--- /dev/null
+#!/bin/bash\r
+# generate .lst file for aspectjtools.jar\r
+# by compile all non-testing src dirs\r
+# todo: copy ajbrowser manifest\r
+[ -n "$DEBUG" ] && set -vx\r
+\r
+usage() {\r
+ name=`basename "$0"`\r
+ cat<<EOF\r
+ Usage: $name { build | manifest }\r
+For compiling aspectjtools-aj.jar using ajc, generate build/aspectjtools.lst \r
+and files it refers to, aspectjtools-sources.lst and aspectj-resources.jar. \r
+\r
+To add to aspectjtools.jar a meta-inf/manifest.mf with a main-class, \r
+specify a single argument: "manifest"\r
+\r
+To create the .lst file, use ajc to build, and add the manifest,\r
+define ASPECTJ_HOME and specify a single argument: "build"\r
+\r
+EOF\r
+}\r
+\r
+canonicalPath() {\r
+ cygpath -ma "$@"\r
+}\r
+\r
+filterOutNonsourceDirs() {\r
+ sed '/\/build\//d;/\/testing/d'\r
+}\r
+\r
+listSourceDirs() {\r
+ for i in ../*/testsrc; do \r
+ p=`echo $i \\r
+ | filterOutNonsourceDirs \\r
+ | sed 's|../\(.*\)/testsrc|\1|'`;\r
+ p=`canonicalPath "../$p"`\r
+ [ -d "$p/src" ] && echo "$p/src"\r
+ done\r
+}\r
+\r
+generateSourcesLstFiles() {\r
+ [ -n "$DEBUG" ] && set -vx\r
+ rm -f aspectjtools-sources.lst; \r
+ for i in `listSourceDirs` ; do\r
+ find "$i" -type f -name \*.java \\r
+ | sed 's|/[^/]*.java|/*.java|' \\r
+ | sort -u ; \r
+ done > aspectjtools-sources.lst; \r
+ # head aspectjtools-sources.lst\r
+}\r
+\r
+genResourceJar() { # slow, but hey\r
+ [ -n "$DEBUG" ] && set -vx\r
+ jarFile=`canonicalPath "$1"`\r
+ [ -n "$jarFile" ] || exit 43\r
+ \r
+ "${JAVA_HOME:-c:/home/apps/jdk14}/bin/"jar \\r
+ cfM "$jarFile" build.xml\r
+ \r
+ curDir=`pwd`;\r
+ for i in `listSourceDirs` ; do\r
+ cd "$i"\r
+ "${JAVA_HOME:-c:/home/apps/jdk14}/bin/"jar \\r
+ ufM "$jarFile" `find . -type f | sed '/CVS/d;/\.java/d'`\r
+ cd "$curDir"\r
+ done \r
+ cd "$curDir"\r
+\r
+# mf=`canonicalPath "grj_manifest.txt"` \r
+# sed 's|@build.version.short@|1.1.1|;s|@company.name@|na|' \\r
+# ../ajbrowser/ajbrowser.mf.txt > "$mf"\r
+# "${JAVA_HOME:-c:/home/apps/jdk14}/bin/"jar \\r
+# ufm "$jarFile" "$mf" build.xml\r
+# rm "$mf"\r
+}\r
+\r
+addManifest() {\r
+ outjar="$1"\r
+ mf=`canonicalPath "grj_manifest.txt"` \r
+ sed 's|@build.version.short@|1.1.1|;s|@company.name@|na|' \\r
+ ../ajbrowser/ajbrowser.mf.txt > "$mf"\r
+ echo "nothing" > am_nothing\r
+ "${JAVA_HOME:-c:/home/apps/jdk14}/bin/"jar \\r
+ ufm "$outjar" "$mf" am_nothing\r
+ rm "$mf" am_nothing\r
+}\r
+\r
+getClasspath() {\r
+ [ -n "$DEBUG" ] && set -vx\r
+ ajrt=`canonicalPath "${ASPECTJ_HOME:-c:/home/apps/aspectj-1.1.1}/lib/aspectjrt.jar"`\r
+ echo "${ajrt};`cygpath -ma ../lib/ant/lib/ant.jar`"\r
+}\r
+\r
+getInjars() {\r
+ [ -n "$DEBUG" ] && set -vx \r
+ cp=""\r
+ sep=""\r
+ for i in "$1" ../lib/bcel/bcel.jar \\r
+ ../org.eclipse.jdt.core/jdtcore-for-aspectj.jar \\r
+ ; do\r
+ cp="${cp}${sep}`canonicalPath "$i"`"\r
+ [ -z "${sep}" ] && sep=";"\r
+ done\r
+ echo "$cp"\r
+}\r
+\r
+setupManifest() {\r
+ [ -n "$DEBUG" ] && set -vx\r
+ midir="../ajbrowser/src/META-INF"\r
+ [ -d "$midir" ] || mkdir ../ajbrowser/src/META-INF\r
+ sed 's|@build.version.short@|1.1.1|;s|@company.name@|na|' \\r
+ ../ajbrowser/ajbrowser.mf.txt > "$1"\r
+}\r
+\r
+generateFile() {\r
+ resourceJar="$1"\r
+ outputJar="$2"\r
+ [ -n "$DEBUG" ] && set -vx\r
+ [ -f "$resourceJar" ] || exit 98\r
+ [ -n "$outputJar" ] || exit 98\r
+ rm -f "$outputJar"\r
+ PS=";"\r
+ #sourceroots=`getSourceroots`\r
+ classpath=`getClasspath`\r
+ injars=`getInjars "$resourceJar"`\r
+ cat<<EOF\r
+# generated `date` by $0\r
+# remove this line if modifying this file\r
+-outjar\r
+$outputJar\r
+-classpath\r
+$classpath\r
+-injars\r
+$injars\r
+-argfile\r
+`canonicalPath aspectjtools-sources.lst`\r
+EOF\r
+}\r
+\r
+errExit() {\r
+ [ -n "$1" ] && echo "## error: $1"\r
+ [ -n "$2" ] && exit "$2"\r
+}\r
+\r
+#########################################################################\r
+#########################################################################\r
+scriptDir=`dirname "$0"`\r
+scriptDir=`cd "$scriptDir"; pwd`\r
+script=`canonicalPath "$0"`\r
+export PS=";" ### XXX platform\r
+ASPECTJ_HOME="${ASPECTJ_HOME:-~/dev/tools/aspectj-1.1.1}"\r
+export ASPECTJ_HOME=`cygpath -m "${ASPECTJ_HOME}"`\r
+\r
+cd "$scriptDir/.."\r
+outjar=`canonicalPath aspectjtools-aj.jar`\r
+\r
+if [ -f aspectjtools.lst ] ; then\r
+ grep -q "remove this line" aspectjtools.lst \\r
+ && rm -f aspectjtools.lst \\r
+ || exit 23\r
+fi\r
+set -e\r
+if [ "$1" = "manifest" ] ; then\r
+ addManifest "$outjar"\r
+elif [ "build" = "$1" ] ; then\r
+ [ "$script" -ot aspectjtools.lst ] || "$script"\r
+ [ -d "$ASPECTJ_HOME" ] || errExit "define ASPECTJ_HOME" 49\r
+ "$ASPECTJ_HOME"/bin/ajc -argfile aspectjtools.lst\r
+ "$script" manifest \r
+elif [ -n "$1" ] ; then\r
+ usage\r
+else \r
+ generateSourcesLstFiles\r
+ resourceJar=`canonicalPath aspectjtools-resources.jar`\r
+ [ -f "$resourceJar" ] || genResourceJar "$resourceJar"\r
+ outjar=`canonicalPath aspectjtools-aj.jar`\r
+ rm -f aspectjtools.lst\r
+ generateFile "$resourceJar" "$outjar" > aspectjtools.lst\r
+ ls -ald "$resourceJar" aspectjtools.lst\r
+fi\r