2015-08-29 02:47:03 +08:00
|
|
|
# Target Java.
|
2009-03-04 11:28:42 +08:00
|
|
|
# Requires:
|
|
|
|
# LOCAL_MODULE_SUFFIX
|
|
|
|
# LOCAL_MODULE_CLASS
|
|
|
|
# all_res_assets
|
|
|
|
|
2012-04-20 06:36:18 +08:00
|
|
|
ifeq ($(TARGET_BUILD_PDK),true)
|
2012-06-07 08:19:29 +08:00
|
|
|
ifeq ($(TARGET_BUILD_PDK_JAVA_PLATFORM),)
|
2012-04-20 06:36:18 +08:00
|
|
|
# LOCAL_SDK not defined or set to current
|
|
|
|
ifeq ($(filter-out current,$(LOCAL_SDK_VERSION)),)
|
2014-10-18 09:26:39 +08:00
|
|
|
ifneq ($(LOCAL_NO_STANDARD_LIBRARIES),true)
|
2012-04-20 06:36:18 +08:00
|
|
|
LOCAL_SDK_VERSION := $(PDK_BUILD_SDK_VERSION)
|
2014-10-18 09:26:39 +08:00
|
|
|
endif #!LOCAL_NO_STANDARD_LIBRARIES
|
2012-04-20 06:36:18 +08:00
|
|
|
endif
|
2012-05-17 01:32:41 +08:00
|
|
|
endif # !PDK_JAVA
|
2012-04-20 06:36:18 +08:00
|
|
|
endif #PDK
|
|
|
|
|
2009-03-04 11:28:42 +08:00
|
|
|
LOCAL_NO_STANDARD_LIBRARIES:=$(strip $(LOCAL_NO_STANDARD_LIBRARIES))
|
|
|
|
LOCAL_SDK_VERSION:=$(strip $(LOCAL_SDK_VERSION))
|
|
|
|
|
2017-09-15 05:58:02 +08:00
|
|
|
ifneq ($(LOCAL_MODULE),jacocoagent)
|
|
|
|
ifneq ($(LOCAL_NO_STANDARD_LIBRARIES),true)
|
|
|
|
ifeq ($(EMMA_INSTRUMENT),true)
|
|
|
|
ifneq ($(EMMA_INSTRUMENT_STATIC),true)
|
|
|
|
# For instrumented build, if Jacoco is not being included statically
|
|
|
|
# in instrumented packages then include Jacoco classes into the
|
|
|
|
# bootclasspath.
|
|
|
|
LOCAL_JAVA_LIBRARIES := jacocoagent $(LOCAL_JAVA_LIBRARIES)
|
|
|
|
endif # EMMA_INSTRUMENT_STATIC
|
|
|
|
endif # EMMA_INSTRUMENT
|
|
|
|
endif # !LOCAL_NO_STANDARD_LIBRARIES
|
|
|
|
endif # LOCAL_MODULE == jacocoagent
|
|
|
|
|
2009-03-04 11:28:42 +08:00
|
|
|
ifneq ($(LOCAL_SDK_VERSION),)
|
|
|
|
ifeq ($(LOCAL_NO_STANDARD_LIBRARIES),true)
|
|
|
|
$(error $(LOCAL_PATH): Must not define both LOCAL_NO_STANDARD_LIBRARIES and LOCAL_SDK_VERSION)
|
|
|
|
else
|
|
|
|
ifeq ($(strip $(filter $(LOCAL_SDK_VERSION),$(TARGET_AVAILABLE_SDK_VERSIONS))),)
|
|
|
|
$(error $(LOCAL_PATH): Invalid LOCAL_SDK_VERSION '$(LOCAL_SDK_VERSION)' \
|
|
|
|
Choices are: $(TARGET_AVAILABLE_SDK_VERSIONS))
|
|
|
|
else
|
2012-05-11 08:25:51 +08:00
|
|
|
ifeq ($(LOCAL_SDK_VERSION)$(TARGET_BUILD_APPS),current)
|
|
|
|
# Use android_stubs_current if LOCAL_SDK_VERSION is current and no TARGET_BUILD_APPS.
|
2012-04-03 09:21:36 +08:00
|
|
|
LOCAL_JAVA_LIBRARIES := android_stubs_current $(LOCAL_JAVA_LIBRARIES)
|
2014-07-20 08:00:50 +08:00
|
|
|
else ifeq ($(LOCAL_SDK_VERSION)$(TARGET_BUILD_APPS),system_current)
|
|
|
|
LOCAL_JAVA_LIBRARIES := android_system_stubs_current $(LOCAL_JAVA_LIBRARIES)
|
2015-11-06 23:20:51 +08:00
|
|
|
else ifeq ($(LOCAL_SDK_VERSION)$(TARGET_BUILD_APPS),test_current)
|
|
|
|
LOCAL_JAVA_LIBRARIES := android_test_stubs_current $(LOCAL_JAVA_LIBRARIES)
|
2010-01-26 01:56:41 +08:00
|
|
|
else
|
|
|
|
LOCAL_JAVA_LIBRARIES := sdk_v$(LOCAL_SDK_VERSION) $(LOCAL_JAVA_LIBRARIES)
|
2016-03-17 00:18:32 +08:00
|
|
|
endif
|
|
|
|
|
|
|
|
ifeq ($(LOCAL_SDK_VERSION),current)
|
|
|
|
my_jack_min_sdk_version := $(PLATFORM_JACK_MIN_SDK_VERSION)
|
|
|
|
else ifeq ($(LOCAL_SDK_VERSION),system_current)
|
|
|
|
my_jack_min_sdk_version := $(PLATFORM_JACK_MIN_SDK_VERSION)
|
|
|
|
else ifeq ($(LOCAL_SDK_VERSION),test_current)
|
|
|
|
my_jack_min_sdk_version := $(PLATFORM_JACK_MIN_SDK_VERSION)
|
|
|
|
else
|
2016-03-10 00:19:58 +08:00
|
|
|
my_jack_min_sdk_version := $(LOCAL_SDK_VERSION)
|
2010-01-26 01:56:41 +08:00
|
|
|
endif
|
2009-03-04 11:28:42 +08:00
|
|
|
endif
|
|
|
|
endif
|
|
|
|
else
|
2016-03-10 00:19:58 +08:00
|
|
|
my_jack_min_sdk_version := $(PLATFORM_JACK_MIN_SDK_VERSION)
|
2009-03-04 11:28:42 +08:00
|
|
|
ifneq ($(LOCAL_NO_STANDARD_LIBRARIES),true)
|
2013-08-07 06:07:18 +08:00
|
|
|
LOCAL_JAVA_LIBRARIES := $(TARGET_DEFAULT_JAVA_LIBRARIES) $(LOCAL_JAVA_LIBRARIES)
|
2009-03-04 11:28:42 +08:00
|
|
|
endif
|
|
|
|
endif
|
2010-11-03 09:43:16 +08:00
|
|
|
|
2016-04-15 03:51:46 +08:00
|
|
|
ifneq (,$(strip $(LOCAL_MIN_SDK_VERSION)))
|
|
|
|
my_jack_min_sdk_version := $(LOCAL_MIN_SDK_VERSION)
|
|
|
|
endif
|
|
|
|
|
2010-11-03 09:43:16 +08:00
|
|
|
proto_sources := $(filter %.proto,$(LOCAL_SRC_FILES))
|
|
|
|
ifneq ($(proto_sources),)
|
|
|
|
ifeq ($(LOCAL_PROTOC_OPTIMIZE_TYPE),micro)
|
2014-09-16 08:51:11 +08:00
|
|
|
LOCAL_STATIC_JAVA_LIBRARIES += libprotobuf-java-micro
|
2010-11-03 09:43:16 +08:00
|
|
|
else
|
2013-03-29 05:02:14 +08:00
|
|
|
ifeq ($(LOCAL_PROTOC_OPTIMIZE_TYPE),nano)
|
2014-09-16 08:51:11 +08:00
|
|
|
LOCAL_STATIC_JAVA_LIBRARIES += libprotobuf-java-nano
|
2013-03-29 05:02:14 +08:00
|
|
|
else
|
2016-10-06 09:01:10 +08:00
|
|
|
ifeq ($(LOCAL_PROTOC_OPTIMIZE_TYPE),stream)
|
|
|
|
# No library for stream protobufs
|
|
|
|
else
|
|
|
|
LOCAL_STATIC_JAVA_LIBRARIES += libprotobuf-java-lite
|
|
|
|
endif
|
2013-03-29 05:02:14 +08:00
|
|
|
endif
|
2010-11-03 09:43:16 +08:00
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
2016-02-25 06:11:55 +08: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 11:28:42 +08: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-18 03:33:40 +08: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)
|
|
|
|
|
2016-12-22 06:29:13 +08:00
|
|
|
# Choose leaf name for the compiled jar file.
|
|
|
|
ifeq ($(LOCAL_EMMA_INSTRUMENT),true)
|
|
|
|
full_classes_compiled_jar_leaf := classes-no-debug-var.jar
|
|
|
|
built_dex_intermediate_leaf := no-local
|
|
|
|
else
|
|
|
|
full_classes_compiled_jar_leaf := classes-full-debug.jar
|
|
|
|
built_dex_intermediate_leaf := with-local
|
|
|
|
endif
|
|
|
|
|
2010-09-24 02:48:38 +08:00
|
|
|
ifeq ($(LOCAL_PROGUARD_ENABLED),disabled)
|
|
|
|
LOCAL_PROGUARD_ENABLED :=
|
2009-07-18 03:33:40 +08:00
|
|
|
endif
|
|
|
|
|
2017-09-01 05:43:04 +08: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
|
2016-12-22 06:29:13 +08:00
|
|
|
full_classes_compiled_jar := $(intermediates.COMMON)/$(full_classes_compiled_jar_leaf)
|
2017-05-23 07:21:49 +08:00
|
|
|
full_classes_processed_jar := $(intermediates.COMMON)/classes-processed.jar
|
2017-04-06 06:30:42 +08:00
|
|
|
full_classes_desugar_jar := $(intermediates.COMMON)/classes-desugar.jar
|
2016-12-22 06:29:13 +08:00
|
|
|
jarjar_leaf := classes-jarjar.jar
|
|
|
|
full_classes_jarjar_jar := $(intermediates.COMMON)/$(jarjar_leaf)
|
2017-04-06 06:30:42 +08:00
|
|
|
full_classes_proguard_jar := $(intermediates.COMMON)/classes-proguard.jar
|
2017-09-14 04:13:53 +08:00
|
|
|
full_classes_combined_jar := $(intermediates.COMMON)/classes-combined.jar
|
2016-12-22 06:29:13 +08:00
|
|
|
built_dex_intermediate := $(intermediates.COMMON)/$(built_dex_intermediate_leaf)/classes.dex
|
2010-09-24 02:48:38 +08:00
|
|
|
full_classes_stubs_jar := $(intermediates.COMMON)/stubs.jar
|
2017-05-27 06:22:02 +08:00
|
|
|
java_source_list_file := $(intermediates.COMMON)/java-source-list
|
|
|
|
|
2010-09-24 02:48:38 +08:00
|
|
|
|
2013-08-29 08:28:36 +08: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-29 04:04:46 +08:00
|
|
|
full_classes_jar :=
|
|
|
|
built_dex :=
|
|
|
|
else
|
2010-09-24 02:48:38 +08:00
|
|
|
full_classes_jar := $(intermediates.COMMON)/classes.jar
|
2013-09-13 08:35:21 +08:00
|
|
|
built_dex := $(intermediates.COMMON)/classes.dex
|
2013-08-29 04:04:46 +08:00
|
|
|
endif
|
2014-09-08 20:45:14 +08:00
|
|
|
# final Jack library, shrinked and obfuscated if it must be
|
|
|
|
full_classes_jack := $(intermediates.COMMON)/classes.jack
|
|
|
|
# intermediate Jack library without shrink and obfuscation
|
|
|
|
noshrob_classes_jack := $(intermediates.COMMON)/classes.noshrob.jack
|
2015-08-19 01:18:18 +08:00
|
|
|
jack_check_timestamp := $(intermediates.COMMON)/jack.check.timestamp
|
2009-07-18 03:33:40 +08:00
|
|
|
|
|
|
|
LOCAL_INTERMEDIATE_TARGETS += \
|
2017-09-01 05:43:04 +08:00
|
|
|
$(full_classes_turbine_jar) \
|
2009-07-18 03:33:40 +08:00
|
|
|
$(full_classes_compiled_jar) \
|
2016-12-22 09:11:03 +08:00
|
|
|
$(full_classes_desugar_jar) \
|
2010-09-24 02:48:38 +08:00
|
|
|
$(full_classes_jarjar_jar) \
|
|
|
|
$(full_classes_jar) \
|
2017-09-14 04:13:53 +08:00
|
|
|
$(full_classes_combined_jar) \
|
2010-10-03 09:35:51 +08:00
|
|
|
$(full_classes_proguard_jar) \
|
2010-09-24 02:48:38 +08:00
|
|
|
$(built_dex_intermediate) \
|
2014-09-08 20:45:14 +08:00
|
|
|
$(full_classes_jack) \
|
|
|
|
$(noshrob_classes_jack) \
|
2015-08-19 01:18:18 +08:00
|
|
|
$(jack_check_timestamp) \
|
2010-03-11 07:48:03 +08:00
|
|
|
$(built_dex) \
|
2017-05-27 06:22:02 +08:00
|
|
|
$(full_classes_stubs_jar) \
|
|
|
|
$(java_source_list_file)
|
2010-09-24 02:48:38 +08:00
|
|
|
|
2010-05-18 09:16:11 +08:00
|
|
|
LOCAL_INTERMEDIATE_SOURCE_DIR := $(intermediates.COMMON)/src
|
2009-07-18 03:33:40 +08:00
|
|
|
|
2010-07-16 08:17:52 +08:00
|
|
|
###############################################################
|
|
|
|
## .rs files: RenderScript sources to .java files and .bc files
|
2012-10-12 06:01:53 +08:00
|
|
|
## .fs files: Filterscript sources to .java files and .bc files
|
2010-07-16 08:17:52 +08:00
|
|
|
###############################################################
|
2012-10-12 06:01:53 +08:00
|
|
|
renderscript_sources := $(filter %.rs %.fs,$(LOCAL_SRC_FILES))
|
2010-07-16 08:17:52 +08:00
|
|
|
# Because names of the java files from RenderScript are unknown until the
|
|
|
|
# .rs file(s) are compiled, we have to depend on a timestamp file.
|
|
|
|
RenderScript_file_stamp :=
|
2015-12-05 05:59:18 +08:00
|
|
|
rs_generated_res_dir :=
|
2013-02-07 08:19:30 +08:00
|
|
|
rs_compatibility_jni_libs :=
|
2010-07-16 08:17:52 +08:00
|
|
|
ifneq ($(renderscript_sources),)
|
|
|
|
renderscript_sources_fullpath := $(addprefix $(LOCAL_PATH)/, $(renderscript_sources))
|
|
|
|
RenderScript_file_stamp := $(LOCAL_INTERMEDIATE_SOURCE_DIR)/RenderScript.stamp
|
2016-12-22 09:37:00 +08:00
|
|
|
renderscript_intermediate.COMMON := $(intermediates.COMMON)/renderscript
|
2010-07-16 08:17:52 +08:00
|
|
|
|
2015-07-29 08:43:51 +08:00
|
|
|
# Defaulting to an empty string uses the latest available platform SDK.
|
2011-08-11 04:53:05 +08:00
|
|
|
renderscript_target_api :=
|
2011-08-30 09:53:53 +08:00
|
|
|
|
|
|
|
ifneq (,$(LOCAL_RENDERSCRIPT_TARGET_API))
|
2015-07-29 08:43:51 +08:00
|
|
|
renderscript_target_api := $(LOCAL_RENDERSCRIPT_TARGET_API)
|
2011-08-30 09:53:53 +08:00
|
|
|
else
|
2015-07-29 08:43:51 +08:00
|
|
|
ifneq (,$(LOCAL_SDK_VERSION))
|
|
|
|
# Set target-api for LOCAL_SDK_VERSIONs other than current.
|
2015-11-06 23:20:51 +08:00
|
|
|
ifneq (,$(filter-out current system_current test_current, $(LOCAL_SDK_VERSION)))
|
2015-07-29 08:43:51 +08:00
|
|
|
renderscript_target_api := $(LOCAL_SDK_VERSION)
|
|
|
|
endif
|
|
|
|
endif # LOCAL_SDK_VERSION is set
|
2011-08-30 09:53:53 +08:00
|
|
|
endif # LOCAL_RENDERSCRIPT_TARGET_API is set
|
2011-08-11 04:53:05 +08:00
|
|
|
|
2015-07-30 02:46:23 +08:00
|
|
|
# For 64-bit, we always have to upgrade to at least 21 for compat build.
|
|
|
|
ifneq ($(LOCAL_RENDERSCRIPT_COMPATIBILITY),)
|
|
|
|
ifeq ($(TARGET_IS_64_BIT),true)
|
|
|
|
ifneq ($(filter $(RSCOMPAT_32BIT_ONLY_API_LEVELS),$(renderscript_target_api)),)
|
|
|
|
renderscript_target_api := 21
|
|
|
|
endif
|
2015-07-29 08:43:51 +08:00
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
2011-08-11 04:53:05 +08:00
|
|
|
ifeq ($(LOCAL_RENDERSCRIPT_CC),)
|
|
|
|
LOCAL_RENDERSCRIPT_CC := $(LLVM_RS_CC)
|
|
|
|
endif
|
|
|
|
|
2011-12-07 10:43:24 +08:00
|
|
|
# Turn on all warnings and warnings as errors for RS compiles.
|
|
|
|
# This can be disabled with LOCAL_RENDERSCRIPT_FLAGS := -Wno-error
|
|
|
|
renderscript_flags := -Wall -Werror
|
|
|
|
renderscript_flags += $(LOCAL_RENDERSCRIPT_FLAGS)
|
|
|
|
|
2010-09-02 04:28:52 +08:00
|
|
|
# prepend the RenderScript system include path
|
2015-11-06 23:20:51 +08:00
|
|
|
ifneq ($(filter-out current system_current test_current,$(LOCAL_SDK_VERSION))$(if $(TARGET_BUILD_APPS),$(filter current system_current test_current,$(LOCAL_SDK_VERSION))),)
|
2012-05-11 08:25:51 +08:00
|
|
|
# if a numeric LOCAL_SDK_VERSION, or current LOCAL_SDK_VERSION with TARGET_BUILD_APPS
|
2011-03-30 02:47:12 +08:00
|
|
|
LOCAL_RENDERSCRIPT_INCLUDES := \
|
2012-03-07 13:48:36 +08:00
|
|
|
$(HISTORICAL_SDK_VERSIONS_ROOT)/renderscript/clang-include \
|
|
|
|
$(HISTORICAL_SDK_VERSIONS_ROOT)/renderscript/include \
|
2011-03-30 02:47:12 +08:00
|
|
|
$(LOCAL_RENDERSCRIPT_INCLUDES)
|
|
|
|
else
|
2011-01-20 03:49:21 +08:00
|
|
|
LOCAL_RENDERSCRIPT_INCLUDES := \
|
2011-08-11 04:53:05 +08:00
|
|
|
$(TOPDIR)external/clang/lib/Headers \
|
2017-01-09 09:40:21 +08:00
|
|
|
$(TOPDIR)frameworks/rs/script_api/include \
|
2011-08-11 04:53:05 +08:00
|
|
|
$(LOCAL_RENDERSCRIPT_INCLUDES)
|
2011-05-26 08:16:22 +08:00
|
|
|
endif
|
|
|
|
|
2011-08-24 13:01:49 +08:00
|
|
|
ifneq ($(LOCAL_RENDERSCRIPT_INCLUDES_OVERRIDE),)
|
|
|
|
LOCAL_RENDERSCRIPT_INCLUDES := $(LOCAL_RENDERSCRIPT_INCLUDES_OVERRIDE)
|
|
|
|
endif
|
|
|
|
|
2015-04-04 07:15:28 +08:00
|
|
|
bc_files := $(patsubst %.fs,%.bc, $(patsubst %.rs,%.bc, $(notdir $(renderscript_sources))))
|
|
|
|
bc_dep_files := $(addprefix $(renderscript_intermediate.COMMON)/,$(patsubst %.bc,%.d,$(bc_files)))
|
|
|
|
|
2010-09-02 04:28:52 +08:00
|
|
|
$(RenderScript_file_stamp): PRIVATE_RS_INCLUDES := $(LOCAL_RENDERSCRIPT_INCLUDES)
|
2011-05-26 08:16:22 +08:00
|
|
|
$(RenderScript_file_stamp): PRIVATE_RS_CC := $(LOCAL_RENDERSCRIPT_CC)
|
2011-12-07 10:43:24 +08:00
|
|
|
$(RenderScript_file_stamp): PRIVATE_RS_FLAGS := $(renderscript_flags)
|
2010-07-16 08:17:52 +08:00
|
|
|
$(RenderScript_file_stamp): PRIVATE_RS_SOURCE_FILES := $(renderscript_sources_fullpath)
|
|
|
|
# By putting the generated java files into $(LOCAL_INTERMEDIATE_SOURCE_DIR), they will be
|
|
|
|
# automatically found by the java compiling function transform-java-to-classes.jar.
|
2013-02-26 08:06:42 +08:00
|
|
|
$(RenderScript_file_stamp): PRIVATE_RS_OUTPUT_DIR := $(renderscript_intermediate.COMMON)
|
2011-08-11 04:53:05 +08:00
|
|
|
$(RenderScript_file_stamp): PRIVATE_RS_TARGET_API := $(renderscript_target_api)
|
2015-04-04 07:15:28 +08:00
|
|
|
$(RenderScript_file_stamp): PRIVATE_DEP_FILES := $(bc_dep_files)
|
2011-05-26 08:16:22 +08:00
|
|
|
$(RenderScript_file_stamp): $(renderscript_sources_fullpath) $(LOCAL_RENDERSCRIPT_CC)
|
2010-07-16 08:17:52 +08:00
|
|
|
$(transform-renderscripts-to-java-and-bc)
|
|
|
|
|
2015-04-04 07:15:28 +08:00
|
|
|
# include the dependency files (.d/.P) generated by llvm-rs-cc.
|
2016-02-01 16:59:01 +08:00
|
|
|
$(call include-depfile,$(RenderScript_file_stamp).P,$(RenderScript_file_stamp))
|
2015-04-04 00:53:41 +08:00
|
|
|
|
2012-11-29 08:52:41 +08:00
|
|
|
ifneq ($(LOCAL_RENDERSCRIPT_COMPATIBILITY),)
|
2015-01-08 10:18:41 +08:00
|
|
|
|
|
|
|
|
|
|
|
ifeq ($(filter $(RSCOMPAT_32BIT_ONLY_API_LEVELS),$(renderscript_target_api)),)
|
|
|
|
ifeq ($(TARGET_IS_64_BIT),true)
|
|
|
|
renderscript_intermediate.bc_folder := $(renderscript_intermediate.COMMON)/res/raw/bc64/
|
|
|
|
else
|
|
|
|
renderscript_intermediate.bc_folder := $(renderscript_intermediate.COMMON)/res/raw/bc32/
|
|
|
|
endif
|
|
|
|
else
|
|
|
|
renderscript_intermediate.bc_folder := $(renderscript_intermediate.COMMON)/res/raw/
|
|
|
|
endif
|
|
|
|
|
2012-11-29 08:52:41 +08:00
|
|
|
rs_generated_bc := $(addprefix \
|
2015-01-08 10:18:41 +08:00
|
|
|
$(renderscript_intermediate.bc_folder), $(bc_files))
|
2012-11-29 08:52:41 +08:00
|
|
|
|
2013-02-26 08:06:42 +08:00
|
|
|
renderscript_intermediate := $(intermediates)/renderscript
|
2013-05-14 06:46:37 +08:00
|
|
|
|
|
|
|
# We don't need the .so files in bundled branches
|
|
|
|
# Prevent these from showing up on the device
|
2015-02-13 08:22:59 +08:00
|
|
|
# One exception is librsjni.so, which is needed for
|
|
|
|
# both native path and compat path.
|
|
|
|
rs_jni_lib := $(TARGET_OUT_INTERMEDIATE_LIBRARIES)/librsjni.so
|
|
|
|
LOCAL_JNI_SHARED_LIBRARIES += librsjni
|
|
|
|
|
2013-10-01 06:57:36 +08:00
|
|
|
ifneq (,$(TARGET_BUILD_APPS)$(FORCE_BUILD_RS_COMPAT))
|
2013-05-14 06:46:37 +08:00
|
|
|
|
2012-11-29 08:52:41 +08:00
|
|
|
rs_compatibility_jni_libs := $(addprefix \
|
2013-02-16 15:02:20 +08:00
|
|
|
$(renderscript_intermediate)/librs., \
|
2012-11-29 08:52:41 +08:00
|
|
|
$(patsubst %.bc,%.so, $(bc_files)))
|
|
|
|
|
|
|
|
$(rs_generated_bc) : $(RenderScript_file_stamp)
|
|
|
|
|
2012-12-18 06:23:14 +08:00
|
|
|
rs_support_lib := $(TARGET_OUT_INTERMEDIATE_LIBRARIES)/libRSSupport.so
|
2015-02-13 08:22:59 +08:00
|
|
|
LOCAL_JNI_SHARED_LIBRARIES += libRSSupport
|
2012-12-18 06:23:14 +08:00
|
|
|
|
2014-11-21 03:05:18 +08:00
|
|
|
rs_support_io_lib :=
|
|
|
|
# check if the target api level support USAGE_IO
|
|
|
|
ifeq ($(filter $(RSCOMPAT_NO_USAGEIO_API_LEVELS),$(renderscript_target_api)),)
|
|
|
|
rs_support_io_lib := $(TARGET_OUT_INTERMEDIATE_LIBRARIES)/libRSSupportIO.so
|
|
|
|
LOCAL_JNI_SHARED_LIBRARIES += libRSSupportIO
|
|
|
|
endif
|
2013-05-14 06:46:37 +08:00
|
|
|
|
2017-08-17 07:05:26 +08:00
|
|
|
my_arch := $(TARGET_$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH)
|
|
|
|
ifneq (,$(filter arm64 mips64 x86_64,$(my_arch)))
|
|
|
|
my_min_sdk_version := 21
|
|
|
|
else
|
|
|
|
my_min_sdk_version := $(MIN_SUPPORTED_SDK_VERSION)
|
|
|
|
endif
|
2013-05-14 06:46:37 +08:00
|
|
|
|
2013-03-06 03:07:15 +08:00
|
|
|
$(rs_compatibility_jni_libs): $(RenderScript_file_stamp) $(RS_PREBUILT_CLCORE) \
|
2014-11-21 03:05:18 +08:00
|
|
|
$(rs_support_lib) $(rs_support_io_lib) $(rs_jni_lib) $(rs_compiler_rt)
|
2013-03-28 07:51:38 +08:00
|
|
|
$(rs_compatibility_jni_libs): $(BCC_COMPAT)
|
2015-07-21 09:40:18 +08:00
|
|
|
$(rs_compatibility_jni_libs): PRIVATE_CXX := $(CXX_WRAPPER) $(TARGET_CXX)
|
2017-08-17 07:05:26 +08:00
|
|
|
$(rs_compatibility_jni_libs): PRIVATE_SDK_VERSION := $(my_min_sdk_version)
|
2013-02-16 15:02:20 +08:00
|
|
|
$(rs_compatibility_jni_libs): $(renderscript_intermediate)/librs.%.so: \
|
2017-08-17 07:05:26 +08:00
|
|
|
$(renderscript_intermediate.bc_folder)%.bc \
|
|
|
|
$(SOONG_OUT_DIR)/ndk.timestamp
|
2012-11-29 08:52:41 +08:00
|
|
|
$(transform-bc-to-so)
|
|
|
|
|
|
|
|
endif
|
|
|
|
|
2013-05-14 06:46:37 +08:00
|
|
|
endif
|
|
|
|
|
2010-07-16 08:17:52 +08:00
|
|
|
LOCAL_INTERMEDIATE_TARGETS += $(RenderScript_file_stamp)
|
|
|
|
# Make sure the generated resource will be added to the apk.
|
2015-12-05 05:59:18 +08:00
|
|
|
rs_generated_res_dir := $(renderscript_intermediate.COMMON)/res
|
|
|
|
LOCAL_RESOURCE_DIR := $(rs_generated_res_dir) $(LOCAL_RESOURCE_DIR)
|
2010-07-16 08:17:52 +08:00
|
|
|
endif
|
|
|
|
|
2015-08-29 02:47:03 +08:00
|
|
|
|
|
|
|
###########################################################
|
|
|
|
## AIDL: Compile .aidl files to .java
|
|
|
|
###########################################################
|
|
|
|
aidl_sources := $(filter %.aidl,$(LOCAL_SRC_FILES))
|
2016-06-24 07:44:47 +08:00
|
|
|
aidl_java_sources :=
|
2015-08-29 02:47:03 +08:00
|
|
|
|
|
|
|
ifneq ($(strip $(aidl_sources)),)
|
|
|
|
|
|
|
|
aidl_preprocess_import :=
|
|
|
|
ifdef LOCAL_SDK_VERSION
|
2015-11-06 23:20:51 +08:00
|
|
|
ifneq ($(filter current system_current test_current, $(LOCAL_SDK_VERSION)$(TARGET_BUILD_APPS)),)
|
2015-08-29 02:47:03 +08:00
|
|
|
# LOCAL_SDK_VERSION is current and no TARGET_BUILD_APPS
|
|
|
|
aidl_preprocess_import := $(TARGET_OUT_COMMON_INTERMEDIATES)/framework.aidl
|
|
|
|
else
|
|
|
|
aidl_preprocess_import := $(HISTORICAL_SDK_VERSIONS_ROOT)/$(LOCAL_SDK_VERSION)/framework.aidl
|
|
|
|
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 07:44:47 +08:00
|
|
|
$(foreach s,$(aidl_sources),\
|
|
|
|
$(eval $(call define-aidl-java-rule,$(s),$(intermediates.COMMON),aidl_java_sources)))
|
2016-01-28 15:10:00 +08:00
|
|
|
$(foreach java,$(aidl_java_sources), \
|
|
|
|
$(call include-depfile,$(java:%.java=%.P),$(java)))
|
2015-08-29 02:47:03 +08:00
|
|
|
|
2016-06-24 07:44:47 +08: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-25 04:13:52 +08:00
|
|
|
$(aidl_java_sources): PRIVATE_MODULE := $(LOCAL_MODULE)
|
2016-06-24 07:44:47 +08:00
|
|
|
|
2015-08-29 02:47:03 +08:00
|
|
|
endif
|
|
|
|
|
|
|
|
##########################################
|
|
|
|
|
2013-01-31 03:22:06 +08: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 10:12:05 +08:00
|
|
|
ifndef LOCAL_CHECKED_MODULE
|
2015-01-20 22:18:48 +08:00
|
|
|
ifdef full_classes_jar
|
2016-12-22 06:29:13 +08:00
|
|
|
ifdef LOCAL_JACK_ENABLED
|
2017-04-28 04:34:02 +08:00
|
|
|
ifeq ($(LOCAL_JACK_ENABLED),javac_frontend)
|
|
|
|
LOCAL_CHECKED_MODULE := $(full_classes_compiled_jar)
|
|
|
|
else
|
2015-08-19 01:18:18 +08:00
|
|
|
LOCAL_CHECKED_MODULE := $(jack_check_timestamp)
|
2017-04-28 04:34:02 +08:00
|
|
|
endif
|
2016-12-22 06:29:13 +08:00
|
|
|
else
|
|
|
|
LOCAL_CHECKED_MODULE := $(full_classes_compiled_jar)
|
|
|
|
endif
|
2013-08-29 04:04:46 +08:00
|
|
|
endif
|
2015-08-19 01:18:18 +08:00
|
|
|
endif
|
2013-01-31 03:22:06 +08:00
|
|
|
|
2009-03-04 11:28:42 +08:00
|
|
|
#######################################
|
|
|
|
include $(BUILD_SYSTEM)/base_rules.mk
|
|
|
|
#######################################
|
|
|
|
|
2015-09-04 15:23:49 +08:00
|
|
|
###########################################################
|
|
|
|
## logtags: emit java source
|
|
|
|
###########################################################
|
|
|
|
ifneq ($(strip $(logtags_sources)),)
|
|
|
|
|
|
|
|
logtags_java_sources := $(patsubst %.logtags,%.java,$(addprefix $(intermediates.COMMON)/src/, $(logtags_sources)))
|
|
|
|
logtags_sources := $(addprefix $(LOCAL_PATH)/, $(logtags_sources))
|
|
|
|
|
2016-03-29 02:29:21 +08:00
|
|
|
$(logtags_java_sources): PRIVATE_MERGED_TAG := $(TARGET_OUT_COMMON_INTERMEDIATES)/all-event-log-tags.txt
|
|
|
|
$(logtags_java_sources): $(intermediates.COMMON)/src/%.java: $(LOCAL_PATH)/%.logtags $(TARGET_OUT_COMMON_INTERMEDIATES)/all-event-log-tags.txt $(JAVATAGS) build/tools/event_log_tags.py
|
2015-09-04 15:23:49 +08:00
|
|
|
$(transform-logtags-to-java)
|
|
|
|
|
|
|
|
else
|
|
|
|
logtags_java_sources :=
|
|
|
|
endif
|
|
|
|
|
2015-08-29 02:47:03 +08:00
|
|
|
##########################################
|
|
|
|
java_sources := $(addprefix $(LOCAL_PATH)/, $(filter %.java,$(LOCAL_SRC_FILES))) $(aidl_java_sources) $(logtags_java_sources) \
|
|
|
|
$(filter %.java,$(LOCAL_GENERATED_SOURCES))
|
|
|
|
all_java_sources := $(java_sources) $(addprefix $(TARGET_OUT_COMMON_INTERMEDIATES)/, $(filter %.java,$(LOCAL_INTERMEDIATE_SOURCES)))
|
|
|
|
|
|
|
|
include $(BUILD_SYSTEM)/java_common.mk
|
|
|
|
|
2016-12-22 09:37:00 +08:00
|
|
|
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_HAS_RS_SOURCES := $(if $(renderscript_sources),true)
|
|
|
|
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_RS_SOURCE_INTERMEDIATES_DIR := $(intermediates.COMMON)/renderscript
|
|
|
|
|
2013-11-15 15:44:56 +08:00
|
|
|
#######################################
|
|
|
|
# defines built_odex along with rule to install odex
|
|
|
|
include $(BUILD_SYSTEM)/dex_preopt_odex_install.mk
|
|
|
|
#######################################
|
|
|
|
|
2013-08-29 04:04:46 +08:00
|
|
|
# Make sure there's something to build.
|
|
|
|
ifdef full_classes_jar
|
|
|
|
ifndef need_compile_java
|
|
|
|
$(error $(LOCAL_PATH): Target java module does not define any source or resource files)
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
2016-03-10 00:19:58 +08:00
|
|
|
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_JACK_MIN_SDK_VERSION := $(my_jack_min_sdk_version)
|
|
|
|
my_jack_min_sdk_version :=
|
|
|
|
|
2009-03-04 11:28:42 +08:00
|
|
|
# Since we're using intermediates.COMMON, make sure that it gets cleaned
|
|
|
|
# properly.
|
|
|
|
$(cleantarget): PRIVATE_CLEAN_FILES += $(intermediates.COMMON)
|
|
|
|
|
2013-08-29 04:04:46 +08:00
|
|
|
ifdef full_classes_jar
|
2009-03-04 11:28:42 +08:00
|
|
|
|
2009-04-10 10:31:12 +08: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-30 03:17:36 +08:00
|
|
|
$(eval $(call copy-one-file,$(full_classes_jar),$(full_classes_stubs_jar)))
|
2009-04-10 10:31:12 +08:00
|
|
|
ALL_MODULES.$(LOCAL_MODULE).STUBS := $(full_classes_stubs_jar)
|
|
|
|
|
2011-10-31 12:37:35 +08:00
|
|
|
# The layers file allows you to enforce a layering between java packages.
|
|
|
|
# Run build/tools/java-layers.py for more details.
|
|
|
|
layers_file := $(addprefix $(LOCAL_PATH)/, $(LOCAL_JAVA_LAYERS_FILE))
|
|
|
|
$(full_classes_compiled_jar): PRIVATE_JAVA_LAYERS_FILE := $(layers_file)
|
2012-10-19 01:54:49 +08:00
|
|
|
$(full_classes_compiled_jar): PRIVATE_WARNINGS_ENABLE := $(LOCAL_WARNINGS_ENABLE)
|
2011-10-31 12:37:35 +08:00
|
|
|
|
2009-03-25 10:07:34 +08: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 22:12:30 +08:00
|
|
|
|
|
|
|
# If error prone is enabled then add LOCAL_ERROR_PRONE_FLAGS to LOCAL_JAVACFLAGS
|
|
|
|
ifeq ($(RUN_ERROR_PRONE),true)
|
|
|
|
LOCAL_JAVACFLAGS += $(LOCAL_ERROR_PRONE_FLAGS)
|
|
|
|
endif
|
|
|
|
|
2017-06-30 21:51:12 +08: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
|
|
|
|
LOCAL_JACK_FLAGS+= -D jack.dex.debug.vars=false -D jack.dex.debug.vars.synthetic=false
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
2017-05-27 06:22:02 +08:00
|
|
|
# List of dependencies for anything that needs all java sources in place
|
|
|
|
java_sources_deps := \
|
|
|
|
$(java_sources) \
|
|
|
|
$(java_resource_sources) \
|
|
|
|
$(RenderScript_file_stamp) \
|
|
|
|
$(proto_java_sources_file_stamp) \
|
|
|
|
$(LOCAL_ADDITIONAL_DEPENDENCIES)
|
|
|
|
|
|
|
|
$(java_source_list_file): $(java_sources_deps)
|
|
|
|
$(write-java-source-list)
|
|
|
|
|
2017-08-31 03:32:12 +08:00
|
|
|
$(full_classes_compiled_jar): PRIVATE_JAVACFLAGS := $(LOCAL_JAVACFLAGS) $(annotation_processor_flags)
|
2011-12-16 08:36:55 +08:00
|
|
|
$(full_classes_compiled_jar): PRIVATE_JAR_EXCLUDE_FILES := $(LOCAL_JAR_EXCLUDE_FILES)
|
2013-07-18 11:29:51 +08:00
|
|
|
$(full_classes_compiled_jar): PRIVATE_JAR_PACKAGES := $(LOCAL_JAR_PACKAGES)
|
2014-05-24 09:41:19 +08:00
|
|
|
$(full_classes_compiled_jar): PRIVATE_JAR_EXCLUDE_PACKAGES := $(LOCAL_JAR_EXCLUDE_PACKAGES)
|
2012-08-31 03:59:42 +08:00
|
|
|
$(full_classes_compiled_jar): PRIVATE_DONT_DELETE_JAR_META_INF := $(LOCAL_DONT_DELETE_JAR_META_INF)
|
2017-05-27 06:22:02 +08:00
|
|
|
$(full_classes_compiled_jar): PRIVATE_JAVA_SOURCE_LIST := $(java_source_list_file)
|
2014-11-09 14:20:03 +08:00
|
|
|
$(full_classes_compiled_jar): \
|
2017-05-27 06:22:02 +08:00
|
|
|
$(java_source_list_file) \
|
|
|
|
$(java_sources_deps) \
|
2017-09-01 05:43:04 +08:00
|
|
|
$(full_java_header_libs) \
|
2017-05-27 06:22:02 +08:00
|
|
|
$(layers_file) \
|
|
|
|
$(annotation_processor_deps) \
|
|
|
|
$(NORMALIZE_PATH) \
|
2017-09-01 05:43:04 +08:00
|
|
|
$(JAR_ARGS) \
|
2017-05-27 06:22:02 +08:00
|
|
|
| $(SOONG_JAVAC_WRAPPER)
|
2009-03-25 10:07:34 +08:00
|
|
|
$(transform-java-to-classes.jar)
|
|
|
|
|
2017-09-01 05:43:04 +08:00
|
|
|
$(full_classes_turbine_jar): PRIVATE_JAVACFLAGS := $(LOCAL_JAVACFLAGS) $(annotation_processor_flags)
|
|
|
|
$(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) \
|
|
|
|
$(NORMALIZE_PATH) \
|
|
|
|
$(JAR_ARGS) \
|
|
|
|
$(ZIPTIME) \
|
2017-09-14 04:13:53 +08:00
|
|
|
| $(TURBINE) \
|
|
|
|
$(MERGE_ZIPS)
|
2017-09-01 05:43:04 +08: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)))
|
|
|
|
|
2016-03-25 02:00:30 +08:00
|
|
|
javac-check : $(full_classes_compiled_jar)
|
2016-09-15 21:34:42 +08:00
|
|
|
javac-check-$(LOCAL_MODULE) : $(full_classes_compiled_jar)
|
2016-03-25 02:00:30 +08:00
|
|
|
|
2017-09-14 04:13:53 +08: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-21 05:56:48 +08:00
|
|
|
$(jar_manifest_file) \
|
2017-09-14 04:13:53 +08:00
|
|
|
$(full_static_java_libs) | $(MERGE_ZIPS)
|
2017-09-21 05:56:48 +08:00
|
|
|
$(if $(PRIVATE_JAR_MANIFEST), $(hide) sed -e "s/%BUILD_NUMBER%/$(BUILD_NUMBER_FROM_FILE)/" \
|
|
|
|
$(PRIVATE_JAR_MANIFEST) > $(dir $@)/manifest.mf)
|
|
|
|
$(MERGE_ZIPS) -j $(if $(PRIVATE_JAR_MANIFEST),-m $(dir $@)/manifest.mf) \
|
|
|
|
$(if $(PRIVATE_DONT_DELETE_JAR_META_INF),,-stripDir META-INF -zipToNotStrip $<) \
|
|
|
|
$@ $< $(call reverse-list,$(PRIVATE_STATIC_JAVA_LIBRARIES))
|
2017-09-14 04:13:53 +08:00
|
|
|
|
2017-05-23 07:21:49 +08: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-14 04:13:53 +08:00
|
|
|
in := $(full_classes_combined_jar)
|
2017-05-23 07:21:49 +08:00
|
|
|
out := $(full_classes_processed_jar).tmp
|
2017-07-14 10:25:47 +08:00
|
|
|
my_jar_processor := $(HOST_OUT_JAVA_LIBRARIES)/$(LOCAL_JAR_PROCESSOR).jar
|
|
|
|
|
2017-05-23 07:21:49 +08:00
|
|
|
$(full_classes_processed_jar): PRIVATE_JAR_PROCESSOR_ARGS := $(LOCAL_JAR_PROCESSOR_ARGS)
|
2017-07-14 10:25:47 +08:00
|
|
|
$(full_classes_processed_jar): PRIVATE_JAR_PROCESSOR := $(my_jar_processor)
|
2017-05-23 07:21:49 +08:00
|
|
|
$(full_classes_processed_jar): PRIVATE_TMP_OUT := $(out)
|
|
|
|
in :=
|
|
|
|
out :=
|
|
|
|
|
2017-09-14 04:13:53 +08:00
|
|
|
$(full_classes_processed_jar): $(full_classes_combined_jar) $(my_jar_processor)
|
2017-05-23 07:21:49 +08:00
|
|
|
@echo Processing $@ with $(PRIVATE_JAR_PROCESSOR)
|
|
|
|
$(hide) rm -f $@ $(PRIVATE_TMP_OUT)
|
2017-07-01 04:55:38 +08:00
|
|
|
$(hide) $(JAVA) -jar $(PRIVATE_JAR_PROCESSOR) $(PRIVATE_JAR_PROCESSOR_ARGS)
|
2017-05-23 07:21:49 +08:00
|
|
|
$(hide) mv $(PRIVATE_TMP_OUT) $@
|
|
|
|
|
2017-07-14 10:25:47 +08:00
|
|
|
my_jar_processor :=
|
2017-05-23 07:21:49 +08:00
|
|
|
else
|
2017-09-14 04:13:53 +08:00
|
|
|
full_classes_processed_jar := $(full_classes_combined_jar)
|
2017-05-23 07:21:49 +08:00
|
|
|
endif
|
|
|
|
|
2017-09-14 05:56:11 +08: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
|
|
|
|
|
|
|
|
$(eval $(call copy-one-file,$(full_classes_jarjar_jar),$(full_classes_jar)))
|
|
|
|
|
2016-12-22 09:11:03 +08:00
|
|
|
my_desugaring :=
|
|
|
|
ifndef LOCAL_JACK_ENABLED
|
2017-03-22 01:17:04 +08:00
|
|
|
ifndef LOCAL_IS_STATIC_JAVA_LIBRARY
|
2016-12-22 09:11:03 +08:00
|
|
|
my_desugaring := true
|
|
|
|
$(full_classes_desugar_jar): PRIVATE_DX_FLAGS := $(LOCAL_DX_FLAGS)
|
2017-09-14 05:56:11 +08:00
|
|
|
$(full_classes_desugar_jar): $(full_classes_jar) $(full_java_header_libs) $(DESUGAR)
|
2016-12-22 09:11:03 +08:00
|
|
|
$(desugar-classes-jar)
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifndef my_desugaring
|
2017-09-14 05:56:11 +08:00
|
|
|
full_classes_desugar_jar := $(full_classes_jar)
|
2016-12-22 09:11:03 +08:00
|
|
|
endif
|
|
|
|
|
2017-09-14 05:56:11 +08:00
|
|
|
LOCAL_FULL_CLASSES_PRE_JACOCO_JAR := $(full_classes_desugar_jar)
|
2016-12-22 06:29:13 +08:00
|
|
|
|
2017-04-12 07:36:46 +08:00
|
|
|
#######################################
|
|
|
|
include $(BUILD_SYSTEM)/jacoco.mk
|
|
|
|
#######################################
|
2016-12-22 06:29:13 +08:00
|
|
|
|
2017-04-12 07:36:46 +08:00
|
|
|
full_classes_pre_proguard_jar := $(LOCAL_FULL_CLASSES_JACOCO_JAR)
|
2010-02-02 01:51:23 +08:00
|
|
|
|
2017-04-06 06:30:42 +08: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 15:47:42 +08:00
|
|
|
|
2017-03-30 03:17:36 +08:00
|
|
|
# Run proguard if necessary
|
2013-08-22 09:32:49 +08:00
|
|
|
ifdef LOCAL_PROGUARD_ENABLED
|
2014-09-10 08:08:46 +08:00
|
|
|
ifneq ($(filter-out full custom nosystem obfuscation optimization shrinktests,$(LOCAL_PROGUARD_ENABLED)),)
|
2013-08-22 09:32:49 +08:00
|
|
|
$(warning while processing: $(LOCAL_MODULE))
|
|
|
|
$(error invalid value for LOCAL_PROGUARD_ENABLED: $(LOCAL_PROGUARD_ENABLED))
|
|
|
|
endif
|
2009-08-31 04:39:24 +08:00
|
|
|
proguard_dictionary := $(intermediates.COMMON)/proguard_dictionary
|
2015-11-04 01:33:21 +08:00
|
|
|
jack_dictionary := $(intermediates.COMMON)/jack_dictionary
|
2015-05-05 10:21:48 +08:00
|
|
|
|
|
|
|
# Hack: see b/20667396
|
|
|
|
# When an app's LOCAL_SDK_VERSION is lower than the support library's LOCAL_SDK_VERSION,
|
|
|
|
# we artifically raises the "SDK version" "linked" by ProGuard, to
|
|
|
|
# - 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.
|
|
|
|
my_support_library_sdk_raise :=
|
|
|
|
ifneq (,$(filter android-support-%,$(LOCAL_STATIC_JAVA_LIBRARIES)))
|
|
|
|
ifdef LOCAL_SDK_VERSION
|
|
|
|
ifdef TARGET_BUILD_APPS
|
2015-11-06 23:20:51 +08:00
|
|
|
ifeq (,$(filter current system_current test_current, $(LOCAL_SDK_VERSION)))
|
2017-09-01 05:43:04 +08:00
|
|
|
my_support_library_sdk_raise := $(call java-lib-header-files, sdk_vcurrent)
|
2015-06-27 03:33:06 +08:00
|
|
|
endif
|
2015-05-05 10:21:48 +08: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-09-01 05:43:04 +08:00
|
|
|
my_support_library_sdk_raise := $(call java-lib-header-files,$(TARGET_DEFAULT_JAVA_LIBRARIES))
|
2015-05-05 10:21:48 +08:00
|
|
|
endif
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
2014-09-08 20:45:14 +08:00
|
|
|
# jack already has the libraries in its classpath and doesn't support jars
|
2017-02-23 06:26:55 +08:00
|
|
|
legacy_proguard_flags := $(addprefix -libraryjars ,$(my_support_library_sdk_raise) \
|
2017-09-01 05:43:04 +08:00
|
|
|
$(filter-out $(my_support_library_sdk_raise),$(full_shared_java_header_libs)))
|
|
|
|
|
|
|
|
legacy_proguard_lib_deps := $(my_support_library_sdk_raise) \
|
|
|
|
$(filter-out $(my_support_library_sdk_raise),$(full_shared_java_header_libs))
|
2015-11-04 01:33:21 +08:00
|
|
|
|
|
|
|
legacy_proguard_flags += -printmapping $(proguard_dictionary)
|
|
|
|
jack_proguard_flags := -printmapping $(jack_dictionary)
|
|
|
|
|
|
|
|
common_proguard_flags := -forceprocessing
|
2013-08-22 09:32:49 +08:00
|
|
|
|
2016-04-07 17:56:42 +08:00
|
|
|
common_proguard_flag_files :=
|
2013-08-22 09:32:49 +08:00
|
|
|
ifeq ($(filter nosystem,$(LOCAL_PROGUARD_ENABLED)),)
|
2016-04-07 17:56:42 +08:00
|
|
|
common_proguard_flag_files += $(BUILD_SYSTEM)/proguard.flags
|
2012-08-28 07:01:38 +08:00
|
|
|
ifeq ($(LOCAL_EMMA_INSTRUMENT),true)
|
2016-12-22 06:29:13 +08:00
|
|
|
ifdef LOCAL_JACK_ENABLED
|
2016-04-07 17:56:42 +08:00
|
|
|
common_proguard_flag_files += $(BUILD_SYSTEM)/proguard.jacoco.flags
|
2016-12-22 06:29:13 +08:00
|
|
|
else
|
|
|
|
common_proguard_flags += -include $(BUILD_SYSTEM)/proguard.emma.flags
|
|
|
|
endif # LOCAL_JACK_ENABLED
|
2012-08-28 07:01:38 +08:00
|
|
|
endif
|
2010-02-02 01:51:23 +08:00
|
|
|
# If this is a test package, add proguard keep flags for tests.
|
2013-08-22 09:32:49 +08:00
|
|
|
ifneq ($(LOCAL_INSTRUMENTATION_FOR)$(filter tests,$(LOCAL_MODULE_TAGS)),)
|
2016-04-07 17:56:42 +08:00
|
|
|
common_proguard_flag_files += $(BUILD_SYSTEM)/proguard_tests.flags
|
2014-09-10 08:08:46 +08:00
|
|
|
ifeq ($(filter shrinktests,$(LOCAL_PROGUARD_ENABLED)),)
|
2014-09-08 20:45:14 +08:00
|
|
|
common_proguard_flags += -dontshrink # don't shrink tests by default
|
2014-09-10 08:08:46 +08:00
|
|
|
endif # shrinktests
|
2010-02-02 01:51:23 +08:00
|
|
|
endif # test package
|
2016-04-07 17:56:42 +08: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 09:32:49 +08:00
|
|
|
ifeq ($(filter obfuscation,$(LOCAL_PROGUARD_ENABLED)),)
|
|
|
|
# By default no obfuscation
|
2014-09-08 20:45:14 +08:00
|
|
|
common_proguard_flags += -dontobfuscate
|
2013-08-22 09:32:49 +08:00
|
|
|
endif # No obfuscation
|
|
|
|
ifeq ($(filter optimization,$(LOCAL_PROGUARD_ENABLED)),)
|
|
|
|
# By default no optimization
|
2014-09-08 20:45:14 +08:00
|
|
|
common_proguard_flags += -dontoptimize
|
2013-08-22 09:32:49 +08: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 20:45:14 +08:00
|
|
|
# jack already has this library in its classpath and doesn't support jars
|
|
|
|
legacy_proguard_flags += -libraryjars $(link_instr_classes_jar)
|
2017-09-01 05:43:04 +08:00
|
|
|
legacy_proguard_lib_deps += $(link_instr_classes_jar)
|
2013-08-22 09:32:49 +08: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 20:45:14 +08:00
|
|
|
legacy_proguard_flags := -injars $(link_instr_classes_jar) \
|
2013-08-22 09:32:49 +08: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 20:45:14 +08:00
|
|
|
$(legacy_proguard_flags)
|
2016-12-22 06:29:13 +08:00
|
|
|
ifdef LOCAL_JACK_ENABLED
|
2015-11-04 01:33:21 +08:00
|
|
|
jack_proguard_flags += -applymapping $(link_instr_intermediates_dir.COMMON)/jack_dictionary
|
|
|
|
full_jack_deps += $(link_instr_intermediates_dir.COMMON)/jack_dictionary
|
2016-12-22 06:29:13 +08:00
|
|
|
endif
|
2013-08-22 09:32:49 +08:00
|
|
|
|
|
|
|
# Sometimes (test + main app) uses different keep rules from the main app -
|
|
|
|
# apply the main app's dictionary anyway.
|
2014-09-08 20:45:14 +08:00
|
|
|
legacy_proguard_flags += -ignorewarnings
|
2013-08-22 09:32:49 +08:00
|
|
|
|
|
|
|
# Make sure we run Proguard on the main app first
|
|
|
|
$(full_classes_proguard_jar) : $(link_instr_intermediates_dir.COMMON)/proguard.classes.jar
|
|
|
|
|
|
|
|
endif # no obfuscation
|
|
|
|
endif # LOCAL_INSTRUMENTATION_FOR
|
|
|
|
endif # LOCAL_PROGUARD_ENABLED is not nosystem
|
2009-08-31 04:39:24 +08:00
|
|
|
|
2010-09-30 05:50:41 +08:00
|
|
|
proguard_flag_files := $(addprefix $(LOCAL_PATH)/, $(LOCAL_PROGUARD_FLAG_FILES))
|
|
|
|
LOCAL_PROGUARD_FLAGS += $(addprefix -include , $(proguard_flag_files))
|
|
|
|
|
2014-02-07 23:18:59 +08: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 21:11:13 +08:00
|
|
|
|
|
|
|
# If not using jack and building against the current SDK version then filter
|
2017-05-15 22:01:31 +08:00
|
|
|
# out the junit, android.test and c.a.i.u.Predicate classes that are to be
|
2017-02-21 21:11:13 +08:00
|
|
|
# removed from the Android API as part of b/30188076 but which are still
|
|
|
|
# present in the Android API. This is to allow changes to be made to the
|
|
|
|
# build to statically include those classes into the application without
|
|
|
|
# simultaneously removing those classes from the API.
|
|
|
|
proguard_injar_filters :=
|
|
|
|
ifndef LOCAL_JACK_ENABLED
|
|
|
|
ifdef LOCAL_SDK_VERSION
|
|
|
|
ifeq (,$(filter-out current system_current test_current, $(LOCAL_SDK_VERSION)))
|
2017-06-15 15:42:23 +08:00
|
|
|
proguard_injar_filters := (!junit/framework/**,!junit/runner/**,!junit/textui/**,!android/test/**,!com/android/internal/util/*)
|
2017-02-21 21:11:13 +08:00
|
|
|
endif
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
2017-09-21 17:53:09 +08:00
|
|
|
$(full_classes_proguard_jar): .KATI_IMPLICIT_OUTPUTS := $(proguard_dictionary)
|
2017-02-21 21:11:13 +08:00
|
|
|
$(full_classes_proguard_jar): PRIVATE_PROGUARD_INJAR_FILTERS := $(proguard_injar_filters)
|
2014-02-07 23:18:59 +08:00
|
|
|
$(full_classes_proguard_jar): PRIVATE_EXTRA_INPUT_JAR := $(extra_input_jar)
|
2014-09-08 20:45:14 +08:00
|
|
|
$(full_classes_proguard_jar): PRIVATE_PROGUARD_FLAGS := $(legacy_proguard_flags) $(common_proguard_flags) $(LOCAL_PROGUARD_FLAGS)
|
2017-09-01 05:43:04 +08:00
|
|
|
$(full_classes_proguard_jar) : $(full_classes_pre_proguard_jar) $(extra_input_jar) $(my_support_library_sdk_raise) $(common_proguard_flag_files) $(proguard_flag_files) $(legacy_proguard_lib_deps) | $(PROGUARD)
|
2010-02-02 01:51:23 +08:00
|
|
|
$(call transform-jar-to-proguard)
|
|
|
|
|
2013-08-22 09:32:49 +08:00
|
|
|
else # LOCAL_PROGUARD_ENABLED not defined
|
2017-04-06 06:30:42 +08:00
|
|
|
full_classes_proguard_jar := $(full_classes_pre_proguard_jar)
|
2013-08-22 09:32:49 +08:00
|
|
|
endif # LOCAL_PROGUARD_ENABLED defined
|
|
|
|
|
2017-04-07 00:56:19 +08:00
|
|
|
ifneq ($(LOCAL_IS_STATIC_JAVA_LIBRARY),true)
|
2016-12-22 06:29:13 +08:00
|
|
|
ifndef LOCAL_JACK_ENABLED
|
|
|
|
$(built_dex_intermediate): PRIVATE_DX_FLAGS := $(LOCAL_DX_FLAGS)
|
|
|
|
# If you instrument class files that have local variable debug information in
|
|
|
|
# them emma does not correctly maintain the local variable table.
|
|
|
|
# This will cause an error when you try to convert the class files for Android.
|
|
|
|
# The workaround here is to build different dex file here based on emma switch
|
|
|
|
# then later copy into classes.dex. When emma is on, dx is run with --no-locals
|
|
|
|
# option to remove local variable information
|
|
|
|
ifeq ($(LOCAL_EMMA_INSTRUMENT),true)
|
|
|
|
$(built_dex_intermediate): PRIVATE_DX_FLAGS += --no-locals
|
|
|
|
endif
|
2017-09-14 05:56:11 +08:00
|
|
|
$(built_dex_intermediate): $(full_classes_proguard_jar) $(DX)
|
2016-12-22 06:29:13 +08:00
|
|
|
$(transform-classes.jar-to-dex)
|
|
|
|
endif # LOCAL_JACK_ENABLED is disabled
|
|
|
|
|
2017-03-30 03:17:36 +08:00
|
|
|
$(built_dex): $(built_dex_intermediate)
|
2010-03-11 07:48:03 +08:00
|
|
|
@echo Copying: $@
|
2013-08-20 23:05:27 +08:00
|
|
|
$(hide) mkdir -p $(dir $@)
|
|
|
|
$(hide) rm -f $(dir $@)/classes*.dex
|
2017-03-30 03:17:36 +08:00
|
|
|
$(hide) cp -fp $(dir $<)/classes*.dex $(dir $@)
|
2009-03-04 11:28:42 +08:00
|
|
|
|
2017-04-28 06:05:44 +08:00
|
|
|
java-dex: $(built_dex)
|
|
|
|
|
2017-04-07 00:56:19 +08:00
|
|
|
endif # !LOCAL_IS_STATIC_JAVA_LIBRARY
|
|
|
|
|
2009-03-04 11:28:42 +08:00
|
|
|
findbugs_xml := $(intermediates.COMMON)/findbugs.xml
|
2015-10-22 01:30:51 +08: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 06:30:42 +08:00
|
|
|
$(findbugs_xml) : $(full_classes_pre_proguard_jar) $(filter %.xml, $(LOCAL_FINDBUGS_FLAGS))
|
2009-03-04 11:28:42 +08:00
|
|
|
@echo Findbugs: $@
|
|
|
|
$(hide) $(FINDBUGS) -textui -effort:min -xml:withMessages \
|
2015-10-22 01:30:51 +08:00
|
|
|
$(PRIVATE_AUXCLASSPATH) $(PRIVATE_FINDBUGS_FLAGS) \
|
2015-02-05 23:10:58 +08:00
|
|
|
$< \
|
2009-03-04 11:28:42 +08: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)
|
|
|
|
$(findbugs_html) : $(findbugs_xml)
|
|
|
|
@mkdir -p $(dir $@)
|
2009-05-13 15:44:59 +08:00
|
|
|
@echo ConvertXmlToText: $@
|
2014-05-20 16:04:16 +08:00
|
|
|
$(hide) $(FINDBUGS_DIR)/convertXmlToText -html:fancy.xsl $(PRIVATE_XML_FILE) \
|
2009-03-04 11:28:42 +08:00
|
|
|
> $@
|
|
|
|
|
|
|
|
$(LOCAL_MODULE)-findbugs : $(findbugs_html)
|
|
|
|
|
2013-08-29 04:04:46 +08:00
|
|
|
endif # full_classes_jar is defined
|
2014-09-08 20:45:14 +08:00
|
|
|
|
2017-02-22 08:14:55 +08:00
|
|
|
ifneq (,$(filter-out current system_current test_current, $(LOCAL_SDK_VERSION)))
|
|
|
|
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_DEFAULT_APP_TARGET_SDK := $(LOCAL_SDK_VERSION)
|
|
|
|
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_SDK_VERSION := $(LOCAL_SDK_VERSION)
|
|
|
|
else
|
|
|
|
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_DEFAULT_APP_TARGET_SDK := $(DEFAULT_APP_TARGET_SDK)
|
|
|
|
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_SDK_VERSION := $(PLATFORM_SDK_VERSION)
|
|
|
|
endif
|
|
|
|
|
2016-12-22 06:29:13 +08:00
|
|
|
ifdef LOCAL_JACK_ENABLED
|
2014-09-08 20:45:14 +08:00
|
|
|
$(LOCAL_INTERMEDIATE_TARGETS): \
|
2015-01-09 17:36:40 +08:00
|
|
|
PRIVATE_JACK_INTERMEDIATES_DIR := $(intermediates.COMMON)/jack-rsc
|
|
|
|
ifeq ($(LOCAL_JACK_ENABLED),incremental)
|
|
|
|
$(LOCAL_INTERMEDIATE_TARGETS): \
|
|
|
|
PRIVATE_JACK_INCREMENTAL_DIR := $(intermediates.COMMON)/jack-incremental
|
2015-08-19 01:18:18 +08:00
|
|
|
$(noshrob_classes_jack): PRIVATE_JACK_INCREMENTAL_DIR := $(intermediates.COMMON)/jack-noshrob-incremental
|
|
|
|
$(jack_check_timestamp): PRIVATE_JACK_INCREMENTAL_DIR := $(intermediates.COMMON)/jack-check-incremental
|
2015-01-09 17:36:40 +08:00
|
|
|
else
|
|
|
|
$(LOCAL_INTERMEDIATE_TARGETS): \
|
|
|
|
PRIVATE_JACK_INCREMENTAL_DIR :=
|
2015-08-19 01:18:18 +08:00
|
|
|
$(noshrob_classes_jack): PRIVATE_JACK_INCREMENTAL_DIR :=
|
|
|
|
$(jack_check_timestamp): PRIVATE_JACK_INCREMENTAL_DIR :=
|
2015-01-09 17:36:40 +08:00
|
|
|
endif
|
2014-09-08 20:45:14 +08:00
|
|
|
|
|
|
|
ifdef full_classes_jar
|
|
|
|
ifdef LOCAL_PROGUARD_ENABLED
|
|
|
|
|
|
|
|
ifndef LOCAL_JACK_PROGUARD_FLAGS
|
|
|
|
LOCAL_JACK_PROGUARD_FLAGS := $(LOCAL_PROGUARD_FLAGS)
|
|
|
|
endif
|
|
|
|
LOCAL_JACK_PROGUARD_FLAGS += $(addprefix -include , $(proguard_flag_files))
|
|
|
|
ifdef LOCAL_TEST_MODULE_TO_PROGUARD_WITH
|
|
|
|
$(error $(LOCAL_MODULE): Build with jack when LOCAL_TEST_MODULE_TO_PROGUARD_WITH is defined is not yet implemented)
|
|
|
|
endif
|
|
|
|
|
2015-11-04 01:33:21 +08:00
|
|
|
# $(jack_dictionary) is just by-product of $(built_dex_intermediate).
|
|
|
|
# The dummy command was added because, without it, make misses the fact the $(built_dex) also
|
|
|
|
# change $(jack_dictionary).
|
|
|
|
$(jack_dictionary): $(full_classes_jack)
|
|
|
|
$(hide) touch $@
|
|
|
|
|
|
|
|
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_JACK_PROGUARD_FLAGS := $(common_proguard_flags) $(jack_proguard_flags) $(LOCAL_JACK_PROGUARD_FLAGS)
|
2014-09-08 20:45:14 +08:00
|
|
|
else # LOCAL_PROGUARD_ENABLED not defined
|
|
|
|
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_JACK_PROGUARD_FLAGS :=
|
|
|
|
endif # LOCAL_PROGUARD_ENABLED defined
|
|
|
|
|
2017-08-31 03:32:12 +08:00
|
|
|
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_JACK_FLAGS := -g $(LOCAL_JACK_FLAGS) $(annotation_processor_flags)
|
2015-07-03 21:46:51 +08:00
|
|
|
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_JACK_VERSION := $(LOCAL_JACK_VERSION)
|
2014-09-08 20:45:14 +08:00
|
|
|
|
2017-05-27 06:22:02 +08:00
|
|
|
jack_all_deps := \
|
|
|
|
$(java_source_list_file) \
|
|
|
|
$(java_sources_deps) \
|
|
|
|
$(full_jack_deps) \
|
|
|
|
$(jar_manifest_file) \
|
|
|
|
$(layers_file) \
|
|
|
|
$(common_proguard_flag_files) \
|
|
|
|
$(proguard_flag_files) \
|
|
|
|
$(annotation_processor_deps) \
|
|
|
|
$(LOCAL_JARJAR_RULES) \
|
|
|
|
$(NORMALIZE_PATH) \
|
|
|
|
$(JACK_DEFAULT_ARGS) \
|
|
|
|
$(JACK)
|
2014-09-08 20:45:14 +08:00
|
|
|
|
2016-04-20 08:22:29 +08:00
|
|
|
$(jack_check_timestamp): $(jack_all_deps) | setup-jack-server
|
2015-08-19 01:18:18 +08:00
|
|
|
@echo Checking build with Jack: $@
|
|
|
|
$(jack-check-java)
|
|
|
|
|
2014-09-08 20:45:14 +08:00
|
|
|
ifeq ($(LOCAL_IS_STATIC_JAVA_LIBRARY),true)
|
2016-08-05 23:45:10 +08:00
|
|
|
$(full_classes_jack): PRIVATE_JACK_PLUGIN_PATH := $(LOCAL_JACK_PLUGIN_PATH)
|
2016-09-19 23:49:03 +08:00
|
|
|
$(full_classes_jack): PRIVATE_JACK_PLUGIN := $(LOCAL_JACK_PLUGIN)
|
2016-08-05 23:45:10 +08:00
|
|
|
$(full_classes_jack): $(jack_all_deps) $(LOCAL_JACK_PLUGIN_PATH) | setup-jack-server
|
2014-09-08 20:45:14 +08:00
|
|
|
@echo Building with Jack: $@
|
|
|
|
$(java-to-jack)
|
|
|
|
|
2015-12-09 17:06:20 +08:00
|
|
|
# Update timestamps of .toc files for static java libraries so
|
|
|
|
# dependents will be always rebuilt.
|
|
|
|
$(built_dex).toc: $(full_classes_jack)
|
|
|
|
touch $@
|
|
|
|
|
2014-09-08 20:45:14 +08:00
|
|
|
else #LOCAL_IS_STATIC_JAVA_LIBRARY
|
|
|
|
$(built_dex_intermediate): PRIVATE_CLASSES_JACK := $(full_classes_jack)
|
|
|
|
|
2015-11-20 00:53:00 +08:00
|
|
|
ifeq ($(LOCAL_EMMA_INSTRUMENT),true)
|
2016-08-05 23:45:10 +08:00
|
|
|
LOCAL_JACK_PLUGIN_PATH += $(HOST_OUT_JAVA_LIBRARIES)/jack-coverage-plugin.jar
|
|
|
|
LOCAL_JACK_PLUGIN += com.android.jack.coverage.CodeCoverage
|
2015-11-20 00:53:00 +08:00
|
|
|
$(built_dex_intermediate): PRIVATE_JACK_COVERAGE_OPTIONS := \
|
2016-04-07 00:18:47 +08:00
|
|
|
-D jack.coverage=true \
|
2015-11-20 00:53:00 +08:00
|
|
|
-D jack.coverage.metadata.file=$(intermediates.COMMON)/coverage.em \
|
2016-04-07 00:18:47 +08:00
|
|
|
-D jack.coverage.jacoco.package=$(JACOCO_PACKAGE_NAME) \
|
|
|
|
$(addprefix -D jack.coverage.jacoco.include=,$(LOCAL_JACK_COVERAGE_INCLUDE_FILTER)) \
|
|
|
|
$(addprefix -D jack.coverage.jacoco.exclude=,$(LOCAL_JACK_COVERAGE_EXCLUDE_FILTER))
|
2015-11-20 00:53:00 +08:00
|
|
|
else
|
|
|
|
$(built_dex_intermediate): PRIVATE_JACK_COVERAGE_OPTIONS :=
|
|
|
|
endif
|
|
|
|
|
2017-04-28 04:34:02 +08:00
|
|
|
# Compiling with javac to jar, then converting jar to dex with jack
|
|
|
|
ifeq ($(LOCAL_JACK_ENABLED),javac_frontend)
|
|
|
|
|
|
|
|
# PRIVATE_EXTRA_JAR_ARGS and source files were already handled during javac
|
|
|
|
$(built_dex_intermediate): PRIVATE_EXTRA_JAR_ARGS :=
|
|
|
|
$(built_dex_intermediate): PRIVATE_JAVA_SOURCES :=
|
|
|
|
$(built_dex_intermediate): PRIVATE_SOURCE_INTERMEDIATES_DIR :=
|
|
|
|
$(built_dex_intermediate): PRIVATE_HAS_PROTO_SOURCES :=
|
|
|
|
$(built_dex_intermediate): PRIVATE_HAS_RS_SOURCES :=
|
|
|
|
|
|
|
|
# Incremental compilation is not supported when mixing javac and jack
|
|
|
|
$(built_dex_intermediate): PRIVATE_JACK_INCREMENTAL_DIR :=
|
|
|
|
|
|
|
|
# Pass output of javac to jack
|
|
|
|
$(built_dex_intermediate): PRIVATE_JACK_IMPORT_JAR := $(full_classes_compiled_jar)
|
|
|
|
$(built_dex_intermediate): $(full_classes_compiled_jar)
|
|
|
|
else # LOCAL_JACK_ENABLED != javac_frontend
|
|
|
|
$(built_dex_intermediate): PRIVATE_JACK_IMPORT_JAR :=
|
|
|
|
endif # LOCAL_JACK_ENABLED != javac_frontend
|
|
|
|
|
2016-08-05 23:45:10 +08:00
|
|
|
$(built_dex_intermediate): PRIVATE_JACK_PLUGIN_PATH := $(LOCAL_JACK_PLUGIN_PATH)
|
|
|
|
$(built_dex_intermediate): PRIVATE_JACK_PLUGIN := $(LOCAL_JACK_PLUGIN)
|
|
|
|
$(built_dex_intermediate): $(jack_all_deps) $(LOCAL_JACK_PLUGIN_PATH) | setup-jack-server
|
2014-09-08 20:45:14 +08:00
|
|
|
@echo Building with Jack: $@
|
|
|
|
$(jack-java-to-dex)
|
|
|
|
|
2015-02-27 10:47:21 +08:00
|
|
|
# $(full_classes_jack) is just by-product of $(built_dex_intermediate).
|
|
|
|
# The dummy command was added because, without it, make misses the fact the $(built_dex) also
|
|
|
|
# change $(full_classes_jack).
|
2014-09-08 20:45:14 +08:00
|
|
|
$(full_classes_jack): $(built_dex_intermediate)
|
2015-02-27 10:47:21 +08:00
|
|
|
$(hide) touch $@
|
2015-02-05 22:27:38 +08:00
|
|
|
|
2015-12-09 17:06:20 +08:00
|
|
|
$(call define-dex-to-toc-rule, $(intermediates.COMMON))
|
|
|
|
|
2014-09-08 20:45:14 +08:00
|
|
|
endif #LOCAL_IS_STATIC_JAVA_LIBRARY
|
|
|
|
|
2016-08-05 23:45:10 +08:00
|
|
|
$(noshrob_classes_jack): PRIVATE_JACK_PLUGIN_PATH := $(LOCAL_JACK_PLUGIN_PATH)
|
2016-09-19 23:49:03 +08:00
|
|
|
$(noshrob_classes_jack): PRIVATE_JACK_PLUGIN := $(LOCAL_JACK_PLUGIN)
|
2015-01-09 17:36:40 +08:00
|
|
|
$(noshrob_classes_jack): PRIVATE_JACK_INTERMEDIATES_DIR := $(intermediates.COMMON)/jack-noshrob-rsc
|
2014-09-08 20:45:14 +08:00
|
|
|
$(noshrob_classes_jack): PRIVATE_JACK_PROGUARD_FLAGS :=
|
2016-08-05 23:45:10 +08:00
|
|
|
$(noshrob_classes_jack): $(jack_all_deps) $(LOCAL_JACK_PLUGIN_PATH) | setup-jack-server
|
2014-09-08 20:45:14 +08:00
|
|
|
@echo Building with Jack: $@
|
|
|
|
$(java-to-jack)
|
|
|
|
endif # full_classes_jar is defined
|
2016-12-22 06:29:13 +08:00
|
|
|
endif # LOCAL_JACK_ENABLED
|