shadow icon indicating copy to clipboard operation
shadow copied to clipboard

Legacy plugin application order breaks shadow detection logic updated for new id

Open jpenilla opened this issue 1 year ago • 2 comments

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

jpenilla avatar Sep 10 '24 20:09 jpenilla

CC @ljacomet

Goooler avatar Sep 11 '24 01:09 Goooler

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.

ljacomet avatar Sep 12 '24 07:09 ljacomet