From da727cf9919e17051f8e6683db5efd4b692c3153 Mon Sep 17 00:00:00 2001 From: Colin Cross Date: Wed, 27 Apr 2016 13:45:26 -0700 Subject: [PATCH 1/2] Support nested glob patterns Globbing separately for path/to/lib and path/to/lib/test would result in trying to use intermediates/path/to/lib as both a file list file for the first glob and as a directory to store the file list file for the second glob, causing ninja to exit with an mkdir "Not a directory" error. Add ".glob" to the file list file name to avoid collisions. Change-Id: I8b9de9133d7ef667088a2f13eb28652508f3a290 --- common/glob.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/glob.go b/common/glob.go index 96655cf8e..5b03bc1bc 100644 --- a/common/glob.go +++ b/common/glob.go @@ -73,7 +73,7 @@ type globContext interface { } func Glob(ctx globContext, outDir string, globPattern string, excludes []string) ([]string, error) { - fileListFile := filepath.Join(outDir, "glob", globToString(globPattern)) + fileListFile := filepath.Join(outDir, "glob", globToString(globPattern)+".glob") depFile := fileListFile + ".d" // Get a globbed file list, and write out fileListFile and depFile From e2c487494578b2149edc84d0dd96ba425f5850f7 Mon Sep 17 00:00:00 2001 From: Colin Cross Date: Wed, 27 Apr 2016 13:47:35 -0700 Subject: [PATCH 2/2] Prevent replacing missing dependency glob rules with errors AndroidModuleContext.Build() replaces all build statements with errors when the module has missing dependencies, but modules may try to create glob rules to detect when missing dependencies have been satisified, and those rules should not be replaced with errors. Whitelist globRule build statements. Change-Id: I2a3cd53c05cea44cec9b5a99090d8778ca954d69 --- common/module.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/module.go b/common/module.go index ee028da15..f3f1263a4 100644 --- a/common/module.go +++ b/common/module.go @@ -440,7 +440,7 @@ func (a *androidModuleContext) ninjaError(outputs []string, err error) { } func (a *androidModuleContext) Build(pctx blueprint.PackageContext, params blueprint.BuildParams) { - if a.missingDeps != nil { + if a.missingDeps != nil && params.Rule != globRule { a.ninjaError(params.Outputs, fmt.Errorf("module %s missing dependencies: %s\n", a.ModuleName(), strings.Join(a.missingDeps, ", "))) return