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'
14+ id ' java-library'
315 id ' jacoco'
4- id ' com.auth0 .gradle.oss-library.java '
16+ id ' me.champeau .gradle.japicmp ' version ' 0.4.1 '
517}
618
719repositories {
820 mavenCentral()
921}
1022
11- group ' com.auth0 '
23+ apply from : rootProject . file( ' gradle/versioning.gradle ' )
1224
25+ version = getVersionFromFile()
26+ group = GROUP
1327logger. lifecycle(" Using version ${ version} for ${ name} group $group " )
1428
15- def signingKey = findProperty( ' signingKey ' )
16- def signingKeyPwd = findProperty( ' signingPassword ' )
17-
18- oss {
19- name ' mvc-auth-commons '
20- repository ' auth0-java-mvc-common '
21- organization ' auth0 '
22- description ' Java library that simplifies the use of Auth0 for server-side MVC web apps '
23- baselineCompareVersion ' 1.5.0 '
24- skipAssertSigningConfiguration true
25-
26- developers {
27- auth0 {
28- displayName = ' Auth0 '
29- 29+ import me.champeau.gradle.japicmp.JapicmpTask
30+
31+ project . afterEvaluate {
32+ def versions = project . ext . testInJavaVersions
33+ for (pluginJavaTestVersion in versions) {
34+ def taskName = " testInJava- ${ pluginJavaTestVersion } "
35+ tasks . register(taskName, Test ) {
36+ def versionToUse = taskName . split( " - " ) . getAt( 1 ) as Integer
37+ description = " Runs unit tests on Java version ${ versionToUse } . "
38+ project . logger . quiet( " Test will be running in ${ versionToUse } " )
39+ group = ' verification '
40+ javaLauncher . set(javaToolchains . launcherFor {
41+ languageVersion = JavaLanguageVersion . of(versionToUse)
42+ })
43+ shouldRunAfter(tasks . named( ' test ' ))
3044 }
31- lbalmaceda {
32- displayName = ' Luciano Balmaceda'
33- 45+ tasks. named(' check' ) {
46+ dependsOn(taskName)
47+ }
48+ }
49+
50+ project. configure(project) {
51+ def baselineVersion = project. ext. baselineCompareVersion
52+ task(' apiDiff' , type : JapicmpTask , dependsOn : ' jar' ) {
53+ oldClasspath. from(files(getBaselineJar(project, baselineVersion)))
54+ newClasspath. from(files(jar. archiveFile))
55+ onlyModified = true
56+ failOnModification = true
57+ ignoreMissingClasses = true
58+ htmlOutputFile = file(" $buildDir /reports/apiDiff/apiDiff.html" )
59+ txtOutputFile = file(" $buildDir /reports/apiDiff/apiDiff.txt" )
60+ doLast {
61+ project. logger. quiet(" Comparing against baseline version ${ baselineVersion} " )
62+ }
3463 }
3564 }
3665}
3766
38- signing {
39- useInMemoryPgpKeys(signingKey, signingKeyPwd)
67+ private static File getBaselineJar (Project project , String baselineVersion ) {
68+ // Use detached configuration: https://github.com/square/okhttp/blob/master/build.gradle#L270
69+ def group = project. group
70+ try {
71+ def baseline = " ${ project.group} :${ project.name} :$baselineVersion "
72+ project. group = ' virtual_group_for_japicmp'
73+ def dependency = project. dependencies. create(baseline + " @jar" )
74+ return project. configurations. detachedConfiguration(dependency). files. find {
75+ it. name == " ${ project.name} -${ baselineVersion} .jar"
76+ }
77+ } finally {
78+ project. group = group
79+ }
80+ }
81+
82+ ext {
83+ baselineCompareVersion = ' 1.5.0'
84+ testInJavaVersions = [8 , 11 , 17 , 21 ]
4085}
4186
4287jacocoTestReport {
@@ -91,4 +136,6 @@ dependencies {
91136 testImplementation ' org.junit.jupiter:junit-jupiter:5.8.1'
92137 testImplementation ' org.springframework:spring-test:4.3.14.RELEASE'
93138 testImplementation ' com.squareup.okhttp3:okhttp:4.11.0'
94- }
139+ }
140+
141+ apply from : rootProject. file(' gradle/maven-publish.gradle' )
0 commit comments