From b1d87c23302d62f61d8cf544b2a6a5ede227c6b1 Mon Sep 17 00:00:00 2001 From: Goooler Date: Mon, 27 Feb 2023 07:13:06 +0800 Subject: [PATCH] Replace deprecated ConfigureUtil https://docs.gradle.org/8.0.1/javadoc/org/gradle/util/ConfigureUtil.html --- src/docs/configuration/README.md | 2 +- .../gradle/plugins/shadow/ShadowJavaPlugin.groovy | 2 +- .../plugins/shadow/tasks/DefaultInheritManifest.groovy | 10 +++++----- .../gradle/plugins/shadow/tasks/InheritManifest.groovy | 5 +++-- 4 files changed, 10 insertions(+), 9 deletions(-) diff --git a/src/docs/configuration/README.md b/src/docs/configuration/README.md index 336876584..483518d54 100644 --- a/src/docs/configuration/README.md +++ b/src/docs/configuration/README.md @@ -97,7 +97,7 @@ task testJar(type: Jar) { shadowJar { manifest { - inheritFrom project.tasks.testJar.manifest + inheritFrom(project, project.tasks.testJar.manifest) } } ``` diff --git a/src/main/groovy/com/github/jengelman/gradle/plugins/shadow/ShadowJavaPlugin.groovy b/src/main/groovy/com/github/jengelman/gradle/plugins/shadow/ShadowJavaPlugin.groovy index 22f791066..3808cf75e 100644 --- a/src/main/groovy/com/github/jengelman/gradle/plugins/shadow/ShadowJavaPlugin.groovy +++ b/src/main/groovy/com/github/jengelman/gradle/plugins/shadow/ShadowJavaPlugin.groovy @@ -68,7 +68,7 @@ class ShadowJavaPlugin implements Plugin { } } } - shadow.manifest.inheritFrom project.tasks.jar.manifest + shadow.manifest.inheritFrom(project, project.tasks.jar.manifest) def libsProvider = project.provider { -> [project.tasks.jar.manifest.attributes.get('Class-Path')] } def files = project.objects.fileCollection().from { -> project.configurations.findByName(ShadowBasePlugin.CONFIGURATION_NAME) diff --git a/src/main/groovy/com/github/jengelman/gradle/plugins/shadow/tasks/DefaultInheritManifest.groovy b/src/main/groovy/com/github/jengelman/gradle/plugins/shadow/tasks/DefaultInheritManifest.groovy index a215d49fa..819fd6833 100644 --- a/src/main/groovy/com/github/jengelman/gradle/plugins/shadow/tasks/DefaultInheritManifest.groovy +++ b/src/main/groovy/com/github/jengelman/gradle/plugins/shadow/tasks/DefaultInheritManifest.groovy @@ -1,6 +1,7 @@ package com.github.jengelman.gradle.plugins.shadow.tasks import org.gradle.api.Action +import org.gradle.api.Project import org.gradle.api.internal.file.FileResolver import org.gradle.api.java.archives.Attributes import org.gradle.api.java.archives.Manifest @@ -8,7 +9,6 @@ import org.gradle.api.java.archives.ManifestException import org.gradle.api.java.archives.ManifestMergeSpec import org.gradle.api.java.archives.internal.DefaultManifest import org.gradle.api.java.archives.internal.DefaultManifestMergeSpec -import org.gradle.util.ConfigureUtil class DefaultInheritManifest implements InheritManifest { @@ -23,16 +23,16 @@ class DefaultInheritManifest implements InheritManifest { this.fileResolver = fileResolver } - InheritManifest inheritFrom(Object... inheritPaths) { - inheritFrom(inheritPaths, null) + InheritManifest inheritFrom(Project project, Object... inheritPaths) { + inheritFrom(project, inheritPaths, null) return this } - InheritManifest inheritFrom(Object inheritPaths, Closure closure) { + InheritManifest inheritFrom(Project project, Object inheritPaths, Closure closure) { DefaultManifestMergeSpec mergeSpec = new DefaultManifestMergeSpec() mergeSpec.from(inheritPaths) inheritMergeSpecs.add(mergeSpec) - ConfigureUtil.configure(closure, mergeSpec) + project.configure(mergeSpec, closure) return this } diff --git a/src/main/groovy/com/github/jengelman/gradle/plugins/shadow/tasks/InheritManifest.groovy b/src/main/groovy/com/github/jengelman/gradle/plugins/shadow/tasks/InheritManifest.groovy index e9cdee827..10be50626 100644 --- a/src/main/groovy/com/github/jengelman/gradle/plugins/shadow/tasks/InheritManifest.groovy +++ b/src/main/groovy/com/github/jengelman/gradle/plugins/shadow/tasks/InheritManifest.groovy @@ -1,10 +1,11 @@ package com.github.jengelman.gradle.plugins.shadow.tasks +import org.gradle.api.Project import org.gradle.api.java.archives.Manifest interface InheritManifest extends Manifest { - InheritManifest inheritFrom(Object... inheritPaths) + InheritManifest inheritFrom(Project project, Object... inheritPaths) - InheritManifest inheritFrom(Object inheritPaths, Closure closure) + InheritManifest inheritFrom(Project project, Object inheritPaths, Closure closure) }