blob: 7d169a94c10c5da1a65bf6ec2f75f8a854efa9f1 [file] [log] [blame]
<project name="plexi" default="build" basedir=".">
<description>GSA Adaptor library</description>
<property name="src.dir" location="src"/>
<property name="test.dir" location="test"/>
<property name="build.dir" location="build"/>
<property name="build-src.dir" location="${build.dir}/src"/>
<property name="build-test.dir" location="${build.dir}/test"/>
<property name="build-instrument.dir" location="${build.dir}/instrument"/>
<property name="dist.dir" location="dist"/>
<property name="javadoc.dir" location="${build.dir}/javadoc"/>
<property name="resource.dir" location="resources"/>
<property name="lib.dir" location="lib"/>
<property name="junit.jar" location="${lib.dir}/junit-4.8.2.jar"/>
<property name="adaptor.class" value="adaptorlib.examples.AdaptorTemplate"/>
<property name="adaptor.args" value=""/>
<property name="cobertura.dir" value="${basedir}/../cobertura/"/>
<!-- Adaptor suffix for distribution files. Useful for placing version numbers
on our jars. -->
<property name="adaptorlib.suffix" value=""/>
<path id="adaptorlib.build.classpath">
<fileset dir="${lib.dir}">
<include name="json_simple-1.1.jar"/>
<include name="gdata-core-1.0.jar"/>
<include name="gdata-gsa-1.0.jar"/>
<include name="joda-time-1.6.jar"/>
<include name="opensaml-2.3.2.jar"/>
<include name="openws-1.3.1.jar"/>
<include name="xmltooling-1.2.2.jar"/>
<include name="guava-pre-pre10.jar"/>
<include name="jsr305.jar"/>
<include name="cron4j-2.2.4.jar"/>
</fileset>
</path>
<path id="adaptorlib.run.classpath">
<path refid="adaptorlib.build.classpath"/>
<pathelement location="${resource.dir}"/>
<path refid="secmgr.run.classpath"/>
<path refid="opensaml.run.classpath"/>
</path>
<path id="examples.build.classpath">
<fileset dir="${lib.dir}">
<include name="opencsv-2.3.jar"/>
<include name="j-calais-0.2.1.jar"/>
</fileset>
</path>
<path id="examples.run.classpath">
<path refid="examples.build.classpath"/>
<fileset dir="${lib.dir}">
<include name="guava-r06.jar"/>
<include name="jackson-core-asl-1.5.5.jar"/>
<include name="jackson-jaxrs-1.5.5.jar"/>
<include name="jackson-mapper-asl-1.5.5.jar"/>
<include name="jersey-client-1.3.jar"/>
<include name="jersey-core-1.3.jar"/>
<include name="jsr311-api-1.1.1.jar"/>
</fileset>
</path>
<path id="secmgr.build.classpath">
<path refid="secmgr.run.classpath"/>
<fileset dir="${lib.dir}">
<!--include name="guice-3.0.jar"/-->
<include name="jsr305.jar"/>
<include name="servlet-api.jar"/>
<!-- Dependencies that are in common with opensaml. -->
<include name="joda-time-1.6.jar"/>
<include name="opensaml-2.3.2.jar"/>
<include name="openws-1.3.1.jar"/>
<include name="slf4j-api-1.5.10.jar"/>
<include name="xmltooling-1.2.2.jar"/>
</fileset>
</path>
<path id="secmgr.run.classpath">
<fileset dir="${lib.dir}">
<include name="guava-pre-pre10.jar"/>
<!-- Haven't seen it used, but it seems to be needed for
com.google.enterprise.secmgr.servlets.ResponseParser.getGroups()
used from adaptorlib.SamlAssertionConsumerHandler.consumeAssertion().
-->
<include name="gson-1.7.1.jar"/>
</fileset>
</path>
<path id="opensaml.run.classpath">
<fileset dir="${lib.dir}">
<include name="bcprov-jdk15-1.45.jar"/>
<!--include name="commons-codec-1.3.jar"/-->
<include name="commons-collections-3.1.jar"/>
<!--include name="commons-httpclient-3.1.jar"/-->
<include name="commons-lang-2.1.jar"/>
<!--include name="jcip-annotations-1.0.jar"/-->
<!--include name="jcl-over-slf4j-1.5.10.jar"/-->
<include name="joda-time-1.6.jar"/>
<!--include name="jul-to-slf4j-1.5.10.jar"/-->
<!--include name="log4j-over-slf4j-1.5.10.jar"/-->
<!--include name="not-yet-commons-ssl-0.3.9.jar"/-->
<include name="opensaml-2.3.2.jar"/>
<include name="openws-1.3.1.jar"/>
<include name="slf4j-api-1.5.10.jar"/>
<include name="velocity-1.5.jar"/>
<include name="xmlsec-1.4.3.jar"/>
<include name="xmltooling-1.2.2.jar"/>
<!-- Libraries that are supposed to be endorsed, that we aren't having
endorsed. -->
<!--include name="resolver-2.9.1.jar"/-->
<!--include name="serializer-2.9.1.jar"/-->
<!--include name="xalan-2.7.1.jar"/-->
<include name="xercesImpl-2.9.1.jar"/>
<!--include name="xml-apis-2.9.1.jar"/-->
<!-- Additional dependencies not included with opensaml. -->
<include name="slf4j-jdk14-1.5.10.jar"/>
<include name="commons-logging-api-1.1.1.jar"/>
</fileset>
</path>
<path id="cobertura.classpath">
<fileset dir="${cobertura.dir}" erroronmissingdir="false">
<include name="cobertura.jar"/>
<include name="lib/**/*.jar"/>
</fileset>
</path>
<target name="build" description="Build source">
<mkdir dir="${build-src.dir}"/>
<!-- Compile secmgr. -->
<javac srcdir="${src.dir}" destdir="${build-src.dir}" debug="true"
includeantruntime="false" encoding="utf-8">
<classpath refid="secmgr.build.classpath"/>
<exclude name="adaptorlib/**"/>
</javac>
<!-- Compile adaptorlib. -->
<javac srcdir="${src.dir}" destdir="${build-src.dir}" debug="true"
includeantruntime="false" encoding="utf-8">
<compilerarg value="-Xlint:unchecked"/>
<classpath refid="adaptorlib.build.classpath"/>
<exclude name="adaptorlib/examples/**"/>
<include name="adaptorlib/**"/>
</javac>
<!-- Compile examples. -->
<javac srcdir="${src.dir}" destdir="${build-src.dir}" debug="true"
includeantruntime="false" encoding="utf-8">
<compilerarg value="-Xlint:unchecked"/>
<classpath refid="examples.build.classpath"/>
<include name="adaptorlib/examples/**"/>
</javac>
<mkdir dir="${build-test.dir}"/>
<!-- Compile JUnit helper -->
<javac srcdir="${test.dir}" destdir="${build-test.dir}" debug="true"
includeantruntime="true" encoding="utf-8">
<compilerarg value="-Xlint:unchecked"/>
<classpath location="${junit.jar}"/>
<include name="JUnitLogFixFormatter.java"/>
</javac>
<!-- Compile tests, excluding example tests. -->
<javac srcdir="${test.dir}" destdir="${build-test.dir}" debug="true"
includeantruntime="false" encoding="utf-8">
<compilerarg value="-Xlint:unchecked"/>
<classpath refid="adaptorlib.build.classpath"/>
<classpath location="${build-src.dir}"/>
<classpath location="${junit.jar}"/>
<exclude name="adaptorlib/examples/**"/>
</javac>
<!-- Compile tests for examples. -->
<javac srcdir="${test.dir}" destdir="${build-test.dir}" debug="true"
includeantruntime="false" encoding="utf-8">
<compilerarg value="-Xlint:unchecked"/>
<classpath refid="examples.build.classpath"/>
<classpath location="${build-src.dir}"/>
<classpath location="${junit.jar}"/>
<include name="adaptorlib/examples/**"/>
</javac>
</target>
<target name="dist" description="Generate distribution binaries"
depends="clean,test,package"/>
<target name="package" description="Generate binaries"
depends="build,javadoc">
<mkdir dir="${dist.dir}"/>
<!-- adaptor.jar -->
<!-- Concatenate dependent JARs together into a comma-delimited list. -->
<pathconvert pathsep="," refid="adaptorlib.run.classpath"
property="tmp.adaptorlib.zipgroup">
<!-- We remove the lib.dir from the paths to prevent trouble with comma
and space in lib.dir. It also makes it nicer <echo>ing
tmp.adaptorlib.zipgroup. -->
<map from="${lib.dir}/" to=""/>
</pathconvert>
<jar destfile="${build.dir}/adaptor.tmp.jar" basedir="${build-src.dir}"
excludes="adaptorlib/examples/**,adaptorlib/prebuilt/**">
<zipgroupfileset dir="${lib.dir}" includes="${tmp.adaptorlib.zipgroup}"/>
<!-- resource.dir is included in tmp.adaptorlib.zipgroup, but since it
isn't a zip file, the zipgroupfileset doesn't include the folder's
contents. Thus, we explicitly add it again here. -->
<fileset dir="${resource.dir}"/>
</jar>
<!-- Re-save JAR without signing keys, since keeping them in the JAR causes
security exceptions. -->
<zip destfile="${dist.dir}/adaptor${adaptorlib.suffix}.jar">
<zipfileset excludes="META-INF/**/*.DSA,META-INF/**/*.SF"
src="${build.dir}/adaptor.tmp.jar"/>
</zip>
<!-- adaptor-prebuild.jar -->
<jar destfile="${dist.dir}/adaptor${adaptorlib.suffix}-prebuilt.jar"
basedir="${build-src.dir}" includes="adaptorlib/prebuilt/**">
</jar>
<!-- adaptor-examples.jar -->
<pathconvert pathsep="," refid="examples.run.classpath"
property="tmp.examples.zipgroup">
<map from="${lib.dir}/" to=""/>
</pathconvert>
<jar destfile="${dist.dir}/adaptor${adaptorlib.suffix}-examples.jar"
basedir="${build-src.dir}" includes="adaptorlib/examples/**">
<zipgroupfileset dir="${lib.dir}" includes="${tmp.examples.zipgroup}"/>
<fileset dir="${src.dir}" includes="adaptorlib/examples/**/*.java"/>
</jar>
<!-- adaptor-docs.zip -->
<zip destfile="${dist.dir}/adaptor${adaptorlib.suffix}-docs.zip"
basedir="${javadoc.dir}"/>
<!-- adaptor-src.zip -->
<zip destfile="${dist.dir}/adaptor${adaptorlib.suffix}-src.zip"
basedir="${basedir}"
excludes="adaptor-config.properties,*.crt,*.jks,build/**,dist/**,**/.*/**"/>
</target>
<target name="-javadoc-test-uptodate">
<uptodate property="javadoc.uptodate"
targetfile="${javadoc.dir}/index.html">
<srcfiles dir="${src.dir}"/>
</uptodate>
</target>
<target name="javadoc" description="Build JavaDocs"
depends="-javadoc-test-uptodate" unless="javadoc.uptodate">
<javadoc sourcepath="${src.dir}" destdir="${javadoc.dir}"
overview="${src.dir}/overview.html" packagenames="adaptorlib,adaptorlib.**">
<classpath refid="adaptorlib.build.classpath"/>
<classpath refid="secmgr.build.classpath"/>
<classpath refid="examples.build.classpath"/>
<link href="http://download.oracle.com/javase/6/docs/jre/api/net/httpserver/spec/"/>
<link href="http://download.oracle.com/javase/6/docs/api/"/>
<arg value="-quiet"/>
</javadoc>
</target>
<target name="clean" description="Remove build output">
<delete dir="${build.dir}"/>
<delete dir="${dist.dir}"/>
</target>
<target name="run" depends="build" description="Run default adaptor">
<java classpath="${build-src.dir}" fork="true" classname="${adaptor.class}">
<classpath refid="adaptorlib.run.classpath"/>
<sysproperty key="java.util.logging.config.file"
value="${src.dir}/logging.properties"/>
<sysproperty key="javax.net.ssl.keyStore" file="keys.jks"/>
<sysproperty key="javax.net.ssl.keyStoreType" value="jks"/>
<sysproperty key="javax.net.ssl.keyStorePassword" value="changeit"/>
<sysproperty key="javax.net.ssl.trustStore" file="cacerts.jks"/>
<sysproperty key="javax.net.ssl.trustStoreType" value="jks"/>
<sysproperty key="javax.net.ssl.trustStorePassword" value="changeit"/>
<arg line="${adaptor.args}"/>
</java>
</target>
<target name="run-db" depends="build" description="Run database adaptor">
<java classpath="${build-src.dir}:${src.dir}/dbadaptortemplate/mysql.jar"
fork="true" classname="adaptorlib.examples.DbAdaptorTemplate">
<classpath refid="adaptorlib.run.classpath"/>
<sysproperty key="java.util.logging.config.file"
value="${src.dir}/logging.properties"/>
<sysproperty key="javax.net.ssl.keyStore" file="keys.jks"/>
<sysproperty key="javax.net.ssl.keyStoreType" value="jks"/>
<sysproperty key="javax.net.ssl.keyStorePassword" value="changeit"/>
<sysproperty key="javax.net.ssl.trustStore" file="cacerts.jks"/>
<sysproperty key="javax.net.ssl.trustStoreType" value="jks"/>
<sysproperty key="javax.net.ssl.trustStorePassword" value="changeit"/>
<arg line="${adaptor.args}"/>
</java>
</target>
<target name="run-fs" depends="build" description="Run filesystem adaptor">
<java classpath="${build-src.dir}" fork="true"
classname="adaptorlib.prebuilt.FileSystemAdaptor">
<classpath refid="adaptorlib.run.classpath"/>
<sysproperty key="java.util.logging.config.file"
value="${src.dir}/logging.properties"/>
<sysproperty key="javax.net.ssl.keyStore" file="keys.jks"/>
<sysproperty key="javax.net.ssl.keyStoreType" value="jks"/>
<sysproperty key="javax.net.ssl.keyStorePassword" value="changeit"/>
<sysproperty key="javax.net.ssl.trustStore" file="cacerts.jks"/>
<sysproperty key="javax.net.ssl.trustStoreType" value="jks"/>
<sysproperty key="javax.net.ssl.trustStorePassword" value="changeit"/>
<arg line="${adaptor.args}"/>
</java>
</target>
<target name="run-cmd" depends="build" description="Run command line adaptor">
<java classpath="${build-src.dir}" fork="true"
classname="adaptorlib.prebuilt.CommandLineAdaptor">
<classpath refid="adaptorlib.run.classpath"/>
<sysproperty key="java.util.logging.config.file"
value="${src.dir}/logging.properties"/>
<sysproperty key="javax.net.ssl.keyStore" file="keys.jks"/>
<sysproperty key="javax.net.ssl.keyStoreType" value="jks"/>
<sysproperty key="javax.net.ssl.keyStorePassword" value="changeit"/>
<sysproperty key="javax.net.ssl.trustStore" file="cacerts.jks"/>
<sysproperty key="javax.net.ssl.trustStoreType" value="jks"/>
<sysproperty key="javax.net.ssl.trustStorePassword" value="changeit"/>
<arg line="${adaptor.args}"/>
</java>
</target>
<target name="test" depends="build" description="Run JUnit tests">
<junit printsummary="yes" haltonfailure="yes" forkmode="once" fork="true">
<sysproperty key="net.sourceforge.cobertura.datafile"
file="${build-instrument.dir}/cobertura.ser"/>
<classpath refid="adaptorlib.run.classpath"/>
<classpath refid="examples.run.classpath"/>
<classpath refid="cobertura.classpath"/>
<classpath location="${junit.jar}"/>
<classpath location="${build-instrument.dir}"/>
<classpath location="${build-src.dir}"/>
<classpath location="${build-test.dir}"/>
<formatter type="plain" usefile="false"/>
<formatter classname="JUnitLogFixFormatter" usefile="false"/>
<batchtest>
<fileset dir="${test.dir}">
<include name="**/*Test.java"/>
</fileset>
</batchtest>
</junit>
</target>
<target name="instrument" depends="build,clean-instrument"
description="Instrument classes">
<taskdef classpathref="cobertura.classpath" resource="tasks.properties"/>
<cobertura-instrument datafile="${build-instrument.dir}/cobertura.ser"
todir="${build-instrument.dir}">
<fileset dir="${build-src.dir}">
<include name="adaptorlib/**"/>
</fileset>
</cobertura-instrument>
</target>
<target name="clean-instrument" description="Delete instrumented classes">
<delete dir="${build-instrument.dir}"/>
</target>
<target name="coverage-report" description="Generates code coverage report">
<taskdef classpathref="cobertura.classpath" resource="tasks.properties"/>
<cobertura-report datafile="${build-instrument.dir}/cobertura.ser"
srcdir="${src.dir}" destdir="${build.dir}/coverage"/>
</target>
</project>