Slackbot
06/01/2023, 10:13 PMVampire
06/01/2023, 10:17 PMif (condition) { register artifact }
?Matthew Moran
06/01/2023, 10:40 PMvoid apply(Project project) {
//... register tasks etc
project.artifacts.add('archives', new File("path-to-file.tar.gz"))
}
Since my condition is based on the user defined extension dsl, I set the default value:
extension.source.convention('DEFAULT')
If I wrap project.artifacts.add(...)
in a condition such as if (extension.source.get() != 'DEFAULT')
the condition fails.
However, I think I solved my issue with
project.afterEvaluate {
if (extension.source.get() != 'DEFAULT') {
project.artifacts.add('archives', new File("path-to-file.tar.gz"))
}
}
Vampire
06/01/2023, 10:42 PMafterEvaluate
is never a solution. It sometimes is doing symptom treatment, most often is just a lazy workaround, and always introduces timing and order problems.Vampire
06/01/2023, 10:43 PMMatthew Moran
06/01/2023, 10:43 PMMatthew Moran
06/01/2023, 10:44 PMVampire
06/01/2023, 10:45 PM