update_crate_tests: Use prebuilt bazel

Bug: 181953100
Test: update_crate_tests.py in external/rust/crates/libc
Change-Id: I3c0477cf8d5aac0ae9e444d1b95b8670c9e2e588
This commit is contained in:
Thiébaud Weksteen
2021-06-10 07:56:06 +02:00
parent 76c4e232ad
commit 3e32afc5a6

View File

@@ -55,6 +55,9 @@ class Env(object):
class Bazel(object):
# set up the Bazel queryview
def __init__(self, env):
if platform.system() != 'Linux':
sys.exit('ERROR: this script has only been tested on Linux.')
self.path = os.path.join(env.ANDROID_BUILD_TOP, "tools", "bazel")
os.chdir(env.ANDROID_BUILD_TOP)
print("Building Bazel Queryview. This can take a couple of minutes...")
cmd = "./build/soong/soong_ui.bash --build-mode --all-modules --dir=. queryview"
@@ -68,15 +71,9 @@ class Bazel(object):
self.setup = False
os.chdir(env.cwd)
def path(self):
# Only tested on Linux.
if platform.system() != 'Linux':
sys.exit('ERROR: this script has only been tested on Linux.')
return "/usr/bin/bazel"
# Return all modules for a given path.
def query_modules(self, path):
cmd = self.path() + " query --config=queryview /" + path + ":all"
cmd = self.path + " query --config=queryview /" + path + ":all"
out = subprocess.check_output(cmd, shell=True, stderr=subprocess.DEVNULL, text=True).strip().split("\n")
modules = set()
for line in out:
@@ -88,7 +85,7 @@ class Bazel(object):
# Return all reverse dependencies for a single module.
def query_rdeps(self, module):
cmd = (self.path() + " query --config=queryview \'rdeps(//..., " +
cmd = (self.path + " query --config=queryview \'rdeps(//..., " +
module + ")\' --output=label_kind")
out = (subprocess.check_output(cmd, shell=True, stderr=subprocess.DEVNULL, text=True)
.strip().split("\n"))