use more normal gradle ways for test classpath manipulation

Project: http://git-wip-us.apache.org/repos/asf/incubator-edgent/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-edgent/commit/8e43c24f
Tree: http://git-wip-us.apache.org/repos/asf/incubator-edgent/tree/8e43c24f
Diff: http://git-wip-us.apache.org/repos/asf/incubator-edgent/diff/8e43c24f

Branch: refs/heads/master
Commit: 8e43c24f985664f46891b323a7f1016d1b0ba3eb
Parents: e83f242
Author: Dale LaBossiere <dlab...@us.ibm.com>
Authored: Mon Sep 19 10:10:15 2016 -0400
Committer: Dale LaBossiere <dlab...@us.ibm.com>
Committed: Mon Sep 19 10:10:15 2016 -0400

----------------------------------------------------------------------
 build.gradle | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-edgent/blob/8e43c24f/build.gradle
----------------------------------------------------------------------
diff --git a/build.gradle b/build.gradle
index 2a76996..aae5fe3 100644
--- a/build.gradle
+++ b/build.gradle
@@ -426,12 +426,9 @@ subprojects {
       // The project's tests are supposed to run against its target-dir jar.
       // We must remove the project's $buildDir/{classes,resources}/main
       // from the classpath so they're not used.  
-      // To be safe, just remove any project's {classes,resources}/main from
-      // the test classpath. 
 
       classpath = project.sourceSets.test.runtimeClasspath
-      classpath = classpath.filter { ! ( it.path.endsWith("classes/main")
-                                         || it.path.endsWith("resources/main") 
)} 
+      classpath -= project.sourceSets.main.output
 
       // Hmm... for some reason the classpath (when printed here) also includes
       // the project's src build/libs/ jar and by the default name
@@ -443,7 +440,7 @@ subprojects {
       // Adjust accordingly.
       
       classpath = classpath.filter { ! 
it.path.startsWith(project.libsDir.path) } 
-      classpath = files(project.jar.archivePath) + classpath  // our jar first
+      classpath = files(project.jar.archivePath) + classpath
       logger.debug "$project.path test.classpath: " + classpath.collect { 
it.toString() }
     }
   }

Reply via email to