Hello, World! I'd like to generate a small file and include it to the common sourceset. In 'normal' (non multiplatform) projects, I have been doing this this way:
Copy code
// Create a Version.kt file and add it to the source set
task generateSources {
def outputDir = file("$buildDir/generated/source/kotlin")
outputs.dir outputDir
doFirst {
def outputWithPackageDir = new File(outputDir, "com/example/mylib")
outputWithPackageDir.mkdirs()
new File(outputWithPackageDir, "Version.kt").write("package com.example.mylib\ninternal const val VERSION = \"$project.version\"")
}
}
compileKotlin.dependsOn generateSources
compileKotlin.source += generateSources.outputs.files
But that doesn't work in my multiplatform module. I've tried to replace