Merge "Add strip mode mini-debug-info."
diff --git a/core/Makefile b/core/Makefile
index 907943e..c0294a6 100644
--- a/core/Makefile
+++ b/core/Makefile
@@ -434,9 +434,9 @@
pdk_fusion_log_tags_file := $(patsubst $(PRODUCT_OUT)/%,$(_pdk_fusion_intermediates)/%,$(filter $(event_log_tags_file),$(ALL_PDK_FUSION_FILES)))
$(all_event_log_tags_file): PRIVATE_SRC_FILES := $(all_event_log_tags_src) $(pdk_fusion_log_tags_file)
-$(all_event_log_tags_file): $(all_event_log_tags_src) $(pdk_fusion_log_tags_file)
+$(all_event_log_tags_file): $(all_event_log_tags_src) $(pdk_fusion_log_tags_file) $(MERGETAGS) build/tools/event_log_tags.py
$(hide) mkdir -p $(dir $@)
- $(hide) build/tools/merge-event-log-tags.py -o $@ $(PRIVATE_SRC_FILES)
+ $(hide) $(MERGETAGS) -o $@ $(PRIVATE_SRC_FILES)
# Include tags from all packages included in this product, plus all
# tags that are part of the system (ie, not in a vendor/ or device/
@@ -450,9 +450,9 @@
$(event_log_tags_file): PRIVATE_SRC_FILES := $(event_log_tags_src) $(pdk_fusion_log_tags_file)
$(event_log_tags_file): PRIVATE_MERGED_FILE := $(all_event_log_tags_file)
-$(event_log_tags_file): $(event_log_tags_src) $(all_event_log_tags_file) $(pdk_fusion_log_tags_file)
+$(event_log_tags_file): $(event_log_tags_src) $(all_event_log_tags_file) $(pdk_fusion_log_tags_file) $(MERGETAGS) build/tools/event_log_tags.py
$(hide) mkdir -p $(dir $@)
- $(hide) build/tools/merge-event-log-tags.py -o $@ -m $(PRIVATE_MERGED_FILE) $(PRIVATE_SRC_FILES)
+ $(hide) $(MERGETAGS) -o $@ -m $(PRIVATE_MERGED_FILE) $(PRIVATE_SRC_FILES)
event-log-tags: $(event_log_tags_file)
@@ -1407,6 +1407,36 @@
# -----------------------------------------------------------------
+# partition table image
+ifdef BOARD_BPT_INPUT_FILES
+
+BUILT_BPTIMAGE_TARGET := $(PRODUCT_OUT)/partition-table.img
+
+INTERNAL_BVBTOOL_MAKE_TABLE_ARGS := \
+ --output_gpt $(BUILT_BPTIMAGE_TARGET) \
+ --output_json $(PRODUCT_OUT)/partition-table.bpt \
+ $(foreach file, $(BOARD_BPT_INPUT_FILES), --input $(file))
+
+ifdef BOARD_BPT_DISK_SIZE
+INTERNAL_BVBTOOL_MAKE_TABLE_ARGS += --disk_size $(BOARD_BPT_DISK_SIZE)
+endif
+
+define build-bptimage-target
+ $(call pretty,"Target partition table image: $(INSTALLED_BPTIMAGE_TARGET)")
+ $(hide) $(BPTTOOL) make_table $(INTERNAL_BVBTOOL_MAKE_TABLE_ARGS) $(BOARD_BPT_MAKE_TABLE_ARGS)
+endef
+
+INSTALLED_BPTIMAGE_TARGET := $(BUILT_BPTIMAGE_TARGET)
+$(INSTALLED_BPTIMAGE_TARGET): $(BPTTOOL) $(BOARD_BPT_INPUT_FILES)
+ $(build-bptimage-target)
+
+.PHONY: bptimage-nodeps
+bptimage-nodeps:
+ $(build-bptimage-target)
+
+endif # BOARD_BPT_INPUT_FILES
+
+# -----------------------------------------------------------------
# cache partition image
ifdef BOARD_CACHEIMAGE_FILE_SYSTEM_TYPE
INTERNAL_CACHEIMAGE_FILES := \
@@ -1532,6 +1562,10 @@
$(HOST_OUT_JAVA_LIBRARIES)/BootSignature.jar \
$(HOST_OUT_EXECUTABLES)/mkuserimg.sh \
$(HOST_OUT_EXECUTABLES)/make_ext4fs \
+ $(HOST_OUT_EXECUTABLES)/mksquashfsimage.sh \
+ $(HOST_OUT_EXECUTABLES)/mksquashfs \
+ $(HOST_OUT_EXECUTABLES)/mkf2fsuserimg.sh \
+ $(HOST_OUT_EXECUTABLES)/make_f2fs \
$(HOST_OUT_EXECUTABLES)/simg2img \
$(HOST_OUT_EXECUTABLES)/e2fsck \
$(HOST_OUT_EXECUTABLES)/build_verity_tree \
@@ -1551,8 +1585,6 @@
$(HOST_LIBRARY_PATH)/libcutils$(HOST_SHLIB_SUFFIX) \
$(HOST_LIBRARY_PATH)/libselinux$(HOST_SHLIB_SUFFIX) \
$(HOST_LIBRARY_PATH)/libcrypto-host$(HOST_SHLIB_SUFFIX) \
- $(HOST_LIBRARY_PATH)/libdivsufsort$(HOST_SHLIB_SUFFIX) \
- $(HOST_LIBRARY_PATH)/libdivsufsort64$(HOST_SHLIB_SUFFIX) \
$(HOST_LIBRARY_PATH)/libext2fs-host$(HOST_SHLIB_SUFFIX) \
$(HOST_LIBRARY_PATH)/libext2_blkid-host$(HOST_SHLIB_SUFFIX) \
$(HOST_LIBRARY_PATH)/libext2_com_err-host$(HOST_SHLIB_SUFFIX) \
@@ -1814,6 +1846,14 @@
$(hide) echo "board_bvb_rollback_index=$(BOARD_BVB_ROLLBACK_INDEX)" >> $(zip_root)/META/misc_info.txt
$(hide) echo "board_bvb_add_image_hashes_args=$(BOARD_BVB_ADD_IMAGE_HASHES_ARGS)" >> $(zip_root)/META/misc_info.txt
endif
+ifdef BOARD_BPT_INPUT_FILES
+ $(hide) echo "board_bpt_enable=true" >> $(zip_root)/META/misc_info.txt
+ $(hide) echo "board_bpt_make_table_args=$(BOARD_BPT_MAKE_TABLE_ARGS)" >> $(zip_root)/META/misc_info.txt
+ $(hide) echo "board_bpt_input_files=$(BOARD_BPT_INPUT_FILES)" >> $(zip_root)/META/misc_info.txt
+endif
+ifdef BOARD_BPT_DISK_SIZE
+ $(hide) echo "board_bpt_disk_size=$(BOARD_BPT_DISK_SIZE)" >> $(zip_root)/META/misc_info.txt
+endif
$(call generate-userimage-prop-dictionary, $(zip_root)/META/misc_info.txt)
ifneq ($(INSTALLED_RECOVERYIMAGE_TARGET),)
$(hide) PATH=$(foreach p,$(INTERNAL_USERIMAGES_BINARY_PATHS),$(p):)$$PATH MKBOOTIMG=$(MKBOOTIMG) \
diff --git a/core/binary.mk b/core/binary.mk
index 8e94653..40b8acd 100644
--- a/core/binary.mk
+++ b/core/binary.mk
@@ -66,14 +66,11 @@
my_ndk_sysroot_include :=
my_ndk_sysroot_lib :=
ifdef LOCAL_SDK_VERSION
- ifdef LOCAL_NDK_VERSION
- $(error $(LOCAL_PATH): LOCAL_NDK_VERSION is now retired.)
- endif
ifdef LOCAL_IS_HOST_MODULE
$(error $(LOCAL_PATH): LOCAL_SDK_VERSION cannot be used in host module)
endif
- my_ndk_source_root := $(HISTORICAL_NDK_VERSIONS_ROOT)/current/sources
- my_ndk_sysroot := $(HISTORICAL_NDK_VERSIONS_ROOT)/current/platforms/android-$(LOCAL_SDK_VERSION)/arch-$(TARGET_$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH)
+ my_ndk_source_root := $(HISTORICAL_NDK_VERSIONS_ROOT)/$(LOCAL_NDK_VERSION)/sources
+ my_ndk_sysroot := $(HISTORICAL_NDK_VERSIONS_ROOT)/$(LOCAL_NDK_VERSION)/platforms/android-$(LOCAL_SDK_VERSION)/arch-$(TARGET_$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH)
my_ndk_sysroot_include := $(my_ndk_sysroot)/usr/include
# x86_64 and and mips64 are both multilib toolchains, so their libraries are
@@ -112,9 +109,6 @@
my_ndk_stl_static_lib :=
my_ndk_stl_cppflags :=
my_cpu_variant := $(TARGET_$(LOCAL_2ND_ARCH_VAR_PREFIX)CPU_ABI)
- ifeq (mips32r6,$(TARGET_$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH_VARIANT))
- my_cpu_variant := mips32r6
- endif
LOCAL_NDK_STL_VARIANT := $(strip $(LOCAL_NDK_STL_VARIANT))
ifeq (,$(LOCAL_NDK_STL_VARIANT))
LOCAL_NDK_STL_VARIANT := system
@@ -138,9 +132,20 @@
endif
else # LOCAL_NDK_STL_VARIANT is not stlport_* either
ifneq (,$(filter c++_%, $(LOCAL_NDK_STL_VARIANT)))
- my_ndk_stl_include_path := $(my_ndk_source_root)/cxx-stl/llvm-libc++/libcxx/include \
- $(my_ndk_source_root)/cxx-stl/llvm-libc++/gabi++/include \
- $(my_ndk_source_root)/android/support/include
+ my_ndk_stl_include_path := \
+ $(my_ndk_source_root)/cxx-stl/llvm-libc++/libcxx/include \
+ $(my_ndk_source_root)/android/support/include \
+
+ # Pre-r11 NDKs used libgabi++ for libc++'s C++ ABI, but r11 and later use
+ # libc++abi.
+ ifeq ($(LOCAL_NDK_VERSION),r10)
+ my_ndk_stl_include_path += \
+ $(my_ndk_source_root)/cxx-stl/llvm-libc++/gabi++/include
+ else
+ my_ndk_stl_include_path += \
+ $(my_ndk_source_root)/cxx-stl/llvm-libc++abi/libcxxabi/include
+ endif
+
ifeq (c++_static,$(LOCAL_NDK_STL_VARIANT))
my_ndk_stl_static_lib := $(my_ndk_source_root)/cxx-stl/llvm-libc++/libs/$(my_cpu_variant)/libc++_static.a
my_ldlibs += -ldl
@@ -214,10 +219,15 @@
# clang is enabled by default for host builds
# enable it unless we've specifically disabled clang above
ifdef LOCAL_IS_HOST_MODULE
- ifneq ($($(my_prefix)OS),windows)
- ifeq ($(my_clang),)
- my_clang := true
- endif
+ ifeq ($($(my_prefix)OS),windows)
+ ifeq ($(my_clang),true)
+ $(error $(LOCAL_MODULE_MAKEFILE): $(LOCAL_MODULE): Clang is not yet supported for windows binaries)
+ endif
+ my_clang := false
+ else
+ ifeq ($(my_clang),)
+ my_clang := true
+ endif
endif
# Add option to make clang the default for device build
else ifeq ($(USE_CLANG_PLATFORM_BUILD),true)
@@ -634,21 +644,23 @@
ifneq ($(proto_sources),)
proto_generated_sources_dir := $(generated_sources_dir)/proto
proto_generated_obj_dir := $(intermediates)/proto
+proto_sources_fullpath := $(addprefix $(LOCAL_PATH)/, $(proto_sources))
ifneq (,$(filter nanopb-c nanopb-c-enable_malloc, $(LOCAL_PROTOC_OPTIMIZE_TYPE)))
my_proto_source_suffix := .c
my_proto_c_includes := external/nanopb-c
my_protoc_flags := --nanopb_out=$(proto_generated_sources_dir) \
--plugin=external/nanopb-c/generator/protoc-gen-nanopb
+my_protoc_deps := $(NANOPB_SRCS) $(proto_sources_fullpath:%.proto=%.options)
else
my_proto_source_suffix := .cc
my_proto_c_includes := external/protobuf/src
my_cflags += -DGOOGLE_PROTOBUF_NO_RTTI
my_protoc_flags := --cpp_out=$(proto_generated_sources_dir)
+my_protoc_deps :=
endif
my_proto_c_includes += $(proto_generated_sources_dir)
-proto_sources_fullpath := $(addprefix $(LOCAL_PATH)/, $(proto_sources))
proto_generated_sources := $(addprefix $(proto_generated_sources_dir)/, \
$(patsubst %.proto,%.pb$(my_proto_source_suffix),$(proto_sources_fullpath)))
proto_generated_headers := $(patsubst %.pb$(my_proto_source_suffix),%.pb.h, $(proto_generated_sources))
@@ -660,7 +672,7 @@
ifndef $(my_prefix)_$(LOCAL_MODULE_CLASS)_$(LOCAL_MODULE)_proto_defined
$(proto_generated_sources): PRIVATE_PROTO_INCLUDES := $(TOP)
$(proto_generated_sources): PRIVATE_PROTOC_FLAGS := $(LOCAL_PROTOC_FLAGS) $(my_protoc_flags)
-$(proto_generated_sources): $(proto_generated_sources_dir)/%.pb$(my_proto_source_suffix): %.proto $(PROTOC)
+$(proto_generated_sources): $(proto_generated_sources_dir)/%.pb$(my_proto_source_suffix): %.proto $(my_protoc_deps) $(PROTOC)
$(transform-proto-to-cc)
# This is just a dummy rule to make sure gmake doesn't skip updating the dependents.
@@ -799,7 +811,7 @@
$(intermediates)/,$(y_yacc_sources:.y=.c))
ifneq ($(y_yacc_cs),)
$(y_yacc_cs): $(intermediates)/%.c: \
- $(TOPDIR)$(LOCAL_PATH)/%.y \
+ $(TOPDIR)$(LOCAL_PATH)/%.y $(BISON) $(BISON_DATA) \
$(my_additional_dependencies)
$(call transform-y-to-c-or-cpp)
$(call track-src-file-gen,$(y_yacc_sources),$(y_yacc_cs))
@@ -812,7 +824,7 @@
$(intermediates)/,$(yy_yacc_sources:.yy=$(LOCAL_CPP_EXTENSION)))
ifneq ($(yy_yacc_cpps),)
$(yy_yacc_cpps): $(intermediates)/%$(LOCAL_CPP_EXTENSION): \
- $(TOPDIR)$(LOCAL_PATH)/%.yy \
+ $(TOPDIR)$(LOCAL_PATH)/%.yy $(BISON) $(BISON_DATA) \
$(my_additional_dependencies)
$(call transform-y-to-c-or-cpp)
$(call track-src-file-gen,$(yy_yacc_sources),$(yy_yacc_cpps))
@@ -1399,9 +1411,18 @@
###########################################################
export_includes := $(intermediates)/export_includes
$(export_includes): PRIVATE_EXPORT_C_INCLUDE_DIRS := $(my_export_c_include_dirs)
+# Headers exported by whole static libraries are also exported by this library.
export_include_deps := $(strip \
$(foreach l,$(my_whole_static_libraries), \
$(call intermediates-dir-for,STATIC_LIBRARIES,$(l),$(LOCAL_IS_HOST_MODULE),,$(LOCAL_2ND_ARCH_VAR_PREFIX),$(my_host_cross))/export_includes))
+# Re-export requested headers from shared libraries.
+export_include_deps += $(strip \
+ $(foreach l,$(LOCAL_EXPORT_SHARED_LIBRARY_HEADERS), \
+ $(call intermediates-dir-for,SHARED_LIBRARIES,$(l),$(LOCAL_IS_HOST_MODULE),,$(LOCAL_2ND_ARCH_VAR_PREFIX),$(my_host_cross))/export_includes))
+# Re-export requested headers from static libraries.
+export_include_deps += $(strip \
+ $(foreach l,$(LOCAL_EXPORT_STATIC_LIBRARY_HEADERS), \
+ $(call intermediates-dir-for,STATIC_LIBRARIES,$(l),$(LOCAL_IS_HOST_MODULE),,$(LOCAL_2ND_ARCH_VAR_PREFIX),$(my_host_cross))/export_includes))
$(export_includes): PRIVATE_REEXPORTED_INCLUDES := $(export_include_deps)
# Make sure .pb.h are already generated before any dependent source files get compiled.
# Similarly, the generated DBus headers need to exist before we export their location.
diff --git a/core/clang/HOST_x86_common.mk b/core/clang/HOST_x86_common.mk
index 9e71750..0f4d4a2 100644
--- a/core/clang/HOST_x86_common.mk
+++ b/core/clang/HOST_x86_common.mk
@@ -34,7 +34,7 @@
-B$($(clang_2nd_arch_prefix)HOST_TOOLCHAIN_FOR_CLANG)/x86_64-linux/bin \
-B$($(clang_2nd_arch_prefix)HOST_TOOLCHAIN_FOR_CLANG)/lib/gcc/x86_64-linux/4.8 \
-L$($(clang_2nd_arch_prefix)HOST_TOOLCHAIN_FOR_CLANG)/lib/gcc/x86_64-linux/4.8 \
- -L$($(clang_2nd_arch_prefix)HOST_TOOLCHAIN_FOR_CLANG)/x86_64-linux/lib64/
+ -L$($(clang_2nd_arch_prefix)HOST_TOOLCHAIN_FOR_CLANG)/x86_64-linux/lib64
else
CLANG_CONFIG_x86_LINUX_HOST_EXTRA_CPPFLAGS := \
--gcc-toolchain=$($(clang_2nd_arch_prefix)HOST_TOOLCHAIN_FOR_CLANG) \
@@ -49,6 +49,6 @@
-B$($(clang_2nd_arch_prefix)HOST_TOOLCHAIN_FOR_CLANG)/x86_64-linux/bin \
-B$($(clang_2nd_arch_prefix)HOST_TOOLCHAIN_FOR_CLANG)/lib/gcc/x86_64-linux/4.8/32 \
-L$($(clang_2nd_arch_prefix)HOST_TOOLCHAIN_FOR_CLANG)/lib/gcc/x86_64-linux/4.8/32 \
- -L$($(clang_2nd_arch_prefix)HOST_TOOLCHAIN_FOR_CLANG)/x86_64-linux/lib32/
+ -L$($(clang_2nd_arch_prefix)HOST_TOOLCHAIN_FOR_CLANG)/x86_64-linux/lib32
endif
endif # Linux
diff --git a/core/clear_vars.mk b/core/clear_vars.mk
index dc44a1a..c3d390f 100644
--- a/core/clear_vars.mk
+++ b/core/clear_vars.mk
@@ -35,6 +35,8 @@
# Group static libraries with "-Wl,--start-group" and "-Wl,--end-group" when linking.
LOCAL_GROUP_STATIC_LIBRARIES:=
LOCAL_WHOLE_STATIC_LIBRARIES:=
+LOCAL_EXPORT_SHARED_LIBRARY_HEADERS:=
+LOCAL_EXPORT_STATIC_LIBRARY_HEADERS:=
LOCAL_SHARED_LIBRARIES:=
LOCAL_IS_HOST_MODULE:=
LOCAL_CC:=
@@ -106,12 +108,14 @@
LOCAL_JARJAR_RULES:=
LOCAL_ADDITIONAL_JAVA_DIR:=
LOCAL_ALLOW_UNDEFINED_SYMBOLS:=
-LOCAL_DX_FLAGS:=
-LOCAL_JACK_ENABLED:=$(DEFAULT_JACK_ENABLED) # '' (ie disabled), disabled, full, incremental
+# full or incremental
+LOCAL_JACK_ENABLED:=full
LOCAL_JACK_FLAGS:=
-LOCAL_JILL_FLAGS:=
+LOCAL_JACK_COVERAGE_INCLUDE_FILTER:=
+LOCAL_JACK_COVERAGE_EXCLUDE_FILTER:=
LOCAL_CERTIFICATE:=
LOCAL_SDK_VERSION:=
+LOCAL_MIN_SDK_VERSION:=
LOCAL_SDK_RES_VERSION:=
LOCAL_NDK_STL_VARIANT:=
LOCAL_EMMA_INSTRUMENT:=
@@ -153,7 +157,6 @@
LOCAL_SOURCE_FILES_ALL_GENERATED:= # '',true
# Don't delete the META_INF dir when merging static Java libraries.
LOCAL_DONT_DELETE_JAR_META_INF:=
-LOCAL_DONT_DELETE_JAR_DIRS:=
LOCAL_ADDITIONAL_CERTIFICATES:=
LOCAL_PREBUILT_MODULE_FILE:=
LOCAL_POST_LINK_CMD:=
@@ -190,6 +193,7 @@
# Used to replace the installed file of a presigned prebuilt apk in PDK fusion build,
# to avoid installing the presigned apks with classes.dex unstripped.
LOCAL_REPLACE_PREBUILT_APK_INSTALLED:=
+LOCAL_NDK_VERSION:=current
# arch specific variables
LOCAL_SRC_FILES_$(TARGET_ARCH):=
diff --git a/core/combo/HOST_darwin-x86.mk b/core/combo/HOST_darwin-x86.mk
index 076815b..ea384b4 100644
--- a/core/combo/HOST_darwin-x86.mk
+++ b/core/combo/HOST_darwin-x86.mk
@@ -44,7 +44,7 @@
# HOST_TOOLCHAIN_ROOT is a Darwin-specific define
$(combo_2nd_arch_prefix)HOST_TOOLCHAIN_FOR_CLANG := $($(combo_2nd_arch_prefix)HOST_TOOLCHAIN_ROOT)
-$(combo_2nd_arch_prefix)HOST_AR := $(AR)
+$(combo_2nd_arch_prefix)HOST_AR := $(mac_sdk_path)/Toolchains/XcodeDefault.xctoolchain/usr/bin/ar
$(combo_2nd_arch_prefix)HOST_GLOBAL_CFLAGS += -isysroot $(mac_sdk_root) -mmacosx-version-min=$(mac_sdk_version) -DMACOSX_DEPLOYMENT_TARGET=$(mac_sdk_version)
$(combo_2nd_arch_prefix)HOST_GLOBAL_LDFLAGS += -isysroot $(mac_sdk_root) -Wl,-syslibroot,$(mac_sdk_root) -mmacosx-version-min=$(mac_sdk_version)
diff --git a/core/combo/HOST_darwin-x86_64.mk b/core/combo/HOST_darwin-x86_64.mk
index a8541ee..eee2ee5 100644
--- a/core/combo/HOST_darwin-x86_64.mk
+++ b/core/combo/HOST_darwin-x86_64.mk
@@ -44,7 +44,7 @@
# HOST_TOOLCHAIN_ROOT is a Darwin-specific define
HOST_TOOLCHAIN_FOR_CLANG := $(HOST_TOOLCHAIN_ROOT)
-HOST_AR := $(AR)
+HOST_AR := $(mac_sdk_path)/Toolchains/XcodeDefault.xctoolchain/usr/bin/ar
HOST_GLOBAL_CFLAGS += -isysroot $(mac_sdk_root) -mmacosx-version-min=$(mac_sdk_version) -DMACOSX_DEPLOYMENT_TARGET=$(mac_sdk_version)
HOST_GLOBAL_LDFLAGS += -isysroot $(mac_sdk_root) -Wl,-syslibroot,$(mac_sdk_root) -mmacosx-version-min=$(mac_sdk_version)
diff --git a/core/combo/TARGET_linux-arm.mk b/core/combo/TARGET_linux-arm.mk
index 510aae5..d89a2cf 100644
--- a/core/combo/TARGET_linux-arm.mk
+++ b/core/combo/TARGET_linux-arm.mk
@@ -155,7 +155,6 @@
-frename-registers
libc_root := bionic/libc
-libm_root := bionic/libm
## on some hosts, the target cross-compiler is not available so do not run this command
@@ -180,8 +179,6 @@
$(libc_root)/arch-arm/include \
$(libc_root)/include \
$(KERNEL_HEADERS) \
- $(libm_root)/include \
- $(libm_root)/include/arm \
$(combo_2nd_arch_prefix)TARGET_CRTBEGIN_STATIC_O := $($(combo_2nd_arch_prefix)TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtbegin_static.o
$(combo_2nd_arch_prefix)TARGET_CRTBEGIN_DYNAMIC_O := $($(combo_2nd_arch_prefix)TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtbegin_dynamic.o
diff --git a/core/combo/TARGET_linux-arm64.mk b/core/combo/TARGET_linux-arm64.mk
index 6a1d861..9ff4981 100644
--- a/core/combo/TARGET_linux-arm64.mk
+++ b/core/combo/TARGET_linux-arm64.mk
@@ -135,7 +135,6 @@
-frename-registers
libc_root := bionic/libc
-libm_root := bionic/libm
TARGET_LIBGCC := $(shell $(TARGET_CC) $(TARGET_GLOBAL_CFLAGS) \
-print-libgcc-file-name)
@@ -153,8 +152,6 @@
$(libc_root)/arch-arm64/include \
$(libc_root)/include \
$(KERNEL_HEADERS) \
- $(libm_root)/include \
- $(libm_root)/include/arm64 \
TARGET_CRTBEGIN_STATIC_O := $(TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtbegin_static.o
TARGET_CRTBEGIN_DYNAMIC_O := $(TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtbegin_dynamic.o
diff --git a/core/combo/TARGET_linux-mips.mk b/core/combo/TARGET_linux-mips.mk
index 186d88f..fcf4c9d 100644
--- a/core/combo/TARGET_linux-mips.mk
+++ b/core/combo/TARGET_linux-mips.mk
@@ -126,7 +126,6 @@
-frename-registers
libc_root := bionic/libc
-libm_root := bionic/libm
## on some hosts, the target cross-compiler is not available so do not run this command
@@ -155,8 +154,6 @@
$(libc_root)/arch-mips/include \
$(libc_root)/include \
$(KERNEL_HEADERS) \
- $(libm_root)/include \
- $(libm_root)/include/mips \
$(combo_2nd_arch_prefix)TARGET_CRTBEGIN_STATIC_O := $($(combo_2nd_arch_prefix)TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtbegin_static.o
$(combo_2nd_arch_prefix)TARGET_CRTBEGIN_DYNAMIC_O := $($(combo_2nd_arch_prefix)TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtbegin_dynamic.o
diff --git a/core/combo/TARGET_linux-mips64.mk b/core/combo/TARGET_linux-mips64.mk
index 3e1f61a..f869317 100644
--- a/core/combo/TARGET_linux-mips64.mk
+++ b/core/combo/TARGET_linux-mips64.mk
@@ -132,7 +132,6 @@
-frename-registers
libc_root := bionic/libc
-libm_root := bionic/libm
## on some hosts, the target cross-compiler is not available so do not run this command
@@ -162,10 +161,6 @@
$(libc_root)/arch-mips64/include \
$(libc_root)/include \
$(KERNEL_HEADERS) \
- $(libm_root)/include \
- $(libm_root)/include/mips \
-
-# TODO: perhaps use $(libm_root)/include/mips64 instead of mips ?
TARGET_CRTBEGIN_STATIC_O := $(TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtbegin_static.o
TARGET_CRTBEGIN_DYNAMIC_O := $(TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtbegin_dynamic.o
diff --git a/core/combo/TARGET_linux-x86.mk b/core/combo/TARGET_linux-x86.mk
index 558ec3b..800a1dd 100644
--- a/core/combo/TARGET_linux-x86.mk
+++ b/core/combo/TARGET_linux-x86.mk
@@ -74,7 +74,6 @@
$(combo_2nd_arch_prefix)TARGET_NO_UNDEFINED_LDFLAGS := -Wl,--no-undefined
libc_root := bionic/libc
-libm_root := bionic/libm
KERNEL_HEADERS_COMMON := $(libc_root)/kernel/uapi
KERNEL_HEADERS_COMMON += $(libc_root)/kernel/common
@@ -135,8 +134,6 @@
$(libc_root)/arch-x86/include \
$(libc_root)/include \
$(KERNEL_HEADERS) \
- $(libm_root)/include \
- $(libm_root)/include/i387 \
$(combo_2nd_arch_prefix)TARGET_CRTBEGIN_STATIC_O := $($(combo_2nd_arch_prefix)TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtbegin_static.o
$(combo_2nd_arch_prefix)TARGET_CRTBEGIN_DYNAMIC_O := $($(combo_2nd_arch_prefix)TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtbegin_dynamic.o
diff --git a/core/combo/TARGET_linux-x86_64.mk b/core/combo/TARGET_linux-x86_64.mk
index 12166ec..bf31334 100644
--- a/core/combo/TARGET_linux-x86_64.mk
+++ b/core/combo/TARGET_linux-x86_64.mk
@@ -74,7 +74,6 @@
TARGET_NO_UNDEFINED_LDFLAGS := -Wl,--no-undefined
libc_root := bionic/libc
-libm_root := bionic/libm
KERNEL_HEADERS_COMMON := $(libc_root)/kernel/uapi
KERNEL_HEADERS_COMMON += $(libc_root)/kernel/common
@@ -144,8 +143,6 @@
$(libc_root)/arch-x86_64/include \
$(libc_root)/include \
$(KERNEL_HEADERS) \
- $(libm_root)/include \
- $(libm_root)/include/amd64 \
TARGET_CRTBEGIN_STATIC_O := $(TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtbegin_static.o
TARGET_CRTBEGIN_DYNAMIC_O := $(TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtbegin_dynamic.o
diff --git a/core/combo/javac.mk b/core/combo/javac.mk
index 7f66ea8..9042d83 100644
--- a/core/combo/javac.mk
+++ b/core/combo/javac.mk
@@ -9,11 +9,6 @@
# COMMON_JAVAC -- Java compiler command with common arguments
#
-ifndef ANDROID_COMPILE_WITH_JACK
-# Defines if compilation with jack is enabled by default.
-ANDROID_COMPILE_WITH_JACK := true
-endif
-
common_jdk_flags := -Xmaxerrs 9999999
# Use the indexer wrapper to index the codebase instead of the javac compiler
diff --git a/core/config.mk b/core/config.mk
index e686733..e63a135 100644
--- a/core/config.mk
+++ b/core/config.mk
@@ -500,6 +500,7 @@
BISON_PKGDATADIR := $(PWD)/external/bison/data
BISON := prebuilts/misc/$(BUILD_OS)-$(HOST_PREBUILT_ARCH)/bison/bison
YACC := $(BISON) -d
+BISON_DATA := $(wildcard external/bison/data/* external/bison/data/*/*)
YASM := prebuilts/misc/$(BUILD_OS)-$(HOST_PREBUILT_ARCH)/yasm/yasm
@@ -512,6 +513,10 @@
BREAKPAD_GENERATE_SYMBOLS := false
endif
PROTOC := $(HOST_OUT_EXECUTABLES)/aprotoc$(HOST_EXECUTABLE_SUFFIX)
+NANOPB_SRCS := external/nanopb-c/generator/protoc-gen-nanopb \
+ $(wildcard external/nanopb-c/generator/*.py \
+ external/nanopb-c/generator/google/*.py \
+ external/nanopb-c/generator/proto/*.py)
DBUS_GENERATOR := $(HOST_OUT_EXECUTABLES)/dbus-binding-generator
MKBOOTFS := $(HOST_OUT_EXECUTABLES)/mkbootfs$(HOST_EXECUTABLE_SUFFIX)
MINIGZIP := $(HOST_OUT_EXECUTABLES)/minigzip$(HOST_EXECUTABLE_SUFFIX)
@@ -520,6 +525,11 @@
else
MKBOOTIMG := $(BOARD_CUSTOM_MKBOOTIMG)
endif
+ifeq (,$(strip $(BOARD_CUSTOM_BPTTOOL)))
+BPTTOOL := $(HOST_OUT_EXECUTABLES)/bpttool$(HOST_EXECUTABLE_SUFFIX)
+else
+BPTTOOL := $(BOARD_CUSTOM_BPTTOOL)
+endif
ifeq (,$(strip $(BOARD_CUSTOM_BVBTOOL)))
BVBTOOL := $(HOST_OUT_EXECUTABLES)/bvbtool$(HOST_EXECUTABLE_SUFFIX)
else
@@ -529,13 +539,8 @@
FS_GET_STATS := $(HOST_OUT_EXECUTABLES)/fs_get_stats$(HOST_EXECUTABLE_SUFFIX)
MAKE_EXT4FS := $(HOST_OUT_EXECUTABLES)/make_ext4fs$(HOST_EXECUTABLE_SUFFIX)
MKEXTUSERIMG := $(HOST_OUT_EXECUTABLES)/mkuserimg.sh
-ifeq ($(HOST_OS),linux)
MAKE_SQUASHFS := $(HOST_OUT_EXECUTABLES)/mksquashfs$(HOST_EXECUTABLE_SUFFIX)
MKSQUASHFSUSERIMG := $(HOST_OUT_EXECUTABLES)/mksquashfsimage.sh
-else
-MAKE_SQUASHFS :=
-MKSQUASHFSUSERIMG :=
-endif
MAKE_F2FS := $(HOST_OUT_EXECUTABLES)/make_f2fs$(HOST_EXECUTABLE_SUFFIX)
MKF2FSUSERIMG := $(HOST_OUT_EXECUTABLES)/mkf2fsuserimg.sh
SIMG2IMG := $(HOST_OUT_EXECUTABLES)/simg2img$(HOST_EXECUTABLE_SUFFIX)
@@ -545,21 +550,19 @@
TUNE2FS := $(HOST_OUT_EXECUTABLES)/tune2fs$(HOST_EXECUTABLE_SUFFIX)
JARJAR := $(HOST_OUT_JAVA_LIBRARIES)/jarjar.jar
-ifeq ($(ANDROID_COMPILE_WITH_JACK),true)
-DEFAULT_JACK_ENABLED:=full
-else
-DEFAULT_JACK_ENABLED:=
-endif
ifneq ($(ANDROID_JACK_EXTRA_ARGS),)
+JACK_DEFAULT_ARGS :=
DEFAULT_JACK_EXTRA_ARGS := $(ANDROID_JACK_EXTRA_ARGS)
else
-DEFAULT_JACK_EXTRA_ARGS := @$(BUILD_SYSTEM)/jack-default.args
+JACK_DEFAULT_ARGS := $(BUILD_SYSTEM)/jack-default.args
+DEFAULT_JACK_EXTRA_ARGS := @$(JACK_DEFAULT_ARGS)
endif
# Turn off jack warnings by default.
DEFAULT_JACK_EXTRA_ARGS += --verbose error
PROGUARD := external/proguard/bin/proguard.sh
JAVATAGS := build/tools/java-event-log-tags.py
+MERGETAGS := build/tools/merge-event-log-tags.py
APPEND2SIMG := $(HOST_OUT_EXECUTABLES)/append2simg
VERITY_SIGNER := $(HOST_OUT_EXECUTABLES)/verity_signer
BUILD_VERITY_TREE := $(HOST_OUT_EXECUTABLES)/build_verity_tree
@@ -853,7 +856,8 @@
RS_PREBUILT_CLCORE := prebuilts/sdk/renderscript/lib/$(TARGET_ARCH)/librsrt_$(TARGET_ARCH).bc
RS_PREBUILT_COMPILER_RT := prebuilts/sdk/renderscript/lib/$(TARGET_ARCH)/libcompiler_rt.a
ifeq (true,$(TARGET_IS_64_BIT))
-RS_PREBUILT_LIBPATH := -L prebuilts/ndk/current/platforms/android-21/arch-$(TARGET_ARCH)/usr/lib
+RS_PREBUILT_LIBPATH := -L prebuilts/ndk/current/platforms/android-21/arch-$(TARGET_ARCH)/usr/lib64 \
+ -L prebuilts/ndk/current/platforms/android-21/arch-$(TARGET_ARCH)/usr/lib
else
RS_PREBUILT_LIBPATH := -L prebuilts/ndk/current/platforms/android-9/arch-$(TARGET_ARCH)/usr/lib
endif
diff --git a/core/configure_local_jack.mk b/core/configure_local_jack.mk
index 2270c88..446bab7 100644
--- a/core/configure_local_jack.mk
+++ b/core/configure_local_jack.mk
@@ -21,16 +21,9 @@
LOCAL_JACK_ENABLED := $(strip $(LOCAL_JACK_ENABLED))
LOCAL_MODULE := $(strip $(LOCAL_MODULE))
-ifneq ($(LOCAL_JACK_ENABLED),full)
-ifneq ($(LOCAL_JACK_ENABLED),incremental)
-ifdef LOCAL_JACK_ENABLED
-ifneq ($(LOCAL_JACK_ENABLED),disabled)
+ifeq ($(filter full incremental,$(LOCAL_JACK_ENABLED)),)
$(error $(LOCAL_PATH): invalid LOCAL_JACK_ENABLED "$(LOCAL_JACK_ENABLED)" for $(LOCAL_MODULE))
endif
-endif
-LOCAL_JACK_ENABLED :=
-endif
-endif
ifdef $(LOCAL_MODULE).JACK_VERSION
LOCAL_JACK_VERSION := $($(LOCAL_MODULE).JACK_VERSION)
diff --git a/core/definitions.mk b/core/definitions.mk
index 15c9df0..9495bc8 100644
--- a/core/definitions.mk
+++ b/core/definitions.mk
@@ -1082,7 +1082,7 @@
define transform-logtags-to-java
@mkdir -p $(dir $@)
@echo "logtags: $@ <= $<"
-$(hide) $(JAVATAGS) -o $@ $^
+$(hide) $(JAVATAGS) -o $@ $< $(PRIVATE_MERGED_TAG)
endef
@@ -1152,7 +1152,7 @@
@mkdir -p $(dir $@)
$(hide) $(RELATIVE_PWD) $(PRIVATE_CXX) \
$(addprefix -I , $(PRIVATE_C_INCLUDES)) \
- $(shell cat $(PRIVATE_IMPORT_INCLUDES)) \
+ $$(cat $(PRIVATE_IMPORT_INCLUDES)) \
$(addprefix -isystem ,\
$(if $(PRIVATE_NO_DEFAULT_COMPILER_FLAGS),, \
$(filter-out $(PRIVATE_C_INCLUDES), \
@@ -1184,7 +1184,7 @@
@mkdir -p $(dir $@)
$(hide) $(RELATIVE_PWD) $(PRIVATE_CC) \
$(addprefix -I , $(PRIVATE_C_INCLUDES)) \
- $(shell cat $(PRIVATE_IMPORT_INCLUDES)) \
+ $$(cat $(PRIVATE_IMPORT_INCLUDES)) \
$(addprefix -isystem ,\
$(if $(PRIVATE_NO_DEFAULT_COMPILER_FLAGS),, \
$(filter-out $(PRIVATE_C_INCLUDES), \
@@ -1259,7 +1259,7 @@
@mkdir -p $(dir $@)
$(hide) $(RELATIVE_PWD) $(PRIVATE_CXX) \
$(addprefix -I , $(PRIVATE_C_INCLUDES)) \
- $(shell cat $(PRIVATE_IMPORT_INCLUDES)) \
+ $$(cat $(PRIVATE_IMPORT_INCLUDES)) \
$(addprefix -isystem ,\
$(if $(PRIVATE_NO_DEFAULT_COMPILER_FLAGS),, \
$(filter-out $(PRIVATE_C_INCLUDES), \
@@ -1289,7 +1289,7 @@
@mkdir -p $(dir $@)
$(hide) $(RELATIVE_PWD) $(PRIVATE_CC) \
$(addprefix -I , $(PRIVATE_C_INCLUDES)) \
- $(shell cat $(PRIVATE_IMPORT_INCLUDES)) \
+ $$(cat $(PRIVATE_IMPORT_INCLUDES)) \
$(addprefix -isystem ,\
$(if $(PRIVATE_NO_DEFAULT_COMPILER_FLAGS),, \
$(filter-out $(PRIVATE_C_INCLUDES), \
@@ -2060,9 +2060,8 @@
$(hide) tr ' ' '\n' < $@.java-source-list \
| sort -u > $@.java-source-list-uniq
$(hide) if [ -s $@.java-source-list-uniq ] ; then \
- $(call call-jack,$(PRIVATE_JACK_EXTRA_ARGS)) \
+ $(call call-jack) \
$(strip $(PRIVATE_JACK_FLAGS)) \
- $(strip $(PRIVATE_JACK_DEBUG_FLAGS)) \
$(addprefix --classpath ,$(strip \
$(call normalize-path-list,$(call reverse-list,$(PRIVATE_STATIC_JACK_LIBRARIES)) $(PRIVATE_BOOTCLASSPATH_JAVA_LIBRARIES) $(PRIVATE_ALL_JACK_LIBRARIES)))) \
-D jack.import.resource.policy=keep-first \
@@ -2231,17 +2230,6 @@
$(call create-empty-package-at,$@)
endef
-# Copy an arhchive file and delete any class files and empty folders inside.
-# $(1): the source archive file.
-# $(2): the destination archive file.
-define initialize-package-file
-@mkdir -p $(dir $(2))
-$(hide) cp -f $(1) $(2)
-$(hide) zip -qd $(2) "*.class" \
- $(if $(strip $(PRIVATE_DONT_DELETE_JAR_DIRS)),,"*/") \
- || true # Ignore the error when nothing to delete.
-endef
-
#TODO: we kinda want to build different asset packages for
# different configurations, then combine them later (or something).
# Per-locale, etc.
@@ -2389,19 +2377,6 @@
fi
endef
-define install-dex-debug
-$(hide) if [ -f "$(PRIVATE_INTERMEDIATES_DIR)/classes.dex" ]; then \
- mkdir -p $(TOP)/dalvik/DEBUG-FILES; \
- $(ACP) $(PRIVATE_INTERMEDIATES_DIR)/classes.dex \
- $(TOP)/dalvik/DEBUG-FILES/$(PRIVATE_MODULE).dex; \
- fi
-$(hide) if [ -f "$(PRIVATE_INTERMEDIATES_DIR)/classes.lst" ]; then \
- mkdir -p $(TOP)/dalvik/DEBUG-FILES; \
- $(ACP) $(PRIVATE_INTERMEDIATES_DIR)/classes.lst \
- $(TOP)/dalvik/DEBUG-FILES/$(PRIVATE_MODULE).lst; \
- fi
-endef
-
# TODO(joeo): If we can ever upgrade to post 3.81 make and get the
# new prebuilt rules to work, we should change this to copy the
# resources to the out directory and then copy the resources.
diff --git a/core/dex_preopt_libart_boot.mk b/core/dex_preopt_libart_boot.mk
index 1c8fb40..69102d1 100644
--- a/core/dex_preopt_libart_boot.mk
+++ b/core/dex_preopt_libart_boot.mk
@@ -62,4 +62,4 @@
--instruction-set-features=$($(PRIVATE_2ND_ARCH_VAR_PREFIX)DEX2OAT_TARGET_INSTRUCTION_SET_FEATURES) \
--android-root=$(PRODUCT_OUT)/system --include-patch-information --runtime-arg -Xnorelocate --no-generate-debug-info \
--multi-image --no-inline-from=core-oj.jar \
- $(PRODUCT_DEX_PREOPT_BOOT_FLAGS) $(GLOBAL_DEXPREOPT_FLAGS) $(COMPILED_CLASSES_FLAGS)
+ $(PRODUCT_DEX_PREOPT_BOOT_FLAGS) $(GLOBAL_DEXPREOPT_FLAGS) $(COMPILED_CLASSES_FLAGS) $(ART_BOOT_IMAGE_EXTRA_ARGS)
diff --git a/core/dpi_specific_apk.mk b/core/dpi_specific_apk.mk
index b2a3d64..dfd55cd 100644
--- a/core/dpi_specific_apk.mk
+++ b/core/dpi_specific_apk.mk
@@ -30,15 +30,9 @@
$(built_dpi_apk): PRIVATE_ADDITIONAL_CERTIFICATES := $(foreach c,\
$(LOCAL_ADDITIONAL_CERTIFICATES), $(c).x509.pem $(c).pk8)
-$(built_dpi_apk): PRIVATE_SOURCE_ARCHIVE :=
ifneq ($(full_classes_jar),)
-$(built_dpi_apk): PRIVATE_DEX_FILE := $(built_dex)
-ifndef LOCAL_JACK_ENABLED
-# Use the jarjar processed arhive as the initial package file.
-$(built_dpi_apk): PRIVATE_SOURCE_ARCHIVE := $(full_classes_jarjar_jar)
-else
$(built_dpi_apk): PRIVATE_JACK_INTERMEDIATES_DIR := $(intermediates.COMMON)/jack-rsc
-endif # LOCAL_JACK_ENABLED
+$(built_dpi_apk): PRIVATE_DEX_FILE := $(built_dex)
$(built_dpi_apk): $(built_dex)
else
$(built_dpi_apk): PRIVATE_DEX_FILE :=
@@ -51,9 +45,7 @@
$(built_dpi_apk) : $(AAPT)
$(built_dpi_apk) : $(all_res_assets) $(jni_shared_libraries) $(full_android_manifest)
@echo "target Package: $(PRIVATE_MODULE) ($@)"
- $(if $(PRIVATE_SOURCE_ARCHIVE),\
- $(call initialize-package-file,$(PRIVATE_SOURCE_ARCHIVE),$@),\
- $(create-empty-package))
+ $(create-empty-package)
$(add-assets-to-package)
ifneq ($(jni_shared_libraries),)
$(add-jni-shared-libs-to-package)
@@ -63,10 +55,8 @@
$(if $(PRIVATE_EXTRA_JAR_ARGS),$(call add-java-resources-to,$@))
else
$(add-dex-to-package)
-ifdef LOCAL_JACK_ENABLED
$(add-carried-jack-resources)
endif
-endif
$(sign-package)
# Set up global variables to register this apk to the higher-level dependency graph.
diff --git a/core/goma.mk b/core/goma.mk
index 982160b..0d5f428 100644
--- a/core/goma.mk
+++ b/core/goma.mk
@@ -46,11 +46,7 @@
# gomacc can start goma client's daemon process automatically, but
# it is safer and faster to start up it beforehand. We run this as a
# background process so this won't slow down the build.
- # We use "ensure_start" command when the compiler_proxy is already
- # running and uses GOMA_HERMETIC=error flag. The compiler_proxy will
- # restart otherwise.
- # TODO(hamaji): Remove this condition after http://b/25676777 is fixed.
- $(shell ( if ( curl http://localhost:$$($(GOMA_CC) port)/flagz | grep GOMA_HERMETIC=error ); then cmd=ensure_start; else cmd=restart; fi; GOMA_HERMETIC=error $(goma_ctl) $${cmd} ) &> /dev/null &)
+ $(shell ( GOMA_HERMETIC=error $(goma_ctl) ensure_start ) &> /dev/null &)
goma_ctl :=
goma_dir :=
diff --git a/core/host_dalvik_java_library.mk b/core/host_dalvik_java_library.mk
index e172018..e1d62cc 100644
--- a/core/host_dalvik_java_library.mk
+++ b/core/host_dalvik_java_library.mk
@@ -81,7 +81,7 @@
jack_all_deps := $(java_sources) $(java_resource_sources) $(full_jack_deps) \
$(jar_manifest_file) $(proto_java_sources_file_stamp) \
- $(LOCAL_ADDITIONAL_DEPENDENCIES) $(JACK)
+ $(LOCAL_ADDITIONAL_DEPENDENCIES) $(JACK_DEFAULT_ARGS) $(JACK)
ifneq ($(LOCAL_IS_STATIC_JAVA_LIBRARY),true)
$(built_dex): PRIVATE_CLASSES_JACK := $(full_classes_jack)
diff --git a/core/java.mk b/core/java.mk
index 6fb16ea..6ee983e 100644
--- a/core/java.mk
+++ b/core/java.mk
@@ -51,6 +51,10 @@
endif
endif
+ifneq (,$(strip $(LOCAL_MIN_SDK_VERSION)))
+ my_jack_min_sdk_version := $(LOCAL_MIN_SDK_VERSION)
+endif
+
proto_sources := $(filter %.proto,$(LOCAL_SRC_FILES))
ifneq ($(proto_sources),)
ifeq ($(LOCAL_PROTOC_OPTIMIZE_TYPE),micro)
@@ -86,34 +90,14 @@
intermediates := $(call local-intermediates-dir)
intermediates.COMMON := $(call local-intermediates-dir,COMMON)
-# 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
-
ifeq ($(LOCAL_PROGUARD_ENABLED),disabled)
LOCAL_PROGUARD_ENABLED :=
endif
-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)
-jarjar_leaf := classes-jarjar.jar
-full_classes_jarjar_jar := $(intermediates.COMMON)/$(jarjar_leaf)
-emma_intermediates_dir := $(intermediates.COMMON)/emma_out
-# 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)
-full_classes_proguard_jar := $(intermediates.COMMON)/$(proguard_jar_leaf)
-built_dex_intermediate := $(intermediates.COMMON)/$(built_dex_intermediate_leaf)/classes.dex
+full_classes_compiled_jar := $(intermediates.COMMON)/classes-full-debug.jar
+full_classes_jarjar_jar := $(intermediates.COMMON)/classes-jarjar.jar
+full_classes_proguard_jar := $(intermediates.COMMON)/proguard.classes.jar
+built_dex_intermediate := $(intermediates.COMMON)/dex-dir/classes.dex
full_classes_stubs_jar := $(intermediates.COMMON)/stubs.jar
ifeq ($(LOCAL_MODULE_CLASS)$(LOCAL_SRC_FILES)$(LOCAL_STATIC_JAVA_LIBRARIES)$(LOCAL_SOURCE_FILES_ALL_GENERATED),APPS)
@@ -133,7 +117,6 @@
LOCAL_INTERMEDIATE_TARGETS += \
$(full_classes_compiled_jar) \
$(full_classes_jarjar_jar) \
- $(full_classes_emma_jar) \
$(full_classes_jar) \
$(full_classes_proguard_jar) \
$(built_dex_intermediate) \
@@ -334,11 +317,7 @@
# command line.
ifndef LOCAL_CHECKED_MODULE
ifdef full_classes_jar
-ifdef LOCAL_JACK_ENABLED
LOCAL_CHECKED_MODULE := $(jack_check_timestamp)
-else
-LOCAL_CHECKED_MODULE := $(full_classes_compiled_jar)
-endif
endif
endif
@@ -354,7 +333,8 @@
logtags_java_sources := $(patsubst %.logtags,%.java,$(addprefix $(intermediates.COMMON)/src/, $(logtags_sources)))
logtags_sources := $(addprefix $(LOCAL_PATH)/, $(logtags_sources))
-$(logtags_java_sources): $(intermediates.COMMON)/src/%.java: $(LOCAL_PATH)/%.logtags $(TARGET_OUT_COMMON_INTERMEDIATES)/all-event-log-tags.txt
+$(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
$(transform-logtags-to-java)
else
@@ -443,31 +423,8 @@
$(hide) $(ACP) -fp $< $@
endif
-ifeq ($(LOCAL_EMMA_INSTRUMENT),true)
-$(full_classes_emma_jar): PRIVATE_EMMA_COVERAGE_FILE := $(intermediates.COMMON)/coverage.em
-$(full_classes_emma_jar): PRIVATE_EMMA_INTERMEDIATES_DIR := $(emma_intermediates_dir)
-# 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
-# this rule will generate both $(PRIVATE_EMMA_COVERAGE_FILE) and
-# $(full_classes_emma_jar)
-$(full_classes_emma_jar): $(full_classes_jarjar_jar) | $(EMMA_JAR)
- $(transform-classes.jar-to-emma)
-
-else
-$(full_classes_emma_jar): $(full_classes_jarjar_jar)
- @echo Copying: $@
- $(copy-file-to-target)
-endif
-
# Keep a copy of the jar just before proguard processing.
-$(full_classes_jar): $(full_classes_emma_jar) | $(ACP)
+$(full_classes_jar): $(full_classes_jarjar_jar) | $(ACP)
@echo Copying: $@
$(hide) $(ACP) -fp $< $@
@@ -510,22 +467,25 @@
common_proguard_flags := -forceprocessing
+common_proguard_flag_files :=
ifeq ($(filter nosystem,$(LOCAL_PROGUARD_ENABLED)),)
-common_proguard_flags += -include $(BUILD_SYSTEM)/proguard.flags
+common_proguard_flag_files += $(BUILD_SYSTEM)/proguard.flags
ifeq ($(LOCAL_EMMA_INSTRUMENT),true)
-ifdef LOCAL_JACK_ENABLED
-common_proguard_flags += -include $(BUILD_SYSTEM)/proguard.jacoco.flags
-else
-common_proguard_flags += -include $(BUILD_SYSTEM)/proguard.emma.flags
-endif # LOCAL_JACK_ENABLED
+common_proguard_flag_files += $(BUILD_SYSTEM)/proguard.jacoco.flags
endif
# If this is a test package, add proguard keep flags for tests.
ifneq ($(LOCAL_INSTRUMENTATION_FOR)$(filter tests,$(LOCAL_MODULE_TAGS)),)
-common_proguard_flags += -include $(BUILD_SYSTEM)/proguard_tests.flags
+common_proguard_flag_files += $(BUILD_SYSTEM)/proguard_tests.flags
ifeq ($(filter shrinktests,$(LOCAL_PROGUARD_ENABLED)),)
common_proguard_flags += -dontshrink # don't shrink tests by default
endif # shrinktests
endif # test package
+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
+
ifeq ($(filter obfuscation,$(LOCAL_PROGUARD_ENABLED)),)
# By default no obfuscation
common_proguard_flags += -dontobfuscate
@@ -551,10 +511,9 @@
-applymapping $(link_instr_intermediates_dir.COMMON)/proguard_dictionary \
-verbose \
$(legacy_proguard_flags)
-ifdef LOCAL_JACK_ENABLED
+
jack_proguard_flags += -applymapping $(link_instr_intermediates_dir.COMMON)/jack_dictionary
full_jack_deps += $(link_instr_intermediates_dir.COMMON)/jack_dictionary
-endif
# Sometimes (test + main app) uses different keep rules from the main app -
# apply the main app's dictionary anyway.
@@ -577,7 +536,7 @@
endif
$(full_classes_proguard_jar): PRIVATE_EXTRA_INPUT_JAR := $(extra_input_jar)
$(full_classes_proguard_jar): PRIVATE_PROGUARD_FLAGS := $(legacy_proguard_flags) $(common_proguard_flags) $(LOCAL_PROGUARD_FLAGS)
-$(full_classes_proguard_jar) : $(full_classes_jar) $(extra_input_jar) $(my_support_library_sdk_raise) $(proguard_flag_files) | $(PROGUARD)
+$(full_classes_proguard_jar) : $(full_classes_jar) $(extra_input_jar) $(my_support_library_sdk_raise) $(common_proguard_flag_files) $(proguard_flag_files) | $(PROGUARD)
$(call transform-jar-to-proguard)
else # LOCAL_PROGUARD_ENABLED not defined
@@ -587,30 +546,11 @@
endif # LOCAL_PROGUARD_ENABLED defined
-ifndef LOCAL_JACK_ENABLED
-# 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)
-# 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
-endif # LOCAL_JACK_ENABLED is disabled
-
$(built_dex): $(built_dex_intermediate) | $(ACP)
@echo Copying: $@
$(hide) mkdir -p $(dir $@)
$(hide) rm -f $(dir $@)/classes*.dex
$(hide) $(ACP) -fp $(dir $<)/classes*.dex $(dir $@)
-ifneq ($(GENERATE_DEX_DEBUG),)
- $(install-dex-debug)
-endif
findbugs_xml := $(intermediates.COMMON)/findbugs.xml
$(findbugs_xml) : PRIVATE_AUXCLASSPATH := $(addprefix -auxclasspath ,$(strip \
@@ -638,7 +578,6 @@
endif # full_classes_jar is defined
-ifdef LOCAL_JACK_ENABLED
$(LOCAL_INTERMEDIATE_TARGETS): \
PRIVATE_JACK_INTERMEDIATES_DIR := $(intermediates.COMMON)/jack-rsc
ifeq ($(LOCAL_JACK_ENABLED),incremental)
@@ -679,9 +618,10 @@
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_JACK_VERSION := $(LOCAL_JACK_VERSION)
jack_all_deps := $(java_sources) $(java_resource_sources) $(full_jack_deps) \
- $(jar_manifest_file) $(layers_file) $(RenderScript_file_stamp) $(proguard_flag_files) \
+ $(jar_manifest_file) $(layers_file) $(RenderScript_file_stamp) \
+ $(common_proguard_flag_files) $(proguard_flag_files) \
$(proto_java_sources_file_stamp) $(LOCAL_ADDITIONAL_DEPENDENCIES) $(LOCAL_JARJAR_RULES) \
- $(JACK)
+ $(JACK_DEFAULT_ARGS) $(JACK)
$(jack_check_timestamp): $(jack_all_deps)
@echo Checking build with Jack: $@
@@ -702,9 +642,11 @@
ifeq ($(LOCAL_EMMA_INSTRUMENT),true)
$(built_dex_intermediate): PRIVATE_JACK_COVERAGE_OPTIONS := \
- -D jack.coverage="true" \
+ -D jack.coverage=true \
-D jack.coverage.metadata.file=$(intermediates.COMMON)/coverage.em \
- -D jack.coverage.jacoco.package=$(JACOCO_PACKAGE_NAME)
+ -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))
else
$(built_dex_intermediate): PRIVATE_JACK_COVERAGE_OPTIONS :=
endif
@@ -729,4 +671,3 @@
@echo Building with Jack: $@
$(java-to-jack)
endif # full_classes_jar is defined
-endif # LOCAL_JACK_ENABLED
diff --git a/core/java_common.mk b/core/java_common.mk
index 44dfc51..f983935 100644
--- a/core/java_common.mk
+++ b/core/java_common.mk
@@ -295,7 +295,6 @@
###########################################################
# JACK
###########################################################
-ifdef LOCAL_JACK_ENABLED
ifdef need_compile_java
LOCAL_JACK_FLAGS += -D jack.java.source.version=$(LOCAL_JAVA_LANGUAGE_VERSION)
@@ -386,4 +385,3 @@
$(LOCAL_INTERMEDIATE_TARGETS) : PRIVATE_JARJAR_RULES := $(LOCAL_JARJAR_RULES)
endif # need_compile_java
-endif # LOCAL_JACK_ENABLED
diff --git a/core/java_library.mk b/core/java_library.mk
index 8edba55..283e9ad 100644
--- a/core/java_library.mk
+++ b/core/java_library.mk
@@ -28,11 +28,9 @@
include $(BUILD_SYSTEM)/configure_local_jack.mk
#################################
-ifdef LOCAL_JACK_ENABLED
ifdef LOCAL_IS_STATIC_JAVA_LIBRARY
LOCAL_BUILT_MODULE_STEM := classes.jack
endif
-endif
intermediates.COMMON := $(call local-intermediates-dir,COMMON)
@@ -47,12 +45,8 @@
ifeq (true,$(EMMA_INSTRUMENT))
ifeq (true,$(LOCAL_EMMA_INSTRUMENT))
ifeq (true,$(EMMA_INSTRUMENT_STATIC))
-ifdef LOCAL_JACK_ENABLED
# Jack supports coverage with Jacoco
LOCAL_STATIC_JAVA_LIBRARIES += jacocoagent
-else
-LOCAL_STATIC_JAVA_LIBRARIES += emma
-endif # LOCAL_JACK_ENABLED
endif # LOCAL_EMMA_INSTRUMENT
endif # EMMA_INSTRUMENT_STATIC
else
@@ -66,37 +60,21 @@
ifeq ($(LOCAL_IS_STATIC_JAVA_LIBRARY),true)
# No dex; all we want are the .class files with resources.
$(common_javalib.jar) : $(java_resource_sources)
-ifdef LOCAL_PROGUARD_ENABLED
-$(common_javalib.jar) : $(full_classes_proguard_jar)
-else
$(common_javalib.jar) : $(full_classes_jar)
-endif
@echo "target Static Jar: $(PRIVATE_MODULE) ($@)"
$(copy-file-to-target)
-ifdef LOCAL_JACK_ENABLED
$(LOCAL_BUILT_MODULE) : $(full_classes_jack)
-else
-$(LOCAL_BUILT_MODULE) : $(common_javalib.jar)
-endif
$(copy-file-to-target)
else # !LOCAL_IS_STATIC_JAVA_LIBRARY
$(common_javalib.jar): PRIVATE_DEX_FILE := $(built_dex)
-$(common_javalib.jar): PRIVATE_SOURCE_ARCHIVE := $(full_classes_jarjar_jar)
-$(common_javalib.jar): PRIVATE_DONT_DELETE_JAR_DIRS := $(LOCAL_DONT_DELETE_JAR_DIRS)
$(common_javalib.jar) : $(built_dex) $(java_resource_sources) | $(ZIPTIME)
@echo "target Jar: $(PRIVATE_MODULE) ($@)"
-ifdef LOCAL_JACK_ENABLED
$(create-empty-package)
-else
- $(call initialize-package-file,$(PRIVATE_SOURCE_ARCHIVE),$@)
-endif
$(add-dex-to-package)
-ifdef LOCAL_JACK_ENABLED
$(add-carried-jack-resources)
-endif
$(remove-timestamps-from-package)
ifdef LOCAL_DEX_PREOPT
diff --git a/core/main.mk b/core/main.mk
index d74d8bb..ad1b663 100644
--- a/core/main.mk
+++ b/core/main.mk
@@ -77,6 +77,7 @@
stnod systemtarball-nodeps \
userdataimage-nodeps userdatatarball-nodeps \
cacheimage-nodeps \
+ bptimage-nodeps \
vendorimage-nodeps \
ramdisk-nodeps \
bootimage-nodeps \
@@ -231,6 +232,12 @@
endif # java version is not Sun Oracle JDK
endif # if requires_openjdk
+KNOWN_INCOMPATIBLE_JAVAC_VERSIONS := google
+incompat_javac := $(foreach v,$(KNOWN_INCOMPATIBLE_JAVAC_VERSIONS),$(findstring $(v),$(javac_version_str)))
+ifneq ($(incompat_javac),)
+javac_version :=
+endif
+
# Check for the correct version of javac
ifeq ($(strip $(javac_version)),)
$(info ************************************************************)
@@ -238,7 +245,12 @@
$(info of javac.)
$(info $(space))
$(info Your version is: $(javac_version_str).)
+ifneq ($(incompat_javac),)
+$(info This '$(incompat_javac)' version is not supported for Android platform builds.)
+$(info Use a publicly available JDK and make sure you have run envsetup.sh / lunch.)
+else
$(info The required version is: $(required_javac_version))
+endif
$(info $(space))
$(info Please follow the machine setup instructions at)
$(info $(space)$(space)$(space)$(space)https://source.android.com/source/download.html)
@@ -905,6 +917,9 @@
.PHONY: cacheimage
cacheimage: $(INSTALLED_CACHEIMAGE_TARGET)
+.PHONY: bptimage
+bptimage: $(INSTALLED_BPTIMAGE_TARGET)
+
.PHONY: vendorimage
vendorimage: $(INSTALLED_VENDORIMAGE_TARGET)
@@ -934,6 +949,7 @@
$(INSTALLED_RECOVERYIMAGE_TARGET) \
$(INSTALLED_USERDATAIMAGE_TARGET) \
$(INSTALLED_CACHEIMAGE_TARGET) \
+ $(INSTALLED_BPTIMAGE_TARGET) \
$(INSTALLED_VENDORIMAGE_TARGET) \
$(INSTALLED_FILES_FILE) \
$(INSTALLED_FILES_FILE_VENDOR)
diff --git a/core/package_internal.mk b/core/package_internal.mk
index 64040e5..6966625 100644
--- a/core/package_internal.mk
+++ b/core/package_internal.mk
@@ -166,12 +166,10 @@
endif # !custom
LOCAL_PROGUARD_FLAGS := $(addprefix -include ,$(proguard_options_file)) $(LOCAL_PROGUARD_FLAGS)
-ifdef LOCAL_JACK_ENABLED
ifndef LOCAL_JACK_PROGUARD_FLAGS
LOCAL_JACK_PROGUARD_FLAGS := $(LOCAL_PROGUARD_FLAGS)
endif
LOCAL_JACK_PROGUARD_FLAGS := $(addprefix -include ,$(proguard_options_file)) $(LOCAL_JACK_PROGUARD_FLAGS)
-endif # LOCAL_JACK_ENABLED
ifeq (true,$(EMMA_INSTRUMENT))
ifndef LOCAL_EMMA_INSTRUMENT
@@ -184,33 +182,35 @@
LOCAL_EMMA_INSTRUMENT := false
endif # EMMA_INSTRUMENT is true
+ifneq ($(LOCAL_SRC_FILES)$(LOCAL_STATIC_JAVA_LIBRARIES)$(LOCAL_SOURCE_FILES_ALL_GENERATED),)
+# Only add jacocoagent if the package contains some java code
ifeq (true,$(LOCAL_EMMA_INSTRUMENT))
ifeq (true,$(EMMA_INSTRUMENT_STATIC))
-ifdef LOCAL_JACK_ENABLED
# Jack supports coverage with Jacoco
LOCAL_STATIC_JAVA_LIBRARIES += jacocoagent
-else
-LOCAL_STATIC_JAVA_LIBRARIES += emma
-endif # LOCAL_JACK_ENABLED
-else
+else # ! EMMA_INSTRUMENT_STATIC
ifdef LOCAL_SDK_VERSION
ifdef TARGET_BUILD_APPS
-# In unbundled build merge the emma library into the apk.
-ifdef LOCAL_JACK_ENABLED
+# In unbundled build, merge the coverage library into the apk.
# Jack supports coverage with Jacoco
LOCAL_STATIC_JAVA_LIBRARIES += jacocoagent
-else
-LOCAL_STATIC_JAVA_LIBRARIES += emma
-endif # LOCAL_JACK_ENABLED
-else
-# If build against the SDK in full build, core.jar is not used,
-# we have to use prebiult emma.jar to make Proguard happy;
-# Otherwise emma classes are included in core.jar.
-LOCAL_PROGUARD_FLAGS += -libraryjars $(EMMA_JAR)
-endif # full build
+# Exclude jacoco classes from proguard
+LOCAL_PROGUARD_FLAGS += -include $(BUILD_SYSTEM)/proguard.jacoco.flags
+LOCAL_JACK_PROGUARD_FLAGS += -include $(BUILD_SYSTEM)/proguard.jacoco.flags
+else # ! TARGET_BUILD_APPS
+# If build against the SDK in full build, core.jar is not used
+# so coverage classes are not present.
+# Jack needs jacoco on the classpath but we do not want it to be in
+# the final apk. While it is a static library, we add it to the
+# LOCAL_JAVA_LIBRARIES which are only present on the classpath.
+# Note: we have nothing to do for proguard since jacoco will be
+# on the classpath only, thus not modified during the compilation.
+LOCAL_JAVA_LIBRARIES += jacocoagent
+endif # TARGET_BUILD_APPS
endif # LOCAL_SDK_VERSION
-endif # EMMA_INSTRUMENT_STATIC
+endif # ! EMMA_INSTRUMENT_STATIC
endif # LOCAL_EMMA_INSTRUMENT
+endif # Contains java code
rs_compatibility_jni_libs :=
@@ -291,30 +291,13 @@
$(add-assets-to-package)
endif
+# Make sure to generate R.java before compiling.
# Other modules should depend on the BUILT module if
# they want to use this module's R.java file.
-$(LOCAL_BUILT_MODULE): $(R_file_stamp)
-
-ifdef LOCAL_JACK_ENABLED
-ifneq ($(built_dex_intermediate),)
-$(built_dex_intermediate): $(R_file_stamp)
-endif
-ifneq ($(noshrob_classes_jack),)
-$(noshrob_classes_jack): $(R_file_stamp)
-endif
-ifneq ($(full_classes_jack),)
-$(full_classes_jack): $(R_file_stamp)
-$(jack_check_timestamp): $(R_file_stamp)
-endif
-endif # LOCAL_JACK_ENABLED
-
-ifneq ($(full_classes_jar),)
-# If full_classes_jar is non-empty, we're building sources.
-# If we're building sources, the initial javac step (which
-# produces full_classes_compiled_jar) needs to ensure the
-# R.java and Manifest.java files have been generated first.
-$(full_classes_compiled_jar): $(R_file_stamp)
-endif
+$(LOCAL_BUILT_MODULE) \
+$(full_classes_compiled_jar) \
+$(built_dex_intermediate) $(noshrob_classes_jack) $(full_classes_jack) $(jack_check_timestamp) \
+ : $(R_file_stamp)
endif # need_compile_res
@@ -357,12 +340,9 @@
ifneq ($(full_classes_jar),)
$(LOCAL_BUILT_MODULE): PRIVATE_DEX_FILE := $(built_dex)
-# Use the jarjar processed arhive as the initial package file.
-$(LOCAL_BUILT_MODULE): PRIVATE_SOURCE_ARCHIVE := $(full_classes_jarjar_jar)
$(LOCAL_BUILT_MODULE): $(built_dex)
else
$(LOCAL_BUILT_MODULE): PRIVATE_DEX_FILE :=
-$(LOCAL_BUILT_MODULE): PRIVATE_SOURCE_ARCHIVE :=
endif # full_classes_jar
include $(BUILD_SYSTEM)/install_jni_libs.mk
@@ -421,16 +401,9 @@
$(LOCAL_BUILT_MODULE): PRIVATE_PRODUCT_AAPT_PREF_CONFIG := $(PRODUCT_AAPT_PREF_CONFIG)
endif
endif
-$(LOCAL_BUILT_MODULE): PRIVATE_DONT_DELETE_JAR_DIRS := $(LOCAL_DONT_DELETE_JAR_DIRS)
$(LOCAL_BUILT_MODULE): $(all_res_assets) $(jni_shared_libraries) $(full_android_manifest)
@echo "target Package: $(PRIVATE_MODULE) ($@)"
-ifdef LOCAL_JACK_ENABLED
$(create-empty-package)
-else
- $(if $(PRIVATE_SOURCE_ARCHIVE),\
- $(call initialize-package-file,$(PRIVATE_SOURCE_ARCHIVE),$@),\
- $(create-empty-package))
-endif
$(add-assets-to-package)
ifneq ($(jni_shared_libraries),)
$(add-jni-shared-libs-to-package)
@@ -441,9 +414,7 @@
else # full_classes_jar
$(add-dex-to-package)
endif # full_classes_jar
-ifdef LOCAL_JACK_ENABLED
$(add-carried-jack-resources)
-endif
ifdef LOCAL_DEX_PREOPT
ifneq ($(BUILD_PLATFORM_ZIP),)
@# Keep a copy of apk with classes.dex unstripped
diff --git a/core/prebuilt_internal.mk b/core/prebuilt_internal.mk
index e826755..22fa6a6 100644
--- a/core/prebuilt_internal.mk
+++ b/core/prebuilt_internal.mk
@@ -392,15 +392,13 @@
endif # LOCAL_IS_HOST_MODULE is not set
ifneq ($(prebuilt_module_is_dex_javalib),true)
-ifneq ($(LOCAL_JILL_FLAGS),)
-$(error LOCAL_JILL_FLAGS is not supported any more, please use jack options in LOCAL_JACK_FLAGS instead)
-endif
# We may be building classes.jack from a host jar for host dalvik Java library.
$(intermediates.COMMON)/classes.jack : PRIVATE_JACK_FLAGS:=$(LOCAL_JACK_FLAGS)
$(intermediates.COMMON)/classes.jack : PRIVATE_JACK_MIN_SDK_VERSION := 1
$(intermediates.COMMON)/classes.jack : $(my_src_jar) \
- $(LOCAL_ADDITIONAL_DEPENDENCIES) $(JACK) | setup-jack-server
+ $(LOCAL_ADDITIONAL_DEPENDENCIES) $(JACK_DEFAULT_ARGS) $(JACK) \
+ | setup-jack-server
$(transform-jar-to-jack)
# Update timestamps of .toc files for prebuilts so dependents will be
diff --git a/core/static_java_library.mk b/core/static_java_library.mk
index 8913ee4..d3324f8 100644
--- a/core/static_java_library.mk
+++ b/core/static_java_library.mk
@@ -63,12 +63,10 @@
LOCAL_PROGUARD_FLAGS := $(addprefix -include ,$(proguard_options_file)) $(LOCAL_PROGUARD_FLAGS)
-ifdef LOCAL_JACK_ENABLED
ifndef LOCAL_JACK_PROGUARD_FLAGS
LOCAL_JACK_PROGUARD_FLAGS := $(LOCAL_PROGUARD_FLAGS)
endif
LOCAL_JACK_PROGUARD_FLAGS := $(addprefix -include ,$(proguard_options_file)) $(LOCAL_JACK_PROGUARD_FLAGS)
-endif # LOCAL_JACK_ENABLED
endif # LOCAL_RESOURCE_DIR
@@ -126,13 +124,10 @@
$(create-resource-java-files)
$(hide) find $(PRIVATE_SOURCE_INTERMEDIATES_DIR) -name R.java | xargs cat > $@
-$(LOCAL_BUILT_MODULE): $(R_file_stamp)
-ifdef LOCAL_JACK_ENABLED
-$(noshrob_classes_jack): $(R_file_stamp)
-$(full_classes_jack): $(R_file_stamp)
-$(jack_check_timestamp): $(R_file_stamp)
-endif # LOCAL_JACK_ENABLED
-$(full_classes_compiled_jar): $(R_file_stamp)
+$(LOCAL_BUILT_MODULE) \
+$(full_classes_compiled_jar) \
+$(noshrob_classes_jack) $(full_classes_jack) $(jack_check_timestamp) \
+ : $(R_file_stamp)
# Rule to build AAR, archive including classes.jar, resource, etc.
built_aar := $(intermediates.COMMON)/javalib.aar
diff --git a/tools/fs_config/Android.mk b/tools/fs_config/Android.mk
index be140b5..fb4a0c4 100644
--- a/tools/fs_config/Android.mk
+++ b/tools/fs_config/Android.mk
@@ -23,20 +23,31 @@
include $(BUILD_HOST_EXECUTABLE)
-# To Build the custom target binary for the host to generate the fs_config
-# override files. The executable is hard coded to include the
-# $(TARGET_ANDROID_FILESYSTEM_CONFIG_H) file if it exists.
-# Expectations:
-# device/<vendor>/<device>/android_filesystem_config.h
-# fills in struct fs_path_config android_device_dirs[] and
-# struct fs_path_config android_device_files[]
-# device/<vendor>/<device>/device.mk
-# PRODUCT_PACKAGES += fs_config_dirs fs_config_files
-
-# If not specified, check if default one to be found
+# One can override the default android_filesystem_config.h file in one of two ways:
+#
+# 1. The old way:
+# To Build the custom target binary for the host to generate the fs_config
+# override files. The executable is hard coded to include the
+# $(TARGET_ANDROID_FILESYSTEM_CONFIG_H) file if it exists.
+# Expectations:
+# device/<vendor>/<device>/android_filesystem_config.h
+# fills in struct fs_path_config android_device_dirs[] and
+# struct fs_path_config android_device_files[]
+# device/<vendor>/<device>/device.mk
+# PRODUCT_PACKAGES += fs_config_dirs fs_config_files
+# If not specified, check if default one to be found
+#
+# 2. The new way:
+# set TARGET_FS_CONFIG_GEN to contain a list of intermediate format files
+# for generating the android_filesystem_config.h file.
+#
+# More information can be found in the README
ANDROID_FS_CONFIG_H := android_filesystem_config.h
ifneq ($(TARGET_ANDROID_FILESYSTEM_CONFIG_H),)
+ifneq ($(TARGET_FS_CONFIG_GEN),)
+$(error Cannot set TARGET_ANDROID_FILESYSTEM_CONFIG_H and TARGET_FS_CONFIG_GEN simultaneously)
+endif
# One and only one file can be specified.
ifneq ($(words $(TARGET_ANDROID_FILESYSTEM_CONFIG_H)),1)
@@ -51,20 +62,43 @@
my_fs_config_h := $(TARGET_ANDROID_FILESYSTEM_CONFIG_H)
else ifneq ($(wildcard $(TARGET_DEVICE_DIR)/$(ANDROID_FS_CONFIG_H)),)
+
+ifneq ($(TARGET_FS_CONFIG_GEN),)
+$(error Cannot provide $(TARGET_DEVICE_DIR)/$(ANDROID_FS_CONFIG_H) and set TARGET_FS_CONFIG_GEN simultaneously)
+endif
my_fs_config_h := $(TARGET_DEVICE_DIR)/$(ANDROID_FS_CONFIG_H)
+
else
my_fs_config_h := $(LOCAL_PATH)/default/$(ANDROID_FS_CONFIG_H)
endif
+##################################
include $(CLEAR_VARS)
LOCAL_SRC_FILES := fs_config_generate.c
LOCAL_MODULE := fs_config_generate_$(TARGET_DEVICE)
+LOCAL_MODULE_CLASS := EXECUTABLES
LOCAL_SHARED_LIBRARIES := libcutils
LOCAL_CFLAGS := -Werror -Wno-error=\#warnings
+
+ifneq ($(TARGET_FS_CONFIG_GEN),)
+gen := $(local-generated-sources-dir)/$(ANDROID_FS_CONFIG_H)
+$(gen): PRIVATE_LOCAL_PATH := $(LOCAL_PATH)
+$(gen): PRIVATE_TARGET_FS_CONFIG_GEN := $(TARGET_FS_CONFIG_GEN)
+$(gen): PRIVATE_CUSTOM_TOOL = $(PRIVATE_LOCAL_PATH)/fs_config_generator.py $(PRIVATE_TARGET_FS_CONFIG_GEN) > $@
+$(gen): $(TARGET_FS_CONFIG_GEN) $(LOCAL_PATH)/fs_config_generator.py
+ $(transform-generated-source)
+
+LOCAL_GENERATED_SOURCES := $(gen)
+my_fs_config_h := $(gen)
+gen :=
+endif
+
LOCAL_C_INCLUDES := $(dir $(my_fs_config_h))
+
include $(BUILD_HOST_EXECUTABLE)
fs_config_generate_bin := $(LOCAL_INSTALLED_MODULE)
+##################################
# Generate the system/etc/fs_config_dirs binary file for the target
# Add fs_config_dirs to PRODUCT_PACKAGES in the device make file to enable
include $(CLEAR_VARS)
@@ -76,6 +110,7 @@
@mkdir -p $(dir $@)
$< -D -o $@
+##################################
# Generate the system/etc/fs_config_files binary file for the target
# Add fs_config_files to PRODUCT_PACKAGES in the device make file to enable
include $(CLEAR_VARS)
diff --git a/tools/fs_config/README b/tools/fs_config/README
new file mode 100644
index 0000000..c20614b
--- /dev/null
+++ b/tools/fs_config/README
@@ -0,0 +1,116 @@
+ _____ _____ _____ _____ __ __ _____
+/ _ \/ __\/ _ \| _ \/ \/ \/ __\
+| _ <| __|| _ || | || \/ || __|
+\__|\_/\_____/\__|__/|_____/\__ \__/\_____/
+
+
+Generating the android_filesystem_config.h
+
+To generate the android_filesystem_config.h file, one can choose from
+one of two methods. The first method, is to declare
+TARGET_ANDROID_FILESYSTEM_CONFIG_H in the device BoardConfig.mk file. This
+variable can only have one item in it, and it is used directly as the
+android_filesystem_config.h header when building
+fs_config_generate_$(TARGET_DEVICE) which is used to generate fs_config_files
+and fs_config_dirs target executable.
+
+The limitation with this, is that it can only be set once, thus if the device
+has a make hierarchy, then each device needs its own file, and cannot share
+from a common source or that common source needs to include everything from
+both devices.
+
+The other way is to set TARGET_FS_CONFIG_GEN, which can be a list of
+intermediate fs configuration files. It is a build error on any one
+these conditions:
+ * Specify TARGET_FS_CONFIG_GEN and TARGET_ANDROID_FILESYSTEM_CONFIG_H
+ * Specify TARGET_FS_CONFIG_GEN and provide
+ $(TARGET_DEVICE_DIR)/android_filesystem_config.h
+
+The parsing of the config file follows the Python ConfigParser specification,
+with the sections and fields as defined below. There are two types of sections,
+both sections require all options to be specified. The first section type is
+the "caps" section.
+
+The "caps" section follows the following syntax:
+
+[path]
+mode: Octal file mode
+user: AID_<user>
+group: AID_<group>
+caps: cap*
+
+Where:
+
+[path]
+ The filesystem path to configure. A path ending in / is considered a dir,
+ else its a file.
+
+mode:
+ A valid octal file mode of at least 3 digits. If 3 is specified, it is
+ prefixed with a 0, else mode is used as is.
+
+user:
+ The exact, C define for a valid AID. Note custom AIDs can be defined in the
+ AID section documented below.
+
+group:
+ The exact, C define for a valid AID. Note custom AIDs can be defined in the
+ AID section documented below.
+
+caps:
+ The name as declared in
+ system/core/include/private/android_filesystem_capability.h without the
+ leading CAP_. Mixed case is allowed. Caps can also be the raw:
+ * binary (0b0101)
+ * octal (0455)
+ * int (42)
+ * hex (0xFF)
+ For multiple caps, just separate by whitespace.
+
+It is an error to specify multiple sections with the same [path]. Per the ini
+specifications enforced by Pythons ConfigParser.
+
+
+The next section type is the "AID" section, for specifying OEM specific AIDS.
+
+The AID section follows the following syntax:
+
+[AID_<name>]
+value: <number>
+
+Where:
+
+[AID_<name>]
+ The <name> can be any valid character for a #define identifier in C.
+
+value:
+ A valid C style number string. Hex, octal, binary and decimal are supported. See "caps"
+ above for more details on number formatting.
+
+It is an error to specify multiple sections with the same [AID_<name>]. Per the ini
+specifications enforced by Pythons ConfigParser. It is also an error to specify
+multiple sections with the same value option. It is also an error to specify a value
+that is outside of the OEM range AID_OEM_RESERVED_START(2900) and AID_OEM_RESERVED_END(2999)
+as defined by system/core/include/private/android_filesystem_config.h.
+
+Ordering within the TARGET_FS_CONFIG_GEN files is not relevant. The paths for files are sorted
+like so within their respective array definition:
+ * specified path before prefix match
+ ** ie foo before f*
+ * lexicographical less than before other
+ ** ie boo before foo
+
+Given these paths:
+
+paths=['ac', 'a', 'acd', 'an', 'a*', 'aa', 'ac*']
+
+The sort order would be:
+paths=['a', 'aa', 'ac', 'acd', 'an', 'ac*', 'a*']
+
+Thus the fs_config tools will match on specified paths before attempting prefix, and match on the
+longest matching prefix.
+
+The declared AIDS are sorted in ascending numerical order based on the option "value". The string
+representation of value is preserved. Both choices were made for maximum readability of the generated
+file and to line up files. Sync lines are placed with the source file as comments in the generated
+header file.
diff --git a/tools/fs_config/fs_config_generator.py b/tools/fs_config/fs_config_generator.py
new file mode 100755
index 0000000..e66e295
--- /dev/null
+++ b/tools/fs_config/fs_config_generator.py
@@ -0,0 +1,277 @@
+#!/usr/bin/env python
+
+import ConfigParser
+import re
+import sys
+
+
+GENERATED = '''
+/*
+ * THIS IS AN AUTOGENERATED FILE! DO NOT MODIFY
+ */
+'''
+
+INCLUDE = '#include <private/android_filesystem_config.h>'
+
+DEFINE_NO_DIRS = '#define NO_ANDROID_FILESYSTEM_CONFIG_DEVICE_DIRS\n'
+DEFINE_NO_FILES = '#define NO_ANDROID_FILESYSTEM_CONFIG_DEVICE_FILES\n'
+
+DEFAULT_WARNING = '#warning No device-supplied android_filesystem_config.h, using empty default.'
+
+NO_ANDROID_FILESYSTEM_CONFIG_DEVICE_DIRS_ENTRY = '{ 00000, AID_ROOT, AID_ROOT, 0, "system/etc/fs_config_dirs" },'
+NO_ANDROID_FILESYSTEM_CONFIG_DEVICE_FILES_ENTRY = '{ 00000, AID_ROOT, AID_ROOT, 0, "system/etc/fs_config_files" },'
+
+IFDEF_ANDROID_FILESYSTEM_CONFIG_DEVICE_DIRS = '#ifdef NO_ANDROID_FILESYSTEM_CONFIG_DEVICE_DIRS'
+ENDIF = '#endif'
+
+OPEN_FILE_STRUCT = 'static const struct fs_path_config android_device_files[] = {'
+OPEN_DIR_STRUCT = 'static const struct fs_path_config android_device_dirs[] = {'
+CLOSE_FILE_STRUCT = '};'
+
+GENERIC_DEFINE = "#define %s\t%s"
+
+FILE_COMMENT = '// Defined in file: \"%s\"'
+
+# from system/core/include/private/android_filesystem_config.h
+AID_OEM_RESERVED_START = 2900
+AID_OEM_RESERVED_END = 2999
+
+
+AID_MATCH = re.compile('AID_[a-zA-Z]+')
+
+def handle_aid(file_name, section_name, config, aids, seen_aids):
+ value = config.get(section_name, 'value')
+
+ errmsg = '%s for: \"' + section_name + '" file: \"' + file_name + '\"'
+
+ if not value:
+ raise Exception(errmsg % 'Found specified but unset "value"')
+
+ v = convert_int(value)
+ if not v:
+ raise Exception(errmsg % ('Invalid "value", not a number, got: \"%s\"' % value))
+
+ # Values must be within OEM range
+ if (v < AID_OEM_RESERVED_START) or (v > AID_OEM_RESERVED_END):
+ s = '"value" not in valid range %d - %d, got: %s'
+ s = s % (AID_OEM_RESERVED_START, AID_OEM_RESERVED_END, value)
+ raise Exception(errmsg % s)
+
+ # use the normalized int value in the dict and detect
+ # duplicate definitions of the same vallue
+ v = str(v)
+ if v in seen_aids[1]:
+ # map of value to aid name
+ a = seen_aids[1][v]
+
+ # aid name to file
+ f = seen_aids[0][a]
+
+ s = 'Duplicate AID value "%s" found on AID: "%s".' % (value, seen_aids[1][v])
+ s += ' Previous found in file: "%s."' % f
+ raise Exception(errmsg % s)
+
+ seen_aids[1][v] = section_name
+
+ # Append a tuple of (AID_*, base10(value), str(value))
+ # We keep the str version of value so we can print that out in the
+ # generated header so investigating parties can identify parts.
+ # We store the base10 value for sorting, so everything is ascending
+ # later.
+ aids.append((file_name, section_name, v, value))
+
+def convert_int(num):
+
+ try:
+ if num.startswith('0x'):
+ return int(num, 16)
+ elif num.startswith('0b'):
+ return int(num, 2)
+ elif num.startswith('0'):
+ return int(num, 8)
+ else:
+ return int(num, 10)
+ except ValueError:
+ pass
+ return None
+
+def handle_path(file_name, section_name, config, files, dirs):
+
+ mode = config.get(section_name, 'mode')
+ user = config.get(section_name, 'user')
+ group = config.get(section_name, 'group')
+ caps = config.get(section_name, 'caps')
+
+ errmsg = 'Found specified but unset option: \"%s" in file: \"' + file_name + '\"'
+
+ if not mode:
+ raise Exception(errmsg % 'mode')
+
+ if not user:
+ raise Exception(errmsg % 'user')
+
+ if not group:
+ raise Exception(errmsg % 'group')
+
+ if not caps:
+ raise Exception(errmsg % 'caps')
+
+ caps = caps.split()
+
+ tmp = []
+ for x in caps:
+ if convert_int(x):
+ tmp.append('(' + x + ')')
+ else:
+ tmp.append('(1ULL << CAP_' + x.upper() + ')')
+
+ caps = tmp
+
+ path = '"' + section_name + '"'
+
+ if len(mode) == 3:
+ mode = '0' + mode
+
+ try:
+ int(mode, 8)
+ except:
+ raise Exception('Mode must be octal characters, got: "' + mode + '"')
+
+ if len(mode) != 4:
+ raise Exception('Mode must be 3 or 4 characters, got: "' + mode + '"')
+
+
+ caps = '|'.join(caps)
+
+ x = [ mode, user, group, caps, section_name ]
+ if section_name[-1] == '/':
+ dirs.append((file_name, x))
+ else:
+ files.append((file_name, x))
+
+def handle_dup(name, file_name, section_name, seen):
+ if section_name in seen:
+ dups = '"' + seen[section_name] + '" and '
+ dups += file_name
+ raise Exception('Duplicate ' + name + ' "' + section_name + '" found in files: ' + dups)
+
+def parse(file_name, files, dirs, aids, seen_paths, seen_aids):
+
+ config = ConfigParser.ConfigParser()
+ config.read(file_name)
+
+ for s in config.sections():
+
+ if AID_MATCH.match(s) and config.has_option(s, 'value'):
+ handle_dup('AID', file_name, s, seen_aids[0])
+ seen_aids[0][s] = file_name
+ handle_aid(file_name, s, config, aids, seen_aids)
+ else:
+ handle_dup('path', file_name, s, seen_paths)
+ seen_paths[s] = file_name
+ handle_path(file_name, s, config, files, dirs)
+
+def generate(files, dirs, aids):
+ print GENERATED
+ print INCLUDE
+ print
+
+ are_dirs = len(dirs) > 0
+ are_files = len(files) > 0
+ are_aids = len(aids) > 0
+
+ if are_aids:
+ # sort on value of (file_name, name, value, strvalue)
+ aids.sort(key=lambda x: x[2])
+ for a in aids:
+ # use the preserved str value
+ print FILE_COMMENT % a[0]
+ print GENERIC_DEFINE % (a[1], a[2])
+
+ print
+
+ if not are_dirs:
+ print DEFINE_NO_DIRS
+
+ if not are_files:
+ print DEFINE_NO_FILES
+
+ if not are_files and not are_dirs and not are_aids:
+ print DEFAULT_WARNING
+ return
+
+ if are_files:
+ print OPEN_FILE_STRUCT
+ for tup in files:
+ f = tup[0]
+ c = tup[1]
+ c[4] = '"' + c[4] + '"'
+ c = '{ ' + ' ,'.join(c) + ' },'
+ print FILE_COMMENT % f
+ print ' ' + c
+
+ if not are_dirs:
+ print IFDEF_ANDROID_FILESYSTEM_CONFIG_DEVICE_DIRS
+ print ' ' + NO_ANDROID_FILESYSTEM_CONFIG_DEVICE_DIRS_ENTRY
+ print ENDIF
+ print CLOSE_FILE_STRUCT
+
+ if are_dirs:
+ print OPEN_DIR_STRUCT
+ for d in dirs:
+ f[4] = '"' + f[4] + '"'
+ d = '{ ' + ' ,'.join(d) + ' },'
+ print ' ' + d
+
+ print CLOSE_FILE_STRUCT
+
+def file_key(x):
+
+ # Wrapper class for custom prefix matching strings
+ class S(object):
+ def __init__(self, str):
+
+ self.orig = str
+ self.is_prefix = str[-1] == '*'
+ if self.is_prefix:
+ self.str = str[:-1]
+ else:
+ self.str = str
+
+ def __lt__(self, other):
+
+ # if were both suffixed the smallest string
+ # is 'bigger'
+ if self.is_prefix and other.is_prefix:
+ b = len(self.str) > len(other.str)
+ # If I am an the suffix match, im bigger
+ elif self.is_prefix:
+ b = False
+ # If other is the suffix match, he's bigger
+ elif other.is_prefix:
+ b = True
+ # Alphabetical
+ else:
+ b = self.str < other.str
+ return b
+
+ return S(x[4])
+
+def main():
+
+ files = []
+ dirs = []
+ aids = []
+ seen_paths = {}
+
+ # (name to file, value to aid)
+ seen_aids = ({}, {})
+
+ for x in sys.argv[1:]:
+ parse(x, files, dirs, aids, seen_paths, seen_aids)
+
+ files.sort(key= lambda x: file_key(x[1]))
+ generate(files, dirs, aids)
+
+if __name__ == '__main__':
+ main()
diff --git a/tools/makeparallel/makeparallel.cpp b/tools/makeparallel/makeparallel.cpp
index 3c39846..c70fa9a 100644
--- a/tools/makeparallel/makeparallel.cpp
+++ b/tools/makeparallel/makeparallel.cpp
@@ -26,6 +26,7 @@
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
+#include <sys/resource.h>
#include <sys/time.h>
#include <sys/types.h>
#include <sys/wait.h>
@@ -343,6 +344,15 @@
// child
unsetenv("MAKEFLAGS");
unsetenv("MAKELEVEL");
+
+ // make 3.81 sets the stack ulimit to unlimited, which may cause problems
+ // for child processes
+ struct rlimit rlim{};
+ if (getrlimit(RLIMIT_STACK, &rlim) == 0 && rlim.rlim_cur == RLIM_INFINITY) {
+ rlim.rlim_cur = 8*1024*1024;
+ setrlimit(RLIMIT_STACK, &rlim);
+ }
+
int ret = execvp(path, args.data());
if (ret < 0) {
error(errno, errno, "exec %s failed", path);
diff --git a/tools/releasetools/add_img_to_target_files.py b/tools/releasetools/add_img_to_target_files.py
index d0027dc..f98a281 100755
--- a/tools/releasetools/add_img_to_target_files.py
+++ b/tools/releasetools/add_img_to_target_files.py
@@ -228,6 +228,35 @@
shutil.rmtree(temp_dir)
+def AddPartitionTable(output_zip, prefix="IMAGES/"):
+ """Create a partition table image and store it in output_zip."""
+
+ _, img_file_name = tempfile.mkstemp()
+ _, bpt_file_name = tempfile.mkstemp()
+
+ # use BPTTOOL from environ, or "bpttool" if empty or not set.
+ bpttool = os.getenv("BPTTOOL") or "bpttool"
+ cmd = [bpttool, "make_table", "--output_json", bpt_file_name,
+ "--output_gpt", img_file_name]
+ input_files_str = OPTIONS.info_dict["board_bpt_input_files"]
+ input_files = input_files_str.split(" ")
+ for i in input_files:
+ cmd.extend(["--input", i])
+ disk_size = OPTIONS.info_dict.get("board_bpt_disk_size")
+ if disk_size:
+ cmd.extend(["--disk_size", disk_size])
+ args = OPTIONS.info_dict.get("board_bpt_make_table_args")
+ if args:
+ cmd.extend(shlex.split(args))
+
+ p = common.Run(cmd, stdout=subprocess.PIPE)
+ p.communicate()
+ assert p.returncode == 0, "bpttool make_table failed"
+
+ common.ZipWrite(output_zip, img_file_name, prefix + "partition-table.img")
+ common.ZipWrite(output_zip, bpt_file_name, prefix + "partition-table.bpt")
+
+
def AddCache(output_zip, prefix="IMAGES/"):
"""Create an empty cache image and store it in output_zip."""
@@ -362,6 +391,9 @@
AddUserdata(output_zip)
banner("cache")
AddCache(output_zip)
+ if OPTIONS.info_dict.get("board_bpt_enable", None) == "true":
+ banner("partition-table")
+ AddPartitionTable(output_zip)
# For devices using A/B update, copy over images from RADIO/ to IMAGES/ and
# make sure we have all the needed images ready under IMAGES/.
diff --git a/tools/releasetools/blockimgdiff.py b/tools/releasetools/blockimgdiff.py
index 625dca2..d49112f 100644
--- a/tools/releasetools/blockimgdiff.py
+++ b/tools/releasetools/blockimgdiff.py
@@ -272,6 +272,8 @@
self.src_basenames = {}
self.src_numpatterns = {}
self._max_stashed_size = 0
+ self.touched_src_ranges = RangeSet()
+ self.touched_src_sha1 = None
assert version in (1, 2, 3, 4)
@@ -373,6 +375,7 @@
else:
stashes[sh] = 1
stashed_blocks += sr.size()
+ self.touched_src_ranges = self.touched_src_ranges.union(sr)
out.append("stash %s %s\n" % (sh, sr.to_string_raw()))
if stashed_blocks > max_stashed_blocks:
@@ -479,6 +482,9 @@
if temp_stash_usage > max_stashed_blocks:
max_stashed_blocks = temp_stash_usage
+ self.touched_src_ranges = self.touched_src_ranges.union(
+ xf.src_ranges)
+
out.append("%s %s %s %s\n" % (
xf.style,
self.HashBlocks(self.tgt, xf.tgt_ranges),
@@ -502,6 +508,9 @@
if temp_stash_usage > max_stashed_blocks:
max_stashed_blocks = temp_stash_usage
+ self.touched_src_ranges = self.touched_src_ranges.union(
+ xf.src_ranges)
+
out.append("%s %d %d %s %s %s %s\n" % (
xf.style,
xf.patch_start, xf.patch_len,
@@ -537,6 +546,10 @@
self.tgt.blocksize, max_allowed, cache_size,
stash_threshold)
+ if self.version >= 3:
+ self.touched_src_sha1 = self.HashBlocks(
+ self.src, self.touched_src_ranges)
+
# Zero out extended blocks as a workaround for bug 20881595.
if self.tgt.extended:
out.append("zero %s\n" % (self.tgt.extended.to_string_raw(),))
diff --git a/tools/releasetools/build_image.py b/tools/releasetools/build_image.py
index e248860..4ff8c43 100755
--- a/tools/releasetools/build_image.py
+++ b/tools/releasetools/build_image.py
@@ -15,9 +15,9 @@
# limitations under the License.
"""
-Build image output_image_file from input_directory and properties_file.
+Build image output_image_file from input_directory, properties_file, and target_out_dir
-Usage: build_image input_directory properties_file output_image_file
+Usage: build_image input_directory properties_file output_image_file target_out_dir
"""
import os
diff --git a/tools/releasetools/common.py b/tools/releasetools/common.py
index 62ccc45..92af547 100644
--- a/tools/releasetools/common.py
+++ b/tools/releasetools/common.py
@@ -1425,6 +1425,8 @@
self.path = os.path.join(tmpdir, partition)
b.Compute(self.path)
self._required_cache = b.max_stashed_size
+ self.touched_src_ranges = b.touched_src_ranges
+ self.touched_src_sha1 = b.touched_src_sha1
if src is None:
_, self.device = GetTypeAndDevice("/" + partition, OPTIONS.info_dict)
@@ -1446,7 +1448,8 @@
if progress:
script.ShowProgress(progress, 0)
self._WriteUpdate(script, output_zip)
- self._WritePostInstallVerifyScript(script)
+ if OPTIONS.verify:
+ self._WritePostInstallVerifyScript(script)
def WriteStrictVerifyScript(self, script):
"""Verify all the blocks in the care_map, including clobbered blocks.
@@ -1467,26 +1470,40 @@
self.device))
script.AppendExtra("")
- def WriteVerifyScript(self, script):
+ def WriteVerifyScript(self, script, touched_blocks_only=False):
partition = self.partition
+
+ # full OTA
if not self.src:
script.Print("Image %s will be patched unconditionally." % (partition,))
+
+ # incremental OTA
else:
- ranges = self.src.care_map.subtract(self.src.clobbered_blocks)
+ if touched_blocks_only and self.version >= 3:
+ ranges = self.touched_src_ranges
+ expected_sha1 = self.touched_src_sha1
+ else:
+ ranges = self.src.care_map.subtract(self.src.clobbered_blocks)
+ expected_sha1 = self.src.TotalSha1()
+
+ # No blocks to be checked, skipping.
+ if not ranges:
+ return
+
ranges_str = ranges.to_string_raw()
if self.version >= 4:
script.AppendExtra(('if (range_sha1("%s", "%s") == "%s" || '
'block_image_verify("%s", '
'package_extract_file("%s.transfer.list"), '
'"%s.new.dat", "%s.patch.dat")) then') % (
- self.device, ranges_str, self.src.TotalSha1(),
+ self.device, ranges_str, expected_sha1,
self.device, partition, partition, partition))
elif self.version == 3:
script.AppendExtra(('if (range_sha1("%s", "%s") == "%s" || '
'block_image_verify("%s", '
'package_extract_file("%s.transfer.list"), '
'"%s.new.dat", "%s.patch.dat")) then') % (
- self.device, ranges_str, self.src.TotalSha1(),
+ self.device, ranges_str, expected_sha1,
self.device, partition, partition, partition))
else:
script.AppendExtra('if range_sha1("%s", "%s") == "%s" then' % (
@@ -1570,7 +1587,8 @@
call = ('block_image_update("{device}", '
'package_extract_file("{partition}.transfer.list"), '
- '"{partition}.new.dat", "{partition}.patch.dat");\n'.format(
+ '"{partition}.new.dat", "{partition}.patch.dat") ||\n'
+ ' abort("Failed to update {partition} image.");'.format(
device=self.device, partition=self.partition))
script.AppendExtra(script.WordWrap(call))
diff --git a/tools/releasetools/ota_from_target_files.py b/tools/releasetools/ota_from_target_files.py
index 1f37eb4..582412a 100755
--- a/tools/releasetools/ota_from_target_files.py
+++ b/tools/releasetools/ota_from_target_files.py
@@ -1003,9 +1003,9 @@
""" % bcb_dev)
# Verify the existing partitions.
- system_diff.WriteVerifyScript(script)
+ system_diff.WriteVerifyScript(script, touched_blocks_only=True)
if vendor_diff:
- vendor_diff.WriteVerifyScript(script)
+ vendor_diff.WriteVerifyScript(script, touched_blocks_only=True)
script.Comment("---- start making changes here ----")
diff --git a/tools/releasetools/rangelib.py b/tools/releasetools/rangelib.py
index 31ed83a..1638f8c 100644
--- a/tools/releasetools/rangelib.py
+++ b/tools/releasetools/rangelib.py
@@ -104,7 +104,7 @@
if last <= s:
last = s+1
else:
- monotonic = True
+ monotonic = False
data.sort()
self.data = tuple(self._remove_pairs(data))
self.monotonic = monotonic
diff --git a/tools/releasetools/sign_target_files_apks.py b/tools/releasetools/sign_target_files_apks.py
index 8941e35..f758ae0 100755
--- a/tools/releasetools/sign_target_files_apks.py
+++ b/tools/releasetools/sign_target_files_apks.py
@@ -421,8 +421,8 @@
temp_file = cStringIO.StringIO()
certs_zip = zipfile.ZipFile(temp_file, "w")
for k in mapped_keys:
- certs_zip.write(k)
- certs_zip.close()
+ common.ZipWrite(certs_zip, k)
+ common.ZipClose(certs_zip)
common.ZipWriteStr(output_tf_zip, "SYSTEM/etc/security/otacerts.zip",
temp_file.getvalue())
diff --git a/tools/releasetools/test_rangelib.py b/tools/releasetools/test_rangelib.py
index 853012e..1c57cbc 100644
--- a/tools/releasetools/test_rangelib.py
+++ b/tools/releasetools/test_rangelib.py
@@ -117,6 +117,7 @@
self.assertTrue(RangeSet("").monotonic)
self.assertTrue(RangeSet("0-4 5-9").monotonic)
self.assertFalse(RangeSet("5-9 0-4").monotonic)
+ self.assertFalse(RangeSet("258768-259211 196604").monotonic)
self.assertTrue(RangeSet(data=[0, 10]).monotonic)
self.assertTrue(RangeSet(data=[0, 10, 15, 20]).monotonic)
diff --git a/tools/signapk/src/com/android/signapk/ApkSignerV2.java b/tools/signapk/src/com/android/signapk/ApkSignerV2.java
index 46cd11e..7b617db 100644
--- a/tools/signapk/src/com/android/signapk/ApkSignerV2.java
+++ b/tools/signapk/src/com/android/signapk/ApkSignerV2.java
@@ -75,7 +75,6 @@
public static final int SIGNATURE_ECDSA_WITH_SHA256 = 0x0201;
public static final int SIGNATURE_ECDSA_WITH_SHA512 = 0x0202;
public static final int SIGNATURE_DSA_WITH_SHA256 = 0x0301;
- public static final int SIGNATURE_DSA_WITH_SHA512 = 0x0302;
/**
* {@code .SF} file header section attribute indicating that the APK is signed not just with
@@ -660,8 +659,6 @@
return Pair.create("SHA512withECDSA", null);
case SIGNATURE_DSA_WITH_SHA256:
return Pair.create("SHA256withDSA", null);
- case SIGNATURE_DSA_WITH_SHA512:
- return Pair.create("SHA512withDSA", null);
default:
throw new IllegalArgumentException(
"Unknown signature algorithm: 0x"
@@ -679,7 +676,6 @@
case SIGNATURE_RSA_PSS_WITH_SHA512:
case SIGNATURE_RSA_PKCS1_V1_5_WITH_SHA512:
case SIGNATURE_ECDSA_WITH_SHA512:
- case SIGNATURE_DSA_WITH_SHA512:
return CONTENT_DIGEST_CHUNKED_SHA512;
default:
throw new IllegalArgumentException(
diff --git a/tools/signapk/src/com/android/signapk/SignApk.java b/tools/signapk/src/com/android/signapk/SignApk.java
index ba84b42..d763be5 100644
--- a/tools/signapk/src/com/android/signapk/SignApk.java
+++ b/tools/signapk/src/com/android/signapk/SignApk.java
@@ -992,7 +992,7 @@
} else if ("EC".equalsIgnoreCase(keyAlgorithm)) {
return ApkSignerV2.SIGNATURE_ECDSA_WITH_SHA512;
} else if ("DSA".equalsIgnoreCase(keyAlgorithm)) {
- return ApkSignerV2.SIGNATURE_DSA_WITH_SHA512;
+ throw new IllegalArgumentException("SHA-512 is not supported with DSA");
} else {
throw new IllegalArgumentException("Unsupported key algorithm: " + keyAlgorithm);
}
diff --git a/tools/warn.py b/tools/warn.py
index bb3b08d..14b3f48 100755
--- a/tools/warn.py
+++ b/tools/warn.py
@@ -16,7 +16,8 @@
HIGH=2
MEDIUM=3
LOW=4
- HARMLESS=5
+ TIDY=5
+ HARMLESS=6
def colorforseverity(sev):
if sev == severity.FIXMENOW:
@@ -27,6 +28,8 @@
return 'orange'
if sev == severity.LOW:
return 'yellow'
+ if sev == severity.TIDY:
+ return 'peachpuff'
if sev == severity.HARMLESS:
return 'limegreen'
if sev == severity.UNKNOWN:
@@ -44,6 +47,8 @@
return 'Low severity warnings'
if sev == severity.HARMLESS:
return 'Harmless warnings'
+ if sev == severity.TIDY:
+ return 'Clang-Tidy warnings'
if sev == severity.UNKNOWN:
return 'Unknown warnings'
return 'Unhandled warnings'
@@ -106,10 +111,15 @@
'description':'Unused function, variable or label',
'patterns':[r".*: warning: '.+' defined but not used",
r".*: warning: unused function '.+'",
+ r".*: warning: private field '.+' is not used",
r".*: warning: unused variable '.+'"] },
{ 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'-Wunused-value',
- 'description':'Statement with no effect',
- 'patterns':[r".*: warning: statement with no effect"] },
+ 'description':'Statement with no effect or result unused',
+ 'patterns':[r".*: warning: statement with no effect",
+ r".*: warning: expression result unused"] },
+ { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'-Wunused-result',
+ 'description':'Ignoreing return value of function',
+ 'patterns':[r".*: warning: ignoring return value of function .+Wunused-result"] },
{ 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'-Wmissing-field-initializers',
'description':'Missing initializer',
'patterns':[r".*: warning: missing initializer"] },
@@ -405,6 +415,9 @@
{ 'category':'C/C++', 'severity':severity.LOW, 'members':[], 'option':'-Wdeprecated-declarations',
'description':'Deprecated declarations',
'patterns':[r".*: warning: .+ is deprecated.+deprecated-declarations"] },
+ { 'category':'C/C++', 'severity':severity.LOW, 'members':[], 'option':'-Wdeprecated-register',
+ 'description':'Deprecated register',
+ 'patterns':[r".*: warning: 'register' storage class specifier is deprecated"] },
{ 'category':'C/C++', 'severity':severity.LOW, 'members':[], 'option':'-Wpointer-sign',
'description':'Converts between pointers to integer types with different sign',
'patterns':[r".*: warning: .+ converts between pointers to integer types with different sign"] },
@@ -465,9 +478,12 @@
{ 'category':'C/C++', 'severity':severity.LOW, 'members':[], 'option':'',
'description':'Useless specifier',
'patterns':[r".*: warning: useless storage class specifier in empty declaration"] },
+ { 'category':'C/C++', 'severity':severity.LOW, 'members':[], 'option':'-Wduplicate-decl-specifier',
+ 'description':'Duplicate declaration specifier',
+ 'patterns':[r".*: warning: duplicate '.+' declaration specifier"] },
{ 'category':'logtags', 'severity':severity.LOW, 'members':[], 'option':'',
'description':'Duplicate logtag',
- 'patterns':[r".*: warning: tag "".+"" \(None\) duplicated in .+"] },
+ 'patterns':[r".*: warning: tag \".+\" \(.+\) duplicated in .+"] },
{ 'category':'logtags', 'severity':severity.LOW, 'members':[], 'option':'typedef-redefinition',
'description':'Typedef redefinition',
'patterns':[r".*: warning: redefinition of typedef '.+' is a C11 feature"] },
@@ -521,6 +537,9 @@
{ 'category':'C/C++', 'severity':severity.LOW, 'members':[], 'option':'',
'description':'Refers to implicitly defined namespace',
'patterns':[r".*: warning: using directive refers to implicitly-defined namespace .+"] },
+ { 'category':'C/C++', 'severity':severity.LOW, 'members':[], 'option':'-Winvalid-pp-token',
+ 'description':'Invalid pp token',
+ 'patterns':[r".*: warning: missing .+Winvalid-pp-token"] },
{ 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'',
'description':'Operator new returns NULL',
@@ -610,6 +629,48 @@
'description':'',
'patterns':[r".*: warning: In file included from .+,"] },
+ # warnings from clang-tidy
+ { 'category':'C/C++', 'severity':severity.TIDY, 'members':[], 'option':'',
+ 'description':'clang-tidy readability',
+ 'patterns':[r".*: .+\[readability-.+\]$"] },
+ { 'category':'C/C++', 'severity':severity.TIDY, 'members':[], 'option':'',
+ 'description':'clang-tidy c++ core guidelines',
+ 'patterns':[r".*: .+\[cppcoreguidelines-.+\]$"] },
+ { 'category':'C/C++', 'severity':severity.TIDY, 'members':[], 'option':'',
+ 'description':'clang-tidy google-runtime',
+ 'patterns':[r".*: .+\[google-runtime-.+\]$"] },
+ { 'category':'C/C++', 'severity':severity.TIDY, 'members':[], 'option':'',
+ 'description':'clang-tidy google-build',
+ 'patterns':[r".*: .+\[google-build-.+\]$"] },
+ { 'category':'C/C++', 'severity':severity.TIDY, 'members':[], 'option':'',
+ 'description':'clang-tidy google-explicit',
+ 'patterns':[r".*: .+\[google-explicit-.+\]$"] },
+ { 'category':'C/C++', 'severity':severity.TIDY, 'members':[], 'option':'',
+ 'description':'clang-tidy google-readability',
+ 'patterns':[r".*: .+\[google-readability-.+\]$"] },
+ { 'category':'C/C++', 'severity':severity.TIDY, 'members':[], 'option':'',
+ 'description':'clang-tidy google-global',
+ 'patterns':[r".*: .+\[google-global-.+\]$"] },
+ { 'category':'C/C++', 'severity':severity.TIDY, 'members':[], 'option':'',
+ 'description':'clang-tidy modernize',
+ 'patterns':[r".*: .+\[modernize-.+\]$"] },
+ { 'category':'C/C++', 'severity':severity.TIDY, 'members':[], 'option':'',
+ 'description':'clang-tidy misc',
+ 'patterns':[r".*: .+\[misc-.+\]$"] },
+ { 'category':'C/C++', 'severity':severity.TIDY, 'members':[], 'option':'',
+ 'description':'clang-tidy CERT',
+ 'patterns':[r".*: .+\[cert-.+\]$"] },
+ { 'category':'C/C++', 'severity':severity.TIDY, 'members':[], 'option':'',
+ 'description':'clang-tidy llvm',
+ 'patterns':[r".*: .+\[llvm-.+\]$"] },
+ { 'category':'C/C++', 'severity':severity.TIDY, 'members':[], 'option':'',
+ 'description':'clang-tidy clang-diagnostic',
+ 'patterns':[r".*: .+\[clang-diagnostic-.+\]$"] },
+ { 'category':'C/C++', 'severity':severity.TIDY, 'members':[], 'option':'',
+ 'description':'clang-tidy clang-analyzer',
+ 'patterns':[r".*: .+\[clang-analyzer-.+\]$",
+ r".*: Call Path : .+$"] },
+
# catch-all for warnings this script doesn't know about yet
{ 'category':'C/C++', 'severity':severity.UNKNOWN, 'members':[], 'option':'',
'description':'Unclassified/unrecognized warnings',
@@ -628,6 +689,7 @@
def dumphtmlprologue(title):
output('<html>\n<head>\n<title>' + title + '</title>\n<body>\n')
+ output('<a name="PageTop">')
output(htmlbig(title))
output('<p>\n')
@@ -650,7 +712,7 @@
output(i + '<br>')
output('</td>')
output('<td width="100" bgcolor="grey">' +
- '<a align="right" href="#WarningTOC">top</a><br>' +
+ '<a align="right" href="#PageTop">top</a><br>' +
'<a align="right" href="#anchor' + str(anchor-1) + '">previous</a><br>' +
'<a align="right" href="#anchor' + str(anchor+1) + '">next</a>')
output('</td></a></tr>')
@@ -696,7 +758,7 @@
# dump table of content, list of all warning patterns
def dumptoc():
n = 1
- output('<a name="WarningTOC"><blockquote>\n')
+ output('<blockquote>\n')
for i in warnpatterns:
i['anchor'] = 'Warning' + str(n)
n += 1
@@ -704,6 +766,7 @@
dumpcount(severity.HIGH)
dumpcount(severity.MEDIUM)
dumpcount(severity.LOW)
+ dumpcount(severity.TIDY)
dumpcount(severity.HARMLESS)
dumpcount(severity.UNKNOWN)
output('</blockquote>\n<p>\n')
@@ -816,6 +879,7 @@
dumpseverity(severity.HIGH)
dumpseverity(severity.MEDIUM)
dumpseverity(severity.LOW)
+dumpseverity(severity.TIDY)
dumpseverity(severity.HARMLESS)
dumpseverity(severity.UNKNOWN)
dumpfixed()