diff options
author | Colin Cross <ccross@android.com> | 2017-10-24 17:46:00 -0700 |
---|---|---|
committer | Colin Cross <ccross@android.com> | 2017-10-26 01:00:46 +0000 |
commit | 8eadbf0aafc293f53eb8b80cea370043fed2d42b (patch) | |
tree | c6e218f3de1dffa5bb3f8a27b24f5125942afbae /scripts | |
parent | 9a36418089efe805fcb4d3ff2ddedf8dff02a264 (diff) | |
download | build_soong-8eadbf0aafc293f53eb8b80cea370043fed2d42b.tar.gz build_soong-8eadbf0aafc293f53eb8b80cea370043fed2d42b.tar.bz2 build_soong-8eadbf0aafc293f53eb8b80cea370043fed2d42b.zip |
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
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/extract-src-jars.sh | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/scripts/extract-src-jars.sh b/scripts/extract-src-jars.sh new file mode 100755 index 00000000..918cf8a5 --- /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 |