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+
12+
113plugins {
214 id ' java'
315 id ' jacoco'
4- id ' com.auth0 .gradle.oss-library.java '
16+ id ' me.champeau .gradle.japicmp ' version ' 0.2.9 '
517}
618
719repositories {
820 mavenCentral()
921}
1022
11- group = ' com.auth0'
12- logger. lifecycle(" Using version ${ version} for ${ name} group $group " )
13-
14- def signingKey = findProperty(' signingKey' )
15- def signingKeyPwd = findProperty(' signingPassword' )
16-
17- oss {
18- name ' auth0'
19- repository ' auth0-java'
20- organization ' auth0'
21- description ' Java client library for the Auth0 platform.'
22- baselineCompareVersion ' 2.0.0'
23- testInJavaVersions = [8 , 11 , 17 ]
24- skipAssertSigningConfiguration true
25-
26- developers {
27- auth0 {
28- displayName = ' Auth0'
29- email = ' oss@auth0.com'
30- }
31- lbalmaceda {
32- displayName = ' Luciano Balmaceda'
33- email = ' luciano.balmaceda@auth0.com'
34- }
35- }
36- }
23+ apply from : rootProject. file(' gradle/versioning.gradle' )
3724
38- signing {
39- useInMemoryPgpKeys(signingKey, signingKeyPwd)
40- }
25+ version = getVersionFromFile()
26+ group = GROUP
27+ logger . lifecycle( " Using version ${ version } for ${ name } group $g roup " )
4128
4229jacocoTestReport {
4330 reports {
@@ -63,6 +50,61 @@ compileTestJava {
6350 options. compilerArgs << " -Xlint:deprecation" << " -Werror"
6451}
6552
53+ import me.champeau.gradle.japicmp.JapicmpTask
54+
55+ project. afterEvaluate {
56+
57+ def versions = project. ext. testInJavaVersions
58+ for (pluginJavaTestVersion in versions) {
59+ def taskName = " testInJava-${ pluginJavaTestVersion} "
60+ tasks. register(taskName, Test ) {
61+ def versionToUse = taskName. split(" -" ). getAt(1 ) as Integer
62+ description = " Runs unit tests on Java version ${ versionToUse} ."
63+ project. logger. quiet(" Test will be running in ${ versionToUse} " )
64+ group = ' verification'
65+ javaLauncher. set(javaToolchains. launcherFor {
66+ languageVersion = JavaLanguageVersion . of(versionToUse)
67+ })
68+ shouldRunAfter(tasks. named(' test' ))
69+ }
70+ tasks. named(' check' ) {
71+ dependsOn(taskName)
72+ }
73+ }
74+
75+ project. configure(project) {
76+ def baselineVersion = project. ext. baselineCompareVersion
77+ task(' apiDiff' , type : JapicmpTask , dependsOn : ' jar' ) {
78+ oldClasspath = files(getBaselineJar(project, baselineVersion))
79+ newClasspath = files(jar. archiveFile)
80+ onlyModified = true
81+ failOnModification = true
82+ ignoreMissingClasses = true
83+ htmlOutputFile = file(" $buildDir /reports/apiDiff/apiDiff.html" )
84+ txtOutputFile = file(" $buildDir /reports/apiDiff/apiDiff.txt" )
85+ doLast {
86+ project. logger. quiet(" Comparing against baseline version ${ baselineVersion} " )
87+ }
88+ }
89+ }
90+ }
91+
92+ private static File getBaselineJar (Project project , String baselineVersion ) {
93+ // Use detached configuration: https://github.com/square/okhttp/blob/master/build.gradle#L270
94+ def group = project. group
95+ try {
96+ def baseline = " ${ project.group} :${ project.name} :$baselineVersion "
97+ project. group = ' virtual_group_for_japicmp'
98+ def dependency = project. dependencies. create(baseline + " @jar" )
99+ return project. configurations. detachedConfiguration(dependency). files. find {
100+ it. name == " ${ project.name} -${ baselineVersion} .jar"
101+ }
102+ } finally {
103+ project. group = group
104+ }
105+ }
106+
107+
66108test {
67109 testLogging {
68110 events " skipped" , " failed"
75117 okhttpVersion = ' 4.11.0'
76118 hamcrestVersion = ' 2.2'
77119 jupiterVersion = ' 5.9.3'
120+
121+ baselineCompareVersion = ' 2.0.0'
122+ testInJavaVersions = [8 , 11 , 17 , 21 ]
78123}
79124
80125dependencies {
@@ -105,3 +150,5 @@ dependencies {
105150 }
106151 }
107152}
153+
154+ apply from : rootProject. file(' gradle/maven-publish.gradle' )
0 commit comments