Home | History | Annotate | Download | only in scripts
      1 #!/bin/sh
      2 
      3 # Insert annotations (from an annotation file) into a Java source file.
      4 # For usage information, run: insert-annotations-to-source --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 AFU=`cd \`dirname $0\`/.. && pwd`
     17 ANNOTATION_FILE_UTILS=${ANNOTATION_FILE_UTILS:-${AFU}/bin:${AFU}/../scene-lib/bin:${AFU}/../asmx/bin:${AFU}/annotation-file-utilities.jar}
     18 LANGTOOLS=${LANGTOOLS:-${AFU}/../../jsr308-langtools}
     19 JAVAC_JAR=${JAVAC_JAR:-${LANGTOOLS}/dist/lib/javac.jar}
     20 
     21 if [ "$DEBUG" = "1" ]; then
     22   echo "--- start of insert-annotations-to-source debugging output"
     23   echo "AFU=${AFU}"
     24   echo "ANNOTATION_FILE_UTILS=${ANNOTATION_FILE_UTILS}"
     25   echo "LANGTOOLS=${LANGTOOLS}"
     26   echo "JAVAC_JAR=${JAVAC_JAR}"
     27   # Keep this in sync with the actual command below.
     28   echo java -ea -Xmx512m -classpath ${JAVAC_JAR}:${ANNOTATION_FILE_UTILS}:${CLASSPATH} annotator.Main "$@"
     29   echo "--- end of insert-annotations-to-source debugging output"
     30 fi
     31 
     32 # Augment, don't replace, CLASSPATH, so as to find user files.
     33 java -ea -Xmx512m -classpath ${JAVAC_JAR}:${ANNOTATION_FILE_UTILS}:${CLASSPATH} annotator.Main "$@"
     34