Merge "Upgrade to ManifestMerger2"
diff --git a/core/binary.mk b/core/binary.mk
index d8fda78..6a58c6c 100644
--- a/core/binary.mk
+++ b/core/binary.mk
@@ -290,6 +290,15 @@
# Move other ldlibs back to shared libraries
my_shared_libraries += $(patsubst -l%,lib%,$(filter-out $(my_allowed_ldlibs),$(my_ldlibs)))
my_ldlibs := $(filter $(my_allowed_ldlibs),$(my_ldlibs))
+else # LOCAL_IS_HOST_MODULE
+ # Add -ldl, -lpthread and -lrt to host builds to match the default behavior of
+ # device builds
+ ifneq ($($(my_prefix)OS),windows)
+ my_ldlibs += -ldl -lpthread
+ ifneq ($(HOST_OS),darwin)
+ my_ldlibs += -lrt
+ endif
+ endif
endif
ifneq ($(LOCAL_SDK_VERSION),)
diff --git a/core/envsetup.mk b/core/envsetup.mk
index d8be9c3..c99c70f 100644
--- a/core/envsetup.mk
+++ b/core/envsetup.mk
@@ -200,6 +200,14 @@
# Set up minimal BOOTCLASSPATH list of jars to build/execute
# java code with dalvikvm/art.
TARGET_CORE_JARS := core-oj core-libart conscrypt okhttp bouncycastle apache-xml
+ifeq ($(EMMA_INSTRUMENT),true)
+ ifneq ($(EMMA_INSTRUMENT_STATIC),true)
+ # For instrumented build, if Jacoco is not being included statically
+ # in instrumented packages then include Jacoco classes into the
+ # bootclasspath.
+ TARGET_CORE_JARS += jacocoagent
+ endif # EMMA_INSTRUMENT_STATIC
+endif # EMMA_INSTRUMENT
HOST_CORE_JARS := $(addsuffix -hostdex,$(TARGET_CORE_JARS))
#################################################################
@@ -315,29 +323,17 @@
SOONG_OUT_DIR := $(OUT_DIR)/soong
-DEBUG_OUT_DIR := $(OUT_DIR)/debug
+TARGET_OUT_ROOT := $(OUT_DIR)/target
-# Move the host or target under the debug/ directory
-# if necessary.
-TARGET_OUT_ROOT_release := $(OUT_DIR)/target
-TARGET_OUT_ROOT_debug := $(DEBUG_OUT_DIR)/target
-TARGET_OUT_ROOT := $(TARGET_OUT_ROOT_$(TARGET_BUILD_TYPE))
-
-HOST_OUT_ROOT_release := $(OUT_DIR)/host
-HOST_OUT_ROOT_debug := $(DEBUG_OUT_DIR)/host
-HOST_OUT_ROOT := $(HOST_OUT_ROOT_$(HOST_BUILD_TYPE))
+HOST_OUT_ROOT := $(OUT_DIR)/host
# We want to avoid two host bin directories in multilib build.
-HOST_OUT_release := $(HOST_OUT_ROOT_release)/$(HOST_OS)-$(HOST_PREBUILT_ARCH)
-HOST_OUT_debug := $(HOST_OUT_ROOT_debug)/$(HOST_OS)-$(HOST_PREBUILT_ARCH)
-HOST_OUT := $(HOST_OUT_$(HOST_BUILD_TYPE))
+HOST_OUT := $(HOST_OUT_ROOT)/$(HOST_OS)-$(HOST_PREBUILT_ARCH)
SOONG_HOST_OUT := $(SOONG_OUT_DIR)/host/$(HOST_OS)-$(HOST_PREBUILT_ARCH)
# TODO: remove
BUILD_OUT := $(HOST_OUT)
-HOST_CROSS_OUT_release := $(HOST_OUT_ROOT_release)/windows-$(HOST_PREBUILT_ARCH)
-HOST_CROSS_OUT_debug := $(HOST_OUT_ROOT_debug)/windows-$(HOST_PREBUILT_ARCH)
-HOST_CROSS_OUT := $(HOST_CROSS_OUT_$(HOST_BUILD_TYPE))
+HOST_CROSS_OUT := $(HOST_OUT_ROOT)/windows-$(HOST_PREBUILT_ARCH)
TARGET_PRODUCT_OUT_ROOT := $(TARGET_OUT_ROOT)/product
diff --git a/core/host_dalvik_java_library.mk b/core/host_dalvik_java_library.mk
index 241cf6e..37e9375 100644
--- a/core/host_dalvik_java_library.mk
+++ b/core/host_dalvik_java_library.mk
@@ -145,30 +145,30 @@
$(eval $(call copy-one-file,$(full_classes_header_jarjar),$(full_classes_header_jar)))
+# 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)
+endif
+
+$(eval $(call copy-one-file,$(full_classes_jarjar_jar),$(full_classes_jar)))
+
my_desugaring :=
ifeq ($(LOCAL_JAVA_LANGUAGE_VERSION),1.8)
my_desugaring := true
$(full_classes_desugar_jar): PRIVATE_DX_FLAGS := $(LOCAL_DX_FLAGS)
-$(full_classes_desugar_jar): $(full_classes_compiled_jar) $(full_java_header_libs) $(DESUGAR)
+$(full_classes_desugar_jar): $(full_classes_jar) $(full_java_header_libs) $(DESUGAR)
$(desugar-classes-jar)
endif
ifndef my_desugaring
-full_classes_desugar_jar := $(full_classes_compiled_jar)
+full_classes_desugar_jar := $(full_classes_jar)
endif
-# 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_desugar_jar) $(LOCAL_JARJAR_RULES) | $(JARJAR)
- @echo JarJar: $@
- $(hide) $(JAVA) -jar $(JARJAR) process $(PRIVATE_JARJAR_RULES) $< $@
-else
-full_classes_jarjar_jar := $(full_classes_desugar_jar)
-endif
-
-$(eval $(call copy-one-file,$(full_classes_jarjar_jar),$(full_classes_jar)))
-
ifeq ($(LOCAL_IS_STATIC_JAVA_LIBRARY),true)
# No dex; all we want are the .class files with resources.
$(LOCAL_BUILT_MODULE) : $(java_resource_sources)
@@ -179,7 +179,7 @@
else # !LOCAL_IS_STATIC_JAVA_LIBRARY
$(built_dex): PRIVATE_INTERMEDIATES_DIR := $(intermediates.COMMON)
$(built_dex): PRIVATE_DX_FLAGS := $(LOCAL_DX_FLAGS)
-$(built_dex): $(full_classes_jar) $(DX)
+$(built_dex): $(full_classes_desugar_jar) $(DX)
$(transform-classes.jar-to-dex)
$(LOCAL_BUILT_MODULE): PRIVATE_DEX_FILE := $(built_dex)
diff --git a/core/java.mk b/core/java.mk
index cc70368..4a6535c 100644
--- a/core/java.mk
+++ b/core/java.mk
@@ -18,6 +18,19 @@
LOCAL_NO_STANDARD_LIBRARIES:=$(strip $(LOCAL_NO_STANDARD_LIBRARIES))
LOCAL_SDK_VERSION:=$(strip $(LOCAL_SDK_VERSION))
+ifneq ($(LOCAL_MODULE),jacocoagent)
+ ifneq ($(LOCAL_NO_STANDARD_LIBRARIES),true)
+ ifeq ($(EMMA_INSTRUMENT),true)
+ ifneq ($(EMMA_INSTRUMENT_STATIC),true)
+ # For instrumented build, if Jacoco is not being included statically
+ # in instrumented packages then include Jacoco classes into the
+ # bootclasspath.
+ LOCAL_JAVA_LIBRARIES := jacocoagent $(LOCAL_JAVA_LIBRARIES)
+ endif # EMMA_INSTRUMENT_STATIC
+ endif # EMMA_INSTRUMENT
+ endif # !LOCAL_NO_STANDARD_LIBRARIES
+endif # LOCAL_MODULE == jacocoagent
+
ifneq ($(LOCAL_SDK_VERSION),)
ifeq ($(LOCAL_NO_STANDARD_LIBRARIES),true)
$(error $(LOCAL_PATH): Must not define both LOCAL_NO_STANDARD_LIBRARIES and LOCAL_SDK_VERSION)
@@ -527,31 +540,33 @@
full_classes_processed_jar := $(full_classes_compiled_jar)
endif
+# Run jarjar if necessary
+ifneq ($(strip $(LOCAL_JARJAR_RULES)),)
+$(full_classes_jarjar_jar): PRIVATE_JARJAR_RULES := $(LOCAL_JARJAR_RULES)
+$(full_classes_jarjar_jar): $(full_classes_processed_jar) $(LOCAL_JARJAR_RULES) | $(JARJAR)
+ @echo JarJar: $@
+ $(hide) $(JAVA) -jar $(JARJAR) process $(PRIVATE_JARJAR_RULES) $< $@
+else
+full_classes_jarjar_jar := $(full_classes_processed_jar)
+endif
+
+$(eval $(call copy-one-file,$(full_classes_jarjar_jar),$(full_classes_jar)))
+
my_desugaring :=
ifndef LOCAL_JACK_ENABLED
ifndef LOCAL_IS_STATIC_JAVA_LIBRARY
my_desugaring := true
$(full_classes_desugar_jar): PRIVATE_DX_FLAGS := $(LOCAL_DX_FLAGS)
-$(full_classes_desugar_jar): $(full_classes_processed_jar) $(full_java_header_libs) $(DESUGAR)
+$(full_classes_desugar_jar): $(full_classes_jar) $(full_java_header_libs) $(DESUGAR)
$(desugar-classes-jar)
endif
endif
ifndef my_desugaring
-full_classes_desugar_jar := $(full_classes_processed_jar)
+full_classes_desugar_jar := $(full_classes_jar)
endif
-# Run jarjar if necessary
-ifneq ($(strip $(LOCAL_JARJAR_RULES)),)
-$(full_classes_jarjar_jar): PRIVATE_JARJAR_RULES := $(LOCAL_JARJAR_RULES)
-$(full_classes_jarjar_jar): $(full_classes_desugar_jar) $(LOCAL_JARJAR_RULES) | $(JARJAR)
- @echo JarJar: $@
- $(hide) $(JAVA) -jar $(JARJAR) process $(PRIVATE_JARJAR_RULES) $< $@
-else
-full_classes_jarjar_jar := $(full_classes_desugar_jar)
-endif
-
-LOCAL_FULL_CLASSES_PRE_JACOCO_JAR := $(full_classes_jarjar_jar)
+LOCAL_FULL_CLASSES_PRE_JACOCO_JAR := $(full_classes_desugar_jar)
#######################################
include $(BUILD_SYSTEM)/jacoco.mk
@@ -702,8 +717,6 @@
full_classes_proguard_jar := $(full_classes_pre_proguard_jar)
endif # LOCAL_PROGUARD_ENABLED defined
-$(eval $(call copy-one-file,$(full_classes_proguard_jar),$(full_classes_jar)))
-
ifneq ($(LOCAL_IS_STATIC_JAVA_LIBRARY),true)
ifndef LOCAL_JACK_ENABLED
$(built_dex_intermediate): PRIVATE_DX_FLAGS := $(LOCAL_DX_FLAGS)
@@ -716,7 +729,7 @@
ifeq ($(LOCAL_EMMA_INSTRUMENT),true)
$(built_dex_intermediate): PRIVATE_DX_FLAGS += --no-locals
endif
-$(built_dex_intermediate): $(full_classes_jar) $(DX)
+$(built_dex_intermediate): $(full_classes_proguard_jar) $(DX)
$(transform-classes.jar-to-dex)
endif # LOCAL_JACK_ENABLED is disabled
diff --git a/core/java_library.mk b/core/java_library.mk
index db4ccb5..f766c01 100644
--- a/core/java_library.mk
+++ b/core/java_library.mk
@@ -67,12 +67,12 @@
ifeq ($(LOCAL_IS_STATIC_JAVA_LIBRARY),true)
# There are some dependencies outside the build system that assume classes.jar
# is available as javalib.jar so copy it there too.
-$(eval $(call copy-one-file,$(full_classes_jar),$(common_javalib.jar)))
+$(eval $(call copy-one-file,$(full_classes_proguard_jar),$(common_javalib.jar)))
ifdef LOCAL_JACK_ENABLED
$(eval $(call copy-one-file,$(full_classes_jack),$(LOCAL_BUILT_MODULE)))
else
-$(eval $(call copy-one-file,$(full_classes_jar),$(LOCAL_BUILT_MODULE)))
+$(eval $(call copy-one-file,$(full_classes_proguard_jar),$(LOCAL_BUILT_MODULE)))
endif
else # !LOCAL_IS_STATIC_JAVA_LIBRARY
diff --git a/core/package_internal.mk b/core/package_internal.mk
index a626dde..11138db 100644
--- a/core/package_internal.mk
+++ b/core/package_internal.mk
@@ -122,7 +122,18 @@
endif
endif
-ifndef enforce_rro_enabled
+ifdef enforce_rro_enabled
+ ifneq ($(PRODUCT_ENFORCE_RRO_EXCLUDED_OVERLAYS),)
+ static_only_resource_overlays := $(filter $(addsuffix %,$(PRODUCT_ENFORCE_RRO_EXCLUDED_OVERLAYS)),$(package_resource_overlays))
+ ifneq ($(static_only_resource_overlays),)
+ package_resource_overlays := $(filter-out $(static_only_resource_overlays),$(package_resource_overlays))
+ LOCAL_RESOURCE_DIR := $(static_only_resource_overlays) $(LOCAL_RESOURCE_DIR)
+ ifeq ($(package_resource_overlays),)
+ enforce_rro_enabled :=
+ endif
+ endif
+ endif
+else
LOCAL_RESOURCE_DIR := $(package_resource_overlays) $(LOCAL_RESOURCE_DIR)
endif
diff --git a/core/pdk_config.mk b/core/pdk_config.mk
index 8c986d6..bef183e 100644
--- a/core/pdk_config.mk
+++ b/core/pdk_config.mk
@@ -99,9 +99,6 @@
ifeq (true,$(TARGET_BUILD_PDK_JAVA_PLATFORM))
PDK_FUSION_OUT_DIR := $(OUT_DIR)
-ifeq (debug,$(TARGET_BUILD_TYPE))
-PDK_FUSION_OUT_DIR := $(DEBUG_OUT_DIR)
-endif
define JAVA_dependency_template
$(call add-dependency,$(PDK_FUSION_OUT_DIR)/$(strip $(1)),\
diff --git a/core/product.mk b/core/product.mk
index 1a0e8c6..95e3b27 100644
--- a/core/product.mk
+++ b/core/product.mk
@@ -94,6 +94,7 @@
PRODUCT_EXTRA_RECOVERY_KEYS \
PRODUCT_PACKAGE_OVERLAYS \
DEVICE_PACKAGE_OVERLAYS \
+ PRODUCT_ENFORCE_RRO_EXCLUDED_OVERLAYS \
PRODUCT_ENFORCE_RRO_TARGETS \
PRODUCT_SDK_ATREE_FILES \
PRODUCT_SDK_ADDON_NAME \
diff --git a/core/product_config.mk b/core/product_config.mk
index 4194e00..6ab40c0 100644
--- a/core/product_config.mk
+++ b/core/product_config.mk
@@ -434,6 +434,10 @@
PRODUCT_IOT := \
$(strip $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_IOT))
+# Resource overlay list which must be excluded from enforcing RRO.
+PRODUCT_ENFORCE_RRO_EXCLUDED_OVERLAYS := \
+ $(strip $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_ENFORCE_RRO_EXCLUDED_OVERLAYS))
+
# Package list to apply enforcing RRO.
PRODUCT_ENFORCE_RRO_TARGETS := \
$(strip $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_ENFORCE_RRO_TARGETS))
diff --git a/core/tasks/sdk-addon.mk b/core/tasks/sdk-addon.mk
index e26773c..2725f95 100644
--- a/core/tasks/sdk-addon.mk
+++ b/core/tasks/sdk-addon.mk
@@ -112,14 +112,14 @@
$(ACP) -r $$d $(PRIVATE_STAGING_DIR)/docs ;\
done
$(hide) mkdir -p $(dir $@)
- $(hide) ( F=$$(pwd)/$@ ; cd $(PRIVATE_STAGING_DIR)/.. && zip -rqX $$F $(notdir $(PRIVATE_STAGING_DIR)) )
+ $(hide) soong_zip -o $@ -C $(dir $(PRIVATE_STAGING_DIR)) -D $(PRIVATE_STAGING_DIR)
$(full_target_img): PRIVATE_STAGING_DIR := $(call append-path,$(staging),$(addon_dir_img))/images/$(TARGET_CPU_ABI)
$(full_target_img): $(full_target) $(addon_img_source_prop) | $(ACP)
@echo Packaging SDK Addon System-Image: $@
$(hide) mkdir -p $(dir $@)
$(ACP) -r $(PRODUCT_OUT)/data $(PRIVATE_STAGING_DIR)/data
- $(hide) ( F=$$(pwd)/$@ ; cd $(PRIVATE_STAGING_DIR)/.. && zip -rqX $$F $(notdir $(PRIVATE_STAGING_DIR)) )
+ $(hide) soong_zip -o $@ -C $(dir $(PRIVATE_STAGING_DIR)) -D $(PRIVATE_STAGING_DIR)
.PHONY: sdk_addon
diff --git a/target/board/Android.mk b/target/board/Android.mk
index 5504c52..c5678d1 100644
--- a/target/board/Android.mk
+++ b/target/board/Android.mk
@@ -132,7 +132,7 @@
# All kernel versions that the system image works with.
KERNEL_VERSIONS := 3.18 4.4 4.9
-KERNEL_CONFIG_DATA := test/vts-testcase/kernel/config/data
+KERNEL_CONFIG_DATA := kernel/configs
$(GEN): $(foreach version,$(KERNEL_VERSIONS),\
$(wildcard $(KERNEL_CONFIG_DATA)/android-$(version)/android-base*.cfg))
diff --git a/target/board/generic_arm64_ab/BoardConfig.mk b/target/board/generic_arm64_ab/BoardConfig.mk
index cf79019..99dbe9f 100644
--- a/target/board/generic_arm64_ab/BoardConfig.mk
+++ b/target/board/generic_arm64_ab/BoardConfig.mk
@@ -83,3 +83,5 @@
# TODO(b/36764215): remove this setting when the generic system image
# no longer has QCOM-specific directories under /.
BOARD_SEPOLICY_DIRS += build/target/board/generic_arm64_ab/sepolicy
+
+BOARD_VNDK_VERSION := current
diff --git a/tools/atree/Android.bp b/tools/atree/Android.bp
new file mode 100644
index 0000000..3c3a8ef
--- /dev/null
+++ b/tools/atree/Android.bp
@@ -0,0 +1,13 @@
+// Copyright 2007 The Android Open Source Project
+//
+// Copies files into the directory structure described by a manifest
+
+cc_binary_host {
+ name: "atree",
+ srcs: [
+ "atree.cpp",
+ "files.cpp",
+ "fs.cpp",
+ ],
+ static_libs: ["libhost"],
+}
diff --git a/tools/atree/Android.mk b/tools/atree/Android.mk
deleted file mode 100644
index f598db5..0000000
--- a/tools/atree/Android.mk
+++ /dev/null
@@ -1,19 +0,0 @@
-# Copyright 2007 The Android Open Source Project
-#
-# Copies files into the directory structure described by a manifest
-
-LOCAL_PATH:= $(call my-dir)
-include $(CLEAR_VARS)
-
-LOCAL_SRC_FILES := \
- atree.cpp \
- files.cpp \
- fs.cpp
-
-LOCAL_STATIC_LIBRARIES := \
- libhost
-
-LOCAL_MODULE := atree
-
-include $(BUILD_HOST_EXECUTABLE)
-
diff --git a/tools/fs_config/Android.bp b/tools/fs_config/Android.bp
new file mode 100644
index 0000000..797cfe2
--- /dev/null
+++ b/tools/fs_config/Android.bp
@@ -0,0 +1,63 @@
+// Copyright (C) 2008 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.
+
+cc_binary_host {
+ name: "fs_config",
+ srcs: ["fs_config.c"],
+ shared_libs: [
+ "libcutils",
+ "libselinux",
+ ],
+ cflags: ["-Werror"],
+}
+
+// -----------------------------------------------------------------------------
+// Unit tests.
+// -----------------------------------------------------------------------------
+
+test_c_flags = [
+ "-fstack-protector-all",
+ "-g",
+ "-Wall",
+ "-Wextra",
+ "-Werror",
+ "-fno-builtin",
+ "-DANDROID_FILESYSTEM_CONFIG=\"android_filesystem_config_test_data.h\"",
+]
+
+//#################################
+// test executable
+cc_test_host {
+ name: "fs_config_generate_test",
+ srcs: ["fs_config_generate.c"],
+ shared_libs: ["libcutils"],
+ cflags: test_c_flags,
+ relative_install_path: "fs_config-unit-tests",
+ no_named_install_directory: true,
+ gtest: false,
+
+}
+
+//#################################
+// gTest tool
+cc_test_host {
+ name: "fs_config-unit-tests",
+ cflags: test_c_flags + ["-DHOST"],
+ shared_libs: [
+ "liblog",
+ "libcutils",
+ "libbase",
+ ],
+ srcs: ["fs_config_test.cpp"],
+}
diff --git a/tools/fs_config/Android.mk b/tools/fs_config/Android.mk
index ab7f92d..3773d38 100644
--- a/tools/fs_config/Android.mk
+++ b/tools/fs_config/Android.mk
@@ -14,15 +14,6 @@
LOCAL_PATH := $(call my-dir)
-include $(CLEAR_VARS)
-
-LOCAL_SRC_FILES := fs_config.c
-LOCAL_MODULE := fs_config
-LOCAL_SHARED_LIBRARIES := libcutils libselinux
-LOCAL_CFLAGS := -Werror
-
-include $(BUILD_HOST_EXECUTABLE)
-
# One can override the default android_filesystem_config.h file in one of two ways:
#
# 1. The old way:
@@ -306,36 +297,3 @@
fs_config_generate_bin :=
my_gen_oem_aid :=
fs_config_generate_extra_partition_list :=
-
-# -----------------------------------------------------------------------------
-# Unit tests.
-# -----------------------------------------------------------------------------
-
-test_c_flags := \
- -fstack-protector-all \
- -g \
- -Wall \
- -Wextra \
- -Werror \
- -fno-builtin \
- -DANDROID_FILESYSTEM_CONFIG='"android_filesystem_config_test_data.h"'
-
-##################################
-# test executable
-include $(CLEAR_VARS)
-LOCAL_MODULE := fs_config_generate_test
-LOCAL_SRC_FILES := fs_config_generate.c
-LOCAL_SHARED_LIBRARIES := libcutils
-LOCAL_CFLAGS := $(test_c_flags)
-LOCAL_MODULE_RELATIVE_PATH := fs_config-unit-tests
-LOCAL_GTEST := false
-include $(BUILD_HOST_NATIVE_TEST)
-
-##################################
-# gTest tool
-include $(CLEAR_VARS)
-LOCAL_MODULE := fs_config-unit-tests
-LOCAL_CFLAGS += $(test_c_flags) -DHOST
-LOCAL_SHARED_LIBRARIES := liblog libcutils libbase
-LOCAL_SRC_FILES := fs_config_test.cpp
-include $(BUILD_HOST_NATIVE_TEST)
diff --git a/tools/fs_get_stats/Android.bp b/tools/fs_get_stats/Android.bp
new file mode 100644
index 0000000..6684319
--- /dev/null
+++ b/tools/fs_get_stats/Android.bp
@@ -0,0 +1,8 @@
+cc_binary_host {
+ name: "fs_get_stats",
+ srcs: ["fs_get_stats.c"],
+ shared_libs: [
+ "libcutils",
+ "liblog",
+ ],
+}
diff --git a/tools/fs_get_stats/Android.mk b/tools/fs_get_stats/Android.mk
deleted file mode 100644
index 4501c1f..0000000
--- a/tools/fs_get_stats/Android.mk
+++ /dev/null
@@ -1,11 +0,0 @@
-LOCAL_PATH:= $(call my-dir)
-
-include $(CLEAR_VARS)
-
-LOCAL_SRC_FILES := fs_get_stats.c
-
-LOCAL_MODULE := fs_get_stats
-
-LOCAL_SHARED_LIBRARIES := libcutils liblog
-
-include $(BUILD_HOST_EXECUTABLE)
diff --git a/tools/releasetools/add_img_to_target_files.py b/tools/releasetools/add_img_to_target_files.py
index 1ce22e7..52d3918 100755
--- a/tools/releasetools/add_img_to_target_files.py
+++ b/tools/releasetools/add_img_to_target_files.py
@@ -505,7 +505,13 @@
print("target_files appears to already contain images.")
sys.exit(1)
- has_vendor = os.path.isdir(os.path.join(OPTIONS.input_tmp, "VENDOR"))
+ # vendor.img is unlike system.img or system_other.img. Because it could be
+ # built from source, or dropped into target_files.zip as a prebuilt blob. We
+ # consider either of them as vendor.img being available, which could be used
+ # when generating vbmeta.img for AVB.
+ has_vendor = (os.path.isdir(os.path.join(OPTIONS.input_tmp, "VENDOR")) or
+ os.path.exists(os.path.join(OPTIONS.input_tmp, "IMAGES",
+ "vendor.img")))
has_system_other = os.path.isdir(os.path.join(OPTIONS.input_tmp,
"SYSTEM_OTHER"))
diff --git a/tools/releasetools/build_image.py b/tools/releasetools/build_image.py
index 6de9763..d2c9f59 100755
--- a/tools/releasetools/build_image.py
+++ b/tools/releasetools/build_image.py
@@ -36,30 +36,36 @@
FIXED_SALT = "aee087a5be3b982978c923f566a94613496b417f2af592639bc80d141e34dfe7"
BLOCK_SIZE = 4096
-def RunCommand(cmd):
+def RunCommand(cmd, verbose=None):
"""Echo and run the given command.
Args:
cmd: the command represented as a list of strings.
+ verbose: show commands being executed.
Returns:
A tuple of the output and the exit code.
"""
- print "Running: ", " ".join(cmd)
+ if verbose is None:
+ verbose = OPTIONS.verbose
+ if verbose:
+ print("Running: " + " ".join(cmd))
p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
output, _ = p.communicate()
- print "%s" % (output.rstrip(),)
+
+ if verbose:
+ print(output.rstrip())
return (output, p.returncode)
def GetVerityFECSize(partition_size):
cmd = ["fec", "-s", str(partition_size)]
- output, exit_code = RunCommand(cmd)
+ output, exit_code = RunCommand(cmd, False)
if exit_code != 0:
return False, 0
return True, int(output)
def GetVerityTreeSize(partition_size):
cmd = ["build_verity_tree", "-s", str(partition_size)]
- output, exit_code = RunCommand(cmd)
+ output, exit_code = RunCommand(cmd, False)
if exit_code != 0:
return False, 0
return True, int(output)
@@ -67,7 +73,7 @@
def GetVerityMetadataSize(partition_size):
cmd = ["system/extras/verity/build_verity_metadata.py", "size",
str(partition_size)]
- output, exit_code = RunCommand(cmd)
+ output, exit_code = RunCommand(cmd, False)
if exit_code != 0:
return False, 0
return True, int(output)
@@ -186,6 +192,8 @@
else:
hi = i
+ print("Adjusted partition size for verity, partition_size: {},"
+ " verity_size: {}".format(result, verity_size))
AdjustPartitionSizeForVerity.results[key] = (result, verity_size)
return (result, verity_size)
@@ -513,9 +521,9 @@
try:
if fs_type.startswith("ext4"):
- (ext4fs_output, exit_code) = RunCommand(build_command)
+ (ext4fs_output, exit_code) = RunCommand(build_command, True)
else:
- (_, exit_code) = RunCommand(build_command)
+ (_, exit_code) = RunCommand(build_command, True)
finally:
if in_dir != origin_in:
# Clean up temporary directories and files.
diff --git a/tools/zipalign/Android.bp b/tools/zipalign/Android.bp
new file mode 100644
index 0000000..cfc6aec
--- /dev/null
+++ b/tools/zipalign/Android.bp
@@ -0,0 +1,31 @@
+//
+// Copyright 2008 The Android Open Source Project
+//
+// Zip alignment tool
+//
+
+cc_binary_host {
+ name: "zipalign",
+
+ srcs: [
+ "ZipAlign.cpp",
+ "ZipEntry.cpp",
+ "ZipFile.cpp",
+ ],
+
+ static_libs: [
+ "libandroidfw",
+ "libutils",
+ "libcutils",
+ "liblog",
+ "libzopfli",
+ "libz",
+ ],
+
+ target: {
+ windows: {
+ host_ldlibs: ["-lpthread"],
+ enabled: true,
+ },
+ },
+}
diff --git a/tools/zipalign/Android.mk b/tools/zipalign/Android.mk
deleted file mode 100644
index 8c0240a..0000000
--- a/tools/zipalign/Android.mk
+++ /dev/null
@@ -1,38 +0,0 @@
-#
-# Copyright 2008 The Android Open Source Project
-#
-# Zip alignment tool
-#
-
-LOCAL_PATH:= $(call my-dir)
-include $(CLEAR_VARS)
-
-LOCAL_SRC_FILES := \
- ZipAlign.cpp \
- ZipEntry.cpp \
- ZipFile.cpp
-
-LOCAL_C_INCLUDES += external/zlib \
- external/zopfli/src
-
-LOCAL_STATIC_LIBRARIES := \
- libandroidfw \
- libutils \
- libcutils \
- liblog \
- libzopfli
-
-LOCAL_LDLIBS_linux += -lrt
-
-LOCAL_STATIC_LIBRARIES_windows += libz
-LOCAL_LDLIBS_linux += -lz
-LOCAL_LDLIBS_darwin += -lz
-
-ifneq ($(strip $(BUILD_HOST_static)),)
-LOCAL_LDLIBS += -lpthread
-endif # BUILD_HOST_static
-
-LOCAL_MODULE := zipalign
-LOCAL_MODULE_HOST_OS := darwin linux windows
-
-include $(BUILD_HOST_EXECUTABLE)