Add visibility support
Implementation uploaded for review. Includes unit tests but does not yet handle prebuilts, that will come in a future change once some more general issues with prebuilts and namespaces is resolved. See README.md#Visibility for details of what this does and how to use it. Bug: 112158820 Test: add visibility rules for core library modules, make core-tests Change-Id: I8ec980554398ad6f2d42043ce518f811a35da679
This commit is contained in:
@@ -26,12 +26,6 @@ import (
|
||||
"github.com/google/blueprint"
|
||||
)
|
||||
|
||||
// This file implements namespaces
|
||||
const (
|
||||
namespacePrefix = "//"
|
||||
modulePrefix = ":"
|
||||
)
|
||||
|
||||
func init() {
|
||||
RegisterModuleType("soong_namespace", NamespaceFactory)
|
||||
}
|
||||
@@ -215,11 +209,11 @@ func (r *NameResolver) AllModules() []blueprint.ModuleGroup {
|
||||
// parses a fully-qualified path (like "//namespace_path:module_name") into a namespace name and a
|
||||
// module name
|
||||
func (r *NameResolver) parseFullyQualifiedName(name string) (namespaceName string, moduleName string, ok bool) {
|
||||
if !strings.HasPrefix(name, namespacePrefix) {
|
||||
if !strings.HasPrefix(name, "//") {
|
||||
return "", "", false
|
||||
}
|
||||
name = strings.TrimPrefix(name, namespacePrefix)
|
||||
components := strings.Split(name, modulePrefix)
|
||||
name = strings.TrimPrefix(name, "//")
|
||||
components := strings.Split(name, ":")
|
||||
if len(components) != 2 {
|
||||
return "", "", false
|
||||
}
|
||||
|
Reference in New Issue
Block a user