[junitlauncher] Add a check in the build to ensure that the junitlauncher 
classes in "confined" package do not depend on classes they aren't meant to


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

Branch: refs/heads/master
Commit: b3f55a2422173e89deb92e0f417f27a63cb06cf4
Parents: 0cb9d22
Author: Jaikiran Pai <[email protected]>
Authored: Thu Oct 11 15:19:55 2018 +0530
Committer: Jaikiran Pai <[email protected]>
Committed: Mon Oct 29 18:48:37 2018 +0530

----------------------------------------------------------------------
 build.xml | 28 ++++++++++++++++++++++++++++
 1 file changed, 28 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ant/blob/b3f55a24/build.xml
----------------------------------------------------------------------
diff --git a/build.xml b/build.xml
index 543d00e..b34bbca 100644
--- a/build.xml
+++ b/build.xml
@@ -600,6 +600,7 @@
            destdir="${build.classes}"
            debug="${debug}"
            deprecation="${deprecation}"
+           excludes="${optional.package}/junitlauncher/confined/**"
            target="${javac.target}"
            source="${javac.source}"
            optimize="${optimize}">
@@ -639,6 +640,33 @@
       </selector>
     </javac>
 
+    <!-- Builds and verifies that the classes belonging in the confined 
package of
+    junitlauncher task do not depend on classes they aren't meant to -->
+    <!-- first wipe out the "confined" package that might have been built 
already
+     due to the javac above -->
+    <delete 
dir="${build.classes}/${optional.package}/junitlauncher/confined/"/>
+    <javac srcdir="${java.dir}"
+           includeantruntime="false"
+           destdir="${build.classes}"
+           debug="${debug}"
+           deprecation="${deprecation}"
+           includes="${optional.package}/junitlauncher/confined/**"
+           target="${javac.target}"
+           source="${javac.source}"
+           optimize="${optimize}">
+      <classpath>
+        <!-- A very limited classpath which only doesn't include optional 
libraries,
+         which the classes in confined package aren't meant to depend on -->
+        <fileset dir="${build.classes}">
+          <!-- exclude the 
org/apache/tools/ant/taskdefs/optional/junitlauncher package
+          from the classpath, since the confined package isn't meant to depend 
on
+          classes in this package -->
+          <exclude 
name="org/apache/tools/ant/taskdefs/optional/junitlauncher/*"/>
+        </fileset>
+      </classpath>
+
+    </javac>
+
     <copy todir="${build.classes}">
       <fileset dir="${java.dir}">
         <include name="**/*.properties"/>

Reply via email to