-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.xml
221 lines (200 loc) · 6.8 KB
/
build.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
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
<!--
==================================================
Buildfile for building samples
==================================================
=== NOTE ===
Dear fellow leJOS user: Don't use this build.xml as a template for your
project. Instead, use the org.lejos.example project as a template for
your projects.
^ lolyeah fuck you too lejos.
-->
<project name="NXJ" default="help" basedir=".">
<!-- set properties for this build -->
<property environment="env" />
<property file="build.properties" />
<!-- check whether nxj.home is correct -->
<available file="${nxj.home}/lib/pc" property="lejos.pc.exists" />
<available file="${nxj.home}/lib/nxt" property="lejos.nxt.exists" />
<fail unless="lejos.pc.exists" message="nxj.home variable incorrect, ${nxj.home}/lib/pc does not exist" />
<fail unless="lejos.nxt.exists" message="nxj.home variable incorrect, ${nxj.home}/lib/nxt does not exist" />
<!-- define the search paths -->
<path id="lejos.pc">
<fileset dir="${nxj.home}/lib/pc">
<include name="**/*.jar" />
</fileset>
</path>
<path id="lejos.nxt">
<fileset dir="${nxj.home}/lib/nxt">
<include name="**/*.jar" />
</fileset>
</path>
<condition property="d32Flag" value="-d32" else="-Dblank.dummy.arg=">
<and>
<os family="mac" />
</and>
</condition>
<target name="clean" description="cleans the build folder">
<delete dir="${build.dir}" />
</target>
<target name="compile" description="generate pccomm jar">
<mkdir dir="${classes.dir}" />
<javac
srcdir="${source.dir}"
includes="${source.include}"
excludes="${source.exclude}"
encoding="${source.encoding}"
source="${source.version}"
target="${target.version}"
destdir="${classes.dir}"
debug="true"
includeAntRuntime="false"
includeJavaRuntime="false"
>
<bootclasspath refid="lejos.nxt" />
<!-- enable warnings -->
<compilerarg value="-Xlint:${source.warn}" />
</javac>
</target>
<target name="link" depends="compile">
<java classname="lejos.pc.tools.NXJLink" failonerror="true" outputproperty="linker.output">
<sysproperty key="nxj.home" file="${nxj.home}"/>
<classpath refid="lejos.pc" />
<arg value="--bootclasspath" />
<arg pathref="lejos.nxt" />
<arg value="--classpath" />
<arg path="${classes.dir}" />
<arg value="--writeorder" />
<arg value="LE" />
<arg value="-o" />
<arg file="${output.nxj}" />
<arg value="-od" />
<arg file="${output.nxd}" />
<!-- <arg value="-v" /> -->
<arg value="${main.class}" />
</java>
<echo>${linker.output}</echo>
<echo file="${output.txt}">${linker.output}</echo>
</target>
<target name="debuglink" depends="compile">
<java classname="lejos.pc.tools.NXJLink" failonerror="true" outputproperty="linker.output">
<sysproperty key="nxj.home" file="${nxj.home}"/>
<classpath refid="lejos.pc" />
<arg value="--bootclasspath" />
<arg pathref="lejos.nxt" />
<arg value="--classpath" />
<arg path="${classes.dir}" />
<arg value="--writeorder" />
<arg value="LE" />
<arg value="-o" />
<arg file="${output.nxj}" />
<arg value="-od" />
<arg file="${output.nxd}" />
<arg value="-v" />
<arg value="-gr" />
<arg value="${main.class}" />
</java>
<echo>${linker.output}</echo>
<echo file="${output.txt}">${linker.output}</echo>
</target>
<target name="upload" depends="link">
<java classname="lejos.pc.tools.NXJUpload" fork="true" failonerror="true">
<sysproperty key="nxj.home" file="${nxj.home}"/>
<jvmarg value="${d32Flag}" />
<classpath refid="lejos.pc" />
<arg value="${output.nxj}" />
</java>
</target>
<target name="debugupload" depends="debuglink">
<java classname="lejos.pc.tools.NXJUpload" fork="true" failonerror="true">
<sysproperty key="nxj.home" file="${nxj.home}"/>
<jvmarg value="${d32Flag}" />
<classpath refid="lejos.pc" />
<arg value="${output.nxj}" />
</java>
</target>
<target name="uploadandrun" depends="link">
<java classname="lejos.pc.tools.NXJUpload" fork="true" failonerror="true">
<sysproperty key="nxj.home" file="${nxj.home}"/>
<jvmarg value="${d32Flag}" />
<classpath refid="lejos.pc" />
<arg value="-r" />
<arg file="${output.nxj}" />
</java>
</target>
<target name="debuguploadandrun" depends="debuglink">
<java classname="lejos.pc.tools.NXJUpload" fork="true" failonerror="true">
<sysproperty key="nxj.home" file="${nxj.home}"/>
<jvmarg value="${d32Flag}" />
<classpath refid="lejos.pc" />
<arg value="-r" />
<arg file="${output.nxj}" />
</java>
</target>
<target name="console" depends="debuguploadandrun">
<sleep seconds="4" />
<java classname="lejos.pc.tools.NXJConsole" fork="true" failonerror="true">
<sysproperty key="nxj.home" file="${nxj.home}"/>
<jvmarg value="${d32Flag}" />
<classpath refid="lejos.pc" />
<arg value="-di" />
<arg file="${output.nxd}" />
</java>
</target>
<target name="consoleviewer" depends="debuguploadandrun">
<sleep seconds="4" />
<java classname="lejos.pc.tools.NXJConsoleViewer" fork="true" failonerror="true">
<sysproperty key="nxj.home" file="${nxj.home}"/>
<jvmarg value="${d32Flag}" />
<classpath refid="lejos.pc" />
<arg value="-di" />
<arg file="${output.nxd}" />
</java>
</target>
<target name="debugtool">
<echo>
This tool let's you resolve the numbers displayed by the NXT in
case of an Exception into meaningfull class and method names.
This tool even let's you find out in which line of your program
the Exception happened. Consider the following example:
Exception: 28
at: 20(11)
at: 21(1)
at: 22(9)
In the following, use 28 as the class number, 20 as the method
number, and 11 as the PC value. It will tell you, which
Exception has been thrown, in which method, and in which line.
</echo>
<input
message="Class number:"
addproperty="class"
/>
<input
message="Method number:"
addproperty="method"
/>
<input
message="PC value:"
addproperty="pc"
/>
<java classname="lejos.pc.tools.NXJDebugTool">
<sysproperty key="nxj.home" file="${nxj.home}"/>
<classpath refid="lejos.pc" />
<arg value="-di" />
<arg file="${output.nxd}" />
<arg value="-c" />
<arg value="-m" />
<arg value="${class}" />
<arg value="${method}" />
<arg value="${pc}" />
</java>
</target>
<target name="runonpc" depends="compile">
<fail unless="main.runonpc" message="Code cannot be run on PC" />
<java classname="${main.class}" fork="true" failonerror="true">
<sysproperty key="nxj.home" file="${nxj.home}"/>
<jvmarg value="${d32Flag}" />
<classpath refid="lejos.pc" />
<classpath path="${classes.dir}" />
</java>
</target>
</project>