From f1a98af5fcc253081bea85b22ddd64422737394a Mon Sep 17 00:00:00 2001 From: Dan Willemsen Date: Mon, 29 Feb 2016 12:45:18 -0800 Subject: [PATCH 1/3] Replace some uses of acp with cp ACP was originally created to overcome differences with cp between Linux, Darwin, and Windows. We've since dropped Windows as a build host, and don't use features like '-u' anymore. For most of our current usecases, 'acp' is identical to 'cp' except that it splits 'cp -p' into 'acp -p' for mode and ownership, and 'acp -t' for timestamps. On Linux, this could be specified using '--preserve=mode,ownership', but Darwin doesn't have this. Since we're removing the destination file before copying, 'cp' already preserves the mode (modulated by the umask). So the only extra thing that gets preserved with 'acp -p' is ownership, which we should not care about in the build system. (In many cases we shouldn't be preserving mode either, so that readonly source trees can actually be marked readonly, but that will be a future change) Change-Id: Ied96fdc303ac5c774347c07363daec8b6dfb22e4 --- core/definitions.mk | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/core/definitions.mk b/core/definitions.mk index 6960ff34e..9cce072e6 100644 --- a/core/definitions.mk +++ b/core/definitions.mk @@ -2363,7 +2363,7 @@ endef # $(1): source file # $(2): destination file define copy-one-file -$(2): $(1) | $(ACP) +$(2): $(1) @echo "Copy: $$@" $$(copy-file-to-target) endef @@ -2399,13 +2399,15 @@ endef # Copy a single file from one place to another, # preserving permissions and overwriting any existing # file. -# We disable the "-t" option for acp cannot handle -# high resolution timestamp correctly on file systems like ext4. -# Therefore copy-file-to-target is the same as copy-file-to-new-target. +# When we used acp, it could not handle high resolution timestamps +# on file systems like ext4. Because of that, '-t' option was disabled +# and copy-file-to-target was identical to copy-file-to-new-target. +# Keep the behavior until we audit and ensure that switching this back +# won't break anything. define copy-file-to-target @mkdir -p $(dir $@) $(hide) rm -f $@ -$(hide) $(ACP) -p $< $@ +$(hide) cp $< $@ endef # The same as copy-file-to-target, but use the local @@ -2436,7 +2438,7 @@ endef define copy-file-to-new-target @mkdir -p $(dir $@) $(hide) rm -f $@ -$(hide) $(ACP) -p $< $@ +$(hide) cp $< $@ endef # The same as copy-file-to-new-target, but use the local From 7f016150a0ba2c45859a4020a93c9000fd94f436 Mon Sep 17 00:00:00 2001 From: Dan Willemsen Date: Mon, 29 Feb 2016 17:52:39 -0800 Subject: [PATCH 2/3] Remove unused dependencies on $(ACP) Most of these are calling to copy-file-to-target or similar, which no longer use $(ACP). Change-Id: I62287a80c577c34df587b74e70055c2f56050ce7 --- core/Makefile | 4 ++-- core/base_rules.mk | 2 +- core/binary.mk | 2 +- core/definitions.mk | 6 +++--- core/dex_preopt.mk | 2 +- core/dex_preopt_odex_install.mk | 3 +-- core/dynamic_binary.mk | 8 ++++---- core/java.mk | 6 +++--- core/java_library.mk | 6 +++--- core/package_internal.mk | 2 +- core/prebuilt_internal.mk | 12 ++++++------ tools/apicheck/Android.mk | 2 +- 12 files changed, 27 insertions(+), 28 deletions(-) diff --git a/core/Makefile b/core/Makefile index 2d7f76d6d..5c302f663 100644 --- a/core/Makefile +++ b/core/Makefile @@ -674,7 +674,7 @@ $(eval $(call combine-notice-files, \ $(target_notice_file_html_gz): $(target_notice_file_html) | $(MINIGZIP) $(hide) $(MINIGZIP) -9 < $< > $@ installed_notice_html_gz := $(TARGET_OUT)/etc/NOTICE.html.gz -$(installed_notice_html_gz): $(target_notice_file_html_gz) | $(ACP) +$(installed_notice_html_gz): $(target_notice_file_html_gz) $(copy-file-to-target) # if we've been run my mm, mmm, etc, don't reinstall this every time @@ -1142,7 +1142,7 @@ endif endif -$(INSTALLED_SYSTEMIMAGE): $(BUILT_SYSTEMIMAGE) $(RECOVERY_FROM_BOOT_PATCH) | $(ACP) +$(INSTALLED_SYSTEMIMAGE): $(BUILT_SYSTEMIMAGE) $(RECOVERY_FROM_BOOT_PATCH) @echo "Install system fs image: $@" $(copy-file-to-target) $(hide) $(call assert-max-image-size,$@ $(RECOVERY_FROM_BOOT_PATCH),$(BOARD_SYSTEMIMAGE_PARTITION_SIZE)) diff --git a/core/base_rules.mk b/core/base_rules.mk index 1d3f57ed8..cb2dfcbb1 100644 --- a/core/base_rules.mk +++ b/core/base_rules.mk @@ -310,7 +310,7 @@ ifndef LOCAL_UNINSTALLABLE_MODULE # installation; hence, LOCAL_ACP_UNAVAILABLE. $(LOCAL_INSTALLED_MODULE): PRIVATE_POST_INSTALL_CMD := $(LOCAL_POST_INSTALL_CMD) ifneq ($(LOCAL_ACP_UNAVAILABLE),true) -$(LOCAL_INSTALLED_MODULE): $(LOCAL_BUILT_MODULE) | $(ACP) +$(LOCAL_INSTALLED_MODULE): $(LOCAL_BUILT_MODULE) @echo "Install: $@" $(copy-file-to-new-target) $(PRIVATE_POST_INSTALL_CMD) diff --git a/core/binary.mk b/core/binary.mk index c6c27084f..54dc474c3 100644 --- a/core/binary.mk +++ b/core/binary.mk @@ -528,7 +528,7 @@ $(my_generated_sources): PRIVATE_MODULE := $(my_register_name) my_gen_sources_copy := $(patsubst $(generated_sources_dir)/%,$(intermediates)/%,$(filter $(generated_sources_dir)/%,$(my_generated_sources))) -$(my_gen_sources_copy): $(intermediates)/% : $(generated_sources_dir)/% | $(ACP) +$(my_gen_sources_copy): $(intermediates)/% : $(generated_sources_dir)/% @echo "Copy: $@" $(copy-file-to-target) diff --git a/core/definitions.mk b/core/definitions.mk index 9cce072e6..c45671021 100644 --- a/core/definitions.mk +++ b/core/definitions.mk @@ -2384,7 +2384,7 @@ endef # $(1): source file # $(2): destination file, must end with .xml. define copy-xml-file-checked -$(2): $(1) | $(ACP) +$(2): $(1) @echo "Copy xml: $$@" $(hide) xmllint $$< >/dev/null # Don't print the xml file to stdout. $$(copy-file-to-target) @@ -2575,7 +2575,7 @@ define add-radio-file endef define add-radio-file-internal INSTALLED_RADIOIMAGE_TARGET += $$(PRODUCT_OUT)/$(2) -$$(PRODUCT_OUT)/$(2) : $$(LOCAL_PATH)/$(1) | $$(ACP) +$$(PRODUCT_OUT)/$(2) : $$(LOCAL_PATH)/$(1) $$(transform-prebuilt-to-target) endef @@ -2590,7 +2590,7 @@ endef define add-radio-file-checked-internal INSTALLED_RADIOIMAGE_TARGET += $$(PRODUCT_OUT)/$(2) BOARD_INFO_CHECK += $(3):$(LOCAL_PATH)/$(1) -$$(PRODUCT_OUT)/$(2) : $$(LOCAL_PATH)/$(1) | $$(ACP) +$$(PRODUCT_OUT)/$(2) : $$(LOCAL_PATH)/$(1) $$(transform-prebuilt-to-target) endef diff --git a/core/dex_preopt.mk b/core/dex_preopt.mk index e0dde01e9..8c473f7c5 100644 --- a/core/dex_preopt.mk +++ b/core/dex_preopt.mk @@ -35,7 +35,7 @@ define _dexpreopt-boot-jar-remove-classes.dex _dbj_jar_no_dex := $(DEXPREOPT_BOOT_JAR_DIR_FULL_PATH)/$(1)_nodex.jar _dbj_src_jar := $(call intermediates-dir-for,JAVA_LIBRARIES,$(1),,COMMON)/javalib.jar -$$(_dbj_jar_no_dex) : $$(_dbj_src_jar) | $(ACP) +$$(_dbj_jar_no_dex) : $$(_dbj_src_jar) $$(call copy-file-to-target) ifneq ($(DEX_PREOPT_DEFAULT),nostripping) $$(call dexpreopt-remove-classes.dex,$$@) diff --git a/core/dex_preopt_odex_install.mk b/core/dex_preopt_odex_install.mk index 73c814667..c7d9750d7 100644 --- a/core/dex_preopt_odex_install.mk +++ b/core/dex_preopt_odex_install.mk @@ -106,8 +106,7 @@ $(built_odex): PRIVATE_DEX_PREOPT_FLAGS := $(LOCAL_DEX_PREOPT_FLAGS) # Use pattern rule - we may have multiple installed odex files. # Ugly syntax - See the definition get-odex-file-path. $(installed_odex) : $(dir $(LOCAL_INSTALLED_MODULE))%$(notdir $(word 1,$(installed_odex))) \ - : $(dir $(LOCAL_BUILT_MODULE))%$(notdir $(word 1,$(built_odex))) \ - | $(ACP) + : $(dir $(LOCAL_BUILT_MODULE))%$(notdir $(word 1,$(built_odex))) @echo "Install: $@" $(copy-file-to-target) endif diff --git a/core/dynamic_binary.mk b/core/dynamic_binary.mk index d6f6cc961..0244494ab 100644 --- a/core/dynamic_binary.mk +++ b/core/dynamic_binary.mk @@ -67,10 +67,10 @@ endif ifeq (true,$(my_pack_module_relocations)) # Pack relocations -$(relocation_packer_output): $(relocation_packer_input) | $(ACP) +$(relocation_packer_output): $(relocation_packer_input) $(pack-elf-relocations) else -$(relocation_packer_output): $(relocation_packer_input) | $(ACP) +$(relocation_packer_output): $(relocation_packer_input) @echo "target Unpacked: $(PRIVATE_MODULE) ($@)" $(copy-file-to-target) endif @@ -85,7 +85,7 @@ my_unstripped_path := $(LOCAL_UNSTRIPPED_PATH) endif symbolic_input := $(relocation_packer_output) symbolic_output := $(my_unstripped_path)/$(my_installed_module_stem) -$(symbolic_output) : $(symbolic_input) | $(ACP) +$(symbolic_output) : $(symbolic_input) @echo "target Symbolic: $(PRIVATE_MODULE) ($@)" $(copy-file-to-target) @@ -148,7 +148,7 @@ else # If the binary we're copying is acp or a prerequisite, # use cp(1) instead. ifneq ($(LOCAL_ACP_UNAVAILABLE),true) -$(strip_output): $(strip_input) | $(ACP) +$(strip_output): $(strip_input) @echo "target Unstripped: $(PRIVATE_MODULE) ($@)" $(copy-file-to-target) else diff --git a/core/java.mk b/core/java.mk index 4485af61c..31e0644b0 100644 --- a/core/java.mk +++ b/core/java.mk @@ -445,7 +445,7 @@ $(full_classes_emma_jar): $(full_classes_jarjar_jar) | $(EMMA_JAR) $(transform-classes.jar-to-emma) else -$(full_classes_emma_jar): $(full_classes_jarjar_jar) | $(ACP) +$(full_classes_emma_jar): $(full_classes_jarjar_jar) @echo Copying: $@ $(copy-file-to-target) endif @@ -561,11 +561,11 @@ extra_input_jar := endif $(full_classes_proguard_jar): PRIVATE_EXTRA_INPUT_JAR := $(extra_input_jar) $(full_classes_proguard_jar): PRIVATE_PROGUARD_FLAGS := $(legacy_proguard_flags) $(common_proguard_flags) $(LOCAL_PROGUARD_FLAGS) -$(full_classes_proguard_jar) : $(full_classes_jar) $(extra_input_jar) $(my_support_library_sdk_raise) $(proguard_flag_files) | $(ACP) $(PROGUARD) +$(full_classes_proguard_jar) : $(full_classes_jar) $(extra_input_jar) $(my_support_library_sdk_raise) $(proguard_flag_files) | $(PROGUARD) $(call transform-jar-to-proguard) else # LOCAL_PROGUARD_ENABLED not defined -$(full_classes_proguard_jar) : $(full_classes_jar) +$(full_classes_proguard_jar) : $(full_classes_jar) | $(ACP) @echo Copying: $@ $(hide) $(ACP) -fp $< $@ diff --git a/core/java_library.mk b/core/java_library.mk index 81a4a6a30..8edba552f 100644 --- a/core/java_library.mk +++ b/core/java_library.mk @@ -103,7 +103,7 @@ ifdef LOCAL_DEX_PREOPT ifneq ($(dexpreopt_boot_jar_module),) # boot jar # boot jar's rules are defined in dex_preopt.mk dexpreopted_boot_jar := $(DEXPREOPT_BOOT_JAR_DIR_FULL_PATH)/$(dexpreopt_boot_jar_module)_nodex.jar -$(LOCAL_BUILT_MODULE) : $(dexpreopted_boot_jar) | $(ACP) +$(LOCAL_BUILT_MODULE) : $(dexpreopted_boot_jar) $(call copy-file-to-target) # For libart boot jars, we don't have .odex files. @@ -114,7 +114,7 @@ $(built_odex) : $(dir $(LOCAL_BUILT_MODULE))% : $(common_javalib.jar) @echo "Dexpreopt Jar: $(PRIVATE_MODULE) ($@)" $(call dexpreopt-one-file,$<,$@) -$(LOCAL_BUILT_MODULE) : $(common_javalib.jar) | $(ACP) +$(LOCAL_BUILT_MODULE) : $(common_javalib.jar) $(call copy-file-to-target) ifneq (nostripping,$(LOCAL_DEX_PREOPT)) $(call dexpreopt-remove-classes.dex,$@) @@ -123,7 +123,7 @@ endif endif # ! boot jar else # LOCAL_DEX_PREOPT -$(LOCAL_BUILT_MODULE) : $(common_javalib.jar) | $(ACP) +$(LOCAL_BUILT_MODULE) : $(common_javalib.jar) $(call copy-file-to-target) endif # LOCAL_DEX_PREOPT diff --git a/core/package_internal.mk b/core/package_internal.mk index 097d801cb..b6f8c8841 100644 --- a/core/package_internal.mk +++ b/core/package_internal.mk @@ -497,7 +497,7 @@ $(built_apk_splits) : $(built_module_path)/%.apk : $(LOCAL_BUILT_MODULE) $(sign-package) # Rules to install the splits -$(installed_apk_splits) : $(my_module_path)/$(LOCAL_MODULE)_%.apk : $(built_module_path)/package_%.apk | $(ACP) +$(installed_apk_splits) : $(my_module_path)/$(LOCAL_MODULE)_%.apk : $(built_module_path)/package_%.apk @echo "Install: $@" $(copy-file-to-new-target) diff --git a/core/prebuilt_internal.mk b/core/prebuilt_internal.mk index 14228091f..bf18e18fd 100644 --- a/core/prebuilt_internal.mk +++ b/core/prebuilt_internal.mk @@ -216,7 +216,7 @@ embedded_prebuilt_jni_libs := 'lib/*.so' endif $(built_module): PRIVATE_EMBEDDED_JNI_LIBS := $(embedded_prebuilt_jni_libs) -$(built_module) : $(my_prebuilt_src_file) | $(ACP) $(ZIPALIGN) $(SIGNAPK_JAR) $(AAPT) +$(built_module) : $(my_prebuilt_src_file) | $(ZIPALIGN) $(SIGNAPK_JAR) $(AAPT) $(transform-prebuilt-to-target) $(uncompress-shared-libs) ifneq ($(LOCAL_CERTIFICATE),PRESIGNED) @@ -255,12 +255,12 @@ my_src_dir := $(LOCAL_PATH)/$(my_src_dir) $(built_apk_splits) : PRIVATE_PRIVATE_KEY := $(LOCAL_CERTIFICATE).pk8 $(built_apk_splits) : PRIVATE_CERTIFICATE := $(LOCAL_CERTIFICATE).x509.pem -$(built_apk_splits) : $(built_module_path)/%.apk : $(my_src_dir)/%.apk | $(ACP) $(AAPT) +$(built_apk_splits) : $(built_module_path)/%.apk : $(my_src_dir)/%.apk | $(AAPT) $(copy-file-to-new-target) $(sign-package) # Rules to install the split apks. -$(installed_apk_splits) : $(my_module_path)/%.apk : $(built_module_path)/%.apk | $(ACP) +$(installed_apk_splits) : $(my_module_path)/%.apk : $(built_module_path)/%.apk @echo "Install: $@" $(copy-file-to-new-target) @@ -280,7 +280,7 @@ $(built_module) : $(my_prebuilt_src_file) $(transform-prebuilt-to-target-strip-comments) else ifneq ($(LOCAL_ACP_UNAVAILABLE),true) -$(built_module) : $(my_prebuilt_src_file) | $(ACP) +$(built_module) : $(my_prebuilt_src_file) $(transform-prebuilt-to-target) else $(built_module) : $(my_prebuilt_src_file) @@ -312,10 +312,10 @@ $(my_src_jar) : $(my_prebuilt_src_file) $(hide) touch $@ endif -$(common_classes_jar) : $(my_src_jar) | $(ACP) +$(common_classes_jar) : $(my_src_jar) $(transform-prebuilt-to-target) -$(common_javalib_jar) : $(common_classes_jar) | $(ACP) +$(common_javalib_jar) : $(common_classes_jar) $(transform-prebuilt-to-target) $(call define-jar-to-toc-rule, $(common_classes_jar)) diff --git a/tools/apicheck/Android.mk b/tools/apicheck/Android.mk index 1674a17e9..9dc7c6bc3 100644 --- a/tools/apicheck/Android.mk +++ b/tools/apicheck/Android.mk @@ -31,7 +31,7 @@ LOCAL_MODULE := apicheck include $(BUILD_SYSTEM)/base_rules.mk $(LOCAL_BUILT_MODULE): $(HOST_OUT_JAVA_LIBRARIES)/doclava$(COMMON_JAVA_PACKAGE_SUFFIX) -$(LOCAL_BUILT_MODULE): $(LOCAL_PATH)/etc/apicheck | $(ACP) +$(LOCAL_BUILT_MODULE): $(LOCAL_PATH)/etc/apicheck @echo "Copy: $(PRIVATE_MODULE) ($@)" $(copy-file-to-new-target) $(hide) chmod 755 $@ From 479311bc7cd9170076b06056e4824f0f10d81216 Mon Sep 17 00:00:00 2001 From: Dan Willemsen Date: Mon, 29 Feb 2016 13:20:29 -0800 Subject: [PATCH 3/3] Remove LOCAL_ACP_UNAVAILABLE Now that copy-file-to-target doesn't use acp, nothing in the acp build path uses acp, so we don't need to special case it to prevent loops. Change-Id: I12810c1b064d0c03135a80077a76bc4c9cc18b24 --- core/base_rules.mk | 14 -------------- core/clear_vars.mk | 1 - core/dynamic_binary.mk | 9 --------- core/prebuilt_internal.mk | 5 ----- libs/host/Android.mk | 4 ---- tools/acp/Android.mk | 1 - 6 files changed, 34 deletions(-) diff --git a/core/base_rules.mk b/core/base_rules.mk index cb2dfcbb1..5afec2f45 100644 --- a/core/base_rules.mk +++ b/core/base_rules.mk @@ -299,26 +299,12 @@ $(foreach c, $(my_path_components),\ ## Module installation rule ########################################################### -# Some hosts do not have ACP; override the LOCAL version if that's the case. -ifneq ($(strip $(HOST_ACP_UNAVAILABLE)),) - LOCAL_ACP_UNAVAILABLE := $(strip $(HOST_ACP_UNAVAILABLE)) -endif - ifndef LOCAL_UNINSTALLABLE_MODULE - # Define a copy rule to install the module. - # acp and libraries that it uses can't use acp for - # installation; hence, LOCAL_ACP_UNAVAILABLE. $(LOCAL_INSTALLED_MODULE): PRIVATE_POST_INSTALL_CMD := $(LOCAL_POST_INSTALL_CMD) -ifneq ($(LOCAL_ACP_UNAVAILABLE),true) $(LOCAL_INSTALLED_MODULE): $(LOCAL_BUILT_MODULE) @echo "Install: $@" $(copy-file-to-new-target) $(PRIVATE_POST_INSTALL_CMD) -else -$(LOCAL_INSTALLED_MODULE): $(LOCAL_BUILT_MODULE) - @echo "Install: $@" - $(copy-file-to-target-with-cp) -endif # Rule to install the module's companion init.rc. my_init_rc_installed := diff --git a/core/clear_vars.mk b/core/clear_vars.mk index 0267321ca..206a230c2 100644 --- a/core/clear_vars.mk +++ b/core/clear_vars.mk @@ -25,7 +25,6 @@ LOCAL_EXPORT_PACKAGE_RESOURCES:= LOCAL_MANIFEST_PACKAGE_NAME:= LOCAL_PACKAGE_SPLITS:= LOCAL_REQUIRED_MODULES:= -LOCAL_ACP_UNAVAILABLE:= LOCAL_MODULE_TAGS:= LOCAL_SRC_FILES:= LOCAL_SRC_FILES_EXCLUDE:= diff --git a/core/dynamic_binary.mk b/core/dynamic_binary.mk index 0244494ab..e81402d90 100644 --- a/core/dynamic_binary.mk +++ b/core/dynamic_binary.mk @@ -144,18 +144,9 @@ endif else # Don't strip the binary, just copy it. We can't skip this step # because a copy of the binary must appear at LOCAL_BUILT_MODULE. -# -# If the binary we're copying is acp or a prerequisite, -# use cp(1) instead. -ifneq ($(LOCAL_ACP_UNAVAILABLE),true) $(strip_output): $(strip_input) @echo "target Unstripped: $(PRIVATE_MODULE) ($@)" $(copy-file-to-target) -else -$(strip_output): $(strip_input) - @echo "target Unstripped: $(PRIVATE_MODULE) ($@)" - $(copy-file-to-target-with-cp) -endif endif # my_strip_module $(cleantarget): PRIVATE_CLEAN_FILES += \ diff --git a/core/prebuilt_internal.mk b/core/prebuilt_internal.mk index bf18e18fd..8c14775fd 100644 --- a/core/prebuilt_internal.mk +++ b/core/prebuilt_internal.mk @@ -279,13 +279,8 @@ ifneq ($(LOCAL_PREBUILT_STRIP_COMMENTS),) $(built_module) : $(my_prebuilt_src_file) $(transform-prebuilt-to-target-strip-comments) else -ifneq ($(LOCAL_ACP_UNAVAILABLE),true) $(built_module) : $(my_prebuilt_src_file) $(transform-prebuilt-to-target) -else -$(built_module) : $(my_prebuilt_src_file) - $(copy-file-to-target-with-cp) -endif endif endif # LOCAL_MODULE_CLASS != APPS diff --git a/libs/host/Android.mk b/libs/host/Android.mk index bc25e4b76..5e6a29120 100644 --- a/libs/host/Android.mk +++ b/libs/host/Android.mk @@ -12,10 +12,6 @@ LOCAL_C_INCLUDES := $(LOCAL_PATH)/include LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)/include LOCAL_CXX_STL := none -# acp uses libhost, so we can't use -# acp to install libhost. -LOCAL_ACP_UNAVAILABLE:= true - include $(BUILD_HOST_STATIC_LIBRARY) # Include toolchain prebuilt modules if they exist. diff --git a/tools/acp/Android.mk b/tools/acp/Android.mk index eec9c9db3..56aac141d 100644 --- a/tools/acp/Android.mk +++ b/tools/acp/Android.mk @@ -11,7 +11,6 @@ LOCAL_SRC_FILES := \ LOCAL_STATIC_LIBRARIES := libhost LOCAL_MODULE := acp -LOCAL_ACP_UNAVAILABLE := true LOCAL_CXX_STL := none include $(BUILD_HOST_EXECUTABLE)