Establishing task dependencies in a plugin

Thanks, David and Stefan. I tried all of your suggestions and always there was some issue.

If I didn’t do some sort of evaluationDependsOn() then the iron law of alphabetical order always raised its ugly head.
If I did try to set up evaluationDependsOn() then it would at some point be necessary to iterate the subprojects, and there was always an issue there. Circular dependencies. Other error messages.

That is just too hard. We’re swimming up stream. And thinking about it, it should not be the responsibility of the bundler plugin to do this. Perhaps I would need yet another overarching kind of plugin to orchestrate the whole thing. But, too much effort.

And so, I gave up and stopped fighting the framework and just do it from the root build.gradle, which now looks like

// all base build.gradles must supply this.
// it should not be overridden.
ext.baseName ='gvp008'
version '1.0.0'

subprojects { proj ->
    
    proj.version = version
    task hello << { task -> println "I'm $proj.name" }
}

afterEvaluate {
    project(':bundle').evaluationDependsOn(':audio')
    project(':bundle').evaluationDependsOn(':content')
    project(':bundle').evaluationDependsOn(':database')
    project(':bundle').evaluationDependsOn(':grammars')
}

That’s not too bad, really, a small compromise I’m willing to live with.

Now on to the next problem!

No matter what I do, the bundle:bundle task is always UP-TO-DATE. I’ve tried every trick I could find documented (primarily setting outputs.upToDateWhen {false}) at every event I could think of but the closure is never called, The UP-TO-DATE decision has evidently been made “up above, somewhere” and gradle never feels the need to check.

To be discussed.