[jbosstools-commits] JBoss Tools SVN: r22803 - trunk/build/target-platform.

jbosstools-commits at lists.jboss.org jbosstools-commits at lists.jboss.org
Tue Jun 15 01:35:11 EDT 2010


Author: nickboldt
Date: 2010-06-15 01:35:11 -0400 (Tue, 15 Jun 2010)
New Revision: 22803

Modified:
   trunk/build/target-platform/e36-wtp32.target
   trunk/build/target-platform/install.xml
   trunk/build/target-platform/target2ant.xsl
Log:
https://jira.jboss.org/browse/JBDS-1247 refactoring + generate update site + metadata + run p2.director

Modified: trunk/build/target-platform/e36-wtp32.target
===================================================================
--- trunk/build/target-platform/e36-wtp32.target	2010-06-14 23:32:48 UTC (rev 22802)
+++ trunk/build/target-platform/e36-wtp32.target	2010-06-15 05:35:11 UTC (rev 22803)
@@ -24,6 +24,15 @@
 <repository location="http://m2eclipse.sonatype.org/sites/m2e-extras/"/>
 </location>
 <location includeAllPlatforms="false" includeMode="planner" type="InstallableUnit">
+<repository location="http://eclipse.svnkit.com/1.3.x/"/>
+</location>
+<location includeAllPlatforms="false" includeMode="planner" type="InstallableUnit">
+<repository location="http://www.polarion.org/projects/subversive/download/eclipse/2.0/update-site/"/>
+</location>
+<location includeAllPlatforms="false" includeMode="planner" type="InstallableUnit">
+<repository location="http://download.eclipse.org/technology/subversive/0.7/update-site/"/>
+</location>
+<location includeAllPlatforms="false" includeMode="planner" type="InstallableUnit">
 <unit id="javax.wsdl" version="1.6.2.v201005080631"/>
 <repository location="http://download.eclipse.org/tools/orbit/downloads/drops/R20100519200754/updateSite/"/>
 </location>
@@ -68,14 +77,12 @@
 <unit id="org.eclipse.platform.ide" version="3.6.0.I20100603-1500"/>
 <repository location="http://download.eclipse.org/eclipse/updates/3.6milestones/"/>
 </location>
-<!--
-&lt;location includeAllPlatforms="false" includeMode="planner" type="InstallableUnit"&gt;
-&lt;repository location="http://download.eclipse.org/rt/ecf/3.2/3.6/site.p2"/&gt;
-&lt;/location&gt;
-&lt;location includeAllPlatforms="false" includeMode="planner" type="InstallableUnit"&gt;
-&lt;repository location="http://download.eclipse.org/modeling/emf/emf/updates/2.6/"/&gt;
-&lt;/location&gt;
--->
+<location includeAllPlatforms="false" includeMode="planner" type="InstallableUnit">
+<repository location="http://download.eclipse.org/rt/ecf/3.2/3.6/site.p2"/>
+</location>
+<location includeAllPlatforms="false" includeMode="planner" type="InstallableUnit">
+<repository location="http://download.eclipse.org/modeling/emf/emf/updates/2.6/"/>
+</location>
 </locations>
 <targetJRE path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
 </target>

Modified: trunk/build/target-platform/install.xml
===================================================================
--- trunk/build/target-platform/install.xml	2010-06-14 23:32:48 UTC (rev 22802)
+++ trunk/build/target-platform/install.xml	2010-06-15 05:35:11 UTC (rev 22803)
@@ -1,24 +1,40 @@
 <project default="run" basedir="." name="Install a target platform into local Eclipse">
 	<!-- To fetch a number of features remote repo(s) and mirror them locally, run this in target/platform dir:
 	
