blob: 4464d1a23eec7d793d31e34d1d775da7246491ab [file] [log] [blame]
<?xml version="1.0"?>
<project name="Web Services Security (WSS4J)" default="usage" basedir=".">
<!-- ================================================================== -->
<description>
Build file for WSS4J
This file is intended for ANT, a Java based build tool.
ANT is available from http://jakarta.apache.org/ant/index.html
Prerequisites:
See the README file
Build Instructions:
To build, run
ant "target"
on the directory where this file is located with the target you want.
</description>
<target name="init">
<property name='product.Name' value='Apache-WS-Security-J'/>
<property name='product.name' value='wss4j'/>
<property name='product.shortname' value='wss4j'/>
<property name='product.version.major' value='1'/>
<property name='product.version.minor' value='6'/>
<property name='product.version.level' value='19'/>
<property name='product.version.qualifier' value='SNAPSHOT'/>
<property name='product.version' value='${product.version.major}.${product.version.minor}.${product.version.level}${product.version.qualifier}'/>
<property name="year" value="2015"/>
<property name="copyright" value="Copyright &#169; ${year} Apache WSS4J Project. All Rights Reserved."/>
<!-- Give user a chance to override without editing this file
(and without typing -D each time it compiles it) -->
<property file="./build.properties"/>
<property file="${user.home}/build.properties"/>
<property name="dir.doc" value="./doc"/>
<property name="dir.dist" value="./dist"/>
<property name="dir.libs" value="./lib"/>
<property name="dir.endorsed.libs" value="./endorsed"/>
<property name="dir.src.java" value="./src/main/java"/>
<property name="dir.src.resources" value="./src/main/resources"/>
<property name="dir.test.java" value="./src/test/java"/>
<property name="dir.test.resources" value="./src/test/resources"/>
<property name="build.dir" value="./build"/>
<property name="build.classes" value="${build.dir}/classes"/>
<property name="jar.library" value="${product.shortname}-${product.version}.jar"/>
<property name="build.doc" value="${build.dir}/doc"/>
<property name="build.doc.xml" value="${build.doc}/xml"/>
<property name="build.doc.html" value="${build.doc}/html"/>
<property name="build.javadoc" value="${build.doc.html}/api"/>
<property name="build.junit.xml" value="${build.doc.xml}/junit"/>
<property name="build.junit.html" value="${build.doc.html}/junit"/>
<condition property="jdk15.present">
<equals arg1="${ant.java.version}" arg2="1.5"/>
</condition>
<condition property="jdk16.present">
<equals arg1="${ant.java.version}" arg2="1.6"/>
</condition>
<condition property="merlin.ok">
<or>
<equals arg1="${ant.java.version}" arg2="1.5"/>
<equals arg1="${ant.java.version}" arg2="1.6"/>
</or>
</condition>
<!--
for the time being following path id uses the libs in the wss4j
lib directory only This is done to test if we really don't need
any axis libs. After this is done we can include the
java.class.path and leave the wss4j/lib empty. This requires that
the CLASSPATH includes all required packages (see above
-->
<path id="classpath.libraries" description="3rd party libs">
<fileset dir="${dir.libs}">
<include name="**/*.jar"/>
<!-- <pathelement path="${java.class.path}"/> -->
</fileset>
<fileset dir="${dir.endorsed.libs}">
<include name="**/*.jar"/>
<!-- <pathelement path="${java.class.path}"/> -->
</fileset>
</path>
<path id="classpath.wss4j" description="wss4j classes; first try pure class files, then jars">
<pathelement path="${build.classes}"/>
<pathelement path="${build.dir}/${jar.library}"/>
</path>
<path id="classpath.library">
<path refid="classpath.wss4j"/>
<path refid="classpath.libraries"/>
</path>
<!-- this shall include Axis jars because the tests use the
Axis implementation of javax.xml.soap, etc. Therefore the
CLASSPATH is included.
-->
<path id="classpath.test">
<!-- classpath for test is librarypath plus junit -->
<path refid="classpath.library"/>
<pathelement path="${build.classes}/resources"/>
<pathelement path="${build.classes}/resources/keys"/>
</path>
<path id="classpath.test.jar">
<!-- classpath for test is librarypath plus junit -->
<path refid="classpath.library"/>
<pathelement path="${build.dir}/${jar.library}"/>
<pathelement path="${build.dir}/${jar.tests}"/>
</path>
<property name="javadoc.packages"
value="
org.apache.ws.security,
org.apache.ws.security.components,
org.apache.ws.security.components.crypto,
org.apache.ws.security.message,
org.apache.ws.security.message.token,
org.apache.ws.security.util
"/>
<echo level="debug">
-------------------------------------------------------------------
${product.Name} v${product.version} [${year}]
-------------------------------------------------------------------
Building with ${ant.version}
using build file ${ant.file}
Java ${java.version} located at ${java.home}
-------------------------------------------------------------------
--- Property values ---
sun.boot.class.path=${sun.boot.class.path}
</echo>
<pathconvert targetos="windows" property="classpath.test.as.string"
refid="classpath.test"/>
<echo level="debug">
classpath.test: ${classpath.test.as.string}
</echo>
</target>
<target name="usage" depends="init">
<echo>
Build instructions
-------------------------------------------------------------------
available targets are:
compile --> compiles everything
compile.library --> compiles the source code
compile.tests --> compiles the tests source code
javadoc --> generates the API documentation
(needs Java > 1.2)
test --> runs the defined JUnit tests
report --> generates html report of test results
clean --> cleans up all generated files and
directories
jar --> creates the JAR file
gump --> includes javadoc, compile jar and test
usage --> provides help on using the build tool
(default)
changelog --> generates changelog.html
See comments inside the build.xml file for more details.
-------------------------------------------------------------------
</echo>
</target>
<target name="clean" depends="init"
description="Clean up all temporary build files">
<delete dir="${build.dir}"/>
<delete dir="${dir.dist}"/>
</target>
<target name="prepare" depends="init"
description="This target generates a first build directory and checks for some libraries">
<tstamp/>
<mkdir dir="${build.dir}"/>
<!--<delete dir="${build.dir}/test-reports"/> -->
<mkdir dir="${build.dir}/test-reports"/>
<available property="junit.present"
classname="org.junit.Assert">
<!-- check whether JUnit is available -->
<classpath refid="classpath.test"/>
</available>
<available property="bc.present" classname="org.bouncycastle.jce.provider.BouncyCastleProvider">
<!-- check whether BouncyCastle is available -->
<classpath refid="classpath.test"/>
</available>
<echo level="debug">
--- Flags (Note: If the {property name} is displayed,
then the component is not present)
jdk15.present=${jdk15.present}
jdk16.present=${jdk16.present}
bc.present=${bc.present}
</echo>
</target>
<!-- ################################################################## -->
<!-- ################################################################## -->
<!-- ################################################################## -->
<!-- ################################################################## -->
<!-- ################################################################## -->
<target name="prepare-src" depends="prepare"
description="This target copies the Java sources and brands the version information">
<!-- create directories -->
<mkdir dir="${build.classes}"/>
<copy todir="${build.classes}">
<fileset dir="${dir.src.java}">
<include name="META-INF/*"/>
</fileset>
</copy>
</target>
<target name="javadoc"
depends="prepare-src"
description="Generates javadoc from all .java files; this is done on the 'branded' files">
<mkdir dir="${build.doc}"/>
<mkdir dir="${build.doc.html}"/>
<mkdir dir="${build.javadoc}"/>
<javadoc destdir="${build.javadoc}"
packagenames="${javadoc.packages}"
classpathref="classpath.test">
<!-- additionalparam="-breakiterator"-->
<sourcepath>
<pathelement location="${dir.src.java}"/>
<pathelement location="${dir.test.java}"/>
</sourcepath>
</javadoc>
</target>
<!-- ################################################################## -->
<!-- Aliases -->
<target name="javadocs" depends="javadoc"/>
<target name="jars" depends="jar"/>
<!-- Collections -->
<target name="gump"
depends="clean,javadoc,compile,test"
description="Target for the gump run"/>
<target name="compile"
depends="compile.library, compile.tests"
description="compile everything"/>
<target name="test"
depends="unitTests"
description="tests everything"/>
<!-- ################################################################## -->
<target name="compile.library" depends="prepare-src">
<!-- Compile the java code from ${dir.src} into ${build.classes} -->
<javac srcdir="${dir.src.java}" destdir="${build.classes}" debug="on" source="1.5" target="1.5" includeAntRuntime="false">
<classpath refid="classpath.library"/>
<!--<compilerarg value="-Xlint"/>-->
<exclude name="**/Merlin.java" unless="merlin.ok"/>
</javac>
<!-- Copy Property files -->
<copy todir="${build.classes}">
<fileset dir="${dir.src.resources}">
<include name="**/*.properties"/>
<include name="**/*.xml"/>
</fileset>
</copy>
</target>
<target name="compile.tests" if="junit.present">
<javac srcdir="${dir.test.java}" destdir="${build.classes}" debug="on" source="1.5" target="1.5" includeAntRuntime="false">
<classpath refid="classpath.test"/>
</javac>
<!-- Copy Property files -->
<copy todir="${build.classes}">
<fileset dir="${dir.test.resources}" includes="**/*"/>
</copy>
</target>
<target name="unitTests" unless="skip.tests" depends="compile">
<junit printsummary="yes"
haltonfailure="yes"
fork="yes"
dir="${basedir}">
<!-- See if this helps with Gump test failures -->
<sysproperty key="build.clonevm" value="true"/>
<jvmarg value="-Djava.endorsed.dirs=${basedir}/endorsed"/>
<classpath refid="classpath.test"/>
<formatter type="xml"/>
<batchtest todir="${build.dir}/test-reports">
<fileset dir="${build.classes}">
<include name="**/*Test.class"/>
</fileset>
</batchtest>
</junit>
</target>
<!-- generate a report from all the tests.
requires Xalan or other XSLT engine in ant\lib-->
<target name="report" depends="init">
<junitreport todir="${build.dir}/test-reports">
<fileset dir="${build.dir}/test-reports">
<include name="TEST-*.xml"/>
</fileset>
<report format="frames" todir="${build.dir}/test-reports/html"/>
</junitreport>
<echo message=
"point your browser to ${build.dir}/test-reports/html/index.html"/>
</target>
<target name="jar"
depends="compile, test"
description="Creates the ${jar.library}">
<jar jarfile="${build.dir}/${jar.library}"
basedir="${build.classes}"
includes="**/*, *.txt"
excludes="components/**, *.properties, wssec/**"
/>
</target>
<target name="dist" depends="bindist, srcdist"/>
<!-- Note that this requires the jars to have been built by maven first -->
<target name="bindist" depends="init"
description="Build binary zip for distro">
<mkdir dir="${dir.dist}"/>
<zip destfile=
"${dir.dist}/${product.shortname}-bin-${product.version}.zip">
<zipfileset prefix="wss4j-${product.version}" dir="."
includes="legal/** lib/** LICENSE.txt README.txt NOTICE "/>
<zipfileset prefix="wss4j-${product.version}/lib" dir="target/"
includes="wss4j-${product.version}.jar" />
<zipfileset prefix="wss4j-${product.version}/doc" dir="target/"
includes="wss4j-${product.version}-*.jar" />
<zipfileset prefix="wss4j-${product.version}/lib" dir="endorsed/"
includes="*.jar" />
</zip>
</target>
<target name="srcdist" depends="init" description=
"Build source zip file for distro">
<mkdir dir="${dir.dist}"/>
<zip destfile=
"${dir.dist}/${product.shortname}-src-${product.version}.zip">
<zipfileset prefix="wss4j-${product.version}" dir="."
includes="src/** ChangeLog.txt LICENSE.txt README.txt NOTICE build.xml pom.xml"/>
</zip>
</target>
</project>