From f21714d492f054ae689b455284816721498775eb Mon Sep 17 00:00:00 2001 From: Jesse Wilson Date: Fri, 7 Jul 2023 07:38:52 -0400 Subject: [PATCH] Upgrade Gradle and JMH (#1283) JMH configuration is much easier now. --- build.gradle.kts | 1 - gradle/libs.versions.toml | 3 +-- gradle/wrapper/gradle-wrapper.properties | 2 +- okio/jvm/jmh/build.gradle.kts | 31 +----------------------- 4 files changed, 3 insertions(+), 34 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index 79c7a7b6da..cfe61a28fa 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -21,7 +21,6 @@ buildscript { dependencies { classpath(libs.android.gradle.plugin) classpath(libs.dokka) - classpath(libs.shadow) classpath(libs.jmh.gradle.plugin) classpath(libs.binaryCompatibilityValidator) classpath(libs.spotless) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index d4580569a1..a3643a9709 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -11,11 +11,10 @@ binaryCompatibilityValidator = { module = "org.jetbrains.kotlinx.binary-compatib kotlin-test = { module = "org.jetbrains.kotlin:kotlin-test" } kotlin-test-junit = { module = "org.jetbrains.kotlin:kotlin-test-junit" } kotlin-time = { module = "org.jetbrains.kotlinx:kotlinx-datetime", version = "0.4.0" } -jmh-gradle-plugin = { module = "me.champeau.gradle:jmh-gradle-plugin", version = "0.5.3" } +jmh-gradle-plugin = { module = "me.champeau.jmh:jmh-gradle-plugin", version = "0.7.1" } jmh-core = { module = "org.openjdk.jmh:jmh-core", version.ref = "jmh" } jmh-generator = { module = "org.openjdk.jmh:jmh-generator-annprocess", version.ref = "jmh" } dokka = { module = "org.jetbrains.dokka:dokka-gradle-plugin", version = "1.8.20" } -shadow = { module = "gradle.plugin.com.github.johnrengelman:shadow", version = "7.1.2" } spotless = { module = "com.diffplug.spotless:spotless-plugin-gradle", version = "6.19.0" } bnd = { module = "biz.aQute.bnd:biz.aQute.bnd.gradle", version = "6.4.0" } vanniktech-publish-plugin = { module = "com.vanniktech:gradle-maven-publish-plugin", version = "0.25.3" } diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 4e86b92707..a363877439 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.2-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.2-bin.zip networkTimeout=10000 zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/okio/jvm/jmh/build.gradle.kts b/okio/jvm/jmh/build.gradle.kts index 20106b3bb7..0e9c04b7d0 100644 --- a/okio/jvm/jmh/build.gradle.kts +++ b/okio/jvm/jmh/build.gradle.kts @@ -1,41 +1,12 @@ -import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar -import com.github.jengelman.gradle.plugins.shadow.transformers.DontIncludeResourceTransformer -import com.github.jengelman.gradle.plugins.shadow.transformers.IncludeResourceTransformer - plugins { - id("java-library") kotlin("jvm") - id("com.github.johnrengelman.shadow") - id("me.champeau.gradle.jmh") + id("me.champeau.jmh") } jmh { - jvmArgs = listOf("-Djmh.separateClasspathJAR=true") - include = listOf("""com\.squareup\.okio\.benchmarks\.MessageDigestBenchmark.*""") - duplicateClassesStrategy = DuplicatesStrategy.WARN } dependencies { api(projects.okio) api(libs.jmh.core) - jmh(projects.okio) { targetConfiguration = "jvmRuntimeElements" } - jmh(libs.jmh.core) - jmh(libs.jmh.generator) -} - -tasks { - val jmhJar by getting(ShadowJar::class) { - transform(DontIncludeResourceTransformer().apply { - resource = "META-INF/BenchmarkList" - }) - - transform(IncludeResourceTransformer().apply { - resource = "META-INF/BenchmarkList" - file = file("${project.buildDir}/jmh-generated-resources/META-INF/BenchmarkList") - }) - } - - val assemble by getting { - dependsOn(jmhJar) - } }