aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSpandan Das <spandandas@google.com>2022-10-21 21:52:13 +0000
committerJihoon Kang <jihoonkang@google.com>2022-12-28 00:27:10 +0000
commit38c5baba25402fd3c52324a2f963c1461509fa44 (patch)
treeaa51f581a638ac544052add777103f28269aee61
parent26566d632305cc7cfa293d43109ec88ff8f175e3 (diff)
downloadsoong-38c5baba25402fd3c52324a2f963c1461509fa44.tar.gz
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 Merged-In: I68d245acae3bfb777bfc8a72fb7cd4909cb0a289
-rw-r--r--android/paths.go15
1 files changed, 15 insertions, 0 deletions
diff --git a/android/paths.go b/android/paths.go
index c3ef7548a..6163762a5 100644
--- a/android/paths.go
+++ b/android/paths.go
@@ -1137,6 +1137,21 @@ func PathForSource(ctx PathContext, pathComponents ...string) SourcePath {
return path
}
+// MaybeExistentPathForSource joins the provided path components and validates that the result
+// neither escapes the source dir nor is in the out dir.
+// It does not validate whether the path exists.
+func MaybeExistentPathForSource(ctx PathContext, pathComponents ...string) SourcePath {
+ path, err := pathForSource(ctx, pathComponents...)
+ if err != nil {
+ reportPathError(ctx, err)
+ }
+
+ if pathtools.IsGlob(path.String()) {
+ ReportPathErrorf(ctx, "path may not contain a glob: %s", path.String())
+ }
+ return path
+}
+
// ExistentPathForSource returns an OptionalPath with the SourcePath, rooted from SrcDir, *not*
// rooted from the module's local source directory, if the path exists, or an empty OptionalPath if
// it doesn't exist. Dependencies are added so that the ninja file will be regenerated if the state