11plugins {
22 id " com.github.nbaztec.coveralls-jacoco" version " 1.2.14"
3- id " com.diffplug.spotless " version " 6.2.0 "
3+ id " checkstyle "
44 id " jacoco"
55 id " java"
66 id " maven-publish"
77 id " signing"
88 id " eclipse"
99 id " idea"
1010 id ' org.jreleaser' version ' 1.18.0'
11- id " org.gradle.test-retry" version " 1.5.6"
1211}
1312
1413sourceCompatibility = 1.8
@@ -47,28 +46,24 @@ configurations {
4746 testsCommonImplementation. extendsFrom(implementation)
4847 testImplementation. extendsFrom(testsCommonImplementation)
4948 intTestImplementation. extendsFrom(testsCommonImplementation)
50- intTestRuntimeOnly. extendsFrom(testRuntimeOnly )
49+ intTestRuntimeOnly. extendsFrom(runtimeOnly )
5150}
5251
5352dependencies {
5453 implementation " com.eclipsesource.minimal-json:minimal-json:0.9.5"
55- implementation " com.fasterxml.jackson.core:jackson-annotations:2.17.2"
56- implementation " com.fasterxml.jackson.core:jackson-core:2.17.2"
57- implementation " com.fasterxml.jackson.core:jackson-databind:2.17.2"
5854 implementation " org.bitbucket.b_c:jose4j:0.9.4"
5955 implementation " org.bouncycastle:bcprov-jdk18on:1.78.1"
6056 implementation " org.bouncycastle:bcpkix-jdk18on:1.78.1"
6157 implementation " com.squareup.okhttp3:okhttp:4.12.0"
6258 implementation " com.github.luben:zstd-jni:1.5.7-2"
6359 testsCommonImplementation " junit:junit:4.13.2"
64- testsCommonImplementation " org.junit.jupiter:junit-jupiter-api:5.10.0"
6560 testsCommonImplementation " org.hamcrest:hamcrest-library:2.2"
6661 testsCommonImplementation " org.mockito:mockito-core:4.8.0"
6762 testsCommonImplementation " org.slf4j:slf4j-nop:2.0.3"
68- testRuntimeOnly " org.junit.vintage:junit-vintage-engine:5.10.0"
69- testRuntimeOnly " org.junit.jupiter:junit-jupiter-engine:5.10.0"
7063 testImplementation " com.github.tomakehurst:wiremock:2.27.2"
7164 exampleImplementation " com.eclipsesource.minimal-json:minimal-json:0.9.5"
65+ // this is last version working under java 8
66+ checkstyle " com.puppycrawl.tools:checkstyle:9.3"
7267}
7368
7469compileJava {
@@ -79,7 +74,7 @@ compileJava {
7974javadoc {
8075 options. windowTitle " Box Java SDK"
8176 options. noQualifiers " all"
82- options. stylesheetFile file(" docs/sdk /css/javadoc.css" )
77+ options. stylesheetFile file(" doc /css/javadoc.css" )
8378 options. noTree true
8479 options. noIndex true
8580 options. noHelp true
@@ -92,140 +87,40 @@ javadoc {
9287 options. links " https://docs.oracle.com/javase/8/docs/api/"
9388}
9489
95- tasks. register(' runExample' , JavaExec ) {
96- dependsOn " exampleClasses"
90+ task runExample (type : JavaExec , dependsOn : " exampleClasses" ) {
9791 classpath = sourceSets. example. runtimeClasspath
9892 mainClass = " com.box.sdk.example.Main"
9993}
10094
101- tasks. register(' runCreateAppUser' , JavaExec ) {
102- dependsOn " exampleClasses"
95+ task runCreateAppUser (type : JavaExec , dependsOn : " exampleClasses" ) {
10396 classpath = sourceSets. example. runtimeClasspath
10497 mainClass = " com.box.sdk.example.CreateAppUser"
10598}
10699
107- tasks. register(' runAccessAsAppUser' , JavaExec ) {
108- dependsOn " exampleClasses"
100+ task runAccessAsAppUser (type : JavaExec , dependsOn : " exampleClasses" ) {
109101 classpath = sourceSets. example. runtimeClasspath
110102 mainClass = " com.box.sdk.example.AccessAsAppUser"
111103}
112104
113- tasks . register( ' integrationTest' , Test ) {
114- description = " Runs the integration tests in com.box.sdk "
105+ task integrationTest ( type : Test ) {
106+ description = " Runs the integration tests. "
115107 group = " Verification"
116108 testLogging. showStandardStreams = true
117109 testClassesDirs = sourceSets. intTest. output. classesDirs
118110 classpath = sourceSets. intTest. runtimeClasspath
119- useJUnitPlatform()
120- include ' **/com/box/sdk/**'
121- retry {
122- maxRetries = 2
123- failOnPassedAfterRetry = false
124- }
125- }
126-
127- tasks. register(' integrationTestGen' , Test ) {
128- description = " Runs integration tests in com.box.sdkgen"
129- group = " Verification"
130- testLogging. showStandardStreams = true
131- testClassesDirs = sourceSets. intTest. output. classesDirs
132- classpath = sourceSets. intTest. runtimeClasspath
133- useJUnitPlatform()
134- include ' **/com/box/sdkgen/**'
135- retry {
136- maxRetries = 2
137- failOnPassedAfterRetry = false
138- }
139-
140- filter {
141- // Socket timeout
142- excludeTestsMatching ' com.box.sdkgen.transfer.TransferITest.testTransferUserContent'
143- }
144-
145- testLogging {
146- events = [' passed' , ' failed' , ' skipped' ]
147- showStandardStreams = true
148- }
149- }
150-
151- tasks. register(' smokeTest' , Test ) {
152- description = " Runs smoke integration tests in com.box.sdk"
153- group = " Verification"
154- testLogging. showStandardStreams = true
155- testClassesDirs = sourceSets. intTest. output. classesDirs
156- classpath = sourceSets. intTest. runtimeClasspath
157- useJUnitPlatform()
158-
159- filter {
160- includeTestsMatching ' com.box.sdk.BoxAPIConnectionIT'
161- includeTestsMatching ' com.box.sdk.BoxFileIT'
162- }
163-
164- retry {
165- maxRetries = 2
166- failOnPassedAfterRetry = false
167- }
168- }
169-
170- tasks. register(' smokeTestGen' , Test ) {
171- description = " Runs integration tests in com.box.sdkgen"
172- group = " Verification"
173- testLogging. showStandardStreams = true
174- testClassesDirs = sourceSets. intTest. output. classesDirs
175- classpath = sourceSets. intTest. runtimeClasspath
176- useJUnitPlatform()
177- include ' **/com/box/sdkgen/**'
178- retry {
179- maxRetries = 2
180- failOnPassedAfterRetry = false
181- }
182-
183- filter {
184- includeTestsMatching ' com.box.sdkgen.auth.AuthITest'
185- includeTestsMatching ' com.box.sdkgen.files.FilesITest'
186- includeTestsMatching ' com.box.sdkgen.uploads.UploadsITest'
187- includeTestsMatching ' com.box.sdkgen.downloads.DownloadsITest'
188- }
189-
190- testLogging {
191- events = [' passed' , ' failed' , ' skipped' ]
192- showStandardStreams = true
193- }
194- }
195-
196- tasks. withType(Test ) {
197- testLogging {
198- exceptionFormat = " full"
199- }
200-
201- jacoco {
202- destinationFile = file(" $buildDir /jacoco/test.exec" )
203- }
204-
205- outputs. upToDateWhen { false }
206- }
207-
208-
209- // Combined task to run both sets
210- tasks. register(' integrationTestsAll' ) {
211- dependsOn[' integrationTest' , ' integrationTestGen' ]
212- description = " Runs all integration tests"
213- group = " Verification"
214111}
215112
216113jacoco {
217114 reportsDirectory = file(" $buildDir /reports/jacoco" )
218115}
219116
220117jacocoTestReport {
221- dependsOn test
222118 reports {
223119 xml. required = true // coveralls plugin depends on xml format report
224120 html. required = true
225121 }
226122}
227123
228-
229124tasks. withType(JavaCompile ) {
230125 options. compilerArgs << " -Xlint:all"
231126
@@ -236,10 +131,17 @@ tasks.withType(JavaCompile) {
236131 }
237132}
238133
239- test {
240- useJUnit()
241- }
134+ tasks. withType(Test ) {
135+ testLogging {
136+ exceptionFormat = " full"
137+ }
242138
139+ jacoco {
140+ destinationFile = file(" $buildDir /jacoco/test.exec" )
141+ }
142+
143+ outputs. upToDateWhen { false }
144+ }
243145
244146tasks. withType(GenerateModuleMetadata ) {
245147 enabled = false
@@ -249,10 +151,9 @@ artifacts {
249151 archives sourcesJar, javadocJar
250152}
251153
252- spotless {
253- java {
254- googleJavaFormat " 1.7"
255- target " src/**/*.java"
154+ test {
155+ useJUnit {
156+ excludeCategories " com.box.sdk.IntegrationTestJWT"
256157 }
257158}
258159
@@ -332,4 +233,4 @@ idea {
332233 sourceDirs - = file(" src/intTest/java" )
333234 testSourceDirs + = file(" src/intTest/java" )
334235 }
335- }
236+ }
0 commit comments