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:
@@ -55,6 +55,9 @@ class Env(object):
|
|||||||
class Bazel(object):
|
class Bazel(object):
|
||||||
# set up the Bazel queryview
|
# set up the Bazel queryview
|
||||||
def __init__(self, env):
|
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)
|
os.chdir(env.ANDROID_BUILD_TOP)
|
||||||
print("Building Bazel Queryview. This can take a couple of minutes...")
|
print("Building Bazel Queryview. This can take a couple of minutes...")
|
||||||
cmd = "./build/soong/soong_ui.bash --build-mode --all-modules --dir=. queryview"
|
cmd = "./build/soong/soong_ui.bash --build-mode --all-modules --dir=. queryview"
|
||||||
@@ -68,15 +71,9 @@ class Bazel(object):
|
|||||||
self.setup = False
|
self.setup = False
|
||||||
os.chdir(env.cwd)
|
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.
|
# Return all modules for a given path.
|
||||||
def query_modules(self, 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")
|
out = subprocess.check_output(cmd, shell=True, stderr=subprocess.DEVNULL, text=True).strip().split("\n")
|
||||||
modules = set()
|
modules = set()
|
||||||
for line in out:
|
for line in out:
|
||||||
@@ -88,7 +85,7 @@ class Bazel(object):
|
|||||||
|
|
||||||
# Return all reverse dependencies for a single module.
|
# Return all reverse dependencies for a single module.
|
||||||
def query_rdeps(self, module):
|
def query_rdeps(self, module):
|
||||||
cmd = (self.path() + " query --config=queryview \'rdeps(//..., " +
|
cmd = (self.path + " query --config=queryview \'rdeps(//..., " +
|
||||||
module + ")\' --output=label_kind")
|
module + ")\' --output=label_kind")
|
||||||
out = (subprocess.check_output(cmd, shell=True, stderr=subprocess.DEVNULL, text=True)
|
out = (subprocess.check_output(cmd, shell=True, stderr=subprocess.DEVNULL, text=True)
|
||||||
.strip().split("\n"))
|
.strip().split("\n"))
|
||||||
|
|||||||
Reference in New Issue
Block a user