diff options
| -rw-r--r-- | ui/build/build.go | 4 | ||||
| -rw-r--r-- | ui/build/cleanbuild.go | 27 |
2 files changed, 31 insertions, 0 deletions
diff --git a/ui/build/build.go b/ui/build/build.go index 349a7de5e..790a5c973 100644 --- a/ui/build/build.go +++ b/ui/build/build.go @@ -218,6 +218,10 @@ func Build(ctx Context, config Config, what int) { dataClean(ctx, config, what) ctx.Println("Deleted data files.") return + } else if inList("deviceclean", config.Arguments()) { + deviceClean(ctx, config, what) + ctx.Println("Performed minimal product cleaning.") + return } if what&BuildSoong != 0 { diff --git a/ui/build/cleanbuild.go b/ui/build/cleanbuild.go index 9df3ac0ef..a323818d8 100644 --- a/ui/build/cleanbuild.go +++ b/ui/build/cleanbuild.go @@ -54,6 +54,33 @@ func dataClean(ctx Context, config Config, what int) { removeGlobs(ctx, filepath.Join(config.ProductOut(), "data", "*")) } +// Remove everything relevant for a clean ota package +func deviceClean(ctx Context, config Config, what int) { + + productOutPath := config.ProductOut() + productOut := func(path string) string { + return filepath.Join(productOutPath, path) + } + + removeGlobs(ctx, + productOut("*.cpio"), + productOut("*.img"), + productOut("*.zip"), + productOut("*.zip.md5sum"), + productOut("android-info.txt"), + productOut("Changelog.txt"), + productOut("kernel"), + productOut("ramdisk"), + productOut("recovery"), + productOut("root"), + productOut("symbols"), + productOut("system"), + productOut("system_other"), + productOut("vendor")) + + ctx.Println("Device specific stuff removed.") +} + // installClean deletes all of the installed files -- the intent is to remove // files that may no longer be installed, either because the user previously // installed them, or they were previously installed by default but no longer |
