Blame SOURCES/eclipse-pdebuild-add-target.patch

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