Adrian
08/04/2023, 6:06 PMval onlyIf = project.provider {
// Expensive operation we don't want in configuration phase
false
}
val maybePresent = tasks.register("maybePresent") {
val task = this
task.onlyIf { onlyIf.get() }
task.outputs.file(task.project.layout.buildDirectory.file("maybe.yaml"))
doLast {
task.outputs.files.singleFile.writeText("Key:Maybe")
}
}
val resolvable by configurations.creating {
isCanBeResolved = true
}
artifacts.add(resolvable.name, maybePresent) // Is there a way to conditionally add this based on onlyIf?