summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Paul Duffin <paulduffin@google.com> 2021-07-09 16:47:38 +0100
committer Paul Duffin <paulduffin@google.com> 2021-07-09 23:54:01 +0100
commit4fbfb59d3e43d92a2ef5c50049210dfcb634fc9e (patch)
treed61443e9748d161003e3b1786e83f008654b9ee8
parent1a0e2d20b313ca38ef149513af2deb1a0a0aaa46 (diff)
Extract preparer for namespace
Bug: 193228441 Test: m nothing Change-Id: If00b0595edd48be8c8d3308b87fb920dfb0340ee
-rw-r--r--android/namespace.go6
-rw-r--r--android/namespace_test.go3
-rw-r--r--android/testing.go5
3 files changed, 11 insertions, 3 deletions
diff --git a/android/namespace.go b/android/namespace.go
index d137636e2..4f727e14e 100644
--- a/android/namespace.go
+++ b/android/namespace.go
@@ -27,7 +27,11 @@ import (
)
func init() {
- RegisterModuleType("soong_namespace", NamespaceFactory)
+ registerNamespaceBuildComponents(InitRegistrationContext)
+}
+
+func registerNamespaceBuildComponents(ctx RegistrationContext) {
+ ctx.RegisterModuleType("soong_namespace", NamespaceFactory)
}
// threadsafe sorted list
diff --git a/android/namespace_test.go b/android/namespace_test.go
index 08e221a65..ea399da06 100644
--- a/android/namespace_test.go
+++ b/android/namespace_test.go
@@ -636,13 +636,12 @@ func setupTestFromFiles(t *testing.T, bps MockFS) (ctx *TestContext, errs []erro
result := GroupFixturePreparers(
FixtureModifyContext(func(ctx *TestContext) {
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)
})
}),
+ PrepareForTestWithNamespace,
bps.AddToFixture(),
).
// Ignore errors for now so tests can check them later.
diff --git a/android/testing.go b/android/testing.go
index b36f62cce..17a812ea1 100644
--- a/android/testing.go
+++ b/android/testing.go
@@ -110,6 +110,11 @@ var PrepareForTestWithLicenseDefaultModules = GroupFixturePreparers(
FixtureAddFile("build/soong/licenses/LICENSE", nil),
)
+var PrepareForTestWithNamespace = FixtureRegisterWithContext(func(ctx RegistrationContext) {
+ registerNamespaceBuildComponents(ctx)
+ ctx.PreArchMutators(RegisterNamespaceMutator)
+})
+
// Test fixture preparer that will register most java build components.
//
// Singletons and mutators should only be added here if they are needed for a majority of java