diff options
| author | Jeff Gaston <jeffrygaston@google.com> | 2017-12-11 21:10:38 +0000 |
|---|---|---|
| committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2017-12-11 21:10:38 +0000 |
| commit | 592faab77ddbc1fc524c27ee1272527c30e4c8a8 (patch) | |
| tree | 04ba1f7acb871fb17d542b692eacedcfa5556d25 /ui | |
| parent | 13f23a2753f7093a2344db91a04973a3b24b6789 (diff) | |
| parent | 02ae4decb7a98d908586654ece81de2faf505704 (diff) | |
| download | build_soong-592faab77ddbc1fc524c27ee1272527c30e4c8a8.tar.gz build_soong-592faab77ddbc1fc524c27ee1272527c30e4c8a8.tar.bz2 build_soong-592faab77ddbc1fc524c27ee1272527c30e4c8a8.zip | |
Merge "Clearer error if no Android.bp is found"
Diffstat (limited to 'ui')
| -rw-r--r-- | ui/build/finder.go | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/ui/build/finder.go b/ui/build/finder.go index f35133bf..a0f5d088 100644 --- a/ui/build/finder.go +++ b/ui/build/finder.go @@ -38,15 +38,28 @@ func NewSourceFinder(ctx Context, config Config) (f *finder.Finder) { if err != nil { ctx.Fatalf("No working directory for module-finder: %v", err.Error()) } + filesystem := fs.OsFs + + // if the root dir is ignored, then the subsequent error messages are very confusing, + // so check for that upfront + pruneFiles := []string{".out-dir", ".find-ignore"} + for _, name := range pruneFiles { + prunePath := filepath.Join(dir, name) + _, statErr := filesystem.Lstat(prunePath) + if statErr == nil { + ctx.Fatalf("%v must not exist", prunePath) + } + } + cacheParams := finder.CacheParams{ WorkingDirectory: dir, RootDirs: []string{"."}, ExcludeDirs: []string{".git", ".repo"}, - PruneFiles: []string{".out-dir", ".find-ignore"}, + PruneFiles: pruneFiles, IncludeFiles: []string{"Android.mk", "Android.bp", "Blueprints", "CleanSpec.mk", "TEST_MAPPING"}, } dumpDir := config.FileListDir() - f, err = finder.New(cacheParams, fs.OsFs, logger.New(ioutil.Discard), + f, err = finder.New(cacheParams, filesystem, logger.New(ioutil.Discard), filepath.Join(dumpDir, "files.db")) if err != nil { ctx.Fatalf("Could not create module-finder: %v", err) @@ -82,6 +95,9 @@ func FindSources(ctx Context, config Config, f *finder.Finder) { androidBps := f.FindNamedAt(".", "Android.bp") androidBps = append(androidBps, f.FindNamedAt("build/blueprint", "Blueprints")...) + if len(androidBps) == 0 { + ctx.Fatalf("No Android.bp found") + } err = dumpListToFile(androidBps, filepath.Join(dumpDir, "Android.bp.list")) if err != nil { ctx.Fatalf("Could not find modules: %v", err) |
