Revert "Revert "Soong support for namespaces""
This mostly reverts commit 178d5fefc0cea9d0f031c0bdee125b9d960f32c3
and mostly reapplies change I6d3e52ef62c4cabe85b9a135a54de0e1a6aab29c .
Bug: 65683273
Test: build/soong/scripts/diff_build_graphs.sh \
--products=aosp_arm \
'build/blueprint:work^ build/soong:work^' \
'build/blueprint:work build/soong:work'
# and see that the only changes were:
# 1. adding some new files
# 2. changing some line numbers
Test: m -j nothing # which runs unit tests
Change-Id: I32baae00277a547fdcdd1c2219fe6625ee0e45d7
diff --git a/android/module.go b/android/module.go
index c728487..e6766a3 100644
--- a/android/module.go
+++ b/android/module.go
@@ -151,6 +151,7 @@
VisitAllModuleVariants(visit func(Module))
GetMissingDependencies() []string
+ Namespace() blueprint.Namespace
}
type Module interface {
@@ -235,6 +236,8 @@
ArchSpecific bool `blueprint:"mutated"`
SkipInstall bool `blueprint:"mutated"`
+
+ NamespaceExportedToMake bool `blueprint:"mutated"`
}
type hostAndDeviceProperties struct {
@@ -500,8 +503,13 @@
var deps Paths
+ namespacePrefix := ctx.Namespace().(*Namespace).id
+ if namespacePrefix != "" {
+ namespacePrefix = namespacePrefix + "-"
+ }
+
if len(allInstalledFiles) > 0 {
- name := PathForPhony(ctx, ctx.ModuleName()+"-install")
+ name := PathForPhony(ctx, namespacePrefix+ctx.ModuleName()+"-install")
ctx.Build(pctx, BuildParams{
Rule: blueprint.Phony,
Output: name,
@@ -513,7 +521,7 @@
}
if len(allCheckbuildFiles) > 0 {
- name := PathForPhony(ctx, ctx.ModuleName()+"-checkbuild")
+ name := PathForPhony(ctx, namespacePrefix+ctx.ModuleName()+"-checkbuild")
ctx.Build(pctx, BuildParams{
Rule: blueprint.Phony,
Output: name,
@@ -529,9 +537,10 @@
suffix = "-soong"
}
+ name := PathForPhony(ctx, namespacePrefix+ctx.ModuleName()+suffix)
ctx.Build(pctx, BuildParams{
Rule: blueprint.Phony,
- Output: PathForPhony(ctx, ctx.ModuleName()+suffix),
+ Outputs: []WritablePath{name},
Implicits: deps,
})