2017-09-07 22:21:51 +02:00
|
|
|
# Java prebuilt coming from Soong.
|
|
|
|
# Extra inputs:
|
|
|
|
# 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
|
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
|
|
|
|
|
|
|
|
#######################################
|
|
|
|
include $(BUILD_SYSTEM)/base_rules.mk
|
|
|
|
#######################################
|
|
|
|
|
|
|
|
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
|
2018-08-22 18:38:02 +02:00
|
|
|
hiddenapi_whitelist_txt := $(intermediates.COMMON)/hiddenapi/whitelist.txt
|
|
|
|
hiddenapi_greylist_txt := $(intermediates.COMMON)/hiddenapi/greylist.txt
|
2018-09-07 15:14:36 +02:00
|
|
|
hiddenapi_darkgreylist_txt := $(intermediates.COMMON)/hiddenapi/darkgreylist.txt
|
2018-10-05 15:01:17 +02:00
|
|
|
hiddenapi_greylist_metadata_csv := $(intermediates.COMMON)/hiddenapi/greylist.csv
|
2017-09-07 22:21:51 +02:00
|
|
|
|
2017-11-23 01:04:55 +01:00
|
|
|
$(eval $(call copy-one-file,$(LOCAL_PREBUILT_MODULE_FILE),$(full_classes_jar)))
|
2017-11-30 05:44:11 +01:00
|
|
|
$(eval $(call copy-one-file,$(LOCAL_PREBUILT_MODULE_FILE),$(full_classes_pre_proguard_jar)))
|
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),\
|
|
|
|
$(intermediates.COMMON)/jacoco-report-classes.jar))
|
2017-12-07 01:09:49 +01:00
|
|
|
$(call add-dependency,$(common_javalib.jar),\
|
|
|
|
$(intermediates.COMMON)/jacoco-report-classes.jar)
|
2017-11-23 01:04:55 +01:00
|
|
|
endif
|
2017-09-07 22:21:51 +02:00
|
|
|
|
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))
|
|
|
|
|
|
|
|
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 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
|
|
|
|
|
2018-03-05 22:35:45 +01:00
|
|
|
ifneq ($(TURBINE_ENABLED),false)
|
2017-09-07 22:21:51 +02:00
|
|
|
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
|
2018-03-05 22:35:45 +01:00
|
|
|
endif # TURBINE_ENABLED != false
|
2017-09-07 22:21:51 +02:00
|
|
|
|
2017-09-12 22:41:20 +02:00
|
|
|
ifdef LOCAL_SOONG_DEX_JAR
|
2018-07-03 16:59:48 +02:00
|
|
|
ifneq ($(LOCAL_UNINSTALLABLE_MODULE),true)
|
|
|
|
ifndef LOCAL_IS_HOST_MODULE
|
|
|
|
ifneq ($(filter $(LOCAL_MODULE),$(PRODUCT_BOOT_JARS)),) # is_boot_jar
|
2018-07-11 16:14:00 +02:00
|
|
|
# Derive greylist from classes.jar.
|
|
|
|
# We use full_classes_jar here, which is the post-proguard jar (on the basis that we also
|
|
|
|
# have a full_classes_pre_proguard_jar). This is consistent with the equivalent code in
|
|
|
|
# java.mk.
|
2018-10-05 15:01:17 +02:00
|
|
|
$(eval $(call hiddenapi-generate-greylist-txt,$(full_classes_jar),$(hiddenapi_whitelist_txt),$(hiddenapi_greylist_txt),$(hiddenapi_darkgreylist_txt),$(hiddenapi_greylist_metadata_csv)))
|
2018-07-03 16:59:48 +02:00
|
|
|
$(eval $(call hiddenapi-copy-soong-jar,$(LOCAL_SOONG_DEX_JAR),$(common_javalib.jar)))
|
|
|
|
else # !is_boot_jar
|
|
|
|
$(eval $(call copy-one-file,$(LOCAL_SOONG_DEX_JAR),$(common_javalib.jar)))
|
|
|
|
endif # is_boot_jar
|
|
|
|
$(eval $(call add-dependency,$(common_javalib.jar),$(full_classes_jar) $(full_classes_header_jar)))
|
|
|
|
|
|
|
|
dex_preopt_profile_src_file := $(common_javalib.jar)
|
|
|
|
|
|
|
|
# defines built_odex along with rule to install odex
|
|
|
|
include $(BUILD_SYSTEM)/dex_preopt_odex_install.mk
|
|
|
|
|
|
|
|
dex_preopt_profile_src_file :=
|
|
|
|
|
|
|
|
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
|
|
|
|
$(eval $(call copy-one-file,$(dexpreopted_boot_jar),$(LOCAL_BUILT_MODULE)))
|
|
|
|
|
|
|
|
# For libart boot jars, we don't have .odex files.
|
|
|
|
else # ! boot jar
|
|
|
|
$(built_odex): PRIVATE_MODULE := $(LOCAL_MODULE)
|
|
|
|
# Use pattern rule - we may have multiple built odex files.
|
2017-10-06 01:01:00 +02:00
|
|
|
$(built_odex) : $(dir $(LOCAL_BUILT_MODULE))% : $(common_javalib.jar)
|
|
|
|
@echo "Dexpreopt Jar: $(PRIVATE_MODULE) ($@)"
|
|
|
|
$(call dexpreopt-one-file,$<,$@)
|
|
|
|
|
2018-10-22 22:44:27 +02:00
|
|
|
$(eval $(call dexpreopt-copy-jar,$(common_javalib.jar),$(LOCAL_BUILT_MODULE),$(LOCAL_STRIP_DEX)))
|
2018-07-03 16:59:48 +02:00
|
|
|
endif # ! boot jar
|
|
|
|
else # LOCAL_DEX_PREOPT
|
|
|
|
$(eval $(call copy-one-file,$(common_javalib.jar),$(LOCAL_BUILT_MODULE)))
|
|
|
|
endif # LOCAL_DEX_PREOPT
|
|
|
|
else # LOCAL_IS_HOST_MODULE
|
|
|
|
$(eval $(call copy-one-file,$(LOCAL_SOONG_DEX_JAR),$(LOCAL_BUILT_MODULE)))
|
|
|
|
$(eval $(call add-dependency,$(LOCAL_BUILT_MODULE),$(full_classes_jar) $(full_classes_header_jar)))
|
|
|
|
endif
|
|
|
|
|
|
|
|
java-dex : $(LOCAL_BUILT_MODULE)
|
|
|
|
else # LOCAL_UNINSTALLABLE_MODULE
|
2018-10-22 14:08:34 +02:00
|
|
|
|
|
|
|
ifneq ($(filter $(LOCAL_MODULE),$(HIDDENAPI_EXTRA_APP_USAGE_JARS)),)
|
|
|
|
# Derive greylist from classes.jar.
|
|
|
|
# We use full_classes_jar here, which is the post-proguard jar (on the basis that we also
|
|
|
|
# have a full_classes_pre_proguard_jar). This is consistent with the equivalent code in
|
|
|
|
# java.mk.
|
|
|
|
$(eval $(call hiddenapi-generate-greylist-txt,$(full_classes_jar),$(hiddenapi_whitelist_txt),$(hiddenapi_greylist_txt),$(hiddenapi_darkgreylist_txt),$(hiddenapi_greylist_metadata_csv)))
|
|
|
|
endif
|
|
|
|
|
2018-07-03 16:59:48 +02:00
|
|
|
$(eval $(call copy-one-file,$(full_classes_jar),$(LOCAL_BUILT_MODULE)))
|
|
|
|
$(eval $(call copy-one-file,$(LOCAL_SOONG_DEX_JAR),$(common_javalib.jar)))
|
|
|
|
java-dex : $(common_javalib.jar)
|
|
|
|
endif # LOCAL_UNINSTALLABLE_MODULE
|
|
|
|
else # LOCAL_SOONG_DEX_JAR
|
2017-10-06 01:01:00 +02:00
|
|
|
$(eval $(call copy-one-file,$(full_classes_jar),$(LOCAL_BUILT_MODULE)))
|
2018-07-03 16:59:48 +02:00
|
|
|
endif # LOCAL_SOONG_DEX_JAR
|
2017-09-12 22:41:20 +02:00
|
|
|
|
2018-10-30 07:17:02 +01:00
|
|
|
ifdef LOCAL_SOONG_AAR
|
|
|
|
ALL_MODULES.$(LOCAL_MODULE).AAR := $(LOCAL_SOONG_AAR)
|
|
|
|
endif
|
|
|
|
|
2017-09-07 22:21:51 +02:00
|
|
|
javac-check : $(full_classes_jar)
|
|
|
|
javac-check-$(LOCAL_MODULE) : $(full_classes_jar)
|
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
|
|
|
|
|
|
|
SOONG_ALREADY_CONV := $(SOONG_ALREADY_CONV) $(LOCAL_MODULE)
|