1+ buildscript {
2+ repositories {
3+ jcenter()
4+ }
5+
6+ dependencies {
7+ // https://github.com/melix/japicmp-gradle-plugin/issues/36
8+ classpath ' com.google.guava:guava:31.1-jre'
9+ }
10+ }
11+
112plugins {
213 id ' java'
314 id ' jacoco'
4- id ' com.auth0 .gradle.oss-library.java '
15+ id ' me.champeau .gradle.japicmp ' version ' 0.2.9 '
516}
617
7- group = ' com.auth0'
8-
9- logger. lifecycle(" Using version ${ version} for ${ name} group $group " )
10-
11- def signingKey = findProperty(' signingKey' )
12- def signingKeyPwd = findProperty(' signingPassword' )
13-
14- oss {
15- name ' jwks-rsa'
16- repository ' jwks-rsa-java'
17- organization ' auth0'
18- description ' JSON Web Key Set parser library'
19- baselineCompareVersion ' 0.15.0'
20- skipAssertSigningConfiguration true
21-
22- developers {
23- auth0 {
24- displayName = ' Auth0'
25- email = ' oss@auth0.com'
26- }
27- lbalmaceda {
28- displayName = ' Luciano Balmaceda'
29- email = ' luciano.balmaceda@auth0.com'
30- }
31- hzalaz {
32- displayName = ' Hernan Zalazar'
33- email = ' hernan@auth0.com'
34- }
35- }
18+ jacoco {
19+ toolVersion = " 0.8.11" // Latest version as of 2025
3620}
3721
38- signing {
39- useInMemoryPgpKeys(signingKey, signingKeyPwd )
22+ repositories {
23+ mavenCentral( )
4024}
4125
26+ apply from : rootProject. file(' gradle/versioning.gradle' )
27+
28+ version = getVersionFromFile()
29+ group = GROUP
30+ logger. lifecycle(" Using version ${ version} for ${ name} group $group " )
31+
4232jacocoTestReport {
4333 reports {
4434 xml. enabled = true
@@ -57,15 +47,70 @@ compileJava {
5747 targetCompatibility ' 1.8'
5848}
5949
50+ import me.champeau.gradle.japicmp.JapicmpTask
51+
52+ project. afterEvaluate {
53+
54+ def versions = project. ext. testInJavaVersions
55+ for (pluginJavaTestVersion in versions) {
56+ def taskName = " testInJava-${ pluginJavaTestVersion} "
57+ tasks. register(taskName, Test ) {
58+ def versionToUse = taskName. split(" -" ). getAt(1 ) as Integer
59+ description = " Runs unit tests on Java version ${ versionToUse} ."
60+ project. logger. quiet(" Test will be running in ${ versionToUse} " )
61+ group = ' verification'
62+ javaLauncher. set(javaToolchains. launcherFor {
63+ languageVersion = JavaLanguageVersion . of(versionToUse)
64+ })
65+ shouldRunAfter(tasks. named(' test' ))
66+ }
67+ tasks. named(' check' ) {
68+ dependsOn(taskName)
69+ }
70+ }
71+
72+ project. configure(project) {
73+ def baselineVersion = project. ext. baselineCompareVersion
74+ task(' apiDiff' , type : JapicmpTask , dependsOn : ' jar' ) {
75+ oldClasspath = files(getBaselineJar(project, baselineVersion))
76+ newClasspath = files(jar. archiveFile)
77+ onlyModified = true
78+ failOnModification = true
79+ ignoreMissingClasses = true
80+ htmlOutputFile = file(" $buildDir /reports/apiDiff/apiDiff.html" )
81+ txtOutputFile = file(" $buildDir /reports/apiDiff/apiDiff.txt" )
82+ doLast {
83+ project. logger. quiet(" Comparing against baseline version ${ baselineVersion} " )
84+ }
85+ }
86+ }
87+ }
88+
89+ private static File getBaselineJar (Project project , String baselineVersion ) {
90+ // Use detached configuration: https://github.com/square/okhttp/blob/master/build.gradle#L270
91+ def group = project. group
92+ try {
93+ def baseline = " ${ project.group} :${ project.name} :$baselineVersion "
94+ project. group = ' virtual_group_for_japicmp'
95+ def dependency = project. dependencies. create(baseline + " @jar" )
96+ return project. configurations. detachedConfiguration(dependency). files. find {
97+ it. name == " ${ project.name} -${ baselineVersion} .jar"
98+ }
99+ } finally {
100+ project. group = group
101+ }
102+ }
103+
60104test {
61105 testLogging {
62106 events " skipped" , " failed"
63107 exceptionFormat " short"
64108 }
65109}
66110
67- repositories {
68- mavenCentral()
111+ ext {
112+ baselineCompareVersion = ' 0.15.0'
113+ testInJavaVersions = [8 , 11 , 17 , 21 ]
69114}
70115
71116dependencies {
@@ -75,8 +120,9 @@ dependencies {
75120 exclude group : " org.mockito" , module : " mockito-core"
76121 }
77122 testImplementation group : ' junit' , name : ' junit' , version :' 4.13.1'
78- testImplementation group : ' org.mockito' , name : ' mockito-core' , version : ' 1.10.19 '
123+ testImplementation " org.mockito: mockito-core:4.8.1 "
79124 testImplementation group : ' org.hamcrest' , name : ' hamcrest-library' , version :' 1.3'
125+
80126}
81127
82128// See https://github.com/google/guava/releases/tag/v32.1.0 for why this is required
0 commit comments