Remove files that should no longer be installed
Make now exports (partial) lists of what should be installed. Those
lists are incomplete, but if something is removed from the list, we can
remove it from the filesystem so that incremental builds work better.
Test: built-in tests (m blueprint_tools)
Test: remove a module from PRODUCT_PACKAGES, see the print and file removed
Test: change the name of a cts test, see the old one removed from cts
Change-Id: I6bc14c6a5af63383ea265e97ed8b875fa51af0ed
diff --git a/ui/build/kati.go b/ui/build/kati.go
index ac09ce1..a845c5b 100644
--- a/ui/build/kati.go
+++ b/ui/build/kati.go
@@ -153,6 +153,7 @@
runKati(ctx, config, katiBuildSuffix, args, func(env *Environment) {})
cleanCopyHeaders(ctx, config)
+ cleanOldInstalledFiles(ctx, config)
}
func cleanCopyHeaders(ctx Context, config Config) {
@@ -192,6 +193,23 @@
})
}
+func cleanOldInstalledFiles(ctx Context, config Config) {
+ ctx.BeginTrace("clean", "clean old installed files")
+ defer ctx.EndTrace()
+
+ // We shouldn't be removing files from one side of the two-step asan builds
+ var suffix string
+ if v, ok := config.Environment().Get("SANITIZE_TARGET"); ok {
+ if sanitize := strings.Fields(v); inList("address", sanitize) {
+ suffix = "_asan"
+ }
+ }
+
+ cleanOldFiles(ctx, config.ProductOut(), ".installable_files"+suffix)
+
+ cleanOldFiles(ctx, config.HostOut(), ".installable_test_files")
+}
+
func runKatiPackage(ctx Context, config Config) {
ctx.BeginTrace(metrics.RunKati, "kati package")
defer ctx.EndTrace()