1 # Java prebuilt coming from Soong. 2 # Extra inputs: 3 # LOCAL_SOONG_HEADER_JAR 4 # LOCAL_SOONG_DEX_JAR 5 # LOCAL_SOONG_JACOCO_REPORT_CLASSES_JAR 6 7 ifneq ($(LOCAL_MODULE_MAKEFILE),$(SOONG_ANDROID_MK)) 8 $(call pretty-error,soong_java_prebuilt.mk may only be used from Soong) 9 endif 10 11 LOCAL_MODULE_SUFFIX := .jar 12 LOCAL_BUILT_MODULE_STEM := javalib.jar 13 14 ####################################### 15 include $(BUILD_SYSTEM)/base_rules.mk 16 ####################################### 17 18 full_classes_jar := $(intermediates.COMMON)/classes.jar 19 full_classes_pre_proguard_jar := $(intermediates.COMMON)/classes-pre-proguard.jar 20 full_classes_header_jar := $(intermediates.COMMON)/classes-header.jar 21 common_javalib.jar := $(intermediates.COMMON)/javalib.jar 22 23 $(eval $(call copy-one-file,$(LOCAL_PREBUILT_MODULE_FILE),$(full_classes_jar))) 24 $(eval $(call copy-one-file,$(LOCAL_PREBUILT_MODULE_FILE),$(full_classes_pre_proguard_jar))) 25 26 ifdef LOCAL_DROIDDOC_STUBS_JAR 27 $(eval $(call copy-one-file,$(LOCAL_DROIDDOC_STUBS_JAR),$(OUT_DOCS)/$(LOCAL_MODULE)-stubs.srcjar)) 28 ALL_DOCS += $(OUT_DOCS)/$(LOCAL_MODULE)-stubs.srcjar 29 endif 30 31 ifdef LOCAL_DROIDDOC_DOC_ZIP 32 $(eval $(call copy-one-file,$(LOCAL_DROIDDOC_DOC_ZIP),$(OUT_DOCS)/$(LOCAL_MODULE)-docs.zip)) 33 endif 34 35 ifdef LOCAL_SOONG_JACOCO_REPORT_CLASSES_JAR 36 $(eval $(call copy-one-file,$(LOCAL_SOONG_JACOCO_REPORT_CLASSES_JAR),\ 37 $(intermediates.COMMON)/jacoco-report-classes.jar)) 38 $(call add-dependency,$(common_javalib.jar),\ 39 $(intermediates.COMMON)/jacoco-report-classes.jar) 40 endif 41 42 ifdef LOCAL_SOONG_RESOURCE_EXPORT_PACKAGE 43 my_res_package := $(intermediates.COMMON)/package-res.apk 44 45 $(my_res_package): $(LOCAL_SOONG_RESOURCE_EXPORT_PACKAGE) 46 @echo "Copy: $@" 47 $(copy-file-to-target) 48 49 $(call add-dependency,$(LOCAL_BUILT_MODULE),$(my_res_package)) 50 51 my_proguard_flags := $(intermediates.COMMON)/export_proguard_flags 52 $(my_proguard_flags): $(LOCAL_SOONG_EXPORT_PROGUARD_FLAGS) 53 @echo "Export proguard flags: $@" 54 rm -f $@ 55 touch $@ 56 for f in $+; do \ 57 echo -e "\n# including $$f" >>$@; \ 58 cat $$f >>$@; \ 59 done 60 61 $(call add-dependency,$(LOCAL_BUILT_MODULE),$(my_proguard_flags)) 62 63 my_static_library_extra_packages := $(intermediates.COMMON)/extra_packages 64 $(eval $(call copy-one-file,$(LOCAL_SOONG_STATIC_LIBRARY_EXTRA_PACKAGES),$(my_static_library_extra_packages))) 65 $(call add-dependency,$(LOCAL_BUILT_MODULE),$(my_static_library_extra_packages)) 66 endif # LOCAL_SOONG_RESOURCE_EXPORT_PACKAGE 67 68 ifneq ($(TURBINE_ENABLED),false) 69 ifdef LOCAL_SOONG_HEADER_JAR 70 $(eval $(call copy-one-file,$(LOCAL_SOONG_HEADER_JAR),$(full_classes_header_jar))) 71 else 72 $(eval $(call copy-one-file,$(full_classes_jar),$(full_classes_header_jar))) 73 endif 74 endif # TURBINE_ENABLED != false 75 76 ifdef LOCAL_SOONG_DEX_JAR 77 ifndef LOCAL_IS_HOST_MODULE 78 ifneq ($(filter $(LOCAL_MODULE),$(PRODUCT_BOOT_JARS)),) # is_boot_jar 79 $(eval $(call hiddenapi-copy-soong-jar,$(LOCAL_SOONG_DEX_JAR),$(common_javalib.jar))) 80 else # !is_boot_jar 81 $(eval $(call copy-one-file,$(LOCAL_SOONG_DEX_JAR),$(common_javalib.jar))) 82 endif # is_boot_jar 83 $(eval $(call add-dependency,$(common_javalib.jar),$(full_classes_jar) $(full_classes_header_jar))) 84 85 dex_preopt_profile_src_file := $(common_javalib.jar) 86 87 # defines built_odex along with rule to install odex 88 include $(BUILD_SYSTEM)/dex_preopt_odex_install.mk 89 90 dex_preopt_profile_src_file := 91 92 ifdef LOCAL_DEX_PREOPT 93 ifneq ($(dexpreopt_boot_jar_module),) # boot jar 94 # boot jar's rules are defined in dex_preopt.mk 95 dexpreopted_boot_jar := $(DEXPREOPT_BOOT_JAR_DIR_FULL_PATH)/$(dexpreopt_boot_jar_module)_nodex.jar 96 $(eval $(call copy-one-file,$(dexpreopted_boot_jar),$(LOCAL_BUILT_MODULE))) 97 98 # For libart boot jars, we don't have .odex files. 99 else # ! boot jar 100 $(built_odex): PRIVATE_MODULE := $(LOCAL_MODULE) 101 # Use pattern rule - we may have multiple built odex files. 102 $(built_odex) : $(dir $(LOCAL_BUILT_MODULE))% : $(common_javalib.jar) 103 @echo "Dexpreopt Jar: $(PRIVATE_MODULE) ($@)" 104 $(call dexpreopt-one-file,$<,$@) 105 106 $(eval $(call dexpreopt-copy-jar,$(common_javalib.jar),$(LOCAL_BUILT_MODULE),$(LOCAL_DEX_PREOPT))) 107 endif # ! boot jar 108 else # LOCAL_DEX_PREOPT 109 $(eval $(call copy-one-file,$(common_javalib.jar),$(LOCAL_BUILT_MODULE))) 110 endif # LOCAL_DEX_PREOPT 111 else # LOCAL_IS_HOST_MODULE 112 $(eval $(call copy-one-file,$(LOCAL_SOONG_DEX_JAR),$(LOCAL_BUILT_MODULE))) 113 $(eval $(call add-dependency,$(LOCAL_BUILT_MODULE),$(full_classes_jar) $(full_classes_header_jar))) 114 endif 115 116 java-dex : $(LOCAL_BUILT_MODULE) 117 else 118 $(eval $(call copy-one-file,$(full_classes_jar),$(LOCAL_BUILT_MODULE))) 119 endif 120 121 javac-check : $(full_classes_jar) 122 javac-check-$(LOCAL_MODULE) : $(full_classes_jar) 123 124 ifndef LOCAL_IS_HOST_MODULE 125 ifeq ($(LOCAL_SDK_VERSION),system_current) 126 my_link_type := java:system 127 else ifneq (,$(call has-system-sdk-version,$(LOCAL_SDK_VERSION))) 128 my_link_type := java:system 129 else ifeq ($(LOCAL_SDK_VERSION),core_current) 130 my_link_type := java:core 131 else ifneq ($(LOCAL_SDK_VERSION),) 132 my_link_type := java:sdk 133 else 134 my_link_type := java:platform 135 endif 136 # warn/allowed types are both empty because Soong modules can't depend on 137 # make-defined modules. 138 my_warn_types := 139 my_allowed_types := 140 141 my_link_deps := 142 my_2nd_arch_prefix := $(LOCAL_2ND_ARCH_VAR_PREFIX) 143 my_common := COMMON 144 include $(BUILD_SYSTEM)/link_type.mk 145 endif # !LOCAL_IS_HOST_MODULE 146