2015-08-28 20:47:03 +02:00
|
|
|
# Target Java.
|
2009-03-04 04:28:42 +01:00
|
|
|
# Requires:
|
|
|
|
# LOCAL_MODULE_SUFFIX
|
|
|
|
# LOCAL_MODULE_CLASS
|
|
|
|
# all_res_assets
|
|
|
|
|
2012-04-20 00:36:18 +02:00
|
|
|
ifeq ($(TARGET_BUILD_PDK),true)
|
2012-06-07 02:19:29 +02:00
|
|
|
ifeq ($(TARGET_BUILD_PDK_JAVA_PLATFORM),)
|
2012-04-20 00:36:18 +02:00
|
|
|
# LOCAL_SDK not defined or set to current
|
|
|
|
ifeq ($(filter-out current,$(LOCAL_SDK_VERSION)),)
|
2014-10-18 03:26:39 +02:00
|
|
|
ifneq ($(LOCAL_NO_STANDARD_LIBRARIES),true)
|
2012-04-20 00:36:18 +02:00
|
|
|
LOCAL_SDK_VERSION := $(PDK_BUILD_SDK_VERSION)
|
2014-10-18 03:26:39 +02:00
|
|
|
endif #!LOCAL_NO_STANDARD_LIBRARIES
|
2012-04-20 00:36:18 +02:00
|
|
|
endif
|
2012-05-16 19:32:41 +02:00
|
|
|
endif # !PDK_JAVA
|
2012-04-20 00:36:18 +02:00
|
|
|
endif #PDK
|
|
|
|
|
2009-03-04 04:28:42 +01:00
|
|
|
LOCAL_NO_STANDARD_LIBRARIES:=$(strip $(LOCAL_NO_STANDARD_LIBRARIES))
|
|
|
|
LOCAL_SDK_VERSION:=$(strip $(LOCAL_SDK_VERSION))
|
|
|
|
|
2010-11-03 02:43:16 +01:00
|
|
|
proto_sources := $(filter %.proto,$(LOCAL_SRC_FILES))
|
|
|
|
ifneq ($(proto_sources),)
|
|
|
|
ifeq ($(LOCAL_PROTOC_OPTIMIZE_TYPE),micro)
|
2014-09-16 02:51:11 +02:00
|
|
|
LOCAL_STATIC_JAVA_LIBRARIES += libprotobuf-java-micro
|
2010-11-03 02:43:16 +01:00
|
|
|
else
|
2013-03-28 22:02:14 +01:00
|
|
|
ifeq ($(LOCAL_PROTOC_OPTIMIZE_TYPE),nano)
|
2014-09-16 02:51:11 +02:00
|
|
|
LOCAL_STATIC_JAVA_LIBRARIES += libprotobuf-java-nano
|
2013-03-28 22:02:14 +01:00
|
|
|
else
|
2016-10-06 03:01:10 +02:00
|
|
|
ifeq ($(LOCAL_PROTOC_OPTIMIZE_TYPE),stream)
|
|
|
|
# No library for stream protobufs
|
|
|
|
else
|
|
|
|
LOCAL_STATIC_JAVA_LIBRARIES += libprotobuf-java-lite
|
|
|
|
endif
|
2013-03-28 22:02:14 +01:00
|
|
|
endif
|
2010-11-03 02:43:16 +01:00
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
2016-02-24 23:11:55 +01:00
|
|
|
# LOCAL_STATIC_JAVA_AAR_LIBRARIES and LOCAL_STATIC_ANDROID_LIBRARIES are also LOCAL_STATIC_JAVA_LIBRARIES.
|
|
|
|
LOCAL_STATIC_JAVA_LIBRARIES := $(strip $(LOCAL_STATIC_JAVA_LIBRARIES) \
|
|
|
|
$(LOCAL_STATIC_JAVA_AAR_LIBRARIES) \
|
|
|
|
$(LOCAL_STATIC_ANDROID_LIBRARIES))
|
|
|
|
# LOCAL_SHARED_ANDROID_LIBRARIES are also LOCAL_JAVA_LIBRARIES.
|
|
|
|
LOCAL_JAVA_LIBRARIES := $(sort $(LOCAL_JAVA_LIBRARIES) $(LOCAL_SHARED_ANDROID_LIBRARIES))
|
2009-03-04 04:28:42 +01:00
|
|
|
|
|
|
|
LOCAL_BUILT_MODULE_STEM := $(strip $(LOCAL_BUILT_MODULE_STEM))
|
|
|
|
ifeq ($(LOCAL_BUILT_MODULE_STEM),)
|
|
|
|
$(error $(LOCAL_PATH): Target java template must define LOCAL_BUILT_MODULE_STEM)
|
|
|
|
endif
|
|
|
|
ifneq ($(filter classes-compiled.jar classes.jar,$(LOCAL_BUILT_MODULE_STEM)),)
|
|
|
|
$(error LOCAL_BUILT_MODULE_STEM may not be "$(LOCAL_BUILT_MODULE_STEM)")
|
|
|
|
endif
|
|
|
|
|
2009-07-17 21:33:40 +02:00
|
|
|
|
|
|
|
##############################################################################
|
|
|
|
# Define the intermediate targets before including base_rules so they get
|
|
|
|
# the correct environment.
|
|
|
|
##############################################################################
|
|
|
|
|
|
|
|
intermediates := $(call local-intermediates-dir)
|
|
|
|
intermediates.COMMON := $(call local-intermediates-dir,COMMON)
|
|
|
|
|
2010-09-23 20:48:38 +02:00
|
|
|
ifeq ($(LOCAL_PROGUARD_ENABLED),disabled)
|
|
|
|
LOCAL_PROGUARD_ENABLED :=
|
2009-07-17 21:33:40 +02:00
|
|
|
endif
|
|
|
|
|
2017-08-31 23:43:04 +02:00
|
|
|
full_classes_turbine_jar := $(intermediates.COMMON)/classes-turbine.jar
|
|
|
|
full_classes_header_jarjar := $(intermediates.COMMON)/classes-header-jarjar.jar
|
|
|
|
full_classes_header_jar := $(intermediates.COMMON)/classes-header.jar
|
2017-12-21 02:33:01 +01:00
|
|
|
full_classes_compiled_jar := $(intermediates.COMMON)/classes-full-debug.jar
|
2017-05-23 01:21:49 +02:00
|
|
|
full_classes_processed_jar := $(intermediates.COMMON)/classes-processed.jar
|
2017-12-21 02:33:01 +01:00
|
|
|
full_classes_jarjar_jar := $(intermediates.COMMON)/classes-jarjar.jar
|
2017-09-13 22:13:53 +02:00
|
|
|
full_classes_combined_jar := $(intermediates.COMMON)/classes-combined.jar
|
2017-12-21 02:33:01 +01:00
|
|
|
built_dex_intermediate := $(intermediates.COMMON)/dex/classes.dex
|
2018-01-29 15:43:14 +01:00
|
|
|
built_dex_hiddenapi := $(intermediates.COMMON)/dex-hiddenapi/classes.dex
|
2010-09-23 20:48:38 +02:00
|
|
|
full_classes_stubs_jar := $(intermediates.COMMON)/stubs.jar
|
2017-05-27 00:22:02 +02:00
|
|
|
java_source_list_file := $(intermediates.COMMON)/java-source-list
|
2018-10-30 19:24:06 +01:00
|
|
|
hiddenapi_flags_csv := $(intermediates.COMMON)/hiddenapi/flags.csv
|
|
|
|
hiddenapi_metadata_csv := $(intermediates.COMMON)/hiddenapi/greylist.csv
|
2010-09-23 20:48:38 +02:00
|
|
|
|
2013-08-29 02:28:36 +02:00
|
|
|
ifeq ($(LOCAL_MODULE_CLASS)$(LOCAL_SRC_FILES)$(LOCAL_STATIC_JAVA_LIBRARIES)$(LOCAL_SOURCE_FILES_ALL_GENERATED),APPS)
|
|
|
|
# If this is an apk without any Java code (e.g. framework-res), we should skip compiling Java.
|
2013-08-28 22:04:46 +02:00
|
|
|
full_classes_jar :=
|
|
|
|
built_dex :=
|
|
|
|
else
|
2010-09-23 20:48:38 +02:00
|
|
|
full_classes_jar := $(intermediates.COMMON)/classes.jar
|
2013-09-13 02:35:21 +02:00
|
|
|
built_dex := $(intermediates.COMMON)/classes.dex
|
2013-08-28 22:04:46 +02:00
|
|
|
endif
|
2009-07-17 21:33:40 +02:00
|
|
|
|
|
|
|
LOCAL_INTERMEDIATE_TARGETS += \
|
2017-08-31 23:43:04 +02:00
|
|
|
$(full_classes_turbine_jar) \
|
2009-07-17 21:33:40 +02:00
|
|
|
$(full_classes_compiled_jar) \
|
2010-09-23 20:48:38 +02:00
|
|
|
$(full_classes_jarjar_jar) \
|
|
|
|
$(full_classes_jar) \
|
2017-09-13 22:13:53 +02:00
|
|
|
$(full_classes_combined_jar) \
|
2010-09-23 20:48:38 +02:00
|
|
|
$(built_dex_intermediate) \
|
2010-03-11 00:48:03 +01:00
|
|
|
$(built_dex) \
|
2017-05-27 00:22:02 +02:00
|
|
|
$(full_classes_stubs_jar) \
|
|
|
|
$(java_source_list_file)
|
2010-09-23 20:48:38 +02:00
|
|
|
|
2010-05-18 03:16:11 +02:00
|
|
|
LOCAL_INTERMEDIATE_SOURCE_DIR := $(intermediates.COMMON)/src
|
2009-07-17 21:33:40 +02:00
|
|
|
|
2015-08-28 20:47:03 +02:00
|
|
|
###########################################################
|
|
|
|
## AIDL: Compile .aidl files to .java
|
|
|
|
###########################################################
|
|
|
|
aidl_sources := $(filter %.aidl,$(LOCAL_SRC_FILES))
|
2016-06-24 01:44:47 +02:00
|
|
|
aidl_java_sources :=
|
2015-08-28 20:47:03 +02:00
|
|
|
|
|
|
|
ifneq ($(strip $(aidl_sources)),)
|
|
|
|
|
|
|
|
aidl_preprocess_import :=
|
|
|
|
ifdef LOCAL_SDK_VERSION
|
2018-01-30 16:14:55 +01:00
|
|
|
ifneq ($(filter current system_current test_current core_current, $(LOCAL_SDK_VERSION)$(TARGET_BUILD_APPS)),)
|
2015-08-28 20:47:03 +02:00
|
|
|
# LOCAL_SDK_VERSION is current and no TARGET_BUILD_APPS
|
|
|
|
aidl_preprocess_import := $(TARGET_OUT_COMMON_INTERMEDIATES)/framework.aidl
|
|
|
|
else
|
2018-04-27 15:11:17 +02:00
|
|
|
aidl_preprocess_import := $(call resolve-prebuilt-sdk-aidl-path,$(LOCAL_SDK_VERSION))
|
2015-08-28 20:47:03 +02:00
|
|
|
endif # not current or system_current
|
|
|
|
else
|
|
|
|
# build against the platform.
|
|
|
|
LOCAL_AIDL_INCLUDES += $(FRAMEWORKS_BASE_JAVA_SRC_DIRS)
|
|
|
|
endif # LOCAL_SDK_VERSION
|
|
|
|
|
2016-06-24 01:44:47 +02:00
|
|
|
$(foreach s,$(aidl_sources),\
|
2017-09-30 02:37:31 +02:00
|
|
|
$(eval $(call define-aidl-java-rule,$(s),$(intermediates.COMMON)/aidl,aidl_java_sources)))
|
2016-01-28 08:10:00 +01:00
|
|
|
$(foreach java,$(aidl_java_sources), \
|
|
|
|
$(call include-depfile,$(java:%.java=%.P),$(java)))
|
2015-08-28 20:47:03 +02:00
|
|
|
|
2016-06-24 01:44:47 +02:00
|
|
|
$(aidl_java_sources) : $(LOCAL_ADDITIONAL_DEPENDENCIES) $(aidl_preprocess_import)
|
|
|
|
|
|
|
|
$(aidl_java_sources): PRIVATE_AIDL_FLAGS := -b $(addprefix -p,$(aidl_preprocess_import)) -I$(LOCAL_PATH) -I$(LOCAL_PATH)/src $(addprefix -I,$(LOCAL_AIDL_INCLUDES))
|
2016-06-24 22:13:52 +02:00
|
|
|
$(aidl_java_sources): PRIVATE_MODULE := $(LOCAL_MODULE)
|
2016-06-24 01:44:47 +02:00
|
|
|
|
2015-08-28 20:47:03 +02:00
|
|
|
endif
|
|
|
|
|
|
|
|
##########################################
|
|
|
|
|
2013-01-30 20:22:06 +01:00
|
|
|
# All of the rules after full_classes_compiled_jar are very unlikely
|
|
|
|
# to fail except for bugs in their respective tools. If you would
|
|
|
|
# like to run these rules, add the "all" modifier goal to the make
|
|
|
|
# command line.
|
2015-09-02 04:12:05 +02:00
|
|
|
ifndef LOCAL_CHECKED_MODULE
|
2015-01-20 15:18:48 +01:00
|
|
|
ifdef full_classes_jar
|
2017-04-27 22:34:02 +02:00
|
|
|
LOCAL_CHECKED_MODULE := $(full_classes_compiled_jar)
|
2013-08-28 22:04:46 +02:00
|
|
|
endif
|
2015-08-18 19:18:18 +02:00
|
|
|
endif
|
2013-01-30 20:22:06 +01:00
|
|
|
|
2009-03-04 04:28:42 +01:00
|
|
|
#######################################
|
|
|
|
include $(BUILD_SYSTEM)/base_rules.mk
|
|
|
|
#######################################
|
|
|
|
|
2015-09-04 09:23:49 +02:00
|
|
|
###########################################################
|
|
|
|
## logtags: emit java source
|
|
|
|
###########################################################
|
|
|
|
ifneq ($(strip $(logtags_sources)),)
|
|
|
|
|
2017-09-30 02:37:31 +02:00
|
|
|
logtags_java_sources := $(patsubst %.logtags,%.java,$(addprefix $(intermediates.COMMON)/logtags/, $(logtags_sources)))
|
2015-09-04 09:23:49 +02:00
|
|
|
logtags_sources := $(addprefix $(LOCAL_PATH)/, $(logtags_sources))
|
|
|
|
|
2016-03-28 20:29:21 +02:00
|
|
|
$(logtags_java_sources): PRIVATE_MERGED_TAG := $(TARGET_OUT_COMMON_INTERMEDIATES)/all-event-log-tags.txt
|
2017-12-06 23:38:40 +01:00
|
|
|
$(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
|
2015-09-04 09:23:49 +02:00
|
|
|
$(transform-logtags-to-java)
|
|
|
|
|
|
|
|
else
|
|
|
|
logtags_java_sources :=
|
|
|
|
endif
|
|
|
|
|
2015-08-28 20:47:03 +02:00
|
|
|
##########################################
|
|
|
|
java_sources := $(addprefix $(LOCAL_PATH)/, $(filter %.java,$(LOCAL_SRC_FILES))) $(aidl_java_sources) $(logtags_java_sources) \
|
|
|
|
$(filter %.java,$(LOCAL_GENERATED_SOURCES))
|
2017-10-04 18:26:06 +02:00
|
|
|
java_intermediate_sources := $(addprefix $(TARGET_OUT_COMMON_INTERMEDIATES)/, $(filter %.java,$(LOCAL_INTERMEDIATE_SOURCES)))
|
|
|
|
all_java_sources := $(java_sources) $(java_intermediate_sources)
|
2018-10-05 08:55:36 +02:00
|
|
|
ALL_MODULES.$(my_register_name).SRCS := $(ALL_MODULES.$(my_register_name).SRCS) $(all_java_sources)
|
2017-10-04 18:26:06 +02:00
|
|
|
|
2015-08-28 20:47:03 +02:00
|
|
|
include $(BUILD_SYSTEM)/java_common.mk
|
|
|
|
|
2018-02-21 16:29:44 +01:00
|
|
|
include $(BUILD_SYSTEM)/sdk_check.mk
|
|
|
|
|
2017-08-22 16:47:08 +02:00
|
|
|
# Set the profile source so that the odex / profile code included from java.mk
|
|
|
|
# can find it.
|
|
|
|
#
|
|
|
|
# TODO: b/64896089, this is broken when called from package_internal.mk, since the file
|
|
|
|
# we preopt from is a temporary file. This will be addressed in a follow up, possibly
|
|
|
|
# by disabling stripping for profile guided preopt (which may be desirable for other
|
|
|
|
# reasons anyway).
|
|
|
|
#
|
|
|
|
# Note that we set this only when called from package_internal.mk and not in other cases.
|
|
|
|
ifneq (,$(called_from_package_internal)
|
|
|
|
dex_preopt_profile_src_file := $(LOCAL_BUILT_MODULE)
|
|
|
|
endif
|
|
|
|
|
2013-11-15 08:44:56 +01:00
|
|
|
#######################################
|
|
|
|
# defines built_odex along with rule to install odex
|
|
|
|
include $(BUILD_SYSTEM)/dex_preopt_odex_install.mk
|
|
|
|
#######################################
|
|
|
|
|
2013-08-28 22:04:46 +02:00
|
|
|
# Make sure there's something to build.
|
|
|
|
ifdef full_classes_jar
|
|
|
|
ifndef need_compile_java
|
2018-02-27 03:00:25 +01:00
|
|
|
$(call pretty-error,Target java module does not define any source or resource files)
|
2013-08-28 22:04:46 +02:00
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
2009-03-04 04:28:42 +01:00
|
|
|
# Since we're using intermediates.COMMON, make sure that it gets cleaned
|
|
|
|
# properly.
|
|
|
|
$(cleantarget): PRIVATE_CLEAN_FILES += $(intermediates.COMMON)
|
|
|
|
|
2013-08-28 22:04:46 +02:00
|
|
|
ifdef full_classes_jar
|
2009-03-04 04:28:42 +01:00
|
|
|
|
2009-04-10 04:31:12 +02:00
|
|
|
# Droiddoc isn't currently able to generate stubs for modules, so we're just
|
|
|
|
# allowing it to use the classes.jar as the "stubs" that would be use to link
|
|
|
|
# against, for the cases where someone needs the jar to link against.
|
2017-03-29 21:17:36 +02:00
|
|
|
$(eval $(call copy-one-file,$(full_classes_jar),$(full_classes_stubs_jar)))
|
2009-04-10 04:31:12 +02:00
|
|
|
ALL_MODULES.$(LOCAL_MODULE).STUBS := $(full_classes_stubs_jar)
|
|
|
|
|
2011-10-31 05:37:35 +01:00
|
|
|
# The layers file allows you to enforce a layering between java packages.
|
2017-12-06 23:38:40 +01:00
|
|
|
# Run build/make/tools/java-layers.py for more details.
|
2011-10-31 05:37:35 +01:00
|
|
|
layers_file := $(addprefix $(LOCAL_PATH)/, $(LOCAL_JAVA_LAYERS_FILE))
|
|
|
|
$(full_classes_compiled_jar): PRIVATE_JAVA_LAYERS_FILE := $(layers_file)
|
2012-10-18 19:54:49 +02:00
|
|
|
$(full_classes_compiled_jar): PRIVATE_WARNINGS_ENABLE := $(LOCAL_WARNINGS_ENABLE)
|
2011-10-31 05:37:35 +01:00
|
|
|
|
2009-03-25 03:07:34 +01:00
|
|
|
# Compile the java files to a .jar file.
|
|
|
|
# This intentionally depends on java_sources, not all_java_sources.
|
|
|
|
# Deps for generated source files must be handled separately,
|
|
|
|
# via deps on the target that generates the sources.
|
2016-09-20 16:12:30 +02:00
|
|
|
|
2017-06-30 15:51:12 +02:00
|
|
|
# For user / userdebug builds, strip the local variable table and the local variable
|
|
|
|
# type table. This has no bearing on stack traces, but will leave less information
|
|
|
|
# available via JDWP.
|
|
|
|
ifneq (,$(PRODUCT_MINIMIZE_JAVA_DEBUG_INFO))
|
|
|
|
ifneq (,$(filter userdebug user,$(TARGET_BUILD_VARIANT)))
|
|
|
|
LOCAL_JAVACFLAGS+= -g:source,lines
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
2017-05-27 00:22:02 +02:00
|
|
|
# List of dependencies for anything that needs all java sources in place
|
|
|
|
java_sources_deps := \
|
|
|
|
$(java_sources) \
|
|
|
|
$(java_resource_sources) \
|
|
|
|
$(proto_java_sources_file_stamp) \
|
2018-03-08 00:44:54 +01:00
|
|
|
$(LOCAL_SRCJARS) \
|
2017-05-27 00:22:02 +02:00
|
|
|
$(LOCAL_ADDITIONAL_DEPENDENCIES)
|
|
|
|
|
|
|
|
$(java_source_list_file): $(java_sources_deps)
|
|
|
|
$(write-java-source-list)
|
|
|
|
|
2017-09-27 01:17:24 +02:00
|
|
|
ifneq ($(TURBINE_ENABLED),false)
|
|
|
|
|
2017-08-31 23:43:04 +02:00
|
|
|
$(full_classes_turbine_jar): PRIVATE_JAVACFLAGS := $(LOCAL_JAVACFLAGS) $(annotation_processor_flags)
|
2018-03-08 00:44:54 +01:00
|
|
|
$(full_classes_turbine_jar): PRIVATE_SRCJARS := $(LOCAL_SRCJARS)
|
2017-08-31 23:43:04 +02:00
|
|
|
$(full_classes_turbine_jar): PRIVATE_DONT_DELETE_JAR_META_INF := $(LOCAL_DONT_DELETE_JAR_META_INF)
|
|
|
|
$(full_classes_turbine_jar): \
|
|
|
|
$(java_source_list_file) \
|
|
|
|
$(java_sources_deps) \
|
|
|
|
$(full_java_header_libs) \
|
2017-09-24 03:19:05 +02:00
|
|
|
$(full_java_bootclasspath_libs) \
|
2017-10-12 22:34:40 +02:00
|
|
|
$(full_java_system_modules_deps) \
|
2017-08-31 23:43:04 +02:00
|
|
|
$(NORMALIZE_PATH) \
|
|
|
|
$(JAR_ARGS) \
|
|
|
|
$(ZIPTIME) \
|
2017-09-13 22:13:53 +02:00
|
|
|
| $(TURBINE) \
|
|
|
|
$(MERGE_ZIPS)
|
2017-08-31 23:43:04 +02:00
|
|
|
$(transform-java-to-header.jar)
|
|
|
|
|
|
|
|
.KATI_RESTAT: $(full_classes_turbine_jar)
|
|
|
|
|
|
|
|
# Run jarjar before generate classes-header.jar if necessary.
|
|
|
|
ifneq ($(strip $(LOCAL_JARJAR_RULES)),)
|
|
|
|
$(full_classes_header_jarjar): PRIVATE_JARJAR_RULES := $(LOCAL_JARJAR_RULES)
|
|
|
|
$(full_classes_header_jarjar): $(full_classes_turbine_jar) $(LOCAL_JARJAR_RULES) | $(JARJAR)
|
|
|
|
@echo Header JarJar: $@
|
|
|
|
$(hide) $(JAVA) -jar $(JARJAR) process $(PRIVATE_JARJAR_RULES) $< $@
|
|
|
|
else
|
|
|
|
full_classes_header_jarjar := $(full_classes_turbine_jar)
|
|
|
|
endif
|
|
|
|
|
|
|
|
$(eval $(call copy-one-file,$(full_classes_header_jarjar),$(full_classes_header_jar)))
|
|
|
|
|
2017-09-27 01:17:24 +02:00
|
|
|
endif # TURBINE_ENABLED != false
|
|
|
|
|
2018-03-07 23:16:43 +01:00
|
|
|
$(full_classes_compiled_jar): PRIVATE_JAVACFLAGS := $(LOCAL_JAVACFLAGS) $(annotation_processor_flags)
|
|
|
|
$(full_classes_compiled_jar): PRIVATE_JAR_EXCLUDE_FILES := $(LOCAL_JAR_EXCLUDE_FILES)
|
|
|
|
$(full_classes_compiled_jar): PRIVATE_JAR_PACKAGES := $(LOCAL_JAR_PACKAGES)
|
|
|
|
$(full_classes_compiled_jar): PRIVATE_JAR_EXCLUDE_PACKAGES := $(LOCAL_JAR_EXCLUDE_PACKAGES)
|
|
|
|
$(full_classes_compiled_jar): PRIVATE_DONT_DELETE_JAR_META_INF := $(LOCAL_DONT_DELETE_JAR_META_INF)
|
|
|
|
$(full_classes_compiled_jar): PRIVATE_JAVA_SOURCE_LIST := $(java_source_list_file)
|
|
|
|
$(full_classes_compiled_jar): PRIVATE_ALL_JAVA_HEADER_LIBRARIES := $(full_java_header_libs)
|
2018-03-08 00:44:54 +01:00
|
|
|
$(full_classes_compiled_jar): PRIVATE_SRCJARS := $(LOCAL_SRCJARS)
|
|
|
|
$(full_classes_compiled_jar): PRIVATE_SRCJAR_LIST_FILE := $(intermediates.COMMON)/srcjar-list
|
|
|
|
$(full_classes_compiled_jar): PRIVATE_SRCJAR_INTERMEDIATES_DIR := $(intermediates.COMMON)/srcjars
|
2018-03-07 23:16:43 +01:00
|
|
|
$(full_classes_compiled_jar): \
|
|
|
|
$(java_source_list_file) \
|
|
|
|
$(full_java_header_libs) \
|
|
|
|
$(java_sources_deps) \
|
|
|
|
$(full_java_bootclasspath_libs) \
|
|
|
|
$(full_java_system_modules_deps) \
|
|
|
|
$(layers_file) \
|
|
|
|
$(annotation_processor_deps) \
|
|
|
|
$(NORMALIZE_PATH) \
|
|
|
|
$(JAR_ARGS) \
|
2018-03-16 00:26:08 +01:00
|
|
|
$(ZIPSYNC) \
|
2018-03-07 23:16:43 +01:00
|
|
|
| $(SOONG_JAVAC_WRAPPER)
|
|
|
|
@echo "Target Java: $@
|
|
|
|
$(call compile-java,$(TARGET_JAVAC),$(PRIVATE_ALL_JAVA_HEADER_LIBRARIES))
|
|
|
|
|
2016-03-24 19:00:30 +01:00
|
|
|
javac-check : $(full_classes_compiled_jar)
|
2016-09-15 15:34:42 +02:00
|
|
|
javac-check-$(LOCAL_MODULE) : $(full_classes_compiled_jar)
|
2018-07-24 10:21:12 +02:00
|
|
|
.PHONY: javac-check-$(LOCAL_MODULE)
|
2016-03-24 19:00:30 +01:00
|
|
|
|
2017-09-13 22:13:53 +02:00
|
|
|
$(full_classes_combined_jar): PRIVATE_DONT_DELETE_JAR_META_INF := $(LOCAL_DONT_DELETE_JAR_META_INF)
|
|
|
|
$(full_classes_combined_jar): $(full_classes_compiled_jar) \
|
2017-09-20 23:56:48 +02:00
|
|
|
$(jar_manifest_file) \
|
2017-09-13 22:13:53 +02:00
|
|
|
$(full_static_java_libs) | $(MERGE_ZIPS)
|
2017-09-20 23:56:48 +02:00
|
|
|
$(if $(PRIVATE_JAR_MANIFEST), $(hide) sed -e "s/%BUILD_NUMBER%/$(BUILD_NUMBER_FROM_FILE)/" \
|
|
|
|
$(PRIVATE_JAR_MANIFEST) > $(dir $@)/manifest.mf)
|
2018-02-14 19:32:48 +01:00
|
|
|
$(MERGE_ZIPS) -j --ignore-duplicates $(if $(PRIVATE_JAR_MANIFEST),-m $(dir $@)/manifest.mf) \
|
2017-09-20 23:56:48 +02:00
|
|
|
$(if $(PRIVATE_DONT_DELETE_JAR_META_INF),,-stripDir META-INF -zipToNotStrip $<) \
|
|
|
|
$@ $< $(call reverse-list,$(PRIVATE_STATIC_JAVA_LIBRARIES))
|
2017-09-13 22:13:53 +02:00
|
|
|
|
2017-05-23 01:21:49 +02:00
|
|
|
ifdef LOCAL_JAR_PROCESSOR
|
|
|
|
# LOCAL_JAR_PROCESSOR_ARGS must be evaluated here to set up the rule-local
|
|
|
|
# PRIVATE_JAR_PROCESSOR_ARGS variable, but $< and $@ are not available yet.
|
|
|
|
# Set ${in} and ${out} so they can be referenced by LOCAL_JAR_PROCESSOR_ARGS
|
|
|
|
# using deferred evaluation (LOCAL_JAR_PROCESSOR_ARGS = instead of :=).
|
2017-09-13 22:13:53 +02:00
|
|
|
in := $(full_classes_combined_jar)
|
2017-05-23 01:21:49 +02:00
|
|
|
out := $(full_classes_processed_jar).tmp
|
2017-07-14 04:25:47 +02:00
|
|
|
my_jar_processor := $(HOST_OUT_JAVA_LIBRARIES)/$(LOCAL_JAR_PROCESSOR).jar
|
|
|
|
|
2017-05-23 01:21:49 +02:00
|
|
|
$(full_classes_processed_jar): PRIVATE_JAR_PROCESSOR_ARGS := $(LOCAL_JAR_PROCESSOR_ARGS)
|
2017-07-14 04:25:47 +02:00
|
|
|
$(full_classes_processed_jar): PRIVATE_JAR_PROCESSOR := $(my_jar_processor)
|
2017-05-23 01:21:49 +02:00
|
|
|
$(full_classes_processed_jar): PRIVATE_TMP_OUT := $(out)
|
|
|
|
in :=
|
|
|
|
out :=
|
|
|
|
|
2017-09-13 22:13:53 +02:00
|
|
|
$(full_classes_processed_jar): $(full_classes_combined_jar) $(my_jar_processor)
|
2017-05-23 01:21:49 +02:00
|
|
|
@echo Processing $@ with $(PRIVATE_JAR_PROCESSOR)
|
|
|
|
$(hide) rm -f $@ $(PRIVATE_TMP_OUT)
|
2017-06-30 22:55:38 +02:00
|
|
|
$(hide) $(JAVA) -jar $(PRIVATE_JAR_PROCESSOR) $(PRIVATE_JAR_PROCESSOR_ARGS)
|
2017-05-23 01:21:49 +02:00
|
|
|
$(hide) mv $(PRIVATE_TMP_OUT) $@
|
|
|
|
|
2017-07-14 04:25:47 +02:00
|
|
|
my_jar_processor :=
|
2017-05-23 01:21:49 +02:00
|
|
|
else
|
2017-09-13 22:13:53 +02:00
|
|
|
full_classes_processed_jar := $(full_classes_combined_jar)
|
2017-05-23 01:21:49 +02:00
|
|
|
endif
|
|
|
|
|
2017-09-13 23:56:11 +02:00
|
|
|
# Run jarjar if necessary
|
|
|
|
ifneq ($(strip $(LOCAL_JARJAR_RULES)),)
|
|
|
|
$(full_classes_jarjar_jar): PRIVATE_JARJAR_RULES := $(LOCAL_JARJAR_RULES)
|
|
|
|
$(full_classes_jarjar_jar): $(full_classes_processed_jar) $(LOCAL_JARJAR_RULES) | $(JARJAR)
|
|
|
|
@echo JarJar: $@
|
|
|
|
$(hide) $(JAVA) -jar $(JARJAR) process $(PRIVATE_JARJAR_RULES) $< $@
|
|
|
|
else
|
|
|
|
full_classes_jarjar_jar := $(full_classes_processed_jar)
|
|
|
|
endif
|
|
|
|
|
2018-02-27 20:05:40 +01:00
|
|
|
$(eval $(call copy-one-file,$(full_classes_jarjar_jar),$(full_classes_jar)))
|
2017-12-23 01:51:23 +01:00
|
|
|
|
|
|
|
#######################################
|
2018-01-31 23:34:07 +01:00
|
|
|
LOCAL_FULL_CLASSES_PRE_JACOCO_JAR := $(full_classes_jar)
|
|
|
|
|
2017-12-23 01:51:23 +01:00
|
|
|
include $(BUILD_SYSTEM)/jacoco.mk
|
|
|
|
#######################################
|
|
|
|
|
2017-11-17 14:02:12 +01:00
|
|
|
# Temporarily enable --multi-dex until proguard supports v53 class files
|
|
|
|
# ( http://b/67673860 ) or we move away from proguard altogether.
|
2017-11-15 21:55:03 +01:00
|
|
|
ifdef TARGET_OPENJDK9
|
2017-10-25 03:38:01 +02:00
|
|
|
LOCAL_DX_FLAGS := $(filter-out --multi-dex,$(LOCAL_DX_FLAGS)) --multi-dex
|
|
|
|
endif
|
|
|
|
|
2018-06-06 23:46:25 +02:00
|
|
|
full_classes_pre_proguard_jar := $(LOCAL_FULL_CLASSES_JACOCO_JAR)
|
2010-02-01 18:51:23 +01:00
|
|
|
|
2017-04-06 00:30:42 +02:00
|
|
|
# Keep a copy of the jar just before proguard processing.
|
|
|
|
$(eval $(call copy-one-file,$(full_classes_pre_proguard_jar),$(intermediates.COMMON)/classes-pre-proguard.jar))
|
2015-11-09 08:47:42 +01:00
|
|
|
|
2017-03-29 21:17:36 +02:00
|
|
|
# Run proguard if necessary
|
2013-08-22 03:32:49 +02:00
|
|
|
ifdef LOCAL_PROGUARD_ENABLED
|
2017-12-28 18:43:41 +01:00
|
|
|
ifneq ($(filter-out full custom obfuscation optimization,$(LOCAL_PROGUARD_ENABLED)),)
|
2013-08-22 03:32:49 +02:00
|
|
|
$(warning while processing: $(LOCAL_MODULE))
|
|
|
|
$(error invalid value for LOCAL_PROGUARD_ENABLED: $(LOCAL_PROGUARD_ENABLED))
|
|
|
|
endif
|
2009-08-30 22:39:24 +02:00
|
|
|
proguard_dictionary := $(intermediates.COMMON)/proguard_dictionary
|
2018-04-13 15:34:20 +02:00
|
|
|
proguard_configuration := $(intermediates.COMMON)/proguard_configuration
|
2015-05-05 04:21:48 +02:00
|
|
|
|
2017-10-21 04:16:41 +02:00
|
|
|
# When an app contains references to APIs that are not in the SDK specified by
|
2018-04-10 17:16:33 +02:00
|
|
|
# its LOCAL_SDK_VERSION for example added by support library or by runtime
|
2017-10-21 04:16:41 +02:00
|
|
|
# classes added by desugar, we artifically raise the "SDK version" "linked" by
|
|
|
|
# ProGuard, to
|
2015-05-05 04:21:48 +02:00
|
|
|
# - suppress ProGuard warnings of referencing symbols unknown to the lower SDK version.
|
|
|
|
# - prevent ProGuard stripping subclass in the support library that extends class added in the higher SDK version.
|
2017-10-21 04:16:41 +02:00
|
|
|
# See b/20667396
|
|
|
|
my_proguard_sdk_raise :=
|
2015-05-05 04:21:48 +02:00
|
|
|
ifdef LOCAL_SDK_VERSION
|
|
|
|
ifdef TARGET_BUILD_APPS
|
2018-01-30 16:14:55 +01:00
|
|
|
ifeq (,$(filter current system_current test_current core_current, $(LOCAL_SDK_VERSION)))
|
2018-04-10 17:16:33 +02:00
|
|
|
my_proguard_sdk_raise := $(call java-lib-header-files, $(call resolve-prebuilt-sdk-module,current))
|
2015-06-26 21:33:06 +02:00
|
|
|
endif
|
2015-05-05 04:21:48 +02:00
|
|
|
else
|
|
|
|
# For platform build, we can't just raise to the "current" SDK,
|
|
|
|
# that would break apps that use APIs removed from the current SDK.
|
2017-10-21 04:16:41 +02:00
|
|
|
my_proguard_sdk_raise := $(call java-lib-header-files,$(TARGET_DEFAULT_BOOTCLASSPATH_LIBRARIES) $(TARGET_DEFAULT_JAVA_LIBRARIES))
|
2015-05-05 04:21:48 +02:00
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
2018-07-25 22:41:42 +02:00
|
|
|
legacy_proguard_flags := $(addprefix -libraryjars ,$(my_proguard_sdk_raise) \
|
2017-10-21 04:16:41 +02:00
|
|
|
$(filter-out $(my_proguard_sdk_raise), \
|
2017-09-24 04:52:43 +02:00
|
|
|
$(full_java_bootclasspath_libs) \
|
|
|
|
$(full_shared_java_header_libs)))
|
2017-08-31 23:43:04 +02:00
|
|
|
|
2017-10-21 04:16:41 +02:00
|
|
|
legacy_proguard_lib_deps := $(my_proguard_sdk_raise) \
|
|
|
|
$(filter-out $(my_proguard_sdk_raise),$(full_shared_java_header_libs))
|
2015-11-03 18:33:21 +01:00
|
|
|
|
|
|
|
legacy_proguard_flags += -printmapping $(proguard_dictionary)
|
2018-04-13 15:34:20 +02:00
|
|
|
legacy_proguard_flags += -printconfiguration $(proguard_configuration)
|
2015-11-03 18:33:21 +01:00
|
|
|
|
|
|
|
common_proguard_flags := -forceprocessing
|
2013-08-22 03:32:49 +02:00
|
|
|
|
2017-12-28 18:43:41 +01:00
|
|
|
common_proguard_flag_files := $(BUILD_SYSTEM)/proguard.flags
|
2013-08-22 03:32:49 +02:00
|
|
|
ifneq ($(LOCAL_INSTRUMENTATION_FOR)$(filter tests,$(LOCAL_MODULE_TAGS)),)
|
2014-09-08 14:45:14 +02:00
|
|
|
common_proguard_flags += -dontshrink # don't shrink tests by default
|
2010-02-01 18:51:23 +01:00
|
|
|
endif # test package
|
2017-11-17 22:11:26 +01:00
|
|
|
ifneq ($(LOCAL_PROGUARD_ENABLED),custom)
|
2018-05-09 22:29:51 +02:00
|
|
|
ifeq ($(LOCAL_USE_AAPT2),true)
|
2017-11-17 22:11:26 +01:00
|
|
|
common_proguard_flag_files += $(foreach l,$(LOCAL_STATIC_ANDROID_LIBRARIES),\
|
|
|
|
$(call intermediates-dir-for,JAVA_LIBRARIES,$(l),,COMMON)/export_proguard_flags)
|
|
|
|
endif
|
|
|
|
endif
|
2016-04-07 11:56:42 +02:00
|
|
|
ifneq ($(common_proguard_flag_files),)
|
|
|
|
common_proguard_flags += $(addprefix -include , $(common_proguard_flag_files))
|
|
|
|
# This is included from $(BUILD_SYSTEM)/proguard.flags
|
|
|
|
common_proguard_flag_files += $(BUILD_SYSTEM)/proguard_basic_keeps.flags
|
|
|
|
endif
|
|
|
|
|
2013-08-22 03:32:49 +02:00
|
|
|
ifeq ($(filter obfuscation,$(LOCAL_PROGUARD_ENABLED)),)
|
|
|
|
# By default no obfuscation
|
2014-09-08 14:45:14 +02:00
|
|
|
common_proguard_flags += -dontobfuscate
|
2013-08-22 03:32:49 +02:00
|
|
|
endif # No obfuscation
|
|
|
|
ifeq ($(filter optimization,$(LOCAL_PROGUARD_ENABLED)),)
|
|
|
|
# By default no optimization
|
2014-09-08 14:45:14 +02:00
|
|
|
common_proguard_flags += -dontoptimize
|
2013-08-22 03:32:49 +02:00
|
|
|
endif # No optimization
|
|
|
|
|
|
|
|
ifdef LOCAL_INSTRUMENTATION_FOR
|
|
|
|
ifeq ($(filter obfuscation,$(LOCAL_PROGUARD_ENABLED)),)
|
|
|
|
# If no obfuscation, link in the instrmented package's classes.jar as a library.
|
|
|
|
# link_instr_classes_jar is defined in base_rule.mk
|
2014-09-08 14:45:14 +02:00
|
|
|
legacy_proguard_flags += -libraryjars $(link_instr_classes_jar)
|
2017-08-31 23:43:04 +02:00
|
|
|
legacy_proguard_lib_deps += $(link_instr_classes_jar)
|
2013-08-22 03:32:49 +02:00
|
|
|
else # obfuscation
|
|
|
|
# If obfuscation is enabled, the main app must be obfuscated too.
|
|
|
|
# We need to run obfuscation using the main app's dictionary,
|
|
|
|
# and treat the main app's class.jar as injars instead of libraryjars.
|
2014-09-08 14:45:14 +02:00
|
|
|
legacy_proguard_flags := -injars $(link_instr_classes_jar) \
|
2013-08-22 03:32:49 +02:00
|
|
|
-outjars $(intermediates.COMMON)/proguard.$(LOCAL_INSTRUMENTATION_FOR).jar \
|
|
|
|
-include $(link_instr_intermediates_dir.COMMON)/proguard_options \
|
|
|
|
-applymapping $(link_instr_intermediates_dir.COMMON)/proguard_dictionary \
|
|
|
|
-verbose \
|
2014-09-08 14:45:14 +02:00
|
|
|
$(legacy_proguard_flags)
|
2018-07-25 22:40:05 +02:00
|
|
|
legacy_proguard_lib_deps += \
|
|
|
|
$(link_instr_classes_jar) \
|
|
|
|
$(link_instr_intermediates_dir.COMMON)/proguard_options \
|
|
|
|
$(link_instr_intermediates_dir.COMMON)/proguard_dictionary \
|
2013-08-22 03:32:49 +02:00
|
|
|
|
|
|
|
# Sometimes (test + main app) uses different keep rules from the main app -
|
|
|
|
# apply the main app's dictionary anyway.
|
2014-09-08 14:45:14 +02:00
|
|
|
legacy_proguard_flags += -ignorewarnings
|
2013-08-22 03:32:49 +02:00
|
|
|
|
|
|
|
endif # no obfuscation
|
|
|
|
endif # LOCAL_INSTRUMENTATION_FOR
|
2009-08-30 22:39:24 +02:00
|
|
|
|
2010-09-29 23:50:41 +02:00
|
|
|
proguard_flag_files := $(addprefix $(LOCAL_PATH)/, $(LOCAL_PROGUARD_FLAG_FILES))
|
2017-10-12 16:09:13 +02:00
|
|
|
proguard_flag_files += $(addprefix $(LOCAL_PATH)/, $(LOCAL_R8_FLAG_FILES))
|
2010-09-29 23:50:41 +02:00
|
|
|
LOCAL_PROGUARD_FLAGS += $(addprefix -include , $(proguard_flag_files))
|
|
|
|
|
2014-02-07 16:18:59 +01:00
|
|
|
ifdef LOCAL_TEST_MODULE_TO_PROGUARD_WITH
|
|
|
|
extra_input_jar := $(call intermediates-dir-for,APPS,$(LOCAL_TEST_MODULE_TO_PROGUARD_WITH),,COMMON)/classes.jar
|
|
|
|
else
|
|
|
|
extra_input_jar :=
|
|
|
|
endif
|
2017-02-21 14:11:13 +01:00
|
|
|
|
2017-09-26 08:36:19 +02:00
|
|
|
ifneq ($(filter obfuscation,$(LOCAL_PROGUARD_ENABLED)),)
|
2018-04-13 15:34:20 +02:00
|
|
|
$(built_dex_intermediate): .KATI_IMPLICIT_OUTPUTS := $(proguard_dictionary) $(proguard_configuration)
|
2017-10-25 17:10:59 +02:00
|
|
|
endif
|
2010-02-01 18:51:23 +01:00
|
|
|
|
2013-08-22 03:32:49 +02:00
|
|
|
else # LOCAL_PROGUARD_ENABLED not defined
|
2017-11-06 07:35:52 +01:00
|
|
|
proguard_flag_files :=
|
2013-08-22 03:32:49 +02:00
|
|
|
endif # LOCAL_PROGUARD_ENABLED defined
|
|
|
|
|
2017-04-06 18:56:19 +02:00
|
|
|
ifneq ($(LOCAL_IS_STATIC_JAVA_LIBRARY),true)
|
2016-12-21 23:29:13 +01:00
|
|
|
$(built_dex_intermediate): PRIVATE_DX_FLAGS := $(LOCAL_DX_FLAGS)
|
2017-10-12 16:09:13 +02:00
|
|
|
|
|
|
|
ifdef LOCAL_PROGUARD_ENABLED
|
2018-07-25 22:41:42 +02:00
|
|
|
$(built_dex_intermediate): PRIVATE_EXTRA_INPUT_JAR := $(extra_input_jar)
|
|
|
|
$(built_dex_intermediate): PRIVATE_PROGUARD_FLAGS := $(legacy_proguard_flags) $(common_proguard_flags) $(LOCAL_PROGUARD_FLAGS)
|
2018-08-23 11:17:17 +02:00
|
|
|
$(built_dex_intermediate): PRIVATE_PROGUARD_DICTIONARY := $(proguard_dictionary)
|
2018-07-25 22:41:42 +02:00
|
|
|
$(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)
|
2017-10-12 16:09:13 +02:00
|
|
|
$(transform-jar-to-dex-r8)
|
2018-07-25 22:41:42 +02:00
|
|
|
else # !LOCAL_PROGUARD_ENABLED
|
2018-09-21 21:36:53 +02:00
|
|
|
$(built_dex_intermediate): PRIVATE_D8_LIBS := $(full_java_bootclasspath_libs) $(full_shared_java_header_libs)
|
|
|
|
$(built_dex_intermediate): $(full_java_bootclasspath_libs) $(full_shared_java_header_libs)
|
2018-07-25 22:41:42 +02:00
|
|
|
$(built_dex_intermediate): $(full_classes_pre_proguard_jar) $(DX) $(ZIP2ZIP)
|
2016-12-21 23:29:13 +01:00
|
|
|
$(transform-classes.jar-to-dex)
|
2017-10-12 16:09:13 +02:00
|
|
|
endif
|
2016-12-21 23:29:13 +01:00
|
|
|
|
2018-01-29 15:43:14 +01:00
|
|
|
ifneq ($(filter $(LOCAL_MODULE),$(PRODUCT_BOOT_JARS)),) # is_boot_jar
|
2018-07-11 16:14:00 +02:00
|
|
|
# Derive API greylist from the classes jar.
|
2018-07-25 22:41:42 +02:00
|
|
|
# We use full_classes_pre_proguard_jar here, as that is what is converted to
|
|
|
|
# dex later on. The difference is academic currently, as we don't proguard any
|
2018-07-11 16:14:00 +02:00
|
|
|
# bootclasspath code at the moment. If we were to do that, we should add keep
|
|
|
|
# rules for all members with the @UnsupportedAppUsage annotation.
|
2018-10-30 19:24:06 +01:00
|
|
|
$(eval $(call hiddenapi-generate-csv, $(full_classes_pre_proguard_jar),$(hiddenapi_flags_csv),$(hiddenapi_metadata_csv)))
|
|
|
|
LOCAL_INTERMEDIATE_TARGETS += $(hiddenapi_flags_csv) $(hiddenapi_metadata_csv)
|
2018-01-29 15:43:14 +01:00
|
|
|
$(eval $(call hiddenapi-copy-dex-files,$(built_dex_intermediate),$(built_dex_hiddenapi)))
|
|
|
|
built_dex_copy_from := $(built_dex_hiddenapi)
|
|
|
|
else # !is_boot_jar
|
|
|
|
built_dex_copy_from := $(built_dex_intermediate)
|
|
|
|
endif # is_boot_jar
|
|
|
|
|
|
|
|
$(built_dex): $(built_dex_copy_from)
|
2010-03-11 00:48:03 +01:00
|
|
|
@echo Copying: $@
|
2013-08-20 17:05:27 +02:00
|
|
|
$(hide) mkdir -p $(dir $@)
|
|
|
|
$(hide) rm -f $(dir $@)/classes*.dex
|
2017-03-29 21:17:36 +02:00
|
|
|
$(hide) cp -fp $(dir $<)/classes*.dex $(dir $@)
|
2009-03-04 04:28:42 +01:00
|
|
|
|
2017-04-28 00:05:44 +02:00
|
|
|
java-dex: $(built_dex)
|
|
|
|
|
2017-04-06 18:56:19 +02:00
|
|
|
endif # !LOCAL_IS_STATIC_JAVA_LIBRARY
|
|
|
|
|
2009-03-04 04:28:42 +01:00
|
|
|
findbugs_xml := $(intermediates.COMMON)/findbugs.xml
|
2015-10-21 19:30:51 +02:00
|
|
|
$(findbugs_xml): PRIVATE_AUXCLASSPATH := $(addprefix -auxclasspath ,$(strip \
|
|
|
|
$(call normalize-path-list,$(filter %.jar,$(full_java_libs)))))
|
|
|
|
$(findbugs_xml): PRIVATE_FINDBUGS_FLAGS := $(LOCAL_FINDBUGS_FLAGS)
|
2017-04-06 00:30:42 +02:00
|
|
|
$(findbugs_xml) : $(full_classes_pre_proguard_jar) $(filter %.xml, $(LOCAL_FINDBUGS_FLAGS))
|
2009-03-04 04:28:42 +01:00
|
|
|
@echo Findbugs: $@
|
|
|
|
$(hide) $(FINDBUGS) -textui -effort:min -xml:withMessages \
|
2015-10-21 19:30:51 +02:00
|
|
|
$(PRIVATE_AUXCLASSPATH) $(PRIVATE_FINDBUGS_FLAGS) \
|
2015-02-05 16:10:58 +01:00
|
|
|
$< \
|
2009-03-04 04:28:42 +01:00
|
|
|
> $@
|
|
|
|
|
|
|
|
ALL_FINDBUGS_FILES += $(findbugs_xml)
|
|
|
|
|
|
|
|
findbugs_html := $(PRODUCT_OUT)/findbugs/$(LOCAL_MODULE).html
|
|
|
|
$(findbugs_html) : PRIVATE_XML_FILE := $(findbugs_xml)
|
|
|
|
$(LOCAL_MODULE)-findbugs : $(findbugs_html)
|
2018-07-24 10:21:12 +02:00
|
|
|
.PHONY: $(LOCAL_MODULE)-findbugs
|
2009-03-04 04:28:42 +01:00
|
|
|
$(findbugs_html) : $(findbugs_xml)
|
|
|
|
@mkdir -p $(dir $@)
|
2009-05-13 09:44:59 +02:00
|
|
|
@echo ConvertXmlToText: $@
|
2014-05-20 10:04:16 +02:00
|
|
|
$(hide) $(FINDBUGS_DIR)/convertXmlToText -html:fancy.xsl $(PRIVATE_XML_FILE) \
|
2009-03-04 04:28:42 +01:00
|
|
|
> $@
|
|
|
|
|
|
|
|
$(LOCAL_MODULE)-findbugs : $(findbugs_html)
|
|
|
|
|
2013-08-28 22:04:46 +02:00
|
|
|
endif # full_classes_jar is defined
|
2014-09-08 14:45:14 +02:00
|
|
|
|
2018-01-30 16:14:55 +01:00
|
|
|
ifneq (,$(filter-out current system_current test_current core_current, $(LOCAL_SDK_VERSION)))
|
2017-10-16 12:20:34 +02:00
|
|
|
my_default_app_target_sdk := $(call get-numeric-sdk-version,$(LOCAL_SDK_VERSION))
|
|
|
|
my_sdk_version := $(call get-numeric-sdk-version,$(LOCAL_SDK_VERSION))
|
2017-09-29 01:17:36 +02:00
|
|
|
else
|
|
|
|
my_default_app_target_sdk := $(DEFAULT_APP_TARGET_SDK)
|
|
|
|
my_sdk_version := $(PLATFORM_SDK_VERSION)
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifdef LOCAL_MIN_SDK_VERSION
|
|
|
|
my_min_sdk_version := $(LOCAL_MIN_SDK_VERSION)
|
2017-02-22 01:14:55 +01:00
|
|
|
else
|
2017-09-29 01:17:36 +02:00
|
|
|
my_min_sdk_version := $(call codename-or-sdk-to-sdk,$(my_default_app_target_sdk))
|
2017-02-22 01:14:55 +01:00
|
|
|
endif
|
|
|
|
|
2017-09-29 01:17:36 +02:00
|
|
|
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_DEFAULT_APP_TARGET_SDK := $(my_default_app_target_sdk)
|
|
|
|
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_SDK_VERSION := $(my_sdk_version)
|
|
|
|
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_MIN_SDK_VERSION := $(my_min_sdk_version)
|