diff --git a/core/aapt2.mk b/core/aapt2.mk index 109bb392d3..4385b4d097 100644 --- a/core/aapt2.mk +++ b/core/aapt2.mk @@ -66,6 +66,8 @@ $(my_res_resources_flat) $(my_overlay_resources_flat) $(my_resources_flata): \ my_static_library_resources := $(foreach l, $(call reverse-list,$(LOCAL_STATIC_ANDROID_LIBRARIES)),\ $(call intermediates-dir-for,JAVA_LIBRARIES,$(l),,COMMON)/package-res.apk) +my_static_library_extra_packages := $(foreach l, $(call reverse-list,$(LOCAL_STATIC_ANDROID_LIBRARIES)),\ + $(call intermediates-dir-for,JAVA_LIBRARIES,$(l),,COMMON)/extra_packages) my_shared_library_resources := $(foreach l, $(LOCAL_SHARED_ANDROID_LIBRARIES),\ $(call intermediates-dir-for,JAVA_LIBRARIES,$(l),,COMMON)/package-res.apk) @@ -81,6 +83,8 @@ endif my_srcjar := $(intermediates.COMMON)/aapt2.srcjar LOCAL_SRCJARS += $(my_srcjar) +aapt_extra_packages := $(intermediates.COMMON)/extra_packages + $(my_res_package): PRIVATE_RES_FLAT := $(my_res_resources_flat) $(my_res_package): PRIVATE_OVERLAY_FLAT := $(my_static_library_resources) $(my_resources_flata) $(my_overlay_resources_flat) $(my_res_package): PRIVATE_SHARED_ANDROID_LIBRARIES := $(my_shared_library_resources) @@ -88,7 +92,9 @@ $(my_res_package): PRIVATE_PROGUARD_OPTIONS_FILE := $(proguard_options_file) $(my_res_package): PRIVATE_ASSET_DIRS := $(my_asset_dirs) $(my_res_package): PRIVATE_JAVA_GEN_DIR := $(intermediates.COMMON)/aapt2 $(my_res_package): PRIVATE_SRCJAR := $(my_srcjar) -$(my_res_package): .KATI_IMPLICIT_OUTPUTS := $(my_srcjar) +$(my_res_package): PRIVATE_STATIC_LIBRARY_EXTRA_PACKAGES := $(my_static_library_extra_packages) +$(my_res_package): PRIVATE_AAPT_EXTRA_PACKAGES := $(aapt_extra_packages) +$(my_res_package): .KATI_IMPLICIT_OUTPUTS := $(my_srcjar) $(aapt_extra_packages) ifdef R_file_stamp $(my_res_package): PRIVATE_R_FILE_STAMP := $(R_file_stamp) @@ -112,8 +118,8 @@ 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_resources_flata) $(my_static_library_resources) \ - $(AAPT2) $(SOONG_ZIP) + $(my_resources_flata) $(my_static_library_resources) $(my_static_library_extra_packages) \ + $(AAPT2) $(SOONG_ZIP) $(EXTRACT_JAR_PACKAGES) @echo "AAPT2 link $@" $(call aapt2-link) ifdef R_file_stamp diff --git a/core/clear_vars.mk b/core/clear_vars.mk index eac5987e94..33257528ce 100644 --- a/core/clear_vars.mk +++ b/core/clear_vars.mk @@ -244,6 +244,7 @@ LOCAL_SOONG_JACOCO_REPORT_CLASSES_JAR := LOCAL_SOONG_PROGUARD_DICT := LOCAL_SOONG_RESOURCE_EXPORT_PACKAGE := LOCAL_SOONG_RRO_DIRS := +LOCAL_SOONG_STATIC_LIBRARY_EXTRA_PACKAGES := LOCAL_DROIDDOC_STUBS_SRCJAR := LOCAL_DROIDDOC_DOC_ZIP := # '',true diff --git a/core/definitions.mk b/core/definitions.mk index 6f029e9c57..092a778d8f 100644 --- a/core/definitions.mk +++ b/core/definitions.mk @@ -2125,6 +2125,7 @@ $(call dump-words-to-file,$(PRIVATE_RES_FLAT),$(dir $@)aapt2-flat-list) $(call dump-words-to-file,$(PRIVATE_OVERLAY_FLAT),$(dir $@)aapt2-flat-overlay-list) $(hide) $(AAPT2) link -o $@ \ $(PRIVATE_AAPT_FLAGS) \ + $(if $(PRIVATE_STATIC_LIBRARY_EXTRA_PACKAGES),$$(cat $(PRIVATE_STATIC_LIBRARY_EXTRA_PACKAGES))) \ $(addprefix --manifest ,$(PRIVATE_ANDROID_MANIFEST)) \ $(addprefix -I ,$(PRIVATE_AAPT_INCLUDES)) \ $(addprefix -I ,$(PRIVATE_SHARED_ANDROID_LIBRARIES)) \ @@ -2143,6 +2144,7 @@ $(hide) $(AAPT2) link -o $@ \ -R \@$(dir $@)aapt2-flat-overlay-list \ \@$(dir $@)aapt2-flat-list $(SOONG_ZIP) -o $(PRIVATE_SRCJAR) -C $(PRIVATE_JAVA_GEN_DIR) -D $(PRIVATE_JAVA_GEN_DIR) +$(EXTRACT_JAR_PACKAGES) -i $(PRIVATE_SRCJAR) -o $(PRIVATE_AAPT_EXTRA_PACKAGES) --prefix '--extra-packages ' endef ########################################################### diff --git a/core/soong_java_prebuilt.mk b/core/soong_java_prebuilt.mk index 3773c07319..58735cd057 100644 --- a/core/soong_java_prebuilt.mk +++ b/core/soong_java_prebuilt.mk @@ -61,6 +61,9 @@ ifdef LOCAL_SOONG_RESOURCE_EXPORT_PACKAGE $(call add-dependency,$(LOCAL_BUILT_MODULE),$(my_proguard_flags)) + my_static_library_extra_packages := $(intermediates.COMMON)/extra_packages + $(eval $(call copy-one-file,$(LOCAL_SOONG_STATIC_LIBRARY_EXTRA_PACKAGES),$(my_static_library_extra_packages))) + $(call add-dependency,$(LOCAL_BUILT_MODULE),$(my_static_library_extra_packages)) endif # LOCAL_SOONG_RESOURCE_EXPORT_PACKAGE ifneq ($(TURBINE_ENABLED),false)