Split CleanSpec processing out of main Kati run
Bug: 35970961
Test: m clean; m nothing; m nothing
Test: Add CleanSpec.mk line, see it executing
Change-Id: Ied59ac9dbcbeec00e1ada8271b1f66cae33edb8d
diff --git a/core/main.mk b/core/main.mk
index 5d6ffc9..81bfae2 100644
--- a/core/main.mk
+++ b/core/main.mk
@@ -83,11 +83,24 @@
# general-tests-specific-config.
-include tools/tradefederation/build/suites/general-tests/config.mk
-# This allows us to force a clean build - included after the config.mk
-# environment setup is done, but before we generate any dependencies. This
-# file does the rm -rf inline so the deps which are all done below will
-# be generated correctly
-include $(BUILD_SYSTEM)/cleanbuild.mk
+# Clean rules
+.PHONY: clean-jack-files
+clean-jack-files: clean-dex-files
+ $(hide) find $(OUT_DIR) -name "*.jack" | xargs rm -f
+ $(hide) find $(OUT_DIR) -type d -name "jack" | xargs rm -rf
+ @echo "All jack files have been removed."
+
+.PHONY: clean-dex-files
+clean-dex-files:
+ $(hide) find $(OUT_DIR) -name "*.dex" ! -path "*/jack-incremental/*" | xargs rm -f
+ $(hide) for i in `find $(OUT_DIR) -name "*.jar" -o -name "*.apk"` ; do ((unzip -l $$i 2> /dev/null | \
+ grep -q "\.dex$$" && rm -f $$i) || continue ) ; done
+ @echo "All dex files and archives containing dex files have been removed."
+
+.PHONY: clean-jack-incremental
+clean-jack-incremental:
+ $(hide) find $(OUT_DIR) -name "jack-incremental" -type d | xargs rm -rf
+ @echo "All jack incremental dirs have been removed."
# Include the google-specific config
-include vendor/google/build/config.mk