Skip to content

Commit

Permalink
Upgrade Gradle and JMH (#1283)
Browse files Browse the repository at this point in the history
JMH configuration is much easier now.
  • Loading branch information
squarejesse authored Jul 7, 2023
1 parent 5f5db4a commit f21714d
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 34 deletions.
1 change: 0 additions & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
3 changes: 1 addition & 2 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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" }
Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -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
31 changes: 1 addition & 30 deletions okio/jvm/jmh/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -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)
}
}

0 comments on commit f21714d

Please sign in to comment.