Ying Wang | 956dccc | 2015-08-28 11:47:03 -0700 | [diff] [blame] | 1 | # Common to host and target Java modules. |
| 2 | |
| 3 | ########################################################### |
| 4 | ## .proto files: Compile proto files to .java |
| 5 | ########################################################### |
| 6 | proto_sources := $(filter %.proto,$(LOCAL_SRC_FILES)) |
| 7 | # Because names of the .java files compiled from .proto files are unknown until the |
| 8 | # .proto files are compiled, we use a timestamp file as depedency. |
| 9 | proto_java_sources_file_stamp := |
| 10 | ifneq ($(proto_sources),) |
| 11 | proto_sources_fullpath := $(addprefix $(LOCAL_PATH)/, $(proto_sources)) |
| 12 | |
| 13 | # By putting the generated java files into $(LOCAL_INTERMEDIATE_SOURCE_DIR), they will be |
| 14 | # automatically found by the java compiling function transform-java-to-classes.jar. |
| 15 | proto_java_intemediate_dir := $(LOCAL_INTERMEDIATE_SOURCE_DIR)/proto |
| 16 | proto_java_sources_file_stamp := $(proto_java_intemediate_dir)/Proto.stamp |
| 17 | proto_java_sources_dir := $(proto_java_intemediate_dir)/src |
| 18 | |
| 19 | $(proto_java_sources_file_stamp): PRIVATE_PROTO_INCLUDES := $(TOP) |
| 20 | $(proto_java_sources_file_stamp): PRIVATE_PROTO_SRC_FILES := $(proto_sources_fullpath) |
| 21 | $(proto_java_sources_file_stamp): PRIVATE_PROTO_JAVA_OUTPUT_DIR := $(proto_java_sources_dir) |
| 22 | ifeq ($(LOCAL_PROTOC_OPTIMIZE_TYPE),micro) |
| 23 | $(proto_java_sources_file_stamp): PRIVATE_PROTO_JAVA_OUTPUT_OPTION := --javamicro_out |
| 24 | else |
| 25 | ifeq ($(LOCAL_PROTOC_OPTIMIZE_TYPE),nano) |
| 26 | $(proto_java_sources_file_stamp): PRIVATE_PROTO_JAVA_OUTPUT_OPTION := --javanano_out |
| 27 | else |
| 28 | $(proto_java_sources_file_stamp): PRIVATE_PROTO_JAVA_OUTPUT_OPTION := --java_out |
| 29 | endif |
| 30 | endif |
| 31 | $(proto_java_sources_file_stamp): PRIVATE_PROTOC_FLAGS := $(LOCAL_PROTOC_FLAGS) |
| 32 | $(proto_java_sources_file_stamp): PRIVATE_PROTO_JAVA_OUTPUT_PARAMS := $(LOCAL_PROTO_JAVA_OUTPUT_PARAMS) |
| 33 | $(proto_java_sources_file_stamp) : $(proto_sources_fullpath) $(PROTOC) |
| 34 | $(call transform-proto-to-java) |
| 35 | |
| 36 | #TODO: protoc should output the dependencies introduced by imports. |
| 37 | endif # proto_sources |
| 38 | |
| 39 | ######################################### |
| 40 | ## Java resources |
| 41 | |
| 42 | # Look for resource files in any specified directories. |
| 43 | # Non-java and non-doc files will be picked up as resources |
| 44 | # and included in the output jar file. |
| 45 | java_resource_file_groups := |
| 46 | |
| 47 | LOCAL_JAVA_RESOURCE_DIRS := $(strip $(LOCAL_JAVA_RESOURCE_DIRS)) |
| 48 | ifneq ($(LOCAL_JAVA_RESOURCE_DIRS),) |
| 49 | # This makes a list of words like |
| 50 | # <dir1>::<file1>:<file2> <dir2>::<file1> <dir3>: |
| 51 | # where each of the files is relative to the directory it's grouped with. |
| 52 | # Directories that don't contain any resource files will result in groups |
| 53 | # that end with a colon, and they are stripped out in the next step. |
| 54 | java_resource_file_groups += \ |
| 55 | $(foreach dir,$(LOCAL_JAVA_RESOURCE_DIRS), \ |
| 56 | $(subst $(space),:,$(strip \ |
| 57 | $(LOCAL_PATH)/$(dir): \ |
Dan Willemsen | 7c3e3f8 | 2015-09-29 16:30:21 -0700 | [diff] [blame] | 58 | $(patsubst ./%,%,$(sort $(shell cd $(LOCAL_PATH)/$(dir) && \ |
Ying Wang | 956dccc | 2015-08-28 11:47:03 -0700 | [diff] [blame] | 59 | find . \ |
| 60 | -type d -a -name ".svn" -prune -o \ |
| 61 | -type f \ |
| 62 | -a \! -name "*.java" \ |
| 63 | -a \! -name "package.html" \ |
| 64 | -a \! -name "overview.html" \ |
| 65 | -a \! -name ".*.swp" \ |
| 66 | -a \! -name ".DS_Store" \ |
| 67 | -a \! -name "*~" \ |
| 68 | -print \ |
Dan Willemsen | 7c3e3f8 | 2015-09-29 16:30:21 -0700 | [diff] [blame] | 69 | ))) \ |
Ying Wang | 956dccc | 2015-08-28 11:47:03 -0700 | [diff] [blame] | 70 | )) \ |
| 71 | ) |
| 72 | java_resource_file_groups := $(filter-out %:,$(java_resource_file_groups)) |
| 73 | endif # LOCAL_JAVA_RESOURCE_DIRS |
| 74 | |
| 75 | LOCAL_JAVA_RESOURCE_FILES := $(strip $(LOCAL_JAVA_RESOURCE_FILES)) |
| 76 | ifneq ($(LOCAL_JAVA_RESOURCE_FILES),) |
| 77 | java_resource_file_groups += \ |
| 78 | $(foreach f,$(LOCAL_JAVA_RESOURCE_FILES), \ |
| 79 | $(patsubst %/,%,$(dir $(f)))::$(notdir $(f)) \ |
| 80 | ) |
| 81 | endif # LOCAL_JAVA_RESOURCE_FILES |
| 82 | |
| 83 | ifdef java_resource_file_groups |
| 84 | # The full paths to all resources, used for dependencies. |
| 85 | java_resource_sources := \ |
| 86 | $(foreach group,$(java_resource_file_groups), \ |
| 87 | $(addprefix $(word 1,$(subst :,$(space),$(group)))/, \ |
| 88 | $(wordlist 2,9999,$(subst :,$(space),$(group))) \ |
| 89 | ) \ |
| 90 | ) |
| 91 | # The arguments to jar that will include these files in a jar file. |
| 92 | # Quote the file name to handle special characters (such as #) correctly. |
| 93 | extra_jar_args := \ |
| 94 | $(foreach group,$(java_resource_file_groups), \ |
| 95 | $(addprefix -C "$(word 1,$(subst :,$(space),$(group)))" , \ |
| 96 | $(foreach w, $(wordlist 2,9999,$(subst :,$(space),$(group))), "$(w)" ) \ |
| 97 | ) \ |
| 98 | ) |
| 99 | java_resource_file_groups := |
| 100 | else |
| 101 | java_resource_sources := |
| 102 | extra_jar_args := |
| 103 | endif # java_resource_file_groups |
| 104 | |
| 105 | ###################################### |
| 106 | ## PRIVATE java vars |
| 107 | # LOCAL_SOURCE_FILES_ALL_GENERATED is set only if the module does not have static source files, |
| 108 | # but generated source files in its LOCAL_INTERMEDIATE_SOURCE_DIR. |
| 109 | # You have to set up the dependency in some other way. |
| 110 | need_compile_java := $(strip $(all_java_sources)$(all_res_assets)$(java_resource_sources))$(LOCAL_STATIC_JAVA_LIBRARIES)$(filter true,$(LOCAL_SOURCE_FILES_ALL_GENERATED)) |
| 111 | ifdef need_compile_java |
| 112 | |
| 113 | full_static_java_libs := \ |
| 114 | $(foreach lib,$(LOCAL_STATIC_JAVA_LIBRARIES), \ |
| 115 | $(call intermediates-dir-for, \ |
| 116 | JAVA_LIBRARIES,$(lib),$(LOCAL_IS_HOST_MODULE),COMMON)/javalib.jar) |
| 117 | |
| 118 | $(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_STATIC_JAVA_LIBRARIES := $(full_static_java_libs) |
| 119 | |
| 120 | $(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_RESOURCE_DIR := $(LOCAL_RESOURCE_DIR) |
| 121 | $(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_ASSET_DIR := $(LOCAL_ASSET_DIR) |
| 122 | |
| 123 | $(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_CLASS_INTERMEDIATES_DIR := $(intermediates.COMMON)/classes |
| 124 | $(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_SOURCE_INTERMEDIATES_DIR := $(intermediates.COMMON)/src |
| 125 | $(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_JAVA_SOURCES := $(all_java_sources) |
| 126 | |
| 127 | $(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_RMTYPEDEFS := $(LOCAL_RMTYPEDEFS) |
| 128 | |
| 129 | # full_java_libs: The list of files that should be used as the classpath. |
| 130 | # Using this list as a dependency list WILL NOT WORK. |
| 131 | # full_java_lib_deps: Should be specified as a prerequisite of this module |
| 132 | # to guarantee that the files in full_java_libs will |
| 133 | # be up-to-date. |
| 134 | ifndef LOCAL_IS_HOST_MODULE |
| 135 | ifeq ($(LOCAL_SDK_VERSION),) |
Ying Wang | 4f2f195 | 2015-11-23 14:57:26 -0800 | [diff] [blame] | 136 | ifeq ($(LOCAL_NO_STANDARD_LIBRARIES),true) |
| 137 | # No bootclasspath. But we still need "" to prevent javac from using default host bootclasspath. |
| 138 | my_bootclasspath := "" |
| 139 | else # LOCAL_NO_STANDARD_LIBRARIES |
| 140 | my_bootclasspath := $(call java-lib-files,core-libart) |
| 141 | endif # LOCAL_NO_STANDARD_LIBRARIES |
Ying Wang | 956dccc | 2015-08-28 11:47:03 -0700 | [diff] [blame] | 142 | else |
| 143 | ifeq ($(LOCAL_SDK_VERSION)$(TARGET_BUILD_APPS),current) |
| 144 | # LOCAL_SDK_VERSION is current and no TARGET_BUILD_APPS. |
Ying Wang | 4f2f195 | 2015-11-23 14:57:26 -0800 | [diff] [blame] | 145 | my_bootclasspath := $(call java-lib-files,android_stubs_current) |
Ying Wang | 956dccc | 2015-08-28 11:47:03 -0700 | [diff] [blame] | 146 | else ifeq ($(LOCAL_SDK_VERSION)$(TARGET_BUILD_APPS),system_current) |
Ying Wang | 4f2f195 | 2015-11-23 14:57:26 -0800 | [diff] [blame] | 147 | my_bootclasspath := $(call java-lib-files,android_system_stubs_current) |
Ying Wang | 956dccc | 2015-08-28 11:47:03 -0700 | [diff] [blame] | 148 | else |
Ying Wang | 4f2f195 | 2015-11-23 14:57:26 -0800 | [diff] [blame] | 149 | my_bootclasspath := $(call java-lib-files,sdk_v$(LOCAL_SDK_VERSION)) |
Ying Wang | 956dccc | 2015-08-28 11:47:03 -0700 | [diff] [blame] | 150 | endif # current or system_current |
| 151 | endif # LOCAL_SDK_VERSION |
Ying Wang | 4f2f195 | 2015-11-23 14:57:26 -0800 | [diff] [blame] | 152 | $(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_BOOTCLASSPATH := -bootclasspath $(my_bootclasspath) |
Ying Wang | 956dccc | 2015-08-28 11:47:03 -0700 | [diff] [blame] | 153 | |
| 154 | full_shared_java_libs := $(call java-lib-files,$(LOCAL_JAVA_LIBRARIES),$(LOCAL_IS_HOST_MODULE)) |
| 155 | full_java_lib_deps := $(call java-lib-deps,$(LOCAL_JAVA_LIBRARIES),$(LOCAL_IS_HOST_MODULE)) |
Shinichiro Hamaji | 89b255a | 2015-11-09 16:47:42 +0900 | [diff] [blame] | 156 | full_java_lib_deps := $(addsuffix .toc, $(full_java_lib_deps)) |
Ying Wang | 956dccc | 2015-08-28 11:47:03 -0700 | [diff] [blame] | 157 | |
| 158 | else # LOCAL_IS_HOST_MODULE |
| 159 | |
| 160 | ifeq ($(USE_CORE_LIB_BOOTCLASSPATH),true) |
Ying Wang | 4f2f195 | 2015-11-23 14:57:26 -0800 | [diff] [blame] | 161 | ifeq ($(LOCAL_NO_STANDARD_LIBRARIES),true) |
| 162 | my_bootclasspath := "" |
| 163 | else |
| 164 | my_bootclasspath := $(call java-lib-files,core-libart-hostdex,$(LOCAL_IS_HOST_MODULE)) |
| 165 | endif |
| 166 | $(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_BOOTCLASSPATH := -bootclasspath $(my_bootclasspath) |
Ying Wang | 956dccc | 2015-08-28 11:47:03 -0700 | [diff] [blame] | 167 | |
| 168 | full_shared_java_libs := $(call java-lib-files,$(LOCAL_JAVA_LIBRARIES),$(LOCAL_IS_HOST_MODULE)) |
| 169 | full_java_lib_deps := $(call java-lib-deps,$(LOCAL_JAVA_LIBRARIES),$(LOCAL_IS_HOST_MODULE)) \ |
| 170 | $(full_shared_java_libs) |
| 171 | else |
| 172 | $(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_BOOTCLASSPATH := |
| 173 | |
| 174 | full_shared_java_libs := $(addprefix $(HOST_OUT_JAVA_LIBRARIES)/,\ |
| 175 | $(addsuffix $(COMMON_JAVA_PACKAGE_SUFFIX),$(LOCAL_JAVA_LIBRARIES))) |
| 176 | full_java_lib_deps := $(full_shared_java_libs) |
| 177 | endif # USE_CORE_LIB_BOOTCLASSPATH |
| 178 | endif # !LOCAL_IS_HOST_MODULE |
| 179 | |
| 180 | full_java_libs := $(full_shared_java_libs) $(full_static_java_libs) $(LOCAL_CLASSPATH) |
| 181 | full_java_lib_deps := $(full_java_lib_deps) $(full_static_java_libs) $(LOCAL_CLASSPATH) |
| 182 | |
| 183 | ifndef LOCAL_IS_HOST_MODULE |
| 184 | # This is set by packages that are linking to other packages that export |
| 185 | # shared libraries, allowing them to make use of the code in the linked apk. |
| 186 | apk_libraries := $(sort $(LOCAL_APK_LIBRARIES) $(LOCAL_RES_LIBRARIES)) |
| 187 | ifneq ($(apk_libraries),) |
| 188 | link_apk_libraries := \ |
| 189 | $(foreach lib,$(apk_libraries), \ |
| 190 | $(call intermediates-dir-for, \ |
| 191 | APPS,$(lib),,COMMON)/classes.jar) |
| 192 | |
| 193 | # link against the jar with full original names (before proguard processing). |
| 194 | full_shared_java_libs += $(link_apk_libraries) |
| 195 | full_java_libs += $(link_apk_libraries) |
| 196 | full_java_lib_deps += $(link_apk_libraries) |
| 197 | endif |
| 198 | |
| 199 | # This is set by packages that contain instrumentation, allowing them to |
| 200 | # link against the package they are instrumenting. Currently only one such |
| 201 | # package is allowed. |
| 202 | LOCAL_INSTRUMENTATION_FOR := $(strip $(LOCAL_INSTRUMENTATION_FOR)) |
| 203 | ifdef LOCAL_INSTRUMENTATION_FOR |
| 204 | ifneq ($(words $(LOCAL_INSTRUMENTATION_FOR)),1) |
| 205 | $(error \ |
| 206 | $(LOCAL_PATH): Multiple LOCAL_INSTRUMENTATION_FOR members defined) |
| 207 | endif |
| 208 | |
| 209 | link_instr_intermediates_dir.COMMON := $(call intermediates-dir-for, \ |
| 210 | APPS,$(LOCAL_INSTRUMENTATION_FOR),,COMMON) |
| 211 | # link against the jar with full original names (before proguard processing). |
| 212 | link_instr_classes_jar := $(link_instr_intermediates_dir.COMMON)/classes.jar |
| 213 | full_java_libs += $(link_instr_classes_jar) |
| 214 | full_java_lib_deps += $(link_instr_classes_jar) |
| 215 | endif # LOCAL_INSTRUMENTATION_FOR |
| 216 | endif # LOCAL_IS_HOST_MODULE |
| 217 | |
| 218 | endif # need_compile_java |
| 219 | |
| 220 | # We may want to add jar manifest or jar resource files even if there is no java code at all. |
| 221 | $(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_EXTRA_JAR_ARGS := $(extra_jar_args) |
| 222 | jar_manifest_file := |
| 223 | ifneq ($(strip $(LOCAL_JAR_MANIFEST)),) |
| 224 | jar_manifest_file := $(LOCAL_PATH)/$(LOCAL_JAR_MANIFEST) |
| 225 | $(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_JAR_MANIFEST := $(jar_manifest_file) |
| 226 | else |
| 227 | $(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_JAR_MANIFEST := |
| 228 | endif |
| 229 | |
| 230 | ########################################################## |
| 231 | ifndef LOCAL_IS_HOST_MODULE |
| 232 | ## AAPT Flags |
| 233 | # aapt doesn't accept multiple --extra-packages flags. |
| 234 | # We have to collapse them into a single --extra-packages flag here. |
| 235 | LOCAL_AAPT_FLAGS := $(strip $(LOCAL_AAPT_FLAGS)) |
| 236 | ifdef LOCAL_AAPT_FLAGS |
| 237 | ifeq ($(filter 0 1,$(words $(filter --extra-packages,$(LOCAL_AAPT_FLAGS)))),) |
| 238 | aapt_flags := $(subst --extra-packages$(space),--extra-packages@,$(LOCAL_AAPT_FLAGS)) |
| 239 | aapt_flags_extra_packages := $(patsubst --extra-packages@%,%,$(filter --extra-packages@%,$(aapt_flags))) |
| 240 | aapt_flags_extra_packages := $(sort $(subst :,$(space),$(aapt_flags_extra_packages))) |
| 241 | LOCAL_AAPT_FLAGS := $(filter-out --extra-packages@%,$(aapt_flags)) \ |
| 242 | --extra-packages $(subst $(space),:,$(aapt_flags_extra_packages)) |
| 243 | aapt_flags_extra_packages := |
| 244 | aapt_flags := |
| 245 | endif |
| 246 | endif |
| 247 | |
| 248 | $(LOCAL_INTERMEDIATE_TARGETS) : PRIVATE_AAPT_FLAGS := $(LOCAL_AAPT_FLAGS) $(PRODUCT_AAPT_FLAGS) |
| 249 | $(LOCAL_INTERMEDIATE_TARGETS) : PRIVATE_MANIFEST_PACKAGE_NAME := $(LOCAL_MANIFEST_PACKAGE_NAME) |
| 250 | $(LOCAL_INTERMEDIATE_TARGETS) : PRIVATE_MANIFEST_INSTRUMENTATION_FOR := $(LOCAL_MANIFEST_INSTRUMENTATION_FOR) |
| 251 | |
Ying Wang | 956dccc | 2015-08-28 11:47:03 -0700 | [diff] [blame] | 252 | ifdef aidl_sources |
| 253 | ALL_MODULES.$(my_register_name).AIDL_FILES := $(aidl_sources) |
| 254 | endif |
| 255 | endif # !LOCAL_IS_HOST_MODULE |
| 256 | |
| 257 | $(LOCAL_INTERMEDIATE_TARGETS) : PRIVATE_ALL_JAVA_LIBRARIES := $(full_java_libs) |
| 258 | |
| 259 | ALL_MODULES.$(my_register_name).INTERMEDIATE_SOURCE_DIR := \ |
| 260 | $(ALL_MODULES.$(my_register_name).INTERMEDIATE_SOURCE_DIR) $(LOCAL_INTERMEDIATE_SOURCE_DIR) |
| 261 | |
| 262 | ########################################################### |
| 263 | # JACK |
| 264 | ########################################################### |
| 265 | ifdef LOCAL_JACK_ENABLED |
| 266 | ifdef need_compile_java |
| 267 | |
| 268 | full_static_jack_libs := \ |
| 269 | $(foreach lib,$(LOCAL_STATIC_JAVA_LIBRARIES), \ |
| 270 | $(call intermediates-dir-for, \ |
| 271 | JAVA_LIBRARIES,$(lib),$(LOCAL_IS_HOST_MODULE),COMMON)/classes.jack) |
| 272 | |
| 273 | $(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_STATIC_JACK_LIBRARIES := $(full_static_jack_libs) |
Ying Wang | 956dccc | 2015-08-28 11:47:03 -0700 | [diff] [blame] | 274 | |
| 275 | ifndef LOCAL_IS_HOST_MODULE |
| 276 | ifeq ($(LOCAL_SDK_VERSION),) |
Ying Wang | 4f2f195 | 2015-11-23 14:57:26 -0800 | [diff] [blame] | 277 | ifeq ($(LOCAL_NO_STANDARD_LIBRARIES),true) |
| 278 | my_bootclasspath := |
Ying Wang | 956dccc | 2015-08-28 11:47:03 -0700 | [diff] [blame] | 279 | else |
Ying Wang | 4f2f195 | 2015-11-23 14:57:26 -0800 | [diff] [blame] | 280 | my_bootclasspath := $(call jack-lib-files,core-libart) |
| 281 | endif |
| 282 | else # LOCAL_SDK_VERSION |
Ying Wang | 956dccc | 2015-08-28 11:47:03 -0700 | [diff] [blame] | 283 | ifeq ($(LOCAL_SDK_VERSION)$(TARGET_BUILD_APPS),current) |
| 284 | # LOCAL_SDK_VERSION is current and no TARGET_BUILD_APPS. |
Ying Wang | 4f2f195 | 2015-11-23 14:57:26 -0800 | [diff] [blame] | 285 | my_bootclasspath := $(call jack-lib-files,android_stubs_current) |
Ying Wang | 956dccc | 2015-08-28 11:47:03 -0700 | [diff] [blame] | 286 | else ifeq ($(LOCAL_SDK_VERSION)$(TARGET_BUILD_APPS),system_current) |
Ying Wang | 4f2f195 | 2015-11-23 14:57:26 -0800 | [diff] [blame] | 287 | my_bootclasspath := $(call jack-lib-files,android_system_stubs_current) |
Ying Wang | 956dccc | 2015-08-28 11:47:03 -0700 | [diff] [blame] | 288 | else |
Ying Wang | 4f2f195 | 2015-11-23 14:57:26 -0800 | [diff] [blame] | 289 | my_bootclasspath :=$(call jack-lib-files,sdk_v$(LOCAL_SDK_VERSION)) |
Ying Wang | 956dccc | 2015-08-28 11:47:03 -0700 | [diff] [blame] | 290 | endif # current or system_current |
| 291 | endif # LOCAL_SDK_VERSION |
Ying Wang | 4f2f195 | 2015-11-23 14:57:26 -0800 | [diff] [blame] | 292 | $(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_BOOTCLASSPATH_JAVA_LIBRARIES := $(my_bootclasspath) |
Ying Wang | 956dccc | 2015-08-28 11:47:03 -0700 | [diff] [blame] | 293 | |
| 294 | full_shared_jack_libs := $(call jack-lib-files,$(LOCAL_JAVA_LIBRARIES),$(LOCAL_IS_HOST_MODULE)) |
| 295 | full_jack_lib_deps := $(call jack-lib-deps,$(LOCAL_JAVA_LIBRARIES),$(LOCAL_IS_HOST_MODULE)) |
Shinichiro Hamaji | f972a4a | 2015-12-09 18:06:20 +0900 | [diff] [blame] | 296 | # Turn off .toc optimization for apps build as we cannot build dexdump. |
| 297 | ifeq (,$(TARGET_BUILD_APPS)) |
| 298 | full_jack_lib_deps := $(patsubst %.jack, %.dex.toc, $(full_jack_lib_deps)) |
| 299 | endif |
Ying Wang | 956dccc | 2015-08-28 11:47:03 -0700 | [diff] [blame] | 300 | |
| 301 | else # LOCAL_IS_HOST_MODULE |
| 302 | |
| 303 | ifeq ($(USE_CORE_LIB_BOOTCLASSPATH),true) |
Ying Wang | 4f2f195 | 2015-11-23 14:57:26 -0800 | [diff] [blame] | 304 | ifeq ($(LOCAL_NO_STANDARD_LIBRARIES),true) |
| 305 | my_bootclasspath := |
| 306 | else |
| 307 | my_bootclasspath := $(call jack-lib-files,core-libart-hostdex,$(LOCAL_IS_HOST_MODULE)) |
| 308 | endif |
| 309 | $(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_BOOTCLASSPATH_JAVA_LIBRARIES := $(my_bootclasspath) |
Ying Wang | 956dccc | 2015-08-28 11:47:03 -0700 | [diff] [blame] | 310 | full_shared_jack_libs := $(call jack-lib-files,$(LOCAL_JAVA_LIBRARIES),$(LOCAL_IS_HOST_MODULE)) |
| 311 | full_jack_lib_deps := $(call jack-lib-deps,$(LOCAL_JAVA_LIBRARIES),$(LOCAL_IS_HOST_MODULE)) |
| 312 | else |
| 313 | $(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_BOOTCLASSPATH_JAVA_LIBRARIES := |
| 314 | full_shared_jack_libs := $(call jack-lib-deps,$(LOCAL_JAVA_LIBRARIES),$(LOCAL_IS_HOST_MODULE)) |
| 315 | full_jack_lib_deps := $(full_shared_jack_libs) |
| 316 | endif # USE_CORE_LIB_BOOTCLASSPATH |
| 317 | endif # !LOCAL_IS_HOST_MODULE |
| 318 | full_jack_libs := $(full_shared_jack_libs) $(full_static_jack_libs) $(LOCAL_JACK_CLASSPATH) |
| 319 | full_jack_lib_deps += $(full_static_jack_libs) $(LOCAL_JACK_CLASSPATH) |
| 320 | |
| 321 | ifndef LOCAL_IS_HOST_MODULE |
| 322 | # This is set by packages that are linking to other packages that export |
| 323 | # shared libraries, allowing them to make use of the code in the linked apk. |
| 324 | ifneq ($(apk_libraries),) |
| 325 | link_apk_jack_libraries := \ |
| 326 | $(foreach lib,$(apk_libraries), \ |
| 327 | $(call intermediates-dir-for, \ |
| 328 | APPS,$(lib),,COMMON)/classes.jack) |
| 329 | |
| 330 | # link against the jar with full original names (before proguard processing). |
| 331 | full_shared_jack_libs += $(link_apk_jack_libraries) |
| 332 | full_jack_libs += $(link_apk_jack_libraries) |
| 333 | full_jack_lib_deps += $(link_apk_jack_libraries) |
| 334 | endif |
| 335 | |
| 336 | # This is set by packages that contain instrumentation, allowing them to |
| 337 | # link against the package they are instrumenting. Currently only one such |
| 338 | # package is allowed. |
| 339 | ifdef LOCAL_INSTRUMENTATION_FOR |
| 340 | # link against the jar with full original names (before proguard processing). |
| 341 | link_instr_classes_jack := $(link_instr_intermediates_dir.COMMON)/classes.noshrob.jack |
| 342 | full_jack_libs += $(link_instr_classes_jack) |
| 343 | full_jack_lib_deps += $(link_instr_classes_jack) |
| 344 | endif # LOCAL_INSTRUMENTATION_FOR |
| 345 | endif # !LOCAL_IS_HOST_MODULE |
| 346 | |
| 347 | # Propagate local configuration options to this target. |
| 348 | $(LOCAL_INTERMEDIATE_TARGETS) : PRIVATE_ALL_JACK_LIBRARIES:= $(full_jack_libs) |
| 349 | $(LOCAL_INTERMEDIATE_TARGETS) : PRIVATE_JARJAR_RULES := $(LOCAL_JARJAR_RULES) |
| 350 | |
| 351 | endif # need_compile_java |
| 352 | endif # LOCAL_JACK_ENABLED |