| 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" /> |
|---|
| 20 |
<!-- policy source --> |
|---|
| 21 |
<property name="pfile" value="test/policy" /> |
|---|
| 22 |
<!-- dictionary output --> |
|---|
| 23 |
<property name="dout" value="dict.out" /> |
|---|
| 24 |
<!-- translator output --> |
|---|
| 25 |
<property name="ofile" value="framework.te" /> |
|---|
| 26 |
|
|---|
| 27 |
<!-- global directory names --> |
|---|
| 28 |
<property name="pkg_path" value="com/tresys/framework" /> |
|---|
| 29 |
<property name="pkg_name" value="com.tresys.framework" /> |
|---|
| 30 |
<property name="src" value="src" /> |
|---|
| 31 |
<property name="build" value="build"/> |
|---|
| 32 |
<property name="testdir" value="test" /> |
|---|
| 33 |
<property name="classpath" value="${build}"/> |
|---|
| 34 |
<property name="buildpath" value="${build}/${pkg_path}" /> |
|---|
| 35 |
<property name="srcpath" value="${src}/${pkg_path}" /> |
|---|
| 36 |
|
|---|
| 37 |
<!-- target names in framework package --> |
|---|
| 38 |
<property name="dict" value="dictionary" /> |
|---|
| 39 |
<property name="pol" value="policy" /> |
|---|
| 40 |
<property name="trans" value="translator" /> |
|---|
| 41 |
<!-- END SETTINGS --> |
|---|
| 42 |
|
|---|
| 43 |
<!-- START GLOBAL TARGETS --> |
|---|
| 44 |
<!-- initialize directories --> |
|---|
| 45 |
<target name="init" depends="initbase,initdict,inittrans,initpol" /> |
|---|
| 46 |
|
|---|
| 47 |
<!-- Default compilation target calls other targets --> |
|---|
| 48 |
<target name="compile" depends="compdict,comptrans,comppol,compcompiler" /> |
|---|
| 49 |
|
|---|
| 50 |
<!-- Clean trees --> |
|---|
| 51 |
<target name="clean" depends="cleanbase,cleandict,cleantrans,cleanpol" > |
|---|
| 52 |
<!-- Delete files in base build directory --> |
|---|
| 53 |
<delete includeEmptyDirs="true" failonerror="false"> |
|---|
| 54 |
<fileset dir="${build}" /> |
|---|
| 55 |
<fileset file="${dout}" /> |
|---|
| 56 |
<fileset file="${ofile}" /> |
|---|
| 57 |
</delete> |
|---|
| 58 |
</target> |
|---|
| 59 |
|
|---|
| 60 |
<!-- Test trees --> |
|---|
| 61 |
<target name="test" depends="testdict,testpol" /> |
|---|
| 62 |
<!-- END GLOBAL TARGETS --> |
|---|
| 63 |
|
|---|
| 64 |
<!-- START BASE TARGETS --> |
|---|
| 65 |
<!-- initialize base build directory if dict file specified--> |
|---|
| 66 |
<target name="initbase"> |
|---|
| 67 |
<!-- setup build directories --> |
|---|
| 68 |
<mkdir dir="${build}/${pkg_path}" /> |
|---|
| 69 |
<copy todir="${build}/${pkg_path}"> |
|---|
| 70 |
<fileset dir="${src}/${pkg_path}" includes="*.java"/> |
|---|
| 71 |
<!-- set version --> |
|---|
| 72 |
<filterset> |
|---|
| 73 |
<filter token="version" value="${version}"/> |
|---|
| 74 |
</filterset> |
|---|
| 75 |
</copy> |
|---|
| 76 |
</target> |
|---|
| 77 |
|
|---|
| 78 |
<!-- Compile the base classes --> |
|---|
| 79 |
<target name="compbase" depends="initbase" /> |
|---|
| 80 |
|
|---|
| 81 |
|
|---|
| 82 |
<!-- Clean tree --> |
|---|
| 83 |
<target name="cleanbase" > |
|---|
| 84 |
<!-- Delete files in base build directory --> |
|---|
| 85 |
<delete includeEmptyDirs="true" failonerror="false"> |
|---|
| 86 |
<fileset dir="${build}/${pkg_path}" includes="*.*" /> |
|---|
| 87 |
</delete> |
|---|
| 88 |
</target> |
|---|
| 89 |
|
|---|
| 90 |
<!-- END BASE TARGETS --> |
|---|
| 91 |
|
|---|
| 92 |
|
|---|
| 93 |
<!-- START DICTIONARY --> |
|---|
| 94 |
<!-- dictionary specific properties --> |
|---|
| 95 |
|
|---|
| 96 |
<property name="dict_parse_class" value="DictionaryParser" /> |
|---|
| 97 |
<property name="dictbuild" value="${buildpath}/${dict}" /> |
|---|
| 98 |
<property name="dictsrc" value="${srcpath}/${dict}" /> |
|---|
| 99 |
|
|---|
| 100 |
<!-- initialize dictionary build directory --> |
|---|
| 101 |
<target name="initdict" depends="initbase" > |
|---|
| 102 |
<mkdir dir="${dictbuild}" /> |
|---|
| 103 |
<!-- setup build directories --> |
|---|
| 104 |
<copy todir="${dictbuild}"> |
|---|
| 105 |
<fileset dir="${dictsrc}" includes="**/*.java,**/*${javacc_ext}"/> |
|---|
| 106 |
<!-- set version --> |
|---|
| 107 |
<filterset> |
|---|
| 108 |
<filter token="version" value="${version}"/> |
|---|
| 109 |
</filterset> |
|---|
| 110 |
</copy> |
|---|
| 111 |
</target> |
|---|
| 112 |
|
|---|
| 113 |
<!-- Compile the dictionary --> |
|---|
| 114 |
<target name="compdict" depends="initbase,initdict"> |
|---|
| 115 |
<!-- compile --> |
|---|
| 116 |
<javacc target="${dictbuild}/${dict_parse_class}${javacc_ext}" |
|---|
| 117 |
javacchome="${javacchome}" /> |
|---|
| 118 |
<javac srcdir="${dictbuild}" destdir="${build}" > |
|---|
| 119 |
|
|---|
| 120 |
<!-- <compilerarg value="-Xlint"/> --> |
|---|
| 121 |
</javac> |
|---|
| 122 |
</target> |
|---|
| 123 |
|
|---|
| 124 |
<!-- Clean the dictionary tree --> |
|---|
| 125 |
<target name="cleandict"> |
|---|
| 126 |
<!-- Delete the build directories --> |
|---|
| 127 |
<delete dir="${dictbuild}"/> |
|---|
| 128 |
</target> |
|---|
| 129 |
|
|---|
| 130 |
<!-- Test the dictionary --> |
|---|
| 131 |
<target name="testdict" depends="initbase,compcompiler"> |
|---|
| 132 |
<java classname="${pkg_name}.Compiler" |
|---|
| 133 |
fork="true" |
|---|
| 134 |
failonerror="true" |
|---|
| 135 |
maxmemory="128m"> |
|---|
| 136 |
<arg value="-v" /> |
|---|
| 137 |
<arg value="-ds" /> |
|---|
| 138 |
<arg path="${dfile}" /> |
|---|
| 139 |
<arg value="-do" /> |
|---|
| 140 |
<arg path="${dout}" /> |
|---|
| 141 |
<classpath> |
|---|
| 142 |
<pathelement location="${build}/" /> |
|---|
| 143 |
</classpath> |
|---|
| 144 |
</java> |
|---|
| 145 |
</target> |
|---|
| 146 |
<!-- END DICTIONARY --> |
|---|
| 147 |
|
|---|
| 148 |
<!-- START POLICY --> |
|---|
| 149 |
<!-- policy specific properties --> |
|---|
| 150 |
<property name="pol" value="policy" /> |
|---|
| 151 |
<property name="pol_parse_class" value="PolicyParser" /> |
|---|
| 152 |
<property name="polbuild" value="${buildpath}/${pol}" /> |
|---|
| 153 |
<property name="polsrc" value="${srcpath}/${pol}" /> |
|---|
| 154 |
|
|---|
| 155 |
<!-- initialize policy build directory --> |
|---|
| 156 |
<target name="initpol" depends="initbase" > |
|---|
| 157 |
<mkdir dir="${polbuild}" /> |
|---|
| 158 |
<copy todir="${polbuild}"> |
|---|
| 159 |
<fileset dir="${polsrc}" includes="**/*.java,**/*${javacc_ext}"/> |
|---|
| 160 |
<!-- set version --> |
|---|
| 161 |
<filterset> |
|---|
| 162 |
<filter token="version" value="${version}"/> |
|---|
| 163 |
</filterset> |
|---|
| 164 |
</copy> |
|---|
| 165 |
</target> |
|---|
| 166 |
|
|---|
| 167 |
<!-- Compile the policy classes --> |
|---|
| 168 |
<target name="comppol" depends="compdict,initpol"> |
|---|
| 169 |
<!-- compile --> |
|---|
| 170 |
<javacc target="${polbuild}/${pol_parse_class}${javacc_ext}" |
|---|
| 171 |
outputdirectory="${polbuild}" |
|---|
| 172 |
javacchome="${javacchome}" /> |
|---|
| 173 |
<javac srcdir="${polbuild}" destdir="${build}" /> |
|---|
| 174 |
</target> |
|---|
| 175 |
|
|---|
| 176 |
<!-- Clean the policy tree --> |
|---|
| 177 |
<target name="cleanpol"> |
|---|
| 178 |
<!-- Delete the build directories --> |
|---|
| 179 |
<delete dir="${polbuild}"/> |
|---|
| 180 |
</target> |
|---|
| 181 |
|
|---|
| 182 |
<!-- Test the policy --> |
|---|
| 183 |
<target name="testpol" depends="compcompiler"> |
|---|
| 184 |
<java classname="${pkg_name}.Compiler" |
|---|
| 185 |
fork="true" |
|---|
| 186 |
failonerror="true" |
|---|
| 187 |
maxmemory="128m"> |
|---|
| 188 |
<arg value="-v"/> |
|---|
| 189 |
<arg value="-dc" /> |
|---|
| 190 |
<arg path="${dout}" /> |
|---|
| 191 |
<arg value="-p" /> |
|---|
| 192 |
<arg path="${pfile}" /> |
|---|
| 193 |
<arg value="-o" /> |
|---|
| 194 |
<arg path="${ofile}" /> |
|---|
| 195 |
<classpath> |
|---|
| 196 |
<pathelement path="${build}" /> |
|---|
| 197 |
</classpath> |
|---|
| 198 |
</java> |
|---|
| 199 |
</target> |
|---|
| 200 |
<!-- END POLICY --> |
|---|
| 201 |
|
|---|
| 202 |
<!-- START TRANSLATOR --> |
|---|
| 203 |
<!-- translator specific properties --> |
|---|
| 204 |
<property name="transbuild" value="${buildpath}/${trans}" /> |
|---|
| 205 |
<property name="transsrc" value="${srcpath}/${trans}" /> |
|---|
| 206 |
|
|---|
| 207 |
<!-- initialize translator build directory --> |
|---|
| 208 |
<target name="inittrans" depends="initbase" > |
|---|
| 209 |
<mkdir dir="${transbuild}" /> |
|---|
| 210 |
<copy todir="${transbuild}"> |
|---|
| 211 |
<fileset dir="${transsrc}" includes="**/*.java"/> |
|---|
| 212 |
<!-- set version --> |
|---|
| 213 |
<filterset> |
|---|
| 214 |
<filter token="version" value="${version}"/> |
|---|
| 215 |
</filterset> |
|---|
| 216 |
</copy> |
|---|
| 217 |
</target> |
|---|
| 218 |
|
|---|
| 219 |
<!-- Compile the translator classes --> |
|---|
| 220 |
<target name="comptrans" depends="initbase,compdict,comppol,inittrans"> |
|---|
| 221 |
<javac srcdir="${transbuild}" destdir="${build}" /> |
|---|
| 222 |
</target> |
|---|
| 223 |
|
|---|
| 224 |
<!-- Clean the translator tree --> |
|---|
| 225 |
<target name="cleantrans"> |
|---|
| 226 |
<!-- Delete the build directories --> |
|---|
| 227 |
<delete dir="${transbuild}"/> |
|---|
| 228 |
</target> |
|---|
| 229 |
<!-- END TRANSLATOR --> |
|---|
| 230 |
|
|---|
| 231 |
<!-- Compile the compiler classes --> |
|---|
| 232 |
<target name="compcompiler" depends="initbase, compdict, comppol, comptrans"> |
|---|
| 233 |
<!-- compile --> |
|---|
| 234 |
<javac sourcepath="" srcdir="${build}/${pkg_path}" destdir="${build}" > |
|---|
| 235 |
<include name="*.java" /> |
|---|
| 236 |
</javac> |
|---|
| 237 |
</target> |
|---|
| 238 |
|
|---|
| 239 |
</project> |
|---|