Newer
Older
<?xml version="1.0" encoding="iso-8859-1" ?>
<!-- $Id$ -->
<project name="align" default="compile" basedir="."
xmlns:artifact="antlib:org.apache.maven.artifact.ant">
<!-- this is useful but introduces, Xlint:path warnings -->
<path id="classpath">
<fileset dir="./lib">
<include name="**/*.jar"/>
<!-- several useless (and may be harmful) things at the moment -->
<exclude name="seals/seals-omt-client.jar" />
<!--exclude name="slf4j/logback-core-1.2.3.jar" />
<exclude name="slf4j/logback-classic-1.2.3.jar" /-->
<target name="usage" depends="versionnumber">
<echo>ant _target_ _options_
usage: this message
init: sets necessary variables
upgrade: retrieve necessary libraries from other projects (local)
compile: incrementaly compiles sources
compileall: recompiles all sources
lint: compiles all sources with bug flags on
jar: archives compiled code
test: performs unit tests
aserv: creates an empty jar file for launching servers
zip: creates a new zip file
javadoc: generates documentation
release: releases a new version
mavenize: creates a maven local repository
cover: check test coverage
analyse: perform static analysis
svnbranch: copy the version under svn
clean: clean-up before release
-Dversion=${version} -Dsvn.revision=${svn.revision} -Dversion.update=${version.update}
<target name="bind" description="Set variables">
<property file="../build.properties"/>
<!-- This should now be handled by GForge -->
Jérôme Euzenat
committed
<property name="tooldir" value="tools" />
<property name="libdir" value="lib" />
<property name="classpath" value="classes"/>
<property name="tempdir" value="/tmp"/>
<!-- for downgrading -->
Jérôme Euzenat
committed
<!--property name="ant.build.javac.source" value="1.7"/>
<property name="ant.build.javac.target" value="1.7"/-->
<!-- when using logback -->
Jérôme Euzenat
committed
<property name="logback.configurationFile" value="logback.xml"/>
<target name="versionnumber" depends="bind" description="Establishes the version number">
<tstamp><format locale="fr,fr" pattern="dd/MM/yyyy" property="date"/></tstamp>
<property name="version.minor" value="9"/>
<property name="copyyear" value="2003-2017"/>
<exec executable="svnversion" outputproperty="svn.rev" failifexecutionfails="false"/>
<condition property="svn.revision" value="${svn.rev}" else="nosvn">
<isset property="svn.rev"/>
</condition>
<!-- second attempt -->
<!--exec executable="svn" output="/tmp/svn.properties">
<arg value="info" />
</exec-->
<property prefix="svn" file="/tmp/svn.properties"/>
<property name="svn.rev" value="${svn.Revision}"/>
<property name="version" value="${version.major}.${version.minor}"/>
<property name="login" value="${user.name}"/>
<property name="debug" value="on"/>
<property name="rep" value="svn+ssh://scm.gforge.inria.fr/svn/alignapi"/>
<filter token="DATE" value="${date}"/>
<filter token="VERS" value="${version}"/>
</target>
<target name="upgrade" description="Upgrade local dependencies">
<copy file="../ontosim/lib/ontosim.jar" todir="lib/ontosim" filtering="false"/>
<echo message="Do not forget to upgrade the POM that ontosim has not" />
<target name="compile" depends="bind" description="Incrementally compile source files">
<property name="javacargs" value="-deprecation" />
<javac deprecation="yes" debug="on" includeantruntime="false" nowarn="no" verbose="no" srcdir="src" destdir="classes" encoding="iso8859-15">
Jérôme Euzenat
committed
<compilerarg line="${javacargs}"/>
<classpath refid="classpath"/>
</javac>
</target>
<target name="compileall" depends="versionnumber" description="Recompile all source files and create jar">
<fileset dir="." includes="classes/**/*.class"/>
<antcall target="cleanjar"/>
<antcall target="jar"/>
<ant dir="plugins/webcontent" target="compileall" />
<target name="lint" depends="bind" description="Check sources for warnings">
<echo message="Setting property..."/>
<!-- values: all,cast,classfile,deprecation,dep-ann,divzero,empty,fallthrough,finally,options,overrides,path,processing,rawtypes,serial,static,try,unchecked,varargs,-cast,-classfile,-deprecation,-dep-ann,-divzero,-empty,-fallthrough,-finally,-options,-overrides,-path,-processing,-rawtypes,-serial,-static,-try,-unchecked,-varargs,none -->
Jérôme Euzenat
committed
<!-- $javacargs has to be used used in a compilearg with a line (not value) argument for accepting several arguments -->
<property name="javacargs" value="-Xlint:all -Xdiags:verbose" />
<antcall target="compileall"/>
</target>
<target name="analyse" depends="jar" description="Perform static analysis of code">
<!-- Checkstyle
classpath="${tooldir}/checkstyle/checkstyle-all-5.0.jar"/-->
<!-- // I must have a checks.xml -->
<!--checkstyle config="docs/sun_checks.xml">
<fileset dir="src" includes="**/*.java"/>
// let see if we can put a css
<formatter type="xml" toFile="test/html/checkstyle.xml"/>
<!-- For running findbugs:
unzip findbugs release anywhere
link it to tools/findbugs (or its lib directory to tools/findbugs/lib)
-->
<taskdef name="findbugs" classpath="${tooldir}/findbugs/lib/findbugs-ant.jar" classname="edu.umd.cs.findbugs.anttask.FindBugsTask" />
<findbugs home="${tooldir}/findbugs"
output="html"
sort="false"
outputFile="test/html/bugs.html" >
<auxClasspath path="lib/oyster/oyster.jar" />
<sourcePath path="src" />
<class location="lib/align.jar" />
<class location="lib/procalign.jar" />
<class location="lib/ontowrap.jar" />
<class location="lib/alignsvc.jar" />
</findbugs>
<taskdef name="pmd" classpath="${tooldir}/pmd/pmd-ant.jar" classname="net.sourceforge.pmd.ant.PMDTask"/>
<pmd shortFilenames="true">
<ruleset>rulesets/favorites.xml</ruleset>
<ruleset>basic</ruleset>
<formatter type="html" toFile="pmd_report.html" linkPrefix="http://pmd.sourceforge.net/xref/"/>
<fileset dir="/usr/local/j2sdk1.4.1_01/src/">
<include name="java/lang/*.java"/>
</fileset>
</pmd-->
</target>
<target name="depend" depends="jar" description="Perform dependency analysis of code">
<echo message="Wait... this is quite long" />
<!-- For running tattletale:
unzip tattletale release anywhere
link it to tools/tattletale
-->
<taskdef name="tattletale-report"
classname="org.jboss.tattletale.ant.ReportTask"
classpath="${tooldir}/tattletale/tattletale-ant.jar:${tooldir}/tattletale/tattletale.jar:${tooldir}/tattletale/javassist.jar"/>
<tattletale-report source="lib" destination="tattletale" blacklisted="ch.qos.logback" />
<!-- blacklisted nor excludes seems to work (may be old version) -->
<!-- For tattletale, look at dependencies in "tattletale/graphviz/dependencies.dot" -->
<!-- Emma (coverage) seems really difficult -->
<!--taskdef resource="emma_ant.properties" classpathref="emma.lib" /-->
</target>
<macrodef name="onejar" description="utility macro for JAR packaging">
<attribute name="group" description="Maven group ID" />
<attribute name="file" description="Artifact name" />
<attribute name="desc" description="Description" />
<attribute name="main" description="Main class to call" default="" />
<attribute name="path" description="Class path" default="" />
<element name="files" description="The fileset Id of the files to include" />
<element name="extramanifest" description="The part of included manifest" optional="yes"/>
<sequential>
<delete file="lib/@{file}.jar"/>
<!-- it may even be easier to generate the pom -->
<copy file="distrib/@{file}.pom" toFile="lib/@{file}.pom" overwrite="true">
<filterset>
<filter token="GROUPID" value="@{group}"/>
<filter token="ARTID" value="@{file}"/>
<filter token="VERS" value="${version}"/>
<filter token="DATE" value="${date}"/>
<filter token="REV" value="${svn.rev}"/>
<filter token="COPYYEAR" value="${copyyear}"/>
</filterset>
</copy>
<jar jarfile="lib/@{file}.jar">
<manifest>
<attribute name="Built-Date" value="${date}"/>
<attribute name="Main-Class" value="@{main}"/>
<attribute name="Class-Path" value="@{path}"/>
<attribute name="Implementation-Title" value="@{desc}"/>
<attribute name="Implementation-Version" value="${version} (${svn.rev})"/>
<!-- This should be achieved with a metainf tag, but not working -->
<zipfileset file="classes/LICENSE.TXT" fullpath="META-INF/LICENSE.TXT" />
<zipfileset file="lib/@{file}.pom" fullpath="META-INF/maven/@{group}/@{file}/pom.xml" />
</jar>
</sequential>
</macrodef>
<target name="jar" depends="compile,versionnumber" description="Create jar archives">
<echo message="Jarchiving..."/>
<copy file="distrib/LICENSE.TXT" tofile="classes/LICENSE.TXT" filtering="true"/>
<onejar file="align"
group="org.semanticweb.owl"
desc="Alignment API">
<files>
<fileset dir="classes">
<include name="org/semanticweb/owl/align/*.class"/>
</fileset>
</files>
</onejar>
<!-- ontowrap.jar -->
<copy file="src/fr/inrialpes/exmo/ontowrap/skoslite/skos.rdf" tofile="classes/fr/inrialpes/exmo/ontowrap/skoslite/skos.rdf" />
<onejar file="ontowrap"
group="fr.inrialpes.exmo"
desc="Ontology wrapper"
path="jena/jena-arq.jar jena/jena-iri.jar jena/jena-core.jar jena/jena-base.jar jena/jena-shaded-guava.jar skosapi/skosapi.jar owlapi10/api.jar owlapi10/impl.jar owlapi10/io.jar owlapi10/rdfapi.jar owlapi10/rdfparser.jar owlapi30/owlapi-bin.jar">
<files>
<fileset dir="classes">
<include name="fr/inrialpes/exmo/ontowrap/**/*.class" />
<include name="fr/inrialpes/exmo/ontowrap/**/*.rdf"/>
</fileset>
</files>
</onejar>
<!-- procalign.jar -->
<onejar file="procalign"
group="fr.inrialpes.exmo.align"
desc="Alignment API implementation"
main="fr.inrialpes.exmo.align.cli.Procalign"
path="skosapi/skosapi.jar owlapi30/owlapi-bin.jar ontosim/ontosim.jar cli/commons-cli.jar slf4j/jcl-over-slf4j.jar slf4j/log4j-over-slf4j.jar slf4j/slf4j-api.jar jwnl/jwnl.jar lucene/lucene-core.jar lucene/lucene-analyzers-common.jar jena/jena-base.jar jena/jena-core.jar jena/jena-iri.jar jena/jena-shaded-guava.jar iddl/iddl.jar xerces/xercesImpl.jar xerces/resolver.jar xerces/xml-apis.jar hermit/hermit.jar align.jar ontowrap.jar procalign.jar lang/commons-text.jar lang/commons-lang3.jar http/httpcore.jar http/httpclient.jar http/httpclient-cache.jar thrift/libthrift.jar">
<files>
<fileset dir="classes">
<include name="fr/inrialpes/exmo/align/impl/**/*.class"/>
<include name="fr/inrialpes/exmo/align/parser/**/*.class"/>
<include name="fr/inrialpes/exmo/align/util/**/*.class"/>
<include name="fr/inrialpes/exmo/align/cli/**/*.class"/>
<include name="fr/inrialpes/exmo/align/gen/**/*.class"/>
<include name="fr/inrialpes/exmo/align/ling/**/*.class"/>
</fileset>
</files>
</onejar>
<!-- alignsvc.jar -->
<copy file="src/fr/inrialpes/exmo/align/service/aserv.wsdl" tofile="classes/fr/inrialpes/exmo/align/service/aserv.wsdl" filtering="false"/>
<onejar file="alignsvc"
group="fr.inrialpes.exmo.align"
desc="Alignment server"
main="fr.inrialpes.exmo.align.service.AlignmentService"
path="procalign.jar osgi/osgi-core.jar jade/jade.jar jdbc/mysql-connector-java.jar jdbc/postgresql-jdbc4.jar servlet/servlet-api.jar fileupload/commons-fileupload.jar fileupload/commons-io.jar jetty/jetty-util.jar jetty/jetty-server.jar jetty/jetty-http.jar jetty/jetty-io.jar gson/gson.jar xerces/xercesImpl.jar lang/commons-text.jar lang/commons-lang3.jar">
<files>
<fileset dir="classes">
<include name="fr/inrialpes/exmo/align/service/**/*.class"/>
<include name="fr/inrialpes/exmo/align/service/**/*.wsdl"/>
<include name="fr/inrialpes/exmo/queryprocessor/**/*.class"/>
</fileset>
</files>
<extramanifest>
<!-- This is all for OSGI -->
<manifest>
<attribute name="Bundle-Name" value="Alignment server"/>
<attribute name="Bundle-SymbolicName" value="alignsvc"/>
<attribute name="Bundle-Version" value="${version} (${svn.rev})"/>
<attribute name="Bundle-Copyright" value="INRIA, ${copyyear}"/>
<attribute name="Bundle-Date" value="${date}"/>
<attribute name="Bundle-License" value="GNU Lesser General Public License 2.1 or above"/>
<attribute name="Bundle-Activator" value="fr.inrialpes.exmo.align.service.osgi.OSGIAServProfile"/>
<attribute name="Export-package" value="fr.inrialpes.exmo.align.service"/>
<attribute name="Import-package" value="org.osgi.framework"/>
</manifest>
</extramanifest>
</onejar>
<target name="cleanjar" depends="bind" description="Delete jar archives">
<echo message="Erasing..."/>
<delete file="lib/align.jar"/>
<delete file="lib/alignsvc.jar"/>
<delete file="lib/procalign.jar"/>
<delete file="lib/aserv.jar"/>
<!-- tested -->
<!-- This generate a server jar with a class path containing all
libs in the lib directory. Useful for servers -->
<target name="aserv" depends="bind">
<echo message="Generating aserv jar..."/>
<delete file="lib/aserv.jar" />
<pathconvert property="aserv.classpath" pathsep=" ">
<map from="${user.dir}/${libdir}/" to=""/>
<path>
<fileset dir="./lib">
<include name="**/*.jar"/>
<include name="*.jar"/>
<!-- several useless (and may be harmful) things at the moment -->
<!--exclude name="seals/seals-omt-client.jar" /-->
</fileset>
</path>
<!--flattenmapper /-->
</pathconvert>
<echo message="path: ${aserv.classpath}" />
<jar jarfile="aserv.jar">
<manifest>
<attribute name="Main-Class" value="fr.inrialpes.exmo.align.service.AlignmentService"/>
<!-- usually each MANIFEST knows what it needs, add here -->
<!-- semanticmapper-0.2.jar jwnl.jar sboa.jar TaxoMap.jar AROMA_aserv.jar oyster2.jar, semanticmapper-0.2.jar, sboalgorithms.jar -->
<!-- others should be there naturally -->
<attribute name="Class-Path" value="${aserv.classpath}"/>
<attribute name="Implementation-Title" value="Alignment server custom launcher"/>
<attribute name="Implementation-Version" value="${version} (${svn.rev})"/>
</manifest>
</jar>
<move file="aserv.jar" tofile="lib/aserv.jar" />
</target>
<target name="test" depends="bind" description="Unit test code">
<condition property="testset" value="${group}" else="raw">
<isset property="group"/>
</condition>
<echo message="Testing ${testset}..."/>
<echo message="You may also want to try bash test/clitest.sh"/>
<taskdef resource="testngtasks" classpath="${tooldir}/testng/testng.jar" />
<javac srcdir="test/src" includeantruntime="false" destdir="test/classes" debug="on" encoding="iso8859-15">
<!--compilerarg value="-Xlint:all"/-->
<classpath>
<path refid="classpath"/>
<pathelement location="${tooldir}/testng/testng.jar"/>
</classpath>
Jérôme Euzenat
committed
<!-- possible groups: raw=impl+serv+io+onto+omwg, full=raw+ling+sem -->
<!-- ling requires WordNet and takes ages initialising it -->
<!-- testng seems to be in parallel by default: forcing thread to 1 (otherwise there are interferences -->
<property name="log.level" value="DEBUG" />
outputDir="test/html" verbose="1"
haltOnFailure="false" failureProperty="failed">
<!-- if ones uses logback -->
<propertyset>
<propertyref name="logback.configurationFile"/>
<!--propertyref name="log.level" /-->
<path refid="classpath" />
<pathelement location="${tooldir}/testng/jcommander-1.69.jar" />
<pathelement location="test/classes" />
</classpath>
<!--xmlfileset dir="${test14.dir}" includes="testng.xml"/-->
<classfileset dir="test" includes="classes/**/*.class"/>
</testng>
<fail if="failed" message="For results: open test/html/index.html" />
<target name="cleantest" depends="bind" description="Clean up test directory">
<fileset dir="test/classes" includes="**/*.class"/>
<fileset dir="test/output" includes="**/*.*"/>
<target name="javadoc" depends="versionnumber" description="Generate java documentation">
destdir="javadoc"
author="true"
version="true"
Windowtitle="Alignment API and Server"
doctitle="Alignment API and Server ${version}"
header="Alignment API and Server ${version} (${svn.rev})"
bottom="(C) INRIA & friends, ${copyyear}"
<classpath refid="classpath"/>
<packageset dir="src" defaultexcludes="yes">
<include name="org/semanticweb/owl/align/**"/>
<include name="fr/inrialpes/**"/>
<include name="org/ivml/alimo/**"/>
<!--exclude name="org/semanticweb/owl/**"/-->
</packageset>
<!-- This works but the classpath is not set correctly -->
<!--packageset dir="plugins/neon/src" defaultexcludes="yes">
<include name="fr/inrialpes/**"/>
</packageset-->
<!--link href="http://java.sun.com/j2se/1.5.0/docs/api"/-->
<target name="release" depends="versionnumber" description="Release a new version of the API">
<echo message="Releasing version ${version} (${svn.revision})" />
<!--echo message="Are you sure that everything is OK (update/ci/compile/lint)?"/-->
<copy file="distrib/LICENSE.TXT" tofile="LICENSE.TXT" filtering="true"/>
<!--copy file="${tempdir}/align-${version}.zip" tofile="${FTPDir}/align-${version}.zip" /-->
<!-- This should now go to GForge -->
<!--copy file="${FTPDir}/align-${version}.zip" tofile="${WebDir}/align.zip" /-->
<echo message="Please upload the released file to Gforge" />
<echo message="mv ${tempdir}/align-${version}.zip ${FTPDir}/" />
<echo message="svn copy svn+ssh://euzenat@scm.gforge.inria.fr/svn/alignapi/trunk svn+ssh://euzenat@scm.gforge.inria.fr/svn/alignapi/tags/version-${version} -m 'release ${version}'"/>
<target name="zip" depends="bind" description="Generate zip file containing a release">
<antcall target="compileall"/>
<antcall target="jar"/>
<antcall target="test">
<param name="group" value="full"/>
</antcall>
<property name="version" value="${version}.${svn.revision}"/>
<ant dir="plugins/android" target="jar">
<property name="version" value="${version}.${svn.revision}"/>
</ant>
<!-- may be useful to change directory -->
<zip zipfile="${tempdir}/align-${version}.zip">
<fileset dir=".">
<include name="**/*"/>
<exclude name="**/.svn"/>
<property name="source-root" value="/usr/src"/>
<property name="repository.URL" value="http://sources.example.com"/>
<java classname="org.tmatesoft.svn.cli.SVN"
dir="${source-root}/TESTREPO" fork="true">
<arg value="commit"/>
<arg value="--username"/>
<arg value="admin"/>
<arg value="--password"/>
<arg value="admin"/>
<arg value="-m"/>
<arg value='"Testing"'/>
<arg value="${repository.URL}/TESTING"/>
<classpath>
<pathelement location="${antroot}/LIB/ganymed.jar" />
<pathelement location="${antroot}/LIB/javasvn.jar" />
<pathelement location="${antroot}/LIB/javasvn-cli.jar" />
</classpath>
</java>
</target>
<!-- This is for testing purposes, but has been found to work -->
<target name="status" depends="bind">
<java classname="org.tmatesoft.svn.cli.SVN" dir="." fork="true">
<arg value="status" />
<classpath refid="classpath"/>
</java>
</target>
<!-- not tested yet -->
<target name="update" depends="bind">
<java classname="org.tmatesoft.svn.cli.SVN" dir="." fork="true"
failonerror="true">
<sysproperty key="javasvn.ssh2.key"
value="/Volumes/Khata/.ssh/id_dsa" />
<!--sysproperty key="javasvn.ssh2.username" value="${login}" />
<sysproperty key="javasvn.ssh2.passphrase" value="aa" /-->
<arg value="update" />
<classpath refid="classpath"/>
</java>
</target>
<!-- not tested yet -->
<target name="commit" depends="update">
<java classname="org.tmatesoft.svn.cli.SVN" dir="." fork="true">
<arg value="commit" />
<arg value="--username" />
<arg value="${login}" />
<arg value="-m" />
<arg value='"Pre-release ${version}"' />
<classpath refid="classpath"/>
</java>
</target>
<!-- not tested yet -->
<target name="svnbranch" depends="">
<java classname="org.tmatesoft.svn.cli.SVN" dir="." fork="true">
<arg value="copy" />
<arg value="--username" />
<arg value="${login}" />
<arg value="${rep}/trunk" />
<arg value="${rep}/tags/version-${version}" />
<arg value="-m" />
<arg value='"Release ${version}"' />
<classpath refid="classpath"/>
</java>
<!-- tested -->
<macrodef name="onepom" description="utility macro for maven exporting">
<attribute name="file" description="Artifact name" />
<sequential>
<artifact:install file="lib/@{file}.jar">
<pom file="lib/@{file}.pom" />
<localRepository path="mvn-repo" />
</artifact:install>
</sequential>
</macrodef>
<!-- tested -->
<target name="mavenize" depends="bind" description="Creates a Maven local repositry">
<echo message="Mavenizing..."/>
<path id="maven-ant-tasks.classpath" path="${tooldir}/maven/maven-ant-tasks-2.1.3.jar" />
<typedef resource="org/apache/maven/artifact/ant/antlib.xml"
uri="antlib:org.apache.maven.artifact.ant"
classpathref="maven-ant-tasks.classpath" />
<delete dir="mvn-repo"/>
<mkdir dir="mvn-repo"/>
<!-- This would require ant-contrib -->
<!--for param="file">
<path>
<fileset dir="lib" includes="**/*.pom"/>
</path>
<echo message="@{file}" />
<onepom file="@{file}" />
</for-->
<onepom file="thrift/libthrift.jar" />
<onepom file="hermit/hermit" />
<onepom file="iddl/iddl" />
<onepom file="jade/jade" />
<onepom file="jdbc/mysql-connector-java" />
<onepom file="jdbc/postgresql-jdbc4" />
<onepom file="jena/jena-arq" />
<onepom file="jena/jena-iri" />
<onepom file="jena/jena-shaded-guava" />
<onepom file="http/httpclient" />
<onepom file="http/httpclient-cache" />
<onepom file="http/httpcore" />
<onepom file="jetty/jetty-util" />
<onepom file="jetty/jetty" />
<onepom file="jwnl/jwnl" />
<onepom file="slf4j/slf4j-api" />
<onepom file="slf4j/jcl-over-slf4j" />
<onepom file="slf4j/log4j-over-slf4j" />
<onepom file="lucene/lucene-core" />
<onepom file="lucene/lucene-analyzers-common" />
<onepom file="lang/commons-text" />
<onepom file="lang/commons-lang3" />
<onepom file="osgi/osgi-core" />
<onepom file="owlapi10/api" />
<onepom file="owlapi10/impl" />
<onepom file="owlapi10/io" />
<onepom file="owlapi10/rdfapi" />
<onepom file="owlapi10/rdfparser" />
<onepom file="owlapi30/owlapi-bin" />
<onepom file="oyster/oyster" />
<onepom file="servlet/servlet-api" />
<onepom file="skosapi/skosapi" />
<onepom file="xerces/resolver" />
<onepom file="xerces/xercesImpl" />
<onepom file="xerces/xml-apis" />
<onepom file="align" />
<onepom file="ontowrap" />
<onepom file="procalign" />
<onepom file="alignsvc" />
</target>
<target name="clean" description="Clean up the whole directory">
<ant dir="plugins/neon" target="clean" />
<ant dir="plugins/webcontent" target="clean" />
<delete>
<fileset dir="classes" includes="**/*.class"/>
<fileset dir="examples" includes="**/*.class"/>
<fileset dir="examples/rdf" includes="*.tex"/>
<fileset dir="examples" includes="**/*.jar"/>
<fileset dir="html/tutorial" includes="**/*.class"/>