Skip to content

Commit 6fa7465

Browse files
committed
[Java] Tests only apply to sbe-tool module.
1 parent 706e690 commit 6fa7465

File tree

1 file changed

+31
-35
lines changed

1 file changed

+31
-35
lines changed

build.gradle

Lines changed: 31 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -145,14 +145,6 @@ subprojects {
145145

146146
jar.enabled = true
147147

148-
dependencies {
149-
testImplementation "org.hamcrest:hamcrest:${hamcrestVersion}"
150-
testImplementation "org.mockito:mockito-junit-jupiter:${mockitoVersion}"
151-
testImplementation "org.junit.jupiter:junit-jupiter-api:${junitVersion}"
152-
testImplementation "org.junit.jupiter:junit-jupiter-params:${junitVersion}"
153-
testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:${junitVersion}"
154-
}
155-
156148
checkstyle.toolVersion = "${checkstyleVersion}"
157149

158150
compileJava {
@@ -164,31 +156,6 @@ subprojects {
164156
options.deprecation = true
165157
}
166158

167-
compileTestJava {
168-
if (JavaVersion.current().ordinal() >= JavaVersion.VERSION_1_9.ordinal()) {
169-
options.compilerArgs.addAll(['--add-exports', 'java.base/java.lang.reflect=ALL-UNNAMED'])
170-
options.compilerArgs.addAll(['--add-exports', 'jdk.unsupported/sun.misc=ALL-UNNAMED'])
171-
}
172-
options.encoding = 'UTF-8'
173-
options.deprecation = true
174-
}
175-
176-
test {
177-
if (JavaVersion.current().ordinal() >= JavaVersion.VERSION_1_9.ordinal()) {
178-
jvmArgs('--add-opens', 'java.base/java.lang.reflect=ALL-UNNAMED')
179-
jvmArgs('--add-exports', 'jdk.unsupported/sun.misc=ALL-UNNAMED')
180-
}
181-
182-
useJUnitPlatform()
183-
184-
testLogging {
185-
showStandardStreams = true
186-
exceptionFormat = 'full'
187-
}
188-
189-
reports.html.enabled = false // Disable individual test reports
190-
}
191-
192159
javadoc {
193160
title = '<h1>Simple Binary Encoding (SBE)</h1>'
194161
options.bottom = '<i>Copyright &#169; 2013-2020 Real Logic Limited. All Rights Reserved.</i>'
@@ -216,6 +183,11 @@ project(':sbe-tool') {
216183
dependencies {
217184
api "org.agrona:agrona:${agronaVersion}"
218185
testImplementation files('build/classes/java/generated')
186+
testImplementation "org.hamcrest:hamcrest:${hamcrestVersion}"
187+
testImplementation "org.mockito:mockito-junit-jupiter:${mockitoVersion}"
188+
testImplementation "org.junit.jupiter:junit-jupiter-api:${junitVersion}"
189+
testImplementation "org.junit.jupiter:junit-jupiter-params:${junitVersion}"
190+
testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:${junitVersion}"
219191
}
220192

221193
sourceSets {
@@ -233,7 +205,31 @@ project(':sbe-tool') {
233205
classpath += sourceSets.main.runtimeClasspath
234206
}
235207

236-
compileTestJava.dependsOn 'compileGeneratedJava'
208+
compileTestJava {
209+
dependsOn 'compileGeneratedJava'
210+
if (JavaVersion.current().ordinal() >= JavaVersion.VERSION_1_9.ordinal()) {
211+
options.compilerArgs.addAll(['--add-exports', 'java.base/java.lang.reflect=ALL-UNNAMED'])
212+
options.compilerArgs.addAll(['--add-exports', 'jdk.unsupported/sun.misc=ALL-UNNAMED'])
213+
}
214+
options.encoding = 'UTF-8'
215+
options.deprecation = true
216+
}
217+
218+
test {
219+
if (JavaVersion.current().ordinal() >= JavaVersion.VERSION_1_9.ordinal()) {
220+
jvmArgs('--add-opens', 'java.base/java.lang.reflect=ALL-UNNAMED')
221+
jvmArgs('--add-exports', 'jdk.unsupported/sun.misc=ALL-UNNAMED')
222+
}
223+
224+
useJUnitPlatform()
225+
226+
testLogging {
227+
showStandardStreams = true
228+
exceptionFormat = 'full'
229+
}
230+
231+
reports.html.enabled = false // Disable individual test reports
232+
}
237233

238234
task generateCodecs(dependsOn: 'compileJava', type: JavaExec) {
239235
main = 'uk.co.real_logic.sbe.SbeTool'
@@ -306,7 +302,7 @@ project(':sbe-all') {
306302
apply plugin: 'com.github.johnrengelman.shadow'
307303

308304
dependencies {
309-
implementation project(':sbe-tool')
305+
compile project(':sbe-tool')
310306
}
311307

312308
task sourcesJar(type: Jar) {

0 commit comments

Comments
 (0)