-		~/eclipse/36clean/eclipse/eclipse -nosplash -data /tmp/workspace -consolelog \
-			-application org.eclipse.ant.core.antRunner -f install.xml \
-			-Dtarget.to.install=e36-wtp32.target \
-			-Declipse.install.dir=/path/to/install/dir | tee log.txt
+		~/eclipse/36clean/eclipse/eclipse -vm /opt/sun-java2-6.0/bin/java -nosplash \
+		    -data /tmp/workspace -consolelog -application org.eclipse.ant.core.antRunner \
+		    -f ./install.xml \
+			  -Dtarget.to.install=e36-wtp32.target \
+			  -Drepo.dir=/tmp/p2.mirror \
+			  -Dinstall.dir=/home/nboldt/eclipse/36clean2/eclipse \
+			| tee log.txt
+			
+			ALTERNATIVE PLAN:
+			
+			generate metadata (content.xml) for file:/home/nboldt/eclipse/workspace-clean36/.metadata/.plugins/org.eclipse.pde.core/.bundle_pool/
+			install from there (already on disk)
 	-->
 
-	<!-- what target file should be installed? -->
+	<!-- what target file to be installed -->
 	<property name="target.to.install" value="e36-wtp32.target" />
 
-	<!-- where should this target be installed? Into ${eclipse.home} or /path/to/eclipse -->
-	<!-- <property name="eclipse.install.dir" value="${eclipse.home}" /> -->
-	<property name="eclipse.install.dir" value="/home/nboldt/eclipse/36clean2/eclipse" />
+	<!-- where to download and create mirror repo -->
+	<property name="repo.dir" value="/tmp/p2.mirror" />
 
-	<target name="init" unless="eclipse.install.dir">
-		<fail>Must set -Declipse.install.dir=/path/to/install/</fail>
+	<!-- where to install target: into ${eclipse.home} or /path/to/eclipse -->
+	<!-- <property name="install.dir" value="${eclipse.home}" /> -->
+	<!-- <property name="install.dir" value="/home/nboldt/eclipse/36clean2/eclipse" /> -->
+
+	<target name="init" unless="install.dir">
+		<fail>Must set these properties:
+  -Dtarget.to.install=e36-wtp32.target
+  -Drepo.dir=/tmp/p2.mirror
+  -Dinstall.dir=/home/nboldt/eclipse/36clean2/eclipse
+</fail>
 	</target>
 
-	<target name="run" depends="init" if="eclipse.install.dir">
+	<target name="run" depends="init" if="install.dir">
+		<mkdir dir="${repo.dir}" />
 
 		<!-- create p2.mirror ant script -->
 		<property name="mirror" value="p2.mirror.xml" />
@@ -26,13 +42,128 @@
 
 		<!-- run generated p2.mirror ant script -->
 		<ant antfile="p2.mirror.xml">
-			<property name="eclipse.install.dir" value="${eclipse.install.dir}" />
+			<property name="repo.dir" value="${repo.dir}" />
 		</ant>
 
+		<!-- generate a site.xml for all the features available -->
+		<antcall target="buildSiteXml" />
+
+		<!-- generate metadata -->
+		<!-- TODO: switch to use Publisher: http://wiki.eclipse.org/Equinox/p2/Publisher#Features_and_Bundles_Publisher_Task
+		<p2.publish.featuresAndBundles
+    metadataRepository="file:/repository/location"
+    artifactRepository="file:/repository/location"
+    publishArtifacts="true"
+    compress="true"
+    source="/bundles/and/features/location/">
+    	-->
+		<java classname="org.eclipse.equinox.launcher.Main"
+		      fork="true"
+		      timeout="10800000"
+		      jvm="${java.home}/bin/java"
+		      failonerror="false"
+		      maxmemory="512m"
+		      taskname="p2"
+		>
+			<classpath>
+				<fileset dir="${eclipse.home}/plugins"
+				         includes="org.eclipse.equinox.launcher_*.jar, org.eclipse.equinox.p2.metadata.generator_*.jar"
+				/>
+				<pathelement location="${eclipse.home}/plugins" />
+			</classpath>
+			<arg line="-application org.eclipse.equinox.p2.metadata.generator.EclipseGenerator" />
+			<arg line=" -updateSite ${repo.dir}/ -site file:${repo.dir}/site.xml" />
+			<arg line="-metadataRepository file://${repo.dir} -metadataRepositoryName &quot;Local Mirror Repo&quot;" />
+			<arg line="-artifactRepository file://${repo.dir} -artifactRepositoryName &quot;Local Mirror Artifacts&quot;"
+			/>
+			<arg line="-compress -noDefaultIUs -reusePack200Files" />
+		</java>
+
 		<!-- cleanup -->
 		<delete file="${mirror}" quiet="true" />
 
