Document Soong namespaces
Bug: 65683273 Test: Read README.md Change-Id: I179c085e123858ae425515ac6bbf4b272c245a2e
This commit is contained in:
parent
088e29ed38
commit
44c0cd8543
32
README.md
32
README.md
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue