Add TEST_MAPPING to finder's cache

Build target test_mapping will create a tarball of all TEST_MAPPING
files in source code based on the cached TEST_MAPPING.list

Bug: 69678490
Test: m -j blueprint_tools && cat out/.module_paths/TEST_MAPPING.list
Change-Id: Iba3479363137609d6631cf1851a8ce4613078f61
This commit is contained in:
Dan Shi
2017-11-22 15:35:09 -08:00
parent 99a5635733
commit cc3d9b304e

View File

@@ -43,7 +43,7 @@ func NewSourceFinder(ctx Context, config Config) (f *finder.Finder) {
RootDirs: []string{"."},
ExcludeDirs: []string{".git", ".repo"},
PruneFiles: []string{".out-dir", ".find-ignore"},
IncludeFiles: []string{"Android.mk", "Android.bp", "Blueprints", "CleanSpec.mk"},
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),
@@ -74,6 +74,12 @@ func FindSources(ctx Context, config Config, f *finder.Finder) {
ctx.Fatalf("Could not export module list: %v", err)
}
testMappings := f.FindNamedAt(".", "TEST_MAPPING")
err = dumpListToFile(testMappings, filepath.Join(dumpDir, "TEST_MAPPING.list"))
if err != nil {
ctx.Fatalf("Could not find modules: %v", err)
}
isBlueprintFile := func(dir finder.DirEntries) (dirs []string, files []string) {
files = []string{}
for _, file := range dir.FileNames {