Blob Blame History Raw
#!/bin/sh

# Generate a source drop for an eclipse.org project (tailored a bit for EMF)

# Usage message
usage="usage: $0 <project_name> <cvs_root> <cvs_tag> <cvs_directory>"

project_name=$1
cvs_root=$2
cvs_tag=$3
cvs_directory=$4

# Ensure we got all of the variables
if [ "x$project_name"x = "xx" ]
then
        echo >&2 "$usage"
        exit 1
fi

if [ "x$cvs_root"x = "xx" ]
then
        echo >&2 "$usage"
        exit 1
fi

if [ "x$cvs_tag"x = "xx" ]
then
        echo >&2 "$usage"
        exit 1
fi

if [ "x$cvs_directory"x = "xx" ]
then
        echo >&2 "$usage"
        exit 1
fi

mkdir -p temp/home && cd temp
touch home/.cvspass
cvs -d $cvs_root co -r $cvs_tag $cvs_directory
pushd $cvs_directory

# These patches do the following:
#   1. add a fetch target to grab the source
#   2. make it so that we don't have to strip the version at source grab time
#      (and thus depend upon org.eclipse.releng

patch -p0 << _EOF_

Index: build.xml
===================================================================
RCS file: /home/tools/org.eclipse.emf.releng.build/build.xml,v
retrieving revision 1.14
diff -u -p -r1.14 build.xml
--- build.xml	7 Nov 2005 20:37:26 -0000	1.14
+++ build.xml	25 Oct 2006 18:07:28 -0000
@@ -44,4 +44,16 @@
 			<property name="builder" value="\${basedir}/\${component}" />
 		</ant>
 	</target>
-</project>
\ No newline at end of file
+
+        <target name="fetch" depends="init">
+                <ant antfile="build.xml" dir="\${pde.build.scripts}"
+                                target="preBuild">
+                        <property name="builder" value="\${basedir}/\${component}" />
+                </ant>
+                <ant antfile="build.xml" dir="\${pde.build.scripts}"
+                                target="fetch">
+                        <property name="builder" value="\${basedir}/\${component}" />
+                </ant>
+        </target>
+
+</project>
Index: sdk/customTargets.xml
===================================================================
RCS file: /home/tools/org.eclipse.emf.releng.build/sdk/customTargets.xml,v
retrieving revision 1.36
diff -u -p -r1.36 customTargets.xml
--- sdk/customTargets.xml	17 Jul 2006 00:02:48 -0000	1.36
+++ sdk/customTargets.xml	25 Oct 2006 17:59:33 -0000
@@ -28,7 +28,6 @@
   <!-- Replace values for cvsRoot, package and mapVersionTag as desired. -->
   <!-- ===================================================================== -->
   <target name="checkLocal">
-    <available property="mapsLocal" file="\${buildDirectory}/maps/org.eclipse.emf" />
   </target>
 
   <target name="getMapFiles" depends="checkLocal" unless="mapsLocal">
@@ -206,11 +205,11 @@
   </target>
 
   <target name="getBaseInit">
-    <taskdef name="stripVersions" classname="org.eclipse.releng.VersionNumberStripper" />
     <property file="\${buildDirectory}/maps/org.eclipse.emf/build.cfg" />
   </target>
 
   <target name="getBaseEclipse" unless="baseExists" depends="getBaseInit">
+    <taskdef name="stripVersions" classname="org.eclipse.releng.VersionNumberStripper" />
     <!-- if there's already an existing eclipse zip by the same name in the dest folder, don't download it again! -->
     <available file="\${downloadsDir}/\${eclipseFile}" property="baseZipExists" />
     <antcall target="downloadBaseEclipse" />
Index: examples/customTargets.xml
===================================================================
RCS file: /home/tools/org.eclipse.emf.releng.build/examples/customTargets.xml,v
retrieving revision 1.16
diff -u -p -r1.16 customTargets.xml
--- examples/customTargets.xml	24 Aug 2006 14:47:17 -0000	1.16
+++ examples/customTargets.xml	25 Oct 2006 17:59:33 -0000
@@ -27,7 +27,6 @@
   <!-- Replace values for cvsRoot, package and mapVersionTag as desired. -->
   <!-- ===================================================================== -->
   <target name="checkLocal">
-    <available property="mapsLocal" file="\${buildDirectory}/maps/org.eclipse.emf" />
   </target>
 
   <target name="getMapFiles" depends="checkLocal" unless="mapsLocal">
@@ -179,11 +178,11 @@
   </target>
 
   <target name="getBaseInit">
-    <taskdef name="stripVersions" classname="org.eclipse.releng.VersionNumberStripper" />
     <property file="\${buildDirectory}/maps/org.eclipse.emf/build.cfg" />
   </target>
 
   <target name="getBaseEclipse" unless="baseExists" depends="getBaseInit">
+    <taskdef name="stripVersions" classname="org.eclipse.releng.VersionNumberStripper" />
     <!-- if there's already an existing eclipse zip by the same name in the dest folder, don't download it again! -->
     <available file="\${downloadsDir}/\${eclipseFile}" property="baseZipExists" />
     <antcall target="downloadBaseEclipse" />

_EOF_

# Fetch the actual source

java -cp /usr/share/eclipse/startup.jar \
  -Duser.home=../home org.eclipse.core.launcher.Main \
  -application org.eclipse.ant.core.antRunner \
  -buildfile build.xml \
  -DbaseLocation=/usr/share/eclipse \
  -Dpde.build.scripts=/usr/share/eclipse/plugins/org.eclipse.pde.build/scripts \
  -Dcomponent=sdk \
  -DbaseExists=true \
  -DbuildLabel=$cvs_tag \
  -DfetchTag=$cvs_tag \
  -DmapCvsRoot="$cvs_root" \
  -DmapVersionTag=$cvs_tag \
  fetch

# Fetch examples

java -cp /usr/share/eclipse/startup.jar \
    -Duser.home=../../home \
    org.eclipse.core.launcher.Main \
    -application org.eclipse.ant.core.antRunner \
    -buildfile build.xml \
    -DbaseLocation=/usr/share/eclipse \
    -Dpde.build.scripts=/usr/share/eclipse/plugins/org.eclipse.pde.build/scripts \
    -Dcomponent=examples \
    -DbaseExists=true \
    -DbuildLabel=$cvs_tag \
    -DfetchTag=$cvs_tag \
    -DmapCvsRoot="$cvs_root" \
    -DmapVersionTag=$cvs_tag \
    fetch
  
popd
# Make the source tarball
tar jcf eclipse-$project_name-fetched-src-$cvs_tag.tar.bz2 $cvs_directory