From ab6ebeaa76e47b3ecf518c8c211ab41dcd85ac2b Mon Sep 17 00:00:00 2001 From: Rafael Winterhalter Date: Mon, 20 Nov 2023 12:41:48 +0100 Subject: [PATCH] Update Gradle version. --- byte-buddy-gradle-plugin/build.gradle | 11 ++++------- .../gradle/verification-metadata.xml | 18 +++++++++--------- .../gradle/wrapper/gradle-wrapper.properties | 6 +++--- .../build/gradle/ByteBuddyPlugin.java | 15 ++++++++++++--- 4 files changed, 28 insertions(+), 22 deletions(-) diff --git a/byte-buddy-gradle-plugin/build.gradle b/byte-buddy-gradle-plugin/build.gradle index d2f9ba4764..dd308fdbc8 100644 --- a/byte-buddy-gradle-plugin/build.gradle +++ b/byte-buddy-gradle-plugin/build.gradle @@ -1,7 +1,7 @@ plugins { id 'java' id 'java-gradle-plugin' - id 'com.gradle.plugin-publish' version '1.0.0' + id 'com.gradle.plugin-publish' version '1.2.1' } if (gradle.gradleVersion.startsWith("2.")) { @@ -60,19 +60,16 @@ tasks.named("jar") { } } -pluginBundle { - website = 'https://bytebuddy.net' - vcsUrl = 'https://github.com/raphw/byte-buddy' - tags = ['Byte Buddy', 'bytecode', 'enhancement'] -} - gradlePlugin { + website.set("https://bytebuddy.net") + vcsUrl.set("https://github.com/raphw/byte-buddy") plugins { byteBuddyPlugin { id = 'net.bytebuddy.byte-buddy-gradle-plugin' implementationClass = 'net.bytebuddy.build.gradle.ByteBuddyPlugin' displayName = 'Byte Buddy Gradle plugin' description = 'The Byte Buddy plugin allows for post processing Java classes with byte code transformation.' + tags.set(['Byte Buddy', 'bytecode', 'enhancement']) } } } diff --git a/byte-buddy-gradle-plugin/gradle/verification-metadata.xml b/byte-buddy-gradle-plugin/gradle/verification-metadata.xml index 39e34ea5b4..a85b266ba1 100644 --- a/byte-buddy-gradle-plugin/gradle/verification-metadata.xml +++ b/byte-buddy-gradle-plugin/gradle/verification-metadata.xml @@ -1,5 +1,5 @@ - + true false @@ -1846,17 +1846,17 @@ - - - + + + - - - + + + - - + + diff --git a/byte-buddy-gradle-plugin/gradle/wrapper/gradle-wrapper.properties b/byte-buddy-gradle-plugin/gradle/wrapper/gradle-wrapper.properties index 2eaf7e9794..30cd5a5316 100644 --- a/byte-buddy-gradle-plugin/gradle/wrapper/gradle-wrapper.properties +++ b/byte-buddy-gradle-plugin/gradle/wrapper/gradle-wrapper.properties @@ -16,9 +16,9 @@ # under the License. distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionSha256Sum=cb87f222c5585bd46838ad4db78463a5c5f3d336e5e2b98dc7c0c586527351c2 -wrapperUrl=https://raw.githubusercontent.com/gradle/gradle/v7.5.0/gradle/wrapper/gradle-wrapper.jar +distributionSha256Sum=3e1af3ae886920c3ac87f7a91f816c0c7c436f276a6eefdb3da152100fef72ae +wrapperUrl=https://raw.githubusercontent.com/gradle/gradle/v8.4.0/gradle/wrapper/gradle-wrapper.jar wrapperHash=91a239400bb638f36a1795d8fdf7939d532cdc7d794d1119b7261aac158b1e60 diff --git a/byte-buddy-gradle-plugin/src/main/java/net/bytebuddy/build/gradle/ByteBuddyPlugin.java b/byte-buddy-gradle-plugin/src/main/java/net/bytebuddy/build/gradle/ByteBuddyPlugin.java index 511b00ffd9..14daa89c84 100644 --- a/byte-buddy-gradle-plugin/src/main/java/net/bytebuddy/build/gradle/ByteBuddyPlugin.java +++ b/byte-buddy-gradle-plugin/src/main/java/net/bytebuddy/build/gradle/ByteBuddyPlugin.java @@ -21,7 +21,6 @@ import org.gradle.api.Plugin; import org.gradle.api.Project; import org.gradle.api.file.SourceDirectorySet; -import org.gradle.api.plugins.Convention; import org.gradle.api.plugins.JavaPlugin; import org.gradle.api.tasks.SourceSet; import org.gradle.api.tasks.SourceSetContainer; @@ -292,20 +291,28 @@ protected static class JavaConventionConfiguration { @MaybeNull private static final Method GET_TARGET_COMPATIBILITY_EXTENSION; + /** + * The {@code org.gradle.api.plugins.Convention#findPlugin(Class)} method or {@code null} if not available. + */ + @MaybeNull + private static final Method FIND_PLUGIN; + /* * Resolves the convention methods which might no longer be supported. */ static { Class javaPluginConvention, javaPluginExtension; - Method getConvention, getExtensions, findByType, getSourceSetsConvention, getSourceSetsExtension, getTargetCompatibilityConvention, getTargetCompatibilityExtension; + Method getConvention, getExtensions, findPlugin, findByType, getSourceSetsConvention, getSourceSetsExtension, getTargetCompatibilityConvention, getTargetCompatibilityExtension; try { javaPluginConvention = Class.forName("org.gradle.api.plugins.JavaPluginConvention"); getConvention = Project.class.getMethod("getConvention"); + findPlugin = Class.forName("org.gradle.api.plugins.Convention").getMethod("findClass", Class.class); getSourceSetsConvention = javaPluginConvention.getMethod("getSourceSets"); getTargetCompatibilityConvention = javaPluginConvention.getMethod("getTargetCompatibility"); } catch (Throwable ignored) { javaPluginConvention = null; getConvention = null; + findPlugin = null; getSourceSetsConvention = null; getTargetCompatibilityConvention = null; } @@ -326,6 +333,7 @@ protected static class JavaConventionConfiguration { JAVA_PLUGIN_EXTENSION = javaPluginExtension; GET_CONVENTION = getConvention; GET_EXTENSIONS = getExtensions; + FIND_PLUGIN = findPlugin; FIND_BY_TYPE = findByType; GET_SOURCE_SETS_CONVENTION = getSourceSetsConvention; GET_SOURCE_SETS_EXTENSION = getSourceSetsExtension; @@ -380,10 +388,11 @@ protected static ByteBuddyPlugin.JavaConventionConfiguration of(Project project) } if (JAVA_PLUGIN_CONVENTION != null && GET_CONVENTION != null + && FIND_PLUGIN != null && GET_SOURCE_SETS_CONVENTION != null && GET_TARGET_COMPATIBILITY_CONVENTION != null) { try { - Object convention = ((Convention) GET_CONVENTION.invoke(project)).findPlugin(JAVA_PLUGIN_CONVENTION); + Object convention = FIND_PLUGIN.invoke(GET_CONVENTION.invoke(project), JAVA_PLUGIN_CONVENTION); if (convention != null) { return new JavaConventionConfiguration( (SourceSetContainer) GET_SOURCE_SETS_CONVENTION.invoke(convention),