Fix source jars

Source jars were not working as designed because javac will only
compile files from the -sourcepath if there are references to them
starting from files on the command line.  Switch to extracting
the source jars into a directory and passing a list of the files
to javac.

Test: m checkbuild
Change-Id: I9f7d824f8538d081b2f5ad64ae3cbfd0e96213af
diff --git a/scripts/extract-src-jars.sh b/scripts/extract-src-jars.sh
new file mode 100755
index 0000000..918cf8a
--- /dev/null
+++ b/scripts/extract-src-jars.sh
@@ -0,0 +1,30 @@
+#!/bin/bash -e
+
+# Extracts .java files from source jars in a specified directory and writes out a list of the files
+
+if [ -z "$1" -o -z "$2" ]; then
+  echo "usage: $0 <output dir> <output file> [<jar> ...]" >&2
+  exit 1
+fi
+
+output_dir=$1
+shift
+output_file=$1
+shift
+
+rm -f $output_file
+touch $output_file
+
+for j in "$@"; do
+  for f in $(zipinfo -1 $j '*.java'); do
+    echo $output_dir/$f >> $output_file
+  done
+  unzip -qn -d $output_dir $j '*.java'
+done
+
+duplicates=$(cat $output_file | sort | uniq -d | uniq)
+if [ -n "$duplicates" ]; then
+  echo Duplicate source files:
+  echo $duplicates
+  exit 1
+fi