From a3b759354612424e07e957716de2845396c0d80a Mon Sep 17 00:00:00 2001 From: Ying Wang Date: Wed, 14 Aug 2013 16:59:00 -0700 Subject: [PATCH] Support to optionally run rmtypedefs. Bug: 10330586 Change-Id: I6ddfca2ec986cf2c82b0942b7a5360508f095e9a --- core/clear_vars.mk | 1 + core/config.mk | 1 + core/definitions.mk | 4 +++- core/host_java_library.mk | 6 +++++- core/java.mk | 5 +++++ 5 files changed, 15 insertions(+), 2 deletions(-) diff --git a/core/clear_vars.mk b/core/clear_vars.mk index 8940c3a0d..7fea46013 100644 --- a/core/clear_vars.mk +++ b/core/clear_vars.mk @@ -140,6 +140,7 @@ LOCAL_PREBUILT_MODULE_FILE:= LOCAL_POST_INSTALL_CMD:= LOCAL_DIST_BUNDLED_BINARIES:= LOCAL_HAL_STATIC_LIBRARIES:= +LOCAL_RMTYPEDEFS:= # Trim MAKEFILE_LIST so that $(call my-dir) doesn't need to # iterate over thousands of entries every time. diff --git a/core/config.mk b/core/config.mk index 96993c08e..4e461a77c 100644 --- a/core/config.mk +++ b/core/config.mk @@ -332,6 +332,7 @@ BCC_COMPAT := $(HOST_OUT_EXECUTABLES)/bcc_compat$(HOST_EXECUTABLE_SUFFIX) DEXOPT := $(HOST_OUT_EXECUTABLES)/dexopt$(HOST_EXECUTABLE_SUFFIX) DEXPREOPT := dalvik/tools/dex-preopt LINT := prebuilts/sdk/tools/lint +RMTYPEDEFS := $(HOST_OUT_EXECUTABLES)/rmtypedefs # ACP is always for the build OS, not for the host OS ACP := $(BUILD_OUT_EXECUTABLES)/acp$(BUILD_EXECUTABLE_SUFFIX) diff --git a/core/definitions.mk b/core/definitions.mk index ecb638b82..e81160861 100644 --- a/core/definitions.mk +++ b/core/definitions.mk @@ -1486,7 +1486,7 @@ $(hide) mkdir -p $(PRIVATE_CLASS_INTERMEDIATES_DIR) $(call unzip-jar-files,$(PRIVATE_STATIC_JAVA_LIBRARIES),$(PRIVATE_CLASS_INTERMEDIATES_DIR)) $(call dump-words-to-file,$(PRIVATE_JAVA_SOURCES),$(PRIVATE_CLASS_INTERMEDIATES_DIR)/java-source-list) $(hide) if [ -d "$(PRIVATE_SOURCE_INTERMEDIATES_DIR)" ]; then \ - find $(PRIVATE_SOURCE_INTERMEDIATES_DIR) -name '*.java' >> $(PRIVATE_CLASS_INTERMEDIATES_DIR)/java-source-list; \ + find $(PRIVATE_SOURCE_INTERMEDIATES_DIR) -name '*.java' >> $(PRIVATE_CLASS_INTERMEDIATES_DIR)/java-source-list; \ fi $(hide) tr ' ' '\n' < $(PRIVATE_CLASS_INTERMEDIATES_DIR)/java-source-list \ | sort -u > $(PRIVATE_CLASS_INTERMEDIATES_DIR)/java-source-list-uniq @@ -1515,6 +1515,7 @@ $(if $(PRIVATE_JAR_PACKAGES), $(hide) find $(PRIVATE_CLASS_INTERMEDIATES_DIR) -m $(foreach pkg, $(PRIVATE_JAR_PACKAGES), \ -not -path $(PRIVATE_CLASS_INTERMEDIATES_DIR)/$(subst .,/,$(pkg))) \ | xargs rm -rf) +$(if $(PRIVATE_RMTYPEDEFS), $(hide) $(RMTYPEDEFS) -v $(PRIVATE_CLASS_INTERMEDIATES_DIR)) $(hide) jar $(if $(strip $(PRIVATE_JAR_MANIFEST)),-cfm,-cf) \ $@ $(PRIVATE_JAR_MANIFEST) -C $(PRIVATE_CLASS_INTERMEDIATES_DIR) . endef @@ -1566,6 +1567,7 @@ $(if $(PRIVATE_JAR_PACKAGES), $(hide) find $(PRIVATE_CLASS_INTERMEDIATES_DIR) -m $(foreach pkg, $(PRIVATE_JAR_PACKAGES), \ -not -path $(PRIVATE_CLASS_INTERMEDIATES_DIR)/$(subst .,/,$(pkg))) \ | xargs rm -rf) +$(if $(PRIVATE_RMTYPEDEFS), $(hide) $(RMTYPEDEFS) -v $(PRIVATE_CLASS_INTERMEDIATES_DIR)) $(hide) jar $(if $(strip $(PRIVATE_JAR_MANIFEST)),-cfm,-cf) \ $@ $(PRIVATE_JAR_MANIFEST) -C $(PRIVATE_CLASS_INTERMEDIATES_DIR) . $(hide) mv $(PRIVATE_CLASS_INTERMEDIATES_DIR)/newstamp $(PRIVATE_CLASS_INTERMEDIATES_DIR)/stamp diff --git a/core/host_java_library.mk b/core/host_java_library.mk index 5e35b90b4..25d248fa9 100644 --- a/core/host_java_library.mk +++ b/core/host_java_library.mk @@ -69,6 +69,8 @@ $(cleantarget): PRIVATE_CLEAN_FILES += $(intermediates.COMMON) $(full_classes_compiled_jar): PRIVATE_JAVA_LAYERS_FILE := $(layers_file) $(full_classes_compiled_jar): PRIVATE_JAVACFLAGS := $(LOCAL_JAVACFLAGS) $(full_classes_compiled_jar): PRIVATE_JAR_EXCLUDE_FILES := +$(full_classes_compiled_jar): PRIVATE_JAR_PACKAGES := +$(full_classes_compiled_jar): PRIVATE_RMTYPEDEFS := $(full_classes_compiled_jar): $(java_sources) $(java_resource_sources) $(full_java_lib_deps) \ $(jar_manifest_file) $(LOCAL_ADDITIONAL_DEPENDENCIES) $(transform-host-java-to-package) @@ -105,9 +107,11 @@ ifneq ($(extra_jar_args),) endif else +$(LOCAL_BUILT_MODULE): PRIVATE_JAVA_LAYERS_FILE := $(layers_file) $(LOCAL_BUILT_MODULE): PRIVATE_JAVACFLAGS := $(LOCAL_JAVACFLAGS) $(LOCAL_BUILT_MODULE): PRIVATE_JAR_EXCLUDE_FILES := -$(LOCAL_BUILT_MODULE): PRIVATE_JAVA_LAYERS_FILE := $(layers_file) +$(LOCAL_BUILT_MODULE): PRIVATE_JAR_PACKAGES := +$(LOCAL_BUILT_MODULE): PRIVATE_RMTYPEDEFS := $(LOCAL_BUILT_MODULE): $(java_sources) $(java_resource_sources) $(full_java_lib_deps) \ $(jar_manifest_file) $(LOCAL_ADDITIONAL_DEPENDENCIES) $(transform-host-java-to-package) diff --git a/core/java.mk b/core/java.mk index 8abfb39c4..2234eff4f 100644 --- a/core/java.mk +++ b/core/java.mk @@ -331,6 +331,10 @@ layers_file := $(addprefix $(LOCAL_PATH)/, $(LOCAL_JAVA_LAYERS_FILE)) $(full_classes_compiled_jar): PRIVATE_JAVA_LAYERS_FILE := $(layers_file) $(full_classes_compiled_jar): PRIVATE_WARNINGS_ENABLE := $(LOCAL_WARNINGS_ENABLE) +ifdef LOCAL_RMTYPEDEFS +$(full_classes_compiled_jar): | $(RMTYPEDEFS) +endif + # Compile the java files to a .jar file. # This intentionally depends on java_sources, not all_java_sources. # Deps for generated source files must be handled separately, @@ -338,6 +342,7 @@ $(full_classes_compiled_jar): PRIVATE_WARNINGS_ENABLE := $(LOCAL_WARNINGS_ENABLE $(full_classes_compiled_jar): PRIVATE_JAVACFLAGS := $(LOCAL_JAVACFLAGS) $(full_classes_compiled_jar): PRIVATE_JAR_EXCLUDE_FILES := $(LOCAL_JAR_EXCLUDE_FILES) $(full_classes_compiled_jar): PRIVATE_JAR_PACKAGES := $(LOCAL_JAR_PACKAGES) +$(full_classes_compiled_jar): PRIVATE_RMTYPEDEFS := $(LOCAL_RMTYPEDEFS) $(full_classes_compiled_jar): PRIVATE_DONT_DELETE_JAR_META_INF := $(LOCAL_DONT_DELETE_JAR_META_INF) $(full_classes_compiled_jar): $(java_sources) $(java_resource_sources) $(full_java_lib_deps) \ $(jar_manifest_file) $(layers_file) $(RenderScript_file_stamp) \