0

So my project has a Main.kt file in the sources root. And there is another Main.kt file in a samples folder for a Sample:

+
|-src
   |- commonMain
          |- kotlin
          |     |- Main.kt
          |- Samples
                |- InputSample
                       |- Main.kt

How do I add a gradle task (kotlin dsl or groovy, at least I need the idea) that is called InputSample for example und runs the Main.kt from thee InputSample folder?

EDIT:

I think its something like this in groovy gradle dsl but I dont know how to convert it:

task app2StartScript(type:CreateStartScripts) {
    applicationName = 'app2'
    classpath = jar.outputs.files
    mainClassName = 'com.example.AppMain2'
    outputDir = file('build/bin')
} 
gutenmorgenuhu
  • 2,312
  • 1
  • 19
  • 33
  • Does InputSample Main.kt run a test? Just because if it is it would be eaier to stick to gradle conventions if it is – matt freake Dec 13 '19 at 09:52
  • No. its just a demo I want to ship the Sourcecode with. There are several such demos – gutenmorgenuhu Dec 13 '19 at 09:56
  • Does this answer your question? [proper way to run kotlin application from gradle task](https://stackoverflow.com/questions/39576170/proper-way-to-run-kotlin-application-from-gradle-task) – smac89 Dec 13 '19 at 10:48

0 Answers0