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
+ }
1
11
2
12
plugins {
3
13
id ' java'
4
14
id ' jacoco'
5
- id ' com.auth0.gradle.oss-library.java'
6
15
id ' checkstyle'
16
+ id ' me.champeau.gradle.japicmp' version ' 0.2.9'
7
17
}
8
18
9
19
sourceSets {
@@ -29,37 +39,69 @@ tasks.named("checkstyleJmh").configure({
29
39
enabled = false
30
40
})
31
41
32
- logger. lifecycle(" Using version ${ version} for ${ group} .${ name} " )
42
+ apply from : rootProject. file(' gradle/versioning.gradle' )
43
+
44
+ version = getVersionFromFile()
45
+ group = GROUP
46
+ logger. lifecycle(" Using version ${ version} for ${ name} group $group " )
33
47
34
- def signingKey = findProperty(' signingKey' )
35
- def signingKeyPwd = findProperty(' signingPassword' )
48
+ import me.champeau.gradle.japicmp.JapicmpTask
36
49
37
- oss {
38
- name " java jwt"
39
- repository " java-jwt"
40
- organization " auth0"
41
- description " Java implementation of JSON Web Token (JWT)"
42
- baselineCompareVersion " 4.1.0"
43
- skipAssertSigningConfiguration true
50
+ project. afterEvaluate {
44
51
45
- developers {
46
- auth0 {
47
- displayName = " Auth0"
48
-
52
+ def versions = project. ext. testInJavaVersions
53
+ for (pluginJavaTestVersion in versions) {
54
+ def taskName = " testInJava-${ pluginJavaTestVersion} "
55
+ tasks. register(taskName, Test ) {
56
+ def versionToUse = taskName. split(" -" ). getAt(1 ) as Integer
57
+ description = " Runs unit tests on Java version ${ versionToUse} ."
58
+ project. logger. quiet(" Test will be running in ${ versionToUse} " )
59
+ group = ' verification'
60
+ javaLauncher. set(javaToolchains. launcherFor {
61
+ languageVersion = JavaLanguageVersion . of(versionToUse)
62
+ })
63
+ shouldRunAfter(tasks. named(' test' ))
49
64
}
50
- lbalmaceda {
51
- displayName = " Luciano Balmaceda"
52
-
65
+ tasks. named(' check' ) {
66
+ dependsOn(taskName)
53
67
}
54
- hzalaz {
55
- displayName = " Hernan Zalazar"
56
-
68
+ }
69
+
70
+ project. configure(project) {
71
+ def baselineVersion = project. ext. baselineCompareVersion
72
+ task(' apiDiff' , type : JapicmpTask , dependsOn : ' jar' ) {
73
+ oldClasspath = files(getBaselineJar(project, baselineVersion))
74
+ newClasspath = files(jar. archiveFile)
75
+ onlyModified = true
76
+ failOnModification = true
77
+ ignoreMissingClasses = true
78
+ htmlOutputFile = file(" $buildDir /reports/apiDiff/apiDiff.html" )
79
+ txtOutputFile = file(" $buildDir /reports/apiDiff/apiDiff.txt" )
80
+ doLast {
81
+ project. logger. quiet(" Comparing against baseline version ${ baselineVersion} " )
82
+ }
83
+ }
84
+ }
85
+ }
86
+
87
+ private static File getBaselineJar (Project project , String baselineVersion ) {
88
+ // Use detached configuration: https://github.com/square/okhttp/blob/master/build.gradle#L270
89
+ def group = project. group
90
+ try {
91
+ def baseline = " ${ project.group} :${ project.name} :$baselineVersion "
92
+ project. group = ' virtual_group_for_japicmp'
93
+ def dependency = project. dependencies. create(baseline + " @jar" )
94
+ return project. configurations. detachedConfiguration(dependency). files. find {
95
+ it. name == " ${ project.name} -${ baselineVersion} .jar"
57
96
}
97
+ } finally {
98
+ project. group = group
58
99
}
59
100
}
60
101
61
- signing {
62
- useInMemoryPgpKeys(signingKey, signingKeyPwd)
102
+ ext {
103
+ baselineCompareVersion = ' 4.1.0'
104
+ testInJavaVersions = [8 , 11 , 17 , 21 ]
63
105
}
64
106
65
107
java {
@@ -198,3 +240,4 @@ tasks.register('jmhHelp', JavaExec) {
198
240
args ' -h'
199
241
}
200
242
243
+ apply from : rootProject. file(' gradle/maven-publish.gradle' )
0 commit comments