root/tags/demo2/build.xml

Revision 284, 10.6 kB (checked in by jathey, 3 years ago)

fixed dictionary extension, updated build file to match

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