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
This commit is contained in:
Andrei Homescu
2023-10-19 06:54:33 +00:00
parent 2f249d2407
commit 7afe14e9d8

View File

@@ -596,25 +596,14 @@ class Crate(object):
path = CUSTOM_MODULE_CRATES.get( path = CUSTOM_MODULE_CRATES.get(
name, f"external/rust/crates/{name}" name, f"external/rust/crates/{name}"
) )
abspath = os.path.normpath(os.path.join(TOP_DIR, path)) if dependency["optional"]:
# 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 feats := [ if feats := [
f f
for f in self.features for f in self.features
if name in self.feature_dependencies.get(f, []) if name in self.feature_dependencies.get(f, [])
]: ]:
print( continue
f"### WARNING: missing dependency {name} needed by features " library_deps.append(path)
+ ", ".join(feats)
)
return
else:
print(f"### WARNING: missing non-optional dependency: {path}")
return
if library_deps: if library_deps:
self.write("MODULE_LIBRARY_DEPS := \\") self.write("MODULE_LIBRARY_DEPS := \\")
for path in library_deps: for path in library_deps: