root/tags/featurefreeze/compilerbuild.xml

Revision 663, 11.0 kB (checked in by bwilliams, 3 years ago)

Added support for new code so this will still work

  • Property svn:eol-style set to native
  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
Line 
1 <?xml version='1.0'?>
2 <!--Copyright (C) 2005 Tresys Technology, LLC
3         Authors: Spencer Shimko <sshimko@tresys.com>
4                          James Athey <jathey@tresys.com>
5        
6         build.xml: ant build file for SEFramework
7 -->
8 <project name="SEFramework" default="test" basedir=".">
9
10         <!-- START SETTINGS -->
11         <!-- VERSION (will be used to globally replace @version@ occurences -->
12         <property name="version" value="0.1"/>
13
14         <!-- system specific settings -->
15         <!-- TODO: Remove these system specific settings -->
16         <property name="javacchome" value="/usr/share/javacc" />
17         <property name="javacc_ext" value=".jj" />
18        
19         <!-- dictionary source -->
20         <property name="dfile" value="test/dictionary.sedic" />
21         <!-- policy source -->
22         <property name="pfile" value="test/policy.sepol" />
23         <!-- system resources source -->
24         <property name="sfile" value="test/sysresources.sesys" />
25         <!-- dictionary output -->
26         <property name="dout" value="dict.out" />
27         <!-- translator output -->
28         <property name="pofile" value="framework.te" />
29         <property name="fofile" value="framework.fc" />
30         <property name="iffile" value="framework.if" />
31     <!-- file context -->
32     <property name="fc" value="test/basepolicy/file_contexts" />
33     <!-- policy.conf -->
34     <property name="pc" value="test/basepolicy/policy.conf" />
35     <!-- libpath -->
36     <property name="libpath" value="/usr/lib" />
37        
38        
39         <!-- global directory names -->
40         <property name="pkg_path" value="com/tresys/framework/compiler" />
41         <property name="pkg_name" value="com.tresys.framework.compiler" />
42         <property name="src" value="src" />
43         <property name="build" value="build"/>
44         <property name="testdir" value="test" />
45         <property name="classpath"  value="${build}"/>
46         <property name="buildpath" value="${build}/${pkg_path}" />
47         <property name="srcpath" value="${src}/${pkg_path}" />
48
49         <!-- target names in framework package -->
50         <property name="dict" value="dictionary" />
51         <property name="pol" value="policy" />
52         <property name="trans" value="translator" />
53         <property name="link" value="linkage" />
54         <property name="libapoljava" value="libapoljava" />
55         <property name="libselinuxjava" value="libselinuxjava" />
56         <property name="refpolicy" value="refpolicy" />
57         <!-- END SETTINGS -->
58
59         <!-- START GLOBAL TARGETS -->
60         <!-- initialize directories -->
61         <target name="init" depends="initbase,initdict,inittrans,initpol" />
62                
63         <!-- Clean trees -->
64         <target name="clean" depends="cleanbase,cleandict,cleantrans,cleanpol,cleansys" >
65                 <!-- Delete files in base build directory -->
66                 <delete includeEmptyDirs="true" failonerror="false">
67                         <fileset dir="${build}" />
68                         <fileset file="${dout}" />
69                         <fileset file="${pofile}" />
70                         <fileset file="${fofile}" />
71                         <fileset file="${iffile}" />
72                 </delete>
73         </target>
74
75         <!-- Test trees -->
76         <target name="test" depends="testsys" />
77         <!-- END GLOBAL TARGETS -->
78
79         <!-- START BASE TARGETS -->
80         <!-- initialize base build directory if dict file specified-->
81         <target name="initbase">
82                 <!-- setup build directories -->
83                 <mkdir dir="${build}/${pkg_path}" />
84                 <copy todir="${build}/${pkg_path}">
85                         <fileset dir="${src}/${pkg_path}" includes="*.java"/>
86                         <!-- set version -->
87                         <filterset>
88                                 <filter token="version" value="${version}"/>
89                         </filterset>
90                 </copy>
91         </target>
92
93         <!-- Clean tree -->
94         <target name="cleanbase" >
95                 <!-- Delete files in base build directory -->
96                 <delete includeEmptyDirs="true" failonerror="false">
97                         <fileset dir="${build}/${pkg_path}" includes="*.*" />
98                 </delete>
99         </target>
100         <!-- END BASE TARGETS -->
101
102         <!-- START LINKAGE -->
103         <!-- linkage specific properties -->
104         <property name="linkbuild" value="${buildpath}/${link}" />
105         <property name="libapoljavabuild" value="${linkbuild}/${libapoljava}" />
106         <property name="linksrc" value="${srcpath}/${link}" />
107         <property name="libapoljavasrc" value="${linksrc}/${libapoljava}" />
108         <property name="libselinuxjavabuild" value="${linkbuild}/${libselinuxjava}" />
109         <property name="libselinuxjavasrc" value="${linksrc}/${libselinuxjava}" />
110         <property name="refpolbuild" value="${linkbuild}/${refpolicy}" />
111         <property name="refpolsrc" value="${linksrc}/${refpolicy}" />
112        
113         <!-- initialize translator build directory -->
114         <target name="initlinkage" depends="initbase" >
115                 <mkdir dir="${linkbuild}" />
116                 <copy todir="${linkbuild}">
117                         <fileset dir="${linksrc}" includes="*.java"/>
118                         <!-- set version -->
119                         <filterset>
120                                 <filter token="version" value="${version}"/>
121                         </filterset>
122                 </copy>
123                 <mkdir dir="${libapoljavabuild}" />
124                 <copy todir="${libapoljavabuild}">
125                         <fileset dir="${libapoljavasrc}" includes="*.java"/>
126                 </copy>
127                 <mkdir dir="${libselinuxjavabuild}" />
128                 <copy todir="${libselinuxjavabuild}">
129                         <fileset dir="${libselinuxjavasrc}" includes="*.java"/>
130                 </copy>
131                 <mkdir dir="${refpolbuild}" />
132                                 <copy todir="${refpolbuild}">
133                                         <fileset dir="${refpolsrc}" includes="*.java"/>
134                                 </copy>
135         </target>
136
137         <!-- Clean the linkage tree -->
138         <target name="cleanlinkage">
139                 <!-- Delete the build directories -->
140                 <delete dir="${linkbuild}"/>
141                 <delete dir="${libapoljavabuild}"/>
142                 <delete dir="${libselinuxjavabuild}"/>
143         </target>
144         <!-- END LINKAGE -->
145
146         <!-- START DICTIONARY -->
147         <!-- dictionary specific properties -->
148
149         <property name="dict_parse_class" value="DictionaryParser" />
150         <property name="dictbuild" value="${buildpath}/${dict}" />
151         <property name="dictsrc" value="${srcpath}/${dict}" />
152
153         <!-- initialize dictionary build directory -->
154         <target name="initdict" depends="initbase" >
155                 <mkdir dir="${dictbuild}" />
156                 <!-- setup build directories -->
157                 <copy todir="${dictbuild}">
158                         <fileset dir="${dictsrc}" includes="*.java,*${javacc_ext}"/>
159                         <!-- set version -->
160                         <filterset>
161                                 <filter token="version" value="${version}"/>
162                         </filterset>
163                 </copy>
164         </target>
165
166         <!-- Generate the dictionary parser -->
167         <target name="compdictparser" depends="initbase,initdict">
168                 <!-- compile -->
169                 <javacc target="${dictbuild}/${dict_parse_class}${javacc_ext}"
170                      outputdirectory="${dictbuild}"
171                      javacchome="${javacchome}" />
172         </target>
173                      
174         <!-- Compile the dictionary -->
175         <target name="compdict" depends="compdictparser">
176                 <!-- compile -->
177                 <javac srcdir="${dictbuild}" destdir="${build}" >
178                         <!-- <compilerarg value="-Xlint"/> -->
179                 </javac>
180         </target>
181
182         <!-- Clean the dictionary tree -->
183         <target name="cleandict">
184                 <!-- Delete the build directories -->
185                 <delete dir="${dictbuild}"/>
186         </target>
187
188         <!-- Test the dictionary -->
189         <target name="testdict" depends="compile">
190                 <java classname="${pkg_name}.Compiler"
191          fork="true"
192          failonerror="true"
193          maxmemory="128m">
194                         <jvmarg value="-Djava.library.path=${libpath}" />
195                         <!-- <arg value="-v" /> -->
196                         <arg value="-ds" />
197                         <arg path="${dfile}" />
198                         <arg value="-do" />
199                         <arg path="${dout}" />
200                         <classpath>
201                                 <pathelement location="${build}/" />
202                         </classpath>
203                 </java>
204         </target>
205         <!-- END DICTIONARY -->
206
207         <!-- START SYSTEM RESOURCES -->
208         <!-- system resource specific properties -->
209         <property name="sys" value="systemResources" />
210         <property name="sys_parse_class" value="SystemResourcesParser" />
211         <property name="sysbuild" value="${buildpath}/${sys}" />
212         <property name="syssrc" value="${srcpath}/${sys}" />
213
214         <!-- initialize system resources build directory -->
215         <target name="initsys" depends="initbase" >
216                 <mkdir dir="${sysbuild}" />
217                 <copy todir="${sysbuild}">
218                         <fileset dir="${syssrc}" includes="*.java,*${javacc_ext}"/>
219                         <!-- set version -->
220                         <filterset>
221                                 <filter token="version" value="${version}"/>
222                         </filterset>
223                 </copy>
224         </target>
225
226         <!-- Generate the system resources parser classes -->
227         <target name="compsysparser" depends="initsys">
228                 <!-- compile -->
229                 <javacc target="${sysbuild}/${sys_parse_class}${javacc_ext}"
230             outputdirectory="${sysbuild}"
231             javacchome="${javacchome}" />
232             </target>
233            
234         <!-- Clean the system resource tree -->
235         <target name="cleansys">
236                 <!-- Delete the build directories -->
237                 <delete dir="${sysbuild}"/>
238         </target>
239
240         <!-- Test the policy -->
241         <target name="testsys" depends="compile">
242                 <java classname="${pkg_name}.Compiler"
243          fork="true"
244          failonerror="true"
245          maxmemory="128m">
246                         <jvmarg value="-Djava.library.path=${libpath}" />
247                         <!-- <jvmarg value="-verbose:jni" /> -->
248                 <!-- <arg value="-v"/> -->
249                         <arg value="-ds" />
250                         <arg path="${dfile}" />
251                         <arg value="-p" />
252                         <arg path="${pfile}" />
253                         <arg value="-po" />
254                         <arg path="${pofile}" />
255                         <arg value="-pc" />
256                         <arg path="${pc}" />
257                         <arg value="-fc" />
258                         <arg path="${fc}" />
259                         <arg value="-s" />
260                         <arg path="${sfile}" />
261                         <arg value="-sf" />
262                         <arg path="${fofile}" />
263                         <arg value="-if" />
264                         <arg path="${iffile}" />
265                         <classpath>
266                                 <pathelement path="${build}" />
267                         </classpath>
268                 </java>
269         </target>
270         <!-- END SYSTEM RESOURCES -->
271
272         <!-- START POLICY -->
273         <!-- policy specific properties -->
274         <property name="pol" value="policy" />
275         <property name="pol_parse_class" value="PolicyParser" />
276         <property name="polbuild" value="${buildpath}/${pol}" />
277         <property name="polsrc" value="${srcpath}/${pol}" />
278
279         <!-- initialize policy build directory -->
280         <target name="initpol" depends="initbase" >
281                 <mkdir dir="${polbuild}" />
282                 <copy todir="${polbuild}">
283                         <fileset dir="${polsrc}" includes="*.java,*${javacc_ext}"/>
284                         <!-- set version -->
285                         <filterset>
286                                 <filter token="version" value="${version}"/>
287                         </filterset>
288                 </copy>
289         </target>
290
291         <!-- Generate the policy compiler -->
292         <target name="comppolparser" depends="initpol">
293                 <!-- compile -->
294                 <javacc target="${polbuild}/${pol_parse_class}${javacc_ext}"
295             outputdirectory="${polbuild}"
296             javacchome="${javacchome}" />
297             </target>
298            
299         <!-- Clean the policy tree -->
300         <target name="cleanpol">
301                 <!-- Delete the build directories -->
302                 <delete dir="${polbuild}"/>
303         </target>
304
305         <!-- Test the policy -->
306         <target name="testpol" depends="testsys" />
307         <!-- END POLICY -->
308
309         <!-- START TRANSLATOR -->
310         <!-- translator specific properties -->
311         <property name="transbuild" value="${buildpath}/${trans}" />
312         <property name="transsrc" value="${srcpath}/${trans}" />
313
314         <!-- initialize translator build directory -->
315         <target name="inittrans" depends="initbase" >
316                 <mkdir dir="${transbuild}" />
317                 <copy todir="${transbuild}">
318                         <fileset dir="${transsrc}" includes="*.java"/>
319                         <!-- set version -->
320                         <filterset>
321                                 <filter token="version" value="${version}"/>
322                         </filterset>
323                 </copy>
324         </target>
325
326         <!-- Clean the translator tree -->
327         <target name="cleantrans">
328                 <!-- Delete the build directories -->
329                 <delete dir="${transbuild}"/>
330         </target>
331         <!-- END TRANSLATOR -->
332        
333         <!--compilation target  -->
334         <target name="compile" depends="initdict,inittrans,initpol,initlinkage,comppolparser,compdictparser,compsysparser">
335                 <javac destdir="${build}" >
336                         <src path="${polbuild}"/>
337                         <src path="${sysbuild}"/>
338                         <src path="${build}/${pkg_path}" />
339                         <src path="${transbuild}" />
340                         <src path="${dictbuild}" />
341                         <src path="${libapoljavabuild}" />
342                         <src path="${libselinuxjavabuild}" />
343                         <src path="${linkbuild}" />
344                 </javac>
345         </target>
346
347 </project>
Note: See TracBrowser for help on using the browser.