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"
@@ -47,7 +47,7 @@ configurations {
4747 testsCommonImplementation. extendsFrom(implementation)
4848 testImplementation. extendsFrom(testsCommonImplementation)
4949 intTestImplementation. extendsFrom(testsCommonImplementation)
50- intTestRuntimeOnly. extendsFrom(testRuntimeOnly )
50+ intTestRuntimeOnly. extendsFrom(runtimeOnly )
5151}
5252
5353dependencies {
@@ -69,6 +69,8 @@ dependencies {
6969 testRuntimeOnly " org.junit.jupiter:junit-jupiter-engine:5.10.0"
7070 testImplementation " com.github.tomakehurst:wiremock:2.27.2"
7171 exampleImplementation " com.eclipsesource.minimal-json:minimal-json:0.9.5"
72+ // this is last version working under java 8
73+ checkstyle " com.puppycrawl.tools:checkstyle:9.3"
7274}
7375
7476compileJava {
@@ -79,7 +81,7 @@ compileJava {
7981javadoc {
8082 options. windowTitle " Box Java SDK"
8183 options. noQualifiers " all"
82- options. stylesheetFile file(" docs/sdk /css/javadoc.css" )
84+ options. stylesheetFile file(" doc /css/javadoc.css" )
8385 options. noTree true
8486 options. noIndex true
8587 options. noHelp true
@@ -92,140 +94,40 @@ javadoc {
9294 options. links " https://docs.oracle.com/javase/8/docs/api/"
9395}
9496
95- tasks. register(' runExample' , JavaExec ) {
96- dependsOn " exampleClasses"
97+ task runExample (type : JavaExec , dependsOn : " exampleClasses" ) {
9798 classpath = sourceSets. example. runtimeClasspath
9899 mainClass = " com.box.sdk.example.Main"
99100}
100101
101- tasks. register(' runCreateAppUser' , JavaExec ) {
102- dependsOn " exampleClasses"
102+ task runCreateAppUser (type : JavaExec , dependsOn : " exampleClasses" ) {
103103 classpath = sourceSets. example. runtimeClasspath
104104 mainClass = " com.box.sdk.example.CreateAppUser"
105105}
106106
107- tasks. register(' runAccessAsAppUser' , JavaExec ) {
108- dependsOn " exampleClasses"
107+ task runAccessAsAppUser (type : JavaExec , dependsOn : " exampleClasses" ) {
109108 classpath = sourceSets. example. runtimeClasspath
110109 mainClass = " com.box.sdk.example.AccessAsAppUser"
111110}
112111
113- tasks . register( ' integrationTest' , Test ) {
114- description = " Runs the integration tests in com.box.sdk "
112+ task integrationTest ( type : Test ) {
113+ description = " Runs the integration tests. "
115114 group = " Verification"
116115 testLogging. showStandardStreams = true
117116 testClassesDirs = sourceSets. intTest. output. classesDirs
118117 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"
214118}
215119
216120jacoco {
217121 reportsDirectory = file(" $buildDir /reports/jacoco" )
218122}
219123
220124jacocoTestReport {
221- dependsOn test
222125 reports {
223126 xml. required = true // coveralls plugin depends on xml format report
224127 html. required = true
225128 }
226129}
227130
228-
229131tasks. withType(JavaCompile ) {
230132 options. compilerArgs << " -Xlint:all"
231133
@@ -236,10 +138,17 @@ tasks.withType(JavaCompile) {
236138 }
237139}
238140
239- test {
240- useJUnit()
241- }
141+ tasks. withType(Test ) {
142+ testLogging {
143+ exceptionFormat = " full"
144+ }
242145
146+ jacoco {
147+ destinationFile = file(" $buildDir /jacoco/test.exec" )
148+ }
149+
150+ outputs. upToDateWhen { false }
151+ }
243152
244153tasks. withType(GenerateModuleMetadata ) {
245154 enabled = false
@@ -249,10 +158,9 @@ artifacts {
249158 archives sourcesJar, javadocJar
250159}
251160
252- spotless {
253- java {
254- googleJavaFormat " 1.7"
255- target " src/**/*.java"
161+ test {
162+ useJUnit {
163+ excludeCategories " com.box.sdk.IntegrationTestJWT"
256164 }
257165}
258166
@@ -332,4 +240,4 @@ idea {
332240 sourceDirs - = file(" src/intTest/java" )
333241 testSourceDirs + = file(" src/intTest/java" )
334242 }
335- }
243+ }
0 commit comments