-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.xml
More file actions
259 lines (217 loc) · 8.71 KB
/
Copy pathbuild.xml
File metadata and controls
259 lines (217 loc) · 8.71 KB
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
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
<!-- ==========================================================================!
! Ant build specification for the phaze project
!========================================================================== -->
<project name="MyProject" default="phaze" basedir=".">
<description>Phaze DSL Project</description>
<!-- read machine-specific properties for this build -->
<property file="build.properties"/>
<!-- set global properties for this build -->
<property name="src" location="${basedir}/src"/>
<property name="build" location="${basedir}/build"/>
<property name="dist" location="${basedir}/dist"/>
<property name="utils" location="${basedir}/utils"/>
<property name="samples" location="${basedir}/samples"/>
<property name="share" location="${basedir}/share"/>
<property name="version" value="phaze-0.1-beta"/>
<!-- ======================================================================!
! Build phaze
!======================================================================= -->
<target name="phaze" depends="grammar">
<!-- ===================================================================!
! Create java classes from ANTLR4 grammar
!=================================================================== -->
<javac
destdir="${build}/classes"
deprecation="Yes"
listfiles="Yes"
includeantruntime="false">
<src path="${src}/compiler"/>
<src path="${build}/phaze"/>
<classpath>
<pathelement path="${java.class.path} ${build}/classes"/>
</classpath>
</javac>
<!-- ===================================================================!
! Archive compiled classes
!==================================================================== -->
<mkdir dir="${build}/jar"/>
<jar destfile="${build}/jar/phaze.jar"
basedir="${build}/classes">
<zipfileset includes="**/*.class" src="${antlr4.jar}"/>
<zipfileset includes="**/*.class" src="${cli.jar}"/>
<zipfileset includes="**/*.class" src="${io.jar}"/>
<manifest>
<attribute name="Main-Class" value="Phaze.Main"/>
</manifest>
</jar>
</target>
<!-- ======================================================================!
! Create jar from ANTLR4 grammar
!======================================================================= -->
<target name="grammar" depends="prog_antlr">
<!-- ===================================================================!
! Create java classes from ANTLR4 grammar
!=================================================================== -->
<java classname="org.antlr.v4.Tool" fork="true" failonerror="true">
<arg value="-o"/>
<arg path="${build}/antlr"/>
<arg path="${src}/grammar/phaze.g4"/>
<classpath>
<pathelement path="${java.class.path}"/>
</classpath>
</java>
<!-- ===================================================================!
! Compile java classes
!=================================================================== -->
<mkdir dir="${build}/classes"/>
<javac srcdir="${build}/antlr"
destdir="${build}/classes"
deprecation="Yes"
listfiles="Yes"
includeantruntime="false">
<classpath>
<pathelement path="${java.class.path}"/>
</classpath>
</javac>
<!-- ===================================================================!
! Create wrapper
!=================================================================== -->
<mkdir dir="${build}/bin"/>
<copy file="${src}/script/phaze.in" tofile="build/bin/phaze">
<filterset>
<filter token="PATH" value="${build}"/>
</filterset>
</copy>
<chmod file="${build}/bin/phaze" perm="+x"/>
</target>
<!-- ======================================================================!
! Install
!======================================================================= -->
<target name="install">
<mkdir dir="${install}/phaze"/>
<mkdir dir="${install}/phaze/jar"/>
<mkdir dir="${install}/phaze/bin"/>
<mkdir dir="${install}/phaze/share"/>
<copy file="${src}/script/phaze.in" tofile="${install}/phaze/bin/phaze">
<filterset>
<filter token="PATH" value="${install}/phaze"/>
</filterset>
</copy>
<chmod file="${install}/phaze/bin/phaze" perm="+x"/>
<copy file="${build}/jar/phaze.jar" todir="${install}/phaze/jar"/>
<copy todir="${install}/phaze/share">
<fileset dir="${share}"/>
</copy>
</target>
<!-- ======================================================================!
! Distribution
!======================================================================= -->
<target name="dist" depends="phaze">
<!-- Create temporary dist directories -->
<mkdir dir="${dist}"/>
<mkdir dir="${build}/dist/${version}"/>
<mkdir dir="${build}/dist/${version}/bin"/>
<mkdir dir="${build}/dist/${version}/jar"/>
<mkdir dir="${build}/dist/${version}/samples"/>
<mkdir dir="${build}/dist/${version}/share"/>
<!-- Copy file into temporary dist directory -->
<copy file="${src}/script/phaze.in"
tofile="${build}/dist/${version}/bin/phaze.in"/>
<copy file="${src}/script/install" todir="${build}/dist/${version}"/>
<copy file="${build}/jar/phaze.jar"
todir="${build}/dist/${version}/jar"/>
<copy todir="${build}/dist/${version}/samples">
<fileset dir="${samples}"/>
</copy>
<copy todir="${build}/dist/${version}/share">
<fileset dir="${share}"/>
</copy>
<chmod file="${build}/dist/${version}/share/config/bootstrap" perm="+x"/>
<chmod file="${build}/dist/${version}/share/config/clean_ac" perm="+x"/>
<chmod file="${build}/dist/${version}/share/config/clean_phaze"
perm="+x"/>
<!-- Create archive-->
<tar destfile="${build}/${version}.tar">
<tarfileset dir="${build}/dist" filemode="755">
<!-- include executable files -->
<include name="${version}/install"/>
<include name="${version}/share/config/bootstrap"/>
<include name="${version}/share/config/clean_ac"/>
<include name="${version}/share/config/clean_phaze"/>
<include name="${version}/share/config/create_lib_am"/>
</tarfileset>
<tarfileset dir="${build}/dist">
<include name="${version}/**"/>
<!-- exclude executable files -->
<exclude name="${version}/install"/>
<exclude name="${version}/share/config/bootstrap"/>
<exclude name="${version}/share/config/clean_ac"/>
<exclude name="${version}/share/config/clean_phaze"/>
<exclude name="${version}/share/config/create_lib_am"/>
</tarfileset>
</tar>
<gzip src="${build}/${version}.tar" destfile="${dist}/${version}.tgz"/>
<!-- Clean up -->
<delete dir="${build}/dist"/>
<delete file="${build}/${version}.tar"/>
</target>
<!-- ======================================================================!
! Initialize the build structure
!======================================================================= -->
<target name="init">
<!-- Create the time stamp -->
<tstamp/>
<!-- Create the build directory -->
<mkdir dir="${build}"/>
<mkdir dir="${build}/phaze"/>
<mkdir dir="${build}/share"/>
<exec executable="${utils}/create_static_interface">
<arg value="PhazeInterfaceCHeader"/>
<arg value="${src}/interface/static_interface_c.h"/>
<arg value="${build}/phaze/PhazeInterfaceCHeader.java"/>
</exec>
<!-- AoS static interface implementation -->
<exec executable="${utils}/create_static_interface">
<arg value="PhazeInterfaceCSourceAoS"/>
<arg value="${src}/interface/static_interface_c_aos.c"/>
<arg value="${build}/phaze/PhazeInterfaceCSourceAoS.java"/>
</exec>
<copy todir="${build}/share">
<fileset dir="${share}"/>
</copy>
<chmod file="${build}/share/config/bootstrap" perm="+x"/>
<chmod file="${build}/share/config/clean_ac" perm="+x"/>
<chmod file="${build}/share/config/clean_phaze" perm="+x"/>
<chmod file="${build}/share/config/create_lib_am" perm="+x"/>
</target>
<!-- ======================================================================!
! Clean the build
!======================================================================= -->
<target name="clean"
description="clean up">
<delete dir="${build}"/>
</target>
<!-- ======================================================================!
! Clean the build
!======================================================================= -->
<target name="distclean"
description="clean up">
<delete dir="${build}"/>
<delete dir="${dist}"/>
</target>
<!-- ======================================================================!
! Find ANTLR4 in CLASSPATH
!======================================================================= -->
<target name="prog_antlr" depends="init">
<whichresource property="antlr.in.classpath"
class="org.antlr.v4.Tool"/>
<fail message="ANTLR4 not found via CLASSPATH ${java.class.path}">
<condition>
<not>
<isset property="antlr.in.classpath"/>
</not>
</condition>
</fail>
<echo message="ANTLR4 found via CLASSPATH"/>
</target>
</project>