diff options
author | Jeff Gaston <jeffrygaston@google.com> | 2017-11-29 19:51:52 -0800 |
---|---|---|
committer | Jeff Gaston <jeffrygaston@google.com> | 2017-12-04 17:44:32 -0800 |
commit | 44c0cd85435d7c90cbf6d5f930a64edac15b42ee (patch) | |
tree | 45e05de2710f4de66083642ddc19d67efdf08b87 /README.md | |
parent | 088e29ed38757e288ad26c7365e3eb6ee92a6f35 (diff) | |
download | build_soong-44c0cd85435d7c90cbf6d5f930a64edac15b42ee.tar.gz build_soong-44c0cd85435d7c90cbf6d5f930a64edac15b42ee.tar.bz2 build_soong-44c0cd85435d7c90cbf6d5f930a64edac15b42ee.zip |
Document Soong namespaces
Bug: 65683273
Test: Read README.md
Change-Id: I179c085e123858ae425515ac6bbf4b272c245a2e
Diffstat (limited to 'README.md')
-rw-r--r-- | README.md | 32 |
1 files changed, 32 insertions, 0 deletions
@@ -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 |