blob: c3787ae3c4e484929eae86253f55a725cc30cb14 [file] [log] [blame]
Ying Wang956dccc2015-08-28 11:47:03 -07001# Target Java.
The Android Open Source Project88b60792009-03-03 19:28:42 -08002# Requires:
3# LOCAL_MODULE_SUFFIX
4# LOCAL_MODULE_CLASS
5# all_res_assets
6
Keun young Parkebb351e2012-04-19 15:36:18 -07007ifeq ($(TARGET_BUILD_PDK),true)
Keun young Parkefe02ce2012-06-06 17:19:29 -07008ifeq ($(TARGET_BUILD_PDK_JAVA_PLATFORM),)
Keun young Parkebb351e2012-04-19 15:36:18 -07009# LOCAL_SDK not defined or set to current
10ifeq ($(filter-out current,$(LOCAL_SDK_VERSION)),)
Ying Wang2fee3a82014-10-17 18:26:39 -070011ifneq ($(LOCAL_NO_STANDARD_LIBRARIES),true)
Keun young Parkebb351e2012-04-19 15:36:18 -070012LOCAL_SDK_VERSION := $(PDK_BUILD_SDK_VERSION)
Ying Wang2fee3a82014-10-17 18:26:39 -070013endif #!LOCAL_NO_STANDARD_LIBRARIES
Keun young Parkebb351e2012-04-19 15:36:18 -070014endif
Keun young Park816b9fd2012-05-16 10:32:41 -070015endif # !PDK_JAVA
Keun young Parkebb351e2012-04-19 15:36:18 -070016endif #PDK
17
The Android Open Source Project88b60792009-03-03 19:28:42 -080018LOCAL_NO_STANDARD_LIBRARIES:=$(strip $(LOCAL_NO_STANDARD_LIBRARIES))
19LOCAL_SDK_VERSION:=$(strip $(LOCAL_SDK_VERSION))
20
Ying Wanga5fc87a2010-11-02 18:43:16 -070021proto_sources := $(filter %.proto,$(LOCAL_SRC_FILES))
22ifneq ($(proto_sources),)
23ifeq ($(LOCAL_PROTOC_OPTIMIZE_TYPE),micro)
Jeff Davidsonb8ddd552014-09-15 17:51:11 -070024 LOCAL_STATIC_JAVA_LIBRARIES += libprotobuf-java-micro
Ying Wanga5fc87a2010-11-02 18:43:16 -070025else
Ulas Kirazcibde274e2013-03-28 14:02:14 -070026 ifeq ($(LOCAL_PROTOC_OPTIMIZE_TYPE),nano)
Jeff Davidsonb8ddd552014-09-15 17:51:11 -070027 LOCAL_STATIC_JAVA_LIBRARIES += libprotobuf-java-nano
Ulas Kirazcibde274e2013-03-28 14:02:14 -070028 else
Joe Onoratoc05a8ee2016-10-05 18:01:10 -070029 ifeq ($(LOCAL_PROTOC_OPTIMIZE_TYPE),stream)
30 # No library for stream protobufs
31 else
32 LOCAL_STATIC_JAVA_LIBRARIES += libprotobuf-java-lite
33 endif
Ulas Kirazcibde274e2013-03-28 14:02:14 -070034 endif
Ying Wanga5fc87a2010-11-02 18:43:16 -070035endif
36endif
37
Ying Wange295c3d2016-02-24 14:11:55 -080038# LOCAL_STATIC_JAVA_AAR_LIBRARIES and LOCAL_STATIC_ANDROID_LIBRARIES are also LOCAL_STATIC_JAVA_LIBRARIES.
39LOCAL_STATIC_JAVA_LIBRARIES := $(strip $(LOCAL_STATIC_JAVA_LIBRARIES) \
40 $(LOCAL_STATIC_JAVA_AAR_LIBRARIES) \
41 $(LOCAL_STATIC_ANDROID_LIBRARIES))
42# LOCAL_SHARED_ANDROID_LIBRARIES are also LOCAL_JAVA_LIBRARIES.
43LOCAL_JAVA_LIBRARIES := $(sort $(LOCAL_JAVA_LIBRARIES) $(LOCAL_SHARED_ANDROID_LIBRARIES))
The Android Open Source Project88b60792009-03-03 19:28:42 -080044
45LOCAL_BUILT_MODULE_STEM := $(strip $(LOCAL_BUILT_MODULE_STEM))
46ifeq ($(LOCAL_BUILT_MODULE_STEM),)
47$(error $(LOCAL_PATH): Target java template must define LOCAL_BUILT_MODULE_STEM)
48endif
49ifneq ($(filter classes-compiled.jar classes.jar,$(LOCAL_BUILT_MODULE_STEM)),)
50$(error LOCAL_BUILT_MODULE_STEM may not be "$(LOCAL_BUILT_MODULE_STEM)")
51endif
52
Joe Onoratoe334d252009-07-17 15:33:40 -040053
54##############################################################################
55# Define the intermediate targets before including base_rules so they get
56# the correct environment.
57##############################################################################
58
59intermediates := $(call local-intermediates-dir)
60intermediates.COMMON := $(call local-intermediates-dir,COMMON)
61
Ying Wang957fea52010-09-23 11:48:38 -070062ifeq ($(LOCAL_PROGUARD_ENABLED),disabled)
63LOCAL_PROGUARD_ENABLED :=
64endif
65
Nan Zhangb3ec5342017-08-31 21:43:04 +000066full_classes_turbine_jar := $(intermediates.COMMON)/classes-turbine.jar
67full_classes_header_jarjar := $(intermediates.COMMON)/classes-header-jarjar.jar
68full_classes_header_jar := $(intermediates.COMMON)/classes-header.jar
Colin Crossa6e87822017-12-20 17:33:01 -080069full_classes_compiled_jar := $(intermediates.COMMON)/classes-full-debug.jar
Colin Crossf8a49c52017-05-22 16:21:49 -070070full_classes_processed_jar := $(intermediates.COMMON)/classes-processed.jar
Colin Crossa6e87822017-12-20 17:33:01 -080071full_classes_jarjar_jar := $(intermediates.COMMON)/classes-jarjar.jar
Nan Zhang9bd54052017-09-13 13:13:53 -070072full_classes_combined_jar := $(intermediates.COMMON)/classes-combined.jar
Colin Crossa6e87822017-12-20 17:33:01 -080073built_dex_intermediate := $(intermediates.COMMON)/dex/classes.dex
Ying Wang957fea52010-09-23 11:48:38 -070074full_classes_stubs_jar := $(intermediates.COMMON)/stubs.jar
Colin Crossdfc45ec2017-05-26 15:22:02 -070075java_source_list_file := $(intermediates.COMMON)/java-source-list
Ying Wang957fea52010-09-23 11:48:38 -070076
Ying Wang37b82aa2013-08-28 17:28:36 -070077ifeq ($(LOCAL_MODULE_CLASS)$(LOCAL_SRC_FILES)$(LOCAL_STATIC_JAVA_LIBRARIES)$(LOCAL_SOURCE_FILES_ALL_GENERATED),APPS)
78# If this is an apk without any Java code (e.g. framework-res), we should skip compiling Java.
Ying Wang990cf5e2013-08-28 13:04:46 -070079full_classes_jar :=
80built_dex :=
81else
Ying Wang957fea52010-09-23 11:48:38 -070082full_classes_jar := $(intermediates.COMMON)/classes.jar
Ying Wang7b7929a2013-09-12 17:35:21 -070083built_dex := $(intermediates.COMMON)/classes.dex
Ying Wang990cf5e2013-08-28 13:04:46 -070084endif
Joe Onoratoe334d252009-07-17 15:33:40 -040085
86LOCAL_INTERMEDIATE_TARGETS += \
Nan Zhangb3ec5342017-08-31 21:43:04 +000087 $(full_classes_turbine_jar) \
Joe Onoratoe334d252009-07-17 15:33:40 -040088 $(full_classes_compiled_jar) \
Ying Wang957fea52010-09-23 11:48:38 -070089 $(full_classes_jarjar_jar) \
Ying Wang957fea52010-09-23 11:48:38 -070090 $(full_classes_jar) \
Nan Zhang9bd54052017-09-13 13:13:53 -070091 $(full_classes_combined_jar) \
Ying Wang957fea52010-09-23 11:48:38 -070092 $(built_dex_intermediate) \
Guang Zhu155afe32010-03-10 15:48:03 -080093 $(built_dex) \
Colin Crossdfc45ec2017-05-26 15:22:02 -070094 $(full_classes_stubs_jar) \
95 $(java_source_list_file)
Ying Wang957fea52010-09-23 11:48:38 -070096
Joe Onorato77dc0a52010-05-17 18:16:11 -070097LOCAL_INTERMEDIATE_SOURCE_DIR := $(intermediates.COMMON)/src
Joe Onoratoe334d252009-07-17 15:33:40 -040098
Ying Wang956dccc2015-08-28 11:47:03 -070099###########################################################
100## AIDL: Compile .aidl files to .java
101###########################################################
102aidl_sources := $(filter %.aidl,$(LOCAL_SRC_FILES))
Christopher Wileyd9205ba2016-06-23 16:44:47 -0700103aidl_java_sources :=
Ying Wang956dccc2015-08-28 11:47:03 -0700104
105ifneq ($(strip $(aidl_sources)),)
Ying Wang956dccc2015-08-28 11:47:03 -0700106
107aidl_preprocess_import :=
108ifdef LOCAL_SDK_VERSION
Colin Cross8e0ff1c2018-12-18 22:43:16 -0800109ifneq ($(filter current system_current test_current core_current, $(LOCAL_SDK_VERSION)$(TARGET_BUILD_APPS_USE_PREBUILT_SDK)),)
Ying Wang956dccc2015-08-28 11:47:03 -0700110 # LOCAL_SDK_VERSION is current and no TARGET_BUILD_APPS
111 aidl_preprocess_import := $(TARGET_OUT_COMMON_INTERMEDIATES)/framework.aidl
112else
Anton Hansson66d47b82018-04-27 14:11:17 +0100113 aidl_preprocess_import := $(call resolve-prebuilt-sdk-aidl-path,$(LOCAL_SDK_VERSION))
Ying Wang956dccc2015-08-28 11:47:03 -0700114endif # not current or system_current
115else
116# build against the platform.
117LOCAL_AIDL_INCLUDES += $(FRAMEWORKS_BASE_JAVA_SRC_DIRS)
118endif # LOCAL_SDK_VERSION
Ying Wang956dccc2015-08-28 11:47:03 -0700119
Christopher Wileyd9205ba2016-06-23 16:44:47 -0700120$(foreach s,$(aidl_sources),\
Dan Willemsen4d995272017-09-29 17:37:31 -0700121 $(eval $(call define-aidl-java-rule,$(s),$(intermediates.COMMON)/aidl,aidl_java_sources)))
Shinichiro Hamaji2a0d1fe2016-01-28 16:10:00 +0900122$(foreach java,$(aidl_java_sources), \
123 $(call include-depfile,$(java:%.java=%.P),$(java)))
Ying Wang956dccc2015-08-28 11:47:03 -0700124
Christopher Wileyd9205ba2016-06-23 16:44:47 -0700125$(aidl_java_sources) : $(LOCAL_ADDITIONAL_DEPENDENCIES) $(aidl_preprocess_import)
126
Steven Morelande0c38892019-02-05 17:01:48 -0800127$(aidl_java_sources): PRIVATE_AIDL_FLAGS := $(addprefix -p,$(aidl_preprocess_import)) -I$(LOCAL_PATH) -I$(LOCAL_PATH)/src $(addprefix -I,$(LOCAL_AIDL_INCLUDES))
Christopher Wileydc9e2672016-06-24 13:13:52 -0700128$(aidl_java_sources): PRIVATE_MODULE := $(LOCAL_MODULE)
Christopher Wileyd9205ba2016-06-23 16:44:47 -0700129
Ying Wang956dccc2015-08-28 11:47:03 -0700130endif
131
Ying Wang956dccc2015-08-28 11:47:03 -0700132##########################################
133
Ying Wang1d977e32013-01-30 11:22:06 -0800134# All of the rules after full_classes_compiled_jar are very unlikely
135# to fail except for bugs in their respective tools. If you would
136# like to run these rules, add the "all" modifier goal to the make
137# command line.
Ying Wang447d6962015-09-01 19:12:05 -0700138ifndef LOCAL_CHECKED_MODULE
Jean-Philippe Lesot0fbc9ff2015-01-20 14:18:48 +0000139ifdef full_classes_jar
Colin Crossb17f2852017-04-27 13:34:02 -0700140LOCAL_CHECKED_MODULE := $(full_classes_compiled_jar)
Ying Wang990cf5e2013-08-28 13:04:46 -0700141endif
Yohann Rousselee572682015-08-18 19:18:18 +0200142endif
Ying Wang1d977e32013-01-30 11:22:06 -0800143
The Android Open Source Project88b60792009-03-03 19:28:42 -0800144#######################################
145include $(BUILD_SYSTEM)/base_rules.mk
146#######################################
147
Yasuhiro Matsudaff82e822015-09-04 16:23:49 +0900148###########################################################
149## logtags: emit java source
150###########################################################
151ifneq ($(strip $(logtags_sources)),)
152
Dan Willemsen4d995272017-09-29 17:37:31 -0700153logtags_java_sources := $(patsubst %.logtags,%.java,$(addprefix $(intermediates.COMMON)/logtags/, $(logtags_sources)))
Yasuhiro Matsudaff82e822015-09-04 16:23:49 +0900154logtags_sources := $(addprefix $(LOCAL_PATH)/, $(logtags_sources))
155
Shinichiro Hamajid3ce14c2016-03-29 03:29:21 +0900156$(logtags_java_sources): PRIVATE_MERGED_TAG := $(TARGET_OUT_COMMON_INTERMEDIATES)/all-event-log-tags.txt
Colin Crossfdea8932017-12-06 14:38:40 -0800157$(logtags_java_sources): $(intermediates.COMMON)/logtags/%.java: $(LOCAL_PATH)/%.logtags $(TARGET_OUT_COMMON_INTERMEDIATES)/all-event-log-tags.txt $(JAVATAGS) build/make/tools/event_log_tags.py
Yasuhiro Matsudaff82e822015-09-04 16:23:49 +0900158 $(transform-logtags-to-java)
159
160else
161logtags_java_sources :=
162endif
163
Ying Wang956dccc2015-08-28 11:47:03 -0700164##########################################
165java_sources := $(addprefix $(LOCAL_PATH)/, $(filter %.java,$(LOCAL_SRC_FILES))) $(aidl_java_sources) $(logtags_java_sources) \
166 $(filter %.java,$(LOCAL_GENERATED_SOURCES))
Nan Zhangad818dc2017-10-04 09:26:06 -0700167java_intermediate_sources := $(addprefix $(TARGET_OUT_COMMON_INTERMEDIATES)/, $(filter %.java,$(LOCAL_INTERMEDIATE_SOURCES)))
168all_java_sources := $(java_sources) $(java_intermediate_sources)
patricktub23d8e62018-10-05 14:55:36 +0800169ALL_MODULES.$(my_register_name).SRCS := $(ALL_MODULES.$(my_register_name).SRCS) $(all_java_sources)
Nan Zhangad818dc2017-10-04 09:26:06 -0700170
Ying Wang956dccc2015-08-28 11:47:03 -0700171include $(BUILD_SYSTEM)/java_common.mk
172
Anton Hansson7ff32d22018-02-21 15:29:44 +0000173include $(BUILD_SYSTEM)/sdk_check.mk
174
Narayan Kamathbbcdc072017-08-22 15:47:08 +0100175# Set the profile source so that the odex / profile code included from java.mk
176# can find it.
177#
178# TODO: b/64896089, this is broken when called from package_internal.mk, since the file
179# we preopt from is a temporary file. This will be addressed in a follow up, possibly
180# by disabling stripping for profile guided preopt (which may be desirable for other
181# reasons anyway).
182#
183# Note that we set this only when called from package_internal.mk and not in other cases.
184ifneq (,$(called_from_package_internal)
185dex_preopt_profile_src_file := $(LOCAL_BUILT_MODULE)
186endif
187
Brian Carlstromced4bff2013-11-14 23:44:56 -0800188#######################################
189# defines built_odex along with rule to install odex
190include $(BUILD_SYSTEM)/dex_preopt_odex_install.mk
191#######################################
192
Ying Wang990cf5e2013-08-28 13:04:46 -0700193# Make sure there's something to build.
194ifdef full_classes_jar
195ifndef need_compile_java
Jeff Gaston960acf12018-02-26 21:00:25 -0500196$(call pretty-error,Target java module does not define any source or resource files)
Ying Wang990cf5e2013-08-28 13:04:46 -0700197endif
198endif
199
The Android Open Source Project88b60792009-03-03 19:28:42 -0800200# Since we're using intermediates.COMMON, make sure that it gets cleaned
201# properly.
202$(cleantarget): PRIVATE_CLEAN_FILES += $(intermediates.COMMON)
203
Ying Wang990cf5e2013-08-28 13:04:46 -0700204ifdef full_classes_jar
The Android Open Source Project88b60792009-03-03 19:28:42 -0800205
Joe Onorato64d85d02009-04-09 19:31:12 -0700206# Droiddoc isn't currently able to generate stubs for modules, so we're just
207# allowing it to use the classes.jar as the "stubs" that would be use to link
208# against, for the cases where someone needs the jar to link against.
Colin Cross0e537342017-03-29 12:17:36 -0700209$(eval $(call copy-one-file,$(full_classes_jar),$(full_classes_stubs_jar)))
Joe Onorato64d85d02009-04-09 19:31:12 -0700210ALL_MODULES.$(LOCAL_MODULE).STUBS := $(full_classes_stubs_jar)
211
Joe Onorato0eccce92011-10-30 21:37:35 -0700212# The layers file allows you to enforce a layering between java packages.
Colin Crossfdea8932017-12-06 14:38:40 -0800213# Run build/make/tools/java-layers.py for more details.
Joe Onorato0eccce92011-10-30 21:37:35 -0700214layers_file := $(addprefix $(LOCAL_PATH)/, $(LOCAL_JAVA_LAYERS_FILE))
215$(full_classes_compiled_jar): PRIVATE_JAVA_LAYERS_FILE := $(layers_file)
Ying Wang057eba02012-10-18 10:54:49 -0700216$(full_classes_compiled_jar): PRIVATE_WARNINGS_ENABLE := $(LOCAL_WARNINGS_ENABLE)
Joe Onorato0eccce92011-10-30 21:37:35 -0700217
The Android Open Source Project88b60792009-03-03 19:28:42 -0800218# Compile the java files to a .jar file.
219# This intentionally depends on java_sources, not all_java_sources.
220# Deps for generated source files must be handled separately,
221# via deps on the target that generates the sources.
Paul Duffin3ca92982016-09-20 15:12:30 +0100222
Przemyslaw Szczepaniak2e81b3c2017-06-30 14:51:12 +0100223# For user / userdebug builds, strip the local variable table and the local variable
224# type table. This has no bearing on stack traces, but will leave less information
225# available via JDWP.
226ifneq (,$(PRODUCT_MINIMIZE_JAVA_DEBUG_INFO))
227ifneq (,$(filter userdebug user,$(TARGET_BUILD_VARIANT)))
228LOCAL_JAVACFLAGS+= -g:source,lines
Przemyslaw Szczepaniak2e81b3c2017-06-30 14:51:12 +0100229endif
230endif
231
Colin Crossdfc45ec2017-05-26 15:22:02 -0700232# List of dependencies for anything that needs all java sources in place
233java_sources_deps := \
234 $(java_sources) \
235 $(java_resource_sources) \
Colin Crossdfc45ec2017-05-26 15:22:02 -0700236 $(proto_java_sources_file_stamp) \
Colin Cross11e2d552018-03-07 15:44:54 -0800237 $(LOCAL_SRCJARS) \
Colin Crossdfc45ec2017-05-26 15:22:02 -0700238 $(LOCAL_ADDITIONAL_DEPENDENCIES)
239
240$(java_source_list_file): $(java_sources_deps)
241 $(write-java-source-list)
242
Colin Cross7dc90432017-09-26 16:17:24 -0700243ifneq ($(TURBINE_ENABLED),false)
244
Nan Zhangb3ec5342017-08-31 21:43:04 +0000245$(full_classes_turbine_jar): PRIVATE_JAVACFLAGS := $(LOCAL_JAVACFLAGS) $(annotation_processor_flags)
Colin Cross11e2d552018-03-07 15:44:54 -0800246$(full_classes_turbine_jar): PRIVATE_SRCJARS := $(LOCAL_SRCJARS)
Nan Zhangb3ec5342017-08-31 21:43:04 +0000247$(full_classes_turbine_jar): PRIVATE_DONT_DELETE_JAR_META_INF := $(LOCAL_DONT_DELETE_JAR_META_INF)
248$(full_classes_turbine_jar): \
249 $(java_source_list_file) \
250 $(java_sources_deps) \
251 $(full_java_header_libs) \
Colin Cross1d1e5ef2017-09-23 18:19:05 -0700252 $(full_java_bootclasspath_libs) \
Colin Crossf9602572017-10-12 13:34:40 -0700253 $(full_java_system_modules_deps) \
Nan Zhangb3ec5342017-08-31 21:43:04 +0000254 $(NORMALIZE_PATH) \
255 $(JAR_ARGS) \
256 $(ZIPTIME) \
Nan Zhang9bd54052017-09-13 13:13:53 -0700257 | $(TURBINE) \
258 $(MERGE_ZIPS)
Nan Zhangb3ec5342017-08-31 21:43:04 +0000259 $(transform-java-to-header.jar)
260
261.KATI_RESTAT: $(full_classes_turbine_jar)
262
263# Run jarjar before generate classes-header.jar if necessary.
264ifneq ($(strip $(LOCAL_JARJAR_RULES)),)
265$(full_classes_header_jarjar): PRIVATE_JARJAR_RULES := $(LOCAL_JARJAR_RULES)
266$(full_classes_header_jarjar): $(full_classes_turbine_jar) $(LOCAL_JARJAR_RULES) | $(JARJAR)
267 @echo Header JarJar: $@
268 $(hide) $(JAVA) -jar $(JARJAR) process $(PRIVATE_JARJAR_RULES) $< $@
269else
270full_classes_header_jarjar := $(full_classes_turbine_jar)
271endif
272
273$(eval $(call copy-one-file,$(full_classes_header_jarjar),$(full_classes_header_jar)))
274
Colin Cross7dc90432017-09-26 16:17:24 -0700275endif # TURBINE_ENABLED != false
276
Colin Cross5ef6e792018-03-07 14:16:43 -0800277$(full_classes_compiled_jar): PRIVATE_JAVACFLAGS := $(LOCAL_JAVACFLAGS) $(annotation_processor_flags)
278$(full_classes_compiled_jar): PRIVATE_JAR_EXCLUDE_FILES := $(LOCAL_JAR_EXCLUDE_FILES)
279$(full_classes_compiled_jar): PRIVATE_JAR_PACKAGES := $(LOCAL_JAR_PACKAGES)
280$(full_classes_compiled_jar): PRIVATE_JAR_EXCLUDE_PACKAGES := $(LOCAL_JAR_EXCLUDE_PACKAGES)
281$(full_classes_compiled_jar): PRIVATE_DONT_DELETE_JAR_META_INF := $(LOCAL_DONT_DELETE_JAR_META_INF)
282$(full_classes_compiled_jar): PRIVATE_JAVA_SOURCE_LIST := $(java_source_list_file)
283$(full_classes_compiled_jar): PRIVATE_ALL_JAVA_HEADER_LIBRARIES := $(full_java_header_libs)
Colin Cross11e2d552018-03-07 15:44:54 -0800284$(full_classes_compiled_jar): PRIVATE_SRCJARS := $(LOCAL_SRCJARS)
285$(full_classes_compiled_jar): PRIVATE_SRCJAR_LIST_FILE := $(intermediates.COMMON)/srcjar-list
286$(full_classes_compiled_jar): PRIVATE_SRCJAR_INTERMEDIATES_DIR := $(intermediates.COMMON)/srcjars
Colin Cross5ef6e792018-03-07 14:16:43 -0800287$(full_classes_compiled_jar): \
288 $(java_source_list_file) \
289 $(full_java_header_libs) \
290 $(java_sources_deps) \
291 $(full_java_bootclasspath_libs) \
292 $(full_java_system_modules_deps) \
293 $(layers_file) \
294 $(annotation_processor_deps) \
295 $(NORMALIZE_PATH) \
296 $(JAR_ARGS) \
Colin Cross3f99cd52018-03-15 16:26:08 -0700297 $(ZIPSYNC) \
Colin Cross5ef6e792018-03-07 14:16:43 -0800298 | $(SOONG_JAVAC_WRAPPER)
299 @echo "Target Java: $@
300 $(call compile-java,$(TARGET_JAVAC),$(PRIVATE_ALL_JAVA_HEADER_LIBRARIES))
301
Ying Wangcddeb6c2016-03-24 11:00:30 -0700302javac-check : $(full_classes_compiled_jar)
Paul Duffin32bd0ad2016-09-15 14:34:42 +0100303javac-check-$(LOCAL_MODULE) : $(full_classes_compiled_jar)
Dan Willemsen7a1da0e2018-07-24 01:21:12 -0700304.PHONY: javac-check-$(LOCAL_MODULE)
Ying Wangcddeb6c2016-03-24 11:00:30 -0700305
Nan Zhang9bd54052017-09-13 13:13:53 -0700306$(full_classes_combined_jar): PRIVATE_DONT_DELETE_JAR_META_INF := $(LOCAL_DONT_DELETE_JAR_META_INF)
307$(full_classes_combined_jar): $(full_classes_compiled_jar) \
Nan Zhangb8801172017-09-20 14:56:48 -0700308 $(jar_manifest_file) \
Nan Zhang9bd54052017-09-13 13:13:53 -0700309 $(full_static_java_libs) | $(MERGE_ZIPS)
Nan Zhangb8801172017-09-20 14:56:48 -0700310 $(if $(PRIVATE_JAR_MANIFEST), $(hide) sed -e "s/%BUILD_NUMBER%/$(BUILD_NUMBER_FROM_FILE)/" \
311 $(PRIVATE_JAR_MANIFEST) > $(dir $@)/manifest.mf)
Colin Cross5b73ab32018-02-14 10:32:48 -0800312 $(MERGE_ZIPS) -j --ignore-duplicates $(if $(PRIVATE_JAR_MANIFEST),-m $(dir $@)/manifest.mf) \
Nan Zhangb8801172017-09-20 14:56:48 -0700313 $(if $(PRIVATE_DONT_DELETE_JAR_META_INF),,-stripDir META-INF -zipToNotStrip $<) \
314 $@ $< $(call reverse-list,$(PRIVATE_STATIC_JAVA_LIBRARIES))
Nan Zhang9bd54052017-09-13 13:13:53 -0700315
Colin Crossf8a49c52017-05-22 16:21:49 -0700316ifdef LOCAL_JAR_PROCESSOR
317# LOCAL_JAR_PROCESSOR_ARGS must be evaluated here to set up the rule-local
318# PRIVATE_JAR_PROCESSOR_ARGS variable, but $< and $@ are not available yet.
319# Set ${in} and ${out} so they can be referenced by LOCAL_JAR_PROCESSOR_ARGS
320# using deferred evaluation (LOCAL_JAR_PROCESSOR_ARGS = instead of :=).
Nan Zhang9bd54052017-09-13 13:13:53 -0700321in := $(full_classes_combined_jar)
Colin Crossf8a49c52017-05-22 16:21:49 -0700322out := $(full_classes_processed_jar).tmp
Colin Cross89b802b2017-07-13 19:25:47 -0700323my_jar_processor := $(HOST_OUT_JAVA_LIBRARIES)/$(LOCAL_JAR_PROCESSOR).jar
324
Colin Crossf8a49c52017-05-22 16:21:49 -0700325$(full_classes_processed_jar): PRIVATE_JAR_PROCESSOR_ARGS := $(LOCAL_JAR_PROCESSOR_ARGS)
Colin Cross89b802b2017-07-13 19:25:47 -0700326$(full_classes_processed_jar): PRIVATE_JAR_PROCESSOR := $(my_jar_processor)
Colin Crossf8a49c52017-05-22 16:21:49 -0700327$(full_classes_processed_jar): PRIVATE_TMP_OUT := $(out)
328in :=
329out :=
330
Nan Zhang9bd54052017-09-13 13:13:53 -0700331$(full_classes_processed_jar): $(full_classes_combined_jar) $(my_jar_processor)
Colin Crossf8a49c52017-05-22 16:21:49 -0700332 @echo Processing $@ with $(PRIVATE_JAR_PROCESSOR)
333 $(hide) rm -f $@ $(PRIVATE_TMP_OUT)
Colin Cross0851df82017-06-30 13:55:38 -0700334 $(hide) $(JAVA) -jar $(PRIVATE_JAR_PROCESSOR) $(PRIVATE_JAR_PROCESSOR_ARGS)
Colin Crossf8a49c52017-05-22 16:21:49 -0700335 $(hide) mv $(PRIVATE_TMP_OUT) $@
336
Colin Cross89b802b2017-07-13 19:25:47 -0700337my_jar_processor :=
Colin Crossf8a49c52017-05-22 16:21:49 -0700338else
Nan Zhang9bd54052017-09-13 13:13:53 -0700339full_classes_processed_jar := $(full_classes_combined_jar)
Colin Crossf8a49c52017-05-22 16:21:49 -0700340endif
341
Nan Zhang870025f2017-09-13 14:56:11 -0700342# Run jarjar if necessary
343ifneq ($(strip $(LOCAL_JARJAR_RULES)),)
344$(full_classes_jarjar_jar): PRIVATE_JARJAR_RULES := $(LOCAL_JARJAR_RULES)
345$(full_classes_jarjar_jar): $(full_classes_processed_jar) $(LOCAL_JARJAR_RULES) | $(JARJAR)
346 @echo JarJar: $@
347 $(hide) $(JAVA) -jar $(JARJAR) process $(PRIVATE_JARJAR_RULES) $< $@
348else
349full_classes_jarjar_jar := $(full_classes_processed_jar)
350endif
351
Jeff Gastondb6557e2018-02-27 14:05:40 -0500352$(eval $(call copy-one-file,$(full_classes_jarjar_jar),$(full_classes_jar)))
Colin Cross96873482017-12-22 16:51:23 -0800353
354#######################################
Jeff Gastond2ba7242018-01-31 17:34:07 -0500355LOCAL_FULL_CLASSES_PRE_JACOCO_JAR := $(full_classes_jar)
356
Colin Cross96873482017-12-22 16:51:23 -0800357include $(BUILD_SYSTEM)/jacoco.mk
358#######################################
359
Tobias Thierer7ef760b2017-11-17 13:02:12 +0000360# Temporarily enable --multi-dex until proguard supports v53 class files
361# ( http://b/67673860 ) or we move away from proguard altogether.
Tobias Thiererf6bd4952017-11-15 20:55:03 +0000362ifdef TARGET_OPENJDK9
Tobias Thierer89740662017-10-25 02:38:01 +0100363LOCAL_DX_FLAGS := $(filter-out --multi-dex,$(LOCAL_DX_FLAGS)) --multi-dex
364endif
365
Colin Crosscf010852018-06-06 21:46:25 +0000366full_classes_pre_proguard_jar := $(LOCAL_FULL_CLASSES_JACOCO_JAR)
Ying Wang3b2bdf12010-02-01 09:51:23 -0800367
Colin Cross950f1ef2017-04-05 15:30:42 -0700368# Keep a copy of the jar just before proguard processing.
369$(eval $(call copy-one-file,$(full_classes_pre_proguard_jar),$(intermediates.COMMON)/classes-pre-proguard.jar))
Shinichiro Hamaji89b255a2015-11-09 16:47:42 +0900370
Colin Cross0e537342017-03-29 12:17:36 -0700371# Run proguard if necessary
Ying Wang7311a342013-08-21 18:32:49 -0700372ifdef LOCAL_PROGUARD_ENABLED
Colin Crosse616f342017-12-28 09:43:41 -0800373ifneq ($(filter-out full custom obfuscation optimization,$(LOCAL_PROGUARD_ENABLED)),)
Ying Wang7311a342013-08-21 18:32:49 -0700374 $(warning while processing: $(LOCAL_MODULE))
375 $(error invalid value for LOCAL_PROGUARD_ENABLED: $(LOCAL_PROGUARD_ENABLED))
376endif
Joe Onorato2daa2b32009-08-30 13:39:24 -0700377proguard_dictionary := $(intermediates.COMMON)/proguard_dictionary
Søren Gjesse9fbdd9e2018-04-13 15:34:20 +0200378proguard_configuration := $(intermediates.COMMON)/proguard_configuration
Ying Wang4f5d0e62015-05-04 19:21:48 -0700379
Colin Crossb5f25a22017-10-20 19:16:41 -0700380# When an app contains references to APIs that are not in the SDK specified by
Anton Hansson400673c2018-04-10 16:16:33 +0100381# its LOCAL_SDK_VERSION for example added by support library or by runtime
Colin Crossb5f25a22017-10-20 19:16:41 -0700382# classes added by desugar, we artifically raise the "SDK version" "linked" by
383# ProGuard, to
Ying Wang4f5d0e62015-05-04 19:21:48 -0700384# - suppress ProGuard warnings of referencing symbols unknown to the lower SDK version.
385# - prevent ProGuard stripping subclass in the support library that extends class added in the higher SDK version.
Colin Crossb5f25a22017-10-20 19:16:41 -0700386# See b/20667396
387my_proguard_sdk_raise :=
Ying Wang4f5d0e62015-05-04 19:21:48 -0700388ifdef LOCAL_SDK_VERSION
Ying Wang4f5d0e62015-05-04 19:21:48 -0700389ifdef TARGET_BUILD_APPS
Jiyong Park5ebca302018-01-31 00:14:55 +0900390ifeq (,$(filter current system_current test_current core_current, $(LOCAL_SDK_VERSION)))
Anton Hansson400673c2018-04-10 16:16:33 +0100391 my_proguard_sdk_raise := $(call java-lib-header-files, $(call resolve-prebuilt-sdk-module,current))
Ying Wang742f5832015-06-26 12:33:06 -0700392endif
Ying Wang4f5d0e62015-05-04 19:21:48 -0700393else
394 # For platform build, we can't just raise to the "current" SDK,
395 # that would break apps that use APIs removed from the current SDK.
Colin Crossb5f25a22017-10-20 19:16:41 -0700396 my_proguard_sdk_raise := $(call java-lib-header-files,$(TARGET_DEFAULT_BOOTCLASSPATH_LIBRARIES) $(TARGET_DEFAULT_JAVA_LIBRARIES))
Ying Wang4f5d0e62015-05-04 19:21:48 -0700397endif
Jiyong Parkeadd1bd2019-04-03 22:22:37 +0900398ifdef BOARD_SYSTEMSDK_VERSIONS
399ifneq (,$(filter true,$(LOCAL_VENDOR_MODULE) $(LOCAL_ODM_MODULE) $(LOCAL_PROPRIETARY_MODULE)))
400 # But for vendor or odm apks, don't raise SDK as the apks are required to
401 # use SDK APIs only
402 my_proguard_sdk_raise :=
403endif
404endif
Ying Wang4f5d0e62015-05-04 19:21:48 -0700405endif
Ying Wang4f5d0e62015-05-04 19:21:48 -0700406
Colin Cross3ebfe732018-07-25 13:41:42 -0700407legacy_proguard_flags := $(addprefix -libraryjars ,$(my_proguard_sdk_raise) \
Colin Crossb5f25a22017-10-20 19:16:41 -0700408 $(filter-out $(my_proguard_sdk_raise), \
Colin Crossb541aae2017-09-23 19:52:43 -0700409 $(full_java_bootclasspath_libs) \
410 $(full_shared_java_header_libs)))
Nan Zhangb3ec5342017-08-31 21:43:04 +0000411
Colin Crossb5f25a22017-10-20 19:16:41 -0700412legacy_proguard_lib_deps := $(my_proguard_sdk_raise) \
413 $(filter-out $(my_proguard_sdk_raise),$(full_shared_java_header_libs))
Yohann Rousselb7de0fb2015-11-03 18:33:21 +0100414
415legacy_proguard_flags += -printmapping $(proguard_dictionary)
Søren Gjesse9fbdd9e2018-04-13 15:34:20 +0200416legacy_proguard_flags += -printconfiguration $(proguard_configuration)
Yohann Rousselb7de0fb2015-11-03 18:33:21 +0100417
418common_proguard_flags := -forceprocessing
Ying Wang7311a342013-08-21 18:32:49 -0700419
Colin Crosse616f342017-12-28 09:43:41 -0800420common_proguard_flag_files := $(BUILD_SYSTEM)/proguard.flags
Ying Wang7311a342013-08-21 18:32:49 -0700421ifneq ($(LOCAL_INSTRUMENTATION_FOR)$(filter tests,$(LOCAL_MODULE_TAGS)),)
Yohann Rousselb4c49cb2014-09-08 14:45:14 +0200422common_proguard_flags += -dontshrink # don't shrink tests by default
Ying Wang3b2bdf12010-02-01 09:51:23 -0800423endif # test package
Dan Willemsen1417c172017-11-17 13:11:26 -0800424ifneq ($(LOCAL_PROGUARD_ENABLED),custom)
Colin Cross20299032018-05-09 13:29:51 -0700425 ifeq ($(LOCAL_USE_AAPT2),true)
Dan Willemsen1417c172017-11-17 13:11:26 -0800426 common_proguard_flag_files += $(foreach l,$(LOCAL_STATIC_ANDROID_LIBRARIES),\
427 $(call intermediates-dir-for,JAVA_LIBRARIES,$(l),,COMMON)/export_proguard_flags)
428 endif
429endif
Shinichiro Hamaji4eaeef82016-04-07 18:56:42 +0900430ifneq ($(common_proguard_flag_files),)
431common_proguard_flags += $(addprefix -include , $(common_proguard_flag_files))
432# This is included from $(BUILD_SYSTEM)/proguard.flags
433common_proguard_flag_files += $(BUILD_SYSTEM)/proguard_basic_keeps.flags
434endif
435
Ying Wang7311a342013-08-21 18:32:49 -0700436ifeq ($(filter obfuscation,$(LOCAL_PROGUARD_ENABLED)),)
437# By default no obfuscation
Yohann Rousselb4c49cb2014-09-08 14:45:14 +0200438common_proguard_flags += -dontobfuscate
Ying Wang7311a342013-08-21 18:32:49 -0700439endif # No obfuscation
440ifeq ($(filter optimization,$(LOCAL_PROGUARD_ENABLED)),)
441# By default no optimization
Yohann Rousselb4c49cb2014-09-08 14:45:14 +0200442common_proguard_flags += -dontoptimize
Ying Wang7311a342013-08-21 18:32:49 -0700443endif # No optimization
Ying Wang3b2bdf12010-02-01 09:51:23 -0800444
Ying Wang7311a342013-08-21 18:32:49 -0700445ifdef LOCAL_INSTRUMENTATION_FOR
446ifeq ($(filter obfuscation,$(LOCAL_PROGUARD_ENABLED)),)
447# If no obfuscation, link in the instrmented package's classes.jar as a library.
448# link_instr_classes_jar is defined in base_rule.mk
Yohann Rousselb4c49cb2014-09-08 14:45:14 +0200449legacy_proguard_flags += -libraryjars $(link_instr_classes_jar)
Nan Zhangb3ec5342017-08-31 21:43:04 +0000450legacy_proguard_lib_deps += $(link_instr_classes_jar)
Ying Wang7311a342013-08-21 18:32:49 -0700451else # obfuscation
452# If obfuscation is enabled, the main app must be obfuscated too.
453# We need to run obfuscation using the main app's dictionary,
454# and treat the main app's class.jar as injars instead of libraryjars.
Yohann Rousselb4c49cb2014-09-08 14:45:14 +0200455legacy_proguard_flags := -injars $(link_instr_classes_jar) \
Ying Wang7311a342013-08-21 18:32:49 -0700456 -outjars $(intermediates.COMMON)/proguard.$(LOCAL_INSTRUMENTATION_FOR).jar \
457 -include $(link_instr_intermediates_dir.COMMON)/proguard_options \
458 -applymapping $(link_instr_intermediates_dir.COMMON)/proguard_dictionary \
459 -verbose \
Yohann Rousselb4c49cb2014-09-08 14:45:14 +0200460 $(legacy_proguard_flags)
Colin Crossfcb441b2018-07-25 13:40:05 -0700461legacy_proguard_lib_deps += \
462 $(link_instr_classes_jar) \
463 $(link_instr_intermediates_dir.COMMON)/proguard_options \
464 $(link_instr_intermediates_dir.COMMON)/proguard_dictionary \
Ying Wang7311a342013-08-21 18:32:49 -0700465
466# Sometimes (test + main app) uses different keep rules from the main app -
467# apply the main app's dictionary anyway.
Yohann Rousselb4c49cb2014-09-08 14:45:14 +0200468legacy_proguard_flags += -ignorewarnings
Ying Wang7311a342013-08-21 18:32:49 -0700469
Ying Wang7311a342013-08-21 18:32:49 -0700470endif # no obfuscation
471endif # LOCAL_INSTRUMENTATION_FOR
Joe Onorato2daa2b32009-08-30 13:39:24 -0700472
Ying Wang0b9382c2010-09-29 14:50:41 -0700473proguard_flag_files := $(addprefix $(LOCAL_PATH)/, $(LOCAL_PROGUARD_FLAG_FILES))
Søren Gjesse0c1fe642017-10-12 16:09:13 +0200474proguard_flag_files += $(addprefix $(LOCAL_PATH)/, $(LOCAL_R8_FLAG_FILES))
Ying Wang0b9382c2010-09-29 14:50:41 -0700475LOCAL_PROGUARD_FLAGS += $(addprefix -include , $(proguard_flag_files))
476
Mihail Dumitrescu4df82b32014-02-07 15:18:59 +0000477ifdef LOCAL_TEST_MODULE_TO_PROGUARD_WITH
478extra_input_jar := $(call intermediates-dir-for,APPS,$(LOCAL_TEST_MODULE_TO_PROGUARD_WITH),,COMMON)/classes.jar
479else
480extra_input_jar :=
481endif
Paul Duffinf22aca12017-02-21 13:11:13 +0000482
Dan Willemsenbdd6a752017-09-25 23:36:19 -0700483ifneq ($(filter obfuscation,$(LOCAL_PROGUARD_ENABLED)),)
Søren Gjesse9fbdd9e2018-04-13 15:34:20 +0200484 $(built_dex_intermediate): .KATI_IMPLICIT_OUTPUTS := $(proguard_dictionary) $(proguard_configuration)
Søren Gjesse4ab5b022017-10-25 17:10:59 +0200485endif
Ying Wang3b2bdf12010-02-01 09:51:23 -0800486
Ying Wang7311a342013-08-21 18:32:49 -0700487else # LOCAL_PROGUARD_ENABLED not defined
ShuJie Wang76e93ba2017-11-06 14:35:52 +0800488proguard_flag_files :=
Ying Wang7311a342013-08-21 18:32:49 -0700489endif # LOCAL_PROGUARD_ENABLED defined
490
Colin Cross96476c12017-04-06 09:56:19 -0700491ifneq ($(LOCAL_IS_STATIC_JAVA_LIBRARY),true)
Colin Cross79e2f732016-12-21 14:29:13 -0800492$(built_dex_intermediate): PRIVATE_DX_FLAGS := $(LOCAL_DX_FLAGS)
Søren Gjesse0c1fe642017-10-12 16:09:13 +0200493
Søren Gjesse0c1fe642017-10-12 16:09:13 +0200494ifdef LOCAL_PROGUARD_ENABLED
Colin Cross3ebfe732018-07-25 13:41:42 -0700495 $(built_dex_intermediate): PRIVATE_EXTRA_INPUT_JAR := $(extra_input_jar)
496 $(built_dex_intermediate): PRIVATE_PROGUARD_FLAGS := $(legacy_proguard_flags) $(common_proguard_flags) $(LOCAL_PROGUARD_FLAGS)
Søren Gjesseb2293432018-08-23 11:17:17 +0200497 $(built_dex_intermediate): PRIVATE_PROGUARD_DICTIONARY := $(proguard_dictionary)
Colin Cross3ebfe732018-07-25 13:41:42 -0700498 $(built_dex_intermediate) : $(full_classes_pre_proguard_jar) $(extra_input_jar) $(my_proguard_sdk_raise) $(common_proguard_flag_files) $(proguard_flag_files) $(legacy_proguard_lib_deps) $(R8_COMPAT_PROGUARD)
Søren Gjesse0c1fe642017-10-12 16:09:13 +0200499 $(transform-jar-to-dex-r8)
Colin Cross3ebfe732018-07-25 13:41:42 -0700500else # !LOCAL_PROGUARD_ENABLED
Colin Crossec17af32018-09-21 12:36:53 -0700501 $(built_dex_intermediate): PRIVATE_D8_LIBS := $(full_java_bootclasspath_libs) $(full_shared_java_header_libs)
502 $(built_dex_intermediate): $(full_java_bootclasspath_libs) $(full_shared_java_header_libs)
Colin Cross3ebfe732018-07-25 13:41:42 -0700503 $(built_dex_intermediate): $(full_classes_pre_proguard_jar) $(DX) $(ZIP2ZIP)
Colin Cross79e2f732016-12-21 14:29:13 -0800504 $(transform-classes.jar-to-dex)
Søren Gjesse0c1fe642017-10-12 16:09:13 +0200505endif
Colin Cross79e2f732016-12-21 14:29:13 -0800506
Colin Cross485c9cd2019-02-04 15:28:51 -0800507ifneq ($(filter $(LOCAL_MODULE),$(PRODUCT_BOOT_JARS)),)
508 $(call pretty-error,Modules in PRODUCT_BOOT_JARS must be defined in Android.bp files)
509endif
David Brazdilb8fa6dd2018-01-29 14:43:14 +0000510
Colin Cross485c9cd2019-02-04 15:28:51 -0800511$(built_dex): $(built_dex_intermediate)
Guang Zhu155afe32010-03-10 15:48:03 -0800512 @echo Copying: $@
Yohann Roussel8ffe9c32013-08-20 17:05:27 +0200513 $(hide) mkdir -p $(dir $@)
514 $(hide) rm -f $(dir $@)/classes*.dex
Colin Cross0e537342017-03-29 12:17:36 -0700515 $(hide) cp -fp $(dir $<)/classes*.dex $(dir $@)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800516
Colin Cross9eff8302017-04-27 15:05:44 -0700517java-dex: $(built_dex)
518
Colin Cross96476c12017-04-06 09:56:19 -0700519endif # !LOCAL_IS_STATIC_JAVA_LIBRARY
520
The Android Open Source Project88b60792009-03-03 19:28:42 -0800521findbugs_xml := $(intermediates.COMMON)/findbugs.xml
Ying Wang702e01e2015-10-21 10:30:51 -0700522$(findbugs_xml): PRIVATE_AUXCLASSPATH := $(addprefix -auxclasspath ,$(strip \
523 $(call normalize-path-list,$(filter %.jar,$(full_java_libs)))))
524$(findbugs_xml): PRIVATE_FINDBUGS_FLAGS := $(LOCAL_FINDBUGS_FLAGS)
Colin Cross950f1ef2017-04-05 15:30:42 -0700525$(findbugs_xml) : $(full_classes_pre_proguard_jar) $(filter %.xml, $(LOCAL_FINDBUGS_FLAGS))
The Android Open Source Project88b60792009-03-03 19:28:42 -0800526 @echo Findbugs: $@
527 $(hide) $(FINDBUGS) -textui -effort:min -xml:withMessages \
Ying Wang702e01e2015-10-21 10:30:51 -0700528 $(PRIVATE_AUXCLASSPATH) $(PRIVATE_FINDBUGS_FLAGS) \
Yohann Rousseld2a76c12015-02-05 16:10:58 +0100529 $< \
The Android Open Source Project88b60792009-03-03 19:28:42 -0800530 > $@
531
532ALL_FINDBUGS_FILES += $(findbugs_xml)
533
534findbugs_html := $(PRODUCT_OUT)/findbugs/$(LOCAL_MODULE).html
535$(findbugs_html) : PRIVATE_XML_FILE := $(findbugs_xml)
536$(LOCAL_MODULE)-findbugs : $(findbugs_html)
Dan Willemsen7a1da0e2018-07-24 01:21:12 -0700537.PHONY: $(LOCAL_MODULE)-findbugs
The Android Open Source Project88b60792009-03-03 19:28:42 -0800538$(findbugs_html) : $(findbugs_xml)
539 @mkdir -p $(dir $@)
Andrew Stadlercef9ed92009-05-13 00:44:59 -0700540 @echo ConvertXmlToText: $@
Yuncheol Heo623d7062014-05-20 17:04:16 +0900541 $(hide) $(FINDBUGS_DIR)/convertXmlToText -html:fancy.xsl $(PRIVATE_XML_FILE) \
The Android Open Source Project88b60792009-03-03 19:28:42 -0800542 > $@
543
544$(LOCAL_MODULE)-findbugs : $(findbugs_html)
545
Ying Wang990cf5e2013-08-28 13:04:46 -0700546endif # full_classes_jar is defined
Yohann Rousselb4c49cb2014-09-08 14:45:14 +0200547
Colin Crossa27f42a2019-02-06 15:40:03 -0800548$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_DEFAULT_APP_TARGET_SDK := $(call module-target-sdk-version)
549$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_SDK_VERSION := $(call module-sdk-version)
550$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_MIN_SDK_VERSION := $(call codename-or-sdk-to-sdk,$(call module-min-sdk-version))