Document Soong namespaces am: 44c0cd8543

am: dc1a9a8eb4

Change-Id: I58792d917081b08970a931c75b9b0609f0325c0d
This commit is contained in:
Jeff Gaston 2017-12-05 03:57:51 +00:00 committed by android-build-merger
commit 7e712bcece
1 changed files with 32 additions and 0 deletions

View File

@ -95,6 +95,38 @@ cc_binary {
}
```
### Name resolution
Soong provides the ability for modules in different directories to specify
the same name, as long as each module is declared within a separate namespace.
A namespace can be declared like this:
```
soong_namespace {
imports: ["path/to/otherNamespace1", "path/to/otherNamespace2"],
}
```
Each Soong module is assigned a namespace based on its location in the tree.
Each Soong module is considered to be in the namespace defined by the
soong_namespace found in an Android.bp in the current directory or closest
ancestor directory, unless no such soong_namespace module is found, in which
case the module is considered to be in the implicit root namespace.
When Soong attempts to resolve dependency D declared my module M in namespace
N which imports namespaces I1, I2, I3..., then if D is a fully-qualified name
of the form "//namespace:module", only the specified namespace will be searched
for the specified module name. Otherwise, Soong will first look for a module
named D declared in namespace N. If that module does not exist, Soong will look
for a module named D in namespaces I1, I2, I3... Lastly, Soong will look in the
root namespace.
Until we have fully converted from Make to Soong, it will be necessary for the
Make product config to specify a value of PRODUCT_SOONG_NAMESPACES. Its value
should be a space-separated list of namespaces that Soong export to Make to be
built by the `m` command. After we have fully converted from Make to Soong, the
details of enabling namespaces could potentially change.
### Formatter
Soong includes a canonical formatter for blueprint files, similar to