xxfast
02/08/2022, 10:27 PMcommonMain
openApiGenerate {
generatorName.set("kotlin")
library.set("multiplatform")
...
}
By default this task doesn’t dependOn
to run before any build task, so I had to manually do so
tasks.preBuild { dependsOn(tasks.openApiGenerate) }
This works for android
, but for desktop i had to do
tasks.named("compileKotlinDesktop") { dependsOn(tasks.openApiGenerate) }
so forth for all other targets. Is there a common task that I can hook on to instead?ephemient
02/09/2022, 1:36 AMfiles(...).builtBy(...)
) then it all just works automatically and you should not need any explicit task dependenciesephemient
02/09/2022, 1:37 AMephemient
02/09/2022, 1:38 AMxxfast
02/09/2022, 1:40 AMsourceSets {
val commonMain by getting {
// include build open-api definitions
kotlin.srcDir("$buildDir/openapi/src/commonMain")
}
}
doesnt look like task is in the task graph by default 🤔
even the docs say
if you’re generating the code on compile, you can add these as a dependency to or any other existing task…compileJava
Copy codecompileJava.dependsOn buildKotlinClient, tasks.openApiGenerate
xxfast
02/09/2022, 1:41 AMcompileJava
task exist in a multiplatform module, so just wondering if there is an equivalentephemient
02/09/2022, 1:47 AMephemient
02/09/2022, 1:48 AMephemient
02/09/2022, 1:52 AMsrcDir(openApiGenerate.outputDir.flatMap { files(it).builtBy(tasks.openApiGenerate)) })
or something along those linesxxfast
02/09/2022, 5:42 AMxxfast
02/09/2022, 5:42 AMxxfast
02/09/2022, 5:42 AM