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
diff --git a/cc/testing.go b/cc/testing.go
index 9ad72d9..3943e72 100644
--- a/cc/testing.go
+++ b/cc/testing.go
@@ -253,23 +253,23 @@
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 @@
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)