blob: e3574401dc02cc5a35dc86acb24a83377716e904 [file] [log] [blame]
Ying Wang956dccc2015-08-28 11:47:03 -07001# Common to host and target Java modules.
2
3###########################################################
Neil Fullerad022512016-01-29 14:22:29 +00004## Java version
5###########################################################
Neil Fullerdecb7972016-03-04 18:00:00 +00006# Use the LOCAL_JAVA_LANGUAGE_VERSION if it is set, otherwise
7# use one based on the LOCAL_SDK_VERSION. If it is < 24
8# pass "1.7" to the tools, if it is unset, >= 24 or "current"
9# pass "1.8".
10#
11# The LOCAL_SDK_VERSION behavior is to ensure that, by default,
12# code that is expected to run on older releases of Android
13# does not use any 1.8 language features that are not supported
14# on earlier runtimes (like default / static interface methods).
15# Modules can override this logic by specifying
16# LOCAL_JAVA_LANGUAGE_VERSION explicitly.
Neil Fullerad022512016-01-29 14:22:29 +000017ifeq (,$(LOCAL_JAVA_LANGUAGE_VERSION))
Neil Fullerdecb7972016-03-04 18:00:00 +000018 private_sdk_versions_without_any_java_18_support := 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
19 ifneq (,$(filter $(LOCAL_SDK_VERSION), $(private_sdk_versions_without_any_java_18_support)))
20 LOCAL_JAVA_LANGUAGE_VERSION := 1.7
21 else
22 LOCAL_JAVA_LANGUAGE_VERSION := 1.8
23 endif
Neil Fullerad022512016-01-29 14:22:29 +000024endif
25LOCAL_JAVACFLAGS += -source $(LOCAL_JAVA_LANGUAGE_VERSION) -target $(LOCAL_JAVA_LANGUAGE_VERSION)
26
27###########################################################
Ying Wang956dccc2015-08-28 11:47:03 -070028## .proto files: Compile proto files to .java
29###########################################################
30proto_sources := $(filter %.proto,$(LOCAL_SRC_FILES))
31# Because names of the .java files compiled from .proto files are unknown until the
32# .proto files are compiled, we use a timestamp file as depedency.
33proto_java_sources_file_stamp :=
34ifneq ($(proto_sources),)
35proto_sources_fullpath := $(addprefix $(LOCAL_PATH)/, $(proto_sources))
36
37# By putting the generated java files into $(LOCAL_INTERMEDIATE_SOURCE_DIR), they will be
38# automatically found by the java compiling function transform-java-to-classes.jar.
39proto_java_intemediate_dir := $(LOCAL_INTERMEDIATE_SOURCE_DIR)/proto
40proto_java_sources_file_stamp := $(proto_java_intemediate_dir)/Proto.stamp
41proto_java_sources_dir := $(proto_java_intemediate_dir)/src
42
43$(proto_java_sources_file_stamp): PRIVATE_PROTO_INCLUDES := $(TOP)
44$(proto_java_sources_file_stamp): PRIVATE_PROTO_SRC_FILES := $(proto_sources_fullpath)
45$(proto_java_sources_file_stamp): PRIVATE_PROTO_JAVA_OUTPUT_DIR := $(proto_java_sources_dir)
46ifeq ($(LOCAL_PROTOC_OPTIMIZE_TYPE),micro)
47$(proto_java_sources_file_stamp): PRIVATE_PROTO_JAVA_OUTPUT_OPTION := --javamicro_out
48else
49 ifeq ($(LOCAL_PROTOC_OPTIMIZE_TYPE),nano)
50$(proto_java_sources_file_stamp): PRIVATE_PROTO_JAVA_OUTPUT_OPTION := --javanano_out
51 else
52$(proto_java_sources_file_stamp): PRIVATE_PROTO_JAVA_OUTPUT_OPTION := --java_out
53 endif
54endif
55$(proto_java_sources_file_stamp): PRIVATE_PROTOC_FLAGS := $(LOCAL_PROTOC_FLAGS)
56$(proto_java_sources_file_stamp): PRIVATE_PROTO_JAVA_OUTPUT_PARAMS := $(LOCAL_PROTO_JAVA_OUTPUT_PARAMS)
57$(proto_java_sources_file_stamp) : $(proto_sources_fullpath) $(PROTOC)
58 $(call transform-proto-to-java)
59
60#TODO: protoc should output the dependencies introduced by imports.
Ying Wangd5ffec92016-03-01 22:05:25 -080061
62ALL_MODULES.$(my_register_name).PROTO_FILES := $(proto_sources_fullpath)
Ying Wang956dccc2015-08-28 11:47:03 -070063endif # proto_sources
64
65#########################################
66## Java resources
67
68# Look for resource files in any specified directories.
69# Non-java and non-doc files will be picked up as resources
70# and included in the output jar file.
71java_resource_file_groups :=
72
73LOCAL_JAVA_RESOURCE_DIRS := $(strip $(LOCAL_JAVA_RESOURCE_DIRS))
74ifneq ($(LOCAL_JAVA_RESOURCE_DIRS),)
75 # This makes a list of words like
76 # <dir1>::<file1>:<file2> <dir2>::<file1> <dir3>:
77 # where each of the files is relative to the directory it's grouped with.
78 # Directories that don't contain any resource files will result in groups
79 # that end with a colon, and they are stripped out in the next step.
80 java_resource_file_groups += \
81 $(foreach dir,$(LOCAL_JAVA_RESOURCE_DIRS), \
82 $(subst $(space),:,$(strip \
83 $(LOCAL_PATH)/$(dir): \
Dan Willemsen7c3e3f82015-09-29 16:30:21 -070084 $(patsubst ./%,%,$(sort $(shell cd $(LOCAL_PATH)/$(dir) && \
Ying Wang956dccc2015-08-28 11:47:03 -070085 find . \
86 -type d -a -name ".svn" -prune -o \
87 -type f \
88 -a \! -name "*.java" \
89 -a \! -name "package.html" \
90 -a \! -name "overview.html" \
91 -a \! -name ".*.swp" \
92 -a \! -name ".DS_Store" \
93 -a \! -name "*~" \
94 -print \
Dan Willemsen7c3e3f82015-09-29 16:30:21 -070095 ))) \
Ying Wang956dccc2015-08-28 11:47:03 -070096 )) \
97 )
98 java_resource_file_groups := $(filter-out %:,$(java_resource_file_groups))
99endif # LOCAL_JAVA_RESOURCE_DIRS
100
101LOCAL_JAVA_RESOURCE_FILES := $(strip $(LOCAL_JAVA_RESOURCE_FILES))
102ifneq ($(LOCAL_JAVA_RESOURCE_FILES),)
103 java_resource_file_groups += \
104 $(foreach f,$(LOCAL_JAVA_RESOURCE_FILES), \
105 $(patsubst %/,%,$(dir $(f)))::$(notdir $(f)) \
106 )
107endif # LOCAL_JAVA_RESOURCE_FILES
108
109ifdef java_resource_file_groups
110 # The full paths to all resources, used for dependencies.
111 java_resource_sources := \
112 $(foreach group,$(java_resource_file_groups), \
113 $(addprefix $(word 1,$(subst :,$(space),$(group)))/, \
114 $(wordlist 2,9999,$(subst :,$(space),$(group))) \
115 ) \
116 )
117 # The arguments to jar that will include these files in a jar file.
118 # Quote the file name to handle special characters (such as #) correctly.
119 extra_jar_args := \
120 $(foreach group,$(java_resource_file_groups), \
121 $(addprefix -C "$(word 1,$(subst :,$(space),$(group)))" , \
122 $(foreach w, $(wordlist 2,9999,$(subst :,$(space),$(group))), "$(w)" ) \
123 ) \
124 )
125 java_resource_file_groups :=
126else
127 java_resource_sources :=
128 extra_jar_args :=
129endif # java_resource_file_groups
130
131######################################
132## PRIVATE java vars
133# LOCAL_SOURCE_FILES_ALL_GENERATED is set only if the module does not have static source files,
134# but generated source files in its LOCAL_INTERMEDIATE_SOURCE_DIR.
135# You have to set up the dependency in some other way.
136need_compile_java := $(strip $(all_java_sources)$(all_res_assets)$(java_resource_sources))$(LOCAL_STATIC_JAVA_LIBRARIES)$(filter true,$(LOCAL_SOURCE_FILES_ALL_GENERATED))
137ifdef need_compile_java
138
139full_static_java_libs := \
140 $(foreach lib,$(LOCAL_STATIC_JAVA_LIBRARIES), \
141 $(call intermediates-dir-for, \
142 JAVA_LIBRARIES,$(lib),$(LOCAL_IS_HOST_MODULE),COMMON)/javalib.jar)
143
144$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_STATIC_JAVA_LIBRARIES := $(full_static_java_libs)
145
146$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_RESOURCE_DIR := $(LOCAL_RESOURCE_DIR)
147$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_ASSET_DIR := $(LOCAL_ASSET_DIR)
148
149$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_CLASS_INTERMEDIATES_DIR := $(intermediates.COMMON)/classes
150$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_SOURCE_INTERMEDIATES_DIR := $(intermediates.COMMON)/src
151$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_JAVA_SOURCES := $(all_java_sources)
152
153$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_RMTYPEDEFS := $(LOCAL_RMTYPEDEFS)
154
155# full_java_libs: The list of files that should be used as the classpath.
156# Using this list as a dependency list WILL NOT WORK.
157# full_java_lib_deps: Should be specified as a prerequisite of this module
158# to guarantee that the files in full_java_libs will
159# be up-to-date.
160ifndef LOCAL_IS_HOST_MODULE
161ifeq ($(LOCAL_SDK_VERSION),)
Ying Wangc6a30172015-11-23 14:57:26 -0800162ifeq ($(LOCAL_NO_STANDARD_LIBRARIES),true)
163# No bootclasspath. But we still need "" to prevent javac from using default host bootclasspath.
164my_bootclasspath := ""
165else # LOCAL_NO_STANDARD_LIBRARIES
166my_bootclasspath := $(call java-lib-files,core-oj):$(call java-lib-files,core-libart)
167endif # LOCAL_NO_STANDARD_LIBRARIES
Ying Wang956dccc2015-08-28 11:47:03 -0700168else
169ifeq ($(LOCAL_SDK_VERSION)$(TARGET_BUILD_APPS),current)
170# LOCAL_SDK_VERSION is current and no TARGET_BUILD_APPS.
Ying Wangc6a30172015-11-23 14:57:26 -0800171my_bootclasspath := $(call java-lib-files,android_stubs_current)
Ying Wang956dccc2015-08-28 11:47:03 -0700172else ifeq ($(LOCAL_SDK_VERSION)$(TARGET_BUILD_APPS),system_current)
Ying Wangc6a30172015-11-23 14:57:26 -0800173my_bootclasspath := $(call java-lib-files,android_system_stubs_current)
Michael Wright0fb087f2015-11-06 15:20:51 +0000174else ifeq ($(LOCAL_SDK_VERSION)$(TARGET_BUILD_APPS),test_current)
175my_bootclasspath := $(call java-lib-files,android_test_stubs_current)
Ying Wang956dccc2015-08-28 11:47:03 -0700176else
Ying Wangc6a30172015-11-23 14:57:26 -0800177my_bootclasspath := $(call java-lib-files,sdk_v$(LOCAL_SDK_VERSION))
Michael Wright0fb087f2015-11-06 15:20:51 +0000178endif # current, system_current, or test_current
Ying Wang956dccc2015-08-28 11:47:03 -0700179endif # LOCAL_SDK_VERSION
Ying Wangc6a30172015-11-23 14:57:26 -0800180$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_BOOTCLASSPATH := -bootclasspath $(my_bootclasspath)
Ying Wang956dccc2015-08-28 11:47:03 -0700181
182full_shared_java_libs := $(call java-lib-files,$(LOCAL_JAVA_LIBRARIES),$(LOCAL_IS_HOST_MODULE))
183full_java_lib_deps := $(call java-lib-deps,$(LOCAL_JAVA_LIBRARIES),$(LOCAL_IS_HOST_MODULE))
Shinichiro Hamaji89b255a2015-11-09 16:47:42 +0900184full_java_lib_deps := $(addsuffix .toc, $(full_java_lib_deps))
Ying Wang956dccc2015-08-28 11:47:03 -0700185
186else # LOCAL_IS_HOST_MODULE
187
188ifeq ($(USE_CORE_LIB_BOOTCLASSPATH),true)
Ying Wangc6a30172015-11-23 14:57:26 -0800189ifeq ($(LOCAL_NO_STANDARD_LIBRARIES),true)
190my_bootclasspath := ""
191else
Ying Wang063d0452016-03-02 17:25:01 -0800192my_bootclasspath := $(call normalize-path-list,$(call host-dex-java-lib-files,core-oj-hostdex core-libart-hostdex))
Ying Wangc6a30172015-11-23 14:57:26 -0800193endif
194$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_BOOTCLASSPATH := -bootclasspath $(my_bootclasspath)
Ying Wang956dccc2015-08-28 11:47:03 -0700195
Ying Wang063d0452016-03-02 17:25:01 -0800196full_shared_java_libs := $(call host-dex-java-lib-files,$(LOCAL_JAVA_LIBRARIES))
197full_java_lib_deps := $(full_shared_java_libs)
198else # !USE_CORE_LIB_BOOTCLASSPATH
Ying Wang956dccc2015-08-28 11:47:03 -0700199$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_BOOTCLASSPATH :=
200
201full_shared_java_libs := $(addprefix $(HOST_OUT_JAVA_LIBRARIES)/,\
202 $(addsuffix $(COMMON_JAVA_PACKAGE_SUFFIX),$(LOCAL_JAVA_LIBRARIES)))
203full_java_lib_deps := $(full_shared_java_libs)
204endif # USE_CORE_LIB_BOOTCLASSPATH
205endif # !LOCAL_IS_HOST_MODULE
206
207full_java_libs := $(full_shared_java_libs) $(full_static_java_libs) $(LOCAL_CLASSPATH)
208full_java_lib_deps := $(full_java_lib_deps) $(full_static_java_libs) $(LOCAL_CLASSPATH)
209
210ifndef LOCAL_IS_HOST_MODULE
211# This is set by packages that are linking to other packages that export
212# shared libraries, allowing them to make use of the code in the linked apk.
213apk_libraries := $(sort $(LOCAL_APK_LIBRARIES) $(LOCAL_RES_LIBRARIES))
214ifneq ($(apk_libraries),)
215 link_apk_libraries := \
216 $(foreach lib,$(apk_libraries), \
217 $(call intermediates-dir-for, \
218 APPS,$(lib),,COMMON)/classes.jar)
219
220 # link against the jar with full original names (before proguard processing).
221 full_shared_java_libs += $(link_apk_libraries)
222 full_java_libs += $(link_apk_libraries)
223 full_java_lib_deps += $(link_apk_libraries)
224endif
225
226# This is set by packages that contain instrumentation, allowing them to
227# link against the package they are instrumenting. Currently only one such
228# package is allowed.
229LOCAL_INSTRUMENTATION_FOR := $(strip $(LOCAL_INSTRUMENTATION_FOR))
230ifdef LOCAL_INSTRUMENTATION_FOR
231 ifneq ($(words $(LOCAL_INSTRUMENTATION_FOR)),1)
232 $(error \
233 $(LOCAL_PATH): Multiple LOCAL_INSTRUMENTATION_FOR members defined)
234 endif
235
236 link_instr_intermediates_dir.COMMON := $(call intermediates-dir-for, \
237 APPS,$(LOCAL_INSTRUMENTATION_FOR),,COMMON)
238 # link against the jar with full original names (before proguard processing).
239 link_instr_classes_jar := $(link_instr_intermediates_dir.COMMON)/classes.jar
240 full_java_libs += $(link_instr_classes_jar)
241 full_java_lib_deps += $(link_instr_classes_jar)
242endif # LOCAL_INSTRUMENTATION_FOR
243endif # LOCAL_IS_HOST_MODULE
244
245endif # need_compile_java
246
247# We may want to add jar manifest or jar resource files even if there is no java code at all.
248$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_EXTRA_JAR_ARGS := $(extra_jar_args)
249jar_manifest_file :=
250ifneq ($(strip $(LOCAL_JAR_MANIFEST)),)
251jar_manifest_file := $(LOCAL_PATH)/$(LOCAL_JAR_MANIFEST)
252$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_JAR_MANIFEST := $(jar_manifest_file)
253else
254$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_JAR_MANIFEST :=
255endif
256
257##########################################################
258ifndef LOCAL_IS_HOST_MODULE
259## AAPT Flags
260# aapt doesn't accept multiple --extra-packages flags.
261# We have to collapse them into a single --extra-packages flag here.
262LOCAL_AAPT_FLAGS := $(strip $(LOCAL_AAPT_FLAGS))
263ifdef LOCAL_AAPT_FLAGS
264ifeq ($(filter 0 1,$(words $(filter --extra-packages,$(LOCAL_AAPT_FLAGS)))),)
265aapt_flags := $(subst --extra-packages$(space),--extra-packages@,$(LOCAL_AAPT_FLAGS))
266aapt_flags_extra_packages := $(patsubst --extra-packages@%,%,$(filter --extra-packages@%,$(aapt_flags)))
267aapt_flags_extra_packages := $(sort $(subst :,$(space),$(aapt_flags_extra_packages)))
268LOCAL_AAPT_FLAGS := $(filter-out --extra-packages@%,$(aapt_flags)) \
269 --extra-packages $(subst $(space),:,$(aapt_flags_extra_packages))
270aapt_flags_extra_packages :=
271aapt_flags :=
272endif
273endif
274
Ying Wang6f9bd2a2016-03-29 12:41:42 -0700275$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_AAPT_FLAGS := $(LOCAL_AAPT_FLAGS) $(PRODUCT_AAPT_FLAGS)
276$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_TARGET_AAPT_CHARACTERISTICS := $(TARGET_AAPT_CHARACTERISTICS)
277$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_MANIFEST_PACKAGE_NAME := $(LOCAL_MANIFEST_PACKAGE_NAME)
278$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_MANIFEST_INSTRUMENTATION_FOR := $(LOCAL_MANIFEST_INSTRUMENTATION_FOR)
Ying Wang956dccc2015-08-28 11:47:03 -0700279
Ying Wang956dccc2015-08-28 11:47:03 -0700280ifdef aidl_sources
281ALL_MODULES.$(my_register_name).AIDL_FILES := $(aidl_sources)
282endif
Ying Wangd5ffec92016-03-01 22:05:25 -0800283ifdef renderscript_sources
284ALL_MODULES.$(my_register_name).RS_FILES := $(renderscript_sources_fullpath)
285endif
Ying Wang956dccc2015-08-28 11:47:03 -0700286endif # !LOCAL_IS_HOST_MODULE
287
Ying Wang6f9bd2a2016-03-29 12:41:42 -0700288$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_ALL_JAVA_LIBRARIES := $(full_java_libs)
Ying Wang956dccc2015-08-28 11:47:03 -0700289
290ALL_MODULES.$(my_register_name).INTERMEDIATE_SOURCE_DIR := \
291 $(ALL_MODULES.$(my_register_name).INTERMEDIATE_SOURCE_DIR) $(LOCAL_INTERMEDIATE_SOURCE_DIR)
292
293###########################################################
294# JACK
295###########################################################
296ifdef LOCAL_JACK_ENABLED
297ifdef need_compile_java
298
Neil Fullerad022512016-01-29 14:22:29 +0000299LOCAL_JACK_FLAGS += -D jack.java.source.version=$(LOCAL_JAVA_LANGUAGE_VERSION)
300
Ying Wang956dccc2015-08-28 11:47:03 -0700301full_static_jack_libs := \
302 $(foreach lib,$(LOCAL_STATIC_JAVA_LIBRARIES), \
303 $(call intermediates-dir-for, \
304 JAVA_LIBRARIES,$(lib),$(LOCAL_IS_HOST_MODULE),COMMON)/classes.jack)
305
306$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_STATIC_JACK_LIBRARIES := $(full_static_jack_libs)
Ying Wang956dccc2015-08-28 11:47:03 -0700307
308ifndef LOCAL_IS_HOST_MODULE
309ifeq ($(LOCAL_SDK_VERSION),)
Ying Wangc6a30172015-11-23 14:57:26 -0800310ifeq ($(LOCAL_NO_STANDARD_LIBRARIES),true)
311my_bootclasspath :=
Ying Wang956dccc2015-08-28 11:47:03 -0700312else
Ying Wangc6a30172015-11-23 14:57:26 -0800313my_bootclasspath := $(call jack-lib-files,core-oj core-libart)
314endif
315else # LOCAL_SDK_VERSION
Ying Wang956dccc2015-08-28 11:47:03 -0700316ifeq ($(LOCAL_SDK_VERSION)$(TARGET_BUILD_APPS),current)
317# LOCAL_SDK_VERSION is current and no TARGET_BUILD_APPS.
Ying Wangc6a30172015-11-23 14:57:26 -0800318my_bootclasspath := $(call jack-lib-files,android_stubs_current)
Ying Wang956dccc2015-08-28 11:47:03 -0700319else ifeq ($(LOCAL_SDK_VERSION)$(TARGET_BUILD_APPS),system_current)
Ying Wangc6a30172015-11-23 14:57:26 -0800320my_bootclasspath := $(call jack-lib-files,android_system_stubs_current)
Michael Wright0fb087f2015-11-06 15:20:51 +0000321else ifeq ($(LOCAL_SDK_VERSION)$(TARGET_BUILD_APPS),test_current)
322my_bootclasspath := $(call jack-lib-files,android_test_stubs_current)
Ying Wang956dccc2015-08-28 11:47:03 -0700323else
Ying Wangc6a30172015-11-23 14:57:26 -0800324my_bootclasspath :=$(call jack-lib-files,sdk_v$(LOCAL_SDK_VERSION))
Michael Wright0fb087f2015-11-06 15:20:51 +0000325endif # current, system_current, or test_current
Ying Wang956dccc2015-08-28 11:47:03 -0700326endif # LOCAL_SDK_VERSION
Ying Wangc6a30172015-11-23 14:57:26 -0800327$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_BOOTCLASSPATH_JAVA_LIBRARIES := $(my_bootclasspath)
Ying Wang956dccc2015-08-28 11:47:03 -0700328
329full_shared_jack_libs := $(call jack-lib-files,$(LOCAL_JAVA_LIBRARIES),$(LOCAL_IS_HOST_MODULE))
Yohann Rousselb7de0fb2015-11-03 18:33:21 +0100330full_jack_deps := $(call jack-lib-deps,$(LOCAL_JAVA_LIBRARIES),$(LOCAL_IS_HOST_MODULE))
Shinichiro Hamajif972a4a2015-12-09 18:06:20 +0900331# Turn off .toc optimization for apps build as we cannot build dexdump.
332ifeq (,$(TARGET_BUILD_APPS))
Yohann Rousselb7de0fb2015-11-03 18:33:21 +0100333full_jack_deps := $(patsubst %.jack, %.dex.toc, $(full_jack_deps))
Shinichiro Hamajif972a4a2015-12-09 18:06:20 +0900334endif
Ying Wang956dccc2015-08-28 11:47:03 -0700335
336else # LOCAL_IS_HOST_MODULE
337
338ifeq ($(USE_CORE_LIB_BOOTCLASSPATH),true)
Ying Wangc6a30172015-11-23 14:57:26 -0800339ifeq ($(LOCAL_NO_STANDARD_LIBRARIES),true)
340my_bootclasspath :=
341else
342my_bootclasspath := $(call jack-lib-files,core-oj-hostdex core-libart-hostdex,$(LOCAL_IS_HOST_MODULE))
343endif
344$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_BOOTCLASSPATH_JAVA_LIBRARIES := $(my_bootclasspath)
Yohann Rousselb7de0fb2015-11-03 18:33:21 +0100345# Compiling against the final jack library. If we want to add support for obfuscated library
346# we'll need to change that to compile against the not obfuscated jack library.
Ying Wang956dccc2015-08-28 11:47:03 -0700347full_shared_jack_libs := $(call jack-lib-files,$(LOCAL_JAVA_LIBRARIES),$(LOCAL_IS_HOST_MODULE))
Yohann Rousselb7de0fb2015-11-03 18:33:21 +0100348full_jack_deps := $(call jack-lib-deps,$(LOCAL_JAVA_LIBRARIES),$(LOCAL_IS_HOST_MODULE))
Ying Wang956dccc2015-08-28 11:47:03 -0700349else
350$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_BOOTCLASSPATH_JAVA_LIBRARIES :=
351full_shared_jack_libs := $(call jack-lib-deps,$(LOCAL_JAVA_LIBRARIES),$(LOCAL_IS_HOST_MODULE))
Yohann Rousselb7de0fb2015-11-03 18:33:21 +0100352full_jack_deps := $(full_shared_jack_libs)
Ying Wang956dccc2015-08-28 11:47:03 -0700353endif # USE_CORE_LIB_BOOTCLASSPATH
354endif # !LOCAL_IS_HOST_MODULE
355full_jack_libs := $(full_shared_jack_libs) $(full_static_jack_libs) $(LOCAL_JACK_CLASSPATH)
Yohann Rousselb7de0fb2015-11-03 18:33:21 +0100356full_jack_deps += $(full_static_jack_libs) $(LOCAL_JACK_CLASSPATH)
Ying Wang956dccc2015-08-28 11:47:03 -0700357
358ifndef LOCAL_IS_HOST_MODULE
359# This is set by packages that are linking to other packages that export
360# shared libraries, allowing them to make use of the code in the linked apk.
361ifneq ($(apk_libraries),)
362 link_apk_jack_libraries := \
363 $(foreach lib,$(apk_libraries), \
364 $(call intermediates-dir-for, \
365 APPS,$(lib),,COMMON)/classes.jack)
366
367 # link against the jar with full original names (before proguard processing).
368 full_shared_jack_libs += $(link_apk_jack_libraries)
369 full_jack_libs += $(link_apk_jack_libraries)
Yohann Rousselb7de0fb2015-11-03 18:33:21 +0100370 full_jack_deps += $(link_apk_jack_libraries)
Ying Wang956dccc2015-08-28 11:47:03 -0700371endif
372
373# This is set by packages that contain instrumentation, allowing them to
374# link against the package they are instrumenting. Currently only one such
375# package is allowed.
376ifdef LOCAL_INSTRUMENTATION_FOR
377 # link against the jar with full original names (before proguard processing).
378 link_instr_classes_jack := $(link_instr_intermediates_dir.COMMON)/classes.noshrob.jack
379 full_jack_libs += $(link_instr_classes_jack)
Yohann Rousselb7de0fb2015-11-03 18:33:21 +0100380 full_jack_deps += $(link_instr_classes_jack)
Ying Wang956dccc2015-08-28 11:47:03 -0700381endif # LOCAL_INSTRUMENTATION_FOR
382endif # !LOCAL_IS_HOST_MODULE
383
384# Propagate local configuration options to this target.
Ying Wang6f9bd2a2016-03-29 12:41:42 -0700385$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_ALL_JACK_LIBRARIES:= $(full_jack_libs)
386$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_JARJAR_RULES := $(LOCAL_JARJAR_RULES)
Ying Wang956dccc2015-08-28 11:47:03 -0700387
388endif # need_compile_java
389endif # LOCAL_JACK_ENABLED