-
Notifications
You must be signed in to change notification settings - Fork 186
/
build.gradle
225 lines (197 loc) · 6.3 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
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
plugins {
id "com.github.nbaztec.coveralls-jacoco" version "1.2.14"
id "checkstyle"
id "jacoco"
id "java"
id "maven-publish"
id "signing"
id "eclipse"
id "idea"
}
sourceCompatibility = 1.8
group = "com.box"
archivesBaseName = "box-java-sdk"
version = "4.12.0"
java {
withJavadocJar()
withSourcesJar()
}
repositories {
mavenCentral()
}
sourceSets {
example {
java {
compileClasspath += main.output
runtimeClasspath += main.runtimeClasspath
}
}
intTest {
java {
compileClasspath += sourceSets.main.output
compileClasspath += sourceSets.test.output
runtimeClasspath += sourceSets.main.output
runtimeClasspath += sourceSets.test.output
}
}
}
configurations {
testsCommonImplementation.extendsFrom(implementation)
testImplementation.extendsFrom(testsCommonImplementation)
intTestImplementation.extendsFrom(testsCommonImplementation)
intTestRuntimeOnly.extendsFrom(runtimeOnly)
}
dependencies {
implementation "com.eclipsesource.minimal-json:minimal-json:0.9.5"
implementation "org.bitbucket.b_c:jose4j:0.9.4"
implementation "org.bouncycastle:bcprov-jdk18on:1.78.1"
implementation "org.bouncycastle:bcpkix-jdk18on:1.78.1"
implementation "com.squareup.okhttp3:okhttp:4.12.0"
testsCommonImplementation "junit:junit:4.13.2"
testsCommonImplementation "org.hamcrest:hamcrest-library:2.2"
testsCommonImplementation "org.mockito:mockito-core:4.8.0"
testsCommonImplementation "org.slf4j:slf4j-nop:2.0.3"
testImplementation "com.github.tomakehurst:wiremock:2.27.2"
exampleImplementation "com.eclipsesource.minimal-json:minimal-json:0.9.5"
// this is last version working under java 8
checkstyle "com.puppycrawl.tools:checkstyle:9.3"
}
compileJava {
sourceCompatibility = 1.8
targetCompatibility = 1.8
}
javadoc {
options.windowTitle "Box Java SDK"
options.noQualifiers "all"
options.stylesheetFile file("doc/css/javadoc.css")
options.noTree true
options.noIndex true
options.noHelp true
options.noDeprecatedList true
options.noNavBar true
options.encoding "utf-8"
options.docEncoding "utf-8"
options.charSet "utf-8"
options.linkSource true
options.links "https://docs.oracle.com/javase/8/docs/api/"
}
task runExample(type: JavaExec, dependsOn: "exampleClasses") {
classpath = sourceSets.example.runtimeClasspath
mainClass = "com.box.sdk.example.Main"
}
task runCreateAppUser(type: JavaExec, dependsOn: "exampleClasses") {
classpath = sourceSets.example.runtimeClasspath
mainClass = "com.box.sdk.example.CreateAppUser"
}
task runAccessAsAppUser(type: JavaExec, dependsOn: "exampleClasses") {
classpath = sourceSets.example.runtimeClasspath
mainClass = "com.box.sdk.example.AccessAsAppUser"
}
task integrationTest(type: Test) {
description = "Runs the integration tests."
group = "Verification"
testLogging.showStandardStreams = true
testClassesDirs = sourceSets.intTest.output.classesDirs
classpath = sourceSets.intTest.runtimeClasspath
}
jacoco {
reportsDirectory = file("$buildDir/reports/jacoco")
}
jacocoTestReport {
reports {
xml.required = true // coveralls plugin depends on xml format report
html.required = true
}
}
tasks.withType(JavaCompile) {
options.compilerArgs << "-Xlint:all"
if (project.hasProperty("bootClasspath")) {
String bootClasspathString = project.property("bootClasspath")
String[] bootClasspath = bootClasspathString.split(File.pathSeparator)
options.bootstrapClasspath = files(bootClasspath)
}
}
tasks.withType(Test) {
testLogging {
exceptionFormat = "full"
}
jacoco {
destinationFile = file("$buildDir/jacoco/test.exec")
}
outputs.upToDateWhen { false }
}
tasks.withType(GenerateModuleMetadata) {
enabled = false
}
artifacts {
archives sourcesJar, javadocJar
}
test {
useJUnit {
excludeCategories "com.box.sdk.IntegrationTestJWT"
}
}
checkstyle {
ignoreFailures = false
maxWarnings = 0
}
publishing {
publications {
boxJavaSdk(MavenPublication) {
from components.java
pom {
artifactId = project.getArchivesBaseName()
name = "Box Java SDK"
description = "The Box SDK for Java."
url = "https://opensource.box.com/box-java-sdk/"
packaging = "jar"
licenses {
license {
name = "The Apache License, Version 2.0"
url = "https://www.apache.org/licenses/LICENSE-2.0.txt"
}
}
developers {
developer {
id = "box"
name = "Box"
email = "sdks@box.com"
}
}
scm {
connection = "scm:git:https://github.com/box/box-java-sdk.git"
developerConnection = "scm:git:https://github.com/box/box-java-sdk.git"
url = "https://github.com/box/box-java-sdk"
}
}
}
}
repositories {
maven {
name = "sonatype"
def releasesRepoUrl = "https://oss.sonatype.org/service/local/staging/deploy/maven2/"
def snapshotsRepoUrl = "https://oss.sonatype.org/content/repositories/snapshots/"
url = version.endsWith("SNAPSHOT") ? snapshotsRepoUrl : releasesRepoUrl
if (project.hasProperty("ossrhUsername") && project.hasProperty("ossrhPassword")) {
credentials {
username = ossrhUsername
password = ossrhPassword
}
}
}
}
}
signing {
required { !version.endsWith("SNAPSHOT") && gradle.taskGraph.hasTask("publish") }
// we are switching to gpg-agent and not using Java-based implementation because of
// org.bouncycastle:bc-fips:1.0.2.1 libray preset in our Docker machines which is
// not comaptible with Gradle implementation
useGpgCmd()
sign publishing.publications.boxJavaSdk
}
idea {
module {
sourceDirs -= file("src/intTest/java")
testSourceDirs += file("src/intTest/java")
}
}