| <project default="run" name="org.eclipse.osee.server.releng/build.xml - Run a OSEE build using the Athena CBI"> |
| |
| <target name="init"> |
| <property environment="env" /> |
| <tstamp> |
| <format property="buildTimestamp" pattern="yyyyMMddHHmm" /> |
| </tstamp> |
| |
| <condition property="forceContextQualifier" value="v${buildTimestamp}"> |
| <not> |
| <isset property="forceContextQualifier" /> |
| </not> |
| </condition> |
| |
| <!-- set properties from hudson parameters, useful with ant build --> |
| <condition property="isInHudson" value="true"> |
| <or> |
| <contains string="${user.dir}" substring="hudson" /> |
| <contains string="${user.name}" substring="hudson" /> |
| <contains string="${user.home}" substring="hudson" /> |
| </or> |
| </condition> |
| |
| <!-- Hudson default path if WORKSPACE not set --> |
| <dirname property="user.dir.parent" file="${user.dir}" /> |
| <condition property="WORKSPACE" value="${user.dir.parent}"> |
| <and> |
| <istrue value="${isInHudson}" /> |
| <not> |
| <isset property="WORKSPACE" /> |
| </not> |
| </and> |
| </condition> |
| |
| <!-- Local default path if WORKSPACE not set --> |
| <condition property="WORKSPACE" value="${java.io.tmpdir}"> |
| <and> |
| <isfalse value="${isInHudson}" /> |
| <not> |
| <isset property="WORKSPACE" /> |
| </not> |
| </and> |
| </condition> |
| |
| <condition property="version" value="${VERSION}"> |
| <isset property="VERSION" /> |
| </condition> |
| <condition property="buildType" value="${BUILDTYPE}"> |
| <isset property="BUILDTYPE" /> |
| </condition> |
| <condition property="projectid" value="${PROJECTID}"> |
| <isset property="PROJECTID" /> |
| </condition> |
| <condition property="fetchTag" value="${FETCHTAG}"> |
| <isset property="FETCHTAG" /> |
| </condition> |
| <condition property="buildAlias" value="${BUILDALIAS}"> |
| <isset property="BUILDALIAS" /> |
| </condition> |
| |
| <property file="build.properties" /> |
| |
| <condition property="buildType" value="N"> |
| <not> |
| <isset property="buildType" /> |
| </not> |
| </condition> |
| |
| <!-- calculate workspaceDir as parent of this folder, the project's .releng folder (relengBuilderDir) --> |
| <property name="relengBuilderDir" value="${basedir}" /> |
| <dirname file="${relengBuilderDir}" property="workspaceDir" /> |
| |
| <!-- can build in /tmp, eg., in /tmp/build, or in workspace, eg., ${WORKSPACE}/build --> |
| <property name="writableBuildRoot" value="${WORKSPACE}/build" /> |
| <property name="buildDir" value="${writableBuildRoot}/athena" /> |
| <condition property="relengCommonBuilderDir" value="${workspaceDir}/org.eclipse.dash.common.releng"> |
| <not> |
| <isset property="relengCommonBuilderDir" /> |
| </not> |
| </condition> |
| |
| <condition property="relengBaseBuilderDir" value="${workspaceDir}/org.eclipse.releng.basebuilder"> |
| <not> |
| <isset property="relengBaseBuilderDir" /> |
| </not> |
| </condition> |
| |
| <condition property="isGitSourceDirSet"> |
| <isset property="gitSourceDir" /> |
| </condition> |
| |
| <taskdef resource="net/sf/antcontrib/antlib.xml"> |
| <classpath> |
| <pathelement path="${classpath}" /> |
| <pathelement location="${relengCommonBuilderDir}/lib/ant-contrib.jar" /> |
| <pathelement location="${relengBuilderDir}/lib/ant-contrib.jar" /> |
| <pathelement location="${thirdPartyJarsDir}/ant-contrib.jar" /> |
| <pathelement location="/usr/share/java/ant-contrib.jar" /> |
| </classpath> |
| </taskdef> |
| |
| <echo message="JAVA_HOME = ${JAVA_HOME}" /> |
| <echo message="JAVE 6.0 HOME: ${JAVA60_HOME}" /> |
| <echo message="WORKSPACE = ${WORKSPACE}" /> |
| <echo message="isInHudson = ${isInHudson}" /> |
| <echo message="relengCommonBuilderDir = ${relengCommonBuilderDir}" /> |
| <echo message="relengBaseBuilderDir = ${relengBaseBuilderDir}" /> |
| <echo message="writableBuildRoot = ${writableBuildRoot}" /> |
| <echo message="buildDir = ${buildDir}" /> |
| <echo message="fetchTag = ${fetchTag}" /> |
| <echo message="forceContextQualifier = ${forceContextQualifier}" /> |
| <echo message="GitSourceDir = ${gitSourceDir}" /> |
| </target> |
| |
| |
| <target name="run" depends="init,createLocalSourceWorkspaceFromMaps,build,createSnapshot,cleanUp"> |
| </target> |
| |
| <target name="build"> |
| <antcall target="setHttpProxy" /> |
| <ant antfile="${relengCommonBuilderDir}/buildAll.xml" target="runEclipse" dir="${relengCommonBuilderDir}" inheritrefs="true" inheritall="true" /> |
| </target> |
| |
| <target name="setHttpProxy" if="http.proxyHost"> |
| <echo message="proxy: - ${http.proxyHost}:${http.proxyPort}" /> |
| <setproxy nonproxyhosts="${http.nonProxyHosts}" proxyhost="${http.proxyHost}" proxyport="${http.proxyPort}" /> |
| </target> |
| |
| <target name="cleanUp"> |
| <delete dir="${buildDir}/eclipse" failonerror="false" /> |
| <delete dir="${buildDir}/testing" failonerror="false" /> |
| <delete dir="${buildDir}/compilelogs" failonerror="false" /> |
| <delete dir="${buildDir}/testresults/consolelogs" failonerror="false" /> |
| <delete dir="${buildDir}/testresults/html" failonerror="false" /> |
| <delete> |
| <fileset dir="${writableBuildRoot}"> |
| <include name="**/*AllFeatures*.zip" /> |
| <include name="**/*Master*.zip" /> |
| <include name="**/*SDK*.zip" /> |
| </fileset> |
| </delete> |
| </target> |
| |
| <target name="createSnapshot"> |
| <echo>Custom post build step CreateSnapshot</echo> |
| <property environment="env" /> |
| |
| <property name="BUILDTYPE" value="I" /> |
| <property name="buildFolder" value="${WORKSPACE}/build" /> |
| <property name="snapshotFolder" value="${buildFolder}/../snapshot/" /> |
| |
| <echo>Build folder: ${buildFolder} </echo> |
| <echo>Snapshot folder: ${snapshotFolder}</echo> |
| <echo>Buildtype: ${BUILDTYPE}</echo> |
| <echo>Job: ${env.JOB_NAME}</echo> |
| |
| <delete quiet="true" dir="${snapshotFolder}" /> |
| |
| <copy flatten="true" toDir="${snapshotFolder}" failonerror="true" includeemptydirs="false"> |
| <fileset dir="${buildFolder}" includes="athena/*-Update-*.zip" /> |
| <fileset dir="${buildFolder}" includes="athena/*-osgi-runtime-*.zip" /> |
| <fileset dir="${buildFolder}" includes="athena/*-Automated-Tests-*.zip" /> |
| <fileset dir="${buildFolder}" includes="athena/*-Javadoc-*.zip" /> |
| </copy> |
| |
| <available file="${snapshotFolder}" property="containsFile" /> |
| <antcall target="doMoveZip" inheritall="true" /> |
| <!--<antcall target="createUnitTestSnapshot" inheritall="true" />--> |
| </target> |
| |
| <target name="doMoveZip" if="containsFile"> |
| <echo>Renaming file to ${zipPrefix}${incubation}-${BUILDTYPE}-Snapshot.zip</echo> |
| <move includeemptydirs="false" tofile="${snapshotFolder}/${zipPrefix}-update${incubation}-${BUILDTYPE}-Snapshot.zip" filtering="true"> |
| <fileset dir="${snapshotFolder}" includes="*-Update-*.zip" /> |
| </move> |
| <move includeemptydirs="false" tofile="${snapshotFolder}/${zipPrefix}-osgi-runtime${incubation}-${BUILDTYPE}-Snapshot.zip" filtering="true"> |
| <fileset dir="${snapshotFolder}" includes="*-osgi-runtime-*.zip" /> |
| </move> |
| <move includeemptydirs="false" tofile="${snapshotFolder}/${zipPrefix}-javadoc${incubation}-${BUILDTYPE}-Snapshot.zip" filtering="true"> |
| <fileset dir="${snapshotFolder}" includes="*-Javadoc-*.zip" /> |
| </move> |
| </target> |
| |
| <target name="createUnitTestSnapshot"> |
| <property name="snapshotTestZipArchive" value="${zipPrefix}-update-tests${incubation}-${BUILDTYPE}-Snapshot.zip" /> |
| |
| <property name="fullTestSuite" value="${snapshotFolder}/full_test_suite-Snapshot.zip" /> |
| <property name="tempTestSnapFolder" value="${snapshotFolder}/test_snap_tmp" /> |
| |
| <move includeemptydirs="false" tofile="${fullTestSuite}" filtering="true"> |
| <fileset dir="${snapshotFolder}"> |
| <filename name="*-Automated-Tests-*.zip" /> |
| </fileset> |
| </move> |
| |
| <mkdir dir="${tempTestSnapFolder}" /> |
| <unzip src="${fullTestSuite}" dest="${tempTestSnapFolder}" /> |
| |
| <pathconvert property="oseeClientUnitTestsZip" setonempty="false"> |
| <path> |
| <fileset dir="${tempTestSnapFolder}/testing"> |
| <include name="*-junit-tests-*.zip" /> |
| </fileset> |
| </path> |
| </pathconvert> |
| <move file="${oseeClientUnitTestsZip}" tofile="${snapshotFolder}/${snapshotTestZipArchive}" /> |
| |
| <delete failonerror="false" file="${fullTestSuite}" /> |
| <delete failonerror="false" dir="${tempTestSnapFolder}" /> |
| </target> |
| |
| <target name="createLocalSourceWorkspaceFromMaps" depends="init" if="isGitSourceDirSet"> |
| <pathconvert property="mapFiles" setonempty="false" pathsep=";"> |
| <path> |
| <fileset dir="${relengBuilderDir}/maps"> |
| <include name="*.map" /> |
| </fileset> |
| </path> |
| </pathconvert> |
| |
| <property name="localSourceCheckoutDir" value="${buildDir}/localBuildSources" /> |
| |
| <mkdir dir="${localSourceCheckoutDir}/features" /> |
| <mkdir dir="${localSourceCheckoutDir}/plugins" /> |
| |
| <for param="aMapFile" delimiter=";" list="${mapFiles}"> |
| <sequential> |
| <processMapFile file="@{aMapFile}" sourceDir="${gitSourceDir}" targetDir="${localSourceCheckoutDir}" /> |
| </sequential> |
| </for> |
| </target> |
| |
| <macrodef name="processMapFile"> |
| <attribute name="file" /> |
| <attribute name="sourceDir" /> |
| <attribute name="targetDir" /> |
| <sequential> |
| <var name="data" unset="true" /> |
| <loadfile property="data" srcfile="@{file}"> |
| <filterchain> |
| <linecontains> |
| <contains value="SVN" /> |
| </linecontains> |
| </filterchain> |
| </loadfile> |
| |
| <for param="line.data" delimiter="${line.separator}" list="${data}" trim="true"> |
| <sequential> |
| <propertyregex property="resourceName" input="@{line.data}" defaultvalue="" regexp="[^,]+$" select="\0" casesensitive="false" override="true" /> |
| <symlink link="@{targetDir}/${resourceName}" resource="@{sourceDir}/${resourceName}" overwrite="true" /> |
| </sequential> |
| </for> |
| </sequential> |
| </macrodef> |
| </project> |