/
build.gradle
142 lines (120 loc) · 4.1 KB
/
build.gradle
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
plugins {
id 'java'
id 'jacoco'
id 'com.auth0.gradle.oss-library.java'
}
logger.lifecycle("Using version ${version} for ${group}.${name}")
oss {
name "java jwt"
repository "java-jwt"
organization "auth0"
description "Java implementation of JSON Web Token (JWT)"
baselineCompareVersion "3.18.2"
developers {
auth0 {
displayName = "Auth0"
email = "oss@auth0.com"
}
lbalmaceda {
displayName = "Luciano Balmaceda"
email = "luciano.balmaceda@auth0.com"
}
hzalaz {
displayName = "Hernan Zalazar"
email = "hernan@auth0.com"
}
}
}
java {
toolchain {
languageVersion = JavaLanguageVersion.of(11)
}
}
compileJava {
exclude 'module-info.java'
// Required to be compatible with JDK 8+
options.compilerArgs = ['--release', "8"]
}
javadoc {
// Exclude internal implementation package from javadoc
excludes = ['com/auth0/jwt/impl', 'module-info.java']
}
dependencies {
implementation 'com.fasterxml.jackson.core:jackson-databind:2.13.2'
testImplementation 'org.bouncycastle:bcprov-jdk15on:1.70'
testImplementation 'junit:junit:4.13.2'
testImplementation 'net.jodah:concurrentunit:0.4.6'
testImplementation 'org.hamcrest:hamcrest:2.2'
testImplementation 'org.mockito:mockito-core:4.4.0'
}
jacoco {
toolVersion = "0.8.7"
}
jacocoTestReport {
reports {
xml.enabled = true
html.enabled = true
}
}
test {
testLogging {
events "skipped", "failed", "standardError"
exceptionFormat "short"
}
}
task compileModuleInfoJava(type: JavaCompile) {
classpath = files()
source = 'src/main/java/module-info.java'
destinationDir = compileJava.destinationDir
doLast {
def descriptor = new File(compileJava.destinationDir, 'module-info.class')
def dest = new File(compileJava.destinationDir, 'META-INF/versions/9')
ant.move file: descriptor, todir: dest
}
doFirst {
options.compilerArgs = [
'--release', '9',
'--module-path', compileJava.classpath.asPath
]
}
}
compileTestJava {
options.compilerArgs = ['--release', "8", "-Xlint:deprecation"]
}
def testJava8 = tasks.register('testJava8', Test) {
description = 'Runs unit tests on Java 8.'
group = 'verification'
javaLauncher.set(javaToolchains.launcherFor {
languageVersion = JavaLanguageVersion.of(8)
})
shouldRunAfter(tasks.named('test'))
}
def testJava17 = tasks.register('testJava17', Test) {
description = 'Runs unit tests on Java 17.'
group = 'verification'
javaLauncher.set(javaToolchains.launcherFor {
languageVersion = JavaLanguageVersion.of(17)
})
shouldRunAfter(tasks.named('test'))
//Following Tests are excluded in Java 17 since secp256k1 curve is disabled Java 15+
filter {
excludeTestsMatching "*.jwt.ConcurrentVerifyTest.shouldPassECDSA256KVerificationWithJOSESignature"
excludeTestsMatching "*.jwt.JWTCreatorTest.shouldAddKeyIdIfAvailableFromECDSAKAlgorithms"
excludeTestsMatching "*.jwt.JWTCreatorTest.shouldNotOverwriteKeyIdIfAddedFromECDSAKAlgorithms"
excludeTestsMatching "*.jwt.JWTTest.shouldCreateAnEmptyECDSA256KSignedToken"
excludeTestsMatching "*.jwt.algorithms.ECDSAAlgorithmTest.shouldPassECDSA256KVerificationWithJOSESignature"
excludeTestsMatching "*.jwt.algorithms.ECDSAAlgorithmTest.shouldPassECDSA256KVerificationWithJOSESignatureWithBothKeys"
excludeTestsMatching "*.jwt.algorithms.ECDSAAlgorithmTest.shouldPassECDSA256KVerificationWithProvidedPublicKey"
excludeTestsMatching "*.jwt.ECDSABouncyCastleProviderTests.shouldPassECDSA256KVerificationWithJOSESignatureWithBothKeys"
excludeTestsMatching "*.jwt.ECDSABouncyCastleProviderTests.shouldPassECDSA256KVerificationWithProvidedPublicKey"
}
}
tasks.named('check') {
dependsOn(testJava8)
dependsOn(testJava17)
}
jar {
manifest.attributes('Multi-Release': 'true')
}
compileModuleInfoJava.dependsOn compileJava
classes.dependsOn compileModuleInfoJava