-		<!-- TODO: run p2.director to install from mirror into eclipse -->
+		<!-- run p2.director to install from repo.dir into install.dir -->
+		<chmod perm="+x" file="${eclipse.home}/eclipse" />
+		<exec executable="${eclipse.home}/eclipse"
+		      failonerror="true"
+		      dir="${eclipse.home}"
+		      timeout="900000"
+		      taskname="p2.dir"
+		>
+			<arg line=" -vm ${java.home}/bin/java" />
+			<arg line=" -application org.eclipse.equinox.p2.director" />
+			<arg line=" -nosplash --launcher.suppressErrors -consoleLog -flavor tooling -roaming -profile SDKProfile" />
+			<!-- <arg line=" -installIU ... -installIU ... " /> -->
+			<arg line=" -destination ${install.dir} -bundlepool ${install.dir}" />
+			<arg line=" -metadataRepository file://${repo.dir} -artifactRepository file://${repo.dir}" />
+			<arg line=" -profileProperties org.eclipse.update.install.features=true" />
+			<arg line=" -vmargs -Declipse.p2.data.area=${install.dir}/p2 -Declipse.p2.MD5Check=false" />
+		</exec>
+	</target>
 
+	<target name="buildSiteXml" description="Generate a site.xml to contain the features in a category">
+		<echo level="info">Generating site.xml for use with p2 repo / update site categories...</echo>
+		<echo file="${repo.dir}/site.xml">&lt;?xml version="1.0" encoding="UTF-8"?&gt;</echo>
+		<if>
+			<equals arg1="${pack200Files}" arg2="-reusePack200Files" />
+			<then>
+				<echo append="true" file="${repo.dir}/site.xml">&lt;site pack200="true"&gt;</echo>
+			</then>
+			<else>
+				<echo append="true" file="${repo.dir}/site.xml">&lt;site&gt;</echo>
+			</else>
+		</if>
+
+		<property name="category.name" value="Subversive Repo" />
+
+		<echo append="true" file="${repo.dir}/site.xml">	&lt;description&gt;To install these features, point Eclipse at this site.&lt;/description&gt;
+
+		&lt;!-- ${category.name} --&gt;
+		&lt;category-def label="${category.name}" name="${category.name}"&gt;
+			&lt;description&gt;${category.name}: contains all features in this build.&lt;/description&gt;
+		&lt;/category-def&gt;
+	</echo>
+
+		<for param="featureJar">
+			<path>
+				<fileset dir="${repo.dir}/features" includes="*.jar" />
+			</path>
+			<sequential>
+				<var name="feature.jarfile" unset="true" />
+				<var name="feature.id" unset="true" />
+				<var name="feature.version" unset="true" />
+				<propertyregex property="feature.jarfile"
+				               defaultvalue="@{featureJar}"
+				               input="@{featureJar}"
+				               regexp=".+/features/([^/]+\.jar)"
+				               replace="\1"
+				               override="true"
+				/>
+				<propertyregex property="feature.id"
+				               defaultvalue="${feature.jarfile}"
+				               input="${feature.jarfile}"
+				               regexp="([^_]+)_(\d+\.\d+\.\d+\..+)\.jar"
+				               replace="\1"
+				               override="true"
+				/>
+				<propertyregex property="feature.version"
+				               defaultvalue="${feature.jarfile}"
+				               input="${feature.jarfile}"
+				               regexp="([^_]+)_(\d+\.\d+\.\d+\..+)\.jar"
+				               replace="\2"
+				               override="true"
+				/>
+				<echo append="true" file="${repo.dir}/site.xml">	&lt;feature id="${feature.id}" version="${feature.version}" url="features/${feature.jarfile}" patch="false"&gt;
+			&lt;category name="${category.name}"/&gt;
+		&lt;/feature&gt;
+	</echo>
+				<var name="feature.jarfile" unset="true" />
+				<var name="feature.id" unset="true" />
+				<var name="feature.version" unset="true" />
+			</sequential>
+		</for>
+		<echo append="true" file="${repo.dir}/site.xml">
+	&lt;/site&gt;
+	</echo>
 	</target>
 </project>

Modified: trunk/build/target-platform/target2ant.xsl
===================================================================
--- trunk/build/target-platform/target2ant.xsl	2010-06-14 23:32:48 UTC (rev 22802)
+++ trunk/build/target-platform/target2ant.xsl	2010-06-15 05:35:11 UTC (rev 22803)
@@ -1,46 +1,44 @@
 <?xml version="1.0" encoding="UTF-8" ?>
 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
-	version="2.0">
-	<!-- TODO: ? make p2.mirror step a single operation w/ a long list of IUs 
-		pulled from a list of sites, rather than from each site 
-	-->
-	<xsl:output method="xml" indent="yes" />
+	version="1.0">
+	<xsl:output method="xml" indent="yes" encoding="UTF-8"
+		version="1.0" />
 	<xsl:decimal-format decimal-separator="."
 		grouping-separator="," />
 
 	<xsl:param name="verbose" select="'false'" />
-	<xsl:param name="destination" select="'file:${eclipse.install.dir}'" />
+	<xsl:param name="destination" select="'file:${repo.dir}'" />
 
 	<xsl:variable name="platformFilter"
 		select="concat(/target/environment/os/text(), ',', /target/environment/ws/text(), ',', /target/environment/arch/text())" />
 
 	<xsl:template match="target">
-		<project name="Install target platform" default="install.target.platform">
+		<project name="Download target platform" default="download.target.platform">
 			<!-- use followStrict="true" to prevent downloading all requirements not 
 				included in the target platform or followStrict="false" to fetch everything -->
-			<target name="init" unless="eclipse.install.dir">
-				<fail>Must set -Declipse.install.dir=/path/to/install/</fail>
+			<target name="init" unless="repo.dir">
+				<fail>Must set -Drepo.dir=/path/to/download/artifacts/</fail>
 			</target>
-			<target name="install.target.platform" depends="init"
-				description="Install from target platform definition" if="eclipse.install.dir">
-				<echo>Install features/plugins into ${eclipse.install.dir}</echo>
-				<xsl:apply-templates />
+			<target name="download.target.platform" depends="init"
+				description="Download from target platform definition" if="repo.dir">
+				<echo level="info">Download features/plugins into ${repo.dir}</echo>
+				<p2.mirror destination="{$destination}" verbose="{$verbose}">
+					<slicingOptions includeFeatures="true" followStrict="false" />
+					<source>
+						<xsl:apply-templates select="//repository" />
+					</source>
+					<xsl:apply-templates select="//unit" />
+				</p2.mirror>
 			</target>
 		</project>
 	</xsl:template>
 
-	<xsl:template match="location">
-		<xsl:variable name="locationUrl" select="./repository/@location" />
-		<p2.mirror destination="{$destination}" verbose="{$verbose}">
-			<slicingOptions includeFeatures="true" followStrict="false" />
-			<source>
-				<repository location="{$locationUrl}" />
-			</source>
-			<xsl:apply-templates />
-		</p2.mirror>
+	<xsl:template match="//repository">
+		<xsl:variable name="locationUrl" select="./@location" />
+		<repository location="{$locationUrl}" />
 	</xsl:template>
 
-	<xsl:template match="unit">
+	<xsl:template match="//unit">
 		<iu id="{@id}" version="{@version}" />
 	</xsl:template>
 



More information about the jbosstools-commits mailing list