Skip to main content

Notice: this Wiki will be going read only early in 2024 and edits will no longer be possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

Common Build Infrastructure/Getting Started/Build In Hudson/Ant Script

Warning2.png
Draft Content
This page is currently under construction. Community members are encouraged to maintain the page, and make sure the information is accurate.


There are a few slight modifications to make to the ant script that will be used to build using Hudson.

1. In the build.properties file the following needs to be added:

writableBuildRoot=${WORKSPACE}/build

2. In the build.properties file the property settings for forceContext and fetchTag can be set or the values can be specified in the build script. These settings control how the plugin qualifiers are created and where the code is retrieve (i.e. Head or if not specified according to your map entries).

3. In the ANT script by default in the Build from Eclipse script, the build directory is the same name as the BuildType and Timestamp of the build. However, this can leave extra directories laying around on Hudson taking up space. So it is recommended that this directory be set to something like athena:

<property name="buildDir" value="${writableBuildRoot}/athena" />

Note.png
Build Dir
This can also be set in the build.properties file as well.


4. (Optional) If you are archiving artifact, verify the build configuration on your hudson's job to includes the correct dir ( build/athena/**/**.* )

5. (Optional) If their are long delays between when the build actually finishes the last target and the cleanup step, an alternative custom cleanup step can be created to delete specific items. Athena uses the <fileset> option in many places and depending on the size of the directories and number of files, this can take a long time to do cleanups. See sample ant script for an alternative.

Sample 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.xpath2
zipPrefix=wst-xpath2-psychopath
incubation=
version=1.1.0
buildType=N
mainFeatureToBuildID=org.eclipse.wst.xml.xpath2.processor.feature
testFeatureToBuildID=org.eclipse.wst.xml.xpath2.processor_tests.feature

# MUST BE SET #
JAVA_HOME=/opt/public/common/ibm-java2-ppc-50
JAVA50_HOME=/opt/public/common/ibm-java2-ppc-50
dependencyURLs=http://download.eclipse.org/eclipse/downloads/drops/R-3.5-200906111540/eclipse-SDK-3.5-linux-gtk-ppc.tar.gz,http://download.eclipse.org/tools/orbit/downloads/drops/R20090825191606/orbit-R20090825191606.zip,http://downloads.sourceforge.net/project/eclemma/06_EclEmma_Runtime_for_Equinox/1.1.0/org.eclemma.runtime.equinox_1.1.0.200908261008.zip


#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,test,publish

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

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

Sample Ant Script

The following is taken from the cbi-wtp-wst.xsl-psychopath build that is currently running on Athena. This build experienced a 20 minute delay at times in the cleanup process, and by switching to a customized cleanup target the cleanup improved (i.e. 20 minute delay cut down to 1 minute).

<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 name="WORKSPACE" location="../../../../"/>
	<property environment="env"/>
	<property file="build.properties" />
	<tstamp>
		<format property="buildTimestamp" pattern="yyyyMMddHHmm" />
	</tstamp>
	<property name="forceContextQualifier" value="v${buildTimestamp}" />
	<property name="fetchTag" value="HEAD" />
 
	<!-- 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="/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" />
		<ant antfile="${relengCommonBuilderDir}/buildAll.xml" target="runEclipse" dir="${relengCommonBuilderDir}" />
		<antcall target="cleanUp" inheritall="true"/>
	</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"/>
			</fileset>
		</delete>
	</target>	
</project>

See Also

Back to the top