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

Commit c27e8f14 authored by Christopher Parsons's avatar Christopher Parsons Committed by Gerrit Code Review
Browse files

Merge "Turn on bp2build_deps by default" into main

parents 5a2a94eb d43be7c7
Loading
Loading
Loading
Loading
+0 −3
Original line number Diff line number Diff line
@@ -634,9 +634,6 @@ func bp2buildDefaultTrueRecursively(packagePath string, config allowlists.Bp2Bui

func registerBp2buildConversionMutator(ctx RegisterMutatorsContext) {
	ctx.BottomUp("bp2build_conversion", bp2buildConversionMutator).Parallel()
}

func registerBp2buildDepsMutator(ctx RegisterMutatorsContext) {
	ctx.BottomUp("bp2build_deps", bp2buildDepsMutator).Parallel()
}

+0 −3
Original line number Diff line number Diff line
@@ -306,9 +306,6 @@ type config struct {
	// in tests when a path doesn't exist.
	TestAllowNonExistentPaths bool

	// If true, register the "bp2build_deps" mutator in the mutator pipeline.
	Bp2buildDepsMutator bool

	// The list of files that when changed, must invalidate soong_build to
	// regenerate build.ninja.
	ninjaFileDepsSet sync.Map
+0 −3
Original line number Diff line number Diff line
@@ -35,9 +35,6 @@ import (
// RegisterMutatorsForBazelConversion is a alternate registration pipeline for bp2build. Exported for testing.
func RegisterMutatorsForBazelConversion(ctx *Context, preArchMutators []RegisterMutatorFunc) {
	bp2buildMutators := append(preArchMutators, registerBp2buildConversionMutator)
	if ctx.config.Bp2buildDepsMutator {
		bp2buildMutators = append(bp2buildMutators, registerBp2buildDepsMutator)
	}
	registerMutatorsForBazelConversion(ctx, bp2buildMutators)
}

+0 −50
Original line number Diff line number Diff line
@@ -1058,50 +1058,6 @@ func TestModuleTypeBp2Build(t *testing.T) {
				}),
			},
		},
		{
			Description:                "depends_on_other_unconverted_module_error",
			ModuleTypeUnderTest:        "filegroup",
			ModuleTypeUnderTestFactory: android.FileGroupFactory,
			UnconvertedDepsMode:        errorModulesUnconvertedDeps,
			Blueprint: `filegroup {
    name: "foobar",
    srcs: [
        ":foo",
        "c",
    ],
    bazel_module: { bp2build_available: true },
}`,
			ExpectedErr: fmt.Errorf(`filegroup .:foobar depends on unconverted modules: foo`),
			Filesystem: map[string]string{
				"other/Android.bp": `filegroup {
    name: "foo",
    srcs: ["a", "b"],
}`,
			},
		},
		{
			Description:                "depends_on_other_missing_module_error",
			ModuleTypeUnderTest:        "filegroup",
			ModuleTypeUnderTestFactory: android.FileGroupFactory,
			UnconvertedDepsMode:        errorModulesUnconvertedDeps,
			Blueprint: `filegroup {
    name: "foobar",
    srcs: [
        "c",
        "//other:foo",
        "//other:goo",
    ],
    bazel_module: { bp2build_available: true },
}`,
			ExpectedErr: fmt.Errorf(`filegroup .:foobar depends on missing modules: //other:goo`),
			Filesystem: map[string]string{"other/Android.bp": `filegroup {
    name: "foo",
    srcs: ["a"],
    bazel_module: { bp2build_available: true },
}
`,
			},
		},
	}

	for _, testCase := range testCases {
@@ -2119,7 +2075,6 @@ func TestBp2buildDepsMutator_missingTransitiveDep(t *testing.T) {
		Blueprint:            bp,
		ExpectedBazelTargets: expectedBazelTargets,
		Description:          "Skipping conversion of a target with missing transitive dep",
		DepsMutator:          true,
	})
}

@@ -2157,7 +2112,6 @@ func TestBp2buildDepsMutator_missingDirectDep(t *testing.T) {
		Blueprint:            bp,
		ExpectedBazelTargets: expectedBazelTargets,
		Description:          "Skipping conversion of a target with missing direct dep",
		DepsMutator:          true,
	})
}

@@ -2180,7 +2134,6 @@ func TestBp2buildDepsMutator_unconvertedDirectDep(t *testing.T) {
		Blueprint:            bp,
		ExpectedBazelTargets: []string{},
		Description:          "Skipping conversion of a target with unconverted direct dep",
		DepsMutator:          true,
	})
}

@@ -2219,7 +2172,6 @@ func TestBp2buildDepsMutator_unconvertedTransitiveDep(t *testing.T) {
		Blueprint:            bp,
		ExpectedBazelTargets: expectedBazelTargets,
		Description:          "Skipping conversion of a target with unconverted transitive dep",
		DepsMutator:          true,
	})
}

@@ -2259,7 +2211,6 @@ func TestBp2buildDepsMutator_alreadyExistsBuildDeps(t *testing.T) {
		Blueprint:               bp,
		ExpectedBazelTargets:    expectedBazelTargets,
		Description:             "Convert target with already-existing build dep",
		DepsMutator:             true,
	})
}

@@ -2301,6 +2252,5 @@ func TestBp2buildDepsMutator_depOnLibc(t *testing.T) {
		Blueprint:               bp,
		ExpectedBazelTargets:    expectedBazelTargets,
		Description:             "Convert target with dep on libc",
		DepsMutator:             true,
	})
}
+0 −11
Original line number Diff line number Diff line
@@ -124,12 +124,6 @@ type Bp2buildTestCase struct {
	// be merged with the generated BUILD file. This allows custom BUILD targets
	// to be used in tests, or use BUILD files to draw package boundaries.
	KeepBuildFileForDirs []string

	// If true, the bp2build_deps mutator is used for this test. This is an
	// experimental mutator that will disable modules which have transitive
	// dependencies with no bazel definition.
	// TODO: b/285631638 - Enable this feature by default.
	DepsMutator bool
}

func RunBp2BuildTestCaseExtraContext(t *testing.T, registerModuleTypes func(ctx android.RegistrationContext), modifyContext func(ctx *android.TestContext), tc Bp2buildTestCase) {
@@ -140,11 +134,6 @@ func RunBp2BuildTestCaseExtraContext(t *testing.T, registerModuleTypes func(ctx
	if modifyContext != nil {
		preparers = append(preparers, android.FixtureModifyContext(modifyContext))
	}
	if tc.DepsMutator {
		preparers = append(preparers, android.FixtureModifyConfig(func(cfg android.Config) {
			cfg.Bp2buildDepsMutator = true
		}))
	}
	preparers = append(preparers, SetBp2BuildTestRunner)
	bp2buildSetup := android.GroupFixturePreparers(
		preparers...,