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
diff --git a/ui/build/finder.go b/ui/build/finder.go
index 05dec3a..010b325 100644
--- a/ui/build/finder.go
+++ b/ui/build/finder.go
@@ -43,7 +43,7 @@
 		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 @@
 		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 {