Legacy plugin application order breaks shadow detection logic updated for new id
Expected and Results
I expect to be able to upgrade from 8.3.0 to 8.3.1 without errors. Instead, I get this:
* What went wrong:
An exception occurred applying plugin request [id: 'com.gradleup.shadow']
> Failed to apply plugin class 'com.github.jengelman.gradle.plugins.shadow.legacy.LegacyShadowPlugin'.
> Task with name 'shadowJar' not found in project ':minimotd-fabric'.
This is because my plugin quiet-loom is checking for all 3 shadow IDs: https://github.com/jpenilla/quiet-loom/blob/071311814f91e5b1409d5008976968da2dc60180/patches/architectury-loom/0006-Detect-shadowJar.patch
I think this could be fixed by applying the empty legacy plugin after plugins that register the shadowJar task.
Related environent and versions
No response
Reproduction steps
Have logic expecting shadowJar task to be registered inside of a plugins.withId action for the legacy plugin id.
Anything else?
No response
CC @ljacomet
Indeed, I did not think that the empty application would trigger withPlugin before the rest of the com.gradleup.shadow plugin is applied.
I am also thinking that having the new plugin on the classpath should not be transparent if you have the old one as well.
So the solution I would propose:
- Apply that empty plugin at the end
- Add capabilities declaration to the plugin Gradle module metadata declaring it has the capabilities of the older plugins
I should be able to propose a PR doing that over the weekend.