root/gs3-extensions/testing/trunk/src/build.xml @ 32694

Revision 32694, 4.6 KB (checked in by ak19, 12 months ago)

Started implementing GSGUITestingUtil.java and simultaneously testing it out. To compile it now needs GLI.jar in classpath which also needs GS3 env script run, so update to build.xml as well.

  • Property svn:executable set to *
Line 
1<?xml version="1.0"?>
2<project name="Greenstone3 Testing Extension" default="build-util-jar" basedir=".">
3 
4  <property environment="env"/> <!-- get properties from the environment -->
5  <property name="compile.includeantruntime" value="false"/> <!-- to get rid of annoying 'ant' warning -->
6
7  <property name="gli.home" value="${env.GSDL3SRCHOME}/gli"/>
8 
9  <target name="build-util-jar" depends="needs-gs3-setup, needs-make-gli-jar">
10    <mkdir dir="${basedir}/build"/>
11    <javac srcdir="${basedir}/src"
12       destdir="${basedir}/build"
13       includeantruntime="${compile.includeantruntime}">
14      <classpath>
15    <fileset dir="${basedir}/lib/java">
16      <include name="*.jar"/>
17    </fileset>
18    <fileset dir="${gli.home}">
19    <include name="GLI.jar"/>
20      </fileset>
21      </classpath>
22      <include name="org/greenstone/gsdl3/testing/*.java"/>         
23    </javac>
24    <jar destfile="${basedir}/lib/java/GSTestingUtil.jar">
25      <fileset dir="${basedir}/build">
26    <include name="org/greenstone/gsdl3/testing/**"/>             
27      </fileset>
28      <manifest>
29    <attribute name="Built-By" value="Greenstone" />
30      </manifest>
31    </jar>
32  </target>
33 
34<!-- +++++++++++++ TUTORIAL TESTING TARGETS ++++++++++++++ -->
35<target name="needs-make-gli-jar"> 
36  <condition property="gli-jar-missing">
37    <not>
38      <available file="${gli.home}/GLI.jar"/>
39    </not>
40    </condition>
41   
42    <fail if="gli-jar-missing" message="Run the makegli followed by makejar scripts in the gli folder before starting the Greenstone server."/>
43</target>
44
45<target name="needs-gs3-setup">
46    <!-- has the gs3-setup script been run?? -->
47    <condition property="gs3-setup-not-done">
48      <not>
49    <isset property="env.GSDL3HOME"/>
50      </not>
51    </condition>
52
53    <fail if="gs3-setup-not-done" message="Please run 'gs3-setup' (Windows) or 'source gs3-setup.sh' (Linux/Mac) before starting the Greenstone server."/>
54
55    <echo>GLI HOME: ${gli.home}</echo>
56  </target>
57
58<target name="compile-tutorials-tests" depends="needs-gs3-setup, needs-make-gli-jar">
59
60  <mkdir dir="${basedir}/build"/>
61  <javac
62      srcdir="${basedir}/src"
63      destdir="${basedir}/build"
64      includeantruntime="${compile.includeantruntime}">
65    <classpath>
66      <fileset dir="${basedir}/lib/java">
67    <include name="*.jar"/>
68      </fileset>
69      <fileset dir="${gli.home}">
70    <include name="GLI.jar"/>
71      </fileset>
72    </classpath>           
73    <include name="gstests/tutorials/*.java"/>
74  </javac>
75  <jar destfile="${basedir}/tutorial-tests.jar">
76    <fileset dir="${basedir}/build">
77      <include name="gstests/tutorials/**"/>
78    </fileset>
79    <manifest>
80      <attribute name="Built-By" value="greenstone" />
81    </manifest>
82  </jar>
83</target>
84
85<!-- https://stackoverflow.com/questions/10704324/how-to-add-to-classpath-all-classes-from-set-of-directories-in-ant -->
86<path id="tutorials.path"> 
87  <fileset dir="${basedir}/lib/java">
88    <include name="*.jar"/>
89  </fileset>
90  <!--<fileset dir="${basedir}/build">     
91    <include name="gstests/tutorials/**/*.class"/>
92  </fileset>-->
93  <files includes="${basedir}/tutorial-tests.jar"/>
94
95  <!-- To run GLI, need GLI.jar and its help jars and folder: classes folder, apache.jar, jna.jar, jna-platform.jar, qfslib.jar, rsyntaxtextarea.jar -->
96  <fileset dir="${gli.home}">
97    <include name="GLI.jar"/>
98  </fileset>
99  <pathelement path="${gli.home}/classes"/>
100  <fileset dir="${gli.home}/lib">
101    <include name="*.jar"/>
102  </fileset> 
103</path>
104
105<!-- TODO: for darwin, need to set custom_vm_args, see gli.sh
106TODO: Launching GLI for GS2 is also different -->
107
108<!-- JUnit must run in GLI folder to mimic how GLI is run.
109     One reason why this is necessary is that GLI then won't display parsing issues with GLI class HelpFrame -->
110<!-- http://ant.1045680.n5.nabble.com/How-to-increase-memory-used-by-JVM-in-Ant-td1355370.html -->
111<target name="run-tutorials-tests" depends="needs-gs3-setup, needs-make-gli-jar">
112  <echo>Tutorial tests</echo>
113  <echo>GSDLHOME: ${env.GSDLHOME}</echo> 
114  <java classname="org.junit.runner.JUnitCore" dir="${gli.home}" fork="true" maxmemory="256m" classpathref="tutorials.path">
115    <!--https://stackoverflow.com/questions/38676719/selenium-using-java-the-path-to-the-driver-executable-must-be-set-by-the-webdr-->
116    <sysproperty key="webdriver.gecko.driver" path="${basedir}/geckodriver"/>
117    <arg value="gstests.tutorials.RunGLITest"/>
118    <!-- TODO: for now hardcoding the GS3 URL. Toplevel build.xml can properly construct this
119     URL, but hard to do so quickly here -->
120    <jvmarg value="-DSERVERURL=http://127.0.0.1:8383/greenstone3/library "/>
121  </java>
122 
123 
124</target>
125
126</project>
127
Note: See TracBrowser for help on using the browser.