aboutsummaryrefslogtreecommitdiff
path: root/annotation-file-utilities/scripts/extract-annotations
diff options
context:
space:
mode:
Diffstat (limited to 'annotation-file-utilities/scripts/extract-annotations')
-rwxr-xr-xannotation-file-utilities/scripts/extract-annotations32
1 files changed, 32 insertions, 0 deletions
diff --git a/annotation-file-utilities/scripts/extract-annotations b/annotation-file-utilities/scripts/extract-annotations
new file mode 100755
index 0000000..c452d39
--- /dev/null
+++ b/annotation-file-utilities/scripts/extract-annotations
@@ -0,0 +1,32 @@
+#!/bin/sh
+
+# Extract annotations from a class file and write them to an annotation file.
+# For usage information, run: extract-annotations --help
+# See the Annotation File Utilities documentation for more information.
+
+# If the very first argument is "--debug-script", debug this script (but
+# don't pass --debug-script to the underlying program).
+DEBUG=0
+if [ "$1" = "--debug-script" ]; then
+ DEBUG=1
+ shift 1
+fi
+
+AFU=${AFU:-$(dirname $0)/..}
+ANNOTATION_FILE_UTILS=${AFU}/bin:${AFU}/../scene-lib/bin:${AFU}/../asmx/bin:${AFU}/annotation-file-utilities.jar
+LANGTOOLS=${LANGTOOLS:-${AFU}/../../jsr308-langtools}
+JAVAC_JAR=${JAVAC_JAR:-${LANGTOOLS}/dist/lib/javac.jar}
+
+if [ "$DEBUG" = "1" ]; then
+ echo "--- start of extract-annotations debugging output"
+ echo "AFU=${AFU}"
+ echo "ANNOTATION_FILE_UTILS=${ANNOTATION_FILE_UTILS}"
+ echo "LANGTOOLS=${LANGTOOLS}"
+ echo "JAVAC_JAR=${JAVAC_JAR}"
+ # Keep this in sync with the actual command below.
+ echo java -ea -cp ${JAVAC_JAR}:${AFU}/lib/plume-core.jar:${ANNOTATION_FILE_UTILS}:${CLASSPATH} annotations.io.classfile.ClassFileReader "$@"
+ echo "--- end of extract-annotations debugging output"
+fi
+
+# Needs CLASSPATH to find user files
+java -ea -cp ${JAVAC_JAR}:${AFU}/lib/plume-core.jar:${ANNOTATION_FILE_UTILS}:${CLASSPATH} annotations.io.classfile.ClassFileReader "$@"