Fix multiple output file generation for AAPT2
Make R.stamp actually part of the same rule that creates R.java. Otherwise if the generated sources directory is removed, we don't regenerate R.java / Manifest.java. Also move the package-export.apk and proguard options file into the same rule. Test: m telephony-common; rm out/target/common/obj/*/*_intermediates/src; m telephony-common Change-Id: I71f6fcaf20593ca23271d52d15537aaa9ef4cc77
This commit is contained in:
parent
a426e0e974
commit
ba9b0fbc05
|
@ -69,23 +69,11 @@ $(my_res_package): PRIVATE_OVERLAY_FLAT := $(my_static_library_resources) $(my_g
|
|||
$(my_res_package): PRIVATE_SHARED_ANDROID_LIBRARIES := $(my_shared_library_resources)
|
||||
$(my_res_package): PRIVATE_PROGUARD_OPTIONS_FILE := $(proguard_options_file)
|
||||
$(my_res_package): PRIVATE_ASSET_DIRS := $(my_asset_dirs)
|
||||
$(my_res_package): $(full_android_manifest) $(my_static_library_resources) $(my_shared_library_resources)
|
||||
$(my_res_package): $(my_full_asset_paths)
|
||||
$(my_res_package): $(my_res_resources_flat) $(my_overlay_resources_flat) \
|
||||
$(my_generated_resources_flata) $(my_static_library_resources) \
|
||||
$(AAPT2)
|
||||
@echo "AAPT2 link $@"
|
||||
$(call aapt2-link)
|
||||
$(my_res_package): .KATI_IMPLICIT_OUTPUTS :=
|
||||
|
||||
ifdef R_file_stamp
|
||||
$(R_file_stamp) : $(my_res_package) | $(ACP)
|
||||
@echo "target R.java/Manifest.java: $(PRIVATE_MODULE) ($@)"
|
||||
@rm -rf $@ && mkdir -p $(dir $@)
|
||||
$(call find-generated-R.java)
|
||||
endif
|
||||
|
||||
ifdef proguard_options_file
|
||||
$(proguard_options_file) : $(my_res_package)
|
||||
$(my_res_package): PRIVATE_R_FILE_STAMP := $(R_file_stamp)
|
||||
$(my_res_package): .KATI_IMPLICIT_OUTPUTS += $(R_file_stamp)
|
||||
endif
|
||||
|
||||
resource_export_package :=
|
||||
|
@ -94,10 +82,27 @@ ifdef LOCAL_EXPORT_PACKAGE_RESOURCES
|
|||
# other packages can use to build their own PRODUCT-agnostic R.java (etc.)
|
||||
# files.
|
||||
resource_export_package := $(intermediates.COMMON)/package-export.apk
|
||||
$(R_file_stamp) : $(resource_export_package)
|
||||
|
||||
$(resource_export_package) : $(my_res_package) | $(ACP)
|
||||
@echo "target Export Resources: $(PRIVATE_MODULE) $(@)"
|
||||
$(copy-file-to-new-target)
|
||||
|
||||
$(my_res_package): PRIVATE_RESOURCE_EXPORT_PACKAGE := $(resource_export_package)
|
||||
$(my_res_package): .KATI_IMPLICIT_OUTPUTS += $(resource_export_package)
|
||||
endif
|
||||
|
||||
ifdef proguard_options_file
|
||||
$(my_res_package): .KATI_IMPLICIT_OUTPUTS += $(proguard_options_file)
|
||||
endif
|
||||
|
||||
$(my_res_package): $(full_android_manifest) $(my_static_library_resources) $(my_shared_library_resources)
|
||||
$(my_res_package): $(my_full_asset_paths)
|
||||
$(my_res_package): $(my_res_resources_flat) $(my_overlay_resources_flat) \
|
||||
$(my_generated_resources_flata) $(my_static_library_resources) \
|
||||
$(AAPT2)
|
||||
@echo "AAPT2 link $@"
|
||||
$(call aapt2-link)
|
||||
ifdef R_file_stamp
|
||||
@rm -f $(PRIVATE_R_FILE_STAMP)
|
||||
$(call find-generated-R.java,$(PRIVATE_R_FILE_STAMP))
|
||||
endif
|
||||
ifdef LOCAL_EXPORT_PACKAGE_RESOURCES
|
||||
@rm -f $(PRIVATE_RESOURCE_EXPORT_PACKAGE)
|
||||
|
||||
cp $@ $(PRIVATE_RESOURCE_EXPORT_PACKAGE)
|
||||
endif
|
||||
|
|
|
@ -2060,7 +2060,7 @@ $(hide) $(AAPT_ASAN_OPTIONS) $(AAPT) package $(PRIVATE_AAPT_FLAGS) -m \
|
|||
--skip-symbols-without-default-localization
|
||||
endef
|
||||
|
||||
# Search for generated R.java/Manifest.java, copy the found R.java as $@.
|
||||
# Search for generated R.java/Manifest.java, copy the found R.java as $1.
|
||||
# Also copy them to a central 'R' directory to make it easier to add the files to an IDE.
|
||||
define find-generated-R.java
|
||||
$(hide) for GENERATED_MANIFEST_FILE in `find $(PRIVATE_SOURCE_INTERMEDIATES_DIR) \
|
||||
|
@ -2075,11 +2075,11 @@ $(hide) for GENERATED_R_FILE in `find $(PRIVATE_SOURCE_INTERMEDIATES_DIR) \
|
|||
mkdir -p $(TARGET_COMMON_OUT_ROOT)/R/$$dir; \
|
||||
$(ACP) -fp $$GENERATED_R_FILE $(TARGET_COMMON_OUT_ROOT)/R/$$dir \
|
||||
|| exit 31; \
|
||||
$(ACP) -fp $$GENERATED_R_FILE $@ || exit 32; \
|
||||
$(ACP) -fp $$GENERATED_R_FILE $1 || exit 32; \
|
||||
done;
|
||||
@# Ensure that the target file is always created, i.e. also in case we did not
|
||||
@# enter the GENERATED_R_FILE-loop above. This avoids unnecessary rebuilding.
|
||||
$(hide) touch $@
|
||||
$(hide) touch $1
|
||||
endef
|
||||
|
||||
###########################################################
|
||||
|
|
|
@ -419,7 +419,7 @@ $(R_file_stamp): $(all_res_assets) $(full_android_manifest) $(RenderScript_file_
|
|||
@echo "target R.java/Manifest.java: $(PRIVATE_MODULE) ($@)"
|
||||
@rm -rf $@ && mkdir -p $(dir $@)
|
||||
$(create-resource-java-files)
|
||||
$(call find-generated-R.java)
|
||||
$(call find-generated-R.java,$@)
|
||||
|
||||
$(proguard_options_file): $(R_file_stamp)
|
||||
|
||||
|
|
Loading…
Reference in New Issue