| 1 |
<?xml version="1.0"?> |
| 2 |
|
| 3 |
<!-- ================================================================ --> |
| 4 |
<!-- Protege-OWL build file for ant (build.xml) --> |
| 5 |
<!-- ================================================================ --> |
| 6 |
|
| 7 |
<!-- Send any questions, comments, fixes, etc. to "randy AT randykerber.com" |
| 8 |
--> |
| 9 |
|
| 10 |
<project name="Protege-OWL" default="usage" basedir="."> |
| 11 |
|
| 12 |
<property environment="env"/> |
| 13 |
<property file = "local.properties"/> |
| 14 |
|
| 15 |
|
| 16 |
<property name = "src" value = "./src"/> |
| 17 |
<property name = "classes" value = "./classes"/> |
| 18 |
<property name = "lib" value = "./lib"/> |
| 19 |
<property name = "dist" value = "./plugins"/> |
| 20 |
<property name = "etc" value = "./etc"/> |
| 21 |
<property name = "owlplugin" value = "edu.stanford.smi.protegex.owl"/> |
| 22 |
<property name = "plugin" value = "${dist}/${owlplugin}"/> |
| 23 |
<property name = "pluginName" value="protege-owl"/> |
| 24 |
<property name = "debug" value = "on"/> |
| 25 |
<property name = "source" value = "1.5"/> |
| 26 |
<property name = "deprecation" value = "off"/> |
| 27 |
<property name = "jarfile" value = "${dist}/${pluginName}.jar"/> |
| 28 |
|
| 29 |
<property name = "manchesterParseDir" |
| 30 |
value = "${src}/edu/stanford/smi/protegex/owl/model/classparser/manchester"/> |
| 31 |
<property name = "dlParseDir" |
| 32 |
value = "${src}/edu/stanford/smi/protegex/owl/model/classparser/dl"/> |
| 33 |
<property name = "compactParseDir" |
| 34 |
value = "${src}/edu/stanford/smi/protegex/owl/model/classparser/compact"/> |
| 35 |
|
| 36 |
<property name = "junit" value = "./junit"/> |
| 37 |
|
| 38 |
<!-- =================================================================== --> |
| 39 |
<!-- USAGE --> |
| 40 |
<!-- Instructions for using the build file --> |
| 41 |
<!-- =================================================================== --> |
| 42 |
<target name = "usage" depends = "init"> |
| 43 |
<echo message = ""/> |
| 44 |
<echo message = "protege owl build instructions"/> |
| 45 |
<echo message = "-------------------------------------------------------------"/> |
| 46 |
<echo message = ""/> |
| 47 |
<echo message = " available targets are:"/> |
| 48 |
<echo message = ""/> |
| 49 |
<echo message = " usage --> provides help on using the build tool (default)"/> |
| 50 |
<echo message = " clean --> cleans up all build related files and dirs"/> |
| 51 |
<echo message = " compile --> compiles the source code"/> |
| 52 |
<echo message = " plugin.dir --> copies files into the Protege plugin directory"/> |
| 53 |
<echo message = " plugin.zip --> creates the protege-owl.zip file, containing the plugin dir"/> |
| 54 |
<echo message = ""/> |
| 55 |
<echo message = "-------------------------------------------------------------"/> |
| 56 |
<echo message = ""/> |
| 57 |
</target> |
| 58 |
|
| 59 |
|
| 60 |
<!-- ================================================================ --> |
| 61 |
<!-- Creates the timestamp --> |
| 62 |
<!-- ================================================================ --> |
| 63 |
|
| 64 |
<target name="init.time" depends=""> |
| 65 |
<tstamp/> |
| 66 |
</target> |
| 67 |
|
| 68 |
<target name="init" depends="init.time"> |
| 69 |
<path id="classpath.compile"> |
| 70 |
<fileset dir="${lib}"/> |
| 71 |
</path> |
| 72 |
<mkdir dir="${classes}"/> |
| 73 |
<mkdir dir="${dist}"/> |
| 74 |
</target> |
| 75 |
|
| 76 |
<!-- ================================================================ --> |
| 77 |
<!-- Build the classpath --> |
| 78 |
<!-- --> |
| 79 |
<!-- ================================================================ --> |
| 80 |
|
| 81 |
<!-- ================================================================ --> |
| 82 |
<!-- Clean up build directories --> |
| 83 |
<!-- ================================================================ --> |
| 84 |
|
| 85 |
<target name="clean" depends="init" |
| 86 |
description="clean up all build related files and dirs"> |
| 87 |
<delete dir="${classes}"/> |
| 88 |
<delete dir="${dist}"/> |
| 89 |
<delete dir="logs"/> |
| 90 |
<delete file="out.owl"/> |
| 91 |
<delete file="out.repository"/> |
| 92 |
</target> |
| 93 |
|
| 94 |
<target name="javacc-compact"> |
| 95 |
<delete file="${compactParseDir}/CompactParser.java"/> |
| 96 |
<delete file="${compactParseDir}/CompactParserConstants.java"/> |
| 97 |
<delete file="${compactParseDir}/CompactParserTokenManager.java"/> |
| 98 |
<delete file="${compactParseDir}/JavaCharStream.java"/> |
| 99 |
<delete file="${compactParseDir}/ParseException.java"/> |
| 100 |
<delete file="${compactParseDir}/Token.java"/> |
| 101 |
<delete file="${compactParseDir}/TokenMgrError.java"/> |
| 102 |
<!-- Run JavaCC on Parser.jj to regenerate files that were deleted in above step. --> |
| 103 |
<javacc javacchome = "${javacc.home}/bin/lib" |
| 104 |
target = "${compactParseDir}/CompactParser.jj" |
| 105 |
outputdirectory = "${compactParseDir}"/> |
| 106 |
</target> |
| 107 |
|
| 108 |
|
| 109 |
<target name="javacc-dl"> |
| 110 |
<delete file="${dlParseDir}/DLSyntaxParser.java"/> |
| 111 |
<delete file="${dlParseDir}/DLSyntaxParserConstants.java"/> |
| 112 |
<delete file="${dlParseDir}/DLSyntaxParserTokenManager.java"/> |
| 113 |
<delete file="${dlParseDir}/JavaCharStream.java"/> |
| 114 |
<delete file="${dlParseDir}/ParseException.java"/> |
| 115 |
<delete file="${dlParseDir}/Token.java"/> |
| 116 |
<delete file="${dlParseDir}/TokenMgrError.java"/> |
| 117 |
<!-- Run JavaCC on Parser.jj to regenerate files that were deleted in above step. --> |
| 118 |
<javacc javacchome = "${javacc.home}/bin/lib" |
| 119 |
target = "${dlParseDir}/DLSyntaxParser.jj" |
| 120 |
outputdirectory = "${dlParseDir}"/> |
| 121 |
</target> |
| 122 |
|
| 123 |
|
| 124 |
<target name="javacc-manchester"> |
| 125 |
<delete file="${manchesterParseDir}/JavaCharStream.java"/> |
| 126 |
<delete file="${manchesterParseDir}/ManchesterOWLParser.java"/> |
| 127 |
<delete file="${manchesterParseDir}/ManchesterOWLParserConstants.java"/> |
| 128 |
<delete file="${manchesterParseDir}/ManchesterOWLParserTokenManager.java"/> |
| 129 |
<delete file="${manchesterParseDir}/ParseException.java"/> |
| 130 |
<delete file="${manchesterParseDir}/Token.java"/> |
| 131 |
<delete file="${manchesterParseDir}/TokenMgrError.java"/> |
| 132 |
<!-- Run JavaCC on Parser.jj to regenerate files that were deleted in above step. --> |
| 133 |
<javacc javacchome = "${javacc.home}/bin/lib" |
| 134 |
target = "${manchesterParseDir}/ManchesterOWLParser.jj" |
| 135 |
outputdirectory = "${manchesterParseDir}"/> |
| 136 |
</target> |
| 137 |
|
| 138 |
<!-- =================================================================== --> |
| 139 |
<target name = "javacc" |
| 140 |
depends = "javacc-manchester,javacc-dl,javacc-compact"> |
| 141 |
</target> |
| 142 |
|
| 143 |
|
| 144 |
|
| 145 |
<!-- ================================================================ --> |
| 146 |
<!-- Compile the source code --> |
| 147 |
<!-- ================================================================ --> |
| 148 |
|
| 149 |
<target name="compile" depends="init" description="compile the Java files" > |
| 150 |
<javac srcdir="${src}" destdir="${classes}" |
| 151 |
deprecation = "${deprecation}" |
| 152 |
debug = "${debug}" |
| 153 |
source = "${source}"> |
| 154 |
<classpath refid="classpath.compile"/> |
| 155 |
</javac> |
| 156 |
<copy todir="${classes}/edu/stanford/smi/protegex/owl/jena" |
| 157 |
file="${src}/edu/stanford/smi/protegex/owl/jena/OWL.pprj"/> |
| 158 |
<copy todir="${classes}/edu/stanford/smi/protegex/owl/jena" |
| 159 |
file="${src}/edu/stanford/smi/protegex/owl/jena/OWL-min.pprj"/> |
| 160 |
<copy todir="${classes}/edu/stanford/smi/protegex/owl/database" |
| 161 |
file="${src}/edu/stanford/smi/protegex/owl/database/OWL.pprj"/> |
| 162 |
<copy todir="${classes}/edu/stanford/smi/protegex/owl/resource/files"> |
| 163 |
<fileset dir="${src}/edu/stanford/smi/protegex/owl/resource/files"/> |
| 164 |
</copy> |
| 165 |
</target> |
| 166 |
|
| 167 |
<!-- ================================================================ --> |
| 168 |
<!-- create the protege-owl.jar file --> |
| 169 |
<!-- ================================================================ --> |
| 170 |
|
| 171 |
<target name="jar" depends="compile" description="Create the protege-owl.jar file"> |
| 172 |
<jar jarfile="${jarfile}" |
| 173 |
manifest="${src}/META-INF/MANIFEST.MF"> |
| 174 |
<fileset dir="${classes}"/> |
| 175 |
<fileset dir="${src}/"> |
| 176 |
<include name="**/*.gif"/> |
| 177 |
</fileset> |
| 178 |
<fileset dir="${src}/"> |
| 179 |
<include name="**/*.png"/> |
| 180 |
</fileset> |
| 181 |
<fileset dir="${src}/"> |
| 182 |
<include name="**/*.db"/> |
| 183 |
</fileset> |
| 184 |
</jar> |
| 185 |
</target> |
| 186 |
|
| 187 |
<!-- ================================================================ --> |
| 188 |
<!-- Copy files into the Protege plugin directory --> |
| 189 |
<!-- ================================================================ --> |
| 190 |
|
| 191 |
<target name="plugin.dir" depends="jar" |
| 192 |
description="Make the directory that becomes a Protege plugin dir"> |
| 193 |
<delete dir="${plugin}"/> |
| 194 |
<mkdir dir="${plugin}"/> |
| 195 |
|
| 196 |
<copy todir="${plugin}"> |
| 197 |
<fileset file="${jarfile}"/> |
| 198 |
<fileset dir="${lib}"> |
| 199 |
<exclude name="looks.jar"/> |
| 200 |
<exclude name="protege*.jar"/> |
| 201 |
</fileset> |
| 202 |
<fileset dir="${etc}"> |
| 203 |
<include name="plugin.properties"/> |
| 204 |
<include name="ont-policy.rdf"/> |
| 205 |
<include name="OWLProfiles.owl"/> |
| 206 |
<include name="protege.owl"/> |
| 207 |
<include name="swrl.owl"/> |
| 208 |
<include name="swrlb.owl"/> |
| 209 |
<exclude name="MANIFEST.MF"/> |
| 210 |
<exclude name="OWL.pprj"/> |
| 211 |
</fileset> |
| 212 |
</copy> |
| 213 |
</target> |
| 214 |
|
| 215 |
|
| 216 |
<target name="plugin.zip" |
| 217 |
depends="plugin.dir" |
| 218 |
description="Create the protege-owl.zip file, containing the plugin dir"> |
| 219 |
<zip destfile="${dist}/${pluginName}.zip"> |
| 220 |
<fileset dir="${dist}"> |
| 221 |
<include name="${owlplugin}/**"/> |
| 222 |
</fileset> |
| 223 |
</zip> |
| 224 |
</target> |
| 225 |
|
| 226 |
|
| 227 |
<target name = "junit-compile" depends = "jar"> |
| 228 |
<javac srcdir = "${junit}" destdir = "${classes}" debug = "on"> |
| 229 |
<classpath refid = "classpath.compile"/> |
| 230 |
<classpath> |
| 231 |
<pathelement location = "${jarfile}"/> |
| 232 |
<pathelement location = "${lib}/protege-test.jar"/> |
| 233 |
</classpath> |
| 234 |
</javac> |
| 235 |
</target> |
| 236 |
|
| 237 |
<target name = "checkJunitConfiguration" depends = "junit-compile"> |
| 238 |
<java classname = "edu.stanford.smi.protegex.owl.junit_config.CheckConfiguration"> |
| 239 |
<classpath> |
| 240 |
<pathelement location="${classes}"/> |
| 241 |
<pathelement location = "${lib}/protege.jar"/> |
| 242 |
<pathelement location = "${lib}/protege-test.jar"/> |
| 243 |
<pathelement location = "${lib}/junit.jar"/> |
| 244 |
</classpath> |
| 245 |
</java> |
| 246 |
</target> |
| 247 |
|
| 248 |
<!-- |
| 249 |
My experience is that "ant junit" provides almost no debugging |
| 250 |
information when things go wrong. (This was not true in my |
| 251 |
previous job and I don't know the difference. log4j??) When there is a |
| 252 |
problem I generally use my development environment to debug |
| 253 |
faulting junit. For scripting problems with the junits the options |
| 254 |
|
| 255 |
filtertrace="false" |
| 256 |
showoutput="true" |
| 257 |
|
| 258 |
give a little more information. Also when you know that some |
| 259 |
junits are failing, removing the option |
| 260 |
|
| 261 |
haltonfailure = "on" |
| 262 |
|
| 263 |
is helpful for showing all the failures. But in the committed |
| 264 |
version I think that this option is very important because it |
| 265 |
means that the developer will never mistakenly believe that |
| 266 |
junits have succeeded. |
| 267 |
--> |
| 268 |
<target name = "junit" |
| 269 |
description = "run the tests (anybody can do it)" |
| 270 |
depends = "plugin.dir,junit-compile,checkJunitConfiguration"> |
| 271 |
<junit printsummary="withOutAndErr" |
| 272 |
dir = "." |
| 273 |
fork = "yes" |
| 274 |
haltonfailure = "on" |
| 275 |
haltonerror = "on"> |
| 276 |
<jvmarg value="-Xmx300M"/> |
| 277 |
<classpath> |
| 278 |
<pathelement location="${classes}"/> |
| 279 |
<pathelement location = "${lib}/protege.jar"/> |
| 280 |
<pathelement location = "${lib}/protege-test.jar"/> |
| 281 |
<fileset |
| 282 |
dir="${plugin}"> |
| 283 |
<include name = "**/*.jar"/> |
| 284 |
</fileset> |
| 285 |
<fileset |
| 286 |
dir="dbdrivers"> |
| 287 |
<include name = "**/*.jar"/> |
| 288 |
</fileset> |
| 289 |
</classpath> |
| 290 |
<batchtest> |
| 291 |
<fileset dir="${junit}"> |
| 292 |
<include name = "**/*TestCase.java"/> |
| 293 |
<exclude name = "**/*Abstract*.java"/> |
| 294 |
<exclude name = "**/*FailedTestCase.java"/> |
| 295 |
</fileset> |
| 296 |
</batchtest> |
| 297 |
</junit> |
| 298 |
</target> |
| 299 |
|
| 300 |
|
| 301 |
</project> |