| <?xml version="1.0"?> |
| <!-- |
| ************************************************************************ |
| * Copyright (c) 2006-2007, Cloudsmith Inc. |
| * The code, documentation and other materials contained herein have been |
| * licensed under the Eclipse Public License - v 1.0 by the copyright holder |
| * listed above, as the Initial Contributor under such license. The text of |
| * such license is available at www.eclipse.org. |
| ************************************************************************ |
| |
| Contributors: |
| Cloudsmith Inc - build.xml for Buckminster project |
| Matthieu Helleboid - changes for EGF |
| |
| Some important parts have been copied from Buckminster's own |
| build setup: |
| http://dev.eclipse.org/viewsvn/index.cgi/trunk/org.eclipse.buckminster.releng/build.xml?root=Tools_BUCKMINSTER&view=markup |
| --> |
| <project name="project"> |
| <!--Property file containing overrides for the default properties --> |
| <property environment="env" /> |
| <property file="build.properties" /> |
| <property name="featurename" value="org.eclipse.egf.sdk" /> |
| |
| <!-- if we are not running in Huson, we some up with a reasonable default --> |
| <condition property="build.root" value="${env.WORKSPACE}" else="${basedir}/../build"> |
| <isset property="env.WORKSPACE" /> |
| </condition> |
| |
| <!--Default properties intended to be overridden by entries in the above property file. --> |
| <property name="tools" location="${build.root}/tools" /> |
| <property name="result" location="${build.root}/result" /> |
| <property name="sources" location="${build.root}/sources" /> |
| |
| <property name="workspace" location="${result}/workspace" /> |
| <property name="publish" location="${result}/publish" /> |
| <property name="buckminster.output.root" location="${result}/output" /> |
| <property name="buckminster.temp.root" location="${result}/temp" /> |
| <property name="eclipse.staging.area" location="/shared/download-staging.priv/modeling/egf/" /> |
| |
| <echoproperties/> |
| |
| <!-- if we have defined a local target platform, we use it --> |
| <condition property="targetPlatformPath" value="${localTargetPlatformPath}" else="${result}/tp"> |
| <isset property="localTargetPlatformPath" /> |
| </condition> |
| |
| <taskdef resource="net/sf/antcontrib/antlib.xml"> |
| <classpath> |
| <pathelement location="lib/ant-contrib-1.0b3.jar" /> |
| </classpath> |
| </taskdef> |
| |
| <!-- This macro executes the default application of an eclipse installation that resides |
| in the folder ${buildtools}/@app |
| --> |
| <macrodef name="eclipse.launch"> |
| <attribute name="app" /> |
| <element name="args" optional="true" /> |
| <sequential> |
| <!-- We assume that the eclipse installation is beneath ${buildtools} --> |
| <property name="@{app}.deploy.dir" value="${tools}/@{app}" /> |
| |
| <!-- Find the Eclipse launcher and assing its location to the @{app}.launcher property --> |
| <pathconvert property="@{app}.launcher"> |
| <first count="1"> |
| <sort> |
| <fileset dir="${@{app}.deploy.dir}/plugins" includes="**/org.eclipse.equinox.launcher_*.jar" /> |
| <reverse xmlns="antlib:org.apache.tools.ant.types.resources.comparators"> |
| <date /> |
| </reverse> |
| </sort> |
| </first> |
| </pathconvert> |
| |
| <!-- Launch the eclipse application --> |
| <java fork="true" jar="${@{app}.launcher}" dir="${@{app}.deploy.dir}" failonerror="true"> |
| <args /> |
| </java> |
| </sequential> |
| </macrodef> |
| |
| <macrodef name="buckminster"> |
| <attribute name="command" /> |
| <attribute name="workspace" default="${workspace}" /> |
| <element name="globargs" optional="true" /> |
| <element name="cmdargs" optional="true" /> |
| <sequential> |
| <eclipse.launch app="buckminster"> |
| <args> |
| <jvmarg value="-Dbugfix.288796=true"/> |
| <arg value="-data" /> |
| <arg value="@{workspace}" /> |
| <arg value="--loglevel" /> |
| <arg value="${buckminster.loglevel}" /> |
| <arg value="--displaystacktrace" /> |
| <globargs /> |
| <arg value="@{command}" /> |
| <arg value="-P" /> |
| <arg value="${properties.tmp}" /> |
| <cmdargs /> |
| </args> |
| </eclipse.launch> |
| </sequential> |
| </macrodef> |
| |
| <target name="init.checks"> |
| <available file="${tools}/director/director" property="director.exists" /> |
| <available file="${tools}/buckminster/buckminster" property="buckminster.exists" /> |
| <available file="${workspace}" type="dir" property="workspace.exists" /> |
| </target> |
| |
| <target name="get.director" unless="director.exists"> |
| <echo message="Fetching headless director application" /> |
| <tempfile destdir="${java.io.tmpdir}" prefix="director-" suffix=".zip" property="director.zip" deleteonexit="true" /> |
| <get src="${director.url}" dest="${director.zip}" /> |
| <mkdir dir="${tools}" /> |
| <unzip src="${director.zip}" dest="${tools}" /> |
| <delete file="${director.zip}" /> |
| </target> |
| |
| <target name="install.buckminster" unless="buckminster.exists" depends="get.director"> |
| <echo message="Configuring headless buckminster with needed features" /> |
| <echo message="Headless site: ${bm.headless.site}" /> |
| <echo message="External site: ${bm.external.site}" /> |
| <eclipse.launch app="director"> |
| <args> |
| <jvmarg value="-Declipse.p2.mirrors=false" /> |
| <arg value="-r" /> |
| <arg value="${bm.headless.site}" /> |
| <arg value="-d" /> |
| <arg value="${tools}/buckminster" /> |
| <arg value="-p" /> |
| <arg value="Buckminster" /> |
| <arg value="-i" /> |
| <arg value="org.eclipse.buckminster.cmdline.product" /> |
| <arg value="-i" /> |
| <arg value="org.eclipse.buckminster.core.headless.feature.feature.group" /> |
| <arg value="-i" /> |
| <arg value="org.eclipse.buckminster.pde.headless.feature.feature.group" /> |
| <arg value="-i" /> |
| <arg value="org.eclipse.buckminster.cvs.headless.feature.feature.group" /> |
| <arg value="-i" /> |
| <arg value="org.eclipse.buckminster.emma.headless.feature.feature.group" /> |
| </args> |
| </eclipse.launch> |
| </target> |
| |
| <target name="init.workspace" unless="workspace.exists"> |
| <mkdir dir="${workspace}" /> |
| </target> |
| |
| <target name="init.build.properties"> |
| <!-- Echo relevant properties to a temporary file so that Buckminster can read them --> |
| <tempfile destdir="${java.io.tmpdir}" prefix="build-" suffix=".properties" deleteonexit="true" property="properties.tmp" /> |
| <echoproperties destfile="${properties.tmp}"> |
| <!-- We don't want these. basedir in particular will cause problems if passed explicitly --> |
| <propertyset negate="true"> |
| <propertyref name="basedir" /> |
| <propertyref name="eclipse.home" /> |
| <propertyref name="properties.tmp" /> |
| <propertyref name="line.separator" /> |
| <propertyref name="path.separator" /> |
| <propertyref prefix="ant." /> |
| <propertyref prefix="file." /> |
| <propertyref prefix="java." /> |
| <propertyref prefix="sun." /> |
| <propertyref prefix="user." /> |
| </propertyset> |
| </echoproperties> |
| </target> |
| |
| <target name="provision" depends="init.checks,init.workspace,install.buckminster,init.build.properties"> |
| <echo message="Importing projects into workspace ${workspace} and binaries into target platform ${targetPlatformPath}" /> |
| |
| <echo message="env.JAVA_HOME : ${env.JAVA_HOME}" /> |
| <echo message="JAVA_HOME : ${JAVA_HOME}" /> |
| <echo message="will use : /shared/common/jdk-1.5.0-22.x86_64" /> |
| <buckminster command="installJRE"> |
| <cmdargs> |
| <arg value="--location" /> |
| <arg value="/shared/common/jdk-1.5.0-22.x86_64" /> |
| </cmdargs> |
| </buckminster> |
| |
| <buckminster command="setpref"> |
| <cmdargs> |
| <arg value="targetPlatformPath=${targetPlatformPath}" /> |
| </cmdargs> |
| </buckminster> |
| |
| <buckminster command="import"> |
| <!-- Uncomment to debug <globargs><jvmarg value="-agentlib:jdwp=transport=dt_socket,address=8000,server=y,suspend=y"/></globargs> --> |
| <cmdargs> |
| <arg value="-P" /> |
| <arg value="${basedir}/build.properties" /> |
| <arg value="${basedir}/build.mspec" /> |
| </cmdargs> |
| </buckminster> |
| </target> |
| |
| <target name="eclipse.build" depends="provision"> |
| <echo message="Invoking all eclipse builders on workspace ${workspace} (with clean and thorough options)" /> |
| <buckminster command="build" > |
| <cmdargs> |
| <arg value="--clean" /> |
| <arg value="--thorough" /> |
| </cmdargs> |
| </buckminster> |
| </target> |
| |
| <target name="test" depends="eclipse.build"> |
| <echo message="Running Junit tests and Emma code coverage" /> |
| <buckminster command="emma"> |
| <cmdargs> |
| <arg value="-l" /> |
| <arg value="org.eclipse.egf.core.test/EGF_Core_Tests.launch" /> |
| <arg value="-o" /> |
| <arg value="${result}/testReport.xml" /> |
| <arg value="--xml" /> |
| <arg value="${result}/coverageReport.xml" /> |
| <arg value="--terseXML" /> |
| <arg value="--flatXML"/> |
| </cmdargs> |
| </buckminster> |
| </target> |
| |
| <target name="site.p2" depends="eclipse.build"> |
| <buckminster command="perform"> |
| <globargs> |
| <arg value="-Dsite.include.top=true"/> |
| </globargs> |
| <cmdargs> |
| <arg value="${featurename}:eclipse.feature#site.p2" /> |
| </cmdargs> |
| </buckminster> |
| </target> |
| |
| <target name="publish.site" depends="site.p2"> |
| <mkdir dir="${publish}/site/"/> |
| <copy todir="${publish}/site/"> |
| <fileset dir="${result}/output"> |
| <include name="${featurename}*/site.p2/*"/> |
| <include name="${featurename}*/site.p2/**"/> |
| </fileset> |
| <filtermapper> |
| <replaceregex pattern="org\.eclipse\.egf.*site\.p2" replace="" /> |
| </filtermapper> |
| </copy> |
| </target> |
| |
| <target name="publish.examples" depends="eclipse.build"> |
| <mkdir dir="${publish}/examples/"/> |
| <for param="plugin"> |
| <path> |
| <dirset dir="${sources}/examples/workspace/" includes="**" > |
| <depth min="0" max="0"/> |
| </dirset> |
| </path> |
| <sequential> |
| <var name="filename" unset="true"/> |
| <basename file="@{plugin}" property="filename"/> |
| <zip destfile="${publish}/examples/${filename}.zip" basedir="@{plugin}" /> |
| </sequential> |
| </for> |
| </target> |
| |
| <target name="publish.dropins" depends="site.p2,featureVersion"> |
| <condition property="site.src" value="site.signed" else="site"> |
| <istrue value="${site.signing}" /> |
| </condition> |
| <echo message="Create dropins from ${site.src}" /> |
| |
| <mkdir dir="${publish}/dropins/${featurename}_${featureVersion}/eclipse/plugins/"/> |
| <for param="file"> |
| <path> |
| <fileset dir="${result}/output"> |
| <include name="${featurename}*/${site.src}/plugins/*.jar"/> |
| </fileset> |
| </path> |
| <sequential> |
| <copy file="@{file}" todir="${publish}/dropins/${featurename}_${featureVersion}/eclipse/plugins/"/> |
| </sequential> |
| </for> |
| |
| <mkdir dir="${publish}/dropins/${featurename}_${featureVersion}/eclipse/features/"/> |
| <for param="file"> |
| <path> |
| <fileset dir="${result}/output"> |
| <include name="${featurename}*/${site.src}/features/*.jar"/> |
| </fileset> |
| </path> |
| <sequential> |
| <var name="filename" unset="true"/> |
| <basename file="@{file}" property="filename" suffix=".jar"/> |
| <unzip src="@{file}" dest="${publish}/dropins/${featurename}_${featureVersion}/eclipse/features/${filename}/"/> |
| </sequential> |
| </for> |
| </target> |
| |
| <target name="featureVersion" > |
| <for param="file"> |
| <path> |
| <fileset dir="${result}/output"> |
| <include name="${featurename}*/temp/feature.xml"/> |
| </fileset> |
| </path> |
| <sequential> |
| <loadfile property="featureFileContent" srcFile="@{file}"/> |
| <propertyregex property="featureVersion" input="${featureFileContent}" regexp='version=\"(.*\..*\..*\..*)\"' select="\1" /> |
| <var name="featureFileContent" unset="true"/> |
| </sequential> |
| </for> |
| </target> |
| |
| <target name="publish.javadoc"> |
| <delete dir="${build.root}/../javadoc" /> |
| <javadoc |
| destdir="${build.root}/../javadoc" |
| maxmemory="1024m" |
| source="1.5" |
| useexternalfile="true" |
| author="true" |
| version="true" |
| use="true" |
| windowtitle="Javadoc"> |
| |
| <link offline="false" href="http://download.oracle.com/javase/1.5.0/docs/api/"/> |
| <link offline="false" href="http://www.osgi.org/javadoc/r4v42/"/> |
| <link offline="false" href="http://download.eclipse.org/modeling/emf/emf/javadoc/2.5.0/"/> |
| <link offline="false" href="http://help.eclipse.org/galileo/index.jsp?topic=/org.eclipse.platform.doc.isv/reference/api/"/> |
| |
| <fileset dir="${build.root}/sources/doc" defaultexcludes="true"> |
| <include name="**/*.java"/> |
| </fileset> |
| <fileset dir="${build.root}/sources/plugins" defaultexcludes="true"> |
| <include name="**/*.java"/> |
| </fileset> |
| <fileset dir="${build.root}/sources/portfolio" defaultexcludes="true"> |
| <include name="**/*.java"/> |
| </fileset> |
| </javadoc> |
| </target> |
| |
| <target name="publish" depends="publish.site,publish.examples,publish.dropins,publish.javadoc" /> |
| <target name="all" depends="clean.result,eclipse.build,site.p2,publish,test" /> |
| |
| <target name="clean.tools"> |
| <delete dir="${tools}" failonerror="true" quiet="true" /> |
| </target> |
| |
| <target name="clean.result"> |
| <delete dir="${result}" failonerror="true" quiet="true" /> |
| </target> |
| </project> |