2017-09-07 22:21:51 +02:00
|
|
|
# Java prebuilt coming from Soong.
|
|
|
|
# Extra inputs:
|
2018-11-17 06:26:33 +01:00
|
|
|
# LOCAL_SOONG_BUILT_INSTALLED
|
|
|
|
# LOCAL_SOONG_CLASSES_JAR
|
2017-09-07 22:21:51 +02:00
|
|
|
# LOCAL_SOONG_HEADER_JAR
|
2017-09-12 22:41:20 +02:00
|
|
|
# LOCAL_SOONG_DEX_JAR
|
2017-11-23 01:04:55 +01:00
|
|
|
# LOCAL_SOONG_JACOCO_REPORT_CLASSES_JAR
|
2021-01-06 18:42:14 +01:00
|
|
|
# LOCAL_SOONG_DEXPREOPT_CONFIG
|
2017-09-07 22:21:51 +02:00
|
|
|
|
|
|
|
ifneq ($(LOCAL_MODULE_MAKEFILE),$(SOONG_ANDROID_MK))
|
|
|
|
$(call pretty-error,soong_java_prebuilt.mk may only be used from Soong)
|
|
|
|
endif
|
|
|
|
|
|
|
|
LOCAL_MODULE_SUFFIX := .jar
|
|
|
|
LOCAL_BUILT_MODULE_STEM := javalib.jar
|
|
|
|
|
2019-01-30 00:07:46 +01:00
|
|
|
intermediates.COMMON := $(call local-intermediates-dir,COMMON)
|
2017-09-07 22:21:51 +02:00
|
|
|
|
|
|
|
full_classes_jar := $(intermediates.COMMON)/classes.jar
|
2017-11-30 05:44:11 +01:00
|
|
|
full_classes_pre_proguard_jar := $(intermediates.COMMON)/classes-pre-proguard.jar
|
2017-09-07 22:21:51 +02:00
|
|
|
full_classes_header_jar := $(intermediates.COMMON)/classes-header.jar
|
2017-09-12 22:41:20 +02:00
|
|
|
common_javalib.jar := $(intermediates.COMMON)/javalib.jar
|
2017-09-07 22:21:51 +02:00
|
|
|
|
2019-01-30 00:07:46 +01:00
|
|
|
ifdef LOCAL_SOONG_AAR
|
|
|
|
LOCAL_ADDITIONAL_CHECKED_MODULE += $(LOCAL_SOONG_AAR)
|
|
|
|
endif
|
|
|
|
|
2021-10-09 06:06:56 +02:00
|
|
|
# Use the Soong output as the checkbuild target instead of LOCAL_BUILT_MODULE
|
|
|
|
# to avoid checkbuilds making an extra copy of every module.
|
|
|
|
LOCAL_CHECKED_MODULE := $(LOCAL_PREBUILT_MODULE_FILE)
|
|
|
|
LOCAL_ADDITIONAL_CHECKED_MODULE += $(LOCAL_SOONG_HEADER_JAR)
|
|
|
|
LOCAL_ADDITIONAL_CHECKED_MODULE += $(LOCAL_FULL_MANIFEST_FILE)
|
|
|
|
LOCAL_ADDITIONAL_CHECKED_MODULE += $(LOCAL_SOONG_DEXPREOPT_CONFIG)
|
|
|
|
LOCAL_ADDITIONAL_CHECKED_MODULE += $(LOCAL_SOONG_RESOURCE_EXPORT_PACKAGE)
|
|
|
|
LOCAL_ADDITIONAL_CHECKED_MODULE += $(LOCAL_SOONG_DEX_JAR)
|
|
|
|
|
2019-01-30 00:07:46 +01:00
|
|
|
#######################################
|
|
|
|
include $(BUILD_SYSTEM)/base_rules.mk
|
|
|
|
#######################################
|
|
|
|
|
2019-01-14 23:10:20 +01:00
|
|
|
ifdef LOCAL_SOONG_CLASSES_JAR
|
|
|
|
$(eval $(call copy-one-file,$(LOCAL_SOONG_CLASSES_JAR),$(full_classes_jar)))
|
|
|
|
$(eval $(call copy-one-file,$(LOCAL_SOONG_CLASSES_JAR),$(full_classes_pre_proguard_jar)))
|
|
|
|
$(eval $(call add-dependency,$(LOCAL_BUILT_MODULE),$(full_classes_jar)))
|
|
|
|
|
|
|
|
ifneq ($(TURBINE_ENABLED),false)
|
|
|
|
ifdef LOCAL_SOONG_HEADER_JAR
|
|
|
|
$(eval $(call copy-one-file,$(LOCAL_SOONG_HEADER_JAR),$(full_classes_header_jar)))
|
|
|
|
else
|
|
|
|
$(eval $(call copy-one-file,$(full_classes_jar),$(full_classes_header_jar)))
|
|
|
|
endif
|
|
|
|
endif # TURBINE_ENABLED != false
|
|
|
|
endif
|
|
|
|
|
|
|
|
$(eval $(call copy-one-file,$(LOCAL_PREBUILT_MODULE_FILE),$(LOCAL_BUILT_MODULE)))
|
2017-09-07 22:21:51 +02:00
|
|
|
|
2017-11-23 01:04:55 +01:00
|
|
|
ifdef LOCAL_SOONG_JACOCO_REPORT_CLASSES_JAR
|
|
|
|
$(eval $(call copy-one-file,$(LOCAL_SOONG_JACOCO_REPORT_CLASSES_JAR),\
|
2021-04-07 03:04:06 +02:00
|
|
|
$(call local-packaging-dir,jacoco)/jacoco-report-classes.jar))
|
2017-12-07 01:09:49 +01:00
|
|
|
$(call add-dependency,$(common_javalib.jar),\
|
2021-04-07 03:04:06 +02:00
|
|
|
$(call local-packaging-dir,jacoco)/jacoco-report-classes.jar)
|
2017-11-23 01:04:55 +01:00
|
|
|
endif
|
2017-09-07 22:21:51 +02:00
|
|
|
|
2019-04-23 22:02:43 +02:00
|
|
|
ifdef LOCAL_SOONG_PROGUARD_DICT
|
2022-04-06 03:11:20 +02:00
|
|
|
$(eval $(call copy-r8-dictionary-file-with-mapping,\
|
|
|
|
$(LOCAL_SOONG_PROGUARD_DICT),\
|
Build the proguard dict zip without PACKAGING intermediates
Before, as each module was built, it would dump its proguard-related
files into the PACKAGING folder. Then the rule for the final distable
zip would zip up this whole folder. This means that if you built a
module that was not part of the system, and then rebuilt the final
zip, it would erronously include more proguard files than necessary.
This problem was worked around by relying on CI to run `m installclean`
every time.
Now, the zip proguard files always include the same information.
This also makes it so that when you build a module, its proguard files
are not copied to the PACKAGING folder, making builds that don't
build the final proguard zips slightly faster.
Bug: 205632228
Test: diff'd proguard-dict.zip, proguard-dict-mapping.textproto, and proguard-usage.zip before/after this cl on sdk_phone_x86_64. They have diffs, but only in the order of files / lines.
Change-Id: I98c02e1eb117c337ba9b98f04ad486597eb9bb86
2023-08-31 00:57:16 +02:00
|
|
|
$(intermediates.COMMON)/proguard_dictionary,\
|
|
|
|
$(intermediates.COMMON)/proguard_dictionary.textproto))
|
|
|
|
|
|
|
|
ALL_MODULES.$(my_register_name).PROGUARD_DICTIONARY_FILES := \
|
|
|
|
$(intermediates.COMMON)/proguard_dictionary \
|
|
|
|
$(LOCAL_SOONG_CLASSES_JAR)
|
|
|
|
ALL_MODULES.$(my_register_name).PROGUARD_DICTIONARY_SOONG_ZIP_ARGUMENTS := \
|
|
|
|
-e out/target/common/obj/$(LOCAL_MODULE_CLASS)/$(LOCAL_MODULE)_intermediates/proguard_dictionary \
|
|
|
|
-f $(intermediates.COMMON)/proguard_dictionary \
|
|
|
|
-e out/target/common/obj/$(LOCAL_MODULE_CLASS)/$(LOCAL_MODULE)_intermediates/classes.jar \
|
|
|
|
-f $(LOCAL_SOONG_CLASSES_JAR)
|
|
|
|
ALL_MODULES.$(my_register_name).PROGUARD_DICTIONARY_MAPPING := $(intermediates.COMMON)/proguard_dictionary.textproto
|
2019-04-23 22:02:43 +02:00
|
|
|
endif
|
|
|
|
|
2021-04-07 03:04:06 +02:00
|
|
|
ifdef LOCAL_SOONG_PROGUARD_USAGE_ZIP
|
Build the proguard dict zip without PACKAGING intermediates
Before, as each module was built, it would dump its proguard-related
files into the PACKAGING folder. Then the rule for the final distable
zip would zip up this whole folder. This means that if you built a
module that was not part of the system, and then rebuilt the final
zip, it would erronously include more proguard files than necessary.
This problem was worked around by relying on CI to run `m installclean`
every time.
Now, the zip proguard files always include the same information.
This also makes it so that when you build a module, its proguard files
are not copied to the PACKAGING folder, making builds that don't
build the final proguard zips slightly faster.
Bug: 205632228
Test: diff'd proguard-dict.zip, proguard-dict-mapping.textproto, and proguard-usage.zip before/after this cl on sdk_phone_x86_64. They have diffs, but only in the order of files / lines.
Change-Id: I98c02e1eb117c337ba9b98f04ad486597eb9bb86
2023-08-31 00:57:16 +02:00
|
|
|
ALL_MODULES.$(my_register_name).PROGUARD_USAGE_ZIP := $(LOCAL_SOONG_PROGUARD_USAGE_ZIP)
|
2020-08-15 02:43:35 +02:00
|
|
|
endif
|
|
|
|
|
|
|
|
|
2018-02-21 02:21:36 +01:00
|
|
|
ifdef LOCAL_SOONG_RESOURCE_EXPORT_PACKAGE
|
2018-05-01 00:59:16 +02:00
|
|
|
my_res_package := $(intermediates.COMMON)/package-res.apk
|
2018-02-21 02:21:36 +01:00
|
|
|
|
2018-05-01 00:59:16 +02:00
|
|
|
$(my_res_package): $(LOCAL_SOONG_RESOURCE_EXPORT_PACKAGE)
|
2018-04-19 23:19:52 +02:00
|
|
|
@echo "Copy: $@"
|
2018-02-21 02:21:36 +01:00
|
|
|
$(copy-file-to-target)
|
|
|
|
|
2018-05-01 00:59:16 +02:00
|
|
|
$(call add-dependency,$(LOCAL_BUILT_MODULE),$(my_res_package))
|
|
|
|
|
2023-06-24 01:17:54 +02:00
|
|
|
my_transitive_res_packages := $(intermediates.COMMON)/transitive-res-packages
|
2023-11-22 00:20:49 +01:00
|
|
|
$(eval $(call copy-one-file,$(LOCAL_SOONG_TRANSITIVE_RES_PACKAGES),$(my_transitive_res_packages)))
|
2023-06-24 01:17:54 +02:00
|
|
|
$(call add-dependency,$(my_res_package),$(my_transitive_res_packages))
|
|
|
|
|
2018-05-01 00:59:16 +02:00
|
|
|
my_proguard_flags := $(intermediates.COMMON)/export_proguard_flags
|
2023-11-22 00:20:49 +01:00
|
|
|
$(eval $(call copy-one-file,$(LOCAL_SOONG_EXPORT_PROGUARD_FLAGS),$(my_proguard_flags)))
|
2018-05-01 00:59:16 +02:00
|
|
|
$(call add-dependency,$(LOCAL_BUILT_MODULE),$(my_proguard_flags))
|
2018-02-21 02:21:36 +01:00
|
|
|
|
2018-05-02 21:52:43 +02:00
|
|
|
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))
|
2018-06-08 01:44:07 +02:00
|
|
|
|
|
|
|
my_static_library_android_manifest := $(intermediates.COMMON)/manifest/AndroidManifest.xml
|
|
|
|
$(eval $(call copy-one-file,$(LOCAL_FULL_MANIFEST_FILE),$(my_static_library_android_manifest)))
|
|
|
|
$(call add-dependency,$(LOCAL_BUILT_MODULE),$(my_static_library_android_manifest))
|
2018-02-21 02:21:36 +01:00
|
|
|
endif # LOCAL_SOONG_RESOURCE_EXPORT_PACKAGE
|
|
|
|
|
2019-01-15 12:46:32 +01:00
|
|
|
|
2017-09-12 22:41:20 +02:00
|
|
|
ifdef LOCAL_SOONG_DEX_JAR
|
2019-01-15 12:46:32 +01:00
|
|
|
ifndef LOCAL_IS_HOST_MODULE
|
2020-04-30 11:59:48 +02:00
|
|
|
boot_jars := $(foreach pair,$(PRODUCT_BOOT_JARS), $(call word-colon,2,$(pair)))
|
|
|
|
ifneq ($(filter $(LOCAL_MODULE),$(boot_jars)),) # is_boot_jar
|
2019-01-14 23:10:20 +01:00
|
|
|
ifeq (true,$(WITH_DEXPREOPT))
|
2020-07-01 14:16:07 +02:00
|
|
|
# $(DEFAULT_DEX_PREOPT_INSTALLED_IMAGE_MODULE) contains modules that installs
|
|
|
|
# all of bootjars' dexpreopt files (.art, .oat, .vdex, ...)
|
|
|
|
# Add them to the required list so they are installed alongside this module.
|
|
|
|
ALL_MODULES.$(my_register_name).REQUIRED_FROM_TARGET += \
|
|
|
|
$(DEFAULT_DEX_PREOPT_INSTALLED_IMAGE_MODULE) \
|
|
|
|
$(2ND_DEFAULT_DEX_PREOPT_INSTALLED_IMAGE_MODULE)
|
|
|
|
# Copy $(LOCAL_BUILT_MODULE) and its dependencies when installing boot.art
|
|
|
|
# so that dependencies of $(LOCAL_BUILT_MODULE) (which may include
|
|
|
|
# jacoco-report-classes.jar) are copied for every build.
|
|
|
|
$(foreach m,$(DEFAULT_DEX_PREOPT_INSTALLED_IMAGE_MODULE) $(2ND_DEFAULT_DEX_PREOPT_INSTALLED_IMAGE_MODULE), \
|
|
|
|
$(eval $(call add-dependency,$(firstword $(call module-installed-files,$(m))),$(LOCAL_BUILT_MODULE))) \
|
|
|
|
)
|
2019-01-14 23:10:20 +01:00
|
|
|
endif
|
|
|
|
endif # is_boot_jar
|
|
|
|
|
2019-01-17 00:13:48 +01:00
|
|
|
$(eval $(call copy-one-file,$(LOCAL_SOONG_DEX_JAR),$(common_javalib.jar)))
|
2019-01-14 23:10:20 +01:00
|
|
|
$(eval $(call add-dependency,$(LOCAL_BUILT_MODULE),$(common_javalib.jar)))
|
2021-03-17 10:01:50 +01:00
|
|
|
ifdef LOCAL_SOONG_CLASSES_JAR
|
|
|
|
$(eval $(call add-dependency,$(common_javalib.jar),$(full_classes_jar)))
|
|
|
|
ifneq ($(TURBINE_ENABLED),false)
|
|
|
|
$(eval $(call add-dependency,$(common_javalib.jar),$(full_classes_header_jar)))
|
|
|
|
endif
|
2019-01-21 19:59:42 +01:00
|
|
|
endif
|
2019-01-14 23:10:20 +01:00
|
|
|
endif
|
2018-10-22 14:08:34 +02:00
|
|
|
|
2019-01-14 23:10:20 +01:00
|
|
|
java-dex : $(LOCAL_BUILT_MODULE)
|
2018-07-03 16:59:48 +02:00
|
|
|
else # LOCAL_SOONG_DEX_JAR
|
2019-01-14 21:49:24 +01:00
|
|
|
ifndef LOCAL_UNINSTALLABLE_MODULE
|
|
|
|
ifndef LOCAL_IS_HOST_MODULE
|
|
|
|
$(call pretty-error,Installable device module must have LOCAL_SOONG_DEX_JAR set)
|
|
|
|
endif
|
|
|
|
endif
|
2018-07-03 16:59:48 +02:00
|
|
|
endif # LOCAL_SOONG_DEX_JAR
|
2017-09-12 22:41:20 +02:00
|
|
|
|
2019-05-27 12:48:21 +02:00
|
|
|
ALL_MODULES.$(my_register_name).CLASSES_JAR := $(full_classes_jar)
|
2018-11-17 06:26:33 +01:00
|
|
|
|
2018-10-30 07:17:02 +01:00
|
|
|
ifdef LOCAL_SOONG_AAR
|
2020-05-08 09:38:46 +02:00
|
|
|
ALL_MODULES.$(my_register_name).AAR := $(LOCAL_SOONG_AAR)
|
2018-10-30 07:17:02 +01:00
|
|
|
endif
|
|
|
|
|
2021-01-06 18:42:14 +01:00
|
|
|
# Copy dexpreopt.config files from Soong libraries to the location where Make
|
|
|
|
# modules can find them.
|
|
|
|
ifdef LOCAL_SOONG_DEXPREOPT_CONFIG
|
|
|
|
$(eval $(call copy-one-file,$(LOCAL_SOONG_DEXPREOPT_CONFIG), $(call local-intermediates-dir,)/dexpreopt.config))
|
2021-04-07 16:57:16 +02:00
|
|
|
my_dexpreopt_config := $(PRODUCT_OUT)/dexpreopt_config/$(LOCAL_MODULE)_dexpreopt.config
|
|
|
|
$(eval $(call copy-one-file,$(LOCAL_SOONG_DEXPREOPT_CONFIG), $(my_dexpreopt_config)))
|
|
|
|
$(LOCAL_BUILT_MODULE): $(my_dexpreopt_config)
|
2021-01-06 18:42:14 +01:00
|
|
|
endif
|
|
|
|
|
2021-03-17 10:01:50 +01:00
|
|
|
ifdef LOCAL_SOONG_CLASSES_JAR
|
2017-09-07 22:21:51 +02:00
|
|
|
javac-check : $(full_classes_jar)
|
|
|
|
javac-check-$(LOCAL_MODULE) : $(full_classes_jar)
|
2021-03-17 10:01:50 +01:00
|
|
|
endif
|
2018-07-24 10:21:12 +02:00
|
|
|
.PHONY: javac-check-$(LOCAL_MODULE)
|
2017-09-07 22:21:51 +02:00
|
|
|
|
2017-09-12 22:41:20 +02:00
|
|
|
ifndef LOCAL_IS_HOST_MODULE
|
|
|
|
ifeq ($(LOCAL_SDK_VERSION),system_current)
|
|
|
|
my_link_type := java:system
|
2017-10-16 12:20:34 +02:00
|
|
|
else ifneq (,$(call has-system-sdk-version,$(LOCAL_SDK_VERSION)))
|
|
|
|
my_link_type := java:system
|
2018-01-30 16:14:55 +01:00
|
|
|
else ifeq ($(LOCAL_SDK_VERSION),core_current)
|
|
|
|
my_link_type := java:core
|
2017-09-12 22:41:20 +02:00
|
|
|
else ifneq ($(LOCAL_SDK_VERSION),)
|
|
|
|
my_link_type := java:sdk
|
|
|
|
else
|
|
|
|
my_link_type := java:platform
|
|
|
|
endif
|
2018-03-08 07:16:12 +01:00
|
|
|
# warn/allowed types are both empty because Soong modules can't depend on
|
|
|
|
# make-defined modules.
|
|
|
|
my_warn_types :=
|
|
|
|
my_allowed_types :=
|
2017-09-12 22:41:20 +02:00
|
|
|
|
|
|
|
my_link_deps :=
|
|
|
|
my_2nd_arch_prefix := $(LOCAL_2ND_ARCH_VAR_PREFIX)
|
|
|
|
my_common := COMMON
|
|
|
|
include $(BUILD_SYSTEM)/link_type.mk
|
|
|
|
endif # !LOCAL_IS_HOST_MODULE
|
2018-05-22 08:39:59 +02:00
|
|
|
|
|
|
|
# LOCAL_EXPORT_SDK_LIBRARIES set by soong is written to exported-sdk-libs file
|
|
|
|
my_exported_sdk_libs_file := $(intermediates.COMMON)/exported-sdk-libs
|
|
|
|
$(my_exported_sdk_libs_file): PRIVATE_EXPORTED_SDK_LIBS := $(LOCAL_EXPORT_SDK_LIBRARIES)
|
|
|
|
$(my_exported_sdk_libs_file):
|
|
|
|
@echo "Export SDK libs $@"
|
|
|
|
$(hide) mkdir -p $(dir $@) && rm -f $@
|
|
|
|
$(if $(PRIVATE_EXPORTED_SDK_LIBS),\
|
|
|
|
$(hide) echo $(PRIVATE_EXPORTED_SDK_LIBS) | tr ' ' '\n' > $@,\
|
|
|
|
$(hide) touch $@)
|
2018-08-17 07:55:43 +02:00
|
|
|
|
2020-06-09 03:50:14 +02:00
|
|
|
SOONG_ALREADY_CONV += $(LOCAL_MODULE)
|