diff options
author | Artur Satayev <satayev@google.com> | 2021-03-18 11:04:09 +0000 |
---|---|---|
committer | Artur Satayev <satayev@google.com> | 2021-03-18 11:15:33 +0000 |
commit | b77b0c5e05a1e16fd959bc9be5a89d238924ac53 (patch) | |
tree | eb8d8404408da11d3677ab732e26a0bbb666e685 /apex/apex_singleton.go | |
parent | fdb61edf43dc2c4b66e0651e5c96e28be89ffe14 (diff) |
Treat allowed_deps.txt source file as optional.
Not all branches have packages/common/module, which breaks the build
for them.
Bug: 179234385
Test: removed allowed_deps.txt && m apex-allowed-deps-check
Change-Id: I38f47c7200e1afbd899e29843d0214bef826fcf9
Diffstat (limited to 'apex/apex_singleton.go')
-rw-r--r-- | apex/apex_singleton.go | 44 |
1 files changed, 27 insertions, 17 deletions
diff --git a/apex/apex_singleton.go b/apex/apex_singleton.go index 4890ba45e..0ed94afdb 100644 --- a/apex/apex_singleton.go +++ b/apex/apex_singleton.go @@ -81,25 +81,35 @@ func (s *apexDepsInfoSingleton) GenerateBuildActions(ctx android.SingletonContex } }) - allowedDeps := android.ExistentPathForSource(ctx, "packages/modules/common/build/allowed_deps.txt").Path() - + allowedDepsSource := android.ExistentPathForSource(ctx, "packages/modules/common/build/allowed_deps.txt") newAllowedDeps := android.PathForOutput(ctx, "apex", "depsinfo", "new-allowed-deps.txt") - ctx.Build(pctx, android.BuildParams{ - Rule: generateApexDepsInfoFilesRule, - Inputs: append(updatableFlatLists, allowedDeps), - Output: newAllowedDeps, - }) - s.allowedApexDepsInfoCheckResult = android.PathForOutput(ctx, newAllowedDeps.Rel()+".check") - ctx.Build(pctx, android.BuildParams{ - Rule: diffAllowedApexDepsInfoRule, - Input: newAllowedDeps, - Output: s.allowedApexDepsInfoCheckResult, - Args: map[string]string{ - "allowed_deps": allowedDeps.String(), - "new_allowed_deps": newAllowedDeps.String(), - }, - }) + + if !allowedDepsSource.Valid() { + // Unbundled projects may not have packages/modules/common/ checked out; ignore those. + ctx.Build(pctx, android.BuildParams{ + Rule: android.Touch, + Output: s.allowedApexDepsInfoCheckResult, + }) + } else { + allowedDeps := allowedDepsSource.Path() + + ctx.Build(pctx, android.BuildParams{ + Rule: generateApexDepsInfoFilesRule, + Inputs: append(updatableFlatLists, allowedDeps), + Output: newAllowedDeps, + }) + + ctx.Build(pctx, android.BuildParams{ + Rule: diffAllowedApexDepsInfoRule, + Input: newAllowedDeps, + Output: s.allowedApexDepsInfoCheckResult, + Args: map[string]string{ + "allowed_deps": allowedDeps.String(), + "new_allowed_deps": newAllowedDeps.String(), + }, + }) + } ctx.Phony("apex-allowed-deps-check", s.allowedApexDepsInfoCheckResult) } |