Do not register missing deps
This is a fix to aosp/2260763 and skips the existence check corectly.
Previously, it would not throw an exception during Soong analysis, but
would add the path to a `MissingDeps` object. The ninja graph generated
using this would throw an exception during ninja execution.
We should not do this check for `cc_api_library`. The prebuilt
library.so is missing in the build graph of the inner tree (expected),
but it will be present when the orchestrator creates the combined
multi-tree ninja graph.
Test: rm -rf out && multitree_build vendor/vendorimage
(I did not clean out/ in aosp/2260763, and therefore did not catch this
earlier)
Test: go test ./cc
Change-Id: I68d245acae3bfb777bfc8a72fb7cd4909cb0a289
diff --git a/cc/library_stub.go b/cc/library_stub.go
index 1597a6f..80c48ad 100644
--- a/cc/library_stub.go
+++ b/cc/library_stub.go
@@ -86,11 +86,11 @@
func (d *apiLibraryDecorator) exportIncludes(ctx ModuleContext) {
exporterProps := d.flagExporter.Properties
for _, dir := range exporterProps.Export_include_dirs {
- d.dirs = append(d.dirs, android.PathForSource(ctx, ctx.ModuleDir(), dir))
+ d.dirs = append(d.dirs, android.MaybeExistentPathForSource(ctx, ctx.ModuleDir(), dir))
}
// system headers
for _, dir := range exporterProps.Export_system_include_dirs {
- d.systemDirs = append(d.systemDirs, android.PathForSource(ctx, ctx.ModuleDir(), dir))
+ d.systemDirs = append(d.systemDirs, android.MaybeExistentPathForSource(ctx, ctx.ModuleDir(), dir))
}
}
@@ -118,7 +118,7 @@
// Skip the existence check of the stub prebuilt file.
// The file is not guaranteed to exist during Soong analysis.
// Build orchestrator will be responsible for creating a connected ninja graph.
- in := android.PathForSource(ctx, ctx.ModuleDir(), *d.properties.Src)
+ in := android.MaybeExistentPathForSource(ctx, ctx.ModuleDir(), *d.properties.Src)
d.unstrippedOutputFile = in
libName := d.libraryDecorator.getLibName(ctx) + flags.Toolchain.ShlibSuffix()