glassfish-pfl/glassfish-pfl-3.2.0-b001-00-build.xml
2020-08-25 14:27:49 +08:00

283 lines
10 KiB
XML

<!-- build file by gil for glassfish-pfl 3.2.0-b001 -->
<project name="glassfish-pfl" default="dist" basedir=".">
<description>
GlassFish Primitive Function Library.
</description>
<!-- set global properties for this build -->
<property name="version" value="3.2.0-b001"/>
<property name="jar.name" value="pfl"/>
<property name="src" location="src"/>
<property name="src.test" location="test"/>
<property name="build" location="build/classes"/>
<property name="build.test" location="build/test-classes"/>
<property name="test.reports" location="build/test-reports"/>
<property name="dist" location="dist"/>
<property name="jar.dest.dir" value="${basedir}/target" />
<property name="javadoc" location="${jar.dest.dir}/apidocs"/>
<property name="javac.debug" value="true"/>
<path id="project.cp">
<pathelement location="${build}"/>
</path>
<path id="test.cp">
<pathelement location="${build.test}"/>
<fileset dir="/usr/share/java" includes="hamcrest/all.jar"/>
</path>
<target name="init">
<!-- Create the build directory structure used by compile -->
<mkdir dir="${build}"/>
<mkdir dir="${jar.dest.dir}"/>
</target>
<target name="compile" depends="init"
description="compile the source " >
<!-- Compile the java code from ${src} into ${build} -->
<javac srcdir="${src}" destdir="${build}" debug="${javac.debug}" source="1.6" target="1.6">
<classpath>
<fileset dir="/usr/share/java">
<include name="objectweb-asm3/asm.jar"/>
<include name="objectweb-asm3/asm-commons.jar"/>
<include name="objectweb-asm3/asm-tree.jar"/>
<include name="objectweb-asm3/asm-util.jar"/>
<include name="junit.jar"/>
</fileset>
</classpath>
</javac>
</target>
<taskdef resource="aQute/bnd/ant/taskdef.properties" >
<classpath>
<fileset dir="/usr/share/java/aqute-bnd" />
</classpath>
</taskdef>
<macrodef name="jar-and-manifest">
<attribute name="destfile"/>
<attribute name="basedir"/>
<attribute name="excludes" default=""/>
<attribute name="includes" default=""/>
<sequential>
<jar destfile="${dist}/${jar.name}-@{destfile}.jar"
basedir="@{basedir}"
excludes="@{excludes}"
includes="@{includes}">
</jar>
<bndwrap jars="${dist}/${jar.name}-@{destfile}.jar" output="${jar.dest.dir}/${jar.name}-@{destfile}.jar" />
<jar file="${jar.dest.dir}/${jar.name}-@{destfile}.jar" update="true">
<manifest>
<attribute name="Built-By"
value="${user.name}"/>
<attribute name="Bundle-Name"
value="${jar.name}-@{destfile}"/>
<attribute name="Bundle-SymbolicName"
value="${jar.name}-@{destfile}"/>
<attribute name="Bundle-Version"
value="${version}"/>
</manifest>
</jar>
</sequential>
</macrodef>
<target name="dist" depends="compile"
description="generate the distribution" >
<!-- Create the distribution directory -->
<mkdir dir="${dist}"/>
<copy todir="${build}/org/glassfish/pfl/dynamic/codegen/impl" overwrite="true">
<fileset dir="${src}/org/glassfish/pfl/dynamic/codegen/impl" includes="**/*.txt"/>
</copy>
<copy todir="${build}/org/glassfish/pfl/dynamic/codegen/spi" overwrite="true">
<fileset dir="${src}/org/glassfish/pfl/dynamic/codegen/spi" includes="**/*.txt"/>
</copy>
<copy todir="${build}/org/glassfish/pfl/dynamic/copyobject/impl" overwrite="true">
<fileset dir="${src}/org/glassfish/pfl/dynamic/copyobject/impl" includes="**/*.txt"/>
</copy>
<copy todir="${build}/org/glassfish/pfl/dynamic/generator" overwrite="true">
<fileset dir="${src}/org/glassfish/pfl/dynamic/generator" includes="**/*.html"/>
</copy>
<jar-and-manifest
basedir="${build}"
destfile="basic"
includes="org/glassfish/pfl/basic/**/*"
excludes="org/glassfish/pfl/basic/tools/**/"/>
<jar-and-manifest
basedir="${build}"
destfile="basic-tools"
includes="org/glassfish/pfl/basic/tools/**/"/>
<jar-and-manifest
basedir="${build}"
destfile="tf"
includes="org/glassfish/pfl/tf/**/*"
excludes="org/glassfish/pfl/tf/tools/**/"/>
<jar-and-manifest
basedir="${build}"
destfile="tf-tools"
includes="org/glassfish/pfl/tf/tools/**/"/>
<jar-and-manifest
basedir="${build}"
destfile="dynamic"
includes="org/glassfish/pfl/dynamic/**/*"/>
<jar-and-manifest
basedir="${build}"
destfile="ff"
includes="org/glassfish/pfl/ff/**/*"/>
<jar-and-manifest
basedir="${build}"
destfile="test"
includes="org/glassfish/pfl/test/*"/>
</target>
<target name="clean"
description="clean up" >
<delete dir="${build}"/>
<delete dir="${dist}"/>
<delete dir="${javadoc}"/>
</target>
<target name="javadoc">
<javadoc sourcepath="${src}"
destdir="${javadoc}"
additionalparam="-Xdoclint:none"
source="1.6" charset="ISO-8859-1"
>
<packageset dir="${src}"/>
<classpath>
<pathelement location="${dist}/${jar.name}-basic.jar"/>
<pathelement location="${dist}/${jar.name}-basic-tools.jar"/>
<pathelement location="${dist}/${jar.name}-tf.jar"/>
<pathelement location="${dist}/${jar.name}-tf-tools.jar"/>
<pathelement location="${dist}/${jar.name}-dynamic.jar"/>
<pathelement location="${dist}/${jar.name}-ff.jar"/>
<pathelement location="${dist}/${jar.name}-test.jar"/>
<pathelement location="${project.cp}"/>
<fileset dir="/usr/share/java">
<include name="objectweb-asm3/asm.jar"/>
<include name="objectweb-asm3/asm-commons.jar"/>
<include name="objectweb-asm3/asm-tree.jar"/>
<include name="objectweb-asm3/asm-util.jar"/>
<include name="junit.jar"/>
</fileset>
</classpath>
</javadoc>
</target>
<target name="compile-tests"
depends="compile"
description="Compile the test code"
unless="test.skip">
<mkdir dir="${build.test}"/>
<javac destdir="${build.test}"
encoding="UTF-8"
nowarn="false"
debug="true"
optimize="false"
deprecation="true"
target="1.6"
verbose="false"
fork="false"
source="1.6">
<src>
<pathelement location="${src.test}"/>
</src>
<classpath>
<pathelement location="${dist}/${jar.name}-basic.jar"/>
<pathelement location="${dist}/${jar.name}-basic-tools.jar"/>
<pathelement location="${dist}/${jar.name}-tf.jar"/>
<pathelement location="${dist}/${jar.name}-tf-tools.jar"/>
<pathelement location="${dist}/${jar.name}-dynamic.jar"/>
<pathelement location="${dist}/${jar.name}-ff.jar"/>
<pathelement location="${dist}/${jar.name}-test.jar"/>
<pathelement location="${project.cp}"/>
<fileset dir="/usr/share/java">
<include name="objectweb-asm/asm.jar"/>
<include name="objectweb-asm/asm-commons.jar"/>
<include name="objectweb-asm/asm-tree.jar"/>
<include name="objectweb-asm/asm-util.jar"/>
<include name="geronimo-ejb.jar"/>
<include name="junit.jar"/>
</fileset>
</classpath>
</javac>
</target>
<target name="test"
depends="compile-tests, junit-missing"
unless="junit.skipped"
description="Run the test cases">
<mkdir dir="${test.reports}"/>
<junit printSummary="yes" haltonerror="true" haltonfailure="true" fork="true" dir=".">
<sysproperty key="basedir" value="."/>
<formatter type="xml"/>
<formatter type="plain" usefile="false"/>
<classpath>
<path refid="test.cp"/>
<pathelement location="${build}"/>
<pathelement location="${build.test}"/>
<fileset dir="/usr/share/java">
<include name="objectweb-asm/asm.jar"/>
<include name="objectweb-asm/asm-commons.jar"/>
<include name="objectweb-asm/asm-tree.jar"/>
<include name="objectweb-asm/asm-util.jar"/>
<include name="geronimo-ejb.jar"/>
</fileset>
<pathelement location="${java.home}/../lib/tools.jar"/>
</classpath>
<batchtest todir="${test.reports}" unless="test">
<fileset dir="${src.test}">
<include name="**/*Test.java"/>
<!-- requires package com.sun.ejb.containers -->
<exclude name="dynamic/codegen/**/*.java"/>
<!-- this test fail -->
<exclude name="org/glassfish/pfl/basic/logex/WrapperGeneratorTest.java"/>
<exclude name="tf/TfTest.java"/>
</fileset>
</batchtest>
<batchtest todir="${test.reports}" if="test">
<fileset dir="${src.test}">
<include name="**/${test}.java"/>
<!-- requires package com.sun.ejb.containers -->
<exclude name="dynamic/codegen/**/*.java"/>
<!-- this test fail -->
<exclude name="org/glassfish/pfl/basic/logex/WrapperGeneratorTest.java"/>
<exclude name="tf/TfTest.java"/>
</fileset>
</batchtest>
</junit>
</target>
<target name="test-junit-present">
<available classname="junit.framework.Test" property="junit.present"/>
</target>
<target name="test-junit-status"
depends="test-junit-present">
<condition property="junit.missing">
<and>
<isfalse value="${junit.present}"/>
<isfalse value="${test.skip}"/>
</and>
</condition>
<condition property="junit.skipped">
<or>
<isfalse value="${junit.present}"/>
<istrue value="${test.skip}"/>
</or>
</condition>
</target>
<target name="junit-missing"
depends="test-junit-status"
if="junit.missing">
<echo>=================================== WARNING ===================================</echo>
<echo> JUnit is not present in your CLASSPATH. Tests not executed </echo>
<echo>===============================================================================</echo>
</target>
</project>