protege-hets/build.xml

213 lines
8 KiB
XML
Raw Normal View History

2011-01-17 21:10:11 +00:00
<?xml version = "1.0" encoding = "utf-8"?>
2011-01-18 09:44:56 +00:00
<project name = "sample plugin project" default = "install" basedir = ".">
2011-01-17 21:10:11 +00:00
2011-01-18 09:44:56 +00:00
<!--
2011-01-17 21:10:11 +00:00
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"/>
<property name = "plugin" value = "de.unibremen.informatik.hets"/>
2011-01-18 09:44:56 +00:00
<property name = "src" location = "./src"/>
2011-01-17 21:10:11 +00:00
<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 = "${genlib}"/>
2011-01-18 09:44:56 +00:00
</target>
2011-01-17 21:10:11 +00:00
<!-- ============================================================= -->
<!-- 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>
<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"/>
2011-01-18 09:44:56 +00:00
<available file="${owl.editor.jar}" type = "file"/>
2011-01-17 21:10:11 +00:00
<available file="${owl.lib}" type="file"/>
</and>
</condition>
2011-01-18 09:44:56 +00:00
<path id = "project.classpath">
2011-01-17 21:10:11 +00:00
<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="${genlib}"/>
</path>
</target>
<target name = "buildlibs" depends="checkProtegeLibsAndReport">
<unjar dest="${build}"
src="${common.lib}">
<patternset>
<include name = "**/log4j.jar"/>
<include name = "**/looks.jar"/>
</patternset>
</unjar>
</target>
<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}">
<fileset dir="." includes="*.xml">
<exclude name="build.xml"/>
</fileset>
</copy>
<!-- the manifest doesn't belong here but this is good for IDE's -->
2011-01-18 09:44:56 +00:00
<mkdir dir="${classes}/META-INF"/>
<copy todir="${classes}/META-INF"
2011-01-17 21:10:11 +00:00
file = "${manifest}"/>
</target>
<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}"
2011-01-18 09:44:56 +00:00
destdir = "${classes}"
2011-01-17 21:10:11 +00:00
debug="on"
includeAntRuntime="false">
2011-01-18 09:44:56 +00:00
<classpath refid = "project.classpath"/>
2011-01-17 21:10:11 +00:00
</javac>
</target>
<target name="build.manifest">
2011-01-18 09:44:56 +00:00
<copy tofile="${manifest}"
2011-01-17 21:10:11 +00:00
file="META-INF/MANIFEST.MF" overwrite="true"/>
2011-01-18 09:44:56 +00:00
<manifest file="${manifest}"
2011-01-17 21:10:11 +00:00
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"
2011-01-18 09:44:56 +00:00
basedir = "${classes}"
2011-01-17 21:10:11 +00:00
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"/>
2011-01-18 09:44:56 +00:00
<copy file="${build}/${plugin}.jar"
2011-01-17 21:10:11 +00:00
todir = "${protege.plugins}"
overwrite = "true"/>
</target>
<target name = "run" depends="install">
2011-01-18 09:44:56 +00:00
<java dir = "${protege.home}"
classname = "org.protege.osgi.framework.Launcher"
classpath = "${protege.osgi}:${protege.launcher}"
fork="true">
2011-01-17 21:10:11 +00:00
<jvmarg value = "-Dfile.encoding=UTF-8"/>
<jvmarg value = "-Xmx500M"/>
<jvmarg value = "-Dlog4j.configuration=file:log4j.xml"/>
</java>
</target>
<target name = "debug" depends="install">
2011-01-18 09:44:56 +00:00
<java fork = "true"
dir = "${protege.home}"
2011-01-17 21:10:11 +00:00
jar = "${protege.osgi}">
<jvmarg value = "-Xmx500M"/>
<jvmarg value = "-Dlog4j.configuration=file:log4j.xml"/>
<jvmarg value = "-Dfile.encoding=UTF-8"/>
2011-01-18 09:44:56 +00:00
<jvmarg value = "-Xrunjdwp:transport=dt_socket,address=8500,server=y,suspend=y"/>
2011-01-17 21:10:11 +00:00
</java>
</target>
<target name = "clean">
<delete dir = "${build}"/>
2011-01-18 09:55:12 +00:00
<delete>
<fileset dir = "${src}/de/unibremen/informatik/hets/grammar/" includes = "*.java *.jj" />
</delete>
2011-01-17 21:10:11 +00:00
</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>
2011-01-18 09:44:56 +00:00
<property name="equinox.common"
2011-01-17 21:10:11 +00:00
location="${protege.common}/org.eclipse.equinox.common.jar"/>
<property name="equinox.registry"
location="${protege.common}/org.eclipse.equinox.registry.jar"/>
2011-01-18 09:44:56 +00:00
<property name="protege.lib"
2011-01-17 21:10:11 +00:00
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>