blob: a9ec14cc939348a6b3835eeddecb6094c7267b26 [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"
/>
<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="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}"/>
<!-- Now that all our overrides are complete, pull in the rest of the build properties -->
<property file="${basedir}/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="EL version ='${release.version}'"/>
<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}'"/>
</target>
<target name="clean" 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"/>
<ant antfile="build.xml" dir="${build.root.dir}" target="clean"/>
</target>
<target name="get-dependencies" depends="clean">
<mkdir dir="${junit.dir}"/>
<mkdir dir="${build.deps.dir}/mail"/>
<mkdir dir="${build.deps.dir}/mavenant"/>
<get src="${activation.url}" dest="${build.deps.dir}/mail/activation.jar"/>
<get src="${mail.url}" dest="${build.deps.dir}/mail/mail.jar"/>
<get src="${mavenant.url}" dest="${build.deps.dir}/mavenant/maven-ant-tasks-2.0.8.jar"/>
<!-- 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}"/>
<!-- 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.jpa.tst.src.prefix}${eclipselink.zip.suffix}" tofile="${download.path}/${release.version}/${installer_id}/${eclipselink.jpa.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>
</project>