Home | History | Annotate | Download | only in scripts
      1 #!/bin/sh
      2 
      3 # Extract annotations from a class file and write them to an annotation file.
      4 # For usage information, run: extract-annotations --help
      5 # See the Annotation File Utilities documentation for more information.
      6 
      7 # If the very first argument is "--debug-script", debug this script (but
      8 # don't pass --debug-script to the underlying program).
      9 DEBUG=0
     10 if [ "$1" = "--debug-script" ]; then
     11   DEBUG=1
     12   shift 1
     13 fi
     14 
     15 AFU=${AFU:-$(dirname $0)/..}
     16 ANNOTATION_FILE_UTILS=${AFU}/bin:${AFU}/../scene-lib/bin:${AFU}/../asmx/bin:${AFU}/annotation-file-utilities.jar
     17 LANGTOOLS=${LANGTOOLS:-${AFU}/../../jsr308-langtools}
     18 JAVAC_JAR=${JAVAC_JAR:-${LANGTOOLS}/dist/lib/javac.jar}
     19 
     20 if [ "$DEBUG" = "1" ]; then
     21   echo "--- start of extract-annotations debugging output"
     22   echo "AFU=${AFU}"
     23   echo "ANNOTATION_FILE_UTILS=${ANNOTATION_FILE_UTILS}"
     24   echo "LANGTOOLS=${LANGTOOLS}"
     25   echo "JAVAC_JAR=${JAVAC_JAR}"
     26   # Keep this in sync with the actual command below.
     27   echo java -ea -cp ${JAVAC_JAR}:${AFU}/lib/plume-core.jar:${ANNOTATION_FILE_UTILS}:${CLASSPATH} annotations.io.classfile.ClassFileReader "$@"
     28   echo "--- end of extract-annotations debugging output"
     29 fi
     30 
     31 # Needs CLASSPATH to find user files
     32 java -ea -cp ${JAVAC_JAR}:${AFU}/lib/plume-core.jar:${ANNOTATION_FILE_UTILS}:${CLASSPATH} annotations.io.classfile.ClassFileReader "$@"
     33