From ca54088aa8659944dddc6e48397f38a8013b5aa3 Mon Sep 17 00:00:00 2001 From: Sasha Smundak Date: Fri, 20 Dec 2019 14:25:50 -0800 Subject: [PATCH] Run extractor for Go files in build/soong directory Bug: 137798757 Test: run cd build/soong && ../../prebuilts/build-tools/linux-x86/bin/go_extractor --goroot=$PWD/../../prebuilts/go/linux-x86 --rules=vnames.go.json --canonicalize_package_corpus --output $OUT_DIR/soong/golang.kzip ./... Change-Id: Ib1edde4bf36e6b0683f49da0986f243690c81d6b --- build_kzip.bash | 12 +++++++++++- vnames.go.json | 9 +++++++++ 2 files changed, 20 insertions(+), 1 deletion(-) create mode 100644 vnames.go.json diff --git a/build_kzip.bash b/build_kzip.bash index 1e0d48f86..ccd6bad02 100755 --- a/build_kzip.bash +++ b/build_kzip.bash @@ -15,8 +15,18 @@ # The extraction might fail for some source files, so run with -k and then check that # sufficiently many files were generated. -build/soong/soong_ui.bash --build-mode --all-modules --dir=$PWD -k merge_zips xref_cxx xref_java declare -r out="${OUT_DIR:-out}" +# Build extraction files for C++ and Java. Build `merge_zips` which we use later. +build/soong/soong_ui.bash --build-mode --all-modules --dir=$PWD -k merge_zips xref_cxx xref_java +#Build extraction file for Go files in build/soong directory. +(cd build/soong; + ../../prebuilts/build-tools/linux-x86/bin/go_extractor \ + --goroot="${PWD}/../../prebuilts/go/linux-x86" \ + --rules=vnames.go.json \ + --canonicalize_package_corpus \ + --output "${out}/soong/all.go.kzip" \ + ./... ) + declare -r kzip_count=$(find "$out" -name '*.kzip' | wc -l) (($kzip_count>100000)) || { printf "Too few kzip files were generated: %d\n" $kzip_count; exit 1; } diff --git a/vnames.go.json b/vnames.go.json new file mode 100644 index 000000000..584209735 --- /dev/null +++ b/vnames.go.json @@ -0,0 +1,9 @@ +[ + { + "pattern": "(.*)", + "vname": { + "corpus": "android.googlesource.com/platform/superproject", + "path": "build/soong/@1@" + } + } +]