2017-09-08 04:21:51 +08:00
|
|
|
# Java prebuilt coming from Soong.
|
|
|
|
# Extra inputs:
|
2018-11-17 13:26:33 +08:00
|
|
|
# LOCAL_SOONG_BUILT_INSTALLED
|
|
|
|
# LOCAL_SOONG_CLASSES_JAR
|
2017-09-08 04:21:51 +08:00
|
|
|
# LOCAL_SOONG_HEADER_JAR
|
2017-09-13 04:41:20 +08:00
|
|
|
# LOCAL_SOONG_DEX_JAR
|
2017-11-23 08:04:55 +08:00
|
|
|
# LOCAL_SOONG_JACOCO_REPORT_CLASSES_JAR
|
2017-09-08 04:21:51 +08: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
|
|
|
|
|
|
|
|
#######################################
|
|
|
|
include $(BUILD_SYSTEM)/base_rules.mk
|
|
|
|
#######################################
|
|
|
|
|
|
|
|
full_classes_jar := $(intermediates.COMMON)/classes.jar
|
2017-11-30 12:44:11 +08:00
|
|
|
full_classes_pre_proguard_jar := $(intermediates.COMMON)/classes-pre-proguard.jar
|
2017-09-08 04:21:51 +08:00
|
|
|
full_classes_header_jar := $(intermediates.COMMON)/classes-header.jar
|
2017-09-13 04:41:20 +08:00
|
|
|
common_javalib.jar := $(intermediates.COMMON)/javalib.jar
|
2018-10-31 02:24:06 +08:00
|
|
|
hiddenapi_flags_csv := $(intermediates.COMMON)/hiddenapi/flags.csv
|
|
|
|
hiddenapi_metadata_csv := $(intermediates.COMMON)/hiddenapi/greylist.csv
|
2017-09-08 04:21:51 +08:00
|
|
|
|
2019-01-15 06:10:20 +08: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-08 04:21:51 +08:00
|
|
|
|
2017-11-23 08:04:55 +08:00
|
|
|
ifdef LOCAL_SOONG_JACOCO_REPORT_CLASSES_JAR
|
|
|
|
$(eval $(call copy-one-file,$(LOCAL_SOONG_JACOCO_REPORT_CLASSES_JAR),\
|
|
|
|
$(intermediates.COMMON)/jacoco-report-classes.jar))
|
2017-12-07 08:09:49 +08:00
|
|
|
$(call add-dependency,$(common_javalib.jar),\
|
|
|
|
$(intermediates.COMMON)/jacoco-report-classes.jar)
|
2017-11-23 08:04:55 +08:00
|
|
|
endif
|
2017-09-08 04:21:51 +08:00
|
|
|
|
2018-02-21 09:21:36 +08:00
|
|
|
ifdef LOCAL_SOONG_RESOURCE_EXPORT_PACKAGE
|
2018-05-01 06:59:16 +08:00
|
|
|
my_res_package := $(intermediates.COMMON)/package-res.apk
|
2018-02-21 09:21:36 +08:00
|
|
|
|
2018-05-01 06:59:16 +08:00
|
|
|
$(my_res_package): $(LOCAL_SOONG_RESOURCE_EXPORT_PACKAGE)
|
2018-04-20 05:19:52 +08:00
|
|
|
@echo "Copy: $@"
|
2018-02-21 09:21:36 +08:00
|
|
|
$(copy-file-to-target)
|
|
|
|
|
2018-05-01 06:59:16 +08:00
|
|
|
$(call add-dependency,$(LOCAL_BUILT_MODULE),$(my_res_package))
|
|
|
|
|
|
|
|
my_proguard_flags := $(intermediates.COMMON)/export_proguard_flags
|
|
|
|
$(my_proguard_flags): $(LOCAL_SOONG_EXPORT_PROGUARD_FLAGS)
|
|
|
|
@echo "Export proguard flags: $@"
|
|
|
|
rm -f $@
|
|
|
|
touch $@
|
|
|
|
for f in $+; do \
|
|
|
|
echo -e "\n# including $$f" >>$@; \
|
|
|
|
cat $$f >>$@; \
|
|
|
|
done
|
|
|
|
|
|
|
|
$(call add-dependency,$(LOCAL_BUILT_MODULE),$(my_proguard_flags))
|
2018-02-21 09:21:36 +08:00
|
|
|
|
2018-05-03 03:52:43 +08: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 07:44:07 +08: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 09:21:36 +08:00
|
|
|
endif # LOCAL_SOONG_RESOURCE_EXPORT_PACKAGE
|
|
|
|
|
2019-01-15 19:46:32 +08:00
|
|
|
|
2017-09-13 04:41:20 +08:00
|
|
|
ifdef LOCAL_SOONG_DEX_JAR
|
2019-01-15 19:46:32 +08:00
|
|
|
ifndef LOCAL_IS_HOST_MODULE
|
|
|
|
ifneq ($(filter $(LOCAL_MODULE),$(PRODUCT_BOOT_JARS)),) # is_boot_jar
|
2019-01-15 06:10:20 +08:00
|
|
|
ifeq (true,$(WITH_DEXPREOPT))
|
|
|
|
# For libart, the boot jars' odex files are replaced by $(DEFAULT_DEX_PREOPT_INSTALLED_IMAGE).
|
|
|
|
# We use this installed_odex trick to get boot.art installed.
|
|
|
|
installed_odex := $(DEFAULT_DEX_PREOPT_INSTALLED_IMAGE)
|
|
|
|
# Append the odex for the 2nd arch if we have one.
|
|
|
|
installed_odex += $($(TARGET_2ND_ARCH_VAR_PREFIX)DEFAULT_DEX_PREOPT_INSTALLED_IMAGE)
|
|
|
|
ALL_MODULES.$(my_register_name).INSTALLED += $(installed_odex)
|
|
|
|
# Make sure to install the .odex and .vdex when you run "make <module_name>"
|
|
|
|
$(my_all_targets): $(installed_odex)
|
|
|
|
endif
|
|
|
|
endif # is_boot_jar
|
|
|
|
|
2019-01-17 07:13:48 +08:00
|
|
|
$(eval $(call copy-one-file,$(LOCAL_SOONG_DEX_JAR),$(common_javalib.jar)))
|
2019-01-15 06:10:20 +08:00
|
|
|
$(eval $(call add-dependency,$(LOCAL_BUILT_MODULE),$(common_javalib.jar)))
|
|
|
|
$(eval $(call add-dependency,$(common_javalib.jar),$(full_classes_jar) $(full_classes_header_jar)))
|
|
|
|
endif
|
2018-10-22 20:08:34 +08:00
|
|
|
|
2019-01-15 06:10:20 +08:00
|
|
|
java-dex : $(LOCAL_BUILT_MODULE)
|
2018-07-03 22:59:48 +08:00
|
|
|
else # LOCAL_SOONG_DEX_JAR
|
2019-01-15 04:49:24 +08: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 22:59:48 +08:00
|
|
|
endif # LOCAL_SOONG_DEX_JAR
|
2017-09-13 04:41:20 +08:00
|
|
|
|
2018-11-17 13:26:33 +08:00
|
|
|
my_built_installed := $(foreach f,$(LOCAL_SOONG_BUILT_INSTALLED),\
|
|
|
|
$(call word-colon,1,$(f)):$(PRODUCT_OUT)$(call word-colon,2,$(f)))
|
|
|
|
my_installed := $(call copy-many-files, $(my_built_installed))
|
|
|
|
ALL_MODULES.$(my_register_name).INSTALLED += $(my_installed)
|
|
|
|
ALL_MODULES.$(my_register_name).BUILT_INSTALLED += $(my_built_installed)
|
|
|
|
$(my_register_name): $(my_installed)
|
|
|
|
|
2018-10-30 14:17:02 +08:00
|
|
|
ifdef LOCAL_SOONG_AAR
|
|
|
|
ALL_MODULES.$(LOCAL_MODULE).AAR := $(LOCAL_SOONG_AAR)
|
|
|
|
endif
|
|
|
|
|
2017-09-08 04:21:51 +08:00
|
|
|
javac-check : $(full_classes_jar)
|
|
|
|
javac-check-$(LOCAL_MODULE) : $(full_classes_jar)
|
2018-07-24 16:21:12 +08:00
|
|
|
.PHONY: javac-check-$(LOCAL_MODULE)
|
2017-09-08 04:21:51 +08:00
|
|
|
|
2017-09-13 04:41:20 +08:00
|
|
|
ifndef LOCAL_IS_HOST_MODULE
|
|
|
|
ifeq ($(LOCAL_SDK_VERSION),system_current)
|
|
|
|
my_link_type := java:system
|
2017-10-16 18:20:34 +08:00
|
|
|
else ifneq (,$(call has-system-sdk-version,$(LOCAL_SDK_VERSION)))
|
|
|
|
my_link_type := java:system
|
2018-01-30 23:14:55 +08:00
|
|
|
else ifeq ($(LOCAL_SDK_VERSION),core_current)
|
|
|
|
my_link_type := java:core
|
2017-09-13 04:41:20 +08:00
|
|
|
else ifneq ($(LOCAL_SDK_VERSION),)
|
|
|
|
my_link_type := java:sdk
|
|
|
|
else
|
|
|
|
my_link_type := java:platform
|
|
|
|
endif
|
2018-03-08 14:16:12 +08: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-13 04:41:20 +08: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 14:39:59 +08: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 13:55:43 +08:00
|
|
|
|
|
|
|
SOONG_ALREADY_CONV := $(SOONG_ALREADY_CONV) $(LOCAL_MODULE)
|