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