1717 * under the License.
1818 */
1919import org.apache.groovy.gradle.ConcurrentExecutionControlBuildService
20- import javax.inject.Inject
20+ import org.apache.tools.ant.taskdefs.condition.Os
2121
2222// Instead of adding to the test sources, this should
2323// be a separate source set so that we can run spec tests in isolation
@@ -34,14 +34,13 @@ sourceSets {
3434
3535tasks. withType(Test ). configureEach {
3636 def fs = objects. newInstance(TestServices ). fileSystemOperations
37- def grapeDirectory = new File (temporaryDir, " grape" )
37+ def grapeDirectory = new File (temporaryDir, ' grape' )
3838 def jdk8 = [' -XX:+UseConcMarkSweepGC' ]
39- def jdk9 = [' -Djava.locale.providers=COMPAT,SPI' ]
40- // def jdk9 = ['-Djava.locale.providers=COMPAT,SPI', '--illegal-access=debug']
41- def common = [' -ea' , " -Xms${ groovyJUnit_ms} " , " -Xmx${ groovyJUnit_mx} " , " -Duser.language=en" ]
39+ def jdk9 = [' -Djava.locale.providers=COMPAT,SPI' /* , '--illegal-access=debug*/ ]
40+ def common = [' -ea' , " -Xms${ groovyJUnit_ms} " , " -Xmx${ groovyJUnit_mx} " , ' -Duser.language=en' ]
4241 if (JavaVersion . current(). isJava9Compatible()) {
4342 jvmArgs(* common, * jdk9)
44- systemProperty " groovy.force.illegal.access" , findProperty(" groovy.force.illegal.access" )
43+ systemProperty ' groovy.force.illegal.access' , findProperty(' groovy.force.illegal.access' )
4544 } else {
4645 jvmArgs(* common, * jdk8)
4746 }
@@ -58,7 +57,8 @@ tasks.withType(Test).configureEach {
5857 if (rootProject. hasProperty(' target.java.home' )) {
5958 String targetJavaHome = rootProject. property(' target.java.home' )?. trim()
6059 if (targetJavaHome) {
61- executable = " ${ targetJavaHome} /bin/java"
60+ executable = [targetJavaHome,' bin' ,' java' ]. join(File . separator)
61+ if (Os . isFamily(Os . FAMILY_WINDOWS )) executable + = ' .exe'
6262 println " Using ${ executable} to run tests"
6363 }
6464 }
@@ -89,7 +89,7 @@ tasks.withType(Test).configureEach {
8989 }
9090 doLast {
9191 fs. delete {
92- delete(files(" . " ). filter { it. name. endsWith ' .class' })
92+ delete(files(' . ' ). filter { it. name. endsWith ' .class' })
9393 }
9494 }
9595}
@@ -116,6 +116,6 @@ Closure buildExcludeFilter(boolean legacyTestSuite) {
116116}
117117
118118interface TestServices {
119- @Inject
119+ @javax.inject. Inject
120120 FileSystemOperations getFileSystemOperations ()
121121}
0 commit comments