blob: 3d40984d021c45f44ea3791408dbd9c2a0814846 [file] [log] [blame]
<?xml version="1.0" encoding="UTF-8"?>
<project name="Packaging">
<target name="create.target.platform.metadata">
<buckminster.targetPlatformLocation property="target.platform.location" />
<property name="target.platform.repository" value="file:${sp:output}" />
<p2.publish.featuresAndBundles metadataRepository="${target.platform.repository}" source="${target.platform.location}" publishArtifacts="false" />
<buckminster.publishJRE metadataRepository="${target.platform.repository}" publishArtifacts="false" />
</target>
<target name="-define.package.name.stem">
<property name="incubation.qualifier" value="" />
<!-- if the build.alias is non-empty then use it in preference -->
<condition property="package.qualifier" value="${incubation.qualifier}-${build.alias}">
<and>
<isset property="build.alias" />
<length string="${build.alias}" when="greater" length="0" />
</and>
</condition>
<!-- otherwise use the build.id if defined, if not then fall back to an empty string -->
<condition property="package.qualifier" value="${incubation.qualifier}-${build.id}" else="${incubation.qualifier}">
<and>
<isset property="build.id" />
<length string="${build.id}" when="greater" length="0" />
</and>
</condition>
<property name="package.name.stem" value="${sp:output}/${package.name}${package.qualifier}" />
</target>
<target name="package.site" depends="-define.package.name.stem">
<mkdir dir="${sp:output}" />
<!-- create the desired ZIP file -->
<zip basedir="${sp:repository}" destfile="${package.name.stem}.zip" />
</target>
<target name="-locate.launcher.jar" unless="launcher.jar">
<pathconvert property="launcher.jar">
<first count="1">
<sort>
<fileset dir="${eclipse.home}/plugins" includes="**/org.eclipse.equinox.launcher_*.jar" />
<reverse xmlns="antlib:org.apache.tools.ant.types.resources.comparators">
<date />
</reverse>
</sort>
</first>
</pathconvert>
</target>
<target name="-define.install.properties" depends="-locate.launcher.jar">
<buckminster.targetPlatformLocation property="target.platform.location" />
<!--
Set the target platform bundle pool path to an empty value in case installation
of the target platform components is desired, otherwise set it to the target
platform location.
The target platform bundle pool path is used as a secondary bundle pool during
the installations. So if set to the location of the target platform, then all
components in the target platform appear to be already installed to the installation
process, and thus are not installed again. On the other hand if set to an empty
value then the components from the target platform don't appear to be installed,
and thus are installed along with the components produced by the build.
-->
<condition property="target.platform.bundle.pool.path" value="">
<istrue value="${install.target.platform.dependencies}" />
</condition>
<property name="target.platform.bundle.pool.path" location="${target.platform.location}" />
<property name="bundle.pools.property.name" value="org.eclipse.equinox.p2.cache.extensions" />
<property name="install.features.property.name" value="org.eclipse.update.install.features" />
<!-- set default -->
<property name="install.features" value="true" />
<!-- default to empty values -->
<property name="fs:repositories" value="" />
<property name="fs:metadata.repositories" value="" />
<property name="fs:artifact.repositories" value="" />
<property name="fs:target.platform.repository" value="" />
<property name="fs:install.pools" value="" />
<!-- create a list of all possible metadata repositories -->
<pathconvert property="metadata.repositories" dirsep="/" pathsep=",">
<buckminster.valuepath value="${fs:repositories}" />
<buckminster.valuepath value="${fs:metadata.repositories}" />
<!-- this is a metadata repository generated for the artifacts in the target platform -->
<buckminster.valuepath value="${fs:target.platform.repository}" />
<map from="" to="file:" />
</pathconvert>
<!-- create a list of all possible artifact repositories -->
<pathconvert property="artifact.repositories" dirsep="/" pathsep=",">
<buckminster.valuepath value="${fs:repositories}" />
<buckminster.valuepath value="${fs:artifact.repositories}" />
<!-- this is the real target platform location -->
<path location="${target.platform.location}" />
<map from="" to="file:" />
</pathconvert>
<condition property="wildcard" value="&quot;*&quot;" else="*">
<os family="windows" />
</condition>
</target>
<target name="-install.ius" if="${install.ius.property}">
<loadresource property="install.ius">
<propertyresource name="${install.ius.property}" />
</loadresource>
<pathconvert property="bundle.pools" dirsep="/" pathsep="|" setonempty="false">
<path path="${default.bundle.pools}" />
<buckminster.valuepath value="${fs:install.pools}" />
<map from="" to="file:" />
</pathconvert>
<condition property="profile.properties" value="${bundle.pools.property.name}=${bundle.pools},${install.features.property.name}=${install.features}" else="${install.features.property.name}=${install.features}">
<isset property="bundle.pools" />
</condition>
<java jar="${launcher.jar}" fork="true" failonerror="true">
<arg value="-consolelog" />
<arg value="-application" />
<arg value="org.eclipse.equinox.p2.director" />
<arg value="-metadataRepository" />
<arg value="${metadata.repositories}" />
<arg value="-artifactRepository" />
<arg value="${artifact.repositories}" />
<arg value="-destination" />
<arg value="${sp:output}" />
<arg value="-profile" />
<arg value="Install" />
<arg value="-profileproperties" />
<arg value="${profile.properties}" />
<arg value="-installIU" />
<arg value="${install.ius}" />
<arg value="-p2.os" />
<arg value="${wildcard}" />
<arg value="-p2.ws" />
<arg value="${wildcard}" />
<arg value="-p2.arch" />
<arg value="${wildcard}" />
</java>
<!-- remove the p2 profile as this is not a real product -->
<delete dir="${sp:output}" includeEmptyDirs="true">
<include name="p2/**" />
<include name=".artifactlock/**" />
</delete>
</target>
<target name="install.ius" depends="-define.install.properties">
<delete dir="${sp:output}" />
<!-- install the specified IUs -->
<antcall target="-install.ius">
<param name="install.ius.property" value="ius" />
<param name="default.bundle.pools" value="${target.platform.bundle.pool.path}" />
</antcall>
<!-- install the specified target platform IUs -->
<antcall target="-install.ius">
<param name="install.ius.property" value="target.platform.ius" />
<param name="default.bundle.pools" value="" />
</antcall>
</target>
<target name="-appoint.single.install.pool" if="sp:install.pools">
<property name="gathered.pools.directory" location="${sp:install.pools}" />
</target>
<target name="-gather.install.pools" depends="-appoint.single.install.pool,-define.package.name.stem" unless="gathered.pools.directory">
<property name="gathered.pools.directory" location="${package.name.stem}" />
<delete dir="${gathered.pools.directory}" />
<mkdir dir="${gathered.pools.directory}" />
<!-- set default -->
<property name="fs:install.pools" value="" />
<buckminster.copy todir="${gathered.pools.directory}">
<buckminster.filesetgroup value="${fs:install.pools}" />
</buckminster.copy>
</target>
<target name="-define.empty.licese.files.resource.set" unless="sp:license.files">
<!-- this is intended to produce an empty zipfileset (cf. with the condition in the target) -->
<zipfileset dir="${basedir}" id="license.files">
<selector if="sp:license.files" />
</zipfileset>
</target>
<target name="-define.license.files.resource.set" depends="-define.empty.licese.files.resource.set" if="sp:license.files">
<!-- define a zipfileset containing all license files and specifying their location in the resulting zip file -->
<zipfileset id="license.files" dir="${sp:license.files}" prefix="${license.files.directory}" />
</target>
<target name="-define.package.ius.properties">
<!-- set defaults -->
<property name="top.directory" value="eclipse" />
<property name="license.files.directory" value="${top.directory}" />
</target>
<target name="package.ius" depends="-define.package.ius.properties,-gather.install.pools,-define.license.files.resource.set">
<mkdir dir="${sp:output}" />
<zip destfile="${package.name.stem}.zip">
<zipfileset dir="${gathered.pools.directory}" prefix="${top.directory}">
<exclude name="artifacts.xml" />
</zipfileset>
<zipfileset refid="license.files" />
</zip>
<!-- cleanup (the directory is present only if fs:install.pools appointed more than one install pool) -->
<delete dir="${package.name.stem}" />
</target>
<target name="-define.package.models.properties">
<!-- set defaults -->
<property name="top.directory" value="models" />
<property name="license.files.directory" value="" />
</target>
<target name="package.models" depends="-define.package.models.properties,-gather.install.pools,-define.license.files.resource.set">
<property name="plugins.directory" location="${gathered.pools.directory}/plugins" />
<property name="models.directory" location="${package.name.stem}/models" />
<property name="stamp.file.name" value=".stamp" />
<delete dir="${models.directory}" />
<!--
create a separate subdirectory of the models directory for each bundle found
in the plugins subdirectory of the gathered install pools directory
-->
<touch mkdirs="true" verbose="false">
<fileset dir="${plugins.directory}">
<include name="*.jar" />
<type type="file" />
</fileset>
<globmapper from="*.jar" to="${models.directory}/*/${stamp.file.name}" />
</touch>
<touch mkdirs="true" verbose="false">
<fileset dir="${plugins.directory}">
<include name="*" />
<type type="dir" />
</fileset>
<globmapper from="*" to="${models.directory}/*/${stamp.file.name}" />
</touch>
<!--
now call the "-extract.model.files" target for every subdirectory created
by the <touch> tasks above
-->
<subant genericantfile="${ant.file}" target="-extract.model.files" inheritall="true">
<dirset dir="${models.directory}">
<include name="*" />
</dirset>
</subant>
<!--
delete the .stamp files and also subdirectories which become empty as a result
(i.e. subdirectories corresponding to bundles containing no model files)
-->
<delete dir="${models.directory}" includeemptydirs="true">
<include name="*/${stamp.file.name}" />
<include name="*" />
</delete>
<zip destfile="${package.name.stem}.zip">
<zipfileset dir="${models.directory}" prefix="${top.directory}" />
<zipfileset refid="license.files" />
</zip>
<!-- cleanup -->
<delete dir="${package.name.stem}" />
</target>
<target name="-define.plugin.properties">
<pathconvert property="plugin.location.stem">
<path location="${basedir}" />
<map from="${models.directory}" to="${plugins.directory}" />
</pathconvert>
<property name="plugin.location" value="${plugin.location.stem}.jar" />
<available property="jar.based.plugin" file="${plugin.location}" type="file" />
<property name="about.file.name" value="about.html" />
<patternset id="model.files">
<include name="model/**" />
<include name="cache/**" />
<include name="${about.file.name}" />
</patternset>
</target>
<target name="-define.zip.resource.set" depends="-define.plugin.properties" if="jar.based.plugin">
<!-- define a resource set for a jar file based plugin -->
<zipfileset id="model.files.resource.set" src="${plugin.location}">
<patternset refid="model.files" />
</zipfileset>
</target>
<target name="-define.file.resource.set" depends="-define.plugin.properties" unless="jar.based.plugin">
<!-- define a resource set for a directory based plugin -->
<fileset id="model.files.resource.set" dir="${plugin.location.stem}">
<patternset refid="model.files" />
</fileset>
</target>
<target name="-define.model.files.resource.set" depends="-define.zip.resource.set,-define.file.resource.set">
<condition property="model.files.present">
<resourcecount when="greater" count="0">
<restrict>
<resources refid="model.files.resource.set" />
<not xmlns="antlib:org.apache.tools.ant.types.resources.selectors">
<name name="${about.file.name}" />
</not>
</restrict>
</resourcecount>
</condition>
</target>
<target name="-extract.model.files" depends="-define.model.files.resource.set" if="model.files.present">
<!-- copy the model files -->
<copy todir="${basedir}">
<resources refid="model.files.resource.set" />
</copy>
</target>
</project>