Loading android/namespace.go +5 −0 Original line number Diff line number Diff line Loading @@ -222,6 +222,11 @@ func (r *NameResolver) parseFullyQualifiedName(name string) (namespaceName strin } func (r *NameResolver) getNamespacesToSearchForModule(sourceNamespace *Namespace) (searchOrder []*Namespace) { if sourceNamespace.visibleNamespaces == nil { // When handling dependencies before namespaceMutator, assume they are non-Soong Blueprint modules and give // access to all namespaces. return r.sortedNamespaces.sortedItems() } return sourceNamespace.visibleNamespaces } Loading android/namespace_test.go +43 −0 Original line number Diff line number Diff line Loading @@ -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{ Loading Loading @@ -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) Loading @@ -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 Loading Loading @@ -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} } Loading
android/namespace.go +5 −0 Original line number Diff line number Diff line Loading @@ -222,6 +222,11 @@ func (r *NameResolver) parseFullyQualifiedName(name string) (namespaceName strin } func (r *NameResolver) getNamespacesToSearchForModule(sourceNamespace *Namespace) (searchOrder []*Namespace) { if sourceNamespace.visibleNamespaces == nil { // When handling dependencies before namespaceMutator, assume they are non-Soong Blueprint modules and give // access to all namespaces. return r.sortedNamespaces.sortedItems() } return sourceNamespace.visibleNamespaces } Loading
android/namespace_test.go +43 −0 Original line number Diff line number Diff line Loading @@ -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{ Loading Loading @@ -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) Loading @@ -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 Loading Loading @@ -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} }