blob: 3d9db0ef29ca949ca36889ab9f831d9be079c553 [file] [log] [blame]
<project name="org.eclipse.swtbot.releng" default="all" basedir=".">
<!-- load up the properties for cruise agents based on their hostnames, if available -->
<exec executable="hostname" outputproperty="hostname" />
<property file="host-conf/build.${hostname}.properties" />
<!-- in case users provide an eclipse.version, load it before anything else! -->
<property file="build-conf/e${eclipse.version}.properties" />
<!-- Load up the basic properties -->
<property file="build.developer.properties" />
<!-- Load up the eclipse version specific properties -->
<available file="build-conf/e${eclipse.version}.properties" property="eclipse-conf-available" />
<fail unless="eclipse-conf-available" message="Could not find file 'build-conf/e${eclipse.version}.properties'" />
<property file="build-conf/e${eclipse.version}.properties" />
<!-- Load up the platform specific properties -->
<available file="build-conf/${os}.${ws}.${arch}.properties" property="build-conf-available" />
<fail unless="build-conf-available" message="Could not find file 'build-conf/${os}.${ws}.${arch}.properties'" />
<property file="build-conf/${os}.${ws}.${arch}.properties" />
<!-- Load up the gef specific properties -->
<available file="build-conf/gef.properties" property="gef-conf-available" />
<fail unless="gef-conf-available" message="Could not find file 'build-conf/gef.properties'" />
<property file="build-conf/gef.properties" />
<property file="build.default.properties" />
<import file="check-prerequisites.xml" />
<property name="plugin.version.primary" value="2.0.3" />
<!-- automagically generate build numbers from git -->
<property name="git.version" value="1" />
<property name="plugin.suffix" value="${git.version}-dev-${eclipse.qualifier}" />
<property name="buildId" value="${plugin.suffix}" />
<property name="eclipse-target" value="${basedir}/../eclipse" />
<property name="all.buildId" value="${plugin.version.primary}.${plugin.suffix}" />
<property name="plugin.prefix" value="org.eclipse.swtbot" />
<property name="feature.id" value="${plugin.prefix}" />
<property name="feature.id.test" value="${feature.id}.test" />
<property name="extra.jvm.options" value="-server" />
<property name="test-sandbox" value="${basedir}/test-sandbox" />
<property name="eclipse-platform-properties" value="-Dosgi.ws=${ws} -Dosgi.os=${os} -Dosgi.arch=${arch} -Dws=${ws} -Dos=${os} -Darch=${arch}" />
<property name="eclipse.3.4.location" value="${basedir}/eclipse" />
<target name="clean" description="cleans the output folders">
<echo>Cleaning all in ${buildDirectory}</echo>
<delete failonerror="false" includeemptydirs="true">
<fileset dir="${buildDirectory}">
<exclude name="plugins/**/**.*" />
<exclude name="features/**/**.*" />
</fileset>
</delete>
<delete dir="artifacts" />
<delete dir="test-sandbox/results" />
<delete dir="test-sandbox/test-eclipse" />
<delete dir="test-sandbox/screenshots" />
</target>
<target name="copy-sources" depends="copy-features, copy-plugins, create-version-files" description="copies sources" />
<target name="create-version-files" description="create a java file containing the version number of swtbot and other information">
<copy filtering="true" overwrite="true" file="../org.eclipse.swtbot.swt.finder/src/org/eclipse/swtbot/swt/finder/SWTBotInfo.java" tofile="target/plugins/org.eclipse.swtbot.swt.finder/src/org/eclipse/swtbot/swt/finder/SWTBotInfo.java">
<filterset>
<filter token="git.version" value="${all.buildId}"/>
</filterset>
</copy>
<copy filtering="true" overwrite="true" file="../org.eclipse.swtbot.eclipse.finder/src/org/eclipse/swtbot/eclipse/finder/SWTBotInfo.java" tofile="target/plugins/org.eclipse.swtbot.eclipse.finder/src/org/eclipse/swtbot/eclipse/finder/SWTBotInfo.java">
<filterset>
<filter token="git.version" value="${all.buildId}"/>
</filterset>
</copy>
</target>
<target name="copy-eclipse" description="copies an eclispse instance to a temporary location">
<echo>Sync eclipse from ${base} to ${eclipse-target}</echo>
<sync todir="${eclipseLocation}" includeemptydirs="true">
<fileset dir="${base}" />
<!-- any other locations/plugins that you want to copy from, in addition to the eclipse "base install"
<fileset dir="${mylyn.base}" />
-->
</sync>
</target>
<target name="copy-features" description="copies the feature sources into the features folder">
<delete dir="${buildDirectory}/features" includes="**/feature.xml"/>
<sync todir="${buildDirectory}/features" includeemptydirs="true">
<fileset dir="../">
<!-- list all your features here -->
<include name="${feature.id}/**" />
<include name="${feature.id.test}/**" />
<include name="org.eclipse.swtbot.forms/**" />
<include name="org.eclipse.swtbot.eclipse/**" />
<include name="org.eclipse.swtbot.eclipse.test.junit3/**" />
<include name="org.eclipse.swtbot.eclipse.test.junit4/**" />
<include name="org.eclipse.swtbot.eclipse.gef/**" />
<include name="org.eclipse.swtbot.ide/**" />
</fileset>
</sync>
</target>
<target name="copy-plugins" description="copies plugin sources into the plugins folder">
<delete dir="${buildDirectory}/plugins" includes="**/MANIFEST.MF" />
<delete dir="${buildDirectory}/plugins" includes="**/build.properties" />
<delete dir="${buildDirectory}/plugins" includes="**/.classpath" />
<delete dir="${buildDirectory}/plugins" includes="**/.project" />
<sync todir="${buildDirectory}/plugins" includeemptydirs="true">
<fileset dir="../">
<!-- include plugins here -->
<include name="${plugin.prefix}*/**" />
<include name="org.eclipse.swt.examples/**" />
<include name="org.eclipse.ui.forms.examples/**" />
<include name="org.apache.*/**" />
<!-- remember to exclude features in case you are using wildcards -->
<exclude name="org.eclipse.swtbot.releng/**" />
<exclude name="${feature.id}/**" />
<exclude name="${feature.id.test}/**" />
<exclude name="org.eclipse.swtbot.forms/**" />
<exclude name="org.eclipse.swtbot.eclipse/**" />
<exclude name="org.eclipse.swtbot.eclipse.gef/**" />
<exclude name="org.eclipse.swtbot.eclipse.test.junit3/**" />
<exclude name="org.eclipse.swtbot.eclipse.test.junit4/**" />
<exclude name="org.eclipse.swtbot.ide/**" />
<!-- the update site -->
<exclude name="org.eclipse.swtbot.updatesite/**" />
<!-- also exclude the generated class files -->
<exclude name="*/bin/**" />
</fileset>
</sync>
</target>
<target name="make-substitutions-4.5" if="isJunit4.5">
<!-- make substitutions in the eclipse-ui plugin. See https://bugs.eclipse.org/bugs/show_bug.cgi?id=274083#c5 -->
<copy file="../org.eclipse.swtbot.eclipse.ui/_build.properties.eclipse_3_5" tofile="../org.eclipse.swtbot.eclipse.ui/build.properties" overwrite="true" />
<copy file="../org.eclipse.swtbot.eclipse.ui/META-INF/_MANIFEST.MF_eclipse_3_5" tofile="../org.eclipse.swtbot.eclipse.ui/META-INF/MANIFEST.MF" overwrite="true" />
<copy file="../org.eclipse.swtbot.eclipse.ui/_classpath.eclipse_3_5" tofile="../org.eclipse.swtbot.eclipse.ui/.classpath" overwrite="true" />
<!-- make substitutions in the junit plugin -->
<copy file="../org.eclipse.swtbot.junit4_x/META-INF/MANIFEST.MF_junit4_5" tofile="../org.eclipse.swtbot.junit4_x/META-INF/MANIFEST.MF" overwrite="true" />
<copy file="../org.eclipse.swtbot.junit4_x/_build.properties.junit4_5" tofile="../org.eclipse.swtbot.junit4_x/build.properties" overwrite="true" />
<copy file="../org.eclipse.swtbot.junit4_x/_classpath.junit4_5" tofile="../org.eclipse.swtbot.junit4_x/.classpath" overwrite="true" />
</target>
<target name="make-substitutions-4.8" if="isJunit4.8">
<!-- make substitutions in the eclipse-ui plugin. See https://bugs.eclipse.org/bugs/show_bug.cgi?id=274083#c5 -->
<copy file="../org.eclipse.swtbot.eclipse.ui/META-INF/_MANIFEST.MF_eclipse_3_6" tofile="../org.eclipse.swtbot.eclipse.ui/META-INF/MANIFEST.MF" overwrite="true" />
<!-- same as eclipse 3.5 -->
<copy file="../org.eclipse.swtbot.eclipse.ui/_build.properties.eclipse_3_5" tofile="../org.eclipse.swtbot.eclipse.ui/build.properties" overwrite="true" />
<copy file="../org.eclipse.swtbot.eclipse.ui/_classpath.eclipse_3_5" tofile="../org.eclipse.swtbot.eclipse.ui/.classpath" overwrite="true" />
<!-- make substitutions in the junit plugin -->
<copy file="../org.eclipse.swtbot.junit4_x/META-INF/MANIFEST.MF_junit4_5" tofile="../org.eclipse.swtbot.junit4_x/META-INF/MANIFEST.MF" overwrite="true" />
<copy file="../org.eclipse.swtbot.junit4_x/_build.properties.junit4_5" tofile="../org.eclipse.swtbot.junit4_x/build.properties" overwrite="true" />
<copy file="../org.eclipse.swtbot.junit4_x/_classpath.junit4_5" tofile="../org.eclipse.swtbot.junit4_x/.classpath" overwrite="true" />
</target>
<target name="make-substitutions-4.3" if="isJunit4.3">
<!-- make substitutions in the eclipse-ui plugin. See https://bugs.eclipse.org/bugs/show_bug.cgi?id=274083#c5 -->
<copy file="../org.eclipse.swtbot.eclipse.ui/_build.properties.eclipse_3_4" tofile="../org.eclipse.swtbot.eclipse.ui/build.properties" overwrite="true" />
<copy file="../org.eclipse.swtbot.eclipse.ui/META-INF/_MANIFEST.MF_eclipse_3_4" tofile="../org.eclipse.swtbot.eclipse.ui/META-INF/MANIFEST.MF" overwrite="true" />
<copy file="../org.eclipse.swtbot.eclipse.ui/_classpath.eclipse_3_4" tofile="../org.eclipse.swtbot.eclipse.ui/.classpath" overwrite="true" />
<!-- make substitutions in the junit plugin -->
<copy file="../org.eclipse.swtbot.junit4_x/META-INF/MANIFEST.MF_junit4_3" tofile="../org.eclipse.swtbot.junit4_x/META-INF/MANIFEST.MF" overwrite="true" />
<copy file="../org.eclipse.swtbot.junit4_x/_build.properties.junit4_3" tofile="../org.eclipse.swtbot.junit4_x/build.properties" overwrite="true" />
<copy file="../org.eclipse.swtbot.junit4_x/_classpath.junit4_3" tofile="../org.eclipse.swtbot.junit4_x/.classpath" overwrite="true" />
</target>
<target name="make-substitutions" depends="guess-junit-version, make-substitutions-4.5, make-substitutions-4.8, make-substitutions-4.3" />
<target name="extract-eclipse">
<condition property="setupTarget" value="setup-zip">
<contains string="${eclipse.sdk.archive}" substring=".zip" />
</condition>
<condition property="setupTarget" value="setup-tar.gz">
<contains string="${eclipse.sdk.archive}" substring=".tar.gz" />
</condition>
<antcall target="${setupTarget}" />
</target>
<!--setup for zip archives-->
<target name="setup-zip" description="Reinstall the test Eclipse installation if specified by user">
<unzip dest="${eclipse-target}" src="externals/${eclipse.sdk.archive}">
<mapper type="glob" from="eclipse/*" to="${eclipse-target}/*" />
</unzip>
</target>
<!--setup for tar.gz archives-->
<target name="setup-tar.gz" description="Reinstall the test Eclipse installation if specified by user">
<exec command="tar" failifexecutionfails="true" failonerror="true">
<arg line="-zxf externals/${eclipse.sdk.archive} -C ${eclipse-target}/.." />
</exec>
</target>
<target name="materialize-workspace" description="Materializes a workspace for eclipse" depends="download-dependencies">
<delete dir="${eclipse-target}" />
<mkdir dir="${eclipse-target}" />
<copy todir="${eclipse-target}/plugins">
<fileset dir="externals/plugins" />
</copy>
<antcall target="extract-eclipse" />
<unzip dest="${eclipse-target}" src="externals/${eclipse.gef.sdk.archive}">
<mapper type="glob" from="eclipse/*" to="${eclipse-target}/*" />
</unzip>
<antcall target="initialize-environment" />
<antcall target="make-substitutions" />
</target>
<target name="printjvm">
<exec command="java -version" />
<echoproperties prefix="java." />
</target>
<target name="init" depends="check-conditions, initialize-environment, printjvm, clean" description="initializes the build directory structure">
<mkdir dir="${buildDirectory}" />
<mkdir dir="artifacts" />
<mkdir dir="${buildDirectory}/plugins" />
<mkdir dir="${buildDirectory}/features" />
</target>
<target name="delete-3.4-classes" if="isJunit4.3">
<delete file="${buildDirectory}/plugins/org.eclipse.swtbot.swt.finder/src/org/eclipse/swtbot/swt/finder/widgets/BrowserAuthenticationListener.java" />
</target>
<target name="pde-build" depends="copy-all, delete-3.4-classes" description="runs the pde build">
<java classname="org.eclipse.equinox.launcher.Main" fork="true" failonerror="true" dir="${basedir}">
<arg value="-application" />
<arg value="org.eclipse.ant.core.antRunner" />
<arg value="-buildfile" />
<arg value="${eclipse-target}/plugins/org.eclipse.pde.build_${pdeBuildPluginVersion}/scripts/build.xml" />
<arg value="-Dtimestamp=${timestamp}" />
<arg value="-DbuildId=${all.buildId}" />
<arg value="-DforceContextQualifier=${plugin.suffix}" />
<arg value="-Dbaseos=${os}" />
<arg value="-Dbasews=${ws}" />
<arg value="-Dbasearch=${arch}" />
<arg value="-Dbuilder=${basedir}" />
<arg value="-Dbasedir=${basedir}" />
<arg value="-Dbuild_directory=${buildDirectory}" />
<classpath>
<fileset dir="${eclipse-target}/plugins">
<include name="org.eclipse.equinox.launcher_*.jar" />
</fileset>
</classpath>
</java>
<copy todir="artifacts" overwrite="true" verbose="true">
<!-- this is the generated artifact -->
<fileset dir="${buildDirectory}/${buildType}.${all.buildId}">
<!-- one zip file for each of the feature that you have built -->
<include name="*.zip" />
</fileset>
</copy>
<antcall target="verify-generated-artifacts" />
</target>
<target name="verify-generated-artifacts" description="check if the artifacts are compliant with the legal docs http://www.eclipse.org/legal/guidetolegaldoc.php and http://www.eclipse.org/legal/guidetolegaldoc2.php">
<delete dir="target/check-licenses" />
<unzip dest="target/check-licenses" src="artifacts/org.eclipse.swtbot.test-${all.buildId}.zip" />
<for param="feature-jar">
<dirset dir="target/check-licenses/eclipse/features" includes="*" />
<sequential>
<echo>Verifying feature @{feature-jar}</echo>
<available file="@{feature-jar}/feature.xml" property="feature.xml.available" />
<fail unless="feature.xml.available" message="feature.xml for feature @{feature-jar} is not available" />
<available file="@{feature-jar}/license.html" property="license.html.availble" />
<fail unless="license.html.availble" message="license.html for feature @{feature-jar} is not available" />
<available file="@{feature-jar}/epl-v10.html" property="epl-v10.html.available" />
<fail unless="epl-v10.html.available" message="epl-v10.html for feature @{feature-jar} is not available" />
</sequential>
</for>
<for param="plugin-jar">
<fileset dir="target/check-licenses/eclipse/plugins" includes="org.eclipse.*" />
<sequential>
<echo>Verifying plugin @{plugin-jar}</echo>
<available classpath="@{plugin-jar}" resource="about.html" ignoresystemclasses="false" property="about.html.available" />
<fail unless="about.html.available" message="about.html for plugin @{plugin-jar} is not available" />
<available classpath="@{plugin-jar}" resource="LICENSE.EPL" ignoresystemclasses="false" property="LICENSE.EPL.available" />
<fail unless="LICENSE.EPL.available" message="LICENSE.EPL for plugin @{plugin-jar} is not available" />
</sequential>
</for>
</target>
<target name="run-core-tests" description="runs the core tests for the connector">
<property name="test-target" value="all" />
<property name="test-classes" value="**/*Test.class" />
<java classname="org.eclipse.equinox.launcher.Main" fork="true" failonerror="true" dir="${test-sandbox}">
<arg value="-Dos=${os}" />
<arg value="-Dws=${ws}" />
<arg value="-Darch=${arch}" />
<arg value="-Dextra.jvm.options=${extra.jvm.options}" />
<!-- one each for each feature that is built -->
<arg value="-Dfeature.id=${feature.id}" />
<arg value="-Dfeature.id.test=${feature.id.test}" />
<arg value="-Dall.buildId=${all.buildId}" />
<arg value="-Dbuild.base=${basedir}/target" />
<arg value="-Dresults.dir=${basedir}/artifacts/tests" />
<!-- properties containing the plugin directory name including version number -->
<arg value="-Dorg.eclipse.swtbot.swt.finder.test=org.eclipse.swtbot.swt.finder.test_${all.buildId}" />
<arg value="-Dorg.eclipse.swtbot.eclipse.finder.test=org.eclipse.swtbot.eclipse.finder.test_${all.buildId}" />
<!-- <arg value="-Danother.plugin.test=another.plugin.test_1.0.0" /> -->
<arg value="-DbuildId=${eclipse.buildId}" />
<!-- pass in locations of any other plugins that may be needed for tests, see the "copy-eclipse" target above
<arg value="-Dmylyn.base=${mylyn.base}" />
-->
<arg value="-application" />
<arg value="org.eclipse.ant.core.antRunner" />
<arg value="-file" />
<arg value="${test-sandbox}/test.xml" />
<arg value="${test-target}" />
<arg value="-Dtest-classes=${test-classes}" />
<jvmarg value="-Xmx512M" />
<classpath>
<fileset dir="${eclipse-target}/plugins">
<include name="org.eclipse.equinox.launcher_*.jar" />
</fileset>
</classpath>
</java>
</target>
<target name="javadoc" description="generate javadocs">
<ant antfile="javadoc.xml" />
</target>
<target name="copy-all" depends="init, copy-sources" description="copies eclipse and minglyn sources" />
<target name="all" depends="init, copy-all, pde-build, run-core-tests, javadoc" description="the default target" />
<target name="create-update-site">
<delete dir="${basedir}/artifacts/update-site" />
<property name="update.site.base.url" value="" />
<property name="has.archives" value="false" />
<ant dir="../${plugin.prefix}.updatesite" inheritall="false">
<property name="eclipse.location" value="${eclipse.3.4.location}" />
<property name="buildId" value="${all.buildId}" />
<property name="update-site-location" value="${update-site-location}" />
<property name="has.archives" value="${has.archives}" />
<property name="update.site.base.url" value="${update.site.base.url}" />
</ant>
</target>
<macrodef name="copy-test-reports">
<attribute name="plugin.id" default="default" />
<sequential>
<echo>Copying @{plugin.id}</echo>
<copy todir="artifacts/to-upload/coverage/@{plugin.id}" failonerror="false">
<fileset dir="artifacts/tests/@{plugin.id}/coverage/html" />
</copy>
<copy todir="artifacts/to-upload/junit/@{plugin.id}" failonerror="false">
<fileset dir="artifacts/tests/@{plugin.id}/junit/html" />
</copy>
</sequential>
</macrodef>
<target name="create-upload-site">
<delete dir="artifacts/to-upload" />
<mkdir dir="artifacts/to-upload" />
<echo file="artifacts/to-upload/version.txt">${all.buildId}</echo>
<copy todir="artifacts/to-upload" includeemptydirs="false">
<fileset dir="artifacts">
<include name="org.eclipse.swtbot-${all.buildId}.zip" />
<include name="org.eclipse.swtbot.eclipse-${all.buildId}.zip" />
<include name="org.eclipse.swtbot.eclipse.test.junit3-${all.buildId}.zip" />
<include name="org.eclipse.swtbot.eclipse.test.junit4-${all.buildId}.zip" />
<include name="org.eclipse.swtbot.eclipse.gef-${all.buildId}.zip" />
<include name="org.eclipse.swtbot.ide-${all.buildId}.zip" />
</fileset>
</copy>
<copy todir="artifacts/to-upload/update-site">
<fileset dir="artifacts/update-site" />
</copy>
<copy todir="artifacts/to-upload/apidocs">
<fileset dir="artifacts/apidocs" />
</copy>
<zip destfile="artifacts/to-upload/swtbot-apidocs-${all.buildId}.zip">
<fileset dir="artifacts/to-upload/apidocs" />
</zip>
<zip destfile="artifacts/to-upload/swtbot-update-site-${all.buildId}.zip">
<fileset dir="artifacts/to-upload/update-site" />
</zip>
<copy-test-reports plugin.id="org.eclipse.swtbot.swt.finder.test" />
<copy-test-reports plugin.id="org.eclipse.swtbot.generator.test" />
<copy-test-reports plugin.id="org.eclipse.swtbot.eclipse.finder.test" />
</target>
<target name="upload-to-server" depends="create-upload-site" if="remote.path">
<property name="rsync.opts" value="" />
<property name="remote.path" value="" />
<exec executable="rsync" failifexecutionfails="true" failonerror="true">
<arg line="--partial --verbose --archive --compress ${rsync.opts} artifacts/to-upload/ ${remote.path}" />
</exec>
</target>
<target name="cruise" depends="materialize-workspace, all, create-update-site, create-upload-site" description="used by cruise, creates update site in addition to the regular build" />
<target name="cruise-upload" depends="cruise, upload-to-server" description="run a cruise build and upload to server" />
</project>