forked from typetools/annotation-tools
-
Notifications
You must be signed in to change notification settings - Fork 2
/
insert-annotations
executable file
·50 lines (44 loc) · 1.62 KB
/
insert-annotations
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#!/bin/sh
# Insert annotations (from an annotation file) into a class file.
# For usage information, run: insert-annotations --help
# See the Annotation File Utilities documentation for more information.
# A few options are consumed by this script rather than being passed to the
# underlying Java program. They must be the first command-line arguments
# provided.
DEBUG=0
CLASSPATH=${CLASSPATH}
while [ "$#" -gt 0 ]; do
case "$1" in
--debug-script)
# Debug this script
DEBUG=1
shift
;;
-cp|-classpath)
# Set the classpath
CLASSPATH=$2
shift 2
;;
*)
break
;;
esac
done
AFU=${AFU:-$(dirname $0)/..}
ANNOTATION_FILE_UTILS=${AFU}/annotation-file-utilities-all.jar
JAVAC_JAR=${JAVAC_JAR:-${AFU}/lib/javac-9+181-r4173-1.jar}
if java -version 2>&1 | grep version | grep 1.8 > /dev/null ; then
# Using JDK 8. -Xbootclasspth isn't supported in 9+ and isn't required.
BOOTCLASSPATH=-Xbootclasspath/p:${JAVAC_JAR}
fi
if [ "$DEBUG" = "1" ]; then
echo "--- start of insert-annotations debugging output"
echo "AFU=${AFU}"
echo "ANNOTATION_FILE_UTILS=${ANNOTATION_FILE_UTILS}"
echo "JAVAC_JAR=${JAVAC_JAR}"
# Keep this in sync with the actual command below.
echo "java -ea ${BOOTCLASSPATH} -cp ${JAVAC_JAR}:${AFU}/lib/plume-lib.jar:${ANNOTATION_FILE_UTILS}:${CLASSPATH} org.checkerframework.afu.scenelib.io.classfile.ClassFileWriter $@"
echo "--- end of insert-annotations debugging output"
fi
# Needs CLASSPATH to find user files
java -ea ${BOOTCLASSPATH} -cp ${ANNOTATION_FILE_UTILS}:${CLASSPATH} org.checkerframework.afu.scenelib.io.classfile.ClassFileWriter "$@"