Andrew Overholt 1fcf3f
### Eclipse Workspace Patch 1.0
Andrew Overholt 1fcf3f
#P org.eclipse.pde.build
Andrew Overholt 1fcf3f
Index: templates/package-build/prepare-build-dir.sh
Ben Konrath 02a0b8
===================================================================
Andrew Overholt 1fcf3f
RCS file: templates/package-build/prepare-build-dir.sh
Andrew Overholt 1fcf3f
diff -N templates/package-build/prepare-build-dir.sh
Ben Konrath 02a0b8
--- /dev/null	1 Jan 1970 00:00:00 -0000
Andrew Overholt 1fcf3f
+++ templates/package-build/prepare-build-dir.sh	1 Jan 1970 00:00:00 -0000
Andrew Overholt 465153
@@ -0,0 +1,96 @@
Andrew Overholt 1fcf3f
+#!/bin/sh
Andrew Overholt 1fcf3f
+
Andrew Overholt 465153
+if [ $# -lt 2 ]; then 
Andrew Overholt 1fcf3f
+  echo "usage: $0 <path to="" source="" dir=""> <path to="" build="" dir="">"
Andrew Overholt 1fcf3f
+  exit 1
Andrew Overholt 1fcf3f
+fi
Andrew Overholt 1fcf3f
+
Andrew Overholt 1fcf3f
+if [ ! -d $1 ]; then
Andrew Overholt 1fcf3f
+  echo "usage: $0 <path to="" source="" dir=""> <path to="" build="" dir="">"
Andrew Overholt 1fcf3f
+  exit 1
Andrew Overholt 1fcf3f
+fi
Andrew Overholt 1fcf3f
+
Andrew Overholt 1fcf3f
+SOURCEDIR=$1
Andrew Overholt 1fcf3f
+BUILDDIR=$2
Andrew Overholt 465153
+TESTING=$3
Andrew Overholt 1fcf3f
+
Andrew Overholt 1fcf3f
+echo "preparing files in $1 for buildfile generation ..."
Andrew Overholt 1fcf3f
+mkdir -p $BUILDDIR
Andrew Overholt 1fcf3f
+
Andrew Overholt 1fcf3f
+# make some ant build files to extract the id from the feature.xml, plugin.xml or the fragment.xml
Andrew Overholt 1fcf3f
+mkdir -p $BUILDDIR/tmp
Andrew Overholt 1fcf3f
+BUILDFILE=$BUILDDIR/tmp/build.xml
Andrew Overholt 1fcf3f
+
Andrew Overholt 1fcf3f
+echo "<project default="\"main\"">
Andrew Overholt 1fcf3f
+	<target name="\"main\"">
Andrew Overholt 1fcf3f
+               	<xmlproperty file="\"@type@.xml\"" collapseattributes="\"true\"/">
Andrew Overholt 1fcf3f
+		<fail unless="\"@type@.id\"" message="\"feature.id" not="" set\"=""/>
Andrew Overholt 1fcf3f
+               	<echo message="\"\${@type@.id}\""/>
Andrew Overholt 1fcf3f
+        </target>
Andrew Overholt 1fcf3f
+</project>" > $BUILDFILE
Andrew Overholt 1fcf3f
+
Andrew Overholt 1fcf3f
+for type in feature plugin fragment; do
Andrew Overholt 1fcf3f
+  CURBUILDFILE=$BUILDDIR/tmp/$type-build.xml
Andrew Overholt 1fcf3f
+  cat $BUILDFILE | sed "s|@type@|$type|" > $CURBUILDFILE
Andrew Overholt 1fcf3f
+done
Andrew Overholt 1fcf3f
+
Andrew Overholt 1fcf3f
+# make the directories eclipse is expecting 
Andrew Overholt 1fcf3f
+echo "  making the 'features' and 'plugins' directories"
Andrew Overholt 1fcf3f
+mkdir -p $BUILDDIR/features $BUILDDIR/plugins
Andrew Overholt 1fcf3f
+
Andrew Overholt 1fcf3f
+# make symlinks for the features
Andrew Overholt 1fcf3f
+FEATURES=$(find $SOURCEDIR -name feature.xml)
Andrew Overholt 465153
+find $SOURCEDIR -name feature.xml | while read f; do
Andrew Overholt 465153
+  PROJECTDIR=$(dirname "$f")
Andrew Overholt 465153
+  PROJECTNAME=$(ant -Dbasedir="$PROJECTDIR" -f $BUILDDIR/tmp/feature-build.xml 2>&1 | grep echo | cut --delimiter=' ' -f 7)
Andrew Overholt 465153
+  ERROR=""
Andrew Overholt 465153
+  if [ -z "$PROJECTNAME" ]; then
Andrew Overholt 1fcf3f
+    echo "ERROR: could not determine the feature id for $PROJECTDIR"
Andrew Overholt 465153
+    if [ $TESTING != true ]; then
Andrew Overholt 465153
+      exit 1
Andrew Overholt 465153
+    else
Andrew Overholt 465153
+      ERROR="yes"
Andrew Overholt 465153
+    fi
Andrew Overholt 1fcf3f
+  fi
Andrew Overholt 1fcf3f
+
Andrew Overholt 465153
+  if [ "x$ERROR" != "xyes" ]; then
Andrew Overholt 465153
+    if [[ $TESTING != true || `echo $PROJECTNAME | grep "org.eclipse"` ]]; then
Andrew Overholt 465153
+    echo "  making symlink: $BUILDDIR/features/$PROJECTNAME -> $PROJECTDIR"
Andrew Overholt 465153
+    ln -sf "$PROJECTDIR" $BUILDDIR/features/"$PROJECTNAME"
Andrew Overholt 465153
+    fi
Andrew Overholt 465153
+  fi
Andrew Overholt 1fcf3f
+done
Andrew Overholt 1fcf3f
+
Andrew Overholt 1fcf3f
+# make symlinks for plugins and fragments
Andrew Overholt 1fcf3f
+PLUGINDIRS=$(find $SOURCEDIR -name plugin.xml -o -name fragment.xml -o -name MANIFEST.MF | sed "s/plugin.xml//g" | sed "s/fragment.xml//g" | sed "s/META-INF\/MANIFEST.MF//" | sort | uniq)
Andrew Overholt 465153
+find $SOURCEDIR -name plugin.xml -o -name fragment.xml -o -name MANIFEST.MF | sed "s/plugin.xml//g" | sed "s/fragment.xml//g" | sed "s/META-INF\/MANIFEST.MF//" | sort | uniq | while read dir; do
Andrew Overholt 1fcf3f
+  PROJECTNAME=""
Andrew Overholt 465153
+  ERROR=""
Andrew Overholt 465153
+  if [ -e "$dir/META-INF/MANIFEST.MF" ]; then
Andrew Overholt 1fcf3f
+    PROJECTNAME=$(grep Bundle-SymbolicName $dir/META-INF/MANIFEST.MF | cut --delimiter=';' -f 1 | cut --delimiter=' ' -f 2)
Andrew Overholt 465153
+  elif [ -e "$dir/plugin.xml" ]; then
Andrew Overholt 1fcf3f
+    PROJECTNAME=$(ant -Dbasedir=$dir -f $BUILDDIR/tmp/plugin-build.xml 2>&1 | grep echo | cut --delimiter=' ' -f 7)
Andrew Overholt 465153
+  elif [ -e "$dir/fragment.xml" ]; then
Andrew Overholt 1fcf3f
+    PROJECTNAME=$(ant -Dbasedir=$dir -f $BUILDDIR/tmp/fragment-build.xml 2>&1 | grep echo | cut --delimiter=' ' -f 7)
Andrew Overholt 1fcf3f
+  fi
Andrew Overholt 1fcf3f
+
Andrew Overholt 465153
+  if [ -z "$PROJECTNAME"  ]; then
Andrew Overholt 1fcf3f
+    echo "ERROR: could not determine the plugin or fragment id for $dir"
Andrew Overholt 465153
+    if [ $TESTING != true ]; then
Andrew Overholt 465153
+      exit 1
Andrew Overholt 465153
+    else
Andrew Overholt 465153
+      ERROR="yes"
Andrew Overholt 465153
+    fi
Andrew Overholt 1fcf3f
+  fi
Andrew Overholt 1fcf3f
+
Andrew Overholt 465153
+  if [ "x$ERROR" != "xyes" ]; then
Andrew Overholt 465153
+    if [[ $TESTING != true || `echo $PROJECTNAME | grep "org.eclipse"` ]]; then
Andrew Overholt 465153
+    echo "  making symlink: $BUILDDIR/plugins/$PROJECTNAME -> $dir"
Andrew Overholt 465153
+    ln -sf $dir $BUILDDIR/plugins/"$PROJECTNAME"
Andrew Overholt 465153
+    fi
Andrew Overholt 465153
+  fi;
Andrew Overholt 1fcf3f
+
Andrew Overholt 1fcf3f
+done 
Andrew Overholt 1fcf3f
+
Andrew Overholt 1fcf3f
+rm -rf $BUILDDIR/tmp
Andrew Overholt 1fcf3f
+echo done 
Ben Konrath 02a0b8
Index: templates/package-build/customTargets-assemble-target.xml
Ben Konrath 02a0b8
===================================================================
Ben Konrath 02a0b8
RCS file: templates/package-build/customTargets-assemble-target.xml
Ben Konrath 02a0b8
diff -N templates/package-build/customTargets-assemble-target.xml
Ben Konrath 02a0b8
--- /dev/null	1 Jan 1970 00:00:00 -0000
Ben Konrath 02a0b8
+++ templates/package-build/customTargets-assemble-target.xml	1 Jan 1970 00:00:00 -0000
Ben Konrath 02a0b8
@@ -0,0 +1,12 @@
Ben Konrath 02a0b8
+<project>
Ben Konrath 02a0b8
+	
Ben Konrath 02a0b8
+	
Ben Konrath 02a0b8
+	
Ben Konrath 02a0b8
+	
Ben Konrath 02a0b8
+	
Ben Konrath 02a0b8
+	
Ben Konrath 02a0b8
+
Ben Konrath 02a0b8
+	<target name="assemble.@id@">
Ben Konrath 02a0b8
+		<ant antfile="${assembleScriptName}" dir="${buildDirectory}"/>
Ben Konrath 02a0b8
+	</target>
Ben Konrath 02a0b8
+</project>
Ben Konrath 02a0b8
Index: templates/package-build/customTargets.xml
Ben Konrath 02a0b8
===================================================================
Ben Konrath 02a0b8
RCS file: templates/package-build/customTargets.xml
Ben Konrath 02a0b8
diff -N templates/package-build/customTargets.xml
Ben Konrath 02a0b8
--- /dev/null	1 Jan 1970 00:00:00 -0000
Ben Konrath 02a0b8
+++ templates/package-build/customTargets.xml	1 Jan 1970 00:00:00 -0000
Andrew Overholt 1fcf3f
@@ -0,0 +1,147 @@
Ben Konrath 02a0b8
+<project name="Build specific targets and properties" default="noDefault">
Ben Konrath 02a0b8
+
Ben Konrath 02a0b8
+	<fail unless="type" message="Please set the ${type} property to 'feature', 'plugin' or 'fragment'."/>
Ben Konrath 02a0b8
+	<fail unless="id" message="Please set the ${id} property to the feature, plugin or fragment id of the plugin you are building."/>
Ben Konrath 02a0b8
+	<fail unless="sourceDirectory" message="Please set the ${sourceDirectory} property to the directory that has the source plugins."/>
Ben Konrath 02a0b8
+
Ben Konrath 02a0b8
+		
Ben Konrath 02a0b8
+	<copy file="${builder}/customTargets-assemble-target.xml" tofile="${buildDirectory}/customTargets-${id}-assemble-target.xml"/> 
Ben Konrath 02a0b8
+	<replace file="${buildDirectory}/customTargets-${id}-assemble-target.xml" token="@id@" value="${id}"/>
Ben Konrath 02a0b8
+	<import file="${buildDirectory}/customTargets-${id}-assemble-target.xml"/>
Ben Konrath 02a0b8
+
Ben Konrath 02a0b8
+	
Ben Konrath 02a0b8
+	
Ben Konrath 02a0b8
+	
Ben Konrath 02a0b8
+	
Ben Konrath 02a0b8
+	<target name="allElements">
Ben Konrath 02a0b8
+		<ant antfile="${genericTargets}" target="${target}">
Ben Konrath 02a0b8
+			<property name="type" value="${type}"/>
Ben Konrath 02a0b8
+			<property name="id" value="${id}"/>
Ben Konrath 02a0b8
+		</ant>
Ben Konrath 02a0b8
+	</target>
Ben Konrath 02a0b8
+
Ben Konrath 02a0b8
+	
Ben Konrath 02a0b8
+	
Ben Konrath 02a0b8
+	
Ben Konrath 02a0b8
+	
Ben Konrath 02a0b8
+	<target name="getMapFiles">
Ben Konrath 02a0b8
+	</target>
Ben Konrath 02a0b8
+
Ben Konrath 02a0b8
+	
Ben Konrath 02a0b8
+
Ben Konrath 02a0b8
+	<target name="clean" unless="noclean">
Ben Konrath 02a0b8
+		<antcall target="allElements">
Ben Konrath 02a0b8
+			<param name="target" value="cleanElement"/>
Ben Konrath 02a0b8
+		</antcall>
Ben Konrath 02a0b8
+	</target>
Ben Konrath 02a0b8
+
Ben Konrath 02a0b8
+	
Ben Konrath 02a0b8
+	
Ben Konrath 02a0b8
+	
Ben Konrath 02a0b8
+	<target name="preSetup">
Ben Konrath 02a0b8
+	</target>
Ben Konrath 02a0b8
+
Ben Konrath 02a0b8
+	
Ben Konrath 02a0b8
+	
Ben Konrath 02a0b8
+	
Ben Konrath 02a0b8
+	<target name="postSetup">
Ben Konrath 02a0b8
+	</target>
Ben Konrath 02a0b8
+
Ben Konrath 02a0b8
+	
Ben Konrath 02a0b8
+	
Ben Konrath 02a0b8
+	
Ben Konrath 02a0b8
+	<target name="preFetch">
Ben Konrath 02a0b8
+	</target>
Ben Konrath 02a0b8
+
Ben Konrath 02a0b8
+	
Ben Konrath 02a0b8
+	
Ben Konrath 02a0b8
+	
Ben Konrath 02a0b8
+	<target name="postFetch">
Ben Konrath 02a0b8
+	</target>
Ben Konrath 02a0b8
+
Ben Konrath 02a0b8
+	
Ben Konrath 02a0b8
+	
Ben Konrath 02a0b8
+	
Ben Konrath 02a0b8
+	<target name="preGenerate">
Ben Konrath 02a0b8
+		
Ben Konrath 02a0b8
+   		plugin projects to be in the 'plugins' directory. The build infrastructure 
Ben Konrath 02a0b8
+		normally arranges the projects during the fetch stage. Since we aren't doing
Ben Konrath 02a0b8
+ 		the fetch stage, we have to manually arrange the files -->
Ben Konrath 02a0b8
+		<exec dir="${builder}" executable="/bin/sh">
Andrew Overholt 465153
+			<arg line="prepare-build-dir.sh ${sourceDirectory} ${buildDirectory} ${testing}"/>
Andrew Overholt 1fcf3f
+		</exec>
Andrew Overholt 1fcf3f
+		<exec dir="${builder}" executable="/bin/sh">
Andrew Overholt 1fcf3f
+		    <arg line="symlink-deps.sh ${buildDirectory} ${orbitDepsDir}"/>
Ben Konrath 02a0b8
+		</exec> 
Ben Konrath 02a0b8
+
Ben Konrath 02a0b8
+	</target>
Ben Konrath 02a0b8
+
Ben Konrath 02a0b8
+	
Ben Konrath 02a0b8
+	
Ben Konrath 02a0b8
+	
Ben Konrath 02a0b8
+	<target name="postGenerate">
Ben Konrath 02a0b8
+		<antcall target="clean"/>
Ben Konrath 02a0b8
+	</target>
Ben Konrath 02a0b8
+
Ben Konrath 02a0b8
+	
Ben Konrath 02a0b8
+	
Ben Konrath 02a0b8
+	
Ben Konrath 02a0b8
+	<target name="preProcess">
Ben Konrath 02a0b8
+	</target>
Ben Konrath 02a0b8
+
Ben Konrath 02a0b8
+	
Ben Konrath 02a0b8
+	
Ben Konrath 02a0b8
+	
Ben Konrath 02a0b8
+	<target name="postProcess">
Ben Konrath 02a0b8
+	</target>
Ben Konrath 02a0b8
+
Ben Konrath 02a0b8
+	
Ben Konrath 02a0b8
+	
Ben Konrath 02a0b8
+	
Ben Konrath 02a0b8
+	<target name="preAssemble">
Ben Konrath 02a0b8
+	</target>
Ben Konrath 02a0b8
+
Ben Konrath 02a0b8
+	
Ben Konrath 02a0b8
+	
Ben Konrath 02a0b8
+	
Ben Konrath 02a0b8
+	<target name="postAssemble">
Ben Konrath 02a0b8
+	</target>
Ben Konrath 02a0b8
+
Ben Konrath 02a0b8
+	
Ben Konrath 02a0b8
+	
Ben Konrath 02a0b8
+	
Ben Konrath 02a0b8
+	<target name="prePackage">
Ben Konrath 02a0b8
+	</target>
Ben Konrath 02a0b8
+
Ben Konrath 02a0b8
+	
Ben Konrath 02a0b8
+	
Ben Konrath 02a0b8
+	
Ben Konrath 02a0b8
+	<target name="postPackage">
Ben Konrath 02a0b8
+	</target>
Ben Konrath 02a0b8
+
Ben Konrath 02a0b8
+	
Ben Konrath 02a0b8
+	
Ben Konrath 02a0b8
+	
Ben Konrath 02a0b8
+	<target name="postBuild">
Ben Konrath 02a0b8
+	</target>
Ben Konrath 02a0b8
+
Ben Konrath 02a0b8
+	
Ben Konrath 02a0b8
+	
Ben Konrath 02a0b8
+	
Ben Konrath 02a0b8
+	<target name="test">
Ben Konrath 02a0b8
+	</target>
Ben Konrath 02a0b8
+
Ben Konrath 02a0b8
+	
Ben Konrath 02a0b8
+	
Ben Konrath 02a0b8
+	
Ben Konrath 02a0b8
+	<target name="publish">
Ben Konrath 02a0b8
+	</target>
Ben Konrath 02a0b8
+
Ben Konrath 02a0b8
+	
Ben Konrath 02a0b8
+	
Ben Konrath 02a0b8
+	
Ben Konrath 02a0b8
+	<target name="noDefault">
Ben Konrath 02a0b8
+		<echo message="You must specify a target when invoking this file"/>
Ben Konrath 02a0b8
+	</target>
Ben Konrath 02a0b8
+
Ben Konrath 02a0b8
+</project>
Andrew Overholt 1fcf3f
Index: templates/package-build/build.properties
Ben Konrath 02a0b8
===================================================================
Andrew Overholt 1fcf3f
RCS file: templates/package-build/build.properties
Andrew Overholt 1fcf3f
diff -N templates/package-build/build.properties
Ben Konrath 02a0b8
--- /dev/null	1 Jan 1970 00:00:00 -0000
Andrew Overholt 1fcf3f
+++ templates/package-build/build.properties	1 Jan 1970 00:00:00 -0000
Andrew Overholt 58053f
@@ -0,0 +1,12 @@
Andrew Overholt 1fcf3f
+buildDirectory=${sourceDirectory}/build
Andrew Overholt 1fcf3f
+buildLabel=rpmBuild
Andrew Overholt 1fcf3f
+archivePrefix=eclipse
Andrew Overholt 1fcf3f
+skipFetch=true
Andrew Overholt 1fcf3f
+javacFailOnError=true
Andrew Overholt 1fcf3f
+collectingFolder=eclipse
Andrew Overholt 1fcf3f
+archivesFormat=*,*,*-zip
Andrew Overholt 1fcf3f
+zipargs=-y
Andrew Overholt 1fcf3f
+javacDebugInfo=true
Andrew Overholt 1fcf3f
+archiveName=${id}.zip
Andrew Overholt 1fcf3f
+runPackager=false
Andrew Overholt 1fcf3f
+baseLocation=/usr/share/eclipse
Andrew Overholt 1fcf3f
Index: templates/package-build/symlink-deps.sh
Andrew Overholt 1fcf3f
===================================================================
Andrew Overholt 1fcf3f
RCS file: templates/package-build/symlink-deps.sh
Andrew Overholt 1fcf3f
diff -N templates/package-build/symlink-deps.sh
Andrew Overholt 1fcf3f
--- /dev/null	1 Jan 1970 00:00:00 -0000
Andrew Overholt 1fcf3f
+++ templates/package-build/symlink-deps.sh	1 Jan 1970 00:00:00 -0000
Andrew Overholt 1fcf3f
@@ -0,0 +1,21 @@
Andrew Overholt 1fcf3f
+#!/bin/sh -x
Ben Konrath 02a0b8
+
Ben Konrath 02a0b8
+if [ $# -ne 2 ]; then 
Andrew Overholt 1fcf3f
+  echo "usage: $0 <path to="" build="" dir=""> <dependencies>"
Ben Konrath 02a0b8
+  exit 1
Ben Konrath 02a0b8
+fi
Ben Konrath 02a0b8
+
Ben Konrath 02a0b8
+if [ ! -d $1 ]; then
Andrew Overholt 1fcf3f
+  echo "usage: $0 <path to="" build="" dir=""> <dependencies>"
Ben Konrath 02a0b8
+  exit 1
Ben Konrath 02a0b8
+fi
Ben Konrath 02a0b8
+
Andrew Overholt 1fcf3f
+BUILDDIR=$1
Andrew Overholt 1fcf3f
+DEPENDENCIESDIR=$2
Ben Konrath 02a0b8
+
Andrew Overholt 1fcf3f
+pushd $BUILDDIR/plugins
Andrew Overholt 1fcf3f
+  for dep in `ls $DEPENDENCIESDIR`; do
Andrew Overholt 1fcf3f
+      echo "ln -s $DEPENDENCIESDIR/$dep"
Andrew Overholt 1fcf3f
+      ln -s $DEPENDENCIESDIR/$dep
Andrew Overholt 1fcf3f
+  done
Andrew Overholt 1fcf3f
+popd