groovy-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cchamp...@apache.org
Subject [06/20] groovy git commit: Introduce an indy specific test suite
Date Tue, 12 Dec 2017 22:07:49 GMT
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/29092678
Tree: http://git-wip-us.apache.org/repos/asf/groovy/tree/29092678
Diff: http://git-wip-us.apache.org/repos/asf/groovy/diff/29092678

Branch: refs/heads/GROOVY_2_5_X
Commit: 29092678c71827b68e6d98618cf297f5aa7a97f2
Parents: ad3998d
Author: Cedric Champeau <cchampeau@apache.org>
Authored: Mon Dec 11 10:39:33 2017 +0100
Committer: Cedric Champeau <cchampeau@apache.org>
Committed: Tue Dec 12 22:09:01 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/29092678/gradle/assemble.gradle
----------------------------------------------------------------------
diff --git a/gradle/assemble.gradle b/gradle/assemble.gradle
index ae574e5..f786607 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/29092678/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/29092678/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']
 }
 


Mime
View raw message