blob: 1aef192f25afb119581e514d3ff46c70cb16f037 [file] [log] [blame]
<!--/*******************************************************************************
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
* which accompanies this distribution.
* The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
* and the Eclipse Distribution License is available at
* http://www.eclipse.org/org/documents/edl-v10.php.
*
* Ant naming conventions:
* - regardless of the actual OS platform,'/' is the directory separator
* (Ant will convert as appropriate).
* - multi-word properties use periods '.'
* - properties ending in .jar define jarfile names only (no path)
* - properties ending in .lib are fully qualified jars (path and filename)
* - properties ending in .dir are directory paths
* - properties ending in .path are path refid names (classpath fragments)
* - multi-word targets use hyphens '-'
* - targets beginning with test- are reserved for high level test targets,
* and are used in test results parsing
* - targets typically use the form <action>-<object>-<type> (ie. package-bundle-zip)
* - multi-word macros use underscores '_'
* - multi-word macro attributes are concatinated
* e.g. 'runpathref'
* - multi-word tasks (taskdef) names are concatinated
* e.g. 'validateconnection'
* - OS environment variables are in ALLCAPS and have 'env' as a prefix
* e.g. ${env.XXX}.
* - Ant properties are lower case.
*
* Contributors:
* egwin - initial implementation.
#******************************************************************************/-->
<!-- =============================================================================
* General Comments
* This buildfile contains:
* - calls to the component builds to clean, compile, package and test thier bits
* - calls to initiate component tests
* - targets to generate the eclipselink tools installer
* - targets to generate the javadocs
* Used standalone it can generate Developer Builds of the entire product or subsets
* of the product.
*================================================================================= -->
<!-- This ant project includes the following tasks:
- build (default) : compiles all components and tests
- clean : removes all build generated files
- build-distribution : compiles and packages all jars, javadocs, installer
- build-javadocs : generates Javadocs
- package-installer-zip : builds installer
- test-srg : runs all Short ReGression test suites
- test-lrg : runs all Long ReGression test suites
It may require some configuration of the build.properties to run.
-->
<project name="eclipselink.tools.temp" default="build" basedir=".">
<target name="build" depends="init, build-tools, build-tools-test" description="Default ant target, compiles all components and tests"/>
<target name="clean" depends="init, clean-tools, clean-tools-test" description="Cleans all build generated files."/>
<target name="build-distribution" depends="clean, build, build-javadocs, package-installer-zip" description="Builds all jars, generates javadoc, and builds installer."/>
<target name="test-srg" depends="init, test-tools-srg" description="Run the SRG test suites"/>
<target name="test-lrg" depends="init, test-tools" description="Run the LRG test suites"/>
<!-- ================================================================================= -->
<!-- =========================== Init Targets ====================================== -->
<target name="init">
<dirname property="tools.build.location_temp" file="${ant.file.eclipselink.tools.temp}"/>
<pathconvert targetos="unix" property="tools.build.location">
<path>
<pathelement location="${tools.build.location_temp}"/>
</path>
</pathconvert>
<echo message="tools.build.location = '${tools.build.location}'"/>
<property environment="env"/>
<echo message="env.JAVA_HOME = '${env.JAVA_HOME}'"/>
<echo message="env.ANT_HOME = '${env.ANT_HOME}'"/>
<echo message="env.JUNIT_HOME = '${env.JUNIT_HOME}'"/>
<echo message="env.MAVENANT_DIR= '${env.MAVENANT_DIR}'"/>
<echo message="env.PATH = '${env.PATH}'"/>
<echo message="env.CLASSPATH = '${env.CLASSPATH}'"/>
<echo message="env.GIT_EXEC = '${env.GIT_EXEC}'"/>
<echo message="env.TARGET = '${env.TARGET}'"/>
<echo message=" "/>
<!-- Allows a user to overide certain user specific properties. -->
<echo message="user.home = '${user.home}'"/>
<!-- local property overrides -->
<condition property="custom.properties.message" value="Loading ${user.home}/build.properties..."
else="Custom properties file '${user.home}/build.properties' not found. Skipping...">
<available file="${user.home}/build.properties"/>
</condition>
<echo message="${custom.properties.message}"/>
<property file="${user.home}/build.properties"/>
<!-- default dependency jar location -->
<condition property="extensions.depend.dir" value="${tools.build.location}/../extension.lib.external"
else="${tools.build.location}">
<available file="${tools.build.location}/../extension.lib.external" type="dir"/>
</condition>
<echo message="extensions.depend.dir= '${extensions.depend.dir}'"/>
<!-- helper definitions -->
<property name="tools.root" value="${tools.build.location}/tools"/>
<property name="tools.mvn.parent" value="${tools.root}/org.eclipse.persistence.tools.parent"/>
<property name="tools.prefix" value="eclipselink-tools"/>
<!-- Versioning -->
<!-- These variables are set in Hudson. A manual build gets defaults -->
<tstamp>
<format property="build.date" pattern="yyyyMMdd"/>
<format property="build.time" pattern="HHmm"/>
</tstamp>
<property name="build.type" value="SNAPSHOT"/>
<property name="git.hash" value="NA"/>
<condition property="version.qualifier" value="qualifier"
else="v${build.date}-${git.hash}">
<equals arg1="${git.hash}" arg2="NA"/>
</condition>
<property name="release.version" value="2.5.0"/>
<property name="version.string" value="${release.version}.${version.qualifier}"/>
<property name="release.designation" value="EclipseLink DeveloperBuild"/>
<!-- generate string for tag creation (used for maven publish and handoff-version as well) -->
<condition property="milestone.tag" value="${release.version}">
<equals arg1="${build.type}" arg2="RELEASE"/>
</condition>
<property name="milestone.tag" value="${release.version}-${build.type}"/>
<echo message="milestone.tag ='${milestone.tag}'"/>
<!-- Javadoc properties -->
<property name="javadoc.title" value="EclipseLink Tools ${release.version}, build '${version.qualifier}' API Reference"/>
<property name="javadoc.dir" value="${tools.build.location}/tools/target/javadoc"/>
<path id="javadoc.path">
<pathelement path="${some.jar}"/>
</path>
<echo message="ANT_ARGS='${env.ANT_ARGS}'"/>
<echo message="ANT_OPTS='${env.ANT_OPTS}'"/>
<echo message=" "/>
<echo message="java.version ='${java.version}'"/>
<echo message="java.class.path='${java.class.path}'"/>
<echo message="os.name ='${os.name}'"/>
<echo message="os.arch ='${os.arch}'"/>
<echo message="os.version ='${os.version}'"/>
<echo message=" "/>
<echo message="tools.root ='${tools.root}'"/>
<echo message="tools.mvn.parent='${tools.mvn.parent}'"/>
<echo message="tools.prefix ='${tools.prefix}'"/>
<echo message=" "/>
<echo message="builddate.buildtime='${build.date}.${build.time}'"/>
<echo message="git.hash ='${git.hash}'"/>
<echo message="build.type ='${build.type}'"/>
<echo message="version.qualifier ='${version.qualifier}'"/>
<echo message="release.version ='${release.version}'"/>
<echo message="version.string ='${version.string}'"/>
<echo message="release.designation='${release.designation}'"/>
<echo message=" "/>
<echo message="javadoc.title ='${javadoc.title}'"/>
<echo message="javadoc.dir ='${javadoc.dir}'"/>
</target>
<!-- Needed for Maven/Tycho builds -->
<target name="check-maven" description="Verify the Maven tool is installed and configured">
<condition property="M2_HOME" value="${env.M2_HOME}">
<!-- else="D:/apache-maven-3.0.4" -->
<isset property="env.M2_HOME"/>
</condition>
<echo message="Maven install (M2_HOME) set to: '${M2_HOME}'"/>
<available file="${M2_HOME}/bin/mvn" property="use.maven"/>
<fail message="Maven 3 not found. Build won't run if Maven 3 not installed and M2_HOME properly set!." unless="use.maven"/>
</target>
<!-- ================================================================================= -->
<!-- =========================== Clean Targets ===================================== -->
<target name="clean-tools" depends="check-maven" description="Clean the maven built runtime projects">
<java dir="${tools.mvn.parent}" fork="true" failonerror="true" classname="org.codehaus.plexus.classworlds.launcher.Launcher">
<jvmarg value="-Dclassworlds.conf=${M2_HOME}/bin/m2.conf"/>
<jvmarg value="-Dmaven.home=${M2_HOME}"/>
<jvmarg value="-Dbuild.qualifier=${version.qualifier}"/>
<arg value="clean"/>
<classpath>
<fileset dir="${M2_HOME}/boot">
<include name="plexus-classworlds-*.jar"/>
</fileset>
</classpath>
</java>
<echo message="Deleting: '${tools.root}/target/**/*'"/>
<delete failonerror="false">
<fileset dir="${tools.root}/target">
<include name="**/*"/>
</fileset>
</delete>
<echo message="Deleting old archives: '${tools.build.location}/${tools.prefix}*.zip'"/>
<delete failonerror="false">
<fileset dir="${tools.build.location}">
<include name="${tools.prefix}*.zip"/>
</fileset>
</delete>
</target>
<!-- Placeholder for non-OSGi test targets -->
<target name="clean-tools-test" description="Clean the testing projects">
<echo message="clean-tools-test"/>
<!-- ant antfile="antbuild.xml" dir="" target="clean"/>
<delete file="${eclipselink.tst.src.prefix}${eclipselink.zip.suffix}" failonerror="false"/ -->
</target>
<!-- ================================================================================= -->
<!-- =========================== Build Targets ===================================== -->
<!-- Compiles all runtime tools OSGi components. -->
<target name="build-tools" depends="check-maven">
<echo message="Launching Maven build with the following parameters:"/>
<echo message=" -Dclassworlds.conf=${M2_HOME}/bin/m2.conf"/>
<echo message=" -Dmaven.home=${M2_HOME}"/>
<echo message=" -Dbuild.qualifier=${version.qualifier}"/>
<echo message=" -DforceContextQualifier=${version.qualifier}"/>
<echo message=" verify"/>
<java dir="${tools.mvn.parent}" fork="true" failonerror="true" classname="org.codehaus.plexus.classworlds.launcher.Launcher">
<jvmarg value="-Dclassworlds.conf=${M2_HOME}/bin/m2.conf"/>
<jvmarg value="-Dmaven.home=${M2_HOME}"/>
<jvmarg value="-Dbuild.qualifier=${version.qualifier}"/>
<jvmarg value="-DforceContextQualifier=${version.qualifier}"/>
<!-- arg value="-X"/ -->
<arg value="verify"/>
<classpath>
<fileset dir="${M2_HOME}/boot">
<include name="plexus-classworlds-*.jar"/>
</fileset>
</classpath>
</java>
</target>
<!-- Placeholder for non-OSGi tools compiles -->
<!-- Compiles tests (excluding workbench, dbws-util and Oracle extensions). -->
<target name="build-tools-test">
<echo message="build-tools-test"/>
<!-- ant antfile="antbuild.xml" dir="${eclipselink.core.test}" target="build"/ -->
</target>
<!-- ================================================================================= -->
<!-- =========================== Javadoc Targets =================================== -->
<target name="build-javadocs">
<!-- the following property needs to be here because the "qualifier" is generated at runtime -->
<mkdir dir="${javadoc.dir}"/>
<delete dir="${javadoc.dir}" failonerror="false"/>
<javadoc
maxmemory="384m"
Verbose="false"
packagenames="org.eclipse.persistence.**"
destdir="${javadoc.dir}"
useexternalfile="yes"
additionalparam="-breakiterator -quiet"
windowtitle="${javadoc.title}"
>
<classpath>
<path refid="javadoc.path"/>
</classpath>
<tag name ="author" enabled="true" description="Author:" />
<tag name ="since" scope="all" description="Since:" />
<tag name ="SBGen" scope="all" description="SBGen:" />
<tag name ="bug" enabled="true" description="Related Bugs:" />
<doctitle><![CDATA[${javadoc.title}]]></doctitle>
<header><![CDATA[${javadoc.title}]]></header>
<!-- *** EclipseLink modules *** -->
<fileset dir="${tools.build.location}/tools/org.eclipse.persistence.tools.db/src" defaultexcludes="yes">
<include name="org/eclipse/persistence/tools/**/*.java"/>
<exclude name="org/eclipse/persistence/tools/internal/**/*.java"/>
</fileset>
<fileset dir="${tools.build.location}/tools/org.eclipse.persistence.tools.gen.db/src" defaultexcludes="yes">
<include name="org/eclipse/persistence/tools/**/*.java"/>
<exclude name="org/eclipse/persistence/tools/internal/**/*.java"/>
</fileset>
<fileset dir="${tools.build.location}/tools/org.eclipse.persistence.tools.mapping/src" defaultexcludes="yes">
<include name="org/eclipse/persistence/tools/**/*.java"/>
<exclude name="org/eclipse/persistence/tools/internal/**/*.java"/>
</fileset>
<fileset dir="${tools.build.location}/tools/org.eclipse.persistence.tools.utility/src" defaultexcludes="yes">
<include name="org/eclipse/persistence/tools/**/*.java"/>
<exclude name="org/eclipse/persistence/tools/internal/**/*.java"/>
</fileset>
<fileset dir="${tools.build.location}/tools/org.eclipse.persistence.tools.gen.nosql/src" defaultexcludes="yes">
<include name="org/eclipse/persistence/tools/**/*.java"/>
<exclude name="org/eclipse/persistence/tools/internal/**/*.java"/>
</fileset>
</javadoc>
</target>
<!-- ================================================================================= -->
<!-- =========================== Package Targets =================================== -->
<!-- Packages javadoc into a zip. -->
<target name="package-javadoc-zip" depends="build-javadocs" description="build EclipseLink javadoc zip">
<delete file="${tools.prefix}-javadoc-${version.string}.zip" failonerror="false"/>
<zip destfile="${tools.prefix}-javadoc-${version.string}.zip">
<!-- miscellaneous files -->
<zipfileset dir="${javadocs.dir}/"/>
</zip>
</target>
<!-- Packages the installer zip. -->
<target name="package-installer-zip" description="build EclipseLink Tools Installer zip">
<delete file="${tools.prefix}-${version.string}.zip" failonerror="false"/>
<zip destfile="${tools.prefix}-${version.string}.zip">
<!-- miscellaneous files -->
<zipfileset dir="${tools.mvn.parent}/resource">
<include name="*.html"/>
</zipfileset>
<zipfileset dir=".">
<include name="eclipselink-tools-javadoc-${version.string}.zip"/>
</zipfileset>
<!-- Library bundles -->
<zipfileset dir="${tools.root}/target">
<include name="*.jar"/>
<exclude name="*.test*"/>
<exclude name="*.parent*"/>
</zipfileset>
<!-- Testing bundles -->
<zipfileset dir="${tools.root}/target" prefix="testing">
<include name="*.test*"/>
</zipfileset>
</zip>
</target>
<!-- ================================================================================= -->
<!-- =========================== Test Targets ====================================== -->
<!-- Run core LRG. -->
<target name="test-tools" description="run the LRG tests">
<echo message="test-tools (LRG run)"/>
<ant antfile="test.xml" dir="${tools.root}/org.eclipse.persistence.tools.utility.tests" target="run"/>
</target>
<!-- Run core SRG. -->
<target name="test-tools-srg" description="run the SRG tests">
<echo message="test-tools-srg (SRG run)"/>
<ant antfile="test.xml" dir="${tools.root}/org.eclipse.persistence.tools.utility.tests" target="test-srg"/>
</target>
<!-- ================================================================================= -->
<!-- =========================== AutoBuild Targets ================================= -->
<target name="build-nightly" depends="get-git-hash, build-distribution, publish-distribution" description="Setup for nightly, build, then export for promote"/>
<!-- ================================================================================= -->
<!-- =========================== AutoBuild Init Targets ============================ -->
<target name="set-defaults">
<!-- The following variables should be passed from Hudson:
env.JAVA_HOME - JAVA_HOME as defined by Hudson
git.exec - fully qualified path to git executable
build.deps.dir - location on buildserver that stores dependencies (/shared/rt/eclipselink/bld_deps/master)
junit.dir - directory where junit.jar can be found
junit.lib - fully qualified path to junit jarfile (junit.dir/junit.jarname)
build.tool.root - root of build server (from here releng and db data files can be found)
hudson.workspace- WORKSPACE as defined by the Hudson slave
M2_HOME - location of Maven3 install (on build server)
-->
<property name="branch" value="master"/>
<condition property="git.exec.message" value="git.exec = '${git.exec}' (Set by Hudson Job)"
else="git.exec = not set!">
<isset property="git.exec"/>
</condition>
<!-- property file="${build.tool.root}/db-${branch}.properties"/ -->
<!-- M2_HOME defaults the value maven 3.0.3 install location on the build -->
<!-- server for AutoBuilds. This is brittle, but easier for now -->
<property name="M2_HOME" value="/shared/common/apache-maven-3.0.3"/>
<!-- Set location of executed scripts to hudson (is also set in promote-init for milestone publising) -->
<property name="script.dir" value="${hudson.workspace}/buildsystem"/>
<!-- Set location to export builds for publishing -->
<property name="extract.root.dir" value="${build.tool.root}/exported_builds"/>
<echo message=" "/>
<echo message="${git.exec.message}"/>
<echo message="build.deps.dir = '${build.deps.dir}'"/>
<echo message="build.tool.root = '${build.tool.root}'"/>
<echo message="hudson.workspace= '${hudson.workspace}'"/>
<echo message="M2_HOME = '${M2_HOME}'"/>
<echo message=" "/>
<echo message="branch = '${branch}'"/>
<echo message="extract.root.dir= '${extract.root.dir}'"/>
</target>
<target name="get-git-hash" unless="git.hash" depends="set-defaults">
<fail message="${git.exec.message}" unless="git.exec"/>
<!-- get git.hash NOTE: if "get" fails defaulted to "NA" -->
<exec outputproperty="git.hash"
failonerror="false"
failifexecutionfails="false"
errorproperty="githash.failed"
logError="true"
executable="${git.exec}">
<arg value="log"/>
<arg value="-1"/>
<arg value="--format=%h"/>
</exec>
<property name="git.hash" value="NA"/>
</target>
<!-- ================================================================================= -->
<!-- =========================== AutoBuild Publish Targets ========================= -->
<target name="cannot-generate-handoff" unless="procedure" depends="init">
<fail message="'procedure' not set. Cannot generate handoff file!"/>
</target>
<target name="generate-handoff" if="procedure" depends="cannot-generate-handoff" description="generate the publishing handoff file">
<property name="handoff.file" value="${build.tool.root}/handoff-file-${procedure}-${branch}-${version.qualifier}.dat"/>
<echo message="Generating Publishing handoff file with the following values:"/>
<echo message=" procedure ='${procedure}'"/>
<echo message=" extract.loc ='${extract.loc}'"/>
<echo message=" host ='${host}'"/>
<echo message=" milestone.tag='${milestone.tag}'"/>
<echo message=" handoff.file ='${handoff.file}'"/>
<echo message="extract.loc=${extract.loc} host=${host} maven.tag=${milestone.tag}" file="${handoff.file}" append="false"/>
<!-- could use ${line.separator} to generate on separate lines, but don't as yet -->
</target>
<target name="publish-distribution" depends="build-distribution">
<echo message="publish-distribution"/>
<property name="tools.extract.dir" value="${extract.root.dir}/tools/${release.version}/${version.qualifier}"/>
<mkdir dir="${tools.extract.dir}"/>
<echo message="Exporting Tools artifacts..."/>
<echo message=" from '${hudson.workspace}'"/>
<echo message=" to '${tools.extract.dir}'"/>
<copy todir="${tools.extract.dir}" failonerror="false">
<fileset dir="${hudson.workspace}">
<include name="${tools.prefix}*${version.qualifier}.zip"/>
</fileset>
</copy>
<!-- Generate proper handoff file -->
<antcall target="generate-handoff">
<param name="procedure" value="tools"/>
<param name="host" value="Eclipse"/>
<param name="extract.loc" value="${tools.extract.dir}"/>
</antcall>
</target>
</project>