solenv/ant/aoo-ant.xml |   29 ++++++++++++++++++++++++-----
 1 file changed, 24 insertions(+), 5 deletions(-)

New commits:
commit d29f38a34d65a4a5876e54ad974862997a3e77c3
Author: Damjan Jovanovic <dam...@apache.org>
Date:   Tue Apr 10 16:01:01 2018 +0000

    Check whether JUnit tests are present before trying to compile them.
    
    Patch by: me

diff --git a/solenv/ant/aoo-ant.xml b/solenv/ant/aoo-ant.xml
index 6eda8af41072..3a267edcbebb 100644
--- a/solenv/ant/aoo-ant.xml
+++ b/solenv/ant/aoo-ant.xml
@@ -118,11 +118,30 @@
                includeantruntime="false"/>
     </target>
 
-    <target name="test-compile" depends="compile,idl">
-        <property name="test.skip" value="true" unless:set="OOO_JUNIT_JAR"/>
-        <echo message="No junit, skipping tests" unless:set="OOO_JUNIT_JAR"/>
+    <target name="test-check">
+        <local name="tests.present"/>
+        <available type="dir" file="${test.src.dir}" property="tests.present"/>
+        <echo message="No tests" unless:set="tests.present"/>
+
+        <local name="only.junit.absent"/>
+        <condition property="only.junit.absent">
+            <and>
+                <isset property="tests.present"/>
+                <not><isset property="OOO_JUNIT_JAR"/></not>
+            </and>
+        </condition>
+        <echo message="No junit, skipping tests" if:set="only.junit.absent"/>
+
+        <condition property="test.skip">
+            <or>
+                <not><isset property="test.present"/></not>
+                <not><isset property="OOO_JUNIT_JAR"/></not>
+            </or>
+        </condition>
+    </target>
 
-        <mkdir dir="${test.build.dir}" if:set="OOO_JUNIT_JAR"/>
+    <target name="test-compile" depends="compile,idl,test-check">
+        <mkdir dir="${test.build.dir}" unless:set="test.skip"/>
         <javac srcdir="${test.src.dir}"
                destdir="${test.build.dir}"
                debug="${test.debug}"
@@ -130,7 +149,7 @@
                deprecation="${test.deprecation}"
                classpathref="internal.test.classpath"
                includeantruntime="false"
-               if:set="OOO_JUNIT_JAR"/>
+               unless:set="test.skip"/>
     </target>
 
     <!-- fork="true" is sadly necessary on Ubuntu due to multiple versions of 
junit confusing Ant,
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to