@@ -4,6 +4,7 @@ plugins {
44 java
55 jacoco
66
7+ id(" me.champeau.jmh" )
78 id(" com.diffplug.spotless" )
89 id(" com.github.spotbugs" )
910 id(" pl.allegro.tech.build.axion-release" )
@@ -15,6 +16,14 @@ repositories {
1516
1617version = rootProject.version
1718
19+ dependencies {
20+ compileOnly(libs.spotbugs.annotations)
21+ testCompileOnly(libs.spotbugs.annotations)
22+ testImplementation(libs.junit.jupiter)
23+ testImplementation(libs.assertj.core)
24+ testRuntimeOnly(libs.junit.launcher)
25+ }
26+
1827java {
1928 toolchain {
2029 languageVersion = JavaLanguageVersion .of(17 )
@@ -32,14 +41,6 @@ tasks.javadoc {
3241 }
3342}
3443
35- dependencies {
36- compileOnly(libs.spotbugs.annotations)
37- testCompileOnly(libs.spotbugs.annotations)
38- testImplementation(libs.junit.jupiter)
39- testImplementation(libs.assertj.core)
40- testRuntimeOnly(libs.junit.launcher)
41- }
42-
4344tasks.named<Test >(" test" ) {
4445 useJUnitPlatform()
4546}
@@ -70,7 +71,6 @@ tasks.check { finalizedBy(tasks.jacocoTestReport) }
7071spotless {
7172 java {
7273 target(" src/**/*.java" )
73-
7474 importOrder()
7575 removeUnusedImports()
7676 googleJavaFormat()
@@ -79,6 +79,21 @@ spotless {
7979
8080spotbugs {
8181 useJavaToolchains = true
82-
8382 omitVisitors = listOf (" FindReturnRef" )
8483}
84+
85+ // dependency configuration to help pull sample bytecode in for testing
86+ val sampleBytecode by configurations.creating {
87+ isTransitive = false
88+ }
89+
90+ // copy sample bytecode jars to a known location for testing/benchmarking
91+ val sampleBytecodeDir = layout.buildDirectory.dir(" sampleBytecode" )
92+ val copySampleBytecode = tasks.register<Copy >(" sampleBytecode" ) {
93+ val versionJarSuffix = " -[0-9.]*\\ .jar$" .toRegex()
94+ rename { name -> name.replace(versionJarSuffix, " .jar" ) }
95+ into(sampleBytecodeDir)
96+ from(sampleBytecode)
97+ }
98+ tasks.test { dependsOn(copySampleBytecode) }
99+ tasks.jmh { dependsOn(copySampleBytecode) }
0 commit comments