Merge "Move BUILD_NATIVE_BENCHMARK over to libgoogle-benchmark."
diff --git a/core/Makefile b/core/Makefile
index 2d7f76d..5c302f6 100644
--- a/core/Makefile
+++ b/core/Makefile
@@ -674,7 +674,7 @@
$(target_notice_file_html_gz): $(target_notice_file_html) | $(MINIGZIP)
$(hide) $(MINIGZIP) -9 < $< > $@
installed_notice_html_gz := $(TARGET_OUT)/etc/NOTICE.html.gz
-$(installed_notice_html_gz): $(target_notice_file_html_gz) | $(ACP)
+$(installed_notice_html_gz): $(target_notice_file_html_gz)
$(copy-file-to-target)
# if we've been run my mm, mmm, etc, don't reinstall this every time
@@ -1142,7 +1142,7 @@
endif
-$(INSTALLED_SYSTEMIMAGE): $(BUILT_SYSTEMIMAGE) $(RECOVERY_FROM_BOOT_PATCH) | $(ACP)
+$(INSTALLED_SYSTEMIMAGE): $(BUILT_SYSTEMIMAGE) $(RECOVERY_FROM_BOOT_PATCH)
@echo "Install system fs image: $@"
$(copy-file-to-target)
$(hide) $(call assert-max-image-size,$@ $(RECOVERY_FROM_BOOT_PATCH),$(BOARD_SYSTEMIMAGE_PARTITION_SIZE))
diff --git a/core/base_rules.mk b/core/base_rules.mk
index 2fe0616..5afec2f 100644
--- a/core/base_rules.mk
+++ b/core/base_rules.mk
@@ -56,7 +56,6 @@
my_module_tags :=
endif
-ifdef BUILDING_WITH_NINJA
# Ninja has an implicit dependency on the command being run, and kati will
# regenerate the ninja manifest if any read makefile changes, so there is no
# need to have dependencies on makefiles.
@@ -64,7 +63,6 @@
# a .mk file, because a few users of LOCAL_ADDITIONAL_DEPENDENCIES don't include
# base_rules.mk, but it will fix the most common ones.
LOCAL_ADDITIONAL_DEPENDENCIES := $(filter-out %.mk,$(LOCAL_ADDITIONAL_DEPENDENCIES))
-endif
###########################################################
## Validate and define fallbacks for input LOCAL_* variables.
@@ -301,45 +299,30 @@
## Module installation rule
###########################################################
-# Some hosts do not have ACP; override the LOCAL version if that's the case.
-ifneq ($(strip $(HOST_ACP_UNAVAILABLE)),)
- LOCAL_ACP_UNAVAILABLE := $(strip $(HOST_ACP_UNAVAILABLE))
-endif
-
ifndef LOCAL_UNINSTALLABLE_MODULE
- # Define a copy rule to install the module.
- # acp and libraries that it uses can't use acp for
- # installation; hence, LOCAL_ACP_UNAVAILABLE.
$(LOCAL_INSTALLED_MODULE): PRIVATE_POST_INSTALL_CMD := $(LOCAL_POST_INSTALL_CMD)
-ifneq ($(LOCAL_ACP_UNAVAILABLE),true)
-$(LOCAL_INSTALLED_MODULE): $(LOCAL_BUILT_MODULE) | $(ACP)
+$(LOCAL_INSTALLED_MODULE): $(LOCAL_BUILT_MODULE)
@echo "Install: $@"
$(copy-file-to-new-target)
$(PRIVATE_POST_INSTALL_CMD)
-else
-$(LOCAL_INSTALLED_MODULE): $(LOCAL_BUILT_MODULE)
- @echo "Install: $@"
- $(copy-file-to-target-with-cp)
-endif
# Rule to install the module's companion init.rc.
-my_init_rc := $(LOCAL_INIT_RC_$(my_32_64_bit_suffix))
-my_init_rc_src :=
my_init_rc_installed :=
-ifndef my_init_rc
-my_init_rc := $(LOCAL_INIT_RC)
+my_init_rc_pairs :=
+my_init_rc := $(LOCAL_INIT_RC_$(my_32_64_bit_suffix))
+ifneq ($(my_init_rc),)
+my_init_rc_pairs += $(LOCAL_PATH)/$(my_init_rc):$(TARGET_OUT$(partition_tag)_ETC)/init/$(notdir $(my_init_rc))
+endif
+ifneq ($(LOCAL_INIT_RC),)
+my_init_rc_pairs += $(LOCAL_PATH)/$(LOCAL_INIT_RC):$(TARGET_OUT$(partition_tag)_ETC)/init/$(notdir $(LOCAL_INIT_RC))
# Make sure we don't define the rule twice in multilib module.
LOCAL_INIT_RC :=
endif
-ifdef my_init_rc
-my_init_rc_src := $(LOCAL_PATH)/$(my_init_rc)
-my_init_rc_installed := $(TARGET_OUT$(partition_tag)_ETC)/init/$(notdir $(my_init_rc_src))
-$(my_init_rc_installed) : $(my_init_rc_src) | $(ACP)
- @echo "Install: $@"
- $(copy-file-to-new-target)
+ifneq ($(my_init_rc_pairs),)
+my_init_rc_installed := $(call copy-many-files,$(my_init_rc_pairs))
$(my_register_name) : $(my_init_rc_installed)
-endif # my_init_rc
+endif # my_init_rc_pairs
endif # !LOCAL_UNINSTALLABLE_MODULE
###########################################################
@@ -392,7 +375,7 @@
ALL_MODULES.$(my_register_name).BUILT_INSTALLED := \
$(strip $(ALL_MODULES.$(my_register_name).BUILT_INSTALLED) \
$(LOCAL_BUILT_MODULE):$(LOCAL_INSTALLED_MODULE) \
- $(addprefix $(my_init_rc_src):,$(my_init_rc_installed)))
+ $(my_init_rc_pairs))
endif
ifdef LOCAL_PICKUP_FILES
# Files or directories ready to pick up by the build system
diff --git a/core/binary.mk b/core/binary.mk
index 1c7ffda..54dc474 100644
--- a/core/binary.mk
+++ b/core/binary.mk
@@ -53,7 +53,7 @@
my_c_includes := $(LOCAL_C_INCLUDES)
my_generated_sources := $(LOCAL_GENERATED_SOURCES)
my_native_coverage := $(LOCAL_NATIVE_COVERAGE)
-my_additional_dependencies := $(LOCAL_MODULE_MAKEFILE_DEP) $(LOCAL_ADDITIONAL_DEPENDENCIES)
+my_additional_dependencies := $(LOCAL_ADDITIONAL_DEPENDENCIES)
my_export_c_include_dirs := $(LOCAL_EXPORT_C_INCLUDE_DIRS)
ifdef LOCAL_IS_HOST_MODULE
@@ -528,7 +528,7 @@
my_gen_sources_copy := $(patsubst $(generated_sources_dir)/%,$(intermediates)/%,$(filter $(generated_sources_dir)/%,$(my_generated_sources)))
-$(my_gen_sources_copy): $(intermediates)/% : $(generated_sources_dir)/% | $(ACP)
+$(my_gen_sources_copy): $(intermediates)/% : $(generated_sources_dir)/%
@echo "Copy: $@"
$(copy-file-to-target)
@@ -1143,7 +1143,7 @@
$(foreach l, $(my_static_libraries) $(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))
$(import_includes): PRIVATE_IMPORT_EXPORT_INCLUDES := $(import_includes_deps)
-$(import_includes) : $(LOCAL_MODULE_MAKEFILE_DEP) $(import_includes_deps)
+$(import_includes) : $(import_includes_deps)
@echo Import includes file: $@
$(hide) mkdir -p $(dir $@) && rm -f $@
ifdef import_includes_deps
@@ -1210,11 +1210,7 @@
# that custom build rules which generate .o files don't consume other generated
# sources as input (or if they do they take care of that dependency themselves).
$(normal_objects) : | $(my_generated_sources)
-ifeq ($(BUILDING_WITH_NINJA),true)
$(all_objects) : $(import_includes)
-else
-$(all_objects) : | $(import_includes)
-endif
ALL_C_CPP_ETC_OBJECTS += $(all_objects)
@@ -1346,6 +1342,21 @@
my_cppflags := $(filter-out $(my_illegal_flags),$(my_cppflags))
my_conlyflags := $(filter-out $(my_illegal_flags),$(my_conlyflags))
+# We can enforce some rules more strictly in the code we own. my_strict
+# indicates if this is code that we can be stricter with. If we have rules that
+# we want to apply to *our* code (but maybe can't for vendor/device specific
+# things), we could extend this to be a ternary value.
+my_strict := true
+ifneq ($(filter external/%,$(LOCAL_PATH)),)
+ my_strict := false
+endif
+
+# Can be used to make some annotations stricter for code we can fix (such as
+# when we mark functions as deprecated).
+ifeq ($(my_strict),true)
+ my_cflags += -DANDROID_STRICT
+endif
+
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_YACCFLAGS := $(LOCAL_YACCFLAGS)
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_ASFLAGS := $(my_asflags)
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_CONLYFLAGS := $(my_conlyflags)
@@ -1391,7 +1402,7 @@
# Similarly, the generated DBus headers need to exist before we export their location.
# People are not going to consume the aidl generated cpp file, but the cpp file is
# generated after the headers, so this is a convenient way to ensure the headers exist.
-$(export_includes) : $(LOCAL_MODULE_MAKEFILE_DEP) $(proto_generated_headers) $(dbus_generated_headers) $(aidl_gen_cpp)
+$(export_includes) : $(proto_generated_headers) $(dbus_generated_headers) $(aidl_gen_cpp)
@echo Export includes file: $< -- $@
$(hide) mkdir -p $(dir $@) && rm -f $@.tmp
ifdef my_export_c_include_dirs
@@ -1401,15 +1412,11 @@
else
$(hide) touch $@.tmp
endif
-ifeq ($(BUILDING_WITH_NINJA),true)
$(hide) if cmp -s $@.tmp $@ ; then \
rm $@.tmp ; \
else \
mv $@.tmp $@ ; \
fi
-else
- mv $@.tmp $@ ;
-endif
# Kati adds restat=1 to ninja. GNU make does nothing for this.
.KATI_RESTAT: $(export_includes)
diff --git a/core/clang/versions.mk b/core/clang/versions.mk
index 7106899..96872c2 100644
--- a/core/clang/versions.mk
+++ b/core/clang/versions.mk
@@ -1,5 +1,5 @@
## Clang/LLVM release versions.
LLVM_RELEASE_VERSION := 3.8
-LLVM_PREBUILTS_VERSION ?= clang-2577113
+LLVM_PREBUILTS_VERSION ?= clang-2629532
LLVM_PREBUILTS_BASE ?= prebuilts/clang/host
diff --git a/core/cleanbuild.mk b/core/cleanbuild.mk
index c5b15bc..f61e3f7 100644
--- a/core/cleanbuild.mk
+++ b/core/cleanbuild.mk
@@ -246,14 +246,7 @@
$(PRODUCT_OUT)/oem \
$(PRODUCT_OUT)/dex_bootjars \
$(PRODUCT_OUT)/obj/JAVA_LIBRARIES \
- $(PRODUCT_OUT)/obj/FAKE \
- $(PRODUCT_OUT)/obj/EXECUTABLES/adbd_intermediates \
- $(PRODUCT_OUT)/obj/EXECUTABLES/logd_intermediates \
- $(PRODUCT_OUT)/obj/STATIC_LIBRARIES/libfs_mgr_intermediates \
- $(PRODUCT_OUT)/obj/EXECUTABLES/init_intermediates \
- $(PRODUCT_OUT)/obj/ETC/mac_permissions.xml_intermediates \
- $(PRODUCT_OUT)/obj/ETC/sepolicy_intermediates \
- $(PRODUCT_OUT)/obj/ETC/init.environ.rc_intermediates
+ $(PRODUCT_OUT)/obj/FAKE
# The files/dirs to delete during a dataclean, which removes any files
# in the staging and emulator data partitions.
diff --git a/core/clear_vars.mk b/core/clear_vars.mk
index 0267321..7304bf8 100644
--- a/core/clear_vars.mk
+++ b/core/clear_vars.mk
@@ -25,7 +25,6 @@
LOCAL_MANIFEST_PACKAGE_NAME:=
LOCAL_PACKAGE_SPLITS:=
LOCAL_REQUIRED_MODULES:=
-LOCAL_ACP_UNAVAILABLE:=
LOCAL_MODULE_TAGS:=
LOCAL_SRC_FILES:=
LOCAL_SRC_FILES_EXCLUDE:=
@@ -208,6 +207,8 @@
LOCAL_REQUIRED_MODULES_$(TARGET_ARCH):=
LOCAL_CLANG_$(TARGET_ARCH):=
LOCAL_PREBUILT_JNI_LIBS_$(TARGET_ARCH):=
+LOCAL_STRIP_MODULE_$(TARGET_ARCH):=
+LOCAL_PACK_MODULE_RELOCATIONS_$(TARGET_ARCH):=
ifdef TARGET_2ND_ARCH
LOCAL_SRC_FILES_$(TARGET_2ND_ARCH):=
LOCAL_SRC_FILES_EXCLUDE_$(TARGET_2ND_ARCH):=
@@ -227,6 +228,8 @@
LOCAL_REQUIRED_MODULES_$(TARGET_2ND_ARCH):=
LOCAL_CLANG_$(TARGET_2ND_ARCH):=
LOCAL_PREBUILT_JNI_LIBS_$(TARGET_2ND_ARCH):=
+LOCAL_STRIP_MODULE_$(TARGET_2ND_ARCH):=
+LOCAL_PACK_MODULE_RELOCATIONS_$(TARGET_2ND_ARCH):=
endif
LOCAL_SRC_FILES_$(HOST_ARCH):=
LOCAL_SRC_FILES_EXCLUDE_$(HOST_ARCH):=
diff --git a/core/combo/arch/arm/armv7-a-neon.mk b/core/combo/arch/arm/armv7-a-neon.mk
index 5dc1fec..5d5b050 100644
--- a/core/combo/arch/arm/armv7-a-neon.mk
+++ b/core/combo/arch/arm/armv7-a-neon.mk
@@ -6,6 +6,8 @@
ARCH_ARM_HAVE_VFP_D32 := true
ARCH_ARM_HAVE_NEON := true
+local_arch_has_lpae := false
+
ifneq (,$(filter cortex-a15 krait denver,$(TARGET_$(combo_2nd_arch_prefix)CPU_VARIANT)))
# TODO: krait is not a cortex-a15, we set the variant to cortex-a15 so that
# hardware divide operations are generated. This should be removed and a
@@ -13,9 +15,7 @@
# core/clang/arm.mk.
arch_variant_cflags := -mcpu=cortex-a15
- # Fake an ARM compiler flag as these processors support LPAE which GCC/clang
- # don't advertise.
- arch_variant_cflags += -D__ARM_FEATURE_LPAE=1
+ local_arch_has_lpae := true
arch_variant_ldflags := \
-Wl,--no-fix-cortex-a8
else
@@ -26,6 +26,8 @@
else
ifneq (,$(filter cortex-a7 cortex-a53 cortex-a53.a57,$(TARGET_$(combo_2nd_arch_prefix)CPU_VARIANT)))
arch_variant_cflags := -mcpu=cortex-a7
+
+ local_arch_has_lpae := true
arch_variant_ldflags := \
-Wl,--no-fix-cortex-a8
else
@@ -37,6 +39,16 @@
endif
endif
+ifeq (true,$(local_arch_has_lpae))
+ # Fake an ARM compiler flag as these processors support LPAE which GCC/clang
+ # don't advertise.
+ # TODO This is a hack and we need to add it for each processor that supports LPAE until some
+ # better solution comes around. See Bug 27340895
+ arch_variant_cflags += -D__ARM_FEATURE_LPAE=1
+endif
+
+local_arch_has_lpae :=
+
arch_variant_cflags += \
-mfloat-abi=softfp \
-mfpu=neon
diff --git a/core/combo/arch/x86/sandybridge.mk b/core/combo/arch/x86/sandybridge.mk
index bca5953..830e1db 100644
--- a/core/combo/arch/x86/sandybridge.mk
+++ b/core/combo/arch/x86/sandybridge.mk
@@ -5,13 +5,13 @@
ARCH_X86_HAVE_SSE4 := true
ARCH_X86_HAVE_SSE4_1 := true
ARCH_X86_HAVE_SSE4_2 := true
-ARCH_X86_HAVE_AES_NI := true
-ARCH_X86_HAVE_AVX := true
+ARCH_X86_HAVE_AES_NI := false
+ARCH_X86_HAVE_AVX := false
ARCH_X86_HAVE_POPCNT := true
ARCH_X86_HAVE_MOVBE := false
# CFLAGS for this arch
arch_variant_cflags := \
- -march=corei7-avx \
+ -march=corei7 \
-mfpmath=sse \
diff --git a/core/combo/arch/x86_64/sandybridge.mk b/core/combo/arch/x86_64/sandybridge.mk
index 865548c..574ec8a 100644
--- a/core/combo/arch/x86_64/sandybridge.mk
+++ b/core/combo/arch/x86_64/sandybridge.mk
@@ -5,11 +5,11 @@
ARCH_X86_HAVE_SSE4 := true
ARCH_X86_HAVE_SSE4_1 := true
ARCH_X86_HAVE_SSE4_2 := true
-ARCH_X86_HAVE_AES_NI := true
-ARCH_X86_HAVE_AVX := true
+ARCH_X86_HAVE_AES_NI := false
+ARCH_X86_HAVE_AVX := false
ARCH_X86_HAVE_POPCNT := true
ARCH_X86_HAVE_MOVBE := false
# CFLAGS for this arch
arch_variant_cflags := \
- -march=corei7-avx
+ -march=corei7
diff --git a/core/config.mk b/core/config.mk
index 85a4ca1..523fe9b 100644
--- a/core/config.mk
+++ b/core/config.mk
@@ -36,7 +36,6 @@
export PYTHONDONTWRITEBYTECODE := 1
# Standard source directories.
-SRC_DOCS:= $(TOPDIR)docs
# TODO: Enforce some kind of layering; only add include paths
# when a module links against a particular library.
# TODO: See if we can remove most of these from the global list.
@@ -51,9 +50,6 @@
$(TOPDIR)frameworks/native/opengl/include \
$(TOPDIR)frameworks/av/include \
$(TOPDIR)frameworks/base/include
-SRC_HOST_HEADERS:=$(TOPDIR)tools/include
-SRC_LIBRARIES:= $(TOPDIR)libs
-SRC_SERVERS:= $(TOPDIR)servers
SRC_TARGET_DIR := $(TOPDIR)build/target
SRC_API_DIR := $(TOPDIR)prebuilts/sdk/api
SRC_SYSTEM_API_DIR := $(TOPDIR)prebuilts/sdk/system-api
@@ -702,7 +698,7 @@
HOST_GLOBAL_LD_DIRS += -L$(HOST_OUT_INTERMEDIATE_LIBRARIES)
TARGET_GLOBAL_LD_DIRS += -L$(TARGET_OUT_INTERMEDIATE_LIBRARIES)
-HOST_PROJECT_INCLUDES:= $(SRC_HEADERS) $(SRC_HOST_HEADERS) $(HOST_OUT_HEADERS)
+HOST_PROJECT_INCLUDES:= $(SRC_HEADERS) $(HOST_OUT_HEADERS)
TARGET_PROJECT_INCLUDES:= $(SRC_HEADERS) $(TARGET_OUT_HEADERS) \
$(TARGET_DEVICE_KERNEL_HEADERS) $(TARGET_BOARD_KERNEL_HEADERS) \
$(TARGET_PRODUCT_KERNEL_HEADERS)
@@ -747,7 +743,7 @@
HOST_CROSS_GLOBAL_CPPFLAGS += $(COMMON_GLOBAL_CPPFLAGS)
HOST_CROSS_RELEASE_CPPFLAGS += $(COMMON_RELEASE_CPPFLAGS)
HOST_CROSS_GLOBAL_LD_DIRS += -L$(HOST_CROSS_OUT_INTERMEDIATE_LIBRARIES)
-HOST_CROSS_PROJECT_INCLUDES:= $(SRC_HEADERS) $(SRC_HOST_HEADERS) $(HOST_CROSS_OUT_HEADERS)
+HOST_CROSS_PROJECT_INCLUDES:= $(SRC_HEADERS) $(HOST_CROSS_OUT_HEADERS)
HOST_CROSS_GLOBAL_CFLAGS += $(HOST_CROSS_RELEASE_CFLAGS)
HOST_CROSS_GLOBAL_CPPFLAGS += $(HOST_CROSS_RELEASE_CPPFLAGS)
@@ -757,7 +753,7 @@
$(HOST_CROSS_2ND_ARCH_VAR_PREFIX)HOST_CROSS_GLOBAL_CPPFLAGS += $(COMMON_GLOBAL_CPPFLAGS)
$(HOST_CROSS_2ND_ARCH_VAR_PREFIX)HOST_CROSS_RELEASE_CPPFLAGS += $(COMMON_RELEASE_CPPFLAGS)
$(HOST_CROSS_2ND_ARCH_VAR_PREFIX)HOST_CROSS_GLOBAL_LD_DIRS += -L$($(HOST_CROSS_2ND_ARCH_VAR_PREFIX)HOST_CROSS_OUT_INTERMEDIATE_LIBRARIES)
-$(HOST_CROSS_2ND_ARCH_VAR_PREFIX)HOST_CROSS_PROJECT_INCLUDES:= $(SRC_HEADERS) $(SRC_HOST_HEADERS) $($(HOST_CROSS_2ND_ARCH_VAR_PREFIX)HOST_CROSS_OUT_HEADERS)
+$(HOST_CROSS_2ND_ARCH_VAR_PREFIX)HOST_CROSS_PROJECT_INCLUDES:= $(SRC_HEADERS) $($(HOST_CROSS_2ND_ARCH_VAR_PREFIX)HOST_CROSS_OUT_HEADERS)
$(HOST_CROSS_2ND_ARCH_VAR_PREFIX)HOST_CROSS_GLOBAL_CFLAGS += $($(HOST_CROSS_2ND_ARCH_VAR_PREFIX)HOST_CROSS_RELEASE_CFLAGS)
$(HOST_CROSS_2ND_ARCH_VAR_PREFIX)HOST_CROSS_GLOBAL_CPPFLAGS += $($(HOST_CROSS_2ND_ARCH_VAR_PREFIX)HOST_CROSS_RELEASE_CPPFLAGS)
endif
diff --git a/core/definitions.mk b/core/definitions.mk
index c40e6bc..66859cd 100644
--- a/core/definitions.mk
+++ b/core/definitions.mk
@@ -133,7 +133,6 @@
define my-dir
$(strip \
$(eval LOCAL_MODULE_MAKEFILE := $$(lastword $$(MAKEFILE_LIST))) \
- $(eval LOCAL_MODULE_MAKEFILE_DEP := $(if $(BUILDING_WITH_NINJA),,$$(LOCAL_MODULE_MAKEFILE))) \
$(if $(filter $(BUILD_SYSTEM)/% $(OUT_DIR)/%,$(LOCAL_MODULE_MAKEFILE)), \
$(error my-dir must be called before including any other makefile.) \
, \
@@ -655,25 +654,36 @@
# $(1): library name
# $(2): Non-empty if IS_HOST_MODULE
define _java-lib-full-classes.jar
-$(call _java-lib-dir,$(1),$(2))/classes$(COMMON_JAVA_PACKAGE_SUFFIX)
+$(call _java-lib-dir,$(1),$(2))/$(if $(2),javalib,classes)$(COMMON_JAVA_PACKAGE_SUFFIX)
endef
+# Get the jar files (you can pass to "javac -classpath") of static or shared
+# Java libraries that you want to link against.
# $(1): library name list
# $(2): Non-empty if IS_HOST_MODULE
define java-lib-files
$(foreach lib,$(1),$(call _java-lib-full-classes.jar,$(lib),$(2)))
endef
-# $(1): library name
-# $(2): Non-empty if IS_HOST_MODULE
-define _java-lib-full-dep
-$(call _java-lib-dir,$(1),$(2))/$(if $(2),javalib,classes)$(COMMON_JAVA_PACKAGE_SUFFIX)
-endef
-
+# Get the dependency files (you can put on the right side of "|" of a build rule)
+# of the Java libraries.
# $(1): library name list
# $(2): Non-empty if IS_HOST_MODULE
+# Historically for target Java libraries we used a different file (javalib.jar)
+# as the dependency.
+# Now we can use classes.jar as dependency, so java-lib-deps is the same
+# as java-lib-files.
define java-lib-deps
-$(foreach lib,$(1),$(call _java-lib-full-dep,$(lib),$(2)))
+$(call java-lib-files,$(1),$(2))
+endef
+
+# Get the jar files (you can pass to "javac -classpath") of host dalvik Java libraries.
+# You can also use them as dependency files.
+# A host dalvik Java library is different from a host Java library in that
+# the java lib file is classes.jar, not javalib.jar.
+# $(1): library name list
+define host-dex-java-lib-files
+$(foreach lib,$(1),$(call _java-lib-dir,$(lib),true)/classes.jar)
endef
###########################################################
@@ -694,16 +704,10 @@
$(foreach lib,$(1),$(call _jack-lib-full-classes,$(lib),$(2)))
endef
-# $(1): library name
-# $(2): Non-empty if IS_HOST_MODULE
-define _jack-lib-full-dep
-$(call _jack-lib-full-classes,$(1),$(2))
-endef
-
# $(1): library name list
# $(2): Non-empty if IS_HOST_MODULE
define jack-lib-deps
-$(foreach lib,$(1),$(call _jack-lib-full-dep,$(lib),$(2)))
+$(call jack-lib-files,$(1),$(2))
endef
###########################################################
@@ -895,15 +899,9 @@
###########################################################
# $(1): the .P file
# $(2): the main build target
-ifeq ($(BUILDING_WITH_NINJA),true)
define include-depfile
$(eval $(2) : .KATI_DEPFILE := $1)
endef
-else
-define include-depfile
-$(eval -include $1)
-endef
-endif
###########################################################
## Track source files compiled to objects
@@ -1302,13 +1300,12 @@
$(PRIVATE_HOST_GLOBAL_CONLYFLAGS) \
) \
$(1) \
- $(PRIVATE_CFLAGS_NO_OVERRIDE) \
-MD -MF $(patsubst %.o,%.d,$@) -o $@ $<
endef
define transform-host-c-to-o-no-deps
@echo "$($(PRIVATE_PREFIX)DISPLAY) C: $(PRIVATE_MODULE) <= $<"
-$(call transform-host-c-or-s-to-o-no-deps, $(PRIVATE_CFLAGS) $(PRIVATE_CONLYFLAGS) $(PRIVATE_DEBUG_CFLAGS))
+$(call transform-host-c-or-s-to-o-no-deps, $(PRIVATE_CFLAGS) $(PRIVATE_CONLYFLAGS) $(PRIVATE_DEBUG_CFLAGS) $(PRIVATE_CFLAGS_NO_OVERRIDE))
endef
define transform-host-s-to-o-no-deps
@@ -1332,7 +1329,7 @@
define transform-host-m-to-o-no-deps
@echo "$($(PRIVATE_PREFIX)DISPLAY) ObjC: $(PRIVATE_MODULE) <= $<"
-$(call transform-host-c-or-s-to-o-no-deps, $(PRIVATE_CFLAGS) $(PRIVATE_DEBUG_CFLAGS))
+$(call transform-host-c-or-s-to-o-no-deps, $(PRIVATE_CFLAGS) $(PRIVATE_DEBUG_CFLAGS) $(PRIVATE_CFLAGS_NO_OVERRIDE))
endef
define transform-host-m-to-o
@@ -2007,6 +2004,38 @@
$(if $(PRIVATE_JAR_MANIFEST), $(hide) echo unsupported options JAR_MANIFEST in $@; exit 53)
endef
+# Invoke Jack to compile java source just to check it compiles correctly.
+#
+# Some historical notes:
+# - below we write the list of java files to java-source-list to avoid argument
+# list length problems with Cygwin
+# - we filter out duplicate java file names because Jack doesn't like them.
+define jack-check-java
+$(hide) rm -f $@
+$(hide) rm -f $@.java-source-list
+$(hide) rm -f $@.java-source-list-uniq
+$(hide) mkdir -p $(dir $@)
+$(if $(PRIVATE_JACK_INCREMENTAL_DIR),$(hide) mkdir -p $(PRIVATE_JACK_INCREMENTAL_DIR))
+$(call dump-words-to-file,$(PRIVATE_JAVA_SOURCES),$@.java-source-list)
+$(hide) if [ -d "$(PRIVATE_SOURCE_INTERMEDIATES_DIR)" ]; then \
+ find $(PRIVATE_SOURCE_INTERMEDIATES_DIR) -name '*.java' >> $@.java-source-list; \
+fi
+$(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)) \
+ $(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 \
+ -D jack.import.type.policy=keep-first \
+ $(if $(PRIVATE_JACK_INCREMENTAL_DIR),--incremental-folder $(PRIVATE_JACK_INCREMENTAL_DIR)) \
+ @$@.java-source-list-uniq; \
+fi
+touch $@
+endef
+
define transform-jar-to-jack
$(hide) mkdir -p $(dir $@)
$(hide) mkdir -p $@.tmpjill.res
@@ -2025,9 +2054,7 @@
# Moves $1.tmp to $1 if necessary. This is designed to be used with
# .KATI_RESTAT. For kati, this function doesn't update the timestamp
# of $1 when $1.tmp is identical to $1 so that ninja won't rebuild
-# targets which depend on $1. For GNU make, this function simply
-# copies $1.tmp to $1.
-ifeq ($(BUILDING_WITH_NINJA),true)
+# targets which depend on $1.
define commit-change-for-toc
$(hide) if cmp -s $1.tmp $1 ; then \
rm $1.tmp ; \
@@ -2035,12 +2062,6 @@
mv $1.tmp $1 ; \
fi
endef
-else
-define commit-change-for-toc
-@# make doesn't support restat. We always update .toc files so the dependents will always be updated too.
-$(hide) mv $1.tmp $1
-endef
-endif
## Rule to create a table of contents from a .jar file.
## Must be called with $(eval).
@@ -2378,7 +2399,7 @@
# $(1): source file
# $(2): destination file
define copy-one-file
-$(2): $(1) | $(ACP)
+$(2): $(1)
@echo "Copy: $$@"
$$(copy-file-to-target)
endef
@@ -2399,7 +2420,7 @@
# $(1): source file
# $(2): destination file, must end with .xml.
define copy-xml-file-checked
-$(2): $(1) | $(ACP)
+$(2): $(1)
@echo "Copy xml: $$@"
$(hide) xmllint $$< >/dev/null # Don't print the xml file to stdout.
$$(copy-file-to-target)
@@ -2414,24 +2435,29 @@
# Copy a single file from one place to another,
# preserving permissions and overwriting any existing
# file.
-# We disable the "-t" option for acp cannot handle
-# high resolution timestamp correctly on file systems like ext4.
-# Therefore copy-file-to-target is the same as copy-file-to-new-target.
+# When we used acp, it could not handle high resolution timestamps
+# on file systems like ext4. Because of that, '-t' option was disabled
+# and copy-file-to-target was identical to copy-file-to-new-target.
+# Keep the behavior until we audit and ensure that switching this back
+# won't break anything.
define copy-file-to-target
@mkdir -p $(dir $@)
-$(hide) $(ACP) -fp $< $@
+$(hide) rm -f $@
+$(hide) cp $< $@
endef
# The same as copy-file-to-target, but use the local
# cp command instead of acp.
define copy-file-to-target-with-cp
@mkdir -p $(dir $@)
-$(hide) cp -fp $< $@
+$(hide) rm -f $@
+$(hide) cp -p $< $@
endef
# The same as copy-file-to-target, but use the zipalign tool to do so.
define copy-file-to-target-with-zipalign
@mkdir -p $(dir $@)
+$(hide) rm -f $@
$(hide) $(ZIPALIGN) -f 4 $< $@
endef
@@ -2439,6 +2465,7 @@
# comments (for config files and such).
define copy-file-to-target-strip-comments
@mkdir -p $(dir $@)
+$(hide) rm -f $@
$(hide) sed -e 's/#.*$$//' -e 's/[ \t]*$$//' -e '/^$$/d' < $< > $@
endef
@@ -2446,14 +2473,16 @@
# the old modification time.
define copy-file-to-new-target
@mkdir -p $(dir $@)
-$(hide) $(ACP) -fp $< $@
+$(hide) rm -f $@
+$(hide) cp $< $@
endef
# The same as copy-file-to-new-target, but use the local
# cp command instead of acp.
define copy-file-to-new-target-with-cp
@mkdir -p $(dir $@)
-$(hide) cp -f $< $@
+$(hide) rm -f $@
+$(hide) cp $< $@
endef
# Copy a prebuilt file to a target location.
@@ -2582,7 +2611,7 @@
endef
define add-radio-file-internal
INSTALLED_RADIOIMAGE_TARGET += $$(PRODUCT_OUT)/$(2)
-$$(PRODUCT_OUT)/$(2) : $$(LOCAL_PATH)/$(1) | $$(ACP)
+$$(PRODUCT_OUT)/$(2) : $$(LOCAL_PATH)/$(1)
$$(transform-prebuilt-to-target)
endef
@@ -2597,7 +2626,7 @@
define add-radio-file-checked-internal
INSTALLED_RADIOIMAGE_TARGET += $$(PRODUCT_OUT)/$(2)
BOARD_INFO_CHECK += $(3):$(LOCAL_PATH)/$(1)
-$$(PRODUCT_OUT)/$(2) : $$(LOCAL_PATH)/$(1) | $$(ACP)
+$$(PRODUCT_OUT)/$(2) : $$(LOCAL_PATH)/$(1)
$$(transform-prebuilt-to-target)
endef
diff --git a/core/dex_preopt.mk b/core/dex_preopt.mk
index e0dde01..8c473f7 100644
--- a/core/dex_preopt.mk
+++ b/core/dex_preopt.mk
@@ -35,7 +35,7 @@
_dbj_jar_no_dex := $(DEXPREOPT_BOOT_JAR_DIR_FULL_PATH)/$(1)_nodex.jar
_dbj_src_jar := $(call intermediates-dir-for,JAVA_LIBRARIES,$(1),,COMMON)/javalib.jar
-$$(_dbj_jar_no_dex) : $$(_dbj_src_jar) | $(ACP)
+$$(_dbj_jar_no_dex) : $$(_dbj_src_jar)
$$(call copy-file-to-target)
ifneq ($(DEX_PREOPT_DEFAULT),nostripping)
$$(call dexpreopt-remove-classes.dex,$$@)
diff --git a/core/dex_preopt_odex_install.mk b/core/dex_preopt_odex_install.mk
index 73c8146..c7d9750 100644
--- a/core/dex_preopt_odex_install.mk
+++ b/core/dex_preopt_odex_install.mk
@@ -106,8 +106,7 @@
# Use pattern rule - we may have multiple installed odex files.
# Ugly syntax - See the definition get-odex-file-path.
$(installed_odex) : $(dir $(LOCAL_INSTALLED_MODULE))%$(notdir $(word 1,$(installed_odex))) \
- : $(dir $(LOCAL_BUILT_MODULE))%$(notdir $(word 1,$(built_odex))) \
- | $(ACP)
+ : $(dir $(LOCAL_BUILT_MODULE))%$(notdir $(word 1,$(built_odex)))
@echo "Install: $@"
$(copy-file-to-target)
endif
diff --git a/core/droiddoc.mk b/core/droiddoc.mk
index 1b65611..0f18a58 100644
--- a/core/droiddoc.mk
+++ b/core/droiddoc.mk
@@ -161,7 +161,6 @@
$(droiddoc) \
$(html_dir_files) \
$(full_java_lib_deps) \
- $(LOCAL_MODULE_MAKEFILE_DEP) \
$(LOCAL_ADDITIONAL_DEPENDENCIES)
@echo Docs droiddoc: $(PRIVATE_OUT_DIR)
$(hide) mkdir -p $(dir $@)
diff --git a/core/dumpvar.mk b/core/dumpvar.mk
index cfb031f..1bd4777 100644
--- a/core/dumpvar.mk
+++ b/core/dumpvar.mk
@@ -1,3 +1,35 @@
+
+# List of variables we want to print in the build banner.
+print_build_config_vars := \
+ PLATFORM_VERSION_CODENAME \
+ PLATFORM_VERSION \
+ TARGET_PRODUCT \
+ TARGET_BUILD_VARIANT \
+ TARGET_BUILD_TYPE \
+ TARGET_BUILD_APPS \
+ TARGET_ARCH \
+ TARGET_ARCH_VARIANT \
+ TARGET_CPU_VARIANT \
+ TARGET_2ND_ARCH \
+ TARGET_2ND_ARCH_VARIANT \
+ TARGET_2ND_CPU_VARIANT \
+ HOST_ARCH \
+ HOST_2ND_ARCH \
+ HOST_OS \
+ HOST_OS_EXTRA \
+ HOST_CROSS_OS \
+ HOST_CROSS_ARCH \
+ HOST_CROSS_2ND_ARCH \
+ HOST_BUILD_TYPE \
+ BUILD_ID \
+ OUT_DIR
+
+ifeq ($(TARGET_BUILD_PDK),true)
+print_build_config_vars += \
+ TARGET_BUILD_PDK \
+ PDK_FUSION_PLATFORM_ZIP
+endif
+
# ---------------------------------------------------------------
# the setpath shell function in envsetup.sh uses this to figure out
# what to add to the path given the config we have chosen.
@@ -38,11 +70,7 @@
absolute_dumpvar := $(strip $(filter abs-%,$(dumpvar_goals)))
ifdef absolute_dumpvar
dumpvar_goals := $(patsubst abs-%,%,$(dumpvar_goals))
- ifneq ($(filter /%,$($(dumpvar_goals))),)
- DUMPVAR_VALUE := $($(dumpvar_goals))
- else
- DUMPVAR_VALUE := $(PWD)/$($(dumpvar_goals))
- endif
+ DUMPVAR_VALUE := $(abspath $($(dumpvar_goals)))
dumpvar_target := dumpvar-abs-$(dumpvar_goals)
else
DUMPVAR_VALUE := $($(dumpvar_goals))
@@ -59,38 +87,37 @@
PRINT_BUILD_CONFIG:=
endif
-endif # CALLED_FROM_SETUP
-
-
-ifneq ($(PRINT_BUILD_CONFIG),)
-HOST_OS_EXTRA:=$(shell python -c "import platform; print(platform.platform())")
-$(info ============================================)
-$(info PLATFORM_VERSION_CODENAME=$(PLATFORM_VERSION_CODENAME))
-$(info PLATFORM_VERSION=$(PLATFORM_VERSION))
-$(info TARGET_PRODUCT=$(TARGET_PRODUCT))
-$(info TARGET_BUILD_VARIANT=$(TARGET_BUILD_VARIANT))
-$(info TARGET_BUILD_TYPE=$(TARGET_BUILD_TYPE))
-$(info TARGET_BUILD_APPS=$(TARGET_BUILD_APPS))
-$(info TARGET_ARCH=$(TARGET_ARCH))
-$(info TARGET_ARCH_VARIANT=$(TARGET_ARCH_VARIANT))
-$(info TARGET_CPU_VARIANT=$(TARGET_CPU_VARIANT))
-$(info TARGET_2ND_ARCH=$(TARGET_2ND_ARCH))
-$(info TARGET_2ND_ARCH_VARIANT=$(TARGET_2ND_ARCH_VARIANT))
-$(info TARGET_2ND_CPU_VARIANT=$(TARGET_2ND_CPU_VARIANT))
-$(info HOST_ARCH=$(HOST_ARCH))
-$(info HOST_2ND_ARCH=$(HOST_2ND_ARCH))
-$(info HOST_OS=$(HOST_OS))
-$(info HOST_OS_EXTRA=$(HOST_OS_EXTRA))
-$(info HOST_CROSS_OS=$(HOST_CROSS_OS))
-$(info HOST_CROSS_ARCH=$(HOST_CROSS_ARCH))
-$(info HOST_CROSS_2ND_ARCH=$(HOST_CROSS_2ND_ARCH))
-$(info HOST_BUILD_TYPE=$(HOST_BUILD_TYPE))
-$(info BUILD_ID=$(BUILD_ID))
-$(info OUT_DIR=$(OUT_DIR))
-ifeq ($(TARGET_BUILD_PDK),true)
-$(info TARGET_BUILD_PDK=$(TARGET_BUILD_PDK))
-$(info PDK_FUSION_PLATFORM_ZIP=$(PDK_FUSION_PLATFORM_ZIP))
+ifneq ($(filter report_config,$(DUMP_MANY_VARS)),)
+# Construct the shell commands that print the config banner.
+report_config_sh := echo '============================================';
+report_config_sh += $(foreach v,$(print_build_config_vars),echo '$v=$($(v))';)
+report_config_sh += echo '============================================';
endif
+# Dump mulitple variables to "<var>=<value>" pairs, one per line.
+# The output may be executed as bash script.
+# Input variables:
+# DUMP_MANY_VARS: the list of variable names.
+# DUMP_VAR_PREFIX: an optional prefix of the variable name added to the output.
+# DUMP_MANY_ABS_VARS: the list of abs variable names.
+# DUMP_ABS_VAR_PREFIX: an optional prefix of the abs variable name added to the output.
+.PHONY: dump-many-vars
+dump-many-vars :
+ @$(foreach v, $(filter-out report_config, $(DUMP_MANY_VARS)),\
+ echo "$(DUMP_VAR_PREFIX)$(v)='$($(v))'";)
+ifneq ($(filter report_config, $(DUMP_MANY_VARS)),)
+ @# Construct a special variable for report_config.
+ @# Escape \` to defer the execution of report_config_sh to preserve the line breaks.
+ @echo "$(DUMP_VAR_PREFIX)report_config=\`$(report_config_sh)\`"
+endif
+ @$(foreach v, $(sort $(DUMP_MANY_ABS_VARS)),\
+ echo "$(DUMP_ABS_VAR_PREFIX)$(v)='$(abspath $($(v)))'";)
+
+endif # CALLED_FROM_SETUP
+
+ifneq ($(PRINT_BUILD_CONFIG),)
+$(info ============================================)
+$(foreach v, $(print_build_config_vars),\
+ $(info $v=$($(v))))
$(info ============================================)
endif
diff --git a/core/dynamic_binary.mk b/core/dynamic_binary.mk
index d6f6cc9..7ed5c35 100644
--- a/core/dynamic_binary.mk
+++ b/core/dynamic_binary.mk
@@ -46,7 +46,9 @@
my_pack_module_relocations := false
ifneq ($(DISABLE_RELOCATION_PACKER),true)
- my_pack_module_relocations := $(LOCAL_PACK_MODULE_RELOCATIONS)
+ my_pack_module_relocations := $(firstword \
+ $(LOCAL_PACK_MODULE_RELOCATIONS_$($(my_prefix)$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH)) \
+ $(LOCAL_PACK_MODULE_RELOCATIONS))
endif
ifeq ($(my_pack_module_relocations),)
@@ -67,10 +69,10 @@
ifeq (true,$(my_pack_module_relocations))
# Pack relocations
-$(relocation_packer_output): $(relocation_packer_input) | $(ACP)
+$(relocation_packer_output): $(relocation_packer_input)
$(pack-elf-relocations)
else
-$(relocation_packer_output): $(relocation_packer_input) | $(ACP)
+$(relocation_packer_output): $(relocation_packer_input)
@echo "target Unpacked: $(PRIVATE_MODULE) ($@)"
$(copy-file-to-target)
endif
@@ -85,7 +87,7 @@
endif
symbolic_input := $(relocation_packer_output)
symbolic_output := $(my_unstripped_path)/$(my_installed_module_stem)
-$(symbolic_output) : $(symbolic_input) | $(ACP)
+$(symbolic_output) : $(symbolic_input)
@echo "target Symbolic: $(PRIVATE_MODULE) ($@)"
$(copy-file-to-target)
@@ -110,7 +112,9 @@
strip_input := $(symbolic_output)
strip_output := $(LOCAL_BUILT_MODULE)
-my_strip_module := $(LOCAL_STRIP_MODULE)
+my_strip_module := $(firstword \
+ $(LOCAL_STRIP_MODULE_$($(my_prefix)$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH)) \
+ $(LOCAL_STRIP_MODULE))
ifeq ($(my_strip_module),)
my_strip_module := true
endif
@@ -144,18 +148,9 @@
else
# Don't strip the binary, just copy it. We can't skip this step
# because a copy of the binary must appear at LOCAL_BUILT_MODULE.
-#
-# If the binary we're copying is acp or a prerequisite,
-# use cp(1) instead.
-ifneq ($(LOCAL_ACP_UNAVAILABLE),true)
-$(strip_output): $(strip_input) | $(ACP)
- @echo "target Unstripped: $(PRIVATE_MODULE) ($@)"
- $(copy-file-to-target)
-else
$(strip_output): $(strip_input)
@echo "target Unstripped: $(PRIVATE_MODULE) ($@)"
- $(copy-file-to-target-with-cp)
-endif
+ $(copy-file-to-target)
endif # my_strip_module
$(cleantarget): PRIVATE_CLEAN_FILES += \
diff --git a/core/envsetup.mk b/core/envsetup.mk
index 4456809..e8fa6a7 100644
--- a/core/envsetup.mk
+++ b/core/envsetup.mk
@@ -54,6 +54,8 @@
HOST_OS := darwin
endif
+HOST_OS_EXTRA:=$(shell python -c "import platform; print(platform.platform())")
+
# BUILD_OS is the real host doing the build.
BUILD_OS := $(HOST_OS)
diff --git a/core/executable_internal.mk b/core/executable_internal.mk
index 2105f58..febea98 100644
--- a/core/executable_internal.mk
+++ b/core/executable_internal.mk
@@ -70,15 +70,16 @@
$(linked_module): PRIVATE_TARGET_CRTBEGIN_STATIC_O := $(my_target_crtbegin_static_o)
$(linked_module): PRIVATE_TARGET_CRTEND_O := $(my_target_crtend_o)
$(linked_module): PRIVATE_TARGET_OUT_INTERMEDIATE_LIBRARIES := $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_OUT_INTERMEDIATE_LIBRARIES)
+$(linked_module): PRIVATE_POST_LINK_CMD := $(LOCAL_POST_LINK_CMD)
ifeq ($(LOCAL_FORCE_STATIC_EXECUTABLE),true)
-$(linked_module): PRIVATE_POST_LINK_CMD := $(LOCAL_POST_LINK_CMD)
$(linked_module): $(my_target_crtbegin_static_o) $(all_objects) $(all_libraries) $(my_target_crtend_o)
$(transform-o-to-static-executable)
$(PRIVATE_POST_LINK_CMD)
else
$(linked_module): $(my_target_crtbegin_dynamic_o) $(all_objects) $(all_libraries) $(my_target_crtend_o)
$(transform-o-to-executable)
+ $(PRIVATE_POST_LINK_CMD)
endif
endif # skip_build_from_source
diff --git a/core/executable_prefer_symlink.mk b/core/executable_prefer_symlink.mk
index 931550f..1640b32 100644
--- a/core/executable_prefer_symlink.mk
+++ b/core/executable_prefer_symlink.mk
@@ -42,7 +42,7 @@
# $(my_symlink) doesn't need to depend on $(PRIVATE_SRC_BINARY_NAME): we can generate symlink to nonexistent file.
# If you add the dependency, make would compare the timestamp of a file against that of its symlink:
# they are always equal, because make follows symlink.
-$(my_symlink): $(LOCAL_MODULE_MAKEFILE_DEP)
+$(my_symlink):
@echo "Symlink: $@ -> $(PRIVATE_SRC_BINARY_NAME)"
@mkdir -p $(dir $@)
@rm -rf $@
diff --git a/core/goma.mk b/core/goma.mk
index 6535b3e..982160b 100644
--- a/core/goma.mk
+++ b/core/goma.mk
@@ -16,16 +16,6 @@
# Notice: this works only with Google's Goma build infrastructure.
ifneq ($(filter-out false,$(USE_GOMA)),)
- # Check if USE_NINJA is not false because GNU make won't work well
- # with goma. Note this file is evaluated twice, once by GNU make and
- # once by kati with USE_NINJA=false. We do this check in the former
- # pass.
- ifndef KATI
- ifeq ($(USE_NINJA),false)
- $(error USE_GOMA=true is not compatible with USE_NINJA=false)
- endif
- endif
-
# Goma requires a lot of processes and file descriptors.
ifeq ($(shell echo $$(($$(ulimit -u) < 2500 || $$(ulimit -n) < 16000))),1)
$(warning Max user processes and/or open files are insufficient)
diff --git a/core/host_dalvik_java_library.mk b/core/host_dalvik_java_library.mk
index c506969..5b8634e 100644
--- a/core/host_dalvik_java_library.mk
+++ b/core/host_dalvik_java_library.mk
@@ -36,6 +36,7 @@
full_classes_jarjar_jar := $(intermediates.COMMON)/classes-jarjar.jar
full_classes_jar := $(intermediates.COMMON)/classes.jar
full_classes_jack := $(intermediates.COMMON)/classes.jack
+jack_check_timestamp := $(intermediates.COMMON)/jack.check.timestamp
built_dex := $(intermediates.COMMON)/classes.dex
LOCAL_INTERMEDIATE_TARGETS += \
@@ -43,12 +44,17 @@
$(full_classes_jarjar_jar) \
$(full_classes_jack) \
$(full_classes_jar) \
+ $(jack_check_timestamp) \
$(built_dex)
# See comment in java.mk
ifndef LOCAL_CHECKED_MODULE
+ifdef LOCAL_JACK_ENABLED
+LOCAL_CHECKED_MODULE := $(jack_check_timestamp)
+else
LOCAL_CHECKED_MODULE := $(full_classes_compiled_jar)
endif
+endif
#######################################
include $(BUILD_SYSTEM)/base_rules.mk
@@ -76,7 +82,6 @@
$(full_java_lib_deps) \
$(jar_manifest_file) \
$(proto_java_sources_file_stamp) \
- $(LOCAL_MODULE_MAKEFILE_DEP) \
$(LOCAL_ADDITIONAL_DEPENDENCIES)
$(transform-host-java-to-package)
@@ -121,16 +126,21 @@
$(LOCAL_INTERMEDIATE_TARGETS): \
PRIVATE_JACK_INCREMENTAL_DIR :=
endif
+$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_JACK_FLAGS := $(GLOBAL_JAVAC_DEBUG_FLAGS) $(LOCAL_JACK_FLAGS)
+$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_JACK_VERSION := $(LOCAL_JACK_VERSION)
+jack_all_deps := $(java_sources) $(java_resource_sources) $(full_jack_deps) \
+ $(jar_manifest_file) $(proto_java_sources_file_stamp) \
+ $(LOCAL_ADDITIONAL_DEPENDENCIES) $(JACK)
$(built_dex): PRIVATE_CLASSES_JACK := $(full_classes_jack)
-$(built_dex): PRIVATE_JACK_FLAGS := $(GLOBAL_JAVAC_DEBUG_FLAGS) $(LOCAL_JACK_FLAGS)
-$(built_dex): PRIVATE_JACK_VERSION := $(LOCAL_JACK_VERSION)
-$(built_dex): $(java_sources) $(java_resource_sources) $(full_jack_deps) \
- $(jar_manifest_file) $(proto_java_sources_file_stamp) $(LOCAL_MODULE_MAKEFILE_DEP) \
- $(LOCAL_ADDITIONAL_DEPENDENCIES) $(JACK) | setup-jack-server
+$(built_dex): $(jack_all_deps) | setup-jack-server
@echo Building with Jack: $@
$(jack-java-to-dex)
+$(jack_check_timestamp): $(jack_all_deps) | setup-jack-server
+ @echo Checking build with Jack: $@
+ $(jack-check-java)
+
# $(full_classes_jack) is just by-product of $(built_dex).
# The dummy command was added because, without it, make misses the fact the $(built_dex) also
# change $(full_classes_jack).
diff --git a/core/host_dalvik_static_java_library.mk b/core/host_dalvik_static_java_library.mk
index e6638be..bdb13b7 100644
--- a/core/host_dalvik_static_java_library.mk
+++ b/core/host_dalvik_static_java_library.mk
@@ -35,8 +35,9 @@
include $(BUILD_SYSTEM)/host_java_library.mk
# proguard is not supported
# *.proto files are not supported
-$(full_classes_jack): PRIVATE_JACK_FLAGS := $(GLOBAL_JAVAC_DEBUG_FLAGS) $(LOCAL_JACK_FLAGS)
-$(full_classes_jack): PRIVATE_JACK_VERSION := $(LOCAL_JACK_VERSION)
+$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_JACK_FLAGS := $(GLOBAL_JAVAC_DEBUG_FLAGS) $(LOCAL_JACK_FLAGS)
+$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_JACK_VERSION := $(LOCAL_JACK_VERSION)
+
$(full_classes_jack): PRIVATE_JARJAR_RULES := $(LOCAL_JARJAR_RULES)
$(full_classes_jack): \
PRIVATE_JACK_INTERMEDIATES_DIR := $(intermediates.COMMON)/jack-rsc
@@ -48,7 +49,7 @@
PRIVATE_JACK_INCREMENTAL_DIR :=
endif
$(full_classes_jack): $(java_sources) $(java_resource_sources) $(full_jack_deps) \
- $(jar_manifest_file) $(layers_file) $(LOCAL_MODULE_MAKEFILE_DEP) \
+ $(jar_manifest_file) $(layers_file) \
$(LOCAL_ADDITIONAL_DEPENDENCIES) $(LOCAL_JARJAR_RULES) \
$(JACK) | setup-jack-server
@echo Building with Jack: $@
diff --git a/core/host_java_library.mk b/core/host_java_library.mk
index 052c571..9a13439 100644
--- a/core/host_java_library.mk
+++ b/core/host_java_library.mk
@@ -30,13 +30,15 @@
endif
full_classes_compiled_jar := $(intermediates.COMMON)/classes-full-debug.jar
+full_classes_jarjar_jar := $(intermediates.COMMON)/classes-jarjar.jar
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/$(notdir $(full_classes_compiled_jar))
+full_classes_emma_jar := $(emma_intermediates_dir)/lib/$(notdir $(full_classes_jarjar_jar))
LOCAL_INTERMEDIATE_TARGETS += \
$(full_classes_compiled_jar) \
+ $(full_classes_jarjar_jar) \
$(full_classes_emma_jar)
#######################################
@@ -49,30 +51,6 @@
include $(BUILD_SYSTEM)/java_common.mk
-ifeq (true,$(LOCAL_EMMA_INSTRUMENT))
-$(full_classes_emma_jar): PRIVATE_EMMA_COVERAGE_FILE := $(intermediates.COMMON)/coverage.em
-$(full_classes_emma_jar): PRIVATE_EMMA_INTERMEDIATES_DIR := $(emma_intermediates_dir)
-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_compiled_jar) | $(EMMA_JAR)
- $(transform-classes.jar-to-emma)
-
-$(built_javalib_jar) : $(full_classes_emma_jar)
- @echo Copying: $@
- $(hide) $(ACP) -fp $< $@
-
-else # LOCAL_EMMA_INSTRUMENT
-# Directly build into $(built_javalib_jar).
-full_classes_compiled_jar := $(built_javalib_jar)
-endif # LOCAL_EMMA_INSTRUMENT
-
# The layers file allows you to enforce a layering between java packages.
# Run build/tools/java-layers.py for more details.
layers_file := $(addprefix $(LOCAL_PATH)/, $(LOCAL_JAVA_LAYERS_FILE))
@@ -88,6 +66,43 @@
$(full_java_lib_deps) \
$(jar_manifest_file) \
$(proto_java_sources_file_stamp) \
- $(LOCAL_MODULE_MAKEFILE_DEP) \
$(LOCAL_ADDITIONAL_DEPENDENCIES)
$(transform-host-java-to-package)
+
+# Run jarjar if necessary, otherwise just copy the file.
+ifneq ($(strip $(LOCAL_JARJAR_RULES)),)
+$(full_classes_jarjar_jar): PRIVATE_JARJAR_RULES := $(LOCAL_JARJAR_RULES)
+$(full_classes_jarjar_jar): $(full_classes_compiled_jar) $(LOCAL_JARJAR_RULES) | $(JARJAR)
+ @echo JarJar: $@
+ $(hide) java -jar $(JARJAR) process $(PRIVATE_JARJAR_RULES) $< $@
+else
+$(full_classes_jarjar_jar): $(full_classes_compiled_jar) | $(ACP)
+ @echo Copying: $@
+ $(hide) $(ACP) -fp $< $@
+endif
+
+ifeq (true,$(LOCAL_EMMA_INSTRUMENT))
+$(full_classes_emma_jar): PRIVATE_EMMA_COVERAGE_FILE := $(intermediates.COMMON)/coverage.em
+$(full_classes_emma_jar): PRIVATE_EMMA_INTERMEDIATES_DIR := $(emma_intermediates_dir)
+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)
+
+$(built_javalib_jar) : $(full_classes_emma_jar)
+ @echo Copying: $@
+ $(hide) $(ACP) -fp $< $@
+
+else # LOCAL_EMMA_INSTRUMENT
+$(built_javalib_jar): $(full_classes_jarjar_jar) | $(ACP)
+ @echo Copying: $@
+ $(hide) $(ACP) -fp $< $@
+endif # LOCAL_EMMA_INSTRUMENT
+
diff --git a/core/host_shared_library_internal.mk b/core/host_shared_library_internal.mk
index 272e76f..bfbde21 100644
--- a/core/host_shared_library_internal.mk
+++ b/core/host_shared_library_internal.mk
@@ -44,7 +44,6 @@
$(LOCAL_BUILT_MODULE): \
$(all_objects) \
$(all_libraries) \
- $(LOCAL_MODULE_MAKEFILE_DEP) \
$(LOCAL_ADDITIONAL_DEPENDENCIES)
$(transform-host-o-to-shared-lib)
diff --git a/core/host_test_internal.mk b/core/host_test_internal.mk
index 7f6aff0..e4fa4c5 100644
--- a/core/host_test_internal.mk
+++ b/core/host_test_internal.mk
@@ -9,6 +9,5 @@
LOCAL_LDLIBS_darwin += -lpthread
LOCAL_CFLAGS += -DGTEST_HAS_STD_STRING -O0 -g
-LOCAL_C_INCLUDES += external/gtest/include
LOCAL_STATIC_LIBRARIES += libgtest_main_host libgtest_host
diff --git a/core/java.mk b/core/java.mk
index 705860b..0ae234a 100644
--- a/core/java.mk
+++ b/core/java.mk
@@ -119,6 +119,7 @@
full_classes_jack := $(intermediates.COMMON)/classes.jack
# intermediate Jack library without shrink and obfuscation
noshrob_classes_jack := $(intermediates.COMMON)/classes.noshrob.jack
+jack_check_timestamp := $(intermediates.COMMON)/jack.check.timestamp
LOCAL_INTERMEDIATE_TARGETS += \
$(full_classes_compiled_jar) \
@@ -129,6 +130,7 @@
$(built_dex_intermediate) \
$(full_classes_jack) \
$(noshrob_classes_jack) \
+ $(jack_check_timestamp) \
$(built_dex) \
$(full_classes_stubs_jar)
@@ -304,7 +306,6 @@
$(aidl_java_sources): $(intermediates.COMMON)/src/%.java: \
$(LOCAL_PATH)/%.aidl \
- $(LOCAL_MODULE_MAKEFILE_DEP) \
$(LOCAL_ADDITIONAL_DEPENDENCIES) \
$(AIDL) \
$(aidl_preprocess_import)
@@ -324,9 +325,13 @@
# 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
#######################################
include $(BUILD_SYSTEM)/base_rules.mk
@@ -413,7 +418,6 @@
$(layers_file) \
$(RenderScript_file_stamp) \
$(proto_java_sources_file_stamp) \
- $(LOCAL_MODULE_MAKEFILE_DEP) \
$(LOCAL_ADDITIONAL_DEPENDENCIES)
$(transform-java-to-classes.jar)
@@ -447,7 +451,7 @@
$(transform-classes.jar-to-emma)
else
-$(full_classes_emma_jar): $(full_classes_jarjar_jar) | $(ACP)
+$(full_classes_emma_jar): $(full_classes_jarjar_jar)
@echo Copying: $@
$(copy-file-to-target)
endif
@@ -563,11 +567,11 @@
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) | $(ACP) $(PROGUARD)
+$(full_classes_proguard_jar) : $(full_classes_jar) $(extra_input_jar) $(my_support_library_sdk_raise) $(proguard_flag_files) | $(PROGUARD)
$(call transform-jar-to-proguard)
else # LOCAL_PROGUARD_ENABLED not defined
-$(full_classes_proguard_jar) : $(full_classes_jar)
+$(full_classes_proguard_jar) : $(full_classes_jar) | $(ACP)
@echo Copying: $@
$(hide) $(ACP) -fp $< $@
@@ -632,9 +636,13 @@
ifeq ($(LOCAL_JACK_ENABLED),incremental)
$(LOCAL_INTERMEDIATE_TARGETS): \
PRIVATE_JACK_INCREMENTAL_DIR := $(intermediates.COMMON)/jack-incremental
+$(noshrob_classes_jack): PRIVATE_JACK_INCREMENTAL_DIR := $(intermediates.COMMON)/jack-noshrob-incremental
+$(jack_check_timestamp): PRIVATE_JACK_INCREMENTAL_DIR := $(intermediates.COMMON)/jack-check-incremental
else
$(LOCAL_INTERMEDIATE_TARGETS): \
PRIVATE_JACK_INCREMENTAL_DIR :=
+$(noshrob_classes_jack): PRIVATE_JACK_INCREMENTAL_DIR :=
+$(jack_check_timestamp): PRIVATE_JACK_INCREMENTAL_DIR :=
endif
ifdef full_classes_jar
@@ -665,7 +673,11 @@
jack_all_deps := $(java_sources) $(java_resource_sources) $(full_jack_deps) \
$(jar_manifest_file) $(layers_file) $(RenderScript_file_stamp) $(proguard_flag_files) \
$(proto_java_sources_file_stamp) $(LOCAL_ADDITIONAL_DEPENDENCIES) $(LOCAL_JARJAR_RULES) \
- $(LOCAL_MODULE_MAKEFILE_DEP) $(JACK)
+ $(JACK)
+
+$(jack_check_timestamp): $(jack_all_deps)
+ @echo Checking build with Jack: $@
+ $(jack-check-java)
ifeq ($(LOCAL_IS_STATIC_JAVA_LIBRARY),true)
$(full_classes_jack): $(jack_all_deps) | setup-jack-server
@@ -704,11 +716,6 @@
endif #LOCAL_IS_STATIC_JAVA_LIBRARY
$(noshrob_classes_jack): PRIVATE_JACK_INTERMEDIATES_DIR := $(intermediates.COMMON)/jack-noshrob-rsc
-ifeq ($(LOCAL_JACK_ENABLED),incremental)
-$(noshrob_classes_jack): PRIVATE_JACK_INCREMENTAL_DIR := $(intermediates.COMMON)/jack-noshrob-incremental
-else
-$(noshrob_classes_jack): PRIVATE_JACK_INCREMENTAL_DIR :=
-endif
$(noshrob_classes_jack): PRIVATE_JACK_PROGUARD_FLAGS :=
$(noshrob_classes_jack): $(jack_all_deps) | setup-jack-server
@echo Building with Jack: $@
diff --git a/core/java_common.mk b/core/java_common.mk
index ddf2958..21cea67 100644
--- a/core/java_common.mk
+++ b/core/java_common.mk
@@ -4,7 +4,11 @@
## Java version
###########################################################
ifeq (,$(LOCAL_JAVA_LANGUAGE_VERSION))
- LOCAL_JAVA_LANGUAGE_VERSION := 1.7
+ ifeq (,$(LEGACY_USE_JAVA7))
+ LOCAL_JAVA_LANGUAGE_VERSION := 1.8
+ else
+ LOCAL_JAVA_LANGUAGE_VERSION := 1.7
+ endif
endif
LOCAL_JAVACFLAGS += -source $(LOCAL_JAVA_LANGUAGE_VERSION) -target $(LOCAL_JAVA_LANGUAGE_VERSION)
@@ -42,6 +46,8 @@
$(call transform-proto-to-java)
#TODO: protoc should output the dependencies introduced by imports.
+
+ALL_MODULES.$(my_register_name).PROTO_FILES := $(proto_sources_fullpath)
endif # proto_sources
#########################################
@@ -169,14 +175,13 @@
ifeq ($(LOCAL_NO_STANDARD_LIBRARIES),true)
my_bootclasspath := ""
else
-my_bootclasspath := $(call java-lib-files,core-oj-hostdex,$(LOCAL_IS_HOST_MODULE)):$(call java-lib-files,core-libart-hostdex,$(LOCAL_IS_HOST_MODULE))
+my_bootclasspath := $(call normalize-path-list,$(call host-dex-java-lib-files,core-oj-hostdex core-libart-hostdex))
endif
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_BOOTCLASSPATH := -bootclasspath $(my_bootclasspath)
-full_shared_java_libs := $(call java-lib-files,$(LOCAL_JAVA_LIBRARIES),$(LOCAL_IS_HOST_MODULE))
-full_java_lib_deps := $(call java-lib-deps,$(LOCAL_JAVA_LIBRARIES),$(LOCAL_IS_HOST_MODULE)) \
- $(full_shared_java_libs)
-else
+full_shared_java_libs := $(call host-dex-java-lib-files,$(LOCAL_JAVA_LIBRARIES))
+full_java_lib_deps := $(full_shared_java_libs)
+else # !USE_CORE_LIB_BOOTCLASSPATH
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_BOOTCLASSPATH :=
full_shared_java_libs := $(addprefix $(HOST_OUT_JAVA_LIBRARIES)/,\
@@ -260,6 +265,9 @@
ifdef aidl_sources
ALL_MODULES.$(my_register_name).AIDL_FILES := $(aidl_sources)
endif
+ifdef renderscript_sources
+ALL_MODULES.$(my_register_name).RS_FILES := $(renderscript_sources_fullpath)
+endif
endif # !LOCAL_IS_HOST_MODULE
$(LOCAL_INTERMEDIATE_TARGETS) : PRIVATE_ALL_JAVA_LIBRARIES := $(full_java_libs)
diff --git a/core/java_library.mk b/core/java_library.mk
index 81a4a6a..8edba55 100644
--- a/core/java_library.mk
+++ b/core/java_library.mk
@@ -103,7 +103,7 @@
ifneq ($(dexpreopt_boot_jar_module),) # boot jar
# boot jar's rules are defined in dex_preopt.mk
dexpreopted_boot_jar := $(DEXPREOPT_BOOT_JAR_DIR_FULL_PATH)/$(dexpreopt_boot_jar_module)_nodex.jar
-$(LOCAL_BUILT_MODULE) : $(dexpreopted_boot_jar) | $(ACP)
+$(LOCAL_BUILT_MODULE) : $(dexpreopted_boot_jar)
$(call copy-file-to-target)
# For libart boot jars, we don't have .odex files.
@@ -114,7 +114,7 @@
@echo "Dexpreopt Jar: $(PRIVATE_MODULE) ($@)"
$(call dexpreopt-one-file,$<,$@)
-$(LOCAL_BUILT_MODULE) : $(common_javalib.jar) | $(ACP)
+$(LOCAL_BUILT_MODULE) : $(common_javalib.jar)
$(call copy-file-to-target)
ifneq (nostripping,$(LOCAL_DEX_PREOPT))
$(call dexpreopt-remove-classes.dex,$@)
@@ -123,7 +123,7 @@
endif # ! boot jar
else # LOCAL_DEX_PREOPT
-$(LOCAL_BUILT_MODULE) : $(common_javalib.jar) | $(ACP)
+$(LOCAL_BUILT_MODULE) : $(common_javalib.jar)
$(call copy-file-to-target)
endif # LOCAL_DEX_PREOPT
diff --git a/core/main.mk b/core/main.mk
index ac71867..85f9117 100644
--- a/core/main.mk
+++ b/core/main.mk
@@ -96,22 +96,15 @@
# and host information.
include $(BUILD_SYSTEM)/config.mk
-relaunch_with_ninja :=
-ifneq ($(USE_NINJA),false)
-ifndef BUILDING_WITH_NINJA
-relaunch_with_ninja := true
-endif
+ifndef KATI
+ifdef USE_NINJA
+$(warning USE_NINJA is ignored. Ninja is always used.)
endif
-ifeq ($(relaunch_with_ninja),true)
# Mark this is a ninja build.
$(shell mkdir -p $(OUT_DIR) && touch $(OUT_DIR)/ninja_build)
include build/core/ninja.mk
-else # !relaunch_with_ninja
-ifndef BUILDING_WITH_NINJA
-# Remove ninja build mark if it exists.
-$(shell rm -f $(OUT_DIR)/ninja_build)
-endif
+else # KATI
# With these files findleaves.py won't be unnecessarily slower even if
# there is a user creates a copy of $(OUT_DIR).
@@ -1120,4 +1113,4 @@
.PHONY: nothing
nothing:
@echo Successfully read the makefiles.
-endif # !relaunch_with_ninja
+endif # KATI
diff --git a/core/ninja.mk b/core/ninja.mk
index 2878514..44c3ef3 100644
--- a/core/ninja.mk
+++ b/core/ninja.mk
@@ -27,6 +27,7 @@
ECLIPSE-% \
PRODUCT-% \
boottarball-nodeps \
+ brillo_tests \
btnod \
build-art% \
build_kernel-nodeps \
@@ -116,6 +117,10 @@
NINJA_ARGS += "-v"
endif
+# Make multiple rules to generate the same target an error instead of
+# proceeding with undefined behavior.
+NINJA_ARGS += -w dupbuild=err
+
ifdef USE_GOMA
KATI_MAKEPARALLEL := $(MAKEPARALLEL)
# Ninja runs remote jobs (i.e., commands which contain gomacc) with
@@ -159,7 +164,8 @@
KATI_LD := $(CLANG_CXX) $(CLANG_HOST_GLOBAL_LDFLAGS)
# Build static ckati. Unfortunately Mac OS X doesn't officially support static exectuables.
ifeq ($(BUILD_OS),linux)
-KATI_LD += -static
+# We need everything in libpthread.a otherwise C++11's threading library will be disabled.
+KATI_LD += -static -Wl,--whole-archive -lpthread -Wl,--no-whole-archive -ldl
endif
KATI_INTERMEDIATES_PATH := $(HOST_OUT_INTERMEDIATES)/EXECUTABLES/ckati_intermediates
diff --git a/core/package_internal.mk b/core/package_internal.mk
index 097d801..1dff269 100644
--- a/core/package_internal.mk
+++ b/core/package_internal.mk
@@ -304,6 +304,7 @@
endif
ifneq ($(full_classes_jack),)
$(full_classes_jack): $(R_file_stamp)
+$(jack_check_timestamp): $(R_file_stamp)
endif
endif # LOCAL_JACK_ENABLED
@@ -497,7 +498,7 @@
$(sign-package)
# Rules to install the splits
-$(installed_apk_splits) : $(my_module_path)/$(LOCAL_MODULE)_%.apk : $(built_module_path)/package_%.apk | $(ACP)
+$(installed_apk_splits) : $(my_module_path)/$(LOCAL_MODULE)_%.apk : $(built_module_path)/package_%.apk
@echo "Install: $@"
$(copy-file-to-new-target)
diff --git a/core/phony_package.mk b/core/phony_package.mk
index 866b13c..b534335 100644
--- a/core/phony_package.mk
+++ b/core/phony_package.mk
@@ -7,7 +7,7 @@
include $(BUILD_SYSTEM)/base_rules.mk
-$(LOCAL_BUILT_MODULE): $(LOCAL_MODULE_MAKEFILE_DEP) $(LOCAL_ADDITIONAL_DEPENDENCIES)
+$(LOCAL_BUILT_MODULE): $(LOCAL_ADDITIONAL_DEPENDENCIES)
$(hide) echo "Fake: $@"
$(hide) mkdir -p $(dir $@)
$(hide) touch $@
diff --git a/core/post_clean.mk b/core/post_clean.mk
index 7fafe4a..f08abff 100644
--- a/core/post_clean.mk
+++ b/core/post_clean.mk
@@ -54,27 +54,30 @@
current_all_packages_config :=
#######################################################
-# Check if we need to delete obsolete aidl-generated java files.
-# When an aidl file gets deleted (or renamed), the generated java file is obsolete.
-previous_aidl_config := $(TARGET_OUT_COMMON_INTERMEDIATES)/previous_aidl_config.mk
-current_aidl_config := $(TARGET_OUT_COMMON_INTERMEDIATES)/current_aidl_config.mk
+# Check if we need to delete obsolete generated java files.
+# When an aidl/proto/etc file gets deleted (or renamed), the generated java file is obsolete.
+previous_gen_java_config := $(TARGET_OUT_COMMON_INTERMEDIATES)/previous_gen_java_config.mk
+current_gen_java_config := $(TARGET_OUT_COMMON_INTERMEDIATES)/current_gen_java_config.mk
-$(shell rm -rf $(current_aidl_config) \
- && mkdir -p $(dir $(current_aidl_config))\
- && touch $(current_aidl_config))
--include $(previous_aidl_config)
+$(shell rm -rf $(current_gen_java_config) \
+ && mkdir -p $(dir $(current_gen_java_config))\
+ && touch $(current_gen_java_config))
+-include $(previous_gen_java_config)
intermediates_to_clean :=
-modules_with_aidl_files :=
+modules_with_gen_java_files :=
$(foreach p, $(ALL_MODULES), \
- $(if $(ALL_MODULES.$(p).AIDL_FILES),\
- $(eval modules_with_aidl_files += $(p))\
- $(shell echo 'AIDL_FILES.$(p) := $(ALL_MODULES.$(p).AIDL_FILES)' >> $(current_aidl_config)))\
- $(if $(filter-out $(ALL_MODULES.$(p).AIDL_FILES),$(AIDL_FILES.$(p))),\
+ $(eval gs := $(strip $(ALL_MODULES.$(p).AIDL_FILES)\
+ $(ALL_MODULES.$(p).PROTO_FILES)\
+ $(ALL_MODULES.$(p).RS_FILES)))\
+ $(if $(gs),\
+ $(eval modules_with_gen_java_files += $(p))\
+ $(shell echo 'GEN_SRC_FILES.$(p) := $(gs)' >> $(current_gen_java_config)))\
+ $(if $(filter-out $(gs),$(GEN_SRC_FILES.$(p))),\
$(eval intermediates_to_clean += $(ALL_MODULES.$(p).INTERMEDIATE_SOURCE_DIR))))
intermediates_to_clean := $(strip $(intermediates_to_clean))
ifdef intermediates_to_clean
-$(info *** Obsolete aidl-generated files detected, clean intermediate files...)
+$(info *** Obsolete generated java files detected, clean intermediate files...)
$(info *** rm -rf $(intermediates_to_clean))
$(shell rm -rf $(intermediates_to_clean))
intermediates_to_clean :=
@@ -82,15 +85,15 @@
# For modules not loaded by the current build (e.g. you are running mm/mmm),
# we copy the info from the previous bulid.
-$(foreach p, $(filter-out $(ALL_MODULES),$(MODULES_WITH_AIDL_FILES)),\
- $(shell echo 'AIDL_FILES.$(p) := $(AIDL_FILES.$(p))' >> $(current_aidl_config)))
-MODULES_WITH_AIDL_FILES := $(sort $(MODULES_WITH_AIDL_FILES) $(modules_with_aidl_files))
-$(shell echo 'MODULES_WITH_AIDL_FILES := $(MODULES_WITH_AIDL_FILES)' >> $(current_aidl_config))
+$(foreach p, $(filter-out $(ALL_MODULES),$(MODULES_WITH_GEN_JAVA_FILES)),\
+ $(shell echo 'GEN_SRC_FILES.$(p) := $(GEN_SRC_FILES.$(p))' >> $(current_gen_java_config)))
+MODULES_WITH_GEN_JAVA_FILES := $(sort $(MODULES_WITH_GEN_JAVA_FILES) $(modules_with_gen_java_files))
+$(shell echo 'MODULES_WITH_GEN_JAVA_FILES := $(MODULES_WITH_GEN_JAVA_FILES)' >> $(current_gen_java_config))
# Now current becomes previous.
-$(shell cmp $(current_aidl_config) $(previous_aidl_config) > /dev/null 2>&1 || mv -f $(current_aidl_config) $(previous_aidl_config))
+$(shell cmp $(current_gen_java_config) $(previous_gen_java_config) > /dev/null 2>&1 || mv -f $(current_gen_java_config) $(previous_gen_java_config))
-MODULES_WITH_AIDL_FILES :=
-modules_with_aidl_files :=
-previous_aidl_config :=
-current_aidl_config :=
+MODULES_WITH_GEN_JAVA_FILES :=
+modules_with_gen_java_files :=
+previous_gen_java_config :=
+current_gen_java_config :=
diff --git a/core/prebuilt_internal.mk b/core/prebuilt_internal.mk
index 286670b..f9ec7d5 100644
--- a/core/prebuilt_internal.mk
+++ b/core/prebuilt_internal.mk
@@ -38,22 +38,29 @@
endif
endif
+my_strip_module := $(firstword \
+ $(LOCAL_STRIP_MODULE_$($(my_prefix)$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH)) \
+ $(LOCAL_STRIP_MODULE))
+my_pack_module_relocations := $(firstword \
+ $(LOCAL_PACK_MODULE_RELOCATIONS_$($(my_prefix)$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH)) \
+ $(LOCAL_PACK_MODULE_RELOCATIONS))
+
ifeq (SHARED_LIBRARIES,$(LOCAL_MODULE_CLASS))
# Put the built targets of all shared libraries in a common directory
# to simplify the link line.
OVERRIDE_BUILT_MODULE_PATH := $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)OUT_INTERMEDIATE_LIBRARIES)
- ifeq ($(LOCAL_IS_HOST_MODULE)$(LOCAL_STRIP_MODULE),)
+ ifeq ($(LOCAL_IS_HOST_MODULE)$(my_strip_module),)
# Strip but not try to add debuglink
- LOCAL_STRIP_MODULE := no_debuglink
+ my_strip_module := no_debuglink
endif
- ifeq ($(LOCAL_IS_HOST_MODULE)$(LOCAL_PACK_MODULE_RELOCATIONS),)
+ ifeq ($(LOCAL_IS_HOST_MODULE)$(my_pack_module_relocations),)
# Do not pack relocations by default
- LOCAL_PACK_MODULE_RELOCATIONS := false
+ my_pack_module_relocations := false
endif
ifeq ($(DISABLE_RELOCATION_PACKER),true)
- LOCAL_PACK_MODULE_RELOCATIONS := false
+ my_pack_module_relocations := false
endif
endif
@@ -75,7 +82,7 @@
LOCAL_INSTALLED_MODULE_STEM := $(LOCAL_MODULE).apk
endif
-ifneq ($(filter true no_debuglink,$(LOCAL_STRIP_MODULE) $(LOCAL_PACK_MODULE_RELOCATIONS)),)
+ifneq ($(filter true no_debuglink,$(my_strip_module) $(my_pack_module_relocations)),)
ifdef LOCAL_IS_HOST_MODULE
$(error Cannot strip/pack host module LOCAL_PATH=$(LOCAL_PATH))
endif
@@ -85,17 +92,20 @@
ifneq ($(LOCAL_PREBUILT_STRIP_COMMENTS),)
$(error Cannot strip/pack scripts LOCAL_PATH=$(LOCAL_PATH))
endif
+ # Set the arch-specific variables to set up the strip/pack rules.
+ LOCAL_STRIP_MODULE_$($(my_prefix)$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH) := $(my_strip_module)
+ LOCAL_PACK_MODULE_RELOCATIONS_$($(my_prefix)$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH) := $(my_pack_module_relocations)
include $(BUILD_SYSTEM)/dynamic_binary.mk
built_module := $(linked_module)
-else # LOCAL_STRIP_MODULE and LOCAL_PACK_MODULE_RELOCATIONS not true
+else # my_strip_module and my_pack_module_relocations not true
include $(BUILD_SYSTEM)/base_rules.mk
built_module := $(LOCAL_BUILT_MODULE)
ifdef prebuilt_module_is_a_library
export_includes := $(intermediates)/export_includes
$(export_includes): PRIVATE_EXPORT_C_INCLUDE_DIRS := $(LOCAL_EXPORT_C_INCLUDE_DIRS)
-$(export_includes) : $(LOCAL_MODULE_MAKEFILE_DEP)
+$(export_includes) :
@echo Export includes file: $< -- $@
$(hide) mkdir -p $(dir $@) && rm -f $@
ifdef LOCAL_EXPORT_C_INCLUDE_DIRS
@@ -130,8 +140,8 @@
endif
# We need to enclose the above export_includes and my_built_shared_libraries in
-# "LOCAL_STRIP_MODULE not true" because otherwise the rules are defined in dynamic_binary.mk.
-endif # LOCAL_STRIP_MODULE not true
+# "my_strip_module not true" because otherwise the rules are defined in dynamic_binary.mk.
+endif # my_strip_module not true
ifeq ($(LOCAL_MODULE_CLASS),APPS)
PACKAGES.$(LOCAL_MODULE).OVERRIDES := $(strip $(LOCAL_OVERRIDES_PACKAGES))
@@ -216,7 +226,7 @@
endif
$(built_module): PRIVATE_EMBEDDED_JNI_LIBS := $(embedded_prebuilt_jni_libs)
-$(built_module) : $(my_prebuilt_src_file) | $(ACP) $(ZIPALIGN) $(SIGNAPK_JAR) $(AAPT)
+$(built_module) : $(my_prebuilt_src_file) | $(ZIPALIGN) $(SIGNAPK_JAR) $(AAPT)
$(transform-prebuilt-to-target)
$(uncompress-shared-libs)
ifneq ($(LOCAL_CERTIFICATE),PRESIGNED)
@@ -255,12 +265,12 @@
$(built_apk_splits) : PRIVATE_PRIVATE_KEY := $(LOCAL_CERTIFICATE).pk8
$(built_apk_splits) : PRIVATE_CERTIFICATE := $(LOCAL_CERTIFICATE).x509.pem
-$(built_apk_splits) : $(built_module_path)/%.apk : $(my_src_dir)/%.apk | $(ACP) $(AAPT)
+$(built_apk_splits) : $(built_module_path)/%.apk : $(my_src_dir)/%.apk | $(AAPT)
$(copy-file-to-new-target)
$(sign-package)
# Rules to install the split apks.
-$(installed_apk_splits) : $(my_module_path)/%.apk : $(built_module_path)/%.apk | $(ACP)
+$(installed_apk_splits) : $(my_module_path)/%.apk : $(built_module_path)/%.apk
@echo "Install: $@"
$(copy-file-to-new-target)
@@ -275,18 +285,17 @@
endif # LOCAL_PACKAGE_SPLITS
else # LOCAL_MODULE_CLASS != APPS
-ifneq ($(LOCAL_PREBUILT_STRIP_COMMENTS),)
+
$(built_module) : $(my_prebuilt_src_file)
+ifneq ($(LOCAL_PREBUILT_STRIP_COMMENTS),)
$(transform-prebuilt-to-target-strip-comments)
else
-ifneq ($(LOCAL_ACP_UNAVAILABLE),true)
-$(built_module) : $(my_prebuilt_src_file) | $(ACP)
$(transform-prebuilt-to-target)
-else
-$(built_module) : $(my_prebuilt_src_file)
- $(copy-file-to-target-with-cp)
endif
+ifeq ($(LOCAL_MODULE_CLASS),EXECUTABLES)
+ $(hide) chmod +x $@
endif
+
endif # LOCAL_MODULE_CLASS != APPS
ifeq ($(LOCAL_MODULE_CLASS),JAVA_LIBRARIES)
@@ -312,10 +321,10 @@
$(hide) touch $@
endif
-$(common_classes_jar) : $(my_src_jar) | $(ACP)
+$(common_classes_jar) : $(my_src_jar)
$(transform-prebuilt-to-target)
-$(common_javalib_jar) : $(common_classes_jar) | $(ACP)
+$(common_javalib_jar) : $(common_classes_jar)
$(transform-prebuilt-to-target)
$(call define-jar-to-toc-rule, $(common_classes_jar))
@@ -330,7 +339,7 @@
# 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 : $(my_src_jar) $(LOCAL_MODULE_MAKEFILE_DEP) \
+$(intermediates.COMMON)/classes.jack : $(my_src_jar) \
$(LOCAL_ADDITIONAL_DEPENDENCIES) $(JACK) | setup-jack-server
$(transform-jar-to-jack)
@@ -341,6 +350,6 @@
endif # JAVA_LIBRARIES
-$(built_module) : $(LOCAL_MODULE_MAKEFILE_DEP) $(LOCAL_ADDITIONAL_DEPENDENCIES)
+$(built_module) : $(LOCAL_ADDITIONAL_DEPENDENCIES)
my_prebuilt_src_file :=
diff --git a/core/product.mk b/core/product.mk
index 4d35704..7043cff 100644
--- a/core/product.mk
+++ b/core/product.mk
@@ -23,14 +23,21 @@
# and the .mk suffix) of the product makefile, "<product_name>:" can be
# omitted.
+# Search for AndroidProducts.mks in the given dir.
+# $(1): the path to the dir
+define _search-android-products-files-in-dir
+$(sort $(shell test -d $(1) && find -L $(1) \
+ -maxdepth 6 \
+ -name .git -prune \
+ -o -name AndroidProducts.mk -print))
+endef
+
#
# Returns the list of all AndroidProducts.mk files.
# $(call ) isn't necessary.
#
define _find-android-products-files
-$(sort $(shell test -d device && find -L device -maxdepth 6 -name AndroidProducts.mk)) \
- $(sort $(shell test -d vendor && find -L vendor -maxdepth 6 -name AndroidProducts.mk)) \
- $(sort $(shell test -d product && find -L product -maxdepth 6 -name AndroidProducts.mk)) \
+$(foreach d, device vendor product,$(call _search-android-products-files-in-dir,$(d))) \
$(SRC_TARGET_DIR)/product/AndroidProducts.mk
endef
diff --git a/core/shared_library_internal.mk b/core/shared_library_internal.mk
index b9a5e3e..6fec460 100644
--- a/core/shared_library_internal.mk
+++ b/core/shared_library_internal.mk
@@ -76,7 +76,6 @@
$(all_libraries) \
$(my_target_crtbegin_so_o) \
$(my_target_crtend_so_o) \
- $(LOCAL_MODULE_MAKEFILE_DEP) \
$(LOCAL_ADDITIONAL_DEPENDENCIES)
$(transform-o-to-shared-lib)
diff --git a/core/soong.mk b/core/soong.mk
index 578aac9..f48e15e 100644
--- a/core/soong.mk
+++ b/core/soong.mk
@@ -26,11 +26,10 @@
$(hide) mkdir -p $(dir $@)
$(hide) (\
echo '{'; \
- echo ' "Device_uses_jemalloc": $(if $(filter true,$(MALLOC_SVELTE)),false,true),'; \
- echo ' "Device_uses_dlmalloc": $(if $(filter true,$(MALLOC_SVELTE)),true,false),'; \
echo ' "Platform_sdk_version": $(PLATFORM_SDK_VERSION),'; \
echo ' "Unbundled_build": $(if $(TARGET_BUILD_APPS),true,false),'; \
echo ' "Brillo": $(if $(BRILLO),true,false),'; \
+ echo ' "Malloc_not_svelte": $(if $(filter true,$(MALLOC_SVELTE)),false,true),'; \
echo ''; \
echo ' "DeviceName": "$(TARGET_DEVICE)",'; \
echo ' "DeviceArch": "$(TARGET_ARCH)",'; \
diff --git a/core/static_java_library.mk b/core/static_java_library.mk
index d956124..8913ee4 100644
--- a/core/static_java_library.mk
+++ b/core/static_java_library.mk
@@ -130,6 +130,7 @@
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)
diff --git a/core/static_library_internal.mk b/core/static_library_internal.mk
index cabe823..2b49046 100644
--- a/core/static_library_internal.mk
+++ b/core/static_library_internal.mk
@@ -20,14 +20,6 @@
include $(BUILD_SYSTEM)/binary.mk
-ifeq ($(LOCAL_RAW_STATIC_LIBRARY),true)
-LOCAL_RAW_STATIC_LIBRARY:=
-$(all_objects) : PRIVATE_TARGET_PROJECT_INCLUDES :=
-$(all_objects) : PRIVATE_TARGET_C_INCLUDES :=
-$(all_objects) : PRIVATE_TARGET_GLOBAL_CFLAGS :=
-$(all_objects) : PRIVATE_TARGET_GLOBAL_CPPFLAGS :=
-endif
-
$(LOCAL_BUILT_MODULE) : $(built_whole_libraries)
$(LOCAL_BUILT_MODULE) : $(all_objects)
$(transform-o-to-static-lib)
diff --git a/core/target_test_internal.mk b/core/target_test_internal.mk
index 4715fe8..030ca40 100644
--- a/core/target_test_internal.mk
+++ b/core/target_test_internal.mk
@@ -4,8 +4,6 @@
LOCAL_CFLAGS += -DGTEST_OS_LINUX_ANDROID -DGTEST_HAS_STD_STRING
-LOCAL_C_INCLUDES += external/gtest/include
-
ifndef LOCAL_SDK_VERSION
LOCAL_STATIC_LIBRARIES += libgtest_main libgtest
else
diff --git a/envsetup.sh b/envsetup.sh
index 61b9ff0..deb6e92 100644
--- a/envsetup.sh
+++ b/envsetup.sh
@@ -37,9 +37,62 @@
echo $A
}
+# Get all the build variables needed by this script in a single call to the build system.
+function build_build_var_cache()
+{
+ T=$(gettop)
+ # Grep out the variable names from the script.
+ cached_vars=`cat $T/build/envsetup.sh | tr '()' ' ' | awk '{for(i=1;i<=NF;i++) if($i~/get_build_var/) print $(i+1)}' | sort -u | tr '\n' ' '`
+ cached_abs_vars=`cat $T/build/envsetup.sh | tr '()' ' ' | awk '{for(i=1;i<=NF;i++) if($i~/get_abs_build_var/) print $(i+1)}' | sort -u | tr '\n' ' '`
+ # Call the build system to dump the "<val>=<value>" pairs as a shell script.
+ build_dicts_script=`\cd $T; CALLED_FROM_SETUP=true BUILD_SYSTEM=build/core \
+ command make --no-print-directory -f build/core/config.mk \
+ dump-many-vars \
+ DUMP_MANY_VARS="$cached_vars" \
+ DUMP_MANY_ABS_VARS="$cached_abs_vars" \
+ DUMP_VAR_PREFIX="var_cache_" \
+ DUMP_ABS_VAR_PREFIX="abs_var_cache_"`
+ local ret=$?
+ if [ $ret -ne 0 ]
+ then
+ unset build_dicts_script
+ return $ret
+ fi
+ # Excute the script to store the "<val>=<value>" pairs as shell variables.
+ eval "$build_dicts_script"
+ ret=$?
+ unset build_dicts_script
+ if [ $ret -ne 0 ]
+ then
+ return $ret
+ fi
+ BUILD_VAR_CACHE_READY="true"
+}
+
+# Delete the build var cache, so that we can still call into the build system
+# to get build variables not listed in this script.
+function destroy_build_var_cache()
+{
+ unset BUILD_VAR_CACHE_READY
+ for v in $cached_vars; do
+ unset var_cache_$v
+ done
+ unset cached_vars
+ for v in $cached_abs_vars; do
+ unset abs_var_cache_$v
+ done
+ unset cached_abs_vars
+}
+
# Get the value of a build variable as an absolute path.
function get_abs_build_var()
{
+ if [ "$BUILD_VAR_CACHE_READY" = "true" ]
+ then
+ eval echo \"\${abs_var_cache_$1}\"
+ return
+ fi
+
T=$(gettop)
if [ ! "$T" ]; then
echo "Couldn't locate the top of the tree. Try setting TOP." >&2
@@ -52,6 +105,12 @@
# Get the exact value of a build variable.
function get_build_var()
{
+ if [ "$BUILD_VAR_CACHE_READY" = "true" ]
+ then
+ eval echo \"\${var_cache_$1}\"
+ return
+ fi
+
T=$(gettop)
if [ ! "$T" ]; then
echo "Couldn't locate the top of the tree. Try setting TOP." >&2
@@ -321,7 +380,9 @@
fi
done
+ build_build_var_cache
set_stuff_for_environment
+ destroy_build_var_cache
}
#
@@ -338,6 +399,7 @@
default_value=aosp_arm
fi
+ export TARGET_BUILD_APPS=
export TARGET_PRODUCT=
local ANSWER
while [ -z "$TARGET_PRODUCT" ]
@@ -365,7 +427,9 @@
fi
done
+ build_build_var_cache
set_stuff_for_environment
+ destroy_build_var_cache
}
function choosevariant()
@@ -428,8 +492,10 @@
choosevariant $3
echo
+ build_build_var_cache
set_stuff_for_environment
printconfig
+ destroy_build_var_cache
}
# Clear this variable. It will be built up again when the vendorsetup.sh
@@ -511,16 +577,6 @@
export TARGET_BUILD_APPS=
- local product=$(echo -n $selection | sed -e "s/-.*$//")
- check_product $product
- if [ $? -ne 0 ]
- then
- echo
- echo "** Don't have a product spec for: '$product'"
- echo "** Do you have the right repo manifest?"
- product=
- fi
-
local variant=$(echo -n $selection | sed -e "s/^[^\-]*-//")
check_variant $variant
if [ $? -ne 0 ]
@@ -531,6 +587,18 @@
variant=
fi
+ local product=$(echo -n $selection | sed -e "s/-.*$//")
+ TARGET_PRODUCT=$product \
+ TARGET_BUILD_VARIANT=$variant \
+ build_build_var_cache
+ if [ $? -ne 0 ]
+ then
+ echo
+ echo "** Don't have a product spec for: '$product'"
+ echo "** Do you have the right repo manifest?"
+ product=
+ fi
+
if [ -z "$product" -o -z "$variant" ]
then
echo
@@ -545,6 +613,7 @@
set_stuff_for_environment
printconfig
+ destroy_build_var_cache
}
# Tab completion for lunch.
@@ -607,8 +676,10 @@
export TARGET_BUILD_TYPE=release
export TARGET_BUILD_APPS=$apps
+ build_build_var_cache
set_stuff_for_environment
printconfig
+ destroy_build_var_cache
}
function gettop
@@ -644,11 +715,18 @@
local T="$1"
test "$WITH_STATIC_ANALYZER" = "0" && unset WITH_STATIC_ANALYZER
if [ -n "$WITH_STATIC_ANALYZER" ]; then
+ # Use scan-build to collect all static analyzer reports into directory
+ # /tmp/scan-build-yyyy-mm-dd-hhmmss-*
+ # The clang compiler passed by --use-analyzer here is not important.
+ # build/core/binary.mk will set CLANG_CXX and CLANG before calling
+ # c++-analyzer and ccc-analyzer.
+ local CLANG_VERSION=$(get_build_var LLVM_PREBUILTS_VERSION)
+ local BUILD_OS=$(get_build_var BUILD_OS)
+ local CLANG_DIR="$T/prebuilts/clang/host/${BUILD_OS}-x86/${CLANG_VERSION}"
echo "\
-$T/prebuilts/misc/linux-x86/analyzer/tools/scan-build/scan-build \
---use-analyzer $T/prebuilts/misc/linux-x86/analyzer/bin/analyzer \
---status-bugs \
---top=$T"
+${CLANG_DIR}/tools/scan-build/bin/scan-build \
+--use-analyzer ${CLANG_DIR}/bin/clang \
+--status-bugs"
fi
}
@@ -871,18 +949,18 @@
append='$'
shift
elif [ "$1" = "--help" -o "$1" = "-h" ]; then
- echo "usage: qpid [[--exact] <process name|pid>"
- return 255
- fi
+ echo "usage: qpid [[--exact] <process name|pid>"
+ return 255
+ fi
local EXE="$1"
if [ "$EXE" ] ; then
- qpid | \grep "$prepend$EXE$append"
- else
- adb shell ps \
- | tr -d '\r' \
- | sed -e 1d -e 's/^[^ ]* *\([0-9]*\).* \([^ ]*\)$/\1 \2/'
- fi
+ qpid | \grep "$prepend$EXE$append"
+ else
+ adb shell ps \
+ | tr -d '\r' \
+ | sed -e 1d -e 's/^[^ ]* *\([0-9]*\).* \([^ ]*\)$/\1 \2/'
+ fi
}
function pid()
@@ -903,7 +981,7 @@
echo "$PID"
else
echo "usage: pid [--exact] <process name>"
- return 255
+ return 255
fi
}
@@ -916,25 +994,25 @@
function coredump_setup()
{
- echo "Getting root...";
- adb root;
- adb wait-for-device;
+ echo "Getting root...";
+ adb root;
+ adb wait-for-device;
- echo "Remounting root partition read-write...";
- adb shell mount -w -o remount -t rootfs rootfs;
- sleep 1;
- adb wait-for-device;
- adb shell mkdir -p /cores;
- adb shell mount -t tmpfs tmpfs /cores;
- adb shell chmod 0777 /cores;
+ echo "Remounting root partition read-write...";
+ adb shell mount -w -o remount -t rootfs rootfs;
+ sleep 1;
+ adb wait-for-device;
+ adb shell mkdir -p /cores;
+ adb shell mount -t tmpfs tmpfs /cores;
+ adb shell chmod 0777 /cores;
- echo "Granting SELinux permission to dump in /cores...";
- adb shell restorecon -R /cores;
+ echo "Granting SELinux permission to dump in /cores...";
+ adb shell restorecon -R /cores;
- echo "Set core pattern.";
- adb shell 'echo /cores/core.%p > /proc/sys/kernel/core_pattern';
+ echo "Set core pattern.";
+ adb shell 'echo /cores/core.%p > /proc/sys/kernel/core_pattern';
- echo "Done."
+ echo "Done."
}
# coredump_enable - enable core dumps for the specified process
@@ -945,13 +1023,13 @@
function coredump_enable()
{
- local PID=$1;
- if [ -z "$PID" ]; then
- printf "Expecting a PID!\n";
- return;
- fi;
- echo "Setting core limit for $PID to infinite...";
- adb shell prlimit $PID 4 -1 -1
+ local PID=$1;
+ if [ -z "$PID" ]; then
+ printf "Expecting a PID!\n";
+ return;
+ fi;
+ echo "Setting core limit for $PID to infinite...";
+ adb shell prlimit $PID 4 -1 -1
}
# core - send SIGV and pull the core for process
@@ -962,28 +1040,28 @@
function core()
{
- local PID=$1;
+ local PID=$1;
- if [ -z "$PID" ]; then
- printf "Expecting a PID!\n";
- return;
- fi;
+ if [ -z "$PID" ]; then
+ printf "Expecting a PID!\n";
+ return;
+ fi;
- local CORENAME=core.$PID;
- local COREPATH=/cores/$CORENAME;
- local SIG=SEGV;
+ local CORENAME=core.$PID;
+ local COREPATH=/cores/$CORENAME;
+ local SIG=SEGV;
- coredump_enable $1;
+ coredump_enable $1;
- local done=0;
- while [ $(adb shell "[ -d /proc/$PID ] && echo -n yes") ]; do
- printf "\tSending SIG%s to %d...\n" $SIG $PID;
- adb shell kill -$SIG $PID;
- sleep 1;
- done;
+ local done=0;
+ while [ $(adb shell "[ -d /proc/$PID ] && echo -n yes") ]; do
+ printf "\tSending SIG%s to %d...\n" $SIG $PID;
+ adb shell kill -$SIG $PID;
+ sleep 1;
+ done;
- adb shell "while [ ! -f $COREPATH ] ; do echo waiting for $COREPATH to be generated; sleep 1; done"
- echo "Done: core is under $COREPATH on device.";
+ adb shell "while [ ! -f $COREPATH ] ; do echo waiting for $COREPATH to be generated; sleep 1; done"
+ echo "Done: core is under $COREPATH on device.";
}
# systemstack - dump the current stack trace of all threads in the system process
diff --git a/libs/host/Android.mk b/libs/host/Android.mk
index bc25e4b..5e6a291 100644
--- a/libs/host/Android.mk
+++ b/libs/host/Android.mk
@@ -12,10 +12,6 @@
LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)/include
LOCAL_CXX_STL := none
-# acp uses libhost, so we can't use
-# acp to install libhost.
-LOCAL_ACP_UNAVAILABLE:= true
-
include $(BUILD_HOST_STATIC_LIBRARY)
# Include toolchain prebuilt modules if they exist.
diff --git a/tools/acp/Android.mk b/tools/acp/Android.mk
index eec9c9d..56aac14 100644
--- a/tools/acp/Android.mk
+++ b/tools/acp/Android.mk
@@ -11,7 +11,6 @@
LOCAL_STATIC_LIBRARIES := libhost
LOCAL_MODULE := acp
-LOCAL_ACP_UNAVAILABLE := true
LOCAL_CXX_STL := none
include $(BUILD_HOST_EXECUTABLE)
diff --git a/tools/apicheck/Android.mk b/tools/apicheck/Android.mk
index 1674a17..b547058 100644
--- a/tools/apicheck/Android.mk
+++ b/tools/apicheck/Android.mk
@@ -15,26 +15,15 @@
ifneq ($(TARGET_BUILD_PDK),true)
LOCAL_PATH := $(call my-dir)
-# We use copy-file-to-new-target so that the installed
-# script file's timestamp is at least as new as the
-# .jar file it wraps.
-
-#TODO(dbort): add a template to do this stuff; share with jx
-
# the hat script
# ============================================================
include $(CLEAR_VARS)
LOCAL_IS_HOST_MODULE := true
LOCAL_MODULE_CLASS := EXECUTABLES
LOCAL_MODULE := apicheck
-
-include $(BUILD_SYSTEM)/base_rules.mk
-
-$(LOCAL_BUILT_MODULE): $(HOST_OUT_JAVA_LIBRARIES)/doclava$(COMMON_JAVA_PACKAGE_SUFFIX)
-$(LOCAL_BUILT_MODULE): $(LOCAL_PATH)/etc/apicheck | $(ACP)
- @echo "Copy: $(PRIVATE_MODULE) ($@)"
- $(copy-file-to-new-target)
- $(hide) chmod 755 $@
+LOCAL_SRC_FILES := etc/apicheck
+LOCAL_REQUIRED_MODULES := doclava
+include $(BUILD_PREBUILT)
# Apicheck is now part of Doclava -- See external/doclava.
endif
diff --git a/tools/releasetools/edify_generator.py b/tools/releasetools/edify_generator.py
index f57360a..57f8cda 100644
--- a/tools/releasetools/edify_generator.py
+++ b/tools/releasetools/edify_generator.py
@@ -83,11 +83,17 @@
raise ValueError("must specify an OEM property")
if not value:
raise ValueError("must specify the OEM value")
- cmd = ('file_getprop("/oem/oem.prop", "{name}") == "{value}" || '
- 'abort("This package expects the value \\"{value}\\" for '
- '\\"{name}\\" on the OEM partition; this has value \\"" + '
- 'file_getprop("/oem/oem.prop", "{name}") + "\\".");').format(
- name=name, value=value)
+ if common.OPTIONS.oem_no_mount:
+ cmd = ('getprop("{name}") == "{value}" || '
+ 'abort("This package expects the value \\"{value}\\" for '
+ '\\"{name}\\"; this has value \\"" + '
+ 'getprop("{name}") + "\\".");').format(name=name, value=value)
+ else:
+ cmd = ('file_getprop("/oem/oem.prop", "{name}") == "{value}" || '
+ 'abort("This package expects the value \\"{value}\\" for '
+ '\\"{name}\\" on the OEM partition; this has value \\"" + '
+ 'file_getprop("/oem/oem.prop", "{name}") + "\\".");').format(
+ name=name, value=value)
self.script.append(cmd)
def AssertSomeFingerprint(self, *fp):
diff --git a/tools/releasetools/ota_from_target_files.py b/tools/releasetools/ota_from_target_files.py
index bea33a3..8923a05 100755
--- a/tools/releasetools/ota_from_target_files.py
+++ b/tools/releasetools/ota_from_target_files.py
@@ -54,6 +54,12 @@
Use the file to specify the expected OEM-specific properties
on the OEM partition of the intended device.
+ --oem_no_mount
+ For devices with OEM-specific properties but without an OEM partition,
+ do not mount the OEM partition in the updater-script. This should be
+ very rarely used, since it's expected to have a dedicated OEM partition
+ for OEM-specific properties. Only meaningful when -o is specified.
+
-w (--wipe_user_data)
Generate an OTA package that will wipe the user data partition
when installed.
@@ -63,6 +69,13 @@
the build scripts (used for developer OTA packages which
legitimately need to go back and forth).
+ --downgrade
+ Intentionally generate an incremental OTA that updates from a newer
+ build to an older one (based on timestamp comparison). "post-timestamp"
+ will be replaced by "ota-downgrade=yes" in the metadata file. A data
+ wipe will always be enforced, so "ota-wipe=yes" will also be included in
+ the metadata file.
+
-e (--extra_script) <file>
Insert the contents of file at the end of the update script.
@@ -126,6 +139,7 @@
OPTIONS.patch_threshold = 0.95
OPTIONS.wipe_user_data = False
OPTIONS.omit_prereq = False
+OPTIONS.downgrade = False
OPTIONS.extra_script = None
OPTIONS.aslr_mode = True
OPTIONS.worker_threads = multiprocessing.cpu_count() // 2
@@ -136,6 +150,7 @@
OPTIONS.block_based = False
OPTIONS.updater_binary = None
OPTIONS.oem_source = None
+OPTIONS.oem_no_mount = False
OPTIONS.fallback_to_full = True
OPTIONS.full_radio = False
OPTIONS.full_bootloader = False
@@ -518,7 +533,8 @@
if oem_props is not None and len(oem_props) > 0:
if OPTIONS.oem_source is None:
raise common.ExternalError("OEM source required for this build")
- script.Mount("/oem", recovery_mount_options)
+ if not OPTIONS.oem_no_mount:
+ script.Mount("/oem", recovery_mount_options)
oem_dict = common.LoadDictionaryFromLines(
open(OPTIONS.oem_source).readlines())
@@ -698,8 +714,9 @@
endif;
endif;
""" % bcb_dev)
- script.AddToZip(input_zip, output_zip, input_path=OPTIONS.updater_binary)
+ script.SetProgress(1)
+ script.AddToZip(input_zip, output_zip, input_path=OPTIONS.updater_binary)
metadata["ota-required-cache"] = str(script.required_cache)
WriteMetadata(metadata, output_zip)
@@ -768,18 +785,38 @@
if oem_props is not None and len(oem_props) > 0:
if OPTIONS.oem_source is None:
raise common.ExternalError("OEM source required for this build")
- script.Mount("/oem", recovery_mount_options)
+ if not OPTIONS.oem_no_mount:
+ script.Mount("/oem", recovery_mount_options)
oem_dict = common.LoadDictionaryFromLines(
open(OPTIONS.oem_source).readlines())
metadata = {
"pre-device": GetOemProperty("ro.product.device", oem_props, oem_dict,
OPTIONS.source_info_dict),
- "post-timestamp": GetBuildProp("ro.build.date.utc",
- OPTIONS.target_info_dict),
"ota-type": "BLOCK",
}
+ post_timestamp = GetBuildProp("ro.build.date.utc", OPTIONS.target_info_dict)
+ pre_timestamp = GetBuildProp("ro.build.date.utc", OPTIONS.source_info_dict)
+ is_downgrade = long(post_timestamp) < long(pre_timestamp)
+
+ if OPTIONS.downgrade:
+ metadata["ota-downgrade"] = "yes"
+ if not is_downgrade:
+ raise RuntimeError("--downgrade specified but no downgrade detected: "
+ "pre: %s, post: %s" % (pre_timestamp, post_timestamp))
+ else:
+ if is_downgrade:
+ # Non-fatal here to allow generating such a package which may require
+ # manual work to adjust the post-timestamp. A legit use case is that we
+ # cut a new build C (after having A and B), but want to enfore the
+ # update path of A -> C -> B. Specifying --downgrade may not help since
+ # that would enforce a data wipe for C -> B update.
+ print("\nWARNING: downgrade detected: pre: %s, post: %s.\n"
+ "The package may not be deployed properly. "
+ "Try --downgrade?\n" % (pre_timestamp, post_timestamp))
+ metadata["post-timestamp"] = post_timestamp
+
device_specific = common.DeviceSpecificParams(
source_zip=source_zip,
source_version=source_version,
@@ -1009,6 +1046,7 @@
if OPTIONS.wipe_user_data:
script.Print("Erasing user data...")
script.FormatPartition("/data")
+ metadata["ota-wipe"] = "yes"
if OPTIONS.two_step:
script.AppendExtra("""
@@ -1033,7 +1071,8 @@
if oem_props is not None and len(oem_props) > 0:
if OPTIONS.oem_source is None:
raise common.ExternalError("OEM source required for this build")
- script.Mount("/oem", recovery_mount_options)
+ if not OPTIONS.oem_no_mount:
+ script.Mount("/oem", recovery_mount_options)
oem_dict = common.LoadDictionaryFromLines(
open(OPTIONS.oem_source).readlines())
@@ -1385,18 +1424,38 @@
if oem_props is not None and len(oem_props) > 0:
if OPTIONS.oem_source is None:
raise common.ExternalError("OEM source required for this build")
- script.Mount("/oem", recovery_mount_options)
+ if not OPTIONS.oem_no_mount:
+ script.Mount("/oem", recovery_mount_options)
oem_dict = common.LoadDictionaryFromLines(
open(OPTIONS.oem_source).readlines())
metadata = {
"pre-device": GetOemProperty("ro.product.device", oem_props, oem_dict,
OPTIONS.source_info_dict),
- "post-timestamp": GetBuildProp("ro.build.date.utc",
- OPTIONS.target_info_dict),
"ota-type": "FILE",
}
+ post_timestamp = GetBuildProp("ro.build.date.utc", OPTIONS.target_info_dict)
+ pre_timestamp = GetBuildProp("ro.build.date.utc", OPTIONS.source_info_dict)
+ is_downgrade = long(post_timestamp) < long(pre_timestamp)
+
+ if OPTIONS.downgrade:
+ metadata["ota-downgrade"] = "yes"
+ if not is_downgrade:
+ raise RuntimeError("--downgrade specified but no downgrade detected: "
+ "pre: %s, post: %s" % (pre_timestamp, post_timestamp))
+ else:
+ if is_downgrade:
+ # Non-fatal here to allow generating such a package which may require
+ # manual work to adjust the post-timestamp. A legit use case is that we
+ # cut a new build C (after having A and B), but want to enfore the
+ # update path of A -> C -> B. Specifying --downgrade may not help since
+ # that would enforce a data wipe for C -> B update.
+ print("\nWARNING: downgrade detected: pre: %s, post: %s.\n"
+ "The package may not be deployed properly. "
+ "Try --downgrade?\n" % (pre_timestamp, post_timestamp))
+ metadata["post-timestamp"] = post_timestamp
+
device_specific = common.DeviceSpecificParams(
source_zip=source_zip,
source_version=source_version,
@@ -1725,6 +1784,7 @@
if OPTIONS.wipe_user_data:
script.Print("Erasing user data...")
script.FormatPartition("/data")
+ metadata["ota-wipe"] = "yes"
if OPTIONS.two_step:
script.AppendExtra("""
@@ -1767,8 +1827,13 @@
OPTIONS.wipe_user_data = True
elif o in ("-n", "--no_prereq"):
OPTIONS.omit_prereq = True
+ elif o == "--downgrade":
+ OPTIONS.downgrade = True
+ OPTIONS.wipe_user_data = True
elif o in ("-o", "--oem_settings"):
OPTIONS.oem_source = a
+ elif o == "--oem_no_mount":
+ OPTIONS.oem_no_mount = True
elif o in ("-e", "--extra_script"):
OPTIONS.extra_script = a
elif o in ("-a", "--aslr_mode"):
@@ -1818,6 +1883,7 @@
"full_bootloader",
"wipe_user_data",
"no_prereq",
+ "downgrade",
"extra_script=",
"worker_threads=",
"aslr_mode=",
@@ -1826,6 +1892,7 @@
"block",
"binary=",
"oem_settings=",
+ "oem_no_mount",
"verify",
"no_fallback_to_full",
"stash_threshold=",
@@ -1837,6 +1904,18 @@
common.Usage(__doc__)
sys.exit(1)
+ if OPTIONS.downgrade:
+ # Sanity check to enforce a data wipe.
+ if not OPTIONS.wipe_user_data:
+ raise ValueError("Cannot downgrade without a data wipe")
+
+ # We should only allow downgrading incrementals (as opposed to full).
+ # Otherwise the device may go back from arbitrary build with this full
+ # OTA package.
+ if OPTIONS.incremental_source is None:
+ raise ValueError("Cannot generate downgradable full OTAs - consider"
+ "using --omit_prereq?")
+
# Load the dict file from the zip directly to have a peek at the OTA type.
# For packages using A/B update, unzipping is not needed.
input_zip = zipfile.ZipFile(args[0], "r")