diff options
author | Dan Willemsen <dwillemsen@google.com> | 2015-12-07 22:23:47 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2015-12-07 22:23:47 +0000 |
commit | fafa3dc7e267675610a34b0c335be350eb30936d (patch) | |
tree | f320ab9b5ad0d5c065d28369fc08c60a6297b813 | |
parent | 231b415995e2eca8f70c299ac944e9634ca0f71a (diff) | |
parent | de4c3e7b442983e3440b639c60ce7825463a3cd1 (diff) | |
download | build_soong-fafa3dc7e267675610a34b0c335be350eb30936d.tar.gz build_soong-fafa3dc7e267675610a34b0c335be350eb30936d.tar.bz2 build_soong-fafa3dc7e267675610a34b0c335be350eb30936d.zip |
Merge "Handle multiple blueprint files in one dir"
-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 } } |