forked from AgileManufacturing/HUniversal-Production-Utrecht
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.xml
210 lines (208 loc) · 7.49 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
<?xml version="1.0" encoding="UTF-8"?>
<project name="REXOS" default="all" basedir="">
<property name="rexos-src-folder" value="${basedir}/src/REXOS/" />
<property name="rexos-java-root" value="${rexos-src-folder}" />
<property name="buildpath" value="${repo-root}/build/REXOS/" />
<property environment="env" />
<taskdef resource="net/sf/antcontrib/antcontrib.properties">
<classpath>
<pathelement location="${rexos-src-folder}/external_libraries/ant-contrib.jar" />
</classpath>
</taskdef>
<!-- @Author: Lars Veenendaal -->
<!-- Attempting to rewrite ant configuration. -->
<!-- Because a missing feature in ant 1.8 i have to set this for all javac calls -->
<presetdef name="rexos.javac">
<javac includeantruntime="false">
<classpath refid="master-classpath" />
</javac>
</presetdef>
<!-- Macro for the following things:
- load current classpath
- echo the current building dir
- make the bin directory
- running javac command using the classpath
- adding currently build source to the classpath
-->
<path id="master-classpath">
<fileset dir="${rexos-src-folder}/external_libraries/">
<include name="*.jar" />
</fileset>
</path>
<target name="all" depends="MAS, HAL, generic, util,scada, generate-all" />
<target name="MAS" depends="util, generic, HAL, scada">
<mkdir dir="build/REXOS/MAS" />
<rexos.javac destdir="build/REXOS">
<src path="${rexos-src-folder}/MAS" />
</rexos.javac>
</target>
<target name="HAL" depends="util, generic">
<mkdir dir="build/REXOS/HAL" />
<rexos.javac destdir="build/REXOS">
<src path="${rexos-src-folder}/HAL" />
</rexos.javac>
</target>
<target name="generic">
<mkdir dir="build/REXOS/generic" />
<rexos.javac destdir="build/REXOS">
<src path="${rexos-src-folder}/generic" />
</rexos.javac>
</target>
<target name="scada" depends="">
<mkdir dir="build/REXOS/SCADA" />
<rexos.javac destdir="build/REXOS">
<src path="${rexos-src-folder}/MAS" />
<src path="${rexos-src-folder}/SCADA" />
</rexos.javac>
</target>
<target name="util">
<mkdir dir="build/REXOS/util" />
<rexos.javac destdir="build/REXOS">
<src path="${rexos-src-folder}/util" />
</rexos.javac>
</target>
<target name="MASSIM">
<mkdir dir="simulation" />
<rexos.javac destdir="build">
<src path="${rexos-src-folder}/simulation" />
</rexos.javac>
</target>
<target name="emurex">
<jar destfile="simulation/simulation.jar" basedir="build/REXOS/" includes="**" excludes="**/Test.class" />
</target>
<target name="clean">
<delete file="${export-classpath-file}" />
<delete dir="build" />
</target>
<target name="generate-all" depends="generate-HAL, generate-module-models, generate-equiplet-models, generate-part-models, generate-nodes" />
<target name="generate-HAL" depends="generate-HAL-modules, generate-HAL-capabilities" />
<target name="generate-HAL-modules" depends="HAL">
<var name="jar.basedir" value="build/REXOS/" />
<var name="jar.targetdir" value="generatedOutput/HAL/modules/" />
<foreach target="-generate-jar" param="theEntry" parallel="false" inheritall="true">
<path id="modulesPathId">
<fileset dir="build/REXOS/HAL/modules" casesensitive="yes">
<include name="**/*.class" />
</fileset>
</path>
</foreach>
</target>
<target name="generate-HAL-capabilities" depends="HAL">
<var name="jar.basedir" value="build/REXOS/" />
<var name="jar.targetdir" value="generatedOutput/HAL/capabilities/" />
<foreach target="-generate-jar" param="theEntry" parallel="false" inheritall="true">
<path id="capabilitiesPathId">
<fileset dir="build/REXOS/HAL/capabilities" casesensitive="yes">
<include name="**/*.class" />
</fileset>
</path>
</foreach>
</target>
<target name="generate-module-models">
<var name="zip.targetdir" value="generatedOutput/models/modules/" />
<for param="zip.manufacturerdir">
<path>
<dirset dir="src/REXOS/modules" casesensitive="yes">
<include name="**/*" />
<exclude name="**/*/*" />
</dirset>
</path>
<sequential>
<var name="zip.offsetdir" unset="true" />
<basename property="zip.offsetdir" file="@{zip.manufacturerdir}" />
<for param="zip.fulldir">
<path>
<dirset dir="@{zip.manufacturerdir}" casesensitive="yes">
<include name="**/*" />
<exclude name="**/*/*" />
<exclude name="_qrCodes" />
</dirset>
</path>
<sequential>
<var name="zip.filename" unset="true" />
<basename property="zip.filename" file="@{zip.fulldir}" />
<var name="zip.destfile" value="${zip.targetdir}/${zip.offsetdir}/${zip.filename}.zip" />
<var name="zip.basedir" value="@{zip.fulldir}/_model/" />
<antcall target="-generate-zip" inheritall="true" />
</sequential>
</for>
</sequential>
</for>
<copy todir="generatedOutput/models/modules/_qrCodes">
<fileset dir="src/REXOS/modules/_qrCodes" />
</copy>
</target>
<target name="generate-equiplet-models">
<var name="zip.targetdir" value="generatedOutput/models/equiplets/" />
<for param="zip.fulldir">
<path>
<dirset dir="src/REXOS/equiplets" casesensitive="yes">
<include name="**/*" />
<exclude name="**/*/*" />
<exclude name="_qrCodes" />
</dirset>
</path>
<sequential>
<var name="zip.filename" unset="true" />
<basename property="zip.filename" file="@{zip.fulldir}" />
<var name="zip.destfile" value="${zip.targetdir}/${zip.filename}.zip" />
<var name="zip.basedir" value="@{zip.fulldir}/_model/" />
<antcall target="-generate-zip" inheritall="true" />
</sequential>
</for>
</target>
<target name="generate-part-models">
<var name="zip.targetdir" value="generatedOutput/models/parts/" />
<for param="zip.fulldir">
<path>
<dirset dir="src/REXOS/parts" casesensitive="yes">
<include name="**/*" />
<exclude name="**/*/*" />
<exclude name="_qrCodes" />
</dirset>
</path>
<sequential>
<var name="zip.filename" unset="true" />
<basename property="zip.filename" file="@{zip.fulldir}" />
<var name="zip.destfile" value="${zip.targetdir}/${zip.filename}.zip" />
<var name="zip.basedir" value="@{zip.fulldir}/_model/" />
<antcall target="-generate-zip" inheritall="true" />
</sequential>
</for>
<copy todir="generatedOutput/models/parts/_qrCodes">
<fileset dir="src/REXOS/parts/_qrCodes" />
</copy>
</target>
<target name="generate-nodes">
<var name="zip.targetdir" value="generatedOutput/nodes/" />
<for param="zip.fulldir">
<path>
<dirset dir="build/REXOS/ROS/" casesensitive="yes">
<include name="*/**" />
<exclude name="**/*/*" />
<exclude name="_*" />
<exclude name="libraries" />
</dirset>
<dirset dir="build/REXOS/ROS/" casesensitive="yes">
<include name="_testing" />
</dirset>
</path>
<sequential>
<var name="zip.basedir" value="build/REXOS/ROS/" />
<var name="zip.filename" unset="true" />
<basename property="zip.filename" file="@{zip.fulldir}" />
<var name="zip.destfile" value="${zip.targetdir}/${zip.filename}.zip" />
<var name="zip.basedir" value="@{zip.fulldir}" />
<antcall target="-generate-zip" inheritall="true" />
</sequential>
</for>
</target>
<target name="-generate-zip">
<basename property="zip.filename" file="${theEntry}" />
<zip destfile="${zip.destfile}" basedir="${zip.basedir}" includes="**/**" />
</target>
<target name="-generate-jar">
<basename property="jar.basename" file="${theEntry}" suffix=".class" />
<jar destfile="${jar.targetdir}/${jar.basename}.jar" basedir="${jar.basedir}" includes="**/${jar.basename}.class" />
</target>
</project>