From 4b49b768a2cb7d455aea5347d27d9045b8c481fa Mon Sep 17 00:00:00 2001 From: Colin Cross Date: Fri, 22 Nov 2019 15:25:03 -0800 Subject: [PATCH] Make TestContext.RegisterModuleType take an android.ModuleFactory Avoid having to pass ModuleFactoryAdaptor to every call to RegisterModuleType in a test by wrapping RegisterModuleType. Test: all soong tests Change-Id: If8847d16487de0479cc3020b728256922b3cadba --- android/androidmk_test.go | 4 +- android/arch_test.go | 2 +- android/csuite_config_test.go | 2 +- android/defaults_test.go | 4 +- android/module_test.go | 2 +- android/mutator_test.go | 4 +- android/namespace_test.go | 6 +-- android/neverallow_test.go | 8 ++-- android/package_test.go | 2 +- android/path_properties_test.go | 4 +- android/paths_test.go | 8 ++-- android/prebuilt_etc_test.go | 12 +++--- android/prebuilt_test.go | 6 +-- android/rule_builder_test.go | 4 +- android/sh_binary_test.go | 4 +- android/testing.go | 10 ++++- android/variable_test.go | 12 +++--- android/visibility_test.go | 6 +-- android/vts_config_test.go | 2 +- apex/apex_test.go | 62 +++++++++++++-------------- bpf/bpf_test.go | 2 +- cc/genrule_test.go | 2 +- cc/prebuilt_test.go | 6 +-- cc/test_data_test.go | 6 +-- cc/testing.go | 36 ++++++++-------- genrule/genrule_test.go | 10 ++--- java/dexpreopt_bootjars_test.go | 2 +- java/java_test.go | 74 ++++++++++++++++----------------- python/python_test.go | 9 ++-- rust/testing.go | 38 ++++++++--------- sdk/sdk_test.go | 32 +++++++------- sysprop/sysprop_test.go | 20 ++++----- xml/xml_test.go | 4 +- 33 files changed, 204 insertions(+), 201 deletions(-) diff --git a/android/androidmk_test.go b/android/androidmk_test.go index 0bb455bb3..940e32418 100644 --- a/android/androidmk_test.go +++ b/android/androidmk_test.go @@ -47,8 +47,8 @@ func TestAndroidMkSingleton_PassesUpdatedAndroidMkDataToCustomCallback(t *testin config.inMake = true // Enable androidmk Singleton ctx := NewTestContext() - ctx.RegisterSingletonType("androidmk", SingletonFactoryAdaptor(AndroidMkSingleton)) - ctx.RegisterModuleType("custom", ModuleFactoryAdaptor(customModuleFactory)) + ctx.RegisterSingletonType("androidmk", AndroidMkSingleton) + ctx.RegisterModuleType("custom", customModuleFactory) ctx.Register() bp := ` diff --git a/android/arch_test.go b/android/arch_test.go index 52a66847e..b41e1ab95 100644 --- a/android/arch_test.go +++ b/android/arch_test.go @@ -338,7 +338,7 @@ func TestArchMutator(t *testing.T) { for _, tt := range testCases { t.Run(tt.name, func(t *testing.T) { ctx := NewTestArchContext() - ctx.RegisterModuleType("module", ModuleFactoryAdaptor(archTestModuleFactory)) + ctx.RegisterModuleType("module", archTestModuleFactory) ctx.MockFileSystem(mockFS) ctx.Register() config := TestArchConfig(buildDir, nil) diff --git a/android/csuite_config_test.go b/android/csuite_config_test.go index e534bb71c..5f86bbbfe 100644 --- a/android/csuite_config_test.go +++ b/android/csuite_config_test.go @@ -22,7 +22,7 @@ func testCSuiteConfig(test *testing.T, bpFileContents string) *TestContext { config := TestArchConfig(buildDir, nil) ctx := NewTestArchContext() - ctx.RegisterModuleType("csuite_config", ModuleFactoryAdaptor(CSuiteConfigFactory)) + ctx.RegisterModuleType("csuite_config", CSuiteConfigFactory) ctx.Register() mockFiles := map[string][]byte{ "Android.bp": []byte(bpFileContents), diff --git a/android/defaults_test.go b/android/defaults_test.go index fa2659563..80980f78b 100644 --- a/android/defaults_test.go +++ b/android/defaults_test.go @@ -64,8 +64,8 @@ func TestDefaultsAllowMissingDependencies(t *testing.T) { ctx := NewTestContext() ctx.SetAllowMissingDependencies(true) - ctx.RegisterModuleType("test", ModuleFactoryAdaptor(defaultsTestModuleFactory)) - ctx.RegisterModuleType("defaults", ModuleFactoryAdaptor(defaultsTestDefaultsFactory)) + ctx.RegisterModuleType("test", defaultsTestModuleFactory) + ctx.RegisterModuleType("defaults", defaultsTestDefaultsFactory) ctx.PreArchMutators(RegisterDefaultsPreArchMutators) diff --git a/android/module_test.go b/android/module_test.go index 6dca29f79..fef1766a3 100644 --- a/android/module_test.go +++ b/android/module_test.go @@ -165,7 +165,7 @@ func depsModuleFactory() Module { func TestErrorDependsOnDisabledModule(t *testing.T) { ctx := NewTestContext() - ctx.RegisterModuleType("deps", ModuleFactoryAdaptor(depsModuleFactory)) + ctx.RegisterModuleType("deps", depsModuleFactory) bp := ` deps { diff --git a/android/mutator_test.go b/android/mutator_test.go index 0b23434af..2350fdb0a 100644 --- a/android/mutator_test.go +++ b/android/mutator_test.go @@ -62,7 +62,7 @@ func TestMutatorAddMissingDependencies(t *testing.T) { ctx := NewTestContext() ctx.SetAllowMissingDependencies(true) - ctx.RegisterModuleType("test", ModuleFactoryAdaptor(mutatorTestModuleFactory)) + ctx.RegisterModuleType("test", mutatorTestModuleFactory) ctx.PreDepsMutators(func(ctx RegisterMutatorsContext) { ctx.TopDown("add_missing_dependencies", addMissingDependenciesMutator) }) @@ -131,7 +131,7 @@ func TestModuleString(t *testing.T) { }) }) - ctx.RegisterModuleType("test", ModuleFactoryAdaptor(mutatorTestModuleFactory)) + ctx.RegisterModuleType("test", mutatorTestModuleFactory) bp := ` test { diff --git a/android/namespace_test.go b/android/namespace_test.go index 20241fe1b..90058e3f5 100644 --- a/android/namespace_test.go +++ b/android/namespace_test.go @@ -637,9 +637,9 @@ func setupTestFromFiles(bps map[string][]byte) (ctx *TestContext, errs []error) ctx = NewTestContext() ctx.MockFileSystem(bps) - ctx.RegisterModuleType("test_module", ModuleFactoryAdaptor(newTestModule)) - ctx.RegisterModuleType("soong_namespace", ModuleFactoryAdaptor(NamespaceFactory)) - ctx.RegisterModuleType("blueprint_test_module", newBlueprintTestModule) + ctx.RegisterModuleType("test_module", newTestModule) + ctx.RegisterModuleType("soong_namespace", NamespaceFactory) + ctx.Context.RegisterModuleType("blueprint_test_module", newBlueprintTestModule) ctx.PreArchMutators(RegisterNamespaceMutator) ctx.PreDepsMutators(func(ctx RegisterMutatorsContext) { ctx.BottomUp("rename", renameMutator) diff --git a/android/neverallow_test.go b/android/neverallow_test.go index b75b5b788..bd94e376c 100644 --- a/android/neverallow_test.go +++ b/android/neverallow_test.go @@ -269,10 +269,10 @@ func TestNeverallow(t *testing.T) { func testNeverallow(config Config, fs map[string][]byte) (*TestContext, []error) { ctx := NewTestContext() - ctx.RegisterModuleType("cc_library", ModuleFactoryAdaptor(newMockCcLibraryModule)) - ctx.RegisterModuleType("java_library", ModuleFactoryAdaptor(newMockJavaLibraryModule)) - ctx.RegisterModuleType("java_library_host", ModuleFactoryAdaptor(newMockJavaLibraryModule)) - ctx.RegisterModuleType("java_device_for_host", ModuleFactoryAdaptor(newMockJavaLibraryModule)) + ctx.RegisterModuleType("cc_library", newMockCcLibraryModule) + ctx.RegisterModuleType("java_library", newMockJavaLibraryModule) + ctx.RegisterModuleType("java_library_host", newMockJavaLibraryModule) + ctx.RegisterModuleType("java_device_for_host", newMockJavaLibraryModule) ctx.PostDepsMutators(registerNeverallowMutator) ctx.Register() diff --git a/android/package_test.go b/android/package_test.go index e5b055667..ae286d662 100644 --- a/android/package_test.go +++ b/android/package_test.go @@ -87,7 +87,7 @@ func testPackage(fs map[string][]byte) (*TestContext, []error) { config := TestArchConfig(buildDir, nil) ctx := NewTestArchContext() - ctx.RegisterModuleType("package", ModuleFactoryAdaptor(PackageFactory)) + ctx.RegisterModuleType("package", PackageFactory) ctx.PreArchMutators(registerPackageRenamer) ctx.Register() diff --git a/android/path_properties_test.go b/android/path_properties_test.go index 59bfa6c21..c859bc530 100644 --- a/android/path_properties_test.go +++ b/android/path_properties_test.go @@ -100,8 +100,8 @@ func TestPathDepsMutator(t *testing.T) { config := TestArchConfig(buildDir, nil) ctx := NewTestArchContext() - ctx.RegisterModuleType("test", ModuleFactoryAdaptor(pathDepsMutatorTestModuleFactory)) - ctx.RegisterModuleType("filegroup", ModuleFactoryAdaptor(FileGroupFactory)) + ctx.RegisterModuleType("test", pathDepsMutatorTestModuleFactory) + ctx.RegisterModuleType("filegroup", FileGroupFactory) bp := test.bp + ` filegroup { diff --git a/android/paths_test.go b/android/paths_test.go index 2e67272e0..1d8afa9c1 100644 --- a/android/paths_test.go +++ b/android/paths_test.go @@ -865,9 +865,9 @@ func testPathForModuleSrc(t *testing.T, buildDir string, tests []pathForModuleSr config := TestConfig(buildDir, nil) ctx := NewTestContext() - ctx.RegisterModuleType("test", ModuleFactoryAdaptor(pathForModuleSrcTestModuleFactory)) - ctx.RegisterModuleType("output_file_provider", ModuleFactoryAdaptor(pathForModuleSrcOutputFileProviderModuleFactory)) - ctx.RegisterModuleType("filegroup", ModuleFactoryAdaptor(FileGroupFactory)) + ctx.RegisterModuleType("test", pathForModuleSrcTestModuleFactory) + ctx.RegisterModuleType("output_file_provider", pathForModuleSrcOutputFileProviderModuleFactory) + ctx.RegisterModuleType("filegroup", FileGroupFactory) fgBp := ` filegroup { @@ -1079,7 +1079,7 @@ func TestPathsForModuleSrc_AllowMissingDependencies(t *testing.T) { ctx := NewTestContext() ctx.SetAllowMissingDependencies(true) - ctx.RegisterModuleType("test", ModuleFactoryAdaptor(pathForModuleSrcTestModuleFactory)) + ctx.RegisterModuleType("test", pathForModuleSrcTestModuleFactory) bp := ` test { diff --git a/android/prebuilt_etc_test.go b/android/prebuilt_etc_test.go index f675ea3c3..100e73d0c 100644 --- a/android/prebuilt_etc_test.go +++ b/android/prebuilt_etc_test.go @@ -23,12 +23,12 @@ import ( func testPrebuiltEtc(t *testing.T, bp string) (*TestContext, Config) { config := TestArchConfig(buildDir, nil) ctx := NewTestArchContext() - ctx.RegisterModuleType("prebuilt_etc", ModuleFactoryAdaptor(PrebuiltEtcFactory)) - ctx.RegisterModuleType("prebuilt_etc_host", ModuleFactoryAdaptor(PrebuiltEtcHostFactory)) - ctx.RegisterModuleType("prebuilt_usr_share", ModuleFactoryAdaptor(PrebuiltUserShareFactory)) - ctx.RegisterModuleType("prebuilt_usr_share_host", ModuleFactoryAdaptor(PrebuiltUserShareHostFactory)) - ctx.RegisterModuleType("prebuilt_font", ModuleFactoryAdaptor(PrebuiltFontFactory)) - ctx.RegisterModuleType("prebuilt_firmware", ModuleFactoryAdaptor(PrebuiltFirmwareFactory)) + ctx.RegisterModuleType("prebuilt_etc", PrebuiltEtcFactory) + ctx.RegisterModuleType("prebuilt_etc_host", PrebuiltEtcHostFactory) + ctx.RegisterModuleType("prebuilt_usr_share", PrebuiltUserShareFactory) + ctx.RegisterModuleType("prebuilt_usr_share_host", PrebuiltUserShareHostFactory) + ctx.RegisterModuleType("prebuilt_font", PrebuiltFontFactory) + ctx.RegisterModuleType("prebuilt_firmware", PrebuiltFirmwareFactory) ctx.PreDepsMutators(func(ctx RegisterMutatorsContext) { ctx.BottomUp("prebuilt_etc", prebuiltEtcMutator).Parallel() }) diff --git a/android/prebuilt_test.go b/android/prebuilt_test.go index 0a18e2c90..81fb2783f 100644 --- a/android/prebuilt_test.go +++ b/android/prebuilt_test.go @@ -132,9 +132,9 @@ func TestPrebuilts(t *testing.T) { ctx := NewTestContext() ctx.PreArchMutators(RegisterPrebuiltsPreArchMutators) ctx.PostDepsMutators(RegisterPrebuiltsPostDepsMutators) - ctx.RegisterModuleType("filegroup", ModuleFactoryAdaptor(FileGroupFactory)) - ctx.RegisterModuleType("prebuilt", ModuleFactoryAdaptor(newPrebuiltModule)) - ctx.RegisterModuleType("source", ModuleFactoryAdaptor(newSourceModule)) + ctx.RegisterModuleType("filegroup", FileGroupFactory) + ctx.RegisterModuleType("prebuilt", newPrebuiltModule) + ctx.RegisterModuleType("source", newSourceModule) ctx.Register() ctx.MockFileSystem(map[string][]byte{ "prebuilt_file": nil, diff --git a/android/rule_builder_test.go b/android/rule_builder_test.go index b4848112a..52c32df5c 100644 --- a/android/rule_builder_test.go +++ b/android/rule_builder_test.go @@ -465,8 +465,8 @@ func TestRuleBuilder_Build(t *testing.T) { "bar": nil, "cp": nil, }) - ctx.RegisterModuleType("rule_builder_test", ModuleFactoryAdaptor(testRuleBuilderFactory)) - ctx.RegisterSingletonType("rule_builder_test", SingletonFactoryAdaptor(testRuleBuilderSingletonFactory)) + ctx.RegisterModuleType("rule_builder_test", testRuleBuilderFactory) + ctx.RegisterSingletonType("rule_builder_test", testRuleBuilderSingletonFactory) ctx.Register() _, errs := ctx.ParseFileList(".", []string{"Android.bp"}) diff --git a/android/sh_binary_test.go b/android/sh_binary_test.go index 9df769ca2..a13875414 100644 --- a/android/sh_binary_test.go +++ b/android/sh_binary_test.go @@ -9,8 +9,8 @@ func testShBinary(t *testing.T, bp string) (*TestContext, Config) { config := TestArchConfig(buildDir, nil) ctx := NewTestArchContext() - ctx.RegisterModuleType("sh_test", ModuleFactoryAdaptor(ShTestFactory)) - ctx.RegisterModuleType("sh_test_host", ModuleFactoryAdaptor(ShTestHostFactory)) + ctx.RegisterModuleType("sh_test", ShTestFactory) + ctx.RegisterModuleType("sh_test_host", ShTestHostFactory) ctx.Register() mockFiles := map[string][]byte{ "Android.bp": []byte(bp), diff --git a/android/testing.go b/android/testing.go index 447ffd6d4..4b55920c5 100644 --- a/android/testing.go +++ b/android/testing.go @@ -71,7 +71,15 @@ func (ctx *TestContext) PostDepsMutators(f RegisterMutatorFunc) { func (ctx *TestContext) Register() { registerMutators(ctx.Context.Context, ctx.preArch, ctx.preDeps, ctx.postDeps) - ctx.RegisterSingletonType("env", SingletonFactoryAdaptor(EnvSingleton)) + ctx.RegisterSingletonType("env", EnvSingleton) +} + +func (ctx *TestContext) RegisterModuleType(name string, factory ModuleFactory) { + ctx.Context.RegisterModuleType(name, ModuleFactoryAdaptor(factory)) +} + +func (ctx *TestContext) RegisterSingletonType(name string, factory SingletonFactory) { + ctx.Context.RegisterSingletonType(name, SingletonFactoryAdaptor(factory)) } func (ctx *TestContext) ModuleForTests(name, variant string) TestingModule { diff --git a/android/variable_test.go b/android/variable_test.go index c1910fe03..1826e3901 100644 --- a/android/variable_test.go +++ b/android/variable_test.go @@ -159,17 +159,17 @@ func testProductVariableModuleFactoryFactory(props interface{}) func() Module { func TestProductVariables(t *testing.T) { ctx := NewTestContext() // A module type that has a srcs property but not a cflags property. - ctx.RegisterModuleType("module1", ModuleFactoryAdaptor(testProductVariableModuleFactoryFactory(struct { + ctx.RegisterModuleType("module1", testProductVariableModuleFactoryFactory(struct { Srcs []string - }{}))) + }{})) // A module type that has a cflags property but not a srcs property. - ctx.RegisterModuleType("module2", ModuleFactoryAdaptor(testProductVariableModuleFactoryFactory(struct { + ctx.RegisterModuleType("module2", testProductVariableModuleFactoryFactory(struct { Cflags []string - }{}))) + }{})) // A module type that does not have any properties that match product_variables. - ctx.RegisterModuleType("module3", ModuleFactoryAdaptor(testProductVariableModuleFactoryFactory(struct { + ctx.RegisterModuleType("module3", testProductVariableModuleFactoryFactory(struct { Foo []string - }{}))) + }{})) ctx.PreDepsMutators(func(ctx RegisterMutatorsContext) { ctx.BottomUp("variable", variableMutator).Parallel() }) diff --git a/android/visibility_test.go b/android/visibility_test.go index d13fadf6a..fd9e98c55 100644 --- a/android/visibility_test.go +++ b/android/visibility_test.go @@ -871,9 +871,9 @@ func testVisibility(buildDir string, fs map[string][]byte) (*TestContext, []erro config := TestArchConfig(buildDir, nil) ctx := NewTestArchContext() - ctx.RegisterModuleType("package", ModuleFactoryAdaptor(PackageFactory)) - ctx.RegisterModuleType("mock_library", ModuleFactoryAdaptor(newMockLibraryModule)) - ctx.RegisterModuleType("mock_defaults", ModuleFactoryAdaptor(defaultsFactory)) + ctx.RegisterModuleType("package", PackageFactory) + ctx.RegisterModuleType("mock_library", newMockLibraryModule) + ctx.RegisterModuleType("mock_defaults", defaultsFactory) ctx.PreArchMutators(registerPackageRenamer) ctx.PreArchMutators(registerVisibilityRuleChecker) ctx.PreArchMutators(RegisterDefaultsPreArchMutators) diff --git a/android/vts_config_test.go b/android/vts_config_test.go index 142b2f591..162944d07 100644 --- a/android/vts_config_test.go +++ b/android/vts_config_test.go @@ -22,7 +22,7 @@ func testVtsConfig(test *testing.T, bpFileContents string) *TestContext { config := TestArchConfig(buildDir, nil) ctx := NewTestArchContext() - ctx.RegisterModuleType("vts_config", ModuleFactoryAdaptor(VtsConfigFactory)) + ctx.RegisterModuleType("vts_config", VtsConfigFactory) ctx.Register() mockFiles := map[string][]byte{ "Android.bp": []byte(bpFileContents), diff --git a/apex/apex_test.go b/apex/apex_test.go index 4d7777dd6..b239d39ed 100644 --- a/apex/apex_test.go +++ b/apex/apex_test.go @@ -101,39 +101,39 @@ func testApexContext(t *testing.T, bp string, handlers ...testCustomizer) (*andr config.TestProductVariables.Platform_vndk_version = proptools.StringPtr("VER") ctx := android.NewTestArchContext() - ctx.RegisterModuleType("apex", android.ModuleFactoryAdaptor(BundleFactory)) - ctx.RegisterModuleType("apex_test", android.ModuleFactoryAdaptor(testApexBundleFactory)) - ctx.RegisterModuleType("apex_vndk", android.ModuleFactoryAdaptor(vndkApexBundleFactory)) - ctx.RegisterModuleType("apex_key", android.ModuleFactoryAdaptor(ApexKeyFactory)) - ctx.RegisterModuleType("apex_defaults", android.ModuleFactoryAdaptor(defaultsFactory)) - ctx.RegisterModuleType("prebuilt_apex", android.ModuleFactoryAdaptor(PrebuiltFactory)) - ctx.RegisterModuleType("override_apex", android.ModuleFactoryAdaptor(overrideApexFactory)) + ctx.RegisterModuleType("apex", BundleFactory) + ctx.RegisterModuleType("apex_test", testApexBundleFactory) + ctx.RegisterModuleType("apex_vndk", vndkApexBundleFactory) + ctx.RegisterModuleType("apex_key", ApexKeyFactory) + ctx.RegisterModuleType("apex_defaults", defaultsFactory) + ctx.RegisterModuleType("prebuilt_apex", PrebuiltFactory) + ctx.RegisterModuleType("override_apex", overrideApexFactory) - ctx.RegisterModuleType("cc_library", android.ModuleFactoryAdaptor(cc.LibraryFactory)) - ctx.RegisterModuleType("cc_library_shared", android.ModuleFactoryAdaptor(cc.LibrarySharedFactory)) - ctx.RegisterModuleType("cc_library_headers", android.ModuleFactoryAdaptor(cc.LibraryHeaderFactory)) - ctx.RegisterModuleType("cc_prebuilt_library_shared", android.ModuleFactoryAdaptor(cc.PrebuiltSharedLibraryFactory)) - ctx.RegisterModuleType("cc_prebuilt_library_static", android.ModuleFactoryAdaptor(cc.PrebuiltStaticLibraryFactory)) - ctx.RegisterModuleType("cc_binary", android.ModuleFactoryAdaptor(cc.BinaryFactory)) - ctx.RegisterModuleType("cc_object", android.ModuleFactoryAdaptor(cc.ObjectFactory)) - ctx.RegisterModuleType("cc_defaults", android.ModuleFactoryAdaptor(func() android.Module { + ctx.RegisterModuleType("cc_library", cc.LibraryFactory) + ctx.RegisterModuleType("cc_library_shared", cc.LibrarySharedFactory) + ctx.RegisterModuleType("cc_library_headers", cc.LibraryHeaderFactory) + ctx.RegisterModuleType("cc_prebuilt_library_shared", cc.PrebuiltSharedLibraryFactory) + ctx.RegisterModuleType("cc_prebuilt_library_static", cc.PrebuiltStaticLibraryFactory) + ctx.RegisterModuleType("cc_binary", cc.BinaryFactory) + ctx.RegisterModuleType("cc_object", cc.ObjectFactory) + ctx.RegisterModuleType("cc_defaults", func() android.Module { return cc.DefaultsFactory() - })) - ctx.RegisterModuleType("cc_test", android.ModuleFactoryAdaptor(cc.TestFactory)) - ctx.RegisterModuleType("llndk_library", android.ModuleFactoryAdaptor(cc.LlndkLibraryFactory)) - ctx.RegisterModuleType("vndk_prebuilt_shared", android.ModuleFactoryAdaptor(cc.VndkPrebuiltSharedFactory)) - ctx.RegisterModuleType("vndk_libraries_txt", android.ModuleFactoryAdaptor(cc.VndkLibrariesTxtFactory)) - ctx.RegisterModuleType("toolchain_library", android.ModuleFactoryAdaptor(cc.ToolchainLibraryFactory)) - ctx.RegisterModuleType("prebuilt_etc", android.ModuleFactoryAdaptor(android.PrebuiltEtcFactory)) - ctx.RegisterModuleType("sh_binary", android.ModuleFactoryAdaptor(android.ShBinaryFactory)) - ctx.RegisterModuleType("android_app_certificate", android.ModuleFactoryAdaptor(java.AndroidAppCertificateFactory)) - ctx.RegisterModuleType("filegroup", android.ModuleFactoryAdaptor(android.FileGroupFactory)) - ctx.RegisterModuleType("java_library", android.ModuleFactoryAdaptor(java.LibraryFactory)) - ctx.RegisterModuleType("java_import", android.ModuleFactoryAdaptor(java.ImportFactory)) - ctx.RegisterModuleType("java_system_modules", android.ModuleFactoryAdaptor(java.SystemModulesFactory)) - ctx.RegisterModuleType("android_app", android.ModuleFactoryAdaptor(java.AndroidAppFactory)) - ctx.RegisterModuleType("android_app_import", android.ModuleFactoryAdaptor(java.AndroidAppImportFactory)) - ctx.RegisterModuleType("override_android_app", android.ModuleFactoryAdaptor(java.OverrideAndroidAppModuleFactory)) + }) + ctx.RegisterModuleType("cc_test", cc.TestFactory) + ctx.RegisterModuleType("llndk_library", cc.LlndkLibraryFactory) + ctx.RegisterModuleType("vndk_prebuilt_shared", cc.VndkPrebuiltSharedFactory) + ctx.RegisterModuleType("vndk_libraries_txt", cc.VndkLibrariesTxtFactory) + ctx.RegisterModuleType("toolchain_library", cc.ToolchainLibraryFactory) + ctx.RegisterModuleType("prebuilt_etc", android.PrebuiltEtcFactory) + ctx.RegisterModuleType("sh_binary", android.ShBinaryFactory) + ctx.RegisterModuleType("android_app_certificate", java.AndroidAppCertificateFactory) + ctx.RegisterModuleType("filegroup", android.FileGroupFactory) + ctx.RegisterModuleType("java_library", java.LibraryFactory) + ctx.RegisterModuleType("java_import", java.ImportFactory) + ctx.RegisterModuleType("java_system_modules", java.SystemModulesFactory) + ctx.RegisterModuleType("android_app", java.AndroidAppFactory) + ctx.RegisterModuleType("android_app_import", java.AndroidAppImportFactory) + ctx.RegisterModuleType("override_android_app", java.OverrideAndroidAppModuleFactory) ctx.PreArchMutators(android.RegisterDefaultsPreArchMutators) ctx.PreArchMutators(func(ctx android.RegisterMutatorsContext) { diff --git a/bpf/bpf_test.go b/bpf/bpf_test.go index cbb251fad..73b90ba0f 100644 --- a/bpf/bpf_test.go +++ b/bpf/bpf_test.go @@ -55,7 +55,7 @@ func testContext(bp string) *android.TestContext { } ctx := cc.CreateTestContext(bp, mockFS, android.Android) - ctx.RegisterModuleType("bpf", android.ModuleFactoryAdaptor(bpfFactory)) + ctx.RegisterModuleType("bpf", bpfFactory) ctx.Register() return ctx diff --git a/cc/genrule_test.go b/cc/genrule_test.go index 92024ac14..785e3e1e4 100644 --- a/cc/genrule_test.go +++ b/cc/genrule_test.go @@ -25,7 +25,7 @@ func testGenruleContext(config android.Config, bp string, fs map[string][]byte) *android.TestContext { ctx := android.NewTestArchContext() - ctx.RegisterModuleType("cc_genrule", android.ModuleFactoryAdaptor(genRuleFactory)) + ctx.RegisterModuleType("cc_genrule", genRuleFactory) ctx.Register() mockFS := map[string][]byte{ diff --git a/cc/prebuilt_test.go b/cc/prebuilt_test.go index edcd26eff..72f9f4ac3 100644 --- a/cc/prebuilt_test.go +++ b/cc/prebuilt_test.go @@ -72,9 +72,9 @@ func TestPrebuilt(t *testing.T) { ctx := CreateTestContext(bp, fs, android.Android) - ctx.RegisterModuleType("cc_prebuilt_library_shared", android.ModuleFactoryAdaptor(PrebuiltSharedLibraryFactory)) - ctx.RegisterModuleType("cc_prebuilt_library_static", android.ModuleFactoryAdaptor(PrebuiltStaticLibraryFactory)) - ctx.RegisterModuleType("cc_prebuilt_binary", android.ModuleFactoryAdaptor(prebuiltBinaryFactory)) + ctx.RegisterModuleType("cc_prebuilt_library_shared", PrebuiltSharedLibraryFactory) + ctx.RegisterModuleType("cc_prebuilt_library_static", PrebuiltStaticLibraryFactory) + ctx.RegisterModuleType("cc_prebuilt_binary", prebuiltBinaryFactory) ctx.PreArchMutators(android.RegisterPrebuiltsPreArchMutators) ctx.PostDepsMutators(android.RegisterPrebuiltsPostDepsMutators) diff --git a/cc/test_data_test.go b/cc/test_data_test.go index 21ea765eb..962ff2685 100644 --- a/cc/test_data_test.go +++ b/cc/test_data_test.go @@ -126,10 +126,8 @@ func TestDataTests(t *testing.T) { "dir/baz": nil, "dir/bar/baz": nil, }) - ctx.RegisterModuleType("filegroup", - android.ModuleFactoryAdaptor(android.FileGroupFactory)) - ctx.RegisterModuleType("test", - android.ModuleFactoryAdaptor(newTest)) + ctx.RegisterModuleType("filegroup", android.FileGroupFactory) + ctx.RegisterModuleType("test", newTest) ctx.Register() _, errs := ctx.ParseBlueprintsFiles("Blueprints") diff --git a/cc/testing.go b/cc/testing.go index 9ad72d9f5..3943e72cc 100644 --- a/cc/testing.go +++ b/cc/testing.go @@ -253,23 +253,23 @@ func CreateTestContext(bp string, fs map[string][]byte, os android.OsType) *android.TestContext { ctx := android.NewTestArchContext() - ctx.RegisterModuleType("cc_defaults", android.ModuleFactoryAdaptor(defaultsFactory)) - ctx.RegisterModuleType("cc_binary", android.ModuleFactoryAdaptor(BinaryFactory)) - ctx.RegisterModuleType("cc_binary_host", android.ModuleFactoryAdaptor(binaryHostFactory)) - ctx.RegisterModuleType("cc_fuzz", android.ModuleFactoryAdaptor(FuzzFactory)) - ctx.RegisterModuleType("cc_library", android.ModuleFactoryAdaptor(LibraryFactory)) - ctx.RegisterModuleType("cc_library_shared", android.ModuleFactoryAdaptor(LibrarySharedFactory)) - ctx.RegisterModuleType("cc_library_static", android.ModuleFactoryAdaptor(LibraryStaticFactory)) - ctx.RegisterModuleType("cc_library_headers", android.ModuleFactoryAdaptor(LibraryHeaderFactory)) - ctx.RegisterModuleType("cc_test", android.ModuleFactoryAdaptor(TestFactory)) - ctx.RegisterModuleType("toolchain_library", android.ModuleFactoryAdaptor(ToolchainLibraryFactory)) - ctx.RegisterModuleType("llndk_library", android.ModuleFactoryAdaptor(LlndkLibraryFactory)) - ctx.RegisterModuleType("llndk_headers", android.ModuleFactoryAdaptor(llndkHeadersFactory)) - ctx.RegisterModuleType("vendor_public_library", android.ModuleFactoryAdaptor(vendorPublicLibraryFactory)) - ctx.RegisterModuleType("cc_object", android.ModuleFactoryAdaptor(ObjectFactory)) - ctx.RegisterModuleType("filegroup", android.ModuleFactoryAdaptor(android.FileGroupFactory)) - ctx.RegisterModuleType("vndk_prebuilt_shared", android.ModuleFactoryAdaptor(VndkPrebuiltSharedFactory)) - ctx.RegisterModuleType("vndk_libraries_txt", android.ModuleFactoryAdaptor(VndkLibrariesTxtFactory)) + ctx.RegisterModuleType("cc_defaults", defaultsFactory) + ctx.RegisterModuleType("cc_binary", BinaryFactory) + ctx.RegisterModuleType("cc_binary_host", binaryHostFactory) + ctx.RegisterModuleType("cc_fuzz", FuzzFactory) + ctx.RegisterModuleType("cc_library", LibraryFactory) + ctx.RegisterModuleType("cc_library_shared", LibrarySharedFactory) + ctx.RegisterModuleType("cc_library_static", LibraryStaticFactory) + ctx.RegisterModuleType("cc_library_headers", LibraryHeaderFactory) + ctx.RegisterModuleType("cc_test", TestFactory) + ctx.RegisterModuleType("toolchain_library", ToolchainLibraryFactory) + ctx.RegisterModuleType("llndk_library", LlndkLibraryFactory) + ctx.RegisterModuleType("llndk_headers", llndkHeadersFactory) + ctx.RegisterModuleType("vendor_public_library", vendorPublicLibraryFactory) + ctx.RegisterModuleType("cc_object", ObjectFactory) + ctx.RegisterModuleType("filegroup", android.FileGroupFactory) + ctx.RegisterModuleType("vndk_prebuilt_shared", VndkPrebuiltSharedFactory) + ctx.RegisterModuleType("vndk_libraries_txt", VndkLibrariesTxtFactory) ctx.PreDepsMutators(func(ctx android.RegisterMutatorsContext) { ctx.BottomUp("image", ImageMutator).Parallel() ctx.BottomUp("link", LinkageMutator).Parallel() @@ -281,7 +281,7 @@ func CreateTestContext(bp string, fs map[string][]byte, ctx.TopDown("double_loadable", checkDoubleLoadableLibraries).Parallel() }) ctx.PreArchMutators(android.RegisterDefaultsPreArchMutators) - ctx.RegisterSingletonType("vndk-snapshot", android.SingletonFactoryAdaptor(VndkSnapshotSingleton)) + ctx.RegisterSingletonType("vndk-snapshot", VndkSnapshotSingleton) // add some modules that are required by the compiler and/or linker bp = bp + GatherRequiredDepsForTest(os) diff --git a/genrule/genrule_test.go b/genrule/genrule_test.go index 5ac0e8cd3..07de999bc 100644 --- a/genrule/genrule_test.go +++ b/genrule/genrule_test.go @@ -55,11 +55,11 @@ func testContext(config android.Config, bp string, fs map[string][]byte) *android.TestContext { ctx := android.NewTestArchContext() - ctx.RegisterModuleType("filegroup", android.ModuleFactoryAdaptor(android.FileGroupFactory)) - ctx.RegisterModuleType("genrule", android.ModuleFactoryAdaptor(GenRuleFactory)) - ctx.RegisterModuleType("gensrcs", android.ModuleFactoryAdaptor(GenSrcsFactory)) - ctx.RegisterModuleType("genrule_defaults", android.ModuleFactoryAdaptor(defaultsFactory)) - ctx.RegisterModuleType("tool", android.ModuleFactoryAdaptor(toolFactory)) + ctx.RegisterModuleType("filegroup", android.FileGroupFactory) + ctx.RegisterModuleType("genrule", GenRuleFactory) + ctx.RegisterModuleType("gensrcs", GenSrcsFactory) + ctx.RegisterModuleType("genrule_defaults", defaultsFactory) + ctx.RegisterModuleType("tool", toolFactory) ctx.PreArchMutators(android.RegisterDefaultsPreArchMutators) ctx.Register() diff --git a/java/dexpreopt_bootjars_test.go b/java/dexpreopt_bootjars_test.go index a684ab232..29a5abe7f 100644 --- a/java/dexpreopt_bootjars_test.go +++ b/java/dexpreopt_bootjars_test.go @@ -53,7 +53,7 @@ func TestDexpreoptBootJars(t *testing.T) { ctx := testContext(bp, nil) - ctx.RegisterSingletonType("dex_bootjars", android.SingletonFactoryAdaptor(dexpreoptBootJarsFactory)) + ctx.RegisterSingletonType("dex_bootjars", dexpreoptBootJarsFactory) run(t, ctx, config) diff --git a/java/java_test.go b/java/java_test.go index 71aba3ab1..efef7c1cc 100644 --- a/java/java_test.go +++ b/java/java_test.go @@ -63,38 +63,38 @@ func testConfig(env map[string]string) android.Config { func testContext(bp string, fs map[string][]byte) *android.TestContext { ctx := android.NewTestArchContext() - ctx.RegisterModuleType("android_app", android.ModuleFactoryAdaptor(AndroidAppFactory)) - ctx.RegisterModuleType("android_app_certificate", android.ModuleFactoryAdaptor(AndroidAppCertificateFactory)) - ctx.RegisterModuleType("android_app_import", android.ModuleFactoryAdaptor(AndroidAppImportFactory)) - ctx.RegisterModuleType("android_library", android.ModuleFactoryAdaptor(AndroidLibraryFactory)) - ctx.RegisterModuleType("android_test", android.ModuleFactoryAdaptor(AndroidTestFactory)) - ctx.RegisterModuleType("android_test_helper_app", android.ModuleFactoryAdaptor(AndroidTestHelperAppFactory)) - ctx.RegisterModuleType("android_test_import", android.ModuleFactoryAdaptor(AndroidTestImportFactory)) - ctx.RegisterModuleType("java_binary", android.ModuleFactoryAdaptor(BinaryFactory)) - ctx.RegisterModuleType("java_binary_host", android.ModuleFactoryAdaptor(BinaryHostFactory)) - ctx.RegisterModuleType("java_device_for_host", android.ModuleFactoryAdaptor(DeviceForHostFactory)) - ctx.RegisterModuleType("java_host_for_device", android.ModuleFactoryAdaptor(HostForDeviceFactory)) - ctx.RegisterModuleType("java_library", android.ModuleFactoryAdaptor(LibraryFactory)) - ctx.RegisterModuleType("java_library_host", android.ModuleFactoryAdaptor(LibraryHostFactory)) - ctx.RegisterModuleType("java_test", android.ModuleFactoryAdaptor(TestFactory)) - ctx.RegisterModuleType("java_import", android.ModuleFactoryAdaptor(ImportFactory)) - ctx.RegisterModuleType("java_import_host", android.ModuleFactoryAdaptor(ImportFactoryHost)) - ctx.RegisterModuleType("java_defaults", android.ModuleFactoryAdaptor(defaultsFactory)) - ctx.RegisterModuleType("java_system_modules", android.ModuleFactoryAdaptor(SystemModulesFactory)) - ctx.RegisterModuleType("java_genrule", android.ModuleFactoryAdaptor(genRuleFactory)) - ctx.RegisterModuleType("java_plugin", android.ModuleFactoryAdaptor(PluginFactory)) - ctx.RegisterModuleType("dex_import", android.ModuleFactoryAdaptor(DexImportFactory)) - ctx.RegisterModuleType("filegroup", android.ModuleFactoryAdaptor(android.FileGroupFactory)) - ctx.RegisterModuleType("genrule", android.ModuleFactoryAdaptor(genrule.GenRuleFactory)) - ctx.RegisterModuleType("droiddoc", android.ModuleFactoryAdaptor(DroiddocFactory)) - ctx.RegisterModuleType("droiddoc_host", android.ModuleFactoryAdaptor(DroiddocHostFactory)) - ctx.RegisterModuleType("droiddoc_template", android.ModuleFactoryAdaptor(ExportedDroiddocDirFactory)) - ctx.RegisterModuleType("prebuilt_stubs_sources", android.ModuleFactoryAdaptor(PrebuiltStubsSourcesFactory)) - ctx.RegisterModuleType("java_sdk_library", android.ModuleFactoryAdaptor(SdkLibraryFactory)) - ctx.RegisterModuleType("java_sdk_library_import", android.ModuleFactoryAdaptor(sdkLibraryImportFactory)) - ctx.RegisterModuleType("override_android_app", android.ModuleFactoryAdaptor(OverrideAndroidAppModuleFactory)) - ctx.RegisterModuleType("override_android_test", android.ModuleFactoryAdaptor(OverrideAndroidTestModuleFactory)) - ctx.RegisterModuleType("prebuilt_apis", android.ModuleFactoryAdaptor(PrebuiltApisFactory)) + ctx.RegisterModuleType("android_app", AndroidAppFactory) + ctx.RegisterModuleType("android_app_certificate", AndroidAppCertificateFactory) + ctx.RegisterModuleType("android_app_import", AndroidAppImportFactory) + ctx.RegisterModuleType("android_library", AndroidLibraryFactory) + ctx.RegisterModuleType("android_test", AndroidTestFactory) + ctx.RegisterModuleType("android_test_helper_app", AndroidTestHelperAppFactory) + ctx.RegisterModuleType("android_test_import", AndroidTestImportFactory) + ctx.RegisterModuleType("java_binary", BinaryFactory) + ctx.RegisterModuleType("java_binary_host", BinaryHostFactory) + ctx.RegisterModuleType("java_device_for_host", DeviceForHostFactory) + ctx.RegisterModuleType("java_host_for_device", HostForDeviceFactory) + ctx.RegisterModuleType("java_library", LibraryFactory) + ctx.RegisterModuleType("java_library_host", LibraryHostFactory) + ctx.RegisterModuleType("java_test", TestFactory) + ctx.RegisterModuleType("java_import", ImportFactory) + ctx.RegisterModuleType("java_import_host", ImportFactoryHost) + ctx.RegisterModuleType("java_defaults", defaultsFactory) + ctx.RegisterModuleType("java_system_modules", SystemModulesFactory) + ctx.RegisterModuleType("java_genrule", genRuleFactory) + ctx.RegisterModuleType("java_plugin", PluginFactory) + ctx.RegisterModuleType("dex_import", DexImportFactory) + ctx.RegisterModuleType("filegroup", android.FileGroupFactory) + ctx.RegisterModuleType("genrule", genrule.GenRuleFactory) + ctx.RegisterModuleType("droiddoc", DroiddocFactory) + ctx.RegisterModuleType("droiddoc_host", DroiddocHostFactory) + ctx.RegisterModuleType("droiddoc_template", ExportedDroiddocDirFactory) + ctx.RegisterModuleType("prebuilt_stubs_sources", PrebuiltStubsSourcesFactory) + ctx.RegisterModuleType("java_sdk_library", SdkLibraryFactory) + ctx.RegisterModuleType("java_sdk_library_import", sdkLibraryImportFactory) + ctx.RegisterModuleType("override_android_app", OverrideAndroidAppModuleFactory) + ctx.RegisterModuleType("override_android_test", OverrideAndroidTestModuleFactory) + ctx.RegisterModuleType("prebuilt_apis", PrebuiltApisFactory) ctx.PreArchMutators(android.RegisterPrebuiltsPreArchMutators) ctx.PreArchMutators(android.RegisterPrebuiltsPostDepsMutators) ctx.PreArchMutators(android.RegisterDefaultsPreArchMutators) @@ -106,11 +106,11 @@ func testContext(bp string, fs map[string][]byte) *android.TestContext { ctx.RegisterPreSingletonType("sdk_versions", android.SingletonFactoryAdaptor(sdkPreSingletonFactory)) // Register module types and mutators from cc needed for JNI testing - ctx.RegisterModuleType("cc_library", android.ModuleFactoryAdaptor(cc.LibraryFactory)) - ctx.RegisterModuleType("cc_object", android.ModuleFactoryAdaptor(cc.ObjectFactory)) - ctx.RegisterModuleType("toolchain_library", android.ModuleFactoryAdaptor(cc.ToolchainLibraryFactory)) - ctx.RegisterModuleType("llndk_library", android.ModuleFactoryAdaptor(cc.LlndkLibraryFactory)) - ctx.RegisterModuleType("ndk_prebuilt_shared_stl", android.ModuleFactoryAdaptor(cc.NdkPrebuiltSharedStlFactory)) + ctx.RegisterModuleType("cc_library", cc.LibraryFactory) + ctx.RegisterModuleType("cc_object", cc.ObjectFactory) + ctx.RegisterModuleType("toolchain_library", cc.ToolchainLibraryFactory) + ctx.RegisterModuleType("llndk_library", cc.LlndkLibraryFactory) + ctx.RegisterModuleType("ndk_prebuilt_shared_stl", cc.NdkPrebuiltSharedStlFactory) ctx.PreDepsMutators(func(ctx android.RegisterMutatorsContext) { ctx.BottomUp("link", cc.LinkageMutator).Parallel() ctx.BottomUp("begin", cc.BeginMutator).Parallel() diff --git a/python/python_test.go b/python/python_test.go index e5fe126c1..ba5e7fadc 100644 --- a/python/python_test.go +++ b/python/python_test.go @@ -332,12 +332,9 @@ func TestPythonModule(t *testing.T) { ctx.PreDepsMutators(func(ctx android.RegisterMutatorsContext) { ctx.BottomUp("version_split", versionSplitMutator()).Parallel() }) - ctx.RegisterModuleType("python_library_host", - android.ModuleFactoryAdaptor(PythonLibraryHostFactory)) - ctx.RegisterModuleType("python_binary_host", - android.ModuleFactoryAdaptor(PythonBinaryHostFactory)) - ctx.RegisterModuleType("python_defaults", - android.ModuleFactoryAdaptor(defaultsFactory)) + ctx.RegisterModuleType("python_library_host", PythonLibraryHostFactory) + ctx.RegisterModuleType("python_binary_host", PythonBinaryHostFactory) + ctx.RegisterModuleType("python_defaults", defaultsFactory) ctx.PreArchMutators(android.RegisterDefaultsPreArchMutators) ctx.Register() ctx.MockFileSystem(d.mockFiles) diff --git a/rust/testing.go b/rust/testing.go index 24defa634..fbded7320 100644 --- a/rust/testing.go +++ b/rust/testing.go @@ -164,25 +164,25 @@ func GatherRequiredDepsForTest() string { func CreateTestContext(bp string) *android.TestContext { ctx := android.NewTestArchContext() - ctx.RegisterModuleType("cc_library", android.ModuleFactoryAdaptor(cc.LibraryFactory)) - ctx.RegisterModuleType("cc_object", android.ModuleFactoryAdaptor(cc.ObjectFactory)) - ctx.RegisterModuleType("rust_binary", android.ModuleFactoryAdaptor(RustBinaryFactory)) - ctx.RegisterModuleType("rust_binary_host", android.ModuleFactoryAdaptor(RustBinaryHostFactory)) - ctx.RegisterModuleType("rust_test", android.ModuleFactoryAdaptor(RustTestFactory)) - ctx.RegisterModuleType("rust_test_host", android.ModuleFactoryAdaptor(RustTestHostFactory)) - ctx.RegisterModuleType("rust_library", android.ModuleFactoryAdaptor(RustLibraryFactory)) - ctx.RegisterModuleType("rust_library_host", android.ModuleFactoryAdaptor(RustLibraryHostFactory)) - ctx.RegisterModuleType("rust_library_host_rlib", android.ModuleFactoryAdaptor(RustLibraryRlibHostFactory)) - ctx.RegisterModuleType("rust_library_host_dylib", android.ModuleFactoryAdaptor(RustLibraryDylibHostFactory)) - ctx.RegisterModuleType("rust_library_rlib", android.ModuleFactoryAdaptor(RustLibraryRlibFactory)) - ctx.RegisterModuleType("rust_library_dylib", android.ModuleFactoryAdaptor(RustLibraryDylibFactory)) - ctx.RegisterModuleType("rust_library_shared", android.ModuleFactoryAdaptor(RustLibrarySharedFactory)) - ctx.RegisterModuleType("rust_library_static", android.ModuleFactoryAdaptor(RustLibraryStaticFactory)) - ctx.RegisterModuleType("rust_library_host_shared", android.ModuleFactoryAdaptor(RustLibrarySharedHostFactory)) - ctx.RegisterModuleType("rust_library_host_static", android.ModuleFactoryAdaptor(RustLibraryStaticHostFactory)) - ctx.RegisterModuleType("rust_proc_macro", android.ModuleFactoryAdaptor(ProcMacroFactory)) - ctx.RegisterModuleType("rust_prebuilt_dylib", android.ModuleFactoryAdaptor(PrebuiltDylibFactory)) - ctx.RegisterModuleType("toolchain_library", android.ModuleFactoryAdaptor(cc.ToolchainLibraryFactory)) + ctx.RegisterModuleType("cc_library", cc.LibraryFactory) + ctx.RegisterModuleType("cc_object", cc.ObjectFactory) + ctx.RegisterModuleType("rust_binary", RustBinaryFactory) + ctx.RegisterModuleType("rust_binary_host", RustBinaryHostFactory) + ctx.RegisterModuleType("rust_test", RustTestFactory) + ctx.RegisterModuleType("rust_test_host", RustTestHostFactory) + ctx.RegisterModuleType("rust_library", RustLibraryFactory) + ctx.RegisterModuleType("rust_library_host", RustLibraryHostFactory) + ctx.RegisterModuleType("rust_library_host_rlib", RustLibraryRlibHostFactory) + ctx.RegisterModuleType("rust_library_host_dylib", RustLibraryDylibHostFactory) + ctx.RegisterModuleType("rust_library_rlib", RustLibraryRlibFactory) + ctx.RegisterModuleType("rust_library_dylib", RustLibraryDylibFactory) + ctx.RegisterModuleType("rust_library_shared", RustLibrarySharedFactory) + ctx.RegisterModuleType("rust_library_static", RustLibraryStaticFactory) + ctx.RegisterModuleType("rust_library_host_shared", RustLibrarySharedHostFactory) + ctx.RegisterModuleType("rust_library_host_static", RustLibraryStaticHostFactory) + ctx.RegisterModuleType("rust_proc_macro", ProcMacroFactory) + ctx.RegisterModuleType("rust_prebuilt_dylib", PrebuiltDylibFactory) + ctx.RegisterModuleType("toolchain_library", cc.ToolchainLibraryFactory) ctx.PreDepsMutators(func(ctx android.RegisterMutatorsContext) { // cc mutators ctx.BottomUp("image", cc.ImageMutator).Parallel() diff --git a/sdk/sdk_test.go b/sdk/sdk_test.go index 99192be0a..855282578 100644 --- a/sdk/sdk_test.go +++ b/sdk/sdk_test.go @@ -42,20 +42,20 @@ func testSdkContext(t *testing.T, bp string) (*android.TestContext, android.Conf }) // from java package - ctx.RegisterModuleType("android_app_certificate", android.ModuleFactoryAdaptor(java.AndroidAppCertificateFactory)) - ctx.RegisterModuleType("java_library", android.ModuleFactoryAdaptor(java.LibraryFactory)) - ctx.RegisterModuleType("java_import", android.ModuleFactoryAdaptor(java.ImportFactory)) - ctx.RegisterModuleType("droidstubs", android.ModuleFactoryAdaptor(java.DroidstubsFactory)) - ctx.RegisterModuleType("prebuilt_stubs_sources", android.ModuleFactoryAdaptor(java.PrebuiltStubsSourcesFactory)) + ctx.RegisterModuleType("android_app_certificate", java.AndroidAppCertificateFactory) + ctx.RegisterModuleType("java_library", java.LibraryFactory) + ctx.RegisterModuleType("java_import", java.ImportFactory) + ctx.RegisterModuleType("droidstubs", java.DroidstubsFactory) + ctx.RegisterModuleType("prebuilt_stubs_sources", java.PrebuiltStubsSourcesFactory) // from cc package - ctx.RegisterModuleType("cc_library", android.ModuleFactoryAdaptor(cc.LibraryFactory)) - ctx.RegisterModuleType("cc_library_shared", android.ModuleFactoryAdaptor(cc.LibrarySharedFactory)) - ctx.RegisterModuleType("cc_object", android.ModuleFactoryAdaptor(cc.ObjectFactory)) - ctx.RegisterModuleType("cc_prebuilt_library_shared", android.ModuleFactoryAdaptor(cc.PrebuiltSharedLibraryFactory)) - ctx.RegisterModuleType("cc_prebuilt_library_static", android.ModuleFactoryAdaptor(cc.PrebuiltStaticLibraryFactory)) - ctx.RegisterModuleType("llndk_library", android.ModuleFactoryAdaptor(cc.LlndkLibraryFactory)) - ctx.RegisterModuleType("toolchain_library", android.ModuleFactoryAdaptor(cc.ToolchainLibraryFactory)) + ctx.RegisterModuleType("cc_library", cc.LibraryFactory) + ctx.RegisterModuleType("cc_library_shared", cc.LibrarySharedFactory) + ctx.RegisterModuleType("cc_object", cc.ObjectFactory) + ctx.RegisterModuleType("cc_prebuilt_library_shared", cc.PrebuiltSharedLibraryFactory) + ctx.RegisterModuleType("cc_prebuilt_library_static", cc.PrebuiltStaticLibraryFactory) + ctx.RegisterModuleType("llndk_library", cc.LlndkLibraryFactory) + ctx.RegisterModuleType("toolchain_library", cc.ToolchainLibraryFactory) ctx.PreDepsMutators(func(ctx android.RegisterMutatorsContext) { ctx.BottomUp("image", cc.ImageMutator).Parallel() ctx.BottomUp("link", cc.LinkageMutator).Parallel() @@ -66,13 +66,13 @@ func testSdkContext(t *testing.T, bp string) (*android.TestContext, android.Conf }) // from apex package - ctx.RegisterModuleType("apex", android.ModuleFactoryAdaptor(apex.BundleFactory)) - ctx.RegisterModuleType("apex_key", android.ModuleFactoryAdaptor(apex.ApexKeyFactory)) + ctx.RegisterModuleType("apex", apex.BundleFactory) + ctx.RegisterModuleType("apex_key", apex.ApexKeyFactory) ctx.PostDepsMutators(apex.RegisterPostDepsMutators) // from this package - ctx.RegisterModuleType("sdk", android.ModuleFactoryAdaptor(ModuleFactory)) - ctx.RegisterModuleType("sdk_snapshot", android.ModuleFactoryAdaptor(SnapshotModuleFactory)) + ctx.RegisterModuleType("sdk", ModuleFactory) + ctx.RegisterModuleType("sdk_snapshot", SnapshotModuleFactory) ctx.PreDepsMutators(RegisterPreDepsMutators) ctx.PostDepsMutators(RegisterPostDepsMutators) diff --git a/sysprop/sysprop_test.go b/sysprop/sysprop_test.go index 6b4337a04..80dcb7217 100644 --- a/sysprop/sysprop_test.go +++ b/sysprop/sysprop_test.go @@ -56,9 +56,9 @@ func testContext(config android.Config, bp string, fs map[string][]byte) *android.TestContext { ctx := android.NewTestArchContext() - ctx.RegisterModuleType("android_app", android.ModuleFactoryAdaptor(java.AndroidAppFactory)) - ctx.RegisterModuleType("java_library", android.ModuleFactoryAdaptor(java.LibraryFactory)) - ctx.RegisterModuleType("java_system_modules", android.ModuleFactoryAdaptor(java.SystemModulesFactory)) + ctx.RegisterModuleType("android_app", java.AndroidAppFactory) + ctx.RegisterModuleType("java_library", java.LibraryFactory) + ctx.RegisterModuleType("java_system_modules", java.SystemModulesFactory) ctx.PreArchMutators(android.RegisterPrebuiltsPreArchMutators) ctx.PreArchMutators(android.RegisterPrebuiltsPostDepsMutators) ctx.PreArchMutators(android.RegisterDefaultsPreArchMutators) @@ -66,12 +66,12 @@ func testContext(config android.Config, bp string, ctx.BottomUp("sysprop_deps", syspropDepsMutator).Parallel() }) - ctx.RegisterModuleType("cc_library", android.ModuleFactoryAdaptor(cc.LibraryFactory)) - ctx.RegisterModuleType("cc_library_headers", android.ModuleFactoryAdaptor(cc.LibraryHeaderFactory)) - ctx.RegisterModuleType("cc_library_static", android.ModuleFactoryAdaptor(cc.LibraryFactory)) - ctx.RegisterModuleType("cc_object", android.ModuleFactoryAdaptor(cc.ObjectFactory)) - ctx.RegisterModuleType("llndk_library", android.ModuleFactoryAdaptor(cc.LlndkLibraryFactory)) - ctx.RegisterModuleType("toolchain_library", android.ModuleFactoryAdaptor(cc.ToolchainLibraryFactory)) + ctx.RegisterModuleType("cc_library", cc.LibraryFactory) + ctx.RegisterModuleType("cc_library_headers", cc.LibraryHeaderFactory) + ctx.RegisterModuleType("cc_library_static", cc.LibraryFactory) + ctx.RegisterModuleType("cc_object", cc.ObjectFactory) + ctx.RegisterModuleType("llndk_library", cc.LlndkLibraryFactory) + ctx.RegisterModuleType("toolchain_library", cc.ToolchainLibraryFactory) ctx.PreDepsMutators(func(ctx android.RegisterMutatorsContext) { ctx.BottomUp("image", cc.ImageMutator).Parallel() ctx.BottomUp("link", cc.LinkageMutator).Parallel() @@ -81,7 +81,7 @@ func testContext(config android.Config, bp string, ctx.BottomUp("sysprop", cc.SyspropMutator).Parallel() }) - ctx.RegisterModuleType("sysprop_library", android.ModuleFactoryAdaptor(syspropLibraryFactory)) + ctx.RegisterModuleType("sysprop_library", syspropLibraryFactory) ctx.Register() diff --git a/xml/xml_test.go b/xml/xml_test.go index f2a440f9a..0a1156670 100644 --- a/xml/xml_test.go +++ b/xml/xml_test.go @@ -50,8 +50,8 @@ func TestMain(m *testing.M) { func testXml(t *testing.T, bp string) *android.TestContext { config := android.TestArchConfig(buildDir, nil) ctx := android.NewTestArchContext() - ctx.RegisterModuleType("prebuilt_etc", android.ModuleFactoryAdaptor(android.PrebuiltEtcFactory)) - ctx.RegisterModuleType("prebuilt_etc_xml", android.ModuleFactoryAdaptor(PrebuiltEtcXmlFactory)) + ctx.RegisterModuleType("prebuilt_etc", android.PrebuiltEtcFactory) + ctx.RegisterModuleType("prebuilt_etc_xml", PrebuiltEtcXmlFactory) ctx.Register() mockFiles := map[string][]byte{ "Android.bp": []byte(bp),