protege-hets/build.xml

268 lines
9.5 KiB
XML
Raw Normal View History

2011-01-17 21:10:11 +00:00
<?xml version = "1.0" encoding = "utf-8"?>
<project name = "sample plugin project" default = "install" basedir = ".">
<!--
To run this build file set the environment variable
PROTEGE_HOME to point to a protege distribution and type ant
install or jar.
-->
<property environment="env"/>
<property name = "protege.home" location="${env.PROTEGE_HOME}"/>
<property file = "${protege.home}/build.properties"/>
<property file="local.properties"/>
<!--
**** CHANGE ME ****
This setting defines the name of the plugin.
This may be the only setting that the developer needs to
change.
-->
<property name = "plugin" value = "de.unibremen.informatik.hets"/>
<!--
these properties probably don't need changing
-->
<property name = "src" location = "./src"/>
<property name = "build" location = "./build"/>
<property name = "bundle.dir" location = "${build}"/>
<property name = "classes" location = "${build}/classes"/>
<property name = "lib" location = "./lib"/>
<property name = "genlib" location = "${build}/lib"/>
<property name = "manifest" location = "${build}/manifest.mf"/>
<property name = "protege.common" location="${protege.home}/bundles"/>
<property name = "protege.plugins" location="${protege.home}/plugins"/>
<target name = "init">
<tstamp>
<format property="build.time" pattern="MM/dd/yyyy hh:mm aa"/>
</tstamp>
<mkdir dir = "${build}"/>
<mkdir dir = "${classes}"/>
<!-- <mkdir dir = "${classes}/lib"/> -->
<mkdir dir = "${genlib}"/>
</target>
<!-- ============================================================= -->
<!-- Configuring the Compile Classpath -->
<!-- ============================================================= -->
<target name="checkProtegeLibsAndReport" depends="checkProtegeLibs"
unless="libs.found">
<echo message="Missing protege libraries. You need to set "/>
<echo message="the PROTEGE_HOME environment variable to a"/>
<echo message="protege installation directory where the"/>
<echo message="appropriate plugins have been installed."/>
<echo message="Alternatively set the jar libs in local.properties (protege.lib=...)"/>
<echo message="Use the -v option to ant to see what jars are missing."/>
<fail message = "missing protege libraries"/>
</target>
<!--
**** CHANGE ME ****
The following target only needs to be modified if the user
needs to change the classpath. It is preconfigured to use
the common protege 4 jars, the lib directory and the
libraries that have been uncovered in buildlibs.
-->
<target name = "checkProtegeLibs" depends="init">
<echo message="Using Protege Home = ${protege.home} to find protege jars"/>
<condition property="libs.found">
<and>
<available file="${protege.osgi}" type="file"/>
<available file="${equinox.common}" type = "file"/>
<available file="${equinox.registry}" type = "file"/>
<!-- <available file="${owl.editor.jar}" type = "file"/> -->
<available file="${owl.lib}" type="file"/>
</and>
</condition>
<path id = "project.classpath">
<pathelement location="${protege.osgi}"/>
<pathelement location="${protege.lib}"/>
<pathelement location="${equinox.common}"/>
<pathelement location="${equinox.registry}"/>
<pathelement location="${owl.editor.jar}"/>
<pathelement location="${owl.lib}"/>
<!-- <fileset dir="${lib}"/> -->
<fileset dir="${genlib}"/>
</path>
</target>
<!--
**** CHANGE ME ****
The following target only needs to be modified if the
developer needs to obtain some jar files that are contained in
the Protege bundles. The contents of these jar files are
found when Protege 4 runs but may be needed in order to
compile the plugin.
-->
<target name = "buildlibs" depends="checkProtegeLibsAndReport">
<unjar dest="${build}"
src="${common.lib}">
<patternset>
<include name = "**/log4j.jar"/>
<include name = "**/looks.jar"/>
</patternset>
</unjar>
</target>
<!--
**** CHANGE ME ****
Here is the copy.resources target. It may need modification
to copy the right resources into the classes directory. By
default it already copies non-java files found in the source
directory, the libraries needed by the project and the
viewconfig and the plugin.xml. This will be sufficient in
many cases.
-->
<target name="copy.resources" depends="build.manifest">
<copy todir="${classes}">
<fileset dir="${src}">
<include name="**/*"/>
<exclude name="**/*.java"/>
<exclude name="**/MANIFEST.MF"/>
<exclude name="**/manifest.mf"/>
</fileset>
</copy>
<!-- <copy todir="${classes}/lib">
<fileset dir="${lib}" excludes="junit*.jar"/>
</copy> -->
<copy todir="${classes}">
<fileset dir="." includes="*.xml">
<exclude name="build.xml"/>
</fileset>
</copy>
<!-- the manifest doesn't belong here but this is good for IDE's -->
<mkdir dir="${classes}/META-INF"/>
<copy todir="${classes}/META-INF"
file = "${manifest}"/>
</target>
<!--
It is less likely that the developer will want to make changes
below this line
-->
<!-- ============================================================= -->
<target name = "jjtree">
<jjtree target="./src/de/unibremen/informatik/hets/grammar/HetCASLGrammar.jjt"
outputdirectory="./src/de/unibremen/informatik/hets/grammar/"
javacchome="/usr/share/java/"
/>
</target>
<target name = "javacc" depends = "jjtree">
<javacc target="./src/de/unibremen/informatik/hets/grammar/HetCASLGrammar.jj"
outputdirectory="./src/de/unibremen/informatik/hets/grammar/"
javacchome="/usr/share/java/"
/>
</target>
<target name = "compile" depends = "buildlibs, checkProtegeLibsAndReport, javacc">
<javac srcdir = "${src}"
destdir = "${classes}"
debug="on"
includeAntRuntime="false">
<classpath refid = "project.classpath"/>
</javac>
</target>
<target name="build.manifest">
<copy tofile="${manifest}"
file="META-INF/MANIFEST.MF" overwrite="true"/>
<manifest file="${manifest}"
mode = "update">
<attribute name="Built-By" value = "${user.name}"/>
<attribute name="Build-Date" value = "${build.time}"/>
</manifest>
</target>
<target name = "jar" depends = "compile, copy.resources">
<jar jarfile = "${build}/${plugin}.jar"
basedir = "${classes}"
manifest = "${build}/manifest.mf"/>
</target>
<target name = "install" depends = "jar">
<!-- flush cache -->
<delete dir = "${protege.home}/configuration/org.eclipse.core.runtime"/>
<delete dir = "${protege.home}/configuration/org.eclipse.osgi"/>
<copy file="${build}/${plugin}.jar"
todir = "${protege.plugins}"
overwrite = "true"/>
</target>
<target name = "run" depends="install">
<java fork = "true"
dir = "${protege.home}"
jar = "${protege.osgi}">
<jvmarg value = "-Dfile.encoding=UTF-8"/>
<jvmarg value = "-Xmx500M"/>
<jvmarg value = "-Dlog4j.configuration=file:log4j.xml"/>
</java>
</target>
<target name = "debug" depends="install">
<java fork = "true"
dir = "${protege.home}"
jar = "${protege.osgi}">
<jvmarg value = "-Xmx500M"/>
<jvmarg value = "-Dlog4j.configuration=file:log4j.xml"/>
<jvmarg value = "-Dfile.encoding=UTF-8"/>
<jvmarg value = "-Xrunjdwp:transport=dt_socket,address=8500,server=y,suspend=y"/>
</java>
</target>
<target name = "clean">
<delete dir = "${build}"/>
</target>
<target name = "usage">
<echo message = "To run this script set the PROTEGE_HOME environment"/>
<echo message = "variable and use one of the following targets"/>
<echo message = "jar - builds the jar (bundle) file for this project"/>
<echo message = "install - installs the bundle into the Protege distribution"/>
<echo message = "copy.resources - copyies resources into the classes directory"/>
<echo message = " this can be useful for ide developers - see the wiki"/>
<echo message = "run - install the plugin and run protege"/>
<echo message = "debug - install the plugin and start protege for debug"/>
</target>
<!--
Standard properties that should not require changing
-->
<property name="equinox.common"
location="${protege.common}/org.eclipse.equinox.common.jar"/>
<property name="equinox.registry"
location="${protege.common}/org.eclipse.equinox.registry.jar"/>
<property name="protege.lib"
location="${protege.common}/org.protege.editor.core.application.jar"/>
<property name="common.lib"
location="${protege.common}/org.protege.common.jar"/>
<property name="owl.lib"
location="${protege.plugins}/org.semanticweb.owl.owlapi.jar"/>
<property name="owl.editor.jar"
location="${protege.plugins}/org.protege.editor.owl.jar"/>
</project>