Skip to content

Commit

Permalink
Apply legacy plugin (#960)
Browse files Browse the repository at this point in the history
Co-authored-by: Zongle Wang <[email protected]>
  • Loading branch information
ljacomet and Goooler authored Sep 10, 2024
1 parent 4105769 commit 6c229f8
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 0 deletions.
1 change: 1 addition & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ tasks.named('shadowJar', ShadowJar) {
from rootProject.file('LICENSE')
from rootProject.file('NOTICE')
enableRelocation true
archiveClassifier = ''
}

tasks.named('ideaModule') {
Expand Down
3 changes: 3 additions & 0 deletions src/docs/changes/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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**
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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)
}
Expand Down
Original file line number Diff line number Diff line change
@@ -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
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
implementation-class=com.github.jengelman.gradle.plugins.shadow.legacy.LegacyShadowPlugin
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down

0 comments on commit 6c229f8

Please sign in to comment.