Slackbot
07/10/2023, 10:21 PMChris Lee
07/10/2023, 10:46 PMAdrian
07/10/2023, 10:50 PMVampire
07/10/2023, 10:52 PMdependsOn
is almost never the right thing to do, unless "dependent" is a lifecycle task. Instead your should wire task outputs to task inputs and get the necessary task dependencies implicitly automatically.Adrian
07/10/2023, 11:08 PMtasks.register("isCi") {
doLast {
project.layout.buildDirectory.file("IsCi")
.also { outputFile ->
val isCi = isCi(project)
outputFile.get().asFile.writeText(isCi)
task.outputs.file(outputFile)
}
}
}
Vampire
07/11/2023, 2:20 PMisCI
and doing conditional logic depending on it is fine. If your are concerned about doing the calculation multiple times because it is costly, just user a local variable in the build script if once per script is seldom enough, or use a build service if not.
What I meant is, that an explicit dependsOn
is practically always wrong unless you have a lifecycle task on the left-hand side.