2009-03-04 03:28:42 +00:00
|
|
|
# Requires:
|
|
|
|
# LOCAL_MODULE_SUFFIX
|
|
|
|
# LOCAL_MODULE_CLASS
|
|
|
|
# all_res_assets
|
|
|
|
|
2012-04-19 22:36:18 +00:00
|
|
|
ifeq ($(TARGET_BUILD_PDK),true)
|
2012-06-07 00:19:29 +00:00
|
|
|
ifeq ($(TARGET_BUILD_PDK_JAVA_PLATFORM),)
|
2012-04-19 22:36:18 +00:00
|
|
|
# LOCAL_SDK not defined or set to current
|
|
|
|
ifeq ($(filter-out current,$(LOCAL_SDK_VERSION)),)
|
2014-10-18 01:26:39 +00:00
|
|
|
ifneq ($(LOCAL_NO_STANDARD_LIBRARIES),true)
|
2012-04-19 22:36:18 +00:00
|
|
|
LOCAL_SDK_VERSION := $(PDK_BUILD_SDK_VERSION)
|
2014-10-18 01:26:39 +00:00
|
|
|
endif #!LOCAL_NO_STANDARD_LIBRARIES
|
2012-04-19 22:36:18 +00:00
|
|
|
endif
|
2012-05-16 17:32:41 +00:00
|
|
|
endif # !PDK_JAVA
|
2012-04-19 22:36:18 +00:00
|
|
|
endif #PDK
|
|
|
|
|
2009-03-04 03:28:42 +00:00
|
|
|
LOCAL_NO_STANDARD_LIBRARIES:=$(strip $(LOCAL_NO_STANDARD_LIBRARIES))
|
|
|
|
LOCAL_SDK_VERSION:=$(strip $(LOCAL_SDK_VERSION))
|
|
|
|
|
|
|
|
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 00:25:51 +00: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 01:21:36 +00:00
|
|
|
LOCAL_JAVA_LIBRARIES := android_stubs_current $(LOCAL_JAVA_LIBRARIES)
|
2014-07-20 00:00:50 +00:00
|
|
|
else ifeq ($(LOCAL_SDK_VERSION)$(TARGET_BUILD_APPS),system_current)
|
|
|
|
LOCAL_JAVA_LIBRARIES := android_system_stubs_current $(LOCAL_JAVA_LIBRARIES)
|
2010-01-25 17:56:41 +00:00
|
|
|
else
|
|
|
|
LOCAL_JAVA_LIBRARIES := sdk_v$(LOCAL_SDK_VERSION) $(LOCAL_JAVA_LIBRARIES)
|
|
|
|
endif
|
2009-03-04 03:28:42 +00:00
|
|
|
endif
|
|
|
|
endif
|
|
|
|
else
|
|
|
|
ifneq ($(LOCAL_NO_STANDARD_LIBRARIES),true)
|
2013-08-06 22:07:18 +00:00
|
|
|
LOCAL_JAVA_LIBRARIES := $(TARGET_DEFAULT_JAVA_LIBRARIES) $(LOCAL_JAVA_LIBRARIES)
|
2009-03-04 03:28:42 +00:00
|
|
|
endif
|
|
|
|
endif
|
2010-11-03 01:43:16 +00:00
|
|
|
|
|
|
|
proto_sources := $(filter %.proto,$(LOCAL_SRC_FILES))
|
|
|
|
ifneq ($(proto_sources),)
|
|
|
|
ifeq ($(LOCAL_PROTOC_OPTIMIZE_TYPE),micro)
|
2014-09-16 00:51:11 +00:00
|
|
|
LOCAL_STATIC_JAVA_LIBRARIES += libprotobuf-java-micro
|
2010-11-03 01:43:16 +00:00
|
|
|
else
|
2013-03-28 21:02:14 +00:00
|
|
|
ifeq ($(LOCAL_PROTOC_OPTIMIZE_TYPE),nano)
|
2014-09-16 00:51:11 +00:00
|
|
|
LOCAL_STATIC_JAVA_LIBRARIES += libprotobuf-java-nano
|
2013-03-28 21:02:14 +00:00
|
|
|
else
|
2014-09-16 00:51:11 +00:00
|
|
|
LOCAL_STATIC_JAVA_LIBRARIES += libprotobuf-java-lite
|
2013-03-28 21:02:14 +00:00
|
|
|
endif
|
2010-11-03 01:43:16 +00:00
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
2014-10-29 22:48:32 +00:00
|
|
|
# LOCAL_STATIC_JAVA_AAR_LIBRARIES are special LOCAL_STATIC_JAVA_LIBRARIES
|
|
|
|
LOCAL_STATIC_JAVA_LIBRARIES := $(strip $(LOCAL_STATIC_JAVA_LIBRARIES) $(LOCAL_STATIC_JAVA_AAR_LIBRARIES))
|
|
|
|
|
2009-12-08 02:14:00 +00:00
|
|
|
LOCAL_JAVA_LIBRARIES := $(sort $(LOCAL_JAVA_LIBRARIES))
|
2009-03-04 03:28:42 +00: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 19:33:40 +00: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)
|
|
|
|
|
|
|
|
# Choose leaf name for the compiled jar file.
|
2012-08-21 23:59:01 +00:00
|
|
|
ifeq ($(LOCAL_EMMA_INSTRUMENT),true)
|
2009-07-17 19:33:40 +00:00
|
|
|
full_classes_compiled_jar_leaf := classes-no-debug-var.jar
|
2013-08-20 15:05:27 +00:00
|
|
|
built_dex_intermediate_leaf := no-local
|
2009-07-17 19:33:40 +00:00
|
|
|
else
|
|
|
|
full_classes_compiled_jar_leaf := classes-full-debug.jar
|
2013-08-20 15:05:27 +00:00
|
|
|
built_dex_intermediate_leaf := with-local
|
2010-09-23 18:48:38 +00:00
|
|
|
endif
|
|
|
|
|
|
|
|
ifeq ($(LOCAL_PROGUARD_ENABLED),disabled)
|
|
|
|
LOCAL_PROGUARD_ENABLED :=
|
2009-07-17 19:33:40 +00:00
|
|
|
endif
|
|
|
|
|
2010-09-23 18:48:38 +00:00
|
|
|
ifdef LOCAL_PROGUARD_ENABLED
|
|
|
|
proguard_jar_leaf := proguard.classes.jar
|
|
|
|
else
|
|
|
|
proguard_jar_leaf := noproguard.classes.jar
|
|
|
|
endif
|
|
|
|
|
|
|
|
full_classes_compiled_jar := $(intermediates.COMMON)/$(full_classes_compiled_jar_leaf)
|
2010-07-07 21:07:24 +00:00
|
|
|
jarjar_leaf := classes-jarjar.jar
|
|
|
|
full_classes_jarjar_jar := $(intermediates.COMMON)/$(jarjar_leaf)
|
2009-07-17 19:33:40 +00:00
|
|
|
emma_intermediates_dir := $(intermediates.COMMON)/emma_out
|
2010-07-07 21:07:24 +00:00
|
|
|
# emma is hardcoded to use the leaf name of its input for the output file --
|
|
|
|
# only the output directory can be changed
|
|
|
|
full_classes_emma_jar := $(emma_intermediates_dir)/lib/$(jarjar_leaf)
|
2010-09-23 18:48:38 +00:00
|
|
|
full_classes_proguard_jar := $(intermediates.COMMON)/$(proguard_jar_leaf)
|
2013-08-20 15:05:27 +00:00
|
|
|
built_dex_intermediate := $(intermediates.COMMON)/$(built_dex_intermediate_leaf)/classes.dex
|
2010-09-23 18:48:38 +00:00
|
|
|
full_classes_stubs_jar := $(intermediates.COMMON)/stubs.jar
|
|
|
|
|
2013-08-29 00:28:36 +00: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 20:04:46 +00:00
|
|
|
full_classes_jar :=
|
|
|
|
built_dex :=
|
|
|
|
else
|
2010-09-23 18:48:38 +00:00
|
|
|
full_classes_jar := $(intermediates.COMMON)/classes.jar
|
2013-09-13 00:35:21 +00:00
|
|
|
built_dex := $(intermediates.COMMON)/classes.dex
|
2013-08-28 20:04:46 +00:00
|
|
|
endif
|
2014-09-08 12:45:14 +00: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
|
2009-07-17 19:33:40 +00:00
|
|
|
|
|
|
|
LOCAL_INTERMEDIATE_TARGETS += \
|
|
|
|
$(full_classes_compiled_jar) \
|
2010-09-23 18:48:38 +00:00
|
|
|
$(full_classes_jarjar_jar) \
|
2009-07-17 19:33:40 +00:00
|
|
|
$(full_classes_emma_jar) \
|
2010-09-23 18:48:38 +00:00
|
|
|
$(full_classes_jar) \
|
2010-10-03 01:35:51 +00:00
|
|
|
$(full_classes_proguard_jar) \
|
2010-09-23 18:48:38 +00:00
|
|
|
$(built_dex_intermediate) \
|
2014-09-08 12:45:14 +00:00
|
|
|
$(full_classes_jack) \
|
|
|
|
$(noshrob_classes_jack) \
|
2010-03-10 23:48:03 +00:00
|
|
|
$(built_dex) \
|
2010-09-23 18:48:38 +00:00
|
|
|
$(full_classes_stubs_jar)
|
|
|
|
|
2009-07-17 19:33:40 +00:00
|
|
|
|
2010-05-18 01:16:11 +00:00
|
|
|
LOCAL_INTERMEDIATE_SOURCE_DIR := $(intermediates.COMMON)/src
|
2009-07-17 19:33:40 +00:00
|
|
|
|
2010-07-16 00:17:52 +00:00
|
|
|
###############################################################
|
|
|
|
## .rs files: RenderScript sources to .java files and .bc files
|
2012-10-11 22:01:53 +00:00
|
|
|
## .fs files: Filterscript sources to .java files and .bc files
|
2010-07-16 00:17:52 +00:00
|
|
|
###############################################################
|
2012-10-11 22:01:53 +00:00
|
|
|
renderscript_sources := $(filter %.rs %.fs,$(LOCAL_SRC_FILES))
|
2010-07-16 00:17:52 +00: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 :=
|
2013-02-07 00:19:30 +00:00
|
|
|
rs_compatibility_jni_libs :=
|
2010-07-16 00:17:52 +00:00
|
|
|
ifneq ($(renderscript_sources),)
|
|
|
|
renderscript_sources_fullpath := $(addprefix $(LOCAL_PATH)/, $(renderscript_sources))
|
|
|
|
RenderScript_file_stamp := $(LOCAL_INTERMEDIATE_SOURCE_DIR)/RenderScript.stamp
|
2013-02-26 00:06:42 +00:00
|
|
|
renderscript_intermediate.COMMON := $(LOCAL_INTERMEDIATE_SOURCE_DIR)/renderscript
|
2010-07-16 00:17:52 +00:00
|
|
|
|
2011-08-10 20:53:05 +00:00
|
|
|
renderscript_target_api :=
|
2011-08-30 01:53:53 +00:00
|
|
|
|
|
|
|
ifneq (,$(LOCAL_RENDERSCRIPT_TARGET_API))
|
|
|
|
renderscript_target_api := $(LOCAL_RENDERSCRIPT_TARGET_API)
|
|
|
|
else
|
2011-08-10 20:53:05 +00:00
|
|
|
ifneq (,$(LOCAL_SDK_VERSION))
|
2011-08-30 01:53:53 +00:00
|
|
|
# Set target-api for LOCAL_SDK_VERSIONs other than current.
|
2014-07-20 00:00:50 +00:00
|
|
|
ifneq (,$(filter-out current system_current, $(LOCAL_SDK_VERSION)))
|
2011-08-10 20:53:05 +00:00
|
|
|
renderscript_target_api := $(LOCAL_SDK_VERSION)
|
|
|
|
endif
|
|
|
|
endif # LOCAL_SDK_VERSION is set
|
2011-08-30 01:53:53 +00:00
|
|
|
endif # LOCAL_RENDERSCRIPT_TARGET_API is set
|
2011-08-10 20:53:05 +00:00
|
|
|
|
|
|
|
ifeq ($(LOCAL_RENDERSCRIPT_CC),)
|
|
|
|
LOCAL_RENDERSCRIPT_CC := $(LLVM_RS_CC)
|
|
|
|
endif
|
|
|
|
|
2011-12-07 02:43:24 +00: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-01 20:28:52 +00:00
|
|
|
# prepend the RenderScript system include path
|
2014-07-20 00:00:50 +00:00
|
|
|
ifneq ($(filter-out current system_current,$(LOCAL_SDK_VERSION))$(if $(TARGET_BUILD_APPS),$(filter current system_current,$(LOCAL_SDK_VERSION))),)
|
2012-05-11 00:25:51 +00:00
|
|
|
# if a numeric LOCAL_SDK_VERSION, or current LOCAL_SDK_VERSION with TARGET_BUILD_APPS
|
2011-03-29 18:47:12 +00:00
|
|
|
LOCAL_RENDERSCRIPT_INCLUDES := \
|
2012-03-07 05:48:36 +00:00
|
|
|
$(HISTORICAL_SDK_VERSIONS_ROOT)/renderscript/clang-include \
|
|
|
|
$(HISTORICAL_SDK_VERSIONS_ROOT)/renderscript/include \
|
2011-03-29 18:47:12 +00:00
|
|
|
$(LOCAL_RENDERSCRIPT_INCLUDES)
|
|
|
|
else
|
2011-01-19 19:49:21 +00:00
|
|
|
LOCAL_RENDERSCRIPT_INCLUDES := \
|
2011-08-10 20:53:05 +00:00
|
|
|
$(TOPDIR)external/clang/lib/Headers \
|
2012-03-28 21:22:55 +00:00
|
|
|
$(TOPDIR)frameworks/rs/scriptc \
|
2011-08-10 20:53:05 +00:00
|
|
|
$(LOCAL_RENDERSCRIPT_INCLUDES)
|
2011-05-26 00:16:22 +00:00
|
|
|
endif
|
|
|
|
|
2011-08-24 05:01:49 +00:00
|
|
|
ifneq ($(LOCAL_RENDERSCRIPT_INCLUDES_OVERRIDE),)
|
|
|
|
LOCAL_RENDERSCRIPT_INCLUDES := $(LOCAL_RENDERSCRIPT_INCLUDES_OVERRIDE)
|
|
|
|
endif
|
|
|
|
|
2010-09-01 20:28:52 +00:00
|
|
|
$(RenderScript_file_stamp): PRIVATE_RS_INCLUDES := $(LOCAL_RENDERSCRIPT_INCLUDES)
|
2011-05-26 00:16:22 +00:00
|
|
|
$(RenderScript_file_stamp): PRIVATE_RS_CC := $(LOCAL_RENDERSCRIPT_CC)
|
2011-12-07 02:43:24 +00:00
|
|
|
$(RenderScript_file_stamp): PRIVATE_RS_FLAGS := $(renderscript_flags)
|
2010-07-16 00:17:52 +00: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 00:06:42 +00:00
|
|
|
$(RenderScript_file_stamp): PRIVATE_RS_OUTPUT_DIR := $(renderscript_intermediate.COMMON)
|
2011-08-10 20:53:05 +00:00
|
|
|
$(RenderScript_file_stamp): PRIVATE_RS_TARGET_API := $(renderscript_target_api)
|
2011-05-26 00:16:22 +00:00
|
|
|
$(RenderScript_file_stamp): $(renderscript_sources_fullpath) $(LOCAL_RENDERSCRIPT_CC)
|
2010-07-16 00:17:52 +00:00
|
|
|
$(transform-renderscripts-to-java-and-bc)
|
|
|
|
|
2012-11-29 00:52:41 +00:00
|
|
|
ifneq ($(LOCAL_RENDERSCRIPT_COMPATIBILITY),)
|
|
|
|
bc_files := $(patsubst %.fs,%.bc, $(patsubst %.rs,%.bc, $(notdir $(renderscript_sources))))
|
2015-01-08 02:18:41 +00: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 00:52:41 +00:00
|
|
|
rs_generated_bc := $(addprefix \
|
2015-01-08 02:18:41 +00:00
|
|
|
$(renderscript_intermediate.bc_folder), $(bc_files))
|
2012-11-29 00:52:41 +00:00
|
|
|
|
2013-02-26 00:06:42 +00:00
|
|
|
renderscript_intermediate := $(intermediates)/renderscript
|
2013-05-13 22:46:37 +00:00
|
|
|
|
|
|
|
# We don't need the .so files in bundled branches
|
|
|
|
# Prevent these from showing up on the device
|
2013-09-30 22:57:36 +00:00
|
|
|
ifneq (,$(TARGET_BUILD_APPS)$(FORCE_BUILD_RS_COMPAT))
|
2013-05-13 22:46:37 +00:00
|
|
|
|
2012-11-29 00:52:41 +00:00
|
|
|
rs_compatibility_jni_libs := $(addprefix \
|
2013-02-16 07:02:20 +00:00
|
|
|
$(renderscript_intermediate)/librs., \
|
2012-11-29 00:52:41 +00:00
|
|
|
$(patsubst %.bc,%.so, $(bc_files)))
|
|
|
|
|
|
|
|
$(rs_generated_bc) : $(RenderScript_file_stamp)
|
|
|
|
|
2012-12-17 22:23:14 +00:00
|
|
|
rs_support_lib := $(TARGET_OUT_INTERMEDIATE_LIBRARIES)/libRSSupport.so
|
|
|
|
rs_jni_lib := $(TARGET_OUT_INTERMEDIATE_LIBRARIES)/librsjni.so
|
2013-02-13 22:13:23 +00:00
|
|
|
LOCAL_JNI_SHARED_LIBRARIES += libRSSupport librsjni
|
2012-12-17 22:23:14 +00:00
|
|
|
|
2014-11-20 19:05:18 +00: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-13 22:46:37 +00:00
|
|
|
|
|
|
|
|
2013-03-05 19:07:15 +00:00
|
|
|
$(rs_compatibility_jni_libs): $(RenderScript_file_stamp) $(RS_PREBUILT_CLCORE) \
|
2014-11-20 19:05:18 +00:00
|
|
|
$(rs_support_lib) $(rs_support_io_lib) $(rs_jni_lib) $(rs_compiler_rt)
|
2013-03-27 23:51:38 +00:00
|
|
|
$(rs_compatibility_jni_libs): $(BCC_COMPAT)
|
2012-11-29 00:52:41 +00:00
|
|
|
$(rs_compatibility_jni_libs): PRIVATE_CXX := $(TARGET_CXX)
|
2013-02-16 07:02:20 +00:00
|
|
|
$(rs_compatibility_jni_libs): $(renderscript_intermediate)/librs.%.so: \
|
2015-01-08 02:18:41 +00:00
|
|
|
$(renderscript_intermediate.bc_folder)%.bc
|
2012-11-29 00:52:41 +00:00
|
|
|
$(transform-bc-to-so)
|
|
|
|
|
|
|
|
endif
|
|
|
|
|
2013-05-13 22:46:37 +00:00
|
|
|
endif
|
|
|
|
|
2010-10-08 23:57:46 +00:00
|
|
|
# include the dependency files (.d) generated by llvm-rs-cc.
|
2013-02-26 00:06:42 +00:00
|
|
|
renderscript_generated_dep_files := $(addprefix $(renderscript_intermediate.COMMON)/, \
|
2012-10-11 22:01:53 +00:00
|
|
|
$(patsubst %.fs,%.d, $(patsubst %.rs,%.d, $(notdir $(renderscript_sources)))))
|
2010-10-08 01:57:57 +00:00
|
|
|
-include $(renderscript_generated_dep_files)
|
|
|
|
|
2010-07-16 00:17:52 +00:00
|
|
|
LOCAL_INTERMEDIATE_TARGETS += $(RenderScript_file_stamp)
|
|
|
|
# Make sure the generated resource will be added to the apk.
|
|
|
|
LOCAL_RESOURCE_DIR := $(LOCAL_INTERMEDIATE_SOURCE_DIR)/renderscript/res $(LOCAL_RESOURCE_DIR)
|
|
|
|
endif
|
|
|
|
|
2013-01-30 19:22:06 +00: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-01-20 14:18:48 +00:00
|
|
|
ifdef full_classes_jar
|
2013-01-30 19:22:06 +00:00
|
|
|
java_alternative_checked_module := $(full_classes_compiled_jar)
|
2013-08-28 20:04:46 +00:00
|
|
|
else
|
2015-01-20 14:18:48 +00:00
|
|
|
java_alternative_checked_module :=
|
2013-08-28 20:04:46 +00:00
|
|
|
endif
|
2013-01-30 19:22:06 +00:00
|
|
|
|
2009-07-17 19:33:40 +00:00
|
|
|
# TODO: It looks like the only thing we need from base_rules is
|
|
|
|
# all_java_sources. See if we can get that by adding a
|
|
|
|
# common_java.mk, and moving the include of base_rules.mk to
|
|
|
|
# after all the declarations.
|
|
|
|
|
2009-03-04 03:28:42 +00:00
|
|
|
#######################################
|
|
|
|
include $(BUILD_SYSTEM)/base_rules.mk
|
|
|
|
#######################################
|
|
|
|
|
2013-01-30 19:22:06 +00:00
|
|
|
java_alternative_checked_module :=
|
|
|
|
|
2013-11-15 07:44:56 +00:00
|
|
|
#######################################
|
|
|
|
# defines built_odex along with rule to install odex
|
|
|
|
include $(BUILD_SYSTEM)/dex_preopt_odex_install.mk
|
|
|
|
#######################################
|
|
|
|
|
2013-08-28 20:04:46 +00: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
|
|
|
|
|
2013-02-07 00:19:30 +00:00
|
|
|
# Install the RS compatibility libraries to /system/lib/ if necessary
|
|
|
|
ifdef rs_compatibility_jni_libs
|
|
|
|
installed_rs_compatibility_jni_libs := $(addprefix $(TARGET_OUT_SHARED_LIBRARIES)/,\
|
|
|
|
$(notdir $(rs_compatibility_jni_libs)))
|
|
|
|
# Provide a way to skip sources included in multiple projects.
|
|
|
|
ifdef LOCAL_RENDERSCRIPT_SKIP_INSTALL
|
|
|
|
skip_install_rs_libs := $(patsubst %.rs,%.so, \
|
2013-02-19 22:31:59 +00:00
|
|
|
$(addprefix $(TARGET_OUT_SHARED_LIBRARIES)/librs., \
|
2013-02-07 00:19:30 +00:00
|
|
|
$(notdir $(LOCAL_RENDERSCRIPT_SKIP_INSTALL))))
|
|
|
|
installed_rs_compatibility_jni_libs := \
|
|
|
|
$(filter-out $(skip_install_rs_libs),$(installed_rs_compatibility_jni_libs))
|
|
|
|
endif
|
|
|
|
ifneq (,$(strip $(installed_rs_compatibility_jni_libs)))
|
|
|
|
$(installed_rs_compatibility_jni_libs) : $(TARGET_OUT_SHARED_LIBRARIES)/lib%.so : \
|
|
|
|
$(renderscript_intermediate)/lib%.so
|
|
|
|
$(hide) mkdir -p $(dir $@) && cp -f $< $@
|
|
|
|
|
|
|
|
# Install them only if the current module is installed.
|
|
|
|
$(LOCAL_INSTALLED_MODULE) : $(installed_rs_compatibility_jni_libs)
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
2009-03-04 03:28:42 +00:00
|
|
|
# We use intermediates.COMMON because the classes.jar/.dex files will be
|
|
|
|
# common even if LOCAL_BUILT_MODULE isn't.
|
|
|
|
#
|
|
|
|
# Override some target variables that base_rules set up for us.
|
|
|
|
$(LOCAL_INTERMEDIATE_TARGETS): \
|
|
|
|
PRIVATE_CLASS_INTERMEDIATES_DIR := $(intermediates.COMMON)/classes
|
|
|
|
$(LOCAL_INTERMEDIATE_TARGETS): \
|
2010-05-18 01:16:11 +00:00
|
|
|
PRIVATE_SOURCE_INTERMEDIATES_DIR := $(LOCAL_INTERMEDIATE_SOURCE_DIR)
|
2009-03-04 03:28:42 +00:00
|
|
|
|
|
|
|
# Since we're using intermediates.COMMON, make sure that it gets cleaned
|
|
|
|
# properly.
|
|
|
|
$(cleantarget): PRIVATE_CLEAN_FILES += $(intermediates.COMMON)
|
|
|
|
|
2013-08-28 20:04:46 +00:00
|
|
|
ifdef full_classes_jar
|
2009-03-04 03:28:42 +00:00
|
|
|
|
2009-04-10 02:31:12 +00: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.
|
|
|
|
# - Use the classes.jar instead of the handful of other intermediates that
|
|
|
|
# we have, because it's the most processed, but still hasn't had dex run on
|
|
|
|
# it, so it's closest to what's on the device.
|
|
|
|
# - This extra copy, with the dependency on LOCAL_BUILT_MODULE allows the
|
|
|
|
# PRIVATE_ vars to be preserved.
|
|
|
|
$(full_classes_stubs_jar): PRIVATE_SOURCE_FILE := $(full_classes_jar)
|
2014-09-08 12:45:14 +00:00
|
|
|
$(full_classes_stubs_jar) : $(full_classes_jar) | $(ACP)
|
2009-04-10 02:31:12 +00:00
|
|
|
@echo Copying $(PRIVATE_SOURCE_FILE)
|
|
|
|
$(hide) $(ACP) -fp $(PRIVATE_SOURCE_FILE) $@
|
|
|
|
ALL_MODULES.$(LOCAL_MODULE).STUBS := $(full_classes_stubs_jar)
|
|
|
|
|
2011-10-31 04:37:35 +00: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-18 17:54:49 +00:00
|
|
|
$(full_classes_compiled_jar): PRIVATE_WARNINGS_ENABLE := $(LOCAL_WARNINGS_ENABLE)
|
2011-10-31 04:37:35 +00:00
|
|
|
|
2013-08-14 23:59:00 +00:00
|
|
|
ifdef LOCAL_RMTYPEDEFS
|
|
|
|
$(full_classes_compiled_jar): | $(RMTYPEDEFS)
|
|
|
|
endif
|
|
|
|
|
2009-03-25 02:07:34 +00: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.
|
2010-02-01 19:13:32 +00:00
|
|
|
$(full_classes_compiled_jar): PRIVATE_JAVACFLAGS := $(LOCAL_JAVACFLAGS)
|
2011-12-16 00:36:55 +00:00
|
|
|
$(full_classes_compiled_jar): PRIVATE_JAR_EXCLUDE_FILES := $(LOCAL_JAR_EXCLUDE_FILES)
|
2013-07-18 03:29:51 +00:00
|
|
|
$(full_classes_compiled_jar): PRIVATE_JAR_PACKAGES := $(LOCAL_JAR_PACKAGES)
|
2014-05-24 01:41:19 +00:00
|
|
|
$(full_classes_compiled_jar): PRIVATE_JAR_EXCLUDE_PACKAGES := $(LOCAL_JAR_EXCLUDE_PACKAGES)
|
2013-08-14 23:59:00 +00:00
|
|
|
$(full_classes_compiled_jar): PRIVATE_RMTYPEDEFS := $(LOCAL_RMTYPEDEFS)
|
2012-08-30 19:59:42 +00:00
|
|
|
$(full_classes_compiled_jar): PRIVATE_DONT_DELETE_JAR_META_INF := $(LOCAL_DONT_DELETE_JAR_META_INF)
|
2014-11-09 06:20:03 +00:00
|
|
|
$(full_classes_compiled_jar): \
|
|
|
|
$(java_sources) \
|
|
|
|
$(java_resource_sources) \
|
|
|
|
$(full_java_lib_deps) \
|
|
|
|
$(jar_manifest_file) \
|
|
|
|
$(layers_file) \
|
|
|
|
$(RenderScript_file_stamp) \
|
|
|
|
$(proto_java_sources_file_stamp) \
|
|
|
|
$(LOCAL_MODULE_MAKEFILE) \
|
|
|
|
$(LOCAL_ADDITIONAL_DEPENDENCIES)
|
2009-03-25 02:07:34 +00:00
|
|
|
$(transform-java-to-classes.jar)
|
|
|
|
|
2009-03-04 03:28:42 +00:00
|
|
|
$(full_classes_compiled_jar): PRIVATE_JAVAC_DEBUG_FLAGS := -g
|
|
|
|
|
2010-07-07 21:07:24 +00:00
|
|
|
# Run jarjar if necessary, otherwise just copy the file.
|
|
|
|
ifneq ($(strip $(LOCAL_JARJAR_RULES)),)
|
|
|
|
$(full_classes_jarjar_jar): PRIVATE_JARJAR_RULES := $(LOCAL_JARJAR_RULES)
|
2013-06-04 15:48:13 +00:00
|
|
|
$(full_classes_jarjar_jar): $(full_classes_compiled_jar) $(LOCAL_JARJAR_RULES) | $(JARJAR)
|
2010-07-07 21:07:24 +00:00
|
|
|
@echo JarJar: $@
|
|
|
|
$(hide) java -jar $(JARJAR) process $(PRIVATE_JARJAR_RULES) $< $@
|
|
|
|
else
|
|
|
|
$(full_classes_jarjar_jar): $(full_classes_compiled_jar) | $(ACP)
|
|
|
|
@echo Copying: $@
|
2011-01-19 01:21:20 +00:00
|
|
|
$(hide) $(ACP) -fp $< $@
|
2010-07-07 21:07:24 +00:00
|
|
|
endif
|
|
|
|
|
2012-08-21 23:59:01 +00:00
|
|
|
ifeq ($(LOCAL_EMMA_INSTRUMENT),true)
|
2009-03-04 03:28:42 +00:00
|
|
|
$(full_classes_emma_jar): PRIVATE_EMMA_COVERAGE_FILE := $(intermediates.COMMON)/coverage.em
|
|
|
|
$(full_classes_emma_jar): PRIVATE_EMMA_INTERMEDIATES_DIR := $(emma_intermediates_dir)
|
2010-03-10 23:48:03 +00:00
|
|
|
# module level coverage filter can be defined using LOCAL_EMMA_COVERAGE_FILTER
|
|
|
|
# in Android.mk
|
|
|
|
ifdef LOCAL_EMMA_COVERAGE_FILTER
|
|
|
|
$(full_classes_emma_jar): PRIVATE_EMMA_COVERAGE_FILTER := $(LOCAL_EMMA_COVERAGE_FILTER)
|
|
|
|
else
|
|
|
|
# by default, avoid applying emma instrumentation onto emma classes itself,
|
|
|
|
# otherwise there will be exceptions thrown
|
|
|
|
$(full_classes_emma_jar): PRIVATE_EMMA_COVERAGE_FILTER := *,-emma,-emmarun,-com.vladium.*
|
|
|
|
endif
|
2009-03-04 03:28:42 +00:00
|
|
|
# this rule will generate both $(PRIVATE_EMMA_COVERAGE_FILE) and
|
|
|
|
# $(full_classes_emma_jar)
|
2010-07-07 21:07:24 +00:00
|
|
|
$(full_classes_emma_jar): $(full_classes_jarjar_jar) | $(EMMA_JAR)
|
2009-03-04 03:28:42 +00:00
|
|
|
$(transform-classes.jar-to-emma)
|
2010-03-10 01:24:32 +00:00
|
|
|
|
2009-03-04 03:28:42 +00:00
|
|
|
else
|
2010-07-07 21:07:24 +00:00
|
|
|
$(full_classes_emma_jar): $(full_classes_jarjar_jar) | $(ACP)
|
2009-03-04 03:28:42 +00:00
|
|
|
@echo Copying: $@
|
2010-07-07 21:07:24 +00:00
|
|
|
$(copy-file-to-target)
|
2009-03-04 03:28:42 +00:00
|
|
|
endif
|
|
|
|
|
2010-02-01 17:51:23 +00:00
|
|
|
# Keep a copy of the jar just before proguard processing.
|
2010-10-03 01:35:51 +00:00
|
|
|
$(full_classes_jar): $(full_classes_emma_jar) | $(ACP)
|
2010-02-01 17:51:23 +00:00
|
|
|
@echo Copying: $@
|
2011-01-19 01:21:20 +00:00
|
|
|
$(hide) $(ACP) -fp $< $@
|
2010-02-01 17:51:23 +00:00
|
|
|
|
2010-10-03 01:35:51 +00:00
|
|
|
# Run proguard if necessary, otherwise just copy the file.
|
2013-08-22 01:32:49 +00:00
|
|
|
ifdef LOCAL_PROGUARD_ENABLED
|
2014-09-10 00:08:46 +00:00
|
|
|
ifneq ($(filter-out full custom nosystem obfuscation optimization shrinktests,$(LOCAL_PROGUARD_ENABLED)),)
|
2013-08-22 01:32:49 +00:00
|
|
|
$(warning while processing: $(LOCAL_MODULE))
|
|
|
|
$(error invalid value for LOCAL_PROGUARD_ENABLED: $(LOCAL_PROGUARD_ENABLED))
|
|
|
|
endif
|
2009-08-30 20:39:24 +00:00
|
|
|
proguard_dictionary := $(intermediates.COMMON)/proguard_dictionary
|
2014-09-08 12:45:14 +00:00
|
|
|
# jack already has the libraries in its classpath and doesn't support jars
|
|
|
|
legacy_proguard_flags := $(addprefix -libraryjars ,$(full_shared_java_libs))
|
|
|
|
common_proguard_flags := \
|
2009-08-30 20:39:24 +00:00
|
|
|
-forceprocessing \
|
|
|
|
-printmapping $(proguard_dictionary)
|
2013-08-22 01:32:49 +00:00
|
|
|
|
|
|
|
ifeq ($(filter nosystem,$(LOCAL_PROGUARD_ENABLED)),)
|
2014-09-08 12:45:14 +00:00
|
|
|
common_proguard_flags += -include $(BUILD_SYSTEM)/proguard.flags
|
2012-08-27 23:01:38 +00:00
|
|
|
ifeq ($(LOCAL_EMMA_INSTRUMENT),true)
|
2014-09-08 12:45:14 +00:00
|
|
|
common_proguard_flags += -include $(BUILD_SYSTEM)/proguard.emma.flags
|
2012-08-27 23:01:38 +00:00
|
|
|
endif
|
2010-02-01 17:51:23 +00:00
|
|
|
# If this is a test package, add proguard keep flags for tests.
|
2013-08-22 01:32:49 +00:00
|
|
|
ifneq ($(LOCAL_INSTRUMENTATION_FOR)$(filter tests,$(LOCAL_MODULE_TAGS)),)
|
2014-09-08 12:45:14 +00:00
|
|
|
common_proguard_flags += -include $(BUILD_SYSTEM)/proguard_tests.flags
|
2014-09-10 00:08:46 +00:00
|
|
|
ifeq ($(filter shrinktests,$(LOCAL_PROGUARD_ENABLED)),)
|
2014-09-08 12:45:14 +00:00
|
|
|
common_proguard_flags += -dontshrink # don't shrink tests by default
|
2014-09-10 00:08:46 +00:00
|
|
|
endif # shrinktests
|
2010-02-01 17:51:23 +00:00
|
|
|
endif # test package
|
2013-08-22 01:32:49 +00:00
|
|
|
ifeq ($(filter obfuscation,$(LOCAL_PROGUARD_ENABLED)),)
|
|
|
|
# By default no obfuscation
|
2014-09-08 12:45:14 +00:00
|
|
|
common_proguard_flags += -dontobfuscate
|
2013-08-22 01:32:49 +00:00
|
|
|
endif # No obfuscation
|
|
|
|
ifeq ($(filter optimization,$(LOCAL_PROGUARD_ENABLED)),)
|
|
|
|
# By default no optimization
|
2014-09-08 12:45:14 +00:00
|
|
|
common_proguard_flags += -dontoptimize
|
2013-08-22 01:32:49 +00: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 12:45:14 +00:00
|
|
|
# jack already has this library in its classpath and doesn't support jars
|
|
|
|
legacy_proguard_flags += -libraryjars $(link_instr_classes_jar)
|
2013-08-22 01:32:49 +00: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 12:45:14 +00:00
|
|
|
legacy_proguard_flags := -injars $(link_instr_classes_jar) \
|
2013-08-22 01:32:49 +00: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 12:45:14 +00:00
|
|
|
$(legacy_proguard_flags)
|
|
|
|
# not supported with jack
|
Running jarjar on Java resources.
Before this change, Java resources are added as a separate step
(add-java-resources-to-package) after dex is run, so jarjar isn't run on
the resource files.
With this change, we add Java resources immediately after we call javac,
so jarjar is run on the resource files (the module's own resource, as
well as resources carried by static Java libraries).
When we generate the final apk/jar, we use the jarjar'ed jar as the
inital pacakge file, with class files and empty folders removed.
When jack is enabled, in jack-java-to-dex we add the Java resources to
a temp jar using the PRIVATE_EXTRA_JAR_ARGS, and extrac the files in a
temp dir. Jack will process the resource files and output the result to
PRIVATE_JACK_INTERMEDIATES_DIR. When we package the final apk/jar, we
need to call add-carried-jack-resources to readd the resources.
(TODO: if jack can output all resources to a jar/zip file, we can use
that file as the initial package file as well.)
Bug: 18837479
Change-Id: I8d7296e30ec8d005054cf04c4f2aed6d7a0d823b
2015-01-14 22:23:56 +00:00
|
|
|
ifeq ($(LOCAL_USE_JACK),true)
|
2014-09-08 12:45:14 +00:00
|
|
|
$(error $(LOCAL_MODULE): Build with jack of instrumentation when obfuscating is not yet supported)
|
|
|
|
endif
|
2013-08-22 01:32:49 +00:00
|
|
|
|
|
|
|
# Sometimes (test + main app) uses different keep rules from the main app -
|
|
|
|
# apply the main app's dictionary anyway.
|
2014-09-08 12:45:14 +00:00
|
|
|
legacy_proguard_flags += -ignorewarnings
|
2013-08-22 01:32:49 +00: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-30 20:39:24 +00:00
|
|
|
|
2010-09-29 21:50:41 +00:00
|
|
|
proguard_flag_files := $(addprefix $(LOCAL_PATH)/, $(LOCAL_PROGUARD_FLAG_FILES))
|
|
|
|
LOCAL_PROGUARD_FLAGS += $(addprefix -include , $(proguard_flag_files))
|
|
|
|
|
2014-02-07 15:18:59 +00: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
|
|
|
|
$(full_classes_proguard_jar): PRIVATE_EXTRA_INPUT_JAR := $(extra_input_jar)
|
2014-09-08 12:45:14 +00:00
|
|
|
$(full_classes_proguard_jar): PRIVATE_PROGUARD_FLAGS := $(legacy_proguard_flags) $(common_proguard_flags) $(LOCAL_PROGUARD_FLAGS)
|
2014-02-07 15:18:59 +00:00
|
|
|
$(full_classes_proguard_jar) : $(full_classes_jar) $(extra_input_jar) $(proguard_flag_files) | $(ACP) $(PROGUARD)
|
2010-02-01 17:51:23 +00:00
|
|
|
$(call transform-jar-to-proguard)
|
|
|
|
|
2013-08-22 01:32:49 +00:00
|
|
|
else # LOCAL_PROGUARD_ENABLED not defined
|
|
|
|
$(full_classes_proguard_jar) : $(full_classes_jar)
|
|
|
|
@echo Copying: $@
|
|
|
|
$(hide) $(ACP) -fp $< $@
|
|
|
|
|
|
|
|
endif # LOCAL_PROGUARD_ENABLED defined
|
|
|
|
|
2014-12-15 15:25:14 +00:00
|
|
|
ifneq ($(strip $(LOCAL_USE_JACK)),true)
|
2011-04-07 01:32:38 +00:00
|
|
|
# Override PRIVATE_INTERMEDIATES_DIR so that install-dex-debug
|
|
|
|
# will work even when intermediates != intermediates.COMMON.
|
|
|
|
$(built_dex_intermediate): PRIVATE_INTERMEDIATES_DIR := $(intermediates.COMMON)
|
|
|
|
$(built_dex_intermediate): PRIVATE_DX_FLAGS := $(LOCAL_DX_FLAGS)
|
2010-03-10 23:48:03 +00:00
|
|
|
# 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
|
2012-08-21 23:59:01 +00:00
|
|
|
ifeq ($(LOCAL_EMMA_INSTRUMENT),true)
|
2010-03-10 23:48:03 +00:00
|
|
|
$(built_dex_intermediate): PRIVATE_DX_FLAGS += --no-locals
|
|
|
|
endif
|
2010-10-03 01:35:51 +00:00
|
|
|
$(built_dex_intermediate): $(full_classes_proguard_jar) $(DX)
|
2009-03-04 03:28:42 +00:00
|
|
|
$(transform-classes.jar-to-dex)
|
2014-12-15 15:25:14 +00:00
|
|
|
endif # !LOCAL_USE_JACK
|
2014-09-08 12:45:14 +00:00
|
|
|
|
2010-03-10 23:48:03 +00:00
|
|
|
$(built_dex): $(built_dex_intermediate) | $(ACP)
|
|
|
|
@echo Copying: $@
|
2013-08-20 15:05:27 +00:00
|
|
|
$(hide) mkdir -p $(dir $@)
|
|
|
|
$(hide) rm -f $(dir $@)/classes*.dex
|
|
|
|
$(hide) $(ACP) -fp $(dir $<)/classes*.dex $(dir $@)
|
2009-03-04 03:28:42 +00:00
|
|
|
ifneq ($(GENERATE_DEX_DEBUG),)
|
|
|
|
$(install-dex-debug)
|
|
|
|
endif
|
|
|
|
|
|
|
|
findbugs_xml := $(intermediates.COMMON)/findbugs.xml
|
|
|
|
$(findbugs_xml) : PRIVATE_JAR_FILE := $(full_classes_jar)
|
|
|
|
$(findbugs_xml) : PRIVATE_AUXCLASSPATH := $(addprefix -auxclasspath ,$(strip \
|
|
|
|
$(call normalize-path-list,$(filter %.jar,\
|
|
|
|
$(full_java_libs)))))
|
|
|
|
# We can't depend directly on full_classes_jar because the PRIVATE_
|
|
|
|
# vars won't be set up correctly.
|
|
|
|
$(findbugs_xml) : $(LOCAL_BUILT_MODULE)
|
|
|
|
@echo Findbugs: $@
|
|
|
|
$(hide) $(FINDBUGS) -textui -effort:min -xml:withMessages \
|
|
|
|
$(PRIVATE_AUXCLASSPATH) \
|
|
|
|
$(PRIVATE_JAR_FILE) \
|
|
|
|
> $@
|
|
|
|
|
|
|
|
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 07:44:59 +00:00
|
|
|
@echo ConvertXmlToText: $@
|
2014-05-20 08:04:16 +00:00
|
|
|
$(hide) $(FINDBUGS_DIR)/convertXmlToText -html:fancy.xsl $(PRIVATE_XML_FILE) \
|
2009-03-04 03:28:42 +00:00
|
|
|
> $@
|
|
|
|
|
|
|
|
$(LOCAL_MODULE)-findbugs : $(findbugs_html)
|
|
|
|
|
2013-08-28 20:04:46 +00:00
|
|
|
endif # full_classes_jar is defined
|
2014-09-08 12:45:14 +00:00
|
|
|
|
Running jarjar on Java resources.
Before this change, Java resources are added as a separate step
(add-java-resources-to-package) after dex is run, so jarjar isn't run on
the resource files.
With this change, we add Java resources immediately after we call javac,
so jarjar is run on the resource files (the module's own resource, as
well as resources carried by static Java libraries).
When we generate the final apk/jar, we use the jarjar'ed jar as the
inital pacakge file, with class files and empty folders removed.
When jack is enabled, in jack-java-to-dex we add the Java resources to
a temp jar using the PRIVATE_EXTRA_JAR_ARGS, and extrac the files in a
temp dir. Jack will process the resource files and output the result to
PRIVATE_JACK_INTERMEDIATES_DIR. When we package the final apk/jar, we
need to call add-carried-jack-resources to readd the resources.
(TODO: if jack can output all resources to a jar/zip file, we can use
that file as the initial package file as well.)
Bug: 18837479
Change-Id: I8d7296e30ec8d005054cf04c4f2aed6d7a0d823b
2015-01-14 22:23:56 +00:00
|
|
|
ifeq ($(LOCAL_USE_JACK),true)
|
2014-09-08 12:45:14 +00:00
|
|
|
$(LOCAL_INTERMEDIATE_TARGETS): \
|
2014-11-19 13:01:06 +00:00
|
|
|
PRIVATE_JACK_INTERMEDIATES_DIR := $(intermediates.COMMON)/jack
|
2014-09-08 12:45:14 +00:00
|
|
|
|
|
|
|
ifdef full_classes_jar
|
|
|
|
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_JACK_DEBUG_FLAGS := -g
|
|
|
|
|
|
|
|
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
|
|
|
|
|
|
|
|
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_JACK_PROGUARD_FLAGS := $(common_proguard_flags) $(LOCAL_JACK_PROGUARD_FLAGS)
|
|
|
|
else # LOCAL_PROGUARD_ENABLED not defined
|
|
|
|
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_JACK_PROGUARD_FLAGS :=
|
|
|
|
endif # LOCAL_PROGUARD_ENABLED defined
|
|
|
|
|
|
|
|
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_JACK_FLAGS := $(LOCAL_JACK_FLAGS)
|
|
|
|
|
|
|
|
jack_all_deps := $(java_sources) $(java_resource_sources) $(full_jack_lib_deps) \
|
|
|
|
$(jar_manifest_file) $(layers_file) $(RenderScript_file_stamp) $(proguard_flag_files) \
|
|
|
|
$(proto_java_sources_file_stamp) $(LOCAL_ADDITIONAL_DEPENDENCIES) $(LOCAL_JARJAR_RULES) \
|
|
|
|
$(LOCAL_MODULE_MAKEFILE) $(JACK_JAR)
|
|
|
|
|
|
|
|
ifeq ($(LOCAL_IS_STATIC_JAVA_LIBRARY),true)
|
|
|
|
$(full_classes_jack): $(jack_all_deps)
|
|
|
|
@echo Building with Jack: $@
|
|
|
|
$(java-to-jack)
|
|
|
|
|
|
|
|
else #LOCAL_IS_STATIC_JAVA_LIBRARY
|
|
|
|
$(built_dex_intermediate): PRIVATE_CLASSES_JACK := $(full_classes_jack)
|
|
|
|
|
|
|
|
$(built_dex_intermediate): $(jack_all_deps)
|
|
|
|
@echo Building with Jack: $@
|
|
|
|
$(jack-java-to-dex)
|
|
|
|
|
|
|
|
$(full_classes_jack): $(built_dex_intermediate)
|
|
|
|
# nothing to do it's built as a side effect of $(built_dex_intermediate)
|
|
|
|
endif #LOCAL_IS_STATIC_JAVA_LIBRARY
|
|
|
|
|
|
|
|
$(noshrob_classes_jack): PRIVATE_JACK_INTERMEDIATES_DIR := $(intermediates.COMMON)/noshrob
|
|
|
|
$(noshrob_classes_jack): PRIVATE_JACK_PROGUARD_FLAGS :=
|
|
|
|
$(noshrob_classes_jack): $(jack_all_deps)
|
|
|
|
@echo Building with Jack: $@
|
|
|
|
$(java-to-jack)
|
|
|
|
endif # full_classes_jar is defined
|
|
|
|
endif # LOCAL_USE_JACK
|