From 7afe14e9d8220b9a6deccdce0e746571b8bfac58 Mon Sep 17 00:00:00 2001 From: Andrei Homescu Date: Thu, 19 Oct 2023 06:54:33 +0000 Subject: [PATCH] Fix cargo2rulesmk.py dependency bug in sandbox Remove the check performed by cargo2rulesmk.py whether the external/rust/crates/{name} directories exist for all dependencies of the current crate. These directories only exist in the Android tree, not in the minimal checkout inside the redshell sandbox. Bug: 281857510 Test: cargo2rulesmk.py on thiserror-impl Change-Id: I1e5d46b4de3129770ab87ebc5e58563010ae6605 --- scripts/cargo2rulesmk.py | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-) diff --git a/scripts/cargo2rulesmk.py b/scripts/cargo2rulesmk.py index 714b80b12..6c11a038e 100755 --- a/scripts/cargo2rulesmk.py +++ b/scripts/cargo2rulesmk.py @@ -596,25 +596,14 @@ class Crate(object): path = CUSTOM_MODULE_CRATES.get( name, f"external/rust/crates/{name}" ) - abspath = os.path.normpath(os.path.join(TOP_DIR, path)) - # just check for directory, not whether it contains rules.mk, since - # we do not generate makefile rules in topological order - if os.path.isdir(abspath): - library_deps.append(path) - elif dependency["optional"]: + if dependency["optional"]: if feats := [ f for f in self.features if name in self.feature_dependencies.get(f, []) ]: - print( - f"### WARNING: missing dependency {name} needed by features " - + ", ".join(feats) - ) - return - else: - print(f"### WARNING: missing non-optional dependency: {path}") - return + continue + library_deps.append(path) if library_deps: self.write("MODULE_LIBRARY_DEPS := \\") for path in library_deps: