Merge "Fix error in build when OUT_DIR_COMMON_BASE is used"

This commit is contained in:
Treehugger Robot
2018-07-11 15:34:52 +00:00
committed by Gerrit Code Review

View File

@@ -16,7 +16,7 @@
# Generates kotlinc module xml file to standard output based on rsp files # Generates kotlinc module xml file to standard output based on rsp files
if [ -z "$1" ]; then if [[ -z "$1" ]]; then
echo "usage: $0 <classpath> <outDir> <rspFiles>..." >&2 echo "usage: $0 <classpath> <outDir> <rspFiles>..." >&2
exit 1 exit 1
fi fi
@@ -30,24 +30,36 @@ classpath=$1
out_dir=$2 out_dir=$2
shift 2 shift 2
# Path in the build file are relative to the build file, we need to make them absolute. # Path in the build file may be relative to the build file, we need to make them
prefix=`pwd` # absolute
prefix="$(pwd)"
get_abs_path () {
local file="$1"
if [[ "${file:0:1}" == '/' ]] ; then
echo "${file}"
else
echo "${prefix}/${file}"
fi
}
# Print preamble # Print preamble
echo "<modules><module name=\"name\" type=\"java-production\" outputDir=\"${out_dir}\">" echo "<modules><module name=\"name\" type=\"java-production\" outputDir=\"${out_dir}\">"
# Print classpath entries # Print classpath entries
for file in $(echo $classpath | tr ":" "\n"); do for file in $(echo "$classpath" | tr ":" "\n"); do
echo " <classpath path=\"${prefix}/${file}\"/>" path="$(get_abs_path "$file")"
echo " <classpath path=\"${path}\"/>"
done done
# For each rsp file, print source entries # For each rsp file, print source entries
while (( "$#" )); do while (( "$#" )); do
for file in $(cat $1); do for file in $(cat "$1"); do
path="$(get_abs_path "$file")"
if [[ $file == *.java ]]; then if [[ $file == *.java ]]; then
echo " <javaSourceRoots path=\"${prefix}/${file}\"/>" echo " <javaSourceRoots path=\"${path}\"/>"
elif [[ $file == *.kt ]]; then elif [[ $file == *.kt ]]; then
echo " <sources path=\"${prefix}/${file}\"/>" echo " <sources path=\"${path}\"/>"
else else
echo "Unknown source file type ${file}" echo "Unknown source file type ${file}"
exit 1 exit 1