blob: 4cbc597e62eec9ae0fbc3b72afe73dd77af7aee9 [file] [log] [blame]
<?xml version="1.0" encoding="UTF-8"?>
<!--
Headless materialization of Emf Parsley workspace
adapted from Headless materialization of Xtext workspace
Author: Lorenzo Bettini, Dennis Huebner
Properties:
WORKSPACE where workspace will be generated,
default: ${user.home}/workspaces/emf-parsley-sources
or ${user.home}/workspaces/emf-parsley-rap-sources
for target materialize.workspace.rap
buckminster.home Buckminster headless location
default: ${user.home}/buckminster.parsley
if not installed, it will be automatically installed
git.clone.dest where sources are (or will be) cloned
${user.home}/git/org.eclipse.emf-parsley
-->
<project name="worskspace" default="materialize.workspace">
<!-- Windows Maximum Path Length Limitation issue
<condition property="git.root" value="/git" else="${user.home}/git">
<os family="windows" />
</condition> -->
<property name="git.root" value="${user.home}/git" />
<property name="git.clone.dest" location="${git.root}/org.eclipse.emf-parsley" />
<property name="checkout.location" location="${git.clone.dest}" />
<property name="releng.project" value="${checkout.location}/releng/org.eclipse.emf.parsley.releng"/>
<property name="commands.path" value="${releng.project}/commands"/>
<property name="target.definition.file" value="luna.target"/>
<property name="target.rap.definition.file" value="kepler-rap.target"/>
<property name="target.definition" value="${checkout.location}/devtools/org.eclipse.emf.parsley.targetplatform/${target.definition.file}"/>
<property name="target.rap.definition" value="${checkout.location}/devtools/org.eclipse.emf.parsley.targetplatform/${target.rap.definition.file}"/>
<property name="target.platform.dir" value="target.platform" />
<property name="eclipse.download" value="http://download.eclipse.org" />
<property name="eclipse.name" value="luna" />
<property name="buckminster.home" location="${user.home}/buckminster.parsley" />
<property name="director.install.dest" location="${user.home}" />
<property name="director.dir" location="${director.install.dest}/director" />
<property name="director.url" value="http://download.eclipse.org/tools/buckminster/products/director_latest.zip" />
<property name="git.config.file" location="${git.clone.dest}/.git/config" />
<property name="remote.cquery" value="http://git.eclipse.org/c/emf-parsley/org.eclipse.emf-parsley.git/plain/devtools/org.eclipse.emf.parsley.contributor/parsley-contr.cquery" />
<property name="eclipse.p2.mirrors" value="true" />
<property name="java.net.preferIPv4Stack" value="true" />
<target name="materialize.workspace" depends="install.buckminster.headless">
<property name="WORKSPACE" location="${user.home}/workspaces/emf-parsley-sources" />
<property name="target.platform" location="${WORKSPACE}/${target.platform.dir}" />
<echo message="output workspace : ${WORKSPACE}" />
<echo message="git clone repository : ${git.clone.dest}" />
<antcall target="cleanup" />
<antcall target="set.target.platform.path" />
<antcall target="clone.projects" />
<antcall target="import.target" />
<antcall target="resolve.commands" />
<antcall target="import.workspace.settings" />
<echo message=" " />
<echo message="Workspace materialized in: ${WORKSPACE}" />
</target>
<target name="materialize.workspace.rap" depends="install.buckminster.headless">
<property name="WORKSPACE" location="${user.home}/workspaces/emf-parsley-rap-sources" />
<property name="target.platform" location="${WORKSPACE}/${target.platform.dir}" />
<echo message="output workspace : ${WORKSPACE}" />
<echo message="git clone repository : ${git.clone.dest}" />
<antcall target="cleanup" />
<antcall target="set.target.platform.path" />
<antcall target="clone.projects" />
<antcall target="import.rap.target" />
<antcall target="resolve.commands.rap" />
<antcall target="import.workspace.settings" />
<echo message=" " />
<echo message="Workspace materialized in: ${WORKSPACE}" />
</target>
<target name="set.target.platform.path">
<run_buckminster command='setpref targetPlatformPath="${target.platform}"' />
</target>
<target name="clone.projects">
<echo message="IMPORTANT: Initial cloning of a git repository may take a while." />
<!-- <run_buckminster command="import ${user.home}/git/org.eclipse.xtext/devtools/org.eclipse.xtext.contributor/xtext-contr.mspec" />
-->
<run_buckminster command="import ${remote.cquery}" />
</target>
<target name="import.target">
<echo message="IMPORTANT: Populating an empty target platform may take a while." />
<run_buckminster command='importtargetdefinition -A "${target.definition}"' />
</target>
<target name="import.rap.target">
<echo message="IMPORTANT: Populating an empty target platform may take a while." />
<run_buckminster command='importtargetdefinition -A "${target.rap.definition}"' />
</target>
<target name="import.api.baseline">
<run_buckminster command='importtargetdefinition "${checkout.location}/releng/org.eclipse.xtext.releng/api-baseline/api-baseline.target"' />
</target>
<target name="set.api.baseline">
<run_buckminster command='addbaseline -A "api-baseline"' />
</target>
<target name="resolve.commands" depends="copy-xtext-grammar-to-bin">
<echo message="IMPORTANT: We also run mwe2 to create Xtext languages artifacts." />
<run_buckminster command='--script "${commands.path}/headless-resolve-commands-contributor.bmscript"' />
</target>
<target name="resolve.commands.rap">
<echo message="IMPORTANT: Populating an empty target platform may take a while." />
<run_buckminster command='--script "${commands.path}/headless-resolve-commands-contributor-rap.bmscript"' />
</target>
<target name="import.workspace.settings">
<run_buckminster command='importprefs -F "${checkout.location}/devtools/org.eclipse.emf.parsley.contributor/workspace.epf"' />
</target>
<!-- = = = = = = = = = = = = = = = = =
macrodef: run_buckminster
pass the commandsfile to execute
= = = = = = = = = = = = = = = = = -->
<macrodef name="run_buckminster">
<attribute name="command" default="default" />
<sequential>
<java fork="true" dir="${buckminster.home}" logError="true" classname="org.eclipse.core.launcher.Main" failonerror="true">
<classpath>
<fileset dir="${buckminster.home}/plugins">
<include name="org.eclipse.equinox.launcher_*.jar" />
</fileset>
</classpath>
<!-- <arg line='-L DEBUG' /> -->
<arg line='@{command}' />
<arg line='-data "${WORKSPACE}"' />
<arg line='-configuration "${WORKSPACE}/configuration"' />
<sysproperty key="projects.location" value="${checkout.location}" />
<sysproperty key="git.clone.dest" value="${git.clone.dest}" />
<sysproperty key="checkout.location" value="${checkout.location}" />
<sysproperty key="target.platform" value="${target.platform}" />
<sysproperty key="eclipse.download" value="${eclipse.download}" />
<sysproperty key="eclipse.p2.mirrors" value="${eclipse.p2.mirrors}" />
<sysproperty key="java.net.preferIPv4Stack" value="${java.net.preferIPv4Stack}" />
<jvmarg line=" -Xms256m -Xmx512m" />
</java>
</sequential>
</macrodef>
<target name="copy-xtext-grammar-to-bin">
<echo message="checkout.location: ${checkout.location}" />
<copy todir="${checkout.location}" overwrite="true" verbose="true">
<fileset dir="${checkout.location}" casesensitive="true">
<include name="**/src/**/*.xtext" />
</fileset>
<regexpmapper from="(.*)/(src)/(.*/*\.xtext)" to="\1/bin/\3" casesensitive="yes" handledirsep="yes"/>
</copy>
</target>
<target name="install.buckminster.headless">
<condition property="buckminster.headless.installed">
<available file="${buckminster.home}/buckminster" />
</condition>
<antcall target="install.buckminster.headless.internal" />
</target>
<target name="install.buckminster.headless.internal" unless="buckminster.headless.installed">
<antcall target="install.p2.director" />
<echo message="" />
<echo message="Installing Buckminster Headless into ${buckminster.home}..." />
<java fork="true" dir="${director.dir}" logError="true" classname="org.eclipse.core.launcher.Main" failonerror="true">
<sysproperty key="eclipse.p2.mirrors" value="false" />
<classpath>
<fileset dir="${director.dir}/plugins">
<include name="org.eclipse.equinox.launcher_*.jar" />
</fileset>
</classpath>
<arg line='-data "${director.dir}/workspace"' />
<arg line="-r ${eclipse.download}/tools/buckminster/headless-4.4,http://download.cloudsmith.com/buckminster/external-4.4,${eclipse.download}/modeling/tmf/xtext/updates/composite/releases" />
<arg line='-d "${buckminster.home}"' />
<arg line="-p Buckminster" />
<arg line="-roaming" />
<arg line="-i org.eclipse.buckminster.cmdline.product" />
<arg line="-i org.eclipse.buckminster.core.headless.feature.feature.group" />
<arg line="-i org.eclipse.buckminster.pde.headless.feature.feature.group" />
<arg line="-i org.eclipse.buckminster.git.headless.feature.feature.group" />
<arg line="-i org.eclipse.buckminster.maven.headless.feature.feature.group" />
<!-- <arg line="-i org.eclipse.buckminster.emma.headless.feature.feature.group" /> -->
<arg line="-i org.eclipse.emf.mwe2.launcher.feature.group" />
</java>
</target>
<target name="install.p2.director">
<condition property="p2.director.installed">
<available file="${director.dir}/director" />
</condition>
<antcall target="install.p2.director.internal" />
</target>
<target name="install.p2.director.internal" unless="p2.director.installed">
<echo message="" />
<echo message="Installing director from ${director.url}..." />
<tempfile destdir="${java.io.tmpdir}" prefix="director-" suffix=".zip" property="director.zip" deleteonexit="true" />
<get src="${director.url}" dest="${director.zip}" />
<unzip src="${director.zip}" dest="${director.install.dest}" />
<delete file="${director.zip}" />
</target>
<target name="cleanup">
<delete failonerror="false" includeemptydirs="true">
<fileset dir="${WORKSPACE}" defaultexcludes="false">
<exclude name="**/.metadata/.plugins/org.eclipse.pde.core/.bundle_pool/" />
<exclude name="**/.metadata/.plugins/*mylyn*/" />
<exclude name="**/.metadata/.mylyn/" />
<exclude name="**/.metadata/.plugins/org.eclipse.jdt.ui/dialog_settings.xml" />
<exclude name="**/.metadata/.plugins/org.eclipse.ui.workbench/workingsets.xml" />
<exclude name="**/${target.platform.dir}/" />
</fileset>
</delete>
</target>
<target name="create.git.config" unless="existing.repository">
<input message="Input your eclipse bugzilla id" addproperty="bugzilla.user" />
<antcall target="-do.modify.config" />
</target>
<target name="-do.modify.config" if="bugzilla.user">
<loadfile property="user.aware.config" srcFile="${checkout.location}/devtools/org.eclipse.xtext.contributor/gerrit.config">
<filterchain>
<expandproperties />
</filterchain>
</loadfile>
<echo file="${git.config.file}">${user.aware.config}</echo>
<echo>Modified ${git.config.file}</echo>
</target>
</project>