diff options
author | Dan Willemsen <dwillemsen@google.com> | 2015-12-07 12:56:59 -0800 |
---|---|---|
committer | Dan Willemsen <dwillemsen@google.com> | 2015-12-07 13:05:54 -0800 |
commit | de4c3e7b442983e3440b639c60ce7825463a3cd1 (patch) | |
tree | 099fa7e5dec5926d8a0316eab3f2a2aa53674939 /common | |
parent | 93c2831af1798870245ee516e51c29a49a395c21 (diff) | |
download | build_soong-de4c3e7b442983e3440b639c60ce7825463a3cd1.tar.gz build_soong-de4c3e7b442983e3440b639c60ce7825463a3cd1.tar.bz2 build_soong-de4c3e7b442983e3440b639c60ce7825463a3cd1.zip |
Handle multiple blueprint files in one dir
If there are multiple blueprint files in one directory, say an
Android.bp, and a build=['other.bp'] entry that pulls in another
blueprint file from the same directory, we'd look for a matching
Android.mk twice. This would cause duplicate glob rules.
Instead, keep track of blueprint directories rather than files.
Change-Id: I4f224e51337ffd5e5e48257ac3458c2d8b2061fa
Diffstat (limited to 'common')
-rw-r--r-- | common/androidmk.go | 27 |
1 files changed, 12 insertions, 15 deletions
diff --git a/common/androidmk.go b/common/androidmk.go index d3089368..5dd422d1 100644 --- a/common/androidmk.go +++ b/common/androidmk.go @@ -51,33 +51,32 @@ func AndroidMkSingleton() blueprint.Singleton { type androidMkSingleton struct{} func (c *androidMkSingleton) GenerateBuildActions(ctx blueprint.SingletonContext) { - fileModules := make(map[string][]blueprint.Module) - hasBPFile := make(map[string]bool) - bpFiles := []string{} + dirModules := make(map[string][]blueprint.Module) + hasBPDir := make(map[string]bool) + bpDirs := []string{} ctx.SetNinjaBuildDir(pctx, filepath.Join(ctx.Config().(Config).BuildDir(), "..")) ctx.VisitAllModules(func(module blueprint.Module) { if _, ok := module.(AndroidModule); ok { - bpFile := ctx.BlueprintFile(module) + bpDir := filepath.Dir(ctx.BlueprintFile(module)) - if !hasBPFile[bpFile] { - hasBPFile[bpFile] = true - bpFiles = append(bpFiles, bpFile) + if !hasBPDir[bpDir] { + hasBPDir[bpDir] = true + bpDirs = append(bpDirs, bpDir) } - fileModules[bpFile] = append(fileModules[bpFile], module) + dirModules[bpDir] = append(dirModules[bpDir], module) } }) // Gather list of eligible Android modules for translation androidMkModules := make(map[blueprint.Module]bool) - var validBpFiles []string srcDir := ctx.Config().(Config).SrcDir() intermediatesDir := filepath.Join(ctx.Config().(Config).IntermediatesDir(), "androidmk") - sort.Strings(bpFiles) - for _, origBp := range bpFiles { - mkFile := filepath.Join(srcDir, filepath.Dir(origBp), "Android.mk") + sort.Strings(bpDirs) + for _, bpDir := range bpDirs { + mkFile := filepath.Join(srcDir, bpDir, "Android.mk") files, err := Glob(ctx, intermediatesDir, mkFile, nil) if err != nil { @@ -93,9 +92,7 @@ func (c *androidMkSingleton) GenerateBuildActions(ctx blueprint.SingletonContext continue } - validBpFiles = append(validBpFiles, origBp) - - for _, mod := range fileModules[origBp] { + for _, mod := range dirModules[bpDir] { androidMkModules[mod] = true } } |