I’m attempting to create a RuleSource plugin that operates on all PrebuiltLibraries. Unfortunately the PrebuiltLibraries don’t seem to be totally populated when my rule is processed.
class PrebuiltBinaryProcessor extends RuleSource {
@Mutate
void processPrebuilts(ModelMap<Task> tasks, Repositories repositories) {
repositories.withType(PrebuiltLibraries)*.each { lib ->
lib.binaries.each { binary ->
// create tasks to operate on prebuilt binaries
}
}
}
}
In this example, the binaries.each loop is a no-op (ie an empty list when the rule is evaluated). If I use binaries.all, the code gets executed as each binary is added. However, at that time tasks is immutable, so I can’t actually add tasks to operate against these binaries.
Is there a way to inject rules after the PrebuiltLibraries have been fully evaluated, but before the tasks container has been finalized?