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