| «IMPORT 'http://www.eclipse.org/amalgam/2008/build'» |
| «IMPORT 'http://www.eclipse.org/amalgam/2008/product'» |
| «IMPORT 'http://www.eclipse.org/emf/2002/Ecore'» |
| |
| «EXTENSION util» |
| «EXTENSION xpt::StringOperations» |
| |
| «DEFINE Main FOR build::Build-» |
| <?xml version="1.0"?> |
| <project default="main" basedir="."> |
| <!-- ===================================================================== --> |
| <!-- NOTE: This a generated script --> |
| <!-- ===================================================================== --> |
| «EXPAND initTarget FOR self» |
| «EXPAND mainTarget FOR self» |
| «EXPAND fetchBuilderTarget FOR self» |
| «EXPAND buildProductTarget FOR self» |
| «EXPAND categorizeTarget FOR self» |
| «EXPAND packTarget FOR self» |
| «EXPAND emailProductFailureTarget FOR self» |
| «EXPAND consolidateTarget FOR self» |
| «EXPAND additions FOR self» |
| </project> |
| «ENDDEFINE» |
| |
| «DEFINE initTarget FOR build::Build» |
| <target name="init"> |
| <property name="date" value="«date»"/> |
| <property name="time" value="«time»"/> |
| <property name="buildRoot" value="«buildRoot»"/> |
| <property name="target" value="«product.launcher.name»"/> |
| <property name="buildDirectory" value="${buildRoot}/${target}"/> |
| <property name="basebuilder" value="${buildDirectory}/basebuilder"/> |
| <property file="${buildRoot}/${target}/builder/build.properties"/> |
| </target> |
| «ENDDEFINE» |
| |
| «DEFINE mainTarget FOR build::Build» |
| <target name="main" depends="init"> |
| <antcall target="fetch.builder"/> |
| <antcall target="build.product"/> |
| <antcall target="pack"/> |
| <!-- FIXME: generate metadata using site.xml to provide categories until bug 250974 is resolved --> |
| <!-- FIXME: need to invoke metadata generator after pack even after categorization bug above is resolved? --> |
| <!-- FIXME: also, if -compress doesn't work, manually jar content and artifacts.xml --> |
| <antcall target="categorize"/> |
| <antcall target="consolidate"/> |
| <!-- FIXME: workaround to correct permissions on build.eclipse.org --> |
| <chmod dir="${buildRoot}" perm="a+rx" type="dir" maxparallel="300" |
| includes="«product.launcher.name»/**"/> |
| <chmod dir="${buildRoot}" perm="a+r" type="file" maxparallel="300" |
| includes="«product.launcher.name»/**"/> |
| </target> |
| «ENDDEFINE» |
| |
| «DEFINE fetchBuilderTarget FOR build::Build» |
| <target name="fetch.builder"> |
| <!-- No director app in normal basebuilder, so just use SDK --> |
| <get src="«builder.location»«builder.file»" |
| dest="${buildRoot}/«builder.file»" verbose="true" usetimestamp="true"/> |
| <mkdir dir="${basebuilder}"/> |
| «IF builder.file.xpandEndsWith('tar.gz') = true» |
| <exec executable="tar"> |
| <arg line="-xzf"/> |
| <arg line="${buildRoot}/«builder.file»"/> |
| <arg line="-C ${basebuilder}"/> |
| </exec> |
| «ELSE» |
| <unzip src="${buildRoot}/«builder.file»" dest="${basebuilder}"/> |
| «ENDIF» |
| </target> |
| «ENDDEFINE» |
| |
| «DEFINE buildProductTarget FOR build::Build» |
| <target name="build.product"> |
| <fail message="Could not load property 'product' from build.properties. Did you generate it and customTargets.xml to ${buildRoot}/${target}/builder?" unless="product" /> |
| <fileset dir="${basebuilder}/eclipse/plugins" includes="org.eclipse.pde.build_*/scripts/productBuild/productBuild.xml" id="pde.plugin.path" /> |
| <pathconvert property="buildFile" refid="pde.plugin.path" /> |
| <fail message="Could not find pde builder here: ${buildFile}" unless="buildFile" /> |
| |
| <echo message="Configuring product «product.id» «product.version» with the following features:"/> |
| «FOREACH product.features.feature->asSequence() AS feature-» |
| <echo message=" «feature.id» «feature.version»"/> |
| «ENDFOREACH» |
| |
| <!-- Run product build to fetch, compile, and generate p2 repository --> |
| <exec executable="${basebuilder}/eclipse/eclipse" dir="${buildDirectory}/builder" resultproperty="product.return.code"> |
| «IF launchVM <> null and launchVM <> ''-» |
| <arg line="-vm «launchVM»"/> |
| «ENDIF-» |
| <arg line="-application org.eclipse.ant.core.antRunner"/> |
| <arg line="-buildfile ${buildFile}" /> |
| <arg line="-nosplash" /> |
| <arg line="--launcher.suppressErrors" /> |
| <arg line="-consoleLog" /> |
| <arg line="-vmargs"/> |
| <arg line="-Xmx1024m" /> |
| <arg value="-DbuildRoot=${buildRoot}"/> |
| <arg value="-Dbuilder=${buildDirectory}/builder"/> |
| <arg value="-Dbasebuilder=${basebuilder}"/> |
| <arg value="-DbuildDirectory=${buildDirectory}"/> |
| <arg value="-Dbase=${base}"/> |
| <arg value="-DbaseLocation=${baseLocation}"/> |
| <arg value="-Dtimestamp=${timestamp}"/> |
| <arg value="-DbuildType=${buildType}"/> |
| <arg value="-DbuildId=${buildId}"/> |
| <arg value="-DbuildLabel=${buildLabel}"/> |
| </exec> |
| |
| <condition property="product.failed"> |
| <not><equals arg1="${product.return.code}" arg2="0"/></not> |
| </condition> |
| |
| <antcall target="email.product.failure"/> |
| |
| «FOREACH configs->asSequence() AS config» |
| «IF config.os.repr() = 'macosx' or config.os.repr() = 'linux'» |
| <!-- FIXME: rename archive to tar.gz instead of zip for macosx and linux --> |
| <move file="${buildDirectory}/${buildLabel}/«archiveName(self)»-«config.os».«config.ws».«config.arch».zip" tofile="${buildDirectory}/${buildLabel}/«archiveName(self)»-«archiveExtension(config)»"/> |
| |
| <!-- FIXME: correct permissions on launcher for macosx --> |
| |
| «ENDIF» |
| «ENDFOREACH» |
| |
| </target> |
| «ENDDEFINE» |
| |
| «DEFINE emailProductFailureTarget FOR build::Build» |
| <target name="email.product.failure" if="product.failed" unless="nomail"> |
| <copy file="${buildDirectory}/«product.launcher.name».build.log.txt" tofile="${buildRoot}/${buildId}.log.txt"/> |
| <mail tolist="«IF buildmaster <> null»«buildmaster.email»«ENDIF»" |
| subject="«label» build failed" |
| encoding="plain" |
| failonerror="false">«IF buildmaster <> null» |
| <from name="«label» buildmaster [«buildmaster.name»]" |
| address="«buildmaster.email»" />«ENDIF» |
| <!-- TODO: add properties to model for accomodate log link and default email list, etc. --> |
| <message>Product build failed! |
| Check the log file for more information: «builderURL»${buildId}.log.txt. |
| </message> |
| </mail> |
| <fail message="Creation of product failed! Email sent."/> |
| </target> |
| «ENDDEFINE» |
| |
| «DEFINE categorizeTarget FOR build::Build» |
| <!-- FIXME: workaround for bug 250974 : generate metadata using site.xml for categorization --> |
| <target name="categorize" depends="init"> |
| <move file="${buildDirectory}/site.xml" todir="${buildDirectory}/${buildLabel}/repo"/> |
| <exec executable="${basebuilder}/eclipse/eclipse" failonerror="false"> |
| «IF launchVM <> null and launchVM <> ''-» |
| <arg line="-vm «launchVM»"/> |
| «ENDIF-» |
| <arg line="-application org.eclipse.equinox.p2.metadata.generator.EclipseGenerator"/> |
| <arg line="-updateSite ${buildDirectory}/${buildLabel}/repo"/> |
| <arg line="-site ${p2.metadata.repo}/site.xml"/> |
| <arg line="-metadataRepository ${p2.metadata.repo}"/> |
| <arg line="-artifactRepository ${p2.artifact.repo}"/> |
| <arg line="-nosplash"/> |
| <arg line="--launcher.suppressErrors"/> |
| <arg line="-consoleLog"/> |
| <arg line="-compress"/> |
| <arg line="-reusePack200Files"/> |
| <arg line="-noDefaultIUs"/> |
| <arg line="-vmargs"/> |
| <arg line="-Xmx1024m"/> |
| </exec> |
| </target> |
| «ENDDEFINE» |
| |
| «DEFINE packTarget FOR build::Build» |
| <!-- As packing can take a LONG time, must pass in -Dpack=true to run pack200 on repo --> |
| <target name="pack" depends="init" if="pack"> |
| <exec executable="${basebuilder}/eclipse/eclipse" failonerror="false"> |
| «IF launchVM <> null and launchVM <> ''-» |
| <arg line="-vm «launchVM»"/> |
| «ENDIF-» |
| <arg line="-application org.eclipse.update.core.siteOptimizer"/> |
| <arg line="-jarProcessor -verbose -pack -processAll -outputDir ${buildDirectory}/${buildLabel}/repo"/> |
| <arg line="${buildDirectory}/${buildLabel}/repo" /> |
| <arg line="-nosplash" /> |
| <arg line="--launcher.suppressErrors" /> |
| <arg line="-consoleLog" /> |
| <arg line="-vmargs"/> |
| <arg line="-Xmx1024m"/> |
| </exec> |
| </target> |
| «ENDDEFINE» |
| |
| «DEFINE consolidateTarget FOR build::Build» |
| <target name="consolidate" depends="init"> |
| <!-- Consolidate artifacts for publish --> |
| <move file="${buildDirectory}/index.php" todir="${buildDirectory}/${buildLabel}"/> |
| <move file="${buildDirectory}/directory.txt" todir="${buildDirectory}/${buildLabel}"/> |
| <move file="${buildDirectory}/«product.launcher.name».build" todir="${buildDirectory}/${buildLabel}"/> |
| <move file="${buildDirectory}/«product.launcher.name».product" todir="${buildDirectory}/${buildLabel}"/> |
| |
| <!-- flatten the repository --> |
| <move tofile="${buildRoot}/«product.launcher.name»/${buildLabel}/binary" file="${buildRoot}/«product.launcher.name»/${buildLabel}/repo/binary"/> |
| <move tofile="${buildRoot}/«product.launcher.name»/${buildLabel}/features" file="${buildRoot}/«product.launcher.name»/${buildLabel}/repo/features"/> |
| <move tofile="${buildRoot}/«product.launcher.name»/${buildLabel}/plugins" file="${buildRoot}/«product.launcher.name»/${buildLabel}/repo/plugins"/> |
| <!-- FIXME: Zip the metadata, as -compress argument above didn't seem to do the trick --> |
| <zip destfile="${buildDirectory}/${buildLabel}/content.jar" |
| basedir="${buildDirectory}/${buildLabel}/repo" |
| includes="content.xml"/> |
| <zip destfile="${buildDirectory}/${buildLabel}/artifacts.jar" |
| basedir="${buildDirectory}/${buildLabel}/repo" |
| includes="artifacts.xml"/> |
| <delete dir="${buildRoot}/«product.launcher.name»/${buildLabel}/repo"/> |
| </target> |
| «ENDDEFINE» |
| |
| «DEFINE additions FOR build::Build» |
| «ENDDEFINE» |
| |