You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@groovy.apache.org by cc...@apache.org on 2017/12/11 19:25:17 UTC

[03/13] groovy git commit: Introduce an indy specific test suite

Introduce an indy specific test suite

The build now integrates a `testWithIndy` test suite. It is possible to execute both the legacy
and the indy test suites by calling `testAll`.


Project: http://git-wip-us.apache.org/repos/asf/groovy/repo
Commit: http://git-wip-us.apache.org/repos/asf/groovy/commit/88fed129
Tree: http://git-wip-us.apache.org/repos/asf/groovy/tree/88fed129
Diff: http://git-wip-us.apache.org/repos/asf/groovy/diff/88fed129

Branch: refs/heads/master
Commit: 88fed129f7741259de5fc66fcc06148ba791a456
Parents: cb0be34
Author: Cedric Champeau <cc...@apache.org>
Authored: Mon Dec 11 10:39:33 2017 +0100
Committer: Cedric Champeau <cc...@apache.org>
Committed: Mon Dec 11 19:17:11 2017 +0100

----------------------------------------------------------------------
 gradle/assemble.gradle              |  2 +-
 gradle/test.gradle                  | 46 +++++++++++++++++++++++++-------
 subprojects/groovy-sql/build.gradle |  2 +-
 3 files changed, 39 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/groovy/blob/88fed129/gradle/assemble.gradle
----------------------------------------------------------------------
diff --git a/gradle/assemble.gradle b/gradle/assemble.gradle
index 0d6bd78..5f8e5af 100644
--- a/gradle/assemble.gradle
+++ b/gradle/assemble.gradle
@@ -208,7 +208,7 @@ allprojects {
                                 // GROOVY-8332: stop copy of annotation processor which is for some reason included in antlr runtime artifact
                                 // GROOVY-8387: we don't want module-info.class from any dependencies
                                 zipfileset(src: jarjarFile,
-                                        excludes: 'META-INF/maven/commons-cli/commons-cli/*,META-INF/*,META-INF/services/javax.annotation.processing.Processor,module-info.class')
+                                        excludes: 'META-INF/maven/*,META-INF/*,META-INF/services/javax.annotation.processing.Processor,module-info.class')
                             }
 
                             zipfileset(src: configurations.runtime.files.find { file -> file.name.startsWith('asm-util') },

http://git-wip-us.apache.org/repos/asf/groovy/blob/88fed129/gradle/test.gradle
----------------------------------------------------------------------
diff --git a/gradle/test.gradle b/gradle/test.gradle
index e91a9a8..176530d 100644
--- a/gradle/test.gradle
+++ b/gradle/test.gradle
@@ -17,7 +17,7 @@
  *  under the License.
  */
 allprojects {
-    test {
+    tasks.withType(Test) {
         if (JavaVersion.current().isJava8Compatible()) {
             jvmArgs '-ea', "-Xms${groovyJUnit_ms}", "-Xmx${groovyJUnit_mx}"
         } else {
@@ -39,6 +39,27 @@ allprojects {
         }
     }
 
+    // create an Indy test suite
+    if (rootProject.indyCapable()) {
+        def dependencies = configurations.testRuntime.incoming.dependencies.findAll {
+            it.name.startsWith('groovy')
+        }.collect {
+            it.name
+        }
+        task testWithIndy(type: Test) {
+            systemProperties 'groovy.target.indy': true
+            dependsOn 'jarWithIndy'
+            dependencies.each { dependsOn "${it}:jarWithIndy" }
+            classpath = classpath - files(jar.archivePath, *dependencies.collect { project(it).jar }) +
+                    files({ [jarWithIndy.archivePath, *dependencies.collect { project(it).jarWithIndy }] })
+        }
+        task testAll {
+            description = "Runs both the normal and indy test suites"
+            dependsOn test, testWithIndy
+        }
+        check.dependsOn testWithIndy
+    }
+
     sourceSets {
         test {
             groovy {
@@ -51,7 +72,7 @@ allprojects {
     }
 }
 
-test {
+tasks.withType(Test) {
     def testdb = System.properties['groovy.testdb.props']
     if (testdb) {
         systemProperties 'groovy.testdb.props': testdb
@@ -60,7 +81,7 @@ test {
     systemProperties 'gradle.home': gradle.gradleHomeDir // this is needed by the security.policy
 
     classpath = files('src/test') + classpath
-    exclude buildExcludeFilter()
+    exclude buildExcludeFilter(it.name == 'test')
     ext.resultText = ''
     doLast {
         ant.delete {
@@ -83,12 +104,17 @@ tasks.addRule('Pattern: testSingle<Name> will test **/<Name>.class') { String ta
     }
 }
 
-def buildExcludeFilter() {
+def buildExcludeFilter(boolean legacyTestSuite) {
     def excludes = []
 
     // if no network available, disable Grapes
     if (!System.properties['junit.network']) {
-        excludes  << 'groovy/grape/'
+        excludes << 'groovy/grape/'
+    }
+
+    if (legacyTestSuite) {
+        // indy tests will only be executed in indy test suite
+        excludes += ['indy', 'Indy']
     }
 
     return { f ->
@@ -104,7 +130,7 @@ ext.extModuleFixtureDir = file("$projectDir/src/test-fixtures/extmodule")
 ext.extModuleOutputDir = file("$buildDir/testFixtures/extmodule")
 ext.extModuleRepoDir = file("$extModuleOutputDir/repo")
 
-task compileTestExtensionModule(type:JavaCompile) {
+task compileTestExtensionModule(type: JavaCompile) {
     classpath = files(jar.archivePath)
     source fileTree("$extModuleFixtureDir/src/main/java")
     destinationDir = file("$extModuleOutputDir/classes")
@@ -112,7 +138,7 @@ task compileTestExtensionModule(type:JavaCompile) {
     targetCompatibility = 1.6
 }
 
-task testExtensionModuleJar(type:Jar) {
+task testExtensionModuleJar(type: Jar) {
     description = 'Builds a sample extension module used in tests'
     dependsOn compileTestExtensionModule
     baseName = 'module-test'
@@ -123,5 +149,7 @@ task testExtensionModuleJar(type:Jar) {
     destinationDir = file("$extModuleRepoDir/jars/module-test/module-test/${version}")
 }
 
-test.dependsOn(testExtensionModuleJar)
-test.classpath += files(extModuleRepoDir)
+tasks.withType(Test) {
+    dependsOn(testExtensionModuleJar)
+    classpath += files(extModuleRepoDir)
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/groovy/blob/88fed129/subprojects/groovy-sql/build.gradle
----------------------------------------------------------------------
diff --git a/subprojects/groovy-sql/build.gradle b/subprojects/groovy-sql/build.gradle
index 27498ae..6c911a5 100644
--- a/subprojects/groovy-sql/build.gradle
+++ b/subprojects/groovy-sql/build.gradle
@@ -29,7 +29,7 @@ dependencies {
 sourceSets.test.runtimeClasspath += files('src/test/groovy')
 
 // TODO move to parent build.gradle subprojects
-test {
+tasks.withType(Test) {
     excludes = ['**/*TestCase.class', '**/*$*.class']
 }