Merge "releasetools: compare size between compressed and patch while build otapackage"
diff --git a/core/Makefile b/core/Makefile
index a1d483b..dc760b5 100644
--- a/core/Makefile
+++ b/core/Makefile
@@ -1139,7 +1139,8 @@
@echo Installed file list: $@
@mkdir -p $(dir $@)
@rm -f $@
- $(hide) build/tools/fileslist.py $(TARGET_OUT) > $@
+ $(hide) build/tools/fileslist.py $(TARGET_OUT) > $(@:.txt=.json)
+ $(hide) build/tools/fileslist_util.py -c $(@:.txt=.json) > $@
.PHONY: installed-file-list
installed-file-list: $(INSTALLED_FILES_FILE)
@@ -1575,7 +1576,8 @@
@echo Installed file list: $@
@mkdir -p $(dir $@)
@rm -f $@
- $(hide) build/tools/fileslist.py $(TARGET_OUT_VENDOR) > $@
+ $(hide) build/tools/fileslist.py $(TARGET_OUT_VENDOR) > $(@:.txt=.json)
+ $(hide) build/tools/fileslist_util.py -c $(@:.txt=.json) > $@
vendorimage_intermediates := \
$(call intermediates-dir-for,PACKAGING,vendor)
@@ -2027,6 +2029,15 @@
$(call dist-for-goals, target-files-package, $(BUILT_TARGET_FILES_PACKAGE))
endif
+# -----------------------------------------------------------------
+# NDK Sysroot Package
+NDK_SYSROOT_TARGET := $(PRODUCT_OUT)/ndk_sysroot.tar.bz2
+$(NDK_SYSROOT_TARGET): ndk
+ @echo Package NDK sysroot...
+ $(hide) tar cjf $@ -C $(SOONG_OUT_DIR) ndk
+
+$(call dist-for-goals,sdk,$(NDK_SYSROOT_TARGET))
+
ifeq ($(build_ota_package),true)
# -----------------------------------------------------------------
# OTA update package
diff --git a/core/binary.mk b/core/binary.mk
index c682d4e..28ac56f 100644
--- a/core/binary.mk
+++ b/core/binary.mk
@@ -58,16 +58,17 @@
my_export_c_include_dirs := $(LOCAL_EXPORT_C_INCLUDE_DIRS)
my_export_c_include_deps := $(LOCAL_EXPORT_C_INCLUDE_DEPS)
-ifneq (,$(foreach dir,$(COVERAGE_PATHS),$(filter $(dir)%,$(LOCAL_PATH))))
+ifneq (,$(strip $(foreach dir,$(subst $(comma),$(space),$(COVERAGE_PATHS)),$(filter $(dir)%,$(LOCAL_PATH)))))
my_native_coverage := true
else
my_native_coverage := false
endif
+my_allow_undefined_symbols := $(strip $(LOCAL_ALLOW_UNDEFINED_SYMBOLS))
+ifdef SANITIZE_HOST
ifdef LOCAL_IS_HOST_MODULE
my_allow_undefined_symbols := true
-else
-my_allow_undefined_symbols := $(strip $(LOCAL_ALLOW_UNDEFINED_SYMBOLS))
+endif
endif
my_ndk_sysroot :=
@@ -159,7 +160,7 @@
my_ndk_stl_include_path :=
my_ndk_stl_shared_lib_fullpath :=
my_ndk_stl_static_lib :=
- my_ndk_stl_cppflags :=
+ my_ndk_cpp_std_version :=
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
@@ -235,7 +236,7 @@
my_ldlibs += -ldl
- my_ndk_stl_cppflags := -std=c++11
+ my_ndk_cpp_std_version := c++11
else # LOCAL_NDK_STL_VARIANT is not c++_* either
ifneq (,$(filter gnustl_%, $(LOCAL_NDK_STL_VARIANT)))
my_ndk_stl_include_path := $(my_ndk_source_root)/cxx-stl/gnu-libstdc++/$($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_NDK_GCC_VERSION)/libs/$(my_cpu_variant)/include \
@@ -323,6 +324,10 @@
endif
my_src_files := $(filter-out $(my_src_files_exclude),$(my_src_files))
+# Strip '/' from the beginning of each src file. This helps the ../ detection in case
+# the source file is in the form of /../file
+my_src_files := $(patsubst /%,%,$(my_src_files))
+
my_clang := $(strip $(LOCAL_CLANG))
ifdef LOCAL_CLANG_$(my_32_64_bit_suffix)
my_clang := $(strip $(LOCAL_CLANG_$(my_32_64_bit_suffix)))
@@ -367,30 +372,38 @@
my_clang := true
endif
-my_cpp_std_version := -std=gnu++14
+my_c_std_version := $(DEFAULT_C_STD_VERSION)
+my_cpp_std_version := $(DEFAULT_CPP_STD_VERSION)
ifneq ($(my_clang),true)
# GCC uses an invalid C++14 ABI (emits calls to
# __cxa_throw_bad_array_length, which is not a valid C++ RT ABI).
# http://b/25022512
- my_cpp_std_version := -std=gnu++11
+ my_cpp_std_version := $(DEFAULT_GCC_CPP_STD_VERSION)
endif
ifdef LOCAL_SDK_VERSION
# The NDK handles this itself.
- my_cpp_std_version :=
+ my_cpp_std_version := $(my_ndk_cpp_std_version)
endif
ifdef LOCAL_IS_HOST_MODULE
ifneq ($(my_clang),true)
# The host GCC doesn't support C++14 (and is deprecated, so likely
# never will). Build these modules with C++11.
- my_cpp_std_version := -std=gnu++11
+ my_cpp_std_version := $(DEFAULT_GCC_CPP_STD_VERSION)
endif
endif
-my_cppflags := $(my_cpp_std_version) $(my_cppflags)
+my_c_std_conlyflags :=
+my_cpp_std_cppflags :=
+ifneq (,$(my_c_std_version))
+ my_c_std_conlyflags := -std=$(my_c_std_version)
+endif
+ifneq (,$(my_cpp_std_version))
+ my_cpp_std_cppflags := -std=$(my_cpp_std_version)
+endif
# arch-specific static libraries go first so that generic ones can depend on them
my_static_libraries := $(LOCAL_STATIC_LIBRARIES_$($(my_prefix)$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH)) $(LOCAL_STATIC_LIBRARIES_$(my_32_64_bit_suffix)) $(my_static_libraries)
@@ -467,7 +480,6 @@
ifdef LOCAL_SDK_VERSION
my_target_global_c_includes :=
my_target_global_c_system_includes := $(my_ndk_stl_include_path) $(my_ndk_sysroot_include)
-my_target_global_cppflags := $(my_ndk_stl_cppflags)
else
my_target_global_c_includes := $(SRC_HEADERS) \
$($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)PROJECT_INCLUDES) \
@@ -475,18 +487,17 @@
my_target_global_c_system_includes := $(SRC_SYSTEM_HEADERS) \
$($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)PROJECT_SYSTEM_INCLUDES) \
$($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)C_SYSTEM_INCLUDES)
-my_target_global_cppflags :=
endif # LOCAL_SDK_VERSION
ifeq ($(my_clang),true)
my_target_global_cflags := $($(LOCAL_2ND_ARCH_VAR_PREFIX)CLANG_$(my_prefix)GLOBAL_CFLAGS)
-my_target_global_conlyflags := $($(LOCAL_2ND_ARCH_VAR_PREFIX)CLANG_$(my_prefix)GLOBAL_CONLYFLAGS)
-my_target_global_cppflags += $($(LOCAL_2ND_ARCH_VAR_PREFIX)CLANG_$(my_prefix)GLOBAL_CPPFLAGS)
+my_target_global_conlyflags := $($(LOCAL_2ND_ARCH_VAR_PREFIX)CLANG_$(my_prefix)GLOBAL_CONLYFLAGS) $(my_c_std_conlyflags)
+my_target_global_cppflags := $($(LOCAL_2ND_ARCH_VAR_PREFIX)CLANG_$(my_prefix)GLOBAL_CPPFLAGS) $(my_cpp_std_cppflags)
my_target_global_ldflags := $($(LOCAL_2ND_ARCH_VAR_PREFIX)CLANG_$(my_prefix)GLOBAL_LDFLAGS)
else
my_target_global_cflags := $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)GLOBAL_CFLAGS)
-my_target_global_conlyflags := $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)GLOBAL_CONLYFLAGS)
-my_target_global_cppflags += $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)GLOBAL_CPPFLAGS)
+my_target_global_conlyflags := $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)GLOBAL_CONLYFLAGS) $(my_c_std_conlyflags)
+my_target_global_cppflags := $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)GLOBAL_CPPFLAGS) $(my_cpp_std_cppflags)
my_target_global_ldflags := $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)GLOBAL_LDFLAGS)
endif # my_clang
@@ -508,13 +519,13 @@
ifeq ($(my_clang),true)
my_host_global_cflags := $($(LOCAL_2ND_ARCH_VAR_PREFIX)CLANG_$(my_prefix)GLOBAL_CFLAGS)
-my_host_global_conlyflags := $($(LOCAL_2ND_ARCH_VAR_PREFIX)CLANG_$(my_prefix)GLOBAL_CONLYFLAGS)
-my_host_global_cppflags := $($(LOCAL_2ND_ARCH_VAR_PREFIX)CLANG_$(my_prefix)GLOBAL_CPPFLAGS)
+my_host_global_conlyflags := $($(LOCAL_2ND_ARCH_VAR_PREFIX)CLANG_$(my_prefix)GLOBAL_CONLYFLAGS) $(my_c_std_conlyflags)
+my_host_global_cppflags := $($(LOCAL_2ND_ARCH_VAR_PREFIX)CLANG_$(my_prefix)GLOBAL_CPPFLAGS) $(my_cpp_std_cppflags)
my_host_global_ldflags := $($(LOCAL_2ND_ARCH_VAR_PREFIX)CLANG_$(my_prefix)GLOBAL_LDFLAGS)
else
my_host_global_cflags := $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)GLOBAL_CFLAGS)
-my_host_global_conlyflags := $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)GLOBAL_CONLYFLAGS)
-my_host_global_cppflags := $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)GLOBAL_CPPFLAGS)
+my_host_global_conlyflags := $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)GLOBAL_CONLYFLAGS) $(my_c_std_conlyflags)
+my_host_global_cppflags := $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)GLOBAL_CPPFLAGS) $(my_cpp_std_cppflags)
my_host_global_ldflags := $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)GLOBAL_LDFLAGS)
endif # my_clang
@@ -619,9 +630,18 @@
# Certain modules like libdl have to have symbols resolved at runtime and blow
# up if --no-undefined is passed to the linker.
ifeq ($(strip $(LOCAL_NO_DEFAULT_COMPILER_FLAGS)),)
-ifeq ($(my_allow_undefined_symbols),)
- my_ldflags += -Wl,--no-undefined
-endif
+ ifeq ($(my_allow_undefined_symbols),)
+ ifneq ($(HOST_OS),darwin)
+ my_ldflags += -Wl,--no-undefined
+ endif
+ else
+ ifdef LOCAL_IS_HOST_MODULE
+ ifeq ($(HOST_OS),darwin)
+ # darwin defaults to treating undefined symbols as errors
+ my_ldflags += -Wl,-undefined,dynamic_lookup
+ endif
+ endif
+ endif
endif
ifeq (true,$(LOCAL_GROUP_STATIC_LIBRARIES))
diff --git a/core/clang/TARGET_arm.mk b/core/clang/TARGET_arm.mk
index 30313f9..9c1a836 100644
--- a/core/clang/TARGET_arm.mk
+++ b/core/clang/TARGET_arm.mk
@@ -1,4 +1,4 @@
-$(clang_2nd_arch_prefix)RS_TRIPLE := armv7-linux-androideabi
+$(clang_2nd_arch_prefix)RS_TRIPLE := renderscript32-linux-androideabi
$(clang_2nd_arch_prefix)RS_TRIPLE_CFLAGS :=
$(clang_2nd_arch_prefix)RS_COMPAT_TRIPLE := armv7-none-linux-gnueabi
diff --git a/core/clang/TARGET_arm64.mk b/core/clang/TARGET_arm64.mk
index d504600..9a67b6b 100644
--- a/core/clang/TARGET_arm64.mk
+++ b/core/clang/TARGET_arm64.mk
@@ -1,4 +1,4 @@
-RS_TRIPLE := aarch64-linux-android
+RS_TRIPLE := renderscript64-linux-android
RS_TRIPLE_CFLAGS :=
RS_COMPAT_TRIPLE := aarch64-linux-android
diff --git a/core/clang/TARGET_mips.mk b/core/clang/TARGET_mips.mk
index df96c5a..dfd99b2 100644
--- a/core/clang/TARGET_mips.mk
+++ b/core/clang/TARGET_mips.mk
@@ -1,4 +1,4 @@
-$(clang_2nd_arch_prefix)RS_TRIPLE := armv7-linux-androideabi
+$(clang_2nd_arch_prefix)RS_TRIPLE := renderscript32-linux-androideabi
$(clang_2nd_arch_prefix)RS_TRIPLE_CFLAGS :=
RS_COMPAT_TRIPLE := mipsel-linux-android
diff --git a/core/clang/TARGET_mips64.mk b/core/clang/TARGET_mips64.mk
index 785752a..a3684cc 100644
--- a/core/clang/TARGET_mips64.mk
+++ b/core/clang/TARGET_mips64.mk
@@ -1,4 +1,4 @@
-RS_TRIPLE := aarch64-linux-android
+RS_TRIPLE := renderscript64-linux-android
RS_TRIPLE_CFLAGS :=
RS_COMPAT_TRIPLE := mips64el-linux-android
diff --git a/core/clang/TARGET_x86.mk b/core/clang/TARGET_x86.mk
index f00eb41..1b9c78c 100644
--- a/core/clang/TARGET_x86.mk
+++ b/core/clang/TARGET_x86.mk
@@ -1,4 +1,4 @@
-$(clang_2nd_arch_prefix)RS_TRIPLE := armv7-linux-androideabi
+$(clang_2nd_arch_prefix)RS_TRIPLE := renderscript32-linux-androideabi
$(clang_2nd_arch_prefix)RS_TRIPLE_CFLAGS := -D__i386__
$(clang_2nd_arch_prefix)RS_COMPAT_TRIPLE := i686-linux-android
diff --git a/core/clang/TARGET_x86_64.mk b/core/clang/TARGET_x86_64.mk
index 0d615f2..0d3ee3f 100644
--- a/core/clang/TARGET_x86_64.mk
+++ b/core/clang/TARGET_x86_64.mk
@@ -1,4 +1,4 @@
-RS_TRIPLE := aarch64-linux-android
+RS_TRIPLE := renderscript64-linux-android
RS_TRIPLE_CFLAGS := -D__x86_64__
RS_COMPAT_TRIPLE := x86_64-linux-android
diff --git a/core/clang/config.mk b/core/clang/config.mk
index c2a0bf4..60e0641 100644
--- a/core/clang/config.mk
+++ b/core/clang/config.mk
@@ -15,61 +15,13 @@
# RenderScript-specific tools
# These are tied to the version of LLVM directly in external/, so they might
# trail the host prebuilts being used for the rest of the build process.
-RS_LLVM_PREBUILTS_VERSION := clang-2812033
+RS_LLVM_PREBUILTS_VERSION := clang-3289846
RS_LLVM_PREBUILTS_BASE := prebuilts/clang/host
RS_LLVM_PREBUILTS_PATH := $(RS_LLVM_PREBUILTS_BASE)/$(BUILD_OS)-x86/$(RS_LLVM_PREBUILTS_VERSION)/bin
RS_CLANG := $(RS_LLVM_PREBUILTS_PATH)/clang$(BUILD_EXECUTABLE_SUFFIX)
RS_LLVM_AS := $(RS_LLVM_PREBUILTS_PATH)/llvm-as$(BUILD_EXECUTABLE_SUFFIX)
RS_LLVM_LINK := $(RS_LLVM_PREBUILTS_PATH)/llvm-link$(BUILD_EXECUTABLE_SUFFIX)
-CLANG_CONFIG_UNKNOWN_CFLAGS := \
- -finline-functions \
- -finline-limit=64 \
- -fno-canonical-system-headers \
- -Wno-clobbered \
- -fno-devirtualize \
- -fno-tree-sra \
- -fprefetch-loop-arrays \
- -funswitch-loops \
- -Werror=unused-but-set-parameter \
- -Werror=unused-but-set-variable \
- -Wmaybe-uninitialized \
- -Wno-error=clobbered \
- -Wno-error=maybe-uninitialized \
- -Wno-error=unused-but-set-parameter \
- -Wno-error=unused-but-set-variable \
- -Wno-free-nonheap-object \
- -Wno-literal-suffix \
- -Wno-maybe-uninitialized \
- -Wno-old-style-declaration \
- -Wno-psabi \
- -Wno-unused-but-set-parameter \
- -Wno-unused-but-set-variable \
- -Wno-unused-local-typedefs \
- -Wunused-but-set-parameter \
- -Wunused-but-set-variable \
- -fdiagnostics-color \
- -mthumb-interwork \
- -fgcse-after-reload \
- -frerun-cse-after-loop \
- -frename-registers \
- -fno-align-jumps \
- -fno-builtin-sin \
- -fno-caller-saves \
- -fno-early-inlining \
- -fno-move-loop-invariants \
- -fno-partial-inlining \
- -fno-strict-volatile-bitfields \
- -fno-tree-copy-prop \
- -fno-tree-loop-optimize \
- -msynci \
- -mno-synci \
- -mno-fused-madd \
- -finline-limit=300 \
- -fno-inline-functions-called-once \
- -mfpmath=sse \
- -mbionic
-
define convert-to-clang-flags
$(strip $(filter-out $(CLANG_CONFIG_UNKNOWN_CFLAGS),$(1)))
endef
@@ -129,11 +81,6 @@
include $(BUILD_SYSTEM)/clang/TARGET_$(TARGET_2ND_ARCH).mk
endif
-ADDRESS_SANITIZER_CONFIG_EXTRA_CFLAGS := -fno-omit-frame-pointer
-ADDRESS_SANITIZER_CONFIG_EXTRA_LDFLAGS := -Wl,-u,__asan_preinit
-
-ADDRESS_SANITIZER_CONFIG_EXTRA_STATIC_LIBRARIES := libasan
-
# This allows us to use the superset of functionality that compiler-rt
# provides to Clang (for supporting features like -ftrapv).
COMPILER_RT_CONFIG_EXTRA_STATIC_LIBRARIES := libcompiler_rt-extras
@@ -145,7 +92,6 @@
device/huawei/angler/ \
device/lge/bullhead/ \
external/gentoo/integration/ \
- external/valgrind/ \
hardware/qcom/ \
$(INTERNAL_LOCAL_CLANG_EXCEPTION_PROJECTS)
diff --git a/core/clang/tidy.mk b/core/clang/tidy.mk
index a081056..868f7bc 100644
--- a/core/clang/tidy.mk
+++ b/core/clang/tidy.mk
@@ -14,45 +14,6 @@
# limitations under the License.
#
-# Most Android source files are not clang-tidy clean yet.
-# Global tidy checks include only google*, performance*,
-# and misc-macro-parentheses, but not google-readability*
-# or google-runtime-references.
-DEFAULT_GLOBAL_TIDY_CHECKS ?= \
- $(subst $(space),, \
- -*,google* \
- ,misc-macro-parentheses \
- ,performance* \
- ,-google-readability* \
- ,-google-runtime-references \
- )
-
-# There are too many clang-tidy warnings in external and vendor projects.
-# Enable only some google checks for these projects.
-DEFAULT_EXTERNAL_VENDOR_TIDY_CHECKS ?= \
- $(subst $(space),, \
- -*,google* \
- ,-google-build-using-namespace \
- ,-google-default-arguments \
- ,-google-explicit-constructor \
- ,-google-readability* \
- ,-google-runtime-int \
- ,-google-runtime-references \
- )
-
-# Every word in DEFAULT_LOCAL_TIDY_CHECKS list has the following format:
-# <local_path_prefix>:,<tidy-checks>
-# The last matched local_path_prefix should be the most specific to be used.
-DEFAULT_LOCAL_TIDY_CHECKS := \
- external/:$(DEFAULT_EXTERNAL_VENDOR_TIDY_CHECKS) \
- external/google:$(DEFAULT_GLOBAL_TIDY_CHECKS) \
- external/webrtc:$(DEFAULT_GLOBAL_TIDY_CHECKS) \
- frameworks/compile/mclinker/:$(DEFAULT_EXTERNAL_VENDOR_TIDY_CHECKS) \
- hardware/qcom:$(DEFAULT_EXTERNAL_VENDOR_TIDY_CHECKS) \
- vendor/:$(DEFAULT_EXTERNAL_VENDOR_TIDY_CHECKS) \
- vendor/google:$(DEFAULT_GLOBAL_TIDY_CHECKS) \
- vendor/google_devices:$(DEFAULT_EXTERNAL_VENDOR_TIDY_CHECKS) \
-
# Returns 2nd word of $(1) if $(2) has prefix of the 1st word of $(1).
define find_default_local_tidy_check2
$(if $(filter $(word 1,$(1))%,$(2)/),$(word 2,$(1)))
@@ -75,25 +36,6 @@
)
endef
-# Give warnings to header files only in selected directories.
-# Do not give warnings to external or vendor header files,
-# which contain too many warnings.
-DEFAULT_TIDY_HEADER_DIRS := \
- $(subst $(space),, \
- art/ \
- |bionic/ \
- |bootable/ \
- |build/ \
- |cts/ \
- |dalvik/ \
- |developers/ \
- |development/ \
- |frameworks/ \
- |libcore/ \
- |libnativehelper/ \
- |system/ \
- )
-
# Default filter contains current directory $1 and DEFAULT_TIDY_HEADER_DIRS.
define default_tidy_header_filter
-header-filter="($(subst $(space),,$1|$(DEFAULT_TIDY_HEADER_DIRS)))"
diff --git a/core/config.mk b/core/config.mk
index c35bfda..93a2d34 100644
--- a/core/config.mk
+++ b/core/config.mk
@@ -643,19 +643,6 @@
# Set up final options.
# ###############################################################
-GLOBAL_CFLAGS_NO_OVERRIDE := \
- -Werror=int-to-pointer-cast \
- -Werror=pointer-to-int-cast \
-
-GLOBAL_CLANG_CFLAGS_NO_OVERRIDE := \
- -Werror=address-of-temporary \
- -Werror=return-type \
- # Bug: http://b/29823425 Disable -Wnull-dereference until the new cases
- # detected by this warning in Clang r271374 are fixed.
- #-Werror=null-dereference \
-
-GLOBAL_CPPFLAGS_NO_OVERRIDE :=
-
# We run gcc/clang with PWD=/proc/self/cwd to remove the $TOP
# from the debug output. That way two builds in two different
# directories will create the same output.
@@ -780,8 +767,6 @@
RSCOMPAT_32BIT_ONLY_API_LEVELS := 8 9 10 11 12 13 14 15 16 17 18 19 20
RSCOMPAT_NO_USAGEIO_API_LEVELS := 8 9 10 11 12 13
-NDK_PREBUILT_SHARED_LIBRARIES := android c dl EGL GLESv1_CM GLESv2 GLESv3 jnigraphics log mediandk m OpenMAXAL OpenSLES stdc++ vulkan z
-
ifeq ($(JAVA_NOT_REQUIRED),true)
# Remove java and tools from our path so that we make sure nobody uses them.
unexport ANDROID_JAVA_HOME
diff --git a/core/config_sanitizers.mk b/core/config_sanitizers.mk
index 2e14fef..3a59ee3 100644
--- a/core/config_sanitizers.mk
+++ b/core/config_sanitizers.mk
@@ -31,10 +31,12 @@
endif
endif
-# Add a filter point for 32-bit vs 64-bit sanitization (to lighten the burden).
-SANITIZE_ARCH ?= 32 64
-ifeq ($(filter $(SANITIZE_ARCH),$(my_32_64_bit_suffix)),)
- my_sanitize :=
+ifndef LOCAL_IS_HOST_MODULE
+ # Add a filter point for 32-bit vs 64-bit sanitization (to lighten the burden)
+ SANITIZE_TARGET_ARCH ?= $(TARGET_ARCH) $(TARGET_2ND_ARCH)
+ ifeq ($(filter $(SANITIZE_TARGET_ARCH),$(TARGET_$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH)),)
+ my_sanitize :=
+ endif
endif
# Add a filter point based on module owner (to lighten the burden). The format is a space- or
diff --git a/core/definitions.mk b/core/definitions.mk
index 61e0461..39c6604 100644
--- a/core/definitions.mk
+++ b/core/definitions.mk
@@ -1584,7 +1584,7 @@
filelist="$$filelist $$ldir/$$ext$$f"; \
done ; \
$($(PRIVATE_2ND_ARCH_VAR_PREFIX)TARGET_AR) $($(PRIVATE_2ND_ARCH_VAR_PREFIX)TARGET_GLOBAL_ARFLAGS) \
- $(PRIVATE_ARFLAGS) $@ $$filelist
+ $@ $$filelist
endef
@@ -1609,7 +1609,7 @@
$(extract-and-include-target-whole-static-libs)
$(call split-long-arguments,$($(PRIVATE_2ND_ARCH_VAR_PREFIX)TARGET_AR) \
$($(PRIVATE_2ND_ARCH_VAR_PREFIX)TARGET_GLOBAL_ARFLAGS) \
- $(PRIVATE_ARFLAGS) $@,$(PRIVATE_ALL_OBJECTS))
+ $@,$(PRIVATE_ALL_OBJECTS))
endef
# $(1): the full path of the source static library.
@@ -1633,8 +1633,7 @@
$(PRIVATE_AR) p $$lib_to_include $$f > $$ldir/$$ext$$f; \
filelist="$$filelist $$ldir/$$ext$$f"; \
done ; \
- $(PRIVATE_AR) $(AUX_GLOBAL_ARFLAGS) \
- $(PRIVATE_ARFLAGS) $@ $$filelist
+ $(PRIVATE_AR) $(AUX_GLOBAL_ARFLAGS) $@ $$filelist
endef
@@ -1652,8 +1651,7 @@
@rm -f $@
$(extract-and-include-aux-whole-static-libs)
$(call split-long-arguments,$(PRIVATE_AR) \
- $(AUX_GLOBAL_ARFLAGS) \
- $(PRIVATE_ARFLAGS) $@,$(PRIVATE_ALL_OBJECTS))
+ $(AUX_GLOBAL_ARFLAGS) $@,$(PRIVATE_ALL_OBJECTS))
endef
define transform-o-to-aux-executable-inner
@@ -1721,7 +1719,7 @@
filelist="$$filelist $$ldir/$$ext$$f"; \
done ; \
$($(PRIVATE_2ND_ARCH_VAR_PREFIX)$(PRIVATE_PREFIX)AR) $($(PRIVATE_2ND_ARCH_VAR_PREFIX)$(PRIVATE_PREFIX)GLOBAL_ARFLAGS) \
- $(PRIVATE_ARFLAGS) $@ $$filelist
+ $@ $$filelist
endef
@@ -1757,8 +1755,8 @@
$(extract-and-include-host-whole-static-libs)
$(create-dummy.o-if-no-objs)
$(call split-long-arguments,$($(PRIVATE_2ND_ARCH_VAR_PREFIX)$(PRIVATE_PREFIX)AR) \
- $($(PRIVATE_2ND_ARCH_VAR_PREFIX)$(PRIVATE_PREFIX)GLOBAL_ARFLAGS) \
- $(PRIVATE_ARFLAGS) $@,$(PRIVATE_ALL_OBJECTS) $(get-dummy.o-if-no-objs))
+ $($(PRIVATE_2ND_ARCH_VAR_PREFIX)$(PRIVATE_PREFIX)GLOBAL_ARFLAGS) $@,\
+ $(PRIVATE_ALL_OBJECTS) $(get-dummy.o-if-no-objs))
$(delete-dummy.o-if-no-objs)
endef
diff --git a/core/dex_preopt_libart.mk b/core/dex_preopt_libart.mk
index ab54b1d..7a0fb95 100644
--- a/core/dex_preopt_libart.mk
+++ b/core/dex_preopt_libart.mk
@@ -104,7 +104,8 @@
--instruction-set=$($(PRIVATE_2ND_ARCH_VAR_PREFIX)DEX2OAT_TARGET_ARCH) \
--instruction-set-variant=$($(PRIVATE_2ND_ARCH_VAR_PREFIX)DEX2OAT_TARGET_CPU_VARIANT) \
--instruction-set-features=$($(PRIVATE_2ND_ARCH_VAR_PREFIX)DEX2OAT_TARGET_INSTRUCTION_SET_FEATURES) \
- --include-patch-information --runtime-arg -Xnorelocate --no-generate-debug-info \
+ --include-patch-information --runtime-arg -Xnorelocate \
+ --no-generate-debug-info --generate-build-id \
--abort-on-hard-verifier-error \
--no-inline-from=core-oj.jar \
$(PRIVATE_DEX_PREOPT_FLAGS) \
diff --git a/core/dex_preopt_libart_boot.mk b/core/dex_preopt_libart_boot.mk
index c26b0fc..5d383a9 100644
--- a/core/dex_preopt_libart_boot.mk
+++ b/core/dex_preopt_libart_boot.mk
@@ -71,6 +71,7 @@
--instruction-set=$($(PRIVATE_2ND_ARCH_VAR_PREFIX)DEX2OAT_TARGET_ARCH) \
--instruction-set-variant=$($(PRIVATE_2ND_ARCH_VAR_PREFIX)DEX2OAT_TARGET_CPU_VARIANT) \
--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 \
+ --android-root=$(PRODUCT_OUT)/system --include-patch-information --runtime-arg -Xnorelocate \
+ --no-generate-debug-info --generate-build-id \
--multi-image --no-inline-from=core-oj.jar \
$(PRODUCT_DEX_PREOPT_BOOT_FLAGS) $(GLOBAL_DEXPREOPT_FLAGS) $(COMPILED_CLASSES_FLAGS) $(ART_BOOT_IMAGE_EXTRA_ARGS)
diff --git a/core/main.mk b/core/main.mk
index dabe093..48a39d0 100644
--- a/core/main.mk
+++ b/core/main.mk
@@ -903,7 +903,6 @@
.PHONY: checkbuild
checkbuild: $(modules_to_check) droid_targets
-checkbuild: checkbuild-soong
ifeq (true,$(ANDROID_BUILD_EVERYTHING_BY_DEFAULT))
droid: checkbuild
diff --git a/core/ninja.mk b/core/ninja.mk
index 30146d2..b865a79 100644
--- a/core/ninja.mk
+++ b/core/ninja.mk
@@ -140,10 +140,11 @@
COMBINED_BUILD_NINJA := $(OUT_DIR)/combined$(KATI_NINJA_SUFFIX).ninja
-$(COMBINED_BUILD_NINJA): $(KATI_BUILD_NINJA)
+$(COMBINED_BUILD_NINJA): $(KATI_BUILD_NINJA) FORCE
$(hide) echo "builddir = $(OUT_DIR)" > $(COMBINED_BUILD_NINJA)
$(hide) echo "include $(KATI_BUILD_NINJA)" >> $(COMBINED_BUILD_NINJA)
$(hide) echo "include $(SOONG_BUILD_NINJA)" >> $(COMBINED_BUILD_NINJA)
+ $(hide) echo "build $(COMBINED_BUILD_NINJA): phony $(SOONG_BUILD_NINJA)" >> $(COMBINED_BUILD_NINJA)
$(sort $(DEFAULT_GOAL) $(ANDROID_GOALS)) : ninja_wrapper
@#empty
diff --git a/core/prebuilt_internal.mk b/core/prebuilt_internal.mk
index af59756..35a01ee 100644
--- a/core/prebuilt_internal.mk
+++ b/core/prebuilt_internal.mk
@@ -16,9 +16,6 @@
$(error dont use LOCAL_PREBUILT_JAVA_LIBRARIES anymore LOCAL_PATH=$(LOCAL_PATH))
endif
-# Not much sense to check build prebuilts
-LOCAL_DONT_CHECK_MODULE := true
-
my_32_64_bit_suffix := $(if $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)IS_64_BIT),64,32)
ifdef LOCAL_PREBUILT_MODULE_FILE
@@ -38,6 +35,8 @@
endif
endif
+LOCAL_CHECKED_MODULE := $(my_prebuilt_src_file)
+
my_strip_module := $(firstword \
$(LOCAL_STRIP_MODULE_$($(my_prefix)$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH)) \
$(LOCAL_STRIP_MODULE))
@@ -172,15 +171,19 @@
# "my_strip_module not true" because otherwise the rules are defined in dynamic_binary.mk.
endif # my_strip_module not true
+ifeq ($(NATIVE_COVERAGE),true)
# Coverage information is needed when static lib is a dependency of another
# coverage-enabled module.
ifeq (STATIC_LIBRARIES, $(LOCAL_MODULE_CLASS))
GCNO_ARCHIVE := $(LOCAL_MODULE).gcnodir
$(intermediates)/$(GCNO_ARCHIVE) : PRIVATE_ALL_OBJECTS :=
$(intermediates)/$(GCNO_ARCHIVE) : PRIVATE_ALL_WHOLE_STATIC_LIBRARIES :=
+$(intermediates)/$(GCNO_ARCHIVE) : PRIVATE_PREFIX := $(my_prefix)
+$(intermediates)/$(GCNO_ARCHIVE) : PRIVATE_2ND_ARCH_VAR_PREFIX := $(LOCAL_2ND_ARCH_VAR_PREFIX)
$(intermediates)/$(GCNO_ARCHIVE) :
$(transform-o-to-static-lib)
endif
+endif
ifeq ($(LOCAL_MODULE_CLASS),APPS)
PACKAGES.$(LOCAL_MODULE).OVERRIDES := $(strip $(LOCAL_OVERRIDES_PACKAGES))
diff --git a/core/product.mk b/core/product.mk
index d4790d5..e2a5339 100644
--- a/core/product.mk
+++ b/core/product.mk
@@ -290,11 +290,6 @@
WITH_DEXPREOPT \
WITH_DEXPREOPT_BOOT_IMG_ONLY
-_product_stash_var_list += \
- GLOBAL_CFLAGS_NO_OVERRIDE \
- GLOBAL_CPPFLAGS_NO_OVERRIDE \
- GLOBAL_CLANG_CFLAGS_NO_OVERRIDE \
-
#
# Mark the variables in _product_stash_var_list as readonly
#
diff --git a/core/soong.mk b/core/soong.mk
index cd5eff4..73622a2 100644
--- a/core/soong.mk
+++ b/core/soong.mk
@@ -48,6 +48,7 @@
echo ' "Allow_missing_dependencies": $(if $(TARGET_BUILD_APPS)$(filter true,$(SOONG_ALLOW_MISSING_DEPENDENCIES)),true,false),'; \
echo ' "SanitizeHost": [$(if $(SANITIZE_HOST),"$(subst $(space),"$(comma)",$(SANITIZE_HOST))")],'; \
echo ' "SanitizeDevice": [$(if $(SANITIZE_TARGET),"$(subst $(space),"$(comma)",$(SANITIZE_TARGET))")],'; \
+ echo ' "SanitizeDeviceArch": [$(if $(SANITIZE_TARGET_ARCH),"$(subst $(space),"$(comma)",$(SANITIZE_TARGET_ARCH))")],'; \
echo ' "HostStaticBinaries": $(if $(strip $(BUILD_HOST_static)),true,false),'; \
echo ' "Cpusets": $(if $(strip $(ENABLE_CPUSETS)),true,false),'; \
echo ' "Schedboost": $(if $(strip $(ENABLE_SCHEDBOOST)),true,false),'; \
@@ -56,6 +57,9 @@
echo ' "UseGoma": $(if $(filter-out false,$(USE_GOMA)),true,false),'; \
echo ' "Debuggable": $(if $(filter userdebug eng,$(TARGET_BUILD_VARIANT)),true,false),'; \
echo ''; \
+ echo ' "ClangTidy": $(if $(filter 1 true,$(WITH_TIDY)),true,false),'; \
+ echo ' "TidyChecks": "$(WITH_TIDY_CHECKS)",'; \
+ echo ''; \
echo ' "DeviceName": "$(TARGET_DEVICE)",'; \
echo ' "DeviceArch": "$(TARGET_ARCH)",'; \
echo ' "DeviceArchVariant": "$(TARGET_ARCH_VARIANT)",'; \
diff --git a/core/static_library_internal.mk b/core/static_library_internal.mk
index 6da6a75..6133ea2 100644
--- a/core/static_library_internal.mk
+++ b/core/static_library_internal.mk
@@ -24,6 +24,7 @@
$(LOCAL_BUILT_MODULE) : $(all_objects)
$(transform-o-to-static-lib)
+ifeq ($(NATIVE_COVERAGE),true)
gcno_suffix := .gcnodir
built_whole_gcno_libraries := \
@@ -36,5 +37,8 @@
$(intermediates)/$(GCNO_ARCHIVE) : PRIVATE_ALL_OBJECTS := $(strip $(LOCAL_GCNO_FILES))
$(intermediates)/$(GCNO_ARCHIVE) : PRIVATE_ALL_WHOLE_STATIC_LIBRARIES := $(strip $(built_whole_gcno_libraries))
+$(intermediates)/$(GCNO_ARCHIVE) : PRIVATE_PREFIX := $(my_prefix)
+$(intermediates)/$(GCNO_ARCHIVE) : PRIVATE_2ND_ARCH_VAR_PREFIX := $(LOCAL_2ND_ARCH_VAR_PREFIX)
$(intermediates)/$(GCNO_ARCHIVE) : $(LOCAL_GCNO_FILES) $(built_whole_gcno_libraries)
$(transform-o-to-static-lib)
+endif
diff --git a/envsetup.sh b/envsetup.sh
index e919891..710b28f 100644
--- a/envsetup.sh
+++ b/envsetup.sh
@@ -1234,7 +1234,7 @@
Darwin)
function mgrep()
{
- find -E . -name .repo -prune -o -name .git -prune -o -path ./out -prune -o -type f -iregex '.*/(Makefile|Makefile\..*|.*\.make|.*\.mak|.*\.mk)' \
+ find -E . -name .repo -prune -o -name .git -prune -o -path ./out -prune -o -type f -iregex '.*/(Makefile|Makefile\..*|.*\.make|.*\.mak|.*\.mk|.*\.bp)' \
-exec grep --color -n "$@" {} +
}
@@ -1248,7 +1248,7 @@
*)
function mgrep()
{
- find . -name .repo -prune -o -name .git -prune -o -path ./out -prune -o -regextype posix-egrep -iregex '(.*\/Makefile|.*\/Makefile\..*|.*\.make|.*\.mak|.*\.mk)' -type f \
+ find . -name .repo -prune -o -name .git -prune -o -path ./out -prune -o -regextype posix-egrep -iregex '(.*\/Makefile|.*\/Makefile\..*|.*\.make|.*\.mak|.*\.mk|.*\.bp)' -type f \
-exec grep --color -n "$@" {} +
}
diff --git a/target/board/generic/BoardConfig.mk b/target/board/generic/BoardConfig.mk
index 325b0ce..b471f9a 100644
--- a/target/board/generic/BoardConfig.mk
+++ b/target/board/generic/BoardConfig.mk
@@ -35,6 +35,7 @@
ifeq ($(HOST_OS),linux)
ifeq ($(WITH_DEXPREOPT),)
WITH_DEXPREOPT := true
+ WITH_DEXPREOPT_BOOT_IMG_ONLY := false
endif
endif
diff --git a/target/board/generic/sepolicy/goldfish_setup.te b/target/board/generic/sepolicy/goldfish_setup.te
index b8f121c..bc25967 100644
--- a/target/board/generic/sepolicy/goldfish_setup.te
+++ b/target/board/generic/sepolicy/goldfish_setup.te
@@ -12,6 +12,7 @@
allow goldfish_setup toolbox_exec:file rx_file_perms;
allow goldfish_setup self:capability { net_admin net_raw };
allow goldfish_setup self:udp_socket create_socket_perms;
+allowxperm goldfish_setup self:udp_socket ioctl priv_sock_ioctls;
net_domain(goldfish_setup)
diff --git a/target/board/generic_arm64/BoardConfig.mk b/target/board/generic_arm64/BoardConfig.mk
index 02d0a6f..34fffed 100644
--- a/target/board/generic_arm64/BoardConfig.mk
+++ b/target/board/generic_arm64/BoardConfig.mk
@@ -65,6 +65,7 @@
ifeq ($(HOST_OS),linux)
ifeq ($(WITH_DEXPREOPT),)
WITH_DEXPREOPT := true
+ WITH_DEXPREOPT_BOOT_IMG_ONLY := false
endif
endif
diff --git a/target/board/generic_mips/BoardConfig.mk b/target/board/generic_mips/BoardConfig.mk
index 1152105..b68d88b 100644
--- a/target/board/generic_mips/BoardConfig.mk
+++ b/target/board/generic_mips/BoardConfig.mk
@@ -42,6 +42,7 @@
ifeq ($(HOST_OS),linux)
ifeq ($(WITH_DEXPREOPT),)
WITH_DEXPREOPT := true
+ WITH_DEXPREOPT_BOOT_IMG_ONLY := false
endif
endif
diff --git a/target/board/generic_mips64/BoardConfig.mk b/target/board/generic_mips64/BoardConfig.mk
index ed9c9b3..44e6287 100644
--- a/target/board/generic_mips64/BoardConfig.mk
+++ b/target/board/generic_mips64/BoardConfig.mk
@@ -57,6 +57,7 @@
ifeq ($(HOST_OS),linux)
ifeq ($(WITH_DEXPREOPT),)
WITH_DEXPREOPT := true
+ WITH_DEXPREOPT_BOOT_IMG_ONLY := false
endif
endif
diff --git a/target/board/generic_x86/BoardConfig.mk b/target/board/generic_x86/BoardConfig.mk
index 50ecb98..f8ac496 100644
--- a/target/board/generic_x86/BoardConfig.mk
+++ b/target/board/generic_x86/BoardConfig.mk
@@ -22,6 +22,7 @@
# of an SDK AVD. Note that this operation only works on Linux for now
ifeq ($(HOST_OS),linux)
WITH_DEXPREOPT ?= true
+WITH_DEXPREOPT_BOOT_IMG_ONLY ?= false
endif
# Build OpenGLES emulation host and guest libraries
diff --git a/target/board/generic_x86_64/BoardConfig.mk b/target/board/generic_x86_64/BoardConfig.mk
index 6958ba5..bd831f8 100755
--- a/target/board/generic_x86_64/BoardConfig.mk
+++ b/target/board/generic_x86_64/BoardConfig.mk
@@ -28,6 +28,7 @@
# of an SDK AVD. Note that this operation only works on Linux for now
ifeq ($(HOST_OS),linux)
WITH_DEXPREOPT ?= true
+WITH_DEXPREOPT_BOOT_IMG_ONLY ?= false
endif
# Build OpenGLES emulation host and guest libraries
diff --git a/target/board/generic_x86_arm/BoardConfig.mk b/target/board/generic_x86_arm/BoardConfig.mk
index 6e2573e..75207fc 100644
--- a/target/board/generic_x86_arm/BoardConfig.mk
+++ b/target/board/generic_x86_arm/BoardConfig.mk
@@ -39,6 +39,7 @@
ifeq ($(HOST_OS),linux)
ifeq ($(WITH_DEXPREOPT),)
WITH_DEXPREOPT := true
+ WITH_DEXPREOPT_BOOT_IMG_ONLY := false
endif
endif
diff --git a/target/product/base.mk b/target/product/base.mk
index 4d70664..2eb20aa 100644
--- a/target/product/base.mk
+++ b/target/product/base.mk
@@ -129,6 +129,9 @@
vold \
wm
+# Packages included only for eng or userdebug builds, previously debug tagged
+PRODUCT_PACKAGES_DEBUG := \
+ perfprofd
PRODUCT_COPY_FILES := $(call add-to-product-copy-files-if-exists,\
frameworks/base/preloaded-classes:system/etc/preloaded-classes)
diff --git a/tools/fat16copy.py b/tools/fat16copy.py
index 1dd15b7..af8bd83 100755
--- a/tools/fat16copy.py
+++ b/tools/fat16copy.py
@@ -222,7 +222,8 @@
data.seek(0, os.SEEK_END)
size = data.tell()
- chunk = self.backing.fs.allocate(size or 1)
+ # Empty files shouldn't have any clusters assigned.
+ chunk = self.backing.fs.allocate(size) if size > 0 else 0
(shortname, ext) = self.make_short_name(name)
self.add_dentry(0, shortname, ext, name, chunk, size)
@@ -240,10 +241,19 @@
"""
chunk = self.backing.fs.allocate(1)
(shortname, ext) = self.make_short_name(name)
- new_dentry = dentry(self.backing.fs, ATTRIBUTE_SUBDIRECTORY,
- shortname, ext, name, chunk, 0)
- new_dentry.commit(self.backing)
- return new_dentry.open_directory()
+ new_dentry = self.add_dentry(ATTRIBUTE_SUBDIRECTORY, shortname,
+ ext, name, chunk, 0)
+ result = new_dentry.open_directory()
+
+ parent_cluster = 0
+
+ if hasattr(self.backing, 'start_cluster'):
+ parent_cluster = self.backing.start_cluster
+
+ result.add_dentry(ATTRIBUTE_SUBDIRECTORY, '.', '', '', chunk, 0)
+ result.add_dentry(ATTRIBUTE_SUBDIRECTORY, '..', '', '', parent_cluster, 0)
+
+ return result
def lfn_checksum(name_data):
"""
@@ -380,28 +390,23 @@
record_count = len(longname_record_data) + 1
found_count = 0
-
- while True:
+ while found_count < record_count:
record = f.read(32)
if record is None or len(record) != 32:
- break
+ # We reached the EOF, so we need to extend the file with a new cluster.
+ f.write("\0" * self.fs.bytes_per_cluster)
+ f.seek(-self.fs.bytes_per_cluster, os.SEEK_CUR)
+ record = f.read(32)
marker = struct.unpack("B", record[0])[0]
if marker == DEL_MARKER or marker == 0:
found_count += 1
-
- if found_count == record_count:
- break
else:
found_count = 0
- if found_count != record_count:
- f.write("\0" * self.fs.bytes_per_cluster)
- f.seek(-self.fs.bytes_per_cluster, os.SEEK_CUR)
- else:
- f.seek(-(record_count * 32), os.SEEK_CUR)
+ f.seek(-(record_count * 32), os.SEEK_CUR)
f.write(entry)
class root_dentry_file(fake_file):
@@ -624,6 +629,8 @@
Allocate a new cluster chain big enough to hold at least the given amount
of bytes.
"""
+ assert amount > 0, "Must allocate a non-zero amount."
+
f = self.f
f.seek(FAT_TABLE_START + 4)
@@ -686,38 +693,17 @@
Given a cluster which is the *last* cluster in a chain, extend it to hold
at least `amount` more bytes.
"""
- return_cluster = None
+ if amount == 0:
+ return
f = self.f
-
- position = FAT_TABLE_START + cluster * 2
- f.seek(position)
-
+ entry_offset = FAT_TABLE_START + cluster * 2
+ f.seek(entry_offset)
assert read_le_short(f) == 0xFFFF, "Extending from middle of chain"
- rewind_short(f)
- while position + 2 < FAT_TABLE_START + self.fat_size and amount > 0:
- skip_short(f)
- got = read_le_short(f)
- rewind_short(f)
- rewind_short(f)
-
- if got != 0:
- break
-
- cluster += 1
- return_cluster = return_cluster or cluster
- position += 2
- self.write_cluster_entry(cluster)
-
- if amount < 0:
- self.write_cluster_entry(0xFFFF)
- return return_cluster
-
- new_chunk = self.allocate(amount)
- f.seek(FAT_TABLE_START + cluster * 2)
- self.write_cluster_entry(new_chunk)
-
- return return_cluster or new_chunk
+ return_cluster = self.allocate(amount)
+ f.seek(entry_offset)
+ self.write_cluster_entry(return_cluster)
+ return return_cluster
def write_file(self, head_cluster, start_byte, data):
"""
@@ -728,35 +714,31 @@
data: The data to write.
"""
f = self.f
+ last_offset = start_byte + len(data)
+ current_offset = 0
+ current_cluster = head_cluster
- while True:
- if start_byte < self.bytes_per_cluster:
- to_write = data[:self.bytes_per_cluster - start_byte]
- data = data[self.bytes_per_cluster - start_byte:]
+ while current_offset < last_offset:
+ # Write everything that falls in the cluster starting at current_offset.
+ data_begin = max(0, current_offset - start_byte)
+ data_end = min(len(data),
+ current_offset + self.bytes_per_cluster - start_byte)
+ if data_end > data_begin:
+ cluster_file_offset = (self.data_start() + self.root_entries * 32 +
+ (current_cluster - 2) * self.bytes_per_cluster)
+ f.seek(cluster_file_offset + max(0, start_byte - current_offset))
+ f.write(data[data_begin:data_end])
- cluster_bytes_from_root = (head_cluster - 2) * \
- self.bytes_per_cluster
- bytes_from_root = cluster_bytes_from_root + start_byte
- bytes_from_data_start = bytes_from_root + self.root_entries * 32
+ # Advance to the next cluster in the chain or get a new cluster if needed.
+ current_offset += self.bytes_per_cluster
+ if last_offset > current_offset:
+ f.seek(FAT_TABLE_START + current_cluster * 2)
+ next_cluster = read_le_short(f)
+ if next_cluster > MAX_CLUSTER_ID:
+ next_cluster = self.extend_cluster(current_cluster, len(data))
+ current_cluster = next_cluster
+ assert current_cluster > 0, "Cannot write free cluster"
- f.seek(self.data_start() + bytes_from_data_start)
- f.write(to_write)
-
- if len(data) == 0:
- return
-
- start_byte -= self.bytes_per_cluster
-
- if start_byte < 0:
- start_byte = 0
-
- f.seek(FAT_TABLE_START + head_cluster * 2)
- next_cluster = read_le_short(f)
- if next_cluster > MAX_CLUSTER_ID:
- head_cluster = self.extend_cluster(head_cluster, len(data))
- else:
- head_cluster = next_cluster
- assert head_cluster > 0, "Cannot write free cluster"
def add_item(directory, item):
"""
@@ -770,7 +752,7 @@
if len(base) == 0:
base = os.path.basename(item[:-1])
sub = directory.new_subdirectory(base)
- for next_item in os.listdir(item):
+ for next_item in sorted(os.listdir(item)):
add_item(sub, os.path.join(item, next_item))
else:
with open(item, 'rb') as f:
diff --git a/tools/fileslist.py b/tools/fileslist.py
index a11efaa..b9e7350 100755
--- a/tools/fileslist.py
+++ b/tools/fileslist.py
@@ -15,12 +15,24 @@
# limitations under the License.
#
-import operator, os, sys
+import json, hashlib, operator, os, sys
def get_file_size(path):
st = os.lstat(path)
return st.st_size;
+def get_file_digest(path):
+ if os.path.isfile(path) == False:
+ return "----------------------------------------------------------------"
+ digest = hashlib.sha256()
+ with open(path, 'rb') as f:
+ while True:
+ buf = f.read(1024*1024)
+ if not buf:
+ break
+ digest.update(buf)
+ return digest.hexdigest();
+
def main(argv):
output = []
roots = argv[1:]
@@ -30,16 +42,17 @@
relative = dir[base:]
for f in files:
try:
- row = (
- get_file_size(os.path.sep.join((dir, f))),
- os.path.sep.join((relative, f)),
- )
+ path = os.path.sep.join((dir, f))
+ row = {
+ "Size": get_file_size(path),
+ "Name": os.path.sep.join((relative, f)),
+ "SHA256": get_file_digest(path),
+ }
output.append(row)
except os.error:
pass
- output.sort(key=operator.itemgetter(0), reverse=True)
- for row in output:
- print "%12d %s" % row
+ output.sort(key=operator.itemgetter("Size", "Name"), reverse=True)
+ print json.dumps(output, indent=2, separators=(',',': '))
if __name__ == '__main__':
main(sys.argv)
diff --git a/tools/fileslist_util.py b/tools/fileslist_util.py
new file mode 100755
index 0000000..ff40d51
--- /dev/null
+++ b/tools/fileslist_util.py
@@ -0,0 +1,68 @@
+#!/usr/bin/env python
+#
+# Copyright (C) 2016 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the 'License');
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an 'AS IS' BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+import getopt, json, sys
+
+def PrintFileNames(path):
+ with open(path) as jf:
+ data = json.load(jf)
+ for line in data:
+ print(line["Name"])
+
+def PrintCanonicalList(path):
+ with open(path) as jf:
+ data = json.load(jf)
+ for line in data:
+ print "{0:12d} {1}".format(line["Size"], line["Name"])
+
+def PrintUsage(name):
+ print("""
+Usage: %s -[nc] json_files_list
+ -n produces list of files only
+ -c produces classic installed-files.txt
+""" % (name))
+
+def main(argv):
+ try:
+ opts, args = getopt.getopt(argv[1:], "nc", "")
+ except getopt.GetoptError, err:
+ print(err)
+ PrintUsage(argv[0])
+ sys.exit(2)
+
+ if len(opts) == 0:
+ print("No conversion option specified")
+ PrintUsage(argv[0])
+ sys.exit(2)
+
+ if len(args) == 0:
+ print("No input file specified")
+ PrintUsage(argv[0])
+ sys.exit(2)
+
+ for o, a in opts:
+ if o == ("-n"):
+ PrintFileNames(args[0])
+ sys.exit()
+ elif o == ("-c"):
+ PrintCanonicalList(args[0])
+ sys.exit()
+ else:
+ assert False, "Unsupported option"
+
+if __name__ == '__main__':
+ main(sys.argv)
diff --git a/tools/findleaves.py b/tools/findleaves.py
index 72cc024..f152a87 100755
--- a/tools/findleaves.py
+++ b/tools/findleaves.py
@@ -26,6 +26,7 @@
def perform_find(mindepth, prune, dirlist, filenames):
result = []
pruneleaves = set(map(lambda x: os.path.split(x)[1], prune))
+ seen = set()
for rootdir in dirlist:
rootdepth = rootdir.count("/")
for root, dirs, files in os.walk(rootdir, followlinks=True):
@@ -52,6 +53,18 @@
if filename in files:
result.append(os.path.join(root, filename))
del dirs[:]
+
+ # filter out inodes that have already been seen due to symlink loops
+ i = 0
+ while i < len(dirs):
+ st = os.stat(os.path.join(root, dirs[i]))
+ key = (st.st_dev, st.st_ino)
+ if key in seen:
+ del dirs[i]
+ else:
+ i += 1
+ seen.add(key)
+
return result
def usage():
diff --git a/tools/releasetools/add_img_to_target_files.py b/tools/releasetools/add_img_to_target_files.py
index 2e26514..3884f49 100755
--- a/tools/releasetools/add_img_to_target_files.py
+++ b/tools/releasetools/add_img_to_target_files.py
@@ -41,9 +41,6 @@
--is_signing
Skip building & adding the images for "userdata" and "cache" if we
are signing the target files.
-
- --verity_signer_path
- Specify the signer path to build verity metadata.
"""
import sys
@@ -71,7 +68,6 @@
OPTIONS.replace_verity_public_key = False
OPTIONS.replace_verity_private_key = False
OPTIONS.is_signing = False
-OPTIONS.verity_signer_path = None
def AddSystem(output_zip, prefix="IMAGES/", recovery_img=None, boot_img=None):
"""Turn the contents of SYSTEM into a system image and store it in
@@ -452,8 +448,6 @@
OPTIONS.replace_verity_public_key = (True, a)
elif o == "--is_signing":
OPTIONS.is_signing = True
- elif o == "--verity_signer_path":
- OPTIONS.verity_signer_path = a
else:
return False
return True
@@ -463,8 +457,7 @@
extra_long_opts=["add_missing", "rebuild_recovery",
"replace_verity_public_key=",
"replace_verity_private_key=",
- "is_signing",
- "verity_signer_path="],
+ "is_signing"],
extra_option_handler=option_handler)
diff --git a/tools/releasetools/blockimgdiff.py b/tools/releasetools/blockimgdiff.py
index 70bb4eb..662b4ec 100644
--- a/tools/releasetools/blockimgdiff.py
+++ b/tools/releasetools/blockimgdiff.py
@@ -999,8 +999,11 @@
heap.append(xf.heap_item)
heapq.heapify(heap)
- sinks = set(u for u in G if not u.outgoing)
- sources = set(u for u in G if not u.incoming)
+ # Use OrderedDict() instead of set() to preserve the insertion order. Need
+ # to use 'sinks[key] = None' to add key into the set. sinks will look like
+ # { key1: None, key2: None, ... }.
+ sinks = OrderedDict.fromkeys(u for u in G if not u.outgoing)
+ sources = OrderedDict.fromkeys(u for u in G if not u.incoming)
def adjust_score(iu, delta):
iu.score += delta
@@ -1011,26 +1014,28 @@
while G:
# Put all sinks at the end of the sequence.
while sinks:
- new_sinks = set()
+ new_sinks = OrderedDict()
for u in sinks:
if u not in G: continue
s2.appendleft(u)
del G[u]
for iu in u.incoming:
adjust_score(iu, -iu.outgoing.pop(u))
- if not iu.outgoing: new_sinks.add(iu)
+ if not iu.outgoing:
+ new_sinks[iu] = None
sinks = new_sinks
# Put all the sources at the beginning of the sequence.
while sources:
- new_sources = set()
+ new_sources = OrderedDict()
for u in sources:
if u not in G: continue
s1.append(u)
del G[u]
for iu in u.outgoing:
adjust_score(iu, +iu.incoming.pop(u))
- if not iu.incoming: new_sources.add(iu)
+ if not iu.incoming:
+ new_sources[iu] = None
sources = new_sources
if not G: break
@@ -1049,11 +1054,13 @@
del G[u]
for iu in u.outgoing:
adjust_score(iu, +iu.incoming.pop(u))
- if not iu.incoming: sources.add(iu)
+ if not iu.incoming:
+ sources[iu] = None
for iu in u.incoming:
adjust_score(iu, -iu.outgoing.pop(u))
- if not iu.outgoing: sinks.add(iu)
+ if not iu.outgoing:
+ sinks[iu] = None
# Now record the sequence in the 'order' field of each transfer,
# and by rearranging self.transfers to be in the chosen sequence.
@@ -1072,8 +1079,7 @@
# Each item of source_ranges will be:
# - None, if that block is not used as a source,
- # - a transfer, if one transfer uses it as a source, or
- # - a set of transfers.
+ # - an ordered set of transfers.
source_ranges = []
for b in self.transfers:
for s, e in b.src_ranges:
@@ -1081,23 +1087,19 @@
source_ranges.extend([None] * (e-len(source_ranges)))
for i in range(s, e):
if source_ranges[i] is None:
- source_ranges[i] = b
+ source_ranges[i] = OrderedDict.fromkeys([b])
else:
- if not isinstance(source_ranges[i], set):
- source_ranges[i] = set([source_ranges[i]])
- source_ranges[i].add(b)
+ source_ranges[i][b] = None
for a in self.transfers:
- intersections = set()
+ intersections = OrderedDict()
for s, e in a.tgt_ranges:
for i in range(s, e):
if i >= len(source_ranges): break
- b = source_ranges[i]
- if b is not None:
- if isinstance(b, set):
- intersections.update(b)
- else:
- intersections.add(b)
+ # Add all the Transfers in source_ranges[i] to the (ordered) set.
+ if source_ranges[i] is not None:
+ for j in source_ranges[i]:
+ intersections[j] = None
for b in intersections:
if a is b: continue
diff --git a/tools/releasetools/build_image.py b/tools/releasetools/build_image.py
index 50e81bf..6bf42d1 100755
--- a/tools/releasetools/build_image.py
+++ b/tools/releasetools/build_image.py
@@ -69,7 +69,7 @@
return True, int(output)
def GetVerityMetadataSize(partition_size):
- cmd = "system/extras/verity/build_verity_metadata.py -s %d"
+ cmd = "system/extras/verity/build_verity_metadata.py size %d"
cmd %= partition_size
status, output = commands.getstatusoutput(cmd)
@@ -214,11 +214,14 @@
return True
def BuildVerityMetadata(image_size, verity_metadata_path, root_hash, salt,
- block_device, signer_path, key):
+ block_device, signer_path, key, signer_args):
cmd_template = (
- "system/extras/verity/build_verity_metadata.py %s %s %s %s %s %s %s")
+ "system/extras/verity/build_verity_metadata.py build " +
+ "%s %s %s %s %s %s %s")
cmd = cmd_template % (image_size, verity_metadata_path, root_hash, salt,
block_device, signer_path, key)
+ if signer_args:
+ cmd += " --signer_args=\"%s\"" % (' '.join(signer_args),)
print cmd
status, output = commands.getstatusoutput(cmd)
if status:
@@ -305,10 +308,10 @@
block_dev = prop_dict["verity_block_device"]
signer_key = prop_dict["verity_key"] + ".pk8"
if OPTIONS.verity_signer_path is not None:
- signer_path = OPTIONS.verity_signer_path + ' '
- signer_path += ' '.join(OPTIONS.verity_signer_args)
+ signer_path = OPTIONS.verity_signer_path
else:
signer_path = prop_dict["verity_signer_cmd"]
+ signer_args = OPTIONS.verity_signer_args
# make a tempdir
tempdir_name = tempfile.mkdtemp(suffix="_verity_images")
@@ -327,7 +330,7 @@
root_hash = prop_dict["verity_root_hash"]
salt = prop_dict["verity_salt"]
if not BuildVerityMetadata(image_size, verity_metadata_path, root_hash, salt,
- block_dev, signer_path, signer_key):
+ block_dev, signer_path, signer_key, signer_args):
shutil.rmtree(tempdir_name, ignore_errors=True)
return False
diff --git a/tools/releasetools/test_blockimgdiff.py b/tools/releasetools/test_blockimgdiff.py
new file mode 100644
index 0000000..03e8c8b
--- /dev/null
+++ b/tools/releasetools/test_blockimgdiff.py
@@ -0,0 +1,77 @@
+#
+# Copyright (C) 2016 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+from __future__ import print_function
+
+import common
+import unittest
+
+from collections import OrderedDict
+from blockimgdiff import BlockImageDiff, EmptyImage, DataImage, Transfer
+from rangelib import RangeSet
+
+class BlockImageDiffTest(unittest.TestCase):
+
+ def test_GenerateDigraphOrder(self):
+ """Make sure GenerateDigraph preserves the order.
+
+ t0: <0-5> => <...>
+ t1: <0-7> => <...>
+ t2: <0-4> => <...>
+ t3: <...> => <0-10>
+
+ t0, t1 and t2 must go before t3, i.e. t3.goes_after =
+ { t0:..., t1:..., t2:... }. But the order of t0-t2 must be preserved.
+ """
+
+ src = EmptyImage()
+ tgt = EmptyImage()
+ block_image_diff = BlockImageDiff(tgt, src)
+
+ transfers = block_image_diff.transfers
+ t0 = Transfer(
+ "t1", "t1", RangeSet("10-15"), RangeSet("0-5"), "move", transfers)
+ t1 = Transfer(
+ "t2", "t2", RangeSet("20-25"), RangeSet("0-7"), "move", transfers)
+ t2 = Transfer(
+ "t3", "t3", RangeSet("30-35"), RangeSet("0-4"), "move", transfers)
+ t3 = Transfer(
+ "t4", "t4", RangeSet("0-10"), RangeSet("40-50"), "move", transfers)
+
+ block_image_diff.GenerateDigraph()
+ t3_goes_after_copy = t3.goes_after.copy()
+
+ # Elements in the set must be in the transfer evaluation order.
+ elements = list(t3_goes_after_copy)
+ self.assertEqual(t0, elements[0])
+ self.assertEqual(t1, elements[1])
+ self.assertEqual(t2, elements[2])
+
+ # Now switch the order of t0, t1 and t2.
+ transfers[0], transfers[1], transfers[2] = (
+ transfers[2], transfers[0], transfers[1])
+ t3.goes_after.clear()
+ t3.goes_before.clear()
+ block_image_diff.GenerateDigraph()
+
+ # The goes_after must be different from last run.
+ self.assertNotEqual(t3_goes_after_copy, t3.goes_after)
+
+ # Assert that each element must agree with the transfer order.
+ elements = list(t3.goes_after)
+ self.assertEqual(t2, elements[0])
+ self.assertEqual(t0, elements[1])
+ self.assertEqual(t1, elements[2])
diff --git a/tools/warn.py b/tools/warn.py
index 3c75825..355d120 100755
--- a/tools/warn.py
+++ b/tools/warn.py
@@ -81,6 +81,7 @@
# dump_csv():
import argparse
+import multiprocessing
import os
import re
@@ -99,6 +100,10 @@
parser.add_argument('--separator',
help='Separator between the end of a URL and the line '
'number argument. e.g. #')
+parser.add_argument('--processes',
+ type=int,
+ default=multiprocessing.cpu_count(),
+ help='Number of parallel processes to process warnings')
parser.add_argument(dest='buildlog', metavar='build.log',
help='Path to build.log file')
args = parser.parse_args()
@@ -1696,14 +1701,47 @@
simple_project_pattern('frameworks/av/cmds'),
simple_project_pattern('frameworks/av/drm'),
simple_project_pattern('frameworks/av/include'),
- simple_project_pattern('frameworks/av/media'),
+ simple_project_pattern('frameworks/av/media/common_time'),
+ simple_project_pattern('frameworks/av/media/img_utils'),
+ simple_project_pattern('frameworks/av/media/libcpustats'),
+ simple_project_pattern('frameworks/av/media/libeffects'),
+ simple_project_pattern('frameworks/av/media/libmediaplayerservice'),
+ simple_project_pattern('frameworks/av/media/libmedia'),
+ simple_project_pattern('frameworks/av/media/libstagefright'),
+ simple_project_pattern('frameworks/av/media/mtp'),
+ simple_project_pattern('frameworks/av/media/ndk'),
+ simple_project_pattern('frameworks/av/media/utils'),
+ project_name_and_pattern('frameworks/av/media/Other',
+ 'frameworks/av/media'),
simple_project_pattern('frameworks/av/radio'),
simple_project_pattern('frameworks/av/services'),
+ simple_project_pattern('frameworks/av/soundtrigger'),
project_name_and_pattern('frameworks/av/Other', 'frameworks/av'),
- simple_project_pattern('frameworks/base'),
- simple_project_pattern('frameworks/compile'),
+ simple_project_pattern('frameworks/base/cmds'),
+ simple_project_pattern('frameworks/base/core'),
+ simple_project_pattern('frameworks/base/drm'),
+ simple_project_pattern('frameworks/base/media'),
+ simple_project_pattern('frameworks/base/libs'),
+ simple_project_pattern('frameworks/base/native'),
+ simple_project_pattern('frameworks/base/packages'),
+ simple_project_pattern('frameworks/base/rs'),
+ simple_project_pattern('frameworks/base/services'),
+ simple_project_pattern('frameworks/base/tests'),
+ simple_project_pattern('frameworks/base/tools'),
+ project_name_and_pattern('frameworks/base/Other', 'frameworks/base'),
+ simple_project_pattern('frameworks/compile/libbcc'),
+ simple_project_pattern('frameworks/compile/mclinker'),
+ simple_project_pattern('frameworks/compile/slang'),
+ project_name_and_pattern('frameworks/compile/Other', 'frameworks/compile'),
simple_project_pattern('frameworks/minikin'),
- simple_project_pattern('frameworks/native'),
+ simple_project_pattern('frameworks/ml'),
+ simple_project_pattern('frameworks/native/cmds'),
+ simple_project_pattern('frameworks/native/include'),
+ simple_project_pattern('frameworks/native/libs'),
+ simple_project_pattern('frameworks/native/opengl'),
+ simple_project_pattern('frameworks/native/services'),
+ simple_project_pattern('frameworks/native/vulkan'),
+ project_name_and_pattern('frameworks/native/Other', 'frameworks/native'),
simple_project_pattern('frameworks/opt'),
simple_project_pattern('frameworks/rs'),
simple_project_pattern('frameworks/webview'),
@@ -1730,16 +1768,58 @@
simple_project_pattern('prebuilts'),
simple_project_pattern('system/bt'),
simple_project_pattern('system/connectivity'),
- simple_project_pattern('system/core'),
- simple_project_pattern('system/extras'),
+ simple_project_pattern('system/core/adb'),
+ simple_project_pattern('system/core/base'),
+ simple_project_pattern('system/core/debuggerd'),
+ simple_project_pattern('system/core/fastboot'),
+ simple_project_pattern('system/core/fingerprintd'),
+ simple_project_pattern('system/core/fs_mgr'),
+ simple_project_pattern('system/core/gatekeeperd'),
+ simple_project_pattern('system/core/healthd'),
+ simple_project_pattern('system/core/include'),
+ simple_project_pattern('system/core/init'),
+ simple_project_pattern('system/core/libbacktrace'),
+ simple_project_pattern('system/core/liblog'),
+ simple_project_pattern('system/core/libpixelflinger'),
+ simple_project_pattern('system/core/libprocessgroup'),
+ simple_project_pattern('system/core/libsysutils'),
+ simple_project_pattern('system/core/logcat'),
+ simple_project_pattern('system/core/logd'),
+ simple_project_pattern('system/core/run-as'),
+ simple_project_pattern('system/core/sdcard'),
+ simple_project_pattern('system/core/toolbox'),
+ project_name_and_pattern('system/core/Other', 'system/core'),
+ simple_project_pattern('system/extras/ANRdaemon'),
+ simple_project_pattern('system/extras/cpustats'),
+ simple_project_pattern('system/extras/crypto-perf'),
+ simple_project_pattern('system/extras/ext4_utils'),
+ simple_project_pattern('system/extras/f2fs_utils'),
+ simple_project_pattern('system/extras/iotop'),
+ simple_project_pattern('system/extras/libfec'),
+ simple_project_pattern('system/extras/memory_replay'),
+ simple_project_pattern('system/extras/micro_bench'),
+ simple_project_pattern('system/extras/mmap-perf'),
+ simple_project_pattern('system/extras/multinetwork'),
+ simple_project_pattern('system/extras/perfprofd'),
+ simple_project_pattern('system/extras/procrank'),
+ simple_project_pattern('system/extras/runconuid'),
+ simple_project_pattern('system/extras/showmap'),
+ simple_project_pattern('system/extras/simpleperf'),
+ simple_project_pattern('system/extras/su'),
+ simple_project_pattern('system/extras/tests'),
+ simple_project_pattern('system/extras/verity'),
+ project_name_and_pattern('system/extras/Other', 'system/extras'),
simple_project_pattern('system/gatekeeper'),
simple_project_pattern('system/keymaster'),
+ simple_project_pattern('system/libhidl'),
simple_project_pattern('system/libhwbinder'),
simple_project_pattern('system/media'),
simple_project_pattern('system/netd'),
+ simple_project_pattern('system/nvram'),
simple_project_pattern('system/security'),
simple_project_pattern('system/sepolicy'),
simple_project_pattern('system/tools'),
+ simple_project_pattern('system/update_engine'),
simple_project_pattern('system/vold'),
project_name_and_pattern('system/Other', 'system'),
simple_project_pattern('toolchain'),
@@ -1991,22 +2071,13 @@
return -1
-def classify_warning(line):
+def classify_one_warning(line, results):
for i in range(len(warn_patterns)):
w = warn_patterns[i]
for cpat in w['compiled_patterns']:
if cpat.match(line):
- w['members'].append(line)
p = find_project_index(line)
- index = len(warning_messages)
- warning_messages.append(line)
- warning_records.append([i, p, index])
- pname = '???' if p < 0 else project_names[p]
- # Count warnings by project.
- if pname in w['projects']:
- w['projects'][pname] += 1
- else:
- w['projects'][pname] = 1
+ results.append([line, i, p])
return
else:
# If we end up here, there was a problem parsing the log
@@ -2015,6 +2086,42 @@
pass
+def classify_warnings(lines):
+ results = []
+ for line in lines:
+ classify_one_warning(line, results)
+ return results
+
+
+def parallel_classify_warnings(warning_lines):
+ """Classify all warning lines with num_cpu parallel processes."""
+ num_cpu = args.processes
+ if num_cpu > 1:
+ groups = [[] for x in range(num_cpu)]
+ i = 0
+ for x in warning_lines:
+ groups[i].append(x)
+ i = (i + 1) % num_cpu
+ pool = multiprocessing.Pool(num_cpu)
+ group_results = pool.map(classify_warnings, groups)
+ else:
+ group_results = [classify_warnings(warning_lines)]
+
+ for result in group_results:
+ for line, pattern_idx, project_idx in result:
+ pattern = warn_patterns[pattern_idx]
+ pattern['members'].append(line)
+ message_idx = len(warning_messages)
+ warning_messages.append(line)
+ warning_records.append([pattern_idx, project_idx, message_idx])
+ pname = '???' if project_idx < 0 else project_names[project_idx]
+ # Count warnings by project.
+ if pname in pattern['projects']:
+ pattern['projects'][pname] += 1
+ else:
+ pattern['projects'][pname] = 1
+
+
def compile_patterns():
"""Precompiling every pattern speeds up parsing by about 30x."""
for i in warn_patterns:
@@ -2082,14 +2189,12 @@
warning_pattern = re.compile('^[^ ]*/[^ ]*: warning: .*')
compile_patterns()
- # read the log file and classify all the warnings
+ # Collect all warnings into the warning_lines set.
warning_lines = set()
for line in infile:
if warning_pattern.match(line):
line = normalize_warning_line(line)
- if line not in warning_lines:
- classify_warning(line)
- warning_lines.add(line)
+ warning_lines.add(line)
elif line_counter < 50:
# save a little bit of time by only doing this for the first few lines
line_counter += 1
@@ -2102,6 +2207,7 @@
m = re.search('(?<=^TARGET_BUILD_VARIANT=).*', line)
if m is not None:
target_variant = m.group(0)
+ parallel_classify_warnings(warning_lines)
# Return s with escaped backslash and quotation characters.
diff --git a/tools/zipalign/ZipAlign.cpp b/tools/zipalign/ZipAlign.cpp
index aef91a5..d56ac29 100644
--- a/tools/zipalign/ZipAlign.cpp
+++ b/tools/zipalign/ZipAlign.cpp
@@ -19,8 +19,9 @@
*/
#include "ZipFile.h"
-#include <stdlib.h>
#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
using namespace android;
diff --git a/tools/zipalign/ZipEntry.cpp b/tools/zipalign/ZipEntry.cpp
index a9c2d33..63d75d1 100644
--- a/tools/zipalign/ZipEntry.cpp
+++ b/tools/zipalign/ZipEntry.cpp
@@ -23,10 +23,11 @@
#include "ZipEntry.h"
#include <utils/Log.h>
-#include <stdio.h>
-#include <string.h>
#include <assert.h>
#include <inttypes.h>
+#include <stdio.h>
+#include <string.h>
+#include <time.h>
using namespace android;