Merge "Add java.RegisterRequiredBuildComponentsForTest function" am: c44075b710 am: 398ab4e8c5 am: 465c9c034f

Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1555158

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I83e74ee100868f97303906ed6a1621d5dfd7149b
This commit is contained in:
Paul Duffin
2021-01-22 19:18:02 +00:00
committed by Automerger Merge Worker
6 changed files with 29 additions and 37 deletions

View File

@@ -52,7 +52,6 @@ func testDexpreoptBoot(t *testing.T, ruleFile string, expectedInputs, expectedOu
dexpreopt.SetTestGlobalConfig(config, dexpreoptConfig)
ctx := testContext(config)
RegisterDexpreoptBootJarsComponents(ctx)
run(t, ctx, config)
dexpreoptBootJars := ctx.SingletonForTests("dex_bootjars")

View File

@@ -73,21 +73,10 @@ func testConfig(env map[string]string, bp string, fs map[string][]byte) android.
func testContext(config android.Config) *android.TestContext {
ctx := android.NewTestArchContext(config)
RegisterJavaBuildComponents(ctx)
RegisterAppBuildComponents(ctx)
RegisterAppImportBuildComponents(ctx)
RegisterAppSetBuildComponents(ctx)
RegisterAARBuildComponents(ctx)
RegisterGenRuleBuildComponents(ctx)
RegisterRuntimeResourceOverlayBuildComponents(ctx)
RegisterSystemModulesBuildComponents(ctx)
RegisterRequiredBuildComponentsForTest(ctx)
ctx.RegisterModuleType("java_plugin", PluginFactory)
ctx.RegisterModuleType("filegroup", android.FileGroupFactory)
ctx.RegisterModuleType("python_binary_host", python.PythonBinaryHostFactory)
RegisterDocsBuildComponents(ctx)
RegisterStubsBuildComponents(ctx)
RegisterPrebuiltApisBuildComponents(ctx)
RegisterSdkLibraryBuildComponents(ctx)
ctx.PreArchMutators(android.RegisterDefaultsPreArchMutators)
ctx.PreArchMutators(android.RegisterComponentsMutator)

View File

@@ -95,6 +95,29 @@ func prebuiltApisFilesForLibs(apiLevels []string, sdkLibs []string) map[string][
return fs
}
// Register build components provided by this package that are needed by tests.
//
// In particular this must register all the components that are used in the `Android.bp` snippet
// returned by GatherRequiredDepsForTest()
func RegisterRequiredBuildComponentsForTest(ctx android.RegistrationContext) {
RegisterAARBuildComponents(ctx)
RegisterAppBuildComponents(ctx)
RegisterAppImportBuildComponents(ctx)
RegisterAppSetBuildComponents(ctx)
RegisterDexpreoptBootJarsComponents(ctx)
RegisterDocsBuildComponents(ctx)
RegisterGenRuleBuildComponents(ctx)
RegisterJavaBuildComponents(ctx)
RegisterPrebuiltApisBuildComponents(ctx)
RegisterRuntimeResourceOverlayBuildComponents(ctx)
RegisterSdkLibraryBuildComponents(ctx)
RegisterStubsBuildComponents(ctx)
RegisterSystemModulesBuildComponents(ctx)
}
// Gather the module definitions needed by tests that depend upon code from this package.
//
// Returns an `Android.bp` snippet that defines the modules that are needed by this package.
func GatherRequiredDepsForTest() string {
var bp string