Repository: GradleUp/shadow (kotlin)

Issue:
Apply an empty `com.github.johnrengelman.shadow` plugin to simplfy migration to the new plugin id `com.gradleup.shadow`
### What feature do you want to see added?

With the rename of this plugin, existing build logic that reacts to the application of the `com.github.johnrengelman.shadow` plugin will no longer be executed.

If this plugin was applying an empty plugin with this plugin id, the logic would still be executed since currently `com.gradleup.shadow` is a drop-in replacement for the previous plugin.

The main downside of doing this is that there is no clear path to deprecate and finally remove that behaviour while warning users that may rely on it without realising it as Gradle does not have APIs for this.

### Upstream changes

Gradle will be releasing a version of the `plugin-publish` plugin that accounts for this new plugin id because without it, some plugin publishing opinions are not enforced when applying `shadow`.

### Are you interested in contributing this feature?

If there is agreement to do this, I would be willing to submit a patch for it.

Pull request:
Closes #958 

---

- [x] [CHANGELOG](src/docs/changes/README.md)'s "Unreleased" section has been updated, if applicable.

Patch:
diff --git a/build.gradle b/build.gradle
index 795c4fdda..556a099ff 100644
--- a/build.gradle
+++ b/build.gradle
@@ -59,6 +59,7 @@ tasks.named('shadowJar', ShadowJar) {
     from rootProject.file('LICENSE')
     from rootProject.file('NOTICE')
     enableRelocation true
+    archiveClassifier = ''
 }
 
 tasks.named('ideaModule') {
diff --git a/src/docs/changes/README.md b/src/docs/changes/README.md
index 29410d6a9..f40b72f36 100644
--- a/src/docs/changes/README.md
+++ b/src/docs/changes/README.md
@@ -5,6 +5,9 @@
 
 **Added**
 
+- Apply an empty plugin that has the legacy `com.github.johnrengelman.shadow` plugin ID.
+  This allows existing build logic to keep on reacting to the legacy plugin as the replacement is drop-in currently.
+
 **Changed**
 
 **Fixed**
diff --git a/src/main/groovy/com/github/jengelman/gradle/plugins/shadow/ShadowPlugin.groovy b/src/main/groovy/com/github/jengelman/gradle/plugins/shadow/ShadowPlugin.groovy
index 36ced5f5d..4b2262f97 100644
--- a/src/main/groovy/com/github/jengelman/gradle/plugins/shadow/ShadowPlugin.groovy
+++ b/src/main/groovy/com/github/jengelman/gradle/plugins/shadow/ShadowPlugin.groovy
@@ -1,5 +1,6 @@
 package com.github.jengelman.gradle.plugins.shadow
 
+import com.github.jengelman.gradle.plugins.shadow.legacy.LegacyShadowPlugin
 import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
 import org.gradle.api.Plugin
 import org.gradle.api.Project
@@ -12,6 +13,7 @@ class ShadowPlugin implements Plugin<Project> {
     void apply(Project project) {
         project.with {
             plugins.apply(ShadowBasePlugin)
+            plugins.apply(LegacyShadowPlugin)
             plugins.withType(JavaPlugin) {
                 plugins.apply(ShadowJavaPlugin)
             }
diff --git a/src/main/groovy/com/github/jengelman/gradle/plugins/shadow/legacy/LegacyShadowPlugin.groovy b/src/main/groovy/com/github/jengelman/gradle/plugins/shadow/legacy/LegacyShadowPlugin.groovy
new file mode 100644
index 000000000..e3e69a7ef
--- /dev/null
+++ b/src/main/groovy/com/github/jengelman/gradle/plugins/shadow/legacy/LegacyShadowPlugin.groovy
@@ -0,0 +1,16 @@
+package com.github.jengelman.gradle.plugins.shadow.legacy
+
+import org.gradle.api.Plugin
+import org.gradle.api.Project
+
+/**
+ * Empty plugin to still have the com.github.johnrengelman.shadow plugin applied.
+ *
+ * This allows older build logic to keep on working as if that old plugin ID was applied.
+ */
+class LegacyShadowPlugin implements Plugin<Project> {
+    @Override
+    void apply(Project target) {
+        // Do nothing
+    }
+}
diff --git a/src/main/resources/META-INF/gradle-plugins/com.github.johnrengelman.shadow.properties b/src/main/resources/META-INF/gradle-plugins/com.github.johnrengelman.shadow.properties
new file mode 100644
index 000000000..811cb77da
--- /dev/null
+++ b/src/main/resources/META-INF/gradle-plugins/com.github.johnrengelman.shadow.properties
@@ -0,0 +1,1 @@
+implementation-class=com.github.jengelman.gradle.plugins.shadow.legacy.LegacyShadowPlugin
\ No newline at end of file


Test patch:
diff --git a/src/test/groovy/com/github/jengelman/gradle/plugins/shadow/ShadowPluginSpec.groovy b/src/test/groovy/com/github/jengelman/gradle/plugins/shadow/ShadowPluginSpec.groovy
index f0dc95f42..a19284e5a 100644
--- a/src/test/groovy/com/github/jengelman/gradle/plugins/shadow/ShadowPluginSpec.groovy
+++ b/src/test/groovy/com/github/jengelman/gradle/plugins/shadow/ShadowPluginSpec.groovy
@@ -31,6 +31,7 @@ class ShadowPluginSpec extends PluginSpecification {
 
         then:
         project.plugins.hasPlugin(ShadowPlugin)
+        project.plugins.hasPlugin(com.github.jengelman.gradle.plugins.shadow.legacy.LegacyShadowPlugin)
 
         and:
         assert !project.tasks.findByName('shadowJar')