diff options
| author | 2023-10-05 09:58:00 +0000 | |
|---|---|---|
| committer | 2023-10-05 09:59:43 +0000 | |
| commit | 464e6a083fe1dc2fa57d87e062fb448b9a76e76c (patch) | |
| tree | 7f2daa9a62b2d0dd07d2c4e764cb0b3ab5b2db2e | |
| parent | f2fd12d97c511a92d4a1ebb582a04e3ac06da03d (diff) | |
Small readability refactor for bp2buildDepsMutator.
Test: presubmits
Change-Id: I59bc943cf8c3419bf16a7053d967d464f9f40f21
| -rw-r--r-- | android/bazel.go | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/android/bazel.go b/android/bazel.go index e307b18d2..b4e7ae558 100644 --- a/android/bazel.go +++ b/android/bazel.go @@ -693,15 +693,27 @@ func bp2buildDepsMutator(ctx BottomUpMutatorContext) { if len(ctx.Module().GetMissingBp2buildDeps()) > 0 { exampleDep := ctx.Module().GetMissingBp2buildDeps()[0] - ctx.MarkBp2buildUnconvertible(bp2build_metrics_proto.UnconvertedReasonType_UNCONVERTED_DEP, exampleDep) + ctx.MarkBp2buildUnconvertible( + bp2build_metrics_proto.UnconvertedReasonType_UNCONVERTED_DEP, exampleDep) } + // Transitively mark modules unconvertible with the following set of conditions. ctx.VisitDirectDeps(func(dep Module) { - if dep.base().GetUnconvertedReason() != nil && - dep.base().GetUnconvertedReason().ReasonType != int(bp2build_metrics_proto.UnconvertedReasonType_DEFINED_IN_BUILD_FILE) && - ctx.OtherModuleDependencyTag(dep) == Bp2buildDepTag { - ctx.MarkBp2buildUnconvertible(bp2build_metrics_proto.UnconvertedReasonType_UNCONVERTED_DEP, dep.Name()) + if dep.base().GetUnconvertedReason() == nil { + return + } + + if dep.base().GetUnconvertedReason().ReasonType == + int(bp2build_metrics_proto.UnconvertedReasonType_DEFINED_IN_BUILD_FILE) { + return } + + if ctx.OtherModuleDependencyTag(dep) != Bp2buildDepTag { + return + } + + ctx.MarkBp2buildUnconvertible( + bp2build_metrics_proto.UnconvertedReasonType_UNCONVERTED_DEP, dep.Name()) }) } |