Eclipse Compiler
authormbaudier <mbaudier@argeo.org>
Tue, 29 Jan 2013 13:05:34 +0000 (14:05 +0100)
committermbaudier <mbaudier@argeo.org>
Tue, 29 Jan 2013 13:05:34 +0000 (14:05 +0100)
.gitignore [new file with mode: 0644]
bin/argeo-builder [new file with mode: 0644]
specs/org.argeo.tp/org.eclipse.jdt.core.compiler.batch/MANIFEST.MF [new file with mode: 0644]
specs/org.argeo.tp/org.eclipse.jdt.core.compiler.batch/build.sh [new file with mode: 0755]

diff --git a/.gitignore b/.gitignore
new file mode 100644 (file)
index 0000000..0748af6
--- /dev/null
@@ -0,0 +1,4 @@
+/sources
+/build
+/cache
+
diff --git a/bin/argeo-builder b/bin/argeo-builder
new file mode 100644 (file)
index 0000000..12e818a
--- /dev/null
@@ -0,0 +1,19 @@
+#!/bin/bash
+
+function argeo_builder_variables() {
+       export ARTIFACT_DIR=$1
+       export ARTIFACT=${ARTIFACT_DIR##*/}
+       export GROUP_DIR=$(dirname "$ARTIFACT_DIR")
+       export GROUP=${GROUP_DIR##*/}
+       export SOURCE_DIR=${ARTIFACT_DIR/specs/sources}
+       export BUILD_DIR=${ARTIFACT_DIR/specs/build}
+}
+
+function argeo_builder_download_eclipse() {
+       ECLIPSE_MIRROR=http://ftp.halifax.rwth-aachen.de/eclipse
+       ECLIPSE_FILE=$1
+       ECLIPSE_URL=$ECLIPSE_MIRROR$ECLIPSE_FILE
+       mkdir -p $SOURCE_DIR
+       (cd $SOURCE_DIR && wget --timestamping $ECLIPSE_URL)
+}
+
diff --git a/specs/org.argeo.tp/org.eclipse.jdt.core.compiler.batch/MANIFEST.MF b/specs/org.argeo.tp/org.eclipse.jdt.core.compiler.batch/MANIFEST.MF
new file mode 100644 (file)
index 0000000..0981fae
--- /dev/null
@@ -0,0 +1,28 @@
+Manifest-Version: 1.0
+Main-Class: org.eclipse.jdt.internal.compiler.batch.Main
+Bundle-ManifestVersion: 2
+Bundle-Name: Eclipse Compiler for Java(TM)
+Bundle-SymbolicName: org.eclipse.jdt.core.compiler.batch
+Bundle-Version: $BUNDLE_VERSION
+Bundle-ClassPath: .
+Bundle-Vendor: Eclipse.org
+Export-Package: org.eclipse.jdt.core,
+ org.eclipse.jdt.core.compiler,
+ org.eclipse.jdt.internal.antadapter;x-internal:=true,
+ org.eclipse.jdt.internal.compiler;x-internal:=true,
+ org.eclipse.jdt.internal.compiler.apt.dispatch;x-internal:=true,
+ org.eclipse.jdt.internal.compiler.apt.model;x-internal:=true,
+ org.eclipse.jdt.internal.compiler.apt.util;x-internal:=true,
+ org.eclipse.jdt.internal.compiler.ast;x-internal:=true,
+ org.eclipse.jdt.internal.compiler.batch;x-internal:=true,
+ org.eclipse.jdt.internal.compiler.classfmt;x-internal:=true,
+ org.eclipse.jdt.internal.compiler.codegen;x-internal:=true,
+ org.eclipse.jdt.internal.compiler.env;x-internal:=true,
+ org.eclipse.jdt.internal.compiler.flow;x-internal:=true,
+ org.eclipse.jdt.internal.compiler.impl;x-internal:=true,
+ org.eclipse.jdt.internal.compiler.lookup;x-internal:=true,
+ org.eclipse.jdt.internal.compiler.parser;x-internal:=true,
+ org.eclipse.jdt.internal.compiler.parser.diagnose;x-internal:=true,
+ org.eclipse.jdt.internal.compiler.problem;x-internal:=true,
+ org.eclipse.jdt.internal.compiler.util;x-internal:=true,
+ org.eclipse.jdt.internal.compiler.tool;x-internal:=true
diff --git a/specs/org.argeo.tp/org.eclipse.jdt.core.compiler.batch/build.sh b/specs/org.argeo.tp/org.eclipse.jdt.core.compiler.batch/build.sh
new file mode 100755 (executable)
index 0000000..28c4abc
--- /dev/null
@@ -0,0 +1,47 @@
+#!/bin/bash
+
+source ../../../bin/argeo-builder
+argeo_builder_variables $PWD
+
+SOURCE_FILE=/eclipse/downloads/drops4/R-4.2.1-201209141800/ecjsrc-4.2.1.jar
+SOURCE_FILENAME=${SOURCE_FILE##*/}
+SRC_DIR=$BUILD_DIR/src
+CLASSES_DIR=$BUILD_DIR/classes
+
+BUNDLE_VERSION=3.8.2
+
+# TODO make javac choice more configurable 
+JAVAC=javac
+JAR=jar
+
+JAVAC_OPTS="-nowarn -source 1.6 -target 1.6"
+
+echo Download sources
+argeo_builder_download_eclipse $SOURCE_FILE
+
+echo Unjar sources
+rm -rf $SRC_DIR
+mkdir -p $SRC_DIR
+(cd $SRC_DIR && $JAR -xf $SOURCE_DIR/$SOURCE_FILENAME)
+# Remove Ant dependant file
+rm  $SRC_DIR/org/eclipse/jdt/core/JDTCompilerAdapter.java
+
+echo Compile
+rm -rf $CLASSES_DIR
+mkdir -p $CLASSES_DIR
+$JAVAC $JAVAC_OPTS -d $CLASSES_DIR $(find $SRC_DIR/org/* | grep .java) 2>&1 | tee $BUILD_DIR/build.log
+
+echo Copy additional files
+(cd $SRC_DIR && cp --parents $(find . | grep .rsc) $CLASSES_DIR)
+(cd $SRC_DIR && cp --parents $(find . | grep .properties) $CLASSES_DIR)
+(cd $SRC_DIR && cp --parents $(find . | grep .props) $CLASSES_DIR)
+mkdir $CLASSES_DIR/META-INF
+cp -r $SRC_DIR/META-INF/services $CLASSES_DIR/META-INF
+
+echo Generate MANIFEST.MF
+MANIFEST_FILE=$ARTIFACT_DIR/MANIFEST.MF
+
+CACHE_JAR_FILE=${ARTIFACT_DIR/specs/cache}_$BUNDLE_VERSION.jar
+echo Create jar file $CACHE_JAR_FILE
+mkdir -p $(dirname $CACHE_JAR_FILE)
+$JAR -cfm $CACHE_JAR_FILE $MANIFEST_FILE -C $CLASSES_DIR .