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
This commit is contained in:
Artur Satayev
2021-03-18 11:04:09 +00:00
parent fdb61edf43
commit b77b0c5e05

View File

@@ -81,16 +81,25 @@ 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") newAllowedDeps := android.PathForOutput(ctx, "apex", "depsinfo", "new-allowed-deps.txt")
s.allowedApexDepsInfoCheckResult = android.PathForOutput(ctx, newAllowedDeps.Rel()+".check")
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{ ctx.Build(pctx, android.BuildParams{
Rule: generateApexDepsInfoFilesRule, Rule: generateApexDepsInfoFilesRule,
Inputs: append(updatableFlatLists, allowedDeps), Inputs: append(updatableFlatLists, allowedDeps),
Output: newAllowedDeps, Output: newAllowedDeps,
}) })
s.allowedApexDepsInfoCheckResult = android.PathForOutput(ctx, newAllowedDeps.Rel()+".check")
ctx.Build(pctx, android.BuildParams{ ctx.Build(pctx, android.BuildParams{
Rule: diffAllowedApexDepsInfoRule, Rule: diffAllowedApexDepsInfoRule,
Input: newAllowedDeps, Input: newAllowedDeps,
@@ -100,6 +109,7 @@ func (s *apexDepsInfoSingleton) GenerateBuildActions(ctx android.SingletonContex
"new_allowed_deps": newAllowedDeps.String(), "new_allowed_deps": newAllowedDeps.String(),
}, },
}) })
}
ctx.Phony("apex-allowed-deps-check", s.allowedApexDepsInfoCheckResult) ctx.Phony("apex-allowed-deps-check", s.allowedApexDepsInfoCheckResult)
} }