Jump to: navigation, search

Difference between revisions of "Common Build Infrastructure/Getting Started/Build In Hudson/Ant Job Distributed"

(New page: To have Athena based Ant Job builds work on any machine and not just a particular node, you need to use the an [[Common Build Infrastructure/Defining Binary Dependencies#Update_Sites|Updat...)
 
Line 4: Line 4:
  
 
'''build.properties'''  
 
'''build.properties'''  
<pre>
+
<pre>## BEGIN PROJECT BUILD PROPERTIES ##
## BEGIN PROJECT BUILD PROPERTIES ##
+
  
 
# default settings for all this project's builds, for this branch; see also o.e.d.common.releng/build.properties for more overrideable defaults
 
# default settings for all this project's builds, for this branch; see also o.e.d.common.releng/build.properties for more overrideable defaults
Line 41: Line 40:
 
## END PROJECT BUILD PROPERTIES ##
 
## END PROJECT BUILD PROPERTIES ##
  
</pre>
+
</pre>  
 +
The key is repositoryURL and IUsToInstall. Note that you CAN NOT mix in a featureIDsToInstall, as this will confuse athena and you will not get the necessary product information installed.
  
The key is repositoryURL and IUsToInstall.  Note that you CAN NOT mix in a featureIDsToInstall, as this will confuse athena and you will not get the necessary product information installed.
+
The build itself uses the new self provisioning mechanism for Athena:
  
The build itself uses the new self provisioning mechanism for Athena:
+
'''build.xml'''
 +
<pre>&lt;project default="run" name="org.eclipse.wst.xml.xpath2.releng/build.xml - Run a PsychoPath build using the Athena CBI"&gt;
 +
&lt;!-- load properties and set timestamp for the build --&gt;
  
build.xml
+
&lt;property environment="env" /&gt;
<pre>
+
&lt;property name="WORKSPACE" location="${env.WORKSPACE}" /&gt;
<project default="run" name="org.eclipse.wst.xml.xpath2.releng/build.xml - Run a PsychoPath build using the Athena CBI">
+
<!-- load properties and set timestamp for the build -->
+
  
<property environment="env" />
+
&lt;ant antfile="bootstrap.xml" target="init"&gt;
<property name="WORKSPACE" location="${env.WORKSPACE}" />
+
&lt;property name="basebuilderTag" value="r35x_v20090811" /&gt;
 +
&lt;property name="commonrelengTag" value="HEAD" /&gt;
 +
&lt;property name="ANTCONTRIB_VERSION" value="1.0b2" /&gt;
 +
&lt;property name="ANT4ECLIPSE_VERSION" value="1.0.0.M3" /&gt;
 +
&lt;property name="build.properties" value="build.properties" /&gt;
 +
&lt;/ant&gt;
  
<ant antfile="bootstrap.xml" target="init">
+
&lt;!-- FIXME if required: Set a valid path to JAVA_HOME, if Eclipse's ${java.home}/../bin/javac cannot be found --&gt;
<property name="basebuilderTag" value="r35x_v20090811" />
+
&lt;condition property="JAVA_HOME" value="${java.home}" else="${java.home}/.."&gt;
<property name="commonrelengTag" value="HEAD" />
+
&lt;available file="${java.home}/bin/javac" type="file" /&gt;
<property name="ANTCONTRIB_VERSION" value="1.0b2" />
+
&lt;/condition&gt;
<property name="ANT4ECLIPSE_VERSION" value="1.0.0.M3" />
+
<property name="build.properties" value="build.properties" />
+
</ant>
+
  
<!-- FIXME if required: Set a valid path to JAVA_HOME, if Eclipse's ${java.home}/../bin/javac cannot be found -->
+
&lt;!-- FIXME if required: if not using this type of qualifier, comment next 4 lines --&gt;
<condition property="JAVA_HOME" value="${java.home}" else="${java.home}/..">
+
&lt;tstamp&gt;
<available file="${java.home}/bin/javac" type="file" />
+
&lt;format property="buildTimestamp" pattern="yyyyMMddHHmm" /&gt;
</condition>
+
&lt;/tstamp&gt;
  
<!-- FIXME if required: if not using this type of qualifier, comment next 4 lines -->
+
&lt;!-- 1. To build from sources using information in the ./maps/*.map files, comment these next two properties
<tstamp>
+
<format property="buildTimestamp" pattern="yyyyMMddHHmm" />
+
</tstamp>
+
 
+
<!-- 1. To build from sources using information in the ./maps/*.map files, comment these next two properties
+
 
2. Or, to build from sources in the workspace, use these properties. You can also use absolute paths if needed.
 
2. Or, to build from sources in the workspace, use these properties. You can also use absolute paths if needed.
-->
+
--&gt;
<!-- <property name="localSourceCheckoutDir" value="${basedir}/.." />
+
&lt;!-- &lt;property name="localSourceCheckoutDir" value="${basedir}/.." /&gt;
<property name="relengBuilderDir" value="${basedir}" /> -->
+
&lt;property name="relengBuilderDir" value="${basedir}" /&gt; --&gt;
  
<property name="build.properties" value="build.properties" />
+
&lt;property name="build.properties" value="build.properties" /&gt;
<property file="${build.properties}" />
+
&lt;property file="${build.properties}" /&gt;
  
<property name="forceContextQualifier" value="v${buildTimestamp}" />
+
&lt;property name="forceContextQualifier" value="v${buildTimestamp}" /&gt;
<property name="fetchTag" value="HEAD" />
+
&lt;property name="fetchTag" value="HEAD" /&gt;
  
<!-- calculate workspaceDir as parent of this folder, the project's .releng folder (relengBuilderDir) -->
+
&lt;!-- calculate workspaceDir as parent of this folder, the project's .releng folder (relengBuilderDir) --&gt;
<import file="findbugs.xml" />
+
&lt;import file="findbugs.xml" /&gt;
<import file="pmd.xml" />
+
&lt;import file="pmd.xml" /&gt;
<dirname file="${relengBuilderDir}" property="workspaceDir" />
+
&lt;dirname file="${relengBuilderDir}" property="workspaceDir" /&gt;
  
<!--  
+
&lt;!--  
 
can build in /tmp, eg., in /tmp/build, or in workspace, eg.,
 
can build in /tmp, eg., in /tmp/build, or in workspace, eg.,
 
${WORKSPACE}/build
 
${WORKSPACE}/build
-->
+
--&gt;
<property name="writableBuildRoot" value="/tmp/build" />
+
&lt;property name="writableBuildRoot" value="/tmp/build" /&gt;
  
<!--  
+
&lt;!--  
 
can be simple path, eg.,  
 
can be simple path, eg.,  
 
${writableBuildRoot}/${buildType}${buildTimestamp} or longer, eg.,
 
${writableBuildRoot}/${buildType}${buildTimestamp} or longer, eg.,
 
${writableBuildRoot}/${topprojectName}/${projectName}/downloads/drops/${version}/${buildType}${buildTimestamp} or
 
${writableBuildRoot}/${topprojectName}/${projectName}/downloads/drops/${version}/${buildType}${buildTimestamp} or
 
${writableBuildRoot}/${topprojectName}/${projectName}/${subprojectName}/downloads/drops/${version}/${buildType}${buildTimestamp}
 
${writableBuildRoot}/${topprojectName}/${projectName}/${subprojectName}/downloads/drops/${version}/${buildType}${buildTimestamp}
-->
+
--&gt;
<property name="buildDir" value="${writableBuildRoot}/athena" />
+
&lt;property name="buildDir" value="${writableBuildRoot}/athena" /&gt;
  
<target name="init">
+
&lt;target name="init"&gt;
<delete dir="${buildDir}" failonerror="false" />
+
&lt;delete dir="${buildDir}" failonerror="false" /&gt;
</target>
+
&lt;/target&gt;
  
<target name="run" depends="init">
+
&lt;target name="run" depends="init"&gt;
<echo message="Workspace: ${WORKSPACE}" />
+
&lt;echo message="Workspace: ${WORKSPACE}" /&gt;
<echo message="Writable Build Root: ${writableBuildRoot}" />
+
&lt;echo message="Writable Build Root: ${writableBuildRoot}" /&gt;
<mkdir dir="${writableBuildRoot}" />
+
&lt;mkdir dir="${writableBuildRoot}" /&gt;
<!-- invoke a new Eclipse process and launch the build from the common.releng folder -->
+
&lt;!-- invoke a new Eclipse process and launch the build from the common.releng folder --&gt;
<!--<property name="relengCommonBuilderDir" value="${workspaceDir}/org.eclipse.dash.common.releng" />-->
+
&lt;!--&lt;property name="relengCommonBuilderDir" value="${workspaceDir}/org.eclipse.dash.common.releng" /&gt;--&gt;
  
<condition property="JAVA_HOME" value="${java.home}" else="${java.home}/..">
+
&lt;condition property="JAVA_HOME" value="${java.home}" else="${java.home}/.."&gt;
<available file="${java.home}/bin/javac" type="file" />
+
&lt;available file="${java.home}/bin/javac" type="file" /&gt;
</condition>
+
&lt;/condition&gt;
  
<!-- <ant antfile="${relengCommonBuilderDir}/buildAll.xml" target="runEclipse" dir="${relengCommonBuilderDir}" />-->
+
&lt;!-- &lt;ant antfile="${relengCommonBuilderDir}/buildAll.xml" target="runEclipse" dir="${relengCommonBuilderDir}" /&gt;--&gt;
<ant antfile="${relengCommonBuilderDir}/build.xml" />
+
&lt;ant antfile="${relengCommonBuilderDir}/build.xml" /&gt;
  
</target>
+
&lt;/target&gt;
  
</project>
+
&lt;/project&gt;
  
 
</pre>
 
</pre>
 +
 +
This build script will provision the necessary files into the workspace to run the build.  It does not depend on hard coded paths or other server specific items.  JDK Home directory is provided by the environment variable set by Hudson.

Revision as of 13:36, 14 May 2010

To have Athena based Ant Job builds work on any machine and not just a particular node, you need to use the an UpdateSite/Repository based build. This will have Athena get the correct target platform SDK and install it.

The following is an example from the Vex project which will run on either master or build2.

build.properties

## BEGIN PROJECT BUILD PROPERTIES ##

# default settings for all this project's builds, for this branch; see also o.e.d.common.releng/build.properties for more overrideable defaults

# To permit automatic downloads of non-EPL compatible code, set this to property to "I accept"
thirdPartyDownloadLicenseAcceptance="I accept"

# MUST BE SET #
projectid=webtools.vex
zipPrefix=wtp-xml-vex
incubation=-Incubation
version=0.5.0
buildType=N
mainFeatureToBuildID=org.eclipse.wst.xml.vex.feature
testFeatureToBuildID=org.eclipse.wst.xml.vex_tests.feature

# MUST BE SET #
JAVA50_HOME=${JAVA_HOME}
JAVA14_HOME=${JAVA_HOME}
dependencyURLs=http://download.eclipse.org/tools/orbit/downloads/drops/R20100114021427/orbit-R20100114021427.zip
repositoryURLs=http://download.eclipse.org/athena/repos/eclipse-Update-S-3.6M5-201001291300.zip,http://download.eclipse.org/releases/helios,http://download.eclipse.org/tools/orbit/downloads/drops/R20100114021427/updateSite
IUsToInstall=org.eclipse.sdk.feature.group+org.eclipse.sdk.ide+org.eclipse.wst.xml_ui.feature.feature.group

#what steps should we do? default: build.steps=buildUpdate,buildZips,buildTests,generateDigests,test,publish,cleanup
#build.steps=buildUpdate,buildZips,buildTests,generateDigests,test,publish,cleanup
build.steps=buildUpdate,buildZips,buildTests,generateDigests,testLocal,map2psf,publish

compilerArg=-enableJavadoc -encoding ISO-8859-1
flattenDependencies=true
parallelCompilation=true
generateFeatureVersionSuffix=true
individualSourceBundles=true

writableBuildRoot=${WORKSPACE}/build
## END PROJECT BUILD PROPERTIES ##

The key is repositoryURL and IUsToInstall. Note that you CAN NOT mix in a featureIDsToInstall, as this will confuse athena and you will not get the necessary product information installed.

The build itself uses the new self provisioning mechanism for Athena:

build.xml

<project default="run" name="org.eclipse.wst.xml.xpath2.releng/build.xml - Run a PsychoPath build using the Athena CBI">
	<!-- load properties and set timestamp for the build -->

	<property environment="env" />
	<property name="WORKSPACE" location="${env.WORKSPACE}" />

	<ant antfile="bootstrap.xml" target="init">
		<property name="basebuilderTag" value="r35x_v20090811" />
		<property name="commonrelengTag" value="HEAD" />
		<property name="ANTCONTRIB_VERSION" value="1.0b2" />
		<property name="ANT4ECLIPSE_VERSION" value="1.0.0.M3" />
		<property name="build.properties" value="build.properties" />
	</ant>

	<!-- FIXME if required: Set a valid path to JAVA_HOME, if Eclipse's ${java.home}/../bin/javac cannot be found -->
	<condition property="JAVA_HOME" value="${java.home}" else="${java.home}/..">
		<available file="${java.home}/bin/javac" type="file" />
	</condition>

	<!-- FIXME if required: if not using this type of qualifier, comment next 4 lines -->
	<tstamp>
		<format property="buildTimestamp" pattern="yyyyMMddHHmm" />
	</tstamp>

	<!-- 1. To build from sources using information in the ./maps/*.map files, comment these next two properties
				 2. Or, to build from sources in the workspace, use these properties. You can also use absolute paths if needed.
			-->
	<!-- <property name="localSourceCheckoutDir" value="${basedir}/.." />
			<property name="relengBuilderDir" value="${basedir}" /> -->

	<property name="build.properties" value="build.properties" />
	<property file="${build.properties}" />

	<property name="forceContextQualifier" value="v${buildTimestamp}" />
	<property name="fetchTag" value="HEAD" />

	<!-- calculate workspaceDir as parent of this folder, the project's .releng folder (relengBuilderDir) -->
	<import file="findbugs.xml" />
	<import file="pmd.xml" />
	<dirname file="${relengBuilderDir}" property="workspaceDir" />

	<!-- 
		can build in /tmp, eg., in /tmp/build, or in workspace, eg.,
		${WORKSPACE}/build
	-->
	<property name="writableBuildRoot" value="/tmp/build" />

	<!-- 
		can be simple path, eg., 
		${writableBuildRoot}/${buildType}${buildTimestamp} or longer, eg.,
		${writableBuildRoot}/${topprojectName}/${projectName}/downloads/drops/${version}/${buildType}${buildTimestamp} or
		${writableBuildRoot}/${topprojectName}/${projectName}/${subprojectName}/downloads/drops/${version}/${buildType}${buildTimestamp}
	-->
	<property name="buildDir" value="${writableBuildRoot}/athena" />

	<target name="init">
		<delete dir="${buildDir}" failonerror="false" />
	</target>

	<target name="run" depends="init">
		<echo message="Workspace: ${WORKSPACE}" />
		<echo message="Writable Build Root: ${writableBuildRoot}" />
		<mkdir dir="${writableBuildRoot}" />
		<!-- invoke a new Eclipse process and launch the build from the common.releng folder -->
		<!--<property name="relengCommonBuilderDir" value="${workspaceDir}/org.eclipse.dash.common.releng" />-->

		<condition property="JAVA_HOME" value="${java.home}" else="${java.home}/..">
			<available file="${java.home}/bin/javac" type="file" />
		</condition>

		<!-- <ant antfile="${relengCommonBuilderDir}/buildAll.xml" target="runEclipse" dir="${relengCommonBuilderDir}" />-->
		<ant antfile="${relengCommonBuilderDir}/build.xml" />

	</target>

</project>

This build script will provision the necessary files into the workspace to run the build. It does not depend on hard coded paths or other server specific items. JDK Home directory is provided by the environment variable set by Hudson.