Work around b/70221552

If one sets a sufficiently long OUT_DIR to build into the
//frameworks/base:framework-javastream-protos generate target will
fail due to trying to run a too-long command. This works around that
problem by making the command being run much smaller.

Test: Build
Bug: 70221552
Change-Id: I0134ccfc83469826d3ea8679e1c52b9b52c6d2e0
This commit is contained in:
Alex Light
2018-08-08 07:05:19 -07:00
parent 9b04b2fd0b
commit 159799d7c9
2 changed files with 36 additions and 10 deletions

View File

@@ -735,22 +735,24 @@ gensrcs {
name: "framework-javastream-protos",
depfile: true,
tool_files: [ "tools/genprotos.sh", ],
tools: [
"aprotoc",
"protoc-gen-javastream",
"soong_zip",
],
cmd: "mkdir -p $(genDir)/$(in) " +
"&& $(location aprotoc) " +
" --plugin=$(location protoc-gen-javastream) " +
" --dependency_out=$(depfile) " +
" --javastream_out=$(genDir)/$(in) " +
" -Iexternal/protobuf/src " +
" -I . " +
" $(in) " +
"&& $(location soong_zip) -jar -o $(out) -C $(genDir)/$(in) -D $(genDir)/$(in)",
// TODO This should not be needed. If you set a custom OUT_DIR or OUT_DIR_COMMON_BASE you can
// end up with a command that is extremely long, potentially going passed MAX_ARG_STRLEN due to
// the way sbox rewrites the command. See b/70221552.
cmd: "$(location tools/genprotos.sh) " +
" $(location aprotoc) " +
" $(location protoc-gen-javastream) " +
" $(location soong_zip) " +
" $(genDir) " +
" $(depfile) " +
" $(in) " +
" $(out)",
srcs: [
"core/proto/**/*.proto",
"libs/incident/**/*.proto",

24
tools/genprotos.sh Executable file
View File

@@ -0,0 +1,24 @@
#!/bin/bash
# TODO This should not be needed. If you set a custom OUT_DIR or OUT_DIR_COMMON_BASE you can
# end up with a command that is extremely long, potentially going passed MAX_ARG_STRLEN due to
# the way sbox rewrites the command. See b/70221552.
set -e
location_aprotoc=$1
location_protoc=$2
location_soong_zip=$3
genDir=$4
depfile=$5
in=$6
out=$7
mkdir -p ${genDir}/${in} && \
${location_aprotoc} --plugin=${location_protoc} \
--dependency_out=${depfile} \
--javastream_out=${genDir}/${in} \
-Iexternal/protobuf/src \
-I . \
${in} && \
${location_soong_zip} -jar -o ${out} -C ${genDir}/${in} -D ${genDir}/${in}