summaryrefslogtreecommitdiff
path: root/rust/rust.go
diff options
context:
space:
mode:
author Colin Cross <ccross@android.com> 2023-08-01 09:57:22 -0700
committer Colin Cross <ccross@android.com> 2023-08-01 10:19:53 -0700
commita86ea0e0ebddb99a7a6131dae990d14bea38e961 (patch)
tree12f6a00c870925889b74f74e21a6091d27b1046d /rust/rust.go
parent1579a72d782556470d8126baddf977f71889610c (diff)
Fix missing rust dependencies when ALLOW_MISSING_DEPENDENCIES=true
Register a missing dependency when a dependency returns an invalid OptionalPath. Fixes: 294070048 Test: rust_test.go Change-Id: Ibccfc30d59c706308e99f11e372f7c9b60d9dc74
Diffstat (limited to 'rust/rust.go')
-rw-r--r--rust/rust.go19
1 files changed, 16 insertions, 3 deletions
diff --git a/rust/rust.go b/rust/rust.go
index 05fceee36..dab35323a 100644
--- a/rust/rust.go
+++ b/rust/rust.go
@@ -1306,12 +1306,17 @@ func (mod *Module) depsToPaths(ctx android.ModuleContext) PathDeps {
}
}
linkObject := ccDep.OutputFile()
- linkPath := linkPathFromFilePath(linkObject.Path())
-
if !linkObject.Valid() {
- ctx.ModuleErrorf("Invalid output file when adding dep %q to %q", depName, ctx.ModuleName())
+ if !ctx.Config().AllowMissingDependencies() {
+ ctx.ModuleErrorf("Invalid output file when adding dep %q to %q", depName, ctx.ModuleName())
+ } else {
+ ctx.AddMissingDependencies([]string{depName})
+ }
+ return
}
+ linkPath := linkPathFromFilePath(linkObject.Path())
+
exportDep := false
switch {
case cc.IsStaticDepTag(depTag):
@@ -1356,6 +1361,14 @@ func (mod *Module) depsToPaths(ctx android.ModuleContext) PathDeps {
// Re-get linkObject as ChooseStubOrImpl actually tells us which
// object (either from stub or non-stub) to use.
linkObject = android.OptionalPathForPath(sharedLibraryInfo.SharedLibrary)
+ if !linkObject.Valid() {
+ if !ctx.Config().AllowMissingDependencies() {
+ ctx.ModuleErrorf("Invalid output file when adding dep %q to %q", depName, ctx.ModuleName())
+ } else {
+ ctx.AddMissingDependencies([]string{depName})
+ }
+ return
+ }
linkPath = linkPathFromFilePath(linkObject.Path())
depPaths.linkDirs = append(depPaths.linkDirs, linkPath)