From 704926639212fdd52addd0f972136769f2fc0254 Mon Sep 17 00:00:00 2001 From: Sasha Smundak Date: Mon, 8 Mar 2021 16:29:31 -0800 Subject: [PATCH] Workaround for b/182183061: generate corpus-specific rule file Bug: 182183061 Test: run build_kzip.bash, verify Go compilation units have corpus set Change-Id: I26e034eb9bbb8fbb3902404ce72f7e223b9a5972 --- build_kzip.bash | 9 +++++++-- vnames.go.json | 8 -------- 2 files changed, 7 insertions(+), 10 deletions(-) delete mode 100644 vnames.go.json diff --git a/build_kzip.bash b/build_kzip.bash index 956472332..a4659d4c8 100755 --- a/build_kzip.bash +++ b/build_kzip.bash @@ -16,6 +16,7 @@ : ${BUILD_NUMBER:=$(uuidgen)} : ${KYTHE_JAVA_SOURCE_BATCH_SIZE:=500} : ${KYTHE_KZIP_ENCODING:=proto} +: ${XREF_CORPUS:?should be set} export KYTHE_JAVA_SOURCE_BATCH_SIZE KYTHE_KZIP_ENCODING # The extraction might fail for some source files, so run with -k and then check that @@ -29,11 +30,15 @@ build/soong/soong_ui.bash --build-mode --all-modules --dir=$PWD -k merge_zips xr declare -r abspath_out=$(realpath "${out}") declare -r go_extractor=$(realpath prebuilts/build-tools/linux-x86/bin/go_extractor) declare -r go_root=$(realpath prebuilts/go/linux-x86) -declare -r vnames_path=$(realpath build/soong/vnames.go.json) declare -r source_root=$PWD + +# TODO(asmundak): Until b/182183061 is fixed, default corpus has to be specified +# in the rules file. Generate this file on the fly with corpus value set from the +# environment variable. for dir in blueprint soong; do (cd "build/$dir"; - KYTHE_ROOT_DIRECTORY="${source_root}" "$go_extractor" --goroot="$go_root" --rules="${vnames_path}" \ + KYTHE_ROOT_DIRECTORY="${source_root}" "$go_extractor" --goroot="$go_root" \ + --rules=<(printf '[{"pattern": "(.*)","vname": {"path": "@1@", "corpus":"%s"}}]' "${XREF_CORPUS}") \ --canonicalize_package_corpus --output "${abspath_out}/soong/build_${dir}.go.kzip" ./... ) done diff --git a/vnames.go.json b/vnames.go.json deleted file mode 100644 index f8c6b7fbc..000000000 --- a/vnames.go.json +++ /dev/null @@ -1,8 +0,0 @@ -[ - { - "pattern": "(.*)", - "vname": { - "path": "@1@" - } - } -]