| 1 |
<?xml version="1.0"?> |
| 2 |
|
| 3 |
<!-- ================================================================ --> |
| 4 |
<!-- SWRLJessBridge 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="swrl-jess-bridge" default="usage" basedir="."> |
| 11 |
|
| 12 |
<property environment="env"/> |
| 13 |
<property name="protege.home" location="${env.PROTEGE_HOME}"/> |
| 14 |
<property name="jess.home" location="${env.JESSHOME}"/> |
| 15 |
|
| 16 |
<property file = "local.properties"/> |
| 17 |
|
| 18 |
<property name = "src" value = "./src"/> |
| 19 |
<property name = "build" location = "./ant-build"/> |
| 20 |
<property name = "classes" value = "${build}/classes"/> |
| 21 |
<property name = "lib" value = "./lib"/> |
| 22 |
<property name = "dist" value = "./dist"/> |
| 23 |
<property name = "jarfile" value = "${dist}/swrl-jess-bridge.jar"/> |
| 24 |
<property name = "etc" value = "./etc"/> |
| 25 |
<property name = "owlplugin" value = "edu.stanford.smi.protegex.owl"/> |
| 26 |
<property name = "plugin" value = "${dist}/${owlplugin}"/> |
| 27 |
<property name = "debug" value = "on"/> |
| 28 |
<property name = "source" value = "1.5"/> |
| 29 |
<property name = "deprecation" value = "off"/> |
| 30 |
|
| 31 |
|
| 32 |
<!-- =================================================================== --> |
| 33 |
<!-- USAGE --> |
| 34 |
<!-- Instructions for using the build file --> |
| 35 |
<!-- =================================================================== --> |
| 36 |
<target name = "usage" depends = "init"> |
| 37 |
<echo message = ""/> |
| 38 |
<echo message = "swrl-jess-bridge build instructions"/> |
| 39 |
<echo message = "-------------------------------------------------------------"/> |
| 40 |
<echo message = ""/> |
| 41 |
<echo message = " available targets are:"/> |
| 42 |
<echo message = ""/> |
| 43 |
<echo message = " usage --> provides help on using the build tool (default)"/> |
| 44 |
<echo message = " clean --> cleans up all build related files and dirs"/> |
| 45 |
<echo message = " compile --> compiles the source code"/> |
| 46 |
<echo message = " jar --> build a swrl-jess-bridge.jar"/> |
| 47 |
<echo message = " plugin.dir --> copies files into the Protege plugin directory"/> |
| 48 |
<echo message = " plugin.zip --> creates the swrl-jess-bridge.zip file containing the plugin directory"/> |
| 49 |
<echo message = " install --> install in Protege-OWL plugins directory"/> |
| 50 |
<echo message = ""/> |
| 51 |
<echo message = "-------------------------------------------------------------"/> |
| 52 |
<echo message = ""/> |
| 53 |
</target> |
| 54 |
|
| 55 |
|
| 56 |
<target name="checkJessHome"> |
| 57 |
<condition property="jess.home.set"> |
| 58 |
<available file="${jess.home}/lib/jess.jar" type="file"/> |
| 59 |
</condition> |
| 60 |
</target> |
| 61 |
|
| 62 |
<target name="useJessHome" depends="checkJessHome" if="jess.home.set"> |
| 63 |
<echo message="Using Jess Home = ${jess.home} to find jess.jar"/> |
| 64 |
<property name="jess.lib" value="${jess.home}/lib/jess.jar"/> |
| 65 |
</target> |
| 66 |
|
| 67 |
<target name="checkProtegeHome"> |
| 68 |
<condition property="protege.home.set"> |
| 69 |
<available file="${protege.home}/protege.jar" type="file"/> |
| 70 |
</condition> |
| 71 |
</target> |
| 72 |
|
| 73 |
<target name="useProtegeHome" depends="checkProtegeHome" if="protege.home.set"> |
| 74 |
<echo message="Using Protege Home = ${protege.home} to find protege jars"/> |
| 75 |
<property name="owl.portability.lib" value="${protege.home}/plugins/${owlplugin}/owl-portability.jar"/> |
| 76 |
<property name="swrl.api.lib" value="${protege.home}/plugins/${owlplugin}/swrl-api.jar"/> |
| 77 |
</target> |
| 78 |
|
| 79 |
<target name = "checkLibs" depends="useProtegeHome, useJessHome"> |
| 80 |
<condition property="libs.found"> |
| 81 |
<and> |
| 82 |
<available file="${owl.portability.lib}" type = "file"/> |
| 83 |
<available file="${swrl.api.lib}" type = "file"/> |
| 84 |
<available file="${jess.lib}" type = "file"/> |
| 85 |
</and> |
| 86 |
</condition> |
| 87 |
<path id = "classpath.compile"> |
| 88 |
<pathelement location = "${owl.portability.lib}"/> |
| 89 |
<pathelement location = "${swrl.api.lib}"/> |
| 90 |
<pathelement location = "${jess.lib}"/> |
| 91 |
<fileset dir="${lib}"/> |
| 92 |
</path> |
| 93 |
</target> |
| 94 |
|
| 95 |
<target name="checkLibsAndReport" depends="checkLibs" unless="libs.found"> |
| 96 |
<echo message="Missing libraries. You need to set "/> |
| 97 |
<echo message="the PROTEGE_HOME and JESSHOME environment variable to the"/> |
| 98 |
<echo message="protege installation directory and the Jess installation directory, respectively."/> |
| 99 |
<echo message="Alternatively set the jar libs in local.properties (protege.lib=...)"/> |
| 100 |
<echo message="Use the -v option to ant to see what jars are missing."/> |
| 101 |
<fail message = "missing libraries"/> |
| 102 |
</target> |
| 103 |
|
| 104 |
<!-- ================================================================ --> |
| 105 |
<!-- Creates the timestamp --> |
| 106 |
<!-- ================================================================ --> |
| 107 |
|
| 108 |
<target name="init.time" depends="checkProtegeHome, checkJessHome"> |
| 109 |
<tstamp/> |
| 110 |
</target> |
| 111 |
|
| 112 |
<target name="init" depends="init.time"> |
| 113 |
<mkdir dir="${classes}"/> |
| 114 |
<mkdir dir="${dist}"/> |
| 115 |
</target> |
| 116 |
|
| 117 |
<!-- ================================================================ --> |
| 118 |
<!-- Build the classpath --> |
| 119 |
<!-- --> |
| 120 |
<!-- ================================================================ --> |
| 121 |
|
| 122 |
<!-- ================================================================ --> |
| 123 |
<!-- Clean up build directories --> |
| 124 |
<!-- ================================================================ --> |
| 125 |
|
| 126 |
<target name="clean" depends="init" |
| 127 |
description="clean up all build related files and dirs"> |
| 128 |
<delete dir="${classes}"/> |
| 129 |
<delete dir="${dist}"/> |
| 130 |
</target> |
| 131 |
|
| 132 |
|
| 133 |
<!-- ================================================================ --> |
| 134 |
<!-- Compile the source code --> |
| 135 |
<!-- ================================================================ --> |
| 136 |
|
| 137 |
<target name="compile" depends="init,checkLibsAndReport" |
| 138 |
description="compile the Java files" > |
| 139 |
<javac srcdir="${src}" destdir="${classes}" |
| 140 |
deprecation = "${deprecation}" |
| 141 |
debug = "${debug}" |
| 142 |
source = "${source}" |
| 143 |
includeAntRuntime="false"> |
| 144 |
<classpath refid="classpath.compile"/> |
| 145 |
</javac> |
| 146 |
</target> |
| 147 |
|
| 148 |
<!-- ================================================================ --> |
| 149 |
<!-- create the swrl-jess-bridge.jar file --> |
| 150 |
<!-- ================================================================ --> |
| 151 |
|
| 152 |
<target name="jar" depends="compile" description="Create the swrl-jess-bridge.jar file"> |
| 153 |
<jar jarfile="${jarfile}" |
| 154 |
manifest="${src}/META-INF/MANIFEST.mf"> |
| 155 |
<fileset dir="${classes}"/> |
| 156 |
<fileset dir="${src}/"> |
| 157 |
<include name="**/*.gif"/> |
| 158 |
</fileset> |
| 159 |
<fileset dir="${src}/"> |
| 160 |
<include name="**/*.png"/> |
| 161 |
</fileset> |
| 162 |
<fileset dir="${src}/"> |
| 163 |
<include name="**/*.db"/> |
| 164 |
</fileset> |
| 165 |
</jar> |
| 166 |
</target> |
| 167 |
|
| 168 |
<!-- ================================================================ --> |
| 169 |
<!-- Copy files into the Protege-OWL plugin directory --> |
| 170 |
<!-- ================================================================ --> |
| 171 |
|
| 172 |
<target name="plugin.dir" depends="jar" |
| 173 |
description="Make the directory that becomes a Protege-OWL plugin dir"> |
| 174 |
<delete dir="${plugin}"/> |
| 175 |
<mkdir dir="${plugin}"/> |
| 176 |
|
| 177 |
<copy todir="${plugin}"> |
| 178 |
<fileset file="${jarfile}"/> |
| 179 |
</copy> |
| 180 |
</target> |
| 181 |
|
| 182 |
|
| 183 |
<target name="plugin.zip" |
| 184 |
depends="plugin.dir" |
| 185 |
description="Create the swrl-jess-bridge.zip file, containing the plugin dir"> |
| 186 |
<zip destfile="${dist}/swrl-jess-bridge.zip"> |
| 187 |
<fileset dir="${dist}"> |
| 188 |
<include name="${owlplugin}/**"/> |
| 189 |
</fileset> |
| 190 |
</zip> |
| 191 |
</target> |
| 192 |
|
| 193 |
<target name = "install" depends = "plugin.zip"> |
| 194 |
<fail message = "set the protege.home variable to do an install"> |
| 195 |
<condition> |
| 196 |
<not> |
| 197 |
<isset property="protege.home.set"/> |
| 198 |
</not> |
| 199 |
</condition> |
| 200 |
</fail> |
| 201 |
<unzip src="${dist}/swrl-jess-bridge.zip" |
| 202 |
dest = "${protege.home}/plugins" |
| 203 |
overwrite = "true"/> |
| 204 |
<copy file = "${jess.lib}" |
| 205 |
todir = "${protege.home}/plugins/${owlplugin}"/> |
| 206 |
</target> |
| 207 |
|
| 208 |
|
| 209 |
</project> |