Home | History | Annotate | Download | only in scripts
      1 #!/bin/sh
      2 
      3 # Ad hoc script for merging annotated JDKs.  Arguments are JDK source
      4 # directories, assumed to be children of $js and identified by directory
      5 # name only (e.g. "merge-annotations nullness").
      6 
      7 if [ $# -le 1 ]; then exit 0; fi
      8 
      9 js="$HOME/src/jdk1.8.0_45/src"
     10 jb="$CHECKERFRAMEWORK/checker/dist/*"
     11 cf="$CHECKERFRAMEWORK/checker/build"
     12 sl="$JSR308/annotation-tools/scene-lib/bin"
     13 al="$JSR308/annotation-tools/annotation-file-utilities/lib"
     14 jj=./jdk.jaif
     15 wd=`pwd`
     16 cp="$jb:$cf:$sl:$al/*:$wd:$CLASSPATH"
     17 if [ 0 -eq 1 ] ; then
     18 td=/tmp/merge-jaifs.*
     19 else
     20 td=/tmp/merge-jaifs.$$
     21 
     22 for aj in $* ; do
     23     cd $aj/build
     24     for f in `find . -name '*\.class' -print | sed 's-^\./--'` ; do
     25         CLASSPATH="$wd/$aj/build:$CHECKERFRAMEWORK/checker/build:$CLASSPATH" \
     26           extract-annotations "$f"
     27         if [ $? -eq 0 ] ; then
     28             d=`dirname "$f"`
     29             mkdir -p "$td/$aj/$d"
     30             mv "$d"/*.jaif "$td/$aj/$d"
     31         fi
     32     done
     33     cd "$wd"
     34 done
     35 fi
     36 
     37 find $td -type f -print | xargs java -cp "$cp" annotations.tools.IndexFileMerger $td | sed 's/(value={\[/({/g' | sed 's/\]}/}/g' > "./$jj" &&\
     38 find "$js" -name "*\.java" -print | CLASSPATH="$cp" xargs insert-annotations-to-source --print-error-stack "$jj" &&\
     39 rm -rf $td
     40 
     41