blob: db87036134018a54f69e2372d5b5b06a2b3a6c69 [file] [log] [blame]
<?xml version="1.0"?>
<project name="ajdt-build" basedir="." default="run">
<!-- set the properties for os -->
<import file="os_support/os.xml" />
<!-- help with provisioning -->
<import file="provisioning_support/get-dependencies.xml"/>
<taskdef resource="com/ibm/lakeba/ant/taskdefs.properties">
<classpath>
<pathelement path="ant_libs/checkresults.jar" />
</classpath>
</taskdef>
<!-- - - - - - - - - - - - - - - - - -
target: init
Initializes properties
- - - - - - - - - - - - - - - - - -->
<target name="init">
<property file="provisioning_support/download.properties" />
<property file="local.properties" />
<property file="build.properties" />
<!-- ===================================================================== -->
<!-- Create the timestamp to be used for the build -->
<!-- This timestamp will not be used if forceContextQualifier is set from -->
<!-- a properties file or from the command line -->
<!-- ===================================================================== -->
<tstamp>
<format property="tstampQual" pattern="yyyyMMdd-HH00" locale="en,US" timezone="America/Vancouver"/>
</tstamp>
<echo message="tstampQual=${tstampQual}"/>
<property name="forceContextQualifier" value="${qualPrefix}-${tstampQual}"/>
<property name="buildLabel" value="build-${forceContextQualifier}"/>
<property name="signer" location="${builder}/provisioning_support/sign.sh"/>
<echo message="=============================================="/>
<echo message="forceContextQualifier=${forceContextQualifier}"/>
<echo message="=============================================="/>
<condition property="target.eclipse.tar" value="${target.eclipse.tar.42}">
<equals arg1="${target.eclipse.version}" arg2="42"/>
</condition>
<condition property="target.eclipse.tar" value="${target.eclipse.tar.37}">
<equals arg1="${target.eclipse.version}" arg2="37"/>
</condition>
<!-- downloading has been disabled -->
<condition property="target.url" value="${target.url.42}">
<equals arg1="${target.eclipse.version}" arg2="42"/>
</condition>
<condition property="target.url" value="${target.url.37}">
<equals arg1="${target.eclipse.version}" arg2="37"/>
</condition>
<echo message="target.eclipse.version=${target.eclipse.version}"/>
<echo message="target.url=${target.url}"/>
<echo message="target.eclipse.tar=${target.eclipse.tar}"/>
</target>
<target name="clean" unless="noclean">
<delete dir="${build.home}" />
<delete dir="${build.dist}" />
<delete dir="${target.eclipse}" />
</target>
<target name="pdebuild" depends="init,init-classpaths,find.pdebuild.home" description="Perform the pde headless build">
<java fork="true" failonerror="true"
dir="${pdebuild.home}"
classname="org.eclipse.core.launcher.Main">
<arg value="-application" />
<arg value="org.eclipse.ant.core.antRunner" />
<arg value="-data" />
<arg value="${build.dest}/target/build-workspace" />
<!--<arg value="-verbose" />-->
<arg value="-DfetchCacheLocation=${fetchCacheLocation}" />
<arg value="-Dbuilder=${workdir}/org.eclipse.ajdt.releng" />
<arg value="-DbaseLocation=${target.eclipse}" />
<arg value="-DbuildDirectory=${build.home}" />
<arg value="-Dbuild.dest=${build.dest}" />
<arg value="-DforceContextQualifier=${forceContextQualifier}" />
<classpath>
<fileset dir="${build.eclipse}/plugins">
<include name="org.eclipse.equinox.launcher_*.jar"/>
</fileset>
</classpath>
</java>
</target>
<target name="zip-archive" depends="init" description="Zip up a copy of the archive for local installation">
<property name="zip.name" value="ajdt-${forceContextQualifier}.zip"/>
<property name="zip.full.location" value="${build.dist}/${zip.name}"/>
<zip destfile="${zip.full.location}">
<fileset dir="${updateSite.loc}" />
</zip>
<!-- now store the zip name and location in a property file-->
<propertyfile file="${build.dist}/ajdt-zip.properties" comment="This properties file contains the location and name of the AJDT update site archive produced by the latest build">
<entry key="zip.name" value="${zip.name}"/>
<entry key="zip.full.location" value="${zip.full.location}"/>
</propertyfile>
</target>
<target name="find.pdebuild.home">
<files includes="${build.eclipse}/plugins/org.eclipse.pde.build_*/scripts" id="pdebuild.folder" />
<property name="pdebuild.home" value="${toString:pdebuild.folder}" />
<echo message="pdebuild.home=${pdebuild.home}" />
<echo message="path=${build.eclipse}/plugins/org.eclipse.pde.build_*/scripts" />
<echo message="path=${toString:pdebuild.folder}" />
</target>
<target name="generateP2metadata" depends="init,init-classpaths,find.pdebuild.home" description="Generate p2 metadata for the AJDT update site">
<java fork="true" failonerror="true" classpathref="eclipse.classpath"
dir="${pdebuild.home}"
classname="org.eclipse.core.launcher.Main">
<arg value="-application" />
<arg value="org.eclipse.equinox.p2.publisher.EclipseGenerator" />
<arg value="-updateSite" />
<arg value="${updateSite.loc}" />
<arg value="-base" />
<arg value="${updateSite.loc}" />
<arg value="-site" />
<arg value="file:${updateSite.loc}/site.xml" />
<arg value="-metadataRepository" />
<arg value="file:${updateSite.loc}" />
<arg value="-metadataRepositoryName" />
<arg value="${p2.repository.name}" />
<arg value="-artifactRepository" />
<arg value="file:${updateSite.loc}" />
<arg value="-artifactRepositoryName" />
<arg value="${p2.repository.name}" />
<arg value="-reusePack200Files" />
<arg value="-noDefaultIUs" />
<jvmarg value="-Xmx128M" />
</java>
</target>
<target name="signUpdateSite" depends="init,init-classpaths,find.pdebuild.home" description="Digitally signs the update site">
<taskdef resource="net/sf/antcontrib/antcontrib.properties" >
<classpath>
<pathelement path="ant_libs/ant-contrib-1.0b3.jar" />
</classpath>
</taskdef>
<if>
<equals arg1="${p2.sign}" arg2="true" />
<then>
<delete file="${updateSite.loc}/content.xml" />
<delete file="${updateSite.loc}/artifacts.xml" />
<java classname="org.eclipse.equinox.internal.p2.jarprocessor.Main" fork="true"
classpathref="jarprocessor.classpath" failonerror="true" maxmemory="256m" dir="${updateSite.loc}">
<arg line="-verbose -processAll -repack -pack -sign ${signer}" />
<arg line="-outputDir ${updateSite.loc} ${updateSite.loc}" />
</java>
<java classname="org.eclipse.equinox.launcher.Main" fork="true" classpathref="eclipse.classpath"
failonerror="true" maxmemory="256m" dir="${updateSite.loc}">
<arg line="-application org.eclipse.equinox.p2.publisher.FeaturesAndBundlesPublisher" />
<arg line="-source ${updateSite.loc} -metadataRepository file:${updateSite.loc}" />
<arg line="-artifactRepository file:${updateSite.loc} -metadataRepositoryName '${p2.repository.name}'" />
<arg line="-artifactRepositoryName '${p2.repository.name}' -reusePackedFiles -reusePack200Files -publishArtifacts" />
</java>
<java classname="org.eclipse.equinox.launcher.Main" fork="true" classpathref="eclipse.classpath"
failonerror="true" maxmemory="256m" dir="${updateSite.loc}">
<arg line="-application org.eclipse.equinox.p2.publisher.CategoryPublisher" />
<arg line="-metadataRepository file:${updateSite.loc}" />
<arg line="-categoryDefinition file:${updateSite.loc}/site.xml" />
<arg line="-categoryQualifier org.eclipse.ajdt" />
</java>
</then>
</if>
</target>
<!--
Run the site optimizer over the update site directory, prior to
uploading to the update server - spyoung
ADE - this is not working any more, so disable. It seems that
some jars are not being properly processed. As this is not a
requirement any longer, it is ok to disable.
-->
<target name="optimizeUpdateSite" depends="init,init-classpaths">
<!-- Step 1 - process all the JARs and mark them for packing -->
<java fork="true" failonerror="true" classpathref="eclipse.classpath"
classname="org.eclipse.core.launcher.Main">
<arg value="-application" />
<arg value="org.eclipse.update.core.siteOptimizer" />
<arg line="-jarProcessor -processAll -repack -verbose" />
<arg line="-outputDir ${updateSite.loc}" />
<arg value="${updateSite.loc}" />
</java>
<!-- Step 2 - "repack" all the JARs (i.e actaully pack them!) -->
<java fork="true" failonerror="true" classpathref="eclipse.classpath"
classname="org.eclipse.core.launcher.Main">
<arg value="-application" />
<arg value="org.eclipse.update.core.siteOptimizer" />
<arg line="-jarProcessor -pack -verbose" />
<arg line="-outputDir ${updateSite.loc}" />
<arg value="${updateSite.loc}" />
</java>
</target>
<target name="check.provision.build" description="Check to see if the build eclipse has already been provisioned">
<available file="${build.eclipse}/.provisioned" property="provision.build.completed"/>
</target>
<target name="check-eclipse-already-downloaded" description="Check to see if the target Eclipse is already downloaded">
<available file="${download.home}/${target.eclipse.tar}" property="download.completed"/>
</target>
<target name="download-eclipse" depends="init,check-eclipse-already-downloaded" unless="download.completed" description="Downloads Eclipse if not already downloaded">
<mkdir dir="${download.home}"/>
<antcall target="downloadFile">
<param name="theURL" value="${target.url}"/>
<param name="downloadsDir" value="${download.home}"/>
<param name="theFile" value="${target.eclipse.tar}"/>
</antcall>
</target>
<!-- for now, only tar files are supported -->
<!-- <target name="provision-build-eclipse" depends="init,check.provision.build,download-eclipse" description="Provisions the Eclipse that is driving the build process"> -->
<target name="provision-build-eclipse" depends="init,init-classpaths,check.provision.build,download-eclipse" unless="provision.build.completed" description="Provisions the Eclipse that is driving the build process">
<!-- set the build eclipse archive if it doesn't already exist -->
<property name="build.eclipse.tar" value="${download.home}/${target.eclipse.tar}"/>
<!-- Unpack eclipse -->
<mkdir dir="${build.dest}"/>
<antcall target="unpack-archive">
<param name="theFile" value="${build.eclipse.tar}" />
<param name="theDir" value="${build.dest}" />
</antcall>
<!-- Install AJDT -->
<install-bundle
eclipse.loc="${build.dest}/eclipse"
updatesite.url="http://download.eclipse.org/tools/ajdt/37/dev/update"
feature.id="org.eclipse.ajdt" />
<!-- Install Fetach factory for git repos -->
<install-bundle
eclipse.loc="${build.dest}/eclipse"
updatesite.url="http://download.eclipse.org/egit/pde/updates-nightly"
feature.id="org.eclipse.egit.fetchfactory" />
<!-- Mark as provisioned -->
<touch file="${build.dest}/eclipse/.provisioned" />
<!-- Mark as provisioned -->
<touch file="${build.dest}/target/eclipse/.provisioned" />
</target>
<target name="init-classpaths">
<!-- paths for use later -->
<path id="eclipse.classpath">
<fileset dir="${build.dest}/eclipse/plugins">
<include name="org.eclipse.equinox.launcher_*.jar" />
</fileset>
</path>
<path id="jarprocessor.classpath">
<fileset dir="${build.dest}/eclipse/plugins">
<include name="org.eclipse.equinox.p2.jarprocessor_*.jar" />
</fileset>
</path>
</target>
<!-- for now, only tar files are supported -->
<!-- Sets up the Target eclipse to build against-->
<target name="provision-target-eclipse" depends="init,init-classpaths" unless="no.provision.target">
<!-- download if not already there -->
<!-- disable downloading
<mkdir dir="${download.home}"/>
<antcall target="downloadFile">
<param name="theURL" value="${target.url}"/>
<param name="downloadsDir" value="${download.home}"/>
<param name="theFile" value="${target.eclipse.tar}"/>
</antcall>
-->
<!-- Unpack a fresh eclipse -->
<delete failonerror="false">
<fileset dir="${build.dest}/target/eclipse"/>
</delete>
<mkdir dir="${build.dest}/target"/>
<antcall target="unpack-archive">
<param name="theFile" value="${download.home}/${target.eclipse.tar}" />
<param name="theDir" value="${build.dest}/target" />
</antcall>
<!-- Install Mylyn -->
<install-bundle
eclipse.loc="${build.dest}/target/eclipse"
updatesite.url="http://download.eclipse.org/tools/mylyn/update/e3.4/"
feature.id="org.eclipse.mylyn_feature" />
<install-bundle
eclipse.loc="${build.dest}/target/eclipse"
updatesite.url="http://download.eclipse.org/tools/mylyn/update/e3.4/"
feature.id="org.eclipse.mylyn.context_feature" />
<install-bundle
eclipse.loc="${build.dest}/target/eclipse"
updatesite.url="http://download.eclipse.org/tools/mylyn/update/e3.4/"
feature.id="org.eclipse.mylyn.ide_feature" />
<install-bundle
eclipse.loc="${build.dest}/target/eclipse"
updatesite.url="http://download.eclipse.org/tools/mylyn/update/e3.4/"
feature.id="org.eclipse.mylyn.java_feature" />
</target>
<!-- Provisions the target Eclipse so that it can run the tests. Does so by installing all of the test plugins. -->
<target name="provision-test-eclipse" depends="init">
<install-bundle
eclipse.loc="${build.dest}/target/eclipse"
updatesite.url="file:${updateSite.loc}"
feature.id="org.eclipse.ajdt" />
<install-bundle
eclipse.loc="${build.dest}/target/eclipse"
updatesite.url="file:${updateSite.loc}"
feature.id="org.eclipse.equinox.weaving.sdk" />
<install-bundle
eclipse.loc="${build.dest}/target/eclipse"
updatesite.url="file:${updateSite.loc}"
feature.id="org.eclipse.aspectj.feature_tests" />
<!-- Ensure that weaving bundle is auto-started, but ensure that we don't add the line twice -->
<replace file="${build.dest}/target/eclipse/configuration/config.ini"
token="osgi.bundles=org.eclipse.equinox.weaving.aspectj@3\:start," value="osgi.bundles="/>
<replace file="${build.dest}/target/eclipse/configuration/config.ini"
token="osgi.bundles=" value="osgi.bundles=org.eclipse.equinox.weaving.aspectj@3\:start,"/>
<!-- org.eclipse.test needs to be in the target AND the build eclipses -->
<mkdir dir="${build.dest}/target/test_framework"/>
<unzip src="${builder}/build_bundles/${eclipse.test.framework.version}" dest="${build.dest}/target/test_framework" />
<install-bundle
eclipse.loc="${build.dest}/target/eclipse"
updatesite.url="file:${build.dest}/target/test_framework"
feature.id="org.eclipse.test" />
<install-bundle
eclipse.loc="${build.dest}/eclipse"
updatesite.url="file:${build.dest}/target/test_framework"
feature.id="org.eclipse.test" />
<!-- start with a clean workspace -->
<delete failonerror="false">
<fileset dir="${test.workspace}" />
</delete>
</target>
<target name="run-test-eclipse" depends="init,run-weaving-tests,run-core-tests,run-ui-tests"/>
<target name="run-weaving-tests" depends="init,refresh-test-workspace">
<antcall target="refresh-test-workspace" />
<ant target="ui-test" antfile="${test.library.xml}" dir="${target.eclipse}" inheritall="false">
<property name="data-dir" value="${test.workspace}" />
<property name="plugin-name" value="org.eclipse.contribution.weaving.jdt.tests" />
<property name="classname" value="org.eclipse.contribution.weaving.jdt.tests.AllWeavingTests" />
<property name="eclipse-home" value="${target.eclipse}" />
<property name="vmargs" value="${vmargs} ${osgi.vmargs}" />
<property name="org.eclipse.test" value="${org.eclipse.test}" />
<property name="arch" value="${build.arch}"/>
<property name="os" value="${build.os}"/>
<property name="ws" value="${build.ws}"/>
<property name="timeout" value="720000"/>
</ant>
</target>
<target name="run-core-tests" depends="init,refresh-test-workspace">
<antcall target="refresh-test-workspace" />
<!-- This should be a core-test, but the tests are hanging on the build server, so maybe they need to be UI tests. -->
<ant target="ui-test" antfile="${test.library.xml}" dir="${target.eclipse}" inheritall="false">
<property name="data-dir" value="${test.workspace}" />
<property name="plugin-name" value="org.eclipse.ajdt.core.tests" />
<property name="classname" value="org.eclipse.ajdt.core.tests.AllCoreTests" />
<property name="eclipse-home" value="${target.eclipse}" />
<property name="vmargs" value="${vmargs} ${osgi.vmargs}" />
<property name="org.eclipse.test" value="${org.eclipse.test}" />
<property name="arch" value="${build.arch}"/>
<property name="os" value="${build.os}"/>
<property name="ws" value="${build.ws}"/>
</ant>
</target>
<target name="run-ui-tests" depends="init,refresh-test-workspace">
<antcall target="refresh-test-workspace" />
<ant target="ui-test" antfile="${test.library.xml}" dir="${target.eclipse}" inheritall="false">
<property name="data-dir" value="${test.workspace}" />
<property name="plugin-name" value="org.eclipse.ajdt.ui.tests" />
<property name="classname" value="org.eclipse.ajdt.ui.tests.AllUITests" />
<property name="eclipse-home" value="${target.eclipse}" />
<property name="vmargs" value="${vmargs} ${osgi.vmargs}" />
<property name="org.eclipse.test" value="${org.eclipse.test}" />
<property name="arch" value="${build.arch}"/>
<property name="os" value="${build.os}"/>
<property name="ws" value="${build.ws}"/>
</ant>
</target>
<target name="set-test-properties">
<property name="vmargs" value="-Xmx1024M -XX:PermSize=64M -XX:MaxPermSize=256M"/>
<property name="osgi.vmargs" value="-Daj.weaving.verbose=true -Dorg.aspectj.weaver.showWeaveInfo=true -Dorg.aspectj.osgi.verbose=true -Dosgi.clean=true"/>
</target>
<!--
FIXADE:
Note that we have to run an empty test before we can run the real test.
The first run of a ui test case in a clean workspace is failing
on the build server. So, we run this empty test first in order to get things
going.
-->
<target name="refresh-test-workspace" depends="init,set-test-properties">
<delete dir="${test.workspace}"/>
<ant target="ui-test" antfile="${test.library.xml}" dir="${target.eclipse}" inheritall="false">
<property name="data-dir" value="${test.workspace}" />
<property name="plugin-name" value="org.eclipse.contribution.weaving.jdt.tests" />
<property name="classname" value="org.eclipse.contribution.weaving.jdt.tests.EmptyTest" />
<property name="eclipse-home" value="${target.eclipse}" />
<property name="vmargs" value="${vmargs} ${osgi.vmargs}" />
<property name="org.eclipse.test" value="${org.eclipse.test}" />
<property name="arch" value="${build.arch}"/>
<property name="os" value="${build.os}"/>
<property name="ws" value="${build.ws}"/>
</ant>
</target>
<target name="copy-test-results" depends="init">
<!--
Copy the xml output files created by the plugin test harness to a
temp location from where it can be merged into build log
-->
<delete dir="${test.results}" failonerror="false" />
<mkdir dir="${test.results}" />
<copy overwrite="true"
file="${target.eclipse}/results/org.eclipse.ajdt.ui.tests.AllUITests.xml" todir="${test.results}" />
<copy overwrite="true"
file="${target.eclipse}/results/org.eclipse.ajdt.core.tests.AllCoreTests.xml" todir="${test.results}" />
<copy overwrite="true"
file="${target.eclipse}/results/org.eclipse.contribution.weaving.jdt.tests.AllWeavingTests.xml"
todir="${test.results}" />
<copy overwrite="true"
file="${target.eclipse}/results/org.eclipse.ajdt.ui.tests.AllUITests.txt" todir="${test.results}" />
<copy overwrite="true"
file="${target.eclipse}/results/org.eclipse.ajdt.core.tests.AllCoreTests.txt" todir="${test.results}" />
<copy overwrite="true"
file="${target.eclipse}/results/org.eclipse.contribution.weaving.jdt.tests.AllWeavingTests.txt"
todir="${test.results}" />
</target>
<target name="check-results">
<!-- Will set property only if failures detected -->
<checkutresults property="ajdt.junit.failed"
file="${test.results}/org.eclipse.ajdt.ui.tests.AllUITests.xml" />
<checkutresults property="ajdt.junit.failed"
file="${test.results}/org.eclipse.ajdt.core.tests.AllCoreTests.xml" />
<checkutresults property="ajdt.junit.failed"
file="${test.results}/org.eclipse.contribution.weaving.jdt.tests.AllWeavingTests.xml" />
</target>
<target name="check-tests-failed" if="ajdt.junit.failed">
<fail>JUnit plugin tests failed: ${ajdt.junit.failed}</fail>
</target>
<!-- <target name="build" depends="provision-build-eclipse,provision-target-eclipse,pdebuild,optimizeUpdateSite,generateP2metadata,zip-archive" /> -->
<!-- Disable optimizeUpdateSite -->
<target name="build" depends="init,provision-build-eclipse,provision-target-eclipse,pdebuild,generateP2metadata,signUpdateSite,zip-archive" />
<target name="tests"
depends="init,provision-test-eclipse,run-test-eclipse,copy-test-results,check-results,check-tests-failed" />
<target name="run" depends="init,clean,build,tests" />
</project>