forked from Robolopes/frc-java-emulator
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfrctest.xml
170 lines (142 loc) · 6.03 KB
/
frctest.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
<project name="frc-test">
<!--
_______ _____ _______
| _____| | _ \ | _____|
| |____ | |_| | | |
| _____| | _ \ | |
| | | | \ \ | |_____ | _ _ |
|_| |_| \_| |_______| —|— |_| |_ —|—
| |_ _| |
_
| | _ _ __ |
—|— |-, _| ,-,-, |_| \ ^ / | | |-, |/
| | |_| | | | |_ \/ \/ |__| | |\
-->
<property name="frctest-folder" value="frctest"/>
<property name="lib-folder" value="${frctest-folder}/lib"/>
<property name="native-lib-folder" location="${frctest-folder}/lib/native"/>
<property name="test-project" value="../frc-java-tests"/>
<property name="test-build.dir" value="${frctest-folder}/unittest-build"/>
<property name="emulator-build.dir" value="${frctest-folder}/emulator-build"/>
<property name="robot-code-jar" value="${frctest-folder}/Robot Code.jar"/>
<!-- assume that the test code is in the same workspace and cloned under the correct name -->
<property name="test-src.dir" value="${test-project}/src"/>
<property name="javassist-jar" value="${lib-folder}/javassist.jar"/>
<property name="guava-jar" value="${lib-folder}/guava-18.0.jar"/>
<property name="reflections-jar" value="${lib-folder}/reflections-0.9.9-RC1.jar"/>
<property name="frctest-jar" value="${lib-folder}/FRC-Test.jar"/>
<property name="junit.jar" value="${lib-folder}/junit.jar"/>
<property name="ant-junit.jar" value="${lib-folder}/ant-junit.jar"/>
<property name="hamcrest.jar" value="${lib-folder}/hamcrest-core-1.3.jar"/>
<property name="javajoystick.jar" value="${lib-folder}/JavaJoystick.jar"/>
<property name="emulatorclasspath" value="${javassist-jar}:${guava-jar}:${reflections-jar}:${frctest-jar}:${javajoystick.jar}:{networktables.jar}"/>
<!-- all of the jars needed to run test mode -->
<property name="testclasspath" value="${emulatorclasspath}:${robot-code-jar}:${junit.jar}:${ant-junit.jar}:${hamcrest.jar}"/>
<target name="test" depends="testcompile">
<junit fork="yes">
<batchtest>
<fileset dir="${test-build.dir}" >
<include name="**/*Test*.class"/>
</fileset>
</batchtest>
<classpath>
<pathelement path="${testclasspath}"/>
<pathelement location="${test-build.dir}"/>
<!-- include resources -->
<pathelement location="${test-project}/src"/>
</classpath>
<sysproperty key="java.library.path" value="${native-lib-folder}"/>
<formatter type="plain" usefile="false" /> <!-- to screen -->
<!--formatter type="xml"/-->
</junit>
<mkdir dir="junit"/>
<!-- junitreport todir="junit">
<fileset dir=".">
<include name="TEST-*.xml" />
</fileset>
<report todir="junit" />
</junitreport-->
</target>
<target name="testdebug" depends="testcompile">
<junit fork="yes">
<batchtest>
<fileset dir="${test-build.dir}" >
<include name="**/*Test*.class"/>
</fileset>
</batchtest>
<classpath>
<pathelement path="${testclasspath}"/>
<pathelement location="${test-build.dir}"/>
<!-- include resources -->
<pathelement location="${test-project}/src"/>
</classpath>
<sysproperty key="java.library.path" value="${native-lib-folder}"/>
<formatter type="plain" usefile="false" /> <!-- to screen -->
<jvmarg value="-Xdebug" />
<jvmarg value="-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5432" />
</junit>
</target>
<target name="emulatordebug" depends="emulatorjar">
<java fork="true" classname="frctest.EmulatorMain">
<classpath>
<pathelement path="${emulatorclasspath}"/>
<pathelement location="${robot-code-jar}"/>
</classpath>
<sysproperty key="java.library.path" value="${native-lib-folder}"/>
<jvmarg value="-Xdebug" />
<jvmarg value="-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5433" />
</java>
</target>
<target name="runemulator" depends="emulatorjar" description="Run the robot emulator.">
<java fork="true" classname="frctest.EmulatorMain">
<classpath>
<pathelement path="${emulatorclasspath}"/>
<pathelement location="${robot-code-jar}"/>
</classpath>
<sysproperty key="java.library.path" value="${native-lib-folder}"/>
</java>
</target>
<target name="emulatorjar" depends="emulatorcompile">
<jar destfile="${robot-code-jar}" update="true">
<fileset dir="${emulator-build.dir}" includes="**/*.class"/>
</jar>
</target>
<target name="testcompile" depends="emulatorjar" description="Compile the test code.">
<mkdir dir="${test-build.dir}"/>
<echo level="info">[FRC-Test] Compiling ${test-src.dir} to ${test-build.dir} using java ${ant.java.version}</echo>
<javac srcdir="${test-src.dir}"
destdir="${test-build.dir}"
includeAntRuntime="no"
includeJavaRuntime="no"
classpath="${testclasspath}"
target="${ant.java.version}"
source="${ant.java.version}"
compiler="javac${ant.java.version}"
debug="true">
</javac>
</target>
<target name="emulatorcompile" description="Compile the source code using the emulator jar.">
<mkdir dir="${emulator-build.dir}"/>
<echo level="info">[FRC-Test] Compiling /${src.dir} to /${emulator-build.dir} using java ${ant.java.version}</echo>
<echo level="info">[FRC-Test] Classpath: ${emulatorclasspath}</echo>
<!-- check javac version, since the Eclipse-included Ant seems to sometimes use an older one-->
<if>
<equals arg1="${ant.java.version}" arg2="1.8"/>
<then>
</then>
<else>
<echo>[FRC-Test] Ant is using an older java version (${ant.java.version}), if the compile fails that's probably why!</echo>
</else>
</if>
<javac srcdir="${src.dir}"
destdir="${emulator-build.dir}"
includeAntRuntime="no"
includeJavaRuntime="no"
classpath="${emulatorclasspath}"
target="${ant.java.version}"
source="${ant.java.version}"
compiler="javac${ant.java.version}"
debug="true">
</javac>
</target>
</project>