blob: e6594f121e3bbe18d96d1c9a27c9214e38ef74d0 [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 '.'
* - multi-word targets use hyphens '-'
* - 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:
* eric.gwin - initial API and implementation (checked in by Tware)
#******************************************************************************/-->
<project name="EclipseLink Automated Build" basedir="." default="build-nightly">
<echo message="---- AutoBuild.xml ----"/>
<target name="build-no-publish" description="Trigger an automated build without testing or publish"
depends="clean, build, build-test"
/>
<target name="build-nightly" description="Trigger the nightly automated build and lrg tests"
depends="clean, build, package-bundles, build-test, test-lrg, publish-build, publish-results, test-for-errors"
/>
<target name="build-milestone" description="Trigger build, testing, and publishing of a milestone release ('release' is a milestone in this case)"
depends="clean, build, package-bundles, build-test, test-lrg, test-for-errors, create-tag, publish-build, publish-results"
/>
<target name="build-continuous" description="Trigger an automated build and run the tests if source changes exist"
depends="clean, build-no-javadoc, build-test, test-srg"
/>
<target name="publish-all" description="Trigger just the publish targets"
depends="publish-build, publish-results"
/>
<target name="init">
<tstamp>
<format property="build_date" pattern="yyyyMMdd"/>
<format property="build_time" pattern="HHmm"/>
</tstamp>
<!-- # The next properties defines are pulled out of the properties file -->
<!-- # to highlight them. -->
<!-- # test.properties.run - defines which file to use to connect to the -->
<!-- # db for post-build testing. -->
<!-- # coretest.prop.file - the file generated by the build, that holds -->
<!-- # the db properties for automated testing -->
<property name="coretest.prop.file" value="${log.dir}/mysql.jpa.test.properties"/>
<property name="test.properties.run" value="${coretest.prop.file}"/>
<property file="${basedir}/autobuild.properties"/>
<!-- temporary need build_id in upload to maven. This code should is duplicated from build.xml -->
<!-- ${build_id} will be given by the build system. Manual build is SNAPSHOT. -->
<condition property="build_number" value="${build_id}">
<isset property="build_id"/>
</condition>
<property name="build_number" value="SNAPSHOT"/>
<!-- end of temporary code-->
<condition property="installer_id" value="${build_date}">
<equals arg1="${build_id}" arg2="SNAPSHOT"/>
</condition>
<property name="installer_id" value="${release.version}${build_id}"/>
<condition property="build_number_string" value="${build.date}">
<equals arg1="${build_id}" arg2=""/>
</condition>
<property name="build_number_string" value="${build_id}-${build.date}"/>
<condition property="download.path" value="${eclipse.download.path}/nightly">
<equals arg1="${build_id}" arg2="SNAPSHOT"/>
</condition>
<property name="download.path" value="${eclipse.download.path}"/>
<!-- HACK: to fix workbench buildnumber stamping until workbench build files can be fixed -->
<property name="_buildNumber" value="${installer_id}"/>
<property name="milestone.tag" value="${installer_id}"/>
<!-- Now that all our overrides are complete, pull in the rest of the build properties -->
<property file="${build.root.dir}/build.properties"/>
<echo message="ANT_ARGS='${env.ANT_ARGS}'"/>
<echo message="ANT_OPTS='${env.ANT_OPTS}'"/>
<echo message=" "/>
<echo message="build_date.build_time='${build_date}.${build_time}'"/>
<echo message="java.version ='${java.version}'"/>
<echo message="os.name ='${os.name}'"/>
<echo message="os.arch ='${os.arch}'"/>
<echo message="os.version ='${os.version}'"/>
<echo message=" "/>
<echo message="basedir ='${basedir}'"/>
<echo message="build.deps.dir='${build.deps.dir}'"/>
<echo message="build.root.dir='${build.root.dir}'"/>
<echo message="log.dir ='${log.dir}'"/>
<echo message="junit.dir ='${junit.dir}'"/>
<echo message="junit.lib ='${junit.lib}'"/>
<echo message=" "/>
<echo message="EL version ='${release.version}'"/>
<echo message="build_id ='${build_id}'"/>
<echo message="build_number ='${build_number}'"/>
<echo message="_buildNumber ='${_buildNumber}'"/>
<echo message="installer_id ='${installer_id}'"/>
<echo message="download.path ='${download.path}'"/>
<echo message="milestone.tag ='${milestone.tag}'"/>
<echo message="build_number_string ='${build_number_string}'"/>
</target>
<target name="clean" depends="init">
<ant antfile="build.xml" dir="${build.root.dir}" target="clean"/>
</target>
<target name="clean-dependencies" depends="init">
<!-- Removed full delete of source tree because build-clean should take care
of old build artifacts, and "svn co" should update source (including
updating revision numbers, and cleaning up files that were renamed or
deleted in the repos). -->
<delete dir="${junit.dir}"/>
<delete dir="${build.deps.dir}/mail"/>
<delete dir="${build.deps.dir}/mavenant"/>
<delete file="${build.deps.dir}/dependencies.txt"/>
<delete file="${build.deps.dir}/junit.zip"/>
</target>
<target name="check-4-junit">
<echo message="Looking for: ${junit.dir}/junit.jar"/>
<available file="${junit.dir}/junit.jar" type="file" property="junit-exist"/>
<echo message="junit-exist: ${junit-exist}"/>
</target>
<target name="get-junit" unless="junit-exist" depends="check-4-junit">
<mkdir dir="${junit.dir}"/>
<!-- Get junit, extract it, then copy to expected location and cleanup (flatten won't work) -->
<get src="${junit.url}" dest="${build.deps.dir}/junit.zip"/>
<unzip src="${build.deps.dir}/junit.zip" dest="${build.deps.dir}"/>
<copy file="${build.deps.dir}/${junit.bundle}/junit.jar" todir="${junit.dir}"/>
<delete dir="${build.deps.dir}/${junit.bundle}"/>
<property name="dependencies-downloaded" value="true"/>
</target>
<target name="check-4-mail">
<echo message="Looking for: ${build.deps.dir}/mail/mail.jar"/>
<available file="${build.deps.dir}/mail/mail.jar" type="file" property="mail-exist"/>
<echo message="mail-exist: ${mail-exist}"/>
</target>
<target name="get-mail" unless="mail-exist" depends="check-4-mail">
<mkdir dir="${build.deps.dir}/mail"/>
<get src="${mail.url}" dest="${build.deps.dir}/mail/mail.jar"/>
<property name="dependencies-downloaded" value="true"/>
</target>
<target name="check-4-activation">
<echo message="Looking for: ${build.deps.dir}/mail/activation.jar"/>
<available file="${build.deps.dir}/mail/activation.jar" type="file" property="activation-exist"/>
<echo message="activation-exist: ${activation-exist}"/>
</target>
<target name="get-activation" unless="activation-exist" depends="check-4-activation">
<get src="${activation.url}" dest="${build.deps.dir}/mail/activation.jar"/>
<property name="dependencies-downloaded" value="true"/>
</target>
<target name="check-4-mavenant">
<echo message="Looking for: ${build.deps.dir}/mavenant/maven-ant-tasks-2.0.8.jar"/>
<available file="${build.deps.dir}/mavenant/maven-ant-tasks-2.0.8.jar" type="file" property="mavenant-exist"/>
<echo message="mavenant-exist: ${mavenant-exist}"/>
</target>
<target name="get-mavenant" unless="mavenant-exist" depends="check-4-mavenant">
<!-- Commented out download, because it seems the access to apache.org has been blocked -->
<!-- mkdir dir="${build.deps.dir}/mavenant"/ -->
<!-- get src="${mavenant.url}" dest="${build.deps.dir}/mavenant/maven-ant-tasks-2.0.8.jar"/ -->
<!-- property name="dependencies-downloaded" value="true"/ -->
<fail message="Must manually create dependency. Build cannot find: ${build.deps.dir}/mavenant/maven-ant-tasks-2.0.8.jar"/>
</target>
<target name="get-dependencies" if="dependencies-downloaded" depends="get-junit, get-mail, get-activation, get-mavenant">
<delete file="${build.deps.dir}/dependencies.txt" failonerror="true"/>
<!-- Generate "dependencies.txt" file -->
<echo message="Buildsystem external dependencies come from:${line.separator}" file="${build.deps.dir}/dependencies.txt" append="false"/>
<echo message="junit: ${junit.url}${line.separator}" file="${build.deps.dir}/dependencies.txt" append="true"/>
<echo message="activation: ${activation.url}${line.separator}" file="${build.deps.dir}/dependencies.txt" append="true"/>
<echo message="mail: ${mail.url}${line.separator}" file="${build.deps.dir}/dependencies.txt" append="true"/>
<echo message="mavenant: ${mavenant.url}${line.separator}" file="${build.deps.dir}/dependencies.txt" append="true"/>
</target>
<target name="build" depends="get-dependencies">
<ant antfile="build.xml" dir="${build.root.dir}" target="build-distribution"/>
</target>
<target name="build-no-javadoc" depends="get-dependencies">
<ant antfile="build.xml" dir="${build.root.dir}" target="package-eclipselink-jar"/>
</target>
<target name="package-bundles" depends="get-dependencies">
<ant antfile="build.xml" dir="${build.root.dir}" target="package-eclipselink-bundles"/>
</target>
<target name="build-test" depends="get-dependencies">
<!-- Generate Test properties file -->
<echo message="# Generated db connection properties (by bootstrap.xml)${line.separator}" file="${coretest.prop.file}" append="false"/>
<echo message="jdbc.driver.jar=${jdbc.driver.jar}${line.separator}" file="${coretest.prop.file}" append="true"/>
<echo message="db.driver=${db.driver}${line.separator}" file="${coretest.prop.file}" append="true"/>
<echo message="db.url=${db.url}${line.separator}" file="${coretest.prop.file}" append="true"/>
<echo message="db.user=${db.user}${line.separator}" file="${coretest.prop.file}" append="true"/>
<echo message="db.pwd=${db.pwd}${line.separator}" file="${coretest.prop.file}" append="true"/>
<echo message="db.platform=${db.platform}${line.separator}" file="${coretest.prop.file}" append="true"/>
<ant antfile="build.xml" dir="${build.root.dir}" target="build-test"/>
<!-- delete file="${coretest.prop.file}"/ -->
</target>
<target name="test-srg">
<ant antfile="build.xml" dir="${build.root.dir}" target="test-srg">
<property name="eclipselink.logging.level" value="${test.logging.level}"/>
</ant>
</target>
<target name="test-lrg">
<ant antfile="build.xml" dir="${build.root.dir}" target="test-lrg">
<property name="eclipselink.logging.level" value="${test.logging.level}"/>
</ant>
</target>
<target name="publish-build">
<!-- New Publish Architecture -->
<mkdir dir="${download.path}/${release.version}/${installer_id}"/>
<copy file="${build.root.dir}/${eclipselink.install.prefix}${eclipselink.zip.suffix}" tofile="${download.path}/${release.version}/${installer_id}/${eclipselink.install.prefix}-${installer_id}${eclipselink.zip.suffix}" failonerror="false"/>
<copy file="${build.root.dir}/${eclipselink.src.install.prefix}${eclipselink.zip.suffix}" tofile="${download.path}/${release.version}/${installer_id}/${eclipselink.src.install.prefix}-${installer_id}${eclipselink.zip.suffix}" failonerror="false"/>
<copy file="${build.root.dir}/${eclipselink.tst.src.prefix}${eclipselink.zip.suffix}" tofile="${download.path}/${release.version}/${installer_id}/${eclipselink.tst.src.prefix}-${installer_id}${eclipselink.zip.suffix}" failonerror="false"/>
<copy file="${build.root.dir}/${eclipselink.plugins.install.prefix}${eclipselink.zip.suffix}" tofile="${download.path}/${release.version}/${installer_id}/${eclipselink.plugins.install.prefix}-${installer_id}${eclipselink.zip.suffix}" failonerror="false"/>
<copy file="${build.root.dir}/foundation/eclipselink.core.test/reports/junit-noframes.html" tofile="${download.path}/${release.version}/${installer_id}/eclipselink-core-srg-${installer_id}.html" failonerror="false"/>
<copy file="${build.root.dir}/jpa/eclipselink.jpa.test/reports/junit-noframes.html" tofile="${download.path}/${release.version}/${installer_id}/eclipselink-jpa-lrg-${installer_id}.html" failonerror="false"/>
<copy file="${build.root.dir}/moxy/eclipselink.moxy.test/reports/jaxb/junit-noframes.html" tofile="${download.path}/${release.version}/${installer_id}/eclipselink-jaxb-lrg-${installer_id}.html" failonerror="false"/>
<copy file="${build.root.dir}/moxy/eclipselink.moxy.test/reports/oxm/junit-noframes.html" tofile="${download.path}/${release.version}/${installer_id}/eclipselink-oxm-lrg-${installer_id}.html" failonerror="false"/>
<copy file="${build.root.dir}/sdo/eclipselink.sdo.test/reports/true/junit-noframes.html" tofile="${download.path}/${release.version}/${installer_id}/eclipselink-sdo-lrg-${installer_id}.html" failonerror="false"/>
<exec executable="${svn.exec}" failonerror="false" logError="true">
<arg value="commit"/>
<arg value="-m ${installer_id}"/>
<arg value="${build.root.dir}/${eclipselink.jar.name}"/>
<arg value="${build.root.dir}/${eclipselink.src.install.prefix}${eclipselink.zip.suffix}"/>
</exec>
<ant antfile="uploadToMaven.xml" dir="${build.root.dir}" target="upload-maven-all"/>
</target>
<target name="fix-permission">
<chmod file="${build.root.dir}/buildsystem/cleanNightly.sh" perm="ug+x"/>
<chmod file="${build.root.dir}/buildsystem/buildNightlyList.sh" perm="ug+x"/>
</target>
<!-- Antified "cleanNightly.sh" -->
<target name="clean-results" depends="fix-permission">
<exec executable="/bin/sh" failonerror="true" logError="true" >
<arg value="${build.root.dir}/buildsystem/cleanNightly.sh"/>
</exec>
</target>
<!-- Antified "buildNightlyList.sh" -->
<target name="publish-results" depends="clean-results">
<exec executable="/bin/sh" failonerror="true" logError="true" >
<arg value="${build.root.dir}/buildsystem/buildNightlyList.sh"/>
</exec>
</target>
<target name="test-for-errors">
<fail message="Some of the junit tests failed. See the ${report.dir}/junit-noframes.html file for details." if="junit.failed"/>
</target>
<target name="create-tag">
<echo message="Create a tag (${milestone.tag}) of this revision (${svn.revision}) for this milestone (${build.type})"/>
</target>
</project>