11plugins {
2- id ' com.github.johnrengelman. shadow' version ' 7.1.2 '
2+ id ' com.gradleup. shadow' version ' 9.4.0 '
33 id " java"
44 id " maven-publish"
55 id " signing"
6- id " org.unbroken-dome.test-sets" version " 4.0.0"
76 id ' me.champeau.gradle.japicmp' version ' 0.4.6' apply false
8- id ' de.undercouch.download' version ' 5.7.0' apply false
7+ id ' de.undercouch.download' version ' 5.7.0' apply false
98}
109
1110import me.champeau.gradle.japicmp.JapicmpTask
@@ -15,14 +14,35 @@ apply plugin: 'de.undercouch.download'
1514description = " BlockHound Java Agent"
1615ext. detailedDescription = " Java agent to detect blocking calls from non-blocking threads."
1716
18- testSets {
17+ sourceSets {
1918 jarFileTest
2019}
2120
22- sourceCompatibility = targetCompatibility = 8
21+ configurations {
22+ jarFileTestImplementation. extendsFrom(testImplementation)
23+ jarFileTestRuntimeOnly. extendsFrom(testRuntimeOnly)
24+ }
25+
26+ task jarFileTest (type : Test ) {
27+ testClassesDirs = sourceSets. jarFileTest. output. classesDirs
28+ classpath = sourceSets. jarFileTest. runtimeClasspath
29+ }
30+
31+ java {
32+ sourceCompatibility = JavaVersion . VERSION_1_8
33+ targetCompatibility = JavaVersion . VERSION_1_8
34+ }
35+
36+ compileJava {
37+ options. release = 8
38+ }
39+
40+ jar {
41+ archiveClassifier. set(' original' )
42+ }
2343
2444shadowJar {
25- classifier = null
45+ archiveClassifier . set( ' ' )
2646
2747 from(" ${ rootDir} /docs/src/docs/dist" ) {
2848 include " LICENSE"
@@ -46,18 +66,29 @@ shadowJar {
4666
4767 // TODO discuss with ByteBuddy folks how to shade it
4868 exclude ' win32-x86*/**'
69+
70+ enableAutoRelocation = true
71+ relocationPrefix = " reactor.blockhound.shaded"
4972}
5073
5174project. tasks. build. dependsOn(shadowJar)
5275
53- task relocateShadowJar (type : com.github.jengelman.gradle.plugins.shadow.tasks.ConfigureShadowRelocation ) {
54- target = tasks. shadowJar
55- prefix = " reactor.blockhound.shaded"
76+ configurations {
77+ apiElements {
78+ outgoing {
79+ artifacts. clear()
80+ artifact(shadowJar)
81+ }
82+ }
83+ runtimeElements {
84+ outgoing {
85+ artifacts. clear()
86+ artifact(shadowJar)
87+ }
88+ }
5689}
5790
58- tasks. shadowJar. dependsOn tasks. relocateShadowJar
59-
60- project. tasks. jarFileTest. configure {
91+ jarFileTest {
6192 systemProperty(" jarFile" , shadowJar. outputs. files. singleFile)
6293 dependsOn(shadowJar)
6394}
@@ -110,7 +141,7 @@ publishing {
110141 artifact sourcesJar
111142 artifact javadocJar
112143
113- artifactId ' blockhound'
144+ artifactId = ' blockhound'
114145 }
115146 }
116147}
@@ -134,15 +165,15 @@ task downloadBaseline(type: Download) {
134165 onlyIfNewer true
135166 compress true
136167 src " ${ repositories.mavenCentral().url} io/projectreactor/tools/blockhound/$compatibleVersion /blockhound-${ compatibleVersion} .jar"
137- dest " ${ buildDir } / baselineLibs/blockhound-${ compatibleVersion} .jar"
168+ dest layout . buildDirectory . file( " baselineLibs/blockhound-${ compatibleVersion} .jar" ) . get() . asFile
138169}
139170
140171def japicmpReport = tasks. register(' japicmpReport' ) {
141172 onlyIf {
142173 japicmp. state. failure != null
143174 }
144175 doLast {
145- def reportFile = file(" ${ project.buildDir } / reports/japi.txt" )
176+ def reportFile = layout . buildDirectory . file(" reports/japi.txt" ). get() . asFile
146177 if (reportFile. exists()) {
147178 println " \n **********************************"
148179 println " * /!\\ API compatibility failures *"
@@ -164,15 +195,15 @@ task japicmp(type: JapicmpTask) {
164195 dependsOn(shadowJar)
165196 onlyIf { " $compatibleVersion " != " SKIP" }
166197
167- oldClasspath. from(files(" ${ buildDir } / baselineLibs/blockhound-${ compatibleVersion} .jar" ))
198+ oldClasspath. from(files(layout . buildDirectory . file( " baselineLibs/blockhound-${ compatibleVersion} .jar" ) . get() . asFile ))
168199 newClasspath. from(files(jar. archiveFile))
169200 // these onlyXxx parameters result in a report that is slightly too noisy, but better than
170201 // onlyBinaryIncompatibleModified = true which masks source-incompatible-only changes
171202 onlyBinaryIncompatibleModified = false
172203 onlyModified = true
173204 failOnModification = true
174205 failOnSourceIncompatibility = true
175- txtOutputFile = file(" ${ project.buildDir } / reports/japi.txt" )
206+ txtOutputFile = layout . buildDirectory . file(" reports/japi.txt" ). get() . asFile
176207 ignoreMissingClasses = true
177208 includeSynthetic = true
178209
0 commit comments