From 8e6e6fdba9d128d7dea658bb9b72cd927068b1a1 Mon Sep 17 00:00:00 2001 From: Dan Willemsen Date: Mon, 12 Sep 2016 20:26:33 -0700 Subject: [PATCH] Remove incremental workaround for aapt overlays This workaround to clean package intermediates is no longer necessary, as ninja reruns commands whose command line changes. Test: switch between product overlays that use add-resource, verify R.java is regenerated. Change-Id: Icb1f76360e39882e4401180414a031956777b020 --- CleanSpec.mk | 3 ++ core/package_internal.mk | 3 -- core/post_clean.mk | 38 -------------- tools/diff_package_overlays.py | 91 ---------------------------------- 4 files changed, 3 insertions(+), 132 deletions(-) delete mode 100755 tools/diff_package_overlays.py diff --git a/CleanSpec.mk b/CleanSpec.mk index 3c8d6ceb9..a3b5f3c2a 100644 --- a/CleanSpec.mk +++ b/CleanSpec.mk @@ -374,6 +374,9 @@ $(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/APPS/*) # $(PRODUCT_OUT)/recovery/root/sdcard goes from symlink to folder. $(call add-clean-step, rm -rf $(PRODUCT_OUT)/recovery/root/sdcard) +$(call add-clean-step, rm -rf $(TARGET_OUT_COMMON_INTERMEDIATES)/APPS/previous_overlays.txt) +$(call add-clean-step, rm -rf $(TARGET_OUT_COMMON_INTERMEDIATES)/APPS/current_packages.txt) + # ************************************************ # NEWER CLEAN STEPS MUST BE AT THE END OF THE LIST # ************************************************ diff --git a/core/package_internal.mk b/core/package_internal.mk index 9545823f9..3c3523ce4 100644 --- a/core/package_internal.mk +++ b/core/package_internal.mk @@ -597,9 +597,6 @@ endif # LOCAL_PACKAGE_SPLITS # Save information about this package PACKAGES.$(LOCAL_PACKAGE_NAME).OVERRIDES := $(strip $(LOCAL_OVERRIDES_PACKAGES)) PACKAGES.$(LOCAL_PACKAGE_NAME).RESOURCE_FILES := $(all_resources) -ifdef package_resource_overlays -PACKAGES.$(LOCAL_PACKAGE_NAME).RESOURCE_OVERLAYS := $(package_resource_overlays) -endif PACKAGES := $(PACKAGES) $(LOCAL_PACKAGE_NAME) diff --git a/core/post_clean.mk b/core/post_clean.mk index f08abff1d..d7e83229b 100644 --- a/core/post_clean.mk +++ b/core/post_clean.mk @@ -15,44 +15,6 @@ # Clean steps that need global knowledge of individual modules. # This file must be included after all Android.mks have been loaded. -####################################################### -# Checks the current build configurations against the previous build, -# clean artifacts in TARGET_COMMON_OUT_ROOT if necessary. -# If a package's resource overlay has been changed, its R class needs to be -# regenerated. -previous_package_overlay_config := $(TARGET_OUT_COMMON_INTERMEDIATES)/APPS/previous_overlays.txt -current_package_overlay_config := $(TARGET_OUT_COMMON_INTERMEDIATES)/APPS/current_overlays.txt -current_all_packages_config := $(dir $(current_package_overlay_config))current_packages.txt - -$(shell rm -rf $(current_package_overlay_config) \ - && mkdir -p $(dir $(current_package_overlay_config)) \ - && touch $(current_package_overlay_config)) -$(shell echo '$(PACKAGES)' > $(current_all_packages_config)) -$(foreach p, $(PACKAGES), $(if $(PACKAGES.$(p).RESOURCE_OVERLAYS), \ - $(shell echo '$(p)' '$(PACKAGES.$(p).RESOURCE_OVERLAYS)' >> $(current_package_overlay_config)))) - -ifneq (,$(wildcard $(previous_package_overlay_config))) -packages_overlay_changed := $(shell build/tools/diff_package_overlays.py \ - $(current_all_packages_config) $(current_package_overlay_config) \ - $(previous_package_overlay_config)) -ifneq (,$(packages_overlay_changed)) -overlay_cleanup_cmd := $(strip rm -rf $(foreach p, $(packages_overlay_changed),\ - $(TARGET_OUT_COMMON_INTERMEDIATES)/APPS/$(p)_intermediates)) -$(info *** Overlay change detected, clean shared intermediate files...) -$(info *** $(overlay_cleanup_cmd)) -$(shell $(overlay_cleanup_cmd)) -overlay_cleanup_cmd := -endif -packages_overlay_changed := -endif - -# Now current becomes previous. -$(shell mv -f $(current_package_overlay_config) $(previous_package_overlay_config)) - -previous_package_overlay_config := -current_package_overlay_config := -current_all_packages_config := - ####################################################### # Check if we need to delete obsolete generated java files. # When an aidl/proto/etc file gets deleted (or renamed), the generated java file is obsolete. diff --git a/tools/diff_package_overlays.py b/tools/diff_package_overlays.py deleted file mode 100755 index 0e2c773d1..000000000 --- a/tools/diff_package_overlays.py +++ /dev/null @@ -1,91 +0,0 @@ -#!/usr/bin/env python -# -# Copyright (C) 2012 The Android Open Source Project -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -""" -Prints to stdout the package names that have overlay changes between -current_overlays.txt and previous_overlays.txt. - -Usage: diff_package_overlays.py -current_packages.txt contains all package names separated by space in the current build. -This script modfies current_packages.txt if necessary: if there is a package in -previous_overlays.txt but absent from current_packages.txt, we copy that line -from previous_overlays.txt over to current_packages.txt. Usually that means we -just don't care that package in the current build (for example we are switching -from a full build to a partial build with mm/mmm), and we should carry on the -previous overlay config so current_overlays.txt always reflects the current -status of the entire tree. - -Format of current_overlays.txt and previous_overlays.txt: - [resource_overlay ...] - [resource_overlay ...] - ... -""" - -import sys - -def main(argv): - if len(argv) != 4: - print >> sys.stderr, __doc__ - sys.exit(1) - - f = open(argv[1]) - all_packages = set(f.read().split()) - f.close() - - def load_overlay_config(filename): - f = open(filename) - result = {} - for line in f: - line = line.strip() - if not line or line.startswith("#"): - continue - words = line.split() - result[words[0]] = " ".join(words[1:]) - f.close() - return result - - current_overlays = load_overlay_config(argv[2]) - previous_overlays = load_overlay_config(argv[3]) - - result = [] - carryon = [] - for p in current_overlays: - if p not in previous_overlays: - result.append(p) - elif current_overlays[p] != previous_overlays[p]: - result.append(p) - for p in previous_overlays: - if p not in current_overlays: - if p in all_packages: - # overlay changed - result.append(p) - else: - # we don't build p in the current build. - carryon.append(p) - - # Add carryon to the current overlay config file. - if carryon: - f = open(argv[2], "a") - for p in carryon: - f.write(p + " " + previous_overlays[p] + "\n") - f.close() - - # Print out the package names that have overlay change. - for r in result: - print r - -if __name__ == "__main__": - main(sys.argv)