Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 464e6a08 authored by Jingwen Chen's avatar Jingwen Chen
Browse files

Small readability refactor for bp2buildDepsMutator.

Test: presubmits
Change-Id: I59bc943cf8c3419bf16a7053d967d464f9f40f21
parent f2fd12d9
Loading
Loading
Loading
Loading
+17 −5
Original line number Diff line number Diff line
@@ -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())
	})
}