212 lines
8 KiB
XML
212 lines
8 KiB
XML
<?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"/>
|
|
|
|
<property name = "plugin" value = "de.unibremen.informatik.hets"/>
|
|
|
|
<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 = "${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>
|
|
|
|
<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="${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 -->
|
|
<mkdir dir="${classes}/META-INF"/>
|
|
<copy todir="${classes}/META-INF"
|
|
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}"
|
|
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 dir = "${protege.home}"
|
|
classname = "org.protege.osgi.framework.Launcher"
|
|
classpath = "${protege.osgi}:${protege.launcher}"
|
|
fork="true">
|
|
<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}"/>
|
|
<delete>
|
|
<fileset dir = "${src}/de/unibremen/informatik/hets/grammar/" includes = "*.java *.jj" />
|
|
</delete>
|
|
</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>
|
|
|
|
<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>
|