-
Notifications
You must be signed in to change notification settings - Fork 919
/
build.gradle
189 lines (155 loc) · 4.32 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
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
plugins {
id 'java'
id 'jacoco'
id 'com.auth0.gradle.oss-library.java'
id 'checkstyle'
}
sourceSets {
jmh {
}
}
configurations {
jmhImplementation {
extendsFrom implementation
}
}
checkstyle {
toolVersion '10.0'
}
//We are disabling lint checks for tests
tasks.named("checkstyleTest").configure({
enabled = false
})
tasks.named("checkstyleJmh").configure({
enabled = false
})
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 "4.1.0"
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.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.14.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'
jmhImplementation sourceSets.main.output
jmhImplementation 'org.openjdk.jmh:jmh-core:1.35'
jmhAnnotationProcessor 'org.openjdk.jmh:jmh-generator-annprocess:1.35'
}
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.release = 8
options.compilerArgs = ["-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'))
}
tasks.named('check') {
dependsOn(testJava8)
dependsOn(testJava17)
}
jar {
manifest.attributes('Multi-Release': 'true')
}
compileModuleInfoJava.dependsOn compileJava
classes.dependsOn compileModuleInfoJava
// Creates a version.txt file containing the current version of the SDK.
// This file is picked up and parsed by our Ship Orb to determine the version.
task exportVersion() {
doLast {
new File(rootDir, "version.txt").text = "$version"
}
}
// you can pass any arguments JMH accepts via Gradle args.
// Example: ./gradlew runJMH --args="-lrf"
tasks.register('runJMH', JavaExec) {
description 'Run JMH benchmarks.'
group 'verification'
main 'org.openjdk.jmh.Main'
classpath sourceSets.jmh.runtimeClasspath
args project.hasProperty("args") ? project.property("args").split() : ""
}
tasks.register('jmhHelp', JavaExec) {
description 'Prints the available command line options for JMH.'
group 'help'
main 'org.openjdk.jmh.Main'
classpath sourceSets.jmh.runtimeClasspath
args '-h'
}