| <?xml version="1.0" encoding="UTF-8"?> |
| <!-- ====================================================================== |
| Sep 6, 2011 4:04:51 PM |
| |
| Dart Tools Tests Build |
| Build the Dart Tools tests and then run them over the Dart code |
| |
| Mark R Russell (mrrussell@google.com) |
| ====================================================================== --> |
| <project name="Dart Tools Tests Build" default="test"> |
| <description> |
| Build the Dart Tools tests and the exercise then over the Dart code |
| </description> |
| |
| <import file="../com.google.dart.tools.deploy.feature_releng/build-common.xml" /> |
| <!-- ================================= |
| target: test |
| Master target to controll the running of the tests |
| ================================= --> |
| <target name="test" depends="doTests,check_results" description="Exercise the Dart Tools tests"> |
| </target> |
| <!-- |
| setup the classpaths and create properties for the run of tests |
| --> |
| <target name="setupTests"> |
| <path id="build.pde.test.port.locator.class.path"> |
| <pathelement |
| location="${build.source}/build/pde.test.utils_3.3.jar" /> |
| <fileset dir="${build.target.abs}/eclipse/plugins"> |
| <include name="org.junit_3.*/**/junit.jar" /> |
| </fileset> |
| </path> |
| <path id="build.pde.test.listener.class.path"> |
| <path refid="build.pde.test.port.locator.class.path" /> |
| <fileset dir="${build.target.abs}/eclipse/plugins"> |
| <include name="org.apache.ant_*/**/ant.jar" /> |
| <include name="org.apache.ant_*/**/ant-junit.jar" /> |
| <include name="org.eclipse.jdt.junit_*.jar" /> |
| <include name="org.eclipse.jdt.junit.core_*.jar" /> |
| <include name="org.eclipse.debug.core_*.jar" /> |
| <include name="org.eclipse.osgi_*.jar" /> |
| <include name="org.eclipse.core.resources_*.jar" /> |
| <include name="org.eclipse.swt_*.jar" /> |
| <include name="org.eclipse.equinox.preferences_*.jar" /> |
| <include name="org.junit_3.*/**/junit.jar" /> |
| <include name="org.eclipse.core.runtime_*.jar" /> |
| <include name="org.eclipse.equinox.common_*.jar" /> |
| <include name="org.eclipse.ui.workbench_*.jar" /> |
| <include name="org.eclipse.jface_*.jar" /> |
| <include name="org.eclipse.swt*.jar" /> |
| <include name="org.eclipse.swt.*.jar" /> |
| </fileset> |
| </path> |
| |
| <property name="build.test.suite" value="com.google.dart.tools.tests.buildbot_test" /> |
| <property name="build.test.classname.list" value="com.google.dart.tools.tests.buildbot.TestAll" /> |
| </target> |
| |
| <!-- |
| get the port used to communicate between Eclipse and the test listener |
| --> |
| <target name="getPort"> |
| <java |
| dir="${build.tmp}" |
| classname="pde.test.utils.PDETestPortLocator" |
| failonerror="true" |
| fork="yes" |
| classpathref="build.pde.test.port.locator.class.path" /> |
| <waitfor |
| maxwait="10" |
| maxwaitunit="second" |
| checkevery="100" |
| checkeveryunit="millisecond"> |
| <available file="${build.tmp}/pde_test_port.properties" /> |
| </waitfor> |
| <property file="${build.tmp}/pde_test_port.properties" prefix="build." /> |
| <echo message="Using port ${build.pde.test.port} for listening to PDE Test run" /> |
| </target> |
| |
| <!-- |
| run the tests in DartTools |
| --> |
| <target name="doTests" depends="deploy, setupTests, getPort"> |
| <property name="build.eclipse.test_application" |
| value="org.eclipse.pde.junit.runtime.coretestapplication" /> |
| <property name="build.test.platform.vm.args" value="" /> |
| <property name="build.test.platform.command.args" value="" /> |
| <property name="build.site.name" value="DashTests" /> |
| <property name="build.test.eclipse.workspace" value="${build.stage.abs}/workspace-test" /> |
| <property name="build.test.reports.dir" value="${build.out}/reports" /> |
| <echoproperties prefix="build." /> |
| <fileset dir="${build.target.abs}/eclipse/plugins" |
| includes="org.eclipse.equinox.launcher_*.jar" |
| id="fs.eclipse.target.launcher" /> |
| <pathconvert property="eclipse.target.launcher.jar" refid="fs.eclipse.target.launcher" /> |
| <echo message="starting Eclipse with ${eclipse.target.launcher.jar}" /> |
| <echo message="running application ${build.eclipse.test_application}"/> |
| <parallel> |
| <sequential> |
| <echo message="running test listener" /> |
| <java classname="pde.test.utils.PDETestResultsCollector" |
| fork="yes" |
| classpathref="build.pde.test.listener.class.path"> |
| <arg line="${build.test.suite} ${build.pde.test.port}" /> |
| </java> |
| </sequential> |
| <sequential> |
| <!-- Give the listener a few seconds to start up. --> |
| <sleep seconds="5" /> |
| <echo message="Launching eclipse with ${eclipse.target.launcher.jar}" /> |
| <java jar="${eclipse.target.launcher.jar}" fork="true" failonerror="false"> |
| <jvmarg line="${build.test.platform.vm.args}" /> |
| <jvmarg value="-Xmx1024m" /> |
| <jvmarg value="-XX:MaxPermSize=256m" /> |
| <jvmarg value="-ea" /> |
| <jvmarg value="-Dcom.google.dart.sdk=${build.target}/eclipse/dart-sdk" /> |
| <jvmarg value="-Dbuild.extra.artifacts=${build.extra.artifacts}" /> |
| <arg value="-consolelog" /> |
| <arg value="-debug" /> |
| <arg line="-application ${build.eclipse.test_application}" /> |
| <arg line="${build.test.platform.command.args}" /> |
| <arg value="-data" /> |
| <arg value="${build.test.eclipse.workspace}" /> |
| <arg value="-clean" /> |
| <arg line="-port ${build.pde.test.port}" /> |
| <arg line="-testpluginname ${build.test.suite}" /> |
| <!-- This is only needed for SWTBot testing, but it doesn't cause |
| any ill effects for non-SWTBot tests. --> |
| <arg line="-loaderpluginname org.eclipse.jdt.junit.runtime" /> |
| <arg line="-classNames ${build.test.classname.list}" /> |
| </java> |
| </sequential> |
| </parallel> |
| <mkdir dir="${build.test.reports.dir}" /> |
| <move todir="${build.test.reports.dir}"> |
| <fileset dir="."> |
| <include name="**/TEST-*.xml" /> |
| </fileset> |
| </move> |
| </target> |
| |
| <!-- The -check_results task parses the generated XML report and looks for |
| the substrings 'failures="0"' and 'errors="0"'. If eitherof these |
| strings cannot be found, then a <fail> task is run.--> |
| <target name="check_results"> |
| <copy |
| file="${build.test.reports.dir}/TEST-${build.test.suite}.xml" |
| tofile="${build.out}/test-results.xml"/> |
| |
| <loadfile |
| srcfile="${build.test.reports.dir}/TEST-${build.test.suite}.xml" |
| property="build.results.summary"> |
| <filterchain> |
| <headfilter lines="10" /> |
| </filterchain> |
| </loadfile> |
| |
| <!-- TODO: This condition assumes that there is a single report file with a |
| single <testsuite> tag. If we start generating more report files, or if each |
| may end up containing more than one <testsuite> tag, then this condition |
| needs to be modified. Rework this condition so that it is more |
| robust. --> |
| <condition property="tests.passed"> |
| <and> |
| <available file="${build.test.reports.dir}/TEST-${build.test.suite}.xml" /> |
| <contains |
| string="${build.results.summary}" |
| substring="errors="0"" /> |
| <contains |
| string="${build.results.summary}" |
| substring="failures="0"" /> |
| </and> |
| </condition> |
| <fail |
| message="FAILED - some tests failed - see the XML report in ${build.test.reports.dir} for more details" |
| unless="tests.passed" /> |
| <echo |
| message="SUCCESS - all tests passed - see the XML report in ${build.test.reports.dir} for more details" /> |
| </target> |
| |
| <!-- |
| deploy the tests to the out directory so they can be used by the test runner |
| --> |
| <target name="deploy" depends="build" description="Deploy the built Dart tests"> |
| <property file="${build.stage.scripts}/build.properties" prefix="build.pde."/> |
| <unzip dest="${build.target.dropins}" > |
| <fileset dir="${build.stage.abs}/${build.pde.buildLabel}" includes="*.zip" /> |
| </unzip> |
| </target> |
| |
| <!-- |
| call the PDE and build the test feature |
| --> |
| <target name="build" depends="setupBuild" description="Build the Dart Tools tests"> |
| <dirset dir="${build.runtime}/eclipse/plugins" id="pde.ds"> |
| <include name="*pde.build_*" /> |
| </dirset> |
| <pathconvert property="pde.build.dir" refid="pde.ds" setonempty="false"/> |
| <property name="pde.scripts.update" location="${pde.build.dir}/scripts" /> |
| <echo message="PDE is located in ${pde.build.dir}" /> |
| <mkdir dir="${build.stage.scripts}" /> |
| <copy todir="${build.stage.scripts}" file="build.properties" /> |
| <property file="${build.stage.scripts}/build.properties" prefix="pde." /> |
| <echoproperties prefix="pde." /> |
| <runAntBuildInEclipse script="${pde.scripts.update}/build.xml" eclipse="3.7" |
| builddir="${build.stage.scripts}" /> |
| |
| </target> |
| |
| <!-- - - - - - - - - - - - - - - - - - |
| target: setupRuntimeEclipse |
| - - - - - - - - - - - - - - - - - --> |
| <target name="setupRuntimeEclipse"> |
| <setupEclipse location="${build.runtime}" version="${build.runtime.eclipse.version}" |
| arch="${build.eclipse.arch}" os.ws="${build.eclipse.os.ws}" /> |
| <fileset dir="${build.runtime}/eclipse/plugins" id="launcherFs" > |
| <include name="*launcher_*.jar" /> |
| </fileset> |
| <pathconvert property="eclipse.runtime.launcher.jar" refid="launcherFs" /> |
| </target> |
| |
| <target name="setupBuild" depends="init, setupRuntimeEclipse"> |
| <setupEclipse location="${build.target}" version="${build.target.eclipse.version}" |
| arch="${build.eclipse.arch}" os.ws="${build.eclipse.os.ws}" /> |
| <setupDeltaPack location="${build.target}" eclipse="${build.target.eclipse.version}" /> |
| <copy todir="${build.stage.plugins}"> |
| <fileset dir="${build.source}/tools/plugins"> |
| <!-- for now, don't copy this over; several of its plugin dependencies are not satisfied --> |
| <exclude name="com.google.dart.tools.ui.swtbot_test/**"/> |
| |
| <include name="*_test/**" /> |
| </fileset> |
| </copy> |
| <copy todir="${build.stage.features}"> |
| <fileset dir="${build.source}/tools/features"> |
| <include name="com.google.dart.tools.tests.feature*/**" /> |
| </fileset> |
| </copy> |
| |
| <property name="com.google.dart.core.tests" |
| value="${build.stage.plugins}/com.google.dart.tools.core_test" /> |
| |
| <mkdir dir="${com.google.dart.core.tests}/src-compiler-javatests" /> |
| |
| <!-- com.google.dart.thirdparty_test --> |
| <property name="dart.thirdparty_test.dir" |
| value="${build.stage.plugins}/com.google.dart.thirdparty_test" /> |
| <copy todir="${dart.thirdparty_test.dir}/lib"> |
| <fileset dir="${build.source.root}/third_party"> |
| <include name="fest/**" /> |
| <include name="hamcrest/**" /> |
| <include name="mockito/**" /> |
| </fileset> |
| </copy> |
| |
| <!-- deploy the plugins and features to the dropins directory --> |
| <unzip dest="${build.target.dropins}" src="${build.out}/dart-editor-${build.eclipse.os.ws}.${build.eclipse.arch}.zip"> |
| <patternset> |
| <include name="**/plugins/com.google.dart*/**" /> |
| <include name="**/features/com.google.dart*/**" /> |
| </patternset> |
| </unzip> |
| <!-- deploy samples, libraries, and dart-sdk to the target eclipse --> |
| <unzip dest="${build.target}" src="${build.out}/dart-editor-${build.eclipse.os.ws}.${build.eclipse.arch}.zip"> |
| <patternset> |
| <include name="*/samples/**" /> |
| <include name="*/dart-sdk/**" /> |
| </patternset> |
| </unzip> |
| <move todir="${build.target}/eclipse"> |
| <fileset dir="${build.target}/dart"> |
| <include name="samples/**" /> |
| <include name="dart-sdk/**" /> |
| </fileset> |
| </move> |
| </target> |
| |
| <!-- - - - - - - - - - - - - - - - - - |
| target: init |
| initialize the build environment by cleaning up the directory and |
| creating the needed directories |
| - - - - - - - - - - - - - - - - - --> |
| <target name="init" depends="setOS, readProperties"> |
| <property environment="env" /> |
| <echoproperties prefix="env." /> |
| |
| <tstamp> |
| <format property="build.date" pattern="yyyyMMddHHmm" /> |
| </tstamp> |
| <echoProperty propertyName="ant.file" /> |
| <echoProperty propertyName="ant.home" /> |
| <echoProperty propertyName="ant.version" /> |
| <echoProperty propertyName="java.home" /> |
| <echoProperty propertyName="java.vendor" /> |
| <echoProperty propertyName="java.version" /> |
| <echoProperty propertyName="user.name" /> |
| <echoProperty propertyName="dataLocation" /> |
| <condition property="data.location" value="${dataLocation}"> |
| <isset property="dataLocation" /> |
| </condition> |
| <property name="data.location" location="../com.google.dart.tools.deploy.feature_releng/build-settings" /> |
| <echoProperty propertyName="data.location" /> |
| <!-- |
| validate that the data location is a directory |
| --> |
| <fail>Error: |
| data.location must be set to a valid directory containing the configuration properties file. |
| the current value is ${data.location}. |
| <condition> |
| <not> |
| <available file="${data.location}" type="dir" /> |
| </not> |
| </condition> |
| </fail> |
| <property name="user.property.file" location="${data.location}/${user.name}.properties" /> |
| <property name="default-user.property.file" location="${data.location}/default-user.properties" /> |
| <property name="eclipse.property.file" location="${data.location}/eclipse-platform.properties" /> |
| <echo message="reading ${eclipse.property.file}" /> |
| <property file="${eclipse.property.file}" /> |
| <echo message="reading ${user.property.file}" /> |
| <property file="${user.property.file}" /> |
| <!-- |
| validate that the default-user.property file exists |
| --> |
| <fail>Error: |
| ${default-user.property.file} must exist. |
| <condition> |
| <not> |
| <available file="${default-user.property.file}" type="file" /> |
| </not> |
| </condition> |
| </fail> |
| |
| <!-- |
| validate the the build.source is a directory |
| --> |
| <fail>Error: |
| build.source must be set to the root of the dart Eclipse tree it must be a directory |
| containing the source for the dart Eclipse product. |
| The current value is ${build.source}. |
| <condition> |
| <not> |
| <available file="${build.source}" type="dir" /> |
| </not> |
| </condition> |
| </fail> |
| <!-- |
| validate that ${build.source}/docs/README.txt exists |
| --> |
| <fail>Error: |
| It appears that build.source is not pointing to the root of the dart Eclipse tree. |
| The build is trying to verify that file ${build.source}/docs/README.txt is a file. |
| The current value is ${build.source}/dart/bundle/README.txt. |
| <condition> |
| <not> |
| <available file="${build.source}/docs/README.txt" type="file" /> |
| </not> |
| </condition> |
| </fail> |
| |
| <condition property="build.revision" value="${env.BUILDBOT_GOT_REVISION}"> |
| <isset property="env.BUILDBOT_GOT_REVISION" /> |
| </condition> |
| <property name="build.revision" value="unknown" /> |
| <dirname file="${build.source}" property="build.source.root"/> |
| |
| <property file="${default-user.property.file}" /> |
| <property name="build.stage.scripts" location="${build.stage}/scripts" /> |
| <echoproperties prefix="java." /> |
| <property name="build.runtime.abs" location="${build.runtime}" /> |
| <property name="build.target.abs" location="${build.target}" /> |
| <property name="build.stage.abs" location="${build.stage}" /> |
| <echoproperties prefix="build." /> |
| <echoproperties prefix="build." destfile="${build.out.property.file}"/> |
| <echoProperty propertyName="eclipse-sdk.3.8.url" /> |
| <echoProperty propertyName="eclipse-sdk.3.8.linux.gtk.x86.zip" /> |
| <echoProperty propertyName="eclipse-sdk.3.7.url" /> |
| <echoProperty propertyName="eclipse-sdk.3.7.linux.gtk.x86.zip" /> |
| <echoProperty propertyName="eclipse-sdk-win32.win32.ext" /> |
| <echoProperty propertyName="eclipse-sdk-linux.gtk.ext" /> |
| <echoProperty propertyName="eclipse-sdk-macosx.macosx.ext" /> |
| <!-- |
| cleanup the build.tmp directory |
| --> |
| <delete failonerror="false" includeemptydirs="true"> |
| <fileset dir="${build.tmp}" /> |
| </delete> |
| <!-- |
| create the build structure |
| --> |
| <mkdir dir="${build.downloads}" /> |
| |
| <mkdir dir="${build.runtime}" /> |
| <mkdir dir="${build.target}" /> |
| <mkdir dir="${build.stage.plugins}" /> |
| <mkdir dir="${build.stage.features}" /> |
| <mkdir dir="${build.out}" /> |
| |
| </target> |
| |
| </project> |