diff options
author | Colin Cross <ccross@android.com> | 2019-06-14 11:26:09 -0700 |
---|---|---|
committer | Colin Cross <ccross@android.com> | 2019-06-14 11:26:09 -0700 |
commit | cd84b4e36b04055e6c413020d053f0f958cbced1 (patch) | |
tree | d7bbb21239b29780571e7dd68343c101f04c67a2 /android/namespace_test.go | |
parent | e77a57336f99c5cd67ff990bba36a57fd1da4296 (diff) | |
download | build_soong-cd84b4e36b04055e6c413020d053f0f958cbced1.tar.gz build_soong-cd84b4e36b04055e6c413020d053f0f958cbced1.tar.bz2 build_soong-cd84b4e36b04055e6c413020d053f0f958cbced1.zip |
Give Blueprint modules access to all namespaces
Don't enforce namespaces on Blueprint modules like
bootstrap_go_package, their dependencies are handled before
namespaces are initialized in namespaceMutator.
Fixes: 135246048
Test: TestDependingOnBlueprintModuleInRootNamespace
Change-Id: I7cf1c26bb8512eed59d6b4eb42a49f7080ffa281
Diffstat (limited to 'android/namespace_test.go')
-rw-r--r-- | android/namespace_test.go | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/android/namespace_test.go b/android/namespace_test.go index 51a0af22..20241fe1 100644 --- a/android/namespace_test.go +++ b/android/namespace_test.go @@ -91,6 +91,28 @@ func TestImplicitlyImportRootNamespace(t *testing.T) { // setupTest will report any errors } +func TestDependingOnBlueprintModuleInRootNamespace(t *testing.T) { + _ = setupTest(t, + map[string]string{ + ".": ` + blueprint_test_module { + name: "a", + } + `, + "dir1": ` + soong_namespace { + } + blueprint_test_module { + name: "b", + deps: ["a"], + } + `, + }, + ) + + // setupTest will report any errors +} + func TestDependingOnModuleInImportedNamespace(t *testing.T) { ctx := setupTest(t, map[string]string{ @@ -617,6 +639,7 @@ func setupTestFromFiles(bps map[string][]byte) (ctx *TestContext, errs []error) ctx.MockFileSystem(bps) ctx.RegisterModuleType("test_module", ModuleFactoryAdaptor(newTestModule)) ctx.RegisterModuleType("soong_namespace", ModuleFactoryAdaptor(NamespaceFactory)) + ctx.RegisterModuleType("blueprint_test_module", newBlueprintTestModule) ctx.PreArchMutators(RegisterNamespaceMutator) ctx.PreDepsMutators(func(ctx RegisterMutatorsContext) { ctx.BottomUp("rename", renameMutator) @@ -641,6 +664,7 @@ func setupTestExpectErrs(bps map[string]string) (ctx *TestContext, errs []error) } func setupTest(t *testing.T, bps map[string]string) (ctx *TestContext) { + t.Helper() ctx, errs := setupTestExpectErrs(bps) FailIfErrored(t, errs) return ctx @@ -718,3 +742,22 @@ func newTestModule() Module { InitAndroidModule(m) return m } + +type blueprintTestModule struct { + blueprint.SimpleName + properties struct { + Deps []string + } +} + +func (b *blueprintTestModule) DynamicDependencies(ctx blueprint.DynamicDependerModuleContext) []string { + return b.properties.Deps +} + +func (b *blueprintTestModule) GenerateBuildActions(blueprint.ModuleContext) { +} + +func newBlueprintTestModule() (blueprint.Module, []interface{}) { + m := &blueprintTestModule{} + return m, []interface{}{&m.properties, &m.SimpleName.Properties} +} |