Merge "Move definition of dist-for-goals before call."
diff --git a/Changes.md b/Changes.md
index 461de97..453ea6c 100644
--- a/Changes.md
+++ b/Changes.md
@@ -1,5 +1,103 @@
# Build System Changes for Android.mk Writers
+## ELF prebuilts in PRODUCT_COPY_FILES
+
+ELF prebuilts in PRODUCT_COPY_FILES that are installed into these paths are an
+error:
+
+* `<partition>/bin/*`
+* `<partition>/lib/*`
+* `<partition>/lib64/*`
+
+Define prebuilt modules and add them to PRODUCT_PACKAGES instead.
+To temporarily relax this check and restore the behavior prior to this change,
+set `BUILD_BROKEN_ELF_PREBUILT_PRODUCT_COPY_FILES := true` in `BoardConfig.mk`.
+
+## COPY_HEADERS usage now produces warnings {#copy_headers}
+
+We've considered `BUILD_COPY_HEADERS`/`LOCAL_COPY_HEADERS` to be deprecated for
+a long time, and the places where it's been able to be used have shrinked over
+the last several releases. Equivalent functionality is not available in Soong.
+
+See the [build/soong/docs/best_practices.md#headers] for more information about
+how best to handle headers in Android.
+
+## `m4` is not available on `$PATH`
+
+There is a prebuilt of it available in prebuilts/build-tools, and a make
+variable `M4` that contains the path.
+
+Beyond the direct usage, whenever you use bison or flex directly, they call m4
+behind the scene, so you must set the M4 environment variable (and depend upon
+it for incremental build correctness):
+
+```
+$(intermediates)/foo.c: .KATI_IMPLICIT_OUTPUTS := $(intermediates)/foo.h
+$(intermediates)/foo.c: $(LOCAL_PATH)/foo.y $(M4) $(BISON) $(BISON_DATA)
+ M4=$(M4) $(BISON) ...
+```
+
+## Rules executed within limited environment
+
+With `ALLOW_NINJA_ENV=false` (soon to be the default), ninja, and all the
+rules/actions executed within it will only have access to a limited number of
+environment variables. Ninja does not track when environment variables change
+in order to trigger rebuilds, so changing behavior based on arbitrary variables
+is not safe with incremental builds.
+
+Kati and Soong can safely use environment variables, so the expectation is that
+you'd embed any environment variables that you need to use within the command
+line generated by those tools. See the [export section](#export_keyword) below
+for examples.
+
+For a temporary workaround, you can set `ALLOW_NINJA_ENV=true` in your
+environment to restore the previous behavior, or set
+`BUILD_BROKEN_NINJA_USES_ENV_VAR := <var> <var2> ...` in your `BoardConfig.mk`
+to allow specific variables to be passed through until you've fixed the rules.
+
+## LOCAL_C_INCLUDES outside the source/output trees are an error {#BUILD_BROKEN_OUTSIDE_INCLUDE_DIRS}
+
+Include directories are expected to be within the source tree (or in the output
+directory, generated during the build). This has been checked in some form
+since Oreo, but now has better checks.
+
+There's now a `BUILD_BROKEN_OUTSIDE_INCLUDE_DIRS` variable, that when set, will
+turn these errors into warnings temporarily. I don't expect this to last more
+than a release, since they're fairly easy to clean up.
+
+Neither of these cases are supported by Soong, and will produce errors when
+converting your module.
+
+### Absolute paths
+
+This has been checked since Oreo. The common reason to hit this is because a
+makefile is calculating a path, and ran abspath/realpath/etc. This is a problem
+because it makes your build non-reproducible. It's very unlikely that your
+source path is the same on every machine.
+
+### Using `../` to leave the source/output directories
+
+This is the new check that has been added. In every case I've found, this has
+been a mistake in the Android.mk -- assuming that `LOCAL_C_INCLUDES` (which is
+relative to the top of the source tree) acts like `LOCAL_SRC_FILES` (which is
+relative to `LOCAL_PATH`).
+
+Since this usually isn't a valid path, you can almost always just remove the
+offending line.
+
+
+## `BOARD_HAL_STATIC_LIBRARIES` and `LOCAL_HAL_STATIC_LIBRARIES` are obsolete {#BOARD_HAL_STATIC_LIBRARIES}
+
+Define proper HIDL / Stable AIDL HAL instead.
+
+* For libhealthd, use health HAL. See instructions for implementing
+ health HAL:
+
+ * [hardware/interfaces/health/2.1/README.md] for health 2.1 HAL (recommended)
+ * [hardware/interfaces/health/1.0/README.md] for health 1.0 HAL
+
+* For libdumpstate, use at least Dumpstate HAL 1.0.
+
## PRODUCT_STATIC_BOOT_CONTROL_HAL is obsolete {#PRODUCT_STATIC_BOOT_CONTROL_HAL}
`PRODUCT_STATIC_BOOT_CONTROL_HAL` was the workaround to allow sideloading with
@@ -477,6 +575,9 @@
[build/soong/Changes.md]: https://android.googlesource.com/platform/build/soong/+/master/Changes.md
+[build/soong/docs/best_practices.md#headers]: https://android.googlesource.com/platform/build/soong/+/master/docs/best_practices.md#headers
[external/fonttools/Lib/fontTools/Android.bp]: https://android.googlesource.com/platform/external/fonttools/+/master/Lib/fontTools/Android.bp
[frameworks/base/Android.bp]: https://android.googlesource.com/platform/frameworks/base/+/master/Android.bp
[frameworks/base/data/fonts/Android.mk]: https://android.googlesource.com/platform/frameworks/base/+/master/data/fonts/Android.mk
+[hardware/interfaces/health/1.0/README.md]: https://android.googlesource.com/platform/hardware/interfaces/+/master/health/1.0/README.md
+[hardware/interfaces/health/2.1/README.md]: https://android.googlesource.com/platform/hardware/interfaces/+/master/health/2.1/README.md
diff --git a/CleanSpec.mk b/CleanSpec.mk
index ddee654..6352e38 100644
--- a/CleanSpec.mk
+++ b/CleanSpec.mk
@@ -646,6 +646,10 @@
$(call add-clean-step, rm -rf $(PRODUCT_OUT)/odm/build.prop)
$(call add-clean-step, rm -rf $(PRODUCT_OUT)/vendor/odm/build.prop)
+# Remove libcameraservice and libcamera_client from base_system
+$(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/lib*/libcameraservice.so)
+$(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/lib*/libcamera_client.so)
+
# Move product and system_ext to root for emulators
$(call add-clean-step, rm -rf $(OUT_DIR)/target/product/generic*/*/product)
$(call add-clean-step, rm -rf $(OUT_DIR)/target/product/generic*/*/system_ext)
@@ -673,6 +677,54 @@
$(call add-clean-step, rm -rf $(HOST_OUT)/fuzz/*)
$(call add-clean-step, rm -rf $(SOONG_OUT_DIR)/host/*/fuzz/*)
+# Change file layout of system_other
+$(call add-clean-step, rm -rf $(PRODUCT_OUT)/system_other)
+
+$(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/apex)
+
+# Migrate preopt files to system_other for some devices
+$(call add-clean-step, rm -rf $(PRODUCT_OUT)/*/*app/*/oat)
+
+# Remove Android Core Library artifacts from the system partition, now
+# that they live in the ART APEX (b/142944799).
+$(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/framework/*.jar)
+
+# Remove symlinks for VNDK apexes
+$(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/lib*/vndk-*)
+
+# Switch to symlinks for VNDK libs
+$(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/lib*/vndk-*)
+
+# Remove Android Core Library artifacts from the system partition
+# again, as the original change removing them was reverted.
+$(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/framework/*.jar)
+
+# The core image variant has been renamed to ""
+$(call add-clean-step, find $(SOONG_OUT_DIR)/.intermediates -type d -name "android_*_core*" -print0 | xargs -0 rm -rf)
+
+# Remove CtsShim apks from system partition, since the have been moved inside
+# the cts shim apex. Also remove the cts shim apex prebuilt since it has been
+# removed in flattened apexs configurations.
+$(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/priv-app/CtsShimPrivPrebuilt)
+$(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/app/CtsShimPrebuilt)
+$(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/apex/com.android.apex.cts.shim.apex)
+
+# Remove vendor and recovery variants, the directory name has changed.
+$(call add-clean-step, find $(SOONG_OUT_DIR)/.intermediates -type d -name "android_*_recovery*" -print0 | xargs -0 rm -rf)
+$(call add-clean-step, find $(SOONG_OUT_DIR)/.intermediates -type d -name "android_*_vendor*" -print0 | xargs -0 rm -rf)
+
+# Clean up VTS-Core and VTS10 related artifacts.
+$(call add-clean-step, rm -rf $(HOST_OUT)/vts-core/*)
+$(call add-clean-step, rm -rf $(HOST_OUT)/framework/vts-core-tradefed.jar)
+$(call add-clean-step, rm -rf $(HOST_OUT)/vts10/*)
+$(call add-clean-step, rm -rf $(HOST_OUT)/framework/vts10-tradefed.jar)
+# Clean up VTS again as VTS-Core will be renamed to VTS
+$(call add-clean-step, rm -rf $(HOST_OUT)/vts/*)
+$(call add-clean-step, rm -rf $(HOST_OUT)/framework/vts-tradefed.jar)
+
+$(call add-clean-step, rm -rf $(PRODUCT_OUT)/vendor/default.prop)
+$(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/etc/prop.default)
+
# ************************************************
# NEWER CLEAN STEPS MUST BE AT THE END OF THE LIST
# ************************************************
diff --git a/Deprecation.md b/Deprecation.md
index 9378e1a..74b54fa 100644
--- a/Deprecation.md
+++ b/Deprecation.md
@@ -14,18 +14,21 @@
| Module type | State |
| -------------------------------- | --------- |
-| `BUILD_AUX_EXECUTABLE` | Error |
-| `BUILD_AUX_STATIC_LIBRARY` | Error |
-| `BUILD_HOST_FUZZ_TEST` | Error |
-| `BUILD_HOST_NATIVE_TEST` | Error |
-| `BUILD_HOST_SHARED_TEST_LIBRARY` | Error |
-| `BUILD_HOST_STATIC_LIBRARY` | Warning |
-| `BUILD_HOST_STATIC_TEST_LIBRARY` | Error |
-| `BUILD_HOST_TEST_CONFIG` | Error |
-| `BUILD_NATIVE_BENCHMARK` | Error |
-| `BUILD_SHARED_TEST_LIBRARY` | Error |
-| `BUILD_STATIC_TEST_LIBRARY` | Error |
-| `BUILD_TARGET_TEST_CONFIG` | Error |
+| `BUILD_AUX_EXECUTABLE` | Obsolete |
+| `BUILD_AUX_STATIC_LIBRARY` | Obsolete |
+| `BUILD_COPY_HEADERS` | Error |
+| `BUILD_HOST_EXECUTABLE` | Error |
+| `BUILD_HOST_FUZZ_TEST` | Obsolete |
+| `BUILD_HOST_NATIVE_TEST` | Obsolete |
+| `BUILD_HOST_SHARED_LIBRARY` | Error |
+| `BUILD_HOST_SHARED_TEST_LIBRARY` | Obsolete |
+| `BUILD_HOST_STATIC_LIBRARY` | Error |
+| `BUILD_HOST_STATIC_TEST_LIBRARY` | Obsolete |
+| `BUILD_HOST_TEST_CONFIG` | Obsolete |
+| `BUILD_NATIVE_BENCHMARK` | Obsolete |
+| `BUILD_SHARED_TEST_LIBRARY` | Obsolete |
+| `BUILD_STATIC_TEST_LIBRARY` | Obsolete |
+| `BUILD_TARGET_TEST_CONFIG` | Obsolete |
| `BUILD_*` | Available |
## Module Type Deprecation Process
diff --git a/OWNERS b/OWNERS
index e89a6a1..05f8b3d 100644
--- a/OWNERS
+++ b/OWNERS
@@ -8,4 +8,4 @@
hansson@google.com
# For version updates
-per-file version_defaults.mk = aseaton@google.com,elisapascual@google.com
+per-file version_defaults.mk = aseaton@google.com,elisapascual@google.com,lubomir@google.com,pscovanner@google.com
diff --git a/common/math.mk b/common/math.mk
index ac3151e..83f2218 100644
--- a/common/math.mk
+++ b/common/math.mk
@@ -33,8 +33,8 @@
math-expect-error :=
# Run the math tests with:
-# make -f ${ANDROID_BUILD_TOP}/build/make/core/math.mk RUN_MATH_TESTS=true
-# $(get_build_var CKATI) -f ${ANDROID_BUILD_TOP}//build/make/core/math.mk RUN_MATH_TESTS=true
+# make -f ${ANDROID_BUILD_TOP}/build/make/common/math.mk RUN_MATH_TESTS=true
+# $(get_build_var CKATI) -f ${ANDROID_BUILD_TOP}//build/make/common/math.mk RUN_MATH_TESTS=true
ifdef RUN_MATH_TESTS
MATH_TEST_FAILURE :=
MATH_TEST_ERROR :=
@@ -134,6 +134,10 @@
$(if $(filter $(1),$(call math_max,$(1),$(2))),true)
endef
+define math_gt
+$(if $(call math_gt_or_eq,$(2),$(1)),,true)
+endef
+
define math_lt
$(if $(call math_gt_or_eq,$(1),$(2)),,true)
endef
@@ -141,6 +145,12 @@
$(call math-expect-true,(call math_gt_or_eq, 2, 1))
$(call math-expect-true,(call math_gt_or_eq, 1, 1))
$(call math-expect-false,(call math_gt_or_eq, 1, 2))
+$(call math-expect-true,(call math_gt, 4, 3))
+$(call math-expect-false,(call math_gt, 5, 5))
+$(call math-expect-false,(call math_gt, 6, 7))
+$(call math-expect-false,(call math_lt, 1, 0))
+$(call math-expect-false,(call math_lt, 8, 8))
+$(call math-expect-true,(call math_lt, 10, 11))
# $1 is the variable name to increment
define inc_and_print
diff --git a/common/strings.mk b/common/strings.mk
index ce6d6fb..ba20e27 100644
--- a/common/strings.mk
+++ b/common/strings.mk
@@ -88,7 +88,7 @@
endef
###########################################################
-## Convert "a=b c= d e = f" into "a=b c=d e=f"
+## Convert "a=b c= d e = f = g h=" into "a=b c=d e= f=g h="
##
## $(1): list to collapse
## $(2): if set, separator word; usually "=", ":", or ":="
@@ -96,11 +96,29 @@
###########################################################
define collapse-pairs
+$(strip \
$(eval _cpSEP := $(strip $(if $(2),$(2),=)))\
-$(strip $(subst $(space)$(_cpSEP)$(space),$(_cpSEP),$(strip \
- $(subst $(_cpSEP), $(_cpSEP) ,$(1)))$(space)))
+$(eval _cpLHS :=)\
+$(eval _cpRET :=)\
+$(foreach w,$(subst $(space)$(_cpSEP),$(_cpSEP),$(strip \
+ $(subst $(_cpSEP),$(space)$(_cpSEP)$(space),$(1)))),\
+ $(if $(findstring $(_cpSEP),$(w)),\
+ $(eval _cpRET += $(_cpLHS))$(eval _cpLHS := $(w)),\
+ $(eval _cpRET += $(_cpLHS)$(w))$(eval _cpLHS :=)))\
+$(if $(_cpLHS),$(_cpRET)$(space)$(_cpLHS),$(_cpRET))\
+$(eval _cpSEP :=)\
+$(eval _cpLHS :=)\
+$(eval _cpRET :=))
endef
+# Sanity check for collapse-pairs.
+ifneq (a=b c=d e= f=g h=,$(call collapse-pairs,a=b c= d e = f = g h=))
+ $(error collapse-pairs sanity check failure)
+endif
+ifneq (a:=b c:=d e:=f g:=h,$(call collapse-pairs,a:=b c:= d e :=f g := h,:=))
+ $(error collapse-pairs sanity check failure)
+endif
+
###########################################################
## Given a list of pairs, if multiple pairs have the same
## first components, keep only the first pair.
diff --git a/core/Makefile b/core/Makefile
index a86b7b7..220b620 100644
--- a/core/Makefile
+++ b/core/Makefile
@@ -16,8 +16,37 @@
define check-product-copy-files
$(if $(filter-out $(TARGET_COPY_OUT_SYSTEM_OTHER)/%,$(2)), \
$(if $(filter %.apk, $(2)),$(error \
- Prebuilt apk found in PRODUCT_COPY_FILES: $(1), use BUILD_PREBUILT instead!)))
+ Prebuilt apk found in PRODUCT_COPY_FILES: $(1), use BUILD_PREBUILT instead!))) \
+$(if $(filter true,$(BUILD_BROKEN_VINTF_PRODUCT_COPY_FILES)),, \
+ $(if $(filter $(TARGET_COPY_OUT_SYSTEM)/etc/vintf/% \
+ $(TARGET_COPY_OUT_SYSTEM)/manifest.xml \
+ $(TARGET_COPY_OUT_SYSTEM)/compatibility_matrix.xml,$(2)), \
+ $(error VINTF metadata found in PRODUCT_COPY_FILES: $(1), use vintf_fragments instead!)) \
+ $(if $(filter $(TARGET_COPY_OUT_PRODUCT)/etc/vintf/%,$(2)), \
+ $(error VINTF metadata found in PRODUCT_COPY_FILES: $(1), \
+ use PRODUCT_MANIFEST_FILES / DEVICE_PRODUCT_COMPATIBILITY_MATRIX_FILE / vintf_compatibility_matrix / vintf_fragments instead!)) \
+ $(if $(filter $(TARGET_COPY_OUT_SYSTEM_EXT)/etc/vintf/%,$(2)), \
+ $(error VINTF metadata found in PRODUCT_COPY_FILES: $(1), \
+ use vintf_compatibility_matrix / vintf_fragments instead!)) \
+ $(if $(filter $(TARGET_COPY_OUT_VENDOR)/etc/vintf/% \
+ $(TARGET_COPY_OUT_VENDOR)/manifest.xml \
+ $(TARGET_COPY_OUT_VENDOR)/compatibility_matrix.xml,$(2)), \
+ $(error VINTF metadata found in PRODUCT_COPY_FILES: $(1), \
+ use DEVICE_MANIFEST_FILE / DEVICE_MATRIX_FILE / vintf_compatibility_matrix / vintf_fragments instead!)) \
+ $(if $(filter $(TARGET_COPY_OUT_ODM)/etc/vintf/% \
+ $(TARGET_COPY_OUT_ODM)/etc/manifest%,$(2)), \
+ $(error VINTF metadata found in PRODUCT_COPY_FILES: $(1), \
+ use ODM_MANIFEST_FILES / vintf_fragments instead!)) \
+)
endef
+
+check_elf_prebuilt_product_copy_files := true
+ifneq (,$(filter true,$(BUILD_BROKEN_ELF_PREBUILT_PRODUCT_COPY_FILES)))
+check_elf_prebuilt_product_copy_files :=
+endif
+check_elf_prebuilt_product_copy_files_hint := \
+ found ELF prebuilt in PRODUCT_COPY_FILES, use cc_prebuilt_binary / cc_prebuilt_library_shared instead.
+
# filter out the duplicate <source file>:<dest file> pairs.
unique_product_copy_files_pairs :=
$(foreach cf,$(PRODUCT_COPY_FILES), \
@@ -38,7 +67,10 @@
$(eval $(call copy-and-uncompress-dexs,$(_src),$(_fulldest))), \
$(if $(filter init%rc,$(notdir $(_dest)))$(filter %/etc/init,$(dir $(_dest))),\
$(eval $(call copy-init-script-file-checked,$(_src),$(_fulldest))),\
- $(eval $(call copy-one-file,$(_src),$(_fulldest)))))) \
+ $(if $(and $(filter true,$(check_elf_prebuilt_product_copy_files)), \
+ $(filter bin lib lib64,$(subst /,$(space),$(_dest)))), \
+ $(eval $(call copy-non-elf-file-checked,$(_src),$(_fulldest),$(check_elf_prebuilt_product_copy_files_hint))), \
+ $(eval $(call copy-one-file,$(_src),$(_fulldest))))))) \
$(eval unique_product_copy_files_destinations += $(_dest))))
# Dump a list of overriden (and ignored PRODUCT_COPY_FILES entries)
@@ -94,9 +126,11 @@
$(error duplicate header copies are no longer allowed. For more information about headers, see: https://android.googlesource.com/platform/build/soong/+/master/docs/best_practices.md#headers)
endif
+$(file >$(PRODUCT_OUT)/.copied_headers_list,$(TARGET_OUT_HEADERS) $(ALL_COPIED_HEADERS))
+
# -----------------------------------------------------------------
# docs/index.html
-ifeq (,$(TARGET_BUILD_APPS))
+ifeq (,$(TARGET_BUILD_UNBUNDLED))
gen := $(OUT_DOCS)/index.html
ALL_DOCS += $(gen)
$(gen): frameworks/base/docs/docs-redirect-index.html
@@ -127,339 +161,6 @@
$(call dist-for-goals,sdk,$(API_FINGERPRINT))
-# -----------------------------------------------------------------
-# property_overrides_split_enabled
-property_overrides_split_enabled :=
-ifeq ($(BOARD_PROPERTY_OVERRIDES_SPLIT_ENABLED), true)
- property_overrides_split_enabled := true
-endif
-
-# -----------------------------------------------------------------
-# FINAL_VENDOR_DEFAULT_PROPERTIES will be installed in vendor/default.prop if
-# property_overrides_split_enabled is true. Otherwise it will be installed in
-# ROOT/default.prop.
-ifdef BOARD_VNDK_VERSION
- ifeq ($(BOARD_VNDK_VERSION),current)
- FINAL_VENDOR_DEFAULT_PROPERTIES := ro.vndk.version=$(PLATFORM_VNDK_VERSION)
- else
- FINAL_VENDOR_DEFAULT_PROPERTIES := ro.vndk.version=$(BOARD_VNDK_VERSION)
- endif
- ifdef BOARD_VNDK_RUNTIME_DISABLE
- FINAL_VENDOR_DEFAULT_PROPERTIES += ro.vndk.lite=true
- endif
-else
- FINAL_VENDOR_DEFAULT_PROPERTIES := ro.vndk.version=$(PLATFORM_VNDK_VERSION)
- FINAL_VENDOR_DEFAULT_PROPERTIES += ro.vndk.lite=true
-endif
-FINAL_VENDOR_DEFAULT_PROPERTIES += \
- $(call collapse-pairs, $(PRODUCT_DEFAULT_PROPERTY_OVERRIDES))
-
-# Add cpu properties for bionic and ART.
-FINAL_VENDOR_DEFAULT_PROPERTIES += ro.bionic.arch=$(TARGET_ARCH)
-FINAL_VENDOR_DEFAULT_PROPERTIES += ro.bionic.cpu_variant=$(TARGET_CPU_VARIANT_RUNTIME)
-FINAL_VENDOR_DEFAULT_PROPERTIES += ro.bionic.2nd_arch=$(TARGET_2ND_ARCH)
-FINAL_VENDOR_DEFAULT_PROPERTIES += ro.bionic.2nd_cpu_variant=$(TARGET_2ND_CPU_VARIANT_RUNTIME)
-
-FINAL_VENDOR_DEFAULT_PROPERTIES += persist.sys.dalvik.vm.lib.2=libart.so
-FINAL_VENDOR_DEFAULT_PROPERTIES += dalvik.vm.isa.$(TARGET_ARCH).variant=$(DEX2OAT_TARGET_CPU_VARIANT_RUNTIME)
-ifneq ($(DEX2OAT_TARGET_INSTRUCTION_SET_FEATURES),)
- FINAL_VENDOR_DEFAULT_PROPERTIES += dalvik.vm.isa.$(TARGET_ARCH).features=$(DEX2OAT_TARGET_INSTRUCTION_SET_FEATURES)
-endif
-
-ifdef TARGET_2ND_ARCH
- FINAL_VENDOR_DEFAULT_PROPERTIES += dalvik.vm.isa.$(TARGET_2ND_ARCH).variant=$($(TARGET_2ND_ARCH_VAR_PREFIX)DEX2OAT_TARGET_CPU_VARIANT_RUNTIME)
- ifneq ($($(TARGET_2ND_ARCH_VAR_PREFIX)DEX2OAT_TARGET_INSTRUCTION_SET_FEATURES),)
- FINAL_VENDOR_DEFAULT_PROPERTIES += dalvik.vm.isa.$(TARGET_2ND_ARCH).features=$($(TARGET_2ND_ARCH_VAR_PREFIX)DEX2OAT_TARGET_INSTRUCTION_SET_FEATURES)
- endif
-endif
-
-# Although these variables are prefixed with TARGET_RECOVERY_, they are also needed under charger
-# mode (via libminui).
-ifdef TARGET_RECOVERY_DEFAULT_ROTATION
-FINAL_VENDOR_DEFAULT_PROPERTIES += \
- ro.minui.default_rotation=$(TARGET_RECOVERY_DEFAULT_ROTATION)
-endif
-ifdef TARGET_RECOVERY_OVERSCAN_PERCENT
-FINAL_VENDOR_DEFAULT_PROPERTIES += \
- ro.minui.overscan_percent=$(TARGET_RECOVERY_OVERSCAN_PERCENT)
-endif
-ifdef TARGET_RECOVERY_PIXEL_FORMAT
-FINAL_VENDOR_DEFAULT_PROPERTIES += \
- ro.minui.pixel_format=$(TARGET_RECOVERY_PIXEL_FORMAT)
-endif
-FINAL_VENDOR_DEFAULT_PROPERTIES := $(call uniq-pairs-by-first-component, \
- $(FINAL_VENDOR_DEFAULT_PROPERTIES),=)
-
-# -----------------------------------------------------------------
-# prop.default
-
-BUILDINFO_SH := build/make/tools/buildinfo.sh
-BUILDINFO_COMMON_SH := build/make/tools/buildinfo_common.sh
-POST_PROCESS_PROPS :=$= build/make/tools/post_process_props.py
-
-# Generates a set of sysprops common to all partitions to a file.
-# $(1): Partition name
-# $(2): Output file name
-define generate-common-build-props
- PRODUCT_BRAND="$(PRODUCT_BRAND)" \
- PRODUCT_DEVICE="$(TARGET_DEVICE)" \
- PRODUCT_MANUFACTURER="$(PRODUCT_MANUFACTURER)" \
- PRODUCT_MODEL="$(PRODUCT_MODEL)" \
- PRODUCT_NAME="$(TARGET_PRODUCT)" \
- $(call generate-common-build-props-with-product-vars-set,$(1),$(2))
-endef
-
-# Like the above macro, but requiring the relevant PRODUCT_ environment
-# variables to be set when called.
-define generate-common-build-props-with-product-vars-set
- BUILD_FINGERPRINT="$(BUILD_FINGERPRINT_FROM_FILE)" \
- BUILD_ID="$(BUILD_ID)" \
- BUILD_NUMBER="$(BUILD_NUMBER_FROM_FILE)" \
- BUILD_VERSION_TAGS="$(BUILD_VERSION_TAGS)" \
- DATE="$(DATE_FROM_FILE)" \
- PLATFORM_SDK_VERSION="$(PLATFORM_SDK_VERSION)" \
- PLATFORM_VERSION="$(PLATFORM_VERSION)" \
- TARGET_BUILD_TYPE="$(TARGET_BUILD_VARIANT)" \
- bash $(BUILDINFO_COMMON_SH) "$(1)" >> $(2)
-endef
-
-ifdef property_overrides_split_enabled
-INSTALLED_DEFAULT_PROP_TARGET := $(TARGET_OUT)/etc/prop.default
-INSTALLED_DEFAULT_PROP_OLD_TARGET := $(TARGET_ROOT_OUT)/default.prop
-ALL_DEFAULT_INSTALLED_MODULES += $(INSTALLED_DEFAULT_PROP_OLD_TARGET)
-$(INSTALLED_DEFAULT_PROP_OLD_TARGET): $(INSTALLED_DEFAULT_PROP_TARGET)
-else
-# legacy path
-INSTALLED_DEFAULT_PROP_TARGET := $(TARGET_ROOT_OUT)/default.prop
-endif
-ALL_DEFAULT_INSTALLED_MODULES += $(INSTALLED_DEFAULT_PROP_TARGET)
-FINAL_DEFAULT_PROPERTIES := \
- $(call collapse-pairs, $(ADDITIONAL_DEFAULT_PROPERTIES)) \
- $(call collapse-pairs, $(PRODUCT_SYSTEM_DEFAULT_PROPERTIES))
-ifndef property_overrides_split_enabled
- FINAL_DEFAULT_PROPERTIES += \
- $(call collapse-pairs, $(FINAL_VENDOR_DEFAULT_PROPERTIES))
-endif
-FINAL_DEFAULT_PROPERTIES := $(call uniq-pairs-by-first-component, \
- $(FINAL_DEFAULT_PROPERTIES),=)
-
-intermediate_system_build_prop := $(call intermediates-dir-for,ETC,system_build_prop)/build.prop
-
-$(INSTALLED_DEFAULT_PROP_TARGET): $(BUILDINFO_COMMON_SH) $(POST_PROCESS_PROPS) $(intermediate_system_build_prop)
- @echo Target buildinfo: $@
- @mkdir -p $(dir $@)
- @rm -f $@
- $(hide) echo "#" > $@; \
- echo "# ADDITIONAL_DEFAULT_PROPERTIES" >> $@; \
- echo "#" >> $@;
- $(hide) $(foreach line,$(FINAL_DEFAULT_PROPERTIES), \
- echo "$(line)" >> $@;)
- $(hide) $(POST_PROCESS_PROPS) $@
-ifdef property_overrides_split_enabled
- $(hide) mkdir -p $(TARGET_ROOT_OUT)
- $(hide) ln -sf system/etc/prop.default $(INSTALLED_DEFAULT_PROP_OLD_TARGET)
-endif
-
-# -----------------------------------------------------------------
-# vendor default.prop
-INSTALLED_VENDOR_DEFAULT_PROP_TARGET :=
-ifdef property_overrides_split_enabled
-INSTALLED_VENDOR_DEFAULT_PROP_TARGET := $(TARGET_OUT_VENDOR)/default.prop
-ALL_DEFAULT_INSTALLED_MODULES += $(INSTALLED_VENDOR_DEFAULT_PROP_TARGET)
-
-$(INSTALLED_VENDOR_DEFAULT_PROP_TARGET): $(INSTALLED_DEFAULT_PROP_TARGET) $(POST_PROCESS_PROPS)
- @echo Target buildinfo: $@
- @mkdir -p $(dir $@)
- $(hide) echo "#" > $@; \
- echo "# ADDITIONAL VENDOR DEFAULT PROPERTIES" >> $@; \
- echo "#" >> $@;
- $(hide) $(foreach line,$(FINAL_VENDOR_DEFAULT_PROPERTIES), \
- echo "$(line)" >> $@;)
- $(hide) $(POST_PROCESS_PROPS) $@
-
-endif # property_overrides_split_enabled
-
-# -----------------------------------------------------------------
-# build.prop
-INSTALLED_BUILD_PROP_TARGET := $(TARGET_OUT)/build.prop
-ALL_DEFAULT_INSTALLED_MODULES += $(INSTALLED_BUILD_PROP_TARGET)
-FINAL_BUILD_PROPERTIES := \
- $(call collapse-pairs, $(ADDITIONAL_BUILD_PROPERTIES))
-FINAL_BUILD_PROPERTIES := $(call uniq-pairs-by-first-component, \
- $(FINAL_BUILD_PROPERTIES),=)
-
-# A list of arbitrary tags describing the build configuration.
-# Force ":=" so we can use +=
-BUILD_VERSION_TAGS := $(BUILD_VERSION_TAGS)
-ifeq ($(TARGET_BUILD_TYPE),debug)
- BUILD_VERSION_TAGS += debug
-endif
-# The "test-keys" tag marks builds signed with the old test keys,
-# which are available in the SDK. "dev-keys" marks builds signed with
-# non-default dev keys (usually private keys from a vendor directory).
-# Both of these tags will be removed and replaced with "release-keys"
-# when the target-files is signed in a post-build step.
-ifeq ($(DEFAULT_SYSTEM_DEV_CERTIFICATE),build/make/target/product/security/testkey)
-BUILD_KEYS := test-keys
-else
-BUILD_KEYS := dev-keys
-endif
-BUILD_VERSION_TAGS += $(BUILD_KEYS)
-BUILD_VERSION_TAGS := $(subst $(space),$(comma),$(sort $(BUILD_VERSION_TAGS)))
-
-# A human-readable string that descibes this build in detail.
-build_desc := $(TARGET_PRODUCT)-$(TARGET_BUILD_VARIANT) $(PLATFORM_VERSION) $(BUILD_ID) $(BUILD_NUMBER_FROM_FILE) $(BUILD_VERSION_TAGS)
-$(intermediate_system_build_prop): PRIVATE_BUILD_DESC := $(build_desc)
-
-# The string used to uniquely identify the combined build and product; used by the OTA server.
-ifeq (,$(strip $(BUILD_FINGERPRINT)))
- ifeq ($(strip $(HAS_BUILD_NUMBER)),false)
- BF_BUILD_NUMBER := $(BUILD_USERNAME)$$($(DATE_FROM_FILE) +%m%d%H%M)
- else
- BF_BUILD_NUMBER := $(file <$(BUILD_NUMBER_FILE))
- endif
- BUILD_FINGERPRINT := $(PRODUCT_BRAND)/$(TARGET_PRODUCT)/$(TARGET_DEVICE):$(PLATFORM_VERSION)/$(BUILD_ID)/$(BF_BUILD_NUMBER):$(TARGET_BUILD_VARIANT)/$(BUILD_VERSION_TAGS)
-endif
-# unset it for safety.
-BF_BUILD_NUMBER :=
-
-BUILD_FINGERPRINT_FILE := $(PRODUCT_OUT)/build_fingerprint.txt
-ifneq (,$(shell mkdir -p $(PRODUCT_OUT) && echo $(BUILD_FINGERPRINT) >$(BUILD_FINGERPRINT_FILE) && grep " " $(BUILD_FINGERPRINT_FILE)))
- $(error BUILD_FINGERPRINT cannot contain spaces: "$(file <$(BUILD_FINGERPRINT_FILE))")
-endif
-BUILD_FINGERPRINT_FROM_FILE := $$(cat $(BUILD_FINGERPRINT_FILE))
-# unset it for safety.
-BUILD_FINGERPRINT :=
-
-# The string used to uniquely identify the system build; used by the OTA server.
-# This purposefully excludes any product-specific variables.
-ifeq (,$(strip $(BUILD_THUMBPRINT)))
- BUILD_THUMBPRINT := $(PLATFORM_VERSION)/$(BUILD_ID)/$(BUILD_NUMBER_FROM_FILE):$(TARGET_BUILD_VARIANT)/$(BUILD_VERSION_TAGS)
-endif
-
-BUILD_THUMBPRINT_FILE := $(PRODUCT_OUT)/build_thumbprint.txt
-ifneq (,$(shell mkdir -p $(PRODUCT_OUT) && echo $(BUILD_THUMBPRINT) >$(BUILD_THUMBPRINT_FILE) && grep " " $(BUILD_THUMBPRINT_FILE)))
- $(error BUILD_THUMBPRINT cannot contain spaces: "$(file <$(BUILD_THUMBPRINT_FILE))")
-endif
-BUILD_THUMBPRINT_FROM_FILE := $$(cat $(BUILD_THUMBPRINT_FILE))
-# unset it for safety.
-BUILD_THUMBPRINT :=
-
-KNOWN_OEM_THUMBPRINT_PROPERTIES := \
- ro.product.brand \
- ro.product.name \
- ro.product.device
-OEM_THUMBPRINT_PROPERTIES := $(filter $(KNOWN_OEM_THUMBPRINT_PROPERTIES),\
- $(PRODUCT_OEM_PROPERTIES))
-
-# Display parameters shown under Settings -> About Phone
-ifeq ($(TARGET_BUILD_VARIANT),user)
- # User builds should show:
- # release build number or branch.buld_number non-release builds
-
- # Dev. branches should have DISPLAY_BUILD_NUMBER set
- ifeq (true,$(DISPLAY_BUILD_NUMBER))
- BUILD_DISPLAY_ID := $(BUILD_ID).$(BUILD_NUMBER_FROM_FILE) $(BUILD_KEYS)
- else
- BUILD_DISPLAY_ID := $(BUILD_ID) $(BUILD_KEYS)
- endif
-else
- # Non-user builds should show detailed build information
- BUILD_DISPLAY_ID := $(build_desc)
-endif
-
-# Accepts a whitespace separated list of product locales such as
-# (en_US en_AU en_GB...) and returns the first locale in the list with
-# underscores replaced with hyphens. In the example above, this will
-# return "en-US".
-define get-default-product-locale
-$(strip $(subst _,-, $(firstword $(1))))
-endef
-
-# TARGET_BUILD_FLAVOR and ro.build.flavor are used only by the test
-# harness to distinguish builds. Only add _asan for a sanitized build
-# if it isn't already a part of the flavor (via a dedicated lunch
-# config for example).
-TARGET_BUILD_FLAVOR := $(TARGET_PRODUCT)-$(TARGET_BUILD_VARIANT)
-ifneq (, $(filter address, $(SANITIZE_TARGET)))
-ifeq (,$(findstring _asan,$(TARGET_BUILD_FLAVOR)))
-TARGET_BUILD_FLAVOR := $(TARGET_BUILD_FLAVOR)_asan
-endif
-endif
-
-ifdef TARGET_SYSTEM_PROP
-system_prop_file := $(TARGET_SYSTEM_PROP)
-else
-system_prop_file := $(wildcard $(TARGET_DEVICE_DIR)/system.prop)
-endif
-$(intermediate_system_build_prop): $(BUILDINFO_SH) $(BUILDINFO_COMMON_SH) $(INTERNAL_BUILD_ID_MAKEFILE) $(BUILD_SYSTEM)/version_defaults.mk $(system_prop_file) $(INSTALLED_ANDROID_INFO_TXT_TARGET) $(API_FINGERPRINT) $(POST_PROCESS_PROPS)
- @echo Target buildinfo: $@
- @mkdir -p $(dir $@)
- $(hide) echo > $@
-ifneq ($(PRODUCT_OEM_PROPERTIES),)
- $(hide) echo "#" >> $@; \
- echo "# PRODUCT_OEM_PROPERTIES" >> $@; \
- echo "#" >> $@;
- $(hide) $(foreach prop,$(PRODUCT_OEM_PROPERTIES), \
- echo "import /oem/oem.prop $(prop)" >> $@;)
-endif
- $(hide) PRODUCT_BRAND="$(PRODUCT_SYSTEM_BRAND)" \
- PRODUCT_MANUFACTURER="$(PRODUCT_SYSTEM_MANUFACTURER)" \
- PRODUCT_MODEL="$(PRODUCT_SYSTEM_MODEL)" \
- PRODUCT_NAME="$(PRODUCT_SYSTEM_NAME)" \
- PRODUCT_DEVICE="$(PRODUCT_SYSTEM_DEVICE)" \
- $(call generate-common-build-props-with-product-vars-set,system,$@)
- $(hide) TARGET_BUILD_TYPE="$(TARGET_BUILD_VARIANT)" \
- TARGET_BUILD_FLAVOR="$(TARGET_BUILD_FLAVOR)" \
- TARGET_DEVICE="$(TARGET_DEVICE)" \
- PRODUCT_DEFAULT_LOCALE="$(call get-default-product-locale,$(PRODUCT_LOCALES))" \
- PRODUCT_DEFAULT_WIFI_CHANNELS="$(PRODUCT_DEFAULT_WIFI_CHANNELS)" \
- PRIVATE_BUILD_DESC="$(PRIVATE_BUILD_DESC)" \
- BUILD_ID="$(BUILD_ID)" \
- BUILD_DISPLAY_ID="$(BUILD_DISPLAY_ID)" \
- DATE="$(DATE_FROM_FILE)" \
- BUILD_USERNAME="$(BUILD_USERNAME)" \
- BUILD_HOSTNAME="$(BUILD_HOSTNAME)" \
- BUILD_NUMBER="$(BUILD_NUMBER_FROM_FILE)" \
- BOARD_BUILD_SYSTEM_ROOT_IMAGE="$(BOARD_BUILD_SYSTEM_ROOT_IMAGE)" \
- PLATFORM_VERSION="$(PLATFORM_VERSION)" \
- PLATFORM_SECURITY_PATCH="$(PLATFORM_SECURITY_PATCH)" \
- PLATFORM_BASE_OS="$(PLATFORM_BASE_OS)" \
- PLATFORM_SDK_VERSION="$(PLATFORM_SDK_VERSION)" \
- PLATFORM_PREVIEW_SDK_VERSION="$(PLATFORM_PREVIEW_SDK_VERSION)" \
- PLATFORM_PREVIEW_SDK_FINGERPRINT="$$(cat $(API_FINGERPRINT))" \
- PLATFORM_VERSION_CODENAME="$(PLATFORM_VERSION_CODENAME)" \
- PLATFORM_VERSION_ALL_CODENAMES="$(PLATFORM_VERSION_ALL_CODENAMES)" \
- PLATFORM_MIN_SUPPORTED_TARGET_SDK_VERSION="$(PLATFORM_MIN_SUPPORTED_TARGET_SDK_VERSION)" \
- BUILD_VERSION_TAGS="$(BUILD_VERSION_TAGS)" \
- $(if $(OEM_THUMBPRINT_PROPERTIES),BUILD_THUMBPRINT="$(BUILD_THUMBPRINT_FROM_FILE)") \
- TARGET_CPU_ABI_LIST="$(TARGET_CPU_ABI_LIST)" \
- TARGET_CPU_ABI_LIST_32_BIT="$(TARGET_CPU_ABI_LIST_32_BIT)" \
- TARGET_CPU_ABI_LIST_64_BIT="$(TARGET_CPU_ABI_LIST_64_BIT)" \
- TARGET_CPU_ABI="$(TARGET_CPU_ABI)" \
- TARGET_CPU_ABI2="$(TARGET_CPU_ABI2)" \
- bash $(BUILDINFO_SH) >> $@
- $(hide) $(foreach file,$(system_prop_file), \
- if [ -f "$(file)" ]; then \
- echo Target buildinfo from: "$(file)"; \
- echo "" >> $@; \
- echo "#" >> $@; \
- echo "# from $(file)" >> $@; \
- echo "#" >> $@; \
- cat $(file) >> $@; \
- echo "# end of $(file)" >> $@; \
- fi;)
- $(if $(FINAL_BUILD_PROPERTIES), \
- $(hide) echo >> $@; \
- echo "#" >> $@; \
- echo "# ADDITIONAL_BUILD_PROPERTIES" >> $@; \
- echo "#" >> $@; )
- $(hide) $(foreach line,$(FINAL_BUILD_PROPERTIES), \
- echo "$(line)" >> $@;)
- $(hide) $(POST_PROCESS_PROPS) $@ $(PRODUCT_SYSTEM_PROPERTY_BLACKLIST)
-
-build_desc :=
-
INSTALLED_RECOVERYIMAGE_TARGET :=
ifdef BUILDING_RECOVERY_IMAGE
ifneq ($(BOARD_USES_RECOVERY_AS_BOOT),true)
@@ -467,168 +168,7 @@
endif
endif
-$(INSTALLED_BUILD_PROP_TARGET): $(intermediate_system_build_prop)
- @echo "Target build info: $@"
- $(hide) grep -v 'ro.product.first_api_level' $(intermediate_system_build_prop) > $@
-
-# -----------------------------------------------------------------
-# vendor build.prop
-#
-# For verifying that the vendor build is what we think it is
-INSTALLED_VENDOR_BUILD_PROP_TARGET := $(TARGET_OUT_VENDOR)/build.prop
-ALL_DEFAULT_INSTALLED_MODULES += $(INSTALLED_VENDOR_BUILD_PROP_TARGET)
-
-ifdef property_overrides_split_enabled
-FINAL_VENDOR_BUILD_PROPERTIES += \
- $(call collapse-pairs, $(PRODUCT_PROPERTY_OVERRIDES))
-FINAL_VENDOR_BUILD_PROPERTIES := $(call uniq-pairs-by-first-component, \
- $(FINAL_VENDOR_BUILD_PROPERTIES),=)
-endif # property_overrides_split_enabled
-
-$(INSTALLED_VENDOR_BUILD_PROP_TARGET): $(BUILDINFO_COMMON_SH) $(POST_PROCESS_PROPS) $(intermediate_system_build_prop)
- @echo Target vendor buildinfo: $@
- @mkdir -p $(dir $@)
- $(hide) echo > $@
-ifeq ($(PRODUCT_USE_DYNAMIC_PARTITIONS),true)
- $(hide) echo ro.boot.dynamic_partitions=true >> $@
-endif
-ifeq ($(PRODUCT_RETROFIT_DYNAMIC_PARTITIONS),true)
- $(hide) echo ro.boot.dynamic_partitions_retrofit=true >> $@
-endif
- $(hide) grep 'ro.product.first_api_level' $(intermediate_system_build_prop) >> $@ || true
- $(hide) echo ro.vendor.build.security_patch="$(VENDOR_SECURITY_PATCH)">>$@
- $(hide) echo ro.vendor.product.cpu.abilist="$(TARGET_CPU_ABI_LIST)">>$@
- $(hide) echo ro.vendor.product.cpu.abilist32="$(TARGET_CPU_ABI_LIST_32_BIT)">>$@
- $(hide) echo ro.vendor.product.cpu.abilist64="$(TARGET_CPU_ABI_LIST_64_BIT)">>$@
- $(hide) echo ro.product.board="$(TARGET_BOOTLOADER_BOARD_NAME)">>$@
- $(hide) echo ro.board.platform="$(TARGET_BOARD_PLATFORM)">>$@
- $(hide) echo ro.hwui.use_vulkan="$(TARGET_USES_VULKAN)">>$@
-ifdef TARGET_SCREEN_DENSITY
- $(hide) echo ro.sf.lcd_density="$(TARGET_SCREEN_DENSITY)">>$@
-endif
-ifeq ($(AB_OTA_UPDATER),true)
- $(hide) echo ro.build.ab_update=true >> $@
-endif
- $(hide) $(call generate-common-build-props,vendor,$@)
- $(hide) echo "#" >> $@; \
- echo "# BOOTIMAGE_BUILD_PROPERTIES" >> $@; \
- echo "#" >> $@;
- $(hide) echo ro.bootimage.build.date=`$(DATE_FROM_FILE)`>>$@
- $(hide) echo ro.bootimage.build.date.utc=`$(DATE_FROM_FILE) +%s`>>$@
- $(hide) echo ro.bootimage.build.fingerprint="$(BUILD_FINGERPRINT_FROM_FILE)">>$@
- $(hide) echo "#" >> $@; \
- echo "# ADDITIONAL VENDOR BUILD PROPERTIES" >> $@; \
- echo "#" >> $@;
- $(hide) cat $(INSTALLED_ANDROID_INFO_TXT_TARGET) | grep 'require version-' | sed -e 's/require version-/ro.build.expect./g' >> $@
-ifdef property_overrides_split_enabled
- $(hide) $(foreach line,$(FINAL_VENDOR_BUILD_PROPERTIES), \
- echo "$(line)" >> $@;)
-endif # property_overrides_split_enabled
- $(hide) $(POST_PROCESS_PROPS) $@ $(PRODUCT_VENDOR_PROPERTY_BLACKLIST)
-
-# -----------------------------------------------------------------
-# product build.prop
-INSTALLED_PRODUCT_BUILD_PROP_TARGET := $(TARGET_OUT_PRODUCT)/build.prop
-ALL_DEFAULT_INSTALLED_MODULES += $(INSTALLED_PRODUCT_BUILD_PROP_TARGET)
-
-ifdef TARGET_PRODUCT_PROP
-product_prop_files := $(TARGET_PRODUCT_PROP)
-else
-product_prop_files := $(wildcard $(TARGET_DEVICE_DIR)/product.prop)
-endif
-
-FINAL_PRODUCT_PROPERTIES += \
- $(call collapse-pairs, $(PRODUCT_PRODUCT_PROPERTIES) $(ADDITIONAL_PRODUCT_PROPERTIES))
-FINAL_PRODUCT_PROPERTIES := $(call uniq-pairs-by-first-component, \
- $(FINAL_PRODUCT_PROPERTIES),=)
-
-$(INSTALLED_PRODUCT_BUILD_PROP_TARGET): $(BUILDINFO_COMMON_SH) $(POST_PROCESS_PROPS) $(product_prop_files)
- @echo Target product buildinfo: $@
- @mkdir -p $(dir $@)
- $(hide) echo > $@
-ifdef BOARD_USES_PRODUCTIMAGE
- $(hide) $(call generate-common-build-props,product,$@)
-endif # BOARD_USES_PRODUCTIMAGE
- $(hide) $(foreach file,$(product_prop_files), \
- if [ -f "$(file)" ]; then \
- echo Target product properties from: "$(file)"; \
- echo "" >> $@; \
- echo "#" >> $@; \
- echo "# from $(file)" >> $@; \
- echo "#" >> $@; \
- cat $(file) >> $@; \
- echo "# end of $(file)" >> $@; \
- fi;)
- $(hide) echo "#" >> $@; \
- echo "# ADDITIONAL PRODUCT PROPERTIES" >> $@; \
- echo "#" >> $@; \
- echo "ro.build.characteristics=$(TARGET_AAPT_CHARACTERISTICS)" >> $@;
- $(hide) $(foreach line,$(FINAL_PRODUCT_PROPERTIES), \
- echo "$(line)" >> $@;)
- $(hide) $(POST_PROCESS_PROPS) $@
-
-# ----------------------------------------------------------------
-# odm build.prop
-INSTALLED_ODM_BUILD_PROP_TARGET := $(TARGET_OUT_ODM)/etc/build.prop
-ALL_DEFAULT_INSTALLED_MODULES += $(INSTALLED_ODM_BUILD_PROP_TARGET)
-
-FINAL_ODM_BUILD_PROPERTIES += \
- $(call collapse-pairs, $(PRODUCT_ODM_PROPERTIES))
-FINAL_ODM_BUILD_PROPERTIES := $(call uniq-pairs-by-first-component, \
- $(FINAL_ODM_BUILD_PROPERTIES),=)
-
-$(INSTALLED_ODM_BUILD_PROP_TARGET): $(BUILDINFO_COMMON_SH) $(POST_PROCESS_PROPS)
- @echo Target odm buildinfo: $@
- @mkdir -p $(dir $@)
- $(hide) echo > $@
- $(hide) echo ro.odm.product.cpu.abilist="$(TARGET_CPU_ABI_LIST)">>$@
- $(hide) echo ro.odm.product.cpu.abilist32="$(TARGET_CPU_ABI_LIST_32_BIT)">>$@
- $(hide) echo ro.odm.product.cpu.abilist64="$(TARGET_CPU_ABI_LIST_64_BIT)">>$@
- $(hide) $(call generate-common-build-props,odm,$@)
- $(hide) echo "#" >> $@; \
- echo "# ADDITIONAL ODM BUILD PROPERTIES" >> $@; \
- echo "#" >> $@;
- $(hide) $(foreach line,$(FINAL_ODM_BUILD_PROPERTIES), \
- echo "$(line)" >> $@;)
- $(hide) $(POST_PROCESS_PROPS) $@
-
-# -----------------------------------------------------------------
-# system_ext build.prop
-INSTALLED_SYSTEM_EXT_BUILD_PROP_TARGET := $(TARGET_OUT_SYSTEM_EXT)/build.prop
-ALL_DEFAULT_INSTALLED_MODULES += $(INSTALLED_SYSTEM_EXT_BUILD_PROP_TARGET)
-
-ifdef TARGET_SYSTEM_EXT_PROP
-system_ext_prop_files := $(TARGET_SYSTEM_EXT_PROP)
-else
-system_ext_prop_files := $(wildcard $(TARGET_DEVICE_DIR)/system_ext.prop)
-endif
-
-FINAL_SYSTEM_EXT_PROPERTIES += \
- $(call collapse-pairs, $(PRODUCT_SYSTEM_EXT_PROPERTIES))
-FINAL_SYSTEM_EXT_PROPERTIES := $(call uniq-pairs-by-first-component, \
- $(FINAL_SYSTEM_EXT_PROPERTIES),=)
-
-$(INSTALLED_SYSTEM_EXT_BUILD_PROP_TARGET): $(BUILDINFO_COMMON_SH) $(POST_PROCESS_PROPS) $(system_ext_prop_files)
- @echo Target system_ext buildinfo: $@
- @mkdir -p $(dir $@)
- $(hide) echo > $@
- $(hide) $(call generate-common-build-props,system_ext,$@)
- $(hide) $(foreach file,$(system_ext_prop_files), \
- if [ -f "$(file)" ]; then \
- echo Target system_ext properties from: "$(file)"; \
- echo "" >> $@; \
- echo "#" >> $@; \
- echo "# from $(file)" >> $@; \
- echo "#" >> $@; \
- cat $(file) >> $@; \
- echo "# end of $(file)" >> $@; \
- fi;)
- $(hide) echo "#" >> $@; \
- echo "# ADDITIONAL SYSTEM_EXT BUILD PROPERTIES" >> $@; \
- echo "#" >> $@;
- $(hide) $(foreach line,$(FINAL_SYSTEM_EXT_PROPERTIES), \
- echo "$(line)" >> $@;)
- $(hide) $(POST_PROCESS_PROPS) $@
+include $(BUILD_SYSTEM)/sysprop.mk
# ----------------------------------------------------------------
@@ -664,20 +204,36 @@
# Depmod requires a well-formed kernel version so 0.0 is used as a placeholder.
DEPMOD_STAGING_SUBDIR :=$= lib/modules/0.0
+define copy-and-strip-kernel-module
+$(2): $(1)
+ $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_STRIP) -o $(2) --strip-debug $(1)
+endef
+
# $(1): modules list
# $(2): output dir
# $(3): mount point
# $(4): staging dir
# $(5): module load list
# $(6): module load list filename
+# $(7): module archive
+# $(8): staging dir for stripped modules
+# $(9): module directory name
# Returns the a list of src:dest pairs to install the modules using copy-many-files.
define build-image-kernel-modules
- $(foreach module,$(1),$(module):$(2)/lib/modules/$(notdir $(module))) \
- $(eval $(call build-image-kernel-modules-depmod,$(1),$(3),$(4),$(5),$(6))) \
- $(4)/$(DEPMOD_STAGING_SUBDIR)/modules.dep:$(2)/lib/modules/modules.dep \
- $(4)/$(DEPMOD_STAGING_SUBDIR)/modules.alias:$(2)/lib/modules/modules.alias \
- $(4)/$(DEPMOD_STAGING_SUBDIR)/modules.softdep:$(2)/lib/modules/modules.softdep \
- $(4)/$(DEPMOD_STAGING_SUBDIR)/$(6):$(2)/lib/modules/$(6)
+ $(if $(9), \
+ $(eval _dir := $(9)/), \
+ $(eval _dir :=)) \
+ $(foreach module,$(1), \
+ $(eval _src := $(module)) \
+ $(if $(8), \
+ $(eval _src := $(8)/$(notdir $(module))) \
+ $(eval $(call copy-and-strip-kernel-module,$(module),$(_src)))) \
+ $(_src):$(2)/lib/modules/$(_dir)$(notdir $(module))) \
+ $(eval $(call build-image-kernel-modules-depmod,$(1),$(3),$(4),$(5),$(6),$(7),$(2),$(9))) \
+ $(4)/$(DEPMOD_STAGING_SUBDIR)/modules.dep:$(2)/lib/modules/$(_dir)modules.dep \
+ $(4)/$(DEPMOD_STAGING_SUBDIR)/modules.alias:$(2)/lib/modules/$(_dir)modules.alias \
+ $(4)/$(DEPMOD_STAGING_SUBDIR)/modules.softdep:$(2)/lib/modules/$(_dir)modules.softdep \
+ $(4)/$(DEPMOD_STAGING_SUBDIR)/$(6):$(2)/lib/modules/$(_dir)$(6)
endef
# $(1): modules list
@@ -685,106 +241,159 @@
# $(3): staging dir
# $(4): module load list
# $(5): module load list filename
+# $(6): module archive
+# $(7): output dir
+# $(8): module directory name
+# TODO(b/144844424): If a module archive is being used, this step (which
+# generates obj/PACKAGING/.../modules.dep) also unzips the module archive into
+# the output directory. This should be moved to a module with a
+# LOCAL_POST_INSTALL_CMD so that if modules.dep is removed from the output dir,
+# the archive modules are restored along with modules.dep.
define build-image-kernel-modules-depmod
$(3)/$(DEPMOD_STAGING_SUBDIR)/modules.dep: .KATI_IMPLICIT_OUTPUTS := $(3)/$(DEPMOD_STAGING_SUBDIR)/modules.alias $(3)/$(DEPMOD_STAGING_SUBDIR)/modules.softdep $(3)/$(DEPMOD_STAGING_SUBDIR)/$(5)
$(3)/$(DEPMOD_STAGING_SUBDIR)/modules.dep: $(DEPMOD)
$(3)/$(DEPMOD_STAGING_SUBDIR)/modules.dep: PRIVATE_MODULES := $(1)
$(3)/$(DEPMOD_STAGING_SUBDIR)/modules.dep: PRIVATE_MOUNT_POINT := $(2)
-$(3)/$(DEPMOD_STAGING_SUBDIR)/modules.dep: PRIVATE_MODULE_DIR := $(3)/$(DEPMOD_STAGING_SUBDIR)/$(2)/lib/modules
+$(3)/$(DEPMOD_STAGING_SUBDIR)/modules.dep: PRIVATE_MODULE_DIR := $(3)/$(DEPMOD_STAGING_SUBDIR)/$(2)/lib/modules/$(8)
$(3)/$(DEPMOD_STAGING_SUBDIR)/modules.dep: PRIVATE_STAGING_DIR := $(3)
$(3)/$(DEPMOD_STAGING_SUBDIR)/modules.dep: PRIVATE_LOAD_MODULES := $(4)
$(3)/$(DEPMOD_STAGING_SUBDIR)/modules.dep: PRIVATE_LOAD_FILE := $(3)/$(DEPMOD_STAGING_SUBDIR)/$(5)
-$(3)/$(DEPMOD_STAGING_SUBDIR)/modules.dep: $(1)
+$(3)/$(DEPMOD_STAGING_SUBDIR)/modules.dep: PRIVATE_MODULE_ARCHIVE := $(6)
+$(3)/$(DEPMOD_STAGING_SUBDIR)/modules.dep: PRIVATE_OUTPUT_DIR := $(7)
+$(3)/$(DEPMOD_STAGING_SUBDIR)/modules.dep: $(1) $(6)
@echo depmod $$(PRIVATE_STAGING_DIR)
rm -rf $$(PRIVATE_STAGING_DIR)
mkdir -p $$(PRIVATE_MODULE_DIR)
- cp $$(PRIVATE_MODULES) $$(PRIVATE_MODULE_DIR)/
+ $(if $(6),\
+ unzip -qo -d $$(PRIVATE_MODULE_DIR) $$(PRIVATE_MODULE_ARCHIVE); \
+ mkdir -p $$(PRIVATE_OUTPUT_DIR)/lib; \
+ cp -r $(3)/$(DEPMOD_STAGING_SUBDIR)/$(2)/lib/modules $$(PRIVATE_OUTPUT_DIR)/lib/; \
+ find $$(PRIVATE_MODULE_DIR) -type f -name *.ko | xargs basename -a > $$(PRIVATE_LOAD_FILE); \
+ )
+ $(if $(1),\
+ cp $$(PRIVATE_MODULES) $$(PRIVATE_MODULE_DIR)/; \
+ for MODULE in $$(PRIVATE_LOAD_MODULES); do \
+ basename $$$$MODULE >> $$(PRIVATE_LOAD_FILE); \
+ done; \
+ )
$(DEPMOD) -b $$(PRIVATE_STAGING_DIR) 0.0
# Turn paths in modules.dep into absolute paths
sed -i.tmp -e 's|\([^: ]*lib/modules/[^: ]*\)|/\1|g' $$(PRIVATE_STAGING_DIR)/$$(DEPMOD_STAGING_SUBDIR)/modules.dep
touch $$(PRIVATE_LOAD_FILE)
- (for MODULE in $$(PRIVATE_LOAD_MODULES); do basename $$$$MODULE >> $$(PRIVATE_LOAD_FILE); done)
endef
# $(1): staging dir
-# $(2): module load list
-# $(3): module load list filename
-# $(4): output dir
+# $(2): modules list
+# $(3): module load list
+# $(4): module load list filename
+# $(5): output dir
define module-load-list-copy-paths
- $(eval $(call build-image-module-load-list,$(1),$(2),$(3))) \
- $(1)/$(DEPMOD_STAGING_SUBDIR)/$(3):$(4)/lib/modules/$(3)
+ $(eval $(call build-image-module-load-list,$(1),$(2),$(3),$(4))) \
+ $(1)/$(DEPMOD_STAGING_SUBDIR)/$(4):$(5)/lib/modules/$(4)
endef
# $(1): staging dir
-# $(2): module load list
-# $(3): module load list filename
+# $(2): modules list
+# $(3): module load list
+# $(4): module load list filename
define build-image-module-load-list
-$(1)/$(DEPMOD_STAGING_SUBDIR)/$(3): PRIVATE_STAGING_DIR := $(1)
-$(1)/$(DEPMOD_STAGING_SUBDIR)/$(3): PRIVATE_LOAD_MODULES := $(2)
-$(1)/$(DEPMOD_STAGING_SUBDIR)/$(3): PRIVATE_LOAD_FILENAME := $(3)
-$(1)/$(DEPMOD_STAGING_SUBDIR)/$(3): $(2)
- rm -f $$@
- (for MODULE in $$(PRIVATE_LOAD_MODULES); do basename $$$$MODULE >> $$@; done)
+$(1)/$(DEPMOD_STAGING_SUBDIR)/$(4): PRIVATE_LOAD_MODULES := $(3)
+$(1)/$(DEPMOD_STAGING_SUBDIR)/$(4): $(2)
+ @echo load-list $$(@)
+ @echo '$$(strip $$(notdir $$(PRIVATE_LOAD_MODULES)))' | tr ' ' '\n' > $$(@)
endef
-# Until support for a vendor-boot/vendor-ramdisk is added, store vendor ramdisk
-# kernel modules on the generic ramdisk as a stopgap.
-ifneq ($(BOARD_VENDOR_RAMDISK_KERNEL_MODULES),)
+# $(1): image name
+# $(2): build output directory (TARGET_OUT_VENDOR, TARGET_RECOVERY_ROOT_OUT, etc)
+# $(3): mount point
+# $(4): module load filename
+# $(5): stripped staging directory
+# $(6): kernel module directory name (top is an out of band value for no directory)
+define build-image-kernel-modules-dir
+$(if $(filter top,$(6)),\
+ $(eval _kver :=)$(eval _sep :=),\
+ $(eval _kver := $(6))$(eval _sep :=_))\
+$(if $(5),\
+ $(eval _stripped_staging_dir := $(5)$(_sep)$(_kver)),\
+ $(eval _stripped_staging_dir :=))\
+$(if $(strip $(BOARD_$(1)_KERNEL_MODULES$(_sep)$(_kver))$(BOARD_$(1)_KERNEL_MODULES_ARCHIVE$(_sep)$(_kver))),\
+ $(if $(BOARD_$(1)_KERNEL_MODULES_LOAD$(_sep)$(_kver)),,\
+ $(eval BOARD_$(1)_KERNEL_MODULES_LOAD$(_sep)$(_kver) := $(BOARD_$(1)_KERNEL_MODULES$(_sep)$(_kver)))) \
+ $(call copy-many-files,$(call build-image-kernel-modules,$(BOARD_$(1)_KERNEL_MODULES$(_sep)$(_kver)),$(2),$(3),$(call intermediates-dir-for,PACKAGING,depmod_$(1)$(_sep)$(_kver)),$(BOARD_$(1)_KERNEL_MODULES_LOAD$(_sep)$(_kver)),$(4),$(BOARD_$(1)_KERNEL_MODULES_ARCHIVE$(_sep)$(_kver)),$(_stripped_staging_dir),$(_kver))))
+endef
+
+# $(1): kernel module directory name (top is an out of band value for no directory)
+define build-recovery-as-boot-load
+$(if $(filter top,$(1)),\
+ $(eval _kver :=)$(eval _sep :=),\
+ $(eval _kver := $(1))$(eval _sep :=_))\
+ $(if $(BOARD_GENERIC_RAMDISK_KERNEL_MODULES_LOAD$(_sep)$(_kver)),\
+ $(call copy-many-files,$(call module-load-list-copy-paths,$(call intermediates-dir-for,PACKAGING,ramdisk_module_list$(_sep)$(_kver)),$(BOARD_GENERIC_RAMDISK_KERNEL_MODULES$(_sep)$(_kver)),$(BOARD_GENERIC_RAMDISK_KERNEL_MODULES_LOAD$(_sep)$(_kver)),modules.load,$(TARGET_RECOVERY_ROOT_OUT))))
+endef
+
+# $(1): kernel module directory name (top is an out of band value for no directory)
+define build-vendor-ramdisk-recovery-load
+$(if $(filter top,$(1)),\
+ $(eval _kver :=)$(eval _sep :=),\
+ $(eval _kver := $(1))$(eval _sep :=_))\
+ $(if $(BOARD_VENDOR_RAMDISK_RECOVERY_KERNEL_MODULES_LOAD$(_sep)$(_kver)),\
+ $(call copy-many-files,$(call module-load-list-copy-paths,$(call intermediates-dir-for,PACKAGING,vendor_ramdisk_recovery_module_list$(_sep)$(_kver)),$(BOARD_VENDOR_RAMDISK_KERNEL_MODULES$(_sep)$(_kver)),$(BOARD_VENDOR_RAMDISK_RECOVERY_KERNEL_MODULES_LOAD$(_sep)$(_kver)),modules.load.recovery,$(TARGET_VENDOR_RAMDISK_OUT))))
+endef
+
+ifneq ($(BUILDING_VENDOR_BOOT_IMAGE),true)
+ # If there is no vendor boot partition, store vendor ramdisk kernel modules in the
+ # boot ramdisk.
BOARD_GENERIC_RAMDISK_KERNEL_MODULES += $(BOARD_VENDOR_RAMDISK_KERNEL_MODULES)
-endif
-ifneq ($(BOARD_VENDOR_RAMDISK_KERNEL_MODULES_LOAD),)
BOARD_GENERIC_RAMDISK_KERNEL_MODULES_LOAD += $(BOARD_VENDOR_RAMDISK_KERNEL_MODULES_LOAD)
endif
-ifeq ($(BOARD_RECOVERY_KERNEL_MODULES_LOAD),)
- BOARD_RECOVERY_KERNEL_MODULES_LOAD := $(BOARD_RECOVERY_KERNEL_MODULES)
-endif
ifeq ($(BOARD_GENERIC_RAMDISK_KERNEL_MODULES_LOAD),)
BOARD_GENERIC_RAMDISK_KERNEL_MODULES_LOAD := $(BOARD_GENERIC_RAMDISK_KERNEL_MODULES)
endif
-ifdef BOARD_GENERIC_RAMDISK_KERNEL_MODULES
+ifneq ($(strip $(BOARD_GENERIC_RAMDISK_KERNEL_MODULES)),)
ifeq ($(BOARD_USES_RECOVERY_AS_BOOT), true)
BOARD_RECOVERY_KERNEL_MODULES += $(BOARD_GENERIC_RAMDISK_KERNEL_MODULES)
endif
endif
-ifdef BOARD_RECOVERY_KERNEL_MODULES
- ifeq ($(BOARD_USES_RECOVERY_AS_BOOT), true)
- ifdef BOARD_GENERIC_RAMDISK_KERNEL_MODULES_LOAD
- ALL_DEFAULT_INSTALLED_MODULES += $(call copy-many-files,$(call module-load-list-copy-paths,$(call intermediates-dir-for,PACKAGING,ramdisk_modules),$(BOARD_GENERIC_RAMDISK_KERNEL_MODULES_LOAD),modules.load,$(TARGET_RECOVERY_ROOT_OUT)))
- endif
- endif
- ALL_DEFAULT_INSTALLED_MODULES += $(call copy-many-files,$(call build-image-kernel-modules,$(BOARD_RECOVERY_KERNEL_MODULES),$(TARGET_RECOVERY_ROOT_OUT),,$(call intermediates-dir-for,PACKAGING,depmod_recovery),$(BOARD_RECOVERY_KERNEL_MODULES_LOAD),modules.load.recovery))
+ifneq ($(BOARD_DO_NOT_STRIP_VENDOR_MODULES),true)
+ VENDOR_STRIPPED_MODULE_STAGING_DIR := $(call intermediates-dir-for,PACKAGING,depmod_vendor_stripped)
+else
+ VENDOR_STRIPPED_MODULE_STAGING_DIR :=
endif
-ifneq ($(BOARD_USES_RECOVERY_AS_BOOT), true)
- ifdef BOARD_GENERIC_RAMDISK_KERNEL_MODULES
- ALL_DEFAULT_INSTALLED_MODULES += $(call copy-many-files,$(call build-image-kernel-modules,$(BOARD_GENERIC_RAMDISK_KERNEL_MODULES),$(TARGET_RAMDISK_OUT),,$(call intermediates-dir-for,PACKAGING,depmod_ramdisk),$(BOARD_GENERIC_RAMDISK_KERNEL_MODULES_LOAD),modules.load))
- endif
+ifneq ($(BOARD_DO_NOT_STRIP_VENDOR_RAMDISK_MODULES),true)
+ VENDOR_RAMDISK_STRIPPED_MODULE_STAGING_DIR := $(call intermediates-dir-for,PACKAGING,depmod_vendor_ramdisk_stripped)
+else
+ VENDOR_RAMDISK_STRIPPED_MODULE_STAGING_DIR :=
endif
-ifdef BOARD_VENDOR_KERNEL_MODULES
- ifeq ($(BOARD_VENDOR_KERNEL_MODULES_LOAD),)
- BOARD_VENDOR_KERNEL_MODULES_LOAD := $(BOARD_VENDOR_KERNEL_MODULES)
- endif
- ALL_DEFAULT_INSTALLED_MODULES += $(call copy-many-files,$(call build-image-kernel-modules,$(BOARD_VENDOR_KERNEL_MODULES),$(TARGET_OUT_VENDOR),vendor,$(call intermediates-dir-for,PACKAGING,depmod_vendor),$(BOARD_VENDOR_KERNEL_MODULES_LOAD),modules.load))
-endif
-
-ifdef BOARD_ODM_KERNEL_MODULES
- ifeq ($(BOARD_RECOVERY_KERNEL_MODULES_LOAD),)
- BOARD_ODM_KERNEL_MODULES_LOAD := $(BOARD_ODM_KERNEL_MODULES)
- endif
- ALL_DEFAULT_INSTALLED_MODULES += $(call copy-many-files,$(call build-image-kernel-modules,$(BOARD_ODM_KERNEL_MODULES),$(TARGET_OUT_ODM),odm,$(call intermediates-dir-for,PACKAGING,depmod_odm),$(BOARD_ODM_KERNEL_MODULES_LOAD),modules.load))
-endif
+BOARD_KERNEL_MODULE_DIRS += top
+$(foreach dir,$(BOARD_KERNEL_MODULE_DIRS), \
+ $(eval ALL_DEFAULT_INSTALLED_MODULES += $(call build-image-kernel-modules-dir,RECOVERY,$(TARGET_RECOVERY_ROOT_OUT),,modules.load.recovery,,$(dir))) \
+ $(eval ALL_DEFAULT_INSTALLED_MODULES += $(call build-image-kernel-modules-dir,VENDOR_RAMDISK,$(TARGET_VENDOR_RAMDISK_OUT),,modules.load,$(VENDOR_RAMDISK_STRIPPED_MODULE_STAGING_DIR),$(dir))) \
+ $(eval ALL_DEFAULT_INSTALLED_MODULES += $(call build-vendor-ramdisk-recovery-load,$(dir))) \
+ $(eval ALL_DEFAULT_INSTALLED_MODULES += $(call build-image-kernel-modules-dir,VENDOR,$(TARGET_OUT_VENDOR),vendor,modules.load,$(VENDOR_STRIPPED_MODULE_STAGING_DIR),$(dir))) \
+ $(eval ALL_DEFAULT_INSTALLED_MODULES += $(call build-image-kernel-modules-dir,ODM,$(TARGET_OUT_ODM),odm,modules.load,,$(dir))) \
+ $(if $(filter true,$(BOARD_USES_RECOVERY_AS_BOOT)),\
+ $(eval ALL_DEFAULT_INSTALLED_MODULES += $(call build-recovery-as-boot-load,$(dir))),\
+ $(eval ALL_DEFAULT_INSTALLED_MODULES += $(call build-image-kernel-modules-dir,GENERIC_RAMDISK,$(TARGET_RAMDISK_OUT),,modules.load,,$(dir)))))
# -----------------------------------------------------------------
# Cert-to-package mapping. Used by the post-build signing tools.
# Use a macro to add newline to each echo command
+# $1 stem name of the package
+# $2 certificate
+# $3 private key
+# $4 compressed
+# $5 partition tag
+# $6 output file
define _apkcerts_write_line
-$(hide) echo -n 'name="$(1).apk" certificate="$2" private_key="$3"' >> $5
-$(if $(4), $(hide) echo -n ' compressed="$4"' >> $5)
-$(hide) echo '' >> $5
+$(hide) echo -n 'name="$(1).apk" certificate="$2" private_key="$3"' >> $6
+$(if $(4), $(hide) echo -n ' compressed="$4"' >> $6)
+$(if $(5), $(hide) echo -n ' partition="$5"' >> $6)
+$(hide) echo '' >> $6
endef
@@ -804,8 +413,8 @@
@rm -f $@
$(foreach p,$(sort $(PACKAGES)),\
$(if $(PACKAGES.$(p).EXTERNAL_KEY),\
- $(call _apkcerts_write_line,$(p),"EXTERNAL","",$(PACKAGES.$(p).COMPRESSED),$@),\
- $(call _apkcerts_write_line,$(p),$(PACKAGES.$(p).CERTIFICATE),$(PACKAGES.$(p).PRIVATE_KEY),$(PACKAGES.$(p).COMPRESSED),$@)))
+ $(call _apkcerts_write_line,$(PACKAGES.$(p).STEM),"EXTERNAL","",$(PACKAGES.$(p).COMPRESSED),$(PACKAGES.$(p).PARTITION),$@),\
+ $(call _apkcerts_write_line,$(PACKAGES.$(p).STEM),$(PACKAGES.$(p).CERTIFICATE),$(PACKAGES.$(p).PRIVATE_KEY),$(PACKAGES.$(p).COMPRESSED),$(PACKAGES.$(p).PARTITION),$@)))
# In case value of PACKAGES is empty.
$(hide) touch $@
@@ -865,6 +474,10 @@
$(call dist-for-goals,droidcore,$(WALL_WERROR))
# -----------------------------------------------------------------
+# C/C++ flag information for modules
+$(call dist-for-goals,droidcore,$(SOONG_MODULES_CFLAG_ARTIFACTS))
+
+# -----------------------------------------------------------------
# Modules missing profile files
PGO_PROFILE_MISSING := $(PRODUCT_OUT)/pgo_profile_file_missing.txt
$(PGO_PROFILE_MISSING):
@@ -917,7 +530,7 @@
# directory).
event_log_tags_src := \
$(sort $(foreach m,\
- $(PRODUCT_PACKAGES) \
+ $(call resolve-bitness-for-modules,TARGET,$(PRODUCT_PACKAGES)) \
$(call module-names-for-tag-list,user), \
$(ALL_MODULES.$(m).EVENT_LOG_TAGS)) \
$(filter-out vendor/% device/% out/%,$(all_event_log_tags_src)))
@@ -948,7 +561,12 @@
INSTALLED_2NDBOOTLOADER_TARGET :=
endif # TARGET_NO_BOOTLOADER
ifneq ($(strip $(TARGET_NO_KERNEL)),true)
- INSTALLED_KERNEL_TARGET := $(PRODUCT_OUT)/kernel
+ ifneq ($(strip $(BOARD_KERNEL_BINARIES)),)
+ INSTALLED_KERNEL_TARGET := $(foreach k,$(BOARD_KERNEL_BINARIES), \
+ $(PRODUCT_OUT)/$(k))
+ else
+ INSTALLED_KERNEL_TARGET := $(PRODUCT_OUT)/kernel
+ endif
else
INSTALLED_KERNEL_TARGET :=
endif
@@ -1002,16 +620,27 @@
$(call dist-for-goals, sdk win_sdk sdk_addon, $(INSTALLED_FILES_FILE_RAMDISK))
BUILT_RAMDISK_TARGET := $(PRODUCT_OUT)/ramdisk.img
+ifeq ($(BOARD_RAMDISK_USE_LZ4),true)
+# -l enables the legacy format used by the Linux kernel
+COMPRESSION_COMMAND_DEPS := $(LZ4)
+COMPRESSION_COMMAND := $(LZ4) -l -12 --favor-decSpeed
+RAMDISK_EXT := .lz4
+else
+COMPRESSION_COMMAND_DEPS := $(MINIGZIP)
+COMPRESSION_COMMAND := $(MINIGZIP)
+RAMDISK_EXT := .gz
+endif
+
# We just build this directly to the install location.
INSTALLED_RAMDISK_TARGET := $(BUILT_RAMDISK_TARGET)
-$(INSTALLED_RAMDISK_TARGET): $(MKBOOTFS) $(INTERNAL_RAMDISK_FILES) $(INSTALLED_FILES_FILE_RAMDISK) | $(MINIGZIP)
+$(INSTALLED_RAMDISK_TARGET): $(MKBOOTFS) $(INTERNAL_RAMDISK_FILES) $(INSTALLED_FILES_FILE_RAMDISK) | $(COMPRESSION_COMMAND_DEPS)
$(call pretty,"Target ram disk: $@")
- $(hide) $(MKBOOTFS) -d $(TARGET_OUT) $(TARGET_RAMDISK_OUT) | $(MINIGZIP) > $@
+ $(hide) $(MKBOOTFS) -d $(TARGET_OUT) $(TARGET_RAMDISK_OUT) | $(COMPRESSION_COMMAND) > $@
.PHONY: ramdisk-nodeps
-ramdisk-nodeps: $(MKBOOTFS) | $(MINIGZIP)
+ramdisk-nodeps: $(MKBOOTFS) | $(COMPRESSION_COMMAND_DEPS)
@echo "make $@: ignoring dependencies"
- $(hide) $(MKBOOTFS) -d $(TARGET_OUT) $(TARGET_RAMDISK_OUT) | $(MINIGZIP) > $(INSTALLED_RAMDISK_TARGET)
+ $(hide) $(MKBOOTFS) -d $(TARGET_OUT) $(TARGET_RAMDISK_OUT) | $(COMPRESSION_COMMAND) > $(INSTALLED_RAMDISK_TARGET)
endif # BUILDING_RAMDISK_IMAGE
@@ -1020,31 +649,39 @@
# This is defined here since we may be building recovery as boot
# below and only want to define this once
-BUILT_BOOTIMAGE_TARGET := $(PRODUCT_OUT)/boot.img
+ifneq ($(strip $(BOARD_KERNEL_BINARIES)),)
+ BUILT_BOOTIMAGE_TARGET := $(foreach k,$(subst kernel,boot,$(BOARD_KERNEL_BINARIES)), $(PRODUCT_OUT)/$(k).img)
+else
+ BUILT_BOOTIMAGE_TARGET := $(PRODUCT_OUT)/boot.img
+endif
+
+ifdef BOARD_BOOTIMAGE_PARTITION_SIZE
+ BOARD_KERNEL_BOOTIMAGE_PARTITION_SIZE := $(BOARD_BOOTIMAGE_PARTITION_SIZE)
+endif
+
+# $1: boot image file name
+# $2: boot image variant (boot, boot-debug)
+define get-bootimage-partition-size
+ $(BOARD_$(call to-upper,$(subst .img,,$(subst $(2),kernel,$(notdir $(1)))))_BOOTIMAGE_PARTITION_SIZE)
+endef
ifneq ($(strip $(TARGET_NO_KERNEL)),true)
INTERNAL_BOOTIMAGE_ARGS := \
$(addprefix --second ,$(INSTALLED_2NDBOOTLOADER_TARGET)) \
--kernel $(INSTALLED_KERNEL_TARGET)
-ifdef BOARD_INCLUDE_DTB_IN_BOOTIMG
- INTERNAL_BOOTIMAGE_ARGS += --dtb $(INSTALLED_DTBIMAGE_TARGET)
-endif
-
ifneq ($(BOARD_BUILD_SYSTEM_ROOT_IMAGE),true)
INTERNAL_BOOTIMAGE_ARGS += --ramdisk $(INSTALLED_RAMDISK_TARGET)
endif
+ifndef BUILDING_VENDOR_BOOT_IMAGE
+ifdef BOARD_INCLUDE_DTB_IN_BOOTIMG
+ INTERNAL_BOOTIMAGE_ARGS += --dtb $(INSTALLED_DTBIMAGE_TARGET)
+endif
+endif
+
INTERNAL_BOOTIMAGE_FILES := $(filter-out --%,$(INTERNAL_BOOTIMAGE_ARGS))
-ifdef BOARD_KERNEL_BASE
- INTERNAL_BOOTIMAGE_ARGS += --base $(BOARD_KERNEL_BASE)
-endif
-
-ifdef BOARD_KERNEL_PAGESIZE
- INTERNAL_BOOTIMAGE_ARGS += --pagesize $(BOARD_KERNEL_PAGESIZE)
-endif
-
ifeq ($(PRODUCT_SUPPORTS_VERITY),true)
ifeq ($(BOARD_BUILD_SYSTEM_ROOT_IMAGE),true)
VERITY_KEYID := veritykeyid=id:`openssl x509 -in $(PRODUCT_VERITY_SIGNING_KEY).x509.pem -text \
@@ -1053,8 +690,22 @@
endif
INTERNAL_KERNEL_CMDLINE := $(strip $(INTERNAL_KERNEL_CMDLINE) buildvariant=$(TARGET_BUILD_VARIANT) $(VERITY_KEYID))
+
+ifndef BUILDING_VENDOR_BOOT_IMAGE
+ifdef BOARD_KERNEL_BASE
+ INTERNAL_BOOTIMAGE_ARGS += --base $(BOARD_KERNEL_BASE)
+endif
+ifdef BOARD_KERNEL_PAGESIZE
+ INTERNAL_BOOTIMAGE_ARGS += --pagesize $(BOARD_KERNEL_PAGESIZE)
+endif
ifdef INTERNAL_KERNEL_CMDLINE
-INTERNAL_BOOTIMAGE_ARGS += --cmdline "$(INTERNAL_KERNEL_CMDLINE)"
+ INTERNAL_BOOTIMAGE_ARGS += --cmdline "$(INTERNAL_KERNEL_CMDLINE)"
+endif
+else
+# building vendor boot image, dtb/base/pagesize go there
+ifdef GENERIC_KERNEL_CMDLINE
+ INTERNAL_BOOTIMAGE_ARGS += --cmdline "$(GENERIC_KERNEL_CMDLINE)"
+endif
endif
INTERNAL_MKBOOTIMG_VERSION_ARGS := \
@@ -1151,6 +802,55 @@
endif # TARGET_NO_KERNEL
# -----------------------------------------------------------------
+# vendor boot image
+ifeq ($(BUILDING_VENDOR_BOOT_IMAGE),true)
+
+ifeq ($(PRODUCT_SUPPORTS_VERITY),true)
+ $(error vboot 1.0 does not support vendor_boot partition)
+endif
+
+INTERNAL_VENDOR_RAMDISK_FILES := $(filter $(TARGET_VENDOR_RAMDISK_OUT)/%, \
+ $(ALL_GENERATED_SOURCES) \
+ $(ALL_DEFAULT_INSTALLED_MODULES))
+
+INTERNAL_VENDOR_RAMDISK_TARGET := $(call intermediates-dir-for,PACKAGING,vendor-boot)/vendor-ramdisk.cpio.gz
+$(INTERNAL_VENDOR_RAMDISK_TARGET): $(MKBOOTFS) $(INTERNAL_VENDOR_RAMDISK_FILES) | $(COMPRESSION_COMMAND_DEPS)
+ $(MKBOOTFS) -d $(TARGET_OUT) $(TARGET_VENDOR_RAMDISK_OUT) | $(COMPRESSION_COMMAND) > $@
+
+ifdef BOARD_INCLUDE_DTB_IN_BOOTIMG
+ INTERNAL_VENDOR_BOOTIMAGE_ARGS += --dtb $(INSTALLED_DTBIMAGE_TARGET)
+endif
+ifdef BOARD_KERNEL_BASE
+ INTERNAL_VENDOR_BOOTIMAGE_ARGS += --base $(BOARD_KERNEL_BASE)
+endif
+ifdef BOARD_KERNEL_PAGESIZE
+ INTERNAL_VENDOR_BOOTIMAGE_ARGS += --pagesize $(BOARD_KERNEL_PAGESIZE)
+endif
+ifdef INTERNAL_KERNEL_CMDLINE
+ INTERNAL_VENDOR_BOOTIMAGE_ARGS += --vendor_cmdline "$(INTERNAL_KERNEL_CMDLINE)"
+endif
+
+INSTALLED_VENDOR_BOOTIMAGE_TARGET := $(PRODUCT_OUT)/vendor_boot.img
+$(INSTALLED_VENDOR_BOOTIMAGE_TARGET): $(MKBOOTIMG) $(INTERNAL_VENDOR_RAMDISK_TARGET) $(INSTALLED_DTBIMAGE_TARGET)
+ifeq ($(BOARD_AVB_ENABLE),true)
+$(INSTALLED_VENDOR_BOOTIMAGE_TARGET): $(AVBTOOL) $(BOARD_AVB_VENDOR_BOOTIMAGE_KEY_PATH)
+ $(call pretty,"Target vendor_boot image: $@")
+ $(MKBOOTIMG) $(INTERNAL_VENDOR_BOOTIMAGE_ARGS) $(BOARD_MKBOOTIMG_ARGS) --vendor_ramdisk $(INTERNAL_VENDOR_RAMDISK_TARGET) --vendor_boot $@
+ $(call assert-max-image-size,$@,$(BOARD_VENDOR_BOOTIMAGE_PARTITION_SIZE))
+ $(AVBTOOL) add_hash_footer \
+ --image $@ \
+ --partition_size $(BOARD_VENDOR_BOOTIMAGE_PARTITION_SIZE) \
+ --partition_name vendor_boot $(INTERNAL_AVB_VENDOR_BOOT_SIGNING_ARGS) \
+ $(BOARD_AVB_VENDOR_BOOT_ADD_HASH_FOOTER_ARGS)
+else
+$(INSTALLED_VENDOR_BOOTIMAGE_TARGET):
+ $(call pretty,"Target vendor_boot image: $@")
+ $(MKBOOTIMG) $(INTERNAL_VENDOR_BOOTIMAGE_ARGS) $(BOARD_MKBOOTIMG_ARGS) --vendor_ramdisk $(INTERNAL_VENDOR_RAMDISK_TARGET) --vendor_boot $@
+ $(call assert-max-image-size,$@,$(BOARD_VENDOR_BOOTIMAGE_PARTITION_SIZE))
+endif
+endif # BUILDING_VENDOR_BOOT_IMAGE
+
+# -----------------------------------------------------------------
# NOTICE files
#
# We are required to publish the licenses for all code under BSD, GPL and
@@ -1173,6 +873,7 @@
# $(5) - Directory to use. Notice files are all $(5)/src. Other
# directories in there will be used for scratch
# $(6) - Dependencies for the output files
+# $(7) - Directories to exclude
#
# The algorithm here is that we go collect a hash for each of the notice
# files and write the names of the files that match that hash. Then
@@ -1186,11 +887,11 @@
# original notice files instead of making rules to copy them somwehere.
# Then we could traverse that without quite as much bash drama.
define combine-notice-files
-$(2) $(3): PRIVATE_MESSAGE := $(4)
-$(2) $(3): PRIVATE_DIR := $(5)
-$(2) : $(3)
-$(3) : $(6) $(BUILD_SYSTEM)/Makefile build/make/tools/generate-notice-files.py
- build/make/tools/generate-notice-files.py --text-output $(2) \
+$(2): PRIVATE_MESSAGE := $(4)
+$(2): PRIVATE_DIR := $(5)
+$(2): .KATI_IMPLICIT_OUTPUTS := $(3)
+$(2): $(6) $(BUILD_SYSTEM)/Makefile build/make/tools/generate-notice-files.py
+ build/make/tools/generate-notice-files.py --text-output $(2) $(foreach xdir, $(7), -e $(xdir) )\
$(if $(filter $(1),xml_excluded_vendor_product_odm),-e vendor -e product -e system_ext -e odm --xml-output, \
$(if $(filter $(1),xml_excluded_system_product_odm),-e system -e product -e system_ext -e odm --xml-output, \
$(if $(filter $(1),xml_product),-i product --xml-output, \
@@ -1215,6 +916,11 @@
winpthreads_notice_file := $(TARGET_OUT_NOTICE_FILES)/src/winpthreads.txt
pdk_fusion_notice_files := $(filter $(TARGET_OUT_NOTICE_FILES)/%, $(ALL_PDK_FUSION_FILES))
+# Some targets get included under $(PRODUCT_OUT) for debug symbols or other
+# reasons--not to be flashed onto any device. Targets under these directories
+# need no associated notice file on the device UI.
+exclude_target_dirs := apex
+
# TODO(b/69865032): Make PRODUCT_NOTICE_SPLIT the default behavior.
ifneq ($(PRODUCT_NOTICE_SPLIT),true)
target_notice_file_html := $(TARGET_OUT_INTERMEDIATES)/NOTICE.html
@@ -1225,7 +931,8 @@
$(target_notice_file_html), \
"Notices for files contained in the filesystem images in this directory:", \
$(TARGET_OUT_NOTICE_FILES), \
- $(ALL_DEFAULT_INSTALLED_MODULES) $(kernel_notice_file) $(pdk_fusion_notice_files)))
+ $(ALL_DEFAULT_INSTALLED_MODULES) $(kernel_notice_file) $(pdk_fusion_notice_files), \
+ $(exclude_target_dirs)))
$(target_notice_file_html_gz): $(target_notice_file_html) | $(MINIGZIP)
$(hide) $(MINIGZIP) -9 < $< > $@
$(installed_notice_html_or_xml_gz): $(target_notice_file_html_gz)
@@ -1259,10 +966,13 @@
# being built. A notice xml file must depend on all modules that could potentially
# install a license file relevant to it.
license_modules := $(ALL_DEFAULT_INSTALLED_MODULES) $(kernel_notice_file) $(pdk_fusion_notice_files)
+# Only files copied to a system image need system image notices.
+license_modules := $(filter $(PRODUCT_OUT)/%,$(license_modules))
# Phonys/fakes don't have notice files (though their deps might)
license_modules := $(filter-out $(TARGET_OUT_FAKE)/%,$(license_modules))
# testcases are not relevant to the system image.
license_modules := $(filter-out $(TARGET_OUT_TESTCASES)/%,$(license_modules))
+# filesystem images: system, vendor, product, system_ext, and odm
license_modules_system := $(filter $(TARGET_OUT)/%,$(license_modules))
license_modules_vendor := $(filter $(TARGET_OUT_VENDOR)/%,$(license_modules))
license_modules_product := $(filter $(TARGET_OUT_PRODUCT)/%,$(license_modules))
@@ -1273,16 +983,44 @@
$(license_modules_product) \
$(license_modules_system_ext) \
$(license_modules_odm)
+# targets used for debug symbols only and do not get copied to the device
+license_modules_symbols_only := $(filter $(PRODUCT_OUT)/apex/%,$(license_modules))
+
license_modules_rest := $(filter-out $(license_modules_agg),$(license_modules))
+license_modules_rest := $(filter-out $(license_modules_symbols_only),$(license_modules_rest))
+
+# Identify the other targets we expect to have notices for:
+# targets copied to the device but are not readable by the UI (e.g. must boot
+# into a different partition to read or don't have an associated /etc
+# directory) must have their notices built somewhere readable.
+license_modules_rehomed := $(filter-out $(PRODUCT_OUT)/%/%,$(license_modules_rest)) # files in root have no /etc
+license_modules_rehomed += $(filter $(PRODUCT_OUT)/recovery/%,$(license_modules_rest))
+license_modules_rehomed += $(filter $(PRODUCT_OUT)/root/%,$(license_modules_rest))
+license_modules_rehomed += $(filter $(PRODUCT_OUT)/data/%,$(license_modules_rest))
+license_modules_rehomed += $(filter $(PRODUCT_OUT)/ramdisk/%,$(license_modules_rest))
+license_modules_rehomed += $(filter $(PRODUCT_OUT)/debug_ramdisk/%,$(license_modules_rest))
+license_modules_rehomed += $(filter $(PRODUCT_OUT)/vendor-ramdisk/%,$(license_modules_rest))
+license_modules_rehomed += $(filter $(PRODUCT_OUT)/persist/%,$(license_modules_rest))
+license_modules_rehomed += $(filter $(PRODUCT_OUT)/persist.img,$(license_modules_rest))
+license_modules_rehomed += $(filter $(PRODUCT_OUT)/system_other/%,$(license_modules_rest))
+license_modules_rehomed += $(filter $(PRODUCT_OUT)/kernel%,$(license_modules_rest))
+license_modules_rehomed += $(filter $(PRODUCT_OUT)/%.img,$(license_modules_rest))
+license_modules_rehomed += $(filter $(PRODUCT_OUT)/%.bin,$(license_modules_rest))
+
+# after removing targets in system images, targets reported in system images, and
+# targets used for debug symbols that do not need notices, nothing must remain.
+license_modules_rest := $(filter-out $(license_modules_rehomed),$(license_modules_rest))
+$(call maybe-print-list-and-error, $(license_modules_rest), \
+ "Targets added under $(PRODUCT_OUT)/ unaccounted for notice handling.")
# If we are building in a configuration that includes a prebuilt vendor.img, we can't
# update its notice file, so include those notices in the system partition instead
ifdef BOARD_PREBUILT_VENDORIMAGE
-license_modules_system += $(license_modules_rest)
+license_modules_system += $(license_modules_rehomed)
system_xml_directories := xml_excluded_vendor_product_odm
system_notice_file_message := "Notices for files contained in all filesystem images except vendor/system_ext/product/odm in this directory:"
else
-license_modules_vendor += $(license_modules_rest)
+license_modules_vendor += $(license_modules_rehomed)
system_xml_directories := xml_system
system_notice_file_message := "Notices for files contained in the system filesystem image in this directory:"
endif
@@ -1292,31 +1030,36 @@
$(target_notice_file_xml), \
$(system_notice_file_message), \
$(TARGET_OUT_NOTICE_FILES), \
- $(license_modules_system)))
+ $(license_modules_system), \
+ $(exclude_target_dirs)))
$(eval $(call combine-notice-files, xml_excluded_system_product_odm, \
$(target_vendor_notice_file_txt), \
$(target_vendor_notice_file_xml), \
"Notices for files contained in all filesystem images except system/system_ext/product/odm in this directory:", \
$(TARGET_OUT_NOTICE_FILES), \
- $(license_modules_vendor)))
+ $(license_modules_vendor), \
+ $(exclude_target_dirs)))
$(eval $(call combine-notice-files, xml_product, \
$(target_product_notice_file_txt), \
$(target_product_notice_file_xml), \
"Notices for files contained in the product filesystem image in this directory:", \
$(TARGET_OUT_NOTICE_FILES), \
- $(license_modules_product)))
+ $(license_modules_product), \
+ $(exclude_target_dirs)))
$(eval $(call combine-notice-files, xml_system_ext, \
$(target_system_ext_notice_file_txt), \
$(target_system_ext_notice_file_xml), \
"Notices for files contained in the system_ext filesystem image in this directory:", \
$(TARGET_OUT_NOTICE_FILES), \
- $(license_modules_system_ext)))
+ $(license_modules_system_ext), \
+ $(exclude_target_dirs)))
$(eval $(call combine-notice-files, xml_odm, \
$(target_odm_notice_file_txt), \
$(target_odm_notice_file_xml), \
"Notices for files contained in the odm filesystem image in this directory:", \
$(TARGET_OUT_NOTICE_FILES), \
- $(license_modules_odm)))
+ $(license_modules_odm), \
+ $(exclude_target_dirs)))
$(target_notice_file_xml_gz): $(target_notice_file_xml) | $(MINIGZIP)
$(hide) $(MINIGZIP) -9 < $< > $@
@@ -1354,7 +1097,8 @@
"Notices for files contained in the tools directory:", \
$(HOST_OUT_NOTICE_FILES), \
$(ALL_DEFAULT_INSTALLED_MODULES) \
- $(winpthreads_notice_file)))
+ $(winpthreads_notice_file), \
+ $(exclude_target_dirs)))
endif # TARGET_BUILD_APPS
@@ -1396,6 +1140,9 @@
ifneq (true,$(TARGET_USERIMAGES_SPARSE_SQUASHFS_DISABLED))
INTERNAL_USERIMAGES_SPARSE_SQUASHFS_FLAG := -s
endif
+ifneq (true,$(TARGET_USERIMAGES_SPARSE_F2FS_DISABLED))
+ INTERNAL_USERIMAGES_SPARSE_F2FS_FLAG := -S
+endif
INTERNAL_USERIMAGES_DEPS := \
$(BUILD_IMAGE) \
@@ -1458,6 +1205,8 @@
$(if $(filter $(2),userdata),\
$(if $(BOARD_USERDATAIMAGE_FILE_SYSTEM_TYPE),$(hide) echo "userdata_fs_type=$(BOARD_USERDATAIMAGE_FILE_SYSTEM_TYPE)" >> $(1))
$(if $(BOARD_USERDATAIMAGE_PARTITION_SIZE),$(hide) echo "userdata_size=$(BOARD_USERDATAIMAGE_PARTITION_SIZE)" >> $(1))
+ $(if $(PRODUCT_FS_CASEFOLD),$(hide) echo "needs_casefold=$(PRODUCT_FS_CASEFOLD)" >> $(1))
+ $(if $(PRODUCT_QUOTA_PROJID),$(hide) echo "needs_projid=$(PRODUCT_QUOTA_PROJID)" >> $(1))
$(hide) echo "userdata_selinux_fc=$(SELINUX_FC)" >> $(1)
)
$(if $(filter $(2),cache),\
@@ -1532,6 +1281,7 @@
$(if $(INTERNAL_USERIMAGES_EXT_VARIANT),$(hide) echo "fs_type=$(INTERNAL_USERIMAGES_EXT_VARIANT)" >> $(1))
$(if $(INTERNAL_USERIMAGES_SPARSE_EXT_FLAG),$(hide) echo "extfs_sparse_flag=$(INTERNAL_USERIMAGES_SPARSE_EXT_FLAG)" >> $(1))
$(if $(INTERNAL_USERIMAGES_SPARSE_SQUASHFS_FLAG),$(hide) echo "squashfs_sparse_flag=$(INTERNAL_USERIMAGES_SPARSE_SQUASHFS_FLAG)" >> $(1))
+$(if $(INTERNAL_USERIMAGES_SPARSE_F2FS_FLAG),$(hide) echo "f2fs_sparse_flag=$(INTERNAL_USERIMAGES_SPARSE_F2FS_FLAG)" >> $(1))
$(if $(BOARD_EXT4_SHARE_DUP_BLOCKS),$(hide) echo "ext4_share_dup_blocks=$(BOARD_EXT4_SHARE_DUP_BLOCKS)" >> $(1))
$(if $(BOARD_FLASH_LOGICAL_BLOCK_SIZE), $(hide) echo "flash_logical_block_size=$(BOARD_FLASH_LOGICAL_BLOCK_SIZE)" >> $(1))
$(if $(BOARD_FLASH_ERASE_BLOCK_SIZE), $(hide) echo "flash_erase_block_size=$(BOARD_FLASH_ERASE_BLOCK_SIZE)" >> $(1))
@@ -1598,7 +1348,8 @@
$(if $(filter true,$(BOARD_BUILD_SYSTEM_ROOT_IMAGE)),\
$(hide) echo "system_root_image=true" >> $(1))
$(hide) echo "root_dir=$(TARGET_ROOT_OUT)" >> $(1)
-$(if $(PRODUCT_USE_DYNAMIC_PARTITION_SIZE),$(hide) echo "use_dynamic_partition_size=true" >> $(1))
+$(if $(filter true,$(PRODUCT_USE_DYNAMIC_PARTITION_SIZE)),\
+ $(hide) echo "use_dynamic_partition_size=true" >> $(1))
$(if $(3),$(hide) $(foreach kv,$(3),echo "$(kv)" >> $(1);))
endef
@@ -1667,12 +1418,13 @@
$(hide) $(FILESLIST) $(TARGET_RECOVERY_ROOT_OUT) > $(@:.txt=.json)
$(hide) $(FILESLIST_UTIL) -c $(@:.txt=.json) > $@
-recovery_initrc := $(call include-path-for, recovery)/etc/init.rc
recovery_sepolicy := \
$(TARGET_RECOVERY_ROOT_OUT)/sepolicy \
$(TARGET_RECOVERY_ROOT_OUT)/plat_file_contexts \
- $(TARGET_RECOVERY_ROOT_OUT)/vendor_file_contexts \
$(TARGET_RECOVERY_ROOT_OUT)/plat_property_contexts \
+ $(TARGET_RECOVERY_ROOT_OUT)/system_ext_file_contexts \
+ $(TARGET_RECOVERY_ROOT_OUT)/system_ext_property_contexts \
+ $(TARGET_RECOVERY_ROOT_OUT)/vendor_file_contexts \
$(TARGET_RECOVERY_ROOT_OUT)/vendor_property_contexts \
$(TARGET_RECOVERY_ROOT_OUT)/odm_file_contexts \
$(TARGET_RECOVERY_ROOT_OUT)/odm_property_contexts \
@@ -1685,7 +1437,7 @@
recovery_kernel := $(INSTALLED_KERNEL_TARGET) # same as a non-recovery system
recovery_ramdisk := $(PRODUCT_OUT)/ramdisk-recovery.img
-recovery_resources_common := $(call include-path-for, recovery)/res
+recovery_resources_common := bootable/recovery/res
# Set recovery_density to a density bucket based on TARGET_SCREEN_DENSITY, PRODUCT_AAPT_PREF_CONFIG,
# or mdpi, in order of preference. We support both specific buckets (e.g. xdpi) and numbers,
@@ -1713,9 +1465,9 @@
# Note that the font selected here can be overridden for a particular device by putting a font.png
# in its private recovery resources.
ifneq (,$(filter xxxhdpi xxhdpi xhdpi,$(recovery_density)))
-recovery_font := $(call include-path-for, recovery)/fonts/18x32.png
+recovery_font := bootable/recovery/fonts/18x32.png
else
-recovery_font := $(call include-path-for, recovery)/fonts/12x22.png
+recovery_font := bootable/recovery/fonts/12x22.png
endif
@@ -1739,7 +1491,7 @@
endif
-RECOVERY_INSTALLING_TEXT_FILE := $(call intermediates-dir-for,PACKAGING,recovery_text_res)/installing_text.png
+RECOVERY_INSTALLING_TEXT_FILE := $(call intermediates-dir-for,ETC,recovery_text_res)/installing_text.png
RECOVERY_INSTALLING_SECURITY_TEXT_FILE := $(dir $(RECOVERY_INSTALLING_TEXT_FILE))/installing_security_text.png
RECOVERY_ERASING_TEXT_FILE := $(dir $(RECOVERY_INSTALLING_TEXT_FILE))/erasing_text.png
RECOVERY_ERROR_TEXT_FILE := $(dir $(RECOVERY_INSTALLING_TEXT_FILE))/error_text.png
@@ -1763,11 +1515,12 @@
$(RECOVERY_WIPE_DATA_CONFIRMATION_TEXT_FILE) \
$(RECOVERY_WIPE_DATA_MENU_HEADER_TEXT_FILE)
-resource_dir := $(call include-path-for, recovery)/tools/recovery_l10n/res/
+resource_dir := bootable/recovery/tools/recovery_l10n/res/
+resource_dir_deps := $(sort $(shell find $(resource_dir) -name *.xml -not -name .*))
image_generator_jar := $(HOST_OUT_JAVA_LIBRARIES)/RecoveryImageGenerator.jar
zopflipng := $(HOST_OUT_EXECUTABLES)/zopflipng
$(RECOVERY_INSTALLING_TEXT_FILE): PRIVATE_SOURCE_FONTS := $(recovery_noto-fonts_dep) $(recovery_roboto-fonts_dep)
-$(RECOVERY_INSTALLING_TEXT_FILE): PRIVATE_RECOVERY_FONT_FILES_DIR := $(call intermediates-dir-for,PACKAGING,recovery_font_files)
+$(RECOVERY_INSTALLING_TEXT_FILE): PRIVATE_RECOVERY_FONT_FILES_DIR := $(call intermediates-dir-for,ETC,recovery_font_files)
$(RECOVERY_INSTALLING_TEXT_FILE): PRIVATE_RESOURCE_DIR := $(resource_dir)
$(RECOVERY_INSTALLING_TEXT_FILE): PRIVATE_IMAGE_GENERATOR_JAR := $(image_generator_jar)
$(RECOVERY_INSTALLING_TEXT_FILE): PRIVATE_ZOPFLIPNG := $(zopflipng)
@@ -1785,7 +1538,7 @@
recovery_wipe_data_menu_header \
recovery_wipe_data_confirmation
$(RECOVERY_INSTALLING_TEXT_FILE): .KATI_IMPLICIT_OUTPUTS := $(filter-out $(RECOVERY_INSTALLING_TEXT_FILE),$(generated_recovery_text_files))
-$(RECOVERY_INSTALLING_TEXT_FILE): $(image_generator_jar) $(resource_dir) $(recovery_noto-fonts_dep) $(recovery_roboto-fonts_dep) $(zopflipng)
+$(RECOVERY_INSTALLING_TEXT_FILE): $(image_generator_jar) $(resource_dir_deps) $(recovery_noto-fonts_dep) $(recovery_roboto-fonts_dep) $(zopflipng)
# Prepares the font directory.
@rm -rf $(PRIVATE_RECOVERY_FONT_FILES_DIR)
@mkdir -p $(PRIVATE_RECOVERY_FONT_FILES_DIR)
@@ -1856,7 +1609,8 @@
ifeq (,$(filter true, $(BOARD_USES_FULL_RECOVERY_IMAGE) $(BOARD_USES_RECOVERY_AS_BOOT) \
$(BOARD_BUILD_SYSTEM_ROOT_IMAGE) $(BOARD_INCLUDE_RECOVERY_DTBO) $(BOARD_INCLUDE_RECOVERY_ACPIO)))
# Named '.dat' so we don't attempt to use imgdiff for patching it.
-RECOVERY_RESOURCE_ZIP := $(TARGET_OUT)/etc/recovery-resource.dat
+RECOVERY_RESOURCE_ZIP := $(TARGET_OUT_VENDOR)/etc/recovery-resource.dat
+ALL_DEFAULT_INSTALLED_MODULES += $(RECOVERY_RESOURCE_ZIP)
else
RECOVERY_RESOURCE_ZIP :=
endif
@@ -1891,9 +1645,7 @@
endef
$(INSTALLED_RECOVERY_BUILD_PROP_TARGET): \
- $(INSTALLED_DEFAULT_PROP_TARGET) \
- $(INSTALLED_VENDOR_DEFAULT_PROP_TARGET) \
- $(intermediate_system_build_prop) \
+ $(INSTALLED_BUILD_PROP_TARGET) \
$(INSTALLED_VENDOR_BUILD_PROP_TARGET) \
$(INSTALLED_ODM_BUILD_PROP_TARGET) \
$(INSTALLED_PRODUCT_BUILD_PROP_TARGET) \
@@ -1901,20 +1653,22 @@
@echo "Target recovery buildinfo: $@"
$(hide) mkdir -p $(dir $@)
$(hide) rm -f $@
- $(hide) cat $(INSTALLED_DEFAULT_PROP_TARGET) > $@
- $(hide) cat $(INSTALLED_VENDOR_DEFAULT_PROP_TARGET) >> $@
- $(hide) cat $(intermediate_system_build_prop) >> $@
+ $(hide) cat $(INSTALLED_BUILD_PROP_TARGET) >> $@
$(hide) cat $(INSTALLED_VENDOR_BUILD_PROP_TARGET) >> $@
$(hide) cat $(INSTALLED_ODM_BUILD_PROP_TARGET) >> $@
$(hide) cat $(INSTALLED_PRODUCT_BUILD_PROP_TARGET) >> $@
$(hide) cat $(INSTALLED_SYSTEM_EXT_BUILD_PROP_TARGET) >> $@
$(call append-recovery-ui-properties,$(PRIVATE_RECOVERY_UI_PROPERTIES),$@)
-INTERNAL_RECOVERYIMAGE_ARGS := \
- $(addprefix --second ,$(INSTALLED_2NDBOOTLOADER_TARGET)) \
- --kernel $(recovery_kernel) \
- --ramdisk $(recovery_ramdisk)
-
+ifeq (truetrue,$(strip $(BUILDING_VENDOR_BOOT_IMAGE))$(strip $(AB_OTA_UPDATER)))
+ INTERNAL_RECOVERYIMAGE_ARGS := --ramdisk $(recovery_ramdisk)
+ifdef GENERIC_KERNEL_CMDLINE
+ INTERNAL_RECOVERYIMAGE_ARGS += --cmdline "$(GENERIC_KERNEL_CMDLINE)"
+endif
+else # not (BUILDING_VENDOR_BOOT_IMAGE and AB_OTA_UPDATER)
+ INTERNAL_RECOVERYIMAGE_ARGS := \
+ $(addprefix --second ,$(INSTALLED_2NDBOOTLOADER_TARGET)) \
+ --ramdisk $(recovery_ramdisk)
# Assumes this has already been stripped
ifdef INTERNAL_KERNEL_CMDLINE
INTERNAL_RECOVERYIMAGE_ARGS += --cmdline "$(INTERNAL_KERNEL_CMDLINE)"
@@ -1931,47 +1685,65 @@
else
INTERNAL_RECOVERYIMAGE_ARGS += --recovery_dtbo $(BOARD_PREBUILT_DTBOIMAGE)
endif
-endif
+endif # BOARD_INCLUDE_RECOVERY_DTBO
ifdef BOARD_INCLUDE_RECOVERY_ACPIO
INTERNAL_RECOVERYIMAGE_ARGS += --recovery_acpio $(BOARD_RECOVERY_ACPIO)
endif
ifdef BOARD_INCLUDE_DTB_IN_BOOTIMG
INTERNAL_RECOVERYIMAGE_ARGS += --dtb $(INSTALLED_DTBIMAGE_TARGET)
endif
+endif # INSTALLED_VENDOR_BOOTIMAGE_TARGET not defined
+ifndef BOARD_RECOVERY_MKBOOTIMG_ARGS
+ BOARD_RECOVERY_MKBOOTIMG_ARGS := $(BOARD_MKBOOTIMG_ARGS)
+endif
+
+$(recovery_ramdisk): $(MKBOOTFS) $(COMPRESSION_COMMAND_DEPS) \
+ $(INTERNAL_ROOT_FILES) \
+ $(INSTALLED_RAMDISK_TARGET) \
+ $(INTERNAL_RECOVERYIMAGE_FILES) \
+ $(recovery_sepolicy) \
+ $(INSTALLED_2NDBOOTLOADER_TARGET) \
+ $(INSTALLED_RECOVERY_BUILD_PROP_TARGET) \
+ $(recovery_resource_deps) \
+ $(recovery_fstab)
+ # Making recovery image
+ mkdir -p $(TARGET_RECOVERY_OUT)
+ mkdir -p $(TARGET_RECOVERY_ROOT_OUT)/sdcard $(TARGET_RECOVERY_ROOT_OUT)/tmp
+ # Copying baseline ramdisk...
+ # Use rsync because "cp -Rf" fails to overwrite broken symlinks on Mac.
+ rsync -a --exclude=sdcard $(IGNORE_RECOVERY_SEPOLICY) $(IGNORE_CACHE_LINK) $(TARGET_ROOT_OUT) $(TARGET_RECOVERY_OUT)
+ # Modifying ramdisk contents...
+ $(if $(filter true,$(BOARD_BUILD_SYSTEM_ROOT_IMAGE)),, \
+ ln -sf /system/bin/init $(TARGET_RECOVERY_ROOT_OUT)/init)
+ # Removes $(TARGET_RECOVERY_ROOT_OUT)/init*.rc EXCEPT init.recovery*.rc.
+ find $(TARGET_RECOVERY_ROOT_OUT) -maxdepth 1 -name 'init*.rc' -type f -not -name "init.recovery.*.rc" | xargs rm -f
+ cp $(TARGET_ROOT_OUT)/init.recovery.*.rc $(TARGET_RECOVERY_ROOT_OUT)/ 2> /dev/null || true # Ignore error when the src file doesn't exist.
+ mkdir -p $(TARGET_RECOVERY_ROOT_OUT)/res
+ rm -rf $(TARGET_RECOVERY_ROOT_OUT)/res/*
+ cp -rf $(recovery_resources_common)/* $(TARGET_RECOVERY_ROOT_OUT)/res
+ $(foreach recovery_text_file,$(generated_recovery_text_files), \
+ cp -rf $(recovery_text_file) $(TARGET_RECOVERY_ROOT_OUT)/res/images/ &&) true
+ cp -f $(recovery_font) $(TARGET_RECOVERY_ROOT_OUT)/res/images/font.png
+ $(foreach item,$(TARGET_PRIVATE_RES_DIRS), \
+ cp -rf $(item) $(TARGET_RECOVERY_ROOT_OUT)/$(newline))
+ $(foreach item,$(recovery_fstab), \
+ cp -f $(item) $(TARGET_RECOVERY_ROOT_OUT)/system/etc/recovery.fstab)
+ $(if $(strip $(recovery_wipe)), \
+ cp -f $(recovery_wipe) $(TARGET_RECOVERY_ROOT_OUT)/system/etc/recovery.wipe)
+ ln -sf prop.default $(TARGET_RECOVERY_ROOT_OUT)/default.prop
+ $(BOARD_RECOVERY_IMAGE_PREPARE)
+ $(MKBOOTFS) -d $(TARGET_OUT) $(TARGET_RECOVERY_ROOT_OUT) | $(COMPRESSION_COMMAND) > $(recovery_ramdisk)
# $(1): output file
+# $(2): kernel file
define build-recoveryimage-target
- # Making recovery image
- $(hide) mkdir -p $(TARGET_RECOVERY_OUT)
- $(hide) mkdir -p $(TARGET_RECOVERY_ROOT_OUT)/sdcard $(TARGET_RECOVERY_ROOT_OUT)/tmp
- # Copying baseline ramdisk...
- # Use rsync because "cp -Rf" fails to overwrite broken symlinks on Mac.
- $(hide) rsync -a --exclude=sdcard $(IGNORE_RECOVERY_SEPOLICY) $(IGNORE_CACHE_LINK) $(TARGET_ROOT_OUT) $(TARGET_RECOVERY_OUT)
- # Modifying ramdisk contents...
- $(if $(filter true,$(BOARD_BUILD_SYSTEM_ROOT_IMAGE)),, \
- $(hide) ln -sf /system/bin/init $(TARGET_RECOVERY_ROOT_OUT)/init)
- # Removes $(TARGET_RECOVERY_ROOT_OUT)/init*.rc EXCEPT init.recovery*.rc.
- $(hide) find $(TARGET_RECOVERY_ROOT_OUT) -maxdepth 1 -name 'init*.rc' -type f -not -name "init.recovery.*.rc" | xargs rm -f
- $(hide) cp -f $(recovery_initrc) $(TARGET_RECOVERY_ROOT_OUT)/
- $(hide) cp $(TARGET_ROOT_OUT)/init.recovery.*.rc $(TARGET_RECOVERY_ROOT_OUT)/ 2> /dev/null || true # Ignore error when the src file doesn't exist.
- $(hide) mkdir -p $(TARGET_RECOVERY_ROOT_OUT)/res
- $(hide) rm -rf $(TARGET_RECOVERY_ROOT_OUT)/res/*
- $(hide) cp -rf $(recovery_resources_common)/* $(TARGET_RECOVERY_ROOT_OUT)/res
- $(hide) $(foreach recovery_text_file,$(generated_recovery_text_files), \
- cp -rf $(recovery_text_file) $(TARGET_RECOVERY_ROOT_OUT)/res/images/ &&) true
- $(hide) cp -f $(recovery_font) $(TARGET_RECOVERY_ROOT_OUT)/res/images/font.png
- $(hide) $(foreach item,$(TARGET_PRIVATE_RES_DIRS), \
- cp -rf $(item) $(TARGET_RECOVERY_ROOT_OUT)/$(newline))
- $(hide) $(foreach item,$(recovery_fstab), \
- cp -f $(item) $(TARGET_RECOVERY_ROOT_OUT)/system/etc/recovery.fstab)
- $(if $(strip $(recovery_wipe)), \
- $(hide) cp -f $(recovery_wipe) $(TARGET_RECOVERY_ROOT_OUT)/system/etc/recovery.wipe)
- $(hide) ln -sf prop.default $(TARGET_RECOVERY_ROOT_OUT)/default.prop
- $(BOARD_RECOVERY_IMAGE_PREPARE)
- $(hide) $(MKBOOTFS) -d $(TARGET_OUT) $(TARGET_RECOVERY_ROOT_OUT) | $(MINIGZIP) > $(recovery_ramdisk)
$(if $(filter true,$(PRODUCT_SUPPORTS_VBOOT)), \
- $(hide) $(MKBOOTIMG) $(INTERNAL_RECOVERYIMAGE_ARGS) $(INTERNAL_MKBOOTIMG_VERSION_ARGS) $(BOARD_MKBOOTIMG_ARGS) --output $(1).unsigned, \
- $(hide) $(MKBOOTIMG) $(INTERNAL_RECOVERYIMAGE_ARGS) $(INTERNAL_MKBOOTIMG_VERSION_ARGS) $(BOARD_MKBOOTIMG_ARGS) --output $(1))
+ $(MKBOOTIMG) --kernel $(2) $(INTERNAL_RECOVERYIMAGE_ARGS) \
+ $(INTERNAL_MKBOOTIMG_VERSION_ARGS) $(BOARD_RECOVERY_MKBOOTIMG_ARGS) \
+ --output $(1).unsigned, \
+ $(MKBOOTIMG) --kernel $(2) $(INTERNAL_RECOVERYIMAGE_ARGS) \
+ $(INTERNAL_MKBOOTIMG_VERSION_ARGS) $(BOARD_RECOVERY_MKBOOTIMG_ARGS) \
+ --output $(1))
$(if $(filter true,$(PRODUCT_SUPPORTS_BOOT_SIGNER)),\
$(if $(filter true,$(BOARD_USES_RECOVERY_AS_BOOT)),\
$(BOOT_SIGNER) /boot $(1) $(PRODUCT_VERITY_SIGNING_KEY).pk8 $(PRODUCT_VERITY_SIGNING_KEY).x509.pem $(1),\
@@ -1981,12 +1753,12 @@
$(if $(filter true,$(PRODUCT_SUPPORTS_VBOOT)), \
$(VBOOT_SIGNER) $(FUTILITY) $(1).unsigned $(PRODUCT_VBOOT_SIGNING_KEY).vbpubk $(PRODUCT_VBOOT_SIGNING_KEY).vbprivk $(PRODUCT_VBOOT_SIGNING_SUBKEY).vbprivk $(1).keyblock $(1))
$(if $(filter true,$(BOARD_USES_RECOVERY_AS_BOOT)), \
- $(hide) $(call assert-max-image-size,$(1),$(call get-hash-image-max-size,$(BOARD_BOOTIMAGE_PARTITION_SIZE))), \
- $(hide) $(call assert-max-image-size,$(1),$(call get-hash-image-max-size,$(BOARD_RECOVERYIMAGE_PARTITION_SIZE))))
+ $(call assert-max-image-size,$(1),$(call get-hash-image-max-size,$(call get-bootimage-partition-size,$(1),boot))), \
+ $(call assert-max-image-size,$(1),$(call get-hash-image-max-size,$(BOARD_RECOVERYIMAGE_PARTITION_SIZE))))
$(if $(filter true,$(BOARD_AVB_ENABLE)), \
$(if $(filter true,$(BOARD_USES_RECOVERY_AS_BOOT)), \
- $(hide) $(AVBTOOL) add_hash_footer --image $(1) --partition_size $(BOARD_BOOTIMAGE_PARTITION_SIZE) --partition_name boot $(INTERNAL_AVB_BOOT_SIGNING_ARGS) $(BOARD_AVB_BOOT_ADD_HASH_FOOTER_ARGS),\
- $(hide) $(AVBTOOL) add_hash_footer --image $(1) --partition_size $(BOARD_RECOVERYIMAGE_PARTITION_SIZE) --partition_name recovery $(INTERNAL_AVB_RECOVERY_SIGNING_ARGS) $(BOARD_AVB_RECOVERY_ADD_HASH_FOOTER_ARGS)))
+ $(AVBTOOL) add_hash_footer --image $(1) --partition_size $(call get-bootimage-partition-size,$(1),boot) --partition_name boot $(INTERNAL_AVB_BOOT_SIGNING_ARGS) $(BOARD_AVB_BOOT_ADD_HASH_FOOTER_ARGS),\
+ $(AVBTOOL) add_hash_footer --image $(1) --partition_size $(BOARD_RECOVERYIMAGE_PARTITION_SIZE) --partition_name recovery $(INTERNAL_AVB_RECOVERY_SIGNING_ARGS) $(BOARD_AVB_RECOVERY_ADD_HASH_FOOTER_ARGS)))
endef
ifeq ($(BOARD_USES_RECOVERY_AS_BOOT),true)
@@ -2013,17 +1785,10 @@
$(INSTALLED_BOOTIMAGE_TARGET): $(INSTALLED_DTBIMAGE_TARGET)
endif
-$(INSTALLED_BOOTIMAGE_TARGET): $(MKBOOTFS) $(MKBOOTIMG) $(MINIGZIP) \
- $(INTERNAL_ROOT_FILES) \
- $(INSTALLED_RAMDISK_TARGET) \
- $(INTERNAL_RECOVERYIMAGE_FILES) \
- $(recovery_initrc) $(recovery_sepolicy) $(recovery_kernel) \
- $(INSTALLED_2NDBOOTLOADER_TARGET) \
- $(INSTALLED_RECOVERY_BUILD_PROP_TARGET) \
- $(recovery_resource_deps) \
- $(recovery_fstab)
+$(INSTALLED_BOOTIMAGE_TARGET): $(MKBOOTIMG) $(recovery_ramdisk) \
+ $(recovery_kernel)
$(call pretty,"Target boot image from recovery: $@")
- $(call build-recoveryimage-target, $@)
+ $(call build-recoveryimage-target, $@, $(PRODUCT_OUT)/$(subst .img,,$(subst boot,kernel,$(notdir $@))))
endif # BOARD_USES_RECOVERY_AS_BOOT
ifdef BOARD_INCLUDE_RECOVERY_DTBO
@@ -2040,17 +1805,9 @@
$(INSTALLED_RECOVERYIMAGE_TARGET): $(INSTALLED_DTBIMAGE_TARGET)
endif
-$(INSTALLED_RECOVERYIMAGE_TARGET): $(MKBOOTFS) $(MKBOOTIMG) $(MINIGZIP) \
- $(INTERNAL_ROOT_FILES) \
- $(INSTALLED_RAMDISK_TARGET) \
- $(INSTALLED_BOOTIMAGE_TARGET) \
- $(INTERNAL_RECOVERYIMAGE_FILES) \
- $(recovery_initrc) $(recovery_sepolicy) $(recovery_kernel) \
- $(INSTALLED_2NDBOOTLOADER_TARGET) \
- $(INSTALLED_RECOVERY_BUILD_PROP_TARGET) \
- $(recovery_resource_deps) \
- $(recovery_fstab)
- $(call build-recoveryimage-target, $@)
+$(INSTALLED_RECOVERYIMAGE_TARGET): $(MKBOOTIMG) $(recovery_ramdisk) \
+ $(recovery_kernel)
+ $(call build-recoveryimage-target, $@, $(recovery_kernel))
ifdef RECOVERY_RESOURCE_ZIP
$(RECOVERY_RESOURCE_ZIP): $(INSTALLED_RECOVERYIMAGE_TARGET) | $(ZIPTIME)
@@ -2079,6 +1836,7 @@
$(error MTD device is no longer supported and thus BOARD_NAND_SPARE_SIZE is deprecated.)
endif
+ifneq ($(BOARD_BUILD_SYSTEM_ROOT_IMAGE),true)
# -----------------------------------------------------------------
# the debug ramdisk, which is the original ramdisk plus additional
# files: force_debuggable, adb_debug.prop and userdebug sepolicy.
@@ -2132,22 +1890,22 @@
# Depends on ramdisk.img, note that some target has ramdisk.img but no boot.img, e.g., emulator.
$(INSTALLED_DEBUG_RAMDISK_TARGET): $(INSTALLED_RAMDISK_TARGET)
endif # BOARD_USES_RECOVERY_AS_BOOT
-$(INSTALLED_DEBUG_RAMDISK_TARGET): $(MKBOOTFS) $(INTERNAL_DEBUG_RAMDISK_FILES) | $(MINIGZIP)
+$(INSTALLED_DEBUG_RAMDISK_TARGET): $(MKBOOTFS) $(INTERNAL_DEBUG_RAMDISK_FILES) | $(COMPRESSION_COMMAND_DEPS)
$(call pretty,"Target debug ram disk: $@")
mkdir -p $(TARGET_DEBUG_RAMDISK_OUT)
touch $(TARGET_DEBUG_RAMDISK_OUT)/force_debuggable
rsync -a $(DEBUG_RAMDISK_SYNC_DIR)/ $(DEBUG_RAMDISK_ROOT_DIR)
- $(MKBOOTFS) -d $(TARGET_OUT) $(DEBUG_RAMDISK_ROOT_DIR) | $(MINIGZIP) > $@
+ $(MKBOOTFS) -d $(TARGET_OUT) $(DEBUG_RAMDISK_ROOT_DIR) | $(COMPRESSION_COMMAND) > $@
.PHONY: ramdisk_debug-nodeps
ramdisk_debug-nodeps: DEBUG_RAMDISK_SYNC_DIR := $(my_debug_ramdisk_sync_dir)
ramdisk_debug-nodeps: DEBUG_RAMDISK_ROOT_DIR := $(my_debug_ramdisk_root_dir)
-ramdisk_debug-nodeps: $(MKBOOTFS) | $(MINIGZIP)
+ramdisk_debug-nodeps: $(MKBOOTFS) | $(COMPRESSION_COMMAND_DEPS)
echo "make $@: ignoring dependencies"
mkdir -p $(TARGET_DEBUG_RAMDISK_OUT)
touch $(TARGET_DEBUG_RAMDISK_OUT)/force_debuggable
rsync -a $(DEBUG_RAMDISK_SYNC_DIR)/ $(DEBUG_RAMDISK_ROOT_DIR)
- $(MKBOOTFS) -d $(TARGET_OUT) $(DEBUG_RAMDISK_ROOT_DIR) | $(MINIGZIP) > $(INSTALLED_DEBUG_RAMDISK_TARGET)
+ $(MKBOOTFS) -d $(TARGET_OUT) $(DEBUG_RAMDISK_ROOT_DIR) | $(COMPRESSION_COMMAND) > $(INSTALLED_DEBUG_RAMDISK_TARGET)
my_debug_ramdisk_sync_dir :=
my_debug_ramdisk_root_dir :=
@@ -2160,8 +1918,12 @@
# Note: it's intentional to skip signing for boot-debug.img, because it
# can only be used if the device is unlocked with verification error.
ifneq ($(strip $(TARGET_NO_KERNEL)),true)
-
-INSTALLED_DEBUG_BOOTIMAGE_TARGET := $(PRODUCT_OUT)/boot-debug.img
+ifneq ($(strip $(BOARD_KERNEL_BINARIES)),)
+ INSTALLED_DEBUG_BOOTIMAGE_TARGET := $(foreach k,$(subst kernel,boot-debug,$(BOARD_KERNEL_BINARIES)), \
+ $(PRODUCT_OUT)/$(k).img)
+else
+ INSTALLED_DEBUG_BOOTIMAGE_TARGET := $(PRODUCT_OUT)/boot-debug.img
+endif
# Replace ramdisk.img in $(MKBOOTIMG) ARGS with ramdisk-debug.img to build boot-debug.img
ifeq ($(BOARD_USES_RECOVERY_AS_BOOT),true)
@@ -2175,40 +1937,205 @@
# Using a test key to sign boot-debug.img to continue booting with the mismatched
# public key, if the device is unlocked.
ifneq ($(BOARD_AVB_BOOT_KEY_PATH),)
-BOARD_AVB_DEBUG_BOOT_KEY_PATH := external/avb/test/data/testkey_rsa2048.pem
-$(INSTALLED_DEBUG_BOOTIMAGE_TARGET): PRIVATE_AVB_DEBUG_BOOT_SIGNING_ARGS := \
- --algorithm SHA256_RSA2048 --key $(BOARD_AVB_DEBUG_BOOT_KEY_PATH)
-$(INSTALLED_DEBUG_BOOTIMAGE_TARGET): $(AVBTOOL) $(BOARD_AVB_DEBUG_BOOT_KEY_PATH)
+$(INSTALLED_DEBUG_BOOTIMAGE_TARGET): $(AVBTOOL) $(BOARD_AVB_BOOT_TEST_KEY_PATH)
endif
+BOARD_AVB_BOOT_TEST_KEY_PATH := external/avb/test/data/testkey_rsa2048.pem
+INTERNAL_AVB_BOOT_TEST_SIGNING_ARGS := --algorithm SHA256_RSA2048 --key $(BOARD_AVB_BOOT_TEST_KEY_PATH)
+# $(1): the bootimage to sign
+define test-key-sign-bootimage
+$(call assert-max-image-size,$(1),$(call get-hash-image-max-size,$(call get-bootimage-partition-size,$(1),boot-debug)))
+$(AVBTOOL) add_hash_footer \
+ --image $(1) \
+ --partition_size $(call get-bootimage-partition-size,$(1),boot-debug)\
+ --partition_name boot $(INTERNAL_AVB_BOOT_TEST_SIGNING_ARGS) \
+ $(BOARD_AVB_BOOT_ADD_HASH_FOOTER_ARGS)
+$(call assert-max-image-size,$(1),$(call get-bootimage-partition-size,$(1),boot-debug))
+endef
+
+# $(1): output file
+define build-debug-bootimage-target
+ $(MKBOOTIMG) --kernel $(PRODUCT_OUT)/$(subst .img,,$(subst boot-debug,kernel,$(notdir $(1)))) \
+ $(INTERNAL_DEBUG_BOOTIMAGE_ARGS) $(INTERNAL_MKBOOTIMG_VERSION_ARGS) $(BOARD_MKBOOTIMG_ARGS) --output $1
+ $(if $(BOARD_AVB_BOOT_KEY_PATH),$(call test-key-sign-bootimage,$1))
+endef
+
# Depends on original boot.img and ramdisk-debug.img, to build the new boot-debug.img
$(INSTALLED_DEBUG_BOOTIMAGE_TARGET): $(MKBOOTIMG) $(INSTALLED_BOOTIMAGE_TARGET) $(INSTALLED_DEBUG_RAMDISK_TARGET)
$(call pretty,"Target boot debug image: $@")
- $(MKBOOTIMG) $(INTERNAL_DEBUG_BOOTIMAGE_ARGS) $(INTERNAL_MKBOOTIMG_VERSION_ARGS) $(BOARD_MKBOOTIMG_ARGS) --output $@
- $(if $(BOARD_AVB_BOOT_KEY_PATH),\
- $(call assert-max-image-size,$@,$(call get-hash-image-max-size,$(BOARD_BOOTIMAGE_PARTITION_SIZE))); \
- $(AVBTOOL) add_hash_footer \
- --image $@ \
- --partition_size $(BOARD_BOOTIMAGE_PARTITION_SIZE) \
- --partition_name boot $(PRIVATE_AVB_DEBUG_BOOT_SIGNING_ARGS) \
- $(BOARD_AVB_BOOT_ADD_HASH_FOOTER_ARGS), \
- $(call assert-max-image-size,$@,$(BOARD_BOOTIMAGE_PARTITION_SIZE)))
+ $(call build-debug-bootimage-target, $@)
.PHONY: bootimage_debug-nodeps
bootimage_debug-nodeps: $(MKBOOTIMG)
echo "make $@: ignoring dependencies"
- $(MKBOOTIMG) $(INTERNAL_DEBUG_BOOTIMAGE_ARGS) $(INTERNAL_MKBOOTIMG_VERSION_ARGS) $(BOARD_MKBOOTIMG_ARGS) --output $(INSTALLED_DEBUG_BOOTIMAGE_TARGET)
- $(if $(BOARD_AVB_BOOT_KEY_PATH),\
- $(call assert-max-image-size,$(INSTALLED_DEBUG_BOOTIMAGE_TARGET),$(call get-hash-image-max-size,$(BOARD_BOOTIMAGE_PARTITION_SIZE))); \
- $(AVBTOOL) add_hash_footer \
- --image $(INSTALLED_DEBUG_BOOTIMAGE_TARGET) \
- --partition_size $(BOARD_BOOTIMAGE_PARTITION_SIZE) \
- --partition_name boot $(PRIVATE_AVB_DEBUG_BOOT_SIGNING_ARGS) \
- $(BOARD_AVB_BOOT_ADD_HASH_FOOTER_ARGS), \
- $(call assert-max-image-size,$(INSTALLED_DEBUG_BOOTIMAGE_TARGET),$(BOARD_BOOTIMAGE_PARTITION_SIZE)))
+ $(foreach b,$(INSTALLED_DEBUG_BOOTIMAGE_TARGET),$(call build-debug-bootimage-target,$b))
endif # TARGET_NO_KERNEL
+ifeq ($(BUILDING_VENDOR_BOOT_IMAGE),true)
+ifeq ($(BUILDING_RAMDISK_IMAGE),true)
+# -----------------------------------------------------------------
+# vendor debug ramdisk
+# Combines vendor ramdisk files and debug ramdisk files to build the vendor debug ramdisk.
+INSTALLED_VENDOR_DEBUG_RAMDISK_TARGET := $(PRODUCT_OUT)/vendor-ramdisk-debug.cpio$(RAMDISK_EXT)
+$(INSTALLED_VENDOR_DEBUG_RAMDISK_TARGET): DEBUG_RAMDISK_FILES := $(INTERNAL_DEBUG_RAMDISK_FILES)
+$(INSTALLED_VENDOR_DEBUG_RAMDISK_TARGET): VENDOR_RAMDISK_DIR := $(TARGET_VENDOR_RAMDISK_OUT)
+
+INTERNAL_VENDOR_DEBUG_RAMDISK_FILES := $(filter $(TARGET_VENDOR_DEBUG_RAMDISK_OUT)/%, \
+ $(ALL_GENERATED_SOURCES) \
+ $(ALL_DEFAULT_INSTALLED_MODULES))
+
+# Note: TARGET_VENDOR_DEBUG_RAMDISK_OUT will be $(PRODUCT_OUT)/vendor_debug_ramdisk/first_stage_ramdisk,
+# if BOARD_USES_RECOVERY_AS_BOOT is true. Otherwise, it will be $(PRODUCT_OUT)/vendor_debug_ramdisk.
+# But the path of $(VENDOR_DEBUG_RAMDISK_DIR) to build the vendor debug ramdisk, is always
+# $(PRODUCT_OUT)/vendor_debug_ramdisk.
+$(INSTALLED_VENDOR_DEBUG_RAMDISK_TARGET): VENDOR_DEBUG_RAMDISK_DIR := $(PRODUCT_OUT)/vendor_debug_ramdisk
+$(INSTALLED_VENDOR_DEBUG_RAMDISK_TARGET): $(INTERNAL_VENDOR_RAMDISK_TARGET) $(INSTALLED_DEBUG_RAMDISK_TARGET)
+$(INSTALLED_VENDOR_DEBUG_RAMDISK_TARGET): $(MKBOOTFS) $(INTERNAL_VENDOR_DEBUG_RAMDISK_FILES) | $(COMPRESSION_COMMAND_DEPS)
+ $(call pretty,"Target vendor debug ram disk: $@")
+ mkdir -p $(TARGET_VENDOR_DEBUG_RAMDISK_OUT)
+ touch $(TARGET_VENDOR_DEBUG_RAMDISK_OUT)/force_debuggable
+ $(foreach debug_file,$(DEBUG_RAMDISK_FILES), \
+ cp -f $(debug_file) $(subst $(PRODUCT_OUT)/debug_ramdisk,$(PRODUCT_OUT)/vendor_debug_ramdisk,$(debug_file)) &&) true
+ rsync -a $(VENDOR_RAMDISK_DIR)/ $(VENDOR_DEBUG_RAMDISK_DIR)
+ $(MKBOOTFS) -d $(TARGET_OUT) $(VENDOR_DEBUG_RAMDISK_DIR) | $(COMPRESSION_COMMAND) > $@
+
+INSTALLED_FILES_FILE_VENDOR_DEBUG_RAMDISK := $(PRODUCT_OUT)/installed-files-vendor-ramdisk-debug.txt
+INSTALLED_FILES_JSON_VENDOR_DEBUG_RAMDISK := $(INSTALLED_FILES_FILE_VENDOR_DEBUG_RAMDISK:.txt=.json)
+$(INSTALLED_FILES_FILE_VENDOR_DEBUG_RAMDISK): .KATI_IMPLICIT_OUTPUTS := $(INSTALLED_FILES_JSON_VENDOR_DEBUG_RAMDISK)
+$(INSTALLED_FILES_FILE_VENDOR_DEBUG_RAMDISK): VENDOR_DEBUG_RAMDISK_DIR := $(PRODUCT_OUT)/vendor_debug_ramdisk
+
+# The vendor debug ramdisk will rsync from $(TARGET_VENDOR_RAMDISK_OUT) and $(INTERNAL_DEBUG_RAMDISK_FILES),
+# so we have to wait for the vendor debug ramdisk to be built before generating the installed file list.
+$(INSTALLED_FILES_FILE_VENDOR_DEBUG_RAMDISK): $(INSTALLED_VENDOR_DEBUG_RAMDISK_TARGET)
+$(INSTALLED_FILES_FILE_VENDOR_DEBUG_RAMDISK): $(INTERNAL_VENDOR_DEBUG_RAMDISK_FILES) $(FILESLIST) $(FILESLIST_UTIL)
+ echo Installed file list: $@
+ mkdir -p $(dir $@)
+ rm -f $@
+ $(FILESLIST) $(VENDOR_DEBUG_RAMDISK_DIR) > $(@:.txt=.json)
+ $(FILESLIST_UTIL) -c $(@:.txt=.json) > $@
+
+# -----------------------------------------------------------------
+# vendor_boot-debug.img.
+INSTALLED_VENDOR_DEBUG_BOOTIMAGE_TARGET := $(PRODUCT_OUT)/vendor_boot-debug.img
+
+# The util to sign vendor_boot-debug.img with a test key.
+BOARD_AVB_VENDOR_BOOT_TEST_KEY_PATH := external/avb/test/data/testkey_rsa2048.pem
+INTERNAL_AVB_VENDOR_BOOT_TEST_SIGNING_ARGS := --algorithm SHA256_RSA2048 --key $(BOARD_AVB_VENDOR_BOOT_TEST_KEY_PATH)
+# $(1): the vendor bootimage to sign
+define test-key-sign-vendor-bootimage
+$(call assert-max-image-size,$(1),$(call get-hash-image-max-size,$(BOARD_VENDOR_BOOTIMAGE_PARTITION_SIZE)))
+$(AVBTOOL) add_hash_footer \
+ --image $(1) \
+ --partition_size $(BOARD_VENDOR_BOOTIMAGE_PARTITION_SIZE) \
+ --partition_name vendor_boot $(INTERNAL_AVB_VENDOR_BOOT_TEST_SIGNING_ARGS) \
+ $(BOARD_AVB_VENDOR_BOOT_ADD_HASH_FOOTER_ARGS)
+$(call assert-max-image-size,$(1),$(BOARD_VENDOR_BOOTIMAGE_PARTITION_SIZE))
+endef
+
+ifneq ($(BOARD_AVB_VENDOR_BOOT_KEY_PATH),)
+$(INSTALLED_VENDOR_DEBUG_BOOTIMAGE_TARGET): $(AVBTOOL) $(BOARD_AVB_VENDOR_BOOT_TEST_KEY_PATH)
+endif
+
+# Depends on vendor_boot.img and vendor-ramdisk-debug.cpio.gz to build the new vendor_boot-debug.img
+$(INSTALLED_VENDOR_DEBUG_BOOTIMAGE_TARGET): $(MKBOOTIMG) $(INSTALLED_VENDOR_BOOTIMAGE_TARGET) $(INSTALLED_VENDOR_DEBUG_RAMDISK_TARGET)
+ $(call pretty,"Target vendor_boot debug image: $@")
+ $(MKBOOTIMG) $(INTERNAL_VENDOR_BOOTIMAGE_ARGS) $(BOARD_MKBOOTIMG_ARGS) --vendor_ramdisk $(INSTALLED_VENDOR_DEBUG_RAMDISK_TARGET) --vendor_boot $@
+ $(call assert-max-image-size,$@,$(BOARD_VENDOR_BOOTIMAGE_PARTITION_SIZE))
+ $(if $(BOARD_AVB_VENDOR_BOOT_KEY_PATH),$(call test-key-sign-vendor-bootimage,$@))
+
+endif # BUILDING_RAMDISK_IMAGE
+endif # BUILDING_VENDOR_BOOT_IMAGE
+
+# -----------------------------------------------------------------
+# The test harness ramdisk, which is based off debug_ramdisk, plus a
+# few additional test-harness-specific properties in adb_debug.prop.
+
+ifdef BUILDING_RAMDISK_IMAGE
+BUILT_TEST_HARNESS_RAMDISK_TARGET := $(PRODUCT_OUT)/ramdisk-test-harness.img
+INSTALLED_TEST_HARNESS_RAMDISK_TARGET := $(BUILT_TEST_HARNESS_RAMDISK_TARGET)
+
+# rsync the content from ramdisk-debug.img to ramdisk-test-harness.img, then
+# appends a few test harness specific properties into the adb_debug.prop.
+TEST_HARNESS_RAMDISK_SYNC_DIR := $(PRODUCT_OUT)/debug_ramdisk
+TEST_HARNESS_RAMDISK_ROOT_DIR := $(PRODUCT_OUT)/test_harness_ramdisk
+
+# The following TARGET_TEST_HARNESS_RAMDISK_OUT will be $(PRODUCT_OUT)/test_harness_ramdisk/first_stage_ramdisk,
+# if BOARD_USES_RECOVERY_AS_BOOT is true. Otherwise, it will be $(PRODUCT_OUT)/test_harness_ramdisk.
+TEST_HARNESS_PROP_TARGET := $(TARGET_TEST_HARNESS_RAMDISK_OUT)/adb_debug.prop
+ADDITIONAL_TEST_HARNESS_PROPERTIES := ro.audio.silent=1
+ADDITIONAL_TEST_HARNESS_PROPERTIES += ro.test_harness=1
+
+# $(1): a list of key=value pairs for additional property assignments
+# $(2): the target .prop file to append the properties from $(1)
+define append-test-harness-props
+ echo "#" >> $(2); \
+ echo "# ADDITIONAL TEST HARNESS_PROPERTIES" >> $(2); \
+ echo "#" >> $(2);
+ $(foreach line,$(1), echo "$(line)" >> $(2);)
+endef
+
+$(INSTALLED_TEST_HARNESS_RAMDISK_TARGET): $(INSTALLED_DEBUG_RAMDISK_TARGET)
+$(INSTALLED_TEST_HARNESS_RAMDISK_TARGET): $(MKBOOTFS) $(INTERNAL_TEST_HARNESS_RAMDISK_FILES) | $(COMPRESSION_COMMAND_DEPS)
+ $(call pretty,"Target test harness ram disk: $@")
+ rsync -a $(TEST_HARNESS_RAMDISK_SYNC_DIR)/ $(TEST_HARNESS_RAMDISK_ROOT_DIR)
+ $(call append-test-harness-props,$(ADDITIONAL_TEST_HARNESS_PROPERTIES),$(TEST_HARNESS_PROP_TARGET))
+ $(MKBOOTFS) -d $(TARGET_OUT) $(TEST_HARNESS_RAMDISK_ROOT_DIR) | $(COMPRESSION_COMMAND) > $@
+
+.PHONY: ramdisk_test_harness-nodeps
+ramdisk_test_harness-nodeps: $(MKBOOTFS) | $(COMPRESSION_COMMAND_DEPS)
+ echo "make $@: ignoring dependencies"
+ rsync -a $(TEST_HARNESS_RAMDISK_SYNC_DIR)/ $(TEST_HARNESS_RAMDISK_ROOT_DIR)
+ $(call append-test-harness-props,$(ADDITIONAL_TEST_HARNESS_PROPERTIES),$(TEST_HARNESS_PROP_TARGET))
+ $(MKBOOTFS) -d $(TARGET_OUT) $(TEST_HARNESS_RAMDISK_ROOT_DIR) | $(COMPRESSION_COMMAND) > $(INSTALLED_TEST_HARNESS_RAMDISK_TARGET)
+
+endif # BUILDING_RAMDISK_IMAGE
+
+# -----------------------------------------------------------------
+# the boot-test-harness.img, which is the kernel plus ramdisk-test-harness.img
+#
+# Note: it's intentional to skip signing for boot-test-harness.img, because it
+# can only be used if the device is unlocked with verification error.
+ifneq ($(strip $(TARGET_NO_KERNEL)),true)
+
+ifneq ($(strip $(BOARD_KERNEL_BINARIES)),)
+ INSTALLED_TEST_HARNESS_BOOTIMAGE_TARGET := $(foreach k,$(subst kernel,boot-test-harness,$(BOARD_KERNEL_BINARIES)), \
+ $(PRODUCT_OUT)/$(k).img)
+else
+ INSTALLED_TEST_HARNESS_BOOTIMAGE_TARGET := $(PRODUCT_OUT)/boot-test-harness.img
+endif
+
+# Replace ramdisk-debug.img in $(MKBOOTIMG) ARGS with ramdisk-test-harness.img to build boot-test-harness.img
+INTERNAL_TEST_HARNESS_BOOTIMAGE_ARGS := $(subst $(INSTALLED_DEBUG_RAMDISK_TARGET),$(INSTALLED_TEST_HARNESS_RAMDISK_TARGET),$(INTERNAL_DEBUG_BOOTIMAGE_ARGS))
+
+# If boot.img is chained but boot-test-harness.img is not signed, libavb in bootloader
+# will fail to find valid AVB metadata from the end of /boot, thus stop booting.
+# Using a test key to sign boot-test-harness.img to continue booting with the mismatched
+# public key, if the device is unlocked.
+ifneq ($(BOARD_AVB_BOOT_KEY_PATH),)
+$(INSTALLED_TEST_HARNESS_BOOTIMAGE_TARGET): $(AVBTOOL) $(BOARD_AVB_BOOT_TEST_KEY_PATH)
+endif
+
+# $(1): output file
+define build-boot-test-harness-target
+ $(MKBOOTIMG) --kernel $(PRODUCT_OUT)/$(subst .img,,$(subst boot-test-harness,kernel,$(notdir $(1)))) \
+ $(INTERNAL_TEST_HARNESS_BOOTIMAGE_ARGS) $(INTERNAL_MKBOOTIMG_VERSION_ARGS) $(BOARD_MKBOOTIMG_ARGS) --output $@
+ $(if $(BOARD_AVB_BOOT_KEY_PATH),$(call test-key-sign-bootimage,$@))
+endef
+
+# Build the new boot-test-harness.img, based on boot-debug.img and ramdisk-test-harness.img.
+$(INSTALLED_TEST_HARNESS_BOOTIMAGE_TARGET): $(MKBOOTIMG) $(INSTALLED_DEBUG_BOOTIMAGE_TARGET) $(INSTALLED_TEST_HARNESS_RAMDISK_TARGET)
+ $(call pretty,"Target boot test harness image: $@")
+ $(call build-boot-test-harness-target,$@)
+
+.PHONY: bootimage_test_harness-nodeps
+bootimage_test_harness-nodeps: $(MKBOOTIMG)
+ echo "make $@: ignoring dependencies"
+ $(foreach b,$(INSTALLED_TEST_HARNESS_BOOTIMAGE_TARGET),$(call build-boot-test-harness-target,$b))
+
+endif # TARGET_NO_KERNEL
+endif # BOARD_BUILD_SYSTEM_ROOT_IMAGE is not true
+
# -----------------------------------------------------------------
# system image
#
@@ -2220,8 +2147,7 @@
INTERNAL_SYSTEMIMAGE_FILES := $(sort $(filter $(TARGET_OUT)/%, \
$(ALL_GENERATED_SOURCES) \
$(ALL_DEFAULT_INSTALLED_MODULES) \
- $(PDK_FUSION_SYSIMG_FILES) \
- $(RECOVERY_RESOURCE_ZIP)) \
+ $(PDK_FUSION_SYSIMG_FILES)) \
$(PDK_FUSION_SYMLINK_STAMP))
FULL_SYSTEMIMAGE_DEPS := $(INTERNAL_SYSTEMIMAGE_FILES) $(INTERNAL_USERIMAGES_DEPS)
@@ -2314,7 +2240,6 @@
$(call create-system-vendor-symlink)
$(call create-system-product-symlink)
$(call create-system-system_ext-symlink)
- $(call check-apex-libs-absence-on-disk)
@mkdir -p $(dir $(1)) $(systemimage_intermediates) && rm -rf $(systemimage_intermediates)/system_image_info.txt
$(call generate-image-prop-dictionary, $(systemimage_intermediates)/system_image_info.txt,system, \
skip_fsck=true)
@@ -2368,10 +2293,10 @@
endif # INSTALLED_RECOVERYIMAGE_TARGET
endif # INSTALLED_BOOTIMAGE_TARGET
-$(INSTALLED_SYSTEMIMAGE_TARGET): $(BUILT_SYSTEMIMAGE) $(RECOVERY_FROM_BOOT_PATCH)
+$(INSTALLED_SYSTEMIMAGE_TARGET): $(BUILT_SYSTEMIMAGE)
@echo "Install system fs image: $@"
$(copy-file-to-target)
- $(hide) $(call assert-max-image-size,$@ $(RECOVERY_FROM_BOOT_PATCH),$(BOARD_SYSTEMIMAGE_PARTITION_SIZE))
+ $(hide) $(call assert-max-image-size,$@,$(BOARD_SYSTEMIMAGE_PARTITION_SIZE))
systemimage: $(INSTALLED_SYSTEMIMAGE_TARGET)
@@ -2381,11 +2306,8 @@
@echo "make $@: ignoring dependencies"
$(call build-systemimage-target,$(INSTALLED_SYSTEMIMAGE_TARGET))
$(hide) $(call assert-max-image-size,$(INSTALLED_SYSTEMIMAGE_TARGET),$(BOARD_SYSTEMIMAGE_PARTITION_SIZE))
-
-ifneq (,$(filter systemimage-nodeps snod, $(MAKECMDGOALS)))
ifeq (true,$(WITH_DEXPREOPT))
-$(warning Warning: with dexpreopt enabled, you may need a full rebuild.)
-endif
+ $(warning Warning: with dexpreopt enabled, you may need a full rebuild.)
endif
endif # BUILDING_SYSTEM_IMAGE
@@ -2407,7 +2329,7 @@
$(if $(filter $(DEXPREOPT.$(m).INSTALLED_STRIPPED),$(ALL_DEFAULT_INSTALLED_MODULES)),$(m))))
pdk_classes_dex := $(strip \
$(foreach m,$(pdk_odex_javalibs),$(call intermediates-dir-for,JAVA_LIBRARIES,$(m),,COMMON)/javalib.jar) \
- $(foreach m,$(pdk_odex_apps),$(call intermediates-dir-for,APPS,$(m))/package.dex.apk))
+ $(foreach m,$(pdk_odex_apps),$(call intermediates-dir-for,APPS,$(m))/package.apk))
pdk_odex_config_mk := $(PRODUCT_OUT)/pdk_dexpreopt_config.mk
$(pdk_odex_config_mk): PRIVATE_JAVA_LIBRARIES := $(pdk_odex_javalibs)
@@ -2425,7 +2347,7 @@
$(hide) echo "PDK.DEXPREOPT.$(m).DEX_PREOPT_FLAGS:=$(DEXPREOPT.$(m).DEX_PREOPT_FLAGS)" >> $@$(newline)\
)
$(foreach m,$(PRIVATE_APPS),\
- $(hide) echo "PDK.DEXPREOPT.$(m).SRC:=$(patsubst $(OUT_DIR)/%,%,$(call intermediates-dir-for,APPS,$(m))/package.dex.apk)" >> $@$(newline)\
+ $(hide) echo "PDK.DEXPREOPT.$(m).SRC:=$(patsubst $(OUT_DIR)/%,%,$(call intermediates-dir-for,APPS,$(m))/package.apk)" >> $@$(newline)\
$(hide) echo "PDK.DEXPREOPT.$(m).DEX_PREOPT:=$(DEXPREOPT.$(m).DEX_PREOPT)" >> $@$(newline)\
$(hide) echo "PDK.DEXPREOPT.$(m).MULTILIB:=$(DEXPREOPT.$(m).MULTILIB)" >> $@$(newline)\
$(hide) echo "PDK.DEXPREOPT.$(m).DEX_PREOPT_FLAGS:=$(DEXPREOPT.$(m).DEX_PREOPT_FLAGS)" >> $@$(newline)\
@@ -2695,94 +2617,6 @@
$(ALL_PDK_FUSION_FILES)) \
$(PDK_FUSION_SYMLINK_STAMP)
-# Final Vendor VINTF manifest including fragments. This is not assembled
-# on the device because it depends on everything in a given device
-# image which defines a vintf_fragment.
-ifdef BUILT_VENDOR_MANIFEST
-BUILT_ASSEMBLED_VENDOR_MANIFEST := $(PRODUCT_OUT)/verified_assembled_vendor_manifest.xml
-ifeq (true,$(PRODUCT_ENFORCE_VINTF_MANIFEST))
-ifneq ($(strip $(DEVICE_FRAMEWORK_COMPATIBILITY_MATRIX_FILE) $(DEVICE_PRODUCT_COMPATIBILITY_MATRIX_FILE)),)
-$(BUILT_ASSEMBLED_VENDOR_MANIFEST): PRIVATE_SYSTEM_ASSEMBLE_VINTF_ENV_VARS := VINTF_ENFORCE_NO_UNUSED_HALS=true
-endif # DEVICE_FRAMEWORK_COMPATIBILITY_MATRIX_FILE or DEVICE_PRODUCT_COMPATIBILITY_MATRIX_FILE
-endif # PRODUCT_ENFORCE_VINTF_MANIFEST
-$(BUILT_ASSEMBLED_VENDOR_MANIFEST): $(HOST_OUT_EXECUTABLES)/assemble_vintf
-$(BUILT_ASSEMBLED_VENDOR_MANIFEST): $(BUILT_SYSTEM_MATRIX)
-$(BUILT_ASSEMBLED_VENDOR_MANIFEST): $(BUILT_VENDOR_MANIFEST)
-$(BUILT_ASSEMBLED_VENDOR_MANIFEST): $(INTERNAL_VENDORIMAGE_FILES)
-
-$(BUILT_ASSEMBLED_VENDOR_MANIFEST): PRIVATE_FLAGS :=
-
-# -- Kernel version and configurations.
-ifeq ($(PRODUCT_OTA_ENFORCE_VINTF_KERNEL_REQUIREMENTS),true)
-
-intermediates := $(call intermediates-dir-for,ETC,$(notdir $(BUILT_ASSEMBLED_VENDOR_MANIFEST)))
-BUILT_KERNEL_CONFIGS_FILE := $(intermediates)/kernel_configs.txt
-BUILT_KERNEL_VERSION_FILE := $(intermediates)/kernel_version.txt
-
-# BOARD_KERNEL_CONFIG_FILE and BOARD_KERNEL_VERSION can be used to override the values extracted
-# from INSTALLED_KERNEL_TARGET.
-ifdef BOARD_KERNEL_CONFIG_FILE
-ifdef BOARD_KERNEL_VERSION
-$(BUILT_KERNEL_CONFIGS_FILE): $(BOARD_KERNEL_CONFIG_FILE)
- cp $< $@
-$(BUILT_KERNEL_VERSION_FILE):
- echo $(BOARD_KERNEL_VERSION) > $@
-
-my_board_extracted_kernel := true
-endif # BOARD_KERNEL_VERSION
-endif # BOARD_KERNEL_CONFIG_FILE
-
-ifneq ($(my_board_extracted_kernel),true)
-ifndef INSTALLED_KERNEL_TARGET
-$(warning No INSTALLED_KERNEL_TARGET is defined when PRODUCT_OTA_ENFORCE_VINTF_KERNEL_REQUIREMENTS \
- is true. Information about the updated kernel cannot be built into OTA update package. \
- You can fix this by: (1) setting TARGET_NO_KERNEL to false and installing the built kernel \
- to $(PRODUCT_OUT)/kernel, so that kernel information will be extracted from the built kernel; \
- or (2) extracting kernel configuration and defining BOARD_KERNEL_CONFIG_FILE and \
- BOARD_KERNEL_VERSION manually; or (3) unsetting PRODUCT_OTA_ENFORCE_VINTF_KERNEL_REQUIREMENTS \
- manually.)
-else
-
-# Tools for decompression that is not in PATH.
-# Check $(EXTRACT_KERNEL) for decompression algorithms supported by the script.
-# Algorithms that are in the script but not in this list will be found in PATH.
-my_decompress_tools := \
- lz4:$(HOST_OUT_EXECUTABLES)/lz4 \
-
-$(BUILT_KERNEL_CONFIGS_FILE): .KATI_IMPLICIT_OUTPUTS := $(BUILT_KERNEL_VERSION_FILE)
-$(BUILT_KERNEL_CONFIGS_FILE): PRIVATE_DECOMPRESS_TOOLS := $(my_decompress_tools)
-$(BUILT_KERNEL_CONFIGS_FILE): $(foreach pair,$(my_decompress_tools),$(call word-colon,2,$(pair)))
-$(BUILT_KERNEL_CONFIGS_FILE): $(EXTRACT_KERNEL) $(INSTALLED_KERNEL_TARGET)
- $< --tools $(PRIVATE_DECOMPRESS_TOOLS) --input $(INSTALLED_KERNEL_TARGET) \
- --output-configs $@ \
- --output-version $(BUILT_KERNEL_VERSION_FILE)
-
-intermediates :=
-my_decompress_tools :=
-
-endif # my_board_extracted_kernel
-my_board_extracted_kernel :=
-
-endif # INSTALLED_KERNEL_TARGET
-
-$(BUILT_ASSEMBLED_VENDOR_MANIFEST): $(BUILT_KERNEL_CONFIGS_FILE) $(BUILT_KERNEL_VERSION_FILE)
-$(BUILT_ASSEMBLED_VENDOR_MANIFEST): PRIVATE_FLAGS += --kernel $$(cat $(BUILT_KERNEL_VERSION_FILE)):$(BUILT_KERNEL_CONFIGS_FILE)
-
-endif # PRODUCT_OTA_ENFORCE_VINTF_KERNEL_REQUIREMENTS
-
-$(BUILT_ASSEMBLED_VENDOR_MANIFEST):
- @echo "Verifying vendor VINTF manifest."
- PRODUCT_ENFORCE_VINTF_MANIFEST=$(PRODUCT_ENFORCE_VINTF_MANIFEST) \
- $(PRIVATE_SYSTEM_ASSEMBLE_VINTF_ENV_VARS) \
- $(HOST_OUT_EXECUTABLES)/assemble_vintf \
- $(PRIVATE_FLAGS) \
- -c $(BUILT_SYSTEM_MATRIX) \
- -i $(BUILT_VENDOR_MANIFEST) \
- $$([ -d $(TARGET_OUT_VENDOR)/etc/vintf/manifest ] && \
- find $(TARGET_OUT_VENDOR)/etc/vintf/manifest -type f -name "*.xml" | \
- sed "s/^/-i /" | tr '\n' ' ') -o $@
-endif # BUILT_VENDOR_MANIFEST
-
# platform.zip depends on $(INTERNAL_VENDORIMAGE_FILES).
$(INSTALLED_PLATFORM_ZIP) : $(INTERNAL_VENDORIMAGE_FILES)
@@ -2824,18 +2658,16 @@
$(BUILD_IMAGE) \
$(TARGET_OUT_VENDOR) $(vendorimage_intermediates)/vendor_image_info.txt \
$(INSTALLED_VENDORIMAGE_TARGET) $(TARGET_OUT)
- $(call assert-max-image-size,$(INSTALLED_VENDORIMAGE_TARGET),$(BOARD_VENDORIMAGE_PARTITION_SIZE))
+ $(call assert-max-image-size,$(INSTALLED_VENDORIMAGE_TARGET) $(RECOVERY_FROM_BOOT_PATCH),$(BOARD_VENDORIMAGE_PARTITION_SIZE))
endef
# We just build this directly to the install location.
INSTALLED_VENDORIMAGE_TARGET := $(BUILT_VENDORIMAGE_TARGET)
-ifdef BUILT_VENDOR_MANIFEST
-$(INSTALLED_VENDORIMAGE_TARGET): $(BUILT_ASSEMBLED_VENDOR_MANIFEST)
-endif
$(INSTALLED_VENDORIMAGE_TARGET): \
$(INTERNAL_USERIMAGES_DEPS) \
$(INTERNAL_VENDORIMAGE_FILES) \
- $(INSTALLED_FILES_FILE_VENDOR)
+ $(INSTALLED_FILES_FILE_VENDOR) \
+ $(RECOVERY_FROM_BOOT_PATCH)
$(build-vendorimage-target)
.PHONY: vendorimage-nodeps vnod
@@ -2906,52 +2738,6 @@
endif
# -----------------------------------------------------------------
-# Final Framework VINTF manifest including fragments. This is not assembled
-# on the device because it depends on everything in a given device
-# image which defines a vintf_fragment.
-
-ifdef BUILDING_SYSTEM_IMAGE
-
-ifndef BOARD_USES_PRODUCTIMAGE
- # If no product image at all, check system manifest directly against device matrix.
- check_framework_manifest := true
-else ifdef BUILDING_PRODUCT_IMAGE
- # If device has a product image, only check if the product image is built.
- check_framework_manifest := true
-endif
-
-# TODO (b/131425279): delete this line once build_mixed script can correctly merge system and
-# product manifests.
-check_framework_manifest := true
-
-ifeq ($(check_framework_manifest),true)
-
-BUILT_ASSEMBLED_FRAMEWORK_MANIFEST := $(PRODUCT_OUT)/verified_assembled_framework_manifest.xml
-$(BUILT_ASSEMBLED_FRAMEWORK_MANIFEST): $(HOST_OUT_EXECUTABLES)/assemble_vintf \
- $(BUILT_VENDOR_MATRIX) \
- $(BUILT_SYSTEM_MANIFEST) \
- $(FULL_SYSTEMIMAGE_DEPS) \
- $(BUILT_PRODUCT_MANIFEST) \
- $(BUILT_PRODUCTIMAGE_TARGET)
- @echo "Verifying framework VINTF manifest."
- PRODUCT_ENFORCE_VINTF_MANIFEST=$(PRODUCT_ENFORCE_VINTF_MANIFEST) \
- $(HOST_OUT_EXECUTABLES)/assemble_vintf \
- -o $@ \
- -c $(BUILT_VENDOR_MATRIX) \
- -i $(BUILT_SYSTEM_MANIFEST) \
- $(addprefix -i ,\
- $(filter $(TARGET_OUT)/etc/vintf/manifest/%.xml,$(FULL_SYSTEMIMAGE_DEPS)) \
- $(BUILT_PRODUCT_MANIFEST) \
- $(filter $(TARGET_OUT_PRODUCT)/etc/vintf/manifest/%.xml,$(INTERNAL_PRODUCTIMAGE_FILES)))
-
-droidcore: $(BUILT_ASSEMBLED_FRAMEWORK_MANIFEST)
-
-endif # check_framework_manifest
-check_framework_manifest :=
-
-endif # BUILDING_SYSTEM_IMAGE
-
-# -----------------------------------------------------------------
# system_ext partition image
ifdef BUILDING_SYSTEM_EXT_IMAGE
INTERNAL_SYSTEM_EXTIMAGE_FILES := \
@@ -3093,6 +2879,41 @@
endef
# -----------------------------------------------------------------
+# custom images
+INSTALLED_CUSTOMIMAGES_TARGET :=
+
+ifneq ($(strip $(BOARD_CUSTOMIMAGES_PARTITION_LIST)),)
+INTERNAL_AVB_CUSTOMIMAGES_SIGNING_ARGS :=
+
+# Sign custom image.
+# $(1): the prebuilt custom image.
+# $(2): the mount point of the prebuilt custom image.
+# $(3): the signed custom image target.
+define sign_custom_image
+$(3): $(1) $(INTERNAL_USERIMAGES_DEPS)
+ @echo Target custom image: $(3)
+ mkdir -p $(dir $(3))
+ cp $(1) $(3)
+ifeq ($(BOARD_AVB_ENABLE),true)
+ PATH=$(INTERNAL_USERIMAGES_BINARY_PATHS):$$$$PATH \
+ $(AVBTOOL) add_hashtree_footer \
+ --image $(3) \
+ --key $(BOARD_AVB_$(call to-upper,$(2))_KEY_PATH) \
+ --algorithm $(BOARD_AVB_$(call to-upper,$(2))_ALGORITHM) \
+ --partition_size $(BOARD_AVB_$(call to-upper,$(2))_PARTITION_SIZE) \
+ --partition_name $(2) \
+ $(INTERNAL_AVB_CUSTOMIMAGES_SIGNING_ARGS) \
+ $(BOARD_AVB_$(call to-upper,$(2))_ADD_HASHTREE_FOOTER_ARGS)
+endif
+INSTALLED_CUSTOMIMAGES_TARGET += $(3)
+endef
+
+$(foreach partition,$(BOARD_CUSTOMIMAGES_PARTITION_LIST), \
+ $(foreach image,$(BOARD_AVB_$(call to-upper,$(partition))_IMAGE_LIST), \
+ $(eval $(call sign_custom_image,$(image),$(partition),$(PRODUCT_OUT)/$(notdir $(image))))))
+endif
+
+# -----------------------------------------------------------------
# vbmeta image
ifeq ($(BOARD_AVB_ENABLE),true)
@@ -3139,29 +2960,55 @@
$(error BOARD_AVB_VBMETA_SYSTEM and BOARD_AVB_VBMETA_VENDOR cannot have duplicates)
endif
+# When building a standalone recovery image for non-A/B devices, recovery image must be self-signed
+# to be verified independently, and cannot be chained into vbmeta.img. See the link below for
+# details.
+ifeq ($(TARGET_OTA_ALLOW_NON_AB),true)
+ifneq ($(INSTALLED_RECOVERYIMAGE_TARGET),)
+$(if $(BOARD_AVB_RECOVERY_KEY_PATH),,\
+ $(error BOARD_AVB_RECOVERY_KEY_PATH must be defined for if non-A/B is supported. \
+ See https://android.googlesource.com/platform/external/avb/+/master/README.md#booting-into-recovery))
+endif
+endif
+
# Appends os version and security patch level as a AVB property descriptor
BOARD_AVB_SYSTEM_ADD_HASHTREE_FOOTER_ARGS += \
+ --prop com.android.build.system.fingerprint:$(BUILD_FINGERPRINT_FROM_FILE) \
--prop com.android.build.system.os_version:$(PLATFORM_VERSION) \
--prop com.android.build.system.security_patch:$(PLATFORM_SECURITY_PATCH)
BOARD_AVB_PRODUCT_ADD_HASHTREE_FOOTER_ARGS += \
+ --prop com.android.build.product.fingerprint:$(BUILD_FINGERPRINT_FROM_FILE) \
--prop com.android.build.product.os_version:$(PLATFORM_VERSION) \
--prop com.android.build.product.security_patch:$(PLATFORM_SECURITY_PATCH)
BOARD_AVB_SYSTEM_EXT_ADD_HASHTREE_FOOTER_ARGS += \
+ --prop com.android.build.system_ext.fingerprint:$(BUILD_FINGERPRINT_FROM_FILE) \
--prop com.android.build.system_ext.os_version:$(PLATFORM_VERSION) \
--prop com.android.build.system_ext.security_patch:$(PLATFORM_SECURITY_PATCH)
BOARD_AVB_BOOT_ADD_HASH_FOOTER_ARGS += \
+ --prop com.android.build.boot.fingerprint:$(BUILD_FINGERPRINT_FROM_FILE) \
--prop com.android.build.boot.os_version:$(PLATFORM_VERSION)
+BOARD_AVB_VENDOR_BOOT_ADD_HASH_FOOTER_ARGS += \
+ --prop com.android.build.vendor_boot.fingerprint:$(BUILD_FINGERPRINT_FROM_FILE) \
+
+BOARD_AVB_RECOVERY_ADD_HASH_FOOTER_ARGS += \
+ --prop com.android.build.recovery.fingerprint:$(BUILD_FINGERPRINT_FROM_FILE)
+
BOARD_AVB_VENDOR_ADD_HASHTREE_FOOTER_ARGS += \
+ --prop com.android.build.vendor.fingerprint:$(BUILD_FINGERPRINT_FROM_FILE) \
--prop com.android.build.vendor.os_version:$(PLATFORM_VERSION)
BOARD_AVB_ODM_ADD_HASHTREE_FOOTER_ARGS += \
+ --prop com.android.build.odm.fingerprint:$(BUILD_FINGERPRINT_FROM_FILE) \
--prop com.android.build.odm.os_version:$(PLATFORM_VERSION)
+BOARD_AVB_DTBO_ADD_HASH_FOOTER_ARGS += \
+ --prop com.android.build.dtbo.fingerprint:$(BUILD_FINGERPRINT_FROM_FILE)
+
# The following vendor- and odm-specific images needs explicit SPL set per board.
ifdef BOOT_SECURITY_PATCH
BOARD_AVB_BOOT_ADD_HASH_FOOTER_ARGS += \
@@ -3179,6 +3026,7 @@
endif
BOOT_FOOTER_ARGS := BOARD_AVB_BOOT_ADD_HASH_FOOTER_ARGS
+VENDOR_BOOT_FOOTER_ARGS := BOARD_AVB_VENDOR_BOOT_ADD_HASH_FOOTER_ARGS
DTBO_FOOTER_ARGS := BOARD_AVB_DTBO_ADD_HASH_FOOTER_ARGS
SYSTEM_FOOTER_ARGS := BOARD_AVB_SYSTEM_ADD_HASHTREE_FOOTER_ARGS
VENDOR_FOOTER_ARGS := BOARD_AVB_VENDOR_ADD_HASHTREE_FOOTER_ARGS
@@ -3207,8 +3055,11 @@
$(eval $(_signing_args) := \
--algorithm $($(_signing_algorithm)) --key $($(_key_path)))
-$(eval INTERNAL_AVB_MAKE_VBMETA_IMAGE_ARGS += \
- --chain_partition $(part):$($(_rollback_index_location)):$(AVB_CHAIN_KEY_DIR)/$(part).avbpubkey)
+# The recovery partition in non-A/B devices should be verified separately. Skip adding the chain
+# partition descriptor for recovery partition into vbmeta.img.
+$(if $(or $(filter-out true,$(TARGET_OTA_ALLOW_NON_AB)),$(filter-out recovery,$(part))),\
+ $(eval INTERNAL_AVB_MAKE_VBMETA_IMAGE_ARGS += \
+ --chain_partition $(part):$($(_rollback_index_location)):$(AVB_CHAIN_KEY_DIR)/$(part).avbpubkey))
# Set rollback_index via footer args for non-chained vbmeta image. Chained vbmeta image will pick up
# the index via a separate flag (e.g. BOARD_AVB_VBMETA_SYSTEM_ROLLBACK_INDEX).
@@ -3233,10 +3084,26 @@
--include_descriptors_from_image $(call images-for-partitions,$(1)))))
endef
+# Checks and sets build variables for a custom chained partition to include it into vbmeta.img.
+# $(1): the custom partition to enable AVB chain.
+define check-and-set-custom-avb-chain-args
+$(eval part := $(1))
+$(eval PART=$(call to-upper,$(part)))
+$(eval _rollback_index_location := BOARD_AVB_$(PART)_ROLLBACK_INDEX_LOCATION)
+$(if $($(_rollback_index_location)),,$(error $(_rollback_index_location) is not defined))
+
+INTERNAL_AVB_MAKE_VBMETA_IMAGE_ARGS += \
+ --chain_partition $(part):$($(_rollback_index_location)):$(AVB_CHAIN_KEY_DIR)/$(part).avbpubkey
+endef
+
ifdef INSTALLED_BOOTIMAGE_TARGET
$(eval $(call check-and-set-avb-args,boot))
endif
+ifdef INSTALLED_VENDOR_BOOTIMAGE_TARGET
+$(eval $(call check-and-set-avb-args,vendor_boot))
+endif
+
$(eval $(call check-and-set-avb-args,system))
ifdef INSTALLED_VENDORIMAGE_TARGET
@@ -3272,6 +3139,11 @@
$(eval $(call check-and-set-avb-args,vbmeta_vendor))
endif
+ifneq ($(strip $(BOARD_CUSTOMIMAGES_PARTITION_LIST)),)
+$(foreach partition,$(BOARD_CUSTOMIMAGES_PARTITION_LIST), \
+ $(eval $(call check-and-set-custom-avb-chain-args,$(partition))))
+endif
+
# Add kernel cmdline descriptor for kernel to mount system.img as root with
# dm-verity. This works when system.img is either chained or not-chained:
# - chained: The --setup_as_rootfs_from_kernel option will add dm-verity kernel
@@ -3312,6 +3184,9 @@
$(if $(BOARD_AVB_BOOT_KEY_PATH),\
$(hide) $(AVBTOOL) extract_public_key --key $(BOARD_AVB_BOOT_KEY_PATH) \
--output $(1)/boot.avbpubkey)
+ $(if $(BOARD_AVB_VENDOR_BOOT_KEY_PATH),\
+ $(AVBTOOL) extract_public_key --key $(BOARD_AVB_VENDOR_BOOT_KEY_PATH) \
+ --output $(1)/vendor_boot.avbpubkey)
$(if $(BOARD_AVB_SYSTEM_KEY_PATH),\
$(hide) $(AVBTOOL) extract_public_key --key $(BOARD_AVB_SYSTEM_KEY_PATH) \
--output $(1)/system.avbpubkey)
@@ -3339,6 +3214,10 @@
$(if $(BOARD_AVB_VBMETA_VENDOR_KEY_PATH),\
$(hide) $(AVBTOOL) extract_public_key --key $(BOARD_AVB_VBMETA_VENDOR_KEY_PATH) \
--output $(1)/vbmeta_vendor.avbpubkey)
+ $(if $(BOARD_CUSTOMIMAGES_PARTITION_LIST),\
+ $(hide) $(foreach partition,$(BOARD_CUSTOMIMAGES_PARTITION_LIST), \
+ $(AVBTOOL) extract_public_key --key $(BOARD_AVB_$(call to-upper,$(partition))_KEY_PATH) \
+ --output $(1)/$(partition).avbpubkey;))
endef
# Builds a chained VBMeta image. This VBMeta image will contain the descriptors for the partitions
@@ -3399,12 +3278,14 @@
$(INSTALLED_VBMETAIMAGE_TARGET): \
$(AVBTOOL) \
$(INSTALLED_BOOTIMAGE_TARGET) \
+ $(INSTALLED_VENDOR_BOOTIMAGE_TARGET) \
$(INSTALLED_SYSTEMIMAGE_TARGET) \
$(INSTALLED_VENDORIMAGE_TARGET) \
$(INSTALLED_PRODUCTIMAGE_TARGET) \
$(INSTALLED_SYSTEM_EXTIMAGE_TARGET) \
$(INSTALLED_ODMIMAGE_TARGET) \
$(INSTALLED_DTBOIMAGE_TARGET) \
+ $(INSTALLED_CUSTOMIMAGES_TARGET) \
$(INSTALLED_RECOVERYIMAGE_TARGET) \
$(INSTALLED_VBMETA_SYSTEMIMAGE_TARGET) \
$(INSTALLED_VBMETA_VENDORIMAGE_TARGET) \
@@ -3414,6 +3295,8 @@
$(build-vbmetaimage-target)
.PHONY: vbmetaimage-nodeps
+vbmetaimage-nodeps: PRIVATE_AVB_VBMETA_SIGNING_ARGS := \
+ --algorithm $(BOARD_AVB_ALGORITHM) --key $(BOARD_AVB_KEY_PATH)
vbmetaimage-nodeps:
$(build-vbmetaimage-target)
endif # BUILDING_VBMETA_IMAGE
@@ -3421,152 +3304,256 @@
endif # BOARD_AVB_ENABLE
# -----------------------------------------------------------------
+# Check VINTF of build
+
+ifeq (,$(TARGET_BUILD_UNBUNDLED))
+intermediates := $(call intermediates-dir-for,PACKAGING,check_vintf_all)
+check_vintf_all_deps :=
+
+# The build system only writes VINTF metadata to */etc/vintf paths. Legacy paths aren't needed here
+# because they are only used for prebuilt images.
+check_vintf_common_srcs_patterns := \
+ $(TARGET_OUT)/etc/vintf/% \
+ $(TARGET_OUT_VENDOR)/etc/vintf/% \
+ $(TARGET_OUT_ODM)/etc/vintf/% \
+ $(TARGET_OUT_PRODUCT)/etc/vintf/% \
+ $(TARGET_OUT_SYSTEM_EXT)/etc/vintf/% \
+
+check_vintf_common_srcs := $(sort $(filter $(check_vintf_common_srcs_patterns), \
+ $(INTERNAL_SYSTEMIMAGE_FILES) \
+ $(INTERNAL_VENDORIMAGE_FILES) \
+ $(INTERNAL_ODMIMAGE_FILES) \
+ $(INTERNAL_PRODUCTIMAGE_FILES) \
+ $(INTERNAL_SYSTEM_EXTIMAGE_FILES) \
+))
+check_vintf_common_srcs_patterns :=
+
+check_vintf_has_system :=
+check_vintf_has_vendor :=
+
+ifneq (,$(filter EMPTY_ODM_SKU_PLACEHOLDER,$(ODM_MANIFEST_SKUS)))
+$(error EMPTY_ODM_SKU_PLACEHOLDER is an internal variable and cannot be used for ODM_MANIFEST_SKUS)
+endif
+ifneq (,$(filter EMPTY_VENDOR_SKU_PLACEHOLDER,$(DEVICE_MANIFEST_SKUS)))
+$(error EMPTY_VENDOR_SKU_PLACEHOLDER is an internal variable and cannot be used for DEIVCE_MANIFEST_SKUS)
+endif
+
+# -- Check system manifest / matrix including fragments (excluding other framework manifests / matrices, e.g. product);
+check_vintf_system_deps := $(filter $(TARGET_OUT)/etc/vintf/%, $(check_vintf_common_srcs))
+ifneq ($(check_vintf_system_deps),)
+check_vintf_has_system := true
+check_vintf_system_log := $(intermediates)/check_vintf_system_log
+check_vintf_all_deps += $(check_vintf_system_log)
+$(check_vintf_system_log): $(HOST_OUT_EXECUTABLES)/checkvintf $(check_vintf_system_deps)
+ @( $< --check-one --dirmap /system:$(TARGET_OUT) > $@ 2>&1 ) || ( cat $@ && exit 1 )
+check_vintf_system_log :=
+endif # check_vintf_system_deps
+check_vintf_system_deps :=
+
+# -- Check vendor manifest / matrix including fragments (excluding other device manifests / matrices)
+check_vintf_vendor_deps := $(filter $(TARGET_OUT_VENDOR)/etc/vintf/%, $(check_vintf_common_srcs))
+ifneq ($(check_vintf_vendor_deps),)
+check_vintf_has_vendor := true
+check_vintf_vendor_log := $(intermediates)/check_vintf_vendor_log
+check_vintf_all_deps += $(check_vintf_vendor_log)
+# Check vendor SKU=(empty) case when:
+# - DEVICE_MANIFEST_FILE is not empty; OR
+# - DEVICE_MANIFEST_FILE is empty AND DEVICE_MANIFEST_SKUS is empty (only vendor manifest fragments are used)
+$(check_vintf_vendor_log): PRIVATE_VENDOR_SKUS := \
+ $(if $(DEVICE_MANIFEST_FILE),EMPTY_VENDOR_SKU_PLACEHOLDER,\
+ $(if $(DEVICE_MANIFEST_SKUS),,EMPTY_VENDOR_SKU_PLACEHOLDER)) \
+ $(DEVICE_MANIFEST_SKUS)
+$(check_vintf_vendor_log): $(HOST_OUT_EXECUTABLES)/checkvintf $(check_vintf_vendor_deps)
+ $(foreach vendor_sku,$(PRIVATE_VENDOR_SKUS), \
+ ( $< --check-one --dirmap /vendor:$(TARGET_OUT_VENDOR) \
+ --property ro.boot.product.vendor.sku=$(filter-out EMPTY_VENDOR_SKU_PLACEHOLDER,$(vendor_sku)) \
+ > $@ 2>&1 ) || ( cat $@ && exit 1 ); )
+check_vintf_vendor_log :=
+endif # check_vintf_vendor_deps
+check_vintf_vendor_deps :=
+
+# -- Check VINTF compatibility of build.
+# Skip partial builds; only check full builds. Only check if:
+# - PRODUCT_ENFORCE_VINTF_MANIFEST is true
+# - system / vendor VINTF metadata exists
+# - Building product / system_ext / odm images if board has product / system_ext / odm images
+ifeq ($(PRODUCT_ENFORCE_VINTF_MANIFEST),true)
+ifeq ($(check_vintf_has_system),true)
+ifeq ($(check_vintf_has_vendor),true)
+ifeq ($(filter true,$(BUILDING_ODM_IMAGE)),$(filter true,$(BOARD_USES_ODMIMAGE)))
+ifeq ($(filter true,$(BUILDING_PRODUCT_IMAGE)),$(filter true,$(BOARD_USES_PRODUCTIMAGE)))
+ifeq ($(filter true,$(BUILDING_SYSTEM_EXT_IMAGE)),$(filter true,$(BOARD_USES_SYSTEM_EXTIMAGE)))
+
+check_vintf_compatible_log := $(intermediates)/check_vintf_compatible_log
+check_vintf_all_deps += $(check_vintf_compatible_log)
+
+check_vintf_compatible_args :=
+check_vintf_compatible_deps := $(check_vintf_common_srcs)
+
+# -- Kernel version and configurations.
+ifeq ($(PRODUCT_OTA_ENFORCE_VINTF_KERNEL_REQUIREMENTS),true)
+
+BUILT_KERNEL_CONFIGS_FILE := $(intermediates)/kernel_configs.txt
+BUILT_KERNEL_VERSION_FILE := $(intermediates)/kernel_version.txt
+
+my_board_extracted_kernel :=
+
+# BOARD_KERNEL_CONFIG_FILE and BOARD_KERNEL_VERSION can be used to override the values extracted
+# from INSTALLED_KERNEL_TARGET.
+ifdef BOARD_KERNEL_CONFIG_FILE
+ifdef BOARD_KERNEL_VERSION
+$(BUILT_KERNEL_CONFIGS_FILE): $(BOARD_KERNEL_CONFIG_FILE)
+ cp $< $@
+$(BUILT_KERNEL_VERSION_FILE):
+ echo $(BOARD_KERNEL_VERSION) > $@
+
+my_board_extracted_kernel := true
+endif # BOARD_KERNEL_VERSION
+endif # BOARD_KERNEL_CONFIG_FILE
+
+ifneq ($(my_board_extracted_kernel),true)
+ifndef INSTALLED_KERNEL_TARGET
+$(warning No INSTALLED_KERNEL_TARGET is defined when PRODUCT_OTA_ENFORCE_VINTF_KERNEL_REQUIREMENTS \
+ is true. Information about the updated kernel cannot be built into OTA update package. \
+ You can fix this by: (1) setting TARGET_NO_KERNEL to false and installing the built kernel \
+ to $(PRODUCT_OUT)/kernel, so that kernel information will be extracted from the built kernel; \
+ or (2) extracting kernel configuration and defining BOARD_KERNEL_CONFIG_FILE and \
+ BOARD_KERNEL_VERSION manually; or (3) unsetting PRODUCT_OTA_ENFORCE_VINTF_KERNEL_REQUIREMENTS \
+ manually.)
+else
+
+# Tools for decompression that is not in PATH.
+# Check $(EXTRACT_KERNEL) for decompression algorithms supported by the script.
+# Algorithms that are in the script but not in this list will be found in PATH.
+my_decompress_tools := \
+ lz4:$(HOST_OUT_EXECUTABLES)/lz4 \
+
+$(BUILT_KERNEL_CONFIGS_FILE): .KATI_IMPLICIT_OUTPUTS := $(BUILT_KERNEL_VERSION_FILE)
+$(BUILT_KERNEL_CONFIGS_FILE): PRIVATE_DECOMPRESS_TOOLS := $(my_decompress_tools)
+$(BUILT_KERNEL_CONFIGS_FILE): $(foreach pair,$(my_decompress_tools),$(call word-colon,2,$(pair)))
+$(BUILT_KERNEL_CONFIGS_FILE): $(EXTRACT_KERNEL) $(INSTALLED_KERNEL_TARGET)
+ $< --tools $(PRIVATE_DECOMPRESS_TOOLS) --input $(INSTALLED_KERNEL_TARGET) \
+ --output-configs $@ \
+ --output-version $(BUILT_KERNEL_VERSION_FILE)
+
+my_decompress_tools :=
+
+endif # my_board_extracted_kernel
+my_board_extracted_kernel :=
+
+endif # INSTALLED_KERNEL_TARGET
+
+check_vintf_compatible_args += --kernel $$(cat $(BUILT_KERNEL_VERSION_FILE)):$(BUILT_KERNEL_CONFIGS_FILE)
+check_vintf_compatible_deps += $(BUILT_KERNEL_CONFIGS_FILE) $(BUILT_KERNEL_VERSION_FILE)
+
+endif # PRODUCT_OTA_ENFORCE_VINTF_KERNEL_REQUIREMENTS
+
+check_vintf_compatible_args += \
+ --dirmap /system:$(TARGET_OUT) \
+ --dirmap /vendor:$(TARGET_OUT_VENDOR) \
+ --dirmap /odm:$(TARGET_OUT_ODM) \
+ --dirmap /product:$(TARGET_OUT_PRODUCT) \
+ --dirmap /system_ext:$(TARGET_OUT_SYSTEM_EXT) \
+
+ifdef PRODUCT_SHIPPING_API_LEVEL
+check_vintf_compatible_args += --property ro.product.first_api_level=$(PRODUCT_SHIPPING_API_LEVEL)
+endif # PRODUCT_SHIPPING_API_LEVEL
+
+$(check_vintf_compatible_log): PRIVATE_CHECK_VINTF_ARGS := $(check_vintf_compatible_args)
+$(check_vintf_compatible_log): PRIVATE_CHECK_VINTF_DEPS := $(check_vintf_compatible_deps)
+# Check ODM SKU=(empty) case when:
+# - ODM_MANIFEST_FILES is not empty; OR
+# - ODM_MANIFEST_FILES is empty AND ODM_MANIFEST_SKUS is empty (only ODM manifest fragments are used)
+$(check_vintf_compatible_log): PRIVATE_ODM_SKUS := \
+ $(if $(ODM_MANIFEST_FILES),EMPTY_ODM_SKU_PLACEHOLDER,\
+ $(if $(ODM_MANIFEST_SKUS),,EMPTY_ODM_SKU_PLACEHOLDER)) \
+ $(ODM_MANIFEST_SKUS)
+# Check vendor SKU=(empty) case when:
+# - DEVICE_MANIFEST_FILE is not empty; OR
+# - DEVICE_MANIFEST_FILE is empty AND DEVICE_MANIFEST_SKUS is empty (only vendor manifest fragments are used)
+$(check_vintf_compatible_log): PRIVATE_VENDOR_SKUS := \
+ $(if $(DEVICE_MANIFEST_FILE),EMPTY_VENDOR_SKU_PLACEHOLDER,\
+ $(if $(DEVICE_MANIFEST_SKUS),,EMPTY_VENDOR_SKU_PLACEHOLDER)) \
+ $(DEVICE_MANIFEST_SKUS)
+$(check_vintf_compatible_log): $(HOST_OUT_EXECUTABLES)/checkvintf $(check_vintf_compatible_deps)
+ @echo -n -e 'Deps: \n ' > $@
+ @sed 's/ /\n /g' <<< "$(PRIVATE_CHECK_VINTF_DEPS)" >> $@
+ @echo -n -e 'Args: \n ' >> $@
+ @cat <<< "$(PRIVATE_CHECK_VINTF_ARGS)" >> $@
+ $(foreach odm_sku,$(PRIVATE_ODM_SKUS), $(foreach vendor_sku,$(PRIVATE_VENDOR_SKUS), \
+ echo "For ODM SKU = $(odm_sku), vendor SKU = $(vendor_sku)" >> $@; \
+ ( $< --check-compat $(PRIVATE_CHECK_VINTF_ARGS) \
+ --property ro.boot.product.hardware.sku=$(filter-out EMPTY_ODM_SKU_PLACEHOLDER,$(odm_sku)) \
+ --property ro.boot.product.vendor.sku=$(filter-out EMPTY_VENDOR_SKU_PLACEHOLDER,$(vendor_sku)) \
+ >> $@ 2>&1 ) || (cat $@ && exit 1); ))
+
+check_vintf_compatible_log :=
+check_vintf_compatible_args :=
+check_vintf_compatible_deps :=
+
+endif # BUILDING_SYSTEM_EXT_IMAGE equals BOARD_USES_SYSTEM_EXTIMAGE
+endif # BUILDING_PRODUCT_IMAGE equals BOARD_USES_PRODUCTIMAGE
+endif # BUILDING_ODM_IMAGE equals BOARD_USES_ODMIMAGE
+endif # check_vintf_has_vendor
+endif # check_vintf_has_system
+endif # PRODUCT_ENFORCE_VINTF_MANIFEST
+
+# Add all logs of VINTF checks to dist builds
+droid_targets: $(check_vintf_all_deps)
+$(call dist-for-goals, droid_targets, $(check_vintf_all_deps))
+
+# Helper alias to check all VINTF of current build.
+.PHONY: check-vintf-all
+check-vintf-all: $(check_vintf_all_deps)
+ $(foreach file,$^,echo "$(file)"; cat "$(file)"; echo;)
+
+check_vintf_has_vendor :=
+check_vintf_has_system :=
+check_vintf_common_srcs :=
+check_vintf_all_deps :=
+intermediates :=
+endif # !TARGET_BUILD_UNBUNDLED
+
+# -----------------------------------------------------------------
# Check image sizes <= size of super partition
-ifeq (,$(TARGET_BUILD_APPS))
-# Do not check for apps-only build
+ifeq (,$(TARGET_BUILD_UNBUNDLED))
ifeq (true,$(PRODUCT_BUILD_SUPER_PARTITION))
-# (1): list of items like "system", "vendor", "product", "system_ext"
-# return: map each item into a command ( wrapped in $$() ) that reads the size
-define read-size-of-partitions
-$(foreach image,$(call images-for-partitions,$(1)),$$($(SPARSE_IMG) --get_partition_size $(image)))
-endef
-
-# round result to BOARD_SUPER_PARTITION_ALIGNMENT
-#$(1): the calculated size
-ifeq (,$(BOARD_SUPER_PARTITION_ALIGNMENT))
-define round-partition-size
-$(1)
-endef
-else
-define round-partition-size
-$$((($(1)+$(BOARD_SUPER_PARTITION_ALIGNMENT)-1)/$(BOARD_SUPER_PARTITION_ALIGNMENT)*$(BOARD_SUPER_PARTITION_ALIGNMENT)))
-endef
-endif
-
-define super-slot-suffix
-$(if $(filter true,$(AB_OTA_UPDATER)),$(if $(filter true,$(PRODUCT_RETROFIT_DYNAMIC_PARTITIONS)),,_a))
-endef
-
-ifndef BOARD_SUPER_PARTITION_WARN_LIMIT
-BOARD_SUPER_PARTITION_WARN_LIMIT := $$(($(BOARD_SUPER_PARTITION_SIZE) * 95 / 100))
-endif
-
-ifndef BOARD_SUPER_PARTITION_ERROR_LIMIT
-BOARD_SUPER_PARTITION_ERROR_LIMIT := $(BOARD_SUPER_PARTITION_SIZE)
-endif
-
-droid_targets: check-all-partition-sizes
-
-.PHONY: check-all-partition-sizes check-all-partition-sizes-nodeps
-
-check_all_partition_sizes_file := $(call intermediates-dir-for,PACKAGING,check-all-partition-sizes)/timestamp
-
-check-all-partition-sizes: $(check_all_partition_sizes_file)
-
-# Add image dependencies so that generated_*_image_info.txt are written before checking.
-$(check_all_partition_sizes_file): \
- $(SPARSE_IMG) \
- $(call images-for-partitions,$(BOARD_SUPER_PARTITION_PARTITION_LIST))
-
-ifeq ($(PRODUCT_RETROFIT_DYNAMIC_PARTITIONS),true)
-# Check sum(super partition block devices) == super partition
-# Non-retrofit devices already defines BOARD_SUPER_PARTITION_SUPER_DEVICE_SIZE = BOARD_SUPER_PARTITION_SIZE
-define check-super-partition-size
- size_list="$(foreach device,$(call to-upper,$(BOARD_SUPER_PARTITION_BLOCK_DEVICES)),$(BOARD_SUPER_PARTITION_$(device)_DEVICE_SIZE))"; \
- sum_sizes_expr=$$(sed -e 's/ /+/g' <<< "$${size_list}"); \
- max_size_expr="$(BOARD_SUPER_PARTITION_SIZE)"; \
- if [ $$(( $${sum_sizes_expr} )) -ne $$(( $${max_size_expr} )) ]; then \
- echo "The sum of super partition block device sizes is not equal to BOARD_SUPER_PARTITION_SIZE:"; \
- echo $${sum_sizes_expr} '!=' $${max_size_expr}; \
- exit 1; \
- else \
- echo "The sum of super partition block device sizes is equal to BOARD_SUPER_PARTITION_SIZE:"; \
- echo $${sum_sizes_expr} '==' $${max_size_expr}; \
- fi
-endef
-endif
-
-# $(1): human-readable max size string
-# $(2): max size expression
-# $(3): list of partition names
-# $(4): human-readable warn size string
-# $(5): warn size expression
-# $(6): human readable error size string
-# $(7): error size expression
-define check-sum-of-partition-sizes
- partition_size_list="$$(for i in $(call read-size-of-partitions,$(3)); do \
- echo $(call round-partition-size,$${i}); \
- done)"; \
- sum_sizes_expr=$$(tr '\n' '+' <<< "$${partition_size_list}" | sed 's/+$$//'); \
- if [ $$(( $${sum_sizes_expr} )) -gt $$(( $(2) )) ]; then \
- echo "The sum of sizes of [$(strip $(3))] is larger than $(strip $(1)):"; \
- echo $${sum_sizes_expr} '==' $$(( $${sum_sizes_expr} )) '>' "$(2)" '==' $$(( $(2) )); \
- exit 1; \
- else \
- if [[ ! -z "$(7)" ]] && [ $$(( $${sum_sizes_expr} )) -gt $$(( $(7) )) ]; then \
- echo "!!!! ERROR !!!! The sum of sizes of [$(strip $(3))] is larger than $(strip $(6)):"; \
- echo $${sum_sizes_expr} '==' $$(( $${sum_sizes_expr} )) '>' "$(7)" '==' $$(( $(7) )); \
- echo "Super partition is" $$(( $$(( $$(( $${sum_sizes_expr} )) * 100)) / $$(( $(2) )) )) "percent occupied!"; \
- exit 1; \
- fi; \
- if [[ ! -z "$(5)" ]] && [ $$(( $${sum_sizes_expr} )) -gt $$(( $(5) )) ]; then \
- echo "!!!! WARNING !!!! The sum of sizes of [$(strip $(3))] is larger than $(strip $(4)):"; \
- echo $${sum_sizes_expr} '==' $$(( $${sum_sizes_expr} )) '>' "$(5)" '==' $$(( $(5) )); \
- echo "Super partition is" $$(( $$(( $$(( $${sum_sizes_expr} )) * 100)) / $$(( $(2) )) )) "percent occupied!"; \
- fi; \
- echo "The sum of sizes of [$(strip $(3))] is within $(strip $(1)):"; \
- echo $${sum_sizes_expr} '==' $$(( $${sum_sizes_expr} )) '<=' "$(2)" '==' $$(( $(2) )); \
- fi;
-endef
-
+# $(1): misc_info.txt
+# #(2): optional log file
define check-all-partition-sizes-target
- # Check sum(all partitions) <= super partition (/ 2 for A/B devices launched with dynamic partitions)
- $(if $(BOARD_SUPER_PARTITION_SIZE),$(if $(BOARD_SUPER_PARTITION_PARTITION_LIST), \
- $(call check-sum-of-partition-sizes,BOARD_SUPER_PARTITION_SIZE$(if $(call super-slot-suffix), / 2), \
- $(BOARD_SUPER_PARTITION_SIZE)$(if $(call super-slot-suffix), / 2),$(BOARD_SUPER_PARTITION_PARTITION_LIST), \
- BOARD_SUPER_PARTITION_WARN_LIMIT$(if $(call super-slot-suffix), / 2), \
- $(BOARD_SUPER_PARTITION_WARN_LIMIT)$(if $(call super-slot-suffix), / 2), \
- BOARD_SUPER_PARTITION_ERROR_LIMIT$(if $(call super-slot-suffix), / 2), \
- $(BOARD_SUPER_PARTITION_ERROR_LIMIT)$(if $(call super-slot-suffix), / 2)) \
- ))
-
- # For each group, check sum(partitions in group) <= group size
- $(foreach group,$(call to-upper,$(BOARD_SUPER_PARTITION_GROUPS)), \
- $(if $(BOARD_$(group)_SIZE),$(if $(BOARD_$(group)_PARTITION_LIST), \
- $(call check-sum-of-partition-sizes,BOARD_$(group)_SIZE,$(BOARD_$(group)_SIZE),$(BOARD_$(group)_PARTITION_LIST)))))
-
- # Check sum(all group sizes) <= super partition (/ 2 for A/B devices launched with dynamic partitions)
- if [[ ! -z $(BOARD_SUPER_PARTITION_SIZE) ]]; then \
- group_size_list="$(foreach group,$(call to-upper,$(BOARD_SUPER_PARTITION_GROUPS)),$(BOARD_$(group)_SIZE))"; \
- sum_sizes_expr=$$(sed -e 's/ /+/g' <<< "$${group_size_list}"); \
- max_size_tail=$(if $(call super-slot-suffix)," / 2"); \
- max_size_expr="$(BOARD_SUPER_PARTITION_SIZE)$${max_size_tail}"; \
- if [ $$(( $${sum_sizes_expr} )) -gt $$(( $${max_size_expr} )) ]; then \
- echo "The sum of sizes of [$(strip $(BOARD_SUPER_PARTITION_GROUPS))] is larger than BOARD_SUPER_PARTITION_SIZE$${max_size_tail}:"; \
- echo $${sum_sizes_expr} '==' $$(( $${sum_sizes_expr} )) '>' $${max_size_expr} '==' $$(( $${max_size_expr} )); \
- exit 1; \
- else \
- echo "The sum of sizes of [$(strip $(BOARD_SUPER_PARTITION_GROUPS))] is within BOARD_SUPER_PARTITION_SIZE$${max_size_tail}:"; \
- echo $${sum_sizes_expr} '==' $$(( $${sum_sizes_expr} )) '<=' $${max_size_expr} '==' $$(( $${max_size_expr} )); \
- fi \
- fi
+ mkdir -p $(dir $(1))
+ rm -f $(1)
+ $(call dump-super-image-info, $(1))
+ $(foreach partition,$(BOARD_SUPER_PARTITION_PARTITION_LIST), \
+ echo "$(partition)_image="$(call images-for-partitions,$(partition)) >> $(1);)
+ $(CHECK_PARTITION_SIZES) $(if $(2),--logfile $(2),-v) $(1)
endef
-$(check_all_partition_sizes_file):
- $(call check-all-partition-sizes-target)
- $(call check-super-partition-size)
- touch $@
+check_all_partition_sizes_log := $(call intermediates-dir-for,PACKAGING,check-all-partition-sizes)/check_all_partition_sizes_log
+droid_targets: $(check_all_partition_sizes_log)
+$(call dist-for-goals, droid_targets, $(check_all_partition_sizes_log))
+$(check_all_partition_sizes_log): \
+ $(CHECK_PARTITION_SIZES) \
+ $(call images-for-partitions,$(BOARD_SUPER_PARTITION_PARTITION_LIST))
+ $(call check-all-partition-sizes-target, \
+ $(call intermediates-dir-for,PACKAGING,check-all-partition-sizes)/misc_info.txt, \
+ $@)
+
+.PHONY: check-all-partition-sizes
+check-all-partition-sizes: $(check_all_partition_sizes_log)
+
+.PHONY: check-all-partition-sizes-nodeps
check-all-partition-sizes-nodeps:
- $(call check-all-partition-sizes-target)
- $(call check-super-partition-size)
+ $(call check-all-partition-sizes-target, \
+ $(call intermediates-dir-for,PACKAGING,check-all-partition-sizes-nodeps)/misc_info.txt)
endif # PRODUCT_BUILD_SUPER_PARTITION
-endif # TARGET_BUILD_APPS
+endif # !TARGET_BUILD_UNBUNDLED
# -----------------------------------------------------------------
# bring in the installer image generation defines if necessary
@@ -3619,6 +3606,8 @@
INTERNAL_OTATOOLS_MODULES := \
aapt2 \
add_img_to_target_files \
+ aftltool \
+ apksigner \
append2simg \
avbtool \
blk_alloc_to_base_fs \
@@ -3655,6 +3644,7 @@
mkbootfs \
mkbootimg \
mke2fs \
+ mke2fs.conf \
mkf2fsuserimg.sh \
mksquashfs \
mksquashfsimage.sh \
@@ -3669,12 +3659,22 @@
simg2img \
sload_f2fs \
tune2fs \
+ unpack_bootimg \
update_host_simulator \
validate_target_files \
verity_signer \
verity_verifier \
zipalign \
+# Additional tools to unpack and repack the apex file.
+INTERNAL_OTATOOLS_MODULES += \
+ apexer \
+ deapexer \
+ debugfs_static \
+ merge_zips \
+ resize2fs \
+ soong_zip \
+
ifeq (true,$(PRODUCT_SUPPORTS_VBOOT))
INTERNAL_OTATOOLS_MODULES += \
futility \
@@ -3703,7 +3703,7 @@
ifneq (,$(wildcard device))
INTERNAL_OTATOOLS_PACKAGE_FILES += \
$(sort $(shell find device $(wildcard vendor) -type f -name "*.pk8" -o -name "verifiedboot*" -o \
- -name "*.x509.pem" -o -name "oem*.prop"))
+ -name "*.pem" -o -name "oem*.prop" -o -name "*.avbpubkey"))
endif
ifneq (,$(wildcard external/avb))
INTERNAL_OTATOOLS_PACKAGE_FILES += \
@@ -3730,7 +3730,7 @@
mkdir -p $(dir $@)
$(call copy-files-with-structure,$(PRIVATE_OTATOOLS_PACKAGE_FILES),$(HOST_OUT)/,$(PRIVATE_ZIP_ROOT))
$(call copy-files-with-structure,$(PRIVATE_OTATOOLS_RELEASETOOLS),build/make/tools/,$(PRIVATE_ZIP_ROOT))
- cp $(SOONG_ZIP) $(ZIP2ZIP) $(PRIVATE_ZIP_ROOT)/bin/
+ cp $(SOONG_ZIP) $(ZIP2ZIP) $(MERGE_ZIPS) $(PRIVATE_ZIP_ROOT)/bin/
$(SOONG_ZIP) -o $@ -C $(PRIVATE_ZIP_ROOT) -D $(PRIVATE_ZIP_ROOT)
.PHONY: otatools-package
@@ -3751,6 +3751,11 @@
endif
.KATI_READONLY := tool_extensions
+# $1: boot image file name
+define misc_boot_size
+$(subst .img,_size,$(1))=$(BOARD_KERNEL$(call to-upper,$(subst boot,,$(subst .img,,$(1))))_BOOTIMAGE_PARTITION_SIZE)
+endef
+
$(INSTALLED_MISC_INFO_TARGET):
rm -f $@
$(call pretty,"Target misc_info.txt: $@")
@@ -3759,11 +3764,21 @@
ifdef BOARD_FLASH_BLOCK_SIZE
$(hide) echo "blocksize=$(BOARD_FLASH_BLOCK_SIZE)" >> $@
endif
-ifdef BOARD_BOOTIMAGE_PARTITION_SIZE
- $(hide) echo "boot_size=$(BOARD_BOOTIMAGE_PARTITION_SIZE)" >> $@
+ifneq ($(strip $(BOARD_BOOTIMAGE_PARTITION_SIZE))$(strip $(BOARD_KERNEL_BINARIES)),)
+ $(foreach b,$(INSTALLED_BOOTIMAGE_TARGET),\
+ echo "$(call misc_boot_size,$(notdir $(b)))" >> $@;)
endif
ifeq ($(INSTALLED_BOOTIMAGE_TARGET),)
$(hide) echo "no_boot=true" >> $@
+else
+ echo "boot_images=$(foreach b,$(INSTALLED_BOOTIMAGE_TARGET),$(notdir $(b)))" >> $@
+endif
+ifeq ($(BOARD_RAMDISK_USE_LZ4),true)
+ echo "lz4_ramdisks=true" >> $@
+endif
+ifneq ($(INSTALLED_VENDOR_BOOTIMAGE_TARGET),)
+ echo "vendor_boot=true" >> $@
+ echo "vendor_boot_size=$(BOARD_VENDOR_BOOTIMAGE_PARTITION_SIZE)" >> $@
endif
ifeq ($(INSTALLED_RECOVERYIMAGE_TARGET),)
$(hide) echo "no_recovery=true" >> $@
@@ -3789,6 +3804,7 @@
$(hide) echo "extra_recovery_keys=$(PRODUCT_EXTRA_RECOVERY_KEYS)" >> $@
endif
$(hide) echo 'mkbootimg_args=$(BOARD_MKBOOTIMG_ARGS)' >> $@
+ $(hide) echo 'recovery_mkbootimg_args=$(BOARD_RECOVERY_MKBOOTIMG_ARGS)' >> $@
$(hide) echo 'mkbootimg_version_args=$(INTERNAL_MKBOOTIMG_VERSION_ARGS)' >> $@
$(hide) echo "multistage_support=1" >> $@
$(hide) echo "blockimgdiff_versions=3,4" >> $@
@@ -3806,6 +3822,9 @@
ifeq ($(BOARD_USES_FULL_RECOVERY_IMAGE),true)
$(hide) echo "full_recovery_image=true" >> $@
endif
+ifdef BOARD_USES_VENDORIMAGE
+ $(hide) echo "board_uses_vendorimage=true" >> $@
+endif
ifeq ($(BOARD_AVB_ENABLE),true)
$(hide) echo "avb_enable=true" >> $@
$(hide) echo "avb_vbmeta_key_path=$(BOARD_AVB_KEY_PATH)" >> $@
@@ -3817,12 +3836,28 @@
$(hide) echo "avb_boot_algorithm=$(BOARD_AVB_BOOT_ALGORITHM)" >> $@
$(hide) echo "avb_boot_rollback_index_location=$(BOARD_AVB_BOOT_ROLLBACK_INDEX_LOCATION)" >> $@
endif # BOARD_AVB_BOOT_KEY_PATH
+ echo "avb_vendor_boot_add_hash_footer_args=$(BOARD_AVB_VENDOR_BOOT_ADD_HASH_FOOTER_ARGS)" >> $@
+ifdef BOARD_AVB_VENDOR_BOOT_KEY_PATH
+ echo "avb_vendor_boot_key_path=$(BOARD_AVB_VENDOR_BOOT_KEY_PATH)" >> $@
+ echo "avb_vendor_boot_algorithm=$(BOARD_AVB_VENDOR_BOOT_ALGORITHM)" >> $@
+ echo "avb_vendor_boot_rollback_index_location=$(BOARD_AVB_VENDOR_BOOT_ROLLBACK_INDEX_LOCATION)" >> $@
+endif # BOARD_AVB_VENDOR_BOOT_KEY_PATH
$(hide) echo "avb_recovery_add_hash_footer_args=$(BOARD_AVB_RECOVERY_ADD_HASH_FOOTER_ARGS)" >> $@
ifdef BOARD_AVB_RECOVERY_KEY_PATH
$(hide) echo "avb_recovery_key_path=$(BOARD_AVB_RECOVERY_KEY_PATH)" >> $@
$(hide) echo "avb_recovery_algorithm=$(BOARD_AVB_RECOVERY_ALGORITHM)" >> $@
$(hide) echo "avb_recovery_rollback_index_location=$(BOARD_AVB_RECOVERY_ROLLBACK_INDEX_LOCATION)" >> $@
endif # BOARD_AVB_RECOVERY_KEY_PATH
+ifneq (,$(strip $(BOARD_CUSTOMIMAGES_PARTITION_LIST)))
+ $(hide) echo "avb_custom_images_partition_list=$(BOARD_CUSTOMIMAGES_PARTITION_LIST)" >> $@
+ $(hide) $(foreach partition,$(BOARD_CUSTOMIMAGES_PARTITION_LIST), \
+ echo "avb_$(partition)_key_path=$(BOARD_AVB_$(call to-upper,$(partition))_KEY_PATH)" >> $@; \
+ echo "avb_$(partition)_algorithm=$(BOARD_AVB_$(call to-upper,$(partition))_ALGORITHM)" >> $@; \
+ echo "avb_$(partition)_add_hashtree_footer_args=$(BOARD_AVB_$(call to-upper,$(partition))_ADD_HASHTREE_FOOTER_ARGS)" >> $@; \
+ echo "avb_$(partition)_rollback_index_location=$(BOARD_AVB_$(call to-upper,$(partition))_ROLLBACK_INDEX_LOCATION)" >> $@; \
+ echo "avb_$(partition)_partition_size=$(BOARD_AVB_$(call to-upper,$(partition))_PARTITION_SIZE)" >> $@; \
+ echo "avb_$(partition)_image_list=$(foreach image,$(BOARD_AVB_$(call to-upper,$(partition))_IMAGE_LIST),$(notdir $(image)))" >> $@;)
+endif # BOARD_CUSTOMIMAGES_PARTITION_LIST
ifneq (,$(strip $(BOARD_AVB_VBMETA_SYSTEM)))
$(hide) echo "avb_vbmeta_system=$(BOARD_AVB_VBMETA_SYSTEM)" >> $@
$(hide) echo "avb_vbmeta_system_args=$(BOARD_AVB_MAKE_VBMETA_SYSTEM_IMAGE_ARGS)" >> $@
@@ -3852,6 +3887,9 @@
$(hide) echo "build_type=$(TARGET_BUILD_VARIANT)" >> $@
$(hide) echo "ab_update=true" >> $@
endif
+ifeq ($(TARGET_OTA_ALLOW_NON_AB),true)
+ $(hide) echo "allow_non_ab=true" >> $@
+endif
ifdef BOARD_PREBUILT_DTBOIMAGE
$(hide) echo "has_dtbo=true" >> $@
ifeq ($(BOARD_AVB_ENABLE),true)
@@ -3872,6 +3910,15 @@
ifdef ODM_MANIFEST_SKUS
$(hide) echo "vintf_odm_manifest_skus=$(ODM_MANIFEST_SKUS)" >> $@
endif
+ifdef ODM_MANIFEST_FILES
+ $(hide) echo "vintf_include_empty_odm_sku=true" >> $@
+endif
+ifdef DEVICE_MANIFEST_SKUS
+ $(hide) echo "vintf_vendor_manifest_skus=$(DEVICE_MANIFEST_SKUS)" >> $@
+endif
+ifdef DEVICE_MANIFEST_FILE
+ $(hide) echo "vintf_include_empty_vendor_sku=true" >> $@
+endif
.PHONY: misc_info
misc_info: $(INSTALLED_MISC_INFO_TARGET)
@@ -3910,7 +3957,7 @@
# We can't build static executables when SANITIZE_TARGET=address
ifeq (,$(filter address, $(SANITIZE_TARGET)))
built_ota_tools += \
- $(call intermediates-dir-for,EXECUTABLES,updater,,,$(TARGET_PREFER_32_BIT))/updater
+ $(call intermediates-dir-for,EXECUTABLES,updater)/updater
endif
$(BUILT_TARGET_FILES_PACKAGE): PRIVATE_OTA_TOOLS := $(built_ota_tools)
@@ -3920,10 +3967,13 @@
ifeq ($(AB_OTA_UPDATER),true)
updater_dep := system/update_engine/update_engine.conf
-else
-# Build OTA tools if not using the AB Updater.
+endif
+
+# Build OTA tools if non-A/B is allowed
+ifeq ($(TARGET_OTA_ALLOW_NON_AB),true)
updater_dep := $(built_ota_tools)
endif
+
$(BUILT_TARGET_FILES_PACKAGE): $(updater_dep)
# If we are using recovery as boot, output recovery files to BOOT/.
@@ -3939,6 +3989,18 @@
$(BUILT_TARGET_FILES_PACKAGE): $(TARGET_OUT_OEM)/$(OSRELEASED_DIRECTORY)/product_version
$(BUILT_TARGET_FILES_PACKAGE): $(TARGET_OUT_ETC)/$(OSRELEASED_DIRECTORY)/system_version
endif
+
+ # Not checking in board_config.mk, since AB_OTA_PARTITIONS may be updated in Android.mk (e.g. to
+ # additionally include radio or bootloader partitions).
+ ifeq ($(AB_OTA_PARTITIONS),)
+ $(error AB_OTA_PARTITIONS must be defined when using AB_OTA_UPDATER)
+ endif
+endif
+
+ifneq ($(AB_OTA_PARTITIONS),)
+ ifneq ($(AB_OTA_UPDATER),true)
+ $(error AB_OTA_UPDATER must be true when defining AB_OTA_PARTITIONS)
+ endif
endif
# Run fs_config while creating the target files package
@@ -3948,6 +4010,15 @@
(cd $(1); find . -type d | sed 's,$$,/,'; find . \! -type d) | cut -c 3- | sort | sed 's,^,$(2),' | $(HOST_OUT_EXECUTABLES)/fs_config -C -D $(TARGET_OUT) -S $(SELINUX_FC) -R "$(2)"
endef
+# Filter out vendor from the list for AOSP targets.
+# $(1): list
+define filter-out-missing-vendor
+$(if $(INSTALLED_VENDORIMAGE_TARGET),$(1),$(filter-out vendor,$(1)))
+endef
+
+# Information related to dynamic partitions and virtual A/B. This information
+# is needed for building the super image (see dump-super-image-info) and
+# building OTA packages.
# $(1): file
define dump-dynamic-partitions-info
$(if $(filter true,$(PRODUCT_USE_DYNAMIC_PARTITIONS)), \
@@ -3965,17 +4036,31 @@
$(foreach device,$(BOARD_SUPER_PARTITION_BLOCK_DEVICES), \
echo "super_$(device)_device_size=$(BOARD_SUPER_PARTITION_$(call to-upper,$(device))_DEVICE_SIZE)" >> $(1);)
$(if $(BOARD_SUPER_PARTITION_PARTITION_LIST), \
- echo "dynamic_partition_list=$(BOARD_SUPER_PARTITION_PARTITION_LIST)" >> $(1))
+ echo "dynamic_partition_list=$(call filter-out-missing-vendor, $(BOARD_SUPER_PARTITION_PARTITION_LIST))" >> $(1))
$(if $(BOARD_SUPER_PARTITION_GROUPS),
echo "super_partition_groups=$(BOARD_SUPER_PARTITION_GROUPS)" >> $(1))
$(foreach group,$(BOARD_SUPER_PARTITION_GROUPS), \
echo "super_$(group)_group_size=$(BOARD_$(call to-upper,$(group))_SIZE)" >> $(1); \
$(if $(BOARD_$(call to-upper,$(group))_PARTITION_LIST), \
- echo "super_$(group)_partition_list=$(BOARD_$(call to-upper,$(group))_PARTITION_LIST)" >> $(1);))
+ echo "super_$(group)_partition_list=$(call filter-out-missing-vendor, $(BOARD_$(call to-upper,$(group))_PARTITION_LIST))" >> $(1);))
$(if $(filter true,$(TARGET_USERIMAGES_SPARSE_EXT_DISABLED)), \
echo "build_non_sparse_super_partition=true" >> $(1))
+ $(if $(filter true,$(TARGET_USERIMAGES_SPARSE_F2FS_DISABLED)), \
+ echo "build_non_sparse_super_partition=true" >> $(1))
$(if $(filter true,$(BOARD_SUPER_IMAGE_IN_UPDATE_PACKAGE)), \
echo "super_image_in_update_package=true" >> $(1))
+ $(if $(BOARD_SUPER_PARTITION_SIZE), \
+ echo "super_partition_size=$(BOARD_SUPER_PARTITION_SIZE)" >> $(1))
+ $(if $(BOARD_SUPER_PARTITION_ALIGNMENT), \
+ echo "super_partition_alignment=$(BOARD_SUPER_PARTITION_ALIGNMENT)" >> $(1))
+ $(if $(BOARD_SUPER_PARTITION_WARN_LIMIT), \
+ echo "super_partition_warn_limit=$(BOARD_SUPER_PARTITION_WARN_LIMIT)" >> $(1))
+ $(if $(BOARD_SUPER_PARTITION_ERROR_LIMIT), \
+ echo "super_partition_error_limit=$(BOARD_SUPER_PARTITION_ERROR_LIMIT)" >> $(1))
+ $(if $(filter true,$(PRODUCT_VIRTUAL_AB_OTA)), \
+ echo "virtual_ab=true" >> $(1))
+ $(if $(filter true,$(PRODUCT_VIRTUAL_AB_OTA_RETROFIT)), \
+ echo "virtual_ab_retrofit=true" >> $(1))
endef
# By conditionally including the dependency of the target files package on the
@@ -3995,6 +4080,7 @@
$(BUILT_TARGET_FILES_PACKAGE): \
$(INSTALLED_RAMDISK_TARGET) \
$(INSTALLED_BOOTIMAGE_TARGET) \
+ $(INSTALLED_VENDOR_BOOTIMAGE_TARGET) \
$(INSTALLED_RADIOIMAGE_TARGET) \
$(INSTALLED_RECOVERYIMAGE_TARGET) \
$(INSTALLED_USERDATAIMAGE_TARGET) \
@@ -4005,6 +4091,7 @@
$(INSTALLED_VBMETAIMAGE_TARGET) \
$(INSTALLED_ODMIMAGE_TARGET) \
$(INSTALLED_DTBOIMAGE_TARGET) \
+ $(INSTALLED_CUSTOMIMAGES_TARGET) \
$(INTERNAL_SYSTEMOTHERIMAGE_FILES) \
$(INSTALLED_ANDROID_INFO_TXT_TARGET) \
$(INSTALLED_KERNEL_TARGET) \
@@ -4027,10 +4114,6 @@
$(HOST_OUT_EXECUTABLES)/fs_config \
$(ADD_IMG_TO_TARGET_FILES) \
$(MAKE_RECOVERY_PATCH) \
- $(BUILT_ASSEMBLED_FRAMEWORK_MANIFEST) \
- $(BUILT_ASSEMBLED_VENDOR_MANIFEST) \
- $(BUILT_SYSTEM_MATRIX) \
- $(BUILT_VENDOR_MATRIX) \
$(BUILT_KERNEL_CONFIGS_FILE) \
$(BUILT_KERNEL_VERSION_FILE) \
| $(ACP)
@@ -4047,33 +4130,37 @@
$(hide) $(call package_files-copy-root, \
$(TARGET_RECOVERY_ROOT_OUT),$(zip_root)/$(PRIVATE_RECOVERY_OUT)/RAMDISK)
ifdef INSTALLED_KERNEL_TARGET
- $(hide) cp $(INSTALLED_KERNEL_TARGET) $(zip_root)/$(PRIVATE_RECOVERY_OUT)/kernel
+ cp $(INSTALLED_KERNEL_TARGET) $(zip_root)/$(PRIVATE_RECOVERY_OUT)/
endif
+ifeq (truetrue,$(strip $(BUILDING_VENDOR_BOOT_IMAGE))$(strip $(AB_OTA_UPDATER)))
+ echo "$(GENERIC_KERNEL_CMDLINE)" > $(zip_root)/$(PRIVATE_RECOVERY_OUT)/cmdline
+else # not (BUILDING_VENDOR_BOOT_IMAGE and AB_OTA_UPDATER)
ifdef INSTALLED_2NDBOOTLOADER_TARGET
- $(hide) cp $(INSTALLED_2NDBOOTLOADER_TARGET) $(zip_root)/$(PRIVATE_RECOVERY_OUT)/second
+ cp $(INSTALLED_2NDBOOTLOADER_TARGET) $(zip_root)/$(PRIVATE_RECOVERY_OUT)/second
endif
ifdef BOARD_INCLUDE_RECOVERY_DTBO
ifdef BOARD_PREBUILT_RECOVERY_DTBOIMAGE
- $(hide) cp $(BOARD_PREBUILT_RECOVERY_DTBOIMAGE) $(zip_root)/$(PRIVATE_RECOVERY_OUT)/recovery_dtbo
+ cp $(BOARD_PREBUILT_RECOVERY_DTBOIMAGE) $(zip_root)/$(PRIVATE_RECOVERY_OUT)/recovery_dtbo
else
- $(hide) cp $(BOARD_PREBUILT_DTBOIMAGE) $(zip_root)/$(PRIVATE_RECOVERY_OUT)/recovery_dtbo
+ cp $(BOARD_PREBUILT_DTBOIMAGE) $(zip_root)/$(PRIVATE_RECOVERY_OUT)/recovery_dtbo
endif
-endif
+endif # BOARD_INCLUDE_RECOVERY_DTBO
ifdef BOARD_INCLUDE_RECOVERY_ACPIO
- $(hide) cp $(BOARD_RECOVERY_ACPIO) $(zip_root)/$(PRIVATE_RECOVERY_OUT)/recovery_acpio
+ cp $(BOARD_RECOVERY_ACPIO) $(zip_root)/$(PRIVATE_RECOVERY_OUT)/recovery_acpio
endif
ifdef INSTALLED_DTBIMAGE_TARGET
- $(hide) cp $(INSTALLED_DTBIMAGE_TARGET) $(zip_root)/$(PRIVATE_RECOVERY_OUT)/dtb
+ cp $(INSTALLED_DTBIMAGE_TARGET) $(zip_root)/$(PRIVATE_RECOVERY_OUT)/dtb
endif
ifdef INTERNAL_KERNEL_CMDLINE
- $(hide) echo "$(INTERNAL_KERNEL_CMDLINE)" > $(zip_root)/$(PRIVATE_RECOVERY_OUT)/cmdline
+ echo "$(INTERNAL_KERNEL_CMDLINE)" > $(zip_root)/$(PRIVATE_RECOVERY_OUT)/cmdline
endif
ifdef BOARD_KERNEL_BASE
- $(hide) echo "$(BOARD_KERNEL_BASE)" > $(zip_root)/$(PRIVATE_RECOVERY_OUT)/base
+ echo "$(BOARD_KERNEL_BASE)" > $(zip_root)/$(PRIVATE_RECOVERY_OUT)/base
endif
ifdef BOARD_KERNEL_PAGESIZE
- $(hide) echo "$(BOARD_KERNEL_PAGESIZE)" > $(zip_root)/$(PRIVATE_RECOVERY_OUT)/pagesize
+ echo "$(BOARD_KERNEL_PAGESIZE)" > $(zip_root)/$(PRIVATE_RECOVERY_OUT)/pagesize
endif
+endif # INSTALLED_VENDOR_BOOTIMAGE_TARGET not defined
endif # INSTALLED_RECOVERYIMAGE_TARGET defined or BOARD_USES_RECOVERY_AS_BOOT is true
@# Components of the boot image
$(hide) mkdir -p $(zip_root)/BOOT
@@ -4089,25 +4176,42 @@
ifdef INSTALLED_KERNEL_TARGET
$(hide) cp $(INSTALLED_KERNEL_TARGET) $(zip_root)/BOOT/kernel
endif
+ifndef INSTALLED_VENDOR_BOOTIMAGE_TARGET
ifdef INSTALLED_2NDBOOTLOADER_TARGET
- $(hide) cp $(INSTALLED_2NDBOOTLOADER_TARGET) $(zip_root)/BOOT/second
+ cp $(INSTALLED_2NDBOOTLOADER_TARGET) $(zip_root)/BOOT/second
endif
ifdef INSTALLED_DTBIMAGE_TARGET
- $(hide) cp $(INSTALLED_DTBIMAGE_TARGET) $(zip_root)/BOOT/dtb
+ cp $(INSTALLED_DTBIMAGE_TARGET) $(zip_root)/BOOT/dtb
endif
-ifdef INTERNAL_KERNEL_CMDLINE
- $(hide) echo "$(INTERNAL_KERNEL_CMDLINE)" > $(zip_root)/BOOT/cmdline
-endif
+ echo "$(INTERNAL_KERNEL_CMDLINE)" > $(zip_root)/BOOT/cmdline
ifdef BOARD_KERNEL_BASE
- $(hide) echo "$(BOARD_KERNEL_BASE)" > $(zip_root)/BOOT/base
+ echo "$(BOARD_KERNEL_BASE)" > $(zip_root)/BOOT/base
endif
ifdef BOARD_KERNEL_PAGESIZE
- $(hide) echo "$(BOARD_KERNEL_PAGESIZE)" > $(zip_root)/BOOT/pagesize
+ echo "$(BOARD_KERNEL_PAGESIZE)" > $(zip_root)/BOOT/pagesize
endif
-endif # BOARD_USES_RECOVERY_AS_BOOT
+else # INSTALLED_VENDOR_BOOTIMAGE_TARGET defined
+ echo "$(GENERIC_KERNEL_CMDLINE)" > $(zip_root)/BOOT/cmdline
+endif # INSTALLED_VENDOR_BOOTIMAGE_TARGET defined
+endif # BOARD_USES_RECOVERY_AS_BOOT not true
$(hide) $(foreach t,$(INSTALLED_RADIOIMAGE_TARGET),\
mkdir -p $(zip_root)/RADIO; \
cp $(t) $(zip_root)/RADIO/$(notdir $(t));)
+ifdef INSTALLED_VENDOR_BOOTIMAGE_TARGET
+ mkdir -p $(zip_root)/VENDOR_BOOT
+ $(call package_files-copy-root, \
+ $(TARGET_VENDOR_RAMDISK_OUT),$(zip_root)/VENDOR_BOOT/RAMDISK)
+ifdef INSTALLED_DTBIMAGE_TARGET
+ cp $(INSTALLED_DTBIMAGE_TARGET) $(zip_root)/VENDOR_BOOT/dtb
+endif
+ifdef BOARD_KERNEL_BASE
+ echo "$(BOARD_KERNEL_BASE)" > $(zip_root)/VENDOR_BOOT/base
+endif
+ifdef BOARD_KERNEL_PAGESIZE
+ echo "$(BOARD_KERNEL_PAGESIZE)" > $(zip_root)/VENDOR_BOOT/pagesize
+endif
+ echo "$(INTERNAL_KERNEL_CMDLINE)" > $(zip_root)/VENDOR_BOOT/vendor_cmdline
+endif # INSTALLED_VENDOR_BOOTIMAGE_TARGET
ifdef BUILDING_SYSTEM_IMAGE
@# Contents of the system image
$(hide) $(call package_files-copy-root, \
@@ -4146,7 +4250,7 @@
@# Extra contents of the OTA package
$(hide) mkdir -p $(zip_root)/OTA
$(hide) cp $(INSTALLED_ANDROID_INFO_TXT_TARGET) $(zip_root)/OTA/
-ifneq ($(AB_OTA_UPDATER),true)
+ifeq ($(TARGET_OTA_ALLOW_NON_AB),true)
ifneq ($(built_ota_tools),)
$(hide) mkdir -p $(zip_root)/OTA/bin
$(hide) cp $(PRIVATE_OTA_TOOLS) $(zip_root)/OTA/bin/
@@ -4183,11 +4287,11 @@
$(hide) cp $(PRODUCT_ODM_BASE_FS_PATH) \
$(zip_root)/META/$(notdir $(PRODUCT_ODM_BASE_FS_PATH))
endif
+ifeq ($(TARGET_OTA_ALLOW_NON_AB),true)
ifneq ($(INSTALLED_RECOVERYIMAGE_TARGET),)
-ifdef BUILDING_SYSTEM_IMAGE
$(hide) PATH=$(INTERNAL_USERIMAGES_BINARY_PATHS):$$PATH MKBOOTIMG=$(MKBOOTIMG) \
$(MAKE_RECOVERY_PATCH) $(zip_root) $(zip_root)
-endif # BUILDING_SYSTEM_IMAGE
+endif
endif
ifeq ($(AB_OTA_UPDATER),true)
@# When using the A/B updater, include the updater config files in the zip.
@@ -4232,6 +4336,11 @@
$(hide) mkdir -p $(zip_root)/PREBUILT_IMAGES
$(hide) cp $(INSTALLED_DTBOIMAGE_TARGET) $(zip_root)/PREBUILT_IMAGES/
endif # BOARD_PREBUILT_DTBOIMAGE
+ifneq ($(strip $(BOARD_CUSTOMIMAGES_PARTITION_LIST)),)
+ $(hide) mkdir -p $(zip_root)/PREBUILT_IMAGES
+ $(hide) $(foreach partition,$(BOARD_CUSTOMIMAGES_PARTITION_LIST), \
+ $(foreach image,$(BOARD_AVB_$(call to-upper,$(partition))_IMAGE_LIST),cp $(image) $(zip_root)/PREBUILT_IMAGES/;))
+endif # BOARD_CUSTOMIMAGES_PARTITION_LIST
@# The radio images in BOARD_PACK_RADIOIMAGES will be additionally copied from RADIO/ into
@# IMAGES/, which then will be added into <product>-img.zip. Such images must be listed in
@# INSTALLED_RADIOIMAGE_TARGET.
@@ -4260,6 +4369,9 @@
@# BOOT/RAMDISK exists and contains the ramdisk for recovery if using BOARD_USES_RECOVERY_AS_BOOT.
$(hide) $(call fs_config,$(zip_root)/BOOT/RAMDISK,) > $(zip_root)/META/boot_filesystem_config.txt
endif
+ifneq ($(INSTALLED_VENDOR_BOOTIMAGE_TARGET),)
+ $(call fs_config,$(zip_root)/VENDOR_BOOT/RAMDISK,) > $(zip_root)/META/vendor_boot_filesystem_config.txt
+endif
ifneq ($(BOARD_BUILD_SYSTEM_ROOT_IMAGE),true)
@# BOOT/RAMDISK also exists and contains the first stage ramdisk if not using BOARD_BUILD_SYSTEM_ROOT_IMAGE.
$(hide) $(call fs_config,$(zip_root)/BOOT/RAMDISK,) > $(zip_root)/META/boot_filesystem_config.txt
@@ -4271,37 +4383,18 @@
$(hide) $(call fs_config,$(zip_root)/SYSTEM_OTHER,system/) > $(zip_root)/META/system_other_filesystem_config.txt
endif
@# Metadata for compatibility verification.
- $(hide) cp $(BUILT_SYSTEM_MATRIX) $(zip_root)/META/system_matrix.xml
-ifdef BUILT_ASSEMBLED_FRAMEWORK_MANIFEST
- $(hide) cp $(BUILT_ASSEMBLED_FRAMEWORK_MANIFEST) $(zip_root)/META/system_manifest.xml
-endif
-ifdef BUILT_ASSEMBLED_VENDOR_MANIFEST
- $(hide) cp $(BUILT_ASSEMBLED_VENDOR_MANIFEST) $(zip_root)/META/vendor_manifest.xml
-endif
-ifdef BUILT_VENDOR_MATRIX
- $(hide) cp $(BUILT_VENDOR_MATRIX) $(zip_root)/META/vendor_matrix.xml
-endif
ifdef BUILT_KERNEL_CONFIGS_FILE
$(hide) cp $(BUILT_KERNEL_CONFIGS_FILE) $(zip_root)/META/kernel_configs.txt
endif
ifdef BUILT_KERNEL_VERSION_FILE
$(hide) cp $(BUILT_KERNEL_VERSION_FILE) $(zip_root)/META/kernel_version.txt
endif
-ifneq ($(BOARD_SUPER_PARTITION_GROUPS),)
- $(hide) echo "super_partition_groups=$(BOARD_SUPER_PARTITION_GROUPS)" > $(zip_root)/META/dynamic_partitions_info.txt
- @# Remove 'vendor' from the group partition list if the image is not available. This should only
- @# happen to AOSP targets built without vendor.img. We can't remove the partition from the
- @# BoardConfig file, as it's still needed elsewhere (e.g. when creating super_empty.img).
- $(foreach group,$(BOARD_SUPER_PARTITION_GROUPS), \
- $(eval _group_partition_list := $(BOARD_$(call to-upper,$(group))_PARTITION_LIST)) \
- $(if $(INSTALLED_VENDORIMAGE_TARGET),,$(eval _group_partition_list := $(filter-out vendor,$(_group_partition_list)))) \
- echo "$(group)_size=$(BOARD_$(call to-upper,$(group))_SIZE)" >> $(zip_root)/META/dynamic_partitions_info.txt; \
- $(if $(_group_partition_list), \
- echo "$(group)_partition_list=$(_group_partition_list)" >> $(zip_root)/META/dynamic_partitions_info.txt;))
-endif # BOARD_SUPER_PARTITION_GROUPS
- @# TODO(b/134525174): Remove `-r` after addressing the issue with recovery patch generation.
- $(hide) PATH=$(INTERNAL_USERIMAGES_BINARY_PATHS):$$PATH MKBOOTIMG=$(MKBOOTIMG) \
- $(ADD_IMG_TO_TARGET_FILES) -a -r -v -p $(HOST_OUT) $(zip_root)
+ rm -rf $(zip_root)/META/dynamic_partitions_info.txt
+ifeq (true,$(PRODUCT_USE_DYNAMIC_PARTITIONS))
+ $(call dump-dynamic-partitions-info, $(zip_root)/META/dynamic_partitions_info.txt)
+endif
+ PATH=$(INTERNAL_USERIMAGES_BINARY_PATHS):$$PATH MKBOOTIMG=$(MKBOOTIMG) \
+ $(ADD_IMG_TO_TARGET_FILES) -a -v -p $(HOST_OUT) $(zip_root)
ifeq ($(BUILD_QEMU_IMAGES),true)
$(hide) AVBTOOL=$(AVBTOOL) $(MK_VBMETA_BOOT_KERNEL_CMDLINE_SH) $(zip_root)/IMAGES/vbmeta.img \
$(zip_root)/IMAGES/system.img $(zip_root)/IMAGES/VerifiedBootParams.textproto
@@ -4390,7 +4483,7 @@
# A zip of the appcompat directory containing logs
APPCOMPAT_ZIP := $(PRODUCT_OUT)/appcompat.zip
# For apps_only build we'll establish the dependency later in build/make/core/main.mk.
-ifndef TARGET_BUILD_APPS
+ifeq (,$(TARGET_BUILD_UNBUNDLED))
$(APPCOMPAT_ZIP): $(INSTALLED_SYSTEMIMAGE_TARGET) \
$(INSTALLED_RAMDISK_TARGET) \
$(INSTALLED_BOOTIMAGE_TARGET) \
@@ -4419,7 +4512,7 @@
SYMBOLS_ZIP := $(PRODUCT_OUT)/$(name).zip
# For apps_only build we'll establish the dependency later in build/make/core/main.mk.
-ifndef TARGET_BUILD_APPS
+ifeq (,$(TARGET_BUILD_UNBUNDLED))
$(SYMBOLS_ZIP): $(INSTALLED_SYSTEMIMAGE_TARGET) \
$(INSTALLED_RAMDISK_TARGET) \
$(INSTALLED_BOOTIMAGE_TARGET) \
@@ -4445,7 +4538,7 @@
name := $(name)_debug
endif
COVERAGE_ZIP := $(PRODUCT_OUT)/$(name).zip
-ifndef TARGET_BUILD_APPS
+ifeq (,$(TARGET_BUILD_UNBUNDLED))
$(COVERAGE_ZIP): $(INSTALLED_SYSTEMIMAGE_TARGET) \
$(INSTALLED_RAMDISK_TARGET) \
$(INSTALLED_BOOTIMAGE_TARGET) \
@@ -4463,6 +4556,19 @@
$(hide) find $(TARGET_OUT_COVERAGE) | sort >$(PRIVATE_LIST_FILE)
$(hide) $(SOONG_ZIP) -d -o $@ -C $(TARGET_OUT_COVERAGE) -l $(PRIVATE_LIST_FILE)
+#------------------------------------------------------------------
+# Export the LLVM profile data tool and dependencies for Clang coverage processing
+#
+ifeq (true,$(CLANG_COVERAGE))
+ LLVM_PROFDATA := $(LLVM_PREBUILTS_BASE)/linux-x86/$(LLVM_PREBUILTS_VERSION)/bin/llvm-profdata
+ LIBCXX := $(LLVM_PREBUILTS_BASE)/linux-x86/$(LLVM_PREBUILTS_VERSION)/lib64/libc++.so.1
+ PROFDATA_ZIP := $(PRODUCT_OUT)/llvm-profdata.zip
+ $(PROFDATA_ZIP): $(SOONG_ZIP)
+ $(hide) $(SOONG_ZIP) -d -o $@ -C $(LLVM_PREBUILTS_BASE)/linux-x86/$(LLVM_PREBUILTS_VERSION) -f $(LLVM_PROFDATA) -f $(LIBCXX)
+
+ $(call dist-for-goals,droidcore,$(PROFDATA_ZIP))
+endif
+
# -----------------------------------------------------------------
# A zip of the Android Apps. Not keeping full path so that we don't
# include product names when distributing
@@ -4496,13 +4602,8 @@
JACOCO_REPORT_CLASSES_ALL := $(PRODUCT_OUT)/jacoco-report-classes-all.jar
$(JACOCO_REPORT_CLASSES_ALL) :
@echo "Collecting uninstrumented classes"
- $(hide) find $(TARGET_COMMON_OUT_ROOT) $(HOST_COMMON_OUT_ROOT) -name "jacoco-report-classes.jar" | \
- zip -@ -0 -q -X $@
-# Meaning of these options:
-# -@ scan stdin for file paths to add to the zip
-# -0 don't do any compression
-# -q supress most output
-# -X skip storing extended file attributes
+ find $(TARGET_COMMON_OUT_ROOT) $(HOST_COMMON_OUT_ROOT) -name "jacoco-report-classes.jar" 2>/dev/null | sort > $@.list
+ $(SOONG_ZIP) -o $@ -L 0 -C $(OUT_DIR) -P out -l $@.list
endif # EMMA_INSTRUMENT=true
@@ -4512,7 +4613,7 @@
#
PROGUARD_DICT_ZIP := $(PRODUCT_OUT)/$(TARGET_PRODUCT)-proguard-dict-$(FILE_NAME_TAG).zip
# For apps_only build we'll establish the dependency later in build/make/core/main.mk.
-ifndef TARGET_BUILD_APPS
+ifeq (,$(TARGET_BUILD_UNBUNDLED))
$(PROGUARD_DICT_ZIP): \
$(INSTALLED_SYSTEMIMAGE_TARGET) \
$(INSTALLED_RAMDISK_TARGET) \
@@ -4591,6 +4692,8 @@
$(call dump-super-image-info,$(2))
$(foreach p,$(BOARD_SUPER_PARTITION_PARTITION_LIST), \
echo "$(p)_image=$(INSTALLED_$(call to-upper,$(p))IMAGE_TARGET)" >> $(2);)
+ $(if $(BUILDING_SYSTEM_OTHER_IMAGE), $(if $(filter system,$(BOARD_SUPER_PARTITION_PARTITION_LIST)), \
+ echo "system_other_image=$(INSTALLED_SYSTEMOTHERIMAGE_TARGET)" >> $(2);))
mkdir -p $(dir $(1))
PATH=$(dir $(LPMAKE)):$$PATH \
$(BUILD_SUPER_IMAGE) -v $(2) $(1)
@@ -4600,6 +4703,12 @@
INSTALLED_SUPERIMAGE_DEPENDENCIES := $(LPMAKE) $(BUILD_SUPER_IMAGE) \
$(foreach p, $(BOARD_SUPER_PARTITION_PARTITION_LIST), $(INSTALLED_$(call to-upper,$(p))IMAGE_TARGET))
+ifdef BUILDING_SYSTEM_OTHER_IMAGE
+ifneq ($(filter system,$(BOARD_SUPER_PARTITION_PARTITION_LIST)),)
+INSTALLED_SUPERIMAGE_DEPENDENCIES += $(INSTALLED_SYSTEMOTHERIMAGE_TARGET)
+endif
+endif
+
# If BOARD_BUILD_SUPER_IMAGE_BY_DEFAULT is set, super.img is built from images in the
# $(PRODUCT_OUT) directory, and is built to $(PRODUCT_OUT)/super.img. Also, it will
# be built for non-dist builds. This is useful for devices that uses super.img directly, e.g.
@@ -4710,6 +4819,20 @@
vendorimage: $(INSTALLED_QEMU_VENDORIMAGE)
droidcore: $(INSTALLED_QEMU_VENDORIMAGE)
endif
+
+ifdef INSTALLED_RAMDISK_TARGET
+ifdef INSTALLED_VENDOR_BOOTIMAGE_TARGET
+ifdef INTERNAL_VENDOR_RAMDISK_TARGET
+INSTALLED_QEMU_RAMDISKIMAGE := $(PRODUCT_OUT)/ramdisk-qemu.img
+$(INSTALLED_QEMU_RAMDISKIMAGE): $(INTERNAL_VENDOR_RAMDISK_TARGET) $(INSTALLED_RAMDISK_TARGET)
+ @echo Create ramdisk-qemu.img
+ (cat $(INSTALLED_RAMDISK_TARGET) $(INTERNAL_VENDOR_RAMDISK_TARGET) > $(INSTALLED_QEMU_RAMDISKIMAGE))
+
+droidcore: $(INSTALLED_QEMU_RAMDISKIMAGE)
+endif
+endif
+endif
+
ifdef INSTALLED_PRODUCTIMAGE_TARGET
INSTALLED_QEMU_PRODUCTIMAGE := $(PRODUCT_OUT)/product-qemu.img
$(INSTALLED_QEMU_PRODUCTIMAGE): $(INSTALLED_PRODUCTIMAGE_TARGET) $(MK_QEMU_IMAGE_SH) $(SGDISK_HOST) $(SIMG2IMG)
@@ -4811,7 +4934,6 @@
$(ALL_DEFAULT_INSTALLED_MODULES) \
$(INSTALLED_RAMDISK_TARGET) \
$(ALL_DOCS) \
- $(TARGET_OUT_COMMON_INTERMEDIATES)/PACKAGING/api-stubs-docs_annotations.zip \
$(ALL_SDK_FILES)
endif
@@ -4842,11 +4964,13 @@
$(target_notice_file_txt) \
$(tools_notice_file_txt) \
$(OUT_DOCS)/offline-sdk-timestamp \
+ $(SDK_METADATA_FILES) \
$(SYMBOLS_ZIP) \
$(COVERAGE_ZIP) \
$(APPCOMPAT_ZIP) \
$(INSTALLED_SYSTEMIMAGE_TARGET) \
$(INSTALLED_QEMU_SYSTEMIMAGE) \
+ $(INSTALLED_QEMU_RAMDISKIMAGE) \
$(INSTALLED_QEMU_VENDORIMAGE) \
$(QEMU_VERIFIED_BOOT_PARAMS) \
$(INSTALLED_USERDATAIMAGE_TARGET) \
@@ -4957,3 +5081,34 @@
ifneq ($(sdk_repo_goal),)
include $(TOPDIR)development/build/tools/sdk_repo.mk
endif
+
+# -----------------------------------------------------------------
+# Soong generates the list of all shared libraries that are depended on by fuzz
+# targets. It saves this list as a source:destination pair to
+# FUZZ_TARGET_SHARED_DEPS_INSTALL_PAIRS, where the source is the path to the
+# build of the unstripped shared library, and the destination is the
+# /data/fuzz/$ARCH/lib (for device) or /fuzz/$ARCH/lib (for host) directory
+# where fuzz target shared libraries are to be "reinstalled". The
+# copy-many-files below generates the rules to copy the unstripped shared
+# libraries to the device or host "reinstallation" directory. These rules are
+# depended on by each module in soong_cc_prebuilt.mk, where the module will have
+# a dependency on each shared library that it needs to be "reinstalled".
+FUZZ_SHARED_DEPS := $(call copy-many-files,$(strip $(FUZZ_TARGET_SHARED_DEPS_INSTALL_PAIRS)))
+
+# -----------------------------------------------------------------
+# The rule to build all fuzz targets, and package them.
+# Note: The packages are created in Soong, and in a perfect world,
+# we'd be able to create the phony rule there. But, if we want to
+# have dist goals for the fuzz target, we need to have the PHONY
+# target defined in make. MakeVarsContext.DistForGoal doesn't take
+# into account that a PHONY rule create by Soong won't be available
+# during make, and such will fail with `writing to readonly
+# directory`, because kati will see 'haiku' as being a file, not a
+# phony target.
+.PHONY: haiku
+haiku: $(SOONG_FUZZ_PACKAGING_ARCH_MODULES) $(ALL_FUZZ_TARGETS)
+$(call dist-for-goals,haiku,$(SOONG_FUZZ_PACKAGING_ARCH_MODULES))
+
+# -----------------------------------------------------------------
+# The makefile for haiku line coverage.
+include $(BUILD_SYSTEM)/line_coverage.mk
diff --git a/core/android_manifest.mk b/core/android_manifest.mk
index 06bea5e..8fab9c6 100644
--- a/core/android_manifest.mk
+++ b/core/android_manifest.mk
@@ -42,19 +42,21 @@
endif
my_target_sdk_version := $(call module-target-sdk-version)
+my_min_sdk_version := $(call module-min-sdk-version)
ifdef TARGET_BUILD_APPS
ifndef TARGET_BUILD_APPS_USE_PREBUILT_SDK
ifeq ($(my_target_sdk_version),$(PLATFORM_VERSION_CODENAME))
ifdef UNBUNDLED_BUILD_TARGET_SDK_WITH_API_FINGERPRINT
my_target_sdk_version := $(my_target_sdk_version).$$(cat $(API_FINGERPRINT))
+ my_min_sdk_version := $(my_min_sdk_version).$$(cat $(API_FINGERPRINT))
$(fixed_android_manifest): $(API_FINGERPRINT)
endif
endif
endif
endif
-$(fixed_android_manifest): PRIVATE_MIN_SDK_VERSION := $(call module-min-sdk-version)
+$(fixed_android_manifest): PRIVATE_MIN_SDK_VERSION := $(my_min_sdk_version)
$(fixed_android_manifest): PRIVATE_TARGET_SDK_VERSION := $(my_target_sdk_version)
my_exported_sdk_libs_file := $(call local-intermediates-dir,COMMON)/exported-sdk-libs
diff --git a/core/app_prebuilt_internal.mk b/core/app_prebuilt_internal.mk
index 399d173..ab574b3 100644
--- a/core/app_prebuilt_internal.mk
+++ b/core/app_prebuilt_internal.mk
@@ -163,10 +163,26 @@
$(built_module) : $(LOCAL_CERTIFICATE).pk8 $(LOCAL_CERTIFICATE).x509.pem
$(built_module) : PRIVATE_PRIVATE_KEY := $(LOCAL_CERTIFICATE).pk8
$(built_module) : PRIVATE_CERTIFICATE := $(LOCAL_CERTIFICATE).x509.pem
+
+ additional_certificates := $(foreach c,$(LOCAL_ADDITIONAL_CERTIFICATES), $(c).x509.pem $(c).pk8)
+ $(built_module): $(additional_certificates)
+ $(built_module): PRIVATE_ADDITIONAL_CERTIFICATES := $(additional_certificates)
+
+ $(built_module): $(LOCAL_CERTIFICATE_LINEAGE)
+ $(built_module): PRIVATE_CERTIFICATE_LINEAGE := $(LOCAL_CERTIFICATE_LINEAGE)
+endif
+
+ifneq ($(LOCAL_MODULE_STEM),)
+ PACKAGES.$(LOCAL_MODULE).STEM := $(LOCAL_MODULE_STEM)
+else
+ PACKAGES.$(LOCAL_MODULE).STEM := $(LOCAL_MODULE)
endif
include $(BUILD_SYSTEM)/app_certificate_validate.mk
+# Set a actual_partition_tag (calculated in base_rules.mk) for the package.
+PACKAGES.$(LOCAL_MODULE).PARTITION := $(actual_partition_tag)
+
# Disable dex-preopt of prebuilts to save space, if requested.
ifndef LOCAL_DEX_PREOPT
ifeq ($(DONT_DEXPREOPT_PREBUILTS),true)
@@ -215,17 +231,6 @@
$(LOCAL_BUILT_MODULE): PRIVATE_INSTALLED_MODULE := $(LOCAL_INSTALLED_MODULE)
endif
-ifneq ($(BUILD_PLATFORM_ZIP),)
-$(built_module) : .KATI_IMPLICIT_OUTPUTS := $(dir $(LOCAL_BUILT_MODULE))package.dex.apk
-endif
-ifneq ($(LOCAL_CERTIFICATE),PRESIGNED)
-ifdef LOCAL_DEX_PREOPT
-$(built_module) : PRIVATE_STRIP_SCRIPT := $(intermediates)/strip.sh
-$(built_module) : $(intermediates)/strip.sh
-$(built_module) : | $(DEXPREOPT_STRIP_DEPS)
-$(built_module) : .KATI_DEPFILE := $(built_module).d
-endif
-endif
ifeq ($(module_run_appcompat),true)
$(built_module) : $(AAPT2)
endif
@@ -235,23 +240,11 @@
ifeq (true, $(LOCAL_UNCOMPRESS_DEX))
$(uncompress-dexs)
endif # LOCAL_UNCOMPRESS_DEX
-ifdef LOCAL_DEX_PREOPT
-ifneq ($(BUILD_PLATFORM_ZIP),)
- @# Keep a copy of apk with classes.dex unstripped
- $(hide) cp -f $@ $(dir $@)package.dex.apk
-endif # BUILD_PLATFORM_ZIP
-endif # LOCAL_DEX_PREOPT
ifneq ($(LOCAL_CERTIFICATE),PRESIGNED)
- @# Only strip out files if we can re-sign the package.
-# Run appcompat before stripping the classes.dex file.
ifeq ($(module_run_appcompat),true)
$(call appcompat-header, aapt2)
$(run-appcompat)
endif # module_run_appcompat
-ifdef LOCAL_DEX_PREOPT
- mv -f $@ $@.tmp
- $(PRIVATE_STRIP_SCRIPT) $@.tmp $@
-endif # LOCAL_DEX_PREOPT
$(sign-package)
# No need for align-package because sign-package takes care of alignment
else # LOCAL_CERTIFICATE == PRESIGNED
diff --git a/core/aux_config.mk b/core/aux_config.mk
deleted file mode 100644
index 10d2536..0000000
--- a/core/aux_config.mk
+++ /dev/null
@@ -1,187 +0,0 @@
-variant_list := $(filter AUX-%,$(MAKECMDGOALS))
-
-ifdef variant_list
-AUX_OS_VARIANT_LIST := $(patsubst AUX-%,%,$(variant_list))
-else
-AUX_OS_VARIANT_LIST := $(TARGET_AUX_OS_VARIANT_LIST)
-endif
-
-# exclude AUX targets from build
-ifeq ($(AUX_OS_VARIANT_LIST),none)
-AUX_OS_VARIANT_LIST :=
-endif
-
-# temporary workaround to support external toolchain
-ifeq ($(NANOHUB_TOOLCHAIN),)
-AUX_OS_VARIANT_LIST :=
-endif
-
-# setup toolchain paths for various CPU architectures
-# this one will come from android prebuilts eventually
-AUX_TOOLCHAIN_cortexm4 := $(NANOHUB_TOOLCHAIN)
-ifeq ($(wildcard $(AUX_TOOLCHAIN_cortexm4)gcc),)
-AUX_TOOLCHAIN_cortexm4:=
-endif
-
-# there is no MAKE var that defines path to HOST toolchain
-# all the interesting paths are hardcoded in soong, and are not available from here
-# There is no other way but to hardcode them again, as we may need host x86 toolcain for AUX
-ifeq ($(HOST_OS),linux)
-AUX_TOOLCHAIN_x86 := prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.15-4.8/bin/x86_64-linux-
-endif
-
-# setup AUX globals
-AUX_SHLIB_SUFFIX := .so
-AUX_GLOBAL_ARFLAGS := crsPD
-AUX_STATIC_LIB_SUFFIX := .a
-
-# Load ever-lasting "indexed" version of AUX variant environment; it is treated as READ-ONLY from this
-# moment on.
-#
-# $(1) - variant
-# no return value
-define aux-variant-setup-paths
-$(eval AUX_OUT_ROOT_$(1) := $(PRODUCT_OUT)/aux/$(1)) \
-$(eval AUX_COMMON_OUT_ROOT_$(1) := $(AUX_OUT_ROOT_$(1))/common) \
-$(eval AUX_OUT_$(1) := $(AUX_OUT_ROOT_$(1))/$(AUX_OS_$(1))-$(AUX_ARCH_$(1))-$(AUX_CPU_$(1))) \
-$(eval AUX_OUT_INTERMEDIATES_$(1) := $(AUX_OUT_$(1))/obj) \
-$(eval AUX_OUT_COMMON_INTERMEDIATES_$(1) := $(AUX_COMMON_OUT_ROOT_$(1))/obj) \
-$(eval AUX_OUT_HEADERS_$(1) := $(AUX_OUT_INTERMEDIATES_$(1))/include) \
-$(eval AUX_OUT_NOTICE_FILES_$(1) := $(AUX_OUT_INTERMEDIATES_$(1))/NOTICE_FILES) \
-$(eval AUX_OUT_FAKE_$(1) := $(AUX_OUT_$(1))/fake_packages) \
-$(eval AUX_OUT_GEN_$(1) := $(AUX_OUT_$(1))/gen) \
-$(eval AUX_OUT_COMMON_GEN_$(1) := $(AUX_COMMON_OUT_ROOT_$(1))/gen) \
-$(eval AUX_OUT_EXECUTABLES_$(1) := $(AUX_OUT_$(1))/bin) \
-$(eval AUX_OUT_UNSTRIPPED_$(1) := $(AUX_OUT_$(1))/symbols)
-endef
-
-# Copy "indexed" AUX environment for given VARIANT into
-# volatile not-indexed set of variables for simplicity of access.
-# Injection of index support throughout the build system is suboptimal
-# hence volatile environment is constructed
-# Unlike HOST*, TARGET* variables, AUX* variables are NOT read-only, but their
-# indexed versions are.
-#
-# $(1) - variant
-# no return value
-define aux-variant-load-env
-$(eval AUX_OS_VARIANT:=$(1)) \
-$(eval AUX_OS:=$(AUX_OS_$(1))) \
-$(eval AUX_ARCH:=$(AUX_ARCH_$(1))) \
-$(eval AUX_SUBARCH:=$(AUX_SUBARCH_$(1))) \
-$(eval AUX_CPU:=$(AUX_CPU_$(1))) \
-$(eval AUX_OS_PATH:=$(AUX_OS_PATH_$(1))) \
-$(eval AUX_OUT_ROOT := $(AUX_OUT_ROOT_$(1))) \
-$(eval AUX_COMMON_OUT_ROOT := $(AUX_COMMON_OUT_ROOT_$(1))) \
-$(eval AUX_OUT := $(AUX_OUT_$(1))) \
-$(eval AUX_OUT_INTERMEDIATES := $(AUX_OUT_INTERMEDIATES_$(1))) \
-$(eval AUX_OUT_COMMON_INTERMEDIATES := $(AUX_OUT_COMMON_INTERMEDIATES_$(1))) \
-$(eval AUX_OUT_HEADERS := $(AUX_OUT_HEADERS_$(1))) \
-$(eval AUX_OUT_NOTICE_FILES := $(AUX_OUT_NOTICE_FILES_$(1))) \
-$(eval AUX_OUT_FAKE := $(AUX_OUT_FAKE_$(1))) \
-$(eval AUX_OUT_GEN := $(AUX_OUT_GEN_$(1))) \
-$(eval AUX_OUT_COMMON_GEN := $(AUX_OUT_COMMON_GEN_$(1))) \
-$(eval AUX_OUT_EXECUTABLES := $(AUX_OUT_EXECUTABLES_$(1))) \
-$(eval AUX_OUT_UNSTRIPPED := $(AUX_OUT_UNSTRIPPED_$(1)))
-endef
-
-# given a variant:path pair, load the variant conviguration with aux-variant-setup-paths from file
-# this is a build system extension mechainsm, since configuration typically resides in non-build
-# project space
-#
-# $(1) - variant:path pair
-# $(2) - file suffix
-# no return value
-define aux-variant-import-from-pair
-$(eval _pair := $(subst :, ,$(1))) \
-$(eval _name:=$(word 1,$(_pair))) \
-$(eval _path:=$(word 2,$(_pair))) \
-$(eval include $(_path)/$(_name)$(2)) \
-$(eval AUX_OS_VARIANT_LIST_$(AUX_OS_$(1)):=) \
-$(call aux-variant-setup-paths,$(_name)) \
-$(eval AUX_ALL_VARIANTS += $(_name)) \
-$(eval AUX_ALL_OSES := $(filter-out $(AUX_OS_$(_name)),$(AUX_ALL_OSES)) $(AUX_OS_$(_name))) \
-$(eval AUX_ALL_CPUS := $(filter-out $(AUX_CPU_$(_name)),$(AUX_ALL_CPUS)) $(AUX_CPU_$(_name))) \
-$(eval AUX_ALL_ARCHS := $(filter-out $(AUX_ARCH_$(_name)),$(AUX_ALL_ARCHS)) $(AUX_ARCH_$(_name))) \
-$(eval AUX_ALL_SUBARCHS := $(filter-out $(AUX_SUBARCH_$(_name)),$(AUX_ALL_SUBARCHS)) $(AUX_SUBARCH_$(_name)))
-endef
-
-# Load system configuration referenced by AUX variant config;
-# this is a build extension mechanism; typically system config
-# resides in a non-build projects;
-# system config may define new rules and globally visible BUILD*
-# includes to support project-specific build steps and toolchains
-# MAintains list of valiants that reference this os config in OS "indexed" var
-# this facilitates multivariant build of the OS (or whataver it is the name of common component these variants share)
-#
-# $(1) - variant
-# no return value
-define aux-import-os-config
-$(eval _aioc_os := $(AUX_OS_$(1))) \
-$(eval AUX_OS_PATH_$(1) := $(patsubst $(_aioc_os):%,%,$(filter $(_aioc_os):%,$(AUX_ALL_OS_PATHS)))) \
-$(eval _aioc_os_cfg := $(AUX_OS_PATH_$(1))/$(_aioc_os)$(os_sfx)) \
-$(if $(wildcard $(_aioc_os_cfg)),,$(error AUX '$(_aioc_os)' OS config file [$(notdir $(_aioc_os_cfg))] required by AUX variant '$(1)' does not exist)) \
-$(if $(filter $(_aioc_os),$(_os_list)),,$(eval include $(_aioc_os_cfg))) \
-$(eval AUX_OS_VARIANT_LIST_$(_aioc_os) += $(1)) \
-$(eval _os_list += $(_aioc_os))
-endef
-
-# make sure that AUX config variables are minimally sane;
-# as a bare minimum they must contain the vars described by aux_env
-# Generate error if requirement is not met.
-#
-#$(1) - variant
-# no return value
-define aux-variant-validate
-$(eval _all:=) \
-$(eval _req:=$(addsuffix _$(1),$(aux_env))) \
-$(foreach var,$(_req),$(eval _all += $(var))) \
-$(eval _missing := $(filter-out $(_all),$(_req))) \
-$(if $(_missing),$(error AUX variant $(1) must define vars: $(_missing)))
-endef
-
-AUX_ALL_VARIANTS :=
-AUX_ALL_OSES :=
-AUX_ALL_CPUS :=
-AUX_ALL_ARCHS :=
-AUX_ALL_SUBARCHS :=
-
-variant_sfx :=_aux_variant_config.mk
-os_sfx :=_aux_os_config.mk
-
-ifdef AUX_OS_VARIANT_LIST
-
-config_roots := $(wildcard device vendor)
-all_configs :=
-ifdef config_roots
-all_configs := $(sort $(shell find $(config_roots) -maxdepth 4 -name '*$(variant_sfx)' -o -name '*$(os_sfx)'))
-endif
-all_os_configs := $(filter %$(os_sfx),$(all_configs))
-all_variant_configs := $(filter %$(variant_sfx),$(all_configs))
-
-AUX_ALL_OS_PATHS := $(foreach f,$(all_os_configs),$(patsubst %$(os_sfx),%,$(notdir $(f))):$(patsubst %/,%,$(dir $(f))))
-AUX_ALL_OS_VARIANT_PATHS := $(foreach f,$(all_variant_configs),$(patsubst %$(variant_sfx),%,$(notdir $(f))):$(patsubst %/,%,$(dir $(f))))
-
-my_variant_pairs := $(foreach v,$(AUX_OS_VARIANT_LIST),$(filter $(v):%,$(AUX_ALL_OS_VARIANT_PATHS)))
-my_missing_variants := $(foreach v,$(AUX_OS_VARIANT_LIST),$(if $(filter $(v):%,$(AUX_ALL_OS_VARIANT_PATHS)),,$(v)))
-
-ifneq ($(strip $(my_missing_variants)),)
-$(error Don't know how to build variant(s): $(my_missing_variants))
-endif
-
-# mandatory variables
-aux_env := AUX_OS AUX_ARCH AUX_SUBARCH AUX_CPU
-
-$(foreach v,$(my_variant_pairs),$(if $(filter $(v),$(AUX_ALL_VARIANTS)),,$(call aux-variant-import-from-pair,$(v),$(variant_sfx))))
-
-ifdef AUX_ALL_VARIANTS
-_os_list :=
-$(foreach v,$(AUX_ALL_VARIANTS),\
- $(call aux-import-os-config,$(v)) \
- $(call aux-variant-validate,$(v)) \
-)
-endif
-
-endif # AUX_OS_VARIANT_LIST
-
-INSTALLED_AUX_TARGETS :=
diff --git a/core/aux_executable.mk b/core/aux_executable.mk
deleted file mode 100644
index 5395e61..0000000
--- a/core/aux_executable.mk
+++ /dev/null
@@ -1,95 +0,0 @@
-# caller might have included aux_toolchain, e.g. if custom build steps are defined
-ifeq ($(LOCAL_IS_AUX_MODULE),)
-include $(BUILD_SYSTEM)/aux_toolchain.mk
-endif
-
-ifeq ($(AUX_BUILD_NOT_COMPATIBLE),)
-
-###########################################################
-## Standard rules for building an executable file.
-##
-## Additional inputs from base_rules.make:
-## None.
-###########################################################
-
-ifeq ($(strip $(LOCAL_MODULE_CLASS)),)
-LOCAL_MODULE_CLASS := EXECUTABLES
-endif
-
-$(call $(aux-executable-hook))
-
-###########################################################
-## Standard rules for building any target-side binaries
-## with dynamic linkage (dynamic libraries or executables
-## that link with dynamic libraries)
-##
-## Files including this file must define a rule to build
-## the target $(linked_module).
-###########################################################
-
-# The name of the target file, without any path prepended.
-# This duplicates logic from base_rules.mk because we need to
-# know its results before base_rules.mk is included.
-include $(BUILD_SYSTEM)/configure_module_stem.mk
-
-intermediates := $(call local-intermediates-dir)
-
-# Define the target that is the unmodified output of the linker.
-# The basename of this target must be the same as the final output
-# binary name, because it's used to set the "soname" in the binary.
-# The includer of this file will define a rule to build this target.
-linked_module := $(intermediates)/LINKED/$(my_built_module_stem)
-
-ALL_ORIGINAL_DYNAMIC_BINARIES += $(linked_module)
-
-# Because AUX_SYMBOL_FILTER_FILE depends on ALL_ORIGINAL_DYNAMIC_BINARIES,
-# the linked_module rules won't necessarily inherit the PRIVATE_
-# variables from LOCAL_BUILT_MODULE. This tells binary.make to explicitly
-# define the PRIVATE_ variables for linked_module as well as for
-# LOCAL_BUILT_MODULE.
-LOCAL_INTERMEDIATE_TARGETS += $(linked_module)
-
-###################################
-include $(BUILD_SYSTEM)/binary.mk
-###################################
-
-aux_output := $(linked_module)
-
-ifneq ($(LOCAL_CUSTOM_BUILD_STEP_INPUT),)
-ifneq ($(LOCAL_CUSTOM_BUILD_STEP_OUTPUT),)
-
-# injecting custom build steps
-$(LOCAL_CUSTOM_BUILD_STEP_INPUT): $(aux_output)
- @echo "$(AUX_DISPLAY) custom copy: $(PRIVATE_MODULE) ($@)"
- @mkdir -p $(dir $@)
- $(hide) $(copy-file-to-target)
-
-aux_output := $(LOCAL_CUSTOM_BUILD_STEP_OUTPUT)
-
-endif
-endif
-
-$(LOCAL_BUILT_MODULE): $(aux_output)
- @echo "$(AUX_DISPLAY) final copy: $(PRIVATE_MODULE) ($@)"
- @mkdir -p $(dir $@)
- $(hide) $(copy-file-to-target)
-
-INSTALLED_AUX_TARGETS += $(LOCAL_INSTALLED_MODULE)
-
-$(cleantarget): PRIVATE_CLEAN_FILES += \
- $(linked_module) \
-
-# Define PRIVATE_ variables from global vars
-$(linked_module): PRIVATE_POST_LINK_CMD := $(LOCAL_POST_LINK_CMD)
-
-ifeq ($(LOCAL_FORCE_STATIC_EXECUTABLE),true)
-$(linked_module): $(all_objects) $(all_libraries) $(LOCAL_ADDITIONAL_DEPENDENCIES)
- $(transform-o-to-aux-static-executable)
- $(PRIVATE_POST_LINK_CMD)
-else
-$(linked_module): $(all_objects) $(all_libraries) $(LOCAL_ADDITIONAL_DEPENDENCIES)
- $(transform-o-to-aux-executable)
- $(PRIVATE_POST_LINK_CMD)
-endif
-
-endif # AUX_BUILD_NOT_COMPATIBLE
diff --git a/core/aux_static_library.mk b/core/aux_static_library.mk
deleted file mode 100644
index d88478d..0000000
--- a/core/aux_static_library.mk
+++ /dev/null
@@ -1,27 +0,0 @@
-ifeq ($(LOCAL_IS_AUX_MODULE),)
-include $(BUILD_SYSTEM)/aux_toolchain.mk
-endif
-
-ifeq ($(AUX_BUILD_NOT_COMPATIBLE),)
-
-ifeq ($(strip $(LOCAL_MODULE_CLASS)),)
-LOCAL_MODULE_CLASS := STATIC_LIBRARIES
-endif
-ifeq ($(strip $(LOCAL_MODULE_SUFFIX)),)
-LOCAL_MODULE_SUFFIX := .a
-endif
-
-LOCAL_UNINSTALLABLE_MODULE := true
-
-ifneq ($(strip $(LOCAL_MODULE_STEM)$(LOCAL_BUILT_MODULE_STEM)),)
-$(error $(LOCAL_PATH): Cannot set module stem for a library)
-endif
-
-include $(BUILD_SYSTEM)/binary.mk
-
-$(LOCAL_BUILT_MODULE) : PRIVATE_AR := $(AUX_AR)
-$(LOCAL_BUILT_MODULE) : $(built_whole_libraries)
-$(LOCAL_BUILT_MODULE) : $(all_objects)
- $(transform-o-to-aux-static-lib)
-
-endif # AUX_BUILD_NOT_COMPATIBLE
diff --git a/core/aux_toolchain.mk b/core/aux_toolchain.mk
deleted file mode 100644
index c710228..0000000
--- a/core/aux_toolchain.mk
+++ /dev/null
@@ -1,52 +0,0 @@
-###########################################################
-# takes form LOCAL_AUX_TOOLCHAIN_$(LOCAL_AUX_CPU)
-###########################################################
-
-###############################
-# setup AUX environment
-###############################
-
-# shortcuts for targets with a single instance of OS, ARCH, VARIANT, CPU
-AUX_TOOLCHAIN := $(if $(LOCAL_AUX_TOOLCHAIN),$(LOCAL_AUX_TOOLCHAIN),$(AUX_TOOLCHAIN_$(AUX_CPU)))
-AUX_BUILD_NOT_COMPATIBLE:=
-ifeq ($(strip $(AUX_TOOLCHAIN)),)
- ifeq ($(strip $(AUX_CPU)),)
- $(warning $(LOCAL_PATH): $(LOCAL_MODULE): Undefined CPU for AUX toolchain)
- AUX_BUILD_NOT_COMPATIBLE += TOOLCHAIN
- else
- $(warning $(LOCAL_PATH): $(LOCAL_MODULE): Undefined AUX toolchain for CPU=$(AUX_CPU))
- AUX_BUILD_NOT_COMPATIBLE += TOOLCHAIN
- endif
-endif
-
-AUX_BUILD_NOT_COMPATIBLE += $(foreach var,OS ARCH SUBARCH CPU OS_VARIANT,$(if $(LOCAL_AUX_$(var)),$(if \
- $(filter $(LOCAL_AUX_$(var)),$(AUX_$(var))),,$(var))))
-
-AUX_BUILD_NOT_COMPATIBLE := $(strip $(AUX_BUILD_NOT_COMPATIBLE))
-
-ifneq ($(AUX_BUILD_NOT_COMPATIBLE),)
-$(info $(LOCAL_PATH): $(LOCAL_MODULE): not compatible: "$(AUX_BUILD_NOT_COMPATIBLE)" with)
-$(info ====> OS=$(AUX_OS) CPU=$(AUX_CPU) ARCH=$(AUX_ARCH) SUBARCH=$(AUX_SUBARCH) OS_VARIANT=$(AUX_OS_VARIANT))
-$(info ====> TOOLCHAIN=$(AUX_TOOLCHAIN))
-endif
-
-AUX_AR := $(AUX_TOOLCHAIN)ar
-AUX_AS := $(AUX_TOOLCHAIN)gcc
-AUX_CC := $(AUX_TOOLCHAIN)gcc
-AUX_CXX := $(AUX_TOOLCHAIN)g++
-AUX_LINKER := $(AUX_TOOLCHAIN)ld
-AUX_OBJCOPY := $(AUX_TOOLCHAIN)objcopy
-AUX_OBJDUMP := $(AUX_TOOLCHAIN)objdump
-
-###############################
-# setup Android environment
-###############################
-
-LOCAL_IS_AUX_MODULE := true
-LOCAL_2ND_ARCH_VAR_PREFIX :=
-LOCAL_CC := $(AUX_CC)
-LOCAL_CXX := $(AUX_CXX)
-LOCAL_NO_DEFAULT_COMPILER_FLAGS := true
-LOCAL_SYSTEM_SHARED_LIBRARIES :=
-LOCAL_CXX_STL := none
-LOCAL_NO_PIC := true
diff --git a/core/base_rules.mk b/core/base_rules.mk
index 32c5807..9818d60 100644
--- a/core/base_rules.mk
+++ b/core/base_rules.mk
@@ -34,7 +34,6 @@
$(call verify-module-name)
LOCAL_IS_HOST_MODULE := $(strip $(LOCAL_IS_HOST_MODULE))
-LOCAL_IS_AUX_MODULE := $(strip $(LOCAL_IS_AUX_MODULE))
ifdef LOCAL_IS_HOST_MODULE
ifneq ($(LOCAL_IS_HOST_MODULE),true)
$(error $(LOCAL_PATH): LOCAL_IS_HOST_MODULE must be "true" or empty, not "$(LOCAL_IS_HOST_MODULE)")
@@ -47,16 +46,8 @@
my_host := host-
my_kind := HOST
else
- ifdef LOCAL_IS_AUX_MODULE
- ifneq ($(LOCAL_IS_AUX_MODULE),true)
- $(error $(LOCAL_PATH): LOCAL_IS_AUX_MODULE must be "true" or empty, not "$(LOCAL_IS_AUX_MODULE)")
- endif
- my_prefix := AUX_
- my_kind := AUX
- else
- my_prefix := TARGET_
- my_kind :=
- endif
+ my_prefix := TARGET_
+ my_kind :=
my_host :=
endif
@@ -183,11 +174,10 @@
# file, tag the module as "gnu". Search for "*_GPL*", "*_LGPL*" and "*_MPL*"
# so that we can also find files like MODULE_LICENSE_GPL_AND_AFL
#
-license_files := $(call find-parent-file,$(LOCAL_PATH),MODULE_LICENSE*)
gpl_license_file := $(call find-parent-file,$(LOCAL_PATH),MODULE_LICENSE*_GPL* MODULE_LICENSE*_MPL* MODULE_LICENSE*_LGPL*)
ifneq ($(gpl_license_file),)
my_module_tags += gnu
- ALL_GPL_MODULE_LICENSE_FILES := $(sort $(ALL_GPL_MODULE_LICENSE_FILES) $(gpl_license_file))
+ ALL_GPL_MODULE_LICENSE_FILES += $(gpl_license_file)
endif
LOCAL_MODULE_CLASS := $(strip $(LOCAL_MODULE_CLASS))
@@ -206,25 +196,42 @@
endif
my_module_path := $(patsubst %/,%,$(my_module_path))
my_module_relative_path := $(strip $(LOCAL_MODULE_RELATIVE_PATH))
+
ifdef LOCAL_IS_HOST_MODULE
partition_tag :=
+ actual_partition_tag :=
else
ifeq (true,$(strip $(LOCAL_VENDOR_MODULE)))
partition_tag := _VENDOR
+ # A vendor module could be on the vendor partition at "vendor" or the system
+ # partition at "system/vendor".
+ actual_partition_tag := $(if $(filter true,$(BOARD_USES_VENDORIMAGE)),vendor,system)
else ifeq (true,$(strip $(LOCAL_OEM_MODULE)))
partition_tag := _OEM
+ actual_partition_tag := oem
else ifeq (true,$(strip $(LOCAL_ODM_MODULE)))
partition_tag := _ODM
+ # An ODM module could be on the odm partition at "odm", the vendor partition
+ # at "vendor/odm", or the system partition at "system/vendor/odm".
+ actual_partition_tag := $(if $(filter true,$(BOARD_USES_ODMIMAGE)),odm,$(if $(filter true,$(BOARD_USES_VENDORIMAGE)),vendor,system))
else ifeq (true,$(strip $(LOCAL_PRODUCT_MODULE)))
partition_tag := _PRODUCT
+ # A product module could be on the product partition at "product" or the
+ # system partition at "system/product".
+ actual_partition_tag := $(if $(filter true,$(BOARD_USES_PRODUCTIMAGE)),product,system)
else ifeq (true,$(strip $(LOCAL_SYSTEM_EXT_MODULE)))
partition_tag := _SYSTEM_EXT
+ # A system_ext-specific module could be on the system_ext partition at
+ # "system_ext" or the system partition at "system/system_ext".
+ actual_partition_tag := $(if $(filter true,$(BOARD_USES_SYSTEM_EXTIMAGE)),system_ext,system)
else ifeq (NATIVE_TESTS,$(LOCAL_MODULE_CLASS))
partition_tag := _DATA
+ actual_partition_tag := data
else
# The definition of should-install-to-system will be different depending
# on which goal (e.g., sdk or just droid) is being built.
partition_tag := $(if $(call should-install-to-system,$(my_module_tags)),,_DATA)
+ actual_partition_tag := $(if $(partition_tag),data,system)
endif
endif
# For test modules that lack a suite tag, set null-suite as the default.
@@ -300,20 +307,27 @@
my_all_targets := device_$(my_register_name)_all_targets
endif
-# variant is enough to make nano class unique; it serves as a key to lookup (OS,ARCH) tuple
-aux_class := $($(my_prefix)OS_VARIANT)
# Make sure that this IS_HOST/CLASS/MODULE combination is unique.
module_id := MODULE.$(if \
- $(LOCAL_IS_HOST_MODULE),$($(my_prefix)OS),$(if \
- $(LOCAL_IS_AUX_MODULE),$(aux_class),TARGET)).$(LOCAL_MODULE_CLASS).$(my_register_name)
+ $(LOCAL_IS_HOST_MODULE),$($(my_prefix)OS),TARGET).$(LOCAL_MODULE_CLASS).$(my_register_name)
ifdef $(module_id)
$(error $(LOCAL_PATH): $(module_id) already defined by $($(module_id)))
endif
$(module_id) := $(LOCAL_PATH)
-intermediates := $(call local-intermediates-dir,,$(LOCAL_2ND_ARCH_VAR_PREFIX),$(my_host_cross))
-intermediates.COMMON := $(call local-intermediates-dir,COMMON)
-generated_sources_dir := $(call local-generated-sources-dir)
+# These are the same as local-intermediates-dir / local-generated-sources dir, but faster
+intermediates.COMMON := $($(my_prefix)OUT_COMMON_INTERMEDIATES)/$(LOCAL_MODULE_CLASS)/$(LOCAL_MODULE)_intermediates
+ifneq (,$(filter $(my_prefix)$(LOCAL_MODULE_CLASS),$(COMMON_MODULE_CLASSES)))
+ intermediates := $($(my_prefix)OUT_COMMON_INTERMEDIATES)/$(LOCAL_MODULE_CLASS)/$(LOCAL_MODULE)_intermediates
+ generated_sources_dir := $($(my_prefix)OUT_COMMON_GEN)/$(LOCAL_MODULE_CLASS)/$(LOCAL_MODULE)_intermediates
+else
+ ifneq (,$(filter $(LOCAL_MODULE_CLASS),$(PER_ARCH_MODULE_CLASSES)))
+ intermediates := $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)OUT_INTERMEDIATES)/$(LOCAL_MODULE_CLASS)/$(LOCAL_MODULE)_intermediates
+ else
+ intermediates := $($(my_prefix)OUT_INTERMEDIATES)/$(LOCAL_MODULE_CLASS)/$(LOCAL_MODULE)_intermediates
+ endif
+ generated_sources_dir := $($(my_prefix)OUT_GEN)/$(LOCAL_MODULE_CLASS)/$(LOCAL_MODULE)_intermediates
+endif
ifneq ($(LOCAL_OVERRIDES_MODULES),)
ifndef LOCAL_IS_HOST_MODULE
@@ -321,6 +335,8 @@
EXECUTABLES.$(LOCAL_MODULE).OVERRIDES := $(strip $(LOCAL_OVERRIDES_MODULES))
else ifeq ($(LOCAL_MODULE_CLASS),SHARED_LIBRARIES)
SHARED_LIBRARIES.$(LOCAL_MODULE).OVERRIDES := $(strip $(LOCAL_OVERRIDES_MODULES))
+ else ifeq ($(LOCAL_MODULE_CLASS),ETC)
+ ETC.$(LOCAL_MODULE).OVERRIDES := $(strip $(LOCAL_OVERRIDES_MODULES))
else
$(call pretty-error,LOCAL_MODULE_CLASS := $(LOCAL_MODULE_CLASS) cannot use LOCAL_OVERRIDES_MODULES)
endif
@@ -339,16 +355,16 @@
ifneq (true,$(LOCAL_UNINSTALLABLE_MODULE))
# Apk and its attachments reside in its own subdir.
ifeq ($(LOCAL_MODULE_CLASS),APPS)
- # framework-res.apk doesn't like the additional layer.
- ifeq ($(LOCAL_NO_STANDARD_LIBRARIES),true)
- # Neither do Runtime Resource Overlay apks, which contain just the overlaid resources.
- else ifeq ($(LOCAL_IS_RUNTIME_RESOURCE_OVERLAY),true)
- else
- ifneq ($(use_testcase_folder),true)
- my_module_path := $(my_module_path)/$(LOCAL_MODULE)
+ # framework-res.apk doesn't like the additional layer.
+ ifeq ($(LOCAL_NO_STANDARD_LIBRARIES),true)
+ # Neither do Runtime Resource Overlay apks, which contain just the overlaid resources.
+ else ifeq ($(LOCAL_IS_RUNTIME_RESOURCE_OVERLAY),true)
+ else
+ ifneq ($(use_testcase_folder),true)
+ my_module_path := $(my_module_path)/$(LOCAL_MODULE)
+ endif
endif
endif
- endif
LOCAL_INSTALLED_MODULE := $(my_module_path)/$(my_installed_module_stem)
endif
@@ -410,7 +426,6 @@
###########################################################
$(LOCAL_INTERMEDIATE_TARGETS) : PRIVATE_PATH:=$(LOCAL_PATH)
$(LOCAL_INTERMEDIATE_TARGETS) : PRIVATE_IS_HOST_MODULE := $(LOCAL_IS_HOST_MODULE)
-$(LOCAL_INTERMEDIATE_TARGETS) : PRIVATE_IS_AUX_MODULE := $(LOCAL_IS_AUX_MODULE)
$(LOCAL_INTERMEDIATE_TARGETS) : PRIVATE_HOST:= $(my_host)
$(LOCAL_INTERMEDIATE_TARGETS) : PRIVATE_PREFIX := $(my_prefix)
@@ -556,17 +571,35 @@
ifneq ($(strip $(LOCAL_TEST_DATA)),)
ifneq (true,$(LOCAL_UNINSTALLABLE_MODULE))
-my_test_data_pairs := $(strip $(foreach td,$(LOCAL_TEST_DATA), \
- $(eval _file := $(call word-colon,2,$(td))) \
- $(if $(_file), \
- $(eval _src_base := $(call word-colon,1,$(td))), \
- $(eval _src_base := $(LOCAL_PATH)) \
- $(eval _file := $(call word-colon,1,$(td)))) \
- $(if $(call streq,$(LOCAL_MODULE_MAKEFILE),$(SOONG_ANDROID_MK)),, \
- $(if $(findstring ..,$(_file)),$(error $(LOCAL_MODULE_MAKEFILE): LOCAL_TEST_DATA may not include '..': $(_file))) \
- $(if $(filter /%,$(_src_base) $(_file)),$(error $(LOCAL_MODULE_MAKEFILE): LOCAL_TEST_DATA may not include absolute paths: $(_src_base) $(_file)))) \
- $(eval my_test_data_file_pairs := $(my_test_data_file_pairs) $(call append-path,$(_src_base),$(_file)):$(_file)) \
- $(call append-path,$(_src_base),$(_file)):$(call append-path,$(my_module_path),$(_file))))
+ifeq ($(LOCAL_MODULE_MAKEFILE),$(SOONG_ANDROID_MK))
+ define copy_test_data_pairs
+ _src_base := $$(call word-colon,1,$$(td))
+ _file := $$(call word-colon,2,$$(td))
+ my_test_data_pairs += $$(call append-path,$$(_src_base),$$(_file)):$$(call append-path,$$(my_module_path),$$(_file))
+ my_test_data_file_pairs += $$(call append-path,$$(_src_base),$$(_file)):$$(_file)
+ endef
+else
+ define copy_test_data_pairs
+ _src_base := $$(call word-colon,1,$$(td))
+ _file := $$(call word-colon,2,$$(td))
+ ifndef _file
+ _file := $$(_src_base)
+ _src_base := $$(LOCAL_PATH)
+ endif
+ ifneq (,$$(findstring ..,$$(_file)))
+ $$(call pretty-error,LOCAL_TEST_DATA may not include '..': $$(_file))
+ endif
+ ifneq (,$$(filter/%,$$(_src_base) $$(_file)))
+ $$(call pretty-error,LOCAL_TEST_DATA may not include absolute paths: $$(_src_base) $$(_file))
+ endif
+ my_test_data_pairs += $$(call append-path,$$(_src_base),$$(_file)):$$(call append-path,$$(my_module_path),$$(_file))
+ my_test_data_file_pairs += $$(call append-path,$$(_src_base),$$(_file)):$$(_file)
+ endef
+endif
+
+$(foreach td,$(LOCAL_TEST_DATA),$(eval $(copy_test_data_pairs)))
+
+copy_test_data_pairs :=
my_installed_test_data := $(call copy-many-files,$(my_test_data_pairs))
$(LOCAL_INSTALLED_MODULE): $(my_installed_test_data)
@@ -579,6 +612,7 @@
## Compatibility suite files.
###########################################################
ifdef LOCAL_COMPATIBILITY_SUITE
+ifneq (true,$(LOCAL_UNINSTALLABLE_MODULE))
# If we are building a native test or benchmark and its stem variants are not defined,
# separate the multiple architectures into subdirectories of the testcase folder.
@@ -703,13 +737,19 @@
ifeq ($(use_testcase_folder),true)
ifneq ($(my_test_data_file_pairs),)
+# Filter out existng installed test data paths when collecting test data files to be installed and
+# indexed as they cause build rule conflicts. Instead put them in a separate list which is only
+# used for indexing.
$(foreach pair, $(my_test_data_file_pairs), \
$(eval parts := $(subst :,$(space),$(pair))) \
$(eval src_path := $(word 1,$(parts))) \
$(eval file := $(word 2,$(parts))) \
$(foreach suite, $(LOCAL_COMPATIBILITY_SUITE), \
$(eval my_compat_dist_$(suite) += $(foreach dir, $(call compatibility_suite_dirs,$(suite),$(arch_dir)), \
- $(call filter-copy-pair,$(src_path),$(call append-path,$(dir),$(file)),$(my_installed_test_data))))))
+ $(call filter-copy-pair,$(src_path),$(call append-path,$(dir),$(file)),$(my_installed_test_data)))) \
+ $(eval my_compat_dist_test_data_$(suite) += \
+ $(foreach dir, $(call compatibility_suite_dirs,$(suite),$(arch_dir)), \
+ $(filter $(my_installed_test_data),$(call append-path,$(dir),$(file)))))))
endif
else
ifneq ($(my_test_data_file_pairs),)
@@ -730,8 +770,10 @@
$(call create-suite-dependencies)
$(foreach suite, $(LOCAL_COMPATIBILITY_SUITE), \
- $(eval my_compat_dist_config_$(suite) := ))
+ $(eval my_compat_dist_config_$(suite) := ) \
+ $(eval my_compat_dist_test_data_$(suite) := ))
+endif # LOCAL_UNINSTALLABLE_MODULE
endif # LOCAL_COMPATIBILITY_SUITE
###########################################################
@@ -791,6 +833,16 @@
ALL_MODULES.$(my_register_name).PICKUP_FILES := \
$(ALL_MODULES.$(my_register_name).PICKUP_FILES) $(LOCAL_PICKUP_FILES)
endif
+# Record the platform availability of this module. Note that the availability is not
+# meaningful for non-installable modules (e.g., static libs) or host modules.
+# We only care about modules that are installable to the device.
+ifeq (true,$(LOCAL_NOT_AVAILABLE_FOR_PLATFORM))
+ ifneq (true,$(LOCAL_UNINSTALLABLE_MODULE))
+ ifndef LOCAL_IS_HOST_MODULE
+ ALL_MODULES.$(my_register_name).NOT_AVAILABLE_FOR_PLATFORM := true
+ endif
+ endif
+endif
my_required_modules := $(LOCAL_REQUIRED_MODULES) \
$(LOCAL_REQUIRED_MODULES_$(TARGET_$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH))
@@ -798,22 +850,28 @@
my_required_modules += $(LOCAL_REQUIRED_MODULES_$($(my_prefix)OS))
endif
-###############################################################################
-## When compiling against the VNDK, add the .vendor suffix to required modules.
-###############################################################################
+##########################################################################
+## When compiling against the VNDK, add the .vendor or .product suffix to
+## required modules.
+##########################################################################
ifneq ($(LOCAL_USE_VNDK),)
- ####################################################
- ## Soong modules may be built twice, once for /system
- ## and once for /vendor. If we're using the VNDK,
- ## switch all soong libraries over to the /vendor
- ## variant.
- ####################################################
+ #####################################################
+ ## Soong modules may be built three times, once for
+ ## /system, once for /vendor and once for /product.
+ ## If we're using the VNDK, switch all soong
+ ## libraries over to the /vendor or /product variant.
+ #####################################################
ifneq ($(LOCAL_MODULE_MAKEFILE),$(SOONG_ANDROID_MK))
# We don't do this renaming for soong-defined modules since they already
- # have correct names (with .vendor suffix when necessary) in their
- # LOCAL_*_LIBRARIES.
- my_required_modules := $(foreach l,$(my_required_modules),\
- $(if $(SPLIT_VENDOR.SHARED_LIBRARIES.$(l)),$(l).vendor,$(l)))
+ # have correct names (with .vendor or .product suffix when necessary) in
+ # their LOCAL_*_LIBRARIES.
+ ifeq ($(LOCAL_USE_VNDK_PRODUCT),true)
+ my_required_modules := $(foreach l,$(my_required_modules),\
+ $(if $(SPLIT_PRODUCT.SHARED_LIBRARIES.$(l)),$(l).product,$(l)))
+ else
+ my_required_modules := $(foreach l,$(my_required_modules),\
+ $(if $(SPLIT_VENDOR.SHARED_LIBRARIES.$(l)),$(l).vendor,$(l)))
+ endif
endif
endif
@@ -875,8 +933,8 @@
##########################################################
# Track module-level dependencies.
# Use $(LOCAL_MODULE) instead of $(my_register_name) to ignore module's bitness.
-ifneq (,$(filter deps-license,$(MAKECMDGOALS)))
-ALL_DEPS.MODULES := $(ALL_DEPS.MODULES) $(LOCAL_MODULE)
+ifdef RECORD_ALL_DEPS
+ALL_DEPS.MODULES += $(LOCAL_MODULE)
ALL_DEPS.$(LOCAL_MODULE).ALL_DEPS := $(sort \
$(ALL_DEPS.$(LOCAL_MODULE).ALL_DEPS) \
$(LOCAL_STATIC_LIBRARIES) \
@@ -890,6 +948,7 @@
$(LOCAL_JAVA_LIBRARIES) \
$(LOCAL_JNI_SHARED_LIBRARIES))
+license_files := $(call find-parent-file,$(LOCAL_PATH),MODULE_LICENSE*)
ALL_DEPS.$(LOCAL_MODULE).LICENSE := $(sort $(ALL_DEPS.$(LOCAL_MODULE).LICENSE) $(license_files))
endif
diff --git a/core/binary.mk b/core/binary.mk
index d9763f9..4894bf2 100644
--- a/core/binary.mk
+++ b/core/binary.mk
@@ -64,6 +64,13 @@
my_export_c_include_deps := $(LOCAL_EXPORT_C_INCLUDE_DEPS)
my_arflags :=
+# Configure the pool to use for clang rules.
+# If LOCAL_CC or LOCAL_CXX is set don't use goma or RBE.
+my_pool :=
+ifeq (,$(strip $(my_cc))$(strip $(my_cxx)))
+ my_pool := $(GOMA_OR_RBE_POOL)
+endif
+
ifneq (,$(strip $(foreach dir,$(COVERAGE_PATHS),$(filter $(dir)%,$(LOCAL_PATH)))))
ifeq (,$(strip $(foreach dir,$(COVERAGE_EXCLUDE_PATHS),$(filter $(dir)%,$(LOCAL_PATH)))))
my_native_coverage := true
@@ -77,30 +84,10 @@
my_native_coverage := false
endif
-ifneq ($(strip $(ENABLE_XOM)),false)
- ifndef LOCAL_IS_HOST_MODULE
- my_xom := true
- # Disable XOM in excluded paths.
- combined_xom_exclude_paths := $(XOM_EXCLUDE_PATHS) \
- $(PRODUCT_XOM_EXCLUDE_PATHS)
- ifneq ($(strip $(foreach dir,$(subst $(comma),$(space),$(combined_xom_exclude_paths)),\
- $(filter $(dir)%,$(LOCAL_PATH)))),)
- my_xom := false
- endif
-
- # Allow LOCAL_XOM to override the above
- ifdef LOCAL_XOM
- my_xom := $(LOCAL_XOM)
- endif
-
- ifeq ($(strip $(my_xom)),true)
- ifeq (arm64,$(TARGET_$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH))
- ifeq ($(my_use_clang_lld),true)
- my_ldflags += -Wl,-execute-only
- endif
- endif
- endif
- endif
+# Exclude directories from manual binder interface whitelisting.
+# TODO(b/145621474): Move this check into IInterface.h when clang-tidy no longer uses absolute paths.
+ifneq (,$(filter $(addsuffix %,$(ALLOWED_MANUAL_INTERFACE_PATHS)),$(LOCAL_PATH)))
+ my_cflags += -DDO_NOT_CHECK_MANUAL_BINDER_INTERFACES
endif
my_allow_undefined_symbols := $(strip $(LOCAL_ALLOW_UNDEFINED_SYMBOLS))
@@ -120,24 +107,11 @@
$(error $(LOCAL_PATH): LOCAL_SDK_VERSION cannot be used in host module)
endif
- my_cflags += -D__ANDROID_NDK__
-
# Make sure we've built the NDK.
my_additional_dependencies += $(SOONG_OUT_DIR)/ndk_base.timestamp
- # mips32r6 is not supported by the NDK. No released NDK contains these
- # libraries, but the r10 in prebuilts/ndk had a local hack to add them :(
- #
- # We need to find a real solution to this problem, but until we do just drop
- # mips32r6 things back to r10 to get the tree building again.
- ifeq (mips32r6,$(TARGET_$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH_VARIANT))
- ifeq ($(LOCAL_NDK_VERSION), current)
- LOCAL_NDK_VERSION := r10
- endif
- endif
-
my_arch := $(TARGET_$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH)
- ifneq (,$(filter arm64 mips64 x86_64,$(my_arch)))
+ ifneq (,$(filter arm64 x86_64,$(my_arch)))
my_min_sdk_version := 21
else
my_min_sdk_version := $(MIN_SUPPORTED_SDK_VERSION)
@@ -171,17 +145,11 @@
$(my_built_ndk)/sysroot/usr/include/$(my_ndk_triple) \
$(my_ndk_sysroot)/usr/include \
- # x86_64 and and mips64 are both multilib toolchains, so their libraries are
+ # x86_64 is a multilib toolchain, so their libraries are
# installed in /usr/lib64. Aarch64, on the other hand, is not a multilib
# compiler, so its libraries are in /usr/lib.
- #
- # Mips32r6 is yet another variation, with libraries installed in libr6.
- #
- # For the rest, the libraries are installed simply to /usr/lib.
- ifneq (,$(filter x86_64 mips64,$(my_arch)))
+ ifneq (,$(filter x86_64,$(my_arch)))
my_ndk_libdir_name := lib64
- else ifeq (mips32r6,$(TARGET_$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH_VARIANT))
- my_ndk_libdir_name := libr6
else
my_ndk_libdir_name := lib
endif
@@ -195,11 +163,7 @@
# hashes (which are much faster!), but shipping to older devices requires
# the old style hash. Fortunately, we can build with both and it'll work
# anywhere.
- #
- # This is not currently supported on MIPS architectures.
- ifeq (,$(filter mips mips64,$(TARGET_$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH)))
- my_ldflags += -Wl,--hash-style=both
- endif
+ my_ldflags += -Wl,--hash-style=both
# We don't want to expose the relocation packer to the NDK just yet.
LOCAL_PACK_MODULE_RELOCATIONS := false
@@ -210,9 +174,6 @@
my_ndk_stl_shared_lib_fullpath :=
my_ndk_stl_static_lib :=
my_cpu_variant := $(TARGET_$(LOCAL_2ND_ARCH_VAR_PREFIX)CPU_ABI)
- ifeq (mips32r6,$(TARGET_$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH_VARIANT))
- my_cpu_variant := mips32r6
- endif
LOCAL_NDK_STL_VARIANT := $(strip $(LOCAL_NDK_STL_VARIANT))
ifeq (,$(LOCAL_NDK_STL_VARIANT))
LOCAL_NDK_STL_VARIANT := system
@@ -288,6 +249,9 @@
# If PLATFORM_VNDK_VERSION has a CODENAME, it will return
# __ANDROID_API_FUTURE__.
my_api_level := $(call codename-or-sdk-to-sdk,$(PLATFORM_VNDK_VERSION))
+ else
+ # Build with current BOARD_VNDK_VERSION.
+ my_api_level := $(call codename-or-sdk-to-sdk,$(BOARD_VNDK_VERSION))
endif
my_cflags += -D__ANDROID_VNDK__
endif
@@ -430,15 +394,6 @@
include $(BUILD_SYSTEM)/cxx_stl_setup.mk
-# Add static HAL libraries
-ifdef LOCAL_HAL_STATIC_LIBRARIES
-$(foreach lib, $(LOCAL_HAL_STATIC_LIBRARIES), \
- $(eval b_lib := $(filter $(lib).%,$(BOARD_HAL_STATIC_LIBRARIES)))\
- $(if $(b_lib), $(eval my_static_libraries += $(b_lib)),\
- $(eval my_static_libraries += $(lib).default)))
-b_lib :=
-endif
-
ifneq ($(strip $(CUSTOM_$(my_prefix)$(LOCAL_2ND_ARCH_VAR_PREFIX)LINKER)),)
my_linker := $(CUSTOM_$(my_prefix)$(LOCAL_2ND_ARCH_VAR_PREFIX)LINKER)
else
@@ -471,8 +426,8 @@
endif
# Disable ccache (or other compiler wrapper) except gomacc, which
# can handle -fprofile-use properly.
- my_cc_wrapper := $(filter $(GOMA_CC),$(my_cc_wrapper))
- my_cxx_wrapper := $(filter $(GOMA_CC),$(my_cxx_wrapper))
+ my_cc_wrapper := $(filter $(GOMA_CC) $(RBE_WRAPPER),$(my_cc_wrapper))
+ my_cxx_wrapper := $(filter $(GOMA_CC) $(RBE_WRAPPER),$(my_cxx_wrapper))
endif
###########################################################
@@ -814,7 +769,7 @@
$(intermediates)/,$(y_yacc_sources:.y=.c))
ifneq ($(y_yacc_cs),)
$(y_yacc_cs): $(intermediates)/%.c: \
- $(TOPDIR)$(LOCAL_PATH)/%.y $(BISON) $(BISON_DATA) \
+ $(TOPDIR)$(LOCAL_PATH)/%.y $(BISON) $(BISON_DATA) $(M4) \
$(my_additional_dependencies)
$(call transform-y-to-c-or-cpp)
$(call track-src-file-gen,$(y_yacc_sources),$(y_yacc_cs))
@@ -827,7 +782,7 @@
$(intermediates)/,$(yy_yacc_sources:.yy=$(LOCAL_CPP_EXTENSION)))
ifneq ($(yy_yacc_cpps),)
$(yy_yacc_cpps): $(intermediates)/%$(LOCAL_CPP_EXTENSION): \
- $(TOPDIR)$(LOCAL_PATH)/%.yy $(BISON) $(BISON_DATA) \
+ $(TOPDIR)$(LOCAL_PATH)/%.yy $(BISON) $(BISON_DATA) $(M4) \
$(my_additional_dependencies)
$(call transform-y-to-c-or-cpp)
$(call track-src-file-gen,$(yy_yacc_sources),$(yy_yacc_cpps))
@@ -843,6 +798,7 @@
l_lex_cs := $(addprefix \
$(intermediates)/,$(l_lex_sources:.l=.c))
ifneq ($(l_lex_cs),)
+$(l_lex_cs): $(LEX) $(M4)
$(l_lex_cs): $(intermediates)/%.c: \
$(TOPDIR)$(LOCAL_PATH)/%.l
$(transform-l-to-c-or-cpp)
@@ -855,6 +811,7 @@
ll_lex_cpps := $(addprefix \
$(intermediates)/,$(ll_lex_sources:.ll=$(LOCAL_CPP_EXTENSION)))
ifneq ($(ll_lex_cpps),)
+$(ll_lex_cpps): $(LEX) $(M4)
$(ll_lex_cpps): $(intermediates)/%$(LOCAL_CPP_EXTENSION): \
$(TOPDIR)$(LOCAL_PATH)/%.ll
$(transform-l-to-c-or-cpp)
@@ -876,7 +833,8 @@
$(foreach s,$(dotdot_sources),\
$(eval $(call compile-dotdot-cpp-file,$(s),\
$(my_additional_dependencies),\
- dotdot_objects)))
+ dotdot_objects,\
+ $(my_pool))))
$(call track-src-file-obj,$(dotdot_sources),$(dotdot_objects))
cpp_normal_sources := $(filter-out ../%,$(filter %$(LOCAL_CPP_EXTENSION),$(my_src_files)))
@@ -887,6 +845,7 @@
$(dotdot_objects) $(cpp_objects): PRIVATE_ARM_CFLAGS := $(normal_objects_cflags)
ifneq ($(strip $(cpp_objects)),)
+$(cpp_objects): .KATI_NINJA_POOL := $(my_pool)
$(cpp_objects): $(intermediates)/%.o: \
$(TOPDIR)$(LOCAL_PATH)/%$(LOCAL_CPP_EXTENSION) \
$(my_additional_dependencies) $(CLANG_CXX)
@@ -906,6 +865,7 @@
ifneq ($(strip $(gen_cpp_objects)),)
# Compile all generated files as thumb.
+$(gen_cpp_objects): .KATI_NINJA_POOL := $(my_pool)
$(gen_cpp_objects): PRIVATE_ARM_MODE := $(normal_objects_mode)
$(gen_cpp_objects): PRIVATE_ARM_CFLAGS := $(normal_objects_cflags)
$(gen_cpp_objects): $(intermediates)/%.o: \
@@ -924,6 +884,7 @@
$(call track-gen-file-obj,$(gen_S_sources),$(gen_S_objects))
ifneq ($(strip $(gen_S_sources)),)
+$(gen_S_objects): .KATI_NINJA_POOL := $(my_pool)
$(gen_S_objects): $(intermediates)/%.o: $(intermediates)/%.S \
$(my_additional_dependencies) $(CLANG)
$(transform-$(PRIVATE_HOST)s-to-o)
@@ -935,6 +896,7 @@
$(call track-gen-file-obj,$(gen_s_sources),$(gen_s_objects))
ifneq ($(strip $(gen_s_objects)),)
+$(gen_s_objects): .KATI_NINJA_POOL := $(my_pool)
$(gen_s_objects): $(intermediates)/%.o: $(intermediates)/%.s \
$(my_additional_dependencies) $(CLANG)
$(transform-$(PRIVATE_HOST)s-to-o)
@@ -962,7 +924,8 @@
$(foreach s, $(dotdot_sources),\
$(eval $(call compile-dotdot-c-file,$(s),\
$(my_additional_dependencies),\
- dotdot_objects)))
+ dotdot_objects,\
+ $(my_pool))))
$(call track-src-file-obj,$(dotdot_sources),$(dotdot_objects))
c_normal_sources := $(filter-out ../%,$(filter %.c,$(my_src_files)))
@@ -973,6 +936,7 @@
$(dotdot_objects) $(c_objects): PRIVATE_ARM_CFLAGS := $(normal_objects_cflags)
ifneq ($(strip $(c_objects)),)
+$(c_objects): .KATI_NINJA_POOL := $(my_pool)
$(c_objects): $(intermediates)/%.o: $(TOPDIR)$(LOCAL_PATH)/%.c \
$(my_additional_dependencies) $(CLANG)
$(transform-$(PRIVATE_HOST)c-to-o)
@@ -991,6 +955,7 @@
ifneq ($(strip $(gen_c_objects)),)
# Compile all generated files as thumb.
+$(gen_c_objects): .KATI_NINJA_POOL := $(my_pool)
$(gen_c_objects): PRIVATE_ARM_MODE := $(normal_objects_mode)
$(gen_c_objects): PRIVATE_ARM_CFLAGS := $(normal_objects_cflags)
$(gen_c_objects): $(intermediates)/%.o: $(intermediates)/%.c \
@@ -1009,6 +974,7 @@
ifneq ($(strip $(objc_objects)),)
my_soong_problems += objc
+$(objc_objects): .KATI_NINJA_POOL := $(my_pool)
$(objc_objects): $(intermediates)/%.o: $(TOPDIR)$(LOCAL_PATH)/%.m \
$(my_additional_dependencies) $(CLANG)
$(transform-$(PRIVATE_HOST)m-to-o)
@@ -1024,6 +990,7 @@
$(call track-src-file-obj,$(objcpp_sources),$(objcpp_objects))
ifneq ($(strip $(objcpp_objects)),)
+$(objcpp_objects): .KATI_NINJA_POOL := $(my_pool)
$(objcpp_objects): $(intermediates)/%.o: $(TOPDIR)$(LOCAL_PATH)/%.mm \
$(my_additional_dependencies) $(CLANG_CXX)
$(transform-$(PRIVATE_HOST)mm-to-o)
@@ -1044,10 +1011,12 @@
$(foreach s,$(dotdot_sources),\
$(eval $(call compile-dotdot-s-file,$(s),\
$(my_additional_dependencies),\
- dotdot_objects_S)))
+ dotdot_objects_S,\
+ $(my_pool))))
$(call track-src-file-obj,$(dotdot_sources),$(dotdot_objects_S))
ifneq ($(strip $(asm_objects_S)),)
+$(asm_objects_S): .KATI_NINJA_POOL := $(my_pool)
$(asm_objects_S): $(intermediates)/%.o: $(TOPDIR)$(LOCAL_PATH)/%.S \
$(my_additional_dependencies) $(CLANG)
$(transform-$(PRIVATE_HOST)s-to-o)
@@ -1064,10 +1033,12 @@
$(foreach s,$(dotdot_sources),\
$(eval $(call compile-dotdot-s-file-no-deps,$(s),\
$(my_additional_dependencies),\
- dotdot_objects_s)))
+ dotdot_objects_s,\
+ $(my_pool))))
$(call track-src-file-obj,$(dotdot_sources),$(dotdot_objects_s))
ifneq ($(strip $(asm_objects_s)),)
+$(asm_objects_s): .KATI_NINJA_POOL := $(my_pool)
$(asm_objects_s): $(intermediates)/%.o: $(TOPDIR)$(LOCAL_PATH)/%.s \
$(my_additional_dependencies) $(CLANG)
$(transform-$(PRIVATE_HOST)s-to-o)
@@ -1127,22 +1098,35 @@
## When compiling against the VNDK, use LL-NDK libraries
###########################################################
ifneq ($(LOCAL_USE_VNDK),)
- ####################################################
- ## Soong modules may be built twice, once for /system
- ## and once for /vendor. If we're using the VNDK,
- ## switch all soong libraries over to the /vendor
- ## variant.
- ####################################################
- my_whole_static_libraries := $(foreach l,$(my_whole_static_libraries),\
- $(if $(SPLIT_VENDOR.STATIC_LIBRARIES.$(l)),$(l).vendor,$(l)))
- my_static_libraries := $(foreach l,$(my_static_libraries),\
- $(if $(SPLIT_VENDOR.STATIC_LIBRARIES.$(l)),$(l).vendor,$(l)))
- my_shared_libraries := $(foreach l,$(my_shared_libraries),\
- $(if $(SPLIT_VENDOR.SHARED_LIBRARIES.$(l)),$(l).vendor,$(l)))
- my_system_shared_libraries := $(foreach l,$(my_system_shared_libraries),\
- $(if $(SPLIT_VENDOR.SHARED_LIBRARIES.$(l)),$(l).vendor,$(l)))
- my_header_libraries := $(foreach l,$(my_header_libraries),\
- $(if $(SPLIT_VENDOR.HEADER_LIBRARIES.$(l)),$(l).vendor,$(l)))
+ #####################################################
+ ## Soong modules may be built three times, once for
+ ## /system, once for /vendor and once for /product.
+ ## If we're using the VNDK, switch all soong
+ ## libraries over to the /vendor or /product variant.
+ #####################################################
+ ifeq ($(LOCAL_USE_VNDK_PRODUCT),true)
+ my_whole_static_libraries := $(foreach l,$(my_whole_static_libraries),\
+ $(if $(SPLIT_PRODUCT.STATIC_LIBRARIES.$(l)),$(l).product,$(l)))
+ my_static_libraries := $(foreach l,$(my_static_libraries),\
+ $(if $(SPLIT_PRODUCT.STATIC_LIBRARIES.$(l)),$(l).product,$(l)))
+ my_shared_libraries := $(foreach l,$(my_shared_libraries),\
+ $(if $(SPLIT_PRODUCT.SHARED_LIBRARIES.$(l)),$(l).product,$(l)))
+ my_system_shared_libraries := $(foreach l,$(my_system_shared_libraries),\
+ $(if $(SPLIT_PRODUCT.SHARED_LIBRARIES.$(l)),$(l).product,$(l)))
+ my_header_libraries := $(foreach l,$(my_header_libraries),\
+ $(if $(SPLIT_PRODUCT.HEADER_LIBRARIES.$(l)),$(l).product,$(l)))
+ else
+ my_whole_static_libraries := $(foreach l,$(my_whole_static_libraries),\
+ $(if $(SPLIT_VENDOR.STATIC_LIBRARIES.$(l)),$(l).vendor,$(l)))
+ my_static_libraries := $(foreach l,$(my_static_libraries),\
+ $(if $(SPLIT_VENDOR.STATIC_LIBRARIES.$(l)),$(l).vendor,$(l)))
+ my_shared_libraries := $(foreach l,$(my_shared_libraries),\
+ $(if $(SPLIT_VENDOR.SHARED_LIBRARIES.$(l)),$(l).vendor,$(l)))
+ my_system_shared_libraries := $(foreach l,$(my_system_shared_libraries),\
+ $(if $(SPLIT_VENDOR.SHARED_LIBRARIES.$(l)),$(l).vendor,$(l)))
+ my_header_libraries := $(foreach l,$(my_header_libraries),\
+ $(if $(SPLIT_VENDOR.HEADER_LIBRARIES.$(l)),$(l).vendor,$(l)))
+ endif
endif
# Platform can use vendor public libraries. If a required shared lib is one of
@@ -1152,6 +1136,18 @@
$(if $(filter $(l),$(VENDOR_PUBLIC_LIBRARIES)),$(l).vendorpublic,$(l)))
endif
+###########################################################
+## When compiling against the NDK, use SDK variants of Soong libraries
+###########################################################
+
+ifneq ($(LOCAL_SDK_VERSION),)
+ my_whole_static_libraries := $(call use_soong_sdk_libraries,$(my_whole_static_libraries))
+ my_static_libraries := $(call use_soong_sdk_libraries,$(my_static_libraries))
+ my_shared_libraries := $(call use_soong_sdk_libraries,$(my_shared_libraries))
+ my_system_shared_libraries := $(call use_soong_sdk_libraries,$(my_system_shared_libraries))
+ my_header_libraries := $(call use_soong_sdk_libraries,$(my_header_libraries))
+endif
+
##########################################################
## Set up installed module dependency
## We cannot compute the full path of the LOCAL_SHARED_LIBRARIES for
@@ -1189,6 +1185,7 @@
my_allowed_types := $(my_allowed_ndk_types)
else ifdef LOCAL_USE_VNDK
_name := $(patsubst %.vendor,%,$(LOCAL_MODULE))
+ _name := $(patsubst %.product,%,$(LOCAL_MODULE))
ifneq ($(filter $(_name),$(VNDK_CORE_LIBRARIES) $(VNDK_SAMEPROCESS_LIBRARIES) $(LLNDK_LIBRARIES)),)
ifeq ($(filter $(_name),$(VNDK_PRIVATE_LIBRARIES)),)
my_link_type := native:vndk
@@ -1197,6 +1194,12 @@
endif
my_warn_types :=
my_allowed_types := native:vndk native:vndk_private
+ else ifeq ($(LOCAL_USE_VNDK_PRODUCT),true)
+ # Modules installed to /product cannot directly depend on modules marked
+ # with vendor_available: false
+ my_link_type := native:product
+ my_warn_types :=
+ my_allowed_types := native:product native:vndk native:platform_vndk
else
# Modules installed to /vendor cannot directly depend on modules marked
# with vendor_available: false
@@ -1277,9 +1280,15 @@
my_c_includes += $(JNI_H_INCLUDE)
endif
-my_outside_includes := $(filter-out $(OUT_DIR)/%,$(filter /%,$(my_c_includes)))
+my_c_includes := $(foreach inc,$(my_c_includes),$(call clean-path,$(inc)))
+
+my_outside_includes := $(filter-out $(OUT_DIR)/%,$(filter /%,$(my_c_includes)) $(filter ../%,$(my_c_includes)))
ifneq ($(my_outside_includes),)
-$(error $(LOCAL_MODULE_MAKEFILE): $(LOCAL_MODULE): C_INCLUDES must be under the source or output directories: $(my_outside_includes))
+ ifeq ($(BUILD_BROKEN_OUTSIDE_INCLUDE_DIRS),true)
+ $(call pretty-warning,C_INCLUDES must be under the source or output directories: $(my_outside_includes))
+ else
+ $(call pretty-error,C_INCLUDES must be under the source or output directories: $(my_outside_includes))
+ endif
endif
# all_objects includes gen_o_objects which were part of LOCAL_GENERATED_SOURCES;
@@ -1443,10 +1452,10 @@
# Check if -Werror or -Wno-error is used in C compiler flags.
# Header libraries do not need cflags.
+my_all_cflags := $(my_cflags) $(my_cppflags) $(my_cflags_no_override)
ifneq (HEADER_LIBRARIES,$(LOCAL_MODULE_CLASS))
# Prebuilt modules do not need cflags.
ifeq (,$(LOCAL_PREBUILT_MODULE_FILE))
- my_all_cflags := $(my_cflags) $(my_cppflags) $(my_cflags_no_override)
# Issue warning if -Wno-error is used.
ifneq (,$(filter -Wno-error,$(my_all_cflags)))
$(eval MODULES_USING_WNO_ERROR := $(MODULES_USING_WNO_ERROR) $(LOCAL_MODULE_MAKEFILE):$(LOCAL_MODULE))
@@ -1465,6 +1474,13 @@
endif
endif
+ifneq (,$(filter -Weverything,$(my_all_cflags)))
+ ifeq (,$(ANDROID_TEMPORARILY_ALLOW_WEVERYTHING))
+ $(call pretty-error, -Weverything is not allowed in Android.mk files.\
+ Build with `m ANDROID_TEMPORARILY_ALLOW_WEVERYTHING=true` to experiment locally with -Weverything.)
+ endif
+endif
+
# Disable clang-tidy if it is not found.
ifeq ($(PATH_TO_CLANG_TIDY),)
my_tidy_enabled := false
@@ -1554,28 +1570,22 @@
## Define PRIVATE_ variables from global vars
###########################################################
ifndef LOCAL_IS_HOST_MODULE
+
ifdef LOCAL_USE_VNDK
-my_target_global_c_includes := \
- $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)PROJECT_INCLUDES)
-my_target_global_c_system_includes := \
- $(TARGET_OUT_HEADERS) \
- $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)PROJECT_SYSTEM_INCLUDES)
+ my_target_global_c_includes :=
+ my_target_global_c_system_includes := $(TARGET_OUT_HEADERS)
else ifdef LOCAL_SDK_VERSION
-my_target_global_c_includes :=
-my_target_global_c_system_includes := $(my_ndk_stl_include_path) $(my_ndk_sysroot_include)
+ my_target_global_c_includes :=
+ my_target_global_c_system_includes := $(my_ndk_stl_include_path) $(my_ndk_sysroot_include)
else ifdef BOARD_VNDK_VERSION
-my_target_global_c_includes := $(SRC_HEADERS) \
- $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)PROJECT_INCLUDES) \
+ my_target_global_c_includes := $(SRC_HEADERS) \
$($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)C_INCLUDES)
-my_target_global_c_system_includes := $(SRC_SYSTEM_HEADERS) \
- $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)PROJECT_SYSTEM_INCLUDES) \
+ my_target_global_c_system_includes := $(SRC_SYSTEM_HEADERS) \
$($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)C_SYSTEM_INCLUDES)
else
-my_target_global_c_includes := $(SRC_HEADERS) \
- $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)PROJECT_INCLUDES) \
+ my_target_global_c_includes := $(SRC_HEADERS) \
$($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)C_INCLUDES)
-my_target_global_c_system_includes := $(SRC_SYSTEM_HEADERS) $(TARGET_OUT_HEADERS) \
- $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)PROJECT_SYSTEM_INCLUDES) \
+ my_target_global_c_system_includes := $(SRC_SYSTEM_HEADERS) $(TARGET_OUT_HEADERS) \
$($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)C_SYSTEM_INCLUDES)
endif
@@ -1658,9 +1668,22 @@
####################################################
## Import includes
####################################################
+imported_includes :=
+
+ifdef LOCAL_USE_VNDK
+ imported_includes += $(call intermediates-dir-for,HEADER_LIBRARIES,device_kernel_headers,$(my_kind),,$(LOCAL_2ND_ARCH_VAR_PREFIX),$(my_host_cross))
+else ifdef LOCAL_SDK_VERSION
+ # Apps shouldn't need device-specific kernel headers
+else ifdef BOARD_VNDK_VERSION
+ # For devices building with the VNDK, only the VNDK gets device-specific kernel headers by default
+ # In soong, it's entirely opt-in
+else
+ # For older non-VNDK builds, continue adding in kernel headers to everything like we used to
+ imported_includes += $(call intermediates-dir-for,HEADER_LIBRARIES,device_kernel_headers,$(my_kind),,$(LOCAL_2ND_ARCH_VAR_PREFIX),$(my_host_cross))
+endif
+
imported_includes := $(strip \
- $(if $(LOCAL_USE_VNDK),\
- $(call intermediates-dir-for,HEADER_LIBRARIES,device_kernel_headers,$(my_kind),,$(LOCAL_2ND_ARCH_VAR_PREFIX),$(my_host_cross))) \
+ $(imported_includes) \
$(foreach l, $(installed_shared_library_module_names), \
$(call intermediates-dir-for,SHARED_LIBRARIES,$(l),$(my_kind),,$(LOCAL_2ND_ARCH_VAR_PREFIX),$(my_host_cross))) \
$(foreach l, $(my_static_libraries) $(my_whole_static_libraries), \
@@ -1776,8 +1799,8 @@
$(call intermediates-dir-for,HEADER_LIBRARIES,$(l),$(my_kind),,$(LOCAL_2ND_ARCH_VAR_PREFIX),$(my_host_cross))))
ifneq ($(strip $(my_export_c_include_dirs)$(export_include_deps)),)
- EXPORTS_LIST := $(EXPORTS_LIST) $(intermediates)
- EXPORTS.$(intermediates).FLAGS := $(foreach d,$(my_export_c_include_dirs),-I $(d))
+ EXPORTS_LIST += $(intermediates)
+ EXPORTS.$(intermediates).FLAGS := $(foreach d,$(my_export_c_include_dirs),-I $(call clean-path,$(d)))
EXPORTS.$(intermediates).REEXPORT := $(export_include_deps)
EXPORTS.$(intermediates).DEPS := $(my_export_c_include_deps) $(my_generated_sources) $(LOCAL_EXPORT_C_INCLUDE_DEPS)
endif
diff --git a/core/board_config.mk b/core/board_config.mk
index a6aef87..ae1614f 100644
--- a/core/board_config.mk
+++ b/core/board_config.mk
@@ -26,6 +26,7 @@
BOARD_KERNEL_CMDLINE \
BOARD_KERNEL_BASE \
BOARD_USES_GENERIC_AUDIO \
+ BOARD_USES_RECOVERY_AS_BOOT \
BOARD_VENDOR_USE_AKMD \
BOARD_WPA_SUPPLICANT_DRIVER \
BOARD_WLAN_DEVICE \
@@ -86,7 +87,12 @@
_build_broken_var_list := \
BUILD_BROKEN_DUP_RULES \
+ BUILD_BROKEN_ELF_PREBUILT_PRODUCT_COPY_FILES \
+ BUILD_BROKEN_OUTSIDE_INCLUDE_DIRS \
+ BUILD_BROKEN_PREBUILT_ELF_FILES \
+ BUILD_BROKEN_TREBLE_SYSPROP_NEVERALLOW \
BUILD_BROKEN_USES_NETWORK \
+ BUILD_BROKEN_VINTF_PRODUCT_COPY_FILES \
_build_broken_var_list += \
$(foreach m,$(AVAILABLE_BUILD_MODULE_TYPES) \
@@ -95,7 +101,8 @@
BUILD_BROKEN_USES_$(m))
_board_true_false_vars := $(_build_broken_var_list)
-_board_strip_readonly_list += $(_build_broken_var_list)
+_board_strip_readonly_list += $(_build_broken_var_list) \
+ BUILD_BROKEN_NINJA_USES_ENV_VARS
# Conditional to building on linux, as dex2oat currently does not work on darwin.
ifeq ($(HOST_OS),linux)
@@ -106,6 +113,7 @@
# Broken build defaults
# ###############################################################
$(foreach v,$(_build_broken_var_list),$(eval $(v) :=))
+BUILD_BROKEN_NINJA_USES_ENV_VARS :=
# Boards may be defined under $(SRC_TARGET_DIR)/board/$(TARGET_DEVICE)
# or under vendor/*/$(TARGET_DEVICE). Search in both places, but
@@ -234,13 +242,8 @@
# build a list out of the TARGET_CPU_ABIs specified by the config.
# Add NATIVE_BRIDGE_ABIs at the end to keep order of preference.
ifeq (,$(TARGET_CPU_ABI_LIST))
- ifeq ($(TARGET_IS_64_BIT)|$(TARGET_PREFER_32_BIT_APPS),true|true)
- TARGET_CPU_ABI_LIST := $(TARGET_CPU_ABI_LIST_32_BIT) $(TARGET_CPU_ABI_LIST_64_BIT) \
- $(_target_native_bridge_abi_list_32_bit) $(_target_native_bridge_abi_list_64_bit)
- else
- TARGET_CPU_ABI_LIST := $(TARGET_CPU_ABI_LIST_64_BIT) $(TARGET_CPU_ABI_LIST_32_BIT) \
- $(_target_native_bridge_abi_list_64_bit) $(_target_native_bridge_abi_list_32_bit)
- endif
+ TARGET_CPU_ABI_LIST := $(TARGET_CPU_ABI_LIST_64_BIT) $(TARGET_CPU_ABI_LIST_32_BIT) \
+ $(_target_native_bridge_abi_list_64_bit) $(_target_native_bridge_abi_list_32_bit)
endif
# Add NATIVE_BRIDGE_ABIs at the end of 32 and 64 bit CPU_ABIs to keep order of preference.
@@ -252,6 +255,19 @@
TARGET_CPU_ABI_LIST_32_BIT := $(subst $(space),$(comma),$(strip $(TARGET_CPU_ABI_LIST_32_BIT)))
TARGET_CPU_ABI_LIST_64_BIT := $(subst $(space),$(comma),$(strip $(TARGET_CPU_ABI_LIST_64_BIT)))
+# Check if config about image building is valid or not.
+define check_image_config
+ $(eval _uc_name := $(call to-upper,$(1))) \
+ $(eval _lc_name := $(call to-lower,$(1))) \
+ $(if $(filter $(_lc_name),$(TARGET_COPY_OUT_$(_uc_name))), \
+ $(if $(BOARD_USES_$(_uc_name)IMAGE),, \
+ $(error If TARGET_COPY_OUT_$(_uc_name) is '$(_lc_name)', either BOARD_PREBUILT_$(_uc_name)IMAGE or BOARD_$(_uc_name)IMAGE_FILE_SYSTEM_TYPE must be set)), \
+ $(if $(BOARD_USES_$(_uc_name)IMAGE), \
+ $(error TARGET_COPY_OUT_$(_uc_name) must be set to '$(_lc_name)' to use a $(_lc_name) image))) \
+ $(eval _uc_name :=) \
+ $(eval _lc_name :=)
+endef
+
###########################################
# Now we can substitute with the real value of TARGET_COPY_OUT_RAMDISK
ifeq ($(BOARD_BUILD_SYSTEM_ROOT_IMAGE),true)
@@ -262,6 +278,8 @@
# Now we can substitute with the real value of TARGET_COPY_OUT_DEBUG_RAMDISK
ifeq ($(BOARD_USES_RECOVERY_AS_BOOT),true)
TARGET_COPY_OUT_DEBUG_RAMDISK := debug_ramdisk/first_stage_ramdisk
+TARGET_COPY_OUT_VENDOR_DEBUG_RAMDISK := vendor_debug_ramdisk/first_stage_ramdisk
+TARGET_COPY_OUT_TEST_HARNESS_RAMDISK := test_harness_ramdisk/first_stage_ramdisk
endif
###########################################
@@ -336,6 +354,17 @@
endif
.KATI_READONLY := BUILDING_RECOVERY_IMAGE
+# Are we building a vendor boot image
+BUILDING_VENDOR_BOOT_IMAGE :=
+ifdef BOARD_BOOT_HEADER_VERSION
+ ifneq ($(call math_gt_or_eq,$(BOARD_BOOT_HEADER_VERSION),3),)
+ ifneq ($(TARGET_NO_VENDOR_BOOT),true)
+ BUILDING_VENDOR_BOOT_IMAGE := true
+ endif
+ endif
+endif
+.KATI_READONLY := BUILDING_VENDOR_BOOT_IMAGE
+
# Are we building a ramdisk image
BUILDING_RAMDISK_IMAGE := true
ifeq ($(PRODUCT_BUILD_RAMDISK_IMAGE),)
@@ -381,6 +410,8 @@
ifdef BOARD_VENDORIMAGE_FILE_SYSTEM_TYPE
BOARD_USES_VENDORIMAGE := true
endif
+# TODO(b/137169253): For now, some AOSP targets build with prebuilt vendor image.
+# But target's BOARD_PREBUILT_VENDORIMAGE is not filled.
ifeq ($(TARGET_COPY_OUT_VENDOR),vendor)
BOARD_USES_VENDORIMAGE := true
else ifdef BOARD_USES_VENDORIMAGE
@@ -420,11 +451,7 @@
ifdef BOARD_PRODUCTIMAGE_FILE_SYSTEM_TYPE
BOARD_USES_PRODUCTIMAGE := true
endif
-ifeq ($(TARGET_COPY_OUT_PRODUCT),product)
- BOARD_USES_PRODUCTIMAGE := true
-else ifdef BOARD_USES_PRODUCTIMAGE
- $(error TARGET_COPY_OUT_PRODUCT must be set to 'product' to use a product image)
-endif
+$(call check_image_config,product)
.KATI_READONLY := BOARD_USES_PRODUCTIMAGE
BUILDING_PRODUCT_IMAGE :=
@@ -464,11 +491,7 @@
ifdef BOARD_SYSTEM_EXTIMAGE_FILE_SYSTEM_TYPE
BOARD_USES_SYSTEM_EXTIMAGE := true
endif
-ifeq ($(TARGET_COPY_OUT_SYSTEM_EXT),system_ext)
- BOARD_USES_SYSTEM_EXTIMAGE := true
-else ifdef BOARD_USES_SYSTEM_EXTIMAGE
- $(error TARGET_COPY_OUT_SYSTEM_EXT must be set to 'system_ext' to use a system_ext image)
-endif
+$(call check_image_config,system_ext)
.KATI_READONLY := BOARD_USES_SYSTEM_EXTIMAGE
BUILDING_SYSTEM_EXT_IMAGE :=
@@ -490,9 +513,9 @@
###########################################
# Now we can substitute with the real value of TARGET_COPY_OUT_ODM
ifeq ($(TARGET_COPY_OUT_ODM),$(_odm_path_placeholder))
- TARGET_COPY_OUT_ODM := vendor/odm
-else ifeq ($(filter odm vendor/odm,$(TARGET_COPY_OUT_ODM)),)
- $(error TARGET_COPY_OUT_ODM must be either 'odm' or 'vendor/odm', seeing '$(TARGET_COPY_OUT_ODM)'.)
+ TARGET_COPY_OUT_ODM := $(TARGET_COPY_OUT_VENDOR)/odm
+else ifeq ($(filter odm system/vendor/odm vendor/odm,$(TARGET_COPY_OUT_ODM)),)
+ $(error TARGET_COPY_OUT_ODM must be either 'odm', 'system/vendor/odm' or 'vendor/odm', seeing '$(TARGET_COPY_OUT_ODM)'.)
endif
PRODUCT_COPY_FILES := $(subst $(_odm_path_placeholder),$(TARGET_COPY_OUT_ODM),$(PRODUCT_COPY_FILES))
@@ -503,11 +526,7 @@
ifdef BOARD_ODMIMAGE_FILE_SYSTEM_TYPE
BOARD_USES_ODMIMAGE := true
endif
-ifeq ($(TARGET_COPY_OUT_ODM),odm)
- BOARD_USES_ODMIMAGE := true
-else ifdef BOARD_USES_ODMIMAGE
- $(error TARGET_COPY_OUT_ODM must be set to 'odm' to use an odm image)
-endif
+$(call check_image_config,odm)
BUILDING_ODM_IMAGE :=
ifeq ($(PRODUCT_BUILD_ODM_IMAGE),)
@@ -526,13 +545,31 @@
.KATI_READONLY := BUILDING_ODM_IMAGE
###########################################
-# Ensure that only TARGET_RECOVERY_UPDATER_LIBS *or* AB_OTA_UPDATER is set.
+# Ensure consistency among TARGET_RECOVERY_UPDATER_LIBS, AB_OTA_UPDATER, and PRODUCT_OTA_FORCE_NON_AB_PACKAGE.
TARGET_RECOVERY_UPDATER_LIBS ?=
AB_OTA_UPDATER ?=
.KATI_READONLY := TARGET_RECOVERY_UPDATER_LIBS AB_OTA_UPDATER
-ifeq ($(AB_OTA_UPDATER),true)
+
+# Ensure that if PRODUCT_OTA_FORCE_NON_AB_PACKAGE == true, then AB_OTA_UPDATER must be true
+ifeq ($(PRODUCT_OTA_FORCE_NON_AB_PACKAGE),true)
+ ifneq ($(AB_OTA_UPDATER),true)
+ $(error AB_OTA_UPDATER must be set to true when PRODUCT_OTA_FORCE_NON_AB_PACKAGE is true)
+ endif
+endif
+
+# In some configurations, A/B and non-A/B may coexist. Check TARGET_OTA_ALLOW_NON_AB
+# to see if non-A/B is supported.
+TARGET_OTA_ALLOW_NON_AB := false
+ifneq ($(AB_OTA_UPDATER),true)
+ TARGET_OTA_ALLOW_NON_AB := true
+else ifeq ($(PRODUCT_OTA_FORCE_NON_AB_PACKAGE),true)
+ TARGET_OTA_ALLOW_NON_AB := true
+endif
+.KATI_READONLY := TARGET_OTA_ALLOW_NON_AB
+
+ifneq ($(TARGET_OTA_ALLOW_NON_AB),true)
ifneq ($(strip $(TARGET_RECOVERY_UPDATER_LIBS)),)
- $(error Do not use TARGET_RECOVERY_UPDATER_LIBS when using AB_OTA_UPDATER)
+ $(error Do not use TARGET_RECOVERY_UPDATER_LIBS when using TARGET_OTA_ALLOW_NON_AB)
endif
endif
@@ -557,9 +594,8 @@
ifdef BOARD_VNDK_VERSION
ifneq ($(BOARD_VNDK_VERSION),current)
- $(error BOARD_VNDK_VERSION: Only "current" is implemented)
+ $(call check_vndk_version,$(BOARD_VNDK_VERSION))
endif
-
TARGET_VENDOR_TEST_SUFFIX := /vendor
else
TARGET_VENDOR_TEST_SUFFIX :=
@@ -569,11 +605,19 @@
# APEXes are by default flattened, i.e. non-updatable.
# It can be unflattened (and updatable) by inheriting from
# updatable_apex.mk
-ifeq (,$(TARGET_FLATTEN_APEX))
-TARGET_FLATTEN_APEX := true
+#
+# APEX flattening can also be forcibly enabled (resp. disabled) by
+# setting OVERRIDE_TARGET_FLATTEN_APEX to true (resp. false), e.g. by
+# setting the OVERRIDE_TARGET_FLATTEN_APEX environment variable.
+ifdef OVERRIDE_TARGET_FLATTEN_APEX
+ TARGET_FLATTEN_APEX := $(OVERRIDE_TARGET_FLATTEN_APEX)
+else
+ ifeq (,$(TARGET_FLATTEN_APEX))
+ TARGET_FLATTEN_APEX := true
+ endif
endif
-ifeq (,$(TARGET_BUILD_APPS))
+ifeq (,$(TARGET_BUILD_UNBUNDLED))
ifdef PRODUCT_EXTRA_VNDK_VERSIONS
$(foreach v,$(PRODUCT_EXTRA_VNDK_VERSIONS),$(call check_vndk_version,$(v)))
endif
@@ -594,7 +638,11 @@
$(KATI_obsolete_var $(m),Please convert to Soong),\
$(KATI_deprecated_var $(m),Please convert to Soong)))
-$(foreach m,$(DEFAULT_ERROR_BUILD_MODULE_TYPES),\
+$(if $(filter true,$(BUILD_BROKEN_USES_BUILD_COPY_HEADERS)),\
+ $(KATI_deprecated_var BUILD_COPY_HEADERS,See $(CHANGES_URL)#copy_headers),\
+ $(KATI_obsolete_var BUILD_COPY_HEADERS,See $(CHANGES_URL)#copy_headers))
+
+$(foreach m,$(filter-out BUILD_COPY_HEADERS,$(DEFAULT_ERROR_BUILD_MODULE_TYPES)),\
$(if $(filter true,$(BUILD_BROKEN_USES_$(m))),\
$(KATI_deprecated_var $(m),Please convert to Soong),\
$(KATI_obsolete_var $(m),Please convert to Soong)))
diff --git a/core/build-system.html b/core/build-system.html
index cc242d9..9cd7b0b 100644
--- a/core/build-system.html
+++ b/core/build-system.html
@@ -467,8 +467,6 @@
<b>TARGET_ARCH</b><br/>
arm<br/>
arm64<br/>
- mips<br/>
- mips64<br/>
x86<br/>
x86_64
</td>
diff --git a/core/build_id.mk b/core/build_id.mk
index 2329288..ba5ca42 100644
--- a/core/build_id.mk
+++ b/core/build_id.mk
@@ -18,4 +18,4 @@
# (like "CRB01"). It must be a single word, and is
# capitalized by convention.
-BUILD_ID=QT
+BUILD_ID=AOSP.MASTER
diff --git a/core/build_rro_package.mk b/core/build_rro_package.mk
index e5d7685..ae528bd 100644
--- a/core/build_rro_package.mk
+++ b/core/build_rro_package.mk
@@ -32,6 +32,12 @@
LOCAL_MODULE_PATH := $(partition)/overlay/$(LOCAL_RRO_THEME)
endif
+# Do not remove resources without default values nor dedupe resource
+# configurations with the same value
+LOCAL_AAPT_FLAGS += \
+ --no-resource-deduping \
+ --no-resource-removal
+
partition :=
include $(BUILD_SYSTEM)/package.mk
diff --git a/core/cc_prebuilt_internal.mk b/core/cc_prebuilt_internal.mk
index 6313019..99b7d0f 100644
--- a/core/cc_prebuilt_internal.mk
+++ b/core/cc_prebuilt_internal.mk
@@ -75,7 +75,7 @@
built_module := $(LOCAL_BUILT_MODULE)
ifdef prebuilt_module_is_a_library
-EXPORTS_LIST := $(EXPORTS_LIST) $(intermediates)
+EXPORTS_LIST += $(intermediates)
EXPORTS.$(intermediates).FLAGS := $(foreach d,$(LOCAL_EXPORT_C_INCLUDE_DIRS),-I $(d))
EXPORTS.$(intermediates).DEPS := $(LOCAL_EXPORT_C_INCLUDE_DEPS)
@@ -85,6 +85,7 @@
my_link_type := native:ndk:$(my_ndk_stl_family):$(my_ndk_stl_link_type)
else ifdef LOCAL_USE_VNDK
_name := $(patsubst %.vendor,%,$(LOCAL_MODULE))
+ _name := $(patsubst %.product,%,$(LOCAL_MODULE))
ifneq ($(filter $(_name),$(VNDK_CORE_LIBRARIES) $(VNDK_SAMEPROCESS_LIBRARIES) $(LLNDK_LIBRARIES)),)
ifeq ($(filter $(_name),$(VNDK_PRIVATE_LIBRARIES)),)
my_link_type := native:vndk
@@ -92,7 +93,11 @@
my_link_type := native:vndk_private
endif
else
- my_link_type := native:vendor
+ ifeq ($(LOCAL_USE_VNDK_PRODUCT),true)
+ my_link_type := native:product
+ else
+ my_link_type := native:vendor
+ endif
endif
else ifneq ($(filter $(TARGET_RECOVERY_OUT)/%,$(LOCAL_MODULE_PATH)),)
my_link_type := native:recovery
@@ -136,8 +141,13 @@
ifdef my_shared_libraries
ifdef LOCAL_USE_VNDK
- my_shared_libraries := $(foreach l,$(my_shared_libraries),\
- $(if $(SPLIT_VENDOR.SHARED_LIBRARIES.$(l)),$(l).vendor,$(l)))
+ ifeq ($(LOCAL_USE_VNDK_PRODUCT),true)
+ my_shared_libraries := $(foreach l,$(my_shared_libraries),\
+ $(if $(SPLIT_PRODUCT.SHARED_LIBRARIES.$(l)),$(l).product,$(l)))
+ else
+ my_shared_libraries := $(foreach l,$(my_shared_libraries),\
+ $(if $(SPLIT_VENDOR.SHARED_LIBRARIES.$(l)),$(l).vendor,$(l)))
+ endif
endif
$(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)DEPENDENCIES_ON_SHARED_LIBRARIES += \
$(my_register_name):$(LOCAL_INSTALLED_MODULE):$(subst $(space),$(comma),$(my_shared_libraries))
diff --git a/core/check_elf_file.mk b/core/check_elf_file.mk
index 0faaadd..d54a5b7 100644
--- a/core/check_elf_file.mk
+++ b/core/check_elf_file.mk
@@ -38,12 +38,14 @@
$<
$(hide) touch $@
-ifneq ($(PRODUCT_CHECK_ELF_FILES)$(CHECK_ELF_FILES),)
+CHECK_ELF_FILES.$(check_elf_files_stamp) := 1
+
ifneq ($(strip $(LOCAL_CHECK_ELF_FILES)),false)
+ifneq ($(strip $(BUILD_BROKEN_PREBUILT_ELF_FILES)),true)
$(LOCAL_BUILT_MODULE): $(check_elf_files_stamp)
check-elf-files: $(check_elf_files_stamp)
+endif # BUILD_BROKEN_PREBUILT_ELF_FILES
endif # LOCAL_CHECK_ELF_FILES
-endif # PRODUCT_CHECK_ELF_FILES or CHECK_ELF_FILES
endif # SHARED_LIBRARIES, EXECUTABLES, NATIVE_TESTS
endif # !LOCAL_IS_HOST_MODULE
diff --git a/core/clang/TARGET_mips.mk b/core/clang/TARGET_mips.mk
deleted file mode 100644
index 3e54a66..0000000
--- a/core/clang/TARGET_mips.mk
+++ /dev/null
@@ -1,9 +0,0 @@
-$(clang_2nd_arch_prefix)RS_TRIPLE := renderscript32-linux-androideabi
-$(clang_2nd_arch_prefix)RS_TRIPLE_CFLAGS :=
-RS_COMPAT_TRIPLE := mipsel-linux-android
-
-$(clang_2nd_arch_prefix)TARGET_LIBPROFILE_RT := $(LLVM_RTLIB_PATH)/libclang_rt.profile-mipsel-android.a
-
-# Address sanitizer clang config
-$(clang_2nd_arch_prefix)ADDRESS_SANITIZER_LINKER := /system/bin/linker_asan
-$(clang_2nd_arch_prefix)ADDRESS_SANITIZER_LINKER_FILE := /system/bin/bootstrap/linker_asan
diff --git a/core/clang/TARGET_mips64.mk b/core/clang/TARGET_mips64.mk
deleted file mode 100644
index cb6a3cd..0000000
--- a/core/clang/TARGET_mips64.mk
+++ /dev/null
@@ -1,9 +0,0 @@
-RS_TRIPLE := renderscript64-linux-android
-RS_TRIPLE_CFLAGS :=
-RS_COMPAT_TRIPLE := mips64el-linux-android
-
-TARGET_LIBPROFILE_RT := $(LLVM_RTLIB_PATH)/libclang_rt.profile-mips64el-android.a
-
-# Address sanitizer clang config
-$(clang_2nd_arch_prefix)ADDRESS_SANITIZER_LINKER := /system/bin/linker_asan64
-$(clang_2nd_arch_prefix)ADDRESS_SANITIZER_LINKER_FILE := /system/bin/bootstrap/linker_asan64
diff --git a/core/clear_vars.mk b/core/clear_vars.mk
index 24cca5a..c88a1cd 100644
--- a/core/clear_vars.mk
+++ b/core/clear_vars.mk
@@ -21,6 +21,7 @@
LOCAL_APIDIFF_NEWAPI:=
LOCAL_APIDIFF_OLDAPI:=
LOCAL_APK_LIBRARIES:=
+LOCAL_APK_SET_MASTER_FILE:=
LOCAL_ARM_MODE:=
LOCAL_ASFLAGS:=
LOCAL_ASSET_DIR:=
@@ -29,6 +30,7 @@
LOCAL_CC:=
LOCAL_CERTIFICATE:=
LOCAL_CFLAGS:=
+LOCAL_CHECK_SAME_VNDK_VARIANTS:=
LOCAL_CHECKED_MODULE:=
LOCAL_C_INCLUDES:=
LOCAL_CLANG:=
@@ -56,7 +58,7 @@
LOCAL_DEX_PREOPT_FLAGS:=
LOCAL_DEX_PREOPT_GENERATE_PROFILE:=
LOCAL_DEX_PREOPT_PROFILE_CLASS_LISTING:=
-LOCAL_DEX_PREOPT:= # '',true,false,nostripping
+LOCAL_DEX_PREOPT:= # '',true,false
LOCAL_DISABLE_AUTO_GENERATE_TEST_CONFIG:=
LOCAL_DISABLE_RESOLVE_SUPPORT_LIBRARIES:=
LOCAL_DONT_CHECK_MODULE:=
@@ -73,6 +75,7 @@
LOCAL_DROIDDOC_DOC_ZIP :=
LOCAL_DROIDDOC_JDIFF_DOC_ZIP :=
LOCAL_DROIDDOC_HTML_DIR:=
+LOCAL_DROIDDOC_METADATA_ZIP:=
LOCAL_DROIDDOC_OPTIONS:=
LOCAL_DROIDDOC_SOURCE_PATH:=
LOCAL_DROIDDOC_STUB_OUT_DIR:=
@@ -105,12 +108,12 @@
LOCAL_FULL_MANIFEST_FILE:=
LOCAL_FULL_TEST_CONFIG:=
LOCAL_FUZZ_ENGINE:=
+LOCAL_FUZZ_INSTALLED_SHARED_DEPS:=
LOCAL_GCNO_FILES:=
LOCAL_GENERATED_SOURCES:=
# Group static libraries with "-Wl,--start-group" and "-Wl,--end-group" when linking.
LOCAL_GROUP_STATIC_LIBRARIES:=
LOCAL_GTEST:=true
-LOCAL_HAL_STATIC_LIBRARIES:=
LOCAL_HEADER_LIBRARIES:=
LOCAL_HOST_PREFIX:=
LOCAL_HOST_REQUIRED_MODULES:=
@@ -150,6 +153,7 @@
LOCAL_JETIFIER_ENABLED:=
LOCAL_JNI_SHARED_LIBRARIES:=
LOCAL_JNI_SHARED_LIBRARIES_ABI:=
+LOCAL_CERTIFICATE_LINEAGE:=
LOCAL_LDFLAGS:=
LOCAL_LDLIBS:=
LOCAL_LOGTAGS_FILES:=
@@ -183,13 +187,13 @@
LOCAL_NO_CRT:=
LOCAL_NO_DEFAULT_COMPILER_FLAGS:=
LOCAL_NO_FPIE :=
-LOCAL_NO_LIBGCC:=
LOCAL_NO_LIBCRT_BUILTINS:=
LOCAL_NO_NOTICE_FILE:=
LOCAL_NO_PIC:=
LOCAL_NOSANITIZE:=
LOCAL_NO_STANDARD_LIBRARIES:=
LOCAL_NO_STATIC_ANALYZER:=
+LOCAL_NOT_AVAILABLE_FOR_PLATFORM:=
LOCAL_NOTICE_FILE:=
LOCAL_ODM_MODULE:=
LOCAL_OEM_MODULE:=
@@ -291,7 +295,6 @@
LOCAL_SYSTEM_SHARED_LIBRARIES:=none
LOCAL_TARGET_REQUIRED_MODULES:=
LOCAL_TEST_CONFIG:=
-LOCAL_TEST_CONFIG_OPTIONS:=
LOCAL_TEST_DATA:=
LOCAL_TEST_MODULE_TO_PROGUARD_WITH:=
LOCAL_TIDY:=
@@ -303,6 +306,7 @@
LOCAL_USE_AAPT2:=
LOCAL_USE_CLANG_LLD:=
LOCAL_USE_VNDK:=
+LOCAL_USE_VNDK_PRODUCT:=
LOCAL_USES_LIBRARIES:=
LOCAL_VENDOR_MODULE:=
LOCAL_VINTF_FRAGMENTS:=
@@ -312,7 +316,6 @@
LOCAL_VTS_MODE:=
LOCAL_WARNINGS_ENABLE:=
LOCAL_WHOLE_STATIC_LIBRARIES:=
-LOCAL_XOM:=
LOCAL_YACCFLAGS:=
LOCAL_CHECK_ELF_FILES:=
# TODO: deprecate, it does nothing
@@ -472,17 +475,6 @@
LOCAL_ROBOTEST_TIMEOUT :=
LOCAL_TEST_PACKAGE :=
-# Aux specific variables
-LOCAL_AUX_ARCH :=
-LOCAL_AUX_CPU :=
-LOCAL_AUX_OS :=
-LOCAL_AUX_OS_VARIANT :=
-LOCAL_AUX_SUBARCH :=
-LOCAL_AUX_TOOLCHAIN :=
-LOCAL_CUSTOM_BUILD_STEP_INPUT:=
-LOCAL_CUSTOM_BUILD_STEP_OUTPUT:=
-LOCAL_IS_AUX_MODULE :=
-
full_android_manifest :=
non_system_module :=
diff --git a/core/combo/TARGET_linux-mips.mk b/core/combo/TARGET_linux-mips.mk
deleted file mode 100644
index 9f14aa2..0000000
--- a/core/combo/TARGET_linux-mips.mk
+++ /dev/null
@@ -1,44 +0,0 @@
-#
-# Copyright (C) 2010 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.
-#
-
-# Configuration for Linux on MIPS.
-# Included by combo/select.mk
-
-# You can set TARGET_ARCH_VARIANT to use an arch version other
-# than mips32r2-fp. Each value should correspond to a file named
-# $(BUILD_COMBOS)/arch/<name>.mk which must contain
-# makefile variable definitions. Their
-# purpose is to allow module Android.mk files to selectively compile
-# different versions of code based upon the funtionality and
-# instructions available in a given architecture version.
-#
-# The blocks also define specific arch_variant_cflags, which
-# include defines, and compiler settings for the given architecture
-# version.
-#
-ifeq ($(strip $(TARGET_$(combo_2nd_arch_prefix)ARCH_VARIANT)),)
-TARGET_$(combo_2nd_arch_prefix)ARCH_VARIANT := mips32r2-fp
-endif
-
-include $(BUILD_SYSTEM)/combo/fdo.mk
-
-define $(combo_var_prefix)transform-shared-lib-to-toc
-$(call _gen_toc_command_for_elf,$(1),$(2))
-endef
-
-$(combo_2nd_arch_prefix)TARGET_PACK_MODULE_RELOCATIONS := true
-
-$(combo_2nd_arch_prefix)TARGET_LINKER := /system/bin/linker
diff --git a/core/combo/TARGET_linux-mips64.mk b/core/combo/TARGET_linux-mips64.mk
deleted file mode 100644
index ae17e46..0000000
--- a/core/combo/TARGET_linux-mips64.mk
+++ /dev/null
@@ -1,44 +0,0 @@
-#
-# Copyright (C) 2013 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.
-#
-
-# Configuration for Linux on MIPS64.
-# Included by combo/select.mk
-
-# You can set TARGET_ARCH_VARIANT to use an arch version other
-# than mips64r6. Each value should correspond to a file named
-# $(BUILD_COMBOS)/arch/<name>.mk which must contain
-# makefile variable definitions. Their
-# purpose is to allow module Android.mk files to selectively compile
-# different versions of code based upon the funtionality and
-# instructions available in a given architecture version.
-#
-# The blocks also define specific arch_variant_cflags, which
-# include defines, and compiler settings for the given architecture
-# version.
-#
-ifeq ($(strip $(TARGET_ARCH_VARIANT)),)
-TARGET_ARCH_VARIANT := mips64r6
-endif
-
-include $(BUILD_SYSTEM)/combo/fdo.mk
-
-define $(combo_var_prefix)transform-shared-lib-to-toc
-$(call _gen_toc_command_for_elf,$(1),$(2))
-endef
-
-TARGET_PACK_MODULE_RELOCATIONS := true
-
-TARGET_LINKER := /system/bin/linker64
diff --git a/core/config.mk b/core/config.mk
index e887d93..eaabe64 100644
--- a/core/config.mk
+++ b/core/config.mk
@@ -127,6 +127,28 @@
)
$(KATI_obsolete_var PRODUCT_IOT)
$(KATI_obsolete_var MD5SUM)
+$(KATI_obsolete_var BOARD_HAL_STATIC_LIBRARIES, See $(CHANGES_URL)#BOARD_HAL_STATIC_LIBRARIES)
+$(KATI_obsolete_var LOCAL_HAL_STATIC_LIBRARIES, See $(CHANGES_URL)#BOARD_HAL_STATIC_LIBRARIES)
+$(KATI_obsolete_var \
+ TARGET_AUX_OS_VARIANT_LIST \
+ LOCAL_AUX_ARCH \
+ LOCAL_AUX_CPU \
+ LOCAL_AUX_OS \
+ LOCAL_AUX_OS_VARIANT \
+ LOCAL_AUX_SUBARCH \
+ LOCAL_AUX_TOOLCHAIN \
+ LOCAL_CUSTOM_BUILD_STEP_INPUT \
+ LOCAL_CUSTOM_BUILD_STEP_OUTPUT \
+ LOCAL_IS_AUX_MODULE \
+ ,AUX support has been removed)
+$(KATI_obsolete_var HOST_OUT_TEST_CONFIG TARGET_OUT_TEST_CONFIG LOCAL_TEST_CONFIG_OPTIONS)
+$(KATI_obsolete_var \
+ TARGET_PROJECT_INCLUDES \
+ 2ND_TARGET_PROJECT_INCLUDES \
+ TARGET_PROJECT_SYSTEM_INCLUDES \
+ 2ND_TARGET_PROJECT_SYSTEM_INCLUDES \
+ ,Project include variables have been removed)
+$(KATI_obsolete_var TARGET_PREFER_32_BIT TARGET_PREFER_32_BIT_APPS TARGET_PREFER_32_BIT_EXECUTABLES)
# Used to force goals to build. Only use for conditionally defined goals.
.PHONY: FORCE
@@ -175,8 +197,6 @@
BUILD_HOST_SHARED_LIBRARY :=$= $(BUILD_SYSTEM)/host_shared_library.mk
BUILD_STATIC_LIBRARY :=$= $(BUILD_SYSTEM)/static_library.mk
BUILD_HEADER_LIBRARY :=$= $(BUILD_SYSTEM)/header_library.mk
-BUILD_AUX_STATIC_LIBRARY :=$= $(BUILD_SYSTEM)/aux_static_library.mk
-BUILD_AUX_EXECUTABLE :=$= $(BUILD_SYSTEM)/aux_executable.mk
BUILD_SHARED_LIBRARY :=$= $(BUILD_SYSTEM)/shared_library.mk
BUILD_EXECUTABLE :=$= $(BUILD_SYSTEM)/executable.mk
BUILD_HOST_EXECUTABLE :=$= $(BUILD_SYSTEM)/host_executable.mk
@@ -191,23 +211,12 @@
BUILD_HOST_JAVA_LIBRARY :=$= $(BUILD_SYSTEM)/host_java_library.mk
BUILD_COPY_HEADERS :=$= $(BUILD_SYSTEM)/copy_headers.mk
BUILD_NATIVE_TEST :=$= $(BUILD_SYSTEM)/native_test.mk
-BUILD_NATIVE_BENCHMARK :=$= $(BUILD_SYSTEM)/native_benchmark.mk
-BUILD_HOST_NATIVE_TEST :=$= $(BUILD_SYSTEM)/host_native_test.mk
BUILD_FUZZ_TEST :=$= $(BUILD_SYSTEM)/fuzz_test.mk
-BUILD_HOST_FUZZ_TEST :=$= $(BUILD_SYSTEM)/host_fuzz_test.mk
-
-BUILD_SHARED_TEST_LIBRARY :=$= $(BUILD_SYSTEM)/shared_test_lib.mk
-BUILD_HOST_SHARED_TEST_LIBRARY :=$= $(BUILD_SYSTEM)/host_shared_test_lib.mk
-BUILD_STATIC_TEST_LIBRARY :=$= $(BUILD_SYSTEM)/static_test_lib.mk
-BUILD_HOST_STATIC_TEST_LIBRARY :=$= $(BUILD_SYSTEM)/host_static_test_lib.mk
BUILD_NOTICE_FILE :=$= $(BUILD_SYSTEM)/notice_files.mk
BUILD_HOST_DALVIK_JAVA_LIBRARY :=$= $(BUILD_SYSTEM)/host_dalvik_java_library.mk
BUILD_HOST_DALVIK_STATIC_JAVA_LIBRARY :=$= $(BUILD_SYSTEM)/host_dalvik_static_java_library.mk
-BUILD_HOST_TEST_CONFIG :=$= $(BUILD_SYSTEM)/host_test_config.mk
-BUILD_TARGET_TEST_CONFIG :=$= $(BUILD_SYSTEM)/target_test_config.mk
-
include $(BUILD_SYSTEM)/deprecation.mk
# ###############################################################
@@ -233,6 +242,36 @@
# Initialize SOONG_CONFIG_NAMESPACES so that it isn't recursive.
SOONG_CONFIG_NAMESPACES :=
+# The add_soong_config_namespace function adds a namespace and initializes it
+# to be empty.
+# $1 is the namespace.
+# Ex: $(call add_soong_config_namespace,acme)
+
+define add_soong_config_namespace
+$(eval SOONG_CONFIG_NAMESPACES += $1) \
+$(eval SOONG_CONFIG_$1 :=)
+endef
+
+# The add_soong_config_var function adds a a list of soong config variables to
+# SOONG_CONFIG_*. The variables and their values are then available to a
+# soong_config_module_type in an Android.bp file.
+# $1 is the namespace. $2 is the list of variables.
+# Ex: $(call add_soong_config_var,acme,COOL_FEATURE_A COOL_FEATURE_B)
+define add_soong_config_var
+$(eval SOONG_CONFIG_$1 += $2) \
+$(foreach v,$2,$(eval SOONG_CONFIG_$1_$v := $($v)))
+endef
+
+# The add_soong_config_var_value function defines a make variable and also adds
+# the variable to SOONG_CONFIG_*.
+# $1 is the namespace. $2 is the variable name. $3 is the variable value.
+# Ex: $(call add_soong_config_var_value,acme,COOL_FEATURE,true)
+
+define add_soong_config_var_value
+$(eval $2 := $3) \
+$(call add_soong_config_var,$1,$2)
+endef
+
# Set the extensions used for various packages
COMMON_PACKAGE_SUFFIX := .zip
COMMON_JAVA_PACKAGE_SUFFIX := .jar
@@ -344,11 +383,6 @@
include $(BUILD_SYSTEM)/rbe.mk
endif
-ifdef TARGET_PREFER_32_BIT
-TARGET_PREFER_32_BIT_APPS := true
-TARGET_PREFER_32_BIT_EXECUTABLES := true
-endif
-
# GCC version selection
TARGET_GCC_VERSION := 4.9
ifdef TARGET_2ND_ARCH
@@ -554,10 +588,11 @@
# prebuilts/build-tools/common/bison.
# To run bison from elsewhere you need to set up enviromental variable
# BISON_PKGDATADIR.
-BISON_PKGDATADIR := $(PWD)/prebuilts/build-tools/common/bison
+BISON_PKGDATADIR := $(prebuilt_build_tools)/common/bison
BISON := $(prebuilt_build_tools_bin_noasan)/bison
YACC := $(BISON) -d
BISON_DATA := $(wildcard $(BISON_PKGDATADIR)/* $(BISON_PKGDATADIR)/*/*)
+M4 :=$= $(prebuilt_build_tools_bin_noasan)/m4
YASM := prebuilts/misc/$(BUILD_OS)-$(HOST_PREBUILT_ARCH)/yasm/yasm
@@ -573,6 +608,7 @@
VTSC := $(HOST_OUT_EXECUTABLES)/vtsc$(HOST_EXECUTABLE_SUFFIX)
MKBOOTFS := $(HOST_OUT_EXECUTABLES)/mkbootfs$(HOST_EXECUTABLE_SUFFIX)
MINIGZIP := $(HOST_OUT_EXECUTABLES)/minigzip$(HOST_EXECUTABLE_SUFFIX)
+LZ4 := $(HOST_OUT_EXECUTABLES)/lz4$(HOST_EXECUTABLE_SUFFIX)
ifeq (,$(strip $(BOARD_CUSTOM_MKBOOTIMG)))
MKBOOTIMG := $(HOST_OUT_EXECUTABLES)/mkbootimg$(HOST_EXECUTABLE_SUFFIX)
else
@@ -609,6 +645,7 @@
MAKE_RECOVERY_PATCH := $(HOST_OUT_EXECUTABLES)/make_recovery_patch$(HOST_EXECUTABLE_SUFFIX)
OTA_FROM_TARGET_FILES := $(HOST_OUT_EXECUTABLES)/ota_from_target_files$(HOST_EXECUTABLE_SUFFIX)
SPARSE_IMG := $(HOST_OUT_EXECUTABLES)/sparse_img$(HOST_EXECUTABLE_SUFFIX)
+CHECK_PARTITION_SIZES := $(HOST_OUT_EXECUTABLES)/check_partition_sizes$(HOST_EXECUTABLE_SUFFIX)
PROGUARD_HOME := external/proguard
PROGUARD := $(PROGUARD_HOME)/bin/proguard.sh
@@ -634,14 +671,6 @@
EXTRACT_KERNEL := build/make/tools/extract_kernel.py
-USE_OPENJDK9 := true
-
-ifeq ($(EXPERIMENTAL_JAVA_LANGUAGE_LEVEL_9),)
-TARGET_OPENJDK9 :=
-else ifeq ($(EXPERIMENTAL_JAVA_LANGUAGE_LEVEL_9),true)
-TARGET_OPENJDK9 := true
-endif
-
# Path to tools.jar
HOST_JDK_TOOLS_JAR := $(ANDROID_JAVA8_HOME)/lib/tools.jar
@@ -721,19 +750,37 @@
PRODUCT_USE_VNDK := $(PRODUCT_USE_VNDK_OVERRIDE)
else ifeq ($(PRODUCT_SHIPPING_API_LEVEL),)
# No shipping level defined
-else ifeq ($(call math_gt_or_eq,27,$(PRODUCT_SHIPPING_API_LEVEL)),)
+else ifeq ($(call math_gt,$(PRODUCT_SHIPPING_API_LEVEL),27),true)
PRODUCT_USE_VNDK := $(PRODUCT_FULL_TREBLE)
endif
+# Define PRODUCT_PRODUCT_VNDK_VERSION if PRODUCT_USE_VNDK is true and
+# PRODUCT_SHIPPING_API_LEVEL is greater than 29.
+PRODUCT_USE_PRODUCT_VNDK := false
ifeq ($(PRODUCT_USE_VNDK),true)
+ ifneq ($(PRODUCT_USE_PRODUCT_VNDK_OVERRIDE),)
+ PRODUCT_USE_PRODUCT_VNDK := $(PRODUCT_USE_PRODUCT_VNDK_OVERRIDE)
+ else ifeq ($(PRODUCT_SHIPPING_API_LEVEL),)
+ # No shipping level defined
+ else ifeq ($(call math_gt,$(PRODUCT_SHIPPING_API_LEVEL),29),true)
+ PRODUCT_USE_PRODUCT_VNDK := true
+ endif
+
ifndef BOARD_VNDK_VERSION
BOARD_VNDK_VERSION := current
endif
+
+ ifeq ($(PRODUCT_USE_PRODUCT_VNDK),true)
+ ifndef PRODUCT_PRODUCT_VNDK_VERSION
+ PRODUCT_PRODUCT_VNDK_VERSION := current
+ endif
+ endif
endif
-$(KATI_obsolete_var PRODUCT_USE_VNDK_OVERRIDE,Use PRODUCT_USE_VNDK instead)
-.KATI_READONLY := \
- PRODUCT_USE_VNDK
+$(KATI_obsolete_var PRODUCT_USE_VNDK,Use BOARD_VNDK_VERSION instead)
+$(KATI_obsolete_var PRODUCT_USE_VNDK_OVERRIDE,Use BOARD_VNDK_VERSION instead)
+$(KATI_obsolete_var PRODUCT_USE_PRODUCT_VNDK,Use PRODUCT_PRODUCT_VNDK_VERSION instead)
+$(KATI_obsolete_var PRODUCT_USE_PRODUCT_VNDK_OVERRIDE,Use PRODUCT_PRODUCT_VNDK_VERSION instead)
# Set BOARD_SYSTEMSDK_VERSIONS to the latest SystemSDK version starting from P-launching
# devices if unset.
@@ -783,7 +830,7 @@
MAINLINE_SEPOLICY_DEV_CERTIFICATES := $(dir $(DEFAULT_SYSTEM_DEV_CERTIFICATE))
endif
-BUILD_NUMBER_FROM_FILE := $$(cat $(OUT_DIR)/build_number.txt)
+BUILD_NUMBER_FROM_FILE := $$(cat $(SOONG_OUT_DIR)/build_number.txt)
BUILD_DATETIME_FROM_FILE := $$(cat $(BUILD_DATETIME_FILE))
# SEPolicy versions
@@ -820,6 +867,7 @@
27.0 \
28.0 \
29.0 \
+ 30.0 \
.KATI_READONLY := \
PLATFORM_SEPOLICY_COMPAT_VERSIONS \
@@ -1020,16 +1068,6 @@
RELATIVE_PWD :=
endif
-TARGET_PROJECT_INCLUDES :=
-TARGET_PROJECT_SYSTEM_INCLUDES := \
- $(TARGET_DEVICE_KERNEL_HEADERS) $(TARGET_BOARD_KERNEL_HEADERS) \
- $(TARGET_PRODUCT_KERNEL_HEADERS)
-
-ifdef TARGET_2ND_ARCH
-$(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_PROJECT_INCLUDES := $(TARGET_PROJECT_INCLUDES)
-$(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_PROJECT_SYSTEM_INCLUDES := $(TARGET_PROJECT_SYSTEM_INCLUDES)
-endif
-
# Flags for DEX2OAT
first_non_empty_of_three = $(if $(1),$(1),$(if $(2),$(2),$(3)))
DEX2OAT_TARGET_ARCH := $(TARGET_ARCH)
@@ -1112,19 +1150,6 @@
TARGET_SDK_VERSIONS_WITHOUT_JAVA_18_SUPPORT := $(call numbers_less_than,24,$(TARGET_AVAILABLE_SDK_VERSIONS))
TARGET_SDK_VERSIONS_WITHOUT_JAVA_19_SUPPORT := $(call numbers_less_than,30,$(TARGET_AVAILABLE_SDK_VERSIONS))
-ifndef INTERNAL_PLATFORM_PRIVATE_API_FILE
-INTERNAL_PLATFORM_PRIVATE_API_FILE := $(TARGET_OUT_COMMON_INTERMEDIATES)/PACKAGING/private.txt
-endif
-ifndef INTERNAL_PLATFORM_PRIVATE_DEX_API_FILE
-INTERNAL_PLATFORM_PRIVATE_DEX_API_FILE := $(TARGET_OUT_COMMON_INTERMEDIATES)/PACKAGING/private-dex.txt
-endif
-ifndef INTERNAL_PLATFORM_SYSTEM_PRIVATE_API_FILE
-INTERNAL_PLATFORM_SYSTEM_PRIVATE_API_FILE := $(TARGET_OUT_COMMON_INTERMEDIATES)/PACKAGING/system-private.txt
-endif
-ifndef INTERNAL_PLATFORM_SYSTEM_PRIVATE_DEX_API_FILE
-INTERNAL_PLATFORM_SYSTEM_PRIVATE_DEX_API_FILE := $(TARGET_OUT_COMMON_INTERMEDIATES)/PACKAGING/system-private-dex.txt
-endif
-
# Missing optional uses-libraries so that the platform doesn't create build rules that depend on
# them.
INTERNAL_PLATFORM_MISSING_USES_LIBRARIES := \
@@ -1164,24 +1189,24 @@
$(filter $(ANDROID_WARNING_ALLOWED_PROJECTS),$(1)/)
endef
+GOMA_POOL :=
+RBE_POOL :=
+GOMA_OR_RBE_POOL :=
+# When goma or RBE are enabled, kati will be passed --default_pool=local_pool to put
+# most rules into the local pool. Explicitly set the pool to "none" for rules that
+# should be run outside the local pool, i.e. with -j500.
+ifneq (,$(filter-out false,$(USE_GOMA)))
+ GOMA_POOL := none
+ GOMA_OR_RBE_POOL := none
+else ifneq (,$(filter-out false,$(USE_RBE)))
+ RBE_POOL := none
+ GOMA_OR_RBE_POOL := none
+endif
+.KATI_READONLY := GOMA_POOL RBE_POOL GOMA_OR_RBE_POOL
+
# These goals don't need to collect and include Android.mks/CleanSpec.mks
# in the source tree.
dont_bother_goals := out \
- snod systemimage-nodeps \
- userdataimage-nodeps \
- cacheimage-nodeps \
- bptimage-nodeps \
- vnod vendorimage-nodeps \
- pnod productimage-nodeps \
- senod systemextimage-nodeps \
- onod odmimage-nodeps \
- systemotherimage-nodeps \
- ramdisk-nodeps \
- ramdisk_debug-nodeps \
- bootimage-nodeps \
- bootimage_debug-nodeps \
- recoveryimage-nodeps \
- vbmetaimage-nodeps \
product-graph dump-products
ifeq ($(CALLED_FROM_SETUP),true)
@@ -1194,4 +1219,7 @@
DEFAULT_DATA_OUT_MODULES := ltp $(ltp_packages) $(kselftest_modules)
.KATI_READONLY := DEFAULT_DATA_OUT_MODULES
+# Make RECORD_ALL_DEPS readonly.
+RECORD_ALL_DEPS :=$= $(filter true,$(RECORD_ALL_DEPS))
+
include $(BUILD_SYSTEM)/dumpvar.mk
diff --git a/core/config_sanitizers.mk b/core/config_sanitizers.mk
index 2439f79..c5cb91c 100644
--- a/core/config_sanitizers.mk
+++ b/core/config_sanitizers.mk
@@ -134,12 +134,6 @@
my_sanitize_diag := $(filter-out cfi,$(my_sanitize_diag))
endif
-# CFI needs gold linker, and mips toolchain does not have one.
-ifneq ($(filter mips mips64,$(TARGET_$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH)),)
- my_sanitize := $(filter-out cfi,$(my_sanitize))
- my_sanitize_diag := $(filter-out cfi,$(my_sanitize_diag))
-endif
-
# Disable sanitizers which need the UBSan runtime for host targets.
ifdef LOCAL_IS_HOST_MODULE
my_sanitize := $(filter-out cfi,$(my_sanitize))
@@ -182,7 +176,9 @@
my_shared_libraries += $($(LOCAL_2ND_ARCH_VAR_PREFIX)HWADDRESS_SANITIZER_RUNTIME_LIBRARY)
ifneq ($(filter EXECUTABLES NATIVE_TESTS,$(LOCAL_MODULE_CLASS)),)
ifeq ($(LOCAL_FORCE_STATIC_EXECUTABLE),true)
- my_static_libraries := $(my_static_libraries) $($(LOCAL_2ND_ARCH_VAR_PREFIX)HWADDRESS_SANITIZER_STATIC_LIBRARY)
+ my_static_libraries := $(my_static_libraries) \
+ $($(LOCAL_2ND_ARCH_VAR_PREFIX)HWADDRESS_SANITIZER_STATIC_LIBRARY) \
+ libdl
endif
endif
endif
@@ -376,8 +372,8 @@
my_cflags += $(HWADDRESS_SANITIZER_CONFIG_EXTRA_CFLAGS)
endif
-# Use minimal diagnostics when integer overflow is enabled; never do it for HOST or AUX modules
-ifeq ($(LOCAL_IS_HOST_MODULE)$(LOCAL_IS_AUX_MODULE),)
+# Use minimal diagnostics when integer overflow is enabled; never do it for HOST modules
+ifeq ($(LOCAL_IS_HOST_MODULE),)
# Pre-emptively add UBSAN minimal runtime incase a static library dependency requires it
ifeq ($(filter STATIC_LIBRARIES,$(LOCAL_MODULE_CLASS)),)
ifndef LOCAL_SDK_VERSION
diff --git a/core/construct_context.sh b/core/construct_context.sh
index 794795a..d620d08 100755
--- a/core/construct_context.sh
+++ b/core/construct_context.sh
@@ -67,6 +67,10 @@
add_to_contexts "${conditional_host_libs_29}" "${conditional_target_libs_29}"
fi
+if [[ "${target_sdk_version}" -lt "30" ]]; then
+ add_to_contexts "${conditional_host_libs_30}" "${conditional_target_libs_30}"
+fi
+
add_to_contexts "${dex_preopt_host_libraries}" "${dex_preopt_target_libraries}"
# Generate the actual context string.
diff --git a/core/copy_headers.mk b/core/copy_headers.mk
index c26d51d..054d271 100644
--- a/core/copy_headers.mk
+++ b/core/copy_headers.mk
@@ -4,15 +4,13 @@
###########################################################
$(call record-module-type,COPY_HEADERS)
ifneq ($(strip $(LOCAL_IS_HOST_MODULE)),)
- $(shell echo $(LOCAL_MODULE_MAKEFILE): $(LOCAL_MODULE): LOCAL_COPY_HEADERS may not be used with host modules >&2)
- $(error done)
+ $(call pretty-error,LOCAL_COPY_HEADERS may not be used with host modules)
endif
# Modules linking against the SDK do not have the include path to use
# COPY_HEADERS, so prevent them from exporting any either.
ifdef LOCAL_SDK_VERSION
-$(shell echo $(LOCAL_MODULE_MAKEFILE): $(LOCAL_MODULE): Modules using LOCAL_SDK_VERSION may not use LOCAL_COPY_HEADERS >&2)
-$(error done)
+ $(call pretty-error,Modules using LOCAL_SDK_VERSION may not use LOCAL_COPY_HEADERS)
endif
include $(BUILD_SYSTEM)/local_vndk.mk
@@ -22,11 +20,20 @@
# present.
ifdef BOARD_VNDK_VERSION
ifndef LOCAL_USE_VNDK
-$(shell echo $(LOCAL_MODULE_MAKEFILE): $(LOCAL_MODULE): Only vendor modules using LOCAL_USE_VNDK may use LOCAL_COPY_HEADERS >&2)
-$(error done)
+ $(call pretty-error,Only vendor modules using LOCAL_USE_VNDK may use LOCAL_COPY_HEADERS)
endif
endif
+# Clean up LOCAL_COPY_HEADERS_TO, since soong_ui will be comparing cleaned
+# paths to figure out which headers are obsolete and should be removed.
+LOCAL_COPY_HEADERS_TO := $(call clean-path,$(LOCAL_COPY_HEADERS_TO))
+ifneq ($(filter /% .. ../%,$(LOCAL_COPY_HEADERS_TO)),)
+ $(call pretty-error,LOCAL_COPY_HEADERS_TO may not start with / or ../ : $(LOCAL_COPY_HEADERS_TO))
+endif
+ifeq ($(LOCAL_COPY_HEADERS_TO),.)
+ LOCAL_COPY_HEADERS_TO :=
+endif
+
# Create a rule to copy each header, and make the
# all_copied_headers phony target depend on each
# destination header. copy-one-header defines the
diff --git a/core/cxx_stl_setup.mk b/core/cxx_stl_setup.mk
index 8e4a46c..a2abb1a 100644
--- a/core/cxx_stl_setup.mk
+++ b/core/cxx_stl_setup.mk
@@ -33,12 +33,6 @@
endif
endif
-# Yes, this is actually what the clang driver does.
-linux_dynamic_gcclibs := -lgcc_s -lgcc -lc -lgcc_s -lgcc
-linux_static_gcclibs := -Wl,--start-group -lgcc -lgcc_eh -lc -Wl,--end-group
-darwin_dynamic_gcclibs := -lc -lSystem
-darwin_static_gcclibs := NO_STATIC_HOST_BINARIES_ON_DARWIN
-
my_link_type := dynamic
ifdef LOCAL_IS_HOST_MODULE
ifneq (,$(BUILD_HOST_static))
@@ -79,28 +73,36 @@
ifdef LOCAL_IS_HOST_MODULE
my_cppflags += -nostdinc++
- my_ldflags += -nodefaultlibs
- my_cxx_ldlibs += $($($(my_prefix)OS)_$(my_link_type)_gcclibs)
+ my_ldflags += -nostdlib++
else
my_static_libraries += libc++demangle
- ifeq (arm,$($(my_prefix)$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH))
- my_static_libraries += libunwind_llvm
- my_ldflags += -Wl,--exclude-libs,libunwind_llvm.a
- endif
ifeq ($(my_link_type),static)
- my_static_libraries += libm libc libdl
+ my_static_libraries += libm libc
+ ifeq (arm,$($(my_prefix)$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH))
+ my_static_libraries += libunwind_llvm
+ my_ldflags += -Wl,--exclude-libs,libunwind_llvm.a
+ else
+ my_static_libraries += libgcc_stripped
+ my_ldflags += -Wl,--exclude-libs,libgcc_stripped.a
+ endif
endif
endif
else ifeq ($(my_cxx_stl),ndk)
- # Using an NDK STL. Handled in binary.mk.
+ # Using an NDK STL. Handled in binary.mk, except for the unwinder.
+ ifeq (arm,$($(my_prefix)$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH))
+ my_static_libraries += libunwind_llvm
+ my_ldflags += -Wl,--exclude-libs,libunwind_llvm.a
+ else
+ my_static_libraries += libgcc_stripped
+ my_ldflags += -Wl,--exclude-libs,libgcc_stripped.a
+ endif
else ifeq ($(my_cxx_stl),libstdc++)
$(error $(LOCAL_PATH): $(LOCAL_MODULE): libstdc++ is not supported)
else ifeq ($(my_cxx_stl),none)
ifdef LOCAL_IS_HOST_MODULE
my_cppflags += -nostdinc++
- my_ldflags += -nodefaultlibs
- my_cxx_ldlibs += $($($(my_prefix)OS)_$(my_link_type)_gcclibs)
+ my_ldflags += -nostdlib++
endif
else
$(error $(LOCAL_PATH): $(LOCAL_MODULE): $(my_cxx_stl) is not a supported STL.)
diff --git a/core/definitions.mk b/core/definitions.mk
index 1b27817..2bf1ba6 100644
--- a/core/definitions.mk
+++ b/core/definitions.mk
@@ -95,7 +95,6 @@
# Display names for various build targets
TARGET_DISPLAY := target
-AUX_DISPLAY := aux
HOST_DISPLAY := host
HOST_CROSS_DISPLAY := host cross
@@ -108,6 +107,21 @@
# All tests that should be skipped in presubmit check.
ALL_DISABLED_PRESUBMIT_TESTS :=
+# All compatibility suites mentioned in LOCAL_COMPATIBILITY_SUITES
+ALL_COMPATIBILITY_SUITES :=
+
+# All LINK_TYPE entries
+ALL_LINK_TYPES :=
+
+# All exported/imported include entries
+EXPORTS_LIST :=
+
+# All modules already converted to Soong
+SOONG_ALREADY_CONV :=
+
+# ALL_DEPS.*.ALL_DEPS keys
+ALL_DEPS.MODULES :=
+
###########################################################
## Debugging; prints a variable list to stdout
###########################################################
@@ -507,29 +521,32 @@
$(if $(1),$(call reverse-list,$(wordlist 2,$(words $(1)),$(1)))) $(firstword $(1))
endef
-define def-host-aux-target
-$(eval _idf_val_:=$(if $(strip $(LOCAL_IS_HOST_MODULE)),HOST,$(if $(strip $(LOCAL_IS_AUX_MODULE)),AUX,))) \
-$(_idf_val_)
-endef
-
###########################################################
## Returns correct _idfPrefix from the list:
-## { HOST, HOST_CROSS, AUX, TARGET }
+## { HOST, HOST_CROSS, TARGET }
###########################################################
# the following rules checked in order:
-# ($1 is in {AUX, HOST_CROSS} => $1;
+# ($1 is in {HOST_CROSS} => $1;
# ($1 is empty) => TARGET;
# ($2 is not empty) => HOST_CROSS;
# => HOST;
define find-idf-prefix
$(strip \
- $(eval _idf_pfx_:=$(strip $(filter AUX HOST_CROSS,$(1)))) \
+ $(eval _idf_pfx_:=$(strip $(filter HOST_CROSS,$(1)))) \
$(eval _idf_pfx_:=$(if $(strip $(1)),$(if $(_idf_pfx_),$(_idf_pfx_),$(if $(strip $(2)),HOST_CROSS,HOST)),TARGET)) \
$(_idf_pfx_)
)
endef
###########################################################
+## Convert install path to on-device path.
+###########################################################
+# $(1): install path
+define install-path-to-on-device-path
+$(patsubst $(PRODUCT_OUT)%,%,$(1))
+endef
+
+###########################################################
## The intermediates directory. Where object files go for
## a given target. We could technically get away without
## the "_intermediates" suffix on the directory, but it's
@@ -539,7 +556,7 @@
# $(1): target class, like "APPS"
# $(2): target name, like "NotePad"
-# $(3): { HOST, HOST_CROSS, AUX, <empty (TARGET)>, <other non-empty (HOST)> }
+# $(3): { HOST, HOST_CROSS, <empty (TARGET)>, <other non-empty (HOST)> }
# $(4): if non-empty, force the intermediates to be COMMON
# $(5): if non-empty, force the intermediates to be for the 2nd arch
# $(6): if non-empty, force the intermediates to be for the host cross os
@@ -553,7 +570,7 @@
$(error $(LOCAL_PATH): Name not defined in call to intermediates-dir-for)) \
$(eval _idfPrefix := $(call find-idf-prefix,$(3),$(6))) \
$(eval _idf2ndArchPrefix := $(if $(strip $(5)),$(TARGET_2ND_ARCH_VAR_PREFIX))) \
- $(if $(filter $(_idfPrefix)-$(_idfClass),$(COMMON_MODULE_CLASSES))$(4), \
+ $(if $(filter $(_idfPrefix)_$(_idfClass),$(COMMON_MODULE_CLASSES))$(4), \
$(eval _idfIntBase := $($(_idfPrefix)_OUT_COMMON_INTERMEDIATES)) \
,$(if $(filter $(_idfClass),$(PER_ARCH_MODULE_CLASSES)),\
$(eval _idfIntBase := $($(_idf2ndArchPrefix)$(_idfPrefix)_OUT_INTERMEDIATES)) \
@@ -576,7 +593,7 @@
$(error $(LOCAL_PATH): LOCAL_MODULE_CLASS not defined before call to local-intermediates-dir)) \
$(if $(strip $(LOCAL_MODULE)),, \
$(error $(LOCAL_PATH): LOCAL_MODULE not defined before call to local-intermediates-dir)) \
- $(call intermediates-dir-for,$(LOCAL_MODULE_CLASS),$(LOCAL_MODULE),$(call def-host-aux-target),$(1),$(2),$(3)) \
+ $(call intermediates-dir-for,$(LOCAL_MODULE_CLASS),$(LOCAL_MODULE),$(if $(strip $(LOCAL_IS_HOST_MODULE)),HOST),$(1),$(2),$(3)) \
)
endef
@@ -591,7 +608,7 @@
# $(1): target class, like "APPS"
# $(2): target name, like "NotePad"
-# $(3): { HOST, HOST_CROSS, AUX, <empty (TARGET)>, <other non-empty (HOST)> }
+# $(3): { HOST, HOST_CROSS, <empty (TARGET)>, <other non-empty (HOST)> }
# $(4): if non-empty, force the generated sources to be COMMON
define generated-sources-dir-for
$(strip \
@@ -602,7 +619,7 @@
$(if $(_idfName),, \
$(error $(LOCAL_PATH): Name not defined in call to generated-sources-dir-for)) \
$(eval _idfPrefix := $(call find-idf-prefix,$(3),)) \
- $(if $(filter $(_idfPrefix)-$(_idfClass),$(COMMON_MODULE_CLASSES))$(4), \
+ $(if $(filter $(_idfPrefix)_$(_idfClass),$(COMMON_MODULE_CLASSES))$(4), \
$(eval _idfIntBase := $($(_idfPrefix)_OUT_COMMON_GEN)) \
, \
$(eval _idfIntBase := $($(_idfPrefix)_OUT_GEN)) \
@@ -621,7 +638,7 @@
$(error $(LOCAL_PATH): LOCAL_MODULE_CLASS not defined before call to local-generated-sources-dir)) \
$(if $(strip $(LOCAL_MODULE)),, \
$(error $(LOCAL_PATH): LOCAL_MODULE not defined before call to local-generated-sources-dir)) \
- $(call generated-sources-dir-for,$(LOCAL_MODULE_CLASS),$(LOCAL_MODULE),$(call def-host-aux-target),$(1)) \
+ $(call generated-sources-dir-for,$(LOCAL_MODULE_CLASS),$(LOCAL_MODULE),$(if $(strip $(LOCAL_IS_HOST_MODULE)),HOST),$(1)) \
)
endef
@@ -886,7 +903,7 @@
define transform-l-to-c-or-cpp
@echo "Lex: $(PRIVATE_MODULE) <= $<"
@mkdir -p $(dir $@)
-$(hide) $(LEX) -o$@ $<
+M4=$(M4) $(LEX) -o$@ $<
endef
###########################################################
@@ -897,7 +914,7 @@
define transform-y-to-c-or-cpp
@echo "Yacc: $(PRIVATE_MODULE) <= $<"
@mkdir -p $(dir $@)
-$(YACC) $(PRIVATE_YACCFLAGS) \
+M4=$(M4) $(YACC) $(PRIVATE_YACCFLAGS) \
--defines=$(basename $@).h \
-o $@ $<
endef
@@ -1363,8 +1380,10 @@
# $(1): the C++ source file in LOCAL_SRC_FILES.
# $(2): the additional dependencies.
# $(3): the variable name to collect the output object file.
+# $(4): the ninja pool to use for the rule
define compile-dotdot-cpp-file
o := $(intermediates)/$(patsubst %$(LOCAL_CPP_EXTENSION),%.o,$(subst ../,$(DOTDOT_REPLACEMENT),$(1)))
+$$(o) : .KATI_NINJA_POOL := $(4)
$$(o) : $(TOPDIR)$(LOCAL_PATH)/$(1) $(2) $(CLANG_CXX)
$$(transform-$$(PRIVATE_HOST)cpp-to-o)
$$(call include-depfiles-for-objs, $$(o))
@@ -1376,8 +1395,10 @@
# $(1): the C source file in LOCAL_SRC_FILES.
# $(2): the additional dependencies.
# $(3): the variable name to collect the output object file.
+# $(4): the ninja pool to use for the rule
define compile-dotdot-c-file
o := $(intermediates)/$(patsubst %.c,%.o,$(subst ../,$(DOTDOT_REPLACEMENT),$(1)))
+$$(o) : .KATI_NINJA_POOL := $(4)
$$(o) : $(TOPDIR)$(LOCAL_PATH)/$(1) $(2) $(CLANG)
$$(transform-$$(PRIVATE_HOST)c-to-o)
$$(call include-depfiles-for-objs, $$(o))
@@ -1389,8 +1410,10 @@
# $(1): the .S source file in LOCAL_SRC_FILES.
# $(2): the additional dependencies.
# $(3): the variable name to collect the output object file.
+# $(4): the ninja pool to use for the rule
define compile-dotdot-s-file
o := $(intermediates)/$(patsubst %.S,%.o,$(subst ../,$(DOTDOT_REPLACEMENT),$(1)))
+$$(o) : .KATI_NINJA_POOL := $(4)
$$(o) : $(TOPDIR)$(LOCAL_PATH)/$(1) $(2) $(CLANG)
$$(transform-$$(PRIVATE_HOST)s-to-o)
$$(call include-depfiles-for-objs, $$(o))
@@ -1402,8 +1425,10 @@
# $(1): the .s source file in LOCAL_SRC_FILES.
# $(2): the additional dependencies.
# $(3): the variable name to collect the output object file.
+# $(4): the ninja pool to use for the rule
define compile-dotdot-s-file-no-deps
o := $(intermediates)/$(patsubst %.s,%.o,$(subst ../,$(DOTDOT_REPLACEMENT),$(1)))
+$$(o) : .KATI_NINJA_POOL := $(4)
$$(o) : $(TOPDIR)$(LOCAL_PATH)/$(1) $(2) $(CLANG)
$$(transform-$$(PRIVATE_HOST)s-to-o)
$(3) += $$(o)
@@ -1488,89 +1513,6 @@
$(hide) mv -f $@.tmp $@
endef
-# $(1): the full path of the source static library.
-# $(2): the full path of the destination static library.
-define _extract-and-include-single-aux-whole-static-lib
-$(hide) ldir=$(PRIVATE_INTERMEDIATES_DIR)/WHOLE/$(basename $(notdir $(1)))_objs;\
- rm -rf $$ldir; \
- mkdir -p $$ldir; \
- cp $(1) $$ldir; \
- lib_to_include=$$ldir/$(notdir $(1)); \
- filelist=; \
- subdir=0; \
- for f in `$(PRIVATE_AR) t $(1)`; do \
- if [ -e $$ldir/$$f ]; then \
- mkdir $$ldir/$$subdir; \
- ext=$$subdir/; \
- subdir=$$((subdir+1)); \
- $(PRIVATE_AR) m $$lib_to_include $$f; \
- else \
- ext=; \
- fi; \
- $(PRIVATE_AR) p $$lib_to_include $$f > $$ldir/$$ext$$f; \
- filelist="$$filelist $$ldir/$$ext$$f"; \
- done ; \
- $(PRIVATE_AR) $(AUX_GLOBAL_ARFLAGS) $(2) $$filelist
-
-endef
-
-define extract-and-include-aux-whole-static-libs
-$(call extract-and-include-whole-static-libs-first, $(firstword $(PRIVATE_ALL_WHOLE_STATIC_LIBRARIES)),$(1))
-$(foreach lib,$(wordlist 2,999,$(PRIVATE_ALL_WHOLE_STATIC_LIBRARIES)), \
- $(call _extract-and-include-single-aux-whole-static-lib, $(lib), $(1)))
-endef
-
-# Explicitly delete the archive first so that ar doesn't
-# try to add to an existing archive.
-define transform-o-to-aux-static-lib
-@echo "$($(PRIVATE_PREFIX)DISPLAY) StaticLib: $(PRIVATE_MODULE) ($@)"
-@mkdir -p $(dir $@)
-@rm -f $@ $@.tmp
-$(call extract-and-include-aux-whole-static-libs,$@.tmp)
-$(call split-long-arguments,$(PRIVATE_AR) \
- $(AUX_GLOBAL_ARFLAGS) $@.tmp,$(PRIVATE_ALL_OBJECTS))
-$(hide) mv -f $@.tmp $@
-endef
-
-define transform-o-to-aux-executable-inner
-$(hide) $(PRIVATE_CXX_LINK) -pie \
- -Bdynamic \
- -Wl,--gc-sections \
- $(PRIVATE_ALL_OBJECTS) \
- -Wl,--whole-archive \
- $(PRIVATE_ALL_WHOLE_STATIC_LIBRARIES) \
- -Wl,--no-whole-archive \
- $(PRIVATE_ALL_STATIC_LIBRARIES) \
- $(PRIVATE_LDFLAGS) \
- -o $@
-endef
-
-define transform-o-to-aux-executable
-@echo "$(AUX_DISPLAY) Executable: $(PRIVATE_MODULE) ($@)"
-@mkdir -p $(dir $@)
-$(transform-o-to-aux-executable-inner)
-endef
-
-define transform-o-to-aux-static-executable-inner
-$(hide) $(PRIVATE_CXX_LINK) \
- -Bstatic \
- -Wl,--gc-sections \
- $(PRIVATE_ALL_OBJECTS) \
- -Wl,--whole-archive \
- $(PRIVATE_ALL_WHOLE_STATIC_LIBRARIES) \
- -Wl,--no-whole-archive \
- $(PRIVATE_ALL_STATIC_LIBRARIES) \
- $(PRIVATE_LDFLAGS) \
- -Wl,-Map=$(@).map \
- -o $@
-endef
-
-define transform-o-to-aux-static-executable
-@echo "$(AUX_DISPLAY) StaticExecutable: $(PRIVATE_MODULE) ($@)"
-@mkdir -p $(dir $@)
-$(transform-o-to-aux-static-executable-inner)
-endef
-
###########################################################
## Commands for running host ar
###########################################################
@@ -1709,7 +1651,6 @@
$(if $(filter true,$(NATIVE_COVERAGE)),$(PRIVATE_TARGET_COVERAGE_LIB)) \
$(PRIVATE_TARGET_LIBCRT_BUILTINS) \
$(PRIVATE_TARGET_LIBATOMIC) \
- $(PRIVATE_TARGET_LIBGCC) \
$(PRIVATE_TARGET_GLOBAL_LDFLAGS) \
$(PRIVATE_LDFLAGS) \
$(PRIVATE_ALL_SHARED_LIBRARIES) \
@@ -1745,7 +1686,6 @@
$(if $(filter true,$(NATIVE_COVERAGE)),$(PRIVATE_TARGET_COVERAGE_LIB)) \
$(PRIVATE_TARGET_LIBCRT_BUILTINS) \
$(PRIVATE_TARGET_LIBATOMIC) \
- $(PRIVATE_TARGET_LIBGCC) \
$(PRIVATE_TARGET_GLOBAL_LDFLAGS) \
$(PRIVATE_LDFLAGS) \
$(PRIVATE_ALL_SHARED_LIBRARIES) \
@@ -1792,7 +1732,6 @@
$(PRIVATE_TARGET_LIBATOMIC) \
$(filter %libcompiler_rt.a %libcompiler_rt.hwasan.a,$(PRIVATE_ALL_STATIC_LIBRARIES)) \
$(PRIVATE_TARGET_LIBCRT_BUILTINS) \
- $(PRIVATE_TARGET_LIBGCC) \
-Wl,--end-group \
$(PRIVATE_TARGET_CRTEND_O)
endef
@@ -2085,7 +2024,7 @@
$(if $(PRIVATE_JAR_EXCLUDE_PACKAGES), $(hide) rm -rf \
$(foreach pkg, $(PRIVATE_JAR_EXCLUDE_PACKAGES), \
$(PRIVATE_CLASS_INTERMEDIATES_DIR)/$(subst .,/,$(pkg))))
-$(hide) $(JAR) -cf $@ $(call jar-args-sorted-files-in-directory,$(PRIVATE_CLASS_INTERMEDIATES_DIR))
+$(hide) $(SOONG_ZIP) -jar -o $@ -C $(PRIVATE_CLASS_INTERMEDIATES_DIR) -D $(PRIVATE_CLASS_INTERMEDIATES_DIR)
$(if $(PRIVATE_EXTRA_JAR_ARGS),$(call add-java-resources-to,$@))
endef
@@ -2099,8 +2038,12 @@
--output $@.premerged --temp_dir $(dir $@)/classes-turbine \
--sources \@$(PRIVATE_JAVA_SOURCE_LIST) --source_jars $(PRIVATE_SRCJARS) \
--javacopts $(PRIVATE_JAVACFLAGS) $(COMMON_JDK_FLAGS) -- \
- $(addprefix --bootclasspath ,$(strip $(PRIVATE_BOOTCLASSPATH))) \
- $(addprefix --classpath ,$(strip $(PRIVATE_ALL_JAVA_HEADER_LIBRARIES))) \
+ $(if $(PRIVATE_USE_SYSTEM_MODULES), \
+ --system $(PRIVATE_SYSTEM_MODULES_DIR), \
+ --bootclasspath $(strip $(PRIVATE_BOOTCLASSPATH))) \
+ --classpath $(strip $(if $(PRIVATE_USE_SYSTEM_MODULES), \
+ $(filter-out $(PRIVATE_SYSTEM_MODULES_LIBS),$(PRIVATE_BOOTCLASSPATH))) \
+ $(PRIVATE_ALL_JAVA_HEADER_LIBRARIES)) \
|| ( rm -rf $(dir $@)/classes-turbine ; exit 41 ) && \
$(MERGE_ZIPS) -j --ignore-duplicates -stripDir META-INF $@.tmp $@.premerged $(PRIVATE_STATIC_JAVA_HEADER_LIBRARIES) ; \
else \
@@ -2185,17 +2128,19 @@
define transform-classes.jar-to-dex
@echo "target Dex: $(PRIVATE_MODULE)"
-@mkdir -p $(dir $@)
+@mkdir -p $(dir $@)tmp
$(hide) rm -f $(dir $@)classes*.dex $(dir $@)d8_input.jar
$(hide) $(ZIP2ZIP) -j -i $< -o $(dir $@)d8_input.jar "**/*.class"
-$(hide) $(DX_COMMAND) $(DEX_FLAGS) \
- --output $(dir $@) \
+$(hide) $(D8_WRAPPER) $(DX_COMMAND) $(DEX_FLAGS) \
+ --output $(dir $@)tmp \
$(addprefix --lib ,$(PRIVATE_D8_LIBS)) \
--min-api $(PRIVATE_MIN_SDK_VERSION) \
$(subst --main-dex-list=, --main-dex-list , \
$(filter-out --core-library --multi-dex --minimal-main-dex,$(PRIVATE_DX_FLAGS))) \
$(dir $@)d8_input.jar
+$(hide) mv $(dir $@)tmp/* $(dir $@)
$(hide) rm -f $(dir $@)d8_input.jar
+$(hide) rm -rf $(dir $@)tmp
endef
# We need the extra blank line, so that the command will be on a separate line.
@@ -2271,6 +2216,7 @@
define sign-package-arg
$(hide) mv $(1) $(1).unsigned
$(hide) $(JAVA) -Djava.library.path=$$(dirname $(SIGNAPK_JNI_LIBRARY_PATH)) -jar $(SIGNAPK_JAR) \
+ $(if $(strip $(PRIVATE_CERTIFICATE_LINEAGE)), --lineage $(PRIVATE_CERTIFICATE_LINEAGE)) \
$(PRIVATE_CERTIFICATE) $(PRIVATE_PRIVATE_KEY) \
$(PRIVATE_ADDITIONAL_CERTIFICATES) $(1).unsigned $(1).signed
$(hide) mv $(1).signed $(1)
@@ -2279,7 +2225,7 @@
# Align STORED entries of a package on 4-byte boundaries to make them easier to mmap.
#
define align-package
-$(hide) if ! $(ZIPALIGN) -c $(ZIPALIGN_PAGE_ALIGN_FLAGS) 4 $@ >/dev/null ; then \
+$(hide) if ! $(ZIPALIGN) -c -p 4 $@ >/dev/null ; then \
mv $@ $@.unaligned; \
$(ZIPALIGN) \
-f \
@@ -2454,17 +2400,26 @@
$(2): \
$(1) \
$(HOST_INIT_VERIFIER) \
- $(HIDL_INHERITANCE_HIERARCHY) \
$(call intermediates-dir-for,ETC,passwd_system)/passwd_system \
$(call intermediates-dir-for,ETC,passwd_vendor)/passwd_vendor \
$(call intermediates-dir-for,ETC,passwd_odm)/passwd_odm \
- $(call intermediates-dir-for,ETC,passwd_product)/passwd_product
+ $(call intermediates-dir-for,ETC,passwd_product)/passwd_product \
+ $(call intermediates-dir-for,ETC,plat_property_contexts)/plat_property_contexts \
+ $(call intermediates-dir-for,ETC,system_ext_property_contexts)/system_ext_property_contexts \
+ $(call intermediates-dir-for,ETC,product_property_contexts)/product_property_contexts \
+ $(call intermediates-dir-for,ETC,vendor_property_contexts)/vendor_property_contexts \
+ $(call intermediates-dir-for,ETC,odm_property_contexts)/odm_property_contexts
$(hide) $(HOST_INIT_VERIFIER) \
-p $(call intermediates-dir-for,ETC,passwd_system)/passwd_system \
-p $(call intermediates-dir-for,ETC,passwd_vendor)/passwd_vendor \
-p $(call intermediates-dir-for,ETC,passwd_odm)/passwd_odm \
-p $(call intermediates-dir-for,ETC,passwd_product)/passwd_product \
- -i $(HIDL_INHERITANCE_HIERARCHY) $$<
+ --property-contexts=$(call intermediates-dir-for,ETC,plat_property_contexts)/plat_property_contexts \
+ --property-contexts=$(call intermediates-dir-for,ETC,system_ext_property_contexts)/system_ext_property_contexts \
+ --property-contexts=$(call intermediates-dir-for,ETC,product_property_contexts)/product_property_contexts \
+ --property-contexts=$(call intermediates-dir-for,ETC,vendor_property_contexts)/vendor_property_contexts \
+ --property-contexts=$(call intermediates-dir-for,ETC,odm_property_contexts)/odm_property_contexts \
+ $$<
else
$(2): $(1)
endif
@@ -2528,6 +2483,22 @@
$(_cmf_dest)))
endef
+# Copy the file only if it's not an ELF file. For use via $(eval).
+# $(1): source file
+# $(2): destination file
+# $(3): message to print on error
+define copy-non-elf-file-checked
+$(2): $(1) $(LLVM_READOBJ)
+ @echo "Copy non-ELF: $$@"
+ $(hide) \
+ if $(LLVM_READOBJ) -h $$< >/dev/null 2>&1; then \
+ $(call echo-error,$$@,$(3)); \
+ $(call echo-error,$$@,found ELF file: $$<); \
+ false; \
+ fi
+ $$(copy-file-to-target)
+endef
+
# The -t option to acp and the -p option to cp is
# required for OSX. OSX has a ridiculous restriction
# where it's an error for a .a file's modification time
@@ -2604,17 +2575,15 @@
endef
# Define a rule to create a symlink to a file.
-# $(1): full path to source
+# $(1): any dependencies
# $(2): source (may be relative)
# $(3): full path to destination
define symlink-file
$(eval $(_symlink-file))
endef
-# Order-only dependency because make/ninja will follow the link when checking
-# the timestamp, so the file must exist
define _symlink-file
-$(3): | $(1)
+$(3): $(1)
@echo "Symlink: $$@ -> $(2)"
@mkdir -p $(dir $$@)
@rm -rf $$@
@@ -2660,7 +2629,7 @@
define transform-jar-to-dex-r8
@echo R8: $@
$(hide) rm -f $(PRIVATE_PROGUARD_DICTIONARY)
-$(hide) $(R8_COMPAT_PROGUARD) $(DEX_FLAGS) \
+$(hide) $(R8_WRAPPER) $(R8_COMPAT_PROGUARD) $(DEX_FLAGS) \
-injars '$<' \
--min-api $(PRIVATE_MIN_SDK_VERSION) \
--no-data-resources \
@@ -2744,32 +2713,6 @@
$$(transform-prebuilt-to-target)
endef
-
-###########################################################
-## API Check
-###########################################################
-
-# eval this to define a rule that runs apicheck.
-#
-# Args:
-# $(1) target
-# $(2) stable api file
-# $(3) api file to be tested
-# $(4) stable removed api file
-# $(5) removed api file to be tested
-# $(6) arguments for apicheck
-# $(7) command to run if apicheck failed
-# $(8) target dependent on this api check
-# $(9) additional dependencies
-define check-api
-$(TARGET_OUT_COMMON_INTERMEDIATES)/PACKAGING/$(strip $(1))-timestamp: $(2) $(3) $(4) $(APICHECK) $(9)
- @echo "Checking API:" $(1)
- $(hide) ( $(APICHECK_COMMAND) --check-api-files $(6) $(2) $(3) $(4) $(5) || ( $(7) ; exit 38 ) )
- $(hide) mkdir -p $$(dir $$@)
- $(hide) touch $$@
-$(8): $(TARGET_OUT_COMMON_INTERMEDIATES)/PACKAGING/$(strip $(1))-timestamp
-endef
-
## Whether to build from source if prebuilt alternative exists
###########################################################
# $(1): module name
@@ -2873,11 +2816,15 @@
# and use my_compat_dist_$(suite) to define the others.
define create-suite-dependencies
$(foreach suite, $(LOCAL_COMPATIBILITY_SUITE), \
- $(eval COMPATIBILITY.$(suite).FILES := \
- $$(COMPATIBILITY.$(suite).FILES) $$(foreach f,$$(my_compat_dist_$(suite)),$$(call word-colon,2,$$(f))) \
- $$(foreach f,$$(my_compat_dist_config_$(suite)),$$(call word-colon,2,$$(f)))) \
- $(eval COMPATIBILITY.$(suite).MODULES := \
- $$(COMPATIBILITY.$(suite).MODULES) $$(my_register_name))) \
+ $(if $(filter $(suite),$(ALL_COMPATIBILITY_SUITES)),,\
+ $(eval ALL_COMPATIBILITY_SUITES += $(suite)) \
+ $(eval COMPATIBILITY.$(suite).FILES :=) \
+ $(eval COMPATIBILITY.$(suite).MODULES :=)) \
+ $(eval COMPATIBILITY.$(suite).FILES += \
+ $$(foreach f,$$(my_compat_dist_$(suite)),$$(call word-colon,2,$$(f))) \
+ $$(foreach f,$$(my_compat_dist_config_$(suite)),$$(call word-colon,2,$$(f))) \
+ $$(my_compat_dist_test_data_$(suite))) \
+ $(eval COMPATIBILITY.$(suite).MODULES += $$(my_register_name))) \
$(eval $(my_all_targets) : $(call copy-many-files, \
$(sort $(foreach suite,$(LOCAL_COMPATIBILITY_SUITE),$(my_compat_dist_$(suite))))) \
$(call copy-many-xml-files-checked, \
@@ -3293,3 +3240,9 @@
XZ="$(XZ)" \
$(LIBRARY_IDENTITY_CHECK_SCRIPT) $(SOONG_STRIP_PATH) $(1) $(2)
endef
+
+# Convert Soong libraries that have SDK variant
+define use_soong_sdk_libraries
+ $(foreach l,$(1),$(if $(filter $(l),$(SOONG_SDK_VARIANT_MODULES)),\
+ $(l).sdk,$(l)))
+endef
diff --git a/core/deprecation.mk b/core/deprecation.mk
index 761a9b6..2b7a869 100644
--- a/core/deprecation.mk
+++ b/core/deprecation.mk
@@ -1,15 +1,12 @@
# These module types can still be used without warnings or errors.
AVAILABLE_BUILD_MODULE_TYPES :=$= \
- BUILD_COPY_HEADERS \
BUILD_EXECUTABLE \
BUILD_FUZZ_TEST \
BUILD_HEADER_LIBRARY \
BUILD_HOST_DALVIK_JAVA_LIBRARY \
BUILD_HOST_DALVIK_STATIC_JAVA_LIBRARY \
- BUILD_HOST_EXECUTABLE \
BUILD_HOST_JAVA_LIBRARY \
BUILD_HOST_PREBUILT \
- BUILD_HOST_SHARED_LIBRARY \
BUILD_JAVA_LIBRARY \
BUILD_MULTI_PREBUILT \
BUILD_NATIVE_TEST \
@@ -27,27 +24,30 @@
# relevant BUILD_BROKEN_USES_BUILD_* variables, then these would move to
# DEFAULT_ERROR_BUILD_MODULE_TYPES.
DEFAULT_WARNING_BUILD_MODULE_TYPES :=$= \
- BUILD_HOST_STATIC_LIBRARY \
# These are BUILD_* variables that are errors to reference, but you can set
# BUILD_BROKEN_USES_BUILD_* in your BoardConfig.mk in order to turn them back
# to warnings.
DEFAULT_ERROR_BUILD_MODULE_TYPES :=$= \
- BUILD_AUX_EXECUTABLE \
- BUILD_AUX_STATIC_LIBRARY \
- BUILD_HOST_FUZZ_TEST \
- BUILD_HOST_NATIVE_TEST \
- BUILD_HOST_STATIC_TEST_LIBRARY \
- BUILD_HOST_TEST_CONFIG \
- BUILD_NATIVE_BENCHMARK \
- BUILD_STATIC_TEST_LIBRARY \
- BUILD_TARGET_TEST_CONFIG \
+ BUILD_COPY_HEADERS \
+ BUILD_HOST_EXECUTABLE \
+ BUILD_HOST_SHARED_LIBRARY \
+ BUILD_HOST_STATIC_LIBRARY \
# These are BUILD_* variables that are always errors to reference.
# Setting the BUILD_BROKEN_USES_BUILD_* variables is also an error.
OBSOLETE_BUILD_MODULE_TYPES :=$= \
+ BUILD_AUX_EXECUTABLE \
+ BUILD_AUX_STATIC_LIBRARY \
+ BUILD_HOST_FUZZ_TEST \
+ BUILD_HOST_NATIVE_TEST \
BUILD_HOST_SHARED_TEST_LIBRARY \
+ BUILD_HOST_STATIC_TEST_LIBRARY \
+ BUILD_HOST_TEST_CONFIG \
+ BUILD_NATIVE_BENCHMARK \
BUILD_SHARED_TEST_LIBRARY \
+ BUILD_STATIC_TEST_LIBRARY \
+ BUILD_TARGET_TEST_CONFIG \
$(foreach m,$(OBSOLETE_BUILD_MODULE_TYPES),\
$(KATI_obsolete_var $(m),Please convert to Soong) \
diff --git a/core/dex_preopt.mk b/core/dex_preopt.mk
index 32690fef..20b4051 100644
--- a/core/dex_preopt.mk
+++ b/core/dex_preopt.mk
@@ -18,9 +18,35 @@
ALL_DEFAULT_INSTALLED_MODULES += $(call copy-many-files,$(DEXPREOPT_IMAGE_PROFILE_BUILT_INSTALLED),$(PRODUCT_OUT))
# Install boot images. Note that there can be multiple.
+my_boot_image_arch := TARGET_ARCH
+my_boot_image_out := $(PRODUCT_OUT)
+my_boot_image_syms := $(TARGET_OUT_UNSTRIPPED)
+my_boot_image_root := DEFAULT_DEX_PREOPT_INSTALLED_IMAGE
DEFAULT_DEX_PREOPT_INSTALLED_IMAGE :=
-$(TARGET_2ND_ARCH_VAR_PREFIX)DEFAULT_DEX_PREOPT_INSTALLED_IMAGE :=
$(foreach my_boot_image_name,$(DEXPREOPT_IMAGE_NAMES),$(eval include $(BUILD_SYSTEM)/dex_preopt_libart.mk))
+ifdef TARGET_2ND_ARCH
+ my_boot_image_arch := TARGET_2ND_ARCH
+ my_boot_image_root := 2ND_DEFAULT_DEX_PREOPT_INSTALLED_IMAGE
+ 2ND_DEFAULT_DEX_PREOPT_INSTALLED_IMAGE :=
+ $(foreach my_boot_image_name,$(DEXPREOPT_IMAGE_NAMES),$(eval include $(BUILD_SYSTEM)/dex_preopt_libart.mk))
+endif
+# Install boot images for testing on host. We exclude framework image as it is not part of art manifest.
+my_boot_image_arch := HOST_ARCH
+my_boot_image_out := $(HOST_OUT)
+my_boot_image_syms := $(HOST_OUT)/symbols
+my_boot_image_root := HOST_BOOT_IMAGE
+HOST_BOOT_IMAGE :=
+$(foreach my_boot_image_name,art_host,$(eval include $(BUILD_SYSTEM)/dex_preopt_libart.mk))
+ifdef HOST_2ND_ARCH
+ my_boot_image_arch := HOST_2ND_ARCH
+ my_boot_image_root := 2ND_HOST_BOOT_IMAGE
+ 2ND_HOST_BOOT_IMAGE :=
+ $(foreach my_boot_image_name,art_host,$(eval include $(BUILD_SYSTEM)/dex_preopt_libart.mk))
+endif
+my_boot_image_arch :=
+my_boot_image_out :=
+my_boot_image_syms :=
+my_boot_image_root :=
# Build the boot.zip which contains the boot jars and their compilation output
# We can do this only if preopt is enabled and if the product uses libart config (which sets the
@@ -34,13 +60,13 @@
$(boot_zip): PRIVATE_BOOTCLASSPATH_JARS := $(bootclasspath_jars)
$(boot_zip): PRIVATE_SYSTEM_SERVER_JARS := $(system_server_jars)
-$(boot_zip): $(bootclasspath_jars) $(system_server_jars) $(SOONG_ZIP) $(MERGE_ZIPS) $(DEXPREOPT_IMAGE_ZIP_boot)
+$(boot_zip): $(bootclasspath_jars) $(system_server_jars) $(SOONG_ZIP) $(MERGE_ZIPS) $(DEXPREOPT_IMAGE_ZIP_boot) $(DEXPREOPT_IMAGE_ZIP_art)
@echo "Create boot package: $@"
rm -f $@
$(SOONG_ZIP) -o $@.tmp \
-C $(dir $(firstword $(PRIVATE_BOOTCLASSPATH_JARS)))/.. $(addprefix -f ,$(PRIVATE_BOOTCLASSPATH_JARS)) \
-C $(PRODUCT_OUT) $(addprefix -f ,$(PRIVATE_SYSTEM_SERVER_JARS))
- $(MERGE_ZIPS) $@ $@.tmp $(DEXPREOPT_IMAGE_ZIP_boot)
+ $(MERGE_ZIPS) $@ $@.tmp $(DEXPREOPT_IMAGE_ZIP_boot) $(DEXPREOPT_IMAGE_ZIP_art)
rm -f $@.tmp
$(call dist-for-goals, droidcore, $(boot_zip))
diff --git a/core/dex_preopt_config.mk b/core/dex_preopt_config.mk
index 69eaea1..7d7d526 100644
--- a/core/dex_preopt_config.mk
+++ b/core/dex_preopt_config.mk
@@ -1,10 +1,20 @@
DEX_PREOPT_CONFIG := $(SOONG_OUT_DIR)/dexpreopt.config
+ENABLE_PREOPT := true
+ifneq (true,$(filter true,$(WITH_DEXPREOPT)))
+ ENABLE_PREOPT :=
+else ifneq (true,$(filter true,$(PRODUCT_USES_DEFAULT_ART_CONFIG)))
+ ENABLE_PREOPT :=
+else ifneq (,$(TARGET_BUILD_APPS))
+ ENABLE_PREOPT :=
+endif
+
# The default value for LOCAL_DEX_PREOPT
DEX_PREOPT_DEFAULT ?= true
# The default filter for which files go into the system_other image (if it is
-# being used). To bundle everything one should set this to '%'
+# being used). Note that each pattern p here matches both '/<p>' and /system/<p>'.
+# To bundle everything one should set this to '%'.
SYSTEM_OTHER_ODEX_FILTER ?= \
app/% \
priv-app/% \
@@ -13,16 +23,9 @@
product/app/% \
product/priv-app/% \
-# The default values for pre-opting. To support the runtime module we ensure no dex files
-# get stripped.
-ifeq ($(PRODUCT_DEX_PREOPT_NEVER_ALLOW_STRIPPING),)
- PRODUCT_DEX_PREOPT_NEVER_ALLOW_STRIPPING := true
-endif
# Conditional to building on linux, as dex2oat currently does not work on darwin.
ifeq ($(HOST_OS),linux)
ifeq (eng,$(TARGET_BUILD_VARIANT))
- # Don't strip for quick development turnarounds.
- DEX_PREOPT_DEFAULT := nostripping
# For an eng build only pre-opt the boot image and system server. This gives reasonable performance
# and still allows a simple workflow: building in frameworks/base and syncing.
WITH_DEXPREOPT_BOOT_IMG_AND_SYSTEM_SERVER_ONLY ?= true
@@ -43,16 +46,6 @@
endif
endif
-# Default to debug version to help find bugs.
-# Set USE_DEX2OAT_DEBUG to false for only building non-debug versions.
-ifeq ($(USE_DEX2OAT_DEBUG),false)
-DEX2OAT := $(SOONG_HOST_OUT_EXECUTABLES)/dex2oat$(HOST_EXECUTABLE_SUFFIX)
-else
-DEX2OAT := $(SOONG_HOST_OUT_EXECUTABLES)/dex2oatd$(HOST_EXECUTABLE_SUFFIX)
-endif
-
-DEX2OAT_DEPENDENCY += $(DEX2OAT)
-
# Use the first preloaded-classes file in PRODUCT_COPY_FILES.
PRELOADED_CLASSES := $(call word-colon,1,$(firstword \
$(filter %system/etc/preloaded-classes,$(PRODUCT_COPY_FILES))))
@@ -72,56 +65,45 @@
DEX2OAT_XMS := $(call get-product-default-property,dalvik.vm.dex2oat-Xms)
DEX2OAT_XMX := $(call get-product-default-property,dalvik.vm.dex2oat-Xmx)
-ifeq ($(TARGET_ARCH),$(filter $(TARGET_ARCH),mips mips64))
-# MIPS specific overrides.
-# For MIPS the ART image is loaded at a lower address. This causes issues
-# with the image overlapping with memory on the host cross-compiling and
-# building the image. We therefore limit the Xmx value. This isn't done
-# via a property as we want the larger Xmx value if we're running on a
-# MIPS device.
-DEX2OAT_XMX := 128m
-endif
-
ifeq ($(WRITE_SOONG_VARIABLES),true)
$(call json_start)
- $(call add_json_bool, DefaultNoStripping, $(filter nostripping,$(DEX_PREOPT_DEFAULT)))
- $(call add_json_bool, DisablePreopt, $(call invert_bool,$(filter true,$(WITH_DEXPREOPT))))
- $(call add_json_list, DisablePreoptModules, $(DEXPREOPT_DISABLED_MODULES))
- $(call add_json_bool, OnlyPreoptBootImageAndSystemServer, $(filter true,$(WITH_DEXPREOPT_BOOT_IMG_AND_SYSTEM_SERVER_ONLY)))
- $(call add_json_bool, GenerateApexImage, $(filter true,$(DEXPREOPT_GENERATE_APEX_IMAGE)))
- $(call add_json_bool, UseApexImage, $(filter true,$(DEXPREOPT_USE_APEX_IMAGE)))
- $(call add_json_bool, DontUncompressPrivAppsDex, $(filter true,$(DONT_UNCOMPRESS_PRIV_APPS_DEXS)))
- $(call add_json_list, ModulesLoadedByPrivilegedModules, $(PRODUCT_LOADED_BY_PRIVILEGED_MODULES))
- $(call add_json_bool, HasSystemOther, $(BOARD_USES_SYSTEM_OTHER_ODEX))
- $(call add_json_list, PatternsOnSystemOther, $(SYSTEM_OTHER_ODEX_FILTER))
- $(call add_json_bool, DisableGenerateProfile, $(filter false,$(WITH_DEX_PREOPT_GENERATE_PROFILE)))
- $(call add_json_str, ProfileDir, $(PRODUCT_DEX_PREOPT_PROFILE_DIR))
- $(call add_json_list, BootJars, $(PRODUCT_BOOT_JARS))
- $(call add_json_list, ArtApexJars, $(ART_APEX_JARS))
- $(call add_json_list, ProductUpdatableBootModules, $(PRODUCT_UPDATABLE_BOOT_MODULES))
- $(call add_json_list, ProductUpdatableBootLocations, $(PRODUCT_UPDATABLE_BOOT_LOCATIONS))
- $(call add_json_list, SystemServerJars, $(PRODUCT_SYSTEM_SERVER_JARS))
- $(call add_json_list, SystemServerApps, $(PRODUCT_SYSTEM_SERVER_APPS))
- $(call add_json_list, SpeedApps, $(PRODUCT_DEXPREOPT_SPEED_APPS))
- $(call add_json_list, PreoptFlags, $(PRODUCT_DEX_PREOPT_DEFAULT_FLAGS))
- $(call add_json_str, DefaultCompilerFilter, $(PRODUCT_DEX_PREOPT_DEFAULT_COMPILER_FILTER))
- $(call add_json_str, SystemServerCompilerFilter, $(PRODUCT_SYSTEM_SERVER_COMPILER_FILTER))
- $(call add_json_bool, GenerateDmFiles, $(PRODUCT_DEX_PREOPT_GENERATE_DM_FILES))
- $(call add_json_bool, NeverAllowStripping, $(PRODUCT_DEX_PREOPT_NEVER_ALLOW_STRIPPING))
- $(call add_json_bool, NoDebugInfo, $(filter false,$(WITH_DEXPREOPT_DEBUG_INFO)))
- $(call add_json_bool, DontResolveStartupStrings, $(filter false,$(PRODUCT_DEX_PREOPT_RESOLVE_STARTUP_STRINGS)))
- $(call add_json_bool, AlwaysSystemServerDebugInfo, $(filter true,$(PRODUCT_SYSTEM_SERVER_DEBUG_INFO)))
- $(call add_json_bool, NeverSystemServerDebugInfo, $(filter false,$(PRODUCT_SYSTEM_SERVER_DEBUG_INFO)))
- $(call add_json_bool, AlwaysOtherDebugInfo, $(filter true,$(PRODUCT_OTHER_JAVA_DEBUG_INFO)))
- $(call add_json_bool, NeverOtherDebugInfo, $(filter false,$(PRODUCT_OTHER_JAVA_DEBUG_INFO)))
- $(call add_json_bool, IsEng, $(filter eng,$(TARGET_BUILD_VARIANT)))
- $(call add_json_bool, SanitizeLite, $(SANITIZE_LITE))
- $(call add_json_bool, DefaultAppImages, $(WITH_DEX_PREOPT_APP_IMAGE))
- $(call add_json_str, Dex2oatXmx, $(DEX2OAT_XMX))
- $(call add_json_str, Dex2oatXms, $(DEX2OAT_XMS))
- $(call add_json_str, EmptyDirectory, $(OUT_DIR)/empty)
+ $(call add_json_bool, DisablePreopt, $(call invert_bool,$(ENABLE_PREOPT)))
+ $(call add_json_list, DisablePreoptModules, $(DEXPREOPT_DISABLED_MODULES))
+ $(call add_json_bool, OnlyPreoptBootImageAndSystemServer, $(filter true,$(WITH_DEXPREOPT_BOOT_IMG_AND_SYSTEM_SERVER_ONLY)))
+ $(call add_json_bool, UseArtImage, $(filter true,$(DEXPREOPT_USE_ART_IMAGE)))
+ $(call add_json_bool, DontUncompressPrivAppsDex, $(filter true,$(DONT_UNCOMPRESS_PRIV_APPS_DEXS)))
+ $(call add_json_list, ModulesLoadedByPrivilegedModules, $(PRODUCT_LOADED_BY_PRIVILEGED_MODULES))
+ $(call add_json_bool, HasSystemOther, $(BOARD_USES_SYSTEM_OTHER_ODEX))
+ $(call add_json_list, PatternsOnSystemOther, $(SYSTEM_OTHER_ODEX_FILTER))
+ $(call add_json_bool, DisableGenerateProfile, $(filter false,$(WITH_DEX_PREOPT_GENERATE_PROFILE)))
+ $(call add_json_str, ProfileDir, $(PRODUCT_DEX_PREOPT_PROFILE_DIR))
+ $(call add_json_list, BootJars, $(PRODUCT_BOOT_JARS))
+ $(call add_json_list, UpdatableBootJars, $(PRODUCT_UPDATABLE_BOOT_JARS))
+ $(call add_json_list, ArtApexJars, $(ART_APEX_JARS))
+ $(call add_json_list, SystemServerJars, $(PRODUCT_SYSTEM_SERVER_JARS))
+ $(call add_json_list, SystemServerApps, $(PRODUCT_SYSTEM_SERVER_APPS))
+ $(call add_json_list, UpdatableSystemServerJars, $(PRODUCT_UPDATABLE_SYSTEM_SERVER_JARS))
+ $(call add_json_bool, BrokenSuboptimalOrderOfSystemServerJars, $(PRODUCT_BROKEN_SUBOPTIMAL_ORDER_OF_SYSTEM_SERVER_JARS))
+ $(call add_json_list, SpeedApps, $(PRODUCT_DEXPREOPT_SPEED_APPS))
+ $(call add_json_list, PreoptFlags, $(PRODUCT_DEX_PREOPT_DEFAULT_FLAGS))
+ $(call add_json_str, DefaultCompilerFilter, $(PRODUCT_DEX_PREOPT_DEFAULT_COMPILER_FILTER))
+ $(call add_json_str, SystemServerCompilerFilter, $(PRODUCT_SYSTEM_SERVER_COMPILER_FILTER))
+ $(call add_json_bool, GenerateDmFiles, $(PRODUCT_DEX_PREOPT_GENERATE_DM_FILES))
+ $(call add_json_bool, NeverAllowStripping, $(PRODUCT_DEX_PREOPT_NEVER_ALLOW_STRIPPING))
+ $(call add_json_bool, NoDebugInfo, $(filter false,$(WITH_DEXPREOPT_DEBUG_INFO)))
+ $(call add_json_bool, DontResolveStartupStrings, $(filter false,$(PRODUCT_DEX_PREOPT_RESOLVE_STARTUP_STRINGS)))
+ $(call add_json_bool, AlwaysSystemServerDebugInfo, $(filter true,$(PRODUCT_SYSTEM_SERVER_DEBUG_INFO)))
+ $(call add_json_bool, NeverSystemServerDebugInfo, $(filter false,$(PRODUCT_SYSTEM_SERVER_DEBUG_INFO)))
+ $(call add_json_bool, AlwaysOtherDebugInfo, $(filter true,$(PRODUCT_OTHER_JAVA_DEBUG_INFO)))
+ $(call add_json_bool, NeverOtherDebugInfo, $(filter false,$(PRODUCT_OTHER_JAVA_DEBUG_INFO)))
+ $(call add_json_bool, IsEng, $(filter eng,$(TARGET_BUILD_VARIANT)))
+ $(call add_json_bool, SanitizeLite, $(SANITIZE_LITE))
+ $(call add_json_bool, DefaultAppImages, $(WITH_DEX_PREOPT_APP_IMAGE))
+ $(call add_json_str, Dex2oatXmx, $(DEX2OAT_XMX))
+ $(call add_json_str, Dex2oatXms, $(DEX2OAT_XMS))
+ $(call add_json_str, EmptyDirectory, $(OUT_DIR)/empty)
$(call add_json_map, CpuVariant)
$(call add_json_str, $(TARGET_ARCH), $(DEX2OAT_TARGET_CPU_VARIANT))
@@ -143,16 +125,6 @@
$(call add_json_str, Dex2oatImageXmx, $(DEX2OAT_IMAGE_XMX))
$(call add_json_str, Dex2oatImageXms, $(DEX2OAT_IMAGE_XMS))
- $(call add_json_map, Tools)
- $(call add_json_str, Profman, $(SOONG_HOST_OUT_EXECUTABLES)/profman)
- $(call add_json_str, Dex2oat, $(DEX2OAT))
- $(call add_json_str, Aapt, $(SOONG_HOST_OUT_EXECUTABLES)/aapt)
- $(call add_json_str, SoongZip, $(SOONG_ZIP))
- $(call add_json_str, Zip2zip, $(ZIP2ZIP))
- $(call add_json_str, ManifestCheck, $(SOONG_HOST_OUT_EXECUTABLES)/manifest_check)
- $(call add_json_str, ConstructContext, $(BUILD_SYSTEM)/construct_context.sh)
- $(call end_json_map)
-
$(call json_end)
$(shell mkdir -p $(dir $(DEX_PREOPT_CONFIG)))
@@ -165,14 +137,3 @@
rm $(DEX_PREOPT_CONFIG).tmp; \
fi)
endif
-
-DEXPREOPT_GEN_DEPS := \
- $(SOONG_HOST_OUT_EXECUTABLES)/profman \
- $(DEX2OAT) \
- $(SOONG_HOST_OUT_EXECUTABLES)/aapt \
- $(SOONG_ZIP) \
- $(ZIP2ZIP) \
- $(BUILD_SYSTEM)/construct_context.sh \
-
-DEXPREOPT_STRIP_DEPS := \
- $(ZIP2ZIP) \
diff --git a/core/dex_preopt_libart.mk b/core/dex_preopt_libart.mk
index 79d5f8c..12b29f4 100644
--- a/core/dex_preopt_libart.mk
+++ b/core/dex_preopt_libart.mk
@@ -1,45 +1,42 @@
####################################
# ART boot image installation
-# Input variable:
+# Input variables:
# my_boot_image_name: the boot image to install
+# my_boot_image_arch: the architecture to install (e.g. TARGET_ARCH, not expanded)
+# my_boot_image_out: the install directory (e.g. $(PRODUCT_OUT))
+# my_boot_image_syms: the symbols director (e.g. $(TARGET_OUT_UNSTRIPPED))
+# my_boot_image_root: make variable used to store installed image path
#
####################################
-# Install primary arch vdex files into a shared location, and then symlink them to both the primary
-# and secondary arch directories.
-my_vdex_copy_pairs := $(DEXPREOPT_IMAGE_VDEX_BUILT_INSTALLED_$(my_boot_image_name)_$(TARGET_ARCH))
-my_installed := $(foreach v,$(my_vdex_copy_pairs),$(PRODUCT_OUT)$(call word-colon,2,$(v)))
+# Install $(1) to $(2) so that it is shared between architectures.
+define copy-vdex-file
+my_vdex_shared := $$(dir $$(patsubst %/,%,$$(dir $(2))))$$(notdir $(2)) # Remove the arch dir.
+ifneq ($(my_boot_image_arch),$(filter $(my_boot_image_arch), TARGET_2ND_ARCH HOST_2ND_ARCH))
+$$(my_vdex_shared): $(1) # Copy $(1) to directory one level up (i.e. with the arch dir removed).
+ @echo "Install: $$@"
+ $$(copy-file-to-target)
+endif
+$(2): $$(my_vdex_shared) # Create symlink at $(2) which points to the actual physical copy.
+ @echo "Symlink: $$@"
+ mkdir -p $$(dir $$@)
+ ln -sfn ../$$(notdir $$@) $$@
+my_vdex_shared :=
+endef
+
+# Same as 'copy-many-files' but it uses the vdex-specific helper above.
+define copy-vdex-files
+$(foreach v,$(1),$(eval $(call copy-vdex-file, $(call word-colon,1,$(v)), $(2)$(call word-colon,2,$(v)))))
+$(foreach v,$(1),$(2)$(call word-colon,2,$(v)))
+endef
+
+# Install the boot images compiled by Soong.
+# The first file is saved in $(my_boot_image_root) and the rest are added as it's dependencies.
+my_suffix := BUILT_INSTALLED_$(my_boot_image_name)_$($(my_boot_image_arch))
+my_installed := $(call copy-many-files,$(DEXPREOPT_IMAGE_$(my_suffix)),$(my_boot_image_out))
+my_installed += $(call copy-many-files,$(DEXPREOPT_IMAGE_UNSTRIPPED_$(my_suffix)),$(my_boot_image_syms))
+my_installed += $(call copy-vdex-files,$(DEXPREOPT_IMAGE_VDEX_$(my_suffix)),$(my_boot_image_out))
+$(my_boot_image_root) += $(firstword $(my_installed))
$(firstword $(my_installed)): $(wordlist 2,9999,$(my_installed))
-
-my_built_vdex_dir := $(dir $(call word-colon,1,$(firstword $(my_vdex_copy_pairs))))
-my_installed_vdex_dir := $(PRODUCT_OUT)$(dir $(call word-colon,2,$(firstword $(my_vdex_copy_pairs))))
-
-$(my_installed): $(my_installed_vdex_dir)% : $(my_built_vdex_dir)%
- @echo "Install: $@"
- @rm -f $@
- $(copy-file-to-target)
- mkdir -p $(dir $@)/$(TARGET_ARCH)
- ln -sfn ../$(notdir $@) $(dir $@)/$(TARGET_ARCH)
-ifdef TARGET_2ND_ARCH
- mkdir -p $(dir $@)/$(TARGET_2ND_ARCH)
- ln -sfn ../$(notdir $@) $(dir $@)/$(TARGET_2ND_ARCH)
-endif
-
-my_dexpreopt_image_extra_deps := $(firstword $(my_installed))
-
-my_2nd_arch_prefix :=
-include $(BUILD_SYSTEM)/dex_preopt_libart_boot.mk
-
-ifdef TARGET_2ND_ARCH
- my_2nd_arch_prefix := $(TARGET_2ND_ARCH_VAR_PREFIX)
- include $(BUILD_SYSTEM)/dex_preopt_libart_boot.mk
-endif
-
-my_2nd_arch_prefix :=
-
-
-my_vdex_copy_pairs :=
my_installed :=
-my_built_vdex_dir :=
-my_installed_vdex_dir :=
-my_dexpreopt_image_extra_deps :=
+my_suffix :=
diff --git a/core/dex_preopt_libart_boot.mk b/core/dex_preopt_libart_boot.mk
deleted file mode 100644
index 34b8526..0000000
--- a/core/dex_preopt_libart_boot.mk
+++ /dev/null
@@ -1,25 +0,0 @@
-# Rules to install a boot image built by dexpreopt_bootjars.go
-# Input variables:
-# my_boot_image_name: the boot image to install
-# my_2nd_arch_prefix: indicates if this is to build for the 2nd arch.
-# my_dexpreopt_image_extra_deps: extra dependencies to add on the installed boot.art
-
-# Install the boot images compiled by Soong
-# The first file (generally boot.art) is saved as DEFAULT_DEX_PREOPT_INSTALLED_IMAGE,
-# and the rest are added as dependencies of the first.
-
-my_installed := $(call copy-many-files,$(DEXPREOPT_IMAGE_BUILT_INSTALLED_$(my_boot_image_name)_$(TARGET_$(my_2nd_arch_prefix)ARCH)),$(PRODUCT_OUT))
-$(firstword $(my_installed)): $(wordlist 2,9999,$(my_installed))
-$(my_2nd_arch_prefix)DEFAULT_DEX_PREOPT_INSTALLED_IMAGE += $(firstword $(my_installed))
-
-# Install the unstripped boot images compiled by Soong into the symbols directory
-# The first file (generally boot.art) made a dependency of DEFAULT_DEX_PREOPT_INSTALLED_IMAGE,
-# and the rest are added as dependencies of the first.
-my_installed := $(call copy-many-files,$(DEXPREOPT_IMAGE_UNSTRIPPED_BUILT_INSTALLED_$(my_boot_image_name)_$(TARGET_$(my_2nd_arch_prefix)ARCH)),$(TARGET_OUT_UNSTRIPPED))
-$(firstword $(my_installed)): $(wordlist 2,9999,$(my_installed))
-$($(my_2nd_arch_prefix)DEFAULT_DEX_PREOPT_INSTALLED_IMAGE): $(firstword $(my_installed))
-
-$($(my_2nd_arch_prefix)DEFAULT_DEX_PREOPT_INSTALLED_IMAGE): $(my_dexpreopt_image_extra_deps)
-
-my_installed :=
-my_built_installed :=
diff --git a/core/dex_preopt_odex_install.mk b/core/dex_preopt_odex_install.mk
index 50e922e..440ffd9 100644
--- a/core/dex_preopt_odex_install.mk
+++ b/core/dex_preopt_odex_install.mk
@@ -58,6 +58,11 @@
LOCAL_DEX_PREOPT :=
endif
+# Don't preopt system server jars that are updatable.
+ifneq (,$(filter %:$(LOCAL_MODULE), $(PRODUCT_UPDATABLE_SYSTEM_SERVER_JARS)))
+ LOCAL_DEX_PREOPT :=
+endif
+
# if WITH_DEXPREOPT_BOOT_IMG_AND_SYSTEM_SERVER_ONLY=true and module is not in boot class path skip
# Also preopt system server jars since selinux prevents system server from loading anything from
# /data. If we don't do this they will need to be extracted which is not favorable for RAM usage
@@ -106,9 +111,10 @@
my_dexpreopt_archs :=
my_dexpreopt_images :=
my_dexpreopt_images_deps :=
+my_dexpreopt_image_locations :=
my_dexpreopt_infix := boot
-ifeq (true, $(DEXPREOPT_USE_APEX_IMAGE))
- my_dexpreopt_infix := apex
+ifeq (true, $(DEXPREOPT_USE_ART_IMAGE))
+ my_dexpreopt_infix := art
endif
ifdef LOCAL_DEX_PREOPT
@@ -178,6 +184,8 @@
endif # TARGET_2ND_ARCH
endif # LOCAL_MODULE_CLASS
+ my_dexpreopt_image_locations += $(DEXPREOPT_IMAGE_LOCATIONS_$(my_dexpreopt_infix))
+
my_filtered_optional_uses_libraries := $(filter-out $(INTERNAL_PLATFORM_MISSING_USES_LIBRARIES), \
$(LOCAL_OPTIONAL_USES_LIBRARIES))
@@ -187,6 +195,7 @@
org.apache.http.legacy \
android.hidl.base-V1.0-java \
android.hidl.manager-V1.0-java \
+ android.test.base \
my_dexpreopt_libs := $(sort \
$(LOCAL_USES_LIBRARIES) \
@@ -207,8 +216,7 @@
$(call json_start)
- # DexPath, StripInputPath, and StripOutputPath are not set, they will
- # be filled in by dexpreopt_gen.
+ # DexPath is not set: it will be filled in by dexpreopt_gen.
$(call add_json_str, Name, $(LOCAL_MODULE))
$(call add_json_str, DexLocation, $(patsubst $(PRODUCT_OUT)%,%,$(LOCAL_INSTALLED_MODULE)))
@@ -226,10 +234,15 @@
$(call add_json_list, UsesLibraries, $(LOCAL_USES_LIBRARIES))
$(call add_json_map, LibraryPaths)
$(foreach lib,$(my_dexpreopt_libs),\
- $(call add_json_str, $(lib), $(call intermediates-dir-for,JAVA_LIBRARIES,$(lib),,COMMON)/javalib.jar))
+ $(call add_json_map, $(lib)) \
+ $(eval file := $(filter %/$(lib).jar, $(call module-installed-files,$(lib)))) \
+ $(call add_json_str, Host, $(call intermediates-dir-for,JAVA_LIBRARIES,$(lib),,COMMON)/javalib.jar) \
+ $(call add_json_str, Device, $(call install-path-to-on-device-path,$(file))) \
+ $(call end_json_map))
$(call end_json_map)
$(call add_json_list, Archs, $(my_dexpreopt_archs))
$(call add_json_list, DexPreoptImages, $(my_dexpreopt_images))
+ $(call add_json_list, DexPreoptImageLocations, $(my_dexpreopt_image_locations))
$(call add_json_list, PreoptBootClassPathDexFiles, $(DEXPREOPT_BOOTCLASSPATH_DEX_FILES))
$(call add_json_list, PreoptBootClassPathDexLocations,$(DEXPREOPT_BOOTCLASSPATH_DEX_LOCATIONS))
$(call add_json_bool, PreoptExtractedApk, $(my_preopt_for_extracted_apk))
@@ -237,13 +250,10 @@
$(call add_json_bool, ForceCreateAppImage, $(filter true,$(LOCAL_DEX_PREOPT_APP_IMAGE)))
$(call add_json_bool, PresignedPrebuilt, $(filter PRESIGNED,$(LOCAL_CERTIFICATE)))
- $(call add_json_bool, NoStripping, $(filter nostripping,$(LOCAL_DEX_PREOPT)))
-
$(call json_end)
my_dexpreopt_config := $(intermediates)/dexpreopt.config
my_dexpreopt_script := $(intermediates)/dexpreopt.sh
- my_strip_script := $(intermediates)/strip.sh
my_dexpreopt_zip := $(intermediates)/dexpreopt.zip
$(my_dexpreopt_config): PRIVATE_MODULE := $(LOCAL_MODULE)
@@ -252,17 +262,19 @@
@echo "$(PRIVATE_MODULE) dexpreopt.config"
echo -e -n '$(subst $(newline),\n,$(subst ','\'',$(subst \,\\,$(PRIVATE_CONTENTS))))' > $@
- .KATI_RESTAT: $(my_dexpreopt_script) $(my_strip_script)
+ .KATI_RESTAT: $(my_dexpreopt_script)
$(my_dexpreopt_script): PRIVATE_MODULE := $(LOCAL_MODULE)
+ $(my_dexpreopt_script): PRIVATE_GLOBAL_SOONG_CONFIG := $(DEX_PREOPT_SOONG_CONFIG_FOR_MAKE)
$(my_dexpreopt_script): PRIVATE_GLOBAL_CONFIG := $(DEX_PREOPT_CONFIG_FOR_MAKE)
$(my_dexpreopt_script): PRIVATE_MODULE_CONFIG := $(my_dexpreopt_config)
- $(my_dexpreopt_script): PRIVATE_STRIP_SCRIPT := $(my_strip_script)
- $(my_dexpreopt_script): .KATI_IMPLICIT_OUTPUTS := $(my_strip_script)
$(my_dexpreopt_script): $(DEXPREOPT_GEN)
- $(my_dexpreopt_script): $(my_dexpreopt_config) $(DEX_PREOPT_CONFIG_FOR_MAKE)
+ $(my_dexpreopt_script): $(my_dexpreopt_config) $(DEX_PREOPT_SOONG_CONFIG_FOR_MAKE) $(DEX_PREOPT_CONFIG_FOR_MAKE)
@echo "$(PRIVATE_MODULE) dexpreopt gen"
- $(DEXPREOPT_GEN) -global $(PRIVATE_GLOBAL_CONFIG) -module $(PRIVATE_MODULE_CONFIG) \
- -dexpreopt_script $@ -strip_script $(PRIVATE_STRIP_SCRIPT) \
+ $(DEXPREOPT_GEN) \
+ -global_soong $(PRIVATE_GLOBAL_SOONG_CONFIG) \
+ -global $(PRIVATE_GLOBAL_CONFIG) \
+ -module $(PRIVATE_MODULE_CONFIG) \
+ -dexpreopt_script $@ \
-out_dir $(OUT_DIR)
my_dexpreopt_deps := $(my_dex_jar)
@@ -302,6 +314,5 @@
my_dexpreopt_config :=
my_dexpreopt_script :=
- my_strip_script :=
my_dexpreopt_zip :=
endif # LOCAL_DEX_PREOPT
diff --git a/core/dynamic_binary.mk b/core/dynamic_binary.mk
index 27ff2c9..48072b3 100644
--- a/core/dynamic_binary.mk
+++ b/core/dynamic_binary.mk
@@ -132,8 +132,8 @@
CLANG_BIN=$(LLVM_PREBUILTS_PATH) \
CROSS_COMPILE=$(PRIVATE_TOOLS_PREFIX) \
XZ=$(XZ) \
- $(SOONG_STRIP_PATH) -i $< -o $@ -d $@.d $(PRIVATE_STRIP_ARGS)
- $(call include-depfile,$(strip_output).d)
+ $(SOONG_STRIP_PATH) -i $< -o $@ -d $@.strip.d $(PRIVATE_STRIP_ARGS)
+ $(call include-depfile,$(strip_output).strip.d,$(strip_output))
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.
diff --git a/core/envsetup.mk b/core/envsetup.mk
index 9901ee1..3aff007 100644
--- a/core/envsetup.mk
+++ b/core/envsetup.mk
@@ -94,14 +94,28 @@
TARGET_BUILD_APPS ?=
+# Set to true for an unbundled build, i.e. a build without
+# support for platform targets like the system image. This also
+# disables consistency checks that only apply to full platform
+# builds.
+TARGET_BUILD_UNBUNDLED ?=
+
+# TARGET_BUILD_APPS implies unbundled build, otherwise we default
+# to bundled (i.e. platform targets such as the system image are
+# included).
+ifneq ($(TARGET_BUILD_APPS),)
+ TARGET_BUILD_UNBUNDLED := true
+endif
+
.KATI_READONLY := \
TARGET_PRODUCT \
TARGET_BUILD_VARIANT \
- TARGET_BUILD_APPS
+ TARGET_BUILD_APPS \
+ TARGET_BUILD_UNBUNDLED \
# ---------------------------------------------------------------
# Set up configuration for host machine. We don't do cross-
-# compiles except for arm/mips, so the HOST is whatever we are
+# compiles except for arm, so the HOST is whatever we are
# running on
# HOST_OS
@@ -228,6 +242,8 @@
TARGET_COPY_OUT_OEM := oem
TARGET_COPY_OUT_RAMDISK := ramdisk
TARGET_COPY_OUT_DEBUG_RAMDISK := debug_ramdisk
+TARGET_COPY_OUT_VENDOR_DEBUG_RAMDISK := vendor_debug_ramdisk
+TARGET_COPY_OUT_TEST_HARNESS_RAMDISK := test_harness_ramdisk
TARGET_COPY_OUT_ROOT := root
TARGET_COPY_OUT_RECOVERY := recovery
# The directory used for optional partitions depend on the BoardConfig, so
@@ -238,6 +254,7 @@
_system_ext_path_placeholder := ||SYSTEM_EXT-PATH-PH||
_odm_path_placeholder := ||ODM-PATH-PH||
TARGET_COPY_OUT_VENDOR := $(_vendor_path_placeholder)
+TARGET_COPY_OUT_VENDOR_RAMDISK := vendor-ramdisk
TARGET_COPY_OUT_PRODUCT := $(_product_path_placeholder)
# TODO(b/135957588) TARGET_COPY_OUT_PRODUCT_SERVICES will copy the target to
# product
@@ -255,17 +272,12 @@
# java code with dalvikvm/art.
# Jars present in the ART apex. These should match exactly the list of
# Java libraries in the ART apex build rule.
-ART_APEX_JARS := core-oj core-libart core-icu4j okhttp bouncycastle apache-xml
-TARGET_CORE_JARS := $(ART_APEX_JARS) conscrypt
-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))
+ART_APEX_JARS := \
+ com.android.art:core-oj \
+ com.android.art:core-libart \
+ com.android.art:okhttp \
+ com.android.art:bouncycastle \
+ com.android.art:apache-xml
#################################################################
# Read the product specs so we can get TARGET_DEVICE and other
@@ -367,9 +379,6 @@
HOST_OUT_COMMON_INTERMEDIATES \
HOST_OUT_FAKE
-# Nano environment config
-include $(BUILD_SYSTEM)/aux_config.mk
-
HOST_CROSS_OUT_INTERMEDIATES := $(HOST_CROSS_OUT)/obj
HOST_CROSS_OUT_NOTICE_FILES := $(HOST_CROSS_OUT_INTERMEDIATES)/NOTICE_FILES
.KATI_READONLY := \
@@ -385,9 +394,6 @@
HOST_CROSS_OUT_GEN := $(HOST_CROSS_OUT)/gen
.KATI_READONLY := HOST_CROSS_OUT_GEN
-HOST_OUT_TEST_CONFIG := $(HOST_OUT)/test_config
-.KATI_READONLY := HOST_OUT_TEST_CONFIG
-
# Out for HOST_2ND_ARCH
$(HOST_2ND_ARCH_VAR_PREFIX)HOST_OUT_INTERMEDIATES := $(HOST_OUT)/obj32
$(HOST_2ND_ARCH_VAR_PREFIX)HOST_OUT_SHARED_LIBRARIES := $(HOST_OUT)/lib
@@ -473,7 +479,6 @@
TARGET_OUT_NOTICE_FILES := $(TARGET_OUT_INTERMEDIATES)/NOTICE_FILES
TARGET_OUT_FAKE := $(PRODUCT_OUT)/fake_packages
TARGET_OUT_TESTCASES := $(PRODUCT_OUT)/testcases
-TARGET_OUT_TEST_CONFIG := $(PRODUCT_OUT)/test_config
.KATI_READONLY := \
TARGET_OUT_EXECUTABLES \
TARGET_OUT_OPTIONAL_EXECUTABLES \
@@ -487,8 +492,7 @@
TARGET_OUT_ETC \
TARGET_OUT_NOTICE_FILES \
TARGET_OUT_FAKE \
- TARGET_OUT_TESTCASES \
- TARGET_OUT_TEST_CONFIG
+ TARGET_OUT_TESTCASES
ifeq ($(SANITIZE_LITE),true)
# When using SANITIZE_LITE, APKs must not be packaged with sanitized libraries, as they will not
@@ -824,6 +828,10 @@
TARGET_RAMDISK_OUT := $(PRODUCT_OUT)/$(TARGET_COPY_OUT_RAMDISK)
TARGET_RAMDISK_OUT_UNSTRIPPED := $(TARGET_OUT_UNSTRIPPED)
TARGET_DEBUG_RAMDISK_OUT := $(PRODUCT_OUT)/$(TARGET_COPY_OUT_DEBUG_RAMDISK)
+TARGET_VENDOR_DEBUG_RAMDISK_OUT := $(PRODUCT_OUT)/$(TARGET_COPY_OUT_VENDOR_DEBUG_RAMDISK)
+TARGET_TEST_HARNESS_RAMDISK_OUT := $(PRODUCT_OUT)/$(TARGET_COPY_OUT_TEST_HARNESS_RAMDISK)
+
+TARGET_VENDOR_RAMDISK_OUT := $(PRODUCT_OUT)/$(TARGET_COPY_OUT_VENDOR_RAMDISK)
TARGET_ROOT_OUT := $(PRODUCT_OUT)/$(TARGET_COPY_OUT_ROOT)
TARGET_ROOT_OUT_BIN := $(TARGET_ROOT_OUT)/bin
@@ -859,7 +867,7 @@
TARGET_INSTALLER_ROOT_OUT \
TARGET_INSTALLER_SYSTEM_OUT
-COMMON_MODULE_CLASSES := TARGET-NOTICE_FILES HOST-NOTICE_FILES HOST-JAVA_LIBRARIES
+COMMON_MODULE_CLASSES := TARGET_NOTICE_FILES HOST_NOTICE_FILES HOST_JAVA_LIBRARIES
PER_ARCH_MODULE_CLASSES := SHARED_LIBRARIES STATIC_LIBRARIES EXECUTABLES GYP RENDERSCRIPT_BITCODE NATIVE_TESTS HEADER_LIBRARIES RLIB_LIBRARIES DYLIB_LIBRARIES
.KATI_READONLY := COMMON_MODULE_CLASSES PER_ARCH_MODULE_CLASSES
diff --git a/core/executable.mk b/core/executable.mk
index c8d9272..9175e0a 100644
--- a/core/executable.mk
+++ b/core/executable.mk
@@ -6,6 +6,10 @@
# LOCAL_MODULE_PATH_32 and LOCAL_MODULE_PATH_64 or LOCAL_MODULE_STEM_32 and
# LOCAL_MODULE_STEM_64
+ifdef LOCAL_IS_HOST_MODULE
+ $(call pretty-error,BUILD_EXECUTABLE is incompatible with LOCAL_IS_HOST_MODULE. Use BUILD_HOST_EXECUTABLE instead.)
+endif
+
my_skip_this_target :=
ifneq ($(filter address,$(SANITIZE_TARGET)),)
ifeq (true,$(LOCAL_FORCE_STATIC_EXECUTABLE))
@@ -36,14 +40,9 @@
LOCAL_NO_2ND_ARCH_MODULE_SUFFIX := true
endif
-# if TARGET_PREFER_32_BIT_EXECUTABLES is set, try to build 32-bit first
ifdef TARGET_2ND_ARCH
-ifeq ($(TARGET_PREFER_32_BIT_EXECUTABLES),true)
-LOCAL_2ND_ARCH_VAR_PREFIX := $(TARGET_2ND_ARCH_VAR_PREFIX)
-else
LOCAL_2ND_ARCH_VAR_PREFIX :=
endif
-endif
my_skip_non_preferred_arch :=
@@ -61,12 +60,7 @@
ifndef my_skip_non_preferred_arch
ifdef TARGET_2ND_ARCH
-# check if the non-preferred arch is the primary or secondary
-ifeq ($(TARGET_PREFER_32_BIT_EXECUTABLES),true)
-LOCAL_2ND_ARCH_VAR_PREFIX :=
-else
LOCAL_2ND_ARCH_VAR_PREFIX := $(TARGET_2ND_ARCH_VAR_PREFIX)
-endif
# check if non-preferred arch is supported
include $(BUILD_SYSTEM)/module_arch_supported.mk
diff --git a/core/executable_internal.mk b/core/executable_internal.mk
index a9915aa..32e56dd 100644
--- a/core/executable_internal.mk
+++ b/core/executable_internal.mk
@@ -41,11 +41,6 @@
else
my_target_libcrt_builtins := $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)LIBCRT_BUILTINS)
endif
-ifeq ($(LOCAL_NO_LIBGCC),true)
-my_target_libgcc :=
-else
-my_target_libgcc := $(call intermediates-dir-for,STATIC_LIBRARIES,libgcc,,,$(LOCAL_2ND_ARCH_VAR_PREFIX))/libgcc.a
-endif
my_target_libatomic := $(call intermediates-dir-for,STATIC_LIBRARIES,libatomic,,,$(LOCAL_2ND_ARCH_VAR_PREFIX))/libatomic.a
ifeq ($(LOCAL_NO_CRT),true)
my_target_crtbegin_dynamic_o :=
@@ -66,7 +61,6 @@
my_target_crtend_o := $(wildcard $(my_ndk_sysroot_lib)/crtend_android.o)
endif
$(linked_module): PRIVATE_TARGET_LIBCRT_BUILTINS := $(my_target_libcrt_builtins)
-$(linked_module): PRIVATE_TARGET_LIBGCC := $(my_target_libgcc)
$(linked_module): PRIVATE_TARGET_LIBATOMIC := $(my_target_libatomic)
$(linked_module): PRIVATE_TARGET_CRTBEGIN_DYNAMIC_O := $(my_target_crtbegin_dynamic_o)
$(linked_module): PRIVATE_TARGET_CRTBEGIN_STATIC_O := $(my_target_crtbegin_static_o)
@@ -74,11 +68,11 @@
$(linked_module): PRIVATE_POST_LINK_CMD := $(LOCAL_POST_LINK_CMD)
ifeq ($(LOCAL_FORCE_STATIC_EXECUTABLE),true)
-$(linked_module): $(my_target_crtbegin_static_o) $(all_objects) $(all_libraries) $(my_target_crtend_o) $(my_target_libcrt_builtins) $(my_target_libgcc) $(my_target_libatomic) $(CLANG_CXX)
+$(linked_module): $(my_target_crtbegin_static_o) $(all_objects) $(all_libraries) $(my_target_crtend_o) $(my_target_libcrt_builtins) $(my_target_libatomic) $(CLANG_CXX)
$(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) $(my_target_libcrt_builtins) $(my_target_libgcc) $(my_target_libatomic) $(CLANG_CXX)
+$(linked_module): $(my_target_crtbegin_dynamic_o) $(all_objects) $(all_libraries) $(my_target_crtend_o) $(my_target_libcrt_builtins) $(my_target_libatomic) $(CLANG_CXX)
$(transform-o-to-executable)
$(PRIVATE_POST_LINK_CMD)
endif
diff --git a/core/executable_prefer_symlink.mk b/core/executable_prefer_symlink.mk
index 9b9814e..fea0bef 100644
--- a/core/executable_prefer_symlink.mk
+++ b/core/executable_prefer_symlink.mk
@@ -5,22 +5,13 @@
# Note: now only limited to the binaries that will be installed under system/bin directory
# Create link to the one used depending on the target
-# configuration. Note that we require the TARGET_IS_64_BIT
-# check because 32 bit targets may not define TARGET_PREFER_32_BIT_APPS
-# et al. since those variables make no sense in that context.
+# configuration.
ifneq ($(LOCAL_IS_HOST_MODULE),true)
my_symlink := $(addprefix $(TARGET_OUT)/bin/, $(LOCAL_MODULE))
my_src_binary_name :=
ifeq ($(TARGET_IS_64_BIT),true)
ifeq ($(TARGET_SUPPORTS_64_BIT_APPS)|$(TARGET_SUPPORTS_32_BIT_APPS),true|true)
- # We support both 32 and 64 bit apps, so we will have to
- # base our decision on whether the target prefers one or the
- # other.
- ifeq ($(TARGET_PREFER_32_BIT_APPS),true)
- my_src_binary_name := $(LOCAL_MODULE_STEM_32)
- else
- my_src_binary_name := $(LOCAL_MODULE_STEM_64)
- endif
+ my_src_binary_name := $(LOCAL_MODULE_STEM_64)
else ifeq ($(TARGET_SUPPORTS_64_BIT_APPS),true)
# We support only 64 bit apps.
my_src_binary_name := $(LOCAL_MODULE_STEM_64)
@@ -40,7 +31,7 @@
# We need this so that the installed files could be picked up based on the
# local module name
-ALL_MODULES.$(LOCAL_MODULE).INSTALLED += $(my_symlink)
+ALL_MODULES.$(my_register_name).INSTALLED += $(my_symlink)
# Create the symlink when you run mm/mmm or "make <module_name>"
$(LOCAL_MODULE) : $(my_symlink)
diff --git a/core/goma.mk b/core/goma.mk
index c265259..2b51d8b 100644
--- a/core/goma.mk
+++ b/core/goma.mk
@@ -27,7 +27,8 @@
# use both ccache and gomacc.
CC_WRAPPER := $(strip $(CC_WRAPPER) $(GOMA_CC))
CXX_WRAPPER := $(strip $(CXX_WRAPPER) $(GOMA_CC))
- JAVAC_WRAPPER := $(strip $(JAVAC_WRAPPER) $(GOMA_CC))
+ # b/143658984: goma can't handle the --system argument to javac
+ #JAVAC_WRAPPER := $(strip $(JAVAC_WRAPPER) $(GOMA_CC))
goma_dir :=
endif
diff --git a/core/host_dalvik_java_library.mk b/core/host_dalvik_java_library.mk
index 8e655ff..da32978 100644
--- a/core/host_dalvik_java_library.mk
+++ b/core/host_dalvik_java_library.mk
@@ -79,6 +79,8 @@
$(java_source_list_file): $(java_sources_deps)
$(write-java-source-list)
+# TODO(b/143658984): goma can't handle the --system argument to javac.
+#$(full_classes_compiled_jar): .KATI_NINJA_POOL := $(GOMA_POOL)
$(full_classes_compiled_jar): PRIVATE_JAVA_LAYERS_FILE := $(layers_file)
$(full_classes_compiled_jar): PRIVATE_JAVACFLAGS := $(LOCAL_JAVACFLAGS) $(annotation_processor_flags)
$(full_classes_compiled_jar): PRIVATE_JAR_EXCLUDE_FILES :=
@@ -97,6 +99,7 @@
$(NORMALIZE_PATH) \
$(JAR_ARGS) \
$(ZIPSYNC) \
+ $(SOONG_ZIP) \
| $(SOONG_JAVAC_WRAPPER)
$(transform-host-java-to-dalvik-package)
diff --git a/core/host_fuzz_test.mk b/core/host_fuzz_test.mk
deleted file mode 100644
index 54c6577..0000000
--- a/core/host_fuzz_test.mk
+++ /dev/null
@@ -1,10 +0,0 @@
-################################################
-## A thin wrapper around BUILD_HOST_EXECUTABLE
-## Common flags for host fuzz tests are added.
-################################################
-$(call record-module-type,HOST_FUZZ_TEST)
-
-LOCAL_SANITIZE += fuzzer
-LOCAL_STATIC_LIBRARIES += libLLVMFuzzer
-
-include $(BUILD_HOST_EXECUTABLE)
diff --git a/core/host_java_library.mk b/core/host_java_library.mk
index 6c23789..f9abe9b 100644
--- a/core/host_java_library.mk
+++ b/core/host_java_library.mk
@@ -70,6 +70,8 @@
$(java_source_list_file): $(java_sources_deps)
$(write-java-source-list)
+# TODO(b/143658984): goma can't handle the --system argument to javac.
+#$(full_classes_compiled_jar): .KATI_NINJA_POOL := $(GOMA_POOL)
$(full_classes_compiled_jar): PRIVATE_JAVA_LAYERS_FILE := $(layers_file)
$(full_classes_compiled_jar): PRIVATE_JAVACFLAGS := $(LOCAL_JAVACFLAGS) $(annotation_processor_flags)
$(full_classes_compiled_jar): PRIVATE_JAR_EXCLUDE_FILES :=
@@ -88,6 +90,7 @@
$(ZIPTIME) \
$(JAR_ARGS) \
$(ZIPSYNC) \
+ $(SOONG_ZIP) \
| $(SOONG_JAVAC_WRAPPER)
$(transform-host-java-to-package)
$(remove-timestamps-from-package)
diff --git a/core/host_native_test.mk b/core/host_native_test.mk
deleted file mode 100644
index aa05bb3..0000000
--- a/core/host_native_test.mk
+++ /dev/null
@@ -1,23 +0,0 @@
-################################################
-## A thin wrapper around BUILD_HOST_EXECUTABLE
-## Common flags for host native tests are added.
-################################################
-$(call record-module-type,HOST_NATIVE_TEST)
-
-ifdef LOCAL_MODULE_CLASS
-ifneq ($(LOCAL_MODULE_CLASS),NATIVE_TESTS)
-$(error $(LOCAL_PATH): LOCAL_MODULE_CLASS must be NATIVE_TESTS with BUILD_HOST_NATIVE_TEST)
-endif
-endif
-
-LOCAL_MODULE_CLASS := NATIVE_TESTS
-
-include $(BUILD_SYSTEM)/host_test_internal.mk
-
-ifndef LOCAL_MULTILIB
-ifndef LOCAL_32_BIT_ONLY
-LOCAL_MULTILIB := both
-endif
-endif
-
-include $(BUILD_HOST_EXECUTABLE)
diff --git a/core/host_shared_library.mk b/core/host_shared_library.mk
index 81236d1..fbe6442 100644
--- a/core/host_shared_library.mk
+++ b/core/host_shared_library.mk
@@ -37,4 +37,9 @@
###########################################################
## Copy headers to the install tree
###########################################################
-include $(BUILD_COPY_HEADERS)
+ifdef LOCAL_COPY_HEADERS
+$(if $(filter true,$(BUILD_BROKEN_USES_BUILD_COPY_HEADERS)),\
+ $(call pretty-warning,LOCAL_COPY_HEADERS is deprecated. See $(CHANGES_URL)#copy_headers),\
+ $(call pretty-error,LOCAL_COPY_HEADERS is obsolete. See $(CHANGES_URL)#copy_headers))
+include $(BUILD_SYSTEM)/copy_headers.mk
+endif
diff --git a/core/host_shared_test_lib.mk b/core/host_shared_test_lib.mk
deleted file mode 100644
index ed7e23a..0000000
--- a/core/host_shared_test_lib.mk
+++ /dev/null
@@ -1 +0,0 @@
-$(error BUILD_HOST_SHARED_TEST_LIBRARY is obsolete)
diff --git a/core/host_static_library.mk b/core/host_static_library.mk
index 469da29..23d809c 100644
--- a/core/host_static_library.mk
+++ b/core/host_static_library.mk
@@ -37,4 +37,9 @@
###########################################################
## Copy headers to the install tree
###########################################################
-include $(BUILD_COPY_HEADERS)
+ifdef LOCAL_COPY_HEADERS
+$(if $(filter true,$(BUILD_BROKEN_USES_BUILD_COPY_HEADERS)),\
+ $(call pretty-warning,LOCAL_COPY_HEADERS is deprecated. See $(CHANGES_URL)#copy_headers),\
+ $(call pretty-error,LOCAL_COPY_HEADERS is obsolete. See $(CHANGES_URL)#copy_headers))
+include $(BUILD_SYSTEM)/copy_headers.mk
+endif
diff --git a/core/host_static_test_lib.mk b/core/host_static_test_lib.mk
deleted file mode 100644
index a9e39b1..0000000
--- a/core/host_static_test_lib.mk
+++ /dev/null
@@ -1,9 +0,0 @@
-##################################################
-## A thin wrapper around BUILD_HOST_STATIC_LIBRARY
-## Common flags for host native tests are added.
-##################################################
-$(call record-module-type,HOST_STATIC_TEST_LIBRARY)
-
-include $(BUILD_SYSTEM)/host_test_internal.mk
-
-include $(BUILD_SYSTEM)/host_static_library.mk
diff --git a/core/host_test_internal.mk b/core/host_test_internal.mk
deleted file mode 100644
index dfe8cf1..0000000
--- a/core/host_test_internal.mk
+++ /dev/null
@@ -1,28 +0,0 @@
-#####################################################
-## Shared definitions for all host test compilations.
-#####################################################
-
-ifeq ($(LOCAL_GTEST),true)
- LOCAL_CFLAGS_linux += -DGTEST_OS_LINUX
- LOCAL_CFLAGS_darwin += -DGTEST_OS_MAC
-
- LOCAL_CFLAGS += -DGTEST_HAS_STD_STRING -O0 -g
-
- LOCAL_STATIC_LIBRARIES += libgtest_main_host libgtest_host
-endif
-
-ifdef LOCAL_MODULE_PATH
-$(error $(LOCAL_PATH): Do not set LOCAL_MODULE_PATH when building test $(LOCAL_MODULE))
-endif
-
-ifdef LOCAL_MODULE_PATH_32
-$(error $(LOCAL_PATH): Do not set LOCAL_MODULE_PATH_32 when building test $(LOCAL_MODULE))
-endif
-
-ifdef LOCAL_MODULE_PATH_64
-$(error $(LOCAL_PATH): Do not set LOCAL_MODULE_PATH_64 when building test $(LOCAL_MODULE))
-endif
-
-ifndef LOCAL_MODULE_RELATIVE_PATH
-LOCAL_MODULE_RELATIVE_PATH := $(LOCAL_MODULE)
-endif
diff --git a/core/install_jni_libs_internal.mk b/core/install_jni_libs_internal.mk
index eac0414..30bcc2c 100644
--- a/core/install_jni_libs_internal.mk
+++ b/core/install_jni_libs_internal.mk
@@ -12,9 +12,18 @@
# my_embedded_prebuilt_jni_libs, prebuilt jni libs embedded in prebuilt apk.
#
+my_sdk_variant = $(1)
+ifneq (,$(and $(my_embed_jni),$(LOCAL_SDK_VERSION)))
+ # Soong produces $(lib).so in $(lib).sdk_intermediates so that the library
+ # has the correct name for embedding in an APK. Append .sdk to the name
+ # of the intermediates directory, but not the .so name.
+ my_sdk_variant = $(call use_soong_sdk_libraries,$(1))
+endif
+
my_jni_shared_libraries := $(strip \
- $(foreach lib,$(LOCAL_JNI_SHARED_LIBRARIES), \
- $(call intermediates-dir-for,SHARED_LIBRARIES,$(lib),,,$(my_2nd_arch_prefix))/$(lib).so))
+ $(foreach lib,$(LOCAL_JNI_SHARED_LIBRARIES), \
+ $(call intermediates-dir-for,SHARED_LIBRARIES,$(call my_sdk_variant,$(lib)),,,$(my_2nd_arch_prefix))/$(lib).so))
+
# App-specific lib path.
my_app_lib_path := $(dir $(LOCAL_INSTALLED_MODULE))lib/$(TARGET_$(my_2nd_arch_prefix)ARCH)
@@ -49,29 +58,21 @@
my_shared_library_path := $(call get_non_asan_path,\
$($(my_2nd_arch_prefix)TARGET_OUT$(partition_tag)_SHARED_LIBRARIES))
my_installed_library := $(addprefix $(my_shared_library_path)/, $(my_jni_filenames))
- # Do not use order-only dependency, because we want to rebuild the image if an jni is updated.
- $(LOCAL_INSTALLED_MODULE) : $(my_installed_library)
- ALL_MODULES.$(LOCAL_MODULE).INSTALLED += $(my_installed_library)
+ ALL_MODULES.$(my_register_name).INSTALLED += $(my_installed_library)
# Create symlink in the app specific lib path
# Skip creating this symlink when running the second part of a target sanitization build.
ifeq ($(filter address,$(SANITIZE_TARGET)),)
- ifdef LOCAL_POST_INSTALL_CMD
- # Add a shell command separator
- LOCAL_POST_INSTALL_CMD += ;
- endif
-
my_symlink_target_dir := $(patsubst $(PRODUCT_OUT)%,%,\
- $(my_shared_library_path))
- LOCAL_POST_INSTALL_CMD += \
- mkdir -p $(my_app_lib_path) \
- $(foreach lib, $(my_jni_filenames), ;ln -sf $(my_symlink_target_dir)/$(lib) $(my_app_lib_path)/$(lib))
- $(LOCAL_INSTALLED_MODULE): PRIVATE_POST_INSTALL_CMD := $(LOCAL_POST_INSTALL_CMD)
- else
- ifdef LOCAL_POST_INSTALL_CMD
- $(LOCAL_INSTALLED_MODULE): PRIVATE_POST_INSTALL_CMD := $(LOCAL_POST_INSTALL_CMD)
- endif
+ $(my_shared_library_path))
+ $(foreach lib,$(my_jni_filenames),\
+ $(call symlink-file, \
+ $(my_shared_library_path)/$(lib), \
+ $(my_symlink_target_dir)/$(lib), \
+ $(my_app_lib_path)/$(lib)) \
+ $(eval $$(LOCAL_INSTALLED_MODULE) : $$(my_app_lib_path)/$$(lib)) \
+ $(eval ALL_MODULES.$(my_register_name).INSTALLED += $$(my_app_lib_path)/$$(lib)))
endif
# Clear jni_shared_libraries to not embed it into the apk.
@@ -99,7 +100,7 @@
my_installed_library := $(addprefix $(my_app_lib_path)/, $(notdir $(my_prebuilt_jni_libs)))
$(LOCAL_INSTALLED_MODULE) : $(my_installed_library)
- ALL_MODULES.$(LOCAL_MODULE).INSTALLED += $(my_installed_library)
+ ALL_MODULES.$(my_register_name).INSTALLED += $(my_installed_library)
endif # my_embed_jni
endif # inner my_prebuilt_jni_libs
endif # outer my_prebuilt_jni_libs
@@ -114,14 +115,25 @@
my_allowed_types := $(my_allowed_ndk_types)
ifneq (,$(filter true,$(LOCAL_VENDOR_MODULE) $(LOCAL_ODM_MODULE) $(LOCAL_PROPRIETARY_MODULE)))
my_allowed_types += native:vendor native:vndk native:platform_vndk
+ else ifeq ($(LOCAL_PRODUCT_MODULE),true)
+ my_allowed_types += native:product native:vndk native:platform_vndk
endif
else
my_link_type := app:platform
my_warn_types := $(my_warn_ndk_types)
- my_allowed_types := $(my_allowed_ndk_types) native:platform native:vendor native:vndk native:vndk_private native:platform_vndk
+ my_allowed_types := $(my_allowed_ndk_types) native:platform native:product native:vendor native:vndk native:vndk_private native:platform_vndk
endif
- my_link_deps := $(addprefix SHARED_LIBRARIES:,$(LOCAL_JNI_SHARED_LIBRARIES))
+ ifeq ($(SOONG_ANDROID_MK),$(LOCAL_MODULE_MAKEFILE))
+ # SOONG_SDK_VARIANT_MODULES isn't complete yet while parsing Soong modules, and Soong has
+ # already ensured that apps link against the correct SDK variants, don't check them.
+ else
+ ifneq (,$(LOCAL_SDK_VERSION))
+ my_link_deps := $(addprefix SHARED_LIBRARIES:,$(call use_soong_sdk_libraries,$(LOCAL_JNI_SHARED_LIBRARIES)))
+ else
+ my_link_deps := $(addprefix SHARED_LIBRARIES:,$(LOCAL_JNI_SHARED_LIBRARIES))
+ endif
+ endif
my_common :=
include $(BUILD_SYSTEM)/link_type.mk
diff --git a/core/instrumentation_test_config_template.xml b/core/instrumentation_test_config_template.xml
index 18ea676..6ca964e 100644
--- a/core/instrumentation_test_config_template.xml
+++ b/core/instrumentation_test_config_template.xml
@@ -17,6 +17,7 @@
<configuration description="Runs {LABEL}.">
<option name="test-suite-tag" value="apct" />
<option name="test-suite-tag" value="apct-instrumentation" />
+ {EXTRA_CONFIGS}
<target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
<option name="cleanup-apks" value="true" />
<option name="test-file-name" value="{MODULE}.apk" />
diff --git a/core/java.mk b/core/java.mk
index d080450..9d42775 100644
--- a/core/java.mk
+++ b/core/java.mk
@@ -207,7 +207,7 @@
# allowing it to use the classes.jar as the "stubs" that would be use to link
# against, for the cases where someone needs the jar to link against.
$(eval $(call copy-one-file,$(full_classes_jar),$(full_classes_stubs_jar)))
-ALL_MODULES.$(LOCAL_MODULE).STUBS := $(full_classes_stubs_jar)
+ALL_MODULES.$(my_register_name).STUBS := $(full_classes_stubs_jar)
# The layers file allows you to enforce a layering between java packages.
# Run build/make/tools/java-layers.py for more details.
@@ -274,6 +274,8 @@
endif # TURBINE_ENABLED != false
+# TODO(b/143658984): goma can't handle the --system argument to javac.
+#$(full_classes_compiled_jar): .KATI_NINJA_POOL := $(GOMA_POOL)
$(full_classes_compiled_jar): PRIVATE_JAVACFLAGS := $(LOCAL_JAVACFLAGS) $(annotation_processor_flags)
$(full_classes_compiled_jar): PRIVATE_JAR_EXCLUDE_FILES := $(LOCAL_JAR_EXCLUDE_FILES)
$(full_classes_compiled_jar): PRIVATE_JAR_PACKAGES := $(LOCAL_JAR_PACKAGES)
@@ -294,6 +296,7 @@
$(NORMALIZE_PATH) \
$(JAR_ARGS) \
$(ZIPSYNC) \
+ $(SOONG_ZIP) \
| $(SOONG_JAVAC_WRAPPER)
@echo "Target Java: $@
$(call compile-java,$(TARGET_JAVAC),$(PRIVATE_ALL_JAVA_HEADER_LIBRARIES))
@@ -358,9 +361,7 @@
# Temporarily enable --multi-dex until proguard supports v53 class files
# ( http://b/67673860 ) or we move away from proguard altogether.
-ifdef TARGET_OPENJDK9
LOCAL_DX_FLAGS := $(filter-out --multi-dex,$(LOCAL_DX_FLAGS)) --multi-dex
-endif
full_classes_pre_proguard_jar := $(LOCAL_FULL_CLASSES_JACOCO_JAR)
@@ -414,8 +415,7 @@
legacy_proguard_flags += -printmapping $(proguard_dictionary)
legacy_proguard_flags += -printconfiguration $(proguard_configuration)
-common_proguard_flags := -forceprocessing
-
+common_proguard_flags :=
common_proguard_flag_files := $(BUILD_SYSTEM)/proguard.flags
ifneq ($(LOCAL_INSTRUMENTATION_FOR)$(filter tests,$(LOCAL_MODULE_TAGS)),)
common_proguard_flags += -dontshrink # don't shrink tests by default
@@ -501,9 +501,9 @@
$(transform-classes.jar-to-dex)
endif
-ifneq ($(filter $(LOCAL_MODULE),$(PRODUCT_BOOT_JARS)),)
- $(call pretty-error,Modules in PRODUCT_BOOT_JARS must be defined in Android.bp files)
-endif
+$(foreach pair,$(PRODUCT_BOOT_JARS), \
+ $(if $(filter $(LOCAL_MODULE),$(call word-colon,2,$(pair))), \
+ $(call pretty-error,Modules in PRODUCT_BOOT_JARS must be defined in Android.bp files)))
$(built_dex): $(built_dex_intermediate)
@echo Copying: $@
diff --git a/core/java_common.mk b/core/java_common.mk
index dfe75f3..b218c0d 100644
--- a/core/java_common.mk
+++ b/core/java_common.mk
@@ -33,8 +33,7 @@
# TODO(ccross): allow 1.9 for current and unbundled once we have SDK system modules
LOCAL_JAVA_LANGUAGE_VERSION := 1.8
else
- # DEFAULT_JAVA_LANGUAGE_VERSION is 1.8, unless TARGET_OPENJDK9 in which case it is 1.9
- LOCAL_JAVA_LANGUAGE_VERSION := $(DEFAULT_JAVA_LANGUAGE_VERSION)
+ LOCAL_JAVA_LANGUAGE_VERSION := 1.9
endif
endif
LOCAL_JAVACFLAGS += -source $(LOCAL_JAVA_LANGUAGE_VERSION) -target $(LOCAL_JAVA_LANGUAGE_VERSION)
@@ -383,7 +382,9 @@
endif # USE_CORE_LIB_BOOTCLASSPATH
endif # !LOCAL_IS_HOST_MODULE
+ifdef RECORD_ALL_DEPS
ALL_DEPS.$(LOCAL_MODULE).ALL_DEPS := $(ALL_DEPS.$(LOCAL_MODULE).ALL_DEPS) $(full_java_bootclasspath_libs)
+endif
# Export the SDK libs. The sdk library names listed in LOCAL_SDK_LIBRARIES are first exported.
# Then sdk library names exported from dependencies are all re-exported.
diff --git a/core/java_library.mk b/core/java_library.mk
index 4734eaf..3ac03dc 100644
--- a/core/java_library.mk
+++ b/core/java_library.mk
@@ -85,17 +85,6 @@
.KATI_RESTAT: $(common_javalib.jar)
-ifdef LOCAL_DEX_PREOPT
-
-$(LOCAL_BUILT_MODULE): PRIVATE_STRIP_SCRIPT := $(intermediates)/strip.sh
-$(LOCAL_BUILT_MODULE): $(intermediates)/strip.sh
-$(LOCAL_BUILT_MODULE): | $(DEXPREOPT_STRIP_DEPS)
-$(LOCAL_BUILT_MODULE): .KATI_DEPFILE := $(LOCAL_BUILT_MODULE).d
-$(LOCAL_BUILT_MODULE): $(common_javalib.jar)
- $(PRIVATE_STRIP_SCRIPT) $< $@
-
-else # LOCAL_DEX_PREOPT
$(eval $(call copy-one-file,$(common_javalib.jar),$(LOCAL_BUILT_MODULE)))
-endif # LOCAL_DEX_PREOPT
endif # !LOCAL_IS_STATIC_JAVA_LIBRARY
diff --git a/core/java_prebuilt_internal.mk b/core/java_prebuilt_internal.mk
index 5b7e9db..95ae2f8 100644
--- a/core/java_prebuilt_internal.mk
+++ b/core/java_prebuilt_internal.mk
@@ -35,9 +35,9 @@
my_dex_jar := $(my_prebuilt_src_file)
# This is a target shared library, i.e. a jar with classes.dex.
-ifneq ($(filter $(LOCAL_MODULE),$(PRODUCT_BOOT_JARS)),)
- $(call pretty-error,Modules in PRODUCT_BOOT_JARS must be defined in Android.bp files)
-endif
+$(foreach pair,$(PRODUCT_BOOT_JARS), \
+ $(if $(filter $(LOCAL_MODULE),$(call word-colon,2,$(pair))), \
+ $(call pretty-error,Modules in PRODUCT_BOOT_JARS must be defined in Android.bp files)))
ALL_MODULES.$(my_register_name).CLASSES_JAR := $(common_classes_jar)
@@ -45,19 +45,8 @@
# defines built_odex along with rule to install odex
include $(BUILD_SYSTEM)/dex_preopt_odex_install.mk
#######################################
-ifdef LOCAL_DEX_PREOPT
-
-$(built_module): PRIVATE_STRIP_SCRIPT := $(intermediates)/strip.sh
-$(built_module): $(intermediates)/strip.sh
-$(built_module): | $(DEXPREOPT_STRIP_DEPS)
-$(built_module): .KATI_DEPFILE := $(built_module).d
-$(built_module): $(my_prebuilt_src_file)
- $(PRIVATE_STRIP_SCRIPT) $< $@
-
-else # ! LOCAL_DEX_PREOPT
$(built_module) : $(my_prebuilt_src_file)
$(call copy-file-to-target)
-endif # LOCAL_DEX_PREOPT
else # ! prebuilt_module_is_dex_javalib
$(built_module) : $(my_prebuilt_src_file)
diff --git a/core/java_renderscript.mk b/core/java_renderscript.mk
index 672863b..bfcf59e 100644
--- a/core/java_renderscript.mk
+++ b/core/java_renderscript.mk
@@ -129,7 +129,7 @@
endif
my_arch := $(TARGET_$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH)
-ifneq (,$(filter arm64 mips64 x86_64,$(my_arch)))
+ifneq (,$(filter arm64 x86_64,$(my_arch)))
my_min_sdk_version := 21
else
my_min_sdk_version := $(MIN_SUPPORTED_SDK_VERSION)
diff --git a/core/line_coverage.mk b/core/line_coverage.mk
new file mode 100644
index 0000000..9b0b528
--- /dev/null
+++ b/core/line_coverage.mk
@@ -0,0 +1,96 @@
+# -----------------------------------------------------------------
+# Make target for line coverage. This target generates a zip file
+# called `line_coverage_profiles.zip` that contains a large set of
+# zip files one for each fuzz target/critical component. Each zip
+# file contains a set of profile files (*.gcno) that we will use
+# to generate line coverage reports. Furthermore, target compiles
+# all fuzz targets with line coverage instrumentation enabled and
+# packs them into another zip file called `line_coverage_profiles.zip`.
+#
+# To run the make target set the coverage related envvars first:
+# NATIVE_LINE_COVERAGE=true NATIVE_COVERAGE=true \
+# COVERAGE_PATHS=* make haiku-line-coverage
+# -----------------------------------------------------------------
+
+# TODO(b/148306195): Due this issue some fuzz targets cannot be built with
+# line coverage instrumentation. For now we just blacklist them.
+blacklisted_fuzz_targets := libneuralnetworks_fuzzer
+
+fuzz_targets := $(ALL_FUZZ_TARGETS)
+fuzz_targets := $(filter-out $(blacklisted_fuzz_targets),$(fuzz_targets))
+
+
+# Android components that considered critical.
+# Please note that adding/Removing critical components is very rare.
+critical_components_static := \
+ lib-bt-packets \
+ libbt-stack \
+ libffi \
+ libhevcdec \
+ libhevcenc \
+ libmpeg2dec \
+ libosi \
+ libpdx \
+ libselinux \
+ libvold \
+ libyuv
+
+# Format is <module_name> or <module_name>:<apex_name>
+critical_components_shared := \
+ libaudioprocessing \
+ libbinder \
+ libbluetooth_gd \
+ libbrillo \
+ libcameraservice \
+ libcurl \
+ libhardware \
+ libinputflinger \
+ libopus \
+ libstagefright \
+ libunwind \
+ libvixl:com.android.art.debug
+
+# Use the intermediates directory to avoid installing libraries to the device.
+intermediates := $(call intermediates-dir-for,PACKAGING,haiku-line-coverage)
+
+
+# We want the profile files for all fuzz targets + critical components.
+line_coverage_profiles := $(intermediates)/line_coverage_profiles.zip
+
+critical_components_static_inputs := $(foreach lib,$(critical_components_static), \
+ $(call intermediates-dir-for,STATIC_LIBRARIES,$(lib))/$(lib).a)
+
+critical_components_shared_inputs := $(foreach lib,$(critical_components_shared), \
+ $(eval filename := $(call word-colon,1,$(lib))) \
+ $(eval modulename := $(subst :,.,$(lib))) \
+ $(call intermediates-dir-for,SHARED_LIBRARIES,$(modulename))/$(filename).so)
+
+fuzz_target_inputs := $(foreach fuzz,$(fuzz_targets), \
+ $(call intermediates-dir-for,EXECUTABLES,$(fuzz))/$(fuzz))
+
+# When line coverage is enabled (NATIVE_LINE_COVERAGE is set), make creates
+# a "coverage" directory and stores all profile (*.gcno) files in inside.
+# We need everything that is stored inside this directory.
+$(line_coverage_profiles): $(fuzz_target_inputs)
+$(line_coverage_profiles): $(critical_components_static_inputs)
+$(line_coverage_profiles): $(critical_components_shared_inputs)
+$(line_coverage_profiles): $(SOONG_ZIP)
+ $(SOONG_ZIP) -o $@ -D $(PRODUCT_OUT)/coverage
+
+
+# Zip all fuzz targets compiled with line coverage.
+line_coverage_fuzz_targets := $(intermediates)/line_coverage_fuzz_targets.zip
+
+$(line_coverage_fuzz_targets): $(fuzz_target_inputs)
+$(line_coverage_fuzz_targets): $(SOONG_ZIP)
+ $(SOONG_ZIP) -o $@ -j $(addprefix -f ,$(fuzz_target_inputs))
+
+
+.PHONY: haiku-line-coverage
+haiku-line-coverage: $(line_coverage_profiles) $(line_coverage_fuzz_targets)
+$(call dist-for-goals, haiku-line-coverage, \
+ $(line_coverage_profiles):line_coverage_profiles.zip \
+ $(line_coverage_fuzz_targets):line_coverage_fuzz_targets.zip)
+
+line_coverage_profiles :=
+line_coverage_fuzz_targets :=
diff --git a/core/link_type.mk b/core/link_type.mk
index f7604ff..48cd8f3 100644
--- a/core/link_type.mk
+++ b/core/link_type.mk
@@ -10,9 +10,9 @@
# my_link_deps: the dependencies, in the form of <MODULE_CLASS>:<name>
#
-my_link_prefix := LINK_TYPE:$(call find-idf-prefix,$(my_kind),$(my_host_cross))$(if $(filter AUX,$(my_kind)),-$(AUX_OS_VARIANT)):$(if $(my_common),$(my_common):_,_:$(if $(my_2nd_arch_prefix),$(my_2nd_arch_prefix),_))
+my_link_prefix := LINK_TYPE:$(call find-idf-prefix,$(my_kind),$(my_host_cross)):$(if $(my_common),$(my_common):_,_:$(if $(my_2nd_arch_prefix),$(my_2nd_arch_prefix),_))
link_type := $(my_link_prefix):$(LOCAL_MODULE_CLASS):$(LOCAL_MODULE)
-ALL_LINK_TYPES := $(ALL_LINK_TYPES) $(link_type)
+ALL_LINK_TYPES += $(link_type)
$(link_type).TYPE := $(my_link_type)
$(link_type).MAKEFILE := $(LOCAL_MODULE_MAKEFILE)
$(link_type).WARN := $(my_warn_types)
diff --git a/core/local_systemsdk.mk b/core/local_systemsdk.mk
index 6c022f2..460073d 100644
--- a/core/local_systemsdk.mk
+++ b/core/local_systemsdk.mk
@@ -15,19 +15,23 @@
#
ifdef BOARD_SYSTEMSDK_VERSIONS
- # Apps and jars in vendor or odm partition are forced to build against System SDK.
- _is_vendor_app :=
+ # Apps and jars in vendor, product or odm partition are forced to build against System SDK.
+ _cannot_use_platform_apis :=
ifneq (,$(filter true,$(LOCAL_VENDOR_MODULE) $(LOCAL_ODM_MODULE) $(LOCAL_PROPRIETARY_MODULE)))
# Note: no need to check LOCAL_MODULE_PATH* since LOCAL_[VENDOR|ODM|OEM]_MODULE is already
# set correctly before this is included.
- _is_vendor_app := true
+ _cannot_use_platform_apis := true
+ else ifeq ($(LOCAL_PRODUCT_MODULE),true)
+ ifeq ($(PRODUCT_ENFORCE_PRODUCT_PARTITION_INTERFACE),true)
+ _cannot_use_platform_apis := true
+ endif
endif
ifneq (,$(filter JAVA_LIBRARIES APPS,$(LOCAL_MODULE_CLASS)))
ifndef LOCAL_SDK_VERSION
- ifeq ($(_is_vendor_app),true)
- ifeq (,$(filter %__auto_generated_rro_vendor,$(LOCAL_MODULE)))
+ ifeq ($(_cannot_use_platform_apis),true)
+ ifeq (,$(LOCAL_IS_RUNTIME_RESOURCE_OVERLAY))
# Runtime resource overlays are exempted from building against System SDK.
- # TODO(b/35859726): remove this exception
+ # TODO(b/155027019): remove this, after no product/vendor apps rely on this behavior.
LOCAL_SDK_VERSION := system_current
endif
endif
@@ -39,7 +43,7 @@
# The range of support versions becomes narrower when BOARD_SYSTEMSDK_VERSIONS
# is set, which is a subset of PLATFORM_SYSTEMSDK_VERSIONS.
ifneq (,$(call has-system-sdk-version,$(LOCAL_SDK_VERSION)))
- ifneq ($(_is_vendor_app),true)
+ ifneq ($(_cannot_use_platform_apis),true)
# apps bundled in system partition can use all system sdk versions provided by the platform
_supported_systemsdk_versions := $(PLATFORM_SYSTEMSDK_VERSIONS)
else ifdef BOARD_SYSTEMSDK_VERSIONS
diff --git a/core/local_vndk.mk b/core/local_vndk.mk
index 198e361..b1bd3e6 100644
--- a/core/local_vndk.mk
+++ b/core/local_vndk.mk
@@ -1,5 +1,5 @@
-#Set LOCAL_USE_VNDK for modules going into vendor or odm partition, except for host modules
+#Set LOCAL_USE_VNDK for modules going into product, vendor or odm partition, except for host modules
#If LOCAL_SDK_VERSION is set, thats a more restrictive set, so they dont need LOCAL_USE_VNDK
ifndef LOCAL_IS_HOST_MODULE
ifndef LOCAL_SDK_VERSION
@@ -8,6 +8,13 @@
# Note: no need to check LOCAL_MODULE_PATH* since LOCAL_[VENDOR|ODM|OEM]_MODULE is already
# set correctly before this is included.
endif
+ ifdef PRODUCT_PRODUCT_VNDK_VERSION
+ # Product modules also use VNDK when PRODUCT_PRODUCT_VNDK_VERSION is defined.
+ ifeq (true,$(LOCAL_PRODUCT_MODULE))
+ LOCAL_USE_VNDK:=true
+ LOCAL_USE_VNDK_PRODUCT:=true
+ endif
+ endif
endif
endif
@@ -33,6 +40,7 @@
# If we're not using the VNDK, drop all restrictions
ifndef BOARD_VNDK_VERSION
LOCAL_USE_VNDK:=
+ LOCAL_USE_VNDK_PRODUCT:=
endif
endif
diff --git a/core/main.mk b/core/main.mk
index e20f669..a0aa526 100644
--- a/core/main.mk
+++ b/core/main.mk
@@ -38,11 +38,13 @@
# Write the build number to a file so it can be read back in
# without changing the command line every time. Avoids rebuilds
# when using ninja.
-$(shell mkdir -p $(OUT_DIR) && \
- echo -n $(BUILD_NUMBER) > $(OUT_DIR)/build_number.txt)
-BUILD_NUMBER_FILE := $(OUT_DIR)/build_number.txt
+$(shell mkdir -p $(SOONG_OUT_DIR) && \
+ echo -n $(BUILD_NUMBER) > $(SOONG_OUT_DIR)/build_number.txt)
+BUILD_NUMBER_FILE := $(SOONG_OUT_DIR)/build_number.txt
.KATI_READONLY := BUILD_NUMBER_FILE
$(KATI_obsolete_var BUILD_NUMBER,See https://android.googlesource.com/platform/build/+/master/Changes.md#BUILD_NUMBER)
+$(BUILD_NUMBER_FILE):
+ touch $@
DATE_FROM_FILE := date -d @$(BUILD_DATETIME_FROM_FILE)
.KATI_READONLY := DATE_FROM_FILE
@@ -109,44 +111,38 @@
endif
endif
-#
-# -----------------------------------------------------------------
-# Validate ADDITIONAL_DEFAULT_PROPERTIES.
-ifneq ($(ADDITIONAL_DEFAULT_PROPERTIES),)
-$(error ADDITIONAL_DEFAULT_PROPERTIES must not be set before here: $(ADDITIONAL_DEFAULT_PROPERTIES))
-endif
+# ADDITIONAL_<partition>_PROPERTIES are properties that are determined by the
+# build system itself. Don't let it be defined from outside of the core build
+# system like Android.mk or <product>.mk files.
+_additional_prop_var_names := \
+ ADDITIONAL_SYSTEM_PROPERTIES \
+ ADDITIONAL_VENDOR_PROPERTIES \
+ ADDITIONAL_ODM_PROPERTIES \
+ ADDITIONAL_PRODUCT_PROPERTIES
-#
-# -----------------------------------------------------------------
-# Validate ADDITIONAL_BUILD_PROPERTIES.
-ifneq ($(ADDITIONAL_BUILD_PROPERTIES),)
-$(error ADDITIONAL_BUILD_PROPERTIES must not be set before here: $(ADDITIONAL_BUILD_PROPERTIES))
-endif
+$(foreach name, $(_additional_prop_var_names),\
+ $(if $($(name)),\
+ $(error $(name) must not set before here. $($(name)))\
+ ,)\
+ $(eval $(name) :=)\
+)
+_additional_prop_var_names :=
-ADDITIONAL_BUILD_PROPERTIES :=
-
-#
-# -----------------------------------------------------------------
-# Validate ADDITIONAL_PRODUCT_PROPERTIES.
-ifneq ($(ADDITIONAL_PRODUCT_PROPERTIES),)
-$(error ADDITIONAL_PRODUCT_PROPERTIES must not be set before here: $(ADDITIONAL_PRODUCT_PROPERTIES))
-endif
-
-ADDITIONAL_PRODUCT_PROPERTIES :=
+$(KATI_obsolete_var ADDITIONAL_BUILD_PROPERTIES, Please use ADDITIONAL_SYSTEM_PROPERTIES)
#
# -----------------------------------------------------------------
# Add the product-defined properties to the build properties.
ifdef PRODUCT_SHIPPING_API_LEVEL
-ADDITIONAL_BUILD_PROPERTIES += \
+ADDITIONAL_SYSTEM_PROPERTIES += \
ro.product.first_api_level=$(PRODUCT_SHIPPING_API_LEVEL)
endif
ifneq ($(BOARD_PROPERTY_OVERRIDES_SPLIT_ENABLED), true)
- ADDITIONAL_BUILD_PROPERTIES += $(PRODUCT_PROPERTY_OVERRIDES)
+ ADDITIONAL_SYSTEM_PROPERTIES += $(PRODUCT_PROPERTY_OVERRIDES)
else
ifndef BOARD_VENDORIMAGE_FILE_SYSTEM_TYPE
- ADDITIONAL_BUILD_PROPERTIES += $(PRODUCT_PROPERTY_OVERRIDES)
+ ADDITIONAL_SYSTEM_PROPERTIES += $(PRODUCT_PROPERTY_OVERRIDES)
endif
endif
@@ -193,19 +189,9 @@
# The pdk (Platform Development Kit) build
include build/make/core/pdk_config.mk
-#
# -----------------------------------------------------------------
-# Enable dynamic linker warnings for userdebug, eng and non-REL builds
-ifneq ($(TARGET_BUILD_VARIANT),user)
- ADDITIONAL_BUILD_PROPERTIES += ro.bionic.ld.warning=1
-else
-# Enable it for user builds as long as they are not final.
-ifneq ($(PLATFORM_VERSION_CODENAME),REL)
- ADDITIONAL_BUILD_PROPERTIES += ro.bionic.ld.warning=1
-endif
-endif
-ADDITIONAL_BUILD_PROPERTIES += ro.treble.enabled=${PRODUCT_FULL_TREBLE}
+ADDITIONAL_SYSTEM_PROPERTIES += ro.treble.enabled=${PRODUCT_FULL_TREBLE}
$(KATI_obsolete_var PRODUCT_FULL_TREBLE,\
Code should be written to work regardless of a device being Treble or \
@@ -215,9 +201,9 @@
# Sets ro.actionable_compatible_property.enabled to know on runtime whether the whitelist
# of actionable compatible properties is enabled or not.
ifeq ($(PRODUCT_ACTIONABLE_COMPATIBLE_PROPERTY_DISABLE),true)
-ADDITIONAL_DEFAULT_PROPERTIES += ro.actionable_compatible_property.enabled=false
+ADDITIONAL_SYSTEM_PROPERTIES += ro.actionable_compatible_property.enabled=false
else
-ADDITIONAL_DEFAULT_PROPERTIES += ro.actionable_compatible_property.enabled=${PRODUCT_COMPATIBLE_PROPERTY}
+ADDITIONAL_SYSTEM_PROPERTIES += ro.actionable_compatible_property.enabled=${PRODUCT_COMPATIBLE_PROPERTY}
endif
# Add the system server compiler filter if they are specified for the product.
@@ -227,7 +213,7 @@
# Enable core platform API violation warnings on userdebug and eng builds.
ifneq ($(TARGET_BUILD_VARIANT),user)
-ADDITIONAL_BUILD_PROPERTIES += persist.debug.dalvik.vm.core_platform_api_policy=just-warn
+ADDITIONAL_SYSTEM_PROPERTIES += persist.debug.dalvik.vm.core_platform_api_policy=just-warn
endif
# Sets the default value of ro.postinstall.fstab.prefix to /system.
@@ -237,7 +223,113 @@
#
# It then uses ${ro.postinstall.fstab.prefix}/etc/fstab.postinstall to
# mount system_other partition.
-ADDITIONAL_DEFAULT_PROPERTIES += ro.postinstall.fstab.prefix=/system
+ADDITIONAL_SYSTEM_PROPERTIES += ro.postinstall.fstab.prefix=/system
+
+# -----------------------------------------------------------------
+# ADDITIONAL_VENDOR_PROPERTIES will be installed in vendor/build.prop if
+# property_overrides_split_enabled is true. Otherwise it will be installed in
+# /system/build.prop
+ifdef BOARD_VNDK_VERSION
+ ifeq ($(BOARD_VNDK_VERSION),current)
+ ADDITIONAL_VENDOR_PROPERTIES := ro.vndk.version=$(PLATFORM_VNDK_VERSION)
+ else
+ ADDITIONAL_VENDOR_PROPERTIES := ro.vndk.version=$(BOARD_VNDK_VERSION)
+ endif
+ ifdef BOARD_VNDK_RUNTIME_DISABLE
+ ADDITIONAL_VENDOR_PROPERTIES += ro.vndk.lite=true
+ endif
+else
+ ADDITIONAL_VENDOR_PROPERTIES := ro.vndk.version=$(PLATFORM_VNDK_VERSION)
+ ADDITIONAL_VENDOR_PROPERTIES += ro.vndk.lite=true
+endif
+ADDITIONAL_VENDOR_PROPERTIES += \
+ $(call collapse-pairs, $(PRODUCT_DEFAULT_PROPERTY_OVERRIDES))
+
+# Add cpu properties for bionic and ART.
+ADDITIONAL_VENDOR_PROPERTIES += ro.bionic.arch=$(TARGET_ARCH)
+ADDITIONAL_VENDOR_PROPERTIES += ro.bionic.cpu_variant=$(TARGET_CPU_VARIANT_RUNTIME)
+ADDITIONAL_VENDOR_PROPERTIES += ro.bionic.2nd_arch=$(TARGET_2ND_ARCH)
+ADDITIONAL_VENDOR_PROPERTIES += ro.bionic.2nd_cpu_variant=$(TARGET_2ND_CPU_VARIANT_RUNTIME)
+
+ADDITIONAL_VENDOR_PROPERTIES += persist.sys.dalvik.vm.lib.2=libart.so
+ADDITIONAL_VENDOR_PROPERTIES += dalvik.vm.isa.$(TARGET_ARCH).variant=$(DEX2OAT_TARGET_CPU_VARIANT_RUNTIME)
+ifneq ($(DEX2OAT_TARGET_INSTRUCTION_SET_FEATURES),)
+ ADDITIONAL_VENDOR_PROPERTIES += dalvik.vm.isa.$(TARGET_ARCH).features=$(DEX2OAT_TARGET_INSTRUCTION_SET_FEATURES)
+endif
+
+ifdef TARGET_2ND_ARCH
+ ADDITIONAL_VENDOR_PROPERTIES += dalvik.vm.isa.$(TARGET_2ND_ARCH).variant=$($(TARGET_2ND_ARCH_VAR_PREFIX)DEX2OAT_TARGET_CPU_VARIANT_RUNTIME)
+ ifneq ($($(TARGET_2ND_ARCH_VAR_PREFIX)DEX2OAT_TARGET_INSTRUCTION_SET_FEATURES),)
+ ADDITIONAL_VENDOR_PROPERTIES += dalvik.vm.isa.$(TARGET_2ND_ARCH).features=$($(TARGET_2ND_ARCH_VAR_PREFIX)DEX2OAT_TARGET_INSTRUCTION_SET_FEATURES)
+ endif
+endif
+
+# Although these variables are prefixed with TARGET_RECOVERY_, they are also needed under charger
+# mode (via libminui).
+ifdef TARGET_RECOVERY_DEFAULT_ROTATION
+ADDITIONAL_VENDOR_PROPERTIES += \
+ ro.minui.default_rotation=$(TARGET_RECOVERY_DEFAULT_ROTATION)
+endif
+ifdef TARGET_RECOVERY_OVERSCAN_PERCENT
+ADDITIONAL_VENDOR_PROPERTIES += \
+ ro.minui.overscan_percent=$(TARGET_RECOVERY_OVERSCAN_PERCENT)
+endif
+ifdef TARGET_RECOVERY_PIXEL_FORMAT
+ADDITIONAL_VENDOR_PROPERTIES += \
+ ro.minui.pixel_format=$(TARGET_RECOVERY_PIXEL_FORMAT)
+endif
+
+ifdef PRODUCT_USE_DYNAMIC_PARTITIONS
+ADDITIONAL_VENDOR_PROPERTIES += \
+ ro.boot.dynamic_partitions=$(PRODUCT_USE_DYNAMIC_PARTITIONS)
+endif
+
+ifdef PRODUCT_RETROFIT_DYNAMIC_PARTITIONS
+ADDITIONAL_VENDOR_PROPERTIES += \
+ ro.boot.dynamic_partitions_retrofit=$(PRODUCT_RETROFIT_DYNAMIC_PARTITIONS)
+endif
+
+ifdef PRODUCT_SHIPPING_API_LEVEL
+ADDITIONAL_VENDOR_PROPERTIES += \
+ ro.product.first_api_level=$(PRODUCT_SHIPPING_API_LEVEL)
+endif
+
+ADDITIONAL_VENDOR_PROPERTIES += \
+ ro.vendor.build.security_patch=$(VENDOR_SECURITY_PATCH) \
+ ro.vendor.product.cpu.abilist=$(TARGET_CPU_ABI_LIST) \
+ ro.vendor.product.cpu.abilist32=$(TARGET_CPU_ABI_LIST_32_BIT) \
+ ro.vendor.product.cpu.abilist64=$(TARGET_CPU_ABI_LIST_64_BIT) \
+ ro.product.board=$(TARGET_BOOTLOADER_BOARD_NAME) \
+ ro.board.platform=$(TARGET_BOARD_PLATFORM) \
+ ro.hwui.use_vulkan=$(TARGET_USES_VULKAN)
+
+ifdef TARGET_SCREEN_DENSITY
+ADDITIONAL_VENDOR_PROPERTIES += \
+ ro.sf.lcd_density=$(TARGET_SCREEN_DENSITY)
+endif
+
+ifdef AB_OTA_UPDATER
+ADDITIONAL_VENDOR_PROPERTIES += \
+ ro.build.ab_update=$(AB_OTA_UPDATER)
+endif
+
+ADDITIONAL_ODM_PROPERTIES += \
+ ro.odm.product.cpu.abilist=$(TARGET_CPU_ABI_LIST) \
+ ro.odm.product.cpu.abilist32=$(TARGET_CPU_ABI_LIST_32_BIT) \
+ ro.odm.product.cpu.abilist64=$(TARGET_CPU_ABI_LIST_64_BIT)
+
+# Set ro.product.vndk.version to know the VNDK version required by product
+# modules. It uses the version in PRODUCT_PRODUCT_VNDK_VERSION. If the value
+# is "current", use PLATFORM_VNDK_VERSION.
+ifdef PRODUCT_PRODUCT_VNDK_VERSION
+ifeq ($(PRODUCT_PRODUCT_VNDK_VERSION),current)
+ADDITIONAL_PRODUCT_PROPERTIES += ro.product.vndk.version=$(PLATFORM_VNDK_VERSION)
+else
+ADDITIONAL_PRODUCT_PROPERTIES += ro.product.vndk.version=$(PRODUCT_PRODUCT_VNDK_VERSION)
+endif
+endif
+
+ADDITIONAL_PRODUCT_PROPERTIES += ro.build.characteristics=$(TARGET_AAPT_CHARACTERISTICS)
# -----------------------------------------------------------------
###
@@ -258,11 +350,11 @@
tags_to_install :=
ifneq (,$(user_variant))
# Target is secure in user builds.
- ADDITIONAL_DEFAULT_PROPERTIES += ro.secure=1
- ADDITIONAL_DEFAULT_PROPERTIES += security.perf_harden=1
+ ADDITIONAL_SYSTEM_PROPERTIES += ro.secure=1
+ ADDITIONAL_SYSTEM_PROPERTIES += security.perf_harden=1
ifeq ($(user_variant),user)
- ADDITIONAL_DEFAULT_PROPERTIES += ro.adb.secure=1
+ ADDITIONAL_SYSTEM_PROPERTIES += ro.adb.secure=1
endif
ifeq ($(user_variant),userdebug)
@@ -274,40 +366,40 @@
endif
# Disallow mock locations by default for user builds
- ADDITIONAL_DEFAULT_PROPERTIES += ro.allow.mock.location=0
+ ADDITIONAL_SYSTEM_PROPERTIES += ro.allow.mock.location=0
else # !user_variant
# Turn on checkjni for non-user builds.
- ADDITIONAL_BUILD_PROPERTIES += ro.kernel.android.checkjni=1
+ ADDITIONAL_SYSTEM_PROPERTIES += ro.kernel.android.checkjni=1
# Set device insecure for non-user builds.
- ADDITIONAL_DEFAULT_PROPERTIES += ro.secure=0
+ ADDITIONAL_SYSTEM_PROPERTIES += ro.secure=0
# Allow mock locations by default for non user builds
- ADDITIONAL_DEFAULT_PROPERTIES += ro.allow.mock.location=1
+ ADDITIONAL_SYSTEM_PROPERTIES += ro.allow.mock.location=1
endif # !user_variant
ifeq (true,$(strip $(enable_target_debugging)))
# Target is more debuggable and adbd is on by default
- ADDITIONAL_DEFAULT_PROPERTIES += ro.debuggable=1
+ ADDITIONAL_SYSTEM_PROPERTIES += ro.debuggable=1
# Enable Dalvik lock contention logging.
- ADDITIONAL_BUILD_PROPERTIES += dalvik.vm.lockprof.threshold=500
+ ADDITIONAL_SYSTEM_PROPERTIES += dalvik.vm.lockprof.threshold=500
else # !enable_target_debugging
# Target is less debuggable and adbd is off by default
- ADDITIONAL_DEFAULT_PROPERTIES += ro.debuggable=0
+ ADDITIONAL_SYSTEM_PROPERTIES += ro.debuggable=0
endif # !enable_target_debugging
## eng ##
ifeq ($(TARGET_BUILD_VARIANT),eng)
tags_to_install := debug eng
-ifneq ($(filter ro.setupwizard.mode=ENABLED, $(call collapse-pairs, $(ADDITIONAL_BUILD_PROPERTIES))),)
+ifneq ($(filter ro.setupwizard.mode=ENABLED, $(call collapse-pairs, $(ADDITIONAL_SYSTEM_PROPERTIES))),)
# Don't require the setup wizard on eng builds
- ADDITIONAL_BUILD_PROPERTIES := $(filter-out ro.setupwizard.mode=%,\
- $(call collapse-pairs, $(ADDITIONAL_BUILD_PROPERTIES))) \
+ ADDITIONAL_SYSTEM_PROPERTIES := $(filter-out ro.setupwizard.mode=%,\
+ $(call collapse-pairs, $(ADDITIONAL_SYSTEM_PROPERTIES))) \
ro.setupwizard.mode=OPTIONAL
endif
ifndef is_sdk_build
# To speedup startup of non-preopted builds, don't verify or compile the boot image.
- ADDITIONAL_BUILD_PROPERTIES += dalvik.vm.image-dex2oat-filter=verify-at-runtime
+ ADDITIONAL_SYSTEM_PROPERTIES += dalvik.vm.image-dex2oat-filter=extract
endif
endif
@@ -341,20 +433,17 @@
$(error The 'sdk' target may not be specified with any other targets)
endif
-# AUX dependencies are already added by now; remove triggers from the MAKECMDGOALS
-MAKECMDGOALS := $(strip $(filter-out AUX-%,$(MAKECMDGOALS)))
-
# TODO: this should be eng I think. Since the sdk is built from the eng
# variant.
tags_to_install := debug eng
-ADDITIONAL_BUILD_PROPERTIES += xmpp.auto-presence=true
-ADDITIONAL_BUILD_PROPERTIES += ro.config.nocheckin=yes
+ADDITIONAL_SYSTEM_PROPERTIES += xmpp.auto-presence=true
+ADDITIONAL_SYSTEM_PROPERTIES += ro.config.nocheckin=yes
else # !sdk
endif
BUILD_WITHOUT_PV := true
-ADDITIONAL_BUILD_PROPERTIES += net.bt.name=Android
+ADDITIONAL_SYSTEM_PROPERTIES += net.bt.name=Android
# ------------------------------------------------------------
# Define a function that, given a list of module tags, returns
@@ -388,10 +477,8 @@
# Strip and readonly a few more variables so they won't be modified.
$(readonly-final-product-vars)
-ADDITIONAL_DEFAULT_PROPERTIES := $(strip $(ADDITIONAL_DEFAULT_PROPERTIES))
-.KATI_READONLY := ADDITIONAL_DEFAULT_PROPERTIES
-ADDITIONAL_BUILD_PROPERTIES := $(strip $(ADDITIONAL_BUILD_PROPERTIES))
-.KATI_READONLY := ADDITIONAL_BUILD_PROPERTIES
+ADDITIONAL_SYSTEM_PROPERTIES := $(strip $(ADDITIONAL_SYSTEM_PROPERTIES))
+.KATI_READONLY := ADDITIONAL_SYSTEM_PROPERTIES
ADDITIONAL_PRODUCT_PROPERTIES := $(strip $(ADDITIONAL_PRODUCT_PROPERTIES))
.KATI_READONLY := ADDITIONAL_PRODUCT_PROPERTIES
@@ -440,10 +527,6 @@
subdir_makefiles_total := $(words init post finish)
endif
-droid_targets: no_vendor_variant_vndk_check
-.PHONY: no_vendor_variant_vndk_check
-no_vendor_variant_vndk_check:
-
$(info [$(call inc_and_print,subdir_makefiles_inc)/$(subdir_makefiles_total)] finishing build rules ...)
# -------------------------------------------------------------------
@@ -471,6 +554,13 @@
endif
# -------------------------------------------------------------------
+# Sort ALL_MODULES to remove duplicate entries.
+# -------------------------------------------------------------------
+ALL_MODULES := $(sort $(ALL_MODULES))
+# Cannot set to readonly because Makefile extends ALL_MODULES
+# .KATI_READONLY := ALL_MODULES
+
+# -------------------------------------------------------------------
# Fix up CUSTOM_MODULES to refer to installed files rather than
# just bare module names. Leave unknown modules alone in case
# they're actually full paths to a particular file.
@@ -491,96 +581,99 @@
# brought in as requirements of other modules.
#
# Resolve the required module name to 32-bit or 64-bit variant.
-# Get a list of corresponding 32-bit module names, if one exists.
-define get-32-bit-modules
-$(sort $(foreach m,$(1),\
- $(if $(ALL_MODULES.$(m)$(TARGET_2ND_ARCH_MODULE_SUFFIX).CLASS),\
- $(m)$(TARGET_2ND_ARCH_MODULE_SUFFIX))))
-endef
-# Get a list of corresponding 32-bit module names, if one exists;
-# otherwise return the original module name
-define get-32-bit-modules-if-we-can
-$(sort $(foreach m,$(1),\
- $(if $(ALL_MODULES.$(m)$(TARGET_2ND_ARCH_MODULE_SUFFIX).CLASS),\
- $(m)$(TARGET_2ND_ARCH_MODULE_SUFFIX), \
- $(m))))
-endef
-# TODO: we can probably check to see if these modules are actually host
-# modules
-define get-host-32-bit-modules
-$(sort $(foreach m,$(1),\
- $(if $(ALL_MODULES.$(m)$(HOST_2ND_ARCH_MODULE_SUFFIX).CLASS),\
- $(m)$(HOST_2ND_ARCH_MODULE_SUFFIX))))
-endef
-# Get a list of corresponding 32-bit module names, if one exists;
-# otherwise return the original module name
-define get-host-32-bit-modules-if-we-can
-$(sort $(foreach m,$(1),\
- $(if $(ALL_MODULES.$(m)$(HOST_2ND_ARCH_MODULE_SUFFIX).CLASS),\
- $(m)$(HOST_2ND_ARCH_MODULE_SUFFIX),\
- $(m))))
-endef
-
-# If a module is for a cross host os, the required modules must be for
-# that OS too.
-# If a module is built for 32-bit, the required modules must be 32-bit too;
-# Otherwise if the module is an executable or shared library,
-# the required modules must be 64-bit;
-# otherwise we require both 64-bit and 32-bit variant, if one exists.
-define target-select-bitness-of-required-modules
-$(foreach m,$(ALL_MODULES),\
- $(eval r := $(ALL_MODULES.$(m).REQUIRED_FROM_TARGET))\
- $(if $(r),\
- $(if $(ALL_MODULES.$(m).FOR_2ND_ARCH),\
- $(eval r_r := $(call get-32-bit-modules-if-we-can,$(r))),\
- $(if $(filter EXECUTABLES SHARED_LIBRARIES NATIVE_TESTS,$(ALL_MODULES.$(m).CLASS)),\
- $(eval r_r := $(r)),\
- $(eval r_r := $(r) $(call get-32-bit-modules,$(r)))\
- )\
- )\
- $(eval ALL_MODULES.$(m).REQUIRED_FROM_TARGET := $(strip $(r_r)))\
- )\
+# Get a list of corresponding module names for the second arch, if they exist.
+# $(1): TARGET, HOST or HOST_CROSS
+# $(2): A list of module names
+define get-modules-for-2nd-arch
+$(strip \
+ $(foreach m,$(2), \
+ $(if $(filter true,$(ALL_MODULES.$(m)$($(1)_2ND_ARCH_MODULE_SUFFIX).FOR_2ND_ARCH)), \
+ $(m)$($(1)_2ND_ARCH_MODULE_SUFFIX) \
+ ) \
+ ) \
)
endef
-$(call target-select-bitness-of-required-modules)
-define host-select-bitness-of-required-modules
-$(foreach m,$(ALL_MODULES),\
- $(eval r := $(ALL_MODULES.$(m).REQUIRED_FROM_HOST))\
- $(if $(r),\
- $(if $(ALL_MODULES.$(m).FOR_2ND_ARCH),\
- $(eval r_r := $(call get-host-32-bit-modules-if-we-can,$(r))),\
- $(if $(filter EXECUTABLES SHARED_LIBRARIES NATIVE_TESTS,$(ALL_MODULES.$(m).CLASS)),\
- $(eval r_r := $(r)),\
- $(eval r_r := $(r) $(call get-host-32-bit-modules,$(r)))\
- )\
- )\
- $(eval ALL_MODULES.$(m).REQUIRED_FROM_HOST := $(strip $(r_r)))\
- )\
+# Resolves module bitness for PRODUCT_PACKAGES and PRODUCT_HOST_PACKAGES.
+# The returned list of module names can be used to access
+# ALL_MODULES.<module>.<*> variables.
+# Name resolution for PRODUCT_PACKAGES / PRODUCT_HOST_PACKAGES:
+# foo:32 resolves to foo_32;
+# foo:64 resolves to foo;
+# foo resolves to both foo and foo_32 (if foo_32 is defined).
+#
+# Name resolution for HOST_CROSS modules:
+# foo:32 resolves to foo;
+# foo:64 resolves to foo_64;
+# foo resolves to both foo and foo_64 (if foo_64 is defined).
+#
+# $(1): TARGET, HOST or HOST_CROSS
+# $(2): A list of simple module names with :32 and :64 suffix
+define resolve-bitness-for-modules
+$(strip \
+ $(eval modules_32 := $(patsubst %:32,%,$(filter %:32,$(2)))) \
+ $(eval modules_64 := $(patsubst %:64,%,$(filter %:64,$(2)))) \
+ $(eval modules_both := $(filter-out %:32 %:64,$(2))) \
+ $(eval ### For host cross modules, the primary arch is windows x86 and secondary is x86_64) \
+ $(if $(filter HOST_CROSS,$(1)), \
+ $(eval modules_1st_arch := $(modules_32)) \
+ $(eval modules_2nd_arch := $(modules_64)), \
+ $(eval modules_1st_arch := $(modules_64)) \
+ $(eval modules_2nd_arch := $(modules_32))) \
+ $(eval ### Note for 32-bit product, 32 and 64 will be added as their original module names.) \
+ $(eval modules := $(modules_1st_arch)) \
+ $(if $($(1)_2ND_ARCH), \
+ $(eval modules += $(call get-modules-for-2nd-arch,$(1),$(modules_2nd_arch))), \
+ $(eval modules += $(modules_2nd_arch))) \
+ $(eval ### For the rest we add both) \
+ $(eval modules += $(modules_both)) \
+ $(if $($(1)_2ND_ARCH), \
+ $(eval modules += $(call get-modules-for-2nd-arch,$(1),$(modules_both)))) \
+ $(modules) \
)
endef
-$(call host-select-bitness-of-required-modules)
-define host-cross-select-bitness-of-required-modules
-$(foreach m,$(ALL_MODULES),\
- $(eval r := $(ALL_MODULES.$(m).REQUIRED_FROM_HOST_CROSS))\
- $(if $(r),\
- $(if $(ALL_MODULES.$(m).FOR_HOST_CROSS),,$(error Only expected REQUIRED_FROM_HOST_CROSS on FOR_HOST_CROSS modules - $(m)))\
- $(eval r := $(addprefix host_cross_,$(r)))\
- $(if $(ALL_MODULES.$(m).FOR_2ND_ARCH),\
- $(eval r_r := $(call get-host-32-bit-modules-if-we-can,$(r))),\
- $(if $(filter EXECUTABLES SHARED_LIBRARIES NATIVE_TESTS,$(ALL_MODULES.$(m).CLASS)),\
- $(eval r_r := $(r)),\
- $(eval r_r := $(r) $(call get-host-32-bit-modules,$(r)))\
- )\
- )\
- $(eval ALL_MODULES.$(m).REQUIRED_FROM_HOST_CROSS := $(strip $(r_r)))\
- )\
+# TODO(b/7456955): error if a required module doesn't exist.
+# Resolve the required module names in ALL_MODULES.*.REQUIRED_FROM_TARGET,
+# ALL_MODULES.*.REQUIRED_FROM_HOST and ALL_MODULES.*.REQUIRED_FROM_HOST_CROSS
+# to 32-bit or 64-bit variant.
+# If a module is for cross host OS, the required modules are also for that OS.
+# Required modules explicitly suffixed with :32 or :64 resolve to that bitness.
+# Otherwise if the requiring module is native and the required module is shared
+# library or native test, then the required module resolves to the same bitness.
+# Otherwise the required module resolves to both variants, if they exist.
+# $(1): TARGET, HOST or HOST_CROSS
+define select-bitness-of-required-modules
+$(foreach m,$(ALL_MODULES), \
+ $(eval r := $(ALL_MODULES.$(m).REQUIRED_FROM_$(1))) \
+ $(if $(r), \
+ $(if $(filter HOST_CROSS,$(1)), \
+ $(if $(ALL_MODULES.$(m).FOR_HOST_CROSS),,$(error Only expected REQUIRED_FROM_HOST_CROSS on FOR_HOST_CROSS modules - $(m))) \
+ $(eval r := $(addprefix host_cross_,$(r)))) \
+ $(eval module_is_native := \
+ $(filter EXECUTABLES SHARED_LIBRARIES NATIVE_TESTS,$(ALL_MODULES.$(m).CLASS))) \
+ $(eval r_r := $(foreach r_i,$(r), \
+ $(if $(filter %:32 %:64,$(r_i)), \
+ $(eval r_m := $(call resolve-bitness-for-modules,$(1),$(r_i))), \
+ $(eval r_m := \
+ $(eval r_i_2nd := $(call get-modules-for-2nd-arch,$(1),$(r_i))) \
+ $(eval required_is_shared_library_or_native_test := \
+ $(filter SHARED_LIBRARIES NATIVE_TESTS, \
+ $(ALL_MODULES.$(r_i).CLASS) $(ALL_MODULES.$(r_i_2nd).CLASS))) \
+ $(if $(and $(module_is_native),$(required_is_shared_library_or_native_test)), \
+ $(if $(ALL_MODULES.$(m).FOR_2ND_ARCH),$(r_i_2nd),$(r_i)), \
+ $(r_i) $(r_i_2nd)))) \
+ $(eval ### TODO(b/7456955): error if r_m is empty / does not exist) \
+ $(r_m))) \
+ $(eval ALL_MODULES.$(m).REQUIRED_FROM_$(1) := $(sort $(r_r))) \
+ ) \
)
endef
-$(call host-cross-select-bitness-of-required-modules)
-r_r :=
+
+$(call select-bitness-of-required-modules,TARGET)
+$(call select-bitness-of-required-modules,HOST)
+$(call select-bitness-of-required-modules,HOST_CROSS)
define add-required-deps
$(1): | $(2)
@@ -741,15 +834,18 @@
$(_all_deps_for_$(1)_))
endef
-# Scan all modules in general-tests and device-tests suite and flatten the
-# shared library dependencies.
+# Scan all modules in general-tests, device-tests and other selected suites and
+# flatten the shared library dependencies.
define update-host-shared-libs-deps-for-suites
-$(foreach suite,general-tests device-tests,\
+$(foreach suite,general-tests device-tests vts,\
$(foreach m,$(COMPATIBILITY.$(suite).MODULES),\
$(eval my_deps := $(call get-all-shared-libs-deps,$(m)))\
$(foreach dep,$(my_deps),\
$(foreach f,$(ALL_MODULES.$(dep).HOST_SHARED_LIBRARY_FILES),\
- $(eval target := $(HOST_OUT_TESTCASES)/$(lastword $(subst /, ,$(dir $(f))))/$(notdir $(f)))\
+ $(if $(filter $(suite),device-tests general-tests),\
+ $(eval my_testcases := $(HOST_OUT_TESTCASES)),\
+ $(eval my_testcases := $$(COMPATIBILITY_TESTCASES_OUT_$(suite))))\
+ $(eval target := $(my_testcases)/$(lastword $(subst /, ,$(dir $(f))))/$(notdir $(f)))\
$(eval COMPATIBILITY.$(suite).HOST_SHARED_LIBRARY.FILES := \
$$(COMPATIBILITY.$(suite).HOST_SHARED_LIBRARY.FILES) $(f):$(target))\
$(eval COMPATIBILITY.$(suite).HOST_SHARED_LIBRARY.FILES := \
@@ -796,9 +892,10 @@
$($(if $(2),$($(1)2ND_ARCH_VAR_PREFIX))TARGET_OUT_INTERMEDIATES)/SHARED_LIBRARIES/%,\
$(call module-built-files,$(mod)))))\
\
- $(if $(r),\
+ $(if $(and $(r),$(deps)),\
$(eval stamp := $(dir $(r))check_elf_files.timestamp)\
- $(eval $(call add-elf-file-check-shared-lib,$(stamp),$(deps)))\
+ $(if $(CHECK_ELF_FILES.$(stamp)),\
+ $(eval $(call add-elf-file-check-shared-lib,$(stamp),$(deps))))\
))
endef
@@ -828,7 +925,6 @@
# - TARGET
# - HOST
# - HOST_CROSS
-# - AUX-<variant-name>
# 3: Whether to use the common intermediates directory or not
# - _
# - COMMON
@@ -855,14 +951,8 @@
link_type_error :=
-define link-type-prefix-base
-$(word 2,$(subst :,$(space),$(1)))
-endef
define link-type-prefix
-$(if $(filter AUX-%,$(link-type-prefix-base)),$(patsubst AUX-%,AUX,$(link-type-prefix-base)),$(link-type-prefix-base))
-endef
-define link-type-aux-variant
-$(if $(filter AUX-%,$(link-type-prefix-base)),$(patsubst AUX-%,%,$(link-type-prefix-base)))
+$(word 2,$(subst :,$(space),$(1)))
endef
define link-type-common
$(patsubst _,,$(word 3,$(subst :,$(space),$(1))))
@@ -880,7 +970,7 @@
$(strip $(eval _p := $(link-type-prefix))\
$(if $(filter HOST HOST_CROSS,$(_p)),\
$($(_p)_OS),\
- $(if $(filter AUX,$(_p)),AUX,android)))
+ android))
endef
define link-type-arch
$($(link-type-prefix)_$(link-type-2ndarchprefix)ARCH)
@@ -932,10 +1022,6 @@
$(call link-type-error,$(1),$(2),$(t)))))
endef
-# TODO: Verify all branches/configs have reasonable warnings/errors, and remove
-# this override
-verify-link-type = $(eval $$(1).MISSING := true)
-
$(foreach lt,$(ALL_LINK_TYPES),\
$(foreach d,$($(lt).DEPS),\
$(if $($(d).TYPE),\
@@ -977,7 +1063,7 @@
# Expand a list of modules to the modules that they override (if any)
# $(1): The list of modules.
define module-overrides
-$(foreach m,$(1),$(PACKAGES.$(m).OVERRIDES) $(EXECUTABLES.$(m).OVERRIDES) $(SHARED_LIBRARIES.$(m).OVERRIDES))
+$(foreach m,$(1),$(PACKAGES.$(m).OVERRIDES) $(EXECUTABLES.$(m).OVERRIDES) $(SHARED_LIBRARIES.$(m).OVERRIDES) $(ETC.$(m).OVERRIDES))
endef
###########################################################
@@ -1030,7 +1116,8 @@
# variables being set.
define auto-included-modules
$(if $(BOARD_VNDK_VERSION),vndk_package) \
- $(if $(DEVICE_MANIFEST_FILE),device_manifest.xml) \
+ $(if $(DEVICE_MANIFEST_FILE),vendor_manifest.xml) \
+ $(if $(DEVICE_MANIFEST_SKUS),$(foreach sku, $(DEVICE_MANIFEST_SKUS),vendor_manifest_$(sku).xml)) \
$(if $(ODM_MANIFEST_FILES),odm_manifest.xml) \
$(if $(ODM_MANIFEST_SKUS),$(foreach sku, $(ODM_MANIFEST_SKUS),odm_manifest_$(sku).xml)) \
@@ -1048,55 +1135,39 @@
# foo resolves to both foo and foo_32 (if foo_32 is defined).
#
# Name resolution for LOCAL_REQUIRED_MODULES:
-# If a module is built for 2nd arch, its required module resolves to
-# 32-bit variant, if it exits. See the select-bitness-of-required-modules definition.
+# See the select-bitness-of-required-modules definition.
# $(1): product makefile
define product-installed-files
- $(eval _mk := $(strip $(1))) \
$(eval _pif_modules := \
- $(PRODUCTS.$(_mk).PRODUCT_PACKAGES) \
- $(if $(filter eng,$(tags_to_install)),$(PRODUCTS.$(_mk).PRODUCT_PACKAGES_ENG)) \
- $(if $(filter debug,$(tags_to_install)),$(PRODUCTS.$(_mk).PRODUCT_PACKAGES_DEBUG)) \
- $(if $(filter tests,$(tags_to_install)),$(PRODUCTS.$(_mk).PRODUCT_PACKAGES_TESTS)) \
- $(if $(filter asan,$(tags_to_install)),$(PRODUCTS.$(_mk).PRODUCT_PACKAGES_DEBUG_ASAN)) \
- $(if $(filter java_coverage,$(tags_to_install)),$(PRODUCTS.$(_mk).PRODUCT_PACKAGES_DEBUG_JAVA_COVERAGE)) \
+ $(call get-product-var,$(1),PRODUCT_PACKAGES) \
+ $(if $(filter eng,$(tags_to_install)),$(call get-product-var,$(1),PRODUCT_PACKAGES_ENG)) \
+ $(if $(filter debug,$(tags_to_install)),$(call get-product-var,$(1),PRODUCT_PACKAGES_DEBUG)) \
+ $(if $(filter tests,$(tags_to_install)),$(call get-product-var,$(1),PRODUCT_PACKAGES_TESTS)) \
+ $(if $(filter asan,$(tags_to_install)),$(call get-product-var,$(1),PRODUCT_PACKAGES_DEBUG_ASAN)) \
+ $(if $(filter java_coverage,$(tags_to_install)),$(call get-product-var,$(1),PRODUCT_PACKAGES_DEBUG_JAVA_COVERAGE)) \
$(call auto-included-modules) \
) \
$(eval ### Filter out the overridden packages and executables before doing expansion) \
$(eval _pif_overrides := $(call module-overrides,$(_pif_modules))) \
$(eval _pif_modules := $(filter-out $(_pif_overrides), $(_pif_modules))) \
$(eval ### Resolve the :32 :64 module name) \
- $(eval _pif_modules_32 := $(patsubst %:32,%,$(filter %:32, $(_pif_modules)))) \
- $(eval _pif_modules_64 := $(patsubst %:64,%,$(filter %:64, $(_pif_modules)))) \
- $(eval _pif_modules_rest := $(filter-out %:32 %:64,$(_pif_modules))) \
- $(eval ### Note for 32-bit product, 32 and 64 will be added as their original module names.) \
- $(eval _pif_modules := $(call get-32-bit-modules-if-we-can, $(_pif_modules_32))) \
- $(eval _pif_modules += $(_pif_modules_64)) \
- $(eval ### For the rest we add both) \
- $(eval _pif_modules += $(call get-32-bit-modules, $(_pif_modules_rest))) \
- $(eval _pif_modules += $(_pif_modules_rest)) \
+ $(eval _pif_modules := $(sort $(call resolve-bitness-for-modules,TARGET,$(_pif_modules)))) \
$(call expand-required-modules,_pif_modules,$(_pif_modules),$(_pif_overrides)) \
$(filter-out $(HOST_OUT_ROOT)/%,$(call module-installed-files, $(_pif_modules))) \
$(call resolve-product-relative-paths,\
- $(foreach cf,$(PRODUCTS.$(_mk).PRODUCT_COPY_FILES),$(call word-colon,2,$(cf))))
+ $(foreach cf,$(call get-product-var,$(1),PRODUCT_COPY_FILES),$(call word-colon,2,$(cf))))
endef
# Similar to product-installed-files above, but handles PRODUCT_HOST_PACKAGES instead
# This does support the :32 / :64 syntax, but does not support module overrides.
define host-installed-files
- $(eval _hif_modules := $(PRODUCTS.$(strip $(1)).PRODUCT_HOST_PACKAGES)) \
- $(eval ### Resolve the :32 :64 module name) \
- $(eval _hif_modules_32 := $(patsubst %:32,%,$(filter %:32, $(_hif_modules)))) \
- $(eval _hif_modules_64 := $(patsubst %:64,%,$(filter %:64, $(_hif_modules)))) \
- $(eval _hif_modules_rest := $(filter-out %:32 %:64,$(_hif_modules))) \
- $(eval _hif_modules := $(call get-host-32-bit-modules-if-we-can, $(_hif_modules_32))) \
- $(eval _hif_modules += $(_hif_modules_64)) \
- $(eval ### For the rest we add both) \
- $(eval _hif_modules += $(call get-host-32-bit-modules, $(_hif_modules_rest))) \
- $(eval _hif_modules += $(_hif_modules_rest)) \
+ $(eval _hif_modules := $(call get-product-var,$(1),PRODUCT_HOST_PACKAGES)) \
$(eval ### Split host vs host cross modules) \
$(eval _hcif_modules := $(filter host_cross_%,$(_hif_modules))) \
$(eval _hif_modules := $(filter-out host_cross_%,$(_hif_modules))) \
+ $(eval ### Resolve the :32 :64 module name) \
+ $(eval _hif_modules := $(sort $(call resolve-bitness-for-modules,HOST,$(_hif_modules)))) \
+ $(eval _hcif_modules := $(sort $(call resolve-bitness-for-modules,HOST_CROSS,$(_hcif_modules)))) \
$(call expand-required-host-modules,_hif_modules,$(_hif_modules),HOST) \
$(call expand-required-host-modules,_hcif_modules,$(_hcif_modules),HOST_CROSS) \
$(filter $(HOST_OUT)/%,$(call module-installed-files, $(_hif_modules))) \
@@ -1115,150 +1186,6 @@
)
endef
-# Check that libraries that should only be in APEXes don't end up in the system
-# image. For the Runtime APEX this complements the checks in
-# art/build/apex/art_apex_test.py.
-# TODO(b/128708192): Implement this restriction in Soong instead.
-
-# Runtime APEX libraries
-APEX_MODULE_LIBS := \
- libadbconnection.so \
- libadbconnectiond.so \
- libandroidicu.so \
- libandroidio.so \
- libart-compiler.so \
- libart-dexlayout.so \
- libart-disassembler.so \
- libart.so \
- libartbase.so \
- libartbased.so \
- libartd-compiler.so \
- libartd-dexlayout.so \
- libartd.so \
- libartpalette.so \
- libc.so \
- libc_malloc_debug.so \
- libc_malloc_hooks.so \
- libdexfile.so \
- libdexfile_external.so \
- libdexfiled.so \
- libdexfiled_external.so \
- libdl.so \
- libdt_fd_forward.so \
- libdt_socket.so \
- libicui18n.so \
- libicuuc.so \
- libjavacore.so \
- libjdwp.so \
- libm.so \
- libnativebridge.so \
- libnativehelper.so \
- libnativeloader.so \
- libneuralnetworks.so \
- libnpt.so \
- libopenjdk.so \
- libopenjdkjvm.so \
- libopenjdkjvmd.so \
- libopenjdkjvmti.so \
- libopenjdkjvmtid.so \
- libpac.so \
- libprofile.so \
- libprofiled.so \
- libsigchain.so \
-
-# Conscrypt APEX libraries
-APEX_MODULE_LIBS += \
- libjavacrypto.so \
-
-# An option to disable the check below, for local use since some build targets
-# still may create these libraries in /system (b/129006418).
-DISABLE_APEX_LIBS_ABSENCE_CHECK ?=
-
-# Bionic should not be in /system, except for the bootstrap instance.
-APEX_LIBS_ABSENCE_CHECK_EXCLUDE := lib/bootstrap lib64/bootstrap
-
-# Exclude lib/arm and lib64/arm64 which contain the native bridge proxy libs. They
-# are compiled for the guest architecture and used with an entirely different
-# linker config. The native libs are then linked to as usual via exported
-# interfaces, so the proxy libs do not violate the interface boundaries on the
-# native architecture.
-# TODO(b/130630776): Introduce a make variable for the appropriate directory
-# when native bridge is active.
-APEX_LIBS_ABSENCE_CHECK_EXCLUDE += lib/arm lib64/arm64
-
-ifdef TARGET_NATIVE_BRIDGE_RELATIVE_PATH
- APEX_LIBS_ABSENCE_CHECK_EXCLUDE += lib/$(TARGET_NATIVE_BRIDGE_RELATIVE_PATH) lib64/$(TARGET_NATIVE_BRIDGE_RELATIVE_PATH)
-endif
-
-ifdef TARGET_NATIVE_BRIDGE_2ND_RELATIVE_PATH
- APEX_LIBS_ABSENCE_CHECK_EXCLUDE += lib/$(TARGET_NATIVE_BRIDGE_2ND_RELATIVE_PATH) lib64/$(TARGET_NATIVE_BRIDGE_2ND_RELATIVE_PATH)
-endif
-
-# Exclude vndk-* subdirectories which contain prebuilts from older releases.
-APEX_LIBS_ABSENCE_CHECK_EXCLUDE += lib/vndk-% lib64/vndk-%
-
-ifdef DISABLE_APEX_LIBS_ABSENCE_CHECK
- check-apex-libs-absence :=
- check-apex-libs-absence-on-disk :=
-else
- # If the check below fails, some library has ended up in system/lib or
- # system/lib64 that is intended to only go into some APEX package. The likely
- # cause is that a library or binary in /system has grown a dependency that
- # directly or indirectly pulls in the prohibited library.
- #
- # To resolve this, look for the APEX package that the library belong to -
- # search for it in 'native_shared_lib' properties in 'apex' build modules (see
- # art/build/apex/Android.bp for an example). Then check if there is an
- # exported library in that APEX package that should be used instead, i.e. one
- # listed in its 'native_shared_lib' property for which the corresponding
- # 'cc_library' module has a 'stubs' clause (like libdexfile_external in
- # art/libdexfile/Android.bp).
- #
- # If you cannot find an APEX exported library that fits your needs, or you
- # think that the library you want to depend on should be allowed in /system,
- # then please contact the owners of the APEX package containing the library.
- #
- # If you get this error for a library that is exported in an APEX, then the
- # APEX might be misconfigured or something is wrong in the build system.
- # Please reach out to the APEX package owners and/or soong-team@, or
- # android-building@googlegroups.com externally.
- define check-apex-libs-absence
- $(call maybe-print-list-and-error, \
- $(filter $(foreach lib,$(APEX_MODULE_LIBS),%/$(lib)), \
- $(filter-out $(foreach dir,$(APEX_LIBS_ABSENCE_CHECK_EXCLUDE), \
- $(TARGET_OUT)/$(if $(findstring %,$(dir)),$(dir),$(dir)/%)), \
- $(filter $(TARGET_OUT)/lib/% $(TARGET_OUT)/lib64/%,$(1)))), \
- APEX libraries found in product_target_FILES (see comment for check-apex-libs-absence in \
- build/make/core/main.mk for details))
- endef
-
- # TODO(b/129006418): The check above catches libraries through product
- # dependencies visible to make, but as long as they have install rules in
- # /system they may still be created there through other make targets. To catch
- # that we also do a check on disk just before the system image is built.
- # NB: This check may fail if you have built intermediate targets in the out
- # tree earlier, e.g. "m <some lib in APEX_MODULE_LIBS>". In that case, please
- # try "m installclean && m systemimage" to get a correct system image. For
- # local work you can also disable the check with the
- # DISABLE_APEX_LIBS_ABSENCE_CHECK environment variable.
- define check-apex-libs-absence-on-disk
- $(hide) ( \
- cd $(TARGET_OUT) && \
- findres=$$(find lib* \
- $(foreach dir,$(APEX_LIBS_ABSENCE_CHECK_EXCLUDE),-path "$(subst %,*,$(dir))" -prune -o) \
- -type f \( -false $(foreach lib,$(APEX_MODULE_LIBS),-o -name $(lib)) \) \
- -print) && \
- if [ -n "$$findres" ]; then \
- echo "APEX libraries found in system image in TARGET_OUT (see comments for" 1>&2; \
- echo "check-apex-libs-absence and check-apex-libs-absence-on-disk in" 1>&2; \
- echo "build/make/core/main.mk for details):" 1>&2; \
- echo "$$findres" | sort 1>&2; \
- false; \
- fi; \
- )
- endef
-endif
-
ifdef FULL_BUILD
ifneq (true,$(ALLOW_MISSING_DEPENDENCIES))
# Check to ensure that all modules in PRODUCT_PACKAGES exist (opt in per product)
@@ -1270,13 +1197,12 @@
_modules := $(patsubst %:64,%,$(_modules))
# Sanity check all modules in PRODUCT_PACKAGES exist. We check for the
# existence if either <module> or the <module>_32 variant.
- _nonexistent_modules := $(filter-out $(ALL_MODULES),$(_modules))
- _nonexistent_modules := $(foreach m,$(_nonexistent_modules),\
- $(if $(call get-32-bit-modules,$(m)),,$(m)))
+ _nonexistent_modules := $(foreach m,$(_modules), \
+ $(if $(or $(ALL_MODULES.$(m).PATH),$(call get-modules-for-2nd-arch,TARGET,$(m))),,$(m)))
$(call maybe-print-list-and-error,$(filter-out $(_whitelist),$(_nonexistent_modules)),\
$(INTERNAL_PRODUCT) includes non-existent modules in PRODUCT_PACKAGES)
$(call maybe-print-list-and-error,$(filter-out $(_nonexistent_modules),$(_whitelist)),\
- $(INTERNAL_PRODUCT) includes redundant whitelist entries for nonexistent PRODUCT_PACKAGES)
+ $(INTERNAL_PRODUCT) includes redundant whitelist entries for non-existent PRODUCT_PACKAGES)
endif
# Check to ensure that all modules in PRODUCT_HOST_PACKAGES exist
@@ -1295,17 +1221,19 @@
endif
endif
- # Some modules produce only host installed files when building with TARGET_BUILD_APPS
- ifeq ($(TARGET_BUILD_APPS),)
- _modules := $(foreach m,$(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_PACKAGES) \
- $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_PACKAGES_DEBUG) \
- $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_PACKAGES_DEBUG_ASAN) \
- $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_PACKAGES_ENG) \
- $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_PACKAGES_TESTS),\
+ # Modules may produce only host installed files in unbundled builds.
+ ifeq (,$(TARGET_BUILD_UNBUNDLED))
+ _modules := $(call resolve-bitness-for-modules,TARGET, \
+ $(PRODUCT_PACKAGES) \
+ $(PRODUCT_PACKAGES_DEBUG) \
+ $(PRODUCT_PACKAGES_DEBUG_ASAN) \
+ $(PRODUCT_PACKAGES_ENG) \
+ $(PRODUCT_PACKAGES_TESTS))
+ _host_modules := $(foreach m,$(_modules), \
$(if $(ALL_MODULES.$(m).INSTALLED),\
$(if $(filter-out $(HOST_OUT_ROOT)/%,$(ALL_MODULES.$(m).INSTALLED)),,\
$(m))))
- $(call maybe-print-list-and-error,$(sort $(_modules)),\
+ $(call maybe-print-list-and-error,$(sort $(_host_modules)),\
Host modules should be in PRODUCT_HOST_PACKAGES$(comma) not PRODUCT_PACKAGES)
endif
@@ -1317,13 +1245,13 @@
# Verify the artifact path requirements made by included products.
is_asan := $(if $(filter address,$(SANITIZE_TARGET)),true)
ifneq (true,$(or $(is_asan),$(DISABLE_ARTIFACT_PATH_REQUIREMENTS)))
- # Fakes don't get installed, host files are irrelevant, and NDK stubs aren't installed to device.
- static_whitelist_patterns := $(TARGET_OUT_FAKE)/% $(HOST_OUT)/% $(SOONG_OUT_DIR)/ndk/%
+ # Fakes don't get installed, and NDK stubs aren't installed to device.
+ static_whitelist_patterns := $(TARGET_OUT_FAKE)/% $(SOONG_OUT_DIR)/ndk/%
# RROs become REQUIRED by the source module, but are always placed on the vendor partition.
static_whitelist_patterns += %__auto_generated_rro_product.apk
static_whitelist_patterns += %__auto_generated_rro_vendor.apk
# Auto-included targets are not considered
- static_whitelist_patterns += $(call module-installed-files,$(call auto-included-modules))
+ static_whitelist_patterns += $(call product-installed-files,)
# $(PRODUCT_OUT)/apex is where shared libraries in APEXes get installed.
# The path can be considered as a fake path, as the shared libraries
# are installed there just to have symbols files for them under
@@ -1379,8 +1307,6 @@
rm -f $@
$(foreach f,$(sort $(all_offending_files)),echo $(f) >> $@;)
endif
-
- $(call check-apex-libs-absence,$(product_target_FILES))
else
# We're not doing a full build, and are probably only including
# a subset of the module makefiles. Don't try to build any modules
@@ -1399,6 +1325,30 @@
$(CUSTOM_MODULES) \
)
+ifdef FULL_BUILD
+#
+# Used by the cleanup logic in soong_ui to remove files that should no longer
+# be installed.
+#
+
+# Include all tests, so that we remove them from the test suites / testcase
+# folders when they are removed.
+test_files := $(foreach ts,$(ALL_COMPATIBILITY_SUITES),$(COMPATIBILITY.$(ts).FILES))
+
+$(shell mkdir -p $(PRODUCT_OUT) $(HOST_OUT))
+
+$(file >$(PRODUCT_OUT)/.installable_files$(if $(filter address,$(SANITIZE_TARGET)),_asan), \
+ $(sort $(patsubst $(PRODUCT_OUT)/%,%,$(filter $(PRODUCT_OUT)/%, \
+ $(modules_to_install) $(test_files)))))
+
+$(file >$(HOST_OUT)/.installable_test_files,$(sort \
+ $(patsubst $(HOST_OUT)/%,%,$(filter $(HOST_OUT)/%, \
+ $(test_files)))))
+
+test_files :=
+endif
+
+
# Don't include any GNU General Public License shared objects or static
# libraries in SDK images. GPL executables (not static/dynamic libraries)
# are okay if they don't link against any closed source libraries (directly
@@ -1462,7 +1412,7 @@
endif
# Build docs as part of checkbuild to catch more breakages.
-module_to_check += $(ALL_DOCS)
+modules_to_check += $(ALL_DOCS)
# for easier debugging
modules_to_check := $(sort $(modules_to_check))
@@ -1500,6 +1450,12 @@
.PHONY: ramdisk_debug
ramdisk_debug: $(INSTALLED_DEBUG_RAMDISK_TARGET)
+.PHONY: ramdisk_test_harness
+ramdisk_test_harness: $(INSTALLED_TEST_HARNESS_RAMDISK_TARGET)
+
+.PHONY: vendor_ramdisk_debug
+vendor_ramdisk_debug: $(INSTALLED_VENDOR_DEBUG_RAMDISK_TARGET)
+
.PHONY: userdataimage
userdataimage: $(INSTALLED_USERDATAIMAGE_TARGET)
@@ -1516,6 +1472,12 @@
.PHONY: vendorimage
vendorimage: $(INSTALLED_VENDORIMAGE_TARGET)
+.PHONY: vendorbootimage
+vendorbootimage: $(INSTALLED_VENDOR_BOOTIMAGE_TARGET)
+
+.PHONY: vendorbootimage_debug
+vendorbootimage_debug: $(INSTALLED_VENDOR_DEBUG_BOOTIMAGE_TARGET)
+
.PHONY: productimage
productimage: $(INSTALLED_PRODUCTIMAGE_TARGET)
@@ -1537,12 +1499,12 @@
.PHONY: bootimage_debug
bootimage_debug: $(INSTALLED_DEBUG_BOOTIMAGE_TARGET)
+.PHONY: bootimage_test_harness
+bootimage_test_harness: $(INSTALLED_TEST_HARNESS_BOOTIMAGE_TARGET)
+
.PHONY: vbmetaimage
vbmetaimage: $(INSTALLED_VBMETAIMAGE_TARGET)
-.PHONY: auxiliary
-auxiliary: $(INSTALLED_AUX_TARGETS)
-
# Build files and then package it into the rom formats
.PHONY: droidcore
droidcore: $(filter $(HOST_OUT_ROOT)/%,$(modules_to_install)) \
@@ -1558,6 +1520,9 @@
$(INSTALLED_CACHEIMAGE_TARGET) \
$(INSTALLED_BPTIMAGE_TARGET) \
$(INSTALLED_VENDORIMAGE_TARGET) \
+ $(INSTALLED_VENDOR_BOOTIMAGE_TARGET) \
+ $(INSTALLED_VENDOR_DEBUG_RAMDISK_TARGET) \
+ $(INSTALLED_VENDOR_DEBUG_BOOTIMAGE_TARGET) \
$(INSTALLED_ODMIMAGE_TARGET) \
$(INSTALLED_SUPERIMAGE_EMPTY_TARGET) \
$(INSTALLED_PRODUCTIMAGE_TARGET) \
@@ -1578,12 +1543,13 @@
$(INSTALLED_FILES_JSON_RAMDISK) \
$(INSTALLED_FILES_FILE_DEBUG_RAMDISK) \
$(INSTALLED_FILES_JSON_DEBUG_RAMDISK) \
+ $(INSTALLED_FILES_FILE_VENDOR_DEBUG_RAMDISK) \
+ $(INSTALLED_FILES_JSON_VENDOR_DEBUG_RAMDISK) \
$(INSTALLED_FILES_FILE_ROOT) \
$(INSTALLED_FILES_JSON_ROOT) \
$(INSTALLED_FILES_FILE_RECOVERY) \
$(INSTALLED_FILES_JSON_RECOVERY) \
$(INSTALLED_ANDROID_INFO_TXT_TARGET) \
- auxiliary \
soong_docs
# dist_files only for putting your library into the dist directory with a full build.
@@ -1645,7 +1611,7 @@
$(apps_only_installed_files)))
-else # TARGET_BUILD_APPS
+else ifeq (,$(TARGET_BUILD_UNBUNDLED))
$(call dist-for-goals, droidcore, \
$(INTERNAL_UPDATE_PACKAGE_TARGET) \
$(INTERNAL_OTA_PACKAGE_TARGET) \
@@ -1673,6 +1639,7 @@
$(INSTALLED_BUILD_PROP_TARGET) \
$(BUILT_TARGET_FILES_PACKAGE) \
$(INSTALLED_ANDROID_INFO_TXT_TARGET) \
+ $(INSTALLED_MISC_INFO_TARGET) \
$(INSTALLED_RAMDISK_TARGET) \
)
@@ -1700,20 +1667,34 @@
$(INSTALLED_FILES_JSON_RAMDISK) \
$(INSTALLED_FILES_FILE_DEBUG_RAMDISK) \
$(INSTALLED_FILES_JSON_DEBUG_RAMDISK) \
+ $(INSTALLED_FILES_FILE_VENDOR_DEBUG_RAMDISK) \
+ $(INSTALLED_FILES_JSON_VENDOR_DEBUG_RAMDISK) \
$(INSTALLED_DEBUG_RAMDISK_TARGET) \
$(INSTALLED_DEBUG_BOOTIMAGE_TARGET) \
+ $(INSTALLED_VENDOR_DEBUG_RAMDISK_TARGET) \
+ $(INSTALLED_VENDOR_DEBUG_BOOTIMAGE_TARGET) \
+ )
+ $(call dist-for-goals, bootimage_test_harness, \
+ $(INSTALLED_TEST_HARNESS_RAMDISK_TARGET) \
+ $(INSTALLED_TEST_HARNESS_BOOTIMAGE_TARGET) \
+ )
+ endif
+
+ ifeq ($(BOARD_USES_RECOVERY_AS_BOOT),true)
+ $(call dist-for-goals, droidcore, \
+ $(recovery_ramdisk) \
)
endif
ifeq ($(EMMA_INSTRUMENT),true)
- $(JACOCO_REPORT_CLASSES_ALL) : $(INSTALLED_SYSTEMIMAGE_TARGET)
+ $(JACOCO_REPORT_CLASSES_ALL) : $(modules_to_install)
$(call dist-for-goals, dist_files, $(JACOCO_REPORT_CLASSES_ALL))
endif
# Put XML formatted API files in the dist dir.
- $(TARGET_OUT_COMMON_INTERMEDIATES)/api.xml: $(call java-lib-header-files,android_stubs_current) $(APICHECK)
- $(TARGET_OUT_COMMON_INTERMEDIATES)/system-api.xml: $(call java-lib-header-files,android_system_stubs_current) $(APICHECK)
- $(TARGET_OUT_COMMON_INTERMEDIATES)/test-api.xml: $(call java-lib-header-files,android_test_stubs_current) $(APICHECK)
+ $(TARGET_OUT_COMMON_INTERMEDIATES)/api.xml: $(call java-lib-files,android_stubs_current) $(APICHECK)
+ $(TARGET_OUT_COMMON_INTERMEDIATES)/system-api.xml: $(call java-lib-files,android_system_stubs_current) $(APICHECK)
+ $(TARGET_OUT_COMMON_INTERMEDIATES)/test-api.xml: $(call java-lib-files,android_test_stubs_current) $(APICHECK)
api_xmls := $(addprefix $(TARGET_OUT_COMMON_INTERMEDIATES)/,api.xml system-api.xml test-api.xml)
$(api_xmls):
@@ -1724,10 +1705,15 @@
$(call dist-for-goals, dist_files, $(api_xmls))
api_xmls :=
+ ifdef CLANG_COVERAGE
+ $(foreach f,$(SOONG_NDK_API_XML), \
+ $(call dist-for-goals,droidcore,$(f):ndk_coverage_xml_dir/$(notdir $(f))))
+ endif
+
# Building a full system-- the default is to build droidcore
droid_targets: droidcore dist_files
-endif # TARGET_BUILD_APPS
+endif # !TARGET_BUILD_UNBUNDLED
.PHONY: docs
docs: $(ALL_DOCS)
diff --git a/core/misc_prebuilt_internal.mk b/core/misc_prebuilt_internal.mk
index a52b9e5..921ea52 100644
--- a/core/misc_prebuilt_internal.mk
+++ b/core/misc_prebuilt_internal.mk
@@ -18,7 +18,7 @@
# Internal build rules for misc prebuilt modules that don't need additional processing
############################################################
-prebuilt_module_classes := SCRIPT ETC DATA
+prebuilt_module_classes := SCRIPT ETC DATA RENDERSCRIPT_BITCODE
ifeq ($(filter $(prebuilt_module_classes),$(LOCAL_MODULE_CLASS)),)
$(call pretty-error,misc_prebuilt_internal.mk is for $(prebuilt_module_classes) modules only)
endif
diff --git a/core/native_benchmark.mk b/core/native_benchmark.mk
deleted file mode 100644
index 073d8dd..0000000
--- a/core/native_benchmark.mk
+++ /dev/null
@@ -1,15 +0,0 @@
-###########################################
-## A thin wrapper around BUILD_EXECUTABLE
-## Common flags for native benchmarks are added.
-###########################################
-$(call record-module-type,NATIVE_BENCHMARK)
-
-LOCAL_STATIC_LIBRARIES += libgoogle-benchmark
-
-ifndef LOCAL_MULTILIB
-ifndef LOCAL_32_BIT_ONLY
-LOCAL_MULTILIB := both
-endif
-endif
-
-include $(BUILD_EXECUTABLE)
diff --git a/core/ninja_config.mk b/core/ninja_config.mk
index b1f4b03..336048f 100644
--- a/core/ninja_config.mk
+++ b/core/ninja_config.mk
@@ -15,7 +15,6 @@
$(dont_bother_goals) \
all \
ECLIPSE-% \
- AUX-% \
brillo_tests \
btnod \
build-art% \
@@ -25,7 +24,6 @@
continuous_native_tests \
cts \
custom_images \
- deps-license \
dicttool_aosp \
dump-products \
eng \
@@ -40,15 +38,13 @@
sdk \
sdk_addon \
sdk_repo \
- snod \
stnod \
- systemimage-nodeps \
target-files-package \
test-art% \
user \
userdataimage \
userdebug \
- vts \
+ vts10 \
win_sdk \
winsdk-tools
diff --git a/core/notice_files.mk b/core/notice_files.mk
index 680a0b1..721a034 100644
--- a/core/notice_files.mk
+++ b/core/notice_files.mk
@@ -6,7 +6,7 @@
ifneq ($(LOCAL_NOTICE_FILE),)
notice_file:=$(strip $(LOCAL_NOTICE_FILE))
else
-notice_file:=$(strip $(wildcard $(LOCAL_PATH)/NOTICE))
+notice_file:=$(strip $(wildcard $(LOCAL_PATH)/LICENSE $(LOCAL_PATH)/LICENCE $(LOCAL_PATH)/NOTICE))
endif
ifeq ($(LOCAL_MODULE_CLASS),GYP)
@@ -71,14 +71,21 @@
# javalib.jar is the default name for the build module (and isn't meaningful)
# If that's what we have, substitute the module name instead. These files
# aren't included on the device, so this name is synthetic anyway.
+ # Extra path "static" is added to try to avoid name conflict between the notice file of
+ # this 'uninstallable' Java module and the notice file for another 'installable' Java module
+ # whose stem is the same as this module's name.
ifneq ($(filter javalib.jar,$(module_leaf)),)
- module_leaf := $(LOCAL_MODULE).jar
+ module_leaf := static/$(LOCAL_MODULE).jar
endif
module_installed_filename := \
$(patsubst $(PRODUCT_OUT)/%,%,$($(my_prefix)OUT_JAVA_LIBRARIES))/$(module_leaf)
else ifeq ($(LOCAL_MODULE_CLASS),ETC)
# ETC modules may be uninstallable, yet still have a NOTICE file. e.g. apex components
module_installed_filename :=
+ else ifneq (,$(and $(filter %.sdk,$(LOCAL_MODULE)),$(filter $(patsubst %.sdk,%,$(LOCAL_MODULE)),$(SOONG_SDK_VARIANT_MODULES))))
+ # Soong produces uninstallable *.sdk shared libraries for embedding in APKs.
+ module_installed_filename := \
+ $(patsubst $(PRODUCT_OUT)/%,%,$($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)OUT_SHARED_LIBRARIES))/$(notdir $(LOCAL_BUILT_MODULE))
else
$(error Cannot determine where to install NOTICE file for $(LOCAL_MODULE))
endif # JAVA_LIBRARIES
@@ -98,7 +105,7 @@
$(installed_notice_file): $(notice_file)
@echo Notice file: $< -- $@
$(hide) mkdir -p $(dir $@)
- $(hide) cat $< > $@
+ $(hide) awk 'FNR==1 && NR > 1 {print "\n"} {print}' $^ > $@
ifdef LOCAL_INSTALLED_MODULE
# Make LOCAL_INSTALLED_MODULE depend on NOTICE files if they exist
diff --git a/core/package.mk b/core/package.mk
index 6bde485..591f7aa 100644
--- a/core/package.mk
+++ b/core/package.mk
@@ -41,15 +41,7 @@
endif
LOCAL_NO_2ND_ARCH_MODULE_SUFFIX := true
-
-# if TARGET_PREFER_32_BIT_APPS is set, try to build 32-bit first
-ifdef TARGET_2ND_ARCH
-ifeq ($(TARGET_PREFER_32_BIT_APPS),true)
-LOCAL_2ND_ARCH_VAR_PREFIX := $(TARGET_2ND_ARCH_VAR_PREFIX)
-else
LOCAL_2ND_ARCH_VAR_PREFIX :=
-endif
-endif
# check if preferred arch is supported
include $(BUILD_SYSTEM)/module_arch_supported.mk
@@ -57,13 +49,7 @@
# first arch is supported
include $(BUILD_SYSTEM)/package_internal.mk
else ifneq (,$(TARGET_2ND_ARCH))
-# check if the non-preferred arch is the primary or secondary
-ifeq ($(TARGET_PREFER_32_BIT_APPS),true)
-LOCAL_2ND_ARCH_VAR_PREFIX :=
-else
LOCAL_2ND_ARCH_VAR_PREFIX := $(TARGET_2ND_ARCH_VAR_PREFIX)
-endif
-
# check if non-preferred arch is supported
include $(BUILD_SYSTEM)/module_arch_supported.mk
ifeq ($(my_module_arch_supported),true)
diff --git a/core/package_internal.mk b/core/package_internal.mk
index 557a2c6..775ee48 100644
--- a/core/package_internal.mk
+++ b/core/package_internal.mk
@@ -99,20 +99,20 @@
# Determine whether auto-RRO is enabled for this package.
enforce_rro_enabled :=
-ifeq ($(PRODUCT_ENFORCE_RRO_TARGETS),*)
- # * means all system APKs, so enable conditionally based on module path.
+ifneq (,$(filter *, $(PRODUCT_ENFORCE_RRO_TARGETS)))
+ # * means all system and system_ext APKs, so enable conditionally based on module path.
+ # Note that modules in PRODUCT_ENFORCE_RRO_EXEMPTED_TARGETS are excluded even if it is '*'
# Note that base_rules.mk has not yet been included, so it's likely that only
# one of LOCAL_MODULE_PATH and the LOCAL_X_MODULE flags has been set.
ifeq (,$(LOCAL_MODULE_PATH))
- non_system_module := $(filter true,\
+ non_rro_target_module := $(filter true,\
$(LOCAL_ODM_MODULE) \
$(LOCAL_OEM_MODULE) \
$(LOCAL_PRODUCT_MODULE) \
- $(LOCAL_SYSTEM_EXT_MODULE) \
$(LOCAL_PROPRIETARY_MODULE) \
$(LOCAL_VENDOR_MODULE))
- enforce_rro_enabled := $(if $(non_system_module),,true)
+ enforce_rro_enabled := $(if $(non_rro_target_module),,true)
else ifneq ($(filter $(TARGET_OUT)/%,$(LOCAL_MODULE_PATH)),)
enforce_rro_enabled := true
endif
@@ -120,6 +120,12 @@
enforce_rro_enabled := true
endif
+# TODO(b/150820813) Some modules depend on static overlay, remove this after eliminating the dependency.
+ifneq (,$(filter $(LOCAL_PACKAGE_NAME), $(PRODUCT_ENFORCE_RRO_EXEMPTED_TARGETS)))
+ enforce_rro_enabled :=
+endif
+
+
product_package_overlays := $(strip \
$(wildcard $(foreach dir, $(PRODUCT_PACKAGE_OVERLAYS), \
$(addprefix $(dir)/, $(LOCAL_RESOURCE_DIR)))))
@@ -371,9 +377,11 @@
# they want to use this module's R.java file.
$(LOCAL_BUILT_MODULE): $(R_file_stamp)
+ifneq ($(full_classes_jar),)
# The R.java file must exist by the time the java source
# list is generated
$(java_source_list_file): $(R_file_stamp)
+endif
endif # need_compile_res
@@ -465,6 +473,12 @@
$(LOCAL_BUILT_MODULE): $(additional_certificates)
$(LOCAL_BUILT_MODULE): PRIVATE_ADDITIONAL_CERTIFICATES := $(additional_certificates)
+$(LOCAL_BUILT_MODULE): $(LOCAL_CERTIFICATE_LINEAGE)
+$(LOCAL_BUILT_MODULE): PRIVATE_CERTIFICATE_LINEAGE := $(LOCAL_CERTIFICATE_LINEAGE)
+
+# Set a actual_partition_tag (calculated in base_rules.mk) for the package.
+PACKAGES.$(LOCAL_PACKAGE_NAME).PARTITION := $(actual_partition_tag)
+
# Verify LOCAL_USES_LIBRARIES/LOCAL_OPTIONAL_USES_LIBRARIES
# If LOCAL_ENFORCE_USES_LIBRARIES is not set, default to true if either of LOCAL_USES_LIBRARIES or
# LOCAL_OPTIONAL_USES_LIBRARIES are specified.
@@ -538,15 +552,6 @@
ifeq (true, $(LOCAL_UNCOMPRESS_DEX))
$(LOCAL_BUILT_MODULE) : $(ZIP2ZIP)
endif
-ifneq ($(BUILD_PLATFORM_ZIP),)
-$(LOCAL_BUILT_MODULE) : .KATI_IMPLICIT_OUTPUTS := $(dir $(LOCAL_BUILT_MODULE))package.dex.apk
-endif
-ifdef LOCAL_DEX_PREOPT
-$(LOCAL_BUILT_MODULE) : PRIVATE_STRIP_SCRIPT := $(intermediates)/strip.sh
-$(LOCAL_BUILT_MODULE) : $(intermediates)/strip.sh
-$(LOCAL_BUILT_MODULE) : | $(DEXPREOPT_STRIP_DEPS)
-$(LOCAL_BUILT_MODULE): .KATI_DEPFILE := $(LOCAL_BUILT_MODULE).d
-endif
$(LOCAL_BUILT_MODULE): PRIVATE_USE_EMBEDDED_NATIVE_LIBS := $(LOCAL_USE_EMBEDDED_NATIVE_LIBS)
$(LOCAL_BUILT_MODULE):
@echo "target Package: $(PRIVATE_MODULE) ($@)"
@@ -569,19 +574,11 @@
@# No need to align, sign-package below will do it.
$(uncompress-dexs)
endif
-# Run appcompat before stripping the classes.dex file.
+# Run appcompat before signing.
ifeq ($(module_run_appcompat),true)
$(appcompat-header)
$(run-appcompat)
endif # module_run_appcompat
-ifdef LOCAL_DEX_PREOPT
-ifneq ($(BUILD_PLATFORM_ZIP),)
- @# Keep a copy of apk with classes.dex unstripped
- $(hide) cp -f $@ $(dir $@)package.dex.apk
-endif # BUILD_PLATFORM_ZIP
- mv -f $@ $@.tmp
- $(PRIVATE_STRIP_SCRIPT) $@.tmp $@
-endif # LOCAL_DEX_PREOPT
$(sign-package)
ifdef LOCAL_COMPRESSED_MODULE
$(compress-package)
@@ -632,7 +629,7 @@
endif # full_classes_jar
$(MERGE_ZIPS) $@ $@.parts/*.zip
rm -rf $@.parts
-ALL_MODULES.$(LOCAL_MODULE).BUNDLE := $(my_bundle_module)
+ALL_MODULES.$(my_register_name).BUNDLE := $(my_bundle_module)
ifdef TARGET_BUILD_APPS
ifdef LOCAL_DPI_VARIANTS
@@ -697,6 +694,12 @@
PACKAGES.$(LOCAL_PACKAGE_NAME).OVERRIDES := $(strip $(LOCAL_OVERRIDES_PACKAGES))
PACKAGES.$(LOCAL_PACKAGE_NAME).RESOURCE_FILES := $(all_resources)
+ifneq ($(LOCAL_MODULE_STEM),)
+ PACKAGES.$(LOCAL_MODULE).STEM := $(LOCAL_MODULE_STEM)
+else
+ PACKAGES.$(LOCAL_MODULE).STEM := $(LOCAL_MODULE)
+endif
+
PACKAGES := $(PACKAGES) $(LOCAL_PACKAGE_NAME)
# Reset internal variables.
diff --git a/core/pathmap.mk b/core/pathmap.mk
index af33f5d..dacbe21 100644
--- a/core/pathmap.mk
+++ b/core/pathmap.mk
@@ -40,7 +40,6 @@
libhardware:hardware/libhardware/include \
libhardware_legacy:hardware/libhardware_legacy/include \
libril:hardware/ril/include \
- recovery:bootable/recovery \
system-core:system/core/include \
audio:system/media/audio/include \
audio-effects:system/media/audio_effects/include \
diff --git a/core/pdk_config.mk b/core/pdk_config.mk
index 4a069d3..922e0ef 100644
--- a/core/pdk_config.mk
+++ b/core/pdk_config.mk
@@ -22,7 +22,7 @@
target/common/obj/JAVA_LIBRARIES/core-libart_intermediates \
target/common/obj/JAVA_LIBRARIES/core-icu4j_intermediates \
target/common/obj/JAVA_LIBRARIES/ext_intermediates \
- target/common/obj/JAVA_LIBRARIES/framework_intermediates \
+ target/common/obj/JAVA_LIBRARIES/framework-minus-apex_intermediates \
target/common/obj/JAVA_LIBRARIES/hwbinder_intermediates \
target/common/obj/JAVA_LIBRARIES/ims-common_intermediates \
target/common/obj/JAVA_LIBRARIES/okhttp_intermediates \
diff --git a/core/prebuilt_internal.mk b/core/prebuilt_internal.mk
index 7006667..ef1471d 100644
--- a/core/prebuilt_internal.mk
+++ b/core/prebuilt_internal.mk
@@ -51,7 +51,7 @@
include $(BUILD_SYSTEM)/java_prebuilt_internal.mk
else ifneq ($(filter STATIC_LIBRARIES SHARED_LIBRARIES EXECUTABLES NATIVE_TESTS,$(LOCAL_MODULE_CLASS)),)
include $(BUILD_SYSTEM)/cc_prebuilt_internal.mk
-else ifneq ($(filter SCRIPT ETC DATA,$(LOCAL_MODULE_CLASS)),)
+else ifneq ($(filter SCRIPT ETC DATA RENDERSCRIPT_BITCODE,$(LOCAL_MODULE_CLASS)),)
include $(BUILD_SYSTEM)/misc_prebuilt_internal.mk
else
$(error $(LOCAL_MODULE) : unexpected LOCAL_MODULE_CLASS for prebuilts: $(LOCAL_MODULE_CLASS))
diff --git a/core/product-graph.mk b/core/product-graph.mk
index b97a69d..968d01b 100644
--- a/core/product-graph.mk
+++ b/core/product-graph.mk
@@ -33,7 +33,6 @@
)
endef
-
this_makefile := build/make/core/product-graph.mk
products_graph := $(OUT_DIR)/products.dot
@@ -71,7 +70,7 @@
# $(2) the output file
define emit-product-node-props
$(hide) echo \"$(1)\" [ \
-label=\"$(dir $(1))\\n$(notdir $(1))\\n\\n$(subst $(close_parenthesis),,$(subst $(open_parethesis),,$(PRODUCTS.$(strip $(1)).PRODUCT_MODEL)))\\n$(PRODUCTS.$(strip $(1)).PRODUCT_DEVICE)\" \
+label=\"$(dir $(1))\\n$(notdir $(1))\\n\\n$(subst $(close_parenthesis),,$(subst $(open_parethesis),,$(call get-product-var,$(1),PRODUCT_MODEL)))\\n$(call get-product-var,$(1),PRODUCT_DEVICE)\" \
style=\"filled\" fillcolor=\"$(strip $(call node-color,$(1)))\" \
colorscheme=\"svg\" fontcolor=\"darkblue\" href=\"products/$(1).html\" \
] >> $(2)
@@ -105,35 +104,35 @@
$(hide) rm -f $$@
$(hide) mkdir -p $$(dir $$@)
$(hide) echo 'FILE=$(strip $(1))' >> $$@
- $(hide) echo 'PRODUCT_NAME=$$(PRODUCTS.$(strip $(1)).PRODUCT_NAME)' >> $$@
- $(hide) echo 'PRODUCT_MODEL=$$(PRODUCTS.$(strip $(1)).PRODUCT_MODEL)' >> $$@
- $(hide) echo 'PRODUCT_LOCALES=$$(PRODUCTS.$(strip $(1)).PRODUCT_LOCALES)' >> $$@
- $(hide) echo 'PRODUCT_AAPT_CONFIG=$$(PRODUCTS.$(strip $(1)).PRODUCT_AAPT_CONFIG)' >> $$@
- $(hide) echo 'PRODUCT_AAPT_PREF_CONFIG=$$(PRODUCTS.$(strip $(1)).PRODUCT_AAPT_PREF_CONFIG)' >> $$@
- $(hide) echo 'PRODUCT_PACKAGES=$$(PRODUCTS.$(strip $(1)).PRODUCT_PACKAGES)' >> $$@
- $(hide) echo 'PRODUCT_DEVICE=$$(PRODUCTS.$(strip $(1)).PRODUCT_DEVICE)' >> $$@
- $(hide) echo 'PRODUCT_MANUFACTURER=$$(PRODUCTS.$(strip $(1)).PRODUCT_MANUFACTURER)' >> $$@
- $(hide) echo 'PRODUCT_PROPERTY_OVERRIDES=$$(PRODUCTS.$(strip $(1)).PRODUCT_PROPERTY_OVERRIDES)' >> $$@
- $(hide) echo 'PRODUCT_DEFAULT_PROPERTY_OVERRIDES=$$(PRODUCTS.$(strip $(1)).PRODUCT_DEFAULT_PROPERTY_OVERRIDES)' >> $$@
- $(hide) echo 'PRODUCT_SYSTEM_DEFAULT_PROPERTIES=$$(PRODUCTS.$(strip $(1)).PRODUCT_SYSTEM_DEFAULT_PROPERTIES)' >> $$@
- $(hide) echo 'PRODUCT_PRODUCT_PROPERTIES=$$(PRODUCTS.$(strip $(1)).PRODUCT_PRODUCT_PROPERTIES)' >> $$@
- $(hide) echo 'PRODUCT_SYSTEM_EXT_PROPERTIES=$$(PRODUCTS.$(strip $(1)).PRODUCT_SYSTEM_EXT_PROPERTIES)' >> $$@
- $(hide) echo 'PRODUCT_ODM_PROPERTIES=$$(PRODUCTS.$(strip $(1)).PRODUCT_ODM_PROPERTIES)' >> $$@
- $(hide) echo 'PRODUCT_CHARACTERISTICS=$$(PRODUCTS.$(strip $(1)).PRODUCT_CHARACTERISTICS)' >> $$@
- $(hide) echo 'PRODUCT_COPY_FILES=$$(PRODUCTS.$(strip $(1)).PRODUCT_COPY_FILES)' >> $$@
- $(hide) echo 'PRODUCT_OTA_PUBLIC_KEYS=$$(PRODUCTS.$(strip $(1)).PRODUCT_OTA_PUBLIC_KEYS)' >> $$@
- $(hide) echo 'PRODUCT_EXTRA_RECOVERY_KEYS=$$(PRODUCTS.$(strip $(1)).PRODUCT_EXTRA_RECOVERY_KEYS)' >> $$@
- $(hide) echo 'PRODUCT_PACKAGE_OVERLAYS=$$(PRODUCTS.$(strip $(1)).PRODUCT_PACKAGE_OVERLAYS)' >> $$@
- $(hide) echo 'DEVICE_PACKAGE_OVERLAYS=$$(PRODUCTS.$(strip $(1)).DEVICE_PACKAGE_OVERLAYS)' >> $$@
- $(hide) echo 'PRODUCT_SDK_ADDON_NAME=$$(PRODUCTS.$(strip $(1)).PRODUCT_SDK_ADDON_NAME)' >> $$@
- $(hide) echo 'PRODUCT_SDK_ADDON_COPY_FILES=$$(PRODUCTS.$(strip $(1)).PRODUCT_SDK_ADDON_COPY_FILES)' >> $$@
- $(hide) echo 'PRODUCT_SDK_ADDON_COPY_MODULES=$$(PRODUCTS.$(strip $(1)).PRODUCT_SDK_ADDON_COPY_MODULES)' >> $$@
- $(hide) echo 'PRODUCT_SDK_ADDON_DOC_MODULES=$$(PRODUCTS.$(strip $(1)).PRODUCT_SDK_ADDON_DOC_MODULES)' >> $$@
- $(hide) echo 'PRODUCT_DEFAULT_WIFI_CHANNELS=$$(PRODUCTS.$(strip $(1)).PRODUCT_DEFAULT_WIFI_CHANNELS)' >> $$@
- $(hide) echo 'PRODUCT_DEFAULT_DEV_CERTIFICATE=$$(PRODUCTS.$(strip $(1)).PRODUCT_DEFAULT_DEV_CERTIFICATE)' >> $$@
- $(hide) echo 'PRODUCT_MAINLINE_SEPOLICY_DEV_CERTIFICATES=$$(PRODUCTS.$(strip $(1)).PRODUCT_MAINLINE_SEPOLICY_DEV_CERTIFICATES)' >> $$@
- $(hide) echo 'PRODUCT_RESTRICT_VENDOR_FILES=$$(PRODUCTS.$(strip $(1)).PRODUCT_RESTRICT_VENDOR_FILES)' >> $$@
- $(hide) echo 'PRODUCT_VENDOR_KERNEL_HEADERS=$$(PRODUCTS.$(strip $(1)).PRODUCT_VENDOR_KERNEL_HEADERS)' >> $$@
+ $(hide) echo 'PRODUCT_NAME=$(call get-product-var,$(1),PRODUCT_NAME)' >> $$@
+ $(hide) echo 'PRODUCT_MODEL=$(call get-product-var,$(1),PRODUCT_MODEL)' >> $$@
+ $(hide) echo 'PRODUCT_LOCALES=$(call get-product-var,$(1),PRODUCT_LOCALES)' >> $$@
+ $(hide) echo 'PRODUCT_AAPT_CONFIG=$(call get-product-var,$(1),PRODUCT_AAPT_CONFIG)' >> $$@
+ $(hide) echo 'PRODUCT_AAPT_PREF_CONFIG=$(call get-product-var,$(1),PRODUCT_AAPT_PREF_CONFIG)' >> $$@
+ $(hide) echo 'PRODUCT_PACKAGES=$(call get-product-var,$(1),PRODUCT_PACKAGES)' >> $$@
+ $(hide) echo 'PRODUCT_DEVICE=$(call get-product-var,$(1),PRODUCT_DEVICE)' >> $$@
+ $(hide) echo 'PRODUCT_MANUFACTURER=$(call get-product-var,$(1),PRODUCT_MANUFACTURER)' >> $$@
+ $(hide) echo 'PRODUCT_PROPERTY_OVERRIDES=$(call get-product-var,$(1),PRODUCT_PROPERTY_OVERRIDES)' >> $$@
+ $(hide) echo 'PRODUCT_DEFAULT_PROPERTY_OVERRIDES=$(call get-product-var,$(1),PRODUCT_DEFAULT_PROPERTY_OVERRIDES)' >> $$@
+ $(hide) echo 'PRODUCT_SYSTEM_DEFAULT_PROPERTIES=$(call get-product-var,$(1),PRODUCT_SYSTEM_DEFAULT_PROPERTIES)' >> $$@
+ $(hide) echo 'PRODUCT_PRODUCT_PROPERTIES=$(call get-product-var,$(1),PRODUCT_PRODUCT_PROPERTIES)' >> $$@
+ $(hide) echo 'PRODUCT_SYSTEM_EXT_PROPERTIES=$(call get-product-var,$(1),PRODUCT_SYSTEM_EXT_PROPERTIES)' >> $$@
+ $(hide) echo 'PRODUCT_ODM_PROPERTIES=$(call get-product-var,$(1),PRODUCT_ODM_PROPERTIES)' >> $$@
+ $(hide) echo 'PRODUCT_CHARACTERISTICS=$(call get-product-var,$(1),PRODUCT_CHARACTERISTICS)' >> $$@
+ $(hide) echo 'PRODUCT_COPY_FILES=$(call get-product-var,$(1),PRODUCT_COPY_FILES)' >> $$@
+ $(hide) echo 'PRODUCT_OTA_PUBLIC_KEYS=$(call get-product-var,$(1),PRODUCT_OTA_PUBLIC_KEYS)' >> $$@
+ $(hide) echo 'PRODUCT_EXTRA_RECOVERY_KEYS=$(call get-product-var,$(1),PRODUCT_EXTRA_RECOVERY_KEYS)' >> $$@
+ $(hide) echo 'PRODUCT_PACKAGE_OVERLAYS=$(call get-product-var,$(1),PRODUCT_PACKAGE_OVERLAYS)' >> $$@
+ $(hide) echo 'DEVICE_PACKAGE_OVERLAYS=$(call get-product-var,$(1),DEVICE_PACKAGE_OVERLAYS)' >> $$@
+ $(hide) echo 'PRODUCT_SDK_ADDON_NAME=$(call get-product-var,$(1),PRODUCT_SDK_ADDON_NAME)' >> $$@
+ $(hide) echo 'PRODUCT_SDK_ADDON_COPY_FILES=$(call get-product-var,$(1),PRODUCT_SDK_ADDON_COPY_FILES)' >> $$@
+ $(hide) echo 'PRODUCT_SDK_ADDON_COPY_MODULES=$(call get-product-var,$(1),PRODUCT_SDK_ADDON_COPY_MODULES)' >> $$@
+ $(hide) echo 'PRODUCT_SDK_ADDON_DOC_MODULES=$(call get-product-var,$(1),PRODUCT_SDK_ADDON_DOC_MODULES)' >> $$@
+ $(hide) echo 'PRODUCT_DEFAULT_WIFI_CHANNELS=$(call get-product-var,$(1),PRODUCT_DEFAULT_WIFI_CHANNELS)' >> $$@
+ $(hide) echo 'PRODUCT_DEFAULT_DEV_CERTIFICATE=$(call get-product-var,$(1),PRODUCT_DEFAULT_DEV_CERTIFICATE)' >> $$@
+ $(hide) echo 'PRODUCT_MAINLINE_SEPOLICY_DEV_CERTIFICATES=$(call get-product-var,$(1),PRODUCT_MAINLINE_SEPOLICY_DEV_CERTIFICATES)' >> $$@
+ $(hide) echo 'PRODUCT_RESTRICT_VENDOR_FILES=$(call get-product-var,$(1),PRODUCT_RESTRICT_VENDOR_FILES)' >> $$@
+ $(hide) echo 'PRODUCT_VENDOR_KERNEL_HEADERS=$(call get-product-var,$(1),PRODUCT_VENDOR_KERNEL_HEADERS)' >> $$@
$(call product-debug-filename, $(p)): \
$(OUT_DIR)/products/$(strip $(1)).txt \
diff --git a/core/product.mk b/core/product.mk
index 2c89fab..94466fa 100644
--- a/core/product.mk
+++ b/core/product.mk
@@ -193,6 +193,9 @@
# Package list to apply enforcing RRO.
_product_list_vars += PRODUCT_ENFORCE_RRO_TARGETS
+# Packages to skip auto-generating RROs for when PRODUCT_ENFORCE_RRO_TARGETS is set to *.
+_product_list_vars += PRODUCT_ENFORCE_RRO_EXEMPTED_TARGETS
+
_product_list_vars += PRODUCT_SDK_ATREE_FILES
_product_list_vars += PRODUCT_SDK_ADDON_NAME
_product_list_vars += PRODUCT_SDK_ADDON_COPY_FILES
@@ -213,6 +216,12 @@
# A list of module names of BOOTCLASSPATH (jar files)
_product_list_vars += PRODUCT_BOOT_JARS
+
+# A list of extra BOOTCLASSPATH jars (to be appended after common jars).
+# Products that include device-specific makefiles before AOSP makefiles should use this
+# instead of PRODUCT_BOOT_JARS, so that device-specific jars go after common jars.
+_product_list_vars += PRODUCT_BOOT_JARS_EXTRA
+
_product_list_vars += PRODUCT_SUPPORTS_BOOT_SIGNER
_product_list_vars += PRODUCT_SUPPORTS_VBOOT
_product_list_vars += PRODUCT_SUPPORTS_VERITY
@@ -228,6 +237,14 @@
_product_list_vars += PRODUCT_VENDOR_PROPERTY_BLACKLIST
_product_list_vars += PRODUCT_SYSTEM_SERVER_APPS
_product_list_vars += PRODUCT_SYSTEM_SERVER_JARS
+# List of system_server jars delivered via apex. Format = <apex name>:<jar name>.
+_product_list_vars += PRODUCT_UPDATABLE_SYSTEM_SERVER_JARS
+# If true, then suboptimal order of system server jars does not cause an error.
+_product_list_vars += PRODUCT_BROKEN_SUBOPTIMAL_ORDER_OF_SYSTEM_SERVER_JARS
+
+# Additional system server jars to be appended at the end of the common list.
+# This is necessary to avoid jars reordering due to makefile inheritance order.
+_product_list_vars += PRODUCT_SYSTEM_SERVER_JARS_EXTRA
# All of the apps that we force preopt, this overrides WITH_DEXPREOPT.
_product_list_vars += PRODUCT_ALWAYS_PREOPT_EXTRACTED_APK
@@ -307,6 +324,10 @@
# List of extra VNDK versions to be included
_product_list_vars += PRODUCT_EXTRA_VNDK_VERSIONS
+# VNDK version of product partition. It can be 'current' if the product
+# partitions uses PLATFORM_VNDK_VERSION.
+_product_single_value_var += PRODUCT_PRODUCT_VNDK_VERSION
+
# Whether the whitelist of actionable compatible properties should be disabled or not
_product_single_value_vars += PRODUCT_ACTIONABLE_COMPATIBLE_PROPERTY_DISABLE
@@ -344,8 +365,6 @@
# system.img), so devices need to install the package in a system-only OTA manner.
_product_single_value_vars += PRODUCT_BUILD_GENERIC_OTA_PACKAGE
-# Whether any paths are excluded from being set XOM when ENABLE_XOM=true
-_product_list_vars += PRODUCT_XOM_EXCLUDE_PATHS
_product_list_vars += PRODUCT_MANIFEST_PACKAGE_NAME_OVERRIDES
_product_list_vars += PRODUCT_PACKAGE_NAME_OVERRIDES
_product_list_vars += PRODUCT_CERTIFICATE_OVERRIDES
@@ -364,8 +383,8 @@
_product_single_value_vars += PRODUCT_BUILD_BOOT_IMAGE
_product_single_value_vars += PRODUCT_BUILD_VBMETA_IMAGE
-_product_list_vars += PRODUCT_UPDATABLE_BOOT_MODULES
-_product_list_vars += PRODUCT_UPDATABLE_BOOT_LOCATIONS
+# List of boot jars delivered via apex
+_product_list_vars += PRODUCT_UPDATABLE_BOOT_JARS
# Whether the product would like to check prebuilt ELF files.
_product_single_value_vars += PRODUCT_CHECK_ELF_FILES
@@ -376,13 +395,25 @@
# If set, device retrofits virtual A/B.
_product_single_value_vars += PRODUCT_VIRTUAL_AB_OTA_RETROFIT
+# If set, forcefully generate a non-A/B update package.
+# Note: A device configuration should inherit from virtual_ab_ota_plus_non_ab.mk
+# instead of setting this variable directly.
+# Note: Use TARGET_OTA_ALLOW_NON_AB in the build system because
+# TARGET_OTA_ALLOW_NON_AB takes the value of AB_OTA_UPDATER into account.
+_product_single_value_vars += PRODUCT_OTA_FORCE_NON_AB_PACKAGE
+
+# If set, Java module in product partition cannot use hidden APIs.
+_product_single_value_vars += PRODUCT_ENFORCE_PRODUCT_PARTITION_INTERFACE
+
+_product_single_value_vars += PRODUCT_INSTALL_EXTRA_FLATTENED_APEXES
+
.KATI_READONLY := _product_single_value_vars _product_list_vars
_product_var_list :=$= $(_product_single_value_vars) $(_product_list_vars)
define dump-product
$(warning ==== $(1) ====)\
$(foreach v,$(_product_var_list),\
-$(warning PRODUCTS.$(1).$(v) := $(PRODUCTS.$(1).$(v))))\
+$(warning PRODUCTS.$(1).$(v) := $(call get-product-var,$(1),$(v))))\
$(warning --------)
endef
@@ -429,8 +460,8 @@
$(sort $(ARTIFACT_PATH_REQUIREMENT_PRODUCTS) $(current_mk)))
endef
-# Makes including non-existant modules in PRODUCT_PACKAGES an error.
-# $(1): whitelist of non-existant modules to allow.
+# Makes including non-existent modules in PRODUCT_PACKAGES an error.
+# $(1): whitelist of non-existent modules to allow.
define enforce-product-packages-exist
$(eval current_mk := $(strip $(word 1,$(_include_stack)))) \
$(eval PRODUCTS.$(current_mk).PRODUCT_ENFORCE_PACKAGES_EXIST := true) \
@@ -547,6 +578,8 @@
$(call readonly-variables,$(_readonly_late_variables))
endef
+# Macro re-defined inside strip-product-vars.
+get-product-var = $(PRODUCTS.$(strip $(1)).$(2))
#
# Strip the variables in _product_var_list and a few build-system
# internal variables, and assign the ones for the current product
@@ -558,6 +591,8 @@
PRODUCT_ENFORCE_PACKAGES_EXIST \
PRODUCT_ENFORCE_PACKAGES_EXIST_WHITELIST, \
$(eval $(v) := $(strip $(PRODUCTS.$(INTERNAL_PRODUCT).$(v)))) \
+ $(eval get-product-var = $$(if $$(filter $$(1),$$(INTERNAL_PRODUCT)),$$($$(2)),$$(PRODUCTS.$$(strip $$(1)).$$(2)))) \
+ $(KATI_obsolete_var PRODUCTS.$(INTERNAL_PRODUCT).$(v),Use $(v) instead) \
)
endef
diff --git a/core/product_config.mk b/core/product_config.mk
index 1293c94..82967bc 100644
--- a/core/product_config.mk
+++ b/core/product_config.mk
@@ -184,6 +184,18 @@
all_product_makefiles :=
all_product_configs :=
+# Jacoco agent JARS to be built and installed, if any.
+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.
+ $(foreach product,$(PRODUCTS),\
+ $(eval PRODUCTS.$(product).PRODUCT_PACKAGES += jacocoagent)\
+ $(eval PRODUCTS.$(product).PRODUCT_BOOT_JARS += jacocoagent))
+ endif # EMMA_INSTRUMENT_STATIC
+endif # EMMA_INSTRUMENT
+
############################################################################
# Strip and assign the PRODUCT_ variables.
$(call strip-product-vars)
@@ -216,6 +228,16 @@
PRODUCT_AAPT_CONFIG_SP := $(PRODUCT_AAPT_CONFIG)
PRODUCT_AAPT_CONFIG := $(subst $(space),$(comma),$(PRODUCT_AAPT_CONFIG))
+# Extra boot jars must be appended at the end after common boot jars.
+PRODUCT_BOOT_JARS += $(PRODUCT_BOOT_JARS_EXTRA)
+
+# Add 'platform:' prefix to unqualified boot jars
+PRODUCT_BOOT_JARS := $(foreach pair,$(PRODUCT_BOOT_JARS), \
+ $(if $(findstring :,$(pair)),,platform:)$(pair))
+
+# The extra system server jars must be appended at the end after common system server jars.
+PRODUCT_SYSTEM_SERVER_JARS += $(PRODUCT_SYSTEM_SERVER_JARS_EXTRA)
+
ifndef PRODUCT_SYSTEM_NAME
PRODUCT_SYSTEM_NAME := $(PRODUCT_NAME)
endif
@@ -252,6 +274,11 @@
endif
endif
+$(foreach pair,$(PRODUCT_UPDATABLE_BOOT_JARS), \
+ $(eval jar := $(call word-colon,2,$(pair))) \
+ $(if $(findstring $(jar), $(PRODUCT_BOOT_JARS)), \
+ $(error A jar in PRODUCT_UPDATABLE_BOOT_JARS must not be in PRODUCT_BOOT_JARS, but $(jar) is)))
+
ENFORCE_SYSTEM_CERTIFICATE := $(PRODUCT_ENFORCE_ARTIFACT_SYSTEM_CERTIFICATE_REQUIREMENT)
ENFORCE_SYSTEM_CERTIFICATE_WHITELIST := $(PRODUCT_ARTIFACT_SYSTEM_CERTIFICATE_REQUIREMENT_WHITELIST)
@@ -316,6 +343,12 @@
endif
endif
+ifdef PRODUCT_SHIPPING_API_LEVEL
+ ifneq (,$(call math_gt_or_eq,29,$(PRODUCT_SHIPPING_API_LEVEL)))
+ PRODUCT_PACKAGES += $(PRODUCT_PACKAGES_SHIPPING_API_LEVEL_29)
+ endif
+endif
+
# If build command defines OVERRIDE_PRODUCT_EXTRA_VNDK_VERSIONS,
# override PRODUCT_EXTRA_VNDK_VERSIONS with it.
ifdef OVERRIDE_PRODUCT_EXTRA_VNDK_VERSIONS
@@ -325,6 +358,20 @@
$(KATI_obsolete_var OVERRIDE_PRODUCT_EXTRA_VNDK_VERSIONS \
,Use PRODUCT_EXTRA_VNDK_VERSIONS instead)
+ifdef OVERRIDE_PRODUCT_ENFORCE_PRODUCT_PARTITION_INTERFACE
+ ifeq (false,$(OVERRIDE_PRODUCT_ENFORCE_PRODUCT_PARTITION_INTERFACE))
+ PRODUCT_ENFORCE_PRODUCT_PARTITION_INTERFACE :=
+ else
+ PRODUCT_ENFORCE_PRODUCT_PARTITION_INTERFACE := $(OVERRIDE_PRODUCT_ENFORCE_PRODUCT_PARTITION_INTERFACE)
+ endif
+else ifeq ($(PRODUCT_SHIPPING_API_LEVEL),)
+ # No shipping level defined
+else ifeq ($(call math_gt,$(PRODUCT_SHIPPING_API_LEVEL),29),true)
+ PRODUCT_ENFORCE_PRODUCT_PARTITION_INTERFACE := true
+endif
+
+$(KATI_obsolete_var OVERRIDE_PRODUCT_ENFORCE_PRODUCT_PARTITION_INTERFACE,Use PRODUCT_ENFORCE_PRODUCT_PARTITION_INTERFACE instead)
+
define product-overrides-config
$$(foreach rule,$$(PRODUCT_$(1)_OVERRIDES),\
$$(if $$(filter 2,$$(words $$(subst :,$$(space),$$(rule)))),,\
diff --git a/core/rbe.mk b/core/rbe.mk
index 231859b..9ec8481 100644
--- a/core/rbe.mk
+++ b/core/rbe.mk
@@ -21,12 +21,61 @@
else
rbe_dir := $(HOME)/rbe
endif
- RBE_WRAPPER := $(rbe_dir)/rewrapper --labels=type=compile,lang=cpp,compiler=clang --env_var_whitelist=PWD
+
+ ifdef RBE_CXX_EXEC_STRATEGY
+ cxx_rbe_exec_strategy := $(RBE_CXX_EXEC_STRATEGY)
+ else
+ cxx_rbe_exec_strategy := "local"
+ endif
+
+ ifdef RBE_CXX_COMPARE
+ cxx_compare := $(RBE_CXX_COMPARE)
+ else
+ cxx_compare := "false"
+ endif
+
+ ifdef RBE_JAVAC_EXEC_STRATEGY
+ javac_exec_strategy := $(RBE_JAVAC_EXEC_STRATEGY)
+ else
+ javac_exec_strategy := "local"
+ endif
+
+ ifdef RBE_R8_EXEC_STRATEGY
+ r8_exec_strategy := $(RBE_R8_EXEC_STRATEGY)
+ else
+ r8_exec_strategy := "local"
+ endif
+
+ ifdef RBE_D8_EXEC_STRATEGY
+ d8_exec_strategy := $(RBE_D8_EXEC_STRATEGY)
+ else
+ d8_exec_strategy := "local"
+ endif
+
+ platform := "container-image=docker://gcr.io/androidbuild-re-dockerimage/android-build-remoteexec-image@sha256:582efb38f0c229ea39952fff9e132ccbe183e14869b39888010dacf56b360d62"
+ cxx_platform := $(platform)",Pool=default"
+ java_r8_d8_platform := $(platform)",Pool=java16"
+
+ RBE_WRAPPER := $(rbe_dir)/rewrapper
+ RBE_CXX := --labels=type=compile,lang=cpp,compiler=clang --env_var_whitelist=PWD --exec_strategy=$(cxx_rbe_exec_strategy) --platform="$(cxx_platform)" --compare="$(cxx_compare)"
# Append rewrapper to existing *_WRAPPER variables so it's possible to
# use both ccache and rewrapper.
- CC_WRAPPER := $(strip $(CC_WRAPPER) $(RBE_WRAPPER))
- CXX_WRAPPER := $(strip $(CXX_WRAPPER) $(RBE_WRAPPER))
+ CC_WRAPPER := $(strip $(CC_WRAPPER) $(RBE_WRAPPER) $(RBE_CXX))
+ CXX_WRAPPER := $(strip $(CXX_WRAPPER) $(RBE_WRAPPER) $(RBE_CXX))
+
+ ifdef RBE_JAVAC
+ JAVAC_WRAPPER := $(strip $(JAVAC_WRAPPER) $(RBE_WRAPPER) --labels=type=compile,lang=java,compiler=javac --exec_strategy=$(javac_exec_strategy) --platform="$(java_r8_d8_platform)")
+ endif
+
+ ifdef RBE_R8
+ R8_WRAPPER := $(strip $(RBE_WRAPPER) --labels=type=compile,compiler=r8 --exec_strategy=$(r8_exec_strategy) --platform="$(java_r8_d8_platform)" --inputs=out/soong/host/linux-x86/framework/r8-compat-proguard.jar,build/make/core/proguard_basic_keeps.flags --toolchain_inputs=prebuilts/jdk/jdk11/linux-x86/bin/java)
+ endif
+
+ ifdef RBE_D8
+ D8_WRAPPER := $(strip $(RBE_WRAPPER) --labels=type=compile,compiler=d8 --exec_strategy=$(d8_exec_strategy) --platform="$(java_r8_d8_platform)" --inputs=out/soong/host/linux-x86/framework/d8.jar --toolchain_inputs=prebuilts/jdk/jdk11/linux-x86/bin/java)
+ endif
rbe_dir :=
endif
+
diff --git a/core/rust_device_test_config_template.xml b/core/rust_device_test_config_template.xml
new file mode 100644
index 0000000..9429d38
--- /dev/null
+++ b/core/rust_device_test_config_template.xml
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2019 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.
+-->
+<!-- This test config file is auto-generated. -->
+<configuration description="Config to run {MODULE} device tests.">
+ <target_preparer class="com.android.tradefed.targetprep.PushFilePreparer">
+ <option name="cleanup" value="true" />
+ <option name="push" value="{MODULE}->/data/local/tmp/{MODULE}" />
+ </target_preparer>
+
+ <test class="com.android.tradefed.testtype.rust.RustBinaryTest" >
+ <option name="test-device-path" value="/data/local/tmp" />
+ <option name="module-name" value="{MODULE}" />
+ </test>
+</configuration>
diff --git a/core/rust_host_test_config_template.xml b/core/rust_host_test_config_template.xml
new file mode 100644
index 0000000..fc23fbe
--- /dev/null
+++ b/core/rust_host_test_config_template.xml
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2019 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.
+-->
+<configuration description="Config to run {MODULE} host tests">
+ <test class="com.android.tradefed.testtype.rust.RustBinaryHostTest" >
+ <option name="test-file" value="{MODULE}" />
+ <option name="test-timeout" value="5m" />
+ </test>
+</configuration>
diff --git a/core/shared_library.mk b/core/shared_library.mk
index 2832c17..29d8276 100644
--- a/core/shared_library.mk
+++ b/core/shared_library.mk
@@ -1,4 +1,7 @@
$(call record-module-type,SHARED_LIBRARY)
+ifdef LOCAL_IS_HOST_MODULE
+ $(call pretty-error,BUILD_SHARED_LIBRARY is incompatible with LOCAL_IS_HOST_MODULE. Use BUILD_HOST_SHARED_LIBRARY instead.)
+endif
my_prefix := TARGET_
include $(BUILD_SYSTEM)/multilib.mk
@@ -53,4 +56,9 @@
###########################################################
## Copy headers to the install tree
###########################################################
-include $(BUILD_COPY_HEADERS)
+ifdef LOCAL_COPY_HEADERS
+$(if $(filter true,$(BUILD_BROKEN_USES_BUILD_COPY_HEADERS)),\
+ $(call pretty-warning,LOCAL_COPY_HEADERS is deprecated. See $(CHANGES_URL)#copy_headers),\
+ $(call pretty-error,LOCAL_COPY_HEADERS is obsolete. See $(CHANGES_URL)#copy_headers))
+include $(BUILD_SYSTEM)/copy_headers.mk
+endif
diff --git a/core/shared_library_internal.mk b/core/shared_library_internal.mk
index 8ec07f8..219772a 100644
--- a/core/shared_library_internal.mk
+++ b/core/shared_library_internal.mk
@@ -39,11 +39,6 @@
else
my_target_libcrt_builtins := $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)LIBCRT_BUILTINS)
endif
-ifeq ($(LOCAL_NO_LIBGCC),true)
-my_target_libgcc :=
-else
-my_target_libgcc := $(call intermediates-dir-for,STATIC_LIBRARIES,libgcc,,,$(LOCAL_2ND_ARCH_VAR_PREFIX))/libgcc.a
-endif
my_target_libatomic := $(call intermediates-dir-for,STATIC_LIBRARIES,libatomic,,,$(LOCAL_2ND_ARCH_VAR_PREFIX))/libatomic.a
ifeq ($(LOCAL_NO_CRT),true)
my_target_crtbegin_so_o :=
@@ -60,7 +55,6 @@
my_target_crtend_so_o := $(wildcard $(my_ndk_sysroot_lib)/crtend_so.o)
endif
$(linked_module): PRIVATE_TARGET_LIBCRT_BUILTINS := $(my_target_libcrt_builtins)
-$(linked_module): PRIVATE_TARGET_LIBGCC := $(my_target_libgcc)
$(linked_module): PRIVATE_TARGET_LIBATOMIC := $(my_target_libatomic)
$(linked_module): PRIVATE_TARGET_CRTBEGIN_SO_O := $(my_target_crtbegin_so_o)
$(linked_module): PRIVATE_TARGET_CRTEND_SO_O := $(my_target_crtend_so_o)
@@ -71,7 +65,6 @@
$(my_target_crtbegin_so_o) \
$(my_target_crtend_so_o) \
$(my_target_libcrt_builtins) \
- $(my_target_libgcc) \
$(my_target_libatomic) \
$(LOCAL_ADDITIONAL_DEPENDENCIES) $(CLANG_CXX)
$(transform-o-to-shared-lib)
diff --git a/core/shared_test_lib.mk b/core/shared_test_lib.mk
deleted file mode 100644
index 1ea9fe7..0000000
--- a/core/shared_test_lib.mk
+++ /dev/null
@@ -1 +0,0 @@
-$(error BUILD_SHARED_TEST_LIBRARY is obsolete)
diff --git a/core/shell_test_config_template.xml b/core/shell_test_config_template.xml
new file mode 100644
index 0000000..5e1c8ee
--- /dev/null
+++ b/core/shell_test_config_template.xml
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2020 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.
+-->
+<!-- This test config file is auto-generated. -->
+<configuration description="Config for running {MODULE} through Atest or in Infra">
+ <option name="test-suite-tag" value="{MODULE}" />
+
+ {EXTRA_CONFIGS}
+
+ <!-- This test requires a device, so it's not annotated with a null-device. -->
+ <test class="com.android.tradefed.testtype.binary.ExecutableHostTest" >
+ <option name="binary" value="{OUTPUT_FILENAME}" />
+ <!-- Test script assumes a relative path with the tests/ folders. -->
+ <option name="relative-path-execution" value="true" />
+ <!-- Tests shouldn't be that long but set 15m to be safe. -->
+ <option name="per-binary-timeout" value="15m" />
+ </test>
+</configuration>
\ No newline at end of file
diff --git a/core/soong_android_app_set.mk b/core/soong_android_app_set.mk
new file mode 100644
index 0000000..5ed9b2c
--- /dev/null
+++ b/core/soong_android_app_set.mk
@@ -0,0 +1,34 @@
+# App prebuilt coming from Soong.
+# Extra inputs:
+# LOCAL_APK_SET_MASTER_FILE
+
+ifneq ($(LOCAL_MODULE_MAKEFILE),$(SOONG_ANDROID_MK))
+ $(call pretty-error,soong_apk_set.mk may only be used from Soong)
+endif
+
+LOCAL_BUILT_MODULE_STEM := $(LOCAL_APK_SET_MASTER_FILE)
+LOCAL_INSTALLED_MODULE_STEM := $(LOCAL_APK_SET_MASTER_FILE)
+
+#######################################
+include $(BUILD_SYSTEM)/base_rules.mk
+#######################################
+
+## Extract master APK from APK set into given directory
+# $(1) APK set
+# $(2) master APK entry (e.g., splits/base-master.apk
+
+define extract-master-from-apk-set
+$(LOCAL_BUILT_MODULE): $(1)
+ @echo "Extracting $$@"
+ unzip -pq $$< $(2) >$$@
+endef
+
+$(eval $(call extract-master-from-apk-set,$(LOCAL_PREBUILT_MODULE_FILE),$(LOCAL_APK_SET_MASTER_FILE)))
+# unzip returns 11 it there was nothing to extract, which is expected,
+# $(LOCAL_APK_SET_MASTER_FILE) has is already there.
+LOCAL_POST_INSTALL_CMD := unzip -qo -j -d $(dir $(LOCAL_INSTALLED_MODULE)) \
+ $(LOCAL_PREBUILT_MODULE_FILE) -x $(LOCAL_APK_SET_MASTER_FILE) || [[ $$? -eq 11 ]]
+$(LOCAL_INSTALLED_MODULE): PRIVATE_POST_INSTALL_CMD := $(LOCAL_POST_INSTALL_CMD)
+PACKAGES.$(LOCAL_MODULE).OVERRIDES := $(strip $(LOCAL_OVERRIDES_PACKAGES))
+
+SOONG_ALREADY_CONV += $(LOCAL_MODULE)
diff --git a/core/soong_app_prebuilt.mk b/core/soong_app_prebuilt.mk
index 8fc2e4c..3549c1d 100644
--- a/core/soong_app_prebuilt.mk
+++ b/core/soong_app_prebuilt.mk
@@ -41,6 +41,10 @@
$(eval $(call copy-one-file,$(full_classes_jar),$(full_classes_header_jar)))
endif
endif # TURBINE_ENABLED != false
+
+ javac-check : $(full_classes_jar)
+ javac-check-$(LOCAL_MODULE) : $(full_classes_jar)
+ .PHONY: javac-check-$(LOCAL_MODULE)
endif
# Run veridex on product, system_ext and vendor modules.
@@ -97,10 +101,6 @@
java-dex: $(LOCAL_SOONG_DEX_JAR)
-ifneq ($(BUILD_PLATFORM_ZIP),)
- $(eval $(call copy-one-file,$(LOCAL_SOONG_DEX_JAR),$(dir $(LOCAL_BUILT_MODULE))package.dex.apk))
-endif
-
my_built_installed := $(foreach f,$(LOCAL_SOONG_BUILT_INSTALLED),\
$(call word-colon,1,$(f)):$(PRODUCT_OUT)$(call word-colon,2,$(f)))
my_installed := $(call copy-many-files, $(my_built_installed))
@@ -108,6 +108,16 @@
ALL_MODULES.$(my_register_name).BUILT_INSTALLED += $(my_built_installed)
$(my_all_targets): $(my_installed)
+# Copy test suite files.
+ifdef LOCAL_COMPATIBILITY_SUITE
+my_apks_to_install := $(foreach f,$(filter %.apk %.idsig,$(LOCAL_SOONG_BUILT_INSTALLED)),$(call word-colon,1,$(f)))
+$(foreach suite, $(LOCAL_COMPATIBILITY_SUITE), \
+ $(eval my_compat_dist_$(suite) := $(foreach dir, $(call compatibility_suite_dirs,$(suite)), \
+ $(foreach a,$(my_apks_to_install),\
+ $(call compat-copy-pair,$(a),$(dir)/$(notdir $(a)))))))
+$(call create-suite-dependencies)
+endif
+
# embedded JNI will already have been handled by soong
my_embed_jni :=
my_prebuilt_jni_libs :=
@@ -129,6 +139,9 @@
my_2nd_arch_prefix :=
PACKAGES := $(PACKAGES) $(LOCAL_MODULE)
+ifndef LOCAL_CERTIFICATE
+ $(call pretty-error,LOCAL_CERTIFICATE must be set for soong_app_prebuilt.mk)
+endif
ifeq ($(LOCAL_CERTIFICATE),PRESIGNED)
# The magic string "PRESIGNED" means this package is already checked
# signed with its release key.
@@ -144,8 +157,17 @@
include $(BUILD_SYSTEM)/app_certificate_validate.mk
PACKAGES.$(LOCAL_MODULE).OVERRIDES := $(strip $(LOCAL_OVERRIDES_PACKAGES))
+ifneq ($(LOCAL_MODULE_STEM),)
+ PACKAGES.$(LOCAL_MODULE).STEM := $(LOCAL_MODULE_STEM)
+else
+ PACKAGES.$(LOCAL_MODULE).STEM := $(LOCAL_MODULE)
+endif
+
+# Set a actual_partition_tag (calculated in base_rules.mk) for the package.
+PACKAGES.$(LOCAL_MODULE).PARTITION := $(actual_partition_tag)
+
ifdef LOCAL_SOONG_BUNDLE
- ALL_MODULES.$(LOCAL_MODULE).BUNDLE := $(LOCAL_SOONG_BUNDLE)
+ ALL_MODULES.$(my_register_name).BUNDLE := $(LOCAL_SOONG_BUNDLE)
endif
ifndef LOCAL_IS_HOST_MODULE
@@ -189,4 +211,11 @@
)
endif
-SOONG_ALREADY_CONV := $(SOONG_ALREADY_CONV) $(LOCAL_MODULE)
+ifdef LOCAL_PREBUILT_COVERAGE_ARCHIVE
+ my_coverage_dir := $(TARGET_OUT_COVERAGE)/$(patsubst $(PRODUCT_OUT)/%,%,$(my_module_path))
+ my_coverage_copy_pairs := $(foreach f,$(LOCAL_PREBUILT_COVERAGE_ARCHIVE),$(f):$(my_coverage_dir)/$(notdir $(f)))
+ my_coverage_files := $(call copy-many-files,$(my_coverage_copy_pairs))
+ $(LOCAL_INSTALLED_MODULE): $(my_coverage_files)
+endif
+
+SOONG_ALREADY_CONV += $(LOCAL_MODULE)
diff --git a/core/soong_cc_prebuilt.mk b/core/soong_cc_prebuilt.mk
index 09eb419..986609b 100644
--- a/core/soong_cc_prebuilt.mk
+++ b/core/soong_cc_prebuilt.mk
@@ -51,7 +51,7 @@
ifneq ($(filter STATIC_LIBRARIES SHARED_LIBRARIES HEADER_LIBRARIES,$(LOCAL_MODULE_CLASS)),)
# Soong module is a static or shared library
- EXPORTS_LIST := $(EXPORTS_LIST) $(intermediates)
+ EXPORTS_LIST += $(intermediates)
EXPORTS.$(intermediates).FLAGS := $(LOCAL_EXPORT_CFLAGS)
EXPORTS.$(intermediates).DEPS := $(LOCAL_EXPORT_C_INCLUDE_DEPS)
@@ -61,7 +61,7 @@
$(my_all_targets): $(LOCAL_BUILT_MODULE).toc
endif
- SOONG_ALREADY_CONV := $(SOONG_ALREADY_CONV) $(LOCAL_MODULE)
+ SOONG_ALREADY_CONV += $(LOCAL_MODULE)
my_link_type := $(LOCAL_SOONG_LINK_TYPE)
my_warn_types :=
@@ -75,8 +75,13 @@
ifdef LOCAL_USE_VNDK
ifneq ($(LOCAL_VNDK_DEPEND_ON_CORE_VARIANT),true)
name_without_suffix := $(patsubst %.vendor,%,$(LOCAL_MODULE))
- ifneq ($(name_without_suffix),$(LOCAL_MODULE)
+ ifneq ($(name_without_suffix),$(LOCAL_MODULE))
SPLIT_VENDOR.$(LOCAL_MODULE_CLASS).$(name_without_suffix) := 1
+ else
+ name_without_suffix := $(patsubst %.product,%,$(LOCAL_MODULE))
+ ifneq ($(name_without_suffix),$(LOCAL_MODULE))
+ SPLIT_PRODUCT.$(LOCAL_MODULE_CLASS).$(name_without_suffix) := 1
+ endif
endif
name_without_suffix :=
endif
@@ -104,39 +109,45 @@
endif
endif
-ifeq ($(LOCAL_VNDK_DEPEND_ON_CORE_VARIANT),true)
- # Add $(LOCAL_BUILT_MODULE) as a dependency to no_vendor_variant_vndk_check so
- # that the vendor variant will be built and checked against the core variant.
- no_vendor_variant_vndk_check: $(LOCAL_BUILT_MODULE)
+my_check_same_vndk_variants :=
+ifeq ($(LOCAL_CHECK_SAME_VNDK_VARIANTS),true)
+ ifeq ($(filter hwaddress address, $(SANITIZE_TARGET)),)
+ ifneq ($(CLANG_COVERAGE),true)
+ my_check_same_vndk_variants := true
+ endif
+ endif
+endif
- my_core_register_name := $(subst .vendor,,$(my_register_name))
+ifeq ($(my_check_same_vndk_variants),true)
+ same_vndk_variants_stamp := $(intermediates)/same_vndk_variants.timestamp
+
+ my_core_register_name := $(subst .vendor,,$(subst .product,,$(my_register_name)))
my_core_variant_files := $(call module-target-built-files,$(my_core_register_name))
my_core_shared_lib := $(sort $(filter %.so,$(my_core_variant_files)))
- $(LOCAL_BUILT_MODULE): PRIVATE_CORE_VARIANT := $(my_core_shared_lib)
- # The built vendor variant library needs to depend on the built core variant
- # so that we can perform identity check against the core variant.
- $(LOCAL_BUILT_MODULE): $(my_core_shared_lib)
+ $(same_vndk_variants_stamp): PRIVATE_CORE_VARIANT := $(my_core_shared_lib)
+ $(same_vndk_variants_stamp): PRIVATE_VENDOR_VARIANT := $(LOCAL_PREBUILT_MODULE_FILE)
+ $(same_vndk_variants_stamp): PRIVATE_TOOLS_PREFIX := $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)TOOLS_PREFIX)
+
+ $(same_vndk_variants_stamp): $(my_core_shared_lib) $(LOCAL_PREBUILT_MODULE_FILE)
+ $(call verify-vndk-libs-identical,\
+ $(PRIVATE_CORE_VARIANT),\
+ $(PRIVATE_VENDOR_VARIANT),\
+ $(PRIVATE_TOOLS_PREFIX))
+ touch $@
+
+ $(LOCAL_BUILT_MODULE): $(same_vndk_variants_stamp)
endif
-ifeq ($(LOCAL_VNDK_DEPEND_ON_CORE_VARIANT),true)
-$(LOCAL_BUILT_MODULE): $(LOCAL_PREBUILT_MODULE_FILE) $(LIBRARY_IDENTITY_CHECK_SCRIPT)
- $(call verify-vndk-libs-identical,\
- $(PRIVATE_CORE_VARIANT),\
- $<,\
- $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)TOOLS_PREFIX))
- $(copy-file-to-target)
-else
$(LOCAL_BUILT_MODULE): $(LOCAL_PREBUILT_MODULE_FILE)
$(transform-prebuilt-to-target)
-endif
ifneq ($(filter EXECUTABLES NATIVE_TESTS,$(LOCAL_MODULE_CLASS)),)
$(hide) chmod +x $@
endif
ifndef LOCAL_IS_HOST_MODULE
ifdef LOCAL_SOONG_UNSTRIPPED_BINARY
- ifneq ($(LOCAL_VNDK_DEPEND_ON_CORE_VARIANT),true)
+ ifneq ($(LOCAL_UNINSTALLABLE_MODULE),true)
my_symbol_path := $(if $(LOCAL_SOONG_SYMBOL_PATH),$(LOCAL_SOONG_SYMBOL_PATH),$(my_module_path))
# Store a copy with symbols for symbolic debugging
my_unstripped_path := $(TARGET_OUT_UNSTRIPPED)/$(patsubst $(PRODUCT_OUT)/%,%,$(my_symbol_path))
@@ -219,3 +230,9 @@
$(notice_target): | $(installed_static_library_notice_file_targets)
$(LOCAL_INSTALLED_MODULE): | $(notice_target)
+
+# Reinstall shared library dependencies of fuzz targets to /data/fuzz/ (for
+# target) or /data/ (for host).
+ifdef LOCAL_IS_FUZZ_TARGET
+$(LOCAL_INSTALLED_MODULE): $(LOCAL_FUZZ_INSTALLED_SHARED_DEPS)
+endif
diff --git a/core/soong_config.mk b/core/soong_config.mk
index bcd025b..53c7b0d 100644
--- a/core/soong_config.mk
+++ b/core/soong_config.mk
@@ -25,14 +25,13 @@
$(call add_json_str, Make_suffix, -$(TARGET_PRODUCT))
$(call add_json_str, BuildId, $(BUILD_ID))
-$(call add_json_str, BuildNumberFromFile, $(BUILD_NUMBER_FROM_FILE))
+$(call add_json_str, BuildNumberFile, build_number.txt)
$(call add_json_str, Platform_version_name, $(PLATFORM_VERSION))
$(call add_json_val, Platform_sdk_version, $(PLATFORM_SDK_VERSION))
$(call add_json_str, Platform_sdk_codename, $(PLATFORM_VERSION_CODENAME))
$(call add_json_bool, Platform_sdk_final, $(filter REL,$(PLATFORM_VERSION_CODENAME)))
$(call add_json_csv, Platform_version_active_codenames, $(PLATFORM_VERSION_ALL_CODENAMES))
-$(call add_json_csv, Platform_version_future_codenames, $(PLATFORM_VERSION_FUTURE_CODENAMES))
$(call add_json_str, Platform_security_patch, $(PLATFORM_SECURITY_PATCH))
$(call add_json_str, Platform_preview_sdk_version, $(PLATFORM_PREVIEW_SDK_VERSION))
$(call add_json_str, Platform_base_os, $(PLATFORM_BASE_OS))
@@ -40,7 +39,7 @@
$(call add_json_str, Platform_min_supported_target_sdk_version, $(PLATFORM_MIN_SUPPORTED_TARGET_SDK_VERSION))
$(call add_json_bool, Allow_missing_dependencies, $(ALLOW_MISSING_DEPENDENCIES))
-$(call add_json_bool, Unbundled_build, $(TARGET_BUILD_APPS))
+$(call add_json_bool, Unbundled_build, $(TARGET_BUILD_UNBUNDLED))
$(call add_json_bool, Unbundled_build_sdks_from_source, $(UNBUNDLED_BUILD_SDKS_FROM_SOURCE))
$(call add_json_bool, Pdk, $(filter true,$(TARGET_BUILD_PDK)))
@@ -81,6 +80,7 @@
$(call add_json_list, DeviceResourceOverlays, $(DEVICE_PACKAGE_OVERLAYS))
$(call add_json_list, ProductResourceOverlays, $(PRODUCT_PACKAGE_OVERLAYS))
$(call add_json_list, EnforceRROTargets, $(PRODUCT_ENFORCE_RRO_TARGETS))
+$(call add_json_list, EnforceRROExemptedTargets, $(PRODUCT_ENFORCE_RRO_EXEMPTED_TARGETS))
$(call add_json_list, EnforceRROExcludedOverlays, $(PRODUCT_ENFORCE_RRO_EXCLUDED_OVERLAYS))
$(call add_json_str, AAPTCharacteristics, $(TARGET_AAPT_CHARACTERISTICS))
@@ -101,38 +101,44 @@
$(call add_json_bool, EnableCFI, $(call invert_bool,$(filter false,$(ENABLE_CFI))))
$(call add_json_list, CFIExcludePaths, $(CFI_EXCLUDE_PATHS) $(PRODUCT_CFI_EXCLUDE_PATHS))
$(call add_json_list, CFIIncludePaths, $(CFI_INCLUDE_PATHS) $(PRODUCT_CFI_INCLUDE_PATHS))
-$(call add_json_bool, EnableXOM, $(call invert_bool,$(filter false,$(ENABLE_XOM))))
-$(call add_json_list, XOMExcludePaths, $(XOM_EXCLUDE_PATHS) $(PRODUCT_XOM_EXCLUDE_PATHS))
$(call add_json_list, IntegerOverflowExcludePaths, $(INTEGER_OVERFLOW_EXCLUDE_PATHS) $(PRODUCT_INTEGER_OVERFLOW_EXCLUDE_PATHS))
+$(call add_json_bool, Experimental_mte, $(filter true,$(TARGET_EXPERIMENTAL_MTE)))
+
$(call add_json_bool, DisableScudo, $(filter true,$(PRODUCT_DISABLE_SCUDO)))
$(call add_json_bool, ClangTidy, $(filter 1 true,$(WITH_TIDY)))
$(call add_json_str, TidyChecks, $(WITH_TIDY_CHECKS))
-$(call add_json_bool, NativeCoverage, $(filter true,$(NATIVE_COVERAGE)))
+$(call add_json_bool, NativeLineCoverage, $(filter true,$(NATIVE_LINE_COVERAGE)))
+$(call add_json_bool, Native_coverage, $(filter true,$(NATIVE_COVERAGE)))
+$(call add_json_bool, ClangCoverage, $(filter true,$(CLANG_COVERAGE)))
$(call add_json_list, CoveragePaths, $(COVERAGE_PATHS))
$(call add_json_list, CoverageExcludePaths, $(COVERAGE_EXCLUDE_PATHS))
+$(call add_json_bool, SamplingPGO, $(filter true,$(SAMPLING_PGO)))
+
$(call add_json_bool, ArtUseReadBarrier, $(call invert_bool,$(filter false,$(PRODUCT_ART_USE_READ_BARRIER))))
$(call add_json_bool, Binder32bit, $(BINDER32BIT))
$(call add_json_str, BtConfigIncludeDir, $(BOARD_BLUETOOTH_BDROID_BUILDCFG_INCLUDE_DIR))
-$(call add_json_list, DeviceKernelHeaders, $(TARGET_PROJECT_SYSTEM_INCLUDES))
-$(call add_json_bool, DevicePrefer32BitApps, $(filter true,$(TARGET_PREFER_32_BIT_APPS)))
-$(call add_json_bool, DevicePrefer32BitExecutables, $(filter true,$(TARGET_PREFER_32_BIT_EXECUTABLES)))
+$(call add_json_list, DeviceKernelHeaders, $(TARGET_DEVICE_KERNEL_HEADERS) $(TARGET_BOARD_KERNEL_HEADERS) $(TARGET_PRODUCT_KERNEL_HEADERS))
$(call add_json_str, DeviceVndkVersion, $(BOARD_VNDK_VERSION))
$(call add_json_str, Platform_vndk_version, $(PLATFORM_VNDK_VERSION))
+$(call add_json_str, ProductVndkVersion, $(PRODUCT_PRODUCT_VNDK_VERSION))
$(call add_json_list, ExtraVndkVersions, $(PRODUCT_EXTRA_VNDK_VERSIONS))
$(call add_json_bool, BoardVndkRuntimeDisable, $(BOARD_VNDK_RUNTIME_DISABLE))
$(call add_json_list, DeviceSystemSdkVersions, $(BOARD_SYSTEMSDK_VERSIONS))
$(call add_json_list, Platform_systemsdk_versions, $(PLATFORM_SYSTEMSDK_VERSIONS))
$(call add_json_bool, Malloc_not_svelte, $(call invert_bool,$(filter true,$(MALLOC_SVELTE))))
+$(call add_json_bool, Malloc_zero_contents, $(MALLOC_ZERO_CONTENTS))
+$(call add_json_bool, Malloc_pattern_fill_contents, $(MALLOC_PATTERN_FILL_CONTENTS))
$(call add_json_str, Override_rs_driver, $(OVERRIDE_RS_DRIVER))
$(call add_json_bool, UncompressPrivAppDex, $(call invert_bool,$(filter true,$(DONT_UNCOMPRESS_PRIV_APPS_DEXS))))
$(call add_json_list, ModulesLoadedByPrivilegedModules, $(PRODUCT_LOADED_BY_PRIVILEGED_MODULES))
$(call add_json_list, BootJars, $(PRODUCT_BOOT_JARS))
+$(call add_json_list, UpdatableBootJars, $(PRODUCT_UPDATABLE_BOOT_JARS))
$(call add_json_bool, VndkUseCoreVariant, $(TARGET_VNDK_USE_CORE_VARIANT))
$(call add_json_bool, VndkSnapshotBuildArtifacts, $(VNDK_SNAPSHOT_BUILD_ARTIFACTS))
@@ -152,6 +158,9 @@
$(call add_json_bool, UseGoma, $(filter-out false,$(USE_GOMA)))
$(call add_json_bool, UseRBE, $(filter-out false,$(USE_RBE)))
+$(call add_json_bool, UseRBEJAVAC, $(filter-out false,$(RBE_JAVAC)))
+$(call add_json_bool, UseRBER8, $(filter-out false,$(RBE_R8)))
+$(call add_json_bool, UseRBED8, $(filter-out false,$(RBE_D8)))
$(call add_json_bool, Arc, $(filter true,$(TARGET_ARC)))
$(call add_json_list, NamespacesToExport, $(PRODUCT_SOONG_NAMESPACES))
@@ -195,6 +204,12 @@
$(call end_json_map))
$(call end_json_map)
+$(call add_json_bool, EnforceProductPartitionInterface, $(PRODUCT_ENFORCE_PRODUCT_PARTITION_INTERFACE))
+
+$(call add_json_bool, InstallExtraFlattenedApexes, $(PRODUCT_INSTALL_EXTRA_FLATTENED_APEXES))
+
+$(call add_json_bool, BoardUsesRecoveryAsBoot, $(BOARD_USES_RECOVERY_AS_BOOT))
+
$(call json_end)
$(file >$(SOONG_VARIABLES).tmp,$(json_contents))
diff --git a/core/soong_droiddoc_prebuilt.mk b/core/soong_droiddoc_prebuilt.mk
index bf1f10b..c0467df 100644
--- a/core/soong_droiddoc_prebuilt.mk
+++ b/core/soong_droiddoc_prebuilt.mk
@@ -38,3 +38,7 @@
.PHONY: $(LOCAL_MODULE) $(LOCAL_MODULE)-jdiff
$(LOCAL_MODULE) $(LOCAL_MODULE)-jdiff : $(OUT_DOCS)/$(LOCAL_MODULE)-jdiff-docs.zip
endif
+
+ifdef LOCAL_DROIDDOC_METADATA_ZIP
+$(eval $(call copy-one-file,$(LOCAL_DROIDDOC_METADATA_ZIP),$(TARGET_OUT_COMMON_INTERMEDIATES)/PACKAGING/$(LOCAL_MODULE)-metadata.zip))
+endif
diff --git a/core/soong_java_prebuilt.mk b/core/soong_java_prebuilt.mk
index 1496d56..e4c84e0 100644
--- a/core/soong_java_prebuilt.mk
+++ b/core/soong_java_prebuilt.mk
@@ -91,7 +91,8 @@
ifdef LOCAL_SOONG_DEX_JAR
ifndef LOCAL_IS_HOST_MODULE
- ifneq ($(filter $(LOCAL_MODULE),$(PRODUCT_BOOT_JARS)),) # is_boot_jar
+ boot_jars := $(foreach pair,$(PRODUCT_BOOT_JARS), $(call word-colon,2,$(pair)))
+ ifneq ($(filter $(LOCAL_MODULE),$(boot_jars)),) # is_boot_jar
ifeq (true,$(WITH_DEXPREOPT))
# For libart, the boot jars' odex files are replaced by $(DEFAULT_DEX_PREOPT_INSTALLED_IMAGE).
# We use this installed_odex trick to get boot.art installed.
@@ -132,7 +133,7 @@
$(my_register_name): $(my_installed)
ifdef LOCAL_SOONG_AAR
- ALL_MODULES.$(LOCAL_MODULE).AAR := $(LOCAL_SOONG_AAR)
+ ALL_MODULES.$(my_register_name).AAR := $(LOCAL_SOONG_AAR)
endif
javac-check : $(full_classes_jar)
@@ -172,4 +173,4 @@
$(hide) echo $(PRIVATE_EXPORTED_SDK_LIBS) | tr ' ' '\n' > $@,\
$(hide) touch $@)
-SOONG_ALREADY_CONV := $(SOONG_ALREADY_CONV) $(LOCAL_MODULE)
+SOONG_ALREADY_CONV += $(LOCAL_MODULE)
diff --git a/core/soong_rust_prebuilt.mk b/core/soong_rust_prebuilt.mk
index 23d18c4..804e37e 100644
--- a/core/soong_rust_prebuilt.mk
+++ b/core/soong_rust_prebuilt.mk
@@ -58,7 +58,7 @@
$(LOCAL_BUILT_MODULE): $(LOCAL_PREBUILT_MODULE_FILE)
$(transform-prebuilt-to-target)
-ifneq ($(filter EXECUTABLES,$(LOCAL_MODULE_CLASS)),)
+ifneq ($(filter EXECUTABLES NATIVE_TESTS,$(LOCAL_MODULE_CLASS)),)
$(hide) chmod +x $@
endif
@@ -75,6 +75,23 @@
endif
endif
+
+ifeq ($(NATIVE_COVERAGE),true)
+ ifneq (,$(strip $(LOCAL_PREBUILT_COVERAGE_ARCHIVE)))
+ $(eval $(call copy-one-file,$(LOCAL_PREBUILT_COVERAGE_ARCHIVE),$(intermediates)/$(LOCAL_MODULE).zip))
+ ifneq ($(LOCAL_UNINSTALLABLE_MODULE),true)
+ ifdef LOCAL_IS_HOST_MODULE
+ my_coverage_path := $($(my_prefix)OUT_COVERAGE)/$(patsubst $($(my_prefix)OUT)/%,%,$(my_module_path))
+ else
+ my_coverage_path := $(TARGET_OUT_COVERAGE)/$(patsubst $(PRODUCT_OUT)/%,%,$(my_module_path))
+ endif
+ my_coverage_path := $(my_coverage_path)/$(patsubst %.so,%,$(my_installed_module_stem)).zip
+ $(eval $(call copy-one-file,$(LOCAL_PREBUILT_COVERAGE_ARCHIVE),$(my_coverage_path)))
+ $(LOCAL_BUILT_MODULE): $(my_coverage_path)
+ endif
+ endif
+endif
+
# A product may be configured to strip everything in some build variants.
# We do the stripping as a post-install command so that LOCAL_BUILT_MODULE
# is still with the symbols and we don't need to clean it (and relink) when
diff --git a/core/static_java_library.mk b/core/static_java_library.mk
index 7eef167..81dc2df 100644
--- a/core/static_java_library.mk
+++ b/core/static_java_library.mk
@@ -209,7 +209,7 @@
$(call jar-args-sorted-files-in-directory,$(dir $@)aar)
# Register the aar file.
-ALL_MODULES.$(LOCAL_MODULE).AAR := $(built_aar)
+ALL_MODULES.$(my_register_name).AAR := $(built_aar)
endif # need_compile_res
# Reset internal variables.
diff --git a/core/static_library.mk b/core/static_library.mk
index 8002e5c..a450092 100644
--- a/core/static_library.mk
+++ b/core/static_library.mk
@@ -1,4 +1,7 @@
$(call record-module-type,STATIC_LIBRARY)
+ifdef LOCAL_IS_HOST_MODULE
+ $(call pretty-error,BUILD_STATIC_LIBRARY is incompatible with LOCAL_IS_HOST_MODULE. Use BUILD_HOST_STATIC_LIBRARY instead)
+endif
my_prefix := TARGET_
include $(BUILD_SYSTEM)/multilib.mk
@@ -38,4 +41,9 @@
###########################################################
## Copy headers to the install tree
###########################################################
-include $(BUILD_COPY_HEADERS)
+ifdef LOCAL_COPY_HEADERS
+$(if $(filter true,$(BUILD_BROKEN_USES_BUILD_COPY_HEADERS)),\
+ $(call pretty-warning,LOCAL_COPY_HEADERS is deprecated. See $(CHANGES_URL)#copy_headers),\
+ $(call pretty-error,LOCAL_COPY_HEADERS is obsolete. See $(CHANGES_URL)#copy_headers))
+include $(BUILD_SYSTEM)/copy_headers.mk
+endif
diff --git a/core/static_test_lib.mk b/core/static_test_lib.mk
deleted file mode 100644
index a0e2970..0000000
--- a/core/static_test_lib.mk
+++ /dev/null
@@ -1,9 +0,0 @@
-#############################################
-## A thin wrapper around BUILD_STATIC_LIBRARY
-## Common flags for native tests are added.
-#############################################
-$(call record-module-type,STATIC_TEST_LIBRARY)
-
-include $(BUILD_SYSTEM)/target_test_internal.mk
-
-include $(BUILD_STATIC_LIBRARY)
diff --git a/core/android_vts_host_config.mk b/core/suite_host_config.mk
similarity index 89%
rename from core/android_vts_host_config.mk
rename to core/suite_host_config.mk
index 38ba19d..d575c5b 100644
--- a/core/android_vts_host_config.mk
+++ b/core/suite_host_config.mk
@@ -16,11 +16,9 @@
LOCAL_MODULE_CLASS := FAKE
LOCAL_IS_HOST_MODULE := true
-LOCAL_COMPATIBILITY_SUITE := vts
include $(BUILD_SYSTEM)/base_rules.mk
$(LOCAL_BUILT_MODULE):
- @echo "VTS host-driven test target: $(PRIVATE_MODULE)"
+ @echo "$(LOCAL_COMPATIBILITY_SUITE) host-driven test target: $(PRIVATE_MODULE)"
$(hide) touch $@
-
diff --git a/core/sysprop.mk b/core/sysprop.mk
new file mode 100644
index 0000000..14fa828
--- /dev/null
+++ b/core/sysprop.mk
@@ -0,0 +1,392 @@
+#
+# Copyright (C) 2020 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.
+#
+
+# sysprop.mk defines rules for generating <partition>/build.prop files
+
+# -----------------------------------------------------------------
+# property_overrides_split_enabled
+property_overrides_split_enabled :=
+ifeq ($(BOARD_PROPERTY_OVERRIDES_SPLIT_ENABLED), true)
+ property_overrides_split_enabled := true
+endif
+
+BUILDINFO_SH := build/make/tools/buildinfo.sh
+POST_PROCESS_PROPS := $(HOST_OUT_EXECUTABLES)/post_process_props$(HOST_EXECUTABLE_SUFFIX)
+
+# Emits a set of sysprops common to all partitions to a file.
+# $(1): Partition name
+# $(2): Output file name
+define generate-common-build-props
+ echo "####################################" >> $(2);\
+ echo "# from generate-common-build-props" >> $(2);\
+ echo "# These properties identify this partition image." >> $(2);\
+ echo "####################################" >> $(2);\
+ $(if $(filter system,$(1)),\
+ echo "ro.product.$(1).brand=$(PRODUCT_SYSTEM_BRAND)" >> $(2);\
+ echo "ro.product.$(1).device=$(PRODUCT_SYSTEM_DEVICE)" >> $(2);\
+ echo "ro.product.$(1).manufacturer=$(PRODUCT_SYSTEM_MANUFACTURER)" >> $(2);\
+ echo "ro.product.$(1).model=$(PRODUCT_SYSTEM_MODEL)" >> $(2);\
+ echo "ro.product.$(1).name=$(PRODUCT_SYSTEM_NAME)" >> $(2);\
+ ,\
+ echo "ro.product.$(1).brand=$(PRODUCT_BRAND)" >> $(2);\
+ echo "ro.product.$(1).device=$(TARGET_DEVICE)" >> $(2);\
+ echo "ro.product.$(1).manufacturer=$(PRODUCT_MANUFACTURER)" >> $(2);\
+ echo "ro.product.$(1).model=$(PRODUCT_MODEL)" >> $(2);\
+ echo "ro.product.$(1).name=$(TARGET_PRODUCT)" >> $(2);\
+ )\
+ echo "ro.$(1).build.date=`$(DATE_FROM_FILE)`" >> $(2);\
+ echo "ro.$(1).build.date.utc=`$(DATE_FROM_FILE) +%s`" >> $(2);\
+ echo "ro.$(1).build.fingerprint=$(BUILD_FINGERPRINT_FROM_FILE)" >> $(2);\
+ echo "ro.$(1).build.id=$(BUILD_ID)" >> $(2);\
+ echo "ro.$(1).build.tags=$(BUILD_VERSION_TAGS)" >> $(2);\
+ echo "ro.$(1).build.type=$(TARGET_BUILD_VARIANT)" >> $(2);\
+ echo "ro.$(1).build.version.incremental=$(BUILD_NUMBER_FROM_FILE)" >> $(2);\
+ echo "ro.$(1).build.version.release=$(PLATFORM_VERSION)" >> $(2);\
+ echo "ro.$(1).build.version.sdk=$(PLATFORM_SDK_VERSION)" >> $(2);\
+
+endef
+
+# Rule for generating <partition>/build.prop file
+#
+# $(1): partition name
+# $(2): path to the output
+# $(3): path to the input *.prop files. The contents of the files are directly
+# emitted to the output
+# $(4): list of variable names each of which contains name=value pairs
+# $(5): optional list of prop names to force remove from the output. Properties from both
+# $(3) and (4) are affected.
+define build-properties
+ALL_DEFAULT_INSTALLED_MODULES += $(2)
+
+# TODO(b/117892318): eliminate the call to uniq-pairs-by-first-component when
+# it is guaranteed that there is no dup.
+$(foreach name,$(strip $(4)),\
+ $(eval _resolved_$(name) := $$(call collapse-pairs, $$(call uniq-pairs-by-first-component,$$($(name)),=)))\
+)
+
+$(2): $(POST_PROCESS_PROPS) $(INTERNAL_BUILD_ID_MAKEFILE) $(API_FINGERPRINT) $(3)
+ $(hide) echo Building $$@
+ $(hide) mkdir -p $$(dir $$@)
+ $(hide) rm -f $$@ && touch $$@
+ $(hide) $$(call generate-common-build-props,$(call to-lower,$(strip $(1))),$$@)
+ $(hide) $(foreach file,$(strip $(3)),\
+ if [ -f "$(file)" ]; then\
+ echo "" >> $$@;\
+ echo "####################################" >> $$@;\
+ echo "# from $(file)" >> $$@;\
+ echo "####################################" >> $$@;\
+ cat $(file) >> $$@;\
+ fi;)
+ $(hide) $(foreach name,$(strip $(4)),\
+ echo "" >> $$@;\
+ echo "####################################" >> $$@;\
+ echo "# from variable $(name)" >> $$@;\
+ echo "####################################" >> $$@;\
+ $$(foreach line,$$(_resolved_$(name)),\
+ echo "$$(line)" >> $$@;\
+ )\
+ )
+ $(hide) $(POST_PROCESS_PROPS) $$@ $(5)
+ $(hide) echo "# end of file" >> $$@
+endef
+
+# -----------------------------------------------------------------
+# Define fingerprint, thumbprint, and version tags for the current build
+#
+# BUILD_VERSION_TAGS is a comma-separated list of tags chosen by the device
+# implementer that further distinguishes the build. It's basically defined
+# by the device implementer. Here, we are adding a mandatory tag that
+# identifies the signing config of the build.
+BUILD_VERSION_TAGS := $(BUILD_VERSION_TAGS)
+ifeq ($(TARGET_BUILD_TYPE),debug)
+ BUILD_VERSION_TAGS += debug
+endif
+# The "test-keys" tag marks builds signed with the old test keys,
+# which are available in the SDK. "dev-keys" marks builds signed with
+# non-default dev keys (usually private keys from a vendor directory).
+# Both of these tags will be removed and replaced with "release-keys"
+# when the target-files is signed in a post-build step.
+ifeq ($(DEFAULT_SYSTEM_DEV_CERTIFICATE),build/make/target/product/security/testkey)
+BUILD_KEYS := test-keys
+else
+BUILD_KEYS := dev-keys
+endif
+BUILD_VERSION_TAGS += $(BUILD_KEYS)
+BUILD_VERSION_TAGS := $(subst $(space),$(comma),$(sort $(BUILD_VERSION_TAGS)))
+
+# BUILD_FINGERPRINT is used used to uniquely identify the combined build and
+# product; used by the OTA server.
+ifeq (,$(strip $(BUILD_FINGERPRINT)))
+ ifeq ($(strip $(HAS_BUILD_NUMBER)),false)
+ BF_BUILD_NUMBER := $(BUILD_USERNAME)$$($(DATE_FROM_FILE) +%m%d%H%M)
+ else
+ BF_BUILD_NUMBER := $(file <$(BUILD_NUMBER_FILE))
+ endif
+ BUILD_FINGERPRINT := $(PRODUCT_BRAND)/$(TARGET_PRODUCT)/$(TARGET_DEVICE):$(PLATFORM_VERSION)/$(BUILD_ID)/$(BF_BUILD_NUMBER):$(TARGET_BUILD_VARIANT)/$(BUILD_VERSION_TAGS)
+endif
+# unset it for safety.
+BF_BUILD_NUMBER :=
+
+BUILD_FINGERPRINT_FILE := $(PRODUCT_OUT)/build_fingerprint.txt
+ifneq (,$(shell mkdir -p $(PRODUCT_OUT) && echo $(BUILD_FINGERPRINT) >$(BUILD_FINGERPRINT_FILE) && grep " " $(BUILD_FINGERPRINT_FILE)))
+ $(error BUILD_FINGERPRINT cannot contain spaces: "$(file <$(BUILD_FINGERPRINT_FILE))")
+endif
+BUILD_FINGERPRINT_FROM_FILE := $$(cat $(BUILD_FINGERPRINT_FILE))
+# unset it for safety.
+BUILD_FINGERPRINT :=
+
+# BUILD_THUMBPRINT is used to uniquely identify the system build; used by the
+# OTA server. This purposefully excludes any product-specific variables.
+ifeq (,$(strip $(BUILD_THUMBPRINT)))
+ BUILD_THUMBPRINT := $(PLATFORM_VERSION)/$(BUILD_ID)/$(BUILD_NUMBER_FROM_FILE):$(TARGET_BUILD_VARIANT)/$(BUILD_VERSION_TAGS)
+endif
+
+BUILD_THUMBPRINT_FILE := $(PRODUCT_OUT)/build_thumbprint.txt
+ifneq (,$(shell mkdir -p $(PRODUCT_OUT) && echo $(BUILD_THUMBPRINT) >$(BUILD_THUMBPRINT_FILE) && grep " " $(BUILD_THUMBPRINT_FILE)))
+ $(error BUILD_THUMBPRINT cannot contain spaces: "$(file <$(BUILD_THUMBPRINT_FILE))")
+endif
+BUILD_THUMBPRINT_FROM_FILE := $$(cat $(BUILD_THUMBPRINT_FILE))
+# unset it for safety.
+BUILD_THUMBPRINT :=
+
+# -----------------------------------------------------------------
+# Define human readable strings that describe this build
+#
+
+# BUILD_ID: detail info; has the same info as the build fingerprint
+BUILD_DESC := $(TARGET_PRODUCT)-$(TARGET_BUILD_VARIANT) $(PLATFORM_VERSION) $(BUILD_ID) $(BUILD_NUMBER_FROM_FILE) $(BUILD_VERSION_TAGS)
+
+# BUILD_DISPLAY_ID is shown under Settings -> About Phone
+ifeq ($(TARGET_BUILD_VARIANT),user)
+ # User builds should show:
+ # release build number or branch.buld_number non-release builds
+
+ # Dev. branches should have DISPLAY_BUILD_NUMBER set
+ ifeq (true,$(DISPLAY_BUILD_NUMBER))
+ BUILD_DISPLAY_ID := $(BUILD_ID).$(BUILD_NUMBER_FROM_FILE) $(BUILD_KEYS)
+ else
+ BUILD_DISPLAY_ID := $(BUILD_ID) $(BUILD_KEYS)
+ endif
+else
+ # Non-user builds should show detailed build information
+ BUILD_DISPLAY_ID := $(BUILD_DESC)
+endif
+
+# TARGET_BUILD_FLAVOR and ro.build.flavor are used only by the test
+# harness to distinguish builds. Only add _asan for a sanitized build
+# if it isn't already a part of the flavor (via a dedicated lunch
+# config for example).
+TARGET_BUILD_FLAVOR := $(TARGET_PRODUCT)-$(TARGET_BUILD_VARIANT)
+ifneq (, $(filter address, $(SANITIZE_TARGET)))
+ifeq (,$(findstring _asan,$(TARGET_BUILD_FLAVOR)))
+TARGET_BUILD_FLAVOR := $(TARGET_BUILD_FLAVOR)_asan
+endif
+endif
+
+KNOWN_OEM_THUMBPRINT_PROPERTIES := \
+ ro.product.brand \
+ ro.product.name \
+ ro.product.device
+OEM_THUMBPRINT_PROPERTIES := $(filter $(KNOWN_OEM_THUMBPRINT_PROPERTIES),\
+ $(PRODUCT_OEM_PROPERTIES))
+KNOWN_OEM_THUMBPRINT_PROPERTIES:=
+
+# -----------------------------------------------------------------
+# system/build.prop
+#
+# Note: parts of this file that can't be generated by the build-properties
+# macro are manually created as separate files and then fed into the macro
+
+# Accepts a whitespace separated list of product locales such as
+# (en_US en_AU en_GB...) and returns the first locale in the list with
+# underscores replaced with hyphens. In the example above, this will
+# return "en-US".
+define get-default-product-locale
+$(strip $(subst _,-, $(firstword $(1))))
+endef
+
+gen_from_buildinfo_sh := $(call intermediates-dir-for,ETC,system_build_prop)/buildinfo.prop
+$(gen_from_buildinfo_sh): $(INTERNAL_BUILD_ID_MAKEFILE) $(API_FINGERPRINT)
+ $(hide) TARGET_BUILD_TYPE="$(TARGET_BUILD_VARIANT)" \
+ TARGET_BUILD_FLAVOR="$(TARGET_BUILD_FLAVOR)" \
+ TARGET_DEVICE="$(TARGET_DEVICE)" \
+ PRODUCT_DEFAULT_LOCALE="$(call get-default-product-locale,$(PRODUCT_LOCALES))" \
+ PRODUCT_DEFAULT_WIFI_CHANNELS="$(PRODUCT_DEFAULT_WIFI_CHANNELS)" \
+ PRIVATE_BUILD_DESC="$(BUILD_DESC)" \
+ BUILD_ID="$(BUILD_ID)" \
+ BUILD_DISPLAY_ID="$(BUILD_DISPLAY_ID)" \
+ DATE="$(DATE_FROM_FILE)" \
+ BUILD_USERNAME="$(BUILD_USERNAME)" \
+ BUILD_HOSTNAME="$(BUILD_HOSTNAME)" \
+ BUILD_NUMBER="$(BUILD_NUMBER_FROM_FILE)" \
+ BOARD_BUILD_SYSTEM_ROOT_IMAGE="$(BOARD_BUILD_SYSTEM_ROOT_IMAGE)" \
+ PLATFORM_VERSION="$(PLATFORM_VERSION)" \
+ PLATFORM_VERSION_LAST_STABLE="$(PLATFORM_VERSION_LAST_STABLE)" \
+ PLATFORM_SECURITY_PATCH="$(PLATFORM_SECURITY_PATCH)" \
+ PLATFORM_BASE_OS="$(PLATFORM_BASE_OS)" \
+ PLATFORM_SDK_VERSION="$(PLATFORM_SDK_VERSION)" \
+ PLATFORM_PREVIEW_SDK_VERSION="$(PLATFORM_PREVIEW_SDK_VERSION)" \
+ PLATFORM_PREVIEW_SDK_FINGERPRINT="$$(cat $(API_FINGERPRINT))" \
+ PLATFORM_VERSION_CODENAME="$(PLATFORM_VERSION_CODENAME)" \
+ PLATFORM_VERSION_ALL_CODENAMES="$(PLATFORM_VERSION_ALL_CODENAMES)" \
+ PLATFORM_MIN_SUPPORTED_TARGET_SDK_VERSION="$(PLATFORM_MIN_SUPPORTED_TARGET_SDK_VERSION)" \
+ BUILD_VERSION_TAGS="$(BUILD_VERSION_TAGS)" \
+ $(if $(OEM_THUMBPRINT_PROPERTIES),BUILD_THUMBPRINT="$(BUILD_THUMBPRINT_FROM_FILE)") \
+ TARGET_CPU_ABI_LIST="$(TARGET_CPU_ABI_LIST)" \
+ TARGET_CPU_ABI_LIST_32_BIT="$(TARGET_CPU_ABI_LIST_32_BIT)" \
+ TARGET_CPU_ABI_LIST_64_BIT="$(TARGET_CPU_ABI_LIST_64_BIT)" \
+ TARGET_CPU_ABI="$(TARGET_CPU_ABI)" \
+ TARGET_CPU_ABI2="$(TARGET_CPU_ABI2)" \
+ bash $(BUILDINFO_SH) > $@
+
+ifneq ($(PRODUCT_OEM_PROPERTIES),)
+import_oem_prop := $(call intermediates-dir-for,ETC,system_build_prop)/oem.prop
+
+$(import_oem_prop):
+ $(hide) echo "#" >> $@; \
+ echo "# PRODUCT_OEM_PROPERTIES" >> $@; \
+ echo "#" >> $@;
+ $(hide) $(foreach prop,$(PRODUCT_OEM_PROPERTIES), \
+ echo "import /oem/oem.prop $(prop)" >> $@;)
+else
+import_oem_prop :=
+endif
+
+ifdef TARGET_SYSTEM_PROP
+system_prop_file := $(TARGET_SYSTEM_PROP)
+else
+system_prop_file := $(wildcard $(TARGET_DEVICE_DIR)/system.prop)
+endif
+
+_prop_files_ := \
+ $(import_oem_prop) \
+ $(gen_from_buildinfo_sh) \
+ $(system_prop_file)
+
+# Order matters here. When there are duplicates, the last one wins.
+# TODO(b/117892318): don't allow duplicates so that the ordering doesn't matter
+_prop_vars_ := \
+ ADDITIONAL_SYSTEM_PROPERTIES \
+ PRODUCT_SYSTEM_DEFAULT_PROPERTIES
+
+ifndef property_overrides_split_enabled
+_prop_vars_ += \
+ ADDITIONAL_VENDOR_PROPERTIES
+endif
+
+_blacklist_names_ := \
+ $(PRODUCT_SYSTEM_PROPERTY_BLACKLIST) \
+ ro.product.first_api_level
+
+INSTALLED_BUILD_PROP_TARGET := $(TARGET_OUT)/build.prop
+
+$(eval $(call build-properties,system,$(INSTALLED_BUILD_PROP_TARGET),\
+$(_prop_files_),$(_prop_vars_),\
+$(_blacklist_names_)))
+
+
+# -----------------------------------------------------------------
+# vendor/build.prop
+#
+_prop_files_ := $(if $(TARGET_VENDOR_PROP),\
+ $(TARGET_VENDOR_PROP),\
+ $(wildcard $(TARGET_DEVICE_DIR)/vendor.prop))
+
+android_info_prop := $(call intermediates-dir-for,ETC,android_info_prop)/android_info.prop
+$(android_info_prop): $(INSTALLED_ANDROID_INFO_TXT_TARGET)
+ cat $< | grep 'require version-' | sed -e 's/require version-/ro.build.expect./g' > $@
+
+_prop_files_ += $(android_info_pro)
+
+ifdef property_overrides_split_enabled
+# Order matters here. When there are duplicates, the last one wins.
+# TODO(b/117892318): don't allow duplicates so that the ordering doesn't matter
+_prop_vars_ := \
+ ADDITIONAL_VENDOR_PROPERTIES \
+ PRODUCT_PROPERTY_OVERRIDES
+else
+_prop_vars_ :=
+endif
+
+INSTALLED_VENDOR_BUILD_PROP_TARGET := $(TARGET_OUT_VENDOR)/build.prop
+$(eval $(call build-properties,\
+ vendor,\
+ $(INSTALLED_VENDOR_BUILD_PROP_TARGET),\
+ $(_prop_files_),\
+ $(_prop_vars_),\
+ $(PRODUCT_VENDOR_PROPERTY_BLACKLIST)))
+
+# -----------------------------------------------------------------
+# product/build.prop
+#
+
+_prop_files_ := $(if $(TARGET_PRODUCT_PROP),\
+ $(TARGET_PRODUCT_PROP),\
+ $(wildcard $(TARGET_DEVICE_DIR)/product.prop))
+
+# Order matters here. When there are duplicates, the last one wins.
+# TODO(b/117892318): don't allow duplicates so that the ordering doesn't matter
+_prop_vars_ := \
+ ADDITIONAL_PRODUCT_PROPERTIES \
+ PRODUCT_PRODUCT_PROPERTIES
+
+INSTALLED_PRODUCT_BUILD_PROP_TARGET := $(TARGET_OUT_PRODUCT)/build.prop
+$(eval $(call build-properties,\
+ product,\
+ $(INSTALLED_PRODUCT_BUILD_PROP_TARGET),\
+ $(_prop_files_),\
+ $(_prop_vars_),\
+ $(empty)))
+
+# ----------------------------------------------------------------
+# odm/build.prop
+#
+_prop_files_ := $(if $(TARGET_ODM_PROP),\
+ $(TARGET_ODM_PROP),\
+ $(wildcard $(TARGET_DEVICE_DIR)/odm.prop))
+
+# Order matters here. When there are duplicates, the last one wins.
+# TODO(b/117892318): don't allow duplicates so that the ordering doesn't matter
+_prop_vars_ := \
+ ADDITIONAL_ODM_PROPERTIES \
+ PRODUCT_ODM_PROPERTIES
+
+INSTALLED_ODM_BUILD_PROP_TARGET := $(TARGET_OUT_ODM)/build.prop
+$(eval $(call build-properties,\
+ odm,\
+ $(INSTALLED_ODM_BUILD_PROP_TARGET),\
+ $(_prop_files),\
+ $(_prop_vars_),\
+ $(empty)))
+
+# -----------------------------------------------------------------
+# system_ext/build.prop
+#
+_prop_files_ := $(if $(TARGET_SYSTEM_EXT_PROP),\
+ $(TARGET_SYSTEM_EXT_PROP),\
+ $(wildcard $(TARGET_DEVICE_DIR)/system_ext.prop))
+
+# Order matters here. When there are duplicates, the last one wins.
+# TODO(b/117892318): don't allow duplicates so that the ordering doesn't matter
+_prop_vars_ := PRODUCT_SYSTEM_EXT_PROPERTIES
+
+INSTALLED_SYSTEM_EXT_BUILD_PROP_TARGET := $(TARGET_OUT_SYSTEM_EXT)/build.prop
+$(eval $(call build-properties,\
+ system_ext,\
+ $(INSTALLED_SYSTEM_EXT_BUILD_PROP_TARGET),\
+ $(_prop_files_),\
+ $(_prop_vars_),\
+ $(empty)))
diff --git a/core/tasks/boot_jars_package_check.mk b/core/tasks/boot_jars_package_check.mk
index dc79e23..02d7212 100644
--- a/core/tasks/boot_jars_package_check.mk
+++ b/core/tasks/boot_jars_package_check.mk
@@ -22,8 +22,27 @@
intermediates := $(call intermediates-dir-for, PACKAGING, boot-jars-package-check,,COMMON)
stamp := $(intermediates)/stamp
-built_boot_jars := $(foreach j, $(PRODUCT_BOOT_JARS), \
+
+# Convert the colon-separated components <apex>:<jar> to <jar>.<apex> names
+# (e.g. com.android.media:updatable-media -> updatable-media.com.android.media).
+# Special cases:
+# - for the "platform" or "system_ext" apex drop the .<apex> suffix
+# - for the ART apex select release variant
+boot_jars := $(foreach pair,$(PRODUCT_BOOT_JARS) $(PRODUCT_UPDATABLE_BOOT_JARS), \
+ $(eval apex := $(call word-colon,1,$(pair))) \
+ $(eval jar := $(call word-colon,2,$(pair))) \
+ $(eval q := :) \
+ $(eval sfx := $(q).$(apex)$(q)) \
+ $(eval sfx := $(subst $(q).platform$(q),$(q)$(q),$(sfx))) \
+ $(eval sfx := $(subst $(q).system_ext$(q),$(q)$(q),$(sfx))) \
+ $(eval sfx := $(subst $(q).com.android.art$(q),$(q).com.android.art.release$(q),$(sfx))) \
+ $(eval sfx := $(patsubst $(q)%$(q),%,$(sfx))) \
+ $(jar)$(sfx))
+
+# Convert boot jar names to build paths.
+built_boot_jars := $(foreach j, $(boot_jars), \
$(call intermediates-dir-for, JAVA_LIBRARIES, $(j),,COMMON)/classes.jar)
+
script := build/make/core/tasks/check_boot_jars/check_boot_jars.py
whitelist_file := build/make/core/tasks/check_boot_jars/package_whitelist.txt
diff --git a/core/tasks/check_boot_jars/check_boot_jars.py b/core/tasks/check_boot_jars/check_boot_jars.py
index 9d71553..67b73d5 100755
--- a/core/tasks/check_boot_jars/check_boot_jars.py
+++ b/core/tasks/check_boot_jars/check_boot_jars.py
@@ -53,10 +53,9 @@
if f.endswith('.class'):
package_name = os.path.dirname(f)
package_name = package_name.replace('/', '.')
- # Skip class without a package name
- if package_name and not whitelist_re.match(package_name):
- print >> sys.stderr, ('Error: %s contains class file %s, whose package name %s is not '
- 'in the whitelist %s of packages allowed on the bootclasspath.'
+ if not package_name or not whitelist_re.match(package_name):
+ print >> sys.stderr, ('Error: %s contains class file %s, whose package name %s is empty or'
+ ' not in the whitelist %s of packages allowed on the bootclasspath.'
% (jar, f, package_name, whitelist_path))
return False
return True
diff --git a/core/tasks/check_boot_jars/package_whitelist.txt b/core/tasks/check_boot_jars/package_whitelist.txt
index 8d9878f..d4f600a 100644
--- a/core/tasks/check_boot_jars/package_whitelist.txt
+++ b/core/tasks/check_boot_jars/package_whitelist.txt
@@ -69,6 +69,8 @@
javax\.xml\.transform\.stream
javax\.xml\.validation
javax\.xml\.xpath
+jdk\.internal\.util
+jdk\.internal\.vm\.annotation
jdk\.net
org\.w3c\.dom
org\.w3c\.dom\.ls
diff --git a/core/tasks/collect_gpl_sources.mk b/core/tasks/collect_gpl_sources.mk
index acbe9be..ebc4181 100644
--- a/core/tasks/collect_gpl_sources.mk
+++ b/core/tasks/collect_gpl_sources.mk
@@ -17,6 +17,8 @@
# in installclean between incremental builds on build servers.
gpl_source_tgz := $(call intermediates-dir-for,PACKAGING,gpl_source)/gpl_source.tgz
+ALL_GPL_MODULE_LICENSE_FILES := $(sort $(ALL_GPL_MODULE_LICENSE_FILES))
+
# FORCE since we can't know whether any of the sources changed
$(gpl_source_tgz): PRIVATE_PATHS := $(sort $(patsubst %/, %, $(dir $(ALL_GPL_MODULE_LICENSE_FILES))))
$(gpl_source_tgz) : $(ALL_GPL_MODULE_LICENSE_FILES)
diff --git a/core/tasks/deps_licenses.mk b/core/tasks/deps_licenses.mk
deleted file mode 100644
index daf986f..0000000
--- a/core/tasks/deps_licenses.mk
+++ /dev/null
@@ -1,59 +0,0 @@
-#
-# Copyright (C) 2015 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.
-#
-
-# Print modules and their transitive dependencies with license files.
-# To invoke, run "make deps-license PROJ_PATH=<proj-path-patterns> DEP_PATH=<dep-path-patterns>".
-# PROJ_PATH restricts the paths of the source modules; DEP_PATH restricts the paths of the dependency modules.
-# Both can be makefile patterns supported by makefile function $(filter).
-# Example: "make deps-license packages/app/% external/%" prints all modules in packages/app/ with their dpendencies in external/.
-# The printout lines look like "<module_name> :: <module_paths> :: <license_files>".
-
-ifneq (,$(filter deps-license,$(MAKECMDGOALS)))
-ifndef PROJ_PATH
-$(error To "make deps-license" you must specify PROJ_PATH and DEP_PATH.)
-endif
-ifndef DEP_PATH
-$(error To "make deps-license" you must specify PROJ_PATH and DEP_PATH.)
-endif
-
-# Expand a module's dependencies transitively.
-# $(1): the variable name to hold the result.
-# $(2): the initial module name.
-define get-module-all-dependencies
-$(eval _gmad_new := $(sort $(filter-out $($(1)),\
- $(foreach m,$(2),$(ALL_DEPS.$(m).ALL_DEPS)))))\
-$(if $(_gmad_new),$(eval $(1) += $(_gmad_new))\
- $(call get-module-all-dependencies,$(1),$(_gmad_new)))
-endef
-
-define print-deps-license
-$(foreach m, $(sort $(ALL_DEPS.MODULES)),\
- $(eval m_p := $(sort $(ALL_MODULES.$(m).PATH) $(ALL_MODULES.$(m)$(TARGET_2ND_ARCH_MODULE_SUFFIX).PATH)))\
- $(if $(filter $(PROJ_PATH),$(m_p)),\
- $(eval deps :=)\
- $(eval $(call get-module-all-dependencies,deps,$(m)))\
- $(info $(m) :: $(m_p) :: $(ALL_DEPS.$(m).LICENSE))\
- $(foreach d,$(deps),\
- $(eval d_p := $(sort $(ALL_MODULES.$(d).PATH) $(ALL_MODULES.$(d)$(TARGET_2ND_ARCH_MODULE_SUFFIX).PATH)))\
- $(if $(filter $(DEP_PATH),$(d_p)),\
- $(info $(space)$(space)$(space)$(space)$(d) :: $(d_p) :: $(ALL_DEPS.$(d).LICENSE))))))
-endef
-
-.PHONY: deps-license
-deps-license:
- @$(call print-deps-license)
-
-endif
diff --git a/core/tasks/device-tests.mk b/core/tasks/device-tests.mk
index f071c7c..73fad7c 100644
--- a/core/tasks/device-tests.mk
+++ b/core/tasks/device-tests.mk
@@ -21,30 +21,38 @@
# Create an artifact to include all test config files in device-tests.
device-tests-configs-zip := $(PRODUCT_OUT)/device-tests_configs.zip
my_host_shared_lib_for_device_tests := $(call copy-many-files,$(COMPATIBILITY.device-tests.HOST_SHARED_LIBRARY.FILES))
-$(device-tests-zip) : .KATI_IMPLICIT_OUTPUTS := $(device-tests-list-zip) $(device-tests-configs-zip)
+device_tests_host_shared_libs_zip := $(PRODUCT_OUT)/device-tests_host-shared-libs.zip
+
+$(device-tests-zip) : .KATI_IMPLICIT_OUTPUTS := $(device-tests-list-zip) $(device-tests-configs-zip) $(device_tests_host_shared_libs_zip)
$(device-tests-zip) : PRIVATE_device_tests_list := $(PRODUCT_OUT)/device-tests_list
$(device-tests-zip) : PRIVATE_HOST_SHARED_LIBS := $(my_host_shared_lib_for_device_tests)
+$(device-tests-zip) : PRIVATE_device_host_shared_libs_zip := $(device_tests_host_shared_libs_zip)
$(device-tests-zip) : $(COMPATIBILITY.device-tests.FILES) $(my_host_shared_lib_for_device_tests) $(SOONG_ZIP)
+ rm -f $@-shared-libs.list
echo $(sort $(COMPATIBILITY.device-tests.FILES)) | tr " " "\n" > $@.list
grep $(HOST_OUT_TESTCASES) $@.list > $@-host.list || true
grep -e .*\\.config$$ $@-host.list > $@-host-test-configs.list || true
$(hide) for shared_lib in $(PRIVATE_HOST_SHARED_LIBS); do \
echo $$shared_lib >> $@-host.list; \
+ echo $$shared_lib >> $@-shared-libs.list; \
done
+ grep $(HOST_OUT_TESTCASES) $@-shared-libs.list > $@-host-shared-libs.list || true
grep $(TARGET_OUT_TESTCASES) $@.list > $@-target.list || true
grep -e .*\\.config$$ $@-target.list > $@-target-test-configs.list || true
$(hide) $(SOONG_ZIP) -d -o $@ -P host -C $(HOST_OUT) -l $@-host.list -P target -C $(PRODUCT_OUT) -l $@-target.list
$(hide) $(SOONG_ZIP) -d -o $(device-tests-configs-zip) \
-P host -C $(HOST_OUT) -l $@-host-test-configs.list \
-P target -C $(PRODUCT_OUT) -l $@-target-test-configs.list
+ $(SOONG_ZIP) -d -o $(PRIVATE_device_host_shared_libs_zip) \
+ -P host -C $(HOST_OUT) -l $@-host-shared-libs.list
rm -f $(PRIVATE_device_tests_list)
$(hide) grep -e .*\\.config$$ $@-host.list | sed s%$(HOST_OUT)%host%g > $(PRIVATE_device_tests_list)
$(hide) grep -e .*\\.config$$ $@-target.list | sed s%$(PRODUCT_OUT)%target%g >> $(PRIVATE_device_tests_list)
$(hide) $(SOONG_ZIP) -d -o $(device-tests-list-zip) -C $(dir $@) -f $(PRIVATE_device_tests_list)
rm -f $@.list $@-host.list $@-target.list $@-host-test-configs.list $@-target-test-configs.list \
- $(PRIVATE_device_tests_list)
+ $@-shared-libs.list $@-host-shared-libs.list $(PRIVATE_device_tests_list)
device-tests: $(device-tests-zip)
-$(call dist-for-goals, device-tests, $(device-tests-zip) $(device-tests-list-zip) $(device-tests-configs-zip))
+$(call dist-for-goals, device-tests, $(device-tests-zip) $(device-tests-list-zip) $(device-tests-configs-zip) $(device_tests_host_shared_libs_zip))
tests: device-tests
diff --git a/core/tasks/general-tests.mk b/core/tasks/general-tests.mk
index 9ea4e62..cb84a5c 100644
--- a/core/tasks/general-tests.mk
+++ b/core/tasks/general-tests.mk
@@ -14,9 +14,12 @@
.PHONY: general-tests
+# TODO(b/149249068): Remove vts10-tradefed.jar after all VTS tests are converted
general_tests_tools := \
$(HOST_OUT_JAVA_LIBRARIES)/cts-tradefed.jar \
$(HOST_OUT_JAVA_LIBRARIES)/compatibility-host-util.jar \
+ $(HOST_OUT_JAVA_LIBRARIES)/vts-tradefed.jar \
+ $(HOST_OUT_JAVA_LIBRARIES)/vts10-tradefed.jar
intermediates_dir := $(call intermediates-dir-for,PACKAGING,general-tests)
general_tests_zip := $(PRODUCT_OUT)/general-tests.zip
diff --git a/core/tasks/mts.mk b/core/tasks/mts.mk
index 56b2390..e800505 100644
--- a/core/tasks/mts.mk
+++ b/core/tasks/mts.mk
@@ -12,6 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
+ifneq ($(wildcard test/mts/README.md),)
test_suite_name := mts
test_suite_tradefed := mts-tradefed
test_suite_readme := test/mts/README.md
@@ -21,3 +22,4 @@
.PHONY: mts
mts: $(compatibility_zip)
$(call dist-for-goals, mts, $(compatibility_zip))
+endif
diff --git a/core/tasks/platform_availability_check.mk b/core/tasks/platform_availability_check.mk
new file mode 100644
index 0000000..043d130
--- /dev/null
+++ b/core/tasks/platform_availability_check.mk
@@ -0,0 +1,36 @@
+#
+# Copyright (C) 2020 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.
+#
+
+# Check whether there is any module that isn't available for platform
+# is installed to the platform.
+
+# Filter FAKE and NON_INSTALLABLE modules out and then collect those are not
+# available for platform
+_modules_not_available_for_platform := \
+$(strip $(foreach m,$(product_MODULES),\
+ $(if $(filter-out FAKE,$(ALL_MODULES.$(m).CLASS)),\
+ $(if $(ALL_MODULES.$(m).INSTALLED),\
+ $(if $(filter true,$(ALL_MODULES.$(m).NOT_AVAILABLE_FOR_PLATFORM)),\
+ $(m))))))
+
+_violators_with_path := $(foreach m,$(sort $(_modules_not_available_for_platform)),\
+ $(m):$(word 1,$(ALL_MODULES.$(m).PATH))\
+)
+
+$(call maybe-print-list-and-error,$(_violators_with_path),\
+Following modules are requested to be installed. But are not available \
+for platform because they do not have "//apex_available:platform" or \
+they depend on other modules that are not available for platform)
diff --git a/core/tasks/sdk-addon.mk b/core/tasks/sdk-addon.mk
index 7f777a5..5097f12 100644
--- a/core/tasks/sdk-addon.mk
+++ b/core/tasks/sdk-addon.mk
@@ -66,7 +66,7 @@
files_to_copy += \
$(addon_dir_img):$(INSTALLED_QEMU_SYSTEMIMAGE):images/$(TARGET_CPU_ABI)/system.img \
$(addon_dir_img):$(INSTALLED_QEMU_VENDORIMAGE):images/$(TARGET_CPU_ABI)/vendor.img \
- $(addon_dir_img):$(BUILT_RAMDISK_TARGET):images/$(TARGET_CPU_ABI)/ramdisk.img \
+ $(addon_dir_img):$(INSTALLED_QEMU_RAMDISKIMAGE):images/$(TARGET_CPU_ABI)/ramdisk.img \
$(addon_dir_img):$(PRODUCT_OUT)/system/build.prop:images/$(TARGET_CPU_ABI)/build.prop \
$(addon_dir_img):device/generic/goldfish/data/etc/userdata.img:images/$(TARGET_CPU_ABI)/userdata.img \
$(addon_dir_img):$(target_notice_file_txt):images/$(TARGET_CPU_ABI)/NOTICE.txt \
diff --git a/core/tasks/tools/compatibility.mk b/core/tasks/tools/compatibility.mk
index b6dd39e..89b0b9b 100644
--- a/core/tasks/tools/compatibility.mk
+++ b/core/tasks/tools/compatibility.mk
@@ -30,6 +30,7 @@
test_artifacts := $(COMPATIBILITY.$(test_suite_name).FILES)
test_tools := $(HOST_OUT_JAVA_LIBRARIES)/hosttestlib.jar \
$(HOST_OUT_JAVA_LIBRARIES)/tradefed.jar \
+ $(HOST_OUT_JAVA_LIBRARIES)/tradefed-test-framework.jar \
$(HOST_OUT_JAVA_LIBRARIES)/loganalysis.jar \
$(HOST_OUT_JAVA_LIBRARIES)/compatibility-host-util.jar \
$(HOST_OUT_JAVA_LIBRARIES)/compatibility-host-util-tests.jar \
@@ -42,13 +43,16 @@
test_tools += $(test_suite_tools)
+# Include host shared libraries
+host_shared_libs := $(call copy-many-files, $(COMPATIBILITY.$(test_suite_name).HOST_SHARED_LIBRARY.FILES))
+
compatibility_zip := $(out_dir).zip
$(compatibility_zip): PRIVATE_NAME := android-$(test_suite_name)
$(compatibility_zip): PRIVATE_OUT_DIR := $(out_dir)
$(compatibility_zip): PRIVATE_TOOLS := $(test_tools) $(test_suite_prebuilt_tools)
$(compatibility_zip): PRIVATE_SUITE_NAME := $(test_suite_name)
$(compatibility_zip): PRIVATE_DYNAMIC_CONFIG := $(test_suite_dynamic_config)
-$(compatibility_zip): $(test_artifacts) $(test_tools) $(test_suite_prebuilt_tools) $(test_suite_dynamic_config) $(SOONG_ZIP) | $(ADB) $(ACP)
+$(compatibility_zip): $(test_artifacts) $(test_tools) $(test_suite_prebuilt_tools) $(test_suite_dynamic_config) $(SOONG_ZIP) $(host_shared_libs) | $(ADB) $(ACP)
# Make dir structure
$(hide) mkdir -p $(PRIVATE_OUT_DIR)/tools $(PRIVATE_OUT_DIR)/testcases
$(hide) echo $(BUILD_NUMBER_FROM_FILE) > $(PRIVATE_OUT_DIR)/tools/version.txt
@@ -65,3 +69,4 @@
test_suite_readme :=
test_suite_prebuilt_tools :=
test_suite_tools :=
+host_shared_libs :=
diff --git a/core/tasks/tools/package-modules.mk b/core/tasks/tools/package-modules.mk
index d7b3010..6cafa4a 100644
--- a/core/tasks/tools/package-modules.mk
+++ b/core/tasks/tools/package-modules.mk
@@ -5,16 +5,31 @@
# my_modules: a list of module names
# my_package_name: the name of the output zip file.
# my_copy_pairs: a list of extra files to install (in src:dest format)
+# Optional input variables:
+# my_modules_strict: what happens when a module from my_modules does not exist
+# "true": error out when a module is missing
+# "false": print a warning when a module is missing
+# "": defaults to false currently
# Output variables:
# my_package_zip: the path to the output zip file.
#
#
my_makefile := $(lastword $(filter-out $(lastword $(MAKEFILE_LIST)),$(MAKEFILE_LIST)))
-my_staging_dir := $(call intermediates-dir-for,PACKAGING,$(my_package_name))
+
+include $(CLEAR_VARS)
+LOCAL_MODULE := $(my_package_name)
+LOCAL_MODULE_CLASS := PACKAGING
+LOCAL_MODULE_STEM := $(my_package_name).zip
+LOCAL_UNINSTALLABLE_MODULE := true
+include $(BUILD_SYSTEM)/base_rules.mk
+my_staging_dir := $(intermediates)
+my_package_zip := $(LOCAL_BUILT_MODULE)
+
my_built_modules := $(foreach p,$(my_copy_pairs),$(call word-colon,1,$(p)))
my_copy_pairs := $(foreach p,$(my_copy_pairs),$(call word-colon,1,$(p)):$(my_staging_dir)/$(call word-colon,2,$(p)))
my_pickup_files :=
+my_missing_error :=
# Iterate over the modules and include their direct dependencies stated in the
# LOCAL_REQUIRED_MODULES.
@@ -26,10 +41,17 @@
$(eval my_modules_and_deps += $(_explicitly_required))\
)
-# Ignore unknown installed files on partial builds
-my_missing_files :=
-ifneq ($(ALLOW_MISSING_DEPENDENCIES),true)
+ifneq ($(filter-out true false,$(my_modules_strict)),)
+ $(shell $(call echo-error,$(my_makefile),$(my_package_name): Invalid value for 'my_module_strict' = '$(my_modules_strict)'. Valid values: 'true', 'false', ''))
+ $(error done)
+endif
+
my_missing_files = $(shell $(call echo-warning,$(my_makefile),$(my_package_name): Unknown installed file for module '$(1)'))
+ifeq ($(ALLOW_MISSING_DEPENDENCIES),true)
+ # Ignore unknown installed files on partial builds
+ my_missing_files =
+else ifeq ($(my_modules_strict),true)
+ my_missing_files = $(shell $(call echo-error,$(my_makefile),$(my_package_name): Unknown installed file for module '$(1)'))$(eval my_missing_error := true)
endif
# Iterate over modules' built files and installed files;
@@ -63,7 +85,10 @@
$(eval my_copy_pairs += $(bui):$(my_staging_dir)/$(my_copy_dest)))\
))
-my_package_zip := $(my_staging_dir)/$(my_package_name).zip
+ifneq ($(my_missing_error),)
+ $(error done)
+endif
+
$(my_package_zip): PRIVATE_COPY_PAIRS := $(my_copy_pairs)
$(my_package_zip): PRIVATE_PICKUP_FILES := $(my_pickup_files)
$(my_package_zip) : $(my_built_modules)
@@ -84,4 +109,6 @@
my_copy_pairs :=
my_pickup_files :=
my_missing_files :=
+my_missing_error :=
my_modules_and_deps :=
+my_modules_strict :=
diff --git a/core/tasks/vendor_snapshot.mk b/core/tasks/vendor_snapshot.mk
new file mode 100644
index 0000000..8234e3f
--- /dev/null
+++ b/core/tasks/vendor_snapshot.mk
@@ -0,0 +1,34 @@
+# Copyright (C) 2020 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.
+
+current_makefile := $(lastword $(MAKEFILE_LIST))
+
+# BOARD_VNDK_VERSION must be set to 'current' in order to generate a vendor snapshot.
+ifeq ($(BOARD_VNDK_VERSION),current)
+
+.PHONY: vendor-snapshot
+vendor-snapshot: $(SOONG_VENDOR_SNAPSHOT_ZIP)
+
+$(call dist-for-goals, vendor-snapshot, $(SOONG_VENDOR_SNAPSHOT_ZIP))
+
+else # BOARD_VNDK_VERSION is NOT set to 'current'
+
+.PHONY: vendor-snapshot
+vendor-snapshot: PRIVATE_MAKEFILE := $(current_makefile)
+vendor-snapshot:
+ $(call echo-error,$(PRIVATE_MAKEFILE),\
+ "CANNOT generate Vendor snapshot. BOARD_VNDK_VERSION must be set to 'current'.")
+ exit 1
+
+endif # BOARD_VNDK_VERSION
diff --git a/core/tasks/vndk.mk b/core/tasks/vndk.mk
index 3c4d942..a2973b4 100644
--- a/core/tasks/vndk.mk
+++ b/core/tasks/vndk.mk
@@ -23,88 +23,10 @@
# BOARD_VNDK_RUNTIME_DISABLE must not be set to 'true'.
ifneq ($(BOARD_VNDK_RUNTIME_DISABLE),true)
-# Returns list of src:dest paths of the intermediate objs
-#
-# Args:
-# $(1): list of module and filename pairs (e.g., ld.config.txt:ld.config.27.txt ...)
-define paths-of-intermediates
-$(strip \
- $(foreach pair,$(1), \
- $(eval module := $(call word-colon,1,$(pair))) \
- $(eval built := $(ALL_MODULES.$(module).BUILT_INSTALLED)) \
- $(eval filename := $(call word-colon,2,$(pair))) \
- $(if $(wordlist 2,100,$(built)), \
- $(error Unable to handle multiple built files ($(module)): $(built))) \
- $(if $(built),$(call word-colon,1,$(built)):$(filename)) \
- ) \
-)
-endef
-
-vndk_prebuilt_txts := \
- ld.config.txt \
- vndksp.libraries.txt \
- llndk.libraries.txt
-
-vndk_snapshot_top := $(call intermediates-dir-for,PACKAGING,vndk-snapshot)
-vndk_snapshot_out := $(vndk_snapshot_top)/vndk-snapshot
-vndk_snapshot_soong_dir := $(call intermediates-dir-for,PACKAGING,vndk-snapshot-soong)
-
-#######################################
-# vndk_snapshot_zip
-vndk_snapshot_variant := $(vndk_snapshot_out)/$(TARGET_ARCH)
-vndk_snapshot_zip := $(PRODUCT_OUT)/android-vndk-$(TARGET_PRODUCT).zip
-
-$(vndk_snapshot_zip): PRIVATE_VNDK_SNAPSHOT_OUT := $(vndk_snapshot_out)
-
-deps := $(call paths-of-intermediates,$(foreach txt,$(vndk_prebuilt_txts), \
- $(txt):$(patsubst %.txt,%.$(PLATFORM_VNDK_VERSION).txt,$(txt))))
-$(vndk_snapshot_zip): PRIVATE_CONFIGS_OUT := $(vndk_snapshot_variant)/configs
-$(vndk_snapshot_zip): PRIVATE_CONFIGS_INTERMEDIATES := $(deps)
-$(vndk_snapshot_zip): $(foreach d,$(deps),$(call word-colon,1,$(d)))
-deps :=
-
-vndk_snapshot_soong_files := $(call copy-many-files, $(SOONG_VNDK_SNAPSHOT_FILES), $(vndk_snapshot_soong_dir))
-
-$(vndk_snapshot_zip): PRIVATE_VNDK_SNAPSHOT_SOONG_DIR := $(vndk_snapshot_soong_dir)
-$(vndk_snapshot_zip): PRIVATE_VNDK_SNAPSHOT_SOONG_FILES := $(sort $(vndk_snapshot_soong_files))
-$(vndk_snapshot_zip): $(vndk_snapshot_soong_files)
-
-# Args
-# $(1): destination directory
-# $(2): list of files (src:dest) to copy
-$(vndk_snapshot_zip): private-copy-intermediates = \
- $(if $(2),$(strip \
- @mkdir -p $(1) && \
- $(foreach file,$(2), \
- cp $(call word-colon,1,$(file)) $(call append-path,$(1),$(call word-colon,2,$(file))) && \
- ) \
- true \
- ))
-
-$(vndk_snapshot_zip): $(SOONG_ZIP)
- @echo 'Generating VNDK snapshot: $@'
- @rm -f $@
- @rm -rf $(PRIVATE_VNDK_SNAPSHOT_OUT)
- @mkdir -p $(PRIVATE_VNDK_SNAPSHOT_OUT)
- $(call private-copy-intermediates, \
- $(PRIVATE_CONFIGS_OUT),$(PRIVATE_CONFIGS_INTERMEDIATES))
- $(hide) $(SOONG_ZIP) -o $@ -C $(PRIVATE_VNDK_SNAPSHOT_OUT) -D $(PRIVATE_VNDK_SNAPSHOT_OUT) \
- -C $(PRIVATE_VNDK_SNAPSHOT_SOONG_DIR) $(foreach f,$(PRIVATE_VNDK_SNAPSHOT_SOONG_FILES),-f $(f))
-
.PHONY: vndk
-vndk: $(vndk_snapshot_zip)
+vndk: $(SOONG_VNDK_SNAPSHOT_ZIP)
-$(call dist-for-goals, vndk, $(vndk_snapshot_zip))
-
-# clear global vars
-clang-ubsan-vndk-core :=
-paths-of-intermediates :=
-vndk_prebuilt_txts :=
-vndk_snapshot_top :=
-vndk_snapshot_out :=
-vndk_snapshot_soong_dir :=
-vndk_snapshot_soong_files :=
-vndk_snapshot_variant :=
+$(call dist-for-goals, vndk, $(SOONG_VNDK_SNAPSHOT_ZIP))
else # BOARD_VNDK_RUNTIME_DISABLE is set to 'true'
error_msg := "CANNOT generate VNDK snapshot. BOARD_VNDK_RUNTIME_DISABLE must not be set to 'true'."
@@ -121,8 +43,9 @@
ifneq (,$(error_msg))
.PHONY: vndk
+vndk: PRIVATE_MAKEFILE := $(current_makefile)
vndk:
- $(call echo-error,$(current_makefile),$(error_msg))
+ $(call echo-error,$(PRIVATE_MAKEFILE),$(error_msg))
exit 1
endif
diff --git a/core/tasks/vts-core-tests.mk b/core/tasks/vts-core-tests.mk
index 95b729a..a3247da 100644
--- a/core/tasks/vts-core-tests.mk
+++ b/core/tasks/vts-core-tests.mk
@@ -12,45 +12,37 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-.PHONY: vts-core
+-include external/linux-kselftest/android/kselftest_test_list.mk
+-include external/ltp/android/ltp_package_list.mk
-vts-core-zip := $(PRODUCT_OUT)/vts-core-tests.zip
-# Create an artifact to include a list of test config files in vts-core.
-vts-core-list-zip := $(PRODUCT_OUT)/vts-core_list.zip
-# Create an artifact to include all test config files in vts-core.
-vts-core-configs-zip := $(PRODUCT_OUT)/vts-core_configs.zip
-my_host_shared_lib_for_vts_core := $(call copy-many-files,$(COMPATIBILITY.vts-core.HOST_SHARED_LIBRARY.FILES))
-$(vts-core-zip) : .KATI_IMPLICIT_OUTPUTS := $(vts-core-list-zip) $(vts-core-configs-zip)
-$(vts-core-zip) : PRIVATE_vts_core_list := $(PRODUCT_OUT)/vts-core_list
-$(vts-core-zip) : PRIVATE_HOST_SHARED_LIBS := $(my_host_shared_lib_for_vts_core)
-$(vts-core-zip) : $(COMPATIBILITY.vts-core.FILES) $(my_host_shared_lib_for_vts_core) $(SOONG_ZIP)
- echo $(sort $(COMPATIBILITY.vts-core.FILES)) | tr " " "\n" > $@.list
- grep $(HOST_OUT_TESTCASES) $@.list > $@-host.list || true
- grep -e .*\\.config$$ $@-host.list > $@-host-test-configs.list || true
- $(hide) for shared_lib in $(PRIVATE_HOST_SHARED_LIBS); do \
- echo $$shared_lib >> $@-host.list; \
- done
- grep $(TARGET_OUT_TESTCASES) $@.list > $@-target.list || true
- grep -e .*\\.config$$ $@-target.list > $@-target-test-configs.list || true
- $(hide) $(SOONG_ZIP) -d -o $@ -P host -C $(HOST_OUT) -l $@-host.list -P target -C $(PRODUCT_OUT) -l $@-target.list
- $(hide) $(SOONG_ZIP) -d -o $(vts-core-configs-zip) \
- -P host -C $(HOST_OUT) -l $@-host-test-configs.list \
- -P target -C $(PRODUCT_OUT) -l $@-target-test-configs.list
- rm -f $(PRIVATE_vts_core_list)
- $(hide) grep -e .*\\.config$$ $@-host.list | sed s%$(HOST_OUT)%host%g > $(PRIVATE_vts_core_list)
- $(hide) grep -e .*\\.config$$ $@-target.list | sed s%$(PRODUCT_OUT)%target%g >> $(PRIVATE_vts_core_list)
- $(hide) $(SOONG_ZIP) -d -o $(vts-core-list-zip) -C $(dir $@) -f $(PRIVATE_vts_core_list)
- rm -f $@.list $@-host.list $@-target.list $@-host-test-configs.list $@-target-test-configs.list \
- $(PRIVATE_vts_core_list)
-
-vts-core: $(vts-core-zip)
-
-test_suite_name := vts-core
-test_suite_tradefed := vts-core-tradefed
+test_suite_name := vts
+test_suite_tradefed := vts-tradefed
test_suite_readme := test/vts/tools/vts-core-tradefed/README
+
+# Copy kernel test modules to testcases directories
+kernel_test_host_out := $(HOST_OUT_TESTCASES)/vts_kernel_tests
+kernel_test_vts_out := $(HOST_OUT)/$(test_suite_name)/android-$(test_suite_name)/testcases/vts_kernel_tests
+kernel_test_modules := \
+ $(kselftest_modules) \
+ ltp \
+ $(ltp_packages)
+
+kernel_test_copy_pairs := \
+ $(call target-native-copy-pairs,$(kernel_test_modules),$(kernel_test_vts_out)) \
+ $(call target-native-copy-pairs,$(kernel_test_modules),$(kernel_test_host_out))
+
+copy_kernel_tests := $(call copy-many-files,$(kernel_test_copy_pairs))
+
+# PHONY target to be used to build and test `vts_kernel_tests` without building full vts
+.PHONY: vts_kernel_tests
+vts_kernel_tests: $(copy_kernel_tests)
+
include $(BUILD_SYSTEM)/tasks/tools/compatibility.mk
-vts-core: $(compatibility_zip)
-$(call dist-for-goals, vts-core, $(vts-core-zip) $(vts-core-list-zip) $(vts-core-configs-zip) $(compatibility_zip))
+$(compatibility_zip): $(copy_kernel_tests)
-tests: vts-core
+.PHONY: vts
+vts: $(compatibility_zip)
+$(call dist-for-goals, vts, $(compatibility_zip))
+
+tests: vts
diff --git a/core/tasks/with-license.mk b/core/tasks/with-license.mk
new file mode 100644
index 0000000..469ad76
--- /dev/null
+++ b/core/tasks/with-license.mk
@@ -0,0 +1,50 @@
+# Copyright (C) 2019 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.
+
+
+.PHONY: with-license
+
+name := $(TARGET_PRODUCT)
+ifeq ($(TARGET_BUILD_TYPE),debug)
+ name := $(name)_debug
+endif
+
+name := $(name)-flashable-$(FILE_NAME_TAG)-with-license
+
+with_license_intermediates := \
+ $(call intermediates-dir-for,PACKAGING,with_license)
+
+# Create a with-license artifact target
+license_image_input_zip := $(with_license_intermediates)/$(name).zip
+$(license_image_input_zip) : $(BUILT_TARGET_FILES_PACKAGE) $(ZIP2ZIP)
+# DO NOT PROCEED without a license file.
+ifndef VENDOR_BLOBS_LICENSE
+ @echo "with-license requires VENDOR_BLOBS_LICENSE to be set."
+ exit 1
+else
+ $(ZIP2ZIP) -i $(BUILT_TARGET_FILES_PACKAGE) -o $@ \
+ RADIO/bootloader.img:bootloader.img RADIO/radio.img:radio.img \
+ IMAGES/*.img:. OTA/android-info.txt:android-info.txt
+endif
+with_license_zip := $(PRODUCT_OUT)/$(name).sh
+$(with_license_zip): PRIVATE_NAME := $(name)
+$(with_license_zip): PRIVATE_INPUT_ZIP := $(license_image_input_zip)
+$(with_license_zip): PRIVATE_VENDOR_BLOBS_LICENSE := $(VENDOR_BLOBS_LICENSE)
+$(with_license_zip): $(license_image_input_zip) $(VENDOR_BLOBS_LICENSE)
+$(with_license_zip): $(HOST_OUT_EXECUTABLES)/generate-self-extracting-archive
+ # Args: <output> <input archive> <comment> <license file>
+ $(HOST_OUT_EXECUTABLES)/generate-self-extracting-archive $@ \
+ $(PRIVATE_INPUT_ZIP) $(PRIVATE_NAME) $(PRIVATE_VENDOR_BLOBS_LICENSE)
+with-license : $(with_license_zip)
+$(call dist-for-goals, with-license, $(with_license_zip))
diff --git a/core/test_config_common.mk b/core/test_config_common.mk
deleted file mode 100644
index 487f9f2..0000000
--- a/core/test_config_common.mk
+++ /dev/null
@@ -1,56 +0,0 @@
-#
-# Copyright (C) 2017 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.
-#
-
-LOCAL_MODULE_CLASS := TEST_CONFIG
-
-# Output test config files to testcases directory.
-ifeq (,$(filter general-tests, $(LOCAL_COMPATIBILITY_SUITE)))
- LOCAL_COMPATIBILITY_SUITE += general-tests
-endif
-
-LOCAL_MODULE_SUFFIX := .config
-
-my_test_config_file := $(wildcard $(LOCAL_PATH)/$(LOCAL_MODULE).xml)
-LOCAL_SRC_FILES :=
-
-include $(BUILD_SYSTEM)/base_rules.mk
-
-# The test config is not in a standalone XML file.
-ifndef my_test_config_file
-
-ifndef LOCAL_TEST_CONFIG_OPTIONS
- $(call pretty-error,LOCAL_TEST_CONFIG_OPTIONS must be set if the test XML file is not provided.)
-endif
-
-my_base_test_config_file := $(LOCAL_PATH)/AndroidTest.xml
-my_test_config_file := $(dir $(LOCAL_BUILT_MODULE))AndroidTest.xml
-
-$(my_test_config_file) : PRIVATE_test_config_options := $(LOCAL_TEST_CONFIG_OPTIONS)
-$(my_test_config_file) : $(my_base_test_config_file)
- @echo "Create $(notdir $@) with options: $(PRIVATE_test_config_options)."
- $(eval _option_xml := \
- $(foreach option,$(PRIVATE_test_config_options), \
- $(eval p := $(subst :,$(space),$(option))) \
- <option name="$(word 1,$(p))" value="$(word 2,$(p))" \/>\n))
- $(hide) sed 's&</configuration>&$(_option_xml)</configuration>&' $< > $@
-
-endif # my_test_config_file
-
-$(LOCAL_BUILT_MODULE) : $(my_test_config_file)
- $(copy-file-to-target)
-
-my_base_test_config_file :=
-my_test_config_file :=
diff --git a/core/version_defaults.mk b/core/version_defaults.mk
index 30890c0..d375780 100644
--- a/core/version_defaults.mk
+++ b/core/version_defaults.mk
@@ -39,9 +39,9 @@
include $(INTERNAL_BUILD_ID_MAKEFILE)
endif
-DEFAULT_PLATFORM_VERSION := RP1A
-MIN_PLATFORM_VERSION := RP1A
-MAX_PLATFORM_VERSION := RP1A
+DEFAULT_PLATFORM_VERSION := SP1A
+MIN_PLATFORM_VERSION := SP1A
+MAX_PLATFORM_VERSION := SP1A
ALLOWED_VERSIONS := $(call allowed-platform-versions,\
$(MIN_PLATFORM_VERSION),\
@@ -85,10 +85,12 @@
# unreleased API level targetable by this branch, not just those that are valid
# lunch targets for this branch.
PLATFORM_VERSION.RP1A := R
+PLATFORM_VERSION.SP1A := S
# These are the current development codenames, if the build is not a final
# release build. If this is a final release build, it is simply "REL".
PLATFORM_VERSION_CODENAME.RP1A := R
+PLATFORM_VERSION_CODENAME.SP1A := S
ifndef PLATFORM_VERSION
PLATFORM_VERSION := $(PLATFORM_VERSION.$(TARGET_PLATFORM_VERSION))
@@ -123,8 +125,8 @@
PLATFORM_VERSION_CODENAME := $(TARGET_PLATFORM_VERSION)
endif
- # This is all of the *active* development codenames. There are future
- # codenames not included in this list. This confusing name is needed because
+ # This is all of the *active* development codenames.
+ # This confusing name is needed because
# all_codenames has been baked into build.prop for ages.
#
# Should be either the same as PLATFORM_VERSION_CODENAME or a comma-separated
@@ -141,29 +143,14 @@
$(if $(filter $(_codename),$(PLATFORM_VERSION_ALL_CODENAMES)),,\
$(eval PLATFORM_VERSION_ALL_CODENAMES += $(_codename))))
- # This is all of the inactive development codenames. Available to be targeted
- # in this branch but in the future relative to our current target.
- PLATFORM_VERSION_FUTURE_CODENAMES :=
-
- # Build a list of all untargeted code names. Avoid duplicates.
- _versions_not_in_target := \
- $(filter-out $(PLATFORM_VERSION_ALL_CODENAMES),$(ALL_VERSIONS))
- $(foreach version,$(_versions_not_in_target),\
- $(eval _codename := $(PLATFORM_VERSION_CODENAME.$(version)))\
- $(if $(filter $(_codename),$(PLATFORM_VERSION_FUTURE_CODENAMES)),,\
- $(eval PLATFORM_VERSION_FUTURE_CODENAMES += $(_codename))))
-
# And convert from space separated to comma separated.
PLATFORM_VERSION_ALL_CODENAMES := \
$(subst $(space),$(comma),$(strip $(PLATFORM_VERSION_ALL_CODENAMES)))
- PLATFORM_VERSION_FUTURE_CODENAMES := \
- $(subst $(space),$(comma),$(strip $(PLATFORM_VERSION_FUTURE_CODENAMES)))
endif
.KATI_READONLY := \
PLATFORM_VERSION_CODENAME \
- PLATFORM_VERSION_ALL_CODENAMES \
- PLATFORM_VERSION_FUTURE_CODENAMES
+ PLATFORM_VERSION_ALL_CODENAMES
ifeq (REL,$(PLATFORM_VERSION_CODENAME))
PLATFORM_PREVIEW_SDK_VERSION := 0
@@ -250,7 +237,7 @@
# It must be of the form "YYYY-MM-DD" on production devices.
# It must match one of the Android Security Patch Level strings of the Public Security Bulletins.
# If there is no $PLATFORM_SECURITY_PATCH set, keep it empty.
- PLATFORM_SECURITY_PATCH := 2019-09-05
+ PLATFORM_SECURITY_PATCH := 2020-06-05
endif
.KATI_READONLY := PLATFORM_SECURITY_PATCH
diff --git a/envsetup.sh b/envsetup.sh
index 92dad9a..e981034 100644
--- a/envsetup.sh
+++ b/envsetup.sh
@@ -8,17 +8,20 @@
Selects <product_name> as the product to build, and <build_variant> as the variant to
build, and stores those selections in the environment to be read by subsequent
invocations of 'm' etc.
-- tapas: tapas [<App1> <App2> ...] [arm|x86|mips|arm64|x86_64|mips64] [eng|userdebug|user]
+- tapas: tapas [<App1> <App2> ...] [arm|x86|arm64|x86_64] [eng|userdebug|user]
- croot: Changes directory to the top of the tree, or a subdirectory thereof.
- m: Makes from the top of the tree.
-- mm: Builds all of the modules in the current directory, but not their dependencies.
-- mmm: Builds all of the modules in the supplied directories, but not their dependencies.
+- mm: Builds and installs all of the modules in the current directory, and their
+ dependencies.
+- mmm: Builds and installs all of the modules in the supplied directories, and their
+ dependencies.
To limit the modules being built use the syntax: mmm dir/:target1,target2.
-- mma: Builds all of the modules in the current directory, and their dependencies.
-- mmma: Builds all of the modules in the supplied directories, and their dependencies.
+- mma: Same as 'mm'
+- mmma: Same as 'mmm'
- provision: Flash device with all required partitions. Options will be passed on to fastboot.
- cgrep: Greps on all local C/C++ files.
- ggrep: Greps on all local Gradle files.
+- gogrep: Greps on all local Go files.
- jgrep: Greps on all local Java files.
- resgrep: Greps on all local res/*.xml files.
- mangrep: Greps on all local AndroidManifest.xml files.
@@ -30,12 +33,10 @@
- allmod: List all modules.
- gomod: Go to the directory containing a module.
- pathmod: Get the directory containing a module.
-- refreshmod: Refresh list of modules for allmod/gomod.
+- refreshmod: Refresh list of modules for allmod/gomod/pathmod.
Environment options:
-- SANITIZE_HOST: Set to 'true' to use ASAN for all host modules. Note that
- ASAN_OPTIONS=detect_leaks=0 will be set by default until the
- build is leak-check clean.
+- SANITIZE_HOST: Set to 'address' to use ASAN for all host modules.
- ANDROID_QUIET_BUILD: set to 'true' to display only the essential messages.
Look at the source to view more functions. The complete list is:
@@ -118,13 +119,13 @@
if [ "$BUILD_VAR_CACHE_READY" = "true" ]
then
eval "echo \"\${var_cache_$1}\""
- return
+ return 0
fi
local T=$(gettop)
if [ ! "$T" ]; then
echo "Couldn't locate the top of the tree. Try setting TOP." >&2
- return
+ return 1
fi
(\cd $T; build/soong/soong_ui.bash --dumpvar-mode $1)
}
@@ -217,8 +218,6 @@
arm64) toolchaindir=aarch64/aarch64-linux-android-$targetgccversion/bin;
toolchaindir2=arm/arm-linux-androideabi-$targetgccversion2/bin
;;
- mips|mips64) toolchaindir=mips/mips64el-linux-android-$targetgccversion/bin
- ;;
*)
echo "Can't find toolchain for unknown architecture: $ARCH"
toolchaindir=xxxxxxxxx
@@ -253,6 +252,9 @@
local ANDROID_LLVM_BINUTILS=$(get_abs_build_var ANDROID_CLANG_PREBUILTS)/llvm-binutils-stable
ANDROID_BUILD_PATHS=$ANDROID_BUILD_PATHS:$ANDROID_LLVM_BINUTILS
+ # Set up ASAN_SYMBOLIZER_PATH for SANITIZE_HOST=address builds.
+ export ASAN_SYMBOLIZER_PATH=$ANDROID_LLVM_BINUTILS/llvm-symbolizer
+
# If prebuilts/android-emulator/<system>/ exists, prepend it to our PATH
# to ensure that the corresponding 'emulator' binaries are used.
case $(uname -s) in
@@ -333,7 +335,6 @@
export ANDROID_BUILD_TOP=$(gettop)
# With this environment variable new GCC can apply colors to warnings/errors
export GCC_COLORS='error=01;31:warning=01;35:note=01;36:caret=01;32:locus=01:quote=01'
- export ASAN_OPTIONS=detect_leaks=0
}
function set_sequence_number()
@@ -527,7 +528,7 @@
export TARGET_BUILD_VARIANT=$default_value
elif (echo -n $ANSWER | grep -q -e "^[0-9][0-9]*$") ; then
if [ "$ANSWER" -le "${#VARIANT_CHOICES[@]}" ] ; then
- export TARGET_BUILD_VARIANT=${VARIANT_CHOICES[$(($ANSWER-1))]}
+ export TARGET_BUILD_VARIANT=${VARIANT_CHOICES[@]:$(($ANSWER-1)):1}
fi
else
if check_variant $ANSWER
@@ -575,15 +576,30 @@
function print_lunch_menu()
{
local uname=$(uname)
- local choices=$(TARGET_BUILD_APPS= get_build_var COMMON_LUNCH_CHOICES)
+ local choices
+ choices=$(TARGET_BUILD_APPS= get_build_var COMMON_LUNCH_CHOICES 2>/dev/null)
+ local ret=$?
+
echo
echo "You're building on" $uname
echo
+
+ if [ $ret -ne 0 ]
+ then
+ echo "Warning: Cannot display lunch menu."
+ echo
+ echo "Note: You can invoke lunch with an explicit target:"
+ echo
+ echo " usage: lunch [target]" >&2
+ echo
+ return
+ fi
+
echo "Lunch menu... pick a combo:"
local i=1
local choice
- for choice in $choices
+ for choice in $(echo $choices)
do
echo " $i. $choice"
i=$(($i+1))
@@ -596,7 +612,12 @@
{
local answer
- if [ "$1" ] ; then
+ if [[ $# -gt 1 ]]; then
+ echo "usage: lunch [target]" >&2
+ return 1
+ fi
+
+ if [ "$1" ]; then
answer=$1
else
print_lunch_menu
@@ -629,7 +650,6 @@
export TARGET_BUILD_APPS=
local product variant_and_version variant version
-
product=${selection%%-*} # Trim everything after first dash
variant_and_version=${selection#*-} # Trim everything up to first dash
if [ "$variant_and_version" != "$selection" ]; then
@@ -654,7 +674,6 @@
then
return 1
fi
-
export TARGET_PRODUCT=$(get_build_var TARGET_PRODUCT)
export TARGET_BUILD_VARIANT=$(get_build_var TARGET_BUILD_VARIANT)
if [ -n "$version" ]; then
@@ -664,10 +683,10 @@
fi
export TARGET_BUILD_TYPE=release
- echo
+ [[ -n "${ANDROID_QUIET_BUILD:-}" ]] || echo
set_stuff_for_environment
- printconfig
+ [[ -n "${ANDROID_QUIET_BUILD:-}" ]] || printconfig
destroy_build_var_cache
}
@@ -693,10 +712,10 @@
function tapas()
{
local showHelp="$(echo $* | xargs -n 1 echo | \grep -E '^(help)$' | xargs)"
- local arch="$(echo $* | xargs -n 1 echo | \grep -E '^(arm|x86|mips|arm64|x86_64|mips64)$' | xargs)"
+ local arch="$(echo $* | xargs -n 1 echo | \grep -E '^(arm|x86|arm64|x86_64)$' | xargs)"
local variant="$(echo $* | xargs -n 1 echo | \grep -E '^(user|userdebug|eng)$' | xargs)"
local density="$(echo $* | xargs -n 1 echo | \grep -E '^(ldpi|mdpi|tvdpi|hdpi|xhdpi|xxhdpi|xxxhdpi|alldpi)$' | xargs)"
- local apps="$(echo $* | xargs -n 1 echo | \grep -E -v '^(user|userdebug|eng|arm|x86|mips|arm64|x86_64|mips64|ldpi|mdpi|tvdpi|hdpi|xhdpi|xxhdpi|xxxhdpi|alldpi)$' | xargs)"
+ local apps="$(echo $* | xargs -n 1 echo | \grep -E -v '^(user|userdebug|eng|arm|x86|arm64|x86_64|ldpi|mdpi|tvdpi|hdpi|xhdpi|xxhdpi|xxxhdpi|alldpi)$' | xargs)"
if [ "$showHelp" != "" ]; then
$(gettop)/build/make/tapasHelp.sh
@@ -719,10 +738,8 @@
local product=aosp_arm
case $arch in
x86) product=aosp_x86;;
- mips) product=aosp_mips;;
arm64) product=aosp_arm64;;
x86_64) product=aosp_x86_64;;
- mips64) product=aosp_mips64;;
esac
if [ -z "$variant" ]; then
variant=eng
@@ -946,7 +963,7 @@
Darwin)
function sgrep()
{
- find -E . -name .repo -prune -o -name .git -prune -o -type f -iregex '.*\.(c|h|cc|cpp|hpp|S|java|xml|sh|mk|aidl|vts)' \
+ find -E . -name .repo -prune -o -name .git -prune -o -type f -iregex '.*\.(c|h|cc|cpp|hpp|S|java|xml|sh|mk|aidl|vts|proto)' \
-exec grep --color -n "$@" {} +
}
@@ -954,7 +971,7 @@
*)
function sgrep()
{
- find . -name .repo -prune -o -name .git -prune -o -type f -iregex '.*\.\(c\|h\|cc\|cpp\|hpp\|S\|java\|xml\|sh\|mk\|aidl\|vts\)' \
+ find . -name .repo -prune -o -name .git -prune -o -type f -iregex '.*\.\(c\|h\|cc\|cpp\|hpp\|S\|java\|xml\|sh\|mk\|aidl\|vts\|proto\)' \
-exec grep --color -n "$@" {} +
}
;;
@@ -971,6 +988,12 @@
-exec grep --color -n "$@" {} +
}
+function gogrep()
+{
+ find . -name .repo -prune -o -name .git -prune -o -name out -prune -o -type f -name "*\.go" \
+ -exec grep --color -n "$@" {} +
+}
+
function jgrep()
{
find . -name .repo -prune -o -name .git -prune -o -name out -prune -o -type f -name "*\.java" \
@@ -1019,7 +1042,7 @@
Darwin)
function mgrep()
{
- find -E . -name .repo -prune -o -name .git -prune -o -path ./out -prune -o \( -iregex '.*/(Makefile|Makefile\..*|.*\.make|.*\.mak|.*\.mk|.*\.bp)' -o -regex '(.*/)?soong/[^/]*.go' \) -type f \
+ find -E . -name .repo -prune -o -name .git -prune -o -path ./out -prune -o \( -iregex '.*/(Makefile|Makefile\..*|.*\.make|.*\.mak|.*\.mk|.*\.bp)' -o -regex '(.*/)?(build|soong)/.*[^/]*\.go' \) -type f \
-exec grep --color -n "$@" {} +
}
@@ -1033,7 +1056,7 @@
*)
function mgrep()
{
- find . -name .repo -prune -o -name .git -prune -o -path ./out -prune -o \( -regextype posix-egrep -iregex '(.*\/Makefile|.*\/Makefile\..*|.*\.make|.*\.mak|.*\.mk|.*\.bp)' -o -regextype posix-extended -regex '(.*/)?soong/[^/]*.go' \) -type f \
+ find . -name .repo -prune -o -name .git -prune -o -path ./out -prune -o \( -regextype posix-egrep -iregex '(.*\/Makefile|.*\/Makefile\..*|.*\.make|.*\.mak|.*\.mk|.*\.bp)' -o -regextype posix-extended -regex '(.*/)?(build|soong)/.*[^/]*\.go' \) -type f \
-exec grep --color -n "$@" {} +
}
@@ -1298,10 +1321,10 @@
echo "Invalid choice"
continue
fi
- pathname=${lines[$(($choice-1))]}
+ pathname=${lines[@]:$(($choice-1)):1}
done
else
- pathname=${lines[0]}
+ pathname=${lines[@]:0:1}
fi
\cd $T/$pathname
}
@@ -1336,7 +1359,7 @@
refreshmod || return 1
fi
- python -c "import json; print '\n'.join(sorted(json.load(open('$ANDROID_PRODUCT_OUT/module-info.json')).keys()))"
+ python -c "import json; print('\n'.join(sorted(json.load(open('$ANDROID_PRODUCT_OUT/module-info.json')).keys())))"
}
# Get the path of a specific module in the android tree, as cached in module-info.json. If any build change
@@ -1362,7 +1385,7 @@
module_info = json.load(open('$ANDROID_PRODUCT_OUT/module-info.json'))
if module not in module_info:
exit(1)
-print module_info[module]['path'][0]" 2>/dev/null)
+print(module_info[module]['path'][0])" 2>/dev/null)
if [ -z "$relpath" ]; then
echo "Could not find module '$1' (try 'refreshmod' if there have been build changes?)." >&2
diff --git a/rbesetup.sh b/rbesetup.sh
new file mode 100644
index 0000000..7e9b2ea
--- /dev/null
+++ b/rbesetup.sh
@@ -0,0 +1,25 @@
+source build/envsetup.sh
+
+# This function prefixes the given command with appropriate variables needed
+# for the build to be executed with RBE.
+function use_rbe() {
+ local RBE_LOG_DIR="/tmp"
+ local RBE_BINARIES_DIR="prebuilts/remoteexecution-client/latest/"
+ local DOCKER_IMAGE="gcr.io/androidbuild-re-dockerimage/android-build-remoteexec-image@sha256:582efb38f0c229ea39952fff9e132ccbe183e14869b39888010dacf56b360d62"
+
+ # Do not set an invocation-ID and let reproxy auto-generate one.
+ USE_RBE="true" \
+ FLAG_server_address="unix:///tmp/reproxy_$RANDOM.sock" \
+ FLAG_exec_root="$(gettop)" \
+ FLAG_platform="container-image=docker://${DOCKER_IMAGE}" \
+ RBE_use_application_default_credentials="true" \
+ RBE_log_dir="${RBE_LOG_DIR}" \
+ RBE_reproxy_wait_seconds="20" \
+ RBE_output_dir="${RBE_LOG_DIR}" \
+ RBE_log_path="text://${RBE_LOG_DIR}/reproxy_log.txt" \
+ RBE_CXX_EXEC_STRATEGY="remote_local_fallback" \
+ RBE_cpp_dependency_scanner_plugin="${RBE_BINARIES_DIR}/dependency_scanner_go_plugin.so" \
+ RBE_DIR=${RBE_BINARIES_DIR} \
+ RBE_re_proxy="${RBE_BINARIES_DIR}/reproxy" \
+ $@
+}
diff --git a/tapasHelp.sh b/tapasHelp.sh
index 38b3e34..0f46130 100755
--- a/tapasHelp.sh
+++ b/tapasHelp.sh
@@ -6,7 +6,7 @@
cd ../..
TOP="${PWD}"
-message='usage: tapas [<App1> <App2> ...] [arm|x86|mips|arm64|x86_64|mips64] [eng|userdebug|user]
+message='usage: tapas [<App1> <App2> ...] [arm|x86|arm64|x86_64] [eng|userdebug|user]
tapas selects individual apps to be built by the Android build system. Unlike
"lunch", "tapas" does not request the building of images for a device.
diff --git a/target/board/Android.mk b/target/board/Android.mk
index c8705c3..9edc85c 100644
--- a/target/board/Android.mk
+++ b/target/board/Android.mk
@@ -34,7 +34,7 @@
ifdef DEVICE_MANIFEST_FILE
# $(DEVICE_MANIFEST_FILE) can be a list of files
include $(CLEAR_VARS)
-LOCAL_MODULE := device_manifest.xml
+LOCAL_MODULE := vendor_manifest.xml
LOCAL_MODULE_STEM := manifest.xml
LOCAL_MODULE_CLASS := ETC
LOCAL_MODULE_PATH := $(TARGET_OUT_VENDOR)/etc/vintf
@@ -50,9 +50,45 @@
LOCAL_PREBUILT_MODULE_FILE := $(GEN)
include $(BUILD_PREBUILT)
-BUILT_VENDOR_MANIFEST := $(LOCAL_BUILT_MODULE)
endif
+# DEVICE_MANIFEST_SKUS: a list of SKUS where DEVICE_MANIFEST_<sku>_FILES is defined.
+ifdef DEVICE_MANIFEST_SKUS
+
+# Install /vendor/etc/vintf/manifest_$(sku).xml
+# $(1): sku
+define _add_device_sku_manifest
+my_fragment_files_var := DEVICE_MANIFEST_$$(call to-upper,$(1))_FILES
+ifndef $$(my_fragment_files_var)
+$$(error $(1) is in DEVICE_MANIFEST_SKUS but $$(my_fragment_files_var) is not defined)
+endif
+my_fragment_files := $$($$(my_fragment_files_var))
+include $$(CLEAR_VARS)
+LOCAL_MODULE := vendor_manifest_$(1).xml
+LOCAL_MODULE_STEM := manifest_$(1).xml
+LOCAL_MODULE_CLASS := ETC
+LOCAL_MODULE_PATH := $(TARGET_OUT_VENDOR)/etc/vintf
+
+GEN := $$(local-generated-sources-dir)/manifest_$(1).xml
+$$(GEN): PRIVATE_SRC_FILES := $$(my_fragment_files)
+$$(GEN): $$(my_fragment_files) $$(HOST_OUT_EXECUTABLES)/assemble_vintf
+ BOARD_SEPOLICY_VERS=$$(BOARD_SEPOLICY_VERS) \
+ PRODUCT_ENFORCE_VINTF_MANIFEST=$$(PRODUCT_ENFORCE_VINTF_MANIFEST) \
+ PRODUCT_SHIPPING_API_LEVEL=$$(PRODUCT_SHIPPING_API_LEVEL) \
+ $$(HOST_OUT_EXECUTABLES)/assemble_vintf -o $$@ \
+ -i $$(call normalize-path-list,$$(PRIVATE_SRC_FILES))
+
+LOCAL_PREBUILT_MODULE_FILE := $$(GEN)
+include $$(BUILD_PREBUILT)
+my_fragment_files_var :=
+my_fragment_files :=
+endef
+
+$(foreach sku, $(DEVICE_MANIFEST_SKUS), $(eval $(call _add_device_sku_manifest,$(sku))))
+_add_device_sku_manifest :=
+
+endif # DEVICE_MANIFEST_SKUS
+
# ODM manifest
ifdef ODM_MANIFEST_FILES
# ODM_MANIFEST_FILES is a list of files that is combined and installed as the default ODM manifest.
diff --git a/target/board/BoardConfigEmuCommon.mk b/target/board/BoardConfigEmuCommon.mk
index d11f9d2..e9fb096 100644
--- a/target/board/BoardConfigEmuCommon.mk
+++ b/target/board/BoardConfigEmuCommon.mk
@@ -33,8 +33,6 @@
# emulator needs super.img
BOARD_BUILD_SUPER_IMAGE_BY_DEFAULT := true
- BOARD_EXT4_SHARE_DUP_BLOCKS := true
-
# 3G + header
BOARD_SUPER_PARTITION_SIZE := 3229614080
BOARD_SUPER_PARTITION_GROUPS := emulator_dynamic_partitions
@@ -74,6 +72,13 @@
BOARD_VENDORIMAGE_PARTITION_SIZE := 146800640
endif
+#vendor boot
+TARGET_NO_VENDOR_BOOT := false
+BOARD_INCLUDE_DTB_IN_BOOTIMG := false
+BOARD_BOOT_HEADER_VERSION := 3
+BOARD_MKBOOTIMG_ARGS += --header_version $(BOARD_BOOT_HEADER_VERSION)
+BOARD_VENDOR_BOOTIMAGE_PARTITION_SIZE := 0x06000000
+
# Enable chain partition for system.
BOARD_AVB_SYSTEM_KEY_PATH := external/avb/test/data/testkey_rsa2048.pem
BOARD_AVB_SYSTEM_ALGORITHM := SHA256_RSA2048
diff --git a/target/board/BoardConfigGsiCommon.mk b/target/board/BoardConfigGsiCommon.mk
index 61aa67c..49f6edc 100644
--- a/target/board/BoardConfigGsiCommon.mk
+++ b/target/board/BoardConfigGsiCommon.mk
@@ -33,6 +33,19 @@
# updating the last seen rollback index in the tamper-evident storage.
BOARD_AVB_ROLLBACK_INDEX := 0
+# Enable chain partition for system.
+# GSI need to sign on system.img instead of vbmeta.
+BOARD_AVB_SYSTEM_KEY_PATH := external/avb/test/data/testkey_rsa2048.pem
+BOARD_AVB_SYSTEM_ALGORITHM := SHA256_RSA2048
+BOARD_AVB_SYSTEM_ROLLBACK_INDEX := $(PLATFORM_SECURITY_PATCH_TIMESTAMP)
+BOARD_AVB_SYSTEM_ROLLBACK_INDEX_LOCATION := 1
+
+# Enable chain partition for boot, mainly for GKI images.
+BOARD_AVB_BOOT_KEY_PATH := external/avb/test/data/testkey_rsa2048.pem
+BOARD_AVB_BOOT_ALGORITHM := SHA256_RSA2048
+BOARD_AVB_BOOT_ROLLBACK_INDEX := $(PLATFORM_SECURITY_PATCH_TIMESTAMP)
+BOARD_AVB_BOOT_ROLLBACK_INDEX_LOCATION := 2
+
# GSI specific System Properties
ifneq (,$(filter userdebug eng,$(TARGET_BUILD_VARIANT)))
TARGET_SYSTEM_EXT_PROP := build/make/target/board/gsi_system_ext.prop
diff --git a/target/board/BoardConfigMainlineCommon.mk b/target/board/BoardConfigMainlineCommon.mk
index 52ba814..bf015e5 100644
--- a/target/board/BoardConfigMainlineCommon.mk
+++ b/target/board/BoardConfigMainlineCommon.mk
@@ -6,6 +6,8 @@
TARGET_NO_BOOTLOADER := true
TARGET_NO_RECOVERY := true
+BOARD_EXT4_SHARE_DUP_BLOCKS := true
+
TARGET_USERIMAGES_USE_EXT4 := true
# Mainline devices must have /system_ext, /vendor and /product partitions.
@@ -46,6 +48,3 @@
# Include stats logging code in LMKD
TARGET_LMKD_STATS_LOG := true
-
-# Generate an APEX image for experiment b/119800099.
-DEXPREOPT_GENERATE_APEX_IMAGE := true
diff --git a/target/board/emulator_arm/AndroidBoard.mk b/target/board/emulator_arm/AndroidBoard.mk
new file mode 100644
index 0000000..7911f61
--- /dev/null
+++ b/target/board/emulator_arm/AndroidBoard.mk
@@ -0,0 +1 @@
+LOCAL_PATH := $(call my-dir)
diff --git a/target/board/emulator_arm/BoardConfig.mk b/target/board/emulator_arm/BoardConfig.mk
new file mode 100644
index 0000000..287824f
--- /dev/null
+++ b/target/board/emulator_arm/BoardConfig.mk
@@ -0,0 +1,37 @@
+# Copyright (C) 2020 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.
+#
+
+# arm emulator specific definitions
+TARGET_ARCH := arm
+TARGET_ARCH_VARIANT := armv7-a-neon
+TARGET_CPU_VARIANT := generic
+TARGET_CPU_ABI := armeabi-v7a
+TARGET_CPU_ABI2 := armeabi
+
+include build/make/target/board/BoardConfigGsiCommon.mk
+include build/make/target/board/BoardConfigEmuCommon.mk
+
+BOARD_USERDATAIMAGE_PARTITION_SIZE := 576716800
+
+# Wifi.
+BOARD_WLAN_DEVICE := emulator
+BOARD_HOSTAPD_DRIVER := NL80211
+BOARD_WPA_SUPPLICANT_DRIVER := NL80211
+BOARD_HOSTAPD_PRIVATE_LIB := lib_driver_cmd_simulated
+BOARD_WPA_SUPPLICANT_PRIVATE_LIB := lib_driver_cmd_simulated
+WPA_SUPPLICANT_VERSION := VER_0_8_X
+WIFI_DRIVER_FW_PATH_PARAM := "/dev/null"
+WIFI_DRIVER_FW_PATH_STA := "/dev/null"
+WIFI_DRIVER_FW_PATH_AP := "/dev/null"
diff --git a/core/target_test_config.mk b/target/board/emulator_arm/device.mk
similarity index 70%
copy from core/target_test_config.mk
copy to target/board/emulator_arm/device.mk
index 61f5d2b..af023eb 100644
--- a/core/target_test_config.mk
+++ b/target/board/emulator_arm/device.mk
@@ -1,5 +1,5 @@
#
-# Copyright (C) 2017 The Android Open Source Project
+# Copyright (C) 2020 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.
@@ -14,10 +14,5 @@
# limitations under the License.
#
-#
-# Common rules for building a TradeFed test XML file for target side tests.
-#
-
-$(call record-module-type,TARGET_TEST_CONFIG)
-
-include $(BUILD_SYSTEM)/test_config_common.mk
+PRODUCT_SOONG_NAMESPACES += device/generic/goldfish # for libwifi-hal-emu
+PRODUCT_SOONG_NAMESPACES += device/generic/goldfish-opengl # for goldfish deps.
diff --git a/target/board/emulator_arm/system_ext.prop b/target/board/emulator_arm/system_ext.prop
new file mode 100644
index 0000000..64829f3
--- /dev/null
+++ b/target/board/emulator_arm/system_ext.prop
@@ -0,0 +1,5 @@
+#
+# system.prop for generic sdk
+#
+
+rild.libpath=/vendor/lib/libreference-ril.so
diff --git a/target/board/emulator_arm64/BoardConfig.mk b/target/board/emulator_arm64/BoardConfig.mk
new file mode 100644
index 0000000..b34ccb4
--- /dev/null
+++ b/target/board/emulator_arm64/BoardConfig.mk
@@ -0,0 +1,77 @@
+# Copyright (C) 2020 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.
+#
+
+# arm64 emulator specific definitions
+TARGET_ARCH := arm64
+TARGET_ARCH_VARIANT := armv8-a
+TARGET_CPU_VARIANT := generic
+TARGET_CPU_ABI := arm64-v8a
+
+TARGET_2ND_ARCH := arm
+TARGET_2ND_CPU_ABI := armeabi-v7a
+TARGET_2ND_CPU_ABI2 := armeabi
+
+ifneq ($(TARGET_BUILD_APPS)$(filter cts sdk vts10,$(MAKECMDGOALS)),)
+# DO NOT USE
+# DO NOT USE
+#
+# This architecture / CPU variant must NOT be used for any 64 bit
+# platform builds. It is the lowest common denominator required
+# to build an unbundled application or cts for all supported 32 and 64 bit
+# platforms.
+#
+# If you're building a 64 bit platform (and not an application) the
+# ARM-v8 specification allows you to assume all the features available in an
+# armv7-a-neon CPU. You should set the following as 2nd arch/cpu variant:
+#
+# TARGET_2ND_ARCH_VARIANT := armv8-a
+# TARGET_2ND_CPU_VARIANT := generic
+#
+# DO NOT USE
+# DO NOT USE
+TARGET_2ND_ARCH_VARIANT := armv7-a-neon
+# DO NOT USE
+# DO NOT USE
+TARGET_2ND_CPU_VARIANT := generic
+# DO NOT USE
+# DO NOT USE
+else
+TARGET_2ND_ARCH_VARIANT := armv8-a
+TARGET_2ND_CPU_VARIANT := generic
+endif
+
+include build/make/target/board/BoardConfigGsiCommon.mk
+include build/make/target/board/BoardConfigEmuCommon.mk
+
+TARGET_NO_KERNEL := false
+TARGET_NO_VENDOR_BOOT := false
+BOARD_USES_RECOVERY_AS_BOOT := true
+
+BOARD_BOOTIMAGE_PARTITION_SIZE := 0x02000000
+BOARD_USERDATAIMAGE_PARTITION_SIZE := 576716800
+
+BOARD_BOOT_HEADER_VERSION := 3
+BOARD_MKBOOTIMG_ARGS += --header_version $(BOARD_BOOT_HEADER_VERSION)
+
+# Wifi.
+BOARD_WLAN_DEVICE := emulator
+BOARD_HOSTAPD_DRIVER := NL80211
+BOARD_WPA_SUPPLICANT_DRIVER := NL80211
+BOARD_HOSTAPD_PRIVATE_LIB := lib_driver_cmd_simulated
+BOARD_WPA_SUPPLICANT_PRIVATE_LIB := lib_driver_cmd_simulated
+WPA_SUPPLICANT_VERSION := VER_0_8_X
+WIFI_DRIVER_FW_PATH_PARAM := "/dev/null"
+WIFI_DRIVER_FW_PATH_STA := "/dev/null"
+WIFI_DRIVER_FW_PATH_AP := "/dev/null"
diff --git a/target/board/emulator_arm64/device.mk b/target/board/emulator_arm64/device.mk
new file mode 100644
index 0000000..57675d0
--- /dev/null
+++ b/target/board/emulator_arm64/device.mk
@@ -0,0 +1,32 @@
+#
+# Copyright (C) 2020 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.
+#
+
+PRODUCT_SOONG_NAMESPACES += device/generic/goldfish # for libwifi-hal-emu
+PRODUCT_SOONG_NAMESPACES += device/generic/goldfish-opengl # for goldfish deps.
+
+# Cuttlefish has GKI kernel prebuilts, so use those for the GKI boot.img.
+ifeq ($(TARGET_PREBUILT_KERNEL),)
+ LOCAL_KERNEL := device/google/cuttlefish_kernel/5.4-arm64/kernel
+else
+ LOCAL_KERNEL := $(TARGET_PREBUILT_KERNEL)
+endif
+
+PRODUCT_COPY_FILES += \
+ $(LOCAL_KERNEL):kernel
+
+# Adjust the Dalvik heap to be appropriate for a tablet.
+$(call inherit-product-if-exists, frameworks/base/build/tablet-dalvik-heap.mk)
+$(call inherit-product-if-exists, frameworks/native/build/tablet-dalvik-heap.mk)
diff --git a/target/board/emulator_arm64/system_ext.prop b/target/board/emulator_arm64/system_ext.prop
new file mode 100644
index 0000000..2f8f803
--- /dev/null
+++ b/target/board/emulator_arm64/system_ext.prop
@@ -0,0 +1,5 @@
+#
+# system.prop for emulator arm64 sdk
+#
+
+rild.libpath=/vendor/lib64/libreference-ril.so
diff --git a/target/board/emulator_x86/BoardConfig.mk b/target/board/emulator_x86/BoardConfig.mk
new file mode 100644
index 0000000..8f79166
--- /dev/null
+++ b/target/board/emulator_x86/BoardConfig.mk
@@ -0,0 +1,40 @@
+# Copyright (C) 2020 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.
+#
+
+# x86 emulator specific definitions
+TARGET_CPU_ABI := x86
+TARGET_ARCH := x86
+TARGET_ARCH_VARIANT := x86
+
+TARGET_PRELINK_MODULE := false
+
+include build/make/target/board/BoardConfigGsiCommon.mk
+include build/make/target/board/BoardConfigEmuCommon.mk
+
+# Resize to 4G to accommodate ASAN and CTS
+BOARD_USERDATAIMAGE_PARTITION_SIZE := 4294967296
+
+BOARD_SEPOLICY_DIRS += device/generic/goldfish/sepolicy/x86
+
+# Wifi.
+BOARD_WLAN_DEVICE := emulator
+BOARD_HOSTAPD_DRIVER := NL80211
+BOARD_WPA_SUPPLICANT_DRIVER := NL80211
+BOARD_HOSTAPD_PRIVATE_LIB := lib_driver_cmd_simulated
+BOARD_WPA_SUPPLICANT_PRIVATE_LIB := lib_driver_cmd_simulated
+WPA_SUPPLICANT_VERSION := VER_0_8_X
+WIFI_DRIVER_FW_PATH_PARAM := "/dev/null"
+WIFI_DRIVER_FW_PATH_STA := "/dev/null"
+WIFI_DRIVER_FW_PATH_AP := "/dev/null"
diff --git a/target/board/emulator_x86/device.mk b/target/board/emulator_x86/device.mk
new file mode 100644
index 0000000..7da09a9
--- /dev/null
+++ b/target/board/emulator_x86/device.mk
@@ -0,0 +1,27 @@
+#
+# Copyright (C) 2020 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.
+#
+
+PRODUCT_SOONG_NAMESPACES += device/generic/goldfish # for libwifi-hal-emu
+PRODUCT_SOONG_NAMESPACES += device/generic/goldfish-opengl # for goldfish deps.
+
+ifdef NET_ETH0_STARTONBOOT
+ PRODUCT_PROPERTY_OVERRIDES += net.eth0.startonboot=1
+endif
+
+# Ensure we package the BIOS files too.
+PRODUCT_HOST_PACKAGES += \
+ bios.bin \
+ vgabios-cirrus.bin \
diff --git a/target/board/emulator_x86/system_ext.prop b/target/board/emulator_x86/system_ext.prop
new file mode 100644
index 0000000..64829f3
--- /dev/null
+++ b/target/board/emulator_x86/system_ext.prop
@@ -0,0 +1,5 @@
+#
+# system.prop for generic sdk
+#
+
+rild.libpath=/vendor/lib/libreference-ril.so
diff --git a/target/board/emulator_x86_64/BoardConfig.mk b/target/board/emulator_x86_64/BoardConfig.mk
new file mode 100755
index 0000000..b9cbd8a
--- /dev/null
+++ b/target/board/emulator_x86_64/BoardConfig.mk
@@ -0,0 +1,42 @@
+# Copyright (C) 2020 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.
+#
+
+# x86_64 emulator specific definitions
+TARGET_CPU_ABI := x86_64
+TARGET_ARCH := x86_64
+TARGET_ARCH_VARIANT := x86_64
+
+TARGET_2ND_CPU_ABI := x86
+TARGET_2ND_ARCH := x86
+TARGET_2ND_ARCH_VARIANT := x86_64
+
+TARGET_PRELINK_MODULE := false
+include build/make/target/board/BoardConfigGsiCommon.mk
+include build/make/target/board/BoardConfigEmuCommon.mk
+
+BOARD_USERDATAIMAGE_PARTITION_SIZE := 576716800
+
+BOARD_SEPOLICY_DIRS += device/generic/goldfish/sepolicy/x86
+
+# Wifi.
+BOARD_WLAN_DEVICE := emulator
+BOARD_HOSTAPD_DRIVER := NL80211
+BOARD_WPA_SUPPLICANT_DRIVER := NL80211
+BOARD_HOSTAPD_PRIVATE_LIB := lib_driver_cmd_simulated
+BOARD_WPA_SUPPLICANT_PRIVATE_LIB := lib_driver_cmd_simulated
+WPA_SUPPLICANT_VERSION := VER_0_8_X
+WIFI_DRIVER_FW_PATH_PARAM := "/dev/null"
+WIFI_DRIVER_FW_PATH_STA := "/dev/null"
+WIFI_DRIVER_FW_PATH_AP := "/dev/null"
diff --git a/target/board/emulator_x86_64/device.mk b/target/board/emulator_x86_64/device.mk
new file mode 100755
index 0000000..7da09a9
--- /dev/null
+++ b/target/board/emulator_x86_64/device.mk
@@ -0,0 +1,27 @@
+#
+# Copyright (C) 2020 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.
+#
+
+PRODUCT_SOONG_NAMESPACES += device/generic/goldfish # for libwifi-hal-emu
+PRODUCT_SOONG_NAMESPACES += device/generic/goldfish-opengl # for goldfish deps.
+
+ifdef NET_ETH0_STARTONBOOT
+ PRODUCT_PROPERTY_OVERRIDES += net.eth0.startonboot=1
+endif
+
+# Ensure we package the BIOS files too.
+PRODUCT_HOST_PACKAGES += \
+ bios.bin \
+ vgabios-cirrus.bin \
diff --git a/target/board/emulator_x86_64/system_ext.prop b/target/board/emulator_x86_64/system_ext.prop
new file mode 100644
index 0000000..ed9d173
--- /dev/null
+++ b/target/board/emulator_x86_64/system_ext.prop
@@ -0,0 +1,5 @@
+#
+# system.prop for generic sdk
+#
+
+rild.libpath=/vendor/lib64/libreference-ril.so
diff --git a/target/board/emulator_x86_64_arm64/BoardConfig.mk b/target/board/emulator_x86_64_arm64/BoardConfig.mk
new file mode 100755
index 0000000..26b61a6
--- /dev/null
+++ b/target/board/emulator_x86_64_arm64/BoardConfig.mk
@@ -0,0 +1,59 @@
+# Copyright (C) 2020 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.
+#
+
+# x86_64 emulator specific definitions
+TARGET_CPU_ABI := x86_64
+TARGET_ARCH := x86_64
+TARGET_ARCH_VARIANT := x86_64
+
+TARGET_2ND_CPU_ABI := x86
+TARGET_2ND_ARCH := x86
+TARGET_2ND_ARCH_VARIANT := x86_64
+
+TARGET_NATIVE_BRIDGE_ARCH := arm64
+TARGET_NATIVE_BRIDGE_ARCH_VARIANT := armv8-a
+TARGET_NATIVE_BRIDGE_CPU_VARIANT := generic
+TARGET_NATIVE_BRIDGE_ABI := arm64-v8a
+
+TARGET_NATIVE_BRIDGE_2ND_ARCH := arm
+TARGET_NATIVE_BRIDGE_2ND_ARCH_VARIANT := armv7-a-neon
+TARGET_NATIVE_BRIDGE_2ND_CPU_VARIANT := generic
+TARGET_NATIVE_BRIDGE_2ND_ABI := armeabi-v7a armeabi
+
+BUILD_BROKEN_DUP_RULES := true
+
+TARGET_PRELINK_MODULE := false
+
+include build/make/target/board/BoardConfigMainlineCommon.mk
+include build/make/target/board/BoardConfigEmuCommon.mk
+
+# the settings differ from BoardConfigMainlineCommon.mk
+BOARD_USES_SYSTEM_OTHER_ODEX :=
+
+# Resize to 4G to accommodate ASAN and CTS
+BOARD_USERDATAIMAGE_PARTITION_SIZE := 4294967296
+
+BOARD_SEPOLICY_DIRS += device/generic/goldfish/sepolicy/x86
+
+# Wifi.
+BOARD_WLAN_DEVICE := emulator
+BOARD_HOSTAPD_DRIVER := NL80211
+BOARD_WPA_SUPPLICANT_DRIVER := NL80211
+BOARD_HOSTAPD_PRIVATE_LIB := lib_driver_cmd_simulated
+BOARD_WPA_SUPPLICANT_PRIVATE_LIB := lib_driver_cmd_simulated
+WPA_SUPPLICANT_VERSION := VER_0_8_X
+WIFI_DRIVER_FW_PATH_PARAM := "/dev/null"
+WIFI_DRIVER_FW_PATH_STA := "/dev/null"
+WIFI_DRIVER_FW_PATH_AP := "/dev/null"
diff --git a/core/target_test_config.mk b/target/board/emulator_x86_64_arm64/device.mk
old mode 100644
new mode 100755
similarity index 70%
copy from core/target_test_config.mk
copy to target/board/emulator_x86_64_arm64/device.mk
index 61f5d2b..af023eb
--- a/core/target_test_config.mk
+++ b/target/board/emulator_x86_64_arm64/device.mk
@@ -1,5 +1,5 @@
#
-# Copyright (C) 2017 The Android Open Source Project
+# Copyright (C) 2020 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.
@@ -14,10 +14,5 @@
# limitations under the License.
#
-#
-# Common rules for building a TradeFed test XML file for target side tests.
-#
-
-$(call record-module-type,TARGET_TEST_CONFIG)
-
-include $(BUILD_SYSTEM)/test_config_common.mk
+PRODUCT_SOONG_NAMESPACES += device/generic/goldfish # for libwifi-hal-emu
+PRODUCT_SOONG_NAMESPACES += device/generic/goldfish-opengl # for goldfish deps.
diff --git a/target/board/emulator_x86_64_arm64/system_ext.prop b/target/board/emulator_x86_64_arm64/system_ext.prop
new file mode 100644
index 0000000..ed9d173
--- /dev/null
+++ b/target/board/emulator_x86_64_arm64/system_ext.prop
@@ -0,0 +1,5 @@
+#
+# system.prop for generic sdk
+#
+
+rild.libpath=/vendor/lib64/libreference-ril.so
diff --git a/target/board/emulator_x86_arm/BoardConfig.mk b/target/board/emulator_x86_arm/BoardConfig.mk
new file mode 100644
index 0000000..21fdbc8
--- /dev/null
+++ b/target/board/emulator_x86_arm/BoardConfig.mk
@@ -0,0 +1,52 @@
+# Copyright (C) 2020 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.
+#
+
+# x86 emulator specific definitions
+TARGET_CPU_ABI := x86
+TARGET_ARCH := x86
+TARGET_ARCH_VARIANT := x86
+
+TARGET_NATIVE_BRIDGE_ARCH := arm
+TARGET_NATIVE_BRIDGE_ARCH_VARIANT := armv7-a-neon
+TARGET_NATIVE_BRIDGE_CPU_VARIANT := generic
+TARGET_NATIVE_BRIDGE_ABI := armeabi-v7a armeabi
+
+BUILD_BROKEN_DUP_RULES := true
+
+#
+# The inclusion order below is important.
+# The settings in latter makefiles overwrite those in the former.
+#
+include build/make/target/board/BoardConfigMainlineCommon.mk
+include build/make/target/board/BoardConfigEmuCommon.mk
+
+# the settings differ from BoardConfigMainlineCommon.mk
+BOARD_USES_SYSTEM_OTHER_ODEX :=
+
+# Resize to 4G to accommodate ASAN and CTS
+BOARD_USERDATAIMAGE_PARTITION_SIZE := 4294967296
+
+BOARD_SEPOLICY_DIRS += device/generic/goldfish/sepolicy/x86
+
+# Wifi.
+BOARD_WLAN_DEVICE := emulator
+BOARD_HOSTAPD_DRIVER := NL80211
+BOARD_WPA_SUPPLICANT_DRIVER := NL80211
+BOARD_HOSTAPD_PRIVATE_LIB := lib_driver_cmd_simulated
+BOARD_WPA_SUPPLICANT_PRIVATE_LIB := lib_driver_cmd_simulated
+WPA_SUPPLICANT_VERSION := VER_0_8_X
+WIFI_DRIVER_FW_PATH_PARAM := "/dev/null"
+WIFI_DRIVER_FW_PATH_STA := "/dev/null"
+WIFI_DRIVER_FW_PATH_AP := "/dev/null"
diff --git a/core/target_test_config.mk b/target/board/emulator_x86_arm/device.mk
similarity index 70%
copy from core/target_test_config.mk
copy to target/board/emulator_x86_arm/device.mk
index 61f5d2b..af023eb 100644
--- a/core/target_test_config.mk
+++ b/target/board/emulator_x86_arm/device.mk
@@ -1,5 +1,5 @@
#
-# Copyright (C) 2017 The Android Open Source Project
+# Copyright (C) 2020 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.
@@ -14,10 +14,5 @@
# limitations under the License.
#
-#
-# Common rules for building a TradeFed test XML file for target side tests.
-#
-
-$(call record-module-type,TARGET_TEST_CONFIG)
-
-include $(BUILD_SYSTEM)/test_config_common.mk
+PRODUCT_SOONG_NAMESPACES += device/generic/goldfish # for libwifi-hal-emu
+PRODUCT_SOONG_NAMESPACES += device/generic/goldfish-opengl # for goldfish deps.
diff --git a/target/board/emulator_x86_arm/system_ext.prop b/target/board/emulator_x86_arm/system_ext.prop
new file mode 100644
index 0000000..64829f3
--- /dev/null
+++ b/target/board/emulator_x86_arm/system_ext.prop
@@ -0,0 +1,5 @@
+#
+# system.prop for generic sdk
+#
+
+rild.libpath=/vendor/lib/libreference-ril.so
diff --git a/target/board/generic/device.mk b/target/board/generic/device.mk
index 0a32415..cfb15f0 100644
--- a/target/board/generic/device.mk
+++ b/target/board/generic/device.mk
@@ -14,6 +14,9 @@
# limitations under the License.
#
+PRODUCT_SOONG_NAMESPACES += device/generic/goldfish # for libwifi-hal-emu
+PRODUCT_SOONG_NAMESPACES += device/generic/goldfish-opengl # for goldfish deps.
+
# NFC:
# Provide default libnfc-nci.conf file for devices that does not have one in
# vendor/etc because aosp system image (of aosp_$arch products) is going to
diff --git a/target/board/generic_arm64/BoardConfig.mk b/target/board/generic_arm64/BoardConfig.mk
index f5caf70..2963ee4 100644
--- a/target/board/generic_arm64/BoardConfig.mk
+++ b/target/board/generic_arm64/BoardConfig.mk
@@ -23,7 +23,7 @@
TARGET_2ND_CPU_ABI := armeabi-v7a
TARGET_2ND_CPU_ABI2 := armeabi
-ifneq ($(TARGET_BUILD_APPS)$(filter cts sdk vts,$(MAKECMDGOALS)),)
+ifneq ($(TARGET_BUILD_APPS)$(filter cts sdk vts10,$(MAKECMDGOALS)),)
# DO NOT USE
# DO NOT USE
#
@@ -53,12 +53,23 @@
endif
include build/make/target/board/BoardConfigGsiCommon.mk
-include build/make/target/board/BoardConfigEmuCommon.mk
+TARGET_NO_KERNEL := false
+TARGET_NO_VENDOR_BOOT := true
+BOARD_USES_RECOVERY_AS_BOOT := true
+
+BOARD_KERNEL-5.4_BOOTIMAGE_PARTITION_SIZE := 67108864
+BOARD_KERNEL-5.4-GZ_BOOTIMAGE_PARTITION_SIZE := 47185920
+BOARD_KERNEL-5.4-LZ4_BOOTIMAGE_PARTITION_SIZE := 53477376
BOARD_USERDATAIMAGE_PARTITION_SIZE := 576716800
-# Emulator system image is going to be used as GSI and some vendor still hasn't
-# cleaned up all device specific directories under root!
+BOARD_BOOT_HEADER_VERSION := 3
+BOARD_MKBOOTIMG_ARGS += --header_version $(BOARD_BOOT_HEADER_VERSION)
+
+BOARD_KERNEL_BINARIES := kernel-5.4 kernel-5.4-gz kernel-5.4-lz4
+
+# Some vendors still haven't cleaned up all device specific directories under
+# root!
# TODO(b/111434759, b/111287060) SoC specific hacks
BOARD_ROOT_EXTRA_SYMLINKS += /vendor/lib/dsp:/dsp
@@ -68,14 +79,3 @@
# TODO(b/36764215): remove this setting when the generic system image
# no longer has QCOM-specific directories under /.
BOARD_SEPOLICY_DIRS += build/make/target/board/generic_arm64/sepolicy
-
-# Wifi.
-BOARD_WLAN_DEVICE := emulator
-BOARD_HOSTAPD_DRIVER := NL80211
-BOARD_WPA_SUPPLICANT_DRIVER := NL80211
-BOARD_HOSTAPD_PRIVATE_LIB := lib_driver_cmd_simulated
-BOARD_WPA_SUPPLICANT_PRIVATE_LIB := lib_driver_cmd_simulated
-WPA_SUPPLICANT_VERSION := VER_0_8_X
-WIFI_DRIVER_FW_PATH_PARAM := "/dev/null"
-WIFI_DRIVER_FW_PATH_STA := "/dev/null"
-WIFI_DRIVER_FW_PATH_AP := "/dev/null"
diff --git a/target/board/generic_arm64/device.mk b/target/board/generic_arm64/device.mk
index e5d8e61..3b7cd44 100644
--- a/target/board/generic_arm64/device.mk
+++ b/target/board/generic_arm64/device.mk
@@ -14,6 +14,11 @@
# limitations under the License.
#
+PRODUCT_COPY_FILES += \
+ device/google/cuttlefish_kernel/5.4-arm64/kernel-5.4:kernel-5.4 \
+ device/google/cuttlefish_kernel/5.4-arm64/kernel-5.4-gz:kernel-5.4-gz \
+ device/google/cuttlefish_kernel/5.4-arm64/kernel-5.4-lz4:kernel-5.4-lz4
+
# Adjust the Dalvik heap to be appropriate for a tablet.
$(call inherit-product-if-exists, frameworks/base/build/tablet-dalvik-heap.mk)
$(call inherit-product-if-exists, frameworks/native/build/tablet-dalvik-heap.mk)
diff --git a/target/board/generic_arm64_ab/BoardConfig.mk b/target/board/generic_arm64_ab/BoardConfig.mk
new file mode 100644
index 0000000..7c91607
--- /dev/null
+++ b/target/board/generic_arm64_ab/BoardConfig.mk
@@ -0,0 +1,39 @@
+#
+# Copyright (C) 2017 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.
+#
+
+include build/make/target/board/BoardConfigGsiCommon.mk
+
+TARGET_ARCH := arm64
+TARGET_ARCH_VARIANT := armv8-a
+TARGET_CPU_ABI := arm64-v8a
+TARGET_CPU_ABI2 :=
+TARGET_CPU_VARIANT := generic
+
+TARGET_2ND_ARCH := arm
+TARGET_2ND_ARCH_VARIANT := armv8-a
+TARGET_2ND_CPU_ABI := armeabi-v7a
+TARGET_2ND_CPU_ABI2 := armeabi
+TARGET_2ND_CPU_VARIANT := generic
+
+# TODO(jiyong) These might be SoC specific.
+BOARD_ROOT_EXTRA_FOLDERS += firmware firmware/radio persist
+BOARD_ROOT_EXTRA_SYMLINKS += /vendor/lib/dsp:/dsp
+BOARD_ROOT_EXTRA_SYMLINKS += /vendor/firmware_mnt/image:/firmware/image
+BOARD_ROOT_EXTRA_SYMLINKS += /vendor/firmware_mnt/verinfo:/firmware/verinfo
+
+# TODO(b/36764215): remove this setting when the generic system image
+# no longer has QCOM-specific directories under /.
+BOARD_SEPOLICY_DIRS += build/make/target/board/generic_arm64/sepolicy
diff --git a/target/board/generic_arm_ab/BoardConfig.mk b/target/board/generic_arm_ab/BoardConfig.mk
new file mode 100644
index 0000000..21b763c
--- /dev/null
+++ b/target/board/generic_arm_ab/BoardConfig.mk
@@ -0,0 +1,36 @@
+#
+# Copyright (C) 2017 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.
+#
+
+include build/make/target/board/BoardConfigGsiCommon.mk
+
+TARGET_ARCH := arm
+TARGET_ARCH_VARIANT := armv7-a-neon
+TARGET_CPU_ABI := armeabi-v7a
+TARGET_CPU_ABI2 := armeabi
+TARGET_CPU_VARIANT := generic
+
+# Legacy GSI keeps 32 bits binder for 32 bits CPU Arch
+TARGET_USES_64_BIT_BINDER := false
+
+# TODO(jiyong) These might be SoC specific.
+BOARD_ROOT_EXTRA_FOLDERS += firmware firmware/radio persist
+BOARD_ROOT_EXTRA_SYMLINKS += /vendor/lib/dsp:/dsp
+BOARD_ROOT_EXTRA_SYMLINKS += /vendor/firmware_mnt/image:/firmware/image
+BOARD_ROOT_EXTRA_SYMLINKS += /vendor/firmware_mnt/verinfo:/firmware/verinfo
+
+# TODO(b/36764215): remove this setting when the generic system image
+# no longer has QCOM-specific directories under /.
+BOARD_SEPOLICY_DIRS += build/make/target/board/generic_arm64/sepolicy
diff --git a/target/board/generic_x86/device.mk b/target/board/generic_x86/device.mk
index bbab2b4..2b10a3d 100644
--- a/target/board/generic_x86/device.mk
+++ b/target/board/generic_x86/device.mk
@@ -14,6 +14,9 @@
# limitations under the License.
#
+PRODUCT_SOONG_NAMESPACES += device/generic/goldfish # for libwifi-hal-emu
+PRODUCT_SOONG_NAMESPACES += device/generic/goldfish-opengl # for goldfish deps.
+
ifdef NET_ETH0_STARTONBOOT
PRODUCT_PROPERTY_OVERRIDES += net.eth0.startonboot=1
endif
diff --git a/target/board/generic_x86_64/device.mk b/target/board/generic_x86_64/device.mk
index bbab2b4..2b10a3d 100755
--- a/target/board/generic_x86_64/device.mk
+++ b/target/board/generic_x86_64/device.mk
@@ -14,6 +14,9 @@
# limitations under the License.
#
+PRODUCT_SOONG_NAMESPACES += device/generic/goldfish # for libwifi-hal-emu
+PRODUCT_SOONG_NAMESPACES += device/generic/goldfish-opengl # for goldfish deps.
+
ifdef NET_ETH0_STARTONBOOT
PRODUCT_PROPERTY_OVERRIDES += net.eth0.startonboot=1
endif
diff --git a/core/host_test_config.mk b/target/board/generic_x86_64_ab/BoardConfig.mk
similarity index 66%
copy from core/host_test_config.mk
copy to target/board/generic_x86_64_ab/BoardConfig.mk
index b9975e5..1dd5e48 100644
--- a/core/host_test_config.mk
+++ b/target/board/generic_x86_64_ab/BoardConfig.mk
@@ -1,5 +1,5 @@
#
-# Copyright (C) 2017 The Android Open Source Project
+# Copyright (C) 2017 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.
@@ -14,12 +14,12 @@
# limitations under the License.
#
-#
-# Common rules for building a TradeFed test XML file for host side tests.
-#
+include build/make/target/board/BoardConfigGsiCommon.mk
-$(call record-module-type,HOST_TEST_CONFIG)
+TARGET_CPU_ABI := x86_64
+TARGET_ARCH := x86_64
+TARGET_ARCH_VARIANT := x86_64
-LOCAL_IS_HOST_MODULE := true
-
-include $(BUILD_SYSTEM)/test_config_common.mk
+TARGET_2ND_CPU_ABI := x86
+TARGET_2ND_ARCH := x86
+TARGET_2ND_ARCH_VARIANT := x86_64
diff --git a/target/board/generic_x86_64_arm64/device.mk b/target/board/generic_x86_64_arm64/device.mk
index fa1eb67..76242c9 100755
--- a/target/board/generic_x86_64_arm64/device.mk
+++ b/target/board/generic_x86_64_arm64/device.mk
@@ -13,3 +13,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
+
+PRODUCT_SOONG_NAMESPACES += device/generic/goldfish # for libwifi-hal-emu
+PRODUCT_SOONG_NAMESPACES += device/generic/goldfish-opengl # for goldfish deps.
diff --git a/core/host_test_config.mk b/target/board/generic_x86_ab/BoardConfig.mk
similarity index 67%
rename from core/host_test_config.mk
rename to target/board/generic_x86_ab/BoardConfig.mk
index b9975e5..53acffd 100644
--- a/core/host_test_config.mk
+++ b/target/board/generic_x86_ab/BoardConfig.mk
@@ -1,5 +1,5 @@
#
-# Copyright (C) 2017 The Android Open Source Project
+# Copyright (C) 2017 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.
@@ -14,12 +14,11 @@
# limitations under the License.
#
-#
-# Common rules for building a TradeFed test XML file for host side tests.
-#
+include build/make/target/board/BoardConfigGsiCommon.mk
-$(call record-module-type,HOST_TEST_CONFIG)
+TARGET_CPU_ABI := x86
+TARGET_ARCH := x86
+TARGET_ARCH_VARIANT := x86
-LOCAL_IS_HOST_MODULE := true
-
-include $(BUILD_SYSTEM)/test_config_common.mk
+# Legacy GSI keeps 32 bits binder for 32 bits CPU Arch
+TARGET_USES_64_BIT_BINDER := false
diff --git a/target/board/generic_x86_arm/device.mk b/target/board/generic_x86_arm/device.mk
index fa1eb67..76242c9 100644
--- a/target/board/generic_x86_arm/device.mk
+++ b/target/board/generic_x86_arm/device.mk
@@ -13,3 +13,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
+
+PRODUCT_SOONG_NAMESPACES += device/generic/goldfish # for libwifi-hal-emu
+PRODUCT_SOONG_NAMESPACES += device/generic/goldfish-opengl # for goldfish deps.
diff --git a/target/board/mainline_arm64/BoardConfig.mk b/target/board/mainline_arm64/BoardConfig.mk
index 70505f4..a09960f 100644
--- a/target/board/mainline_arm64/BoardConfig.mk
+++ b/target/board/mainline_arm64/BoardConfig.mk
@@ -26,11 +26,17 @@
include build/make/target/board/BoardConfigMainlineCommon.mk
+# TODO(b/143732851): Remove this after replacing /persit with
+# /mnt/vendor/persist
+BOARD_ROOT_EXTRA_SYMLINKS += /mnt/vendor/persist:/persist
+BOARD_SEPOLICY_DIRS += build/make/target/board/mainline_arm64/sepolicy
+
TARGET_NO_KERNEL := true
# Build generic A/B format system-only OTA.
AB_OTA_UPDATER := true
AB_OTA_PARTITIONS := system
-BOARD_VENDORIMAGE_FILE_SYSTEM_TYPE := ext4
BOARD_PRODUCTIMAGE_FILE_SYSTEM_TYPE := ext4
+BOARD_SYSTEM_EXTIMAGE_FILE_SYSTEM_TYPE := ext4
+BOARD_VENDORIMAGE_FILE_SYSTEM_TYPE := ext4
diff --git a/target/board/mainline_arm64/sepolicy/OWNERS b/target/board/mainline_arm64/sepolicy/OWNERS
new file mode 100644
index 0000000..ff29677
--- /dev/null
+++ b/target/board/mainline_arm64/sepolicy/OWNERS
@@ -0,0 +1,8 @@
+alanstokes@google.com
+bowgotsai@google.com
+jbires@google.com
+jeffv@google.com
+jgalenson@google.com
+sspatil@google.com
+tomcherry@google.com
+trong@google.com
diff --git a/target/board/mainline_arm64/sepolicy/file.te b/target/board/mainline_arm64/sepolicy/file.te
new file mode 100644
index 0000000..36baabd
--- /dev/null
+++ b/target/board/mainline_arm64/sepolicy/file.te
@@ -0,0 +1,3 @@
+# TODO(b/143732851): remove this file when the mainline system image
+# no longer need these SoC specific directory
+type persist_file, file_type;
diff --git a/target/board/mainline_arm64/sepolicy/file_contexts b/target/board/mainline_arm64/sepolicy/file_contexts
new file mode 100644
index 0000000..4d02edc
--- /dev/null
+++ b/target/board/mainline_arm64/sepolicy/file_contexts
@@ -0,0 +1,5 @@
+# TODO(b/143732851): remove this file when the mainline system image
+# no longer need these SoC specific directory
+
+# /persist
+/persist(/.*)? u:object_r:persist_file:s0
diff --git a/target/board/mainline_x86/BoardConfig.mk b/target/board/mainline_x86/BoardConfig.mk
new file mode 100644
index 0000000..4dda058b
--- /dev/null
+++ b/target/board/mainline_x86/BoardConfig.mk
@@ -0,0 +1,31 @@
+#
+# Copyright (C) 2019 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.
+#
+
+TARGET_ARCH := x86
+TARGET_ARCH_VARIANT := x86
+TARGET_CPU_ABI := x86
+
+include build/make/target/board/BoardConfigMainlineCommon.mk
+
+TARGET_NO_KERNEL := true
+
+# Build generic A/B format system-only OTA.
+AB_OTA_UPDATER := true
+AB_OTA_PARTITIONS := system
+
+BOARD_PRODUCTIMAGE_FILE_SYSTEM_TYPE := ext4
+BOARD_SYSTEM_EXTIMAGE_FILE_SYSTEM_TYPE := ext4
+BOARD_VENDORIMAGE_FILE_SYSTEM_TYPE := ext4
diff --git a/target/board/mainline_x86_64/BoardConfig.mk b/target/board/mainline_x86_64/BoardConfig.mk
new file mode 100644
index 0000000..118fda6
--- /dev/null
+++ b/target/board/mainline_x86_64/BoardConfig.mk
@@ -0,0 +1,35 @@
+#
+# Copyright (C) 2019 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.
+#
+
+TARGET_ARCH := x86_64
+TARGET_ARCH_VARIANT := x86_64
+TARGET_CPU_ABI := x86_64
+
+TARGET_2ND_ARCH := x86
+TARGET_2ND_ARCH_VARIANT := x86_64
+TARGET_2ND_CPU_ABI := x86
+
+include build/make/target/board/BoardConfigMainlineCommon.mk
+
+TARGET_NO_KERNEL := true
+
+# Build generic A/B format system-only OTA.
+AB_OTA_UPDATER := true
+AB_OTA_PARTITIONS := system
+
+BOARD_PRODUCTIMAGE_FILE_SYSTEM_TYPE := ext4
+BOARD_SYSTEM_EXTIMAGE_FILE_SYSTEM_TYPE := ext4
+BOARD_VENDORIMAGE_FILE_SYSTEM_TYPE := ext4
diff --git a/target/board/mainline_x86_arm/BoardConfig.mk b/target/board/mainline_x86_arm/BoardConfig.mk
new file mode 100644
index 0000000..d775a77
--- /dev/null
+++ b/target/board/mainline_x86_arm/BoardConfig.mk
@@ -0,0 +1,36 @@
+#
+# Copyright (C) 2019 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.
+#
+
+TARGET_ARCH := x86
+TARGET_ARCH_VARIANT := x86
+TARGET_CPU_ABI := x86
+
+TARGET_NATIVE_BRIDGE_ARCH := arm
+TARGET_NATIVE_BRIDGE_ARCH_VARIANT := armv7-a-neon
+TARGET_NATIVE_BRIDGE_CPU_VARIANT := generic
+TARGET_NATIVE_BRIDGE_ABI := armeabi-v7a armeabi
+
+include build/make/target/board/BoardConfigMainlineCommon.mk
+
+TARGET_NO_KERNEL := true
+
+# Build generic A/B format system-only OTA.
+AB_OTA_UPDATER := true
+AB_OTA_PARTITIONS := system
+
+BOARD_PRODUCTIMAGE_FILE_SYSTEM_TYPE := ext4
+BOARD_SYSTEM_EXTIMAGE_FILE_SYSTEM_TYPE := ext4
+BOARD_VENDORIMAGE_FILE_SYSTEM_TYPE := ext4
diff --git a/target/product/AndroidProducts.mk b/target/product/AndroidProducts.mk
index 174916d..3949737 100644
--- a/target/product/AndroidProducts.mk
+++ b/target/product/AndroidProducts.mk
@@ -43,9 +43,13 @@
else
PRODUCT_MAKEFILES := \
+ $(LOCAL_DIR)/aosp_arm64_ab.mk \
$(LOCAL_DIR)/aosp_arm64.mk \
+ $(LOCAL_DIR)/aosp_arm_ab.mk \
$(LOCAL_DIR)/aosp_arm.mk \
+ $(LOCAL_DIR)/aosp_x86_64_ab.mk \
$(LOCAL_DIR)/aosp_x86_64.mk \
+ $(LOCAL_DIR)/aosp_x86_ab.mk \
$(LOCAL_DIR)/aosp_x86_arm.mk \
$(LOCAL_DIR)/aosp_x86.mk \
$(LOCAL_DIR)/full.mk \
@@ -53,8 +57,10 @@
$(LOCAL_DIR)/generic.mk \
$(LOCAL_DIR)/generic_x86.mk \
$(LOCAL_DIR)/gsi_arm64.mk \
- $(LOCAL_DIR)/mainline_arm64.mk \
$(LOCAL_DIR)/mainline_system_arm64.mk \
+ $(LOCAL_DIR)/mainline_system_x86.mk \
+ $(LOCAL_DIR)/mainline_system_x86_arm.mk \
+ $(LOCAL_DIR)/mainline_system_x86_64.mk \
$(LOCAL_DIR)/sdk_arm64.mk \
$(LOCAL_DIR)/sdk.mk \
$(LOCAL_DIR)/sdk_phone_arm64.mk \
diff --git a/target/product/aosp_arm.mk b/target/product/aosp_arm.mk
index 2ff2b20..0607717 100644
--- a/target/product/aosp_arm.mk
+++ b/target/product/aosp_arm.mk
@@ -36,6 +36,12 @@
PRODUCT_ARTIFACT_PATH_REQUIREMENT_WHITELIST += \
#
+# All components inherited here go to system_ext image
+#
+$(call inherit-product, $(SRC_TARGET_DIR)/product/handheld_system_ext.mk)
+$(call inherit-product, $(SRC_TARGET_DIR)/product/telephony_system_ext.mk)
+
+#
# All components inherited here go to product image
#
$(call inherit-product, $(SRC_TARGET_DIR)/product/aosp_product.mk)
diff --git a/target/product/aosp_arm64.mk b/target/product/aosp_arm64.mk
index cc4785a..3254ccf 100644
--- a/target/product/aosp_arm64.mk
+++ b/target/product/aosp_arm64.mk
@@ -14,8 +14,6 @@
# limitations under the License.
#
-PRODUCT_USE_DYNAMIC_PARTITIONS := true
-
# The system image of aosp_arm64-userdebug is a GSI for the devices with:
# - ARM 64 bits user space
# - 64 bits binder interface
@@ -39,8 +37,11 @@
PRODUCT_ENFORCE_ARTIFACT_PATH_REQUIREMENTS := relaxed
endif
-PRODUCT_ARTIFACT_PATH_REQUIREMENT_WHITELIST += \
- root/init.zygote64_32.rc \
+#
+# All components inherited here go to system_ext image
+#
+$(call inherit-product, $(SRC_TARGET_DIR)/product/handheld_system_ext.mk)
+$(call inherit-product, $(SRC_TARGET_DIR)/product/telephony_system_ext.mk)
#
# All components inherited here go to product image
@@ -48,9 +49,8 @@
$(call inherit-product, $(SRC_TARGET_DIR)/product/aosp_product.mk)
#
-# All components inherited here go to vendor image
+# All components inherited here go to vendor or vendor_boot image
#
-$(call inherit-product-if-exists, device/generic/goldfish/arm64-vendor.mk)
$(call inherit-product, $(SRC_TARGET_DIR)/product/emulator_vendor.mk)
$(call inherit-product, $(SRC_TARGET_DIR)/board/generic_arm64/device.mk)
diff --git a/target/product/aosp_arm64_ab.mk b/target/product/aosp_arm64_ab.mk
new file mode 100644
index 0000000..75b9cc4
--- /dev/null
+++ b/target/product/aosp_arm64_ab.mk
@@ -0,0 +1,58 @@
+#
+# Copyright (C) 2017 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.
+#
+
+# PRODUCT_PROPERTY_OVERRIDES cannot be used here because sysprops will be at
+# /vendor/[build|default].prop when build split is on. In order to have sysprops
+# on the generic system image, place them in build/make/target/board/
+# gsi_system.prop.
+
+# aosp_arm64_ab-userdebug is a Legacy GSI for the devices with:
+# - ARM 64 bits user space
+# - 64 bits binder interface
+# - system-as-root
+
+#
+# All components inherited here go to system image
+# (The system image of Legacy GSI is not CSI)
+#
+$(call inherit-product, $(SRC_TARGET_DIR)/product/core_64_bit.mk)
+$(call inherit-product, $(SRC_TARGET_DIR)/product/mainline_system.mk)
+
+# Enable mainline checking for excat this product name
+ifeq (aosp_arm64_ab,$(TARGET_PRODUCT))
+PRODUCT_ENFORCE_ARTIFACT_PATH_REQUIREMENTS := relaxed
+endif
+
+#
+# All components inherited here go to system_ext image
+#
+$(call inherit-product, $(SRC_TARGET_DIR)/product/handheld_system_ext.mk)
+$(call inherit-product, $(SRC_TARGET_DIR)/product/telephony_system_ext.mk)
+
+#
+# All components inherited here go to product image
+#
+$(call inherit-product, $(SRC_TARGET_DIR)/product/aosp_product.mk)
+
+#
+# Special settings for GSI releasing
+#
+$(call inherit-product, $(SRC_TARGET_DIR)/product/legacy_gsi_release.mk)
+
+PRODUCT_NAME := aosp_arm64_ab
+PRODUCT_DEVICE := generic_arm64_ab
+PRODUCT_BRAND := Android
+PRODUCT_MODEL := AOSP on ARM64
diff --git a/target/product/aosp_arm_ab.mk b/target/product/aosp_arm_ab.mk
new file mode 100644
index 0000000..80ebdb1
--- /dev/null
+++ b/target/product/aosp_arm_ab.mk
@@ -0,0 +1,57 @@
+#
+# Copyright (C) 2017 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.
+#
+
+# PRODUCT_PROPERTY_OVERRIDES cannot be used here because sysprops will be at
+# /vendor/[build|default].prop when build split is on. In order to have sysprops
+# on the generic system image, place them in build/make/target/board/
+# gsi_system.prop.
+
+# aosp_arm_ab-userdebug is a Legacy GSI for the devices with:
+# - ARM 32 bits user space
+# - 32 bits binder interface
+# - system-as-root
+
+#
+# All components inherited here go to system image
+# (The system image of Legacy GSI is not CSI)
+#
+$(call inherit-product, $(SRC_TARGET_DIR)/product/mainline_system.mk)
+
+# Enable mainline checking for excat this product name
+ifeq (aosp_arm_ab,$(TARGET_PRODUCT))
+PRODUCT_ENFORCE_ARTIFACT_PATH_REQUIREMENTS := relaxed
+endif
+
+#
+# All components inherited here go to system_ext image
+#
+$(call inherit-product, $(SRC_TARGET_DIR)/product/handheld_system_ext.mk)
+$(call inherit-product, $(SRC_TARGET_DIR)/product/telephony_system_ext.mk)
+
+#
+# All components inherited here go to product image
+#
+$(call inherit-product, $(SRC_TARGET_DIR)/product/aosp_product.mk)
+
+#
+# Special settings for GSI releasing
+#
+$(call inherit-product, $(SRC_TARGET_DIR)/product/legacy_gsi_release.mk)
+
+PRODUCT_NAME := aosp_arm_ab
+PRODUCT_DEVICE := generic_arm_ab
+PRODUCT_BRAND := Android
+PRODUCT_MODEL := AOSP on ARM32
diff --git a/target/product/aosp_product.mk b/target/product/aosp_product.mk
index 8c87983..9b9ccb1 100644
--- a/target/product/aosp_product.mk
+++ b/target/product/aosp_product.mk
@@ -21,21 +21,6 @@
# Default AOSP sounds
$(call inherit-product-if-exists, frameworks/base/data/sounds/AllAudio.mk)
-# TODO(b/133643923): Clean up the mainline whitelist
-PRODUCT_ARTIFACT_PATH_REQUIREMENT_WHITELIST += \
- system/app/messaging/messaging.apk \
- system/app/messaging/oat/% \
- system/app/WAPPushManager/WAPPushManager.apk \
- system/app/WAPPushManager/oat/% \
- system/bin/healthd \
- system/etc/init/healthd.rc \
- system/etc/vintf/manifest/manifest_healthd.xml \
- system/lib/libframesequence.so \
- system/lib/libgiftranscode.so \
- system/lib64/libframesequence.so \
- system/lib64/libgiftranscode.so \
-
-
# Additional settings used in all AOSP builds
PRODUCT_PRODUCT_PROPERTIES += \
ro.config.ringtone=Ring_Synth_04.ogg \
@@ -46,7 +31,6 @@
PRODUCT_PACKAGES += \
messaging \
PhotoTable \
- WAPPushManager \
WallpaperPicker \
# Telephony:
diff --git a/target/product/aosp_x86.mk b/target/product/aosp_x86.mk
index e557aa8..51b5daf 100644
--- a/target/product/aosp_x86.mk
+++ b/target/product/aosp_x86.mk
@@ -34,6 +34,12 @@
endif
#
+# All components inherited here go to system_ext image
+#
+$(call inherit-product, $(SRC_TARGET_DIR)/product/handheld_system_ext.mk)
+$(call inherit-product, $(SRC_TARGET_DIR)/product/telephony_system_ext.mk)
+
+#
# All components inherited here go to product image
#
$(call inherit-product, $(SRC_TARGET_DIR)/product/aosp_product.mk)
diff --git a/target/product/aosp_x86_64.mk b/target/product/aosp_x86_64.mk
index a471702..9b26716 100644
--- a/target/product/aosp_x86_64.mk
+++ b/target/product/aosp_x86_64.mk
@@ -39,8 +39,11 @@
PRODUCT_ENFORCE_ARTIFACT_PATH_REQUIREMENTS := relaxed
endif
-PRODUCT_ARTIFACT_PATH_REQUIREMENT_WHITELIST += \
- root/init.zygote64_32.rc \
+#
+# All components inherited here go to system_ext image
+#
+$(call inherit-product, $(SRC_TARGET_DIR)/product/handheld_system_ext.mk)
+$(call inherit-product, $(SRC_TARGET_DIR)/product/telephony_system_ext.mk)
#
# All components inherited here go to product image
diff --git a/target/product/aosp_x86_64_ab.mk b/target/product/aosp_x86_64_ab.mk
new file mode 100644
index 0000000..9d23fc7
--- /dev/null
+++ b/target/product/aosp_x86_64_ab.mk
@@ -0,0 +1,58 @@
+#
+# Copyright (C) 2017 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.
+#
+
+# PRODUCT_PROPERTY_OVERRIDES cannot be used here because sysprops will be at
+# /vendor/[build|default].prop when build split is on. In order to have sysprops
+# on the generic system image, place them in build/make/target/board/
+# gsi_system.prop.
+
+# aosp_x86_64_ab-userdebug is a Legacy GSI for the devices with:
+# - x86 64 bits user space
+# - 64 bits binder interface
+# - system-as-root
+
+#
+# All components inherited here go to system image
+# (The system image of Legacy GSI is not CSI)
+#
+$(call inherit-product, $(SRC_TARGET_DIR)/product/core_64_bit.mk)
+$(call inherit-product, $(SRC_TARGET_DIR)/product/mainline_system.mk)
+
+# Enable mainline checking for excat this product name
+ifeq (aosp_x86_64_ab,$(TARGET_PRODUCT))
+PRODUCT_ENFORCE_ARTIFACT_PATH_REQUIREMENTS := relaxed
+endif
+
+#
+# All components inherited here go to system_ext image
+#
+$(call inherit-product, $(SRC_TARGET_DIR)/product/handheld_system_ext.mk)
+$(call inherit-product, $(SRC_TARGET_DIR)/product/telephony_system_ext.mk)
+
+#
+# All components inherited here go to product image
+#
+$(call inherit-product, $(SRC_TARGET_DIR)/product/aosp_product.mk)
+
+#
+# Special settings for GSI releasing
+#
+$(call inherit-product, $(SRC_TARGET_DIR)/product/legacy_gsi_release.mk)
+
+PRODUCT_NAME := aosp_x86_64_ab
+PRODUCT_DEVICE := generic_x86_64_ab
+PRODUCT_BRAND := Android
+PRODUCT_MODEL := AOSP on x86_64
diff --git a/target/product/aosp_x86_ab.mk b/target/product/aosp_x86_ab.mk
new file mode 100644
index 0000000..6b6a4c6
--- /dev/null
+++ b/target/product/aosp_x86_ab.mk
@@ -0,0 +1,58 @@
+#
+# Copyright (C) 2017 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.
+#
+
+# PRODUCT_PROPERTY_OVERRIDES cannot be used here because sysprops will be at
+# /vendor/[build|default].prop when build split is on. In order to have sysprops
+# on the generic system image, place them in build/make/target/board/
+# gsi_system.prop.
+
+# aosp_x86_ab-userdebug is a Legacy GSI for the devices with:
+# - x86 32 bits user space
+# - 32 bits binder interface
+# - system-as-root
+
+#
+# All components inherited here go to system image
+# (The system image of Legacy GSI is not CSI)
+#
+$(call inherit-product, $(SRC_TARGET_DIR)/product/core_64_bit.mk)
+$(call inherit-product, $(SRC_TARGET_DIR)/product/mainline_system.mk)
+
+# Enable mainline checking for excat this product name
+ifeq (aosp_x86_ab,$(TARGET_PRODUCT))
+PRODUCT_ENFORCE_ARTIFACT_PATH_REQUIREMENTS := relaxed
+endif
+
+#
+# All components inherited here go to system_ext image
+#
+$(call inherit-product, $(SRC_TARGET_DIR)/product/handheld_system_ext.mk)
+$(call inherit-product, $(SRC_TARGET_DIR)/product/telephony_system_ext.mk)
+
+#
+# All components inherited here go to product image
+#
+$(call inherit-product, $(SRC_TARGET_DIR)/product/aosp_product.mk)
+
+#
+# Special settings for GSI releasing
+#
+$(call inherit-product, $(SRC_TARGET_DIR)/product/legacy_gsi_release.mk)
+
+PRODUCT_NAME := aosp_x86_ab
+PRODUCT_DEVICE := generic_x86_ab
+PRODUCT_BRAND := Android
+PRODUCT_MODEL := AOSP on x86
diff --git a/target/product/aosp_x86_arm.mk b/target/product/aosp_x86_arm.mk
index c0f8f8a..7b9b89c 100644
--- a/target/product/aosp_x86_arm.mk
+++ b/target/product/aosp_x86_arm.mk
@@ -32,6 +32,12 @@
system/system_ext/%
#
+# All components inherited here go to system_ext image
+#
+$(call inherit-product, $(SRC_TARGET_DIR)/product/handheld_system_ext.mk)
+$(call inherit-product, $(SRC_TARGET_DIR)/product/telephony_system_ext.mk)
+
+#
# All components inherited here go to product image
#
$(call inherit-product, $(SRC_TARGET_DIR)/product/aosp_product.mk)
diff --git a/target/product/base.mk b/target/product/base.mk
index 804a2ee..d3250d4 100644
--- a/target/product/base.mk
+++ b/target/product/base.mk
@@ -17,5 +17,6 @@
# This makefile is suitable to inherit by products that don't need to be split
# up by partition.
$(call inherit-product, $(SRC_TARGET_DIR)/product/base_system.mk)
+$(call inherit-product, $(SRC_TARGET_DIR)/product/base_system_ext.mk)
$(call inherit-product, $(SRC_TARGET_DIR)/product/base_vendor.mk)
$(call inherit-product, $(SRC_TARGET_DIR)/product/base_product.mk)
diff --git a/target/product/base_product.mk b/target/product/base_product.mk
index 749d2c2..2ed550c 100644
--- a/target/product/base_product.mk
+++ b/target/product/base_product.mk
@@ -17,7 +17,6 @@
# Base modules and settings for the product partition.
PRODUCT_PACKAGES += \
group_product \
- healthd \
ModuleMetadata \
passwd_product \
product_compatibility_matrix.xml \
diff --git a/target/product/base_system.mk b/target/product/base_system.mk
index 4e33d23..9e82048 100644
--- a/target/product/base_system.mk
+++ b/target/product/base_system.mk
@@ -16,8 +16,7 @@
# Base modules and settings for the system partition.
PRODUCT_PACKAGES += \
- abb \
- adbd \
+ adbd_system_api \
am \
android.hidl.allocator@1.0-service \
android.hidl.base-V1.0-java \
@@ -28,8 +27,8 @@
android.test.base \
android.test.mock \
android.test.runner \
+ ANGLE \
apexd \
- applypatch \
appops \
app_process \
appwidget \
@@ -42,6 +41,7 @@
bmgr \
bootanimation \
bootstat \
+ boringssl_self_test \
bpfloader \
bu \
bugreport \
@@ -49,19 +49,22 @@
cgroups.json \
charger \
cmd \
+ com.android.adbd \
+ com.android.apex.cts.shim.v1 \
com.android.conscrypt \
+ com.android.cronet \
com.android.i18n \
+ com.android.ipsec \
com.android.location.provider \
com.android.media \
com.android.media.swcodec \
com.android.resolv \
com.android.neuralnetworks \
+ com.android.sdkext \
+ com.android.tethering \
com.android.tzdata \
ContactsProvider \
content \
- crash_dump \
- CtsShimPrebuilt \
- CtsShimPrivPrebuilt \
debuggerd\
device_config \
dmctl \
@@ -75,10 +78,11 @@
ExtServices \
ExtShared \
flags_health_check \
- framework \
+ framework-minus-apex \
framework-res \
framework-sysconfig.xml \
fsck_msdos \
+ fsverity-release-cert-der \
fs_config_files_system \
fs_config_dirs_system \
group_system \
@@ -99,18 +103,15 @@
incidentd \
incident_helper \
init.environ.rc \
- init.rc \
init_system \
input \
installd \
iorapd \
ip \
- ip6tables \
iptables \
ip-up-vpn \
javax.obex \
keystore \
- ld.config.txt \
ld.mc \
libaaudio \
libamidi \
@@ -124,14 +125,14 @@
libbinder_ndk \
libc.bootstrap \
libcamera2ndk \
- libcamera_client \
- libcameraservice \
libcutils \
libdl.bootstrap \
+ libdl_android.bootstrap \
libdrmframework \
libdrmframework_jni \
libEGL \
libETC1 \
+ libfdtrack \
libFFTEm \
libfilterfw \
libgatekeeper \
@@ -174,8 +175,6 @@
libspeexresampler \
libsqlite \
libstagefright \
- libstagefright_amrnb_common \
- libstagefright_enc_common \
libstagefright_foundation \
libstagefright_omx \
libstdc++ \
@@ -210,7 +209,7 @@
mtpd \
ndc \
netd \
- NetworkStack \
+ NetworkStackNext \
org.apache.http.legacy \
otacerts \
PackageInstaller \
@@ -313,29 +312,29 @@
tz_version_host \
tz_version_host_tzdata_apex \
-ifeq ($(TARGET_CORE_JARS),)
-$(error TARGET_CORE_JARS is empty; cannot initialize PRODUCT_BOOT_JARS variable)
+ifeq ($(ART_APEX_JARS),)
+$(error ART_APEX_JARS is empty; cannot initialize PRODUCT_BOOT_JARS variable)
endif
# The order matters for runtime class lookup performance.
PRODUCT_BOOT_JARS := \
- $(TARGET_CORE_JARS) \
- framework \
+ $(ART_APEX_JARS) \
+ framework-minus-apex \
ext \
+ com.android.i18n:core-icu4j \
telephony-common \
voip-common \
ims-common \
- updatable-media
-PRODUCT_UPDATABLE_BOOT_MODULES := conscrypt updatable-media
-PRODUCT_UPDATABLE_BOOT_LOCATIONS := \
- /apex/com.android.conscrypt/javalib/conscrypt.jar \
- /apex/com.android.media/javalib/updatable-media.jar
+PRODUCT_UPDATABLE_BOOT_JARS := \
+ com.android.conscrypt:conscrypt \
+ com.android.media:updatable-media \
+ com.android.sdkext:framework-sdkextensions \
+ com.android.tethering:framework-tethering
PRODUCT_COPY_FILES += \
- system/core/rootdir/init.usb.rc:root/init.usb.rc \
- system/core/rootdir/init.usb.configfs.rc:root/init.usb.configfs.rc \
- system/core/rootdir/ueventd.rc:root/ueventd.rc \
+ system/core/rootdir/init.usb.rc:system/etc/init/hw/init.usb.rc \
+ system/core/rootdir/init.usb.configfs.rc:system/etc/init/hw/init.usb.configfs.rc \
system/core/rootdir/etc/hosts:system/etc/hosts
# Add the compatibility library that is needed when android.test.base
@@ -348,7 +347,7 @@
PRODUCT_BOOT_JARS += android.test.base
endif
-PRODUCT_COPY_FILES += system/core/rootdir/init.zygote32.rc:root/init.zygote32.rc
+PRODUCT_COPY_FILES += system/core/rootdir/init.zygote32.rc:system/etc/init/hw/init.zygote32.rc
PRODUCT_DEFAULT_PROPERTY_OVERRIDES += ro.zygote=zygote32
PRODUCT_SYSTEM_DEFAULT_PROPERTIES += debug.atrace.tags.enableflags=0
@@ -366,6 +365,7 @@
logpersist.start \
logtagd.rc \
procrank \
+ remount \
showmap \
sqlite3 \
ss \
diff --git a/core/target_test_config.mk b/target/product/base_system_ext.mk
similarity index 70%
copy from core/target_test_config.mk
copy to target/product/base_system_ext.mk
index 61f5d2b..b67549a 100644
--- a/core/target_test_config.mk
+++ b/target/product/base_system_ext.mk
@@ -1,5 +1,5 @@
#
-# Copyright (C) 2017 The Android Open Source Project
+# Copyright (C) 2019 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.
@@ -14,10 +14,8 @@
# limitations under the License.
#
-#
-# Common rules for building a TradeFed test XML file for target side tests.
-#
-
-$(call record-module-type,TARGET_TEST_CONFIG)
-
-include $(BUILD_SYSTEM)/test_config_common.mk
+# Base modules and settings for the system_ext partition.
+PRODUCT_PACKAGES += \
+ group_system_ext \
+ system_ext_manifest.xml \
+ passwd_system_ext \
diff --git a/target/product/base_vendor.mk b/target/product/base_vendor.mk
index 0b9b9db..b3368d6 100644
--- a/target/product/base_vendor.mk
+++ b/target/product/base_vendor.mk
@@ -41,14 +41,13 @@
# Base modules and settings for the vendor partition.
PRODUCT_PACKAGES += \
android.hardware.cas@1.1-service \
- android.hardware.configstore@1.1-service \
android.hardware.media.omx@1.0-service \
+ boringssl_self_test_vendor \
dumpsys_vendor \
fs_config_files_nonsystem \
fs_config_dirs_nonsystem \
gralloc.default \
group_odm \
- group_system_ext \
group_vendor \
init_vendor \
libbundlewrapper \
@@ -64,13 +63,21 @@
libril \
libvisualizer \
passwd_odm \
- passwd_system_ext \
passwd_vendor \
selinux_policy_nonsystem \
shell_and_utilities_vendor \
vndservice \
+
+# Base module when shipping api level is less than or equal to 29
+PRODUCT_PACKAGES_SHIPPING_API_LEVEL_29 += \
+ android.hardware.configstore@1.1-service \
vndservicemanager \
# VINTF data for vendor image
PRODUCT_PACKAGES += \
- device_compatibility_matrix.xml \
+ vendor_compatibility_matrix.xml \
+
+# Packages to update the recovery partition, which will be installed on
+# /vendor. TODO(b/141648565): Don't install these unless they're needed.
+PRODUCT_PACKAGES += \
+ applypatch
diff --git a/target/product/cfi-common.mk b/target/product/cfi-common.mk
index 7a53bc1..42edd92 100644
--- a/target/product/cfi-common.mk
+++ b/target/product/cfi-common.mk
@@ -17,7 +17,7 @@
# This is a set of common components to enable CFI for (across
# compatible product configs)
PRODUCT_CFI_INCLUDE_PATHS := \
- device/google/cuttlefish_common/guest/libs/wpa_supplicant_8_lib \
+ device/google/cuttlefish/guest/libs/wpa_supplicant_8_lib \
device/google/wahoo/wifi_offload \
external/tinyxml2 \
external/wpa_supplicant_8 \
diff --git a/target/product/core_64_bit.mk b/target/product/core_64_bit.mk
index 76e2a36..f9baa27 100644
--- a/target/product/core_64_bit.mk
+++ b/target/product/core_64_bit.mk
@@ -23,7 +23,7 @@
# for 32-bit only.
# Copy the 64-bit primary, 32-bit secondary zygote startup script
-PRODUCT_COPY_FILES += system/core/rootdir/init.zygote64_32.rc:root/init.zygote64_32.rc
+PRODUCT_COPY_FILES += system/core/rootdir/init.zygote64_32.rc:system/etc/init/hw/init.zygote64_32.rc
# Set the zygote property to select the 64-bit primary, 32-bit secondary script
# This line must be parsed before the one in core_minimal.mk
diff --git a/target/product/core_64_bit_only.mk b/target/product/core_64_bit_only.mk
index 72d30f5..8901a50 100644
--- a/target/product/core_64_bit_only.mk
+++ b/target/product/core_64_bit_only.mk
@@ -20,7 +20,7 @@
# to core_minimal.mk.
# Copy the 64-bit zygote startup script
-PRODUCT_COPY_FILES += system/core/rootdir/init.zygote64.rc:root/init.zygote64.rc
+PRODUCT_COPY_FILES += system/core/rootdir/init.zygote64.rc:system/etc/init/hw/init.zygote64.rc
# Set the zygote property to select the 64-bit script.
# This line must be parsed before the one in core_minimal.mk
diff --git a/target/product/core_minimal.mk b/target/product/core_minimal.mk
index 9718dc6..6fb1173 100644
--- a/target/product/core_minimal.mk
+++ b/target/product/core_minimal.mk
@@ -22,6 +22,7 @@
# handheld_<x>.mk.
$(call inherit-product, $(SRC_TARGET_DIR)/product/media_system.mk)
+$(call inherit-product, $(SRC_TARGET_DIR)/product/media_system_ext.mk)
$(call inherit-product, $(SRC_TARGET_DIR)/product/media_vendor.mk)
$(call inherit-product, $(SRC_TARGET_DIR)/product/media_product.mk)
diff --git a/target/product/developer_gsi_keys.mk b/target/product/developer_gsi_keys.mk
new file mode 100644
index 0000000..a7e3d62
--- /dev/null
+++ b/target/product/developer_gsi_keys.mk
@@ -0,0 +1,31 @@
+#
+# Copyright (C) 2019 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.
+#
+
+# Device makers who are willing to support booting the public Developer-GSI
+# in locked state can add the following line into a device.mk to inherit this
+# makefile. This file will then install the up-to-date GSI public keys into
+# the first-stage ramdisk to pass verified boot.
+#
+# In device/<company>/<board>/device.mk:
+# $(call inherit-product, $(SRC_TARGET_DIR)/product/developer_gsi_keys.mk)
+#
+# Currently, the developer GSI images can be downloaded from the following URL:
+# https://developer.android.com/topic/generic-system-image/releases
+#
+PRODUCT_PACKAGES += \
+ q-developer-gsi.avbpubkey \
+ r-developer-gsi.avbpubkey \
+ s-developer-gsi.avbpubkey \
diff --git a/core/target_test_config.mk b/target/product/emulated_storage.mk
similarity index 69%
copy from core/target_test_config.mk
copy to target/product/emulated_storage.mk
index 61f5d2b..d7cc9ce 100644
--- a/core/target_test_config.mk
+++ b/target/product/emulated_storage.mk
@@ -1,5 +1,5 @@
#
-# Copyright (C) 2017 The Android Open Source Project
+# Copyright (C) 2020 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.
@@ -14,10 +14,8 @@
# limitations under the License.
#
-#
-# Common rules for building a TradeFed test XML file for target side tests.
-#
+PRODUCT_QUOTA_PROJID := 1
+PRODUCT_PROPERTY_OVERRIDES += external_storage.projid.enabled=1
-$(call record-module-type,TARGET_TEST_CONFIG)
-
-include $(BUILD_SYSTEM)/test_config_common.mk
+PRODUCT_FS_CASEFOLD := 1
+PRODUCT_PROPERTY_OVERRIDES += external_storage.casefold.enabled=1
diff --git a/target/product/emulator.mk b/target/product/emulator.mk
index 7ff01cd..52fa1a7 100644
--- a/target/product/emulator.mk
+++ b/target/product/emulator.mk
@@ -20,8 +20,6 @@
# Device modules
PRODUCT_PACKAGES += \
- libGLES_android \
- vintf \
CarrierConfig \
# need this for gles libraries to load properly
diff --git a/target/product/emulator_system.mk b/target/product/emulator_system.mk
new file mode 100644
index 0000000..4b6987c
--- /dev/null
+++ b/target/product/emulator_system.mk
@@ -0,0 +1,24 @@
+#
+# Copyright (C) 2019 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.
+#
+# This file lists emulator experimental modules added to PRODUCT_PACKAGES,
+# only included by targets sdk_phone_x86/64 and sdk_gphone_x86/64
+
+PRODUCT_ARTIFACT_PATH_REQUIREMENT_WHITELIST := \
+ system/lib/libemulator_multidisplay_jni.so \
+ system/lib64/libemulator_multidisplay_jni.so \
+ system/priv-app/MultiDisplayProvider/MultiDisplayProvider.apk \
+
+PRODUCT_PACKAGES += MultiDisplayProvider
diff --git a/target/product/emulator_vendor.mk b/target/product/emulator_vendor.mk
index e67124e..7891a26 100644
--- a/target/product/emulator_vendor.mk
+++ b/target/product/emulator_vendor.mk
@@ -21,21 +21,6 @@
$(call inherit-product, $(SRC_TARGET_DIR)/product/handheld_vendor.mk)
$(call inherit-product, $(SRC_TARGET_DIR)/product/telephony_vendor.mk)
-# TODO(b/123495142): these files should be clean up
-PRODUCT_ARTIFACT_PATH_REQUIREMENT_WHITELIST := \
- system/bin/vintf \
- system/etc/permissions/android.software.verified_boot.xml \
- system/etc/permissions/privapp-permissions-goldfish.xml \
- system/lib/egl/libGLES_android.so \
- system/lib64/egl/libGLES_android.so \
- system/priv-app/SdkSetup/SdkSetup.apk \
- system/priv-app/SdkSetup/oat/% \
-
-# Device modules
-PRODUCT_PACKAGES += \
- libGLES_android \
- vintf \
-
# need this for gles libraries to load properly
# after moving to /vendor/lib/
PRODUCT_PACKAGES += \
diff --git a/target/product/full.mk b/target/product/full.mk
index b356f9d..adb54ab 100644
--- a/target/product/full.mk
+++ b/target/product/full.mk
@@ -19,6 +19,7 @@
# build quite specifically for the emulator, and might not be
# entirely appropriate to inherit from for on-device configurations.
+$(call inherit-product-if-exists, device/generic/goldfish/arm32-vendor.mk)
$(call inherit-product, $(SRC_TARGET_DIR)/product/emulator.mk)
$(call inherit-product, $(SRC_TARGET_DIR)/product/aosp_base_telephony.mk)
$(call inherit-product, $(SRC_TARGET_DIR)/board/generic/device.mk)
diff --git a/target/product/generic.mk b/target/product/generic.mk
index 68130e3..a1acaab 100644
--- a/target/product/generic.mk
+++ b/target/product/generic.mk
@@ -14,6 +14,9 @@
# limitations under the License.
#
+PRODUCT_SOONG_NAMESPACES += device/generic/goldfish # for libwifi-hal-emu
+PRODUCT_SOONG_NAMESPACES += device/generic/goldfish-opengl # for goldfish deps.
+
# This is a generic phone product that isn't specialized for a specific device.
# It includes the base Android platform.
diff --git a/target/product/generic_no_telephony.mk b/target/product/generic_no_telephony.mk
index 324d36f..eb12872 100644
--- a/target/product/generic_no_telephony.mk
+++ b/target/product/generic_no_telephony.mk
@@ -21,6 +21,7 @@
# base_<x>.mk or media_<x>.mk.
$(call inherit-product, $(SRC_TARGET_DIR)/product/handheld_system.mk)
+$(call inherit-product, $(SRC_TARGET_DIR)/product/handheld_system_ext.mk)
$(call inherit-product, $(SRC_TARGET_DIR)/product/handheld_vendor.mk)
$(call inherit-product, $(SRC_TARGET_DIR)/product/handheld_product.mk)
diff --git a/target/product/go_defaults_common.mk b/target/product/go_defaults_common.mk
index d4655f1..3e42b68 100644
--- a/target/product/go_defaults_common.mk
+++ b/target/product/go_defaults_common.mk
@@ -40,6 +40,7 @@
# Do not spin up a separate process for the network stack on go devices, use an in-process APK.
PRODUCT_PACKAGES += InProcessNetworkStack
PRODUCT_PACKAGES += CellBroadcastAppPlatform
+PRODUCT_PACKAGES += com.android.tethering.inprocess
# Strip the local variable table and the local variable type table to reduce
# the size of the system image. This has no bearing on stack traces, but will
diff --git a/target/product/gsi/Android.bp b/target/product/gsi/Android.bp
new file mode 100644
index 0000000..b7ce86e
--- /dev/null
+++ b/target/product/gsi/Android.bp
@@ -0,0 +1,20 @@
+// Copyright 2020 Google Inc. All rights reserved.
+//
+// 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.
+
+filegroup {
+ name: "vndk_lib_lists",
+ srcs: [
+ "*.txt",
+ ],
+}
diff --git a/target/product/gsi/Android.mk b/target/product/gsi/Android.mk
index 1987c9c..c491d4a 100644
--- a/target/product/gsi/Android.mk
+++ b/target/product/gsi/Android.mk
@@ -1,20 +1,8 @@
LOCAL_PATH:= $(call my-dir)
#####################################################################
-# Create the list of vndk libraries from the source code.
-INTERNAL_VNDK_LIB_LIST := $(call intermediates-dir-for,PACKAGING,vndk)/libs.txt
-$(INTERNAL_VNDK_LIB_LIST):
- @echo "Generate: $@"
- @mkdir -p $(dir $@)
- $(hide) echo -n > $@
- $(hide) $(foreach lib, $(filter-out libclang_rt.%,$(LLNDK_LIBRARIES)), \
- echo LLNDK: $(lib).so >> $@;)
- $(hide) $(foreach lib, $(VNDK_SAMEPROCESS_LIBRARIES), \
- echo VNDK-SP: $(lib).so >> $@;)
- $(hide) $(foreach lib, $(filter-out libclang_rt.%,$(VNDK_CORE_LIBRARIES)), \
- echo VNDK-core: $(lib).so >> $@;)
- $(hide) $(foreach lib, $(VNDK_PRIVATE_LIBRARIES), \
- echo VNDK-private: $(lib).so >> $@;)
+# list of vndk libraries from the source code.
+INTERNAL_VNDK_LIB_LIST := $(SOONG_VNDK_LIBRARIES_FILE)
#####################################################################
# This is the up-to-date list of vndk libs.
@@ -49,6 +37,9 @@
check-vndk-list: ;
else ifeq ($(TARGET_SKIP_CURRENT_VNDK),true)
check-vndk-list: ;
+else ifeq ($(BOARD_VNDK_VERSION),)
+# b/143233626 do not check vndk-list when vndk libs are not built
+check-vndk-list: ;
else
check-vndk-list: $(check-vndk-list-timestamp)
ifneq ($(SKIP_ABI_CHECKS),true)
@@ -60,7 +51,7 @@
ifeq (REL,$(PLATFORM_VERSION_CODENAME))
_vndk_check_failure_message += " Changing the VNDK library list is not allowed in API locked branches."
else
-_vndk_check_failure_message += " Run update-vndk-list.sh to update $(LATEST_VNDK_LIB_LIST)"
+_vndk_check_failure_message += " Run \`update-vndk-list.sh\` to update $(LATEST_VNDK_LIB_LIST)"
endif
$(check-vndk-list-timestamp): $(INTERNAL_VNDK_LIB_LIST) $(LATEST_VNDK_LIB_LIST) $(HOST_OUT_EXECUTABLES)/update-vndk-list.sh
@@ -102,8 +93,8 @@
@chmod a+x $@
#####################################################################
-# Check that all ABI reference dumps have corresponding NDK/VNDK
-# libraries.
+# Check that all ABI reference dumps have corresponding
+# NDK/VNDK/PLATFORM libraries.
# $(1): The directory containing ABI dumps.
# Return a list of ABI dump paths ending with .so.lsdump.
@@ -113,25 +104,42 @@
$(call find-files-in-subdirs,$(1),"*.so.lsdump" -and -type f,.)))
endef
+# $(1): A list of tags.
+# $(2): A list of tag:path.
+# Return the file names of the ABI dumps that match the tags.
+define filter-abi-dump-paths
+$(eval tag_patterns := $(foreach tag,$(1),$(tag):%))
+$(notdir $(patsubst $(tag_patterns),%,$(filter $(tag_patterns),$(2))))
+endef
+
VNDK_ABI_DUMP_DIR := prebuilts/abi-dumps/vndk/$(PLATFORM_VNDK_VERSION)
NDK_ABI_DUMP_DIR := prebuilts/abi-dumps/ndk/$(PLATFORM_VNDK_VERSION)
+PLATFORM_ABI_DUMP_DIR := prebuilts/abi-dumps/platform/$(PLATFORM_VNDK_VERSION)
VNDK_ABI_DUMPS := $(call find-abi-dump-paths,$(VNDK_ABI_DUMP_DIR))
NDK_ABI_DUMPS := $(call find-abi-dump-paths,$(NDK_ABI_DUMP_DIR))
+PLATFORM_ABI_DUMPS := $(call find-abi-dump-paths,$(PLATFORM_ABI_DUMP_DIR))
-$(check-vndk-abi-dump-list-timestamp): $(VNDK_ABI_DUMPS) $(NDK_ABI_DUMPS)
+$(check-vndk-abi-dump-list-timestamp): PRIVATE_LSDUMP_PATHS := $(LSDUMP_PATHS)
+$(check-vndk-abi-dump-list-timestamp):
$(eval added_vndk_abi_dumps := $(strip $(sort $(filter-out \
- $(addsuffix .so.lsdump,$(filter-out $(NDK_MIGRATED_LIBS) $(VNDK_PRIVATE_LIBRARIES),$(LLNDK_LIBRARIES) $(VNDK_SAMEPROCESS_LIBRARIES) $(VNDK_CORE_LIBRARIES))), \
+ $(call filter-abi-dump-paths,LLNDK VNDK-SP VNDK-core,$(PRIVATE_LSDUMP_PATHS)), \
$(notdir $(VNDK_ABI_DUMPS))))))
$(if $(added_vndk_abi_dumps), \
- echo -e "Found ABI reference dumps for non-VNDK libraries. Run \`find \$${ANDROID_BUILD_TOP}/$(VNDK_ABI_DUMP_DIR) '(' -name $(subst $(space), -or -name ,$(added_vndk_abi_dumps)) ')' -delete\` to delete the dumps.")
+ echo -e "Found unexpected ABI reference dump files under $(VNDK_ABI_DUMP_DIR). It is caused by mismatch between Android.bp and the dump files. Run \`find \$${ANDROID_BUILD_TOP}/$(VNDK_ABI_DUMP_DIR) '(' -name $(subst $(space), -or -name ,$(added_vndk_abi_dumps)) ')' -delete\` to delete the dump files.")
$(eval added_ndk_abi_dumps := $(strip $(sort $(filter-out \
- $(addsuffix .so.lsdump,$(NDK_MIGRATED_LIBS)), \
+ $(call filter-abi-dump-paths,NDK,$(PRIVATE_LSDUMP_PATHS)), \
$(notdir $(NDK_ABI_DUMPS))))))
$(if $(added_ndk_abi_dumps), \
- echo -e "Found ABI reference dumps for non-NDK libraries. Run \`find \$${ANDROID_BUILD_TOP}/$(NDK_ABI_DUMP_DIR) '(' -name $(subst $(space), -or -name ,$(added_ndk_abi_dumps)) ')' -delete\` to delete the dumps.")
+ echo -e "Found unexpected ABI reference dump files under $(NDK_ABI_DUMP_DIR). It is caused by mismatch between Android.bp and the dump files. Run \`find \$${ANDROID_BUILD_TOP}/$(NDK_ABI_DUMP_DIR) '(' -name $(subst $(space), -or -name ,$(added_ndk_abi_dumps)) ')' -delete\` to delete the dump files.")
- $(if $(added_vndk_abi_dumps)$(added_ndk_abi_dumps),exit 1)
+ $(eval added_platform_abi_dumps := $(strip $(sort $(filter-out \
+ $(call filter-abi-dump-paths,PLATFORM,$(PRIVATE_LSDUMP_PATHS)), \
+ $(notdir $(PLATFORM_ABI_DUMPS))))))
+ $(if $(added_platform_abi_dumps), \
+ echo -e "Found unexpected ABI reference dump files under $(PLATFORM_ABI_DUMP_DIR). It is caused by mismatch between Android.bp and the dump files. Run \`find \$${ANDROID_BUILD_TOP}/$(PLATFORM_ABI_DUMP_DIR) '(' -name $(subst $(space), -or -name ,$(added_platform_abi_dumps)) ')' -delete\` to delete the dump files.")
+
+ $(if $(added_vndk_abi_dumps)$(added_ndk_abi_dumps)$(added_platform_abi_dumps),exit 1)
$(hide) mkdir -p $(dir $@)
$(hide) touch $@
@@ -148,28 +156,25 @@
ifneq ($(TARGET_SKIP_CURRENT_VNDK),true)
LOCAL_REQUIRED_MODULES += \
- llndk.libraries.txt \
- vndksp.libraries.txt \
- vndkcore.libraries.txt \
- vndkprivate.libraries.txt \
+ vndkcorevariant.libraries.txt \
$(addsuffix .vendor,$(VNDK_CORE_LIBRARIES)) \
- $(addsuffix .vendor,$(VNDK_SAMEPROCESS_LIBRARIES))
+ $(addsuffix .vendor,$(VNDK_SAMEPROCESS_LIBRARIES)) \
+ $(VNDK_USING_CORE_VARIANT_LIBRARIES) \
+ com.android.vndk.current
endif
include $(BUILD_PHONY_PACKAGE)
include $(CLEAR_VARS)
-LOCAL_MODULE := vndk_snapshot_package
-_binder32 :=
-ifneq ($(TARGET_USES_64_BIT_BINDER),true)
-ifneq ($(TARGET_IS_64_BIT),true)
-_binder32 := _binder32
+_vndk_versions := $(PRODUCT_EXTRA_VNDK_VERSIONS)
+ifneq ($(BOARD_VNDK_VERSION),current)
+ _vndk_versions += $(BOARD_VNDK_VERSION)
endif
-endif
-LOCAL_REQUIRED_MODULES := \
- $(foreach vndk_ver,$(PRODUCT_EXTRA_VNDK_VERSIONS),vndk_v$(vndk_ver)_$(TARGET_ARCH)$(_binder32))
-_binder32 :=
+LOCAL_MODULE := vndk_apex_snapshot_package
+LOCAL_REQUIRED_MODULES := $(foreach vndk_ver,$(_vndk_versions),com.android.vndk.v$(vndk_ver))
include $(BUILD_PHONY_PACKAGE)
+_vndk_versions :=
+
endif # BOARD_VNDK_VERSION is set
#####################################################################
diff --git a/target/product/gsi/current.txt b/target/product/gsi/current.txt
index 7683389..cd4d750 100644
--- a/target/product/gsi/current.txt
+++ b/target/product/gsi/current.txt
@@ -14,6 +14,7 @@
LLNDK: libmediandk.so
LLNDK: libnativewindow.so
LLNDK: libneuralnetworks.so
+LLNDK: libselinux.so
LLNDK: libsync.so
LLNDK: libvndksupport.so
LLNDK: libvulkan.so
@@ -25,8 +26,8 @@
VNDK-SP: android.hardware.graphics.mapper@3.0.so
VNDK-SP: android.hardware.renderscript@1.0.so
VNDK-SP: android.hidl.memory.token@1.0.so
-VNDK-SP: android.hidl.memory@1.0.so
VNDK-SP: android.hidl.memory@1.0-impl.so
+VNDK-SP: android.hidl.memory@1.0.so
VNDK-SP: android.hidl.safe_union@1.0.so
VNDK-SP: libRSCpuRef.so
VNDK-SP: libRSDriver.so
@@ -34,7 +35,6 @@
VNDK-SP: libbacktrace.so
VNDK-SP: libbase.so
VNDK-SP: libbcinfo.so
-VNDK-SP: libbinderthreadstate.so
VNDK-SP: libblas.so
VNDK-SP: libc++.so
VNDK-SP: libcompiler_rt.so
@@ -42,8 +42,6 @@
VNDK-SP: libhardware.so
VNDK-SP: libhidlbase.so
VNDK-SP: libhidlmemory.so
-VNDK-SP: libhidltransport.so
-VNDK-SP: libhwbinder.so
VNDK-SP: libion.so
VNDK-SP: libjsoncpp.so
VNDK-SP: liblzma.so
@@ -63,12 +61,15 @@
VNDK-core: android.hardware.audio.common@2.0.so
VNDK-core: android.hardware.audio.common@4.0.so
VNDK-core: android.hardware.audio.common@5.0.so
+VNDK-core: android.hardware.audio.common@6.0.so
VNDK-core: android.hardware.audio.effect@2.0.so
VNDK-core: android.hardware.audio.effect@4.0.so
VNDK-core: android.hardware.audio.effect@5.0.so
+VNDK-core: android.hardware.audio.effect@6.0.so
VNDK-core: android.hardware.audio@2.0.so
VNDK-core: android.hardware.audio@4.0.so
VNDK-core: android.hardware.audio@5.0.so
+VNDK-core: android.hardware.audio@6.0.so
VNDK-core: android.hardware.authsecret@1.0.so
VNDK-core: android.hardware.automotive.audiocontrol@1.0.so
VNDK-core: android.hardware.automotive.evs@1.0.so
@@ -78,7 +79,9 @@
VNDK-core: android.hardware.bluetooth.a2dp@1.0.so
VNDK-core: android.hardware.bluetooth.audio@2.0.so
VNDK-core: android.hardware.bluetooth@1.0.so
+VNDK-core: android.hardware.bluetooth@1.1.so
VNDK-core: android.hardware.boot@1.0.so
+VNDK-core: android.hardware.boot@1.1.so
VNDK-core: android.hardware.broadcastradio@1.0.so
VNDK-core: android.hardware.broadcastradio@1.1.so
VNDK-core: android.hardware.broadcastradio@2.0.so
@@ -96,6 +99,7 @@
VNDK-core: android.hardware.cas.native@1.0.so
VNDK-core: android.hardware.cas@1.0.so
VNDK-core: android.hardware.cas@1.1.so
+VNDK-core: android.hardware.cas@1.2.so
VNDK-core: android.hardware.configstore-utils.so
VNDK-core: android.hardware.configstore@1.0.so
VNDK-core: android.hardware.configstore@1.1.so
@@ -106,6 +110,7 @@
VNDK-core: android.hardware.drm@1.1.so
VNDK-core: android.hardware.drm@1.2.so
VNDK-core: android.hardware.dumpstate@1.0.so
+VNDK-core: android.hardware.dumpstate@1.1.so
VNDK-core: android.hardware.fastboot@1.0.so
VNDK-core: android.hardware.gatekeeper@1.0.so
VNDK-core: android.hardware.gnss.measurement_corrections@1.0.so
@@ -123,11 +128,16 @@
VNDK-core: android.hardware.health.storage@1.0.so
VNDK-core: android.hardware.health@1.0.so
VNDK-core: android.hardware.health@2.0.so
+VNDK-core: android.hardware.health@2.1.so
+VNDK-core: android.hardware.identity-V2-ndk_platform.so
VNDK-core: android.hardware.input.classifier@1.0.so
VNDK-core: android.hardware.input.common@1.0.so
VNDK-core: android.hardware.ir@1.0.so
+VNDK-core: android.hardware.keymaster-V2-ndk_platform.so
VNDK-core: android.hardware.keymaster@3.0.so
VNDK-core: android.hardware.keymaster@4.0.so
+VNDK-core: android.hardware.keymaster@4.1.so
+VNDK-core: android.hardware.light-V1-ndk_platform.so
VNDK-core: android.hardware.light@2.0.so
VNDK-core: android.hardware.media.bufferpool@1.0.so
VNDK-core: android.hardware.media.bufferpool@2.0.so
@@ -138,10 +148,12 @@
VNDK-core: android.hardware.neuralnetworks@1.0.so
VNDK-core: android.hardware.neuralnetworks@1.1.so
VNDK-core: android.hardware.neuralnetworks@1.2.so
+VNDK-core: android.hardware.neuralnetworks@1.3.so
VNDK-core: android.hardware.nfc@1.0.so
VNDK-core: android.hardware.nfc@1.1.so
VNDK-core: android.hardware.nfc@1.2.so
VNDK-core: android.hardware.oemlock@1.0.so
+VNDK-core: android.hardware.power-V1-ndk_platform.so
VNDK-core: android.hardware.power.stats@1.0.so
VNDK-core: android.hardware.power@1.0.so
VNDK-core: android.hardware.power@1.1.so
@@ -156,12 +168,14 @@
VNDK-core: android.hardware.radio@1.2.so
VNDK-core: android.hardware.radio@1.3.so
VNDK-core: android.hardware.radio@1.4.so
+VNDK-core: android.hardware.radio@1.5.so
VNDK-core: android.hardware.secure_element@1.0.so
VNDK-core: android.hardware.secure_element@1.1.so
+VNDK-core: android.hardware.secure_element@1.2.so
VNDK-core: android.hardware.sensors@1.0.so
VNDK-core: android.hardware.sensors@2.0.so
-VNDK-core: android.hardware.soundtrigger@2.0.so
VNDK-core: android.hardware.soundtrigger@2.0-core.so
+VNDK-core: android.hardware.soundtrigger@2.0.so
VNDK-core: android.hardware.soundtrigger@2.1.so
VNDK-core: android.hardware.soundtrigger@2.2.so
VNDK-core: android.hardware.tetheroffload.config@1.0.so
@@ -177,6 +191,7 @@
VNDK-core: android.hardware.usb@1.0.so
VNDK-core: android.hardware.usb@1.1.so
VNDK-core: android.hardware.usb@1.2.so
+VNDK-core: android.hardware.vibrator-V1-ndk_platform.so
VNDK-core: android.hardware.vibrator@1.0.so
VNDK-core: android.hardware.vibrator@1.1.so
VNDK-core: android.hardware.vibrator@1.2.so
@@ -195,8 +210,8 @@
VNDK-core: android.hardware.wifi@1.3.so
VNDK-core: android.hidl.allocator@1.0.so
VNDK-core: android.hidl.memory.block@1.0.so
-VNDK-core: android.hidl.token@1.0.so
VNDK-core: android.hidl.token@1.0-utils.so
+VNDK-core: android.hidl.token@1.0.so
VNDK-core: android.system.net.netd@1.0.so
VNDK-core: android.system.net.netd@1.1.so
VNDK-core: android.system.suspend@1.0.so
@@ -223,8 +238,6 @@
VNDK-core: libhardware_legacy.so
VNDK-core: libhidlallocatorutils.so
VNDK-core: libjpeg.so
-VNDK-core: libkeymaster_messages.so
-VNDK-core: libkeymaster_portable.so
VNDK-core: libldacBT_abr.so
VNDK-core: libldacBT_enc.so
VNDK-core: liblz4.so
@@ -240,12 +253,7 @@
VNDK-core: libpng.so
VNDK-core: libpower.so
VNDK-core: libprocinfo.so
-VNDK-core: libprotobuf-cpp-full.so
-VNDK-core: libprotobuf-cpp-lite.so
-VNDK-core: libpuresoftkeymasterdevice.so
VNDK-core: libradio_metadata.so
-VNDK-core: libselinux.so
-VNDK-core: libsoftkeymasterdevice.so
VNDK-core: libspeexresampler.so
VNDK-core: libsqlite.so
VNDK-core: libssl.so
@@ -265,7 +273,6 @@
VNDK-core: libyuv.so
VNDK-core: libziparchive.so
VNDK-private: libbacktrace.so
-VNDK-private: libbinderthreadstate.so
VNDK-private: libblas.so
VNDK-private: libcompiler_rt.so
VNDK-private: libft2.so
diff --git a/target/product/gsi_arm64.mk b/target/product/gsi_arm64.mk
index 09fb633..adf7ca5 100644
--- a/target/product/gsi_arm64.mk
+++ b/target/product/gsi_arm64.mk
@@ -23,8 +23,11 @@
# Enable mainline checking
PRODUCT_ENFORCE_ARTIFACT_PATH_REQUIREMENTS := relaxed
-PRODUCT_ARTIFACT_PATH_REQUIREMENT_WHITELIST += \
- root/init.zygote64_32.rc \
+#
+# All components inherited here go to system_ext image
+#
+$(call inherit-product, $(SRC_TARGET_DIR)/product/handheld_system_ext.mk)
+$(call inherit-product, $(SRC_TARGET_DIR)/product/telephony_system_ext.mk)
#
# All components inherited here go to product image
diff --git a/target/product/gsi_release.mk b/target/product/gsi_release.mk
index cab3916..b70ba3d 100644
--- a/target/product/gsi_release.mk
+++ b/target/product/gsi_release.mk
@@ -29,12 +29,6 @@
system/product/% \
system/system_ext/%
-
-# GSI doesn't support apex for now.
-# Properties set in product take precedence over those in vendor.
-PRODUCT_PRODUCT_PROPERTIES += \
- ro.apex.updatable=false
-
# Split selinux policy
PRODUCT_FULL_TREBLE_OVERRIDE := true
@@ -44,26 +38,16 @@
# Needed by Pi newly launched device to pass VtsTrebleSysProp on GSI
PRODUCT_COMPATIBLE_PROPERTY_OVERRIDE := true
+# GSI targets should install "unflattened" APEXes in /system
+TARGET_FLATTEN_APEX := false
+
+# GSI targets should install "flattened" APEXes in /system_ext as well
+PRODUCT_INSTALL_EXTRA_FLATTENED_APEXES := true
+
# GSI specific tasks on boot
PRODUCT_PACKAGES += \
gsi_skip_mount.cfg \
init.gsi.rc
-# Support addtional P and Q VNDK packages
+# Support additional P and Q VNDK packages
PRODUCT_EXTRA_VNDK_VERSIONS := 28 29
-
-# The 64 bits GSI build targets inhiert core_64_bit.mk to enable 64 bits and
-# include the init.zygote64_32.rc.
-# 64 bits GSI for releasing need to includes different zygote settings for
-# vendor.img to select by setting property ro.zygote=zygote64_32 or
-# ro.zygote=zygote32_64:
-# 1. 64-bit primary, 32-bit secondary, or
-# 2. 32-bit primary, 64-bit secondary
-# Here includes the init.zygote32_64.rc if it had inhierted core_64_bit.mk.
-ifeq (true|true,$(TARGET_SUPPORTS_32_BIT_APPS)|$(TARGET_SUPPORTS_64_BIT_APPS))
-PRODUCT_COPY_FILES += \
- system/core/rootdir/init.zygote32_64.rc:root/init.zygote32_64.rc
-
-PRODUCT_ARTIFACT_PATH_REQUIREMENT_WHITELIST += \
- root/init.zygote32_64.rc
-endif
diff --git a/target/product/handheld_product.mk b/target/product/handheld_product.mk
index 54dcaf2..e03c212 100644
--- a/target/product/handheld_product.mk
+++ b/target/product/handheld_product.mk
@@ -17,7 +17,7 @@
# This makefile contains the product partition contents for
# a generic phone or tablet device. Only add something here if
# it definitely doesn't belong on other types of devices (if it
-# does, use base_vendor.mk).
+# does, use base_product.mk).
$(call inherit-product, $(SRC_TARGET_DIR)/product/media_product.mk)
# /product packages
@@ -29,16 +29,10 @@
DeskClock \
Gallery2 \
LatinIME \
- Launcher3QuickStep \
Music \
OneTimeInitializer \
- Provision \
QuickSearchBox \
- Settings \
SettingsIntelligence \
- StorageManager \
- SystemUI \
- WallpaperCropper \
frameworks-base-overlays
PRODUCT_PACKAGES_DEBUG += \
diff --git a/target/product/handheld_system.mk b/target/product/handheld_system.mk
index 6463a54..b540fdf 100644
--- a/target/product/handheld_system.mk
+++ b/target/product/handheld_system.mk
@@ -43,7 +43,6 @@
CaptivePortalLogin \
CertInstaller \
clatd \
- clatd.conf \
DocumentsUI \
DownloadProviderUi \
EasterEgg \
diff --git a/target/product/handheld_system_ext.mk b/target/product/handheld_system_ext.mk
new file mode 100644
index 0000000..d935fbf
--- /dev/null
+++ b/target/product/handheld_system_ext.mk
@@ -0,0 +1,30 @@
+#
+# Copyright (C) 2019 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.
+#
+
+# This makefile contains the system_ext partition contents for
+# a generic phone or tablet device. Only add something here if
+# it definitely doesn't belong on other types of devices (if it
+# does, use base_system_ext.mk).
+$(call inherit-product, $(SRC_TARGET_DIR)/product/media_system_ext.mk)
+
+# /system_ext packages
+PRODUCT_PACKAGES += \
+ Launcher3QuickStep \
+ Provision \
+ Settings \
+ StorageManager \
+ SystemUI \
+ WallpaperCropper \
diff --git a/target/product/legacy_gsi_release.mk b/target/product/legacy_gsi_release.mk
new file mode 100644
index 0000000..f072481
--- /dev/null
+++ b/target/product/legacy_gsi_release.mk
@@ -0,0 +1,37 @@
+#
+# Copyright (C) 2020 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.
+#
+
+include $(SRC_TARGET_DIR)/product/gsi_release.mk
+
+PRODUCT_ARTIFACT_PATH_REQUIREMENT_WHITELIST += \
+ system/etc/init/init.legacy-gsi.rc \
+ system/etc/init/gsi/init.vndk-27.rc \
+ system/etc/ld.config.vndk_lite.txt \
+
+# Legacy GSI support additional O-MR1 interface
+PRODUCT_EXTRA_VNDK_VERSIONS += 27
+
+# Support for the O-MR1 devices
+PRODUCT_COPY_FILES += \
+ build/make/target/product/gsi/init.legacy-gsi.rc:system/etc/init/init.legacy-gsi.rc \
+ build/make/target/product/gsi/init.vndk-27.rc:system/etc/init/gsi/init.vndk-27.rc
+
+# Namespace configuration file for non-enforcing VNDK
+PRODUCT_PACKAGES += \
+ ld.config.vndk_lite.txt
+
+# Legacy GSI relax the compatible property checking
+PRODUCT_COMPATIBLE_PROPERTY_OVERRIDE := false
diff --git a/target/product/mainline.mk b/target/product/mainline.mk
deleted file mode 100644
index 7900cdf..0000000
--- a/target/product/mainline.mk
+++ /dev/null
@@ -1,37 +0,0 @@
-#
-# Copyright (C) 2019 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.
-#
-
-# This makefile is intended to serve as a base for completely AOSP based
-# mainline devices, It contain the mainline system partition and sensible
-# defaults for the product and vendor partition.
-$(call inherit-product, $(SRC_TARGET_DIR)/product/mainline_system.mk)
-
-$(call inherit-product, $(SRC_TARGET_DIR)/product/handheld_vendor.mk)
-$(call inherit-product, $(SRC_TARGET_DIR)/product/handheld_product.mk)
-$(call inherit-product, $(SRC_TARGET_DIR)/product/telephony_vendor.mk)
-$(call inherit-product, $(SRC_TARGET_DIR)/product/telephony_product.mk)
-
-$(call inherit-product, frameworks/base/data/sounds/AllAudio.mk)
-
-PRODUCT_PROPERTY_OVERRIDES += \
- ro.config.ringtone=Ring_Synth_04.ogg \
- ro.com.android.dataroaming=true \
-
-PRODUCT_PACKAGES += \
- PhotoTable \
- WallpaperPicker \
-
-PRODUCT_COPY_FILES += device/sample/etc/apns-full-conf.xml:$(TARGET_COPY_OUT_PRODUCT)/etc/apns-conf.xml
diff --git a/target/product/mainline_arm64.mk b/target/product/mainline_arm64.mk
deleted file mode 100644
index 6d998d6..0000000
--- a/target/product/mainline_arm64.mk
+++ /dev/null
@@ -1,36 +0,0 @@
-#
-# Copyright (C) 2018 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.
-#
-
-$(call inherit-product, $(SRC_TARGET_DIR)/product/core_64_bit.mk)
-$(call inherit-product, $(SRC_TARGET_DIR)/product/mainline.mk)
-whitelist := product_manifest.xml
-$(call enforce-product-packages-exist,$(whitelist))
-
-PRODUCT_NAME := mainline_arm64
-PRODUCT_DEVICE := mainline_arm64
-PRODUCT_BRAND := generic
-PRODUCT_SHIPPING_API_LEVEL := 28
-PRODUCT_RESTRICT_VENDOR_FILES := all
-
-PRODUCT_ENFORCE_ARTIFACT_PATH_REQUIREMENTS := relaxed
-PRODUCT_ARTIFACT_PATH_REQUIREMENT_WHITELIST += \
- root/init.zygote64_32.rc \
-
-# Modules that should probably be moved to /product
-PRODUCT_ARTIFACT_PATH_REQUIREMENT_WHITELIST += \
- system/bin/healthd \
- system/etc/init/healthd.rc \
- system/etc/vintf/manifest/manifest_healthd.xml \
diff --git a/target/product/mainline_system.mk b/target/product/mainline_system.mk
index 43bc45f..f21a4e4 100644
--- a/target/product/mainline_system.mk
+++ b/target/product/mainline_system.mk
@@ -21,6 +21,9 @@
# Add adb keys to debuggable AOSP builds (if they exist)
$(call inherit-product-if-exists, vendor/google/security/adb/vendor_key.mk)
+# Enable updating of APEXes
+$(call inherit-product, $(SRC_TARGET_DIR)/product/updatable_apex.mk)
+
# Shared java libs
PRODUCT_PACKAGES += \
com.android.nfc_extras \
@@ -64,8 +67,8 @@
# For ringtones that rely on forward lock encryption
PRODUCT_PACKAGES += libfwdlockengine
-# System libraries commonly depended on by things on the product partition.
-# This list will be pruned periodically.
+# System libraries commonly depended on by things on the system_ext or product partitions.
+# These lists will be pruned periodically.
PRODUCT_PACKAGES += \
android.hardware.biometrics.fingerprint@2.1 \
android.hardware.radio@1.0 \
@@ -78,6 +81,7 @@
android.hardware.secure_element@1.0 \
android.hardware.wifi@1.0 \
libaudio-resampler \
+ libaudiohal \
libdrm \
liblogwrap \
liblz4 \
@@ -85,6 +89,13 @@
libnl \
libprotobuf-cpp-full \
+# These libraries are empty and have been combined into libhidlbase, but are still depended
+# on by things off /system.
+# TODO(b/135686713): remove these
+PRODUCT_PACKAGES += \
+ libhidltransport \
+ libhwbinder \
+
# Camera service uses 'libdepthphoto' for adding dynamic depth
# metadata inside depth jpegs.
PRODUCT_PACKAGES += \
@@ -93,24 +104,41 @@
PRODUCT_PACKAGES_DEBUG += \
avbctl \
bootctl \
- tinyplay \
tinycap \
+ tinyhostless \
tinymix \
tinypcminfo \
+ tinyplay \
update_engine_client \
PRODUCT_HOST_PACKAGES += \
tinyplay
+# Include all zygote init scripts. "ro.zygote" will select one of them.
+PRODUCT_COPY_FILES += \
+ system/core/rootdir/init.zygote32.rc:system/etc/init/hw/init.zygote32.rc \
+ system/core/rootdir/init.zygote64.rc:system/etc/init/hw/init.zygote64.rc \
+ system/core/rootdir/init.zygote64_32.rc:system/etc/init/hw/init.zygote64_32.rc \
+
# Enable dynamic partition size
PRODUCT_USE_DYNAMIC_PARTITION_SIZE := true
-PRODUCT_PACKAGES += \
- com.android.apex.cts.shim.v1_prebuilt
+PRODUCT_ENFORCE_RRO_TARGETS := *
+
+# TODO(b/150820813) Settings depends on static overlay, remove this after eliminating the dependency.
+PRODUCT_ENFORCE_RRO_EXEMPTED_TARGETS := Settings
PRODUCT_NAME := mainline_system
PRODUCT_BRAND := generic
+# Define /system partition-specific product properties to identify that /system
+# partition is mainline_system.
+PRODUCT_SYSTEM_NAME := mainline
+PRODUCT_SYSTEM_BRAND := Android
+PRODUCT_SYSTEM_MANUFACTURER := Android
+PRODUCT_SYSTEM_MODEL := mainline
+PRODUCT_SYSTEM_DEVICE := generic
+
_base_mk_whitelist :=
_my_whitelist := $(_base_mk_whitelist)
diff --git a/target/product/mainline_system_arm64.mk b/target/product/mainline_system_arm64.mk
index b9ac1e3..60035c1 100644
--- a/target/product/mainline_system_arm64.mk
+++ b/target/product/mainline_system_arm64.mk
@@ -14,22 +14,31 @@
# limitations under the License.
#
+#
+# All components inherited here go to system image
+#
$(call inherit-product, $(SRC_TARGET_DIR)/product/core_64_bit.mk)
$(call inherit-product, $(SRC_TARGET_DIR)/product/mainline_system.mk)
$(call enforce-product-packages-exist,)
+# Enable mainline checking
+PRODUCT_ENFORCE_ARTIFACT_PATH_REQUIREMENTS := true
+
PRODUCT_BUILD_CACHE_IMAGE := false
PRODUCT_BUILD_ODM_IMAGE := false
PRODUCT_BUILD_PRODUCT_IMAGE := false
-PRODUCT_BUILD_SYSTEM_EXT_IMAGE := false
PRODUCT_BUILD_RAMDISK_IMAGE := false
PRODUCT_BUILD_SYSTEM_IMAGE := true
+PRODUCT_BUILD_SYSTEM_EXT_IMAGE := false
PRODUCT_BUILD_SYSTEM_OTHER_IMAGE := false
PRODUCT_BUILD_USERDATA_IMAGE := false
PRODUCT_BUILD_VENDOR_IMAGE := false
+PRODUCT_SHIPPING_API_LEVEL := 29
+
+# TODO(b/137033385): change this back to "all"
+PRODUCT_RESTRICT_VENDOR_FILES := owner
+
PRODUCT_NAME := mainline_system_arm64
PRODUCT_DEVICE := mainline_arm64
PRODUCT_BRAND := generic
-PRODUCT_SHIPPING_API_LEVEL := 28
-PRODUCT_RESTRICT_VENDOR_FILES := all
diff --git a/target/product/mainline_system_x86.mk b/target/product/mainline_system_x86.mk
new file mode 100644
index 0000000..a30a1fc
--- /dev/null
+++ b/target/product/mainline_system_x86.mk
@@ -0,0 +1,43 @@
+#
+# Copyright (C) 2019 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.
+#
+
+#
+# All components inherited here go to system image
+#
+$(call inherit-product, $(SRC_TARGET_DIR)/product/mainline_system.mk)
+$(call enforce-product-packages-exist,)
+
+# Enable mainline checking
+PRODUCT_ENFORCE_ARTIFACT_PATH_REQUIREMENTS := true
+
+PRODUCT_BUILD_CACHE_IMAGE := false
+PRODUCT_BUILD_ODM_IMAGE := false
+PRODUCT_BUILD_PRODUCT_IMAGE := false
+PRODUCT_BUILD_RAMDISK_IMAGE := false
+PRODUCT_BUILD_SYSTEM_IMAGE := true
+PRODUCT_BUILD_SYSTEM_EXT_IMAGE := false
+PRODUCT_BUILD_SYSTEM_OTHER_IMAGE := false
+PRODUCT_BUILD_USERDATA_IMAGE := false
+PRODUCT_BUILD_VENDOR_IMAGE := false
+
+PRODUCT_SHIPPING_API_LEVEL := 29
+
+# TODO(b/137033385): change this back to "all"
+PRODUCT_RESTRICT_VENDOR_FILES := owner
+
+PRODUCT_NAME := mainline_system_x86
+PRODUCT_DEVICE := mainline_x86
+PRODUCT_BRAND := generic
diff --git a/target/product/mainline_system_x86_64.mk b/target/product/mainline_system_x86_64.mk
new file mode 100644
index 0000000..473ff72
--- /dev/null
+++ b/target/product/mainline_system_x86_64.mk
@@ -0,0 +1,43 @@
+#
+# Copyright (C) 2019 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.
+#
+
+#
+# All components inherited here go to system image
+#
+$(call inherit-product, $(SRC_TARGET_DIR)/product/core_64_bit.mk)
+$(call inherit-product, $(SRC_TARGET_DIR)/product/mainline_system.mk)
+$(call enforce-product-packages-exist,)
+
+# Enable mainline checking
+PRODUCT_ENFORCE_ARTIFACT_PATH_REQUIREMENTS := true
+
+PRODUCT_BUILD_CACHE_IMAGE := false
+PRODUCT_BUILD_ODM_IMAGE := false
+PRODUCT_BUILD_PRODUCT_IMAGE := false
+PRODUCT_BUILD_RAMDISK_IMAGE := false
+PRODUCT_BUILD_SYSTEM_IMAGE := true
+PRODUCT_BUILD_SYSTEM_EXT_IMAGE := false
+PRODUCT_BUILD_SYSTEM_OTHER_IMAGE := false
+PRODUCT_BUILD_USERDATA_IMAGE := false
+PRODUCT_BUILD_VENDOR_IMAGE := false
+
+PRODUCT_SHIPPING_API_LEVEL := 29
+
+PRODUCT_RESTRICT_VENDOR_FILES := all
+
+PRODUCT_NAME := mainline_system_x86_64
+PRODUCT_DEVICE := mainline_x86_64
+PRODUCT_BRAND := generic
diff --git a/target/product/mainline_system_x86_arm.mk b/target/product/mainline_system_x86_arm.mk
new file mode 100644
index 0000000..2e01cde
--- /dev/null
+++ b/target/product/mainline_system_x86_arm.mk
@@ -0,0 +1,43 @@
+#
+# Copyright (C) 2019 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.
+#
+
+#
+# All components inherited here go to system image
+#
+$(call inherit-product, $(SRC_TARGET_DIR)/product/mainline_system.mk)
+$(call enforce-product-packages-exist,)
+
+# Enable mainline checking
+PRODUCT_ENFORCE_ARTIFACT_PATH_REQUIREMENTS := true
+
+PRODUCT_BUILD_CACHE_IMAGE := false
+PRODUCT_BUILD_ODM_IMAGE := false
+PRODUCT_BUILD_PRODUCT_IMAGE := false
+PRODUCT_BUILD_RAMDISK_IMAGE := false
+PRODUCT_BUILD_SYSTEM_IMAGE := true
+PRODUCT_BUILD_SYSTEM_EXT_IMAGE := false
+PRODUCT_BUILD_SYSTEM_OTHER_IMAGE := false
+PRODUCT_BUILD_USERDATA_IMAGE := false
+PRODUCT_BUILD_VENDOR_IMAGE := false
+
+PRODUCT_SHIPPING_API_LEVEL := 29
+
+# TODO(b/137033385): change this back to "all"
+PRODUCT_RESTRICT_VENDOR_FILES := owner
+
+PRODUCT_NAME := mainline_system_x86_arm
+PRODUCT_DEVICE := mainline_x86_arm
+PRODUCT_BRAND := generic
diff --git a/target/product/media_product.mk b/target/product/media_product.mk
index 17c24ee..76cb311 100644
--- a/target/product/media_product.mk
+++ b/target/product/media_product.mk
@@ -17,7 +17,7 @@
# This makefile contains the product partition contents for
# media-capable devices (non-wearables). Only add something here
# if it definitely doesn't belong on wearables. Otherwise, choose
-# base_vendor.mk.
+# base_product.mk.
$(call inherit-product, $(SRC_TARGET_DIR)/product/base_product.mk)
# /product packages
diff --git a/target/product/media_system.mk b/target/product/media_system.mk
index 5c0902d..a83e609 100644
--- a/target/product/media_system.mk
+++ b/target/product/media_system.mk
@@ -36,7 +36,6 @@
make_f2fs \
requestsync \
StatementService \
- vndk_snapshot_package \
PRODUCT_HOST_PACKAGES += \
fsck.f2fs \
@@ -51,10 +50,15 @@
# The order here is the same order they end up on the classpath, so it matters.
PRODUCT_SYSTEM_SERVER_JARS := \
+ com.android.location.provider \
services \
ethernet-service \
wifi-service \
- com.android.location.provider \
+
+# system server jars which are updated via apex modules.
+# The values should be of the format <apex name>:<jar name>
+PRODUCT_UPDATABLE_SYSTEM_SERVER_JARS := \
+ com.android.ipsec:android.net.ipsec.ike \
PRODUCT_COPY_FILES += \
system/core/rootdir/etc/public.libraries.android.txt:system/etc/public.libraries.txt
diff --git a/target/product/media_system_ext.mk b/target/product/media_system_ext.mk
new file mode 100644
index 0000000..2e20af3
--- /dev/null
+++ b/target/product/media_system_ext.mk
@@ -0,0 +1,25 @@
+#
+# Copyright (C) 2019 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.
+#
+
+# This makefile contains the system_ext partition contents for
+# media-capable devices (non-wearables). Only add something here
+# if it definitely doesn't belong on wearables. Otherwise, choose
+# base_system_ext.mk.
+$(call inherit-product, $(SRC_TARGET_DIR)/product/base_system_ext.mk)
+
+# /system_ext packages
+PRODUCT_PACKAGES += \
+ vndk_apex_snapshot_package \
diff --git a/target/product/runtime_libart.mk b/target/product/runtime_libart.mk
index 581a72b..84b1252 100644
--- a/target/product/runtime_libart.mk
+++ b/target/product/runtime_libart.mk
@@ -16,15 +16,6 @@
# Provides a functioning ART environment without Android frameworks
-ifeq ($(TARGET_CORE_JARS),)
-$(error TARGET_CORE_JARS is empty; cannot update PRODUCT_PACKAGES variable)
-endif
-
-# Minimal boot classpath. This should be a subset of PRODUCT_BOOT_JARS, and equivalent to
-# TARGET_CORE_JARS.
-PRODUCT_PACKAGES += \
- $(TARGET_CORE_JARS)
-
# Additional mixins to the boot classpath.
PRODUCT_PACKAGES += \
android.test.base \
@@ -37,6 +28,8 @@
PRODUCT_PACKAGES += com.android.runtime
# ART APEX module.
+# Note that this package includes the minimal boot classpath JARs (listed in
+# ART_APEX_JARS), which should no longer be added directly to PRODUCT_PACKAGES.
PRODUCT_PACKAGES += com.android.art
PRODUCT_HOST_PACKAGES += com.android.art
@@ -82,6 +75,10 @@
pm.dexopt.inactive=verify \
pm.dexopt.shared=speed
+# Pass file with the list of updatable boot class path packages to dex2oat.
+PRODUCT_SYSTEM_DEFAULT_PROPERTIES += \
+ dalvik.vm.dex2oat-updatable-bcp-packages-file=/system/etc/updatable-bcp-packages.txt
+
# Enable resolution of startup const strings.
PRODUCT_SYSTEM_DEFAULT_PROPERTIES += \
dalvik.vm.dex2oat-resolve-startup-strings=true
diff --git a/target/product/sdk_phone_arm64.mk b/target/product/sdk_phone_arm64.mk
index ad72633..cefa288 100644
--- a/target/product/sdk_phone_arm64.mk
+++ b/target/product/sdk_phone_arm64.mk
@@ -14,8 +14,41 @@
# limitations under the License.
#
QEMU_USE_SYSTEM_EXT_PARTITIONS := true
+PRODUCT_USE_DYNAMIC_PARTITIONS := true
-$(call inherit-product, $(SRC_TARGET_DIR)/product/aosp_arm64.mk)
+# This is a build configuration for a full-featured build of the
+# Open-Source part of the tree. It's geared toward a US-centric
+# build quite specifically for the emulator, and might not be
+# entirely appropriate to inherit from for on-device configurations.
+
+# Enable mainline checking for exact this product name
+ifeq (sdk_phone_arm64,$(TARGET_PRODUCT))
+PRODUCT_ENFORCE_ARTIFACT_PATH_REQUIREMENTS := relaxed
+endif
+
+#
+# All components inherited here go to system image
+#
+$(call inherit-product, $(SRC_TARGET_DIR)/product/core_64_bit.mk)
+$(call inherit-product, $(SRC_TARGET_DIR)/product/mainline_system.mk)
+
+#
+# All components inherited here go to system_ext image
+#
+$(call inherit-product, $(SRC_TARGET_DIR)/product/handheld_system_ext.mk)
+$(call inherit-product, $(SRC_TARGET_DIR)/product/telephony_system_ext.mk)
+
+#
+# All components inherited here go to product image
+#
+$(call inherit-product, $(SRC_TARGET_DIR)/product/aosp_product.mk)
+
+#
+# All components inherited here go to vendor or vendor_boot image
+#
+$(call inherit-product-if-exists, device/generic/goldfish/arm64-vendor.mk)
+$(call inherit-product, $(SRC_TARGET_DIR)/product/emulator_vendor.mk)
+$(call inherit-product, $(SRC_TARGET_DIR)/board/emulator_arm64/device.mk)
# Define the host tools and libs that are parts of the SDK.
$(call inherit-product, sdk/build/product_sdk.mk)
@@ -28,7 +61,7 @@
# Overrides
PRODUCT_BRAND := Android
PRODUCT_NAME := sdk_phone_arm64
-PRODUCT_DEVICE := generic_arm64
+PRODUCT_DEVICE := emulator_arm64
PRODUCT_MODEL := Android SDK built for arm64
diff --git a/target/product/sdk_phone_armv7.mk b/target/product/sdk_phone_armv7.mk
index 77b8b50..c4c5a38 100644
--- a/target/product/sdk_phone_armv7.mk
+++ b/target/product/sdk_phone_armv7.mk
@@ -14,8 +14,40 @@
# limitations under the License.
#
QEMU_USE_SYSTEM_EXT_PARTITIONS := true
+PRODUCT_USE_DYNAMIC_PARTITIONS := true
-$(call inherit-product, $(SRC_TARGET_DIR)/product/aosp_arm.mk)
+# This is a build configuration for a full-featured build of the
+# Open-Source part of the tree. It's geared toward a US-centric
+# build quite specifically for the emulator, and might not be
+# entirely appropriate to inherit from for on-device configurations.
+
+# Enable mainline checking for exact this product name
+ifeq (sdk_phone_armv7,$(TARGET_PRODUCT))
+PRODUCT_ENFORCE_ARTIFACT_PATH_REQUIREMENTS := relaxed
+endif
+
+#
+# All components inherited here go to system image
+#
+$(call inherit-product, $(SRC_TARGET_DIR)/product/mainline_system.mk)
+
+#
+# All components inherited here go to system_ext image
+#
+$(call inherit-product, $(SRC_TARGET_DIR)/product/handheld_system_ext.mk)
+$(call inherit-product, $(SRC_TARGET_DIR)/product/telephony_system_ext.mk)
+
+#
+# All components inherited here go to product image
+#
+$(call inherit-product, $(SRC_TARGET_DIR)/product/aosp_product.mk)
+
+#
+# All components inherited here go to vendor image
+#
+$(call inherit-product-if-exists, device/generic/goldfish/arm32-vendor.mk)
+$(call inherit-product, $(SRC_TARGET_DIR)/product/emulator_vendor.mk)
+$(call inherit-product, $(SRC_TARGET_DIR)/board/emulator_arm/device.mk)
# Define the host tools and libs that are parts of the SDK.
$(call inherit-product, sdk/build/product_sdk.mk)
@@ -29,4 +61,5 @@
# Overrides
PRODUCT_BRAND := Android
PRODUCT_NAME := sdk_phone_armv7
-PRODUCT_DEVICE := generic
+PRODUCT_DEVICE := emulator_arm
+PRODUCT_MODEL := Android SDK built for arm
diff --git a/target/product/sdk_phone_x86.mk b/target/product/sdk_phone_x86.mk
index efb3c6e..bcee066 100644
--- a/target/product/sdk_phone_x86.mk
+++ b/target/product/sdk_phone_x86.mk
@@ -16,17 +16,28 @@
QEMU_USE_SYSTEM_EXT_PARTITIONS := true
PRODUCT_USE_DYNAMIC_PARTITIONS := true
+# This is a build configuration for a full-featured build of the
+# Open-Source part of the tree. It's geared toward a US-centric
+# build quite specifically for the emulator, and might not be
+# entirely appropriate to inherit from for on-device configurations.
+
#
# All components inherited here go to system image
#
$(call inherit-product, $(SRC_TARGET_DIR)/product/mainline_system.mk)
-# Enable mainline checking for excat this product name
+# Enable mainline checking for exact this product name
ifeq (sdk_phone_x86,$(TARGET_PRODUCT))
PRODUCT_ENFORCE_ARTIFACT_PATH_REQUIREMENTS := relaxed
endif
#
+# All components inherited here go to system_ext image
+#
+$(call inherit-product, $(SRC_TARGET_DIR)/product/handheld_system_ext.mk)
+$(call inherit-product, $(SRC_TARGET_DIR)/product/telephony_system_ext.mk)
+
+#
# All components inherited here go to product image
#
$(call inherit-product, $(SRC_TARGET_DIR)/product/aosp_product.mk)
@@ -36,9 +47,7 @@
#
$(call inherit-product-if-exists, device/generic/goldfish/x86-vendor.mk)
$(call inherit-product, $(SRC_TARGET_DIR)/product/emulator_vendor.mk)
-$(call inherit-product, $(SRC_TARGET_DIR)/board/generic_x86/device.mk)
-
-$(call inherit-product, $(SRC_TARGET_DIR)/product/aosp_x86.mk)
+$(call inherit-product, $(SRC_TARGET_DIR)/board/emulator_x86/device.mk)
# Define the host tools and libs that are parts of the SDK.
-include sdk/build/product_sdk.mk
@@ -47,5 +56,5 @@
# Overrides
PRODUCT_BRAND := Android
PRODUCT_NAME := sdk_phone_x86
-PRODUCT_DEVICE := generic_x86
+PRODUCT_DEVICE := emulator_x86
PRODUCT_MODEL := Android SDK built for x86
diff --git a/target/product/sdk_phone_x86_64.mk b/target/product/sdk_phone_x86_64.mk
index 267796f..82bbee5 100644
--- a/target/product/sdk_phone_x86_64.mk
+++ b/target/product/sdk_phone_x86_64.mk
@@ -16,19 +16,27 @@
QEMU_USE_SYSTEM_EXT_PARTITIONS := true
PRODUCT_USE_DYNAMIC_PARTITIONS := true
+# This is a build configuration for a full-featured build of the
+# Open-Source part of the tree. It's geared toward a US-centric
+# build quite specifically for the emulator, and might not be
+# entirely appropriate to inherit from for on-device configurations.
+
#
# All components inherited here go to system image
#
$(call inherit-product, $(SRC_TARGET_DIR)/product/core_64_bit.mk)
$(call inherit-product, $(SRC_TARGET_DIR)/product/mainline_system.mk)
-# Enable mainline checking for excat this product name
+# Enable mainline checking for exact this product name
ifeq (sdk_phone_x86_64,$(TARGET_PRODUCT))
PRODUCT_ENFORCE_ARTIFACT_PATH_REQUIREMENTS := relaxed
endif
-PRODUCT_ARTIFACT_PATH_REQUIREMENT_WHITELIST += \
- root/init.zygote64_32.rc \
+#
+# All components inherited here go to system_ext image
+#
+$(call inherit-product, $(SRC_TARGET_DIR)/product/handheld_system_ext.mk)
+$(call inherit-product, $(SRC_TARGET_DIR)/product/telephony_system_ext.mk)
#
# All components inherited here go to product image
@@ -40,7 +48,7 @@
#
$(call inherit-product-if-exists, device/generic/goldfish/x86_64-vendor.mk)
$(call inherit-product, $(SRC_TARGET_DIR)/product/emulator_vendor.mk)
-$(call inherit-product, $(SRC_TARGET_DIR)/board/generic_x86_64/device.mk)
+$(call inherit-product, $(SRC_TARGET_DIR)/board/emulator_x86_64/device.mk)
# Define the host tools and libs that are parts of the SDK.
-include sdk/build/product_sdk.mk
@@ -49,5 +57,5 @@
# Overrides
PRODUCT_BRAND := Android
PRODUCT_NAME := sdk_phone_x86_64
-PRODUCT_DEVICE := generic_x86_64
+PRODUCT_DEVICE := emulator_x86_64
PRODUCT_MODEL := Android SDK built for x86_64
diff --git a/target/product/security/Android.bp b/target/product/security/Android.bp
index 080706b..5f4f82b 100644
--- a/target/product/security/Android.bp
+++ b/target/product/security/Android.bp
@@ -3,3 +3,11 @@
name: "aosp-testkey",
certificate: "testkey",
}
+
+// Google-owned certificate for CTS testing, since we can't trust arbitrary keys on release devices.
+prebuilt_etc {
+ name: "fsverity-release-cert-der",
+ src: "fsverity-release.x509.der",
+ sub_dir: "security/fsverity",
+ filename_from_src: true,
+}
diff --git a/target/product/security/Android.mk b/target/product/security/Android.mk
index 3631cfd..d6a8b53 100644
--- a/target/product/security/Android.mk
+++ b/target/product/security/Android.mk
@@ -80,30 +80,3 @@
$(extra_recovery_keys)
$(SOONG_ZIP) -o $@ -j \
$(foreach key_file, $(PRIVATE_CERT) $(PRIVATE_EXTRA_RECOVERY_KEYS), -f $(key_file))
-
-
-#######################################
-# update_engine_payload_key, used by update_engine. We use the same key as otacerts but in RSA
-# public key format.
-include $(CLEAR_VARS)
-
-LOCAL_MODULE := update_engine_payload_key
-LOCAL_MODULE_CLASS := ETC
-LOCAL_MODULE_STEM := update-payload-key.pub.pem
-LOCAL_MODULE_PATH := $(TARGET_OUT_ETC)/update_engine
-include $(BUILD_SYSTEM)/base_rules.mk
-$(LOCAL_BUILT_MODULE): $(DEFAULT_SYSTEM_DEV_CERTIFICATE).x509.pem
- openssl x509 -pubkey -noout -in $< > $@
-
-
-#######################################
-# update_engine_payload_key for recovery image, used by update_engine.
-include $(CLEAR_VARS)
-
-LOCAL_MODULE := update_engine_payload_key.recovery
-LOCAL_MODULE_CLASS := ETC
-LOCAL_MODULE_STEM := update-payload-key.pub.pem
-LOCAL_MODULE_PATH := $(TARGET_RECOVERY_ROOT_OUT)/system/etc/update_engine
-include $(BUILD_SYSTEM)/base_rules.mk
-$(LOCAL_BUILT_MODULE): $(DEFAULT_SYSTEM_DEV_CERTIFICATE).x509.pem
- openssl x509 -pubkey -noout -in $< > $@
diff --git a/target/product/security/fsverity-release.x509.der b/target/product/security/fsverity-release.x509.der
new file mode 100644
index 0000000..cd8cd79
--- /dev/null
+++ b/target/product/security/fsverity-release.x509.der
Binary files differ
diff --git a/target/product/telephony.mk b/target/product/telephony.mk
index e0eb159..3ad7a1f 100644
--- a/target/product/telephony.mk
+++ b/target/product/telephony.mk
@@ -16,5 +16,6 @@
# All modules for telephony
$(call inherit-product, $(SRC_TARGET_DIR)/product/telephony_system.mk)
+$(call inherit-product, $(SRC_TARGET_DIR)/product/telephony_system_ext.mk)
$(call inherit-product, $(SRC_TARGET_DIR)/product/telephony_vendor.mk)
$(call inherit-product, $(SRC_TARGET_DIR)/product/telephony_product.mk)
diff --git a/target/product/telephony_product.mk b/target/product/telephony_product.mk
index a4c7e31..3ec954f 100644
--- a/target/product/telephony_product.mk
+++ b/target/product/telephony_product.mk
@@ -19,6 +19,4 @@
# /product packages
PRODUCT_PACKAGES += \
- CarrierConfig \
Dialer \
- EmergencyInfo \
diff --git a/target/product/telephony_system.mk b/target/product/telephony_system.mk
index 4da9bdf..c306a04 100644
--- a/target/product/telephony_system.mk
+++ b/target/product/telephony_system.mk
@@ -21,6 +21,7 @@
ONS \
CarrierDefaultApp \
CallLogBackup \
- CellBroadcastAppPlatform \
+ CellBroadcastApp \
+ CellBroadcastServiceModule \
PRODUCT_COPY_FILES := \
diff --git a/core/host_test_config.mk b/target/product/telephony_system_ext.mk
similarity index 66%
copy from core/host_test_config.mk
copy to target/product/telephony_system_ext.mk
index b9975e5..f81a607 100644
--- a/core/host_test_config.mk
+++ b/target/product/telephony_system_ext.mk
@@ -1,5 +1,5 @@
#
-# Copyright (C) 2017 The Android Open Source Project
+# Copyright (C) 2019 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.
@@ -14,12 +14,10 @@
# limitations under the License.
#
-#
-# Common rules for building a TradeFed test XML file for host side tests.
-#
+# This is the list of modules that are specific to products that have telephony
+# hardware, and install to the system_ext partition.
-$(call record-module-type,HOST_TEST_CONFIG)
-
-LOCAL_IS_HOST_MODULE := true
-
-include $(BUILD_SYSTEM)/test_config_common.mk
+# /system_ext packages
+PRODUCT_PACKAGES += \
+ CarrierConfig \
+ EmergencyInfo \
diff --git a/target/product/updatable_apex.mk b/target/product/updatable_apex.mk
index a9f4baf..e5a647c 100644
--- a/target/product/updatable_apex.mk
+++ b/target/product/updatable_apex.mk
@@ -16,5 +16,8 @@
# Inherit this when the target needs to support updating APEXes
-PRODUCT_PROPERTY_OVERRIDES := ro.apex.updatable=true
-TARGET_FLATTEN_APEX := false
+ifneq ($(OVERRIDE_TARGET_FLATTEN_APEX),true)
+ PRODUCT_PACKAGES += com.android.apex.cts.shim.v1_prebuilt
+ PRODUCT_PROPERTY_OVERRIDES := ro.apex.updatable=true
+ TARGET_FLATTEN_APEX := false
+endif
diff --git a/core/target_test_config.mk b/target/product/userspace_reboot.mk
similarity index 70%
copy from core/target_test_config.mk
copy to target/product/userspace_reboot.mk
index 61f5d2b..3f881af 100644
--- a/core/target_test_config.mk
+++ b/target/product/userspace_reboot.mk
@@ -1,5 +1,5 @@
#
-# Copyright (C) 2017 The Android Open Source Project
+# Copyright (C) 2019 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.
@@ -14,10 +14,6 @@
# limitations under the License.
#
-#
-# Common rules for building a TradeFed test XML file for target side tests.
-#
+# Inherit this when the target supports userspace reboot
-$(call record-module-type,TARGET_TEST_CONFIG)
-
-include $(BUILD_SYSTEM)/test_config_common.mk
+PRODUCT_PROPERTY_OVERRIDES := init.userspace_reboot.is_supported=true
diff --git a/target/product/virtual_ab_ota.mk b/target/product/virtual_ab_ota.mk
index c00b0ed..1774de4 100644
--- a/target/product/virtual_ab_ota.mk
+++ b/target/product/virtual_ab_ota.mk
@@ -16,4 +16,6 @@
PRODUCT_VIRTUAL_AB_OTA := true
-PRODUCT_PRODUCT_PROPERTIES += ro.virtual_ab.enabled=true
+PRODUCT_PROPERTY_OVERRIDES += ro.virtual_ab.enabled=true
+
+PRODUCT_PACKAGES += e2fsck_ramdisk
diff --git a/core/target_test_config.mk b/target/product/virtual_ab_ota_plus_non_ab.mk
similarity index 70%
rename from core/target_test_config.mk
rename to target/product/virtual_ab_ota_plus_non_ab.mk
index 61f5d2b..325d75e 100644
--- a/core/target_test_config.mk
+++ b/target/product/virtual_ab_ota_plus_non_ab.mk
@@ -1,5 +1,5 @@
#
-# Copyright (C) 2017 The Android Open Source Project
+# Copyright (C) 2020 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.
@@ -14,10 +14,8 @@
# limitations under the License.
#
-#
-# Common rules for building a TradeFed test XML file for target side tests.
-#
+$(call inherit-product, $(SRC_TARGET_DIR)/product/virtual_ab_ota.mk)
-$(call record-module-type,TARGET_TEST_CONFIG)
+PRODUCT_OTA_FORCE_NON_AB_PACKAGE := true
-include $(BUILD_SYSTEM)/test_config_common.mk
+PRODUCT_PROPERTY_OVERRIDES += ro.virtual_ab.allow_non_ab=true
diff --git a/target/product/virtual_ab_ota_retrofit.mk b/target/product/virtual_ab_ota_retrofit.mk
index b492fad..3e85741 100644
--- a/target/product/virtual_ab_ota_retrofit.mk
+++ b/target/product/virtual_ab_ota_retrofit.mk
@@ -18,4 +18,4 @@
PRODUCT_VIRTUAL_AB_OTA_RETROFIT := true
-PRODUCT_PRODUCT_PROPERTIES += ro.virtual_ab.retrofit=true
+PRODUCT_PROPERTY_OVERRIDES += ro.virtual_ab.retrofit=true
diff --git a/tools/Android.bp b/tools/Android.bp
new file mode 100644
index 0000000..159890c
--- /dev/null
+++ b/tools/Android.bp
@@ -0,0 +1,39 @@
+// Copyright (C) 2019 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.
+
+python_binary_host {
+ name: "generate-self-extracting-archive",
+ srcs: ["generate-self-extracting-archive.py"],
+ version: {
+ py2: {
+ enabled: true,
+ },
+ py3: {
+ enabled: false,
+ },
+ },
+}
+
+python_binary_host {
+ name: "post_process_props",
+ srcs: ["post_process_props.py"],
+ version: {
+ py2: {
+ enabled: false,
+ },
+ py3: {
+ enabled: true,
+ },
+ },
+}
diff --git a/tools/auto_gen_test_config.py b/tools/auto_gen_test_config.py
index c7c5bdc..943f238 100755
--- a/tools/auto_gen_test_config.py
+++ b/tools/auto_gen_test_config.py
@@ -27,6 +27,7 @@
ATTRIBUTE_PACKAGE = 'package'
PLACEHOLDER_LABEL = '{LABEL}'
+PLACEHOLDER_EXTRA_CONFIGS = '{EXTRA_CONFIGS}'
PLACEHOLDER_MODULE = '{MODULE}'
PLACEHOLDER_PACKAGE = '{PACKAGE}'
PLACEHOLDER_RUNNER = '{RUNNER}'
@@ -41,16 +42,20 @@
Returns:
0 if no error, otherwise 1.
"""
- if len(argv) != 4:
+ if len(argv) != 4 and len(argv) != 6:
sys.stderr.write(
- 'Invalid arguements. The script requires 4 arguments for file paths: '
+ 'Invalid arguments. The script requires 4 arguments for file paths: '
'target_config android_manifest empty_config '
- 'instrumentation_test_config_template.\n')
+ 'instrumentation_test_config_template '
+ 'and 2 optional arguments for extra configs: '
+ '--extra-configs \'EXTRA_CONFIGS\'.\n')
return 1
+
target_config = argv[0]
android_manifest = argv[1]
empty_config = argv[2]
instrumentation_test_config_template = argv[3]
+ extra_configs = '\n'.join(argv[5].split('\\n')) if len(argv) == 6 else ''
manifest = parse(android_manifest)
instrumentation_elements = manifest.getElementsByTagName('instrumentation')
@@ -80,6 +85,7 @@
config = config.replace(PLACEHOLDER_MODULE, module)
config = config.replace(PLACEHOLDER_PACKAGE, package)
config = config.replace(PLACEHOLDER_TEST_TYPE, test_type)
+ config = config.replace(PLACEHOLDER_EXTRA_CONFIGS, extra_configs)
config = config.replace(PLACEHOLDER_RUNNER, runner)
with open(target_config, 'w') as config_file:
config_file.write(config)
diff --git a/tools/buildinfo_common.sh b/tools/buildinfo_common.sh
deleted file mode 100755
index 6041d79..0000000
--- a/tools/buildinfo_common.sh
+++ /dev/null
@@ -1,29 +0,0 @@
-#!/bin/bash
-
-partition="$1"
-
-if [ "$#" -ne 1 ]; then
- echo "Usage: $0 <partition>" 1>&2
- exit 1
-fi
-
-echo "# begin common build properties"
-echo "# autogenerated by $0"
-
-echo "ro.${partition}.build.date=`$DATE`"
-echo "ro.${partition}.build.date.utc=`$DATE +%s`"
-echo "ro.${partition}.build.fingerprint=$BUILD_FINGERPRINT"
-echo "ro.${partition}.build.id=$BUILD_ID"
-echo "ro.${partition}.build.tags=$BUILD_VERSION_TAGS"
-echo "ro.${partition}.build.type=$TARGET_BUILD_TYPE"
-echo "ro.${partition}.build.version.incremental=$BUILD_NUMBER"
-echo "ro.${partition}.build.version.release=$PLATFORM_VERSION"
-echo "ro.${partition}.build.version.sdk=$PLATFORM_SDK_VERSION"
-
-echo "ro.product.${partition}.brand=$PRODUCT_BRAND"
-echo "ro.product.${partition}.device=$PRODUCT_DEVICE"
-echo "ro.product.${partition}.manufacturer=$PRODUCT_MANUFACTURER"
-echo "ro.product.${partition}.model=$PRODUCT_MODEL"
-echo "ro.product.${partition}.name=$PRODUCT_NAME"
-
-echo "# end common build properties"
diff --git a/tools/check_identical_lib.sh b/tools/check_identical_lib.sh
index 01007c0..c3aa41a 100755
--- a/tools/check_identical_lib.sh
+++ b/tools/check_identical_lib.sh
@@ -5,11 +5,13 @@
CORE="${2}"
VENDOR="${3}"
-stripped_core="${CORE}.vndk_lib_check.stripped"
-stripped_vendor="${VENDOR}.vndk_lib_check.stripped"
+TMPDIR="$(mktemp -d ${CORE}.vndk_lib_check.XXXXXXXX)"
+stripped_core="${TMPDIR}/core"
+stripped_vendor="${TMPDIR}/vendor"
function cleanup() {
- rm -f ${stripped_core} ${stripped_vendor}
+ rm -f "${stripped_core}" "${stripped_vendor}"
+ rmdir "${TMPDIR}"
}
trap cleanup EXIT
diff --git a/tools/event_log_tags.py b/tools/event_log_tags.py
index 645839e..35b2de0 100644
--- a/tools/event_log_tags.py
+++ b/tools/event_log_tags.py
@@ -62,9 +62,9 @@
try:
for self.linenum, line in enumerate(file_object):
self.linenum += 1
-
+ line = re.sub('#.*$', '', line) # strip trailing comments
line = line.strip()
- if not line or line[0] == '#': continue
+ if not line: continue
parts = re.split(r"\s+", line, 2)
if len(parts) < 2:
diff --git a/tools/fs_config/Android.bp b/tools/fs_config/Android.bp
index 8c69417..1dd5e4a 100644
--- a/tools/fs_config/Android.bp
+++ b/tools/fs_config/Android.bp
@@ -52,6 +52,7 @@
cc_library_headers {
name: "oemaids_headers",
+ vendor_available: true,
generated_headers: ["oemaids_header_gen"],
export_generated_headers: ["oemaids_header_gen"],
}
diff --git a/tools/fs_config/fs_config.c b/tools/fs_config/fs_config.c
index 2952875..2a75add 100644
--- a/tools/fs_config/fs_config.c
+++ b/tools/fs_config/fs_config.c
@@ -26,6 +26,7 @@
#include <selinux/label.h>
#include "private/android_filesystem_config.h"
+#include "private/fs_config.h"
// This program takes a list of files and directories (indicated by a
// trailing slash) on the stdin, and prints to stdout each input
diff --git a/tools/fs_get_stats/fs_get_stats.c b/tools/fs_get_stats/fs_get_stats.c
index 159e2aa..64ef0e2 100644
--- a/tools/fs_get_stats/fs_get_stats.c
+++ b/tools/fs_get_stats/fs_get_stats.c
@@ -4,6 +4,7 @@
#include <unistd.h>
#include <private/android_filesystem_config.h>
+#include <private/fs_config.h>
#define DO_DEBUG 1
diff --git a/tools/generate-self-extracting-archive.py b/tools/generate-self-extracting-archive.py
index f0b7568..5b0628d 100755
--- a/tools/generate-self-extracting-archive.py
+++ b/tools/generate-self-extracting-archive.py
@@ -38,7 +38,7 @@
import os
import zipfile
-_HEADER_TEMPLATE = """#!/bin/sh
+_HEADER_TEMPLATE = """#!/bin/bash
#
{comment_line}
#
@@ -91,8 +91,8 @@
break
dst.write(b)
-_MAX_OFFSET_WIDTH = 8
-def _generate_extract_command(start, end, extract_name):
+_MAX_OFFSET_WIDTH = 20
+def _generate_extract_command(start, size, extract_name):
"""Generate the extract command.
The length of this string must be constant no matter what the start and end
@@ -101,7 +101,7 @@
Args:
start: offset in bytes of the start of the wrapped file
- end: offset in bytes of the end of the wrapped file
+ size: size in bytes of the wrapped file
extract_name: of the file to create when extracted
"""
@@ -111,14 +111,18 @@
if len(start_str) != _MAX_OFFSET_WIDTH + 1:
raise Exception('Start offset too large (%d)' % start)
- end_str = ('%d' % end).rjust(_MAX_OFFSET_WIDTH)
- if len(end_str) != _MAX_OFFSET_WIDTH:
- raise Exception('End offset too large (%d)' % end)
+ size_str = ('%d' % size).rjust(_MAX_OFFSET_WIDTH)
+ if len(size_str) != _MAX_OFFSET_WIDTH:
+ raise Exception('Size too large (%d)' % size)
- return "tail -c %s $0 | head -c %s > %s\n" % (start_str, end_str, extract_name)
+ return "tail -c %s $0 | head -c %s > %s\n" % (start_str, size_str, extract_name)
def main(argv):
+ if len(argv) != 5:
+ print 'generate-self-extracting-archive.py expects exactly 4 arguments'
+ sys.exit(1)
+
output_filename = argv[1]
input_archive_filename = argv[2]
comment = argv[3]
@@ -129,6 +133,14 @@
with open(license_filename, 'r') as license_file:
license = license_file.read()
+ if not license:
+ print 'License file was empty'
+ sys.exit(1)
+
+ if 'SOFTWARE LICENSE AGREEMENT' not in license:
+ print 'License does not look like a license'
+ sys.exit(1)
+
comment_line = '# %s\n' % comment
extract_name = os.path.basename(input_archive_filename)
@@ -161,5 +173,9 @@
trailing_zip.seek(0)
_pipe_bytes(trailing_zip, output)
+ umask = os.umask(0)
+ os.umask(umask)
+ os.chmod(output_filename, 0o777 & ~umask)
+
if __name__ == "__main__":
main(sys.argv)
diff --git a/tools/post_process_props.py b/tools/post_process_props.py
index 9ddd5d7..4fa15bc 100755
--- a/tools/post_process_props.py
+++ b/tools/post_process_props.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
#
# Copyright (C) 2009 The Android Open Source Project
#
@@ -24,121 +24,117 @@
# so we decrease the value by 1 here.
PROP_VALUE_MAX = 91
-# Put the modifications that you need to make into the /system/build.prop into this
-# function. The prop object has get(name) and put(name,value) methods.
-def mangle_build_prop(prop):
- pass
-
-# Put the modifications that you need to make into /vendor/default.prop and
-# /odm/default.prop into this function. The prop object has get(name) and
-# put(name,value) methods.
-def mangle_default_prop_override(prop):
- pass
-
-# Put the modifications that you need to make into the /system/etc/prop.default into this
-# function. The prop object has get(name) and put(name,value) methods.
-def mangle_default_prop(prop):
+# Put the modifications that you need to make into the */build.prop into this
+# function.
+def mangle_build_prop(prop_list):
# If ro.debuggable is 1, then enable adb on USB by default
# (this is for userdebug builds)
- if prop.get("ro.debuggable") == "1":
- val = prop.get("persist.sys.usb.config")
+ if prop_list.get("ro.debuggable") == "1":
+ val = prop_list.get("persist.sys.usb.config")
if "adb" not in val:
if val == "":
val = "adb"
else:
val = val + ",adb"
- prop.put("persist.sys.usb.config", val)
+ prop_list.put("persist.sys.usb.config", val)
# UsbDeviceManager expects a value here. If it doesn't get it, it will
# default to "adb". That might not the right policy there, but it's better
# to be explicit.
- if not prop.get("persist.sys.usb.config"):
- prop.put("persist.sys.usb.config", "none");
+ if not prop_list.get("persist.sys.usb.config"):
+ prop_list.put("persist.sys.usb.config", "none");
-def validate(prop):
+def validate(prop_list):
"""Validate the properties.
Returns:
True if nothing is wrong.
"""
check_pass = True
- buildprops = prop.to_dict()
- for key, value in buildprops.iteritems():
- # Check build properties' length.
- if len(value) > PROP_VALUE_MAX and not key.startswith("ro."):
+ for p in prop_list.get_all():
+ if len(p.value) > PROP_VALUE_MAX and not p.name.startswith("ro."):
check_pass = False
sys.stderr.write("error: %s cannot exceed %d bytes: " %
- (key, PROP_VALUE_MAX))
- sys.stderr.write("%s (%d)\n" % (value, len(value)))
+ (p.name, PROP_VALUE_MAX))
+ sys.stderr.write("%s (%d)\n" % (p.value, len(p.value)))
return check_pass
-class PropFile:
+class Prop:
- def __init__(self, lines):
- self.lines = [s.strip() for s in lines]
+ def __init__(self, name, value, comment=None):
+ self.name = name.strip()
+ self.value = value.strip()
+ self.comment = comment
- def to_dict(self):
- props = {}
- for line in self.lines:
- if not line or line.startswith("#"):
- continue
- if "=" in line:
- key, value = line.split("=", 1)
- props[key] = value
- return props
+ @staticmethod
+ def from_line(line):
+ line = line.rstrip('\n')
+ if line.startswith("#"):
+ return Prop("", "", line)
+ elif "=" in line:
+ name, value = line.split("=", 1)
+ return Prop(name, value)
+ else:
+ # don't fail on invalid line
+ # TODO(jiyong) make this a hard error
+ return Prop("", "", line)
+
+ def is_comment(self):
+ return self.comment != None
+
+ def __str__(self):
+ if self.is_comment():
+ return self.comment
+ else:
+ return self.name + "=" + self.value
+
+class PropList:
+
+ def __init__(self, filename):
+ with open(filename) as f:
+ self.props = [Prop.from_line(l)
+ for l in f.readlines() if l.strip() != ""]
+
+ def get_all(self):
+ return [p for p in self.props if not p.is_comment()]
def get(self, name):
- key = name + "="
- for line in self.lines:
- if line.startswith(key):
- return line[len(key):]
- return ""
+ return next((p.value for p in self.props if p.name == name), "")
def put(self, name, value):
- key = name + "="
- for i in range(0,len(self.lines)):
- if self.lines[i].startswith(key):
- self.lines[i] = key + value
- return
- self.lines.append(key + value)
+ index = next((i for i,p in enumerate(self.props) if p.name == name), -1)
+ if index == -1:
+ self.props.append(Prop(name, value))
+ else:
+ self.props[index].value = value
def delete(self, name):
- key = name + "="
- self.lines = [ line for line in self.lines if not line.startswith(key) ]
+ index = next((i for i,p in enumerate(self.props) if p.name == name), -1)
+ if index != -1:
+ new_comment = "# removed by post_process_props.py\n#" + str(self.props[index])
+ self.props[index] = Prop.from_line(new_comment)
- def write(self, f):
- f.write("\n".join(self.lines))
- f.write("\n")
+ def write(self, filename):
+ with open(filename, 'w+') as f:
+ for p in self.props:
+ f.write(str(p) + "\n")
def main(argv):
filename = argv[1]
- f = open(filename)
- lines = f.readlines()
- f.close()
- properties = PropFile(lines)
-
- if filename.endswith("/build.prop"):
- mangle_build_prop(properties)
- elif (filename.endswith("/vendor/default.prop") or
- filename.endswith("/odm/default.prop")):
- mangle_default_prop_override(properties)
- elif (filename.endswith("/default.prop") or # legacy
- filename.endswith("/prop.default")):
- mangle_default_prop(properties)
- else:
+ if not filename.endswith("/build.prop"):
sys.stderr.write("bad command line: " + str(argv) + "\n")
sys.exit(1)
- if not validate(properties):
+ props = PropList(filename)
+ mangle_build_prop(props)
+ if not validate(props):
sys.exit(1)
# Drop any blacklisted keys
for key in argv[2:]:
- properties.delete(key)
+ props.delete(key)
- f = open(filename, 'w+')
- properties.write(f)
- f.close()
+ props.write(filename)
if __name__ == "__main__":
main(sys.argv)
diff --git a/tools/releasetools/Android.bp b/tools/releasetools/Android.bp
index 6cde77e..11f92ab 100644
--- a/tools/releasetools/Android.bp
+++ b/tools/releasetools/Android.bp
@@ -73,9 +73,6 @@
"releasetools_build_super_image",
"releasetools_common",
],
- required: [
- "zip2zip",
- ],
}
python_defaults {
@@ -187,7 +184,9 @@
"bsdiff",
"imgdiff",
"minigzip",
+ "lz4",
"mkbootfs",
+ "signapk",
],
}
@@ -237,6 +236,16 @@
embedded_launcher: false,
},
},
+ // TODO (b/140144201) Build imgdiff from releasetools_common
+ required: [
+ "aapt2",
+ "boot_signer",
+ "brotli",
+ "bsdiff",
+ "imgdiff",
+ "minigzip",
+ "mkbootfs",
+ ],
}
python_binary_host {
@@ -264,6 +273,19 @@
}
python_binary_host {
+ name: "check_partition_sizes",
+ srcs: [
+ "check_partition_sizes.py",
+ ],
+ libs: [
+ "releasetools_common",
+ ],
+ defaults: [
+ "releasetools_binary_defaults",
+ ],
+}
+
+python_binary_host {
name: "check_ota_package_signature",
defaults: ["releasetools_binary_defaults"],
srcs: [
@@ -419,6 +441,7 @@
name: "releasetools_test_defaults",
srcs: [
"check_ota_package_signature.py",
+ "check_partition_sizes.py",
"check_target_files_signatures.py",
"make_recovery_patch.py",
"merge_target_files.py",
@@ -443,9 +466,6 @@
data: [
"testdata/**/*",
],
- required: [
- "otatools",
- ],
}
python_test_host {
diff --git a/tools/releasetools/OWNERS b/tools/releasetools/OWNERS
index 766adb4..d7fc540 100644
--- a/tools/releasetools/OWNERS
+++ b/tools/releasetools/OWNERS
@@ -1,2 +1,4 @@
-tbao@google.com
+elsk@google.com
+nhdo@google.com
xunchang@google.com
+zhaojiac@google.com
diff --git a/tools/releasetools/add_img_to_target_files.py b/tools/releasetools/add_img_to_target_files.py
index 23ae29f..490b44a 100755
--- a/tools/releasetools/add_img_to_target_files.py
+++ b/tools/releasetools/add_img_to_target_files.py
@@ -60,6 +60,7 @@
import common
import rangelib
import sparse_img
+import verity_utils
if sys.hexversion < 0x02070000:
print("Python 2.7 or newer is required.", file=sys.stderr)
@@ -165,9 +166,12 @@
else:
common.ZipWrite(output_zip, output_file, arc_name)
- if (OPTIONS.rebuild_recovery and recovery_img is not None and
- boot_img is not None):
- logger.info("Building new recovery patch")
+ board_uses_vendorimage = OPTIONS.info_dict.get(
+ "board_uses_vendorimage") == "true"
+
+ if (OPTIONS.rebuild_recovery and not board_uses_vendorimage and
+ recovery_img is not None and boot_img is not None):
+ logger.info("Building new recovery patch on system at system/vendor")
common.MakeRecoveryPatch(OPTIONS.input_tmp, output_sink, recovery_img,
boot_img, info_dict=OPTIONS.info_dict)
@@ -190,7 +194,7 @@
CreateImage(OPTIONS.input_tmp, OPTIONS.info_dict, "system_other", img)
-def AddVendor(output_zip):
+def AddVendor(output_zip, recovery_img=None, boot_img=None):
"""Turn the contents of VENDOR into a vendor image and store in it
output_zip."""
@@ -199,6 +203,27 @@
logger.info("vendor.img already exists; no need to rebuild...")
return img.name
+ def output_sink(fn, data):
+ ofile = open(os.path.join(OPTIONS.input_tmp, "VENDOR", fn), "w")
+ ofile.write(data)
+ ofile.close()
+
+ if output_zip:
+ arc_name = "VENDOR/" + fn
+ if arc_name in output_zip.namelist():
+ OPTIONS.replace_updated_files_list.append(arc_name)
+ else:
+ common.ZipWrite(output_zip, ofile.name, arc_name)
+
+ board_uses_vendorimage = OPTIONS.info_dict.get(
+ "board_uses_vendorimage") == "true"
+
+ if (OPTIONS.rebuild_recovery and board_uses_vendorimage and
+ recovery_img is not None and boot_img is not None):
+ logger.info("Building new recovery patch on vendor")
+ common.MakeRecoveryPatch(OPTIONS.input_tmp, output_sink, recovery_img,
+ boot_img, info_dict=OPTIONS.info_dict)
+
block_list = OutputFile(output_zip, OPTIONS.input_tmp, "IMAGES", "vendor.map")
CreateImage(OPTIONS.input_tmp, OPTIONS.info_dict, "vendor", img,
block_list=block_list)
@@ -288,16 +313,61 @@
img.Write()
return img.name
+def AddCustomImages(output_zip, partition_name):
+ """Adds and signs custom images in IMAGES/.
+
+ Args:
+ output_zip: The output zip file (needs to be already open), or None to
+ write images to OPTIONS.input_tmp/.
+
+ Uses the image under IMAGES/ if it already exists. Otherwise looks for the
+ image under PREBUILT_IMAGES/, signs it as needed, and returns the image name.
+
+ Raises:
+ AssertionError: If image can't be found.
+ """
+
+ partition_size = OPTIONS.info_dict.get(
+ "avb_{}_partition_size".format(partition_name))
+ key_path = OPTIONS.info_dict.get("avb_{}_key_path".format(partition_name))
+ algorithm = OPTIONS.info_dict.get("avb_{}_algorithm".format(partition_name))
+ extra_args = OPTIONS.info_dict.get(
+ "avb_{}_add_hashtree_footer_args".format(partition_name))
+ partition_size = OPTIONS.info_dict.get(
+ "avb_{}_partition_size".format(partition_name))
+
+ builder = verity_utils.CreateCustomImageBuilder(
+ OPTIONS.info_dict, partition_name, partition_size,
+ key_path, algorithm, extra_args)
+
+ for img_name in OPTIONS.info_dict.get(
+ "avb_{}_image_list".format(partition_name)).split():
+ custom_image = OutputFile(output_zip, OPTIONS.input_tmp, "IMAGES", img_name)
+ if os.path.exists(custom_image.name):
+ continue
+
+ custom_image_prebuilt_path = os.path.join(
+ OPTIONS.input_tmp, "PREBUILT_IMAGES", img_name)
+ assert os.path.exists(custom_image_prebuilt_path), \
+ "Failed to find %s at %s" % (img_name, custom_image_prebuilt_path)
+
+ shutil.copy(custom_image_prebuilt_path, custom_image.name)
+
+ if builder is not None:
+ builder.Build(custom_image.name)
+
+ custom_image.Write()
+
+ default = os.path.join(OPTIONS.input_tmp, "IMAGES", partition_name + ".img")
+ assert os.path.exists(default), \
+ "There should be one %s.img" % (partition_name)
+ return default
+
def CreateImage(input_dir, info_dict, what, output_file, block_list=None):
logger.info("creating %s.img...", what)
image_props = build_image.ImagePropFromGlobalDict(info_dict, what)
- fstab = info_dict["fstab"]
- mount_point = "/" + what
- if fstab and mount_point in fstab:
- image_props["fs_type"] = fstab[mount_point].fs_type
-
image_props["timestamp"] = FIXED_FILE_TIMESTAMP
if what == "system":
@@ -318,13 +388,8 @@
# Use repeatable ext4 FS UUID and hash_seed UUID (based on partition name and
# build fingerprint).
- uuid_seed = what + "-"
- if "build.prop" in info_dict:
- build_prop = info_dict["build.prop"]
- if "ro.build.fingerprint" in build_prop:
- uuid_seed += build_prop["ro.build.fingerprint"]
- elif "ro.build.thumbprint" in build_prop:
- uuid_seed += build_prop["ro.build.thumbprint"]
+ build_info = common.BuildInfo(info_dict)
+ uuid_seed = what + "-" + build_info.GetPartitionFingerprint(what)
image_props["uuid"] = str(uuid.uuid5(uuid.NAMESPACE_URL, uuid_seed))
hash_seed = "hash_seed-" + uuid_seed
image_props["hash_seed"] = str(uuid.uuid5(uuid.NAMESPACE_URL, hash_seed))
@@ -382,9 +447,6 @@
else:
user_dir = common.MakeTempDir()
- fstab = OPTIONS.info_dict["fstab"]
- if fstab:
- image_props["fs_type"] = fstab["/data"].fs_type
build_image.BuildImage(user_dir, image_props, img.name)
common.CheckSize(img.name, "userdata.img", OPTIONS.info_dict)
@@ -400,8 +462,9 @@
Args:
output_zip: The output zip file, which needs to be already open.
partitions: A dict that's keyed by partition names with image paths as
- values. Only valid partition names are accepted, as listed in
- common.AVB_PARTITIONS.
+ values. Only valid partition names are accepted, as partitions listed
+ in common.AVB_PARTITIONS and custom partitions listed in
+ OPTIONS.info_dict.get("avb_custom_images_partition_list")
name: Name of the VBMeta partition, e.g. 'vbmeta', 'vbmeta_system'.
needed_partitions: Partitions whose descriptors should be included into the
generated VBMeta image.
@@ -471,10 +534,6 @@
image_props["timestamp"] = FIXED_FILE_TIMESTAMP
user_dir = common.MakeTempDir()
-
- fstab = OPTIONS.info_dict["fstab"]
- if fstab:
- image_props["fs_type"] = fstab["/cache"].fs_type
build_image.BuildImage(user_dir, image_props, img.name)
common.CheckSize(img.name, "cache.img", OPTIONS.info_dict)
@@ -541,17 +600,19 @@
care_map_list += care_map
# adds fingerprint field to the care_map
- build_props = OPTIONS.info_dict.get(partition + ".build.prop", {})
+ # TODO(xunchang) revisit the fingerprint calculation for care_map.
+ partition_props = OPTIONS.info_dict.get(partition + ".build.prop")
prop_name_list = ["ro.{}.build.fingerprint".format(partition),
"ro.{}.build.thumbprint".format(partition)]
- present_props = [x for x in prop_name_list if x in build_props]
+ present_props = [x for x in prop_name_list if
+ partition_props and partition_props.GetProp(x)]
if not present_props:
logger.warning("fingerprint is not present for partition %s", partition)
property_id, fingerprint = "unknown", "unknown"
else:
property_id = present_props[0]
- fingerprint = build_props[property_id]
+ fingerprint = partition_props.GetProp(property_id)
care_map_list += [property_id, fingerprint]
if not care_map_list:
@@ -673,6 +734,7 @@
has_recovery = OPTIONS.info_dict.get("no_recovery") != "true"
has_boot = OPTIONS.info_dict.get("no_boot") != "true"
+ has_vendor_boot = OPTIONS.info_dict.get("vendor_boot") == "true"
# {vendor,odm,product,system_ext}.img are unlike system.img or
# system_other.img. Because it could be built from source, or dropped into
@@ -715,7 +777,7 @@
# A map between partition names and their paths, which could be used when
# generating AVB vbmeta image.
- partitions = dict()
+ partitions = {}
def banner(s):
logger.info("\n\n++++ %s ++++\n\n", s)
@@ -723,16 +785,37 @@
boot_image = None
if has_boot:
banner("boot")
- # common.GetBootableImage() returns the image directly if present.
- boot_image = common.GetBootableImage(
- "IMAGES/boot.img", "boot.img", OPTIONS.input_tmp, "BOOT")
- # boot.img may be unavailable in some targets (e.g. aosp_arm64).
- if boot_image:
- partitions['boot'] = os.path.join(OPTIONS.input_tmp, "IMAGES", "boot.img")
- if not os.path.exists(partitions['boot']):
- boot_image.WriteToDir(OPTIONS.input_tmp)
+ boot_images = OPTIONS.info_dict.get("boot_images")
+ if boot_images is None:
+ boot_images = "boot.img"
+ for b in boot_images.split():
+ # common.GetBootableImage() returns the image directly if present.
+ boot_image = common.GetBootableImage(
+ "IMAGES/" + b, b, OPTIONS.input_tmp, "BOOT")
+ # boot.img may be unavailable in some targets (e.g. aosp_arm64).
+ if boot_image:
+ boot_image_path = os.path.join(OPTIONS.input_tmp, "IMAGES", b)
+ # vbmeta does not need to include boot.img with multiple boot.img files,
+ # which is only used for aosp_arm64 for GKI
+ if len(boot_images.split()) == 1:
+ partitions['boot'] = boot_image_path
+ if not os.path.exists(boot_image_path):
+ boot_image.WriteToDir(OPTIONS.input_tmp)
+ if output_zip:
+ boot_image.AddToZip(output_zip)
+
+ if has_vendor_boot:
+ banner("vendor_boot")
+ vendor_boot_image = common.GetVendorBootImage(
+ "IMAGES/vendor_boot.img", "vendor_boot.img", OPTIONS.input_tmp,
+ "VENDOR_BOOT")
+ if vendor_boot_image:
+ partitions['vendor_boot'] = os.path.join(OPTIONS.input_tmp, "IMAGES",
+ "vendor_boot.img")
+ if not os.path.exists(partitions['vendor_boot']):
+ vendor_boot_image.WriteToDir(OPTIONS.input_tmp)
if output_zip:
- boot_image.AddToZip(output_zip)
+ vendor_boot_image.AddToZip(output_zip)
recovery_image = None
if has_recovery:
@@ -767,7 +850,8 @@
if has_vendor:
banner("vendor")
- partitions['vendor'] = AddVendor(output_zip)
+ partitions['vendor'] = AddVendor(
+ output_zip, recovery_img=recovery_image, boot_img=boot_image)
if has_product:
banner("product")
@@ -799,11 +883,20 @@
banner("dtbo")
partitions['dtbo'] = AddDtbo(output_zip)
+ # Custom images.
+ custom_partitions = OPTIONS.info_dict.get(
+ "avb_custom_images_partition_list", "").strip().split()
+ for partition_name in custom_partitions:
+ partition_name = partition_name.strip()
+ banner("custom images for " + partition_name)
+ partitions[partition_name] = AddCustomImages(output_zip, partition_name)
+
if OPTIONS.info_dict.get("avb_enable") == "true":
# vbmeta_partitions includes the partitions that should be included into
# top-level vbmeta.img, which are the ones that are not included in any
# chained VBMeta image plus the chained VBMeta images themselves.
- vbmeta_partitions = common.AVB_PARTITIONS[:]
+ # Currently custom_partitions are all chained to VBMeta image.
+ vbmeta_partitions = common.AVB_PARTITIONS[:] + tuple(custom_partitions)
vbmeta_system = OPTIONS.info_dict.get("avb_vbmeta_system", "").strip()
if vbmeta_system:
diff --git a/tools/releasetools/apex_utils.py b/tools/releasetools/apex_utils.py
index ee3c463..1c61938 100644
--- a/tools/releasetools/apex_utils.py
+++ b/tools/releasetools/apex_utils.py
@@ -18,6 +18,7 @@
import os.path
import re
import shlex
+import shutil
import zipfile
import common
@@ -26,6 +27,8 @@
OPTIONS = common.OPTIONS
+APEX_PAYLOAD_IMAGE = 'apex_payload.img'
+
class ApexInfoError(Exception):
"""An Exception raised during Apex Information command."""
@@ -41,8 +44,132 @@
Exception.__init__(self, message)
+class ApexApkSigner(object):
+ """Class to sign the apk files in a apex payload image and repack the apex"""
+
+ def __init__(self, apex_path, key_passwords, codename_to_api_level_map):
+ self.apex_path = apex_path
+ self.key_passwords = key_passwords
+ self.codename_to_api_level_map = codename_to_api_level_map
+
+ def ProcessApexFile(self, apk_keys, payload_key, signing_args=None):
+ """Scans and signs the apk files and repack the apex
+
+ Args:
+ apk_keys: A dict that holds the signing keys for apk files.
+
+ Returns:
+ The repacked apex file containing the signed apk files.
+ """
+ list_cmd = ['deapexer', 'list', self.apex_path]
+ entries_names = common.RunAndCheckOutput(list_cmd).split()
+ apk_entries = [name for name in entries_names if name.endswith('.apk')]
+
+ # No need to sign and repack, return the original apex path.
+ if not apk_entries:
+ logger.info('No apk file to sign in %s', self.apex_path)
+ return self.apex_path
+
+ for entry in apk_entries:
+ apk_name = os.path.basename(entry)
+ if apk_name not in apk_keys:
+ raise ApexSigningError('Failed to find signing keys for apk file {} in'
+ ' apex {}. Use "-e <apkname>=" to specify a key'
+ .format(entry, self.apex_path))
+ if not any(dirname in entry for dirname in ['app/', 'priv-app/',
+ 'overlay/']):
+ logger.warning('Apk path does not contain the intended directory name:'
+ ' %s', entry)
+
+ payload_dir, has_signed_apk = self.ExtractApexPayloadAndSignApks(
+ apk_entries, apk_keys)
+ if not has_signed_apk:
+ logger.info('No apk file has been signed in %s', self.apex_path)
+ return self.apex_path
+
+ return self.RepackApexPayload(payload_dir, payload_key, signing_args)
+
+ def ExtractApexPayloadAndSignApks(self, apk_entries, apk_keys):
+ """Extracts the payload image and signs the containing apk files."""
+ payload_dir = common.MakeTempDir()
+ extract_cmd = ['deapexer', 'extract', self.apex_path, payload_dir]
+ common.RunAndCheckOutput(extract_cmd)
+
+ has_signed_apk = False
+ for entry in apk_entries:
+ apk_path = os.path.join(payload_dir, entry)
+ assert os.path.exists(self.apex_path)
+
+ key_name = apk_keys.get(os.path.basename(entry))
+ if key_name in common.SPECIAL_CERT_STRINGS:
+ logger.info('Not signing: %s due to special cert string', apk_path)
+ continue
+
+ logger.info('Signing apk file %s in apex %s', apk_path, self.apex_path)
+ # Rename the unsigned apk and overwrite the original apk path with the
+ # signed apk file.
+ unsigned_apk = common.MakeTempFile()
+ os.rename(apk_path, unsigned_apk)
+ common.SignFile(unsigned_apk, apk_path, key_name, self.key_passwords,
+ codename_to_api_level_map=self.codename_to_api_level_map)
+ has_signed_apk = True
+ return payload_dir, has_signed_apk
+
+ def RepackApexPayload(self, payload_dir, payload_key, signing_args=None):
+ """Rebuilds the apex file with the updated payload directory."""
+ apex_dir = common.MakeTempDir()
+ # Extract the apex file and reuse its meta files as repack parameters.
+ common.UnzipToDir(self.apex_path, apex_dir)
+ arguments_dict = {
+ 'manifest': os.path.join(apex_dir, 'apex_manifest.pb'),
+ 'build_info': os.path.join(apex_dir, 'apex_build_info.pb'),
+ 'key': payload_key,
+ }
+ for filename in arguments_dict.values():
+ assert os.path.exists(filename), 'file {} not found'.format(filename)
+
+ # The repack process will add back these files later in the payload image.
+ for name in ['apex_manifest.pb', 'apex_manifest.json', 'lost+found']:
+ path = os.path.join(payload_dir, name)
+ if os.path.isfile(path):
+ os.remove(path)
+ elif os.path.isdir(path):
+ shutil.rmtree(path)
+
+ # TODO(xunchang) the signing process can be improved by using
+ # '--unsigned_payload_only'. But we need to parse the vbmeta earlier for
+ # the signing arguments, e.g. algorithm, salt, etc.
+ payload_img = os.path.join(apex_dir, APEX_PAYLOAD_IMAGE)
+ generate_image_cmd = ['apexer', '--force', '--payload_only',
+ '--do_not_check_keyname', '--apexer_tool_path',
+ os.getenv('PATH')]
+ for key, val in arguments_dict.items():
+ generate_image_cmd.extend(['--' + key, val])
+
+ # Add quote to the signing_args as we will pass
+ # --signing_args "--signing_helper_with_files=%path" to apexer
+ if signing_args:
+ generate_image_cmd.extend(['--signing_args', '"{}"'.format(signing_args)])
+
+ # optional arguments for apex repacking
+ manifest_json = os.path.join(apex_dir, 'apex_manifest.json')
+ if os.path.exists(manifest_json):
+ generate_image_cmd.extend(['--manifest_json', manifest_json])
+ generate_image_cmd.extend([payload_dir, payload_img])
+ if OPTIONS.verbose:
+ generate_image_cmd.append('-v')
+ common.RunAndCheckOutput(generate_image_cmd)
+
+ # Add the payload image back to the apex file.
+ common.ZipDelete(self.apex_path, APEX_PAYLOAD_IMAGE)
+ with zipfile.ZipFile(self.apex_path, 'a') as output_apex:
+ common.ZipWrite(output_apex, payload_img, APEX_PAYLOAD_IMAGE,
+ compress_type=zipfile.ZIP_STORED)
+ return self.apex_path
+
+
def SignApexPayload(avbtool, payload_file, payload_key_path, payload_key_name,
- algorithm, salt, no_hashtree, signing_args=None):
+ algorithm, salt, hash_algorithm, no_hashtree, signing_args=None):
"""Signs a given payload_file with the payload key."""
# Add the new footer. Old footer, if any, will be replaced by avbtool.
cmd = [avbtool, 'add_hashtree_footer',
@@ -51,7 +178,8 @@
'--key', payload_key_path,
'--prop', 'apex.key:{}'.format(payload_key_name),
'--image', payload_file,
- '--salt', salt]
+ '--salt', salt,
+ '--hash_algorithm', hash_algorithm]
if no_hashtree:
cmd.append('--no_hashtree')
if signing_args:
@@ -108,11 +236,11 @@
'Failed to get APEX payload info for {}:\n{}'.format(
payload_path, e))
- # Extract the Algorithm / Salt / Prop info / Tree size from payload (i.e. an
- # image signed with avbtool). For example,
+ # Extract the Algorithm / Hash Algorithm / Salt / Prop info / Tree size from
+ # payload (i.e. an image signed with avbtool). For example,
# Algorithm: SHA256_RSA4096
PAYLOAD_INFO_PATTERN = (
- r'^\s*(?P<key>Algorithm|Salt|Prop|Tree Size)\:\s*(?P<value>.*?)$')
+ r'^\s*(?P<key>Algorithm|Hash Algorithm|Salt|Prop|Tree Size)\:\s*(?P<value>.*?)$')
payload_info_matcher = re.compile(PAYLOAD_INFO_PATTERN)
payload_info = {}
@@ -146,7 +274,7 @@
payload_info[key] = value
# Sanity check.
- for key in ('Algorithm', 'Salt', 'apex.key'):
+ for key in ('Algorithm', 'Salt', 'apex.key', 'Hash Algorithm'):
if key not in payload_info:
raise ApexInfoError(
'Failed to find {} prop in {}'.format(key, payload_path))
@@ -155,7 +283,8 @@
def SignApex(avbtool, apex_data, payload_key, container_key, container_pw,
- codename_to_api_level_map, no_hashtree, signing_args=None):
+ apk_keys, codename_to_api_level_map,
+ no_hashtree, signing_args=None):
"""Signs the current APEX with the given payload/container keys.
Args:
@@ -163,6 +292,7 @@
payload_key: The path to payload signing key (w/ extension).
container_key: The path to container signing key (w/o extension).
container_pw: The matching password of the container_key, or None.
+ apk_keys: A dict that holds the signing keys for apk files.
codename_to_api_level_map: A dict that maps from codename to API level.
no_hashtree: Don't include hashtree in the signed APEX.
signing_args: Additional args to be passed to the payload signer.
@@ -174,10 +304,15 @@
with open(apex_file, 'wb') as apex_fp:
apex_fp.write(apex_data)
- APEX_PAYLOAD_IMAGE = 'apex_payload.img'
APEX_PUBKEY = 'apex_pubkey'
- # 1a. Extract and sign the APEX_PAYLOAD_IMAGE entry with the given
+ # 1. Extract the apex payload image and sign the containing apk files. Repack
+ # the apex file after signing.
+ apk_signer = ApexApkSigner(apex_file, container_pw,
+ codename_to_api_level_map)
+ apex_file = apk_signer.ProcessApexFile(apk_keys, payload_key, signing_args)
+
+ # 2a. Extract and sign the APEX_PAYLOAD_IMAGE entry with the given
# payload_key.
payload_dir = common.MakeTempDir(prefix='apex-payload-')
with zipfile.ZipFile(apex_file) as apex_fd:
@@ -192,12 +327,12 @@
payload_info['apex.key'],
payload_info['Algorithm'],
payload_info['Salt'],
+ payload_info['Hash Algorithm'],
no_hashtree,
signing_args)
- # 1b. Update the embedded payload public key.
+ # 2b. Update the embedded payload public key.
payload_public_key = common.ExtractAvbPublicKey(avbtool, payload_key)
-
common.ZipDelete(apex_file, APEX_PAYLOAD_IMAGE)
if APEX_PUBKEY in zip_items:
common.ZipDelete(apex_file, APEX_PUBKEY)
@@ -206,11 +341,11 @@
common.ZipWrite(apex_zip, payload_public_key, arcname=APEX_PUBKEY)
common.ZipClose(apex_zip)
- # 2. Align the files at page boundary (same as in apexer).
+ # 3. Align the files at page boundary (same as in apexer).
aligned_apex = common.MakeTempFile(prefix='apex-container-', suffix='.apex')
common.RunAndCheckOutput(['zipalign', '-f', '4096', apex_file, aligned_apex])
- # 3. Sign the APEX container with container_key.
+ # 4. Sign the APEX container with container_key.
signed_apex = common.MakeTempFile(prefix='apex-container-', suffix='.apex')
# Specify the 4K alignment when calling SignApk.
diff --git a/tools/releasetools/blockimgdiff.py b/tools/releasetools/blockimgdiff.py
index 72f065d..8b6a690 100644
--- a/tools/releasetools/blockimgdiff.py
+++ b/tools/releasetools/blockimgdiff.py
@@ -1558,6 +1558,7 @@
split_large_apks = []
cache_size = common.OPTIONS.cache_size
split_threshold = 0.125
+ assert cache_size is not None
max_blocks_per_transfer = int(cache_size * split_threshold /
self.tgt.blocksize)
empty = RangeSet()
diff --git a/tools/releasetools/build_image.py b/tools/releasetools/build_image.py
index af508fe..7567346 100755
--- a/tools/releasetools/build_image.py
+++ b/tools/releasetools/build_image.py
@@ -57,7 +57,7 @@
Returns:
The number of bytes based on a 1K block_size.
"""
- cmd = ["du", "-k", "-s", path]
+ cmd = ["du", "-b", "-k", "-s", path]
output = common.RunAndCheckOutput(cmd, verbose=False)
return int(output.split()[0]) * 1024
@@ -248,6 +248,8 @@
build_command = []
fs_type = prop_dict.get("fs_type", "")
run_e2fsck = False
+ needs_projid = prop_dict.get("needs_projid", 0)
+ needs_casefold = prop_dict.get("needs_casefold", 0)
if fs_type.startswith("ext"):
build_command = [prop_dict["ext_mkuserimg"]]
@@ -285,9 +287,12 @@
build_command.extend(["-U", prop_dict["uuid"]])
if "hash_seed" in prop_dict:
build_command.extend(["-S", prop_dict["hash_seed"]])
- if "ext4_share_dup_blocks" in prop_dict:
+ if prop_dict.get("ext4_share_dup_blocks") == "true":
build_command.append("-c")
- build_command.extend(["--inode_size", "256"])
+ if (needs_projid):
+ build_command.extend(["--inode_size", "512"])
+ else:
+ build_command.extend(["--inode_size", "256"])
if "selinux_fc" in prop_dict:
build_command.append(prop_dict["selinux_fc"])
elif fs_type.startswith("squash"):
@@ -315,6 +320,8 @@
elif fs_type.startswith("f2fs"):
build_command = ["mkf2fsuserimg.sh"]
build_command.extend([out_file, prop_dict["image_size"]])
+ if "f2fs_sparse_flag" in prop_dict:
+ build_command.extend([prop_dict["f2fs_sparse_flag"]])
if fs_config:
build_command.extend(["-C", fs_config])
build_command.extend(["-f", in_dir])
@@ -326,6 +333,10 @@
if "timestamp" in prop_dict:
build_command.extend(["-T", str(prop_dict["timestamp"])])
build_command.extend(["-L", prop_dict["mount_point"]])
+ if (needs_projid):
+ build_command.append("--prjquota")
+ if (needs_casefold):
+ build_command.append("--casefold")
else:
raise BuildImageError(
"Error: unknown filesystem type: {}".format(fs_type))
@@ -498,9 +509,9 @@
d = {}
if "build.prop" in glob_dict:
- bp = glob_dict["build.prop"]
- if "ro.build.date.utc" in bp:
- d["timestamp"] = bp["ro.build.date.utc"]
+ timestamp = glob_dict["build.prop"].GetProp("ro.build.date.utc")
+ if timestamp:
+ d["timestamp"] = timestamp
def copy_prop(src_p, dest_p):
"""Copy a property from the global dictionary.
@@ -519,6 +530,7 @@
common_props = (
"extfs_sparse_flag",
"squashfs_sparse_flag",
+ "f2fs_sparse_flag",
"skip_fsck",
"ext_mkuserimg",
"verity",
@@ -528,7 +540,6 @@
"verity_disable",
"avb_enable",
"avb_avbtool",
- "avb_salt",
"use_dynamic_partition_size",
)
for p in common_props:
@@ -541,6 +552,7 @@
"avb_add_hashtree_footer_args")
copy_prop("avb_system_key_path", "avb_key_path")
copy_prop("avb_system_algorithm", "avb_algorithm")
+ copy_prop("avb_system_salt", "avb_salt")
copy_prop("fs_type", "fs_type")
# Copy the generic system fs type first, override with specific one if
# available.
@@ -572,6 +584,7 @@
"avb_add_hashtree_footer_args")
copy_prop("avb_system_other_key_path", "avb_key_path")
copy_prop("avb_system_other_algorithm", "avb_algorithm")
+ copy_prop("avb_system_other_salt", "avb_salt")
copy_prop("fs_type", "fs_type")
copy_prop("system_fs_type", "fs_type")
copy_prop("system_other_size", "partition_size")
@@ -582,7 +595,6 @@
copy_prop("system_squashfs_compressor", "squashfs_compressor")
copy_prop("system_squashfs_compressor_opt", "squashfs_compressor_opt")
copy_prop("system_squashfs_block_size", "squashfs_block_size")
- copy_prop("system_base_fs_file", "base_fs_file")
copy_prop("system_extfs_inode_count", "extfs_inode_count")
if not copy_prop("system_extfs_rsv_pct", "extfs_rsv_pct"):
d["extfs_rsv_pct"] = "0"
@@ -596,6 +608,8 @@
copy_prop("flash_logical_block_size", "flash_logical_block_size")
copy_prop("flash_erase_block_size", "flash_erase_block_size")
copy_prop("userdata_selinux_fc", "selinux_fc")
+ copy_prop("needs_casefold", "needs_casefold")
+ copy_prop("needs_projid", "needs_projid")
elif mount_point == "cache":
copy_prop("cache_fs_type", "fs_type")
copy_prop("cache_size", "partition_size")
@@ -606,6 +620,7 @@
"avb_add_hashtree_footer_args")
copy_prop("avb_vendor_key_path", "avb_key_path")
copy_prop("avb_vendor_algorithm", "avb_algorithm")
+ copy_prop("avb_vendor_salt", "avb_salt")
copy_prop("vendor_fs_type", "fs_type")
copy_prop("vendor_size", "partition_size")
if not copy_prop("vendor_journal_size", "journal_size"):
@@ -628,6 +643,7 @@
"avb_add_hashtree_footer_args")
copy_prop("avb_product_key_path", "avb_key_path")
copy_prop("avb_product_algorithm", "avb_algorithm")
+ copy_prop("avb_product_salt", "avb_salt")
copy_prop("product_fs_type", "fs_type")
copy_prop("product_size", "partition_size")
if not copy_prop("product_journal_size", "journal_size"):
@@ -650,6 +666,7 @@
"avb_add_hashtree_footer_args")
copy_prop("avb_system_ext_key_path", "avb_key_path")
copy_prop("avb_system_ext_algorithm", "avb_algorithm")
+ copy_prop("avb_system_ext_salt", "avb_salt")
copy_prop("system_ext_fs_type", "fs_type")
copy_prop("system_ext_size", "partition_size")
if not copy_prop("system_ext_journal_size", "journal_size"):
@@ -674,6 +691,7 @@
"avb_add_hashtree_footer_args")
copy_prop("avb_odm_key_path", "avb_key_path")
copy_prop("avb_odm_algorithm", "avb_algorithm")
+ copy_prop("avb_odm_salt", "avb_salt")
copy_prop("odm_fs_type", "fs_type")
copy_prop("odm_size", "partition_size")
if not copy_prop("odm_journal_size", "journal_size"):
diff --git a/tools/releasetools/build_super_image.py b/tools/releasetools/build_super_image.py
index f63453d..fb31415 100755
--- a/tools/releasetools/build_super_image.py
+++ b/tools/releasetools/build_super_image.py
@@ -55,7 +55,7 @@
logger = logging.getLogger(__name__)
-UNZIP_PATTERN = ["IMAGES/*", "META/*"]
+UNZIP_PATTERN = ["IMAGES/*", "META/*", "*/build.prop"]
def GetArgumentsForImage(partition, group, image=None):
@@ -76,6 +76,8 @@
"--super-name", info_dict["super_metadata_device"]]
ab_update = info_dict.get("ab_update") == "true"
+ virtual_ab = info_dict.get("virtual_ab") == "true"
+ virtual_ab_retrofit = info_dict.get("virtual_ab_retrofit") == "true"
retrofit = info_dict.get("dynamic_partition_retrofit") == "true"
block_devices = shlex.split(info_dict.get("super_block_devices", "").strip())
groups = shlex.split(info_dict.get("super_partition_groups", "").strip())
@@ -89,6 +91,8 @@
if ab_update and retrofit:
cmd.append("--auto-slot-suffixing")
+ if virtual_ab and not virtual_ab_retrofit:
+ cmd.append("--virtual-ab")
for device in block_devices:
size = info_dict["super_{}_device_size".format(device)]
diff --git a/tools/releasetools/check_partition_sizes.py b/tools/releasetools/check_partition_sizes.py
new file mode 100644
index 0000000..745c136
--- /dev/null
+++ b/tools/releasetools/check_partition_sizes.py
@@ -0,0 +1,276 @@
+#!/usr/bin/env python
+#
+# Copyright (C) 2019 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.
+
+"""
+Check dynamic partition sizes.
+
+usage: check_partition_sizes [info.txt]
+
+Check dump-super-partitions-info procedure for expected keys in info.txt. In
+addition, *_image (e.g. system_image, vendor_image, etc.) must be defined for
+each partition in dynamic_partition_list.
+
+Exit code is 0 if successful and non-zero if any failures.
+"""
+
+from __future__ import print_function
+
+import logging
+import sys
+
+import common
+import sparse_img
+
+if sys.hexversion < 0x02070000:
+ print("Python 2.7 or newer is required.", file=sys.stderr)
+ sys.exit(1)
+
+logger = logging.getLogger(__name__)
+
+class Expression(object):
+ def __init__(self, desc, expr, value=None):
+ # Human-readable description
+ self.desc = str(desc)
+ # Numeric expression
+ self.expr = str(expr)
+ # Value of expression
+ self.value = int(expr) if value is None else value
+
+ def CheckLe(self, other, level=logging.ERROR):
+ format_args = (self.desc, other.desc, self.expr, self.value,
+ other.expr, other.value)
+ if self.value <= other.value:
+ logger.info("%s is less than or equal to %s:\n%s == %d <= %s == %d",
+ *format_args)
+ else:
+ msg = "{} is greater than {}:\n{} == {} > {} == {}".format(*format_args)
+ if level == logging.ERROR:
+ raise RuntimeError(msg)
+ else:
+ logger.log(level, msg)
+
+ def CheckEq(self, other):
+ format_args = (self.desc, other.desc, self.expr, self.value,
+ other.expr, other.value)
+ if self.value == other.value:
+ logger.info("%s equals %s:\n%s == %d == %s == %d", *format_args)
+ else:
+ raise RuntimeError("{} does not equal {}:\n{} == {} != {} == {}".format(
+ *format_args))
+
+
+# A/B feature flags
+class DeviceType(object):
+ NONE = 0
+ AB = 1
+ RVAB = 2 # retrofit Virtual-A/B
+ VAB = 3
+
+ @staticmethod
+ def Get(info_dict):
+ if info_dict.get("ab_update") != "true":
+ return DeviceType.NONE
+ if info_dict.get("virtual_ab_retrofit") == "true":
+ return DeviceType.RVAB
+ if info_dict.get("virtual_ab") == "true":
+ return DeviceType.VAB
+ return DeviceType.AB
+
+
+# Dynamic partition feature flags
+class Dap(object):
+ NONE = 0
+ RDAP = 1
+ DAP = 2
+
+ @staticmethod
+ def Get(info_dict):
+ if info_dict.get("use_dynamic_partitions") != "true":
+ return Dap.NONE
+ if info_dict.get("dynamic_partition_retrofit") == "true":
+ return Dap.RDAP
+ return Dap.DAP
+
+
+class DynamicPartitionSizeChecker(object):
+ def __init__(self, info_dict):
+ if "super_partition_size" in info_dict:
+ if "super_partition_warn_limit" not in info_dict:
+ info_dict["super_partition_warn_limit"] = \
+ int(info_dict["super_partition_size"]) * 95 // 100
+ if "super_partition_error_limit" not in info_dict:
+ info_dict["super_partition_error_limit"] = \
+ int(info_dict["super_partition_size"])
+ self.info_dict = info_dict
+
+
+ def _ReadSizeOfPartition(self, name):
+ # Tests uses *_image_size instead (to avoid creating empty sparse images
+ # on disk)
+ if name + "_image_size" in self.info_dict:
+ return int(self.info_dict[name + "_image_size"])
+ return sparse_img.GetImagePartitionSize(self.info_dict[name + "_image"])
+
+
+ # Round result to BOARD_SUPER_PARTITION_ALIGNMENT
+ def _RoundPartitionSize(self, size):
+ alignment = self.info_dict.get("super_partition_alignment")
+ if alignment is None:
+ return size
+ return (size + alignment - 1) // alignment * alignment
+
+
+ def _CheckSuperPartitionSize(self):
+ info_dict = self.info_dict
+ super_block_devices = \
+ info_dict.get("super_block_devices", "").strip().split()
+ size_list = [int(info_dict.get("super_{}_device_size".format(b), "0"))
+ for b in super_block_devices]
+ sum_size = Expression("sum of super partition block device sizes",
+ "+".join(str(size) for size in size_list),
+ sum(size_list))
+ super_partition_size = Expression("BOARD_SUPER_PARTITION_SIZE",
+ info_dict["super_partition_size"])
+ sum_size.CheckEq(super_partition_size)
+
+ def _CheckSumOfPartitionSizes(self, max_size, partition_names,
+ warn_size=None, error_size=None):
+ partition_size_list = [self._RoundPartitionSize(
+ self._ReadSizeOfPartition(p)) for p in partition_names]
+ sum_size = Expression("sum of sizes of {}".format(partition_names),
+ "+".join(str(size) for size in partition_size_list),
+ sum(partition_size_list))
+ sum_size.CheckLe(max_size)
+ if error_size:
+ sum_size.CheckLe(error_size)
+ if warn_size:
+ sum_size.CheckLe(warn_size, level=logging.WARNING)
+
+ def _NumDeviceTypesInSuper(self):
+ slot = DeviceType.Get(self.info_dict)
+ dap = Dap.Get(self.info_dict)
+
+ if dap == Dap.NONE:
+ raise RuntimeError("check_partition_sizes should only be executed on "
+ "builds with dynamic partitions enabled")
+
+ # Retrofit dynamic partitions: 1 slot per "super", 2 "super"s on the device
+ if dap == Dap.RDAP:
+ if slot != DeviceType.AB:
+ raise RuntimeError("Device with retrofit dynamic partitions must use "
+ "regular (non-Virtual) A/B")
+ return 1
+
+ # Launch DAP: 1 super on the device
+ assert dap == Dap.DAP
+
+ # DAP + A/B: 2 slots in super
+ if slot == DeviceType.AB:
+ return 2
+
+ # DAP + retrofit Virtual A/B: same as A/B
+ if slot == DeviceType.RVAB:
+ return 2
+
+ # DAP + Launch Virtual A/B: 1 *real* slot in super (2 virtual slots)
+ if slot == DeviceType.VAB:
+ return 1
+
+ # DAP + non-A/B: 1 slot in super
+ assert slot == DeviceType.NONE
+ return 1
+
+ def _CheckAllPartitionSizes(self):
+ info_dict = self.info_dict
+ num_slots = self._NumDeviceTypesInSuper()
+ size_limit_suffix = (" / %d" % num_slots) if num_slots > 1 else ""
+
+ # Check sum(all partitions) <= super partition (/ 2 for A/B devices launched
+ # with dynamic partitions)
+ if "super_partition_size" in info_dict and \
+ "dynamic_partition_list" in info_dict:
+ max_size = Expression(
+ "BOARD_SUPER_PARTITION_SIZE{}".format(size_limit_suffix),
+ int(info_dict["super_partition_size"]) // num_slots)
+ warn_limit = Expression(
+ "BOARD_SUPER_PARTITION_WARN_LIMIT{}".format(size_limit_suffix),
+ int(info_dict["super_partition_warn_limit"]) // num_slots)
+ error_limit = Expression(
+ "BOARD_SUPER_PARTITION_ERROR_LIMIT{}".format(size_limit_suffix),
+ int(info_dict["super_partition_error_limit"]) // num_slots)
+ self._CheckSumOfPartitionSizes(
+ max_size, info_dict["dynamic_partition_list"].strip().split(),
+ warn_limit, error_limit)
+
+ groups = info_dict.get("super_partition_groups", "").strip().split()
+
+ # For each group, check sum(partitions in group) <= group size
+ for group in groups:
+ if "super_{}_group_size".format(group) in info_dict and \
+ "super_{}_partition_list".format(group) in info_dict:
+ group_size = Expression(
+ "BOARD_{}_SIZE".format(group),
+ int(info_dict["super_{}_group_size".format(group)]))
+ self._CheckSumOfPartitionSizes(
+ group_size,
+ info_dict["super_{}_partition_list".format(group)].strip().split())
+
+ # Check sum(all group sizes) <= super partition (/ 2 for A/B devices
+ # launched with dynamic partitions)
+ if "super_partition_size" in info_dict:
+ group_size_list = [int(info_dict.get(
+ "super_{}_group_size".format(group), 0)) for group in groups]
+ sum_size = Expression("sum of sizes of {}".format(groups),
+ "+".join(str(size) for size in group_size_list),
+ sum(group_size_list))
+ max_size = Expression(
+ "BOARD_SUPER_PARTITION_SIZE{}".format(size_limit_suffix),
+ int(info_dict["super_partition_size"]) // num_slots)
+ sum_size.CheckLe(max_size)
+
+ def Run(self):
+ self._CheckAllPartitionSizes()
+ if self.info_dict.get("dynamic_partition_retrofit") == "true":
+ self._CheckSuperPartitionSize()
+
+
+def CheckPartitionSizes(inp):
+ if isinstance(inp, str):
+ info_dict = common.LoadDictionaryFromFile(inp)
+ return DynamicPartitionSizeChecker(info_dict).Run()
+ if isinstance(inp, dict):
+ return DynamicPartitionSizeChecker(inp).Run()
+ raise ValueError("{} is not a dictionary or a valid path".format(inp))
+
+
+def main(argv):
+ args = common.ParseOptions(argv, __doc__)
+ if len(args) != 1:
+ common.Usage(__doc__)
+ sys.exit(1)
+ common.InitLogging()
+ CheckPartitionSizes(args[0])
+
+
+if __name__ == "__main__":
+ try:
+ common.CloseInheritedPipes()
+ main(sys.argv[1:])
+ except common.ExternalError:
+ logger.exception("\n ERROR:\n")
+ sys.exit(1)
+ finally:
+ common.Cleanup()
diff --git a/tools/releasetools/check_target_files_vintf.py b/tools/releasetools/check_target_files_vintf.py
index 543147c..95d09cc 100755
--- a/tools/releasetools/check_target_files_vintf.py
+++ b/tools/releasetools/check_target_files_vintf.py
@@ -38,11 +38,14 @@
# paths (VintfObject.cpp).
# These paths are stored in different directories in target files package, so
# we have to search for the correct path and tell checkvintf to remap them.
+# Look for TARGET_COPY_OUT_* variables in board_config.mk for possible paths for
+# each partition.
DIR_SEARCH_PATHS = {
'/system': ('SYSTEM',),
'/vendor': ('VENDOR', 'SYSTEM/vendor'),
'/product': ('PRODUCT', 'SYSTEM/product'),
- '/odm': ('ODM', 'VENDOR/odm'),
+ '/odm': ('ODM', 'VENDOR/odm', 'SYSTEM/vendor/odm'),
+ '/system_ext': ('SYSTEM_EXT', 'SYSTEM/system_ext'),
}
UNZIP_PATTERN = ['META/*', '*/build.prop']
@@ -64,16 +67,22 @@
def GetArgsForSkus(info_dict):
- skus = info_dict.get('vintf_odm_manifest_skus', '').strip().split()
- if not skus:
- logger.info("ODM_MANIFEST_SKUS is not defined. Check once without SKUs.")
- skus = ['']
- return [['--property', 'ro.boot.product.hardware.sku=' + sku]
- for sku in skus]
+ odm_skus = info_dict.get('vintf_odm_manifest_skus', '').strip().split()
+ if info_dict.get('vintf_include_empty_odm_sku', '') == "true" or not odm_skus:
+ odm_skus += ['']
+
+ vendor_skus = info_dict.get('vintf_vendor_manifest_skus', '').strip().split()
+ if info_dict.get('vintf_include_empty_vendor_sku', '') == "true" or \
+ not vendor_skus:
+ vendor_skus += ['']
+
+ return [['--property', 'ro.boot.product.hardware.sku=' + odm_sku,
+ '--property', 'ro.boot.product.vendor.sku=' + vendor_sku]
+ for odm_sku in odm_skus for vendor_sku in vendor_skus]
def GetArgsForShippingApiLevel(info_dict):
- shipping_api_level = info_dict['vendor.build.prop'].get(
+ shipping_api_level = info_dict['vendor.build.prop'].GetProp(
'ro.product.first_api_level')
if not shipping_api_level:
logger.warning('Cannot determine ro.product.first_api_level')
@@ -86,7 +95,7 @@
config_path = os.path.join(input_tmp, 'META/kernel_configs.txt')
if not os.path.isfile(version_path) or not os.path.isfile(config_path):
- logger.info('Skipping kernel config checks because ' +
+ logger.info('Skipping kernel config checks because '
'PRODUCT_OTA_ENFORCE_VINTF_KERNEL_REQUIREMENTS is not set')
return []
diff --git a/tools/releasetools/common.py b/tools/releasetools/common.py
index 6756049..8a59a39 100644
--- a/tools/releasetools/common.py
+++ b/tools/releasetools/common.py
@@ -47,27 +47,29 @@
class Options(object):
+
def __init__(self):
- base_out_path = os.getenv('OUT_DIR_COMMON_BASE')
- if base_out_path is None:
- base_search_path = "out"
- else:
- base_search_path = os.path.join(base_out_path,
- os.path.basename(os.getcwd()))
+ # Set up search path, in order to find framework/ and lib64/. At the time of
+ # running this function, user-supplied search path (`--path`) hasn't been
+ # available. So the value set here is the default, which might be overridden
+ # by commandline flag later.
+ exec_path = sys.argv[0]
+ if exec_path.endswith('.py'):
+ script_name = os.path.basename(exec_path)
+ # logger hasn't been initialized yet at this point. Use print to output
+ # warnings.
+ print(
+ 'Warning: releasetools script should be invoked as hermetic Python '
+ 'executable -- build and run `{}` directly.'.format(script_name[:-3]),
+ file=sys.stderr)
+ self.search_path = os.path.realpath(os.path.join(os.path.dirname(exec_path), '..'))
- # Python >= 3.3 returns 'linux', whereas Python 2.7 gives 'linux2'.
- platform_search_path = {
- "linux": os.path.join(base_search_path, "host/linux-x86"),
- "linux2": os.path.join(base_search_path, "host/linux-x86"),
- "darwin": os.path.join(base_search_path, "host/darwin-x86"),
- }
-
- self.search_path = platform_search_path.get(sys.platform)
self.signapk_path = "framework/signapk.jar" # Relative to search_path
self.signapk_shared_library_path = "lib64" # Relative to search_path
self.extra_signapk_args = []
self.java_path = "java" # Use the one on the path by default.
self.java_args = ["-Xmx2048m"] # The default JVM args.
+ self.android_jar_path = None
self.public_key_suffix = ".x509.pem"
self.private_key_suffix = ".pk8"
# use otatools built boot_signer by default
@@ -75,6 +77,11 @@
self.boot_signer_args = []
self.verity_signer_path = None
self.verity_signer_args = []
+ self.aftl_tool_path = None
+ self.aftl_server = None
+ self.aftl_key_path = None
+ self.aftl_manufacturer_key_path = None
+ self.aftl_signer_helper = None
self.verbose = False
self.tempfiles = []
self.device_specific = None
@@ -86,6 +93,7 @@
# Stash size cannot exceed cache_size * threshold.
self.cache_size = None
self.stash_threshold = 0.8
+ self.logfile = None
OPTIONS = Options()
@@ -100,7 +108,7 @@
# that system_other is not in the list because we don't want to include its
# descriptor into vbmeta.img.
AVB_PARTITIONS = ('boot', 'dtbo', 'odm', 'product', 'recovery', 'system',
- 'system_ext', 'vendor')
+ 'system_ext', 'vendor', 'vendor_boot')
# Chained VBMeta partitions.
AVB_VBMETA_PARTITIONS = ('vbmeta_system', 'vbmeta_vendor')
@@ -157,13 +165,14 @@
'default': {
'class': 'logging.StreamHandler',
'formatter': 'standard',
+ 'level': 'WARNING',
},
},
'loggers': {
'': {
'handlers': ['default'],
- 'level': 'WARNING',
'propagate': True,
+ 'level': 'INFO',
}
}
}
@@ -176,8 +185,19 @@
# Increase the logging level for verbose mode.
if OPTIONS.verbose:
- config = copy.deepcopy(DEFAULT_LOGGING_CONFIG)
- config['loggers']['']['level'] = 'INFO'
+ config = copy.deepcopy(config)
+ config['handlers']['default']['level'] = 'INFO'
+
+ if OPTIONS.logfile:
+ config = copy.deepcopy(config)
+ config['handlers']['logfile'] = {
+ 'class': 'logging.FileHandler',
+ 'formatter': 'standard',
+ 'level': 'INFO',
+ 'mode': 'w',
+ 'filename': OPTIONS.logfile,
+ }
+ config['loggers']['']['handlers'].append('logfile')
logging.config.dictConfig(config)
@@ -284,6 +304,289 @@
pass
+class BuildInfo(object):
+ """A class that holds the information for a given build.
+
+ This class wraps up the property querying for a given source or target build.
+ It abstracts away the logic of handling OEM-specific properties, and caches
+ the commonly used properties such as fingerprint.
+
+ There are two types of info dicts: a) build-time info dict, which is generated
+ at build time (i.e. included in a target_files zip); b) OEM info dict that is
+ specified at package generation time (via command line argument
+ '--oem_settings'). If a build doesn't use OEM-specific properties (i.e. not
+ having "oem_fingerprint_properties" in build-time info dict), all the queries
+ would be answered based on build-time info dict only. Otherwise if using
+ OEM-specific properties, some of them will be calculated from two info dicts.
+
+ Users can query properties similarly as using a dict() (e.g. info['fstab']),
+ or to query build properties via GetBuildProp() or GetPartitionBuildProp().
+
+ Attributes:
+ info_dict: The build-time info dict.
+ is_ab: Whether it's a build that uses A/B OTA.
+ oem_dicts: A list of OEM dicts.
+ oem_props: A list of OEM properties that should be read from OEM dicts; None
+ if the build doesn't use any OEM-specific property.
+ fingerprint: The fingerprint of the build, which would be calculated based
+ on OEM properties if applicable.
+ device: The device name, which could come from OEM dicts if applicable.
+ """
+
+ _RO_PRODUCT_RESOLVE_PROPS = ["ro.product.brand", "ro.product.device",
+ "ro.product.manufacturer", "ro.product.model",
+ "ro.product.name"]
+ _RO_PRODUCT_PROPS_DEFAULT_SOURCE_ORDER_CURRENT = [
+ "product", "odm", "vendor", "system_ext", "system"]
+ _RO_PRODUCT_PROPS_DEFAULT_SOURCE_ORDER_ANDROID_10 = [
+ "product", "product_services", "odm", "vendor", "system"]
+ _RO_PRODUCT_PROPS_DEFAULT_SOURCE_ORDER_LEGACY = []
+
+ def __init__(self, info_dict, oem_dicts=None):
+ """Initializes a BuildInfo instance with the given dicts.
+
+ Note that it only wraps up the given dicts, without making copies.
+
+ Arguments:
+ info_dict: The build-time info dict.
+ oem_dicts: A list of OEM dicts (which is parsed from --oem_settings). Note
+ that it always uses the first dict to calculate the fingerprint or the
+ device name. The rest would be used for asserting OEM properties only
+ (e.g. one package can be installed on one of these devices).
+
+ Raises:
+ ValueError: On invalid inputs.
+ """
+ self.info_dict = info_dict
+ self.oem_dicts = oem_dicts
+
+ self._is_ab = info_dict.get("ab_update") == "true"
+
+ # Skip _oem_props if oem_dicts is None to use BuildInfo in
+ # sign_target_files_apks
+ if self.oem_dicts:
+ self._oem_props = info_dict.get("oem_fingerprint_properties")
+ else:
+ self._oem_props = None
+
+ def check_fingerprint(fingerprint):
+ if (" " in fingerprint or any(ord(ch) > 127 for ch in fingerprint)):
+ raise ValueError(
+ 'Invalid build fingerprint: "{}". See the requirement in Android CDD '
+ "3.2.2. Build Parameters.".format(fingerprint))
+
+
+ self._partition_fingerprints = {}
+ for partition in PARTITIONS_WITH_CARE_MAP:
+ try:
+ fingerprint = self.CalculatePartitionFingerprint(partition)
+ check_fingerprint(fingerprint)
+ self._partition_fingerprints[partition] = fingerprint
+ except ExternalError:
+ continue
+ if "system" in self._partition_fingerprints:
+ # system_other is not included in PARTITIONS_WITH_CARE_MAP, but does
+ # need a fingerprint when creating the image.
+ self._partition_fingerprints[
+ "system_other"] = self._partition_fingerprints["system"]
+
+ # These two should be computed only after setting self._oem_props.
+ self._device = self.GetOemProperty("ro.product.device")
+ self._fingerprint = self.CalculateFingerprint()
+ check_fingerprint(self._fingerprint)
+
+ @property
+ def is_ab(self):
+ return self._is_ab
+
+ @property
+ def device(self):
+ return self._device
+
+ @property
+ def fingerprint(self):
+ return self._fingerprint
+
+ @property
+ def oem_props(self):
+ return self._oem_props
+
+ def __getitem__(self, key):
+ return self.info_dict[key]
+
+ def __setitem__(self, key, value):
+ self.info_dict[key] = value
+
+ def get(self, key, default=None):
+ return self.info_dict.get(key, default)
+
+ def items(self):
+ return self.info_dict.items()
+
+ def _GetRawBuildProp(self, prop, partition):
+ prop_file = '{}.build.prop'.format(
+ partition) if partition else 'build.prop'
+ partition_props = self.info_dict.get(prop_file)
+ if not partition_props:
+ return None
+ return partition_props.GetProp(prop)
+
+ def GetPartitionBuildProp(self, prop, partition):
+ """Returns the inquired build property for the provided partition."""
+ # If provided a partition for this property, only look within that
+ # partition's build.prop.
+ if prop in BuildInfo._RO_PRODUCT_RESOLVE_PROPS:
+ prop = prop.replace("ro.product", "ro.product.{}".format(partition))
+ else:
+ prop = prop.replace("ro.", "ro.{}.".format(partition))
+
+ prop_val = self._GetRawBuildProp(prop, partition)
+ if prop_val is not None:
+ return prop_val
+ raise ExternalError("couldn't find %s in %s.build.prop" %
+ (prop, partition))
+
+ def GetBuildProp(self, prop):
+ """Returns the inquired build property from the standard build.prop file."""
+ if prop in BuildInfo._RO_PRODUCT_RESOLVE_PROPS:
+ return self._ResolveRoProductBuildProp(prop)
+
+ prop_val = self._GetRawBuildProp(prop, None)
+ if prop_val is not None:
+ return prop_val
+
+ raise ExternalError("couldn't find %s in build.prop" % (prop,))
+
+ def _ResolveRoProductBuildProp(self, prop):
+ """Resolves the inquired ro.product.* build property"""
+ prop_val = self._GetRawBuildProp(prop, None)
+ if prop_val:
+ return prop_val
+
+ default_source_order = self._GetRoProductPropsDefaultSourceOrder()
+ source_order_val = self._GetRawBuildProp(
+ "ro.product.property_source_order", None)
+ if source_order_val:
+ source_order = source_order_val.split(",")
+ else:
+ source_order = default_source_order
+
+ # Check that all sources in ro.product.property_source_order are valid
+ if any([x not in default_source_order for x in source_order]):
+ raise ExternalError(
+ "Invalid ro.product.property_source_order '{}'".format(source_order))
+
+ for source_partition in source_order:
+ source_prop = prop.replace(
+ "ro.product", "ro.product.{}".format(source_partition), 1)
+ prop_val = self._GetRawBuildProp(source_prop, source_partition)
+ if prop_val:
+ return prop_val
+
+ raise ExternalError("couldn't resolve {}".format(prop))
+
+ def _GetRoProductPropsDefaultSourceOrder(self):
+ # NOTE: refer to CDDs and android.os.Build.VERSION for the definition and
+ # values of these properties for each Android release.
+ android_codename = self._GetRawBuildProp("ro.build.version.codename", None)
+ if android_codename == "REL":
+ android_version = self._GetRawBuildProp("ro.build.version.release", None)
+ if android_version == "10":
+ return BuildInfo._RO_PRODUCT_PROPS_DEFAULT_SOURCE_ORDER_ANDROID_10
+ # NOTE: float() conversion of android_version will have rounding error.
+ # We are checking for "9" or less, and using "< 10" is well outside of
+ # possible floating point rounding.
+ try:
+ android_version_val = float(android_version)
+ except ValueError:
+ android_version_val = 0
+ if android_version_val < 10:
+ return BuildInfo._RO_PRODUCT_PROPS_DEFAULT_SOURCE_ORDER_LEGACY
+ return BuildInfo._RO_PRODUCT_PROPS_DEFAULT_SOURCE_ORDER_CURRENT
+
+ def GetOemProperty(self, key):
+ if self.oem_props is not None and key in self.oem_props:
+ return self.oem_dicts[0][key]
+ return self.GetBuildProp(key)
+
+ def GetPartitionFingerprint(self, partition):
+ return self._partition_fingerprints.get(partition, None)
+
+ def CalculatePartitionFingerprint(self, partition):
+ try:
+ return self.GetPartitionBuildProp("ro.build.fingerprint", partition)
+ except ExternalError:
+ return "{}/{}/{}:{}/{}/{}:{}/{}".format(
+ self.GetPartitionBuildProp("ro.product.brand", partition),
+ self.GetPartitionBuildProp("ro.product.name", partition),
+ self.GetPartitionBuildProp("ro.product.device", partition),
+ self.GetPartitionBuildProp("ro.build.version.release", partition),
+ self.GetPartitionBuildProp("ro.build.id", partition),
+ self.GetPartitionBuildProp("ro.build.version.incremental", partition),
+ self.GetPartitionBuildProp("ro.build.type", partition),
+ self.GetPartitionBuildProp("ro.build.tags", partition))
+
+ def CalculateFingerprint(self):
+ if self.oem_props is None:
+ try:
+ return self.GetBuildProp("ro.build.fingerprint")
+ except ExternalError:
+ return "{}/{}/{}:{}/{}/{}:{}/{}".format(
+ self.GetBuildProp("ro.product.brand"),
+ self.GetBuildProp("ro.product.name"),
+ self.GetBuildProp("ro.product.device"),
+ self.GetBuildProp("ro.build.version.release"),
+ self.GetBuildProp("ro.build.id"),
+ self.GetBuildProp("ro.build.version.incremental"),
+ self.GetBuildProp("ro.build.type"),
+ self.GetBuildProp("ro.build.tags"))
+ return "%s/%s/%s:%s" % (
+ self.GetOemProperty("ro.product.brand"),
+ self.GetOemProperty("ro.product.name"),
+ self.GetOemProperty("ro.product.device"),
+ self.GetBuildProp("ro.build.thumbprint"))
+
+ def WriteMountOemScript(self, script):
+ assert self.oem_props is not None
+ recovery_mount_options = self.info_dict.get("recovery_mount_options")
+ script.Mount("/oem", recovery_mount_options)
+
+ def WriteDeviceAssertions(self, script, oem_no_mount):
+ # Read the property directly if not using OEM properties.
+ if not self.oem_props:
+ script.AssertDevice(self.device)
+ return
+
+ # Otherwise assert OEM properties.
+ if not self.oem_dicts:
+ raise ExternalError(
+ "No OEM file provided to answer expected assertions")
+
+ for prop in self.oem_props.split():
+ values = []
+ for oem_dict in self.oem_dicts:
+ if prop in oem_dict:
+ values.append(oem_dict[prop])
+ if not values:
+ raise ExternalError(
+ "The OEM file is missing the property %s" % (prop,))
+ script.AssertOemProperty(prop, values, oem_no_mount)
+
+
+def ReadFromInputFile(input_file, fn):
+ """Reads the contents of fn from input zipfile or directory."""
+ if isinstance(input_file, zipfile.ZipFile):
+ return input_file.read(fn).decode()
+ else:
+ path = os.path.join(input_file, *fn.split("/"))
+ try:
+ with open(path) as f:
+ return f.read()
+ except IOError as e:
+ if e.errno == errno.ENOENT:
+ raise KeyError(fn)
+
+
def LoadInfoDict(input_file, repacking=False):
"""Loads the key/value pairs from the given input target_files.
@@ -321,16 +624,7 @@
"input_file must be a path str when doing repacking"
def read_helper(fn):
- if isinstance(input_file, zipfile.ZipFile):
- return input_file.read(fn).decode()
- else:
- path = os.path.join(input_file, *fn.split("/"))
- try:
- with open(path) as f:
- return f.read()
- except IOError as e:
- if e.errno == errno.ENOENT:
- raise KeyError(fn)
+ return ReadFromInputFile(input_file, fn)
try:
d = LoadDictionaryFromLines(read_helper("META/misc_info.txt").split("\n"))
@@ -358,26 +652,19 @@
d["root_fs_config"] = os.path.join(
input_file, "META", "root_filesystem_config.txt")
- # Redirect {system,vendor}_base_fs_file.
- if "system_base_fs_file" in d:
- basename = os.path.basename(d["system_base_fs_file"])
- system_base_fs_file = os.path.join(input_file, "META", basename)
- if os.path.exists(system_base_fs_file):
- d["system_base_fs_file"] = system_base_fs_file
+ # Redirect {partition}_base_fs_file for each of the named partitions.
+ for part_name in ["system", "vendor", "system_ext", "product", "odm"]:
+ key_name = part_name + "_base_fs_file"
+ if key_name not in d:
+ continue
+ basename = os.path.basename(d[key_name])
+ base_fs_file = os.path.join(input_file, "META", basename)
+ if os.path.exists(base_fs_file):
+ d[key_name] = base_fs_file
else:
logger.warning(
- "Failed to find system base fs file: %s", system_base_fs_file)
- del d["system_base_fs_file"]
-
- if "vendor_base_fs_file" in d:
- basename = os.path.basename(d["vendor_base_fs_file"])
- vendor_base_fs_file = os.path.join(input_file, "META", basename)
- if os.path.exists(vendor_base_fs_file):
- d["vendor_base_fs_file"] = vendor_base_fs_file
- else:
- logger.warning(
- "Failed to find vendor base fs file: %s", vendor_base_fs_file)
- del d["vendor_base_fs_file"]
+ "Failed to find %s base fs file: %s", part_name, base_fs_file)
+ del d[key_name]
def makeint(key):
if key in d:
@@ -390,79 +677,37 @@
makeint("userdata_size")
makeint("cache_size")
makeint("recovery_size")
- makeint("boot_size")
makeint("fstab_version")
- # We changed recovery.fstab path in Q, from ../RAMDISK/etc/recovery.fstab to
- # ../RAMDISK/system/etc/recovery.fstab. LoadInfoDict() has to handle both
- # cases, since it may load the info_dict from an old build (e.g. when
- # generating incremental OTAs from that build).
- system_root_image = d.get("system_root_image") == "true"
- if d.get("no_recovery") != "true":
- recovery_fstab_path = "RECOVERY/RAMDISK/system/etc/recovery.fstab"
- if isinstance(input_file, zipfile.ZipFile):
- if recovery_fstab_path not in input_file.namelist():
- recovery_fstab_path = "RECOVERY/RAMDISK/etc/recovery.fstab"
- else:
- path = os.path.join(input_file, *recovery_fstab_path.split("/"))
- if not os.path.exists(path):
- recovery_fstab_path = "RECOVERY/RAMDISK/etc/recovery.fstab"
- d["fstab"] = LoadRecoveryFSTab(
- read_helper, d["fstab_version"], recovery_fstab_path, system_root_image)
+ boot_images = "boot.img"
+ if "boot_images" in d:
+ boot_images = d["boot_images"]
+ for b in boot_images.split():
+ makeint(b.replace(".img","_size"))
- elif d.get("recovery_as_boot") == "true":
- recovery_fstab_path = "BOOT/RAMDISK/system/etc/recovery.fstab"
- if isinstance(input_file, zipfile.ZipFile):
- if recovery_fstab_path not in input_file.namelist():
- recovery_fstab_path = "BOOT/RAMDISK/etc/recovery.fstab"
- else:
- path = os.path.join(input_file, *recovery_fstab_path.split("/"))
- if not os.path.exists(path):
- recovery_fstab_path = "BOOT/RAMDISK/etc/recovery.fstab"
- d["fstab"] = LoadRecoveryFSTab(
- read_helper, d["fstab_version"], recovery_fstab_path, system_root_image)
-
- else:
- d["fstab"] = None
+ # Load recovery fstab if applicable.
+ d["fstab"] = _FindAndLoadRecoveryFstab(d, input_file, read_helper)
# Tries to load the build props for all partitions with care_map, including
# system and vendor.
for partition in PARTITIONS_WITH_CARE_MAP:
partition_prop = "{}.build.prop".format(partition)
- d[partition_prop] = LoadBuildProp(
- read_helper, "{}/build.prop".format(partition.upper()))
- # Some partition might use /<partition>/etc/build.prop as the new path.
- # TODO: try new path first when majority of them switch to the new path.
- if not d[partition_prop]:
- d[partition_prop] = LoadBuildProp(
- read_helper, "{}/etc/build.prop".format(partition.upper()))
+ d[partition_prop] = PartitionBuildProps.FromInputFile(
+ input_file, partition)
d["build.prop"] = d["system.build.prop"]
- # Set up the salt (based on fingerprint or thumbprint) that will be used when
- # adding AVB footer.
+ # Set up the salt (based on fingerprint) that will be used when adding AVB
+ # hash / hashtree footers.
if d.get("avb_enable") == "true":
- fp = None
- if "build.prop" in d:
- build_prop = d["build.prop"]
- if "ro.build.fingerprint" in build_prop:
- fp = build_prop["ro.build.fingerprint"]
- elif "ro.build.thumbprint" in build_prop:
- fp = build_prop["ro.build.thumbprint"]
- if fp:
- d["avb_salt"] = sha256(fp).hexdigest()
+ build_info = BuildInfo(d)
+ for partition in PARTITIONS_WITH_CARE_MAP:
+ fingerprint = build_info.GetPartitionFingerprint(partition)
+ if fingerprint:
+ d["avb_{}_salt".format(partition)] = sha256(fingerprint).hexdigest()
return d
-def LoadBuildProp(read_helper, prop_file):
- try:
- data = read_helper(prop_file)
- except KeyError:
- logger.warning("Failed to read %s", prop_file)
- data = ""
- return LoadDictionaryFromLines(data.split("\n"))
-
-
def LoadListFromFile(file_path):
with open(file_path) as f:
return f.read().splitlines()
@@ -485,15 +730,131 @@
return d
+class PartitionBuildProps(object):
+ """The class holds the build prop of a particular partition.
+
+ This class loads the build.prop and holds the build properties for a given
+ partition. It also partially recognizes the 'import' statement in the
+ build.prop; and calculates alternative values of some specific build
+ properties during runtime.
+
+ Attributes:
+ input_file: a zipped target-file or an unzipped target-file directory.
+ partition: name of the partition.
+ props_allow_override: a list of build properties to search for the
+ alternative values during runtime.
+ build_props: a dict of build properties for the given partition.
+ prop_overrides: a set of props that are overridden by import.
+ placeholder_values: A dict of runtime variables' values to replace the
+ placeholders in the build.prop file. We expect exactly one value for
+ each of the variables.
+ """
+ def __init__(self, input_file, name, placeholder_values=None):
+ self.input_file = input_file
+ self.partition = name
+ self.props_allow_override = [props.format(name) for props in [
+ 'ro.product.{}.brand', 'ro.product.{}.name', 'ro.product.{}.device']]
+ self.build_props = {}
+ self.prop_overrides = set()
+ self.placeholder_values = {}
+ if placeholder_values:
+ self.placeholder_values = copy.deepcopy(placeholder_values)
+
+ @staticmethod
+ def FromDictionary(name, build_props):
+ """Constructs an instance from a build prop dictionary."""
+
+ props = PartitionBuildProps("unknown", name)
+ props.build_props = build_props.copy()
+ return props
+
+ @staticmethod
+ def FromInputFile(input_file, name, placeholder_values=None):
+ """Loads the build.prop file and builds the attributes."""
+ data = ''
+ for prop_file in ['{}/etc/build.prop'.format(name.upper()),
+ '{}/build.prop'.format(name.upper())]:
+ try:
+ data = ReadFromInputFile(input_file, prop_file)
+ break
+ except KeyError:
+ logger.warning('Failed to read %s', prop_file)
+
+ props = PartitionBuildProps(input_file, name, placeholder_values)
+ props._LoadBuildProp(data)
+ return props
+
+ def _LoadBuildProp(self, data):
+ for line in data.split('\n'):
+ line = line.strip()
+ if not line or line.startswith("#"):
+ continue
+ if line.startswith("import"):
+ overrides = self._ImportParser(line)
+ duplicates = self.prop_overrides.intersection(overrides.keys())
+ if duplicates:
+ raise ValueError('prop {} is overridden multiple times'.format(
+ ','.join(duplicates)))
+ self.prop_overrides = self.prop_overrides.union(overrides.keys())
+ self.build_props.update(overrides)
+ elif "=" in line:
+ name, value = line.split("=", 1)
+ if name in self.prop_overrides:
+ raise ValueError('prop {} is set again after overridden by import '
+ 'statement'.format(name))
+ self.build_props[name] = value
+
+ def _ImportParser(self, line):
+ """Parses the build prop in a given import statement."""
+
+ tokens = line.split()
+ if tokens[0] != 'import' or (len(tokens) != 2 and len(tokens) != 3) :
+ raise ValueError('Unrecognized import statement {}'.format(line))
+
+ if len(tokens) == 3:
+ logger.info("Import %s from %s, skip", tokens[2], tokens[1])
+ return {}
+
+ import_path = tokens[1]
+ if not re.match(r'^/{}/.*\.prop$'.format(self.partition), import_path):
+ raise ValueError('Unrecognized import path {}'.format(line))
+
+ # We only recognize a subset of import statement that the init process
+ # supports. And we can loose the restriction based on how the dynamic
+ # fingerprint is used in practice. The placeholder format should be
+ # ${placeholder}, and its value should be provided by the caller through
+ # the placeholder_values.
+ for prop, value in self.placeholder_values.items():
+ prop_place_holder = '${{{}}}'.format(prop)
+ if prop_place_holder in import_path:
+ import_path = import_path.replace(prop_place_holder, value)
+ if '$' in import_path:
+ logger.info('Unresolved place holder in import path %s', import_path)
+ return {}
+
+ import_path = import_path.replace('/{}'.format(self.partition),
+ self.partition.upper())
+ logger.info('Parsing build props override from %s', import_path)
+
+ lines = ReadFromInputFile(self.input_file, import_path).split('\n')
+ d = LoadDictionaryFromLines(lines)
+ return {key: val for key, val in d.items()
+ if key in self.props_allow_override}
+
+ def GetProp(self, prop):
+ return self.build_props.get(prop)
+
+
def LoadRecoveryFSTab(read_helper, fstab_version, recovery_fstab_path,
system_root_image=False):
class Partition(object):
- def __init__(self, mount_point, fs_type, device, length, context):
+ def __init__(self, mount_point, fs_type, device, length, context, slotselect):
self.mount_point = mount_point
self.fs_type = fs_type
self.device = device
self.length = length
self.context = context
+ self.slotselect = slotselect
try:
data = read_helper(recovery_fstab_path)
@@ -521,10 +882,13 @@
# It's a good line, parse it.
length = 0
+ slotselect = False
options = options.split(",")
for i in options:
if i.startswith("length="):
length = int(i[7:])
+ elif i == "slotselect":
+ slotselect = True
else:
# Ignore all unknown options in the unified fstab.
continue
@@ -538,7 +902,8 @@
mount_point = pieces[1]
d[mount_point] = Partition(mount_point=mount_point, fs_type=pieces[2],
- device=pieces[0], length=length, context=context)
+ device=pieces[0], length=length, context=context,
+ slotselect=slotselect)
# / is used for the system mount point when the root directory is included in
# system. Other areas assume system is always at "/system" so point /system
@@ -549,18 +914,54 @@
return d
+def _FindAndLoadRecoveryFstab(info_dict, input_file, read_helper):
+ """Finds the path to recovery fstab and loads its contents."""
+ # recovery fstab is only meaningful when installing an update via recovery
+ # (i.e. non-A/B OTA). Skip loading fstab if device used A/B OTA.
+ if info_dict.get('ab_update') == 'true' and \
+ info_dict.get("allow_non_ab") != "true":
+ return None
+
+ # We changed recovery.fstab path in Q, from ../RAMDISK/etc/recovery.fstab to
+ # ../RAMDISK/system/etc/recovery.fstab. This function has to handle both
+ # cases, since it may load the info_dict from an old build (e.g. when
+ # generating incremental OTAs from that build).
+ system_root_image = info_dict.get('system_root_image') == 'true'
+ if info_dict.get('no_recovery') != 'true':
+ recovery_fstab_path = 'RECOVERY/RAMDISK/system/etc/recovery.fstab'
+ if isinstance(input_file, zipfile.ZipFile):
+ if recovery_fstab_path not in input_file.namelist():
+ recovery_fstab_path = 'RECOVERY/RAMDISK/etc/recovery.fstab'
+ else:
+ path = os.path.join(input_file, *recovery_fstab_path.split('/'))
+ if not os.path.exists(path):
+ recovery_fstab_path = 'RECOVERY/RAMDISK/etc/recovery.fstab'
+ return LoadRecoveryFSTab(
+ read_helper, info_dict['fstab_version'], recovery_fstab_path,
+ system_root_image)
+
+ if info_dict.get('recovery_as_boot') == 'true':
+ recovery_fstab_path = 'BOOT/RAMDISK/system/etc/recovery.fstab'
+ if isinstance(input_file, zipfile.ZipFile):
+ if recovery_fstab_path not in input_file.namelist():
+ recovery_fstab_path = 'BOOT/RAMDISK/etc/recovery.fstab'
+ else:
+ path = os.path.join(input_file, *recovery_fstab_path.split('/'))
+ if not os.path.exists(path):
+ recovery_fstab_path = 'BOOT/RAMDISK/etc/recovery.fstab'
+ return LoadRecoveryFSTab(
+ read_helper, info_dict['fstab_version'], recovery_fstab_path,
+ system_root_image)
+
+ return None
+
+
def DumpInfoDict(d):
for k, v in sorted(d.items()):
logger.info("%-25s = (%s) %s", k, type(v).__name__, v)
-def MergeDynamicPartitionInfoDicts(framework_dict,
- vendor_dict,
- include_dynamic_partition_list=True,
- size_prefix="",
- size_suffix="",
- list_prefix="",
- list_suffix=""):
+def MergeDynamicPartitionInfoDicts(framework_dict, vendor_dict):
"""Merges dynamic partition info variables.
Args:
@@ -568,18 +969,6 @@
partial framework target files.
vendor_dict: The dictionary of dynamic partition info variables from the
partial vendor target files.
- include_dynamic_partition_list: If true, merges the dynamic_partition_list
- variable. Not all use cases need this variable merged.
- size_prefix: The prefix in partition group size variables that precedes the
- name of the partition group. For example, partition group 'group_a' with
- corresponding size variable 'super_group_a_group_size' would have the
- size_prefix 'super_'.
- size_suffix: Similar to size_prefix but for the variable's suffix. For
- example, 'super_group_a_group_size' would have size_suffix '_group_size'.
- list_prefix: Similar to size_prefix but for the partition group's
- partition_list variable.
- list_suffix: Similar to size_suffix but for the partition group's
- partition_list variable.
Returns:
The merged dynamic partition info dictionary.
@@ -588,27 +977,30 @@
# Partition groups and group sizes are defined by the vendor dict because
# these values may vary for each board that uses a shared system image.
merged_dict["super_partition_groups"] = vendor_dict["super_partition_groups"]
- if include_dynamic_partition_list:
- framework_dynamic_partition_list = framework_dict.get(
- "dynamic_partition_list", "")
- vendor_dynamic_partition_list = vendor_dict.get("dynamic_partition_list",
- "")
- merged_dict["dynamic_partition_list"] = (
- "%s %s" % (framework_dynamic_partition_list,
- vendor_dynamic_partition_list)).strip()
+ framework_dynamic_partition_list = framework_dict.get(
+ "dynamic_partition_list", "")
+ vendor_dynamic_partition_list = vendor_dict.get("dynamic_partition_list", "")
+ merged_dict["dynamic_partition_list"] = ("%s %s" % (
+ framework_dynamic_partition_list, vendor_dynamic_partition_list)).strip()
for partition_group in merged_dict["super_partition_groups"].split(" "):
# Set the partition group's size using the value from the vendor dict.
- key = "%s%s%s" % (size_prefix, partition_group, size_suffix)
+ key = "super_%s_group_size" % partition_group
if key not in vendor_dict:
raise ValueError("Vendor dict does not contain required key %s." % key)
merged_dict[key] = vendor_dict[key]
# Set the partition group's partition list using a concatenation of the
# framework and vendor partition lists.
- key = "%s%s%s" % (list_prefix, partition_group, list_suffix)
+ key = "super_%s_partition_list" % partition_group
merged_dict[key] = (
"%s %s" %
(framework_dict.get(key, ""), vendor_dict.get(key, ""))).strip()
+
+ # Pick virtual ab related flags from vendor dict, if defined.
+ if "virtual_ab" in vendor_dict.keys():
+ merged_dict["virtual_ab"] = vendor_dict["virtual_ab"]
+ if "virtual_ab_retrofit" in vendor_dict.keys():
+ merged_dict["virtual_ab_retrofit"] = vendor_dict["virtual_ab_retrofit"]
return merged_dict
@@ -629,7 +1021,7 @@
cmd.extend(["--salt", avb_salt])
-def GetAvbPartitionArg(partition, image, info_dict = None):
+def GetAvbPartitionArg(partition, image, info_dict=None):
"""Returns the VBMeta arguments for partition.
It sets up the VBMeta argument by including the partition descriptor from the
@@ -649,12 +1041,21 @@
# Check if chain partition is used.
key_path = info_dict.get("avb_" + partition + "_key_path")
- if key_path:
- chained_partition_arg = GetAvbChainedPartitionArg(partition, info_dict)
- return ["--chain_partition", chained_partition_arg]
- else:
+ if not key_path:
return ["--include_descriptors_from_image", image]
+ # For a non-A/B device, we don't chain /recovery nor include its descriptor
+ # into vbmeta.img. The recovery image will be configured on an independent
+ # boot chain, to be verified with AVB_SLOT_VERIFY_FLAGS_NO_VBMETA_PARTITION.
+ # See details at
+ # https://android.googlesource.com/platform/external/avb/+/master/README.md#booting-into-recovery.
+ if info_dict.get("ab_update") != "true" and partition == "recovery":
+ return []
+
+ # Otherwise chain the partition into vbmeta.
+ chained_partition_arg = GetAvbChainedPartitionArg(partition, info_dict)
+ return ["--chain_partition", chained_partition_arg]
+
def GetAvbChainedPartitionArg(partition, info_dict, key=None):
"""Constructs and returns the arg to build or verify a chained partition.
@@ -682,6 +1083,46 @@
return "{}:{}:{}".format(partition, rollback_index_location, pubkey_path)
+def ConstructAftlMakeImageCommands(output_image):
+ """Constructs the command to append the aftl image to vbmeta."""
+
+ # Ensure the other AFTL parameters are set as well.
+ assert OPTIONS.aftl_tool_path is not None, 'No aftl tool provided.'
+ assert OPTIONS.aftl_key_path is not None, 'No AFTL key provided.'
+ assert OPTIONS.aftl_manufacturer_key_path is not None, \
+ 'No AFTL manufacturer key provided.'
+
+ vbmeta_image = MakeTempFile()
+ os.rename(output_image, vbmeta_image)
+ build_info = BuildInfo(OPTIONS.info_dict)
+ version_incremental = build_info.GetBuildProp("ro.build.version.incremental")
+ aftltool = OPTIONS.aftl_tool_path
+ server_argument_list = [OPTIONS.aftl_server, OPTIONS.aftl_key_path]
+ aftl_cmd = [aftltool, "make_icp_from_vbmeta",
+ "--vbmeta_image_path", vbmeta_image,
+ "--output", output_image,
+ "--version_incremental", version_incremental,
+ "--transparency_log_servers", ','.join(server_argument_list),
+ "--manufacturer_key", OPTIONS.aftl_manufacturer_key_path,
+ "--algorithm", "SHA256_RSA4096",
+ "--padding", "4096"]
+ if OPTIONS.aftl_signer_helper:
+ aftl_cmd.extend(shlex.split(OPTIONS.aftl_signer_helper))
+ return aftl_cmd
+
+
+def AddAftlInclusionProof(output_image):
+ """Appends the aftl inclusion proof to the vbmeta image."""
+
+ aftl_cmd = ConstructAftlMakeImageCommands(output_image)
+ RunAndCheckOutput(aftl_cmd)
+
+ verify_cmd = ['aftltool', 'verify_image_icp', '--vbmeta_image_path',
+ output_image, '--transparency_log_pub_keys',
+ OPTIONS.aftl_key_path]
+ RunAndCheckOutput(verify_cmd)
+
+
def BuildVBMeta(image_path, partitions, name, needed_partitions):
"""Creates a VBMeta image.
@@ -691,8 +1132,9 @@
Args:
image_path: The output path for the new VBMeta image.
partitions: A dict that's keyed by partition names with image paths as
- values. Only valid partition names are accepted, as listed in
- common.AVB_PARTITIONS.
+ values. Only valid partition names are accepted, as partitions listed
+ in common.AVB_PARTITIONS and custom partitions listed in
+ OPTIONS.info_dict.get("avb_custom_images_partition_list")
name: Name of the VBMeta partition, e.g. 'vbmeta', 'vbmeta_system'.
needed_partitions: Partitions whose descriptors should be included into the
generated VBMeta image.
@@ -704,11 +1146,15 @@
cmd = [avbtool, "make_vbmeta_image", "--output", image_path]
AppendAVBSigningArgs(cmd, name)
+ custom_partitions = OPTIONS.info_dict.get(
+ "avb_custom_images_partition_list", "").strip().split()
+
for partition, path in partitions.items():
if partition not in needed_partitions:
continue
assert (partition in AVB_PARTITIONS or
- partition in AVB_VBMETA_PARTITIONS), \
+ partition in AVB_VBMETA_PARTITIONS or
+ partition in custom_partitions), \
'Unknown partition: {}'.format(partition)
assert os.path.exists(path), \
'Failed to find {} for {}'.format(path, partition)
@@ -724,24 +1170,51 @@
# zip only). For such cases, we additionally scan other locations (e.g.
# IMAGES/, RADIO/, etc) before bailing out.
if arg == '--include_descriptors_from_image':
- image_path = split_args[index + 1]
- if os.path.exists(image_path):
+ chained_image = split_args[index + 1]
+ if os.path.exists(chained_image):
continue
found = False
for dir_name in ['IMAGES', 'RADIO', 'PREBUILT_IMAGES']:
alt_path = os.path.join(
- OPTIONS.input_tmp, dir_name, os.path.basename(image_path))
+ OPTIONS.input_tmp, dir_name, os.path.basename(chained_image))
if os.path.exists(alt_path):
split_args[index + 1] = alt_path
found = True
break
- assert found, 'Failed to find {}'.format(image_path)
+ assert found, 'Failed to find {}'.format(chained_image)
cmd.extend(split_args)
RunAndCheckOutput(cmd)
+ # Generate the AFTL inclusion proof.
+ if OPTIONS.aftl_server is not None:
+ AddAftlInclusionProof(image_path)
-def _BuildBootableImage(sourcedir, fs_config_file, info_dict=None,
+
+def _MakeRamdisk(sourcedir, fs_config_file=None, lz4_ramdisks=False):
+ ramdisk_img = tempfile.NamedTemporaryFile()
+
+ if fs_config_file is not None and os.access(fs_config_file, os.F_OK):
+ cmd = ["mkbootfs", "-f", fs_config_file,
+ os.path.join(sourcedir, "RAMDISK")]
+ else:
+ cmd = ["mkbootfs", os.path.join(sourcedir, "RAMDISK")]
+ p1 = Run(cmd, stdout=subprocess.PIPE)
+ if lz4_ramdisks:
+ p2 = Run(["lz4", "-l", "-12" , "--favor-decSpeed"], stdin=p1.stdout,
+ stdout=ramdisk_img.file.fileno())
+ else:
+ p2 = Run(["minigzip"], stdin=p1.stdout, stdout=ramdisk_img.file.fileno())
+
+ p2.wait()
+ p1.wait()
+ assert p1.returncode == 0, "mkbootfs of %s ramdisk failed" % (sourcedir,)
+ assert p2.returncode == 0, "compression of %s ramdisk failed" % (sourcedir,)
+
+ return ramdisk_img
+
+
+def _BuildBootableImage(image_name, sourcedir, fs_config_file, info_dict=None,
has_ramdisk=False, two_step_image=False):
"""Build a bootable image from the specified sourcedir.
@@ -754,25 +1227,15 @@
for building the requested image.
"""
- def make_ramdisk():
- ramdisk_img = tempfile.NamedTemporaryFile()
+ # "boot" or "recovery", without extension.
+ partition_name = os.path.basename(sourcedir).lower()
- if os.access(fs_config_file, os.F_OK):
- cmd = ["mkbootfs", "-f", fs_config_file,
- os.path.join(sourcedir, "RAMDISK")]
- else:
- cmd = ["mkbootfs", os.path.join(sourcedir, "RAMDISK")]
- p1 = Run(cmd, stdout=subprocess.PIPE)
- p2 = Run(["minigzip"], stdin=p1.stdout, stdout=ramdisk_img.file.fileno())
-
- p2.wait()
- p1.wait()
- assert p1.returncode == 0, "mkbootfs of %s ramdisk failed" % (sourcedir,)
- assert p2.returncode == 0, "minigzip of %s ramdisk failed" % (sourcedir,)
-
- return ramdisk_img
-
- if not os.access(os.path.join(sourcedir, "kernel"), os.F_OK):
+ if partition_name == "recovery":
+ kernel = "kernel"
+ else:
+ kernel = image_name.replace("boot", "kernel")
+ kernel = kernel.replace(".img","")
+ if not os.access(os.path.join(sourcedir, kernel), os.F_OK):
return None
if has_ramdisk and not os.access(os.path.join(sourcedir, "RAMDISK"), os.F_OK):
@@ -784,12 +1247,13 @@
img = tempfile.NamedTemporaryFile()
if has_ramdisk:
- ramdisk_img = make_ramdisk()
+ use_lz4 = info_dict.get("lz4_ramdisks") == 'true'
+ ramdisk_img = _MakeRamdisk(sourcedir, fs_config_file, lz4_ramdisks=use_lz4)
# use MKBOOTIMG from environ, or "mkbootimg" if empty or not set
mkbootimg = os.getenv('MKBOOTIMG') or "mkbootimg"
- cmd = [mkbootimg, "--kernel", os.path.join(sourcedir, "kernel")]
+ cmd = [mkbootimg, "--kernel", os.path.join(sourcedir, kernel)]
fn = os.path.join(sourcedir, "second")
if os.access(fn, os.F_OK):
@@ -816,7 +1280,14 @@
cmd.append("--pagesize")
cmd.append(open(fn).read().rstrip("\n"))
- args = info_dict.get("mkbootimg_args")
+ if partition_name == "recovery":
+ args = info_dict.get("recovery_mkbootimg_args")
+ if not args:
+ # Fall back to "mkbootimg_args" for recovery image
+ # in case "recovery_mkbootimg_args" is not set.
+ args = info_dict.get("mkbootimg_args")
+ else:
+ args = info_dict.get("mkbootimg_args")
if args and args.strip():
cmd.extend(shlex.split(args))
@@ -834,9 +1305,6 @@
else:
cmd.extend(["--output", img.name])
- # "boot" or "recovery", without extension.
- partition_name = os.path.basename(sourcedir).lower()
-
if partition_name == "recovery":
if info_dict.get("include_recovery_dtbo") == "true":
fn = os.path.join(sourcedir, "recovery_dtbo")
@@ -887,7 +1355,10 @@
# AVB: if enabled, calculate and add hash to boot.img or recovery.img.
if info_dict.get("avb_enable") == "true":
avbtool = info_dict["avb_avbtool"]
- part_size = info_dict[partition_name + "_size"]
+ if partition_name == "recovery":
+ part_size = info_dict["recovery_size"]
+ else:
+ part_size = info_dict[image_name.replace(".img","_size")]
cmd = [avbtool, "add_hash_footer", "--image", img.name,
"--partition_size", str(part_size), "--partition_name",
partition_name]
@@ -938,7 +1409,7 @@
info_dict.get("recovery_as_boot") == "true")
fs_config = "META/" + tree_subdir.lower() + "_filesystem_config.txt"
- data = _BuildBootableImage(os.path.join(unpack_dir, tree_subdir),
+ data = _BuildBootableImage(prebuilt_name, os.path.join(unpack_dir, tree_subdir),
os.path.join(unpack_dir, fs_config),
info_dict, has_ramdisk, two_step_image)
if data:
@@ -946,6 +1417,106 @@
return None
+def _BuildVendorBootImage(sourcedir, info_dict=None):
+ """Build a vendor boot image from the specified sourcedir.
+
+ Take a ramdisk, dtb, and vendor_cmdline from the input (in 'sourcedir'), and
+ turn them into a vendor boot image.
+
+ Return the image data, or None if sourcedir does not appear to contains files
+ for building the requested image.
+ """
+
+ if info_dict is None:
+ info_dict = OPTIONS.info_dict
+
+ img = tempfile.NamedTemporaryFile()
+
+ use_lz4 = info_dict.get("lz4_ramdisks") == 'true'
+ ramdisk_img = _MakeRamdisk(sourcedir, lz4_ramdisks=use_lz4)
+
+ # use MKBOOTIMG from environ, or "mkbootimg" if empty or not set
+ mkbootimg = os.getenv('MKBOOTIMG') or "mkbootimg"
+
+ cmd = [mkbootimg]
+
+ fn = os.path.join(sourcedir, "dtb")
+ if os.access(fn, os.F_OK):
+ cmd.append("--dtb")
+ cmd.append(fn)
+
+ fn = os.path.join(sourcedir, "vendor_cmdline")
+ if os.access(fn, os.F_OK):
+ cmd.append("--vendor_cmdline")
+ cmd.append(open(fn).read().rstrip("\n"))
+
+ fn = os.path.join(sourcedir, "base")
+ if os.access(fn, os.F_OK):
+ cmd.append("--base")
+ cmd.append(open(fn).read().rstrip("\n"))
+
+ fn = os.path.join(sourcedir, "pagesize")
+ if os.access(fn, os.F_OK):
+ cmd.append("--pagesize")
+ cmd.append(open(fn).read().rstrip("\n"))
+
+ args = info_dict.get("mkbootimg_args")
+ if args and args.strip():
+ cmd.extend(shlex.split(args))
+
+ args = info_dict.get("mkbootimg_version_args")
+ if args and args.strip():
+ cmd.extend(shlex.split(args))
+
+ cmd.extend(["--vendor_ramdisk", ramdisk_img.name])
+ cmd.extend(["--vendor_boot", img.name])
+
+ RunAndCheckOutput(cmd)
+
+ # AVB: if enabled, calculate and add hash.
+ if info_dict.get("avb_enable") == "true":
+ avbtool = info_dict["avb_avbtool"]
+ part_size = info_dict["vendor_boot_size"]
+ cmd = [avbtool, "add_hash_footer", "--image", img.name,
+ "--partition_size", str(part_size), "--partition_name", "vendor_boot"]
+ AppendAVBSigningArgs(cmd, "vendor_boot")
+ args = info_dict.get("avb_vendor_boot_add_hash_footer_args")
+ if args and args.strip():
+ cmd.extend(shlex.split(args))
+ RunAndCheckOutput(cmd)
+
+ img.seek(os.SEEK_SET, 0)
+ data = img.read()
+
+ ramdisk_img.close()
+ img.close()
+
+ return data
+
+
+def GetVendorBootImage(name, prebuilt_name, unpack_dir, tree_subdir,
+ info_dict=None):
+ """Return a File object with the desired vendor boot image.
+
+ Look for it under 'unpack_dir'/IMAGES, otherwise construct it from
+ the source files in 'unpack_dir'/'tree_subdir'."""
+
+ prebuilt_path = os.path.join(unpack_dir, "IMAGES", prebuilt_name)
+ if os.path.exists(prebuilt_path):
+ logger.info("using prebuilt %s from IMAGES...", prebuilt_name)
+ return File.FromLocalFile(name, prebuilt_path)
+
+ logger.info("building image from target_files %s...", tree_subdir)
+
+ if info_dict is None:
+ info_dict = OPTIONS.info_dict
+
+ data = _BuildVendorBootImage(os.path.join(unpack_dir, tree_subdir), info_dict)
+ if data:
+ return File(name, data)
+ return None
+
+
def Gunzip(in_filename, out_filename):
"""Gunzips the given gzip compressed file to a given output file."""
with gzip.open(in_filename, "rb") as in_file, \
@@ -1399,7 +1970,8 @@
continue
m = re.match(
r'^name="(?P<NAME>.*)"\s+certificate="(?P<CERT>.*)"\s+'
- r'private_key="(?P<PRIVKEY>.*?)"(\s+compressed="(?P<COMPRESSED>.*)")?$',
+ r'private_key="(?P<PRIVKEY>.*?)"(\s+compressed="(?P<COMPRESSED>.*?)")?'
+ r'(\s+partition="(?P<PARTITION>.*?)")?$',
line)
if not m:
continue
@@ -1463,6 +2035,9 @@
-h (--help)
Display this usage message and exit.
+
+ --logfile <file>
+ Put verbose logs to specified file (regardless of --verbose option.)
"""
def Usage(docstring):
@@ -1485,11 +2060,12 @@
argv, "hvp:s:x:" + extra_opts,
["help", "verbose", "path=", "signapk_path=",
"signapk_shared_library_path=", "extra_signapk_args=",
- "java_path=", "java_args=", "public_key_suffix=",
+ "java_path=", "java_args=", "android_jar_path=", "public_key_suffix=",
"private_key_suffix=", "boot_signer_path=", "boot_signer_args=",
"verity_signer_path=", "verity_signer_args=", "device_specific=",
- "extra="] +
- list(extra_long_opts))
+ "extra=", "logfile=", "aftl_tool_path=", "aftl_server=",
+ "aftl_key_path=", "aftl_manufacturer_key_path=",
+ "aftl_signer_helper="] + list(extra_long_opts))
except getopt.GetoptError as err:
Usage(docstring)
print("**", str(err), "**")
@@ -1513,6 +2089,8 @@
OPTIONS.java_path = a
elif o in ("--java_args",):
OPTIONS.java_args = shlex.split(a)
+ elif o in ("--android_jar_path",):
+ OPTIONS.android_jar_path = a
elif o in ("--public_key_suffix",):
OPTIONS.public_key_suffix = a
elif o in ("--private_key_suffix",):
@@ -1525,11 +2103,23 @@
OPTIONS.verity_signer_path = a
elif o in ("--verity_signer_args",):
OPTIONS.verity_signer_args = shlex.split(a)
+ elif o in ("--aftl_tool_path",):
+ OPTIONS.aftl_tool_path = a
+ elif o in ("--aftl_server",):
+ OPTIONS.aftl_server = a
+ elif o in ("--aftl_key_path",):
+ OPTIONS.aftl_key_path = a
+ elif o in ("--aftl_manufacturer_key_path",):
+ OPTIONS.aftl_manufacturer_key_path = a
+ elif o in ("--aftl_signer_helper",):
+ OPTIONS.aftl_signer_helper = a
elif o in ("-s", "--device_specific"):
OPTIONS.device_specific = a
elif o in ("-x", "--extra"):
key, value = a.split("=", 1)
OPTIONS.extras[key] = value
+ elif o in ("--logfile",):
+ OPTIONS.logfile = a
else:
if extra_option_handler is None or not extra_option_handler(o, a):
assert False, "unknown option \"%s\"" % (o,)
@@ -2107,11 +2697,12 @@
self.device = 'map_partition("%s")' % partition
else:
if OPTIONS.source_info_dict is None:
- _, device_path = GetTypeAndDevice("/" + partition, OPTIONS.info_dict)
+ _, device_expr = GetTypeAndDeviceExpr("/" + partition,
+ OPTIONS.info_dict)
else:
- _, device_path = GetTypeAndDevice("/" + partition,
- OPTIONS.source_info_dict)
- self.device = '"%s"' % device_path
+ _, device_expr = GetTypeAndDeviceExpr("/" + partition,
+ OPTIONS.source_info_dict)
+ self.device = device_expr
@property
def required_cache(self):
@@ -2343,16 +2934,51 @@
"squashfs": "EMMC"
}
-
-def GetTypeAndDevice(mount_point, info):
+def GetTypeAndDevice(mount_point, info, check_no_slot=True):
+ """
+ Use GetTypeAndDeviceExpr whenever possible. This function is kept for
+ backwards compatibility. It aborts if the fstab entry has slotselect option
+ (unless check_no_slot is explicitly set to False).
+ """
fstab = info["fstab"]
if fstab:
+ if check_no_slot:
+ assert not fstab[mount_point].slotselect, \
+ "Use GetTypeAndDeviceExpr instead"
return (PARTITION_TYPES[fstab[mount_point].fs_type],
fstab[mount_point].device)
else:
raise KeyError
+def GetTypeAndDeviceExpr(mount_point, info):
+ """
+ Return the filesystem of the partition, and an edify expression that evaluates
+ to the device at runtime.
+ """
+ fstab = info["fstab"]
+ if fstab:
+ p = fstab[mount_point]
+ device_expr = '"%s"' % fstab[mount_point].device
+ if p.slotselect:
+ device_expr = 'add_slot_suffix(%s)' % device_expr
+ return (PARTITION_TYPES[fstab[mount_point].fs_type], device_expr)
+ else:
+ raise KeyError
+
+
+def GetEntryForDevice(fstab, device):
+ """
+ Returns:
+ The first entry in fstab whose device is the given value.
+ """
+ if not fstab:
+ return None
+ for mount_point in fstab:
+ if fstab[mount_point].device == device:
+ return fstab[mount_point]
+ return None
+
def ParseCertificate(data):
"""Parses and converts a PEM-encoded certificate into DER-encoded.
@@ -2435,13 +3061,25 @@
info_dict = OPTIONS.info_dict
full_recovery_image = info_dict.get("full_recovery_image") == "true"
+ board_uses_vendorimage = info_dict.get("board_uses_vendorimage") == "true"
+
+ if board_uses_vendorimage:
+ # In this case, the output sink is rooted at VENDOR
+ recovery_img_path = "etc/recovery.img"
+ recovery_resource_dat_path = "VENDOR/etc/recovery-resource.dat"
+ sh_dir = "bin"
+ else:
+ # In this case the output sink is rooted at SYSTEM
+ recovery_img_path = "vendor/etc/recovery.img"
+ recovery_resource_dat_path = "SYSTEM/vendor/etc/recovery-resource.dat"
+ sh_dir = "vendor/bin"
if full_recovery_image:
- output_sink("etc/recovery.img", recovery_img.data)
+ output_sink(recovery_img_path, recovery_img.data)
else:
system_root_image = info_dict.get("system_root_image") == "true"
- path = os.path.join(input_dir, "SYSTEM", "etc", "recovery-resource.dat")
+ path = os.path.join(input_dir, recovery_resource_dat_path)
# With system-root-image, boot and recovery images will have mismatching
# entries (only recovery has the ramdisk entry) (Bug: 72731506). Use bsdiff
# to handle such a case.
@@ -2454,7 +3092,7 @@
if os.path.exists(path):
diff_program.append("-b")
diff_program.append(path)
- bonus_args = "--bonus /system/etc/recovery-resource.dat"
+ bonus_args = "--bonus /vendor/etc/recovery-resource.dat"
else:
bonus_args = ""
@@ -2465,16 +3103,24 @@
try:
# The following GetTypeAndDevice()s need to use the path in the target
# info_dict instead of source_info_dict.
- boot_type, boot_device = GetTypeAndDevice("/boot", info_dict)
- recovery_type, recovery_device = GetTypeAndDevice("/recovery", info_dict)
+ boot_type, boot_device = GetTypeAndDevice("/boot", info_dict,
+ check_no_slot=False)
+ recovery_type, recovery_device = GetTypeAndDevice("/recovery", info_dict,
+ check_no_slot=False)
except KeyError:
return
if full_recovery_image:
- sh = """#!/system/bin/sh
+
+ # Note that we use /vendor to refer to the recovery resources. This will
+ # work for a separate vendor partition mounted at /vendor or a
+ # /system/vendor subdirectory on the system partition, for which init will
+ # create a symlink from /vendor to /system/vendor.
+
+ sh = """#!/vendor/bin/sh
if ! applypatch --check %(type)s:%(device)s:%(size)d:%(sha1)s; then
applypatch \\
- --flash /system/etc/recovery.img \\
+ --flash /vendor/etc/recovery.img \\
--target %(type)s:%(device)s:%(size)d:%(sha1)s && \\
log -t recovery "Installing new recovery image: succeeded" || \\
log -t recovery "Installing new recovery image: failed"
@@ -2486,10 +3132,10 @@
'sha1': recovery_img.sha1,
'size': recovery_img.size}
else:
- sh = """#!/system/bin/sh
+ sh = """#!/vendor/bin/sh
if ! applypatch --check %(recovery_type)s:%(recovery_device)s:%(recovery_size)d:%(recovery_sha1)s; then
applypatch %(bonus_args)s \\
- --patch /system/recovery-from-boot.p \\
+ --patch /vendor/recovery-from-boot.p \\
--source %(boot_type)s:%(boot_device)s:%(boot_size)d:%(boot_sha1)s \\
--target %(recovery_type)s:%(recovery_device)s:%(recovery_size)d:%(recovery_sha1)s && \\
log -t recovery "Installing new recovery image: succeeded" || \\
@@ -2502,14 +3148,14 @@
'recovery_size': recovery_img.size,
'recovery_sha1': recovery_img.sha1,
'boot_type': boot_type,
- 'boot_device': boot_device,
- 'recovery_type': recovery_type,
+ 'boot_device': boot_device + '$(getprop ro.boot.slot_suffix)',
+ 'recovery_type': recovery_type + '$(getprop ro.boot.slot_suffix)',
'recovery_device': recovery_device,
'bonus_args': bonus_args}
- # The install script location moved from /system/etc to /system/bin
- # in the L release.
- sh_location = "bin/install-recovery.sh"
+ # The install script location moved from /system/etc to /system/bin in the L
+ # release. In the R release it is in VENDOR/bin or SYSTEM/vendor/bin.
+ sh_location = os.path.join(sh_dir, "install-recovery.sh")
logger.info("putting script in %s", sh_location)
diff --git a/tools/releasetools/edify_generator.py b/tools/releasetools/edify_generator.py
index 7ed85fe..99e21f1 100644
--- a/tools/releasetools/edify_generator.py
+++ b/tools/releasetools/edify_generator.py
@@ -183,11 +183,30 @@
It checks the checksums of the given partitions. If none of them matches the
expected checksum, updater will additionally look for a backup on /cache.
"""
+ self._CheckSecondTokenNotSlotSuffixed(target, "PatchPartitionExprCheck")
+ self._CheckSecondTokenNotSlotSuffixed(source, "PatchPartitionExprCheck")
+ self.PatchPartitionExprCheck('"%s"' % target, '"%s"' % source)
+
+ def PatchPartitionExprCheck(self, target_expr, source_expr):
+ """Checks whether updater can patch the given partitions.
+
+ It checks the checksums of the given partitions. If none of them matches the
+ expected checksum, updater will additionally look for a backup on /cache.
+
+ Args:
+ target_expr: an Edify expression that serves as the target arg to
+ patch_partition. Must be evaluated to a string in the form of
+ foo:bar:baz:quux
+ source_expr: an Edify expression that serves as the source arg to
+ patch_partition. Must be evaluated to a string in the form of
+ foo:bar:baz:quux
+ """
self.script.append(self.WordWrap((
- 'patch_partition_check("{target}",\0"{source}") ||\n abort('
- '"E{code}: \\"{target}\\" or \\"{source}\\" has unexpected '
- 'contents.");').format(
- target=target, source=source,
+ 'patch_partition_check({target},\0{source}) ||\n abort('
+ 'concat("E{code}: \\"",{target},"\\" or \\"",{source},"\\" has '
+ 'unexpected contents."));').format(
+ target=target_expr,
+ source=source_expr,
code=common.ErrorCode.BAD_PATCH_FILE)))
def CacheFreeSpaceCheck(self, amount):
@@ -218,8 +237,9 @@
mount_flags = mount_dict.get(p.fs_type, "")
if p.context is not None:
mount_flags = p.context + ("," + mount_flags if mount_flags else "")
- self.script.append('mount("%s", "%s", "%s", "%s", "%s");' % (
- p.fs_type, common.PARTITION_TYPES[p.fs_type], p.device,
+ self.script.append('mount("%s", "%s", %s, "%s", "%s");' % (
+ p.fs_type, common.PARTITION_TYPES[p.fs_type],
+ self._GetSlotSuffixDeviceForEntry(p),
p.mount_point, mount_flags))
self.mounts.add(p.mount_point)
@@ -242,8 +262,9 @@
raise ValueError("Partition %s cannot be tuned\n" % (partition,))
self.script.append(
'tune2fs(' + "".join(['"%s", ' % (i,) for i in options]) +
- '"%s") || abort("E%d: Failed to tune partition %s");' % (
- p.device, common.ErrorCode.TUNE_PARTITION_FAILURE, partition))
+ '%s) || abort("E%d: Failed to tune partition %s");' % (
+ self._GetSlotSuffixDeviceForEntry(p),
+ common.ErrorCode.TUNE_PARTITION_FAILURE, partition))
def FormatPartition(self, partition):
"""Format the given partition, specified by its mount point (eg,
@@ -252,18 +273,19 @@
fstab = self.fstab
if fstab:
p = fstab[partition]
- self.script.append('format("%s", "%s", "%s", "%s", "%s");' %
+ self.script.append('format("%s", "%s", %s, "%s", "%s");' %
(p.fs_type, common.PARTITION_TYPES[p.fs_type],
- p.device, p.length, p.mount_point))
+ self._GetSlotSuffixDeviceForEntry(p),
+ p.length, p.mount_point))
def WipeBlockDevice(self, partition):
if partition not in ("/system", "/vendor"):
raise ValueError(("WipeBlockDevice doesn't work on %s\n") % (partition,))
fstab = self.fstab
size = self.info.get(partition.lstrip("/") + "_size", None)
- device = fstab[partition].device
+ device = self._GetSlotSuffixDeviceForEntry(fstab[partition])
- self.script.append('wipe_block_device("%s", %s);' % (device, size))
+ self.script.append('wipe_block_device(%s, %s);' % (device, size))
def ApplyPatch(self, srcfile, tgtfile, tgtsize, tgtsha1, *patchpairs):
"""Apply binary patches (in *patchpairs) to the given srcfile to
@@ -296,14 +318,69 @@
self.PatchPartition(target, source, patch)
def PatchPartition(self, target, source, patch):
- """Applies the patch to the source partition and writes it to target."""
+ """
+ Applies the patch to the source partition and writes it to target.
+
+ Args:
+ target: the target arg to patch_partition. Must be in the form of
+ foo:bar:baz:quux
+ source: the source arg to patch_partition. Must be in the form of
+ foo:bar:baz:quux
+ patch: the patch arg to patch_partition. Must be an unquoted string.
+ """
+ self._CheckSecondTokenNotSlotSuffixed(target, "PatchPartitionExpr")
+ self._CheckSecondTokenNotSlotSuffixed(source, "PatchPartitionExpr")
+ self.PatchPartitionExpr('"%s"' % target, '"%s"' % source, '"%s"' % patch)
+
+ def PatchPartitionExpr(self, target_expr, source_expr, patch_expr):
+ """
+ Applies the patch to the source partition and writes it to target.
+
+ Args:
+ target_expr: an Edify expression that serves as the target arg to
+ patch_partition. Must be evaluated to a string in the form of
+ foo:bar:baz:quux
+ source_expr: an Edify expression that serves as the source arg to
+ patch_partition. Must be evaluated to a string in the form of
+ foo:bar:baz:quux
+ patch_expr: an Edify expression that serves as the patch arg to
+ patch_partition. Must be evaluated to a string.
+ """
self.script.append(self.WordWrap((
- 'patch_partition("{target}",\0"{source}",\0'
- 'package_extract_file("{patch}")) ||\n'
- ' abort("E{code}: Failed to apply patch to {source}");').format(
- target=target, source=source, patch=patch,
+ 'patch_partition({target},\0{source},\0'
+ 'package_extract_file({patch})) ||\n'
+ ' abort(concat('
+ ' "E{code}: Failed to apply patch to ",{source}));').format(
+ target=target_expr,
+ source=source_expr,
+ patch=patch_expr,
code=common.ErrorCode.APPLY_PATCH_FAILURE)))
+ def _GetSlotSuffixDeviceForEntry(self, entry=None):
+ """
+ Args:
+ entry: the fstab entry of device "foo"
+ Returns:
+ An edify expression. Caller must not quote result.
+ If foo is slot suffixed, it returns
+ 'add_slot_suffix("foo")'
+ Otherwise it returns
+ '"foo"' (quoted)
+ """
+ assert entry is not None
+ if entry.slotselect:
+ return 'add_slot_suffix("%s")' % entry.device
+ return '"%s"' % entry.device
+
+ def _CheckSecondTokenNotSlotSuffixed(self, s, fn):
+ lst = s.split(':')
+ assert(len(s) == 4), "{} does not contain 4 tokens".format(s)
+ if self.fstab:
+ entry = common.GetEntryForDevice(s[1])
+ if entry is not None:
+ assert not entry.slotselect, \
+ "Use %s because %s is slot suffixed" % (fn, s[1])
+
def WriteRawImage(self, mount_point, fn, mapfn=None):
"""Write the given package file into the partition for the given
mount point."""
@@ -312,15 +389,16 @@
if fstab:
p = fstab[mount_point]
partition_type = common.PARTITION_TYPES[p.fs_type]
- args = {'device': p.device, 'fn': fn}
+ device = self._GetSlotSuffixDeviceForEntry(p)
+ args = {'device': device, 'fn': fn}
if partition_type == "EMMC":
if mapfn:
args["map"] = mapfn
self.script.append(
- 'package_extract_file("%(fn)s", "%(device)s", "%(map)s");' % args)
+ 'package_extract_file("%(fn)s", %(device)s, "%(map)s");' % args)
else:
self.script.append(
- 'package_extract_file("%(fn)s", "%(device)s");' % args)
+ 'package_extract_file("%(fn)s", %(device)s);' % args)
else:
raise ValueError(
"don't know how to write \"%s\" partitions" % p.fs_type)
diff --git a/tools/releasetools/make_recovery_patch.py b/tools/releasetools/make_recovery_patch.py
index 725b355..1497d69 100644
--- a/tools/releasetools/make_recovery_patch.py
+++ b/tools/releasetools/make_recovery_patch.py
@@ -47,8 +47,17 @@
if not recovery_img or not boot_img:
sys.exit(0)
+ board_uses_vendorimage = OPTIONS.info_dict.get(
+ "board_uses_vendorimage") == "true"
+
+ if board_uses_vendorimage:
+ target_files_dir = "VENDOR"
+ else:
+ target_files_dir = "SYSTEM"
+
def output_sink(fn, data):
- with open(os.path.join(output_dir, "SYSTEM", *fn.split("/")), "wb") as f:
+ with open(os.path.join(output_dir, target_files_dir,
+ *fn.split("/")), "wb") as f:
f.write(data)
common.MakeRecoveryPatch(input_dir, output_sink, recovery_img, boot_img)
diff --git a/tools/releasetools/merge_builds.py b/tools/releasetools/merge_builds.py
index ca348cf..3ac4ec4 100644
--- a/tools/releasetools/merge_builds.py
+++ b/tools/releasetools/merge_builds.py
@@ -96,12 +96,7 @@
merged_dict = dict(vendor_dict)
merged_dict.update(
common.MergeDynamicPartitionInfoDicts(
- framework_dict=framework_dict,
- vendor_dict=vendor_dict,
- size_prefix="super_",
- size_suffix="_group_size",
- list_prefix="super_",
- list_suffix="_partition_list"))
+ framework_dict=framework_dict, vendor_dict=vendor_dict))
output_super_empty_path = os.path.join(OPTIONS.product_out_vendor,
"super_empty.img")
build_super_image.BuildSuperImage(merged_dict, output_super_empty_path)
diff --git a/tools/releasetools/merge_target_files.py b/tools/releasetools/merge_target_files.py
index ba70986..d9d3854 100755
--- a/tools/releasetools/merge_target_files.py
+++ b/tools/releasetools/merge_target_files.py
@@ -68,8 +68,7 @@
files package and saves it at this path.
--rebuild_recovery
- Rebuild the recovery patch used by non-A/B devices and write it to the
- system image.
+ Deprecated; does nothing.
--keep-tmp
Keep tempoary files for debugging purposes.
@@ -80,6 +79,7 @@
import fnmatch
import logging
import os
+import re
import shutil
import subprocess
import sys
@@ -95,6 +95,8 @@
logger = logging.getLogger(__name__)
OPTIONS = common.OPTIONS
+# Always turn on verbose logging.
+OPTIONS.verbose = True
OPTIONS.framework_target_files = None
OPTIONS.framework_item_list = None
OPTIONS.framework_misc_info_keys = None
@@ -106,9 +108,32 @@
OPTIONS.output_ota = None
OPTIONS.output_img = None
OPTIONS.output_super_empty = None
+# TODO(b/132730255): Remove this option.
OPTIONS.rebuild_recovery = False
OPTIONS.keep_tmp = False
+# In an item list (framework or vendor), we may see entries that select whole
+# partitions. Such an entry might look like this 'SYSTEM/*' (e.g., for the
+# system partition). The following regex matches this and extracts the
+# partition name.
+
+PARTITION_ITEM_PATTERN = re.compile(r'^([A-Z_]+)/\*$')
+
+# In apexkeys.txt or apkcerts.txt, we will find partition tags on each entry in
+# the file. We use these partition tags to filter the entries in those files
+# from the two different target files packages to produce a merged apexkeys.txt
+# or apkcerts.txt file. A partition tag (e.g., for the product partition) looks
+# like this: 'partition="product"'. We use the group syntax grab the value of
+# the tag. We use non-greedy matching in case there are other fields on the
+# same line.
+
+PARTITION_TAG_PATTERN = re.compile(r'partition="(.*?)"')
+
+# The sorting algorithm for apexkeys.txt and apkcerts.txt does not include the
+# ".apex" or ".apk" suffix, so we use the following pattern to extract a key.
+
+MODULE_KEY_PATTERN = re.compile(r'name="(.+)\.(apex|apk)"')
+
# DEFAULT_FRAMEWORK_ITEM_LIST is a list of items to extract from the partial
# framework target files package as is, meaning these items will land in the
# output target files package exactly as they appear in the input partial
@@ -372,32 +397,6 @@
write_sorted_data(data=output_ab_partitions, path=output_ab_partitions_txt)
-def append_recovery_to_filesystem_config(output_target_files_temp_dir):
- """Performs special processing for META/filesystem_config.txt.
-
- This function appends recovery information to META/filesystem_config.txt so
- that recovery patch regeneration will succeed.
-
- Args:
- output_target_files_temp_dir: The name of a directory that will be used to
- create the output target files package after all the special cases are
- processed. We find filesystem_config.txt here.
- """
-
- filesystem_config_txt = os.path.join(output_target_files_temp_dir, 'META',
- 'filesystem_config.txt')
-
- with open(filesystem_config_txt, 'a') as f:
- # TODO(bpeckham) this data is hard coded. It should be generated
- # programmatically.
- f.write('system/bin/install-recovery.sh 0 0 750 '
- 'selabel=u:object_r:install_recovery_exec:s0 capabilities=0x0\n')
- f.write('system/recovery-from-boot.p 0 0 644 '
- 'selabel=u:object_r:system_file:s0 capabilities=0x0\n')
- f.write('system/etc/recovery.img 0 0 440 '
- 'selabel=u:object_r:install_recovery_exec:s0 capabilities=0x0\n')
-
-
def process_misc_info_txt(framework_target_files_temp_dir,
vendor_target_files_temp_dir,
output_target_files_temp_dir,
@@ -442,12 +441,7 @@
if (merged_dict.get('use_dynamic_partitions') == 'true') and (
framework_dict.get('use_dynamic_partitions') == 'true'):
merged_dynamic_partitions_dict = common.MergeDynamicPartitionInfoDicts(
- framework_dict=framework_dict,
- vendor_dict=merged_dict,
- size_prefix='super_',
- size_suffix='_group_size',
- list_prefix='super_',
- list_suffix='_partition_list')
+ framework_dict=framework_dict, vendor_dict=merged_dict)
merged_dict.update(merged_dynamic_partitions_dict)
# Ensure that add_img_to_target_files rebuilds super split images for
# devices that retrofit dynamic partitions. This flag may have been set to
@@ -506,11 +500,7 @@
merged_dynamic_partitions_dict = common.MergeDynamicPartitionInfoDicts(
framework_dict=framework_dynamic_partitions_dict,
- vendor_dict=vendor_dynamic_partitions_dict,
- # META/dynamic_partitions_info.txt does not use dynamic_partition_list.
- include_dynamic_partition_list=False,
- size_suffix='_size',
- list_suffix='_partition_list')
+ vendor_dict=vendor_dynamic_partitions_dict)
output_dynamic_partitions_info_txt = os.path.join(
output_target_files_dir, 'META', 'dynamic_partitions_info.txt')
@@ -519,9 +509,40 @@
path=output_dynamic_partitions_info_txt)
+def item_list_to_partition_set(item_list):
+ """Converts a target files item list to a partition set.
+
+ The item list contains items that might look like 'SYSTEM/*' or 'VENDOR/*' or
+ 'OTA/android-info.txt'. Items that end in '/*' are assumed to match entire
+ directories where 'SYSTEM' or 'VENDOR' is a directory name that identifies the
+ contents of a partition of the same name. Other items in the list, such as the
+ 'OTA' example contain metadata. This function iterates such a list, returning
+ a set that contains the partition entries.
+
+ Args:
+ item_list: A list of items in a target files package.
+ Returns:
+ A set of partitions extracted from the list of items.
+ """
+
+ partition_set = set()
+
+ for item in item_list:
+ match = PARTITION_ITEM_PATTERN.search(item.strip())
+ partition_tag = match.group(1).lower() if match else None
+
+ if partition_tag:
+ partition_set.add(partition_tag)
+
+ return partition_set
+
+
def process_apex_keys_apk_certs_common(framework_target_files_dir,
vendor_target_files_dir,
- output_target_files_dir, file_name):
+ output_target_files_dir,
+ framework_partition_set,
+ vendor_partition_set, file_name):
+
"""Performs special processing for META/apexkeys.txt or META/apkcerts.txt.
This function merges the contents of the META/apexkeys.txt or
@@ -537,6 +558,10 @@
items extracted from the vendor target files package.
output_target_files_dir: The name of a directory that will be used to create
the output target files package after all the special cases are processed.
+ framework_partition_set: Partitions that are considered framework
+ partitions. Used to filter apexkeys.txt and apkcerts.txt.
+ vendor_partition_set: Partitions that are considered vendor partitions. Used
+ to filter apexkeys.txt and apkcerts.txt.
file_name: The name of the file to merge. One of apkcerts.txt or
apexkeys.txt.
"""
@@ -547,21 +572,44 @@
with open(file_path) as f:
for line in f:
if line.strip():
- temp[line.split()[0]] = line.strip()
+ name = line.split()[0]
+ match = MODULE_KEY_PATTERN.search(name)
+ temp[match.group(1)] = line.strip()
return temp
framework_dict = read_helper(framework_target_files_dir)
vendor_dict = read_helper(vendor_target_files_dir)
+ merged_dict = {}
- for key in framework_dict:
- if key in vendor_dict and vendor_dict[key] != framework_dict[key]:
- raise ValueError('Conflicting entries found in %s:\n %s and\n %s' %
- (file_name, framework_dict[key], vendor_dict[key]))
- vendor_dict[key] = framework_dict[key]
+ def filter_into_merged_dict(item_dict, partition_set):
+ for key, value in item_dict.items():
+ match = PARTITION_TAG_PATTERN.search(value)
+
+ if match is None:
+ raise ValueError('Entry missing partition tag: %s' % value)
+
+ partition_tag = match.group(1)
+
+ if partition_tag in partition_set:
+ if key in merged_dict:
+ raise ValueError('Duplicate key %s' % key)
+
+ merged_dict[key] = value
+
+ filter_into_merged_dict(framework_dict, framework_partition_set)
+ filter_into_merged_dict(vendor_dict, vendor_partition_set)
output_file = os.path.join(output_target_files_dir, 'META', file_name)
- write_sorted_data(data=vendor_dict.values(), path=output_file)
+ # The following code is similar to write_sorted_data, but different enough
+ # that we couldn't use that function. We need the output to be sorted by the
+ # basename of the apex/apk (without the ".apex" or ".apk" suffix). This
+ # allows the sort to be consistent with the framework/vendor input data and
+ # eases comparison of input data with merged data.
+ with open(output_file, 'w') as output:
+ for key in sorted(merged_dict.keys()):
+ out_str = merged_dict[key] + '\n'
+ output.write(out_str)
def copy_file_contexts(framework_target_files_dir, vendor_target_files_dir,
@@ -594,7 +642,9 @@
def process_special_cases(framework_target_files_temp_dir,
vendor_target_files_temp_dir,
output_target_files_temp_dir,
- framework_misc_info_keys, rebuild_recovery):
+ framework_misc_info_keys,
+ framework_partition_set,
+ vendor_partition_set):
"""Performs special-case processing for certain target files items.
Certain files in the output target files package require special-case
@@ -611,8 +661,10 @@
framework_misc_info_keys: A list of keys to obtain from the framework
instance of META/misc_info.txt. The remaining keys from the vendor
instance.
- rebuild_recovery: If true, rebuild the recovery patch used by non-A/B
- devices and write it to the system image.
+ framework_partition_set: Partitions that are considered framework
+ partitions. Used to filter apexkeys.txt and apkcerts.txt.
+ vendor_partition_set: Partitions that are considered vendor partitions. Used
+ to filter apexkeys.txt and apkcerts.txt.
"""
if 'ab_update' in framework_misc_info_keys:
@@ -621,10 +673,6 @@
vendor_target_files_temp_dir=vendor_target_files_temp_dir,
output_target_files_temp_dir=output_target_files_temp_dir)
- if rebuild_recovery:
- append_recovery_to_filesystem_config(
- output_target_files_temp_dir=output_target_files_temp_dir)
-
copy_file_contexts(
framework_target_files_dir=framework_target_files_temp_dir,
vendor_target_files_dir=vendor_target_files_temp_dir,
@@ -645,12 +693,16 @@
framework_target_files_dir=framework_target_files_temp_dir,
vendor_target_files_dir=vendor_target_files_temp_dir,
output_target_files_dir=output_target_files_temp_dir,
+ framework_partition_set=framework_partition_set,
+ vendor_partition_set=vendor_partition_set,
file_name='apkcerts.txt')
process_apex_keys_apk_certs_common(
framework_target_files_dir=framework_target_files_temp_dir,
vendor_target_files_dir=vendor_target_files_temp_dir,
output_target_files_dir=output_target_files_temp_dir,
+ framework_partition_set=framework_partition_set,
+ vendor_partition_set=vendor_partition_set,
file_name='apexkeys.txt')
@@ -758,7 +810,8 @@
vendor_target_files_temp_dir=vendor_target_files_temp_dir,
output_target_files_temp_dir=output_target_files_temp_dir,
framework_misc_info_keys=framework_misc_info_keys,
- rebuild_recovery=rebuild_recovery)
+ framework_partition_set=item_list_to_partition_set(framework_item_list),
+ vendor_partition_set=item_list_to_partition_set(vendor_item_list))
return output_target_files_temp_dir
@@ -779,6 +832,7 @@
add_img_args = ['--verbose']
add_img_args.append('--add_missing')
+ # TODO(b/132730255): Remove this if statement.
if rebuild_recovery:
add_img_args.append('--rebuild_recovery')
add_img_args.append(target_files_dir)
@@ -1016,7 +1070,7 @@
OPTIONS.output_img = a
elif o == '--output-super-empty':
OPTIONS.output_super_empty = a
- elif o == '--rebuild_recovery':
+ elif o == '--rebuild_recovery': # TODO(b/132730255): Warn
OPTIONS.rebuild_recovery = True
elif o == '--keep-tmp':
OPTIONS.keep_tmp = True
@@ -1057,9 +1111,6 @@
common.Usage(__doc__)
sys.exit(1)
- # Always turn on verbose logging.
- OPTIONS.verbose = True
-
if OPTIONS.framework_item_list:
framework_item_list = common.LoadListFromFile(OPTIONS.framework_item_list)
else:
diff --git a/tools/releasetools/ota_from_target_files.py b/tools/releasetools/ota_from_target_files.py
index de947f3..b753414 100755
--- a/tools/releasetools/ota_from_target_files.py
+++ b/tools/releasetools/ota_from_target_files.py
@@ -78,6 +78,13 @@
Write a copy of the metadata to a separate file. Therefore, users can
read the post build fingerprint without extracting the OTA package.
+ --force_non_ab
+ This flag can only be set on an A/B device that also supports non-A/B
+ updates. Implies --two_step.
+ If set, generate that non-A/B update package.
+ If not set, generates A/B package for A/B device and non-A/B package for
+ non-A/B device.
+
Non-A/B OTA specific options
-b (--binary) <file>
@@ -171,8 +178,23 @@
--payload_signer_args <args>
Specify the arguments needed for payload signer.
+ --payload_signer_maximum_signature_size <signature_size>
+ The maximum signature size (in bytes) that would be generated by the given
+ payload signer. Only meaningful when custom payload signer is specified
+ via '--payload_signer'.
+ If the signer uses a RSA key, this should be the number of bytes to
+ represent the modulus. If it uses an EC key, this is the size of a
+ DER-encoded ECDSA signature.
+
--payload_signer_key_size <key_size>
- Specify the key size in bytes of the payload signer.
+ Deprecated. Use the '--payload_signer_maximum_signature_size' instead.
+
+ --boot_variable_file <path>
+ A file that contains the possible values of ro.boot.* properties. It's
+ used to calculate the possible runtime fingerprints when some
+ ro.product.* properties are overridden by the 'import' statement.
+ The file expects one property per line, and each line has the following
+ format: 'prop_name=value1,value2'. e.g. 'ro.boot.product.sku=std,pro'
--skip_postinstall
Skip the postinstall hooks when generating an A/B OTA package (default:
@@ -185,6 +207,8 @@
from __future__ import print_function
import collections
+import copy
+import itertools
import logging
import multiprocessing
import os.path
@@ -221,6 +245,7 @@
OPTIONS.no_signing = False
OPTIONS.block_based = True
OPTIONS.updater_binary = None
+OPTIONS.oem_dicts = None
OPTIONS.oem_source = None
OPTIONS.oem_no_mount = False
OPTIONS.full_radio = False
@@ -231,7 +256,7 @@
OPTIONS.log_diff = None
OPTIONS.payload_signer = None
OPTIONS.payload_signer_args = []
-OPTIONS.payload_signer_key_size = None
+OPTIONS.payload_signer_maximum_signature_size = None
OPTIONS.extracted_input = None
OPTIONS.key_passwords = []
OPTIONS.skip_postinstall = False
@@ -239,6 +264,8 @@
OPTIONS.skip_compatibility_check = False
OPTIONS.output_metadata_path = None
OPTIONS.disable_fec_computation = False
+OPTIONS.force_non_ab = False
+OPTIONS.boot_variable_file = None
METADATA_NAME = 'META-INF/com/android/metadata'
@@ -255,226 +282,8 @@
# 'system_other' and bootloader partitions.
SECONDARY_PAYLOAD_SKIPPED_IMAGES = [
'boot', 'dtbo', 'modem', 'odm', 'product', 'radio', 'recovery',
- 'system_ext', 'vbmeta', 'vbmeta_system', 'vbmeta_vendor', 'vendor']
-
-
-class BuildInfo(object):
- """A class that holds the information for a given build.
-
- This class wraps up the property querying for a given source or target build.
- It abstracts away the logic of handling OEM-specific properties, and caches
- the commonly used properties such as fingerprint.
-
- There are two types of info dicts: a) build-time info dict, which is generated
- at build time (i.e. included in a target_files zip); b) OEM info dict that is
- specified at package generation time (via command line argument
- '--oem_settings'). If a build doesn't use OEM-specific properties (i.e. not
- having "oem_fingerprint_properties" in build-time info dict), all the queries
- would be answered based on build-time info dict only. Otherwise if using
- OEM-specific properties, some of them will be calculated from two info dicts.
-
- Users can query properties similarly as using a dict() (e.g. info['fstab']),
- or to query build properties via GetBuildProp() or GetVendorBuildProp().
-
- Attributes:
- info_dict: The build-time info dict.
- is_ab: Whether it's a build that uses A/B OTA.
- oem_dicts: A list of OEM dicts.
- oem_props: A list of OEM properties that should be read from OEM dicts; None
- if the build doesn't use any OEM-specific property.
- fingerprint: The fingerprint of the build, which would be calculated based
- on OEM properties if applicable.
- device: The device name, which could come from OEM dicts if applicable.
- """
-
- _RO_PRODUCT_RESOLVE_PROPS = ["ro.product.brand", "ro.product.device",
- "ro.product.manufacturer", "ro.product.model",
- "ro.product.name"]
- _RO_PRODUCT_PROPS_DEFAULT_SOURCE_ORDER = ["product", "odm", "vendor",
- "system_ext", "system"]
-
- def __init__(self, info_dict, oem_dicts):
- """Initializes a BuildInfo instance with the given dicts.
-
- Note that it only wraps up the given dicts, without making copies.
-
- Arguments:
- info_dict: The build-time info dict.
- oem_dicts: A list of OEM dicts (which is parsed from --oem_settings). Note
- that it always uses the first dict to calculate the fingerprint or the
- device name. The rest would be used for asserting OEM properties only
- (e.g. one package can be installed on one of these devices).
-
- Raises:
- ValueError: On invalid inputs.
- """
- self.info_dict = info_dict
- self.oem_dicts = oem_dicts
-
- self._is_ab = info_dict.get("ab_update") == "true"
- self._oem_props = info_dict.get("oem_fingerprint_properties")
-
- if self._oem_props:
- assert oem_dicts, "OEM source required for this build"
-
- # These two should be computed only after setting self._oem_props.
- self._device = self.GetOemProperty("ro.product.device")
- self._fingerprint = self.CalculateFingerprint()
-
- # Sanity check the build fingerprint.
- if (' ' in self._fingerprint or
- any(ord(ch) > 127 for ch in self._fingerprint)):
- raise ValueError(
- 'Invalid build fingerprint: "{}". See the requirement in Android CDD '
- '3.2.2. Build Parameters.'.format(self._fingerprint))
-
- @property
- def is_ab(self):
- return self._is_ab
-
- @property
- def device(self):
- return self._device
-
- @property
- def fingerprint(self):
- return self._fingerprint
-
- @property
- def vendor_fingerprint(self):
- return self._fingerprint_of("vendor")
-
- @property
- def product_fingerprint(self):
- return self._fingerprint_of("product")
-
- @property
- def odm_fingerprint(self):
- return self._fingerprint_of("odm")
-
- def _fingerprint_of(self, partition):
- if partition + ".build.prop" not in self.info_dict:
- return None
- build_prop = self.info_dict[partition + ".build.prop"]
- if "ro." + partition + ".build.fingerprint" in build_prop:
- return build_prop["ro." + partition + ".build.fingerprint"]
- if "ro." + partition + ".build.thumbprint" in build_prop:
- return build_prop["ro." + partition + ".build.thumbprint"]
- return None
-
- @property
- def oem_props(self):
- return self._oem_props
-
- def __getitem__(self, key):
- return self.info_dict[key]
-
- def __setitem__(self, key, value):
- self.info_dict[key] = value
-
- def get(self, key, default=None):
- return self.info_dict.get(key, default)
-
- def items(self):
- return self.info_dict.items()
-
- def GetBuildProp(self, prop):
- """Returns the inquired build property."""
- if prop in BuildInfo._RO_PRODUCT_RESOLVE_PROPS:
- return self._ResolveRoProductBuildProp(prop)
-
- try:
- return self.info_dict.get("build.prop", {})[prop]
- except KeyError:
- raise common.ExternalError("couldn't find %s in build.prop" % (prop,))
-
- def _ResolveRoProductBuildProp(self, prop):
- """Resolves the inquired ro.product.* build property"""
- prop_val = self.info_dict.get("build.prop", {}).get(prop)
- if prop_val:
- return prop_val
-
- source_order_val = self.info_dict.get("build.prop", {}).get(
- "ro.product.property_source_order")
- if source_order_val:
- source_order = source_order_val.split(",")
- else:
- source_order = BuildInfo._RO_PRODUCT_PROPS_DEFAULT_SOURCE_ORDER
-
- # Check that all sources in ro.product.property_source_order are valid
- if any([x not in BuildInfo._RO_PRODUCT_PROPS_DEFAULT_SOURCE_ORDER
- for x in source_order]):
- raise common.ExternalError(
- "Invalid ro.product.property_source_order '{}'".format(source_order))
-
- for source in source_order:
- source_prop = prop.replace(
- "ro.product", "ro.product.{}".format(source), 1)
- prop_val = self.info_dict.get(
- "{}.build.prop".format(source), {}).get(source_prop)
- if prop_val:
- return prop_val
-
- raise common.ExternalError("couldn't resolve {}".format(prop))
-
- def GetVendorBuildProp(self, prop):
- """Returns the inquired vendor build property."""
- try:
- return self.info_dict.get("vendor.build.prop", {})[prop]
- except KeyError:
- raise common.ExternalError(
- "couldn't find %s in vendor.build.prop" % (prop,))
-
- def GetOemProperty(self, key):
- if self.oem_props is not None and key in self.oem_props:
- return self.oem_dicts[0][key]
- return self.GetBuildProp(key)
-
- def CalculateFingerprint(self):
- if self.oem_props is None:
- try:
- return self.GetBuildProp("ro.build.fingerprint")
- except common.ExternalError:
- return "{}/{}/{}:{}/{}/{}:{}/{}".format(
- self.GetBuildProp("ro.product.brand"),
- self.GetBuildProp("ro.product.name"),
- self.GetBuildProp("ro.product.device"),
- self.GetBuildProp("ro.build.version.release"),
- self.GetBuildProp("ro.build.id"),
- self.GetBuildProp("ro.build.version.incremental"),
- self.GetBuildProp("ro.build.type"),
- self.GetBuildProp("ro.build.tags"))
- return "%s/%s/%s:%s" % (
- self.GetOemProperty("ro.product.brand"),
- self.GetOemProperty("ro.product.name"),
- self.GetOemProperty("ro.product.device"),
- self.GetBuildProp("ro.build.thumbprint"))
-
- def WriteMountOemScript(self, script):
- assert self.oem_props is not None
- recovery_mount_options = self.info_dict.get("recovery_mount_options")
- script.Mount("/oem", recovery_mount_options)
-
- def WriteDeviceAssertions(self, script, oem_no_mount):
- # Read the property directly if not using OEM properties.
- if not self.oem_props:
- script.AssertDevice(self.device)
- return
-
- # Otherwise assert OEM properties.
- if not self.oem_dicts:
- raise common.ExternalError(
- "No OEM file provided to answer expected assertions")
-
- for prop in self.oem_props.split():
- values = []
- for oem_dict in self.oem_dicts:
- if prop in oem_dict:
- values.append(oem_dict[prop])
- if not values:
- raise common.ExternalError(
- "The OEM file is missing the property %s" % (prop,))
- script.AssertOemProperty(prop, values, oem_no_mount)
+ 'system_ext', 'vbmeta', 'vbmeta_system', 'vbmeta_vendor', 'vendor',
+ 'vendor_boot']
class PayloadSigner(object):
@@ -507,35 +316,31 @@
self.signer = "openssl"
self.signer_args = ["pkeyutl", "-sign", "-inkey", signing_key,
"-pkeyopt", "digest:sha256"]
- self.key_size = self._GetKeySizeInBytes(signing_key)
+ self.maximum_signature_size = self._GetMaximumSignatureSizeInBytes(
+ signing_key)
else:
self.signer = OPTIONS.payload_signer
self.signer_args = OPTIONS.payload_signer_args
- if OPTIONS.payload_signer_key_size:
- self.key_size = int(OPTIONS.payload_signer_key_size)
- assert self.key_size == 256 or self.key_size == 512, \
- "Unsupported key size {}".format(OPTIONS.payload_signer_key_size)
+ if OPTIONS.payload_signer_maximum_signature_size:
+ self.maximum_signature_size = int(
+ OPTIONS.payload_signer_maximum_signature_size)
else:
- self.key_size = 256
+ # The legacy config uses RSA2048 keys.
+ logger.warning("The maximum signature size for payload signer is not"
+ " set, default to 256 bytes.")
+ self.maximum_signature_size = 256
@staticmethod
- def _GetKeySizeInBytes(signing_key):
- modulus_file = common.MakeTempFile(prefix="modulus-")
- cmd = ["openssl", "rsa", "-inform", "PEM", "-in", signing_key, "-modulus",
- "-noout", "-out", modulus_file]
- common.RunAndCheckOutput(cmd, verbose=False)
-
- with open(modulus_file) as f:
- modulus_string = f.read()
- # The modulus string has the format "Modulus=$data", where $data is the
- # concatenation of hex dump of the modulus.
- MODULUS_PREFIX = "Modulus="
- assert modulus_string.startswith(MODULUS_PREFIX)
- modulus_string = modulus_string[len(MODULUS_PREFIX):]
- key_size = len(modulus_string) // 2
- assert key_size == 256 or key_size == 512, \
- "Unsupported key size {}".format(key_size)
- return key_size
+ def _GetMaximumSignatureSizeInBytes(signing_key):
+ out_signature_size_file = common.MakeTempFile("signature_size")
+ cmd = ["delta_generator", "--out_maximum_signature_size_file={}".format(
+ out_signature_size_file), "--private_key={}".format(signing_key)]
+ common.RunAndCheckOutput(cmd)
+ with open(out_signature_size_file) as f:
+ signature_size = f.read().rstrip()
+ logger.info("%s outputs the maximum signature size: %s", cmd[0],
+ signature_size)
+ return int(signature_size)
def Sign(self, in_file):
"""Signs the given input file. Returns the output filename."""
@@ -615,7 +420,7 @@
metadata_sig_file = common.MakeTempFile(prefix="sig-", suffix=".bin")
cmd = ["brillo_update_payload", "hash",
"--unsigned_payload", self.payload_file,
- "--signature_size", str(payload_signer.key_size),
+ "--signature_size", str(payload_signer.maximum_signature_size),
"--metadata_hash_file", metadata_sig_file,
"--payload_hash_file", payload_sig_file]
self._Run(cmd)
@@ -630,7 +435,7 @@
cmd = ["brillo_update_payload", "sign",
"--unsigned_payload", self.payload_file,
"--payload", signed_payload_file,
- "--signature_size", str(payload_signer.key_size),
+ "--signature_size", str(payload_signer.maximum_signature_size),
"--metadata_signature_file", signed_metadata_sig_file,
"--payload_signature_file", signed_payload_sig_file]
self._Run(cmd)
@@ -731,10 +536,19 @@
script.WriteRawImage("/boot", "recovery.img")
-def HasRecoveryPatch(target_files_zip):
+def HasRecoveryPatch(target_files_zip, info_dict):
+ board_uses_vendorimage = info_dict.get("board_uses_vendorimage") == "true"
+
+ if board_uses_vendorimage:
+ target_files_dir = "VENDOR"
+ else:
+ target_files_dir = "SYSTEM/vendor"
+
+ patch = "%s/recovery-from-boot.p" % target_files_dir
+ img = "%s/etc/recovery.img" %target_files_dir
+
namelist = [name for name in target_files_zip.namelist()]
- return ("SYSTEM/recovery-from-boot.p" in namelist or
- "SYSTEM/etc/recovery.img" in namelist)
+ return (patch in namelist or img in namelist)
def HasPartition(target_files_zip, partition):
@@ -837,7 +651,7 @@
partition_target_info = target_info["fstab"]["/" + name]
disable_imgdiff = (partition_source_info.fs_type == "squashfs" or
partition_target_info.fs_type == "squashfs")
- return common.BlockDifference(name, partition_src, partition_tgt,
+ return common.BlockDifference(name, partition_tgt, partition_src,
check_first_block,
version=blockimgdiff_version,
disable_imgdiff=disable_imgdiff)
@@ -895,7 +709,7 @@
def WriteFullOTAPackage(input_zip, output_file):
- target_info = BuildInfo(OPTIONS.info_dict, OPTIONS.oem_dicts)
+ target_info = common.BuildInfo(OPTIONS.info_dict, OPTIONS.oem_dicts)
# We don't know what version it will be installed on top of. We expect the API
# just won't change very often. Similarly for fstab, it might have changed in
@@ -925,7 +739,7 @@
metadata=metadata,
info_dict=OPTIONS.info_dict)
- assert HasRecoveryPatch(input_zip)
+ assert HasRecoveryPatch(input_zip, info_dict=OPTIONS.info_dict)
# Assertions (e.g. downgrade check, device properties check).
ts = target_info.GetBuildProp("ro.build.date.utc")
@@ -1121,20 +935,30 @@
Returns:
A dict to be written into package metadata entry.
"""
- assert isinstance(target_info, BuildInfo)
- assert source_info is None or isinstance(source_info, BuildInfo)
+ assert isinstance(target_info, common.BuildInfo)
+ assert source_info is None or isinstance(source_info, common.BuildInfo)
+ separator = '|'
+
+ boot_variable_values = {}
+ if OPTIONS.boot_variable_file:
+ d = common.LoadDictionaryFromFile(OPTIONS.boot_variable_file)
+ for key, values in d.items():
+ boot_variable_values[key] = [val.strip() for val in values.split(',')]
+
+ post_build_devices, post_build_fingerprints = \
+ CalculateRuntimeDevicesAndFingerprints(target_info, boot_variable_values)
metadata = {
- 'post-build' : target_info.fingerprint,
- 'post-build-incremental' : target_info.GetBuildProp(
+ 'post-build': separator.join(sorted(post_build_fingerprints)),
+ 'post-build-incremental': target_info.GetBuildProp(
'ro.build.version.incremental'),
- 'post-sdk-level' : target_info.GetBuildProp(
+ 'post-sdk-level': target_info.GetBuildProp(
'ro.build.version.sdk'),
- 'post-security-patch-level' : target_info.GetBuildProp(
+ 'post-security-patch-level': target_info.GetBuildProp(
'ro.build.version.security_patch'),
}
- if target_info.is_ab:
+ if target_info.is_ab and not OPTIONS.force_non_ab:
metadata['ota-type'] = 'AB'
metadata['ota-required-cache'] = '0'
else:
@@ -1148,12 +972,15 @@
is_incremental = source_info is not None
if is_incremental:
- metadata['pre-build'] = source_info.fingerprint
+ pre_build_devices, pre_build_fingerprints = \
+ CalculateRuntimeDevicesAndFingerprints(source_info,
+ boot_variable_values)
+ metadata['pre-build'] = separator.join(sorted(pre_build_fingerprints))
metadata['pre-build-incremental'] = source_info.GetBuildProp(
'ro.build.version.incremental')
- metadata['pre-device'] = source_info.device
+ metadata['pre-device'] = separator.join(sorted(pre_build_devices))
else:
- metadata['pre-device'] = target_info.device
+ metadata['pre-device'] = separator.join(sorted(post_build_devices))
# Use the actual post-timestamp, even for a downgrade case.
metadata['post-timestamp'] = target_info.GetBuildProp('ro.build.date.utc')
@@ -1535,8 +1362,8 @@
def WriteBlockIncrementalOTAPackage(target_zip, source_zip, output_file):
- target_info = BuildInfo(OPTIONS.target_info_dict, OPTIONS.oem_dicts)
- source_info = BuildInfo(OPTIONS.source_info_dict, OPTIONS.oem_dicts)
+ target_info = common.BuildInfo(OPTIONS.target_info_dict, OPTIONS.oem_dicts)
+ source_info = common.BuildInfo(OPTIONS.source_info_dict, OPTIONS.oem_dicts)
target_api_version = target_info["recovery_api_version"]
source_api_version = source_info["recovery_api_version"]
@@ -1656,7 +1483,8 @@
required_cache_sizes = [diff.required_cache for diff in
block_diff_dict.values()]
if updating_boot:
- boot_type, boot_device = common.GetTypeAndDevice("/boot", source_info)
+ boot_type, boot_device_expr = common.GetTypeAndDeviceExpr("/boot",
+ source_info)
d = common.Difference(target_boot, source_boot)
_, _, d = d.ComputePatch()
if d is None:
@@ -1671,11 +1499,11 @@
common.ZipWriteStr(output_zip, "boot.img.p", d)
- script.PatchPartitionCheck(
- "{}:{}:{}:{}".format(
- boot_type, boot_device, target_boot.size, target_boot.sha1),
- "{}:{}:{}:{}".format(
- boot_type, boot_device, source_boot.size, source_boot.sha1))
+ target_expr = 'concat("{}:",{},":{}:{}")'.format(
+ boot_type, boot_device_expr, target_boot.size, target_boot.sha1)
+ source_expr = 'concat("{}:",{},":{}:{}")'.format(
+ boot_type, boot_device_expr, source_boot.size, source_boot.sha1)
+ script.PatchPartitionExprCheck(target_expr, source_expr)
required_cache_sizes.append(target_boot.size)
@@ -1743,12 +1571,11 @@
logger.info("boot image changed; including patch.")
script.Print("Patching boot image...")
script.ShowProgress(0.1, 10)
- script.PatchPartition(
- '{}:{}:{}:{}'.format(
- boot_type, boot_device, target_boot.size, target_boot.sha1),
- '{}:{}:{}:{}'.format(
- boot_type, boot_device, source_boot.size, source_boot.sha1),
- 'boot.img.p')
+ target_expr = 'concat("{}:",{},":{}:{}")'.format(
+ boot_type, boot_device_expr, target_boot.size, target_boot.sha1)
+ source_expr = 'concat("{}:",{},":{}:{}")'.format(
+ boot_type, boot_device_expr, source_boot.size, source_boot.sha1)
+ script.PatchPartitionExpr(target_expr, source_expr, '"boot.img.p"')
else:
logger.info("boot image unchanged; skipping.")
@@ -1841,6 +1668,10 @@
partitions = [partition for partition in partitions if partition
not in SECONDARY_PAYLOAD_SKIPPED_IMAGES]
output_list.append('{}={}'.format(key, ' '.join(partitions)))
+ elif key == 'virtual_ab' or key == "virtual_ab_retrofit":
+ # Remove virtual_ab flag from secondary payload so that OTA client
+ # don't use snapshots for secondary update
+ pass
else:
output_list.append(line)
return '\n'.join(output_list)
@@ -2015,10 +1846,10 @@
compression=zipfile.ZIP_DEFLATED)
if source_file is not None:
- target_info = BuildInfo(OPTIONS.target_info_dict, OPTIONS.oem_dicts)
- source_info = BuildInfo(OPTIONS.source_info_dict, OPTIONS.oem_dicts)
+ target_info = common.BuildInfo(OPTIONS.target_info_dict, OPTIONS.oem_dicts)
+ source_info = common.BuildInfo(OPTIONS.source_info_dict, OPTIONS.oem_dicts)
else:
- target_info = BuildInfo(OPTIONS.info_dict, OPTIONS.oem_dicts)
+ target_info = common.BuildInfo(OPTIONS.info_dict, OPTIONS.oem_dicts)
source_info = None
# Metadata to comply with Android OTA package format.
@@ -2161,6 +1992,37 @@
output_file)
+def CalculateRuntimeDevicesAndFingerprints(build_info, boot_variable_values):
+ """Returns a tuple of sets for runtime devices and fingerprints"""
+
+ device_names = {build_info.device}
+ fingerprints = {build_info.fingerprint}
+
+ if not boot_variable_values:
+ return device_names, fingerprints
+
+ # Calculate all possible combinations of the values for the boot variables.
+ keys = boot_variable_values.keys()
+ value_list = boot_variable_values.values()
+ combinations = [dict(zip(keys, values))
+ for values in itertools.product(*value_list)]
+ for placeholder_values in combinations:
+ # Reload the info_dict as some build properties may change their values
+ # based on the value of ro.boot* properties.
+ info_dict = copy.deepcopy(build_info.info_dict)
+ for partition in common.PARTITIONS_WITH_CARE_MAP:
+ partition_prop_key = "{}.build.prop".format(partition)
+ old_props = info_dict[partition_prop_key]
+ info_dict[partition_prop_key] = common.PartitionBuildProps.FromInputFile(
+ old_props.input_file, partition, placeholder_values)
+ info_dict["build.prop"] = info_dict["system.build.prop"]
+
+ new_build_info = common.BuildInfo(info_dict, build_info.oem_dicts)
+ device_names.add(new_build_info.device)
+ fingerprints.add(new_build_info.fingerprint)
+ return device_names, fingerprints
+
+
def main(argv):
def option_handler(o, a):
@@ -2215,8 +2077,13 @@
OPTIONS.payload_signer = a
elif o == "--payload_signer_args":
OPTIONS.payload_signer_args = shlex.split(a)
+ elif o == "--payload_signer_maximum_signature_size":
+ OPTIONS.payload_signer_maximum_signature_size = a
elif o == "--payload_signer_key_size":
- OPTIONS.payload_signer_key_size = a
+ # TODO(Xunchang) remove this option after cleaning up the callers.
+ logger.warning("The option '--payload_signer_key_size' is deprecated."
+ " Use '--payload_signer_maximum_signature_size' instead.")
+ OPTIONS.payload_signer_maximum_signature_size = a
elif o == "--extracted_input_target_files":
OPTIONS.extracted_input = a
elif o == "--skip_postinstall":
@@ -2229,6 +2096,10 @@
OPTIONS.output_metadata_path = a
elif o == "--disable_fec_computation":
OPTIONS.disable_fec_computation = True
+ elif o == "--force_non_ab":
+ OPTIONS.force_non_ab = True
+ elif o == "--boot_variable_file":
+ OPTIONS.boot_variable_file = a
else:
return False
return True
@@ -2257,6 +2128,7 @@
"log_diff=",
"payload_signer=",
"payload_signer_args=",
+ "payload_signer_maximum_signature_size=",
"payload_signer_key_size=",
"extracted_input_target_files=",
"skip_postinstall",
@@ -2264,6 +2136,8 @@
"skip_compatibility_check",
"output_metadata_path=",
"disable_fec_computation",
+ "force_non_ab",
+ "boot_variable_file=",
], extra_option_handler=option_handler)
if len(args) != 2:
@@ -2325,11 +2199,17 @@
OPTIONS.skip_postinstall = True
ab_update = OPTIONS.info_dict.get("ab_update") == "true"
+ allow_non_ab = OPTIONS.info_dict.get("allow_non_ab") == "true"
+ if OPTIONS.force_non_ab:
+ assert allow_non_ab, "--force_non_ab only allowed on devices that supports non-A/B"
+ assert ab_update, "--force_non_ab only allowed on A/B devices"
+
+ generate_ab = not OPTIONS.force_non_ab and ab_update
# Use the default key to sign the package if not specified with package_key.
# package_keys are needed on ab_updates, so always define them if an
- # ab_update is getting created.
- if not OPTIONS.no_signing or ab_update:
+ # A/B update is getting created.
+ if not OPTIONS.no_signing or generate_ab:
if OPTIONS.package_key is None:
OPTIONS.package_key = OPTIONS.info_dict.get(
"default_system_dev_certificate",
@@ -2337,7 +2217,7 @@
# Get signing keys
OPTIONS.key_passwords = common.GetKeyPasswords([OPTIONS.package_key])
- if ab_update:
+ if generate_ab:
GenerateAbOtaPackage(
target_file=args[0],
output_file=args[1],
diff --git a/tools/releasetools/sign_apex.py b/tools/releasetools/sign_apex.py
index f2daa46..fb947f4 100755
--- a/tools/releasetools/sign_apex.py
+++ b/tools/releasetools/sign_apex.py
@@ -31,6 +31,14 @@
--payload_extra_args <args>
Optional flag that specifies any extra args to be passed to payload signer
(e.g. --payload_extra_args="--signing_helper_with_files /path/to/helper").
+
+ -e (--extra_apks) <name,name,...=key>
+ Add extra APK name/key pairs. This is useful to sign the apk files in the
+ apex payload image.
+
+ --codename_to_api_level_map Q:29,R:30,...
+ A Mapping of codename to api level. This is useful to provide sdk targeting
+ information to APK Signer.
"""
import logging
@@ -43,8 +51,8 @@
logger = logging.getLogger(__name__)
-def SignApexFile(avbtool, apex_file, payload_key, container_key,
- signing_args=None):
+def SignApexFile(avbtool, apex_file, payload_key, container_key, no_hashtree,
+ apk_keys=None, signing_args=None, codename_to_api_level_map=None):
"""Signs the given apex file."""
with open(apex_file, 'rb') as input_fp:
apex_data = input_fp.read()
@@ -55,8 +63,9 @@
payload_key=payload_key,
container_key=container_key,
container_pw=None,
- codename_to_api_level_map=None,
- no_hashtree=False,
+ codename_to_api_level_map=codename_to_api_level_map,
+ no_hashtree=no_hashtree,
+ apk_keys=apk_keys,
signing_args=signing_args)
@@ -77,18 +86,34 @@
options['payload_key'] = a
elif o == '--payload_extra_args':
options['payload_extra_args'] = a
+ elif o == '--codename_to_api_level_map':
+ versions = a.split(",")
+ for v in versions:
+ key, value = v.split(":")
+ if 'codename_to_api_level_map' not in options:
+ options['codename_to_api_level_map'] = {}
+ options['codename_to_api_level_map'].update({key: value})
+ elif o in ("-e", "--extra_apks"):
+ names, key = a.split("=")
+ names = names.split(",")
+ for n in names:
+ if 'extra_apks' not in options:
+ options['extra_apks'] = {}
+ options['extra_apks'].update({n: key})
else:
return False
return True
args = common.ParseOptions(
argv, __doc__,
- extra_opts='',
+ extra_opts='e:',
extra_long_opts=[
'avbtool=',
+ 'codename_to_api_level_map=',
'container_key=',
'payload_extra_args=',
'payload_key=',
+ 'extra_apks=',
],
extra_option_handler=option_handler)
@@ -105,7 +130,10 @@
options['payload_key'],
options['container_key'],
no_hashtree=False,
- signing_args=options.get('payload_extra_args'))
+ apk_keys=options.get('extra_apks', {}),
+ signing_args=options.get('payload_extra_args'),
+ codename_to_api_level_map=options.get(
+ 'codename_to_api_level_map', {}))
shutil.copyfile(signed_apex, args[1])
logger.info("done.")
diff --git a/tools/releasetools/sign_target_files_apks.py b/tools/releasetools/sign_target_files_apks.py
index 710147b..47360c9 100755
--- a/tools/releasetools/sign_target_files_apks.py
+++ b/tools/releasetools/sign_target_files_apks.py
@@ -91,6 +91,14 @@
Replace the veritykeyid in BOOT/cmdline of input_target_file_zip
with keyid of the cert pointed by <path_to_X509_PEM_cert_file>.
+ --remove_avb_public_keys <key1>,<key2>,...
+ Remove AVB public keys from the first-stage ramdisk. The key file to
+ remove is located at either of the following dirs:
+ - BOOT/RAMDISK/avb/ or
+ - BOOT/RAMDISK/first_stage_ramdisk/avb/
+ The second dir will be used for lookup if BOARD_USES_RECOVERY_AS_BOOT is
+ set to true.
+
--avb_{boot,system,system_other,vendor,dtbo,vbmeta,vbmeta_system,
vbmeta_vendor}_algorithm <algorithm>
--avb_{boot,system,system_other,vendor,dtbo,vbmeta,vbmeta_system,
@@ -103,6 +111,20 @@
Specify any additional args that are needed to AVB-sign the image
(e.g. "--signing_helper /path/to/helper"). The args will be appended to
the existing ones in info dict.
+
+ --avb_extra_custom_image_key <partition=key>
+ --avb_extra_custom_image_algorithm <partition=algorithm>
+ Use the specified algorithm (e.g. SHA256_RSA4096) and the key to AVB-sign
+ the specified custom images mounted on the partition. Otherwise it uses
+ the existing values in info dict.
+
+ --avb_extra_custom_image_extra_args <partition=extra_args>
+ Specify any additional args that are needed to AVB-sign the custom images
+ mounted on the partition (e.g. "--signing_helper /path/to/helper"). The
+ args will be appended to the existing ones in info dict.
+
+ --android_jar_path <path>
+ Path to the android.jar to repack the apex file.
"""
from __future__ import print_function
@@ -147,10 +169,26 @@
OPTIONS.replace_verity_public_key = False
OPTIONS.replace_verity_private_key = False
OPTIONS.replace_verity_keyid = False
+OPTIONS.remove_avb_public_keys = None
OPTIONS.tag_changes = ("-test-keys", "-dev-keys", "+release-keys")
OPTIONS.avb_keys = {}
OPTIONS.avb_algorithms = {}
OPTIONS.avb_extra_args = {}
+OPTIONS.android_jar_path = None
+
+
+AVB_FOOTER_ARGS_BY_PARTITION = {
+ 'boot' : 'avb_boot_add_hash_footer_args',
+ 'dtbo' : 'avb_dtbo_add_hash_footer_args',
+ 'recovery' : 'avb_recovery_add_hash_footer_args',
+ 'system' : 'avb_system_add_hashtree_footer_args',
+ 'system_other' : 'avb_system_other_add_hashtree_footer_args',
+ 'vendor' : 'avb_vendor_add_hashtree_footer_args',
+ 'vendor_boot' : 'avb_vendor_boot_add_hash_footer_args',
+ 'vbmeta' : 'avb_vbmeta_args',
+ 'vbmeta_system' : 'avb_vbmeta_system_args',
+ 'vbmeta_vendor' : 'avb_vbmeta_vendor_args',
+}
def GetApkCerts(certmap):
@@ -478,6 +516,7 @@
payload_key,
container_key,
key_passwords[container_key],
+ apk_keys,
codename_to_api_level_map,
no_hashtree=True,
signing_args=OPTIONS.avb_extra_args.get('apex'))
@@ -538,19 +577,23 @@
# Ask add_img_to_target_files to rebuild the recovery patch if needed.
elif filename in ("SYSTEM/recovery-from-boot.p",
+ "VENDOR/recovery-from-boot.p",
+
"SYSTEM/etc/recovery.img",
- "SYSTEM/bin/install-recovery.sh"):
+ "VENDOR/etc/recovery.img",
+
+ "SYSTEM/bin/install-recovery.sh",
+ "VENDOR/bin/install-recovery.sh"):
OPTIONS.rebuild_recovery = True
# Don't copy OTA certs if we're replacing them.
+ # Replacement of update-payload-key.pub.pem was removed in b/116660991.
elif (
OPTIONS.replace_ota_keys and
filename in (
"BOOT/RAMDISK/system/etc/security/otacerts.zip",
- "BOOT/RAMDISK/system/etc/update_engine/update-payload-key.pub.pem",
"RECOVERY/RAMDISK/system/etc/security/otacerts.zip",
- "SYSTEM/etc/security/otacerts.zip",
- "SYSTEM/etc/update_engine/update-payload-key.pub.pem")):
+ "SYSTEM/etc/security/otacerts.zip")):
pass
# Skip META/misc_info.txt since we will write back the new values later.
@@ -562,6 +605,18 @@
filename in ("BOOT/RAMDISK/verity_key",
"ROOT/verity_key")):
pass
+ elif (OPTIONS.remove_avb_public_keys and
+ (filename.startswith("BOOT/RAMDISK/avb/") or
+ filename.startswith("BOOT/RAMDISK/first_stage_ramdisk/avb/"))):
+ matched_removal = False
+ for key_to_remove in OPTIONS.remove_avb_public_keys:
+ if filename.endswith(key_to_remove):
+ matched_removal = True
+ print("Removing AVB public key from ramdisk: %s" % filename)
+ break
+ if not matched_removal:
+ # Copy it verbatim if we don't want to remove it.
+ common.ZipWriteStr(output_tf_zip, out_info, data)
# Skip verity keyid (for system_root_image use) if we will replace it.
elif OPTIONS.replace_verity_keyid and filename == "BOOT/cmdline":
@@ -587,8 +642,7 @@
# Should NOT sign boot-debug.img.
elif filename in (
"BOOT/RAMDISK/force_debuggable",
- "RECOVERY/RAMDISK/force_debuggable"
- "RECOVERY/RAMDISK/first_stage_ramdisk/force_debuggable"):
+ "BOOT/RAMDISK/first_stage_ramdisk/force_debuggable"):
raise common.ExternalError("debuggable boot.img cannot be signed")
# A non-APK file; copy it verbatim.
@@ -622,6 +676,10 @@
# Replace the AVB signing keys, if any.
ReplaceAvbSigningKeys(misc_info)
+ # Rewrite the props in AVB signing args.
+ if misc_info.get('avb_enable') == 'true':
+ RewriteAvbProps(misc_info)
+
# Write back misc_info with the latest values.
ReplaceMiscInfoTxt(input_tf_zip, output_tf_zip, misc_info)
@@ -814,24 +872,6 @@
# We DO NOT include the extra_recovery_keys (if any) here.
WriteOtacerts(output_tf_zip, "SYSTEM/etc/security/otacerts.zip", mapped_keys)
- # For A/B devices, update the payload verification key.
- if misc_info.get("ab_update") == "true":
- # Unlike otacerts.zip that may contain multiple keys, we can only specify
- # ONE payload verification key.
- if len(mapped_keys) > 1:
- print("\n WARNING: Found more than one OTA keys; Using the first one"
- " as payload verification key.\n\n")
-
- print("Using %s for payload verification." % (mapped_keys[0],))
- pubkey = common.ExtractPublicKey(mapped_keys[0])
- common.ZipWriteStr(
- output_tf_zip,
- "SYSTEM/etc/update_engine/update-payload-key.pub.pem",
- pubkey)
- common.ZipWriteStr(
- output_tf_zip,
- "BOOT/RAMDISK/system/etc/update_engine/update-payload-key.pub.pem",
- pubkey)
def ReplaceVerityPublicKey(output_zip, filename, key_path):
@@ -910,18 +950,6 @@
def ReplaceAvbSigningKeys(misc_info):
"""Replaces the AVB signing keys."""
- AVB_FOOTER_ARGS_BY_PARTITION = {
- 'boot' : 'avb_boot_add_hash_footer_args',
- 'dtbo' : 'avb_dtbo_add_hash_footer_args',
- 'recovery' : 'avb_recovery_add_hash_footer_args',
- 'system' : 'avb_system_add_hashtree_footer_args',
- 'system_other' : 'avb_system_other_add_hashtree_footer_args',
- 'vendor' : 'avb_vendor_add_hashtree_footer_args',
- 'vbmeta' : 'avb_vbmeta_args',
- 'vbmeta_system' : 'avb_vbmeta_system_args',
- 'vbmeta_vendor' : 'avb_vbmeta_vendor_args',
- }
-
def ReplaceAvbPartitionSigningKey(partition):
key = OPTIONS.avb_keys.get(partition)
if not key:
@@ -939,12 +967,46 @@
if extra_args:
print('Setting extra AVB signing args for %s to "%s"' % (
partition, extra_args))
- args_key = AVB_FOOTER_ARGS_BY_PARTITION[partition]
+ if partition in AVB_FOOTER_ARGS_BY_PARTITION:
+ args_key = AVB_FOOTER_ARGS_BY_PARTITION[partition]
+ else:
+ # custom partition
+ args_key = "avb_{}_add_hashtree_footer_args".format(partition)
misc_info[args_key] = (misc_info.get(args_key, '') + ' ' + extra_args)
for partition in AVB_FOOTER_ARGS_BY_PARTITION:
ReplaceAvbPartitionSigningKey(partition)
+ for custom_partition in misc_info.get(
+ "avb_custom_images_partition_list", "").strip().split():
+ ReplaceAvbPartitionSigningKey(custom_partition)
+
+
+def RewriteAvbProps(misc_info):
+ """Rewrites the props in AVB signing args."""
+ for partition, args_key in AVB_FOOTER_ARGS_BY_PARTITION.items():
+ args = misc_info.get(args_key)
+ if not args:
+ continue
+
+ tokens = []
+ changed = False
+ for token in args.split(' '):
+ fingerprint_key = 'com.android.build.{}.fingerprint'.format(partition)
+ if not token.startswith(fingerprint_key):
+ tokens.append(token)
+ continue
+ prefix, tag = token.rsplit('/', 1)
+ tokens.append('{}/{}'.format(prefix, EditTags(tag)))
+ changed = True
+
+ if changed:
+ result = ' '.join(tokens)
+ print('Rewriting AVB prop for {}:\n'.format(partition))
+ print(' replace: {}'.format(args))
+ print(' with: {}'.format(result))
+ misc_info[args_key] = result
+
def BuildKeyMap(misc_info, key_mapping_options):
for s, d in key_mapping_options:
@@ -959,6 +1021,7 @@
devkeydir + "/media": d + "/media",
devkeydir + "/shared": d + "/shared",
devkeydir + "/platform": d + "/platform",
+ devkeydir + "/networkstack": d + "/networkstack",
})
else:
OPTIONS.key_map[s] = d
@@ -1038,7 +1101,8 @@
r'public_key="(?P<PAYLOAD_PUBLIC_KEY>.*)"\s+'
r'private_key="(?P<PAYLOAD_PRIVATE_KEY>.*)"\s+'
r'container_certificate="(?P<CONTAINER_CERT>.*)"\s+'
- r'container_private_key="(?P<CONTAINER_PRIVATE_KEY>.*)"$',
+ r'container_private_key="(?P<CONTAINER_PRIVATE_KEY>.*?)"'
+ r'(\s+partition="(?P<PARTITION>.*?)")?$',
line)
if not matches:
continue
@@ -1111,6 +1175,8 @@
OPTIONS.replace_verity_private_key = (True, a)
elif o == "--replace_verity_keyid":
OPTIONS.replace_verity_keyid = (True, a)
+ elif o == "--remove_avb_public_keys":
+ OPTIONS.remove_avb_public_keys = a.split(",")
elif o == "--avb_vbmeta_key":
OPTIONS.avb_keys['vbmeta'] = a
elif o == "--avb_vbmeta_algorithm":
@@ -1161,6 +1227,18 @@
OPTIONS.avb_extra_args['vbmeta_vendor'] = a
elif o == "--avb_apex_extra_args":
OPTIONS.avb_extra_args['apex'] = a
+ elif o == "--avb_extra_custom_image_key":
+ partition, key = a.split("=")
+ OPTIONS.avb_keys[partition] = key
+ elif o == "--avb_extra_custom_image_algorithm":
+ partition, algorithm = a.split("=")
+ OPTIONS.avb_algorithms[partition] = algorithm
+ elif o == "--avb_extra_custom_image_extra_args":
+ # Setting the maxsplit parameter to one, which will return a list with
+ # two elements. e.g., the second '=' should not be splitted for
+ # 'oem=--signing_helper_with_files=/tmp/avbsigner.sh'.
+ partition, extra_args = a.split("=", 1)
+ OPTIONS.avb_extra_args[partition] = extra_args
else:
return False
return True
@@ -1179,6 +1257,7 @@
"replace_verity_public_key=",
"replace_verity_private_key=",
"replace_verity_keyid=",
+ "remove_avb_public_keys=",
"avb_apex_extra_args=",
"avb_vbmeta_algorithm=",
"avb_vbmeta_key=",
@@ -1204,6 +1283,9 @@
"avb_vbmeta_vendor_algorithm=",
"avb_vbmeta_vendor_key=",
"avb_vbmeta_vendor_extra_args=",
+ "avb_extra_custom_image_key=",
+ "avb_extra_custom_image_algorithm=",
+ "avb_extra_custom_image_extra_args=",
],
extra_option_handler=option_handler)
@@ -1228,6 +1310,8 @@
apex_keys_info = ReadApexKeysInfo(input_zip)
apex_keys = GetApexKeys(apex_keys_info, apk_keys)
+ # TODO(xunchang) check for the apks inside the apex files, and abort early if
+ # the keys are not available.
CheckApkAndApexKeysAvailable(
input_zip,
set(apk_keys.keys()) | set(apex_keys.keys()),
diff --git a/tools/releasetools/sparse_img.py b/tools/releasetools/sparse_img.py
index 3367896..524c0f2 100644
--- a/tools/releasetools/sparse_img.py
+++ b/tools/releasetools/sparse_img.py
@@ -249,8 +249,19 @@
with open(fn) as f:
for line in f:
- fn, ranges = line.split(None, 1)
- ranges = rangelib.RangeSet.parse(ranges)
+ fn, ranges_text = line.rstrip().split(None, 1)
+ raw_ranges = rangelib.RangeSet.parse(ranges_text)
+
+ # Note: e2fsdroid records holes in the extent tree as "0" blocks.
+ # This causes confusion because clobbered_blocks always includes
+ # the superblock (physical block #0). Since the 0 blocks here do
+ # not represent actual physical blocks, remove them from the set.
+ ranges = raw_ranges.subtract(rangelib.RangeSet("0"))
+ # b/150334561 we need to perserve the monotonic property of the raw
+ # range. Otherwise, the validation script will read the blocks with
+ # wrong order when pulling files from the image.
+ ranges.monotonic = raw_ranges.monotonic
+ ranges.extra['text_str'] = ranges_text
if allow_shared_blocks:
# Find the shared blocks that have been claimed by others. If so, tag
@@ -261,9 +272,6 @@
if not non_shared:
continue
- # There shouldn't anything in the extra dict yet.
- assert not ranges.extra, "Non-empty RangeSet.extra"
-
# Put the non-shared RangeSet as the value in the block map, which
# has a copy of the original RangeSet.
non_shared.extra['uses_shared_blocks'] = ranges
diff --git a/tools/releasetools/test_add_img_to_target_files.py b/tools/releasetools/test_add_img_to_target_files.py
index 3d0766f..c82a40b 100644
--- a/tools/releasetools/test_add_img_to_target_files.py
+++ b/tools/releasetools/test_add_img_to_target_files.py
@@ -128,13 +128,16 @@
'vendor_image_size' : 40960,
'system_verity_block_device': '/dev/block/system',
'vendor_verity_block_device': '/dev/block/vendor',
- 'system.build.prop': {
- 'ro.system.build.fingerprint':
- 'google/sailfish/12345:user/dev-keys',
- },
- 'vendor.build.prop': {
- 'ro.vendor.build.fingerprint': 'google/sailfish/678:user/dev-keys',
- },
+ 'system.build.prop': common.PartitionBuildProps.FromDictionary(
+ 'system', {
+ 'ro.system.build.fingerprint':
+ 'google/sailfish/12345:user/dev-keys'}
+ ),
+ 'vendor.build.prop': common.PartitionBuildProps.FromDictionary(
+ 'vendor', {
+ 'ro.vendor.build.fingerprint':
+ 'google/sailfish/678:user/dev-keys'}
+ ),
}
# Prepare the META/ folder.
@@ -206,18 +209,21 @@
"""Tests the case for device using AVB."""
image_paths = self._test_AddCareMapForAbOta()
OPTIONS.info_dict = {
- 'extfs_sparse_flag' : '-s',
- 'system_image_size' : 65536,
- 'vendor_image_size' : 40960,
- 'avb_system_hashtree_enable' : 'true',
- 'avb_vendor_hashtree_enable' : 'true',
- 'system.build.prop': {
- 'ro.system.build.fingerprint':
- 'google/sailfish/12345:user/dev-keys',
- },
- 'vendor.build.prop': {
- 'ro.vendor.build.fingerprint': 'google/sailfish/678:user/dev-keys',
- }
+ 'extfs_sparse_flag': '-s',
+ 'system_image_size': 65536,
+ 'vendor_image_size': 40960,
+ 'avb_system_hashtree_enable': 'true',
+ 'avb_vendor_hashtree_enable': 'true',
+ 'system.build.prop': common.PartitionBuildProps.FromDictionary(
+ 'system', {
+ 'ro.system.build.fingerprint':
+ 'google/sailfish/12345:user/dev-keys'}
+ ),
+ 'vendor.build.prop': common.PartitionBuildProps.FromDictionary(
+ 'vendor', {
+ 'ro.vendor.build.fingerprint':
+ 'google/sailfish/678:user/dev-keys'}
+ ),
}
AddCareMapForAbOta(None, ['system', 'vendor'], image_paths)
@@ -258,17 +264,21 @@
"""Tests the case for partitions with thumbprint."""
image_paths = self._test_AddCareMapForAbOta()
OPTIONS.info_dict = {
- 'extfs_sparse_flag' : '-s',
- 'system_image_size' : 65536,
- 'vendor_image_size' : 40960,
+ 'extfs_sparse_flag': '-s',
+ 'system_image_size': 65536,
+ 'vendor_image_size': 40960,
'system_verity_block_device': '/dev/block/system',
'vendor_verity_block_device': '/dev/block/vendor',
- 'system.build.prop': {
- 'ro.system.build.thumbprint': 'google/sailfish/123:user/dev-keys',
- },
- 'vendor.build.prop' : {
- 'ro.vendor.build.thumbprint': 'google/sailfish/456:user/dev-keys',
- },
+ 'system.build.prop': common.PartitionBuildProps.FromDictionary(
+ 'system', {
+ 'ro.system.build.thumbprint':
+ 'google/sailfish/123:user/dev-keys'}
+ ),
+ 'vendor.build.prop': common.PartitionBuildProps.FromDictionary(
+ 'vendor', {
+ 'ro.vendor.build.thumbprint':
+ 'google/sailfish/456:user/dev-keys'}
+ ),
}
AddCareMapForAbOta(None, ['system', 'vendor'], image_paths)
diff --git a/tools/releasetools/test_apex_utils.py b/tools/releasetools/test_apex_utils.py
index 5d4cc77..7b4a4b0 100644
--- a/tools/releasetools/test_apex_utils.py
+++ b/tools/releasetools/test_apex_utils.py
@@ -14,8 +14,11 @@
# limitations under the License.
#
+import re
import os
import os.path
+import shutil
+import zipfile
import apex_utils
import common
@@ -31,6 +34,9 @@
self.testdata_dir = test_utils.get_testdata_dir()
# The default payload signing key.
self.payload_key = os.path.join(self.testdata_dir, 'testkey.key')
+ self.apex_with_apk = os.path.join(self.testdata_dir, 'has_apk.apex')
+
+ common.OPTIONS.search_path = test_utils.get_search_path()
@staticmethod
def _GetTestPayload():
@@ -44,11 +50,12 @@
payload_file = self._GetTestPayload()
apex_utils.SignApexPayload(
'avbtool', payload_file, self.payload_key, 'testkey', 'SHA256_RSA2048',
- self.SALT, no_hashtree=True)
+ self.SALT, 'sha256', no_hashtree=True)
payload_info = apex_utils.ParseApexPayloadInfo('avbtool', payload_file)
self.assertEqual('SHA256_RSA2048', payload_info['Algorithm'])
self.assertEqual(self.SALT, payload_info['Salt'])
self.assertEqual('testkey', payload_info['apex.key'])
+ self.assertEqual('sha256', payload_info['Hash Algorithm'])
self.assertEqual('0 bytes', payload_info['Tree Size'])
@test_utils.SkipIfExternalToolsUnavailable()
@@ -56,7 +63,7 @@
payload_file = self._GetTestPayload()
apex_utils.SignApexPayload(
'avbtool', payload_file, self.payload_key, 'testkey', 'SHA256_RSA2048',
- self.SALT, no_hashtree=True)
+ self.SALT, 'sha256', no_hashtree=True)
apex_utils.VerifyApexPayload(
'avbtool', payload_file, self.payload_key, True)
@@ -65,7 +72,7 @@
payload_file = self._GetTestPayload()
apex_utils.SignApexPayload(
'avbtool', payload_file, self.payload_key, 'testkey', 'SHA256_RSA2048',
- self.SALT, no_hashtree=False)
+ self.SALT, 'sha256', no_hashtree=False)
apex_utils.VerifyApexPayload('avbtool', payload_file, self.payload_key)
payload_info = apex_utils.ParseApexPayloadInfo('avbtool', payload_file)
self.assertEqual('4096 bytes', payload_info['Tree Size'])
@@ -75,7 +82,7 @@
payload_file = self._GetTestPayload()
apex_utils.SignApexPayload(
'avbtool', payload_file, self.payload_key, 'testkey', 'SHA256_RSA2048',
- self.SALT, no_hashtree=True)
+ self.SALT, 'sha256', no_hashtree=True)
apex_utils.VerifyApexPayload('avbtool', payload_file, self.payload_key,
no_hashtree=True)
payload_info = apex_utils.ParseApexPayloadInfo('avbtool', payload_file)
@@ -92,7 +99,7 @@
'avbtool',
payload_file,
self.payload_key,
- 'testkey', 'SHA256_RSA2048', self.SALT,
+ 'testkey', 'SHA256_RSA2048', self.SALT, 'sha256',
True,
payload_signer_args)
apex_utils.VerifyApexPayload(
@@ -109,6 +116,7 @@
'testkey',
'SHA256_RSA2048',
self.SALT,
+ 'sha256',
no_hashtree=True)
@test_utils.SkipIfExternalToolsUnavailable()
@@ -116,7 +124,7 @@
payload_file = self._GetTestPayload()
apex_utils.SignApexPayload(
'avbtool', payload_file, self.payload_key, 'testkey', 'SHA256_RSA2048',
- self.SALT, True)
+ self.SALT, 'sha256', True)
apex_utils.VerifyApexPayload(
'avbtool', payload_file, self.payload_key, True)
self.assertRaises(
@@ -126,3 +134,56 @@
payload_file,
os.path.join(self.testdata_dir, 'testkey_with_passwd.key'),
no_hashtree=True)
+
+ @test_utils.SkipIfExternalToolsUnavailable()
+ def test_ApexApkSigner_noApkPresent(self):
+ apex_path = os.path.join(self.testdata_dir, 'foo.apex')
+ signer = apex_utils.ApexApkSigner(apex_path, None, None)
+ processed_apex = signer.ProcessApexFile({}, self.payload_key)
+ self.assertEqual(apex_path, processed_apex)
+
+ @test_utils.SkipIfExternalToolsUnavailable()
+ def test_ApexApkSigner_apkKeyNotPresent(self):
+ apex_path = common.MakeTempFile(suffix='.apex')
+ shutil.copy(self.apex_with_apk, apex_path)
+ signer = apex_utils.ApexApkSigner(apex_path, None, None)
+ self.assertRaises(apex_utils.ApexSigningError, signer.ProcessApexFile,
+ {}, self.payload_key)
+
+ @test_utils.SkipIfExternalToolsUnavailable()
+ def test_ApexApkSigner_signApk(self):
+ apex_path = common.MakeTempFile(suffix='.apex')
+ shutil.copy(self.apex_with_apk, apex_path)
+ signer = apex_utils.ApexApkSigner(apex_path, None, None)
+ apk_keys = {'wifi-service-resources.apk': os.path.join(
+ self.testdata_dir, 'testkey')}
+
+ self.payload_key = os.path.join(self.testdata_dir, 'testkey_RSA4096.key')
+ apex_file = signer.ProcessApexFile(apk_keys, self.payload_key)
+ package_name_extract_cmd = ['aapt', 'dump', 'badging', apex_file]
+ output = common.RunAndCheckOutput(package_name_extract_cmd)
+ for line in output.splitlines():
+ # Sample output from aapt: "package: name='com.google.android.wifi'
+ # versionCode='1' versionName='' platformBuildVersionName='R'
+ # compileSdkVersion='29' compileSdkVersionCodename='R'"
+ match = re.search(r"^package:.* name='([\w|\.]+)'", line, re.IGNORECASE)
+ if match:
+ package_name = match.group(1)
+ self.assertEquals('com.google.android.wifi', package_name)
+
+ @test_utils.SkipIfExternalToolsUnavailable()
+ def test_ApexApkSigner_noAssetDir(self):
+ no_asset = common.MakeTempFile(suffix='.apex')
+ with zipfile.ZipFile(no_asset, 'w') as output_zip:
+ with zipfile.ZipFile(self.apex_with_apk, 'r') as input_zip:
+ name_list = input_zip.namelist()
+ for name in name_list:
+ if not name.startswith('assets'):
+ output_zip.writestr(name, input_zip.read(name))
+
+ signer = apex_utils.ApexApkSigner(no_asset, None, None)
+ apk_keys = {'wifi-service-resources.apk': os.path.join(
+ self.testdata_dir, 'testkey')}
+
+ self.payload_key = os.path.join(self.testdata_dir, 'testkey_RSA4096.key')
+ signer.ProcessApexFile(apk_keys, self.payload_key)
diff --git a/tools/releasetools/test_check_partition_sizes.py b/tools/releasetools/test_check_partition_sizes.py
new file mode 100644
index 0000000..ed20873
--- /dev/null
+++ b/tools/releasetools/test_check_partition_sizes.py
@@ -0,0 +1,128 @@
+#
+# Copyright (C) 2019 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+import common
+import test_utils
+from check_partition_sizes import CheckPartitionSizes
+
+class CheckPartitionSizesTest(test_utils.ReleaseToolsTestCase):
+ def setUp(self):
+ self.info_dict = common.LoadDictionaryFromLines("""
+ use_dynamic_partitions=true
+ ab_update=true
+ super_block_devices=super
+ dynamic_partition_list=system vendor product
+ super_partition_groups=group
+ super_group_partition_list=system vendor product
+ super_partition_size=200
+ super_super_device_size=200
+ super_group_group_size=100
+ system_image_size=50
+ vendor_image_size=20
+ product_image_size=20
+ """.split("\n"))
+
+ def test_ab(self):
+ CheckPartitionSizes(self.info_dict)
+
+ def test_non_ab(self):
+ self.info_dict.update(common.LoadDictionaryFromLines("""
+ ab_update=false
+ super_partition_size=100
+ super_super_device_size=100
+ """.split("\n")))
+ CheckPartitionSizes(self.info_dict)
+
+ def test_non_dap(self):
+ self.info_dict.update(common.LoadDictionaryFromLines("""
+ use_dynamic_partitions=false
+ """.split("\n")))
+ with self.assertRaises(RuntimeError):
+ CheckPartitionSizes(self.info_dict)
+
+ def test_retrofit_dap(self):
+ self.info_dict.update(common.LoadDictionaryFromLines("""
+ dynamic_partition_retrofit=true
+ super_block_devices=system vendor
+ super_system_device_size=75
+ super_vendor_device_size=25
+ super_partition_size=100
+ """.split("\n")))
+ CheckPartitionSizes(self.info_dict)
+
+ def test_ab_partition_too_big(self):
+ self.info_dict.update(common.LoadDictionaryFromLines("""
+ system_image_size=100
+ """.split("\n")))
+ with self.assertRaises(RuntimeError):
+ CheckPartitionSizes(self.info_dict)
+
+ def test_ab_group_too_big(self):
+ self.info_dict.update(common.LoadDictionaryFromLines("""
+ super_group_group_size=110
+ """.split("\n")))
+ with self.assertRaises(RuntimeError):
+ CheckPartitionSizes(self.info_dict)
+
+ def test_no_image(self):
+ del self.info_dict["system_image_size"]
+ with self.assertRaises(KeyError):
+ CheckPartitionSizes(self.info_dict)
+
+ def test_block_devices_not_match(self):
+ self.info_dict.update(common.LoadDictionaryFromLines("""
+ dynamic_partition_retrofit=true
+ super_block_devices=system vendor
+ super_system_device_size=80
+ super_vendor_device_size=25
+ super_partition_size=100
+ """.split("\n")))
+ with self.assertRaises(RuntimeError):
+ CheckPartitionSizes(self.info_dict)
+
+ def test_retrofit_vab(self):
+ self.info_dict.update(common.LoadDictionaryFromLines("""
+ virtual_ab=true
+ virtual_ab_retrofit=true
+ """.split("\n")))
+ CheckPartitionSizes(self.info_dict)
+
+ def test_retrofit_vab_too_big(self):
+ self.info_dict.update(common.LoadDictionaryFromLines("""
+ virtual_ab=true
+ virtual_ab_retrofit=true
+ system_image_size=100
+ """.split("\n")))
+ with self.assertRaises(RuntimeError):
+ CheckPartitionSizes(self.info_dict)
+
+ def test_vab(self):
+ self.info_dict.update(common.LoadDictionaryFromLines("""
+ virtual_ab=true
+ super_partition_size=100
+ super_super_device_size=100
+ """.split("\n")))
+ CheckPartitionSizes(self.info_dict)
+
+ def test_vab_too_big(self):
+ self.info_dict.update(common.LoadDictionaryFromLines("""
+ virtual_ab=true
+ super_partition_size=100
+ super_super_device_size=100
+ system_image_size=100
+ """.split("\n")))
+ with self.assertRaises(RuntimeError):
+ CheckPartitionSizes(self.info_dict)
diff --git a/tools/releasetools/test_check_target_files_vintf.py b/tools/releasetools/test_check_target_files_vintf.py
index a1328c2..d326229 100644
--- a/tools/releasetools/test_check_target_files_vintf.py
+++ b/tools/releasetools/test_check_target_files_vintf.py
@@ -35,20 +35,20 @@
'SYSTEM_EXT/etc/build.prop': '',
# Non-empty files
- 'SYSTEM/compatibility_matrix.xml':"""
- <compatibility-matrix version="1.0" type="framework">
+ 'SYSTEM/etc/vintf/compatibility_matrix.1.xml':"""
+ <compatibility-matrix version="1.0" level="1" type="framework">
<sepolicy>
<sepolicy-version>0.0</sepolicy-version>
<kernel-sepolicy-version>0</kernel-sepolicy-version>
</sepolicy>
</compatibility-matrix>""",
'SYSTEM/manifest.xml':
- '<manifest version="1.0" type="framework" />',
+ '<manifest version="1.0" type="framework"/>',
'VENDOR/build.prop': 'ro.product.first_api_level=29\n',
'VENDOR/compatibility_matrix.xml':
'<compatibility-matrix version="1.0" type="device" />',
- 'VENDOR/manifest.xml':
- '<manifest version="1.0" type="device"/>',
+ 'VENDOR/etc/vintf/manifest.xml':
+ '<manifest version="1.0" target-level="1" type="device"/>',
'META/misc_info.txt':
'recovery_api_version=3\nfstab_version=2\nvintf_enforce=true\n',
}
@@ -78,6 +78,8 @@
for root, _, files in os.walk(test_delta_dir):
rel_root = os.path.relpath(root, test_delta_dir)
for f in files:
+ if not f.endswith('.xml'):
+ continue
output_file = os.path.join(test_dir, rel_root, f)
with open(os.path.join(root, f)) as inp:
write_string_to_file(inp.read(), output_file)
@@ -138,6 +140,6 @@
def test_CheckVintf_bad_xml(self):
test_dir = self.prepare_test_dir('does-not-exist')
write_string_to_file('not an XML',
- os.path.join(test_dir, 'VENDOR/manifest.xml'))
+ os.path.join(test_dir, 'VENDOR/etc/vintf/manifest.xml'))
# Should raise an error because a file has invalid format.
self.assertRaises(common.ExternalError, CheckVintf, test_dir)
diff --git a/tools/releasetools/test_common.py b/tools/releasetools/test_common.py
index ceb023f..787e675 100644
--- a/tools/releasetools/test_common.py
+++ b/tools/releasetools/test_common.py
@@ -19,6 +19,7 @@
import subprocess
import tempfile
import time
+import unittest
import zipfile
from hashlib import sha1
@@ -44,6 +45,312 @@
yield b'\0' * (step_size - block_size)
+class BuildInfoTest(test_utils.ReleaseToolsTestCase):
+
+ TEST_INFO_DICT = {
+ 'build.prop': common.PartitionBuildProps.FromDictionary(
+ 'system', {
+ 'ro.product.device': 'product-device',
+ 'ro.product.name': 'product-name',
+ 'ro.build.fingerprint': 'build-fingerprint',
+ 'ro.build.foo': 'build-foo'}
+ ),
+ 'system.build.prop': common.PartitionBuildProps.FromDictionary(
+ 'system', {
+ 'ro.product.system.brand': 'product-brand',
+ 'ro.product.system.name': 'product-name',
+ 'ro.product.system.device': 'product-device',
+ 'ro.system.build.version.release': 'version-release',
+ 'ro.system.build.id': 'build-id',
+ 'ro.system.build.version.incremental': 'version-incremental',
+ 'ro.system.build.type': 'build-type',
+ 'ro.system.build.tags': 'build-tags',
+ 'ro.system.build.foo': 'build-foo'}
+ ),
+ 'vendor.build.prop': common.PartitionBuildProps.FromDictionary(
+ 'vendor', {
+ 'ro.product.vendor.brand': 'vendor-product-brand',
+ 'ro.product.vendor.name': 'vendor-product-name',
+ 'ro.product.vendor.device': 'vendor-product-device',
+ 'ro.vendor.build.version.release': 'vendor-version-release',
+ 'ro.vendor.build.id': 'vendor-build-id',
+ 'ro.vendor.build.version.incremental':
+ 'vendor-version-incremental',
+ 'ro.vendor.build.type': 'vendor-build-type',
+ 'ro.vendor.build.tags': 'vendor-build-tags'}
+ ),
+ 'property1': 'value1',
+ 'property2': 4096,
+ }
+
+ TEST_INFO_DICT_USES_OEM_PROPS = {
+ 'build.prop': common.PartitionBuildProps.FromDictionary(
+ 'system', {
+ 'ro.product.name': 'product-name',
+ 'ro.build.thumbprint': 'build-thumbprint',
+ 'ro.build.bar': 'build-bar'}
+ ),
+ 'vendor.build.prop': common.PartitionBuildProps.FromDictionary(
+ 'vendor', {
+ 'ro.vendor.build.fingerprint': 'vendor-build-fingerprint'}
+ ),
+ 'property1': 'value1',
+ 'property2': 4096,
+ 'oem_fingerprint_properties': 'ro.product.device ro.product.brand',
+ }
+
+ TEST_OEM_DICTS = [
+ {
+ 'ro.product.brand': 'brand1',
+ 'ro.product.device': 'device1',
+ },
+ {
+ 'ro.product.brand': 'brand2',
+ 'ro.product.device': 'device2',
+ },
+ {
+ 'ro.product.brand': 'brand3',
+ 'ro.product.device': 'device3',
+ },
+ ]
+
+ TEST_INFO_DICT_PROPERTY_SOURCE_ORDER = {
+ 'build.prop': common.PartitionBuildProps.FromDictionary(
+ 'system', {
+ 'ro.build.fingerprint': 'build-fingerprint',
+ 'ro.product.property_source_order':
+ 'product,odm,vendor,system_ext,system'}
+ ),
+ 'system.build.prop': common.PartitionBuildProps.FromDictionary(
+ 'system', {
+ 'ro.product.system.device': 'system-product-device'}
+ ),
+ 'vendor.build.prop': common.PartitionBuildProps.FromDictionary(
+ 'vendor', {
+ 'ro.product.vendor.device': 'vendor-product-device'}
+ ),
+ }
+
+ TEST_INFO_DICT_PROPERTY_SOURCE_ORDER_ANDROID_10 = {
+ 'build.prop': common.PartitionBuildProps.FromDictionary(
+ 'system', {
+ 'ro.build.fingerprint': 'build-fingerprint',
+ 'ro.product.property_source_order':
+ 'product,product_services,odm,vendor,system',
+ 'ro.build.version.release': '10',
+ 'ro.build.version.codename': 'REL'}
+ ),
+ 'system.build.prop': common.PartitionBuildProps.FromDictionary(
+ 'system', {
+ 'ro.product.system.device': 'system-product-device'}
+ ),
+ 'vendor.build.prop': common.PartitionBuildProps.FromDictionary(
+ 'vendor', {
+ 'ro.product.vendor.device': 'vendor-product-device'}
+ ),
+ }
+
+ TEST_INFO_DICT_PROPERTY_SOURCE_ORDER_ANDROID_9 = {
+ 'build.prop': common.PartitionBuildProps.FromDictionary(
+ 'system', {
+ 'ro.product.device': 'product-device',
+ 'ro.build.fingerprint': 'build-fingerprint',
+ 'ro.build.version.release': '9',
+ 'ro.build.version.codename': 'REL'}
+ ),
+ 'system.build.prop': common.PartitionBuildProps.FromDictionary(
+ 'system', {
+ 'ro.product.system.device': 'system-product-device'}
+ ),
+ 'vendor.build.prop': common.PartitionBuildProps.FromDictionary(
+ 'vendor', {
+ 'ro.product.vendor.device': 'vendor-product-device'}
+ ),
+ }
+
+ def test_init(self):
+ target_info = common.BuildInfo(self.TEST_INFO_DICT, None)
+ self.assertEqual('product-device', target_info.device)
+ self.assertEqual('build-fingerprint', target_info.fingerprint)
+ self.assertFalse(target_info.is_ab)
+ self.assertIsNone(target_info.oem_props)
+
+ def test_init_with_oem_props(self):
+ target_info = common.BuildInfo(self.TEST_INFO_DICT_USES_OEM_PROPS,
+ self.TEST_OEM_DICTS)
+ self.assertEqual('device1', target_info.device)
+ self.assertEqual('brand1/product-name/device1:build-thumbprint',
+ target_info.fingerprint)
+
+ # Swap the order in oem_dicts, which would lead to different BuildInfo.
+ oem_dicts = copy.copy(self.TEST_OEM_DICTS)
+ oem_dicts[0], oem_dicts[2] = oem_dicts[2], oem_dicts[0]
+ target_info = common.BuildInfo(self.TEST_INFO_DICT_USES_OEM_PROPS,
+ oem_dicts)
+ self.assertEqual('device3', target_info.device)
+ self.assertEqual('brand3/product-name/device3:build-thumbprint',
+ target_info.fingerprint)
+
+ def test_init_badFingerprint(self):
+ info_dict = copy.deepcopy(self.TEST_INFO_DICT)
+ info_dict['build.prop'].build_props[
+ 'ro.build.fingerprint'] = 'bad fingerprint'
+ self.assertRaises(ValueError, common.BuildInfo, info_dict, None)
+
+ info_dict['build.prop'].build_props[
+ 'ro.build.fingerprint'] = 'bad\x80fingerprint'
+ self.assertRaises(ValueError, common.BuildInfo, info_dict, None)
+
+ def test___getitem__(self):
+ target_info = common.BuildInfo(self.TEST_INFO_DICT, None)
+ self.assertEqual('value1', target_info['property1'])
+ self.assertEqual(4096, target_info['property2'])
+ self.assertEqual('build-foo',
+ target_info['build.prop'].GetProp('ro.build.foo'))
+
+ def test___getitem__with_oem_props(self):
+ target_info = common.BuildInfo(self.TEST_INFO_DICT_USES_OEM_PROPS,
+ self.TEST_OEM_DICTS)
+ self.assertEqual('value1', target_info['property1'])
+ self.assertEqual(4096, target_info['property2'])
+ self.assertIsNone(target_info['build.prop'].GetProp('ro.build.foo'))
+
+ def test___setitem__(self):
+ target_info = common.BuildInfo(copy.deepcopy(self.TEST_INFO_DICT), None)
+ self.assertEqual('value1', target_info['property1'])
+ target_info['property1'] = 'value2'
+ self.assertEqual('value2', target_info['property1'])
+
+ self.assertEqual('build-foo',
+ target_info['build.prop'].GetProp('ro.build.foo'))
+ target_info['build.prop'].build_props['ro.build.foo'] = 'build-bar'
+ self.assertEqual('build-bar',
+ target_info['build.prop'].GetProp('ro.build.foo'))
+
+ def test_get(self):
+ target_info = common.BuildInfo(self.TEST_INFO_DICT, None)
+ self.assertEqual('value1', target_info.get('property1'))
+ self.assertEqual(4096, target_info.get('property2'))
+ self.assertEqual(4096, target_info.get('property2', 1024))
+ self.assertEqual(1024, target_info.get('property-nonexistent', 1024))
+ self.assertEqual('build-foo',
+ target_info.get('build.prop').GetProp('ro.build.foo'))
+
+ def test_get_with_oem_props(self):
+ target_info = common.BuildInfo(self.TEST_INFO_DICT_USES_OEM_PROPS,
+ self.TEST_OEM_DICTS)
+ self.assertEqual('value1', target_info.get('property1'))
+ self.assertEqual(4096, target_info.get('property2'))
+ self.assertEqual(4096, target_info.get('property2', 1024))
+ self.assertEqual(1024, target_info.get('property-nonexistent', 1024))
+ self.assertIsNone(target_info.get('build.prop').GetProp('ro.build.foo'))
+
+ def test_items(self):
+ target_info = common.BuildInfo(self.TEST_INFO_DICT, None)
+ items = target_info.items()
+ self.assertIn(('property1', 'value1'), items)
+ self.assertIn(('property2', 4096), items)
+
+ def test_GetBuildProp(self):
+ target_info = common.BuildInfo(self.TEST_INFO_DICT, None)
+ self.assertEqual('build-foo', target_info.GetBuildProp('ro.build.foo'))
+ self.assertRaises(common.ExternalError, target_info.GetBuildProp,
+ 'ro.build.nonexistent')
+
+ def test_GetBuildProp_with_oem_props(self):
+ target_info = common.BuildInfo(self.TEST_INFO_DICT_USES_OEM_PROPS,
+ self.TEST_OEM_DICTS)
+ self.assertEqual('build-bar', target_info.GetBuildProp('ro.build.bar'))
+ self.assertRaises(common.ExternalError, target_info.GetBuildProp,
+ 'ro.build.nonexistent')
+
+ def test_GetPartitionFingerprint(self):
+ target_info = common.BuildInfo(self.TEST_INFO_DICT, None)
+ self.assertEqual(
+ target_info.GetPartitionFingerprint('vendor'),
+ 'vendor-product-brand/vendor-product-name/vendor-product-device'
+ ':vendor-version-release/vendor-build-id/vendor-version-incremental'
+ ':vendor-build-type/vendor-build-tags')
+
+ def test_GetPartitionFingerprint_system_other_uses_system(self):
+ target_info = common.BuildInfo(self.TEST_INFO_DICT, None)
+ self.assertEqual(
+ target_info.GetPartitionFingerprint('system_other'),
+ target_info.GetPartitionFingerprint('system'))
+
+ def test_GetPartitionFingerprint_uses_fingerprint_prop_if_available(self):
+ info_dict = copy.deepcopy(self.TEST_INFO_DICT)
+ info_dict['vendor.build.prop'].build_props[
+ 'ro.vendor.build.fingerprint'] = 'vendor:fingerprint'
+ target_info = common.BuildInfo(info_dict, None)
+ self.assertEqual(
+ target_info.GetPartitionFingerprint('vendor'),
+ 'vendor:fingerprint')
+
+ def test_WriteMountOemScript(self):
+ target_info = common.BuildInfo(self.TEST_INFO_DICT_USES_OEM_PROPS,
+ self.TEST_OEM_DICTS)
+ script_writer = test_utils.MockScriptWriter()
+ target_info.WriteMountOemScript(script_writer)
+ self.assertEqual([('Mount', '/oem', None)], script_writer.lines)
+
+ def test_WriteDeviceAssertions(self):
+ target_info = common.BuildInfo(self.TEST_INFO_DICT, None)
+ script_writer = test_utils.MockScriptWriter()
+ target_info.WriteDeviceAssertions(script_writer, False)
+ self.assertEqual([('AssertDevice', 'product-device')], script_writer.lines)
+
+ def test_WriteDeviceAssertions_with_oem_props(self):
+ target_info = common.BuildInfo(self.TEST_INFO_DICT_USES_OEM_PROPS,
+ self.TEST_OEM_DICTS)
+ script_writer = test_utils.MockScriptWriter()
+ target_info.WriteDeviceAssertions(script_writer, False)
+ self.assertEqual(
+ [
+ ('AssertOemProperty', 'ro.product.device',
+ ['device1', 'device2', 'device3'], False),
+ ('AssertOemProperty', 'ro.product.brand',
+ ['brand1', 'brand2', 'brand3'], False),
+ ],
+ script_writer.lines)
+
+ def test_ResolveRoProductProperty_FromVendor(self):
+ info_dict = copy.deepcopy(self.TEST_INFO_DICT_PROPERTY_SOURCE_ORDER)
+ info = common.BuildInfo(info_dict, None)
+ self.assertEqual('vendor-product-device',
+ info.GetBuildProp('ro.product.device'))
+
+ def test_ResolveRoProductProperty_FromSystem(self):
+ info_dict = copy.deepcopy(self.TEST_INFO_DICT_PROPERTY_SOURCE_ORDER)
+ del info_dict['vendor.build.prop'].build_props['ro.product.vendor.device']
+ info = common.BuildInfo(info_dict, None)
+ self.assertEqual('system-product-device',
+ info.GetBuildProp('ro.product.device'))
+
+ def test_ResolveRoProductProperty_InvalidPropertySearchOrder(self):
+ info_dict = copy.deepcopy(self.TEST_INFO_DICT_PROPERTY_SOURCE_ORDER)
+ info_dict['build.prop'].build_props[
+ 'ro.product.property_source_order'] = 'bad-source'
+ with self.assertRaisesRegexp(common.ExternalError,
+ 'Invalid ro.product.property_source_order'):
+ info = common.BuildInfo(info_dict, None)
+ info.GetBuildProp('ro.product.device')
+
+ def test_ResolveRoProductProperty_Android10PropertySearchOrder(self):
+ info_dict = copy.deepcopy(
+ self.TEST_INFO_DICT_PROPERTY_SOURCE_ORDER_ANDROID_10)
+ info = common.BuildInfo(info_dict, None)
+ self.assertEqual('vendor-product-device',
+ info.GetBuildProp('ro.product.device'))
+
+ def test_ResolveRoProductProperty_Android9PropertySearchOrder(self):
+ info_dict = copy.deepcopy(
+ self.TEST_INFO_DICT_PROPERTY_SOURCE_ORDER_ANDROID_9)
+ info = common.BuildInfo(info_dict, None)
+ self.assertEqual('product-device',
+ info.GetBuildProp('ro.product.device'))
+
+
class CommonZipTest(test_utils.ReleaseToolsTestCase):
def _verify(self, zip_file, zip_file_name, arcname, expected_hash,
@@ -500,6 +807,25 @@
'Compressed4.apk' : 'certs/compressed4',
}
+ # Test parsing with no optional fields, both optional fields, and only the
+ # partition optional field.
+ APKCERTS_TXT4 = (
+ 'name="RecoveryLocalizer.apk" certificate="certs/devkey.x509.pem"'
+ ' private_key="certs/devkey.pk8"\n'
+ 'name="Settings.apk"'
+ ' certificate="build/make/target/product/security/platform.x509.pem"'
+ ' private_key="build/make/target/product/security/platform.pk8"'
+ ' compressed="gz" partition="system"\n'
+ 'name="TV.apk" certificate="PRESIGNED" private_key=""'
+ ' partition="product"\n'
+ )
+
+ APKCERTS_CERTMAP4 = {
+ 'RecoveryLocalizer.apk' : 'certs/devkey',
+ 'Settings.apk' : 'build/make/target/product/security/platform',
+ 'TV.apk' : 'PRESIGNED',
+ }
+
def setUp(self):
self.testdata_dir = test_utils.get_testdata_dir()
@@ -576,6 +902,14 @@
with zipfile.ZipFile(target_files, 'r') as input_zip:
self.assertRaises(ValueError, common.ReadApkCerts, input_zip)
+ def test_ReadApkCerts_WithWithoutOptionalFields(self):
+ target_files = self._write_apkcerts_txt(self.APKCERTS_TXT4)
+ with zipfile.ZipFile(target_files, 'r') as input_zip:
+ certmap, ext = common.ReadApkCerts(input_zip)
+
+ self.assertDictEqual(self.APKCERTS_CERTMAP4, certmap)
+ self.assertIsNone(ext)
+
def test_ExtractPublicKey(self):
cert = os.path.join(self.testdata_dir, 'testkey.x509.pem')
pubkey = os.path.join(self.testdata_dir, 'testkey.pubkey.pem')
@@ -749,10 +1083,12 @@
self.assertNotIn(
'incomplete', sparse_image.file_map['/system/file2'].extra)
- # All other entries should look normal without any tags.
+ # '/system/file1' will only contain one field -- a copy of the input text.
+ self.assertEqual(1, len(sparse_image.file_map['/system/file1'].extra))
+
+ # Meta entries should not have any extra tag.
self.assertFalse(sparse_image.file_map['__COPY'].extra)
self.assertFalse(sparse_image.file_map['__NONZERO-0'].extra)
- self.assertFalse(sparse_image.file_map['/system/file1'].extra)
@test_utils.SkipIfExternalToolsUnavailable()
def test_GetSparseImage_incompleteRanges(self):
@@ -775,7 +1111,9 @@
with zipfile.ZipFile(target_files, 'r') as input_zip:
sparse_image = common.GetSparseImage('system', tempdir, input_zip, False)
- self.assertFalse(sparse_image.file_map['/system/file1'].extra)
+ self.assertEqual(
+ '1-5 9-10',
+ sparse_image.file_map['/system/file1'].extra['text_str'])
self.assertTrue(sparse_image.file_map['/system/file2'].extra['incomplete'])
@test_utils.SkipIfExternalToolsUnavailable()
@@ -801,7 +1139,9 @@
with zipfile.ZipFile(target_files, 'r') as input_zip:
sparse_image = common.GetSparseImage('system', tempdir, input_zip, False)
- self.assertFalse(sparse_image.file_map['//system/file1'].extra)
+ self.assertEqual(
+ '1-5 9-10',
+ sparse_image.file_map['//system/file1'].extra['text_str'])
self.assertTrue(sparse_image.file_map['//system/file2'].extra['incomplete'])
self.assertTrue(
sparse_image.file_map['/system/app/file3'].extra['incomplete'])
@@ -826,7 +1166,9 @@
with zipfile.ZipFile(target_files, 'r') as input_zip:
sparse_image = common.GetSparseImage('system', tempdir, input_zip, False)
- self.assertFalse(sparse_image.file_map['//system/file1'].extra)
+ self.assertEqual(
+ '1-5 9-10',
+ sparse_image.file_map['//system/file1'].extra['text_str'])
self.assertTrue(sparse_image.file_map['//init.rc'].extra['incomplete'])
@test_utils.SkipIfExternalToolsUnavailable()
@@ -1078,30 +1420,26 @@
framework_dict = {
'super_partition_groups': 'group_a',
'dynamic_partition_list': 'system',
- 'super_group_a_list': 'system',
+ 'super_group_a_partition_list': 'system',
}
vendor_dict = {
'super_partition_groups': 'group_a group_b',
'dynamic_partition_list': 'vendor product',
- 'super_group_a_list': 'vendor',
- 'super_group_a_size': '1000',
- 'super_group_b_list': 'product',
- 'super_group_b_size': '2000',
+ 'super_group_a_partition_list': 'vendor',
+ 'super_group_a_group_size': '1000',
+ 'super_group_b_partition_list': 'product',
+ 'super_group_b_group_size': '2000',
}
merged_dict = common.MergeDynamicPartitionInfoDicts(
framework_dict=framework_dict,
- vendor_dict=vendor_dict,
- size_prefix='super_',
- size_suffix='_size',
- list_prefix='super_',
- list_suffix='_list')
+ vendor_dict=vendor_dict)
expected_merged_dict = {
'super_partition_groups': 'group_a group_b',
'dynamic_partition_list': 'system vendor product',
- 'super_group_a_list': 'system vendor',
- 'super_group_a_size': '1000',
- 'super_group_b_list': 'product',
- 'super_group_b_size': '2000',
+ 'super_group_a_partition_list': 'system vendor',
+ 'super_group_a_group_size': '1000',
+ 'super_group_b_partition_list': 'product',
+ 'super_group_b_group_size': '2000',
}
self.assertEqual(merged_dict, expected_merged_dict)
@@ -1109,31 +1447,27 @@
framework_dict = {
'super_partition_groups': 'group_a',
'dynamic_partition_list': 'system',
- 'super_group_a_list': 'system',
- 'super_group_a_size': '5000',
+ 'super_group_a_partition_list': 'system',
+ 'super_group_a_group_size': '5000',
}
vendor_dict = {
'super_partition_groups': 'group_a group_b',
'dynamic_partition_list': 'vendor product',
- 'super_group_a_list': 'vendor',
- 'super_group_a_size': '1000',
- 'super_group_b_list': 'product',
- 'super_group_b_size': '2000',
+ 'super_group_a_partition_list': 'vendor',
+ 'super_group_a_group_size': '1000',
+ 'super_group_b_partition_list': 'product',
+ 'super_group_b_group_size': '2000',
}
merged_dict = common.MergeDynamicPartitionInfoDicts(
framework_dict=framework_dict,
- vendor_dict=vendor_dict,
- size_prefix='super_',
- size_suffix='_size',
- list_prefix='super_',
- list_suffix='_list')
+ vendor_dict=vendor_dict)
expected_merged_dict = {
'super_partition_groups': 'group_a group_b',
'dynamic_partition_list': 'system vendor product',
- 'super_group_a_list': 'system vendor',
- 'super_group_a_size': '1000',
- 'super_group_b_list': 'product',
- 'super_group_b_size': '2000',
+ 'super_group_a_partition_list': 'system vendor',
+ 'super_group_a_group_size': '1000',
+ 'super_group_b_partition_list': 'product',
+ 'super_group_b_group_size': '2000',
}
self.assertEqual(merged_dict, expected_merged_dict)
@@ -1161,6 +1495,121 @@
self.assertEqual('5', chained_partition_args[1])
self.assertTrue(os.path.exists(chained_partition_args[2]))
+ @test_utils.SkipIfExternalToolsUnavailable()
+ def test_AppendVBMetaArgsForPartition_recoveryAsChainedPartition_nonAb(self):
+ testdata_dir = test_utils.get_testdata_dir()
+ pubkey = os.path.join(testdata_dir, 'testkey.pubkey.pem')
+ info_dict = {
+ 'avb_avbtool': 'avbtool',
+ 'avb_recovery_key_path': pubkey,
+ 'avb_recovery_rollback_index_location': 3,
+ }
+ cmd = common.GetAvbPartitionArg(
+ 'recovery', '/path/to/recovery.img', info_dict)
+ self.assertFalse(cmd)
+
+ @test_utils.SkipIfExternalToolsUnavailable()
+ def test_AppendVBMetaArgsForPartition_recoveryAsChainedPartition_ab(self):
+ testdata_dir = test_utils.get_testdata_dir()
+ pubkey = os.path.join(testdata_dir, 'testkey.pubkey.pem')
+ info_dict = {
+ 'ab_update': 'true',
+ 'avb_avbtool': 'avbtool',
+ 'avb_recovery_key_path': pubkey,
+ 'avb_recovery_rollback_index_location': 3,
+ }
+ cmd = common.GetAvbPartitionArg(
+ 'recovery', '/path/to/recovery.img', info_dict)
+ self.assertEqual(2, len(cmd))
+ self.assertEqual('--chain_partition', cmd[0])
+ chained_partition_args = cmd[1].split(':')
+ self.assertEqual(3, len(chained_partition_args))
+ self.assertEqual('recovery', chained_partition_args[0])
+ self.assertEqual('3', chained_partition_args[1])
+ self.assertTrue(os.path.exists(chained_partition_args[2]))
+
+ def test_BuildVBMeta_appendAftlCommandSyntax(self):
+ testdata_dir = test_utils.get_testdata_dir()
+ common.OPTIONS.info_dict = {
+ 'ab_update': 'true',
+ 'avb_avbtool': 'avbtool',
+ 'build.prop': common.PartitionBuildProps.FromDictionary(
+ 'system', {
+ 'ro.build.version.incremental': '6285659',
+ 'ro.product.device': 'coral',
+ 'ro.build.fingerprint':
+ 'google/coral/coral:R/RP1A.200311.002/'
+ '6285659:userdebug/dev-keys'}
+ ),
+ }
+ common.OPTIONS.aftl_tool_path = 'aftltool'
+ common.OPTIONS.aftl_server = 'log.endpoints.aftl-dev.cloud.goog:9000'
+ common.OPTIONS.aftl_key_path = os.path.join(testdata_dir,
+ 'test_transparency_key.pub')
+ common.OPTIONS.aftl_manufacturer_key_path = os.path.join(
+ testdata_dir, 'test_aftl_rsa4096.pem')
+
+ vbmeta_image = tempfile.NamedTemporaryFile(delete=False)
+ cmd = common.ConstructAftlMakeImageCommands(vbmeta_image.name)
+ expected_cmd = [
+ 'aftltool', 'make_icp_from_vbmeta',
+ '--vbmeta_image_path', 'place_holder',
+ '--output', vbmeta_image.name,
+ '--version_incremental', '6285659',
+ '--transparency_log_servers',
+ 'log.endpoints.aftl-dev.cloud.goog:9000,{}'.format(
+ common.OPTIONS.aftl_key_path),
+ '--manufacturer_key', common.OPTIONS.aftl_manufacturer_key_path,
+ '--algorithm', 'SHA256_RSA4096',
+ '--padding', '4096']
+
+ # ignore the place holder, i.e. path to a temp file
+ self.assertEqual(cmd[:3], expected_cmd[:3])
+ self.assertEqual(cmd[4:], expected_cmd[4:])
+
+ @unittest.skip("enable after we have a server for public")
+ def test_BuildVBMeta_appendAftlContactServer(self):
+ testdata_dir = test_utils.get_testdata_dir()
+ common.OPTIONS.info_dict = {
+ 'ab_update': 'true',
+ 'avb_avbtool': 'avbtool',
+ 'build.prop': common.PartitionBuildProps.FromDictionary(
+ 'system', {
+ 'ro.build.version.incremental': '6285659',
+ 'ro.product.device': 'coral',
+ 'ro.build.fingerprint':
+ 'google/coral/coral:R/RP1A.200311.002/'
+ '6285659:userdebug/dev-keys'}
+ )
+ }
+ common.OPTIONS.aftl_tool_path = "aftltool"
+ common.OPTIONS.aftl_server = "log.endpoints.aftl-dev.cloud.goog:9000"
+ common.OPTIONS.aftl_key_path = os.path.join(testdata_dir,
+ 'test_transparency_key.pub')
+ common.OPTIONS.aftl_manufacturer_key_path = os.path.join(
+ testdata_dir, 'test_aftl_rsa4096.pem')
+
+ input_dir = common.MakeTempDir()
+ system_image = common.MakeTempFile()
+ build_image_cmd = ['mkuserimg_mke2fs', input_dir, system_image, 'ext4',
+ '/system', str(4096 * 100), '-j', '0', '-s']
+ common.RunAndCheckOutput(build_image_cmd)
+
+ add_footer_cmd = ['avbtool', 'add_hashtree_footer',
+ '--partition_size', str(4096 * 150),
+ '--partition_name', 'system',
+ '--image', system_image]
+ common.RunAndCheckOutput(add_footer_cmd)
+
+ vbmeta_image = common.MakeTempFile()
+ common.BuildVBMeta(vbmeta_image, {'system': system_image}, 'vbmeta',
+ ['system'])
+
+ verify_cmd = ['aftltool', 'verify_image_icp', '--vbmeta_image_path',
+ vbmeta_image, '--transparency_log_pub_keys',
+ common.OPTIONS.aftl_key_path]
+ common.RunAndCheckOutput(verify_cmd)
+
class InstallRecoveryScriptFormatTest(test_utils.ReleaseToolsTestCase):
"""Checks the format of install-recovery.sh.
@@ -1224,24 +1673,6 @@
self._info)
-class MockScriptWriter(object):
- """A class that mocks edify_generator.EdifyGenerator."""
-
- def __init__(self, enable_comments=False):
- self.lines = []
- self.enable_comments = enable_comments
-
- def Comment(self, comment):
- if self.enable_comments:
- self.lines.append('# {}'.format(comment))
-
- def AppendExtra(self, extra):
- self.lines.append(extra)
-
- def __str__(self):
- return '\n'.join(self.lines)
-
-
class MockBlockDifference(object):
def __init__(self, partition, tgt, src=None):
@@ -1279,7 +1710,7 @@
if not line.startswith(b'#')]
def setUp(self):
- self.script = MockScriptWriter()
+ self.script = test_utils.MockScriptWriter()
self.output_path = common.MakeTempFile(suffix='.zip')
def test_full(self):
@@ -1464,3 +1895,241 @@
lines = self.get_op_list(self.output_path)
self.assertEqual(lines, ["remove foo"])
+
+
+class PartitionBuildPropsTest(test_utils.ReleaseToolsTestCase):
+ def setUp(self):
+ self.odm_build_prop = [
+ 'ro.odm.build.date.utc=1578430045',
+ 'ro.odm.build.fingerprint='
+ 'google/coral/coral:10/RP1A.200325.001/6337676:user/dev-keys',
+ 'ro.product.odm.device=coral',
+ 'import /odm/etc/build_${ro.boot.product.device_name}.prop',
+ ]
+
+ @staticmethod
+ def _BuildZipFile(entries):
+ input_file = common.MakeTempFile(prefix='target_files-', suffix='.zip')
+ with zipfile.ZipFile(input_file, 'w') as input_zip:
+ for name, content in entries.items():
+ input_zip.writestr(name, content)
+
+ return input_file
+
+ def test_parseBuildProps_noImportStatement(self):
+ build_prop = [
+ 'ro.odm.build.date.utc=1578430045',
+ 'ro.odm.build.fingerprint='
+ 'google/coral/coral:10/RP1A.200325.001/6337676:user/dev-keys',
+ 'ro.product.odm.device=coral',
+ ]
+ input_file = self._BuildZipFile({
+ 'ODM/etc/build.prop': '\n'.join(build_prop),
+ })
+
+ with zipfile.ZipFile(input_file, 'r') as input_zip:
+ placeholder_values = {
+ 'ro.boot.product.device_name': ['std', 'pro']
+ }
+ partition_props = common.PartitionBuildProps.FromInputFile(
+ input_zip, 'odm', placeholder_values)
+
+ self.assertEqual({
+ 'ro.odm.build.date.utc': '1578430045',
+ 'ro.odm.build.fingerprint':
+ 'google/coral/coral:10/RP1A.200325.001/6337676:user/dev-keys',
+ 'ro.product.odm.device': 'coral',
+ }, partition_props.build_props)
+
+ self.assertEqual(set(), partition_props.prop_overrides)
+
+ def test_parseBuildProps_singleImportStatement(self):
+ build_std_prop = [
+ 'ro.product.odm.device=coral',
+ 'ro.product.odm.name=product1',
+ ]
+ build_pro_prop = [
+ 'ro.product.odm.device=coralpro',
+ 'ro.product.odm.name=product2',
+ ]
+
+ input_file = self._BuildZipFile({
+ 'ODM/etc/build.prop': '\n'.join(self.odm_build_prop),
+ 'ODM/etc/build_std.prop': '\n'.join(build_std_prop),
+ 'ODM/etc/build_pro.prop': '\n'.join(build_pro_prop),
+ })
+
+ with zipfile.ZipFile(input_file, 'r') as input_zip:
+ placeholder_values = {
+ 'ro.boot.product.device_name': 'std'
+ }
+ partition_props = common.PartitionBuildProps.FromInputFile(
+ input_zip, 'odm', placeholder_values)
+
+ self.assertEqual({
+ 'ro.odm.build.date.utc': '1578430045',
+ 'ro.odm.build.fingerprint':
+ 'google/coral/coral:10/RP1A.200325.001/6337676:user/dev-keys',
+ 'ro.product.odm.device': 'coral',
+ 'ro.product.odm.name': 'product1',
+ }, partition_props.build_props)
+
+ with zipfile.ZipFile(input_file, 'r') as input_zip:
+ placeholder_values = {
+ 'ro.boot.product.device_name': 'pro'
+ }
+ partition_props = common.PartitionBuildProps.FromInputFile(
+ input_zip, 'odm', placeholder_values)
+
+ self.assertEqual({
+ 'ro.odm.build.date.utc': '1578430045',
+ 'ro.odm.build.fingerprint':
+ 'google/coral/coral:10/RP1A.200325.001/6337676:user/dev-keys',
+ 'ro.product.odm.device': 'coralpro',
+ 'ro.product.odm.name': 'product2',
+ }, partition_props.build_props)
+
+ def test_parseBuildProps_noPlaceHolders(self):
+ build_prop = copy.copy(self.odm_build_prop)
+ input_file = self._BuildZipFile({
+ 'ODM/etc/build.prop': '\n'.join(build_prop),
+ })
+
+ with zipfile.ZipFile(input_file, 'r') as input_zip:
+ partition_props = common.PartitionBuildProps.FromInputFile(
+ input_zip, 'odm')
+
+ self.assertEqual({
+ 'ro.odm.build.date.utc': '1578430045',
+ 'ro.odm.build.fingerprint':
+ 'google/coral/coral:10/RP1A.200325.001/6337676:user/dev-keys',
+ 'ro.product.odm.device': 'coral',
+ }, partition_props.build_props)
+
+ self.assertEqual(set(), partition_props.prop_overrides)
+
+ def test_parseBuildProps_multipleImportStatements(self):
+ build_prop = copy.deepcopy(self.odm_build_prop)
+ build_prop.append(
+ 'import /odm/etc/build_${ro.boot.product.product_name}.prop')
+
+ build_std_prop = [
+ 'ro.product.odm.device=coral',
+ ]
+ build_pro_prop = [
+ 'ro.product.odm.device=coralpro',
+ ]
+
+ product1_prop = [
+ 'ro.product.odm.name=product1',
+ 'ro.product.not_care=not_care',
+ ]
+
+ product2_prop = [
+ 'ro.product.odm.name=product2',
+ 'ro.product.not_care=not_care',
+ ]
+
+ input_file = self._BuildZipFile({
+ 'ODM/etc/build.prop': '\n'.join(build_prop),
+ 'ODM/etc/build_std.prop': '\n'.join(build_std_prop),
+ 'ODM/etc/build_pro.prop': '\n'.join(build_pro_prop),
+ 'ODM/etc/build_product1.prop': '\n'.join(product1_prop),
+ 'ODM/etc/build_product2.prop': '\n'.join(product2_prop),
+ })
+
+ with zipfile.ZipFile(input_file, 'r') as input_zip:
+ placeholder_values = {
+ 'ro.boot.product.device_name': 'std',
+ 'ro.boot.product.product_name': 'product1',
+ 'ro.boot.product.not_care': 'not_care',
+ }
+ partition_props = common.PartitionBuildProps.FromInputFile(
+ input_zip, 'odm', placeholder_values)
+
+ self.assertEqual({
+ 'ro.odm.build.date.utc': '1578430045',
+ 'ro.odm.build.fingerprint':
+ 'google/coral/coral:10/RP1A.200325.001/6337676:user/dev-keys',
+ 'ro.product.odm.device': 'coral',
+ 'ro.product.odm.name': 'product1'
+ }, partition_props.build_props)
+
+ with zipfile.ZipFile(input_file, 'r') as input_zip:
+ placeholder_values = {
+ 'ro.boot.product.device_name': 'pro',
+ 'ro.boot.product.product_name': 'product2',
+ 'ro.boot.product.not_care': 'not_care',
+ }
+ partition_props = common.PartitionBuildProps.FromInputFile(
+ input_zip, 'odm', placeholder_values)
+
+ self.assertEqual({
+ 'ro.odm.build.date.utc': '1578430045',
+ 'ro.odm.build.fingerprint':
+ 'google/coral/coral:10/RP1A.200325.001/6337676:user/dev-keys',
+ 'ro.product.odm.device': 'coralpro',
+ 'ro.product.odm.name': 'product2'
+ }, partition_props.build_props)
+
+ def test_parseBuildProps_defineAfterOverride(self):
+ build_prop = copy.deepcopy(self.odm_build_prop)
+ build_prop.append('ro.product.odm.device=coral')
+
+ build_std_prop = [
+ 'ro.product.odm.device=coral',
+ ]
+ build_pro_prop = [
+ 'ro.product.odm.device=coralpro',
+ ]
+
+ input_file = self._BuildZipFile({
+ 'ODM/etc/build.prop': '\n'.join(build_prop),
+ 'ODM/etc/build_std.prop': '\n'.join(build_std_prop),
+ 'ODM/etc/build_pro.prop': '\n'.join(build_pro_prop),
+ })
+
+ with zipfile.ZipFile(input_file, 'r') as input_zip:
+ placeholder_values = {
+ 'ro.boot.product.device_name': 'std',
+ }
+
+ self.assertRaises(ValueError, common.PartitionBuildProps.FromInputFile,
+ input_zip, 'odm', placeholder_values)
+
+ def test_parseBuildProps_duplicateOverride(self):
+ build_prop = copy.deepcopy(self.odm_build_prop)
+ build_prop.append(
+ 'import /odm/etc/build_${ro.boot.product.product_name}.prop')
+
+ build_std_prop = [
+ 'ro.product.odm.device=coral',
+ 'ro.product.odm.name=product1',
+ ]
+ build_pro_prop = [
+ 'ro.product.odm.device=coralpro',
+ ]
+
+ product1_prop = [
+ 'ro.product.odm.name=product1',
+ ]
+
+ product2_prop = [
+ 'ro.product.odm.name=product2',
+ ]
+
+ input_file = self._BuildZipFile({
+ 'ODM/etc/build.prop': '\n'.join(build_prop),
+ 'ODM/etc/build_std.prop': '\n'.join(build_std_prop),
+ 'ODM/etc/build_pro.prop': '\n'.join(build_pro_prop),
+ 'ODM/etc/build_product1.prop': '\n'.join(product1_prop),
+ 'ODM/etc/build_product2.prop': '\n'.join(product2_prop),
+ })
+
+ with zipfile.ZipFile(input_file, 'r') as input_zip:
+ placeholder_values = {
+ 'ro.boot.product.device_name': 'std',
+ 'ro.boot.product.product_name': 'product1',
+ }
+ self.assertRaises(ValueError, common.PartitionBuildProps.FromInputFile,
+ input_zip, 'odm', placeholder_values)
diff --git a/tools/releasetools/test_merge_target_files.py b/tools/releasetools/test_merge_target_files.py
index 1abe83c..ff8593b 100644
--- a/tools/releasetools/test_merge_target_files.py
+++ b/tools/releasetools/test_merge_target_files.py
@@ -22,6 +22,7 @@
DEFAULT_FRAMEWORK_ITEM_LIST,
DEFAULT_VENDOR_ITEM_LIST,
DEFAULT_FRAMEWORK_MISC_INFO_KEYS, copy_items,
+ item_list_to_partition_set,
process_apex_keys_apk_certs_common)
@@ -142,6 +143,8 @@
os.path.join(vendor_dir, 'META', 'apexkeys.txt'))
process_apex_keys_apk_certs_common(framework_dir, vendor_dir, output_dir,
+ set(['product', 'system', 'system_ext']),
+ set(['odm', 'vendor']),
'apexkeys.txt')
merged_entries = []
@@ -175,4 +178,54 @@
os.path.join(conflict_dir, 'META', 'apexkeys.txt'))
self.assertRaises(ValueError, process_apex_keys_apk_certs_common,
- framework_dir, conflict_dir, output_dir, 'apexkeys.txt')
+ framework_dir, conflict_dir, output_dir,
+ set(['product', 'system', 'system_ext']),
+ set(['odm', 'vendor']),
+ 'apexkeys.txt')
+
+ def test_process_apex_keys_apk_certs_HandlesApkCertsSyntax(self):
+ output_dir = common.MakeTempDir()
+ os.makedirs(os.path.join(output_dir, 'META'))
+
+ framework_dir = common.MakeTempDir()
+ os.makedirs(os.path.join(framework_dir, 'META'))
+ os.symlink(
+ os.path.join(self.testdata_dir, 'apkcerts_framework.txt'),
+ os.path.join(framework_dir, 'META', 'apkcerts.txt'))
+
+ vendor_dir = common.MakeTempDir()
+ os.makedirs(os.path.join(vendor_dir, 'META'))
+ os.symlink(
+ os.path.join(self.testdata_dir, 'apkcerts_vendor.txt'),
+ os.path.join(vendor_dir, 'META', 'apkcerts.txt'))
+
+ process_apex_keys_apk_certs_common(framework_dir, vendor_dir, output_dir,
+ set(['product', 'system', 'system_ext']),
+ set(['odm', 'vendor']),
+ 'apkcerts.txt')
+
+ merged_entries = []
+ merged_path = os.path.join(self.testdata_dir, 'apkcerts_merge.txt')
+
+ with open(merged_path) as f:
+ merged_entries = f.read().split('\n')
+
+ output_entries = []
+ output_path = os.path.join(output_dir, 'META', 'apkcerts.txt')
+
+ with open(output_path) as f:
+ output_entries = f.read().split('\n')
+
+ return self.assertEqual(merged_entries, output_entries)
+
+ def test_item_list_to_partition_set(self):
+ item_list = [
+ 'META/apexkeys.txt',
+ 'META/apkcerts.txt',
+ 'META/filesystem_config.txt',
+ 'PRODUCT/*',
+ 'SYSTEM/*',
+ 'SYSTEM_EXT/*',
+ ]
+ partition_set = item_list_to_partition_set(item_list)
+ self.assertEqual(set(['product', 'system', 'system_ext']), partition_set)
diff --git a/tools/releasetools/test_ota_from_target_files.py b/tools/releasetools/test_ota_from_target_files.py
index 9825a5e..7783f96 100644
--- a/tools/releasetools/test_ota_from_target_files.py
+++ b/tools/releasetools/test_ota_from_target_files.py
@@ -22,11 +22,12 @@
import common
import test_utils
from ota_from_target_files import (
- _LoadOemDicts, AbOtaPropertyFiles, BuildInfo, FinalizeMetadata,
+ _LoadOemDicts, AbOtaPropertyFiles, FinalizeMetadata,
GetPackageMetadata, GetTargetFilesZipForSecondaryImages,
GetTargetFilesZipWithoutPostinstallConfig, NonAbOtaPropertyFiles,
Payload, PayloadSigner, POSTINSTALL_CONFIG, PropertyFiles,
- StreamingPropertyFiles, WriteFingerprintAssertion)
+ StreamingPropertyFiles, WriteFingerprintAssertion,
+ CalculateRuntimeDevicesAndFingerprints)
def construct_target_files(secondary=False):
@@ -74,291 +75,6 @@
return target_files
-class MockScriptWriter(object):
- """A class that mocks edify_generator.EdifyGenerator.
-
- It simply pushes the incoming arguments onto script stack, which is to assert
- the calls to EdifyGenerator functions.
- """
-
- def __init__(self):
- self.script = []
-
- def Mount(self, *args):
- self.script.append(('Mount',) + args)
-
- def AssertDevice(self, *args):
- self.script.append(('AssertDevice',) + args)
-
- def AssertOemProperty(self, *args):
- self.script.append(('AssertOemProperty',) + args)
-
- def AssertFingerprintOrThumbprint(self, *args):
- self.script.append(('AssertFingerprintOrThumbprint',) + args)
-
- def AssertSomeFingerprint(self, *args):
- self.script.append(('AssertSomeFingerprint',) + args)
-
- def AssertSomeThumbprint(self, *args):
- self.script.append(('AssertSomeThumbprint',) + args)
-
-
-class BuildInfoTest(test_utils.ReleaseToolsTestCase):
-
- TEST_INFO_DICT = {
- 'build.prop' : {
- 'ro.product.device' : 'product-device',
- 'ro.product.name' : 'product-name',
- 'ro.build.fingerprint' : 'build-fingerprint',
- 'ro.build.foo' : 'build-foo',
- },
- 'vendor.build.prop' : {
- 'ro.vendor.build.fingerprint' : 'vendor-build-fingerprint',
- },
- 'property1' : 'value1',
- 'property2' : 4096,
- }
-
- TEST_INFO_DICT_USES_OEM_PROPS = {
- 'build.prop' : {
- 'ro.product.name' : 'product-name',
- 'ro.build.thumbprint' : 'build-thumbprint',
- 'ro.build.bar' : 'build-bar',
- },
- 'vendor.build.prop' : {
- 'ro.vendor.build.fingerprint' : 'vendor-build-fingerprint',
- },
- 'property1' : 'value1',
- 'property2' : 4096,
- 'oem_fingerprint_properties' : 'ro.product.device ro.product.brand',
- }
-
- TEST_OEM_DICTS = [
- {
- 'ro.product.brand' : 'brand1',
- 'ro.product.device' : 'device1',
- },
- {
- 'ro.product.brand' : 'brand2',
- 'ro.product.device' : 'device2',
- },
- {
- 'ro.product.brand' : 'brand3',
- 'ro.product.device' : 'device3',
- },
- ]
-
- def test_init(self):
- target_info = BuildInfo(self.TEST_INFO_DICT, None)
- self.assertEqual('product-device', target_info.device)
- self.assertEqual('build-fingerprint', target_info.fingerprint)
- self.assertFalse(target_info.is_ab)
- self.assertIsNone(target_info.oem_props)
-
- def test_init_with_oem_props(self):
- target_info = BuildInfo(self.TEST_INFO_DICT_USES_OEM_PROPS,
- self.TEST_OEM_DICTS)
- self.assertEqual('device1', target_info.device)
- self.assertEqual('brand1/product-name/device1:build-thumbprint',
- target_info.fingerprint)
-
- # Swap the order in oem_dicts, which would lead to different BuildInfo.
- oem_dicts = copy.copy(self.TEST_OEM_DICTS)
- oem_dicts[0], oem_dicts[2] = oem_dicts[2], oem_dicts[0]
- target_info = BuildInfo(self.TEST_INFO_DICT_USES_OEM_PROPS, oem_dicts)
- self.assertEqual('device3', target_info.device)
- self.assertEqual('brand3/product-name/device3:build-thumbprint',
- target_info.fingerprint)
-
- # Missing oem_dict should be rejected.
- self.assertRaises(AssertionError, BuildInfo,
- self.TEST_INFO_DICT_USES_OEM_PROPS, None)
-
- def test_init_badFingerprint(self):
- info_dict = copy.deepcopy(self.TEST_INFO_DICT)
- info_dict['build.prop']['ro.build.fingerprint'] = 'bad fingerprint'
- self.assertRaises(ValueError, BuildInfo, info_dict, None)
-
- info_dict['build.prop']['ro.build.fingerprint'] = 'bad\x80fingerprint'
- self.assertRaises(ValueError, BuildInfo, info_dict, None)
-
- def test___getitem__(self):
- target_info = BuildInfo(self.TEST_INFO_DICT, None)
- self.assertEqual('value1', target_info['property1'])
- self.assertEqual(4096, target_info['property2'])
- self.assertEqual('build-foo', target_info['build.prop']['ro.build.foo'])
-
- def test___getitem__with_oem_props(self):
- target_info = BuildInfo(self.TEST_INFO_DICT_USES_OEM_PROPS,
- self.TEST_OEM_DICTS)
- self.assertEqual('value1', target_info['property1'])
- self.assertEqual(4096, target_info['property2'])
- self.assertRaises(KeyError,
- lambda: target_info['build.prop']['ro.build.foo'])
-
- def test___setitem__(self):
- target_info = BuildInfo(copy.deepcopy(self.TEST_INFO_DICT), None)
- self.assertEqual('value1', target_info['property1'])
- target_info['property1'] = 'value2'
- self.assertEqual('value2', target_info['property1'])
-
- self.assertEqual('build-foo', target_info['build.prop']['ro.build.foo'])
- target_info['build.prop']['ro.build.foo'] = 'build-bar'
- self.assertEqual('build-bar', target_info['build.prop']['ro.build.foo'])
-
- def test_get(self):
- target_info = BuildInfo(self.TEST_INFO_DICT, None)
- self.assertEqual('value1', target_info.get('property1'))
- self.assertEqual(4096, target_info.get('property2'))
- self.assertEqual(4096, target_info.get('property2', 1024))
- self.assertEqual(1024, target_info.get('property-nonexistent', 1024))
- self.assertEqual('build-foo', target_info.get('build.prop')['ro.build.foo'])
-
- def test_get_with_oem_props(self):
- target_info = BuildInfo(self.TEST_INFO_DICT_USES_OEM_PROPS,
- self.TEST_OEM_DICTS)
- self.assertEqual('value1', target_info.get('property1'))
- self.assertEqual(4096, target_info.get('property2'))
- self.assertEqual(4096, target_info.get('property2', 1024))
- self.assertEqual(1024, target_info.get('property-nonexistent', 1024))
- self.assertIsNone(target_info.get('build.prop').get('ro.build.foo'))
- self.assertRaises(KeyError,
- lambda: target_info.get('build.prop')['ro.build.foo'])
-
- def test_items(self):
- target_info = BuildInfo(self.TEST_INFO_DICT, None)
- items = target_info.items()
- self.assertIn(('property1', 'value1'), items)
- self.assertIn(('property2', 4096), items)
-
- def test_GetBuildProp(self):
- target_info = BuildInfo(self.TEST_INFO_DICT, None)
- self.assertEqual('build-foo', target_info.GetBuildProp('ro.build.foo'))
- self.assertRaises(common.ExternalError, target_info.GetBuildProp,
- 'ro.build.nonexistent')
-
- def test_GetBuildProp_with_oem_props(self):
- target_info = BuildInfo(self.TEST_INFO_DICT_USES_OEM_PROPS,
- self.TEST_OEM_DICTS)
- self.assertEqual('build-bar', target_info.GetBuildProp('ro.build.bar'))
- self.assertRaises(common.ExternalError, target_info.GetBuildProp,
- 'ro.build.nonexistent')
-
- def test_GetVendorBuildProp(self):
- target_info = BuildInfo(self.TEST_INFO_DICT, None)
- self.assertEqual('vendor-build-fingerprint',
- target_info.GetVendorBuildProp(
- 'ro.vendor.build.fingerprint'))
- self.assertRaises(common.ExternalError, target_info.GetVendorBuildProp,
- 'ro.build.nonexistent')
-
- def test_GetVendorBuildProp_with_oem_props(self):
- target_info = BuildInfo(self.TEST_INFO_DICT_USES_OEM_PROPS,
- self.TEST_OEM_DICTS)
- self.assertEqual('vendor-build-fingerprint',
- target_info.GetVendorBuildProp(
- 'ro.vendor.build.fingerprint'))
- self.assertRaises(common.ExternalError, target_info.GetVendorBuildProp,
- 'ro.build.nonexistent')
-
- def test_vendor_fingerprint(self):
- target_info = BuildInfo(self.TEST_INFO_DICT, None)
- self.assertEqual('vendor-build-fingerprint',
- target_info.vendor_fingerprint)
-
- def test_vendor_fingerprint_blacklisted(self):
- target_info_dict = copy.deepcopy(self.TEST_INFO_DICT_USES_OEM_PROPS)
- del target_info_dict['vendor.build.prop']['ro.vendor.build.fingerprint']
- target_info = BuildInfo(target_info_dict, self.TEST_OEM_DICTS)
- self.assertIsNone(target_info.vendor_fingerprint)
-
- def test_vendor_fingerprint_without_vendor_build_prop(self):
- target_info_dict = copy.deepcopy(self.TEST_INFO_DICT_USES_OEM_PROPS)
- del target_info_dict['vendor.build.prop']
- target_info = BuildInfo(target_info_dict, self.TEST_OEM_DICTS)
- self.assertIsNone(target_info.vendor_fingerprint)
-
- def test_WriteMountOemScript(self):
- target_info = BuildInfo(self.TEST_INFO_DICT_USES_OEM_PROPS,
- self.TEST_OEM_DICTS)
- script_writer = MockScriptWriter()
- target_info.WriteMountOemScript(script_writer)
- self.assertEqual([('Mount', '/oem', None)], script_writer.script)
-
- def test_WriteDeviceAssertions(self):
- target_info = BuildInfo(self.TEST_INFO_DICT, None)
- script_writer = MockScriptWriter()
- target_info.WriteDeviceAssertions(script_writer, False)
- self.assertEqual([('AssertDevice', 'product-device')], script_writer.script)
-
- def test_WriteDeviceAssertions_with_oem_props(self):
- target_info = BuildInfo(self.TEST_INFO_DICT_USES_OEM_PROPS,
- self.TEST_OEM_DICTS)
- script_writer = MockScriptWriter()
- target_info.WriteDeviceAssertions(script_writer, False)
- self.assertEqual(
- [
- ('AssertOemProperty', 'ro.product.device',
- ['device1', 'device2', 'device3'], False),
- ('AssertOemProperty', 'ro.product.brand',
- ['brand1', 'brand2', 'brand3'], False),
- ],
- script_writer.script)
-
- def test_WriteFingerprintAssertion_without_oem_props(self):
- target_info = BuildInfo(self.TEST_INFO_DICT, None)
- source_info_dict = copy.deepcopy(self.TEST_INFO_DICT)
- source_info_dict['build.prop']['ro.build.fingerprint'] = (
- 'source-build-fingerprint')
- source_info = BuildInfo(source_info_dict, None)
-
- script_writer = MockScriptWriter()
- WriteFingerprintAssertion(script_writer, target_info, source_info)
- self.assertEqual(
- [('AssertSomeFingerprint', 'source-build-fingerprint',
- 'build-fingerprint')],
- script_writer.script)
-
- def test_WriteFingerprintAssertion_with_source_oem_props(self):
- target_info = BuildInfo(self.TEST_INFO_DICT, None)
- source_info = BuildInfo(self.TEST_INFO_DICT_USES_OEM_PROPS,
- self.TEST_OEM_DICTS)
-
- script_writer = MockScriptWriter()
- WriteFingerprintAssertion(script_writer, target_info, source_info)
- self.assertEqual(
- [('AssertFingerprintOrThumbprint', 'build-fingerprint',
- 'build-thumbprint')],
- script_writer.script)
-
- def test_WriteFingerprintAssertion_with_target_oem_props(self):
- target_info = BuildInfo(self.TEST_INFO_DICT_USES_OEM_PROPS,
- self.TEST_OEM_DICTS)
- source_info = BuildInfo(self.TEST_INFO_DICT, None)
-
- script_writer = MockScriptWriter()
- WriteFingerprintAssertion(script_writer, target_info, source_info)
- self.assertEqual(
- [('AssertFingerprintOrThumbprint', 'build-fingerprint',
- 'build-thumbprint')],
- script_writer.script)
-
- def test_WriteFingerprintAssertion_with_both_oem_props(self):
- target_info = BuildInfo(self.TEST_INFO_DICT_USES_OEM_PROPS,
- self.TEST_OEM_DICTS)
- source_info_dict = copy.deepcopy(self.TEST_INFO_DICT_USES_OEM_PROPS)
- source_info_dict['build.prop']['ro.build.thumbprint'] = (
- 'source-build-thumbprint')
- source_info = BuildInfo(source_info_dict, self.TEST_OEM_DICTS)
-
- script_writer = MockScriptWriter()
- WriteFingerprintAssertion(script_writer, target_info, source_info)
- self.assertEqual(
- [('AssertSomeThumbprint', 'build-thumbprint',
- 'source-build-thumbprint')],
- script_writer.script)
-
-
class LoadOemDictsTest(test_utils.ReleaseToolsTestCase):
def test_NoneDict(self):
@@ -393,29 +109,61 @@
class OtaFromTargetFilesTest(test_utils.ReleaseToolsTestCase):
-
TEST_TARGET_INFO_DICT = {
- 'build.prop' : {
- 'ro.product.device' : 'product-device',
- 'ro.build.fingerprint' : 'build-fingerprint-target',
- 'ro.build.version.incremental' : 'build-version-incremental-target',
- 'ro.build.version.sdk' : '27',
- 'ro.build.version.security_patch' : '2017-12-01',
- 'ro.build.date.utc' : '1500000000',
- },
+ 'build.prop': common.PartitionBuildProps.FromDictionary(
+ 'system', {
+ 'ro.product.device': 'product-device',
+ 'ro.build.fingerprint': 'build-fingerprint-target',
+ 'ro.build.version.incremental': 'build-version-incremental-target',
+ 'ro.build.version.sdk': '27',
+ 'ro.build.version.security_patch': '2017-12-01',
+ 'ro.build.date.utc': '1500000000'}
+ )
}
TEST_SOURCE_INFO_DICT = {
- 'build.prop' : {
- 'ro.product.device' : 'product-device',
- 'ro.build.fingerprint' : 'build-fingerprint-source',
- 'ro.build.version.incremental' : 'build-version-incremental-source',
- 'ro.build.version.sdk' : '25',
- 'ro.build.version.security_patch' : '2016-12-01',
- 'ro.build.date.utc' : '1400000000',
- },
+ 'build.prop': common.PartitionBuildProps.FromDictionary(
+ 'system', {
+ 'ro.product.device': 'product-device',
+ 'ro.build.fingerprint': 'build-fingerprint-source',
+ 'ro.build.version.incremental': 'build-version-incremental-source',
+ 'ro.build.version.sdk': '25',
+ 'ro.build.version.security_patch': '2016-12-01',
+ 'ro.build.date.utc': '1400000000'}
+ )
}
+ TEST_INFO_DICT_USES_OEM_PROPS = {
+ 'build.prop': common.PartitionBuildProps.FromDictionary(
+ 'system', {
+ 'ro.product.name': 'product-name',
+ 'ro.build.thumbprint': 'build-thumbprint',
+ 'ro.build.bar': 'build-bar'}
+ ),
+ 'vendor.build.prop': common.PartitionBuildProps.FromDictionary(
+ 'vendor', {
+ 'ro.vendor.build.fingerprint': 'vendor-build-fingerprint'}
+ ),
+ 'property1': 'value1',
+ 'property2': 4096,
+ 'oem_fingerprint_properties': 'ro.product.device ro.product.brand',
+ }
+
+ TEST_OEM_DICTS = [
+ {
+ 'ro.product.brand': 'brand1',
+ 'ro.product.device': 'device1',
+ },
+ {
+ 'ro.product.brand': 'brand2',
+ 'ro.product.device': 'device2',
+ },
+ {
+ 'ro.product.brand': 'brand3',
+ 'ro.product.device': 'device3',
+ },
+ ]
+
def setUp(self):
self.testdata_dir = test_utils.get_testdata_dir()
self.assertTrue(os.path.exists(self.testdata_dir))
@@ -437,7 +185,7 @@
def test_GetPackageMetadata_abOta_full(self):
target_info_dict = copy.deepcopy(self.TEST_TARGET_INFO_DICT)
target_info_dict['ab_update'] = 'true'
- target_info = BuildInfo(target_info_dict, None)
+ target_info = common.BuildInfo(target_info_dict, None)
metadata = GetPackageMetadata(target_info)
self.assertDictEqual(
{
@@ -455,8 +203,8 @@
def test_GetPackageMetadata_abOta_incremental(self):
target_info_dict = copy.deepcopy(self.TEST_TARGET_INFO_DICT)
target_info_dict['ab_update'] = 'true'
- target_info = BuildInfo(target_info_dict, None)
- source_info = BuildInfo(self.TEST_SOURCE_INFO_DICT, None)
+ target_info = common.BuildInfo(target_info_dict, None)
+ source_info = common.BuildInfo(self.TEST_SOURCE_INFO_DICT, None)
common.OPTIONS.incremental_source = ''
metadata = GetPackageMetadata(target_info, source_info)
self.assertDictEqual(
@@ -475,7 +223,7 @@
metadata)
def test_GetPackageMetadata_nonAbOta_full(self):
- target_info = BuildInfo(self.TEST_TARGET_INFO_DICT, None)
+ target_info = common.BuildInfo(self.TEST_TARGET_INFO_DICT, None)
metadata = GetPackageMetadata(target_info)
self.assertDictEqual(
{
@@ -490,8 +238,8 @@
metadata)
def test_GetPackageMetadata_nonAbOta_incremental(self):
- target_info = BuildInfo(self.TEST_TARGET_INFO_DICT, None)
- source_info = BuildInfo(self.TEST_SOURCE_INFO_DICT, None)
+ target_info = common.BuildInfo(self.TEST_TARGET_INFO_DICT, None)
+ source_info = common.BuildInfo(self.TEST_SOURCE_INFO_DICT, None)
common.OPTIONS.incremental_source = ''
metadata = GetPackageMetadata(target_info, source_info)
self.assertDictEqual(
@@ -509,7 +257,7 @@
metadata)
def test_GetPackageMetadata_wipe(self):
- target_info = BuildInfo(self.TEST_TARGET_INFO_DICT, None)
+ target_info = common.BuildInfo(self.TEST_TARGET_INFO_DICT, None)
common.OPTIONS.wipe_user_data = True
metadata = GetPackageMetadata(target_info)
self.assertDictEqual(
@@ -526,7 +274,7 @@
metadata)
def test_GetPackageMetadata_retrofitDynamicPartitions(self):
- target_info = BuildInfo(self.TEST_TARGET_INFO_DICT, None)
+ target_info = common.BuildInfo(self.TEST_TARGET_INFO_DICT, None)
common.OPTIONS.retrofit_dynamic_partitions = True
metadata = GetPackageMetadata(target_info)
self.assertDictEqual(
@@ -544,10 +292,10 @@
@staticmethod
def _test_GetPackageMetadata_swapBuildTimestamps(target_info, source_info):
- (target_info['build.prop']['ro.build.date.utc'],
- source_info['build.prop']['ro.build.date.utc']) = (
- source_info['build.prop']['ro.build.date.utc'],
- target_info['build.prop']['ro.build.date.utc'])
+ (target_info['build.prop'].build_props['ro.build.date.utc'],
+ source_info['build.prop'].build_props['ro.build.date.utc']) = (
+ source_info['build.prop'].build_props['ro.build.date.utc'],
+ target_info['build.prop'].build_props['ro.build.date.utc'])
def test_GetPackageMetadata_unintentionalDowngradeDetected(self):
target_info_dict = copy.deepcopy(self.TEST_TARGET_INFO_DICT)
@@ -555,8 +303,8 @@
self._test_GetPackageMetadata_swapBuildTimestamps(
target_info_dict, source_info_dict)
- target_info = BuildInfo(target_info_dict, None)
- source_info = BuildInfo(source_info_dict, None)
+ target_info = common.BuildInfo(target_info_dict, None)
+ source_info = common.BuildInfo(source_info_dict, None)
common.OPTIONS.incremental_source = ''
self.assertRaises(RuntimeError, GetPackageMetadata, target_info,
source_info)
@@ -567,8 +315,8 @@
self._test_GetPackageMetadata_swapBuildTimestamps(
target_info_dict, source_info_dict)
- target_info = BuildInfo(target_info_dict, None)
- source_info = BuildInfo(source_info_dict, None)
+ target_info = common.BuildInfo(target_info_dict, None)
+ source_info = common.BuildInfo(source_info_dict, None)
common.OPTIONS.incremental_source = ''
common.OPTIONS.downgrade = True
common.OPTIONS.wipe_user_data = True
@@ -596,7 +344,7 @@
with zipfile.ZipFile(target_file) as verify_zip:
namelist = verify_zip.namelist()
- ab_partitions = verify_zip.read('META/ab_partitions.txt')
+ ab_partitions = verify_zip.read('META/ab_partitions.txt').decode()
self.assertIn('META/ab_partitions.txt', namelist)
self.assertIn('IMAGES/system.img', namelist)
@@ -676,9 +424,9 @@
with zipfile.ZipFile(target_file) as verify_zip:
namelist = verify_zip.namelist()
- updated_misc_info = verify_zip.read('META/misc_info.txt')
+ updated_misc_info = verify_zip.read('META/misc_info.txt').decode()
updated_dynamic_partitions_info = verify_zip.read(
- 'META/dynamic_partitions_info.txt')
+ 'META/dynamic_partitions_info.txt').decode()
self.assertIn('META/ab_partitions.txt', namelist)
self.assertIn('IMAGES/system.img', namelist)
@@ -781,6 +529,59 @@
FinalizeMetadata(metadata, zip_file, output_file, needed_property_files)
self.assertIn('ota-test-property-files', metadata)
+ def test_WriteFingerprintAssertion_without_oem_props(self):
+ target_info = common.BuildInfo(self.TEST_TARGET_INFO_DICT, None)
+ source_info_dict = copy.deepcopy(self.TEST_TARGET_INFO_DICT)
+ source_info_dict['build.prop'].build_props['ro.build.fingerprint'] = (
+ 'source-build-fingerprint')
+ source_info = common.BuildInfo(source_info_dict, None)
+
+ script_writer = test_utils.MockScriptWriter()
+ WriteFingerprintAssertion(script_writer, target_info, source_info)
+ self.assertEqual(
+ [('AssertSomeFingerprint', 'source-build-fingerprint',
+ 'build-fingerprint-target')],
+ script_writer.lines)
+
+ def test_WriteFingerprintAssertion_with_source_oem_props(self):
+ target_info = common.BuildInfo(self.TEST_TARGET_INFO_DICT, None)
+ source_info = common.BuildInfo(self.TEST_INFO_DICT_USES_OEM_PROPS,
+ self.TEST_OEM_DICTS)
+
+ script_writer = test_utils.MockScriptWriter()
+ WriteFingerprintAssertion(script_writer, target_info, source_info)
+ self.assertEqual(
+ [('AssertFingerprintOrThumbprint', 'build-fingerprint-target',
+ 'build-thumbprint')],
+ script_writer.lines)
+
+ def test_WriteFingerprintAssertion_with_target_oem_props(self):
+ target_info = common.BuildInfo(self.TEST_INFO_DICT_USES_OEM_PROPS,
+ self.TEST_OEM_DICTS)
+ source_info = common.BuildInfo(self.TEST_TARGET_INFO_DICT, None)
+
+ script_writer = test_utils.MockScriptWriter()
+ WriteFingerprintAssertion(script_writer, target_info, source_info)
+ self.assertEqual(
+ [('AssertFingerprintOrThumbprint', 'build-fingerprint-target',
+ 'build-thumbprint')],
+ script_writer.lines)
+
+ def test_WriteFingerprintAssertion_with_both_oem_props(self):
+ target_info = common.BuildInfo(self.TEST_INFO_DICT_USES_OEM_PROPS,
+ self.TEST_OEM_DICTS)
+ source_info_dict = copy.deepcopy(self.TEST_INFO_DICT_USES_OEM_PROPS)
+ source_info_dict['build.prop'].build_props['ro.build.thumbprint'] = (
+ 'source-build-thumbprint')
+ source_info = common.BuildInfo(source_info_dict, self.TEST_OEM_DICTS)
+
+ script_writer = test_utils.MockScriptWriter()
+ WriteFingerprintAssertion(script_writer, target_info, source_info)
+ self.assertEqual(
+ [('AssertSomeThumbprint', 'build-thumbprint',
+ 'source-build-thumbprint')],
+ script_writer.lines)
+
class TestPropertyFiles(PropertyFiles):
"""A class that extends PropertyFiles for testing purpose."""
@@ -1088,10 +889,28 @@
payload_offset, metadata_total = (
property_files._GetPayloadMetadataOffsetAndSize(input_zip))
- # Read in the metadata signature directly.
+ # The signature proto has the following format (details in
+ # /platform/system/update_engine/update_metadata.proto):
+ # message Signature {
+ # optional uint32 version = 1;
+ # optional bytes data = 2;
+ # optional fixed32 unpadded_signature_size = 3;
+ # }
+ #
+ # According to the protobuf encoding, the tail of the signature message will
+ # be [signature string(256 bytes) + encoding of the fixed32 number 256]. And
+ # 256 is encoded as 'x1d\x00\x01\x00\x00':
+ # [3 (field number) << 3 | 5 (type) + byte reverse of 0x100 (256)].
+ # Details in (https://developers.google.com/protocol-buffers/docs/encoding)
+ signature_tail_length = self.SIGNATURE_SIZE + 5
+ self.assertGreater(metadata_total, signature_tail_length)
with open(output_file, 'rb') as verify_fp:
- verify_fp.seek(payload_offset + metadata_total - self.SIGNATURE_SIZE)
- metadata_signature = verify_fp.read(self.SIGNATURE_SIZE)
+ verify_fp.seek(payload_offset + metadata_total - signature_tail_length)
+ metadata_signature_proto_tail = verify_fp.read(signature_tail_length)
+
+ self.assertEqual(b'\x1d\x00\x01\x00\x00',
+ metadata_signature_proto_tail[-5:])
+ metadata_signature = metadata_signature_proto_tail[:-5]
# Now we extract the metadata hash via brillo_update_payload script, which
# will serve as the oracle result.
@@ -1253,11 +1072,13 @@
with open(file1, 'rb') as fp1, open(file2, 'rb') as fp2:
self.assertEqual(fp1.read(), fp2.read())
+ @test_utils.SkipIfExternalToolsUnavailable()
def test_init(self):
payload_signer = PayloadSigner()
self.assertEqual('openssl', payload_signer.signer)
- self.assertEqual(256, payload_signer.key_size)
+ self.assertEqual(256, payload_signer.maximum_signature_size)
+ @test_utils.SkipIfExternalToolsUnavailable()
def test_init_withPassword(self):
common.OPTIONS.package_key = os.path.join(
self.testdata_dir, 'testkey_with_passwd')
@@ -1270,18 +1091,27 @@
def test_init_withExternalSigner(self):
common.OPTIONS.payload_signer = 'abc'
common.OPTIONS.payload_signer_args = ['arg1', 'arg2']
- common.OPTIONS.payload_signer_key_size = '512'
+ common.OPTIONS.payload_signer_maximum_signature_size = '512'
payload_signer = PayloadSigner()
self.assertEqual('abc', payload_signer.signer)
self.assertEqual(['arg1', 'arg2'], payload_signer.signer_args)
- self.assertEqual(512, payload_signer.key_size)
+ self.assertEqual(512, payload_signer.maximum_signature_size)
- def test_GetKeySizeInBytes_512Bytes(self):
+ @test_utils.SkipIfExternalToolsUnavailable()
+ def test_GetMaximumSignatureSizeInBytes_512Bytes(self):
signing_key = os.path.join(self.testdata_dir, 'testkey_RSA4096.key')
# pylint: disable=protected-access
- key_size = PayloadSigner._GetKeySizeInBytes(signing_key)
- self.assertEqual(512, key_size)
+ signature_size = PayloadSigner._GetMaximumSignatureSizeInBytes(signing_key)
+ self.assertEqual(512, signature_size)
+ @test_utils.SkipIfExternalToolsUnavailable()
+ def test_GetMaximumSignatureSizeInBytes_ECKey(self):
+ signing_key = os.path.join(self.testdata_dir, 'testkey_EC.key')
+ # pylint: disable=protected-access
+ signature_size = PayloadSigner._GetMaximumSignatureSizeInBytes(signing_key)
+ self.assertEqual(72, signature_size)
+
+ @test_utils.SkipIfExternalToolsUnavailable()
def test_Sign(self):
payload_signer = PayloadSigner()
input_file = os.path.join(self.testdata_dir, self.SIGFILE)
@@ -1489,3 +1319,239 @@
Payload.SECONDARY_PAYLOAD_PROPERTIES_TXT):
continue
self.assertEqual(zipfile.ZIP_STORED, entry_info.compress_type)
+
+
+class RuntimeFingerprintTest(test_utils.ReleaseToolsTestCase):
+ MISC_INFO = [
+ 'recovery_api_version=3',
+ 'fstab_version=2',
+ 'recovery_as_boot=true',
+ ]
+
+ BUILD_PROP = [
+ 'ro.build.version.release=version-release',
+ 'ro.build.id=build-id',
+ 'ro.build.version.incremental=version-incremental',
+ 'ro.build.type=build-type',
+ 'ro.build.tags=build-tags',
+ 'ro.build.version.sdk=30',
+ 'ro.build.version.security_patch=2020',
+ 'ro.build.date.utc=12345678'
+ ]
+
+ VENDOR_BUILD_PROP = [
+ 'ro.product.vendor.brand=vendor-product-brand',
+ 'ro.product.vendor.name=vendor-product-name',
+ 'ro.product.vendor.device=vendor-product-device'
+ ]
+
+ def setUp(self):
+ common.OPTIONS.oem_dicts = None
+ self.test_dir = common.MakeTempDir()
+ self.writeFiles({'META/misc_info.txt': '\n'.join(self.MISC_INFO)},
+ self.test_dir)
+
+ def writeFiles(self, contents_dict, out_dir):
+ for path, content in contents_dict.items():
+ abs_path = os.path.join(out_dir, path)
+ dir_name = os.path.dirname(abs_path)
+ if not os.path.exists(dir_name):
+ os.makedirs(dir_name)
+ with open(abs_path, 'w') as f:
+ f.write(content)
+
+ @staticmethod
+ def constructFingerprint(prefix):
+ return '{}:version-release/build-id/version-incremental:' \
+ 'build-type/build-tags'.format(prefix)
+
+ def test_CalculatePossibleFingerprints_no_dynamic_fingerprint(self):
+ build_prop = copy.deepcopy(self.BUILD_PROP)
+ build_prop.extend([
+ 'ro.product.brand=product-brand',
+ 'ro.product.name=product-name',
+ 'ro.product.device=product-device',
+ ])
+ self.writeFiles({
+ 'SYSTEM/build.prop': '\n'.join(build_prop),
+ 'VENDOR/build.prop': '\n'.join(self.VENDOR_BUILD_PROP),
+ }, self.test_dir)
+
+ build_info = common.BuildInfo(common.LoadInfoDict(self.test_dir))
+ expected = ({'product-device'},
+ {self.constructFingerprint(
+ 'product-brand/product-name/product-device')})
+ self.assertEqual(expected,
+ CalculateRuntimeDevicesAndFingerprints(build_info, {}))
+
+ def test_CalculatePossibleFingerprints_single_override(self):
+ vendor_build_prop = copy.deepcopy(self.VENDOR_BUILD_PROP)
+ vendor_build_prop.extend([
+ 'import /vendor/etc/build_${ro.boot.sku_name}.prop',
+ ])
+ self.writeFiles({
+ 'SYSTEM/build.prop': '\n'.join(self.BUILD_PROP),
+ 'VENDOR/build.prop': '\n'.join(vendor_build_prop),
+ 'VENDOR/etc/build_std.prop':
+ 'ro.product.vendor.name=vendor-product-std',
+ 'VENDOR/etc/build_pro.prop':
+ 'ro.product.vendor.name=vendor-product-pro',
+ }, self.test_dir)
+
+ build_info = common.BuildInfo(common.LoadInfoDict(self.test_dir))
+ boot_variable_values = {'ro.boot.sku_name': ['std', 'pro']}
+
+ expected = ({'vendor-product-device'}, {
+ self.constructFingerprint(
+ 'vendor-product-brand/vendor-product-name/vendor-product-device'),
+ self.constructFingerprint(
+ 'vendor-product-brand/vendor-product-std/vendor-product-device'),
+ self.constructFingerprint(
+ 'vendor-product-brand/vendor-product-pro/vendor-product-device'),
+ })
+ self.assertEqual(
+ expected, CalculateRuntimeDevicesAndFingerprints(
+ build_info, boot_variable_values))
+
+ def test_CalculatePossibleFingerprints_multiple_overrides(self):
+ vendor_build_prop = copy.deepcopy(self.VENDOR_BUILD_PROP)
+ vendor_build_prop.extend([
+ 'import /vendor/etc/build_${ro.boot.sku_name}.prop',
+ 'import /vendor/etc/build_${ro.boot.device_name}.prop',
+ ])
+ self.writeFiles({
+ 'SYSTEM/build.prop': '\n'.join(self.BUILD_PROP),
+ 'VENDOR/build.prop': '\n'.join(vendor_build_prop),
+ 'VENDOR/etc/build_std.prop':
+ 'ro.product.vendor.name=vendor-product-std',
+ 'VENDOR/etc/build_product1.prop':
+ 'ro.product.vendor.device=vendor-device-product1',
+ 'VENDOR/etc/build_pro.prop':
+ 'ro.product.vendor.name=vendor-product-pro',
+ 'VENDOR/etc/build_product2.prop':
+ 'ro.product.vendor.device=vendor-device-product2',
+ }, self.test_dir)
+
+ build_info = common.BuildInfo(common.LoadInfoDict(self.test_dir))
+ boot_variable_values = {
+ 'ro.boot.sku_name': ['std', 'pro'],
+ 'ro.boot.device_name': ['product1', 'product2'],
+ }
+
+ expected_devices = {'vendor-product-device', 'vendor-device-product1',
+ 'vendor-device-product2'}
+ expected_fingerprints = {
+ self.constructFingerprint(
+ 'vendor-product-brand/vendor-product-name/vendor-product-device'),
+ self.constructFingerprint(
+ 'vendor-product-brand/vendor-product-std/vendor-device-product1'),
+ self.constructFingerprint(
+ 'vendor-product-brand/vendor-product-pro/vendor-device-product1'),
+ self.constructFingerprint(
+ 'vendor-product-brand/vendor-product-std/vendor-device-product2'),
+ self.constructFingerprint(
+ 'vendor-product-brand/vendor-product-pro/vendor-device-product2')
+ }
+ self.assertEqual((expected_devices, expected_fingerprints),
+ CalculateRuntimeDevicesAndFingerprints(
+ build_info, boot_variable_values))
+
+ def test_GetPackageMetadata_full_package(self):
+ vendor_build_prop = copy.deepcopy(self.VENDOR_BUILD_PROP)
+ vendor_build_prop.extend([
+ 'import /vendor/etc/build_${ro.boot.sku_name}.prop',
+ ])
+ self.writeFiles({
+ 'SYSTEM/build.prop': '\n'.join(self.BUILD_PROP),
+ 'VENDOR/build.prop': '\n'.join(vendor_build_prop),
+ 'VENDOR/etc/build_std.prop':
+ 'ro.product.vendor.name=vendor-product-std',
+ 'VENDOR/etc/build_pro.prop':
+ 'ro.product.vendor.name=vendor-product-pro',
+ }, self.test_dir)
+
+ common.OPTIONS.boot_variable_file = common.MakeTempFile()
+ with open(common.OPTIONS.boot_variable_file, 'w') as f:
+ f.write('ro.boot.sku_name=std,pro')
+
+ build_info = common.BuildInfo(common.LoadInfoDict(self.test_dir))
+ metadata = GetPackageMetadata(build_info)
+ self.assertEqual('vendor-product-device', metadata['pre-device'])
+ fingerprints = [
+ self.constructFingerprint(
+ 'vendor-product-brand/vendor-product-name/vendor-product-device'),
+ self.constructFingerprint(
+ 'vendor-product-brand/vendor-product-pro/vendor-product-device'),
+ self.constructFingerprint(
+ 'vendor-product-brand/vendor-product-std/vendor-product-device'),
+ ]
+ self.assertEqual('|'.join(fingerprints), metadata['post-build'])
+
+ def test_GetPackageMetadata_incremental_package(self):
+ vendor_build_prop = copy.deepcopy(self.VENDOR_BUILD_PROP)
+ vendor_build_prop.extend([
+ 'import /vendor/etc/build_${ro.boot.sku_name}.prop',
+ ])
+ self.writeFiles({
+ 'SYSTEM/build.prop': '\n'.join(self.BUILD_PROP),
+ 'VENDOR/build.prop': '\n'.join(vendor_build_prop),
+ 'VENDOR/etc/build_std.prop':
+ 'ro.product.vendor.device=vendor-device-std',
+ 'VENDOR/etc/build_pro.prop':
+ 'ro.product.vendor.device=vendor-device-pro',
+ }, self.test_dir)
+
+ common.OPTIONS.boot_variable_file = common.MakeTempFile()
+ with open(common.OPTIONS.boot_variable_file, 'w') as f:
+ f.write('ro.boot.sku_name=std,pro')
+
+ source_dir = common.MakeTempDir()
+ source_build_prop = [
+ 'ro.build.version.release=source-version-release',
+ 'ro.build.id=source-build-id',
+ 'ro.build.version.incremental=source-version-incremental',
+ 'ro.build.type=build-type',
+ 'ro.build.tags=build-tags',
+ 'ro.build.version.sdk=29',
+ 'ro.build.version.security_patch=2020',
+ 'ro.build.date.utc=12340000'
+ ]
+ self.writeFiles({
+ 'META/misc_info.txt': '\n'.join(self.MISC_INFO),
+ 'SYSTEM/build.prop': '\n'.join(source_build_prop),
+ 'VENDOR/build.prop': '\n'.join(vendor_build_prop),
+ 'VENDOR/etc/build_std.prop':
+ 'ro.product.vendor.device=vendor-device-std',
+ 'VENDOR/etc/build_pro.prop':
+ 'ro.product.vendor.device=vendor-device-pro',
+ }, source_dir)
+ common.OPTIONS.incremental_source = source_dir
+
+ target_info = common.BuildInfo(common.LoadInfoDict(self.test_dir))
+ source_info = common.BuildInfo(common.LoadInfoDict(source_dir))
+
+ metadata = GetPackageMetadata(target_info, source_info)
+ self.assertEqual(
+ 'vendor-device-pro|vendor-device-std|vendor-product-device',
+ metadata['pre-device'])
+ suffix = ':source-version-release/source-build-id/' \
+ 'source-version-incremental:build-type/build-tags'
+ pre_fingerprints = [
+ 'vendor-product-brand/vendor-product-name/vendor-device-pro'
+ '{}'.format(suffix),
+ 'vendor-product-brand/vendor-product-name/vendor-device-std'
+ '{}'.format(suffix),
+ 'vendor-product-brand/vendor-product-name/vendor-product-device'
+ '{}'.format(suffix),
+ ]
+ self.assertEqual('|'.join(pre_fingerprints), metadata['pre-build'])
+
+ post_fingerprints = [
+ self.constructFingerprint(
+ 'vendor-product-brand/vendor-product-name/vendor-device-pro'),
+ self.constructFingerprint(
+ 'vendor-product-brand/vendor-product-name/vendor-device-std'),
+ self.constructFingerprint(
+ 'vendor-product-brand/vendor-product-name/vendor-product-device'),
+ ]
+ self.assertEqual('|'.join(post_fingerprints), metadata['post-build'])
diff --git a/tools/releasetools/test_sign_apex.py b/tools/releasetools/test_sign_apex.py
index b4ef127..82f5938 100644
--- a/tools/releasetools/test_sign_apex.py
+++ b/tools/releasetools/test_sign_apex.py
@@ -38,5 +38,22 @@
'avbtool',
foo_apex,
payload_key,
- container_key)
+ container_key,
+ False)
self.assertTrue(os.path.exists(signed_foo_apex))
+
+ @test_utils.SkipIfExternalToolsUnavailable()
+ def test_SignApexWithApk(self):
+ test_apex = os.path.join(self.testdata_dir, 'has_apk.apex')
+ payload_key = os.path.join(self.testdata_dir, 'testkey_RSA4096.key')
+ container_key = os.path.join(self.testdata_dir, 'testkey')
+ apk_keys = {'wifi-service-resources.apk': os.path.join(
+ self.testdata_dir, 'testkey')}
+ signed_test_apex = sign_apex.SignApexFile(
+ 'avbtool',
+ test_apex,
+ payload_key,
+ container_key,
+ False,
+ apk_keys)
+ self.assertTrue(os.path.exists(signed_test_apex))
diff --git a/tools/releasetools/test_sign_target_files_apks.py b/tools/releasetools/test_sign_target_files_apks.py
index e0a635a..308172f 100644
--- a/tools/releasetools/test_sign_target_files_apks.py
+++ b/tools/releasetools/test_sign_target_files_apks.py
@@ -23,7 +23,8 @@
import test_utils
from sign_target_files_apks import (
CheckApkAndApexKeysAvailable, EditTags, GetApkFileInfo, ReadApexKeysInfo,
- ReplaceCerts, ReplaceVerityKeyId, RewriteProps, WriteOtacerts)
+ ReplaceCerts, ReplaceVerityKeyId, RewriteAvbProps, RewriteProps,
+ WriteOtacerts)
class SignTargetFilesApksTest(test_utils.ReleaseToolsTestCase):
@@ -34,8 +35,12 @@
<signer signature="{}"><seinfo value="media"/></signer>
</policy>"""
+ # Note that we test one apex with the partition tag, and another without to
+ # make sure that new OTA tools can process an older target files package that
+ # does not include the partition tag.
+
# pylint: disable=line-too-long
- APEX_KEYS_TXT = """name="apex.apexd_test.apex" public_key="system/apex/apexd/apexd_testdata/com.android.apex.test_package.avbpubkey" private_key="system/apex/apexd/apexd_testdata/com.android.apex.test_package.pem" container_certificate="build/make/target/product/security/testkey.x509.pem" container_private_key="build/make/target/product/security/testkey.pk8"
+ APEX_KEYS_TXT = """name="apex.apexd_test.apex" public_key="system/apex/apexd/apexd_testdata/com.android.apex.test_package.avbpubkey" private_key="system/apex/apexd/apexd_testdata/com.android.apex.test_package.pem" container_certificate="build/make/target/product/security/testkey.x509.pem" container_private_key="build/make/target/product/security/testkey.pk8" partition="system"
name="apex.apexd_test_different_app.apex" public_key="system/apex/apexd/apexd_testdata/com.android.apex.test_package_2.avbpubkey" private_key="system/apex/apexd/apexd_testdata/com.android.apex.test_package_2.pem" container_certificate="build/make/target/product/security/testkey.x509.pem" container_private_key="build/make/target/product/security/testkey.pk8"
"""
@@ -52,6 +57,40 @@
# Tags are sorted.
self.assertEqual(EditTags('xyz,abc,dev-keys,xyz'), ('abc,release-keys,xyz'))
+ def test_RewriteAvbProps(self):
+ misc_info = {
+ 'avb_boot_add_hash_footer_args':
+ ('--prop com.android.build.boot.os_version:R '
+ '--prop com.android.build.boot.security_patch:2019-09-05'),
+ 'avb_system_add_hashtree_footer_args':
+ ('--prop com.android.build.system.os_version:R '
+ '--prop com.android.build.system.security_patch:2019-09-05 '
+ '--prop com.android.build.system.fingerprint:'
+ 'Android/aosp_taimen/taimen:R/QT/foo:userdebug/test-keys'),
+ 'avb_vendor_add_hashtree_footer_args':
+ ('--prop com.android.build.vendor.os_version:R '
+ '--prop com.android.build.vendor.security_patch:2019-09-05 '
+ '--prop com.android.build.vendor.fingerprint:'
+ 'Android/aosp_taimen/taimen:R/QT/foo:userdebug/dev-keys'),
+ }
+ expected_dict = {
+ 'avb_boot_add_hash_footer_args':
+ ('--prop com.android.build.boot.os_version:R '
+ '--prop com.android.build.boot.security_patch:2019-09-05'),
+ 'avb_system_add_hashtree_footer_args':
+ ('--prop com.android.build.system.os_version:R '
+ '--prop com.android.build.system.security_patch:2019-09-05 '
+ '--prop com.android.build.system.fingerprint:'
+ 'Android/aosp_taimen/taimen:R/QT/foo:userdebug/release-keys'),
+ 'avb_vendor_add_hashtree_footer_args':
+ ('--prop com.android.build.vendor.os_version:R '
+ '--prop com.android.build.vendor.security_patch:2019-09-05 '
+ '--prop com.android.build.vendor.fingerprint:'
+ 'Android/aosp_taimen/taimen:R/QT/foo:userdebug/release-keys'),
+ }
+ RewriteAvbProps(misc_info)
+ self.assertDictEqual(expected_dict, misc_info)
+
def test_RewriteProps(self):
props = (
('', ''),
@@ -449,7 +488,8 @@
'public_key="system/apex/apexd/apexd_testdata/com.android.apex.test_package_2.avbpubkey" '
'private_key="system/apex/apexd/apexd_testdata/com.android.apex.test_package_2.pem" '
'container_certificate="build/make/target/product/security/testkey.x509.pem" '
- 'container_private_key="build/make/target/product/security/testkey2.pk8"')
+ 'container_private_key="build/make/target/product/security/testkey2.pk8" '
+ 'partition="system"')
target_files = common.MakeTempFile(suffix='.zip')
with zipfile.ZipFile(target_files, 'w') as target_files_zip:
target_files_zip.writestr('META/apexkeys.txt', apex_keys)
diff --git a/tools/releasetools/test_utils.py b/tools/releasetools/test_utils.py
index 2445671..e999757 100755
--- a/tools/releasetools/test_utils.py
+++ b/tools/releasetools/test_utils.py
@@ -145,6 +145,47 @@
return sparse_image
+class MockScriptWriter(object):
+ """A class that mocks edify_generator.EdifyGenerator.
+
+ It simply pushes the incoming arguments onto script stack, which is to assert
+ the calls to EdifyGenerator functions.
+ """
+
+ def __init__(self, enable_comments=False):
+ self.lines = []
+ self.enable_comments = enable_comments
+
+ def Mount(self, *args):
+ self.lines.append(('Mount',) + args)
+
+ def AssertDevice(self, *args):
+ self.lines.append(('AssertDevice',) + args)
+
+ def AssertOemProperty(self, *args):
+ self.lines.append(('AssertOemProperty',) + args)
+
+ def AssertFingerprintOrThumbprint(self, *args):
+ self.lines.append(('AssertFingerprintOrThumbprint',) + args)
+
+ def AssertSomeFingerprint(self, *args):
+ self.lines.append(('AssertSomeFingerprint',) + args)
+
+ def AssertSomeThumbprint(self, *args):
+ self.lines.append(('AssertSomeThumbprint',) + args)
+
+ def Comment(self, comment):
+ if not self.enable_comments:
+ return
+ self.lines.append('# {}'.format(comment))
+
+ def AppendExtra(self, extra):
+ self.lines.append(extra)
+
+ def __str__(self):
+ return '\n'.join(self.lines)
+
+
class ReleaseToolsTestCase(unittest.TestCase):
"""A common base class for all the releasetools unittests."""
diff --git a/tools/releasetools/test_validate_target_files.py b/tools/releasetools/test_validate_target_files.py
index 9c816eb..6504515 100644
--- a/tools/releasetools/test_validate_target_files.py
+++ b/tools/releasetools/test_validate_target_files.py
@@ -238,14 +238,14 @@
system_root = os.path.join(input_tmp, "SYSTEM")
os.mkdir(system_root)
- # Write the test file that contain multiple blocks of zeros, and these
- # zero blocks will be omitted by kernel. And the test files will occupy one
- # block range each in the final system image.
+ # Write test files that contain multiple blocks of zeros, and these zero
+ # blocks will be omitted by kernel. Each test file will occupy one block in
+ # the final system image.
with open(os.path.join(system_root, 'a'), 'w') as f:
- f.write("aaa")
+ f.write('aaa')
f.write('\0' * 4096 * 3)
with open(os.path.join(system_root, 'b'), 'w') as f:
- f.write("bbb")
+ f.write('bbb')
f.write('\0' * 4096 * 3)
raw_file_map = os.path.join(input_tmp, 'IMAGES', 'raw_system.map')
@@ -254,7 +254,7 @@
# Parse the generated file map and update the block ranges for each file.
file_map_list = {}
image_ranges = RangeSet()
- with open(raw_file_map, 'r') as f:
+ with open(raw_file_map) as f:
for line in f.readlines():
info = line.split()
self.assertEqual(2, len(info))
@@ -265,7 +265,7 @@
mock_shared_block = RangeSet("10-20").subtract(image_ranges).first(1)
with open(os.path.join(input_tmp, 'IMAGES', 'system.map'), 'w') as f:
for key in sorted(file_map_list.keys()):
- line = "{} {}\n".format(
+ line = '{} {}\n'.format(
key, file_map_list[key].union(mock_shared_block))
f.write(line)
@@ -277,9 +277,55 @@
for name in all_entries:
input_zip.write(os.path.join(input_tmp, name), arcname=name)
- input_zip = zipfile.ZipFile(input_file, 'r')
- info_dict = {'extfs_sparse_flag': '-s'}
-
# Expect the validation to pass and both files are skipped due to
# 'incomplete' block range.
- ValidateFileConsistency(input_zip, input_tmp, info_dict)
+ with zipfile.ZipFile(input_file) as input_zip:
+ info_dict = {'extfs_sparse_flag': '-s'}
+ ValidateFileConsistency(input_zip, input_tmp, info_dict)
+
+ @test_utils.SkipIfExternalToolsUnavailable()
+ def test_ValidateFileConsistency_nonMonotonicRanges(self):
+ input_tmp = common.MakeTempDir()
+ os.mkdir(os.path.join(input_tmp, 'IMAGES'))
+ system_image = os.path.join(input_tmp, 'IMAGES', 'system.img')
+ system_root = os.path.join(input_tmp, "SYSTEM")
+ os.mkdir(system_root)
+
+ # Write the test file that contain three blocks of 'a', 'b', 'c'.
+ with open(os.path.join(system_root, 'abc'), 'w') as f:
+ f.write('a' * 4096 + 'b' * 4096 + 'c' * 4096)
+ raw_file_map = os.path.join(input_tmp, 'IMAGES', 'raw_system.map')
+ self._generate_system_image(system_image, system_root, raw_file_map)
+
+ # Parse the generated file map and manipulate the block ranges of 'abc' to
+ # be 'cba'.
+ file_map_list = {}
+ with open(raw_file_map) as f:
+ for line in f.readlines():
+ info = line.split()
+ self.assertEqual(2, len(info))
+ ranges = RangeSet(info[1])
+ self.assertTrue(ranges.monotonic)
+ blocks = reversed(list(ranges.next_item()))
+ file_map_list[info[0]] = ' '.join([str(block) for block in blocks])
+
+ # Update the contents of 'abc' to be 'cba'.
+ with open(os.path.join(system_root, 'abc'), 'w') as f:
+ f.write('c' * 4096 + 'b' * 4096 + 'a' * 4096)
+
+ # Update the system.map.
+ with open(os.path.join(input_tmp, 'IMAGES', 'system.map'), 'w') as f:
+ for key in sorted(file_map_list.keys()):
+ f.write('{} {}\n'.format(key, file_map_list[key]))
+
+ # Get the target zip file.
+ input_file = common.MakeTempFile()
+ all_entries = ['SYSTEM/', 'SYSTEM/abc', 'IMAGES/',
+ 'IMAGES/system.map', 'IMAGES/system.img']
+ with zipfile.ZipFile(input_file, 'w') as input_zip:
+ for name in all_entries:
+ input_zip.write(os.path.join(input_tmp, name), arcname=name)
+
+ with zipfile.ZipFile(input_file) as input_zip:
+ info_dict = {'extfs_sparse_flag': '-s'}
+ ValidateFileConsistency(input_zip, input_tmp, info_dict)
diff --git a/tools/releasetools/testdata/apexkeys_framework.txt b/tools/releasetools/testdata/apexkeys_framework.txt
index 2346668..b9caf9e 100644
--- a/tools/releasetools/testdata/apexkeys_framework.txt
+++ b/tools/releasetools/testdata/apexkeys_framework.txt
@@ -1,2 +1,7 @@
-name="com.android.runtime.debug.apex" public_key="art/build/apex/com.android.runtime.avbpubkey" private_key="art/build/apex/com.android.runtime.pem" container_certificate="art/build/apex/com.android.runtime.debug.x509.pem" container_private_key="art/build/apex/com.android.runtime.debug.pk8"
-name="com.android.conscrypt.apex" public_key="external/conscrypt/apex/com.android.conscrypt.avbpubkey" private_key="external/conscrypt/apex/com.android.conscrypt.pem" container_certificate="external/conscrypt/apex/com.android.conscrypt.x509.pem" container_private_key="external/conscrypt/apex/com.android.conscrypt.pk8"
+name="com.android.conscrypt.apex" public_key="external/conscrypt/apex/com.android.conscrypt.avbpubkey" private_key="external/conscrypt/apex/com.android.conscrypt.pem" container_certificate="external/conscrypt/apex/com.android.conscrypt.x509.pem" container_private_key="external/conscrypt/apex/com.android.conscrypt.pk8" partition="system"
+name="com.android.dummy_product.apex" public_key="selected" private_key="selected" container_certificate="selected" container_private_key="selected" partition="product"
+name="com.android.runtime.apex" public_key="bionic/apex/com.android.runtime.avbpubkey" private_key="bionic/apex/com.android.runtime.pem" container_certificate="bionic/apex/com.android.runtime.x509.pem" container_private_key="bionic/apex/com.android.runtime.pk8" partition="system"
+name="com.android.vndk.current.on_vendor.apex" public_key="not_selected" private_key="not_selected" container_certificate="not_selected" container_private_key="not_selected" partition="vendor"
+name="com.android.vndk.v27.apex" public_key="packages/modules/vndk/apex/com.android.vndk.v27.pubkey" private_key="packages/modules/vndk/apex/com.android.vndk.v27.pem" container_certificate="packages/modules/vndk/apex/com.android.vndk.v27.x509.pem" container_private_key="packages/modules/vndk/apex/com.android.vndk.v27.pk8" partition="system_ext"
+name="com.android.vndk.v28.apex" public_key="packages/modules/vndk/apex/com.android.vndk.v28.pubkey" private_key="packages/modules/vndk/apex/com.android.vndk.v28.pem" container_certificate="packages/modules/vndk/apex/com.android.vndk.v28.x509.pem" container_private_key="packages/modules/vndk/apex/com.android.vndk.v28.pk8" partition="system_ext"
+name="com.android.vndk.v29.apex" public_key="packages/modules/vndk/apex/com.android.vndk.v29.pubkey" private_key="packages/modules/vndk/apex/com.android.vndk.v29.pem" container_certificate="packages/modules/vndk/apex/com.android.vndk.v29.x509.pem" container_private_key="packages/modules/vndk/apex/com.android.vndk.v29.pk8" partition="system_ext"
diff --git a/tools/releasetools/testdata/apexkeys_framework_conflict.txt b/tools/releasetools/testdata/apexkeys_framework_conflict.txt
index caa21c2..9a055f4 100644
--- a/tools/releasetools/testdata/apexkeys_framework_conflict.txt
+++ b/tools/releasetools/testdata/apexkeys_framework_conflict.txt
@@ -1 +1 @@
-name="com.android.runtime.debug.apex" public_key="art/build/apex/com.android.runtime.avbpubkey" private_key="art/build/apex/com.android.runtime.pem" container_certificate="art/build/apex/com.android.runtime.release.x509.pem" container_private_key="art/build/apex/com.android.runtime.debug.pk8"
+name="com.android.conscrypt.apex" public_key="external/conscrypt/apex/com.android.conscrypt.avbpubkey" private_key="external/conscrypt/apex/com.android.conscrypt.pem" container_certificate="external/conscrypt/apex/com.android.conscrypt.x509.pem" container_private_key="external/conscrypt/apex/com.android.conscrypt.pk8" partition="vendor"
diff --git a/tools/releasetools/testdata/apexkeys_merge.txt b/tools/releasetools/testdata/apexkeys_merge.txt
index 48e789f..a9355d7 100644
--- a/tools/releasetools/testdata/apexkeys_merge.txt
+++ b/tools/releasetools/testdata/apexkeys_merge.txt
@@ -1,4 +1,7 @@
-name="com.android.conscrypt.apex" public_key="external/conscrypt/apex/com.android.conscrypt.avbpubkey" private_key="external/conscrypt/apex/com.android.conscrypt.pem" container_certificate="external/conscrypt/apex/com.android.conscrypt.x509.pem" container_private_key="external/conscrypt/apex/com.android.conscrypt.pk8"
-name="com.android.runtime.debug.apex" public_key="art/build/apex/com.android.runtime.avbpubkey" private_key="art/build/apex/com.android.runtime.pem" container_certificate="art/build/apex/com.android.runtime.debug.x509.pem" container_private_key="art/build/apex/com.android.runtime.debug.pk8"
-name="com.android.runtime.release.apex" public_key="art/build/apex/com.android.runtime.avbpubkey" private_key="art/build/apex/com.android.runtime.pem" container_certificate="art/build/apex/com.android.runtime.release.x509.pem" container_private_key="art/build/apex/com.android.runtime.release.pk8"
-name="com.android.support.apexer.apex" public_key="system/apex/apexer/etc/com.android.support.apexer.avbpubkey" private_key="system/apex/apexer/etc/com.android.support.apexer.pem" container_certificate="build/target/product/security/testkey.x509.pem" container_private_key="build/target/product/security/testkey.pk8"
+name="com.android.conscrypt.apex" public_key="external/conscrypt/apex/com.android.conscrypt.avbpubkey" private_key="external/conscrypt/apex/com.android.conscrypt.pem" container_certificate="external/conscrypt/apex/com.android.conscrypt.x509.pem" container_private_key="external/conscrypt/apex/com.android.conscrypt.pk8" partition="system"
+name="com.android.dummy_product.apex" public_key="selected" private_key="selected" container_certificate="selected" container_private_key="selected" partition="product"
+name="com.android.runtime.apex" public_key="bionic/apex/com.android.runtime.avbpubkey" private_key="bionic/apex/com.android.runtime.pem" container_certificate="bionic/apex/com.android.runtime.x509.pem" container_private_key="bionic/apex/com.android.runtime.pk8" partition="system"
+name="com.android.vndk.current.on_vendor.apex" public_key="packages/modules/vndk/apex/com.android.vndk.current.pubkey" private_key="packages/modules/vndk/apex/com.android.vndk.current.pem" container_certificate="packages/modules/vndk/apex/com.android.vndk.current.x509.pem" container_private_key="packages/modules/vndk/apex/com.android.vndk.current.pk8" partition="vendor"
+name="com.android.vndk.v27.apex" public_key="packages/modules/vndk/apex/com.android.vndk.v27.pubkey" private_key="packages/modules/vndk/apex/com.android.vndk.v27.pem" container_certificate="packages/modules/vndk/apex/com.android.vndk.v27.x509.pem" container_private_key="packages/modules/vndk/apex/com.android.vndk.v27.pk8" partition="system_ext"
+name="com.android.vndk.v28.apex" public_key="packages/modules/vndk/apex/com.android.vndk.v28.pubkey" private_key="packages/modules/vndk/apex/com.android.vndk.v28.pem" container_certificate="packages/modules/vndk/apex/com.android.vndk.v28.x509.pem" container_private_key="packages/modules/vndk/apex/com.android.vndk.v28.pk8" partition="system_ext"
+name="com.android.vndk.v29.apex" public_key="packages/modules/vndk/apex/com.android.vndk.v29.pubkey" private_key="packages/modules/vndk/apex/com.android.vndk.v29.pem" container_certificate="packages/modules/vndk/apex/com.android.vndk.v29.x509.pem" container_private_key="packages/modules/vndk/apex/com.android.vndk.v29.pk8" partition="system_ext"
diff --git a/tools/releasetools/testdata/apexkeys_vendor.txt b/tools/releasetools/testdata/apexkeys_vendor.txt
index b751227..7dd3964 100644
--- a/tools/releasetools/testdata/apexkeys_vendor.txt
+++ b/tools/releasetools/testdata/apexkeys_vendor.txt
@@ -1,3 +1,7 @@
-name="com.android.runtime.release.apex" public_key="art/build/apex/com.android.runtime.avbpubkey" private_key="art/build/apex/com.android.runtime.pem" container_certificate="art/build/apex/com.android.runtime.release.x509.pem" container_private_key="art/build/apex/com.android.runtime.release.pk8"
-name="com.android.support.apexer.apex" public_key="system/apex/apexer/etc/com.android.support.apexer.avbpubkey" private_key="system/apex/apexer/etc/com.android.support.apexer.pem" container_certificate="build/target/product/security/testkey.x509.pem" container_private_key="build/target/product/security/testkey.pk8"
-name="com.android.runtime.debug.apex" public_key="art/build/apex/com.android.runtime.avbpubkey" private_key="art/build/apex/com.android.runtime.pem" container_certificate="art/build/apex/com.android.runtime.debug.x509.pem" container_private_key="art/build/apex/com.android.runtime.debug.pk8"
+name="com.android.conscrypt.apex" public_key="not_selected" private_key="not_selected" container_certificate="not_selected" container_private_key="not_selected" partition="system"
+name="com.android.dummy_product.apex" public_key="not_selected" private_key="not_selected" container_certificate="not_selected" container_private_key="not_selected" partition="product"
+name="com.android.runtime.apex" public_key="not_selected" private_key="not_selected" container_certificate="not_selected" container_private_key="not_selected" partition="system"
+name="com.android.vndk.current.on_vendor.apex" public_key="packages/modules/vndk/apex/com.android.vndk.current.pubkey" private_key="packages/modules/vndk/apex/com.android.vndk.current.pem" container_certificate="packages/modules/vndk/apex/com.android.vndk.current.x509.pem" container_private_key="packages/modules/vndk/apex/com.android.vndk.current.pk8" partition="vendor"
+name="com.android.vndk.v27.apex" public_key="not_selected" private_key="not_selected" container_certificate="not_selected" container_private_key="not_selected" partition="system_ext"
+name="com.android.vndk.v28.apex" public_key="not_selected" private_key="not_selected" container_certificate="not_selected" container_private_key="not_selected" partition="system_ext"
+name="com.android.vndk.v29.apex" public_key="not_selected" private_key="not_selected" container_certificate="not_selected" container_private_key="not_selected" partition="system_ext"
diff --git a/tools/releasetools/testdata/apkcerts_framework.txt b/tools/releasetools/testdata/apkcerts_framework.txt
new file mode 100644
index 0000000..a75f55c
--- /dev/null
+++ b/tools/releasetools/testdata/apkcerts_framework.txt
@@ -0,0 +1,6 @@
+name="TestSystem1.apk" certificate="build/make/target/product/security/testkey.x509.pem" private_key="build/make/target/product/security/testkey.pk8" partition="system"
+name="TestSystem2.apk" certificate="build/make/target/product/security/testkey.x509.pem" private_key="build/make/target/product/security/testkey.pk8" partition="system"
+name="TestVendor.apk" certificate="not_selected" private_key="not_selected" partition="vendor"
+name="TestOdm.apk" certificate="not_selected" private_key="not_selected" partition="odm"
+name="TestProduct.apk" certificate="build/make/target/product/security/testkey.x509.pem" private_key="build/make/target/product/security/testkey.pk8" partition="product"
+name="TestSystemExt.apk" certificate="build/make/target/product/security/testkey.x509.pem" private_key="build/make/target/product/security/testkey.pk8" partition="system_ext"
diff --git a/tools/releasetools/testdata/apkcerts_merge.txt b/tools/releasetools/testdata/apkcerts_merge.txt
new file mode 100644
index 0000000..0425e96
--- /dev/null
+++ b/tools/releasetools/testdata/apkcerts_merge.txt
@@ -0,0 +1,6 @@
+name="TestOdm.apk" certificate="build/make/target/product/security/testkey.x509.pem" private_key="build/make/target/product/security/testkey.pk8" partition="odm"
+name="TestProduct.apk" certificate="build/make/target/product/security/testkey.x509.pem" private_key="build/make/target/product/security/testkey.pk8" partition="product"
+name="TestSystem1.apk" certificate="build/make/target/product/security/testkey.x509.pem" private_key="build/make/target/product/security/testkey.pk8" partition="system"
+name="TestSystem2.apk" certificate="build/make/target/product/security/testkey.x509.pem" private_key="build/make/target/product/security/testkey.pk8" partition="system"
+name="TestSystemExt.apk" certificate="build/make/target/product/security/testkey.x509.pem" private_key="build/make/target/product/security/testkey.pk8" partition="system_ext"
+name="TestVendor.apk" certificate="build/make/target/product/security/testkey.x509.pem" private_key="build/make/target/product/security/testkey.pk8" partition="vendor"
diff --git a/tools/releasetools/testdata/apkcerts_vendor.txt b/tools/releasetools/testdata/apkcerts_vendor.txt
new file mode 100644
index 0000000..13d5255
--- /dev/null
+++ b/tools/releasetools/testdata/apkcerts_vendor.txt
@@ -0,0 +1,6 @@
+name="TestSystem1.apk" certificate="not_selected" private_key="not_selected" partition="system"
+name="TestSystem2.apk" certificate="not_selected" private_key="not_selected" partition="system"
+name="TestVendor.apk" certificate="build/make/target/product/security/testkey.x509.pem" private_key="build/make/target/product/security/testkey.pk8" partition="vendor"
+name="TestOdm.apk" certificate="build/make/target/product/security/testkey.x509.pem" private_key="build/make/target/product/security/testkey.pk8" partition="odm"
+name="TestProduct.apk" certificate="not_selected" private_key="not_selected" partition="product"
+name="TestSystemExt.apk" certificate="not_selected" private_key="not_selected" partition="system_ext"
diff --git a/tools/releasetools/testdata/has_apk.apex b/tools/releasetools/testdata/has_apk.apex
new file mode 100644
index 0000000..12bbdf9
--- /dev/null
+++ b/tools/releasetools/testdata/has_apk.apex
Binary files differ
diff --git a/tools/releasetools/testdata/test_aftl_rsa4096.pem b/tools/releasetools/testdata/test_aftl_rsa4096.pem
new file mode 100644
index 0000000..89f1ef3
--- /dev/null
+++ b/tools/releasetools/testdata/test_aftl_rsa4096.pem
@@ -0,0 +1,52 @@
+-----BEGIN PRIVATE KEY-----
+MIIJQgIBADANBgkqhkiG9w0BAQEFAASCCSwwggkoAgEAAoICAQDDlhUPUgtWL6LB
+Wybp6wsEJeioV1aRLPGSA2/xIpTiJUK46cb/MD5eBTWjKENoIgX23eL/ePy2I68e
++WvcZ5ITGOTRQqNVZIdc5qvr03wkV0BsJQMHSMAHacePpB/4xM5MzN/6Ku1wA8Dw
+uK+v/Cw4hqq8H/gP0oPVQ1bwcIePzRPX4YkkyXusoyzTIm5DJ9reVtyFucKqANCN
+aFmGxcaEc2nADtARQWJpO95joFsMvr68+JBxpCt8aWbxuSz/rLJ9Y8Z46V/++XG+
+E4QEob/WVY5pUD/RyogLrfhIf+zO7R3wJklXElSFacIX9+RzR9dgkQVbqxLfBKIP
+XWLCsF4I4EnvqUtaVjIMl8UpZpoq8pDLRqZ71Os5xZYq06x9E02M6DnvFbZEdaOX
+MCz2mmNX3g5FahvJayBhCuNhyTkd79MFR71Wp48TvWxKz3S7q0T0cWHNhtPkHSCa
+KwD93AQnqtLKYDGkHIZBzJPcs+QxbzdHyGzhXZb+qh5KmQvNA9HRBQY1RkMmzIbI
+8pzYTwpOkbCEhVoCWcRaaF1Pgl+zcpgJOMbBBUabx/dConFIhMDW/I5fHgKgwGqm
+tWUibrMPdnfS6W5MXi8jC0eDuZl0VwmdE+4dLujiOofUYnb7D+GXojf3PrSLcTw1
+PmG0f7l5xDKN9a0N+IXqvD2oAANTsQIDAQABAoICAQCW5HXw8OogHvYg2HMIKrbA
+B4McRO1baWIhtRcq4PQeGIMGaA2HmS+0l65O5uRCNWWGlJ7pW+0TlCop6mHFk/4F
+T8JQk2mxmrI4ARqIAQwYeVwRUuioOP81eO1mK0gjQ6qpY7I0reOq9KpozQN18UYo
+gfS82Kkng9EDukUbkKV1UtFJTw3gXLVWdjlB1qFcnCXmPPs7DBpbz+8V+XiAWpsS
+WnwumP77IQeMiozDLdaw2YQMBHRjyDVocWTjfmpyAkleJZjcdagC7W1MKIBElomL
+EUyigTALaYZWBGy1ekQ3TIY5XUBdtZ2RpAsDNNOCAN3v+VI565zOhCOHWRO1gh24
+vyhBFR0HYqBRoLbLAqo8bM5iLPz1EWGyaTnfxt38J8Va0TD7KihcBnphiA+dkhEF
+oc0yIp/8S2o3CfkNok7Ju8Amb7M4JJuKhuP8wxn86fAHpjjd3Y4SlZp0NrTrd7T2
+msLIneb1OUZZxFxyJG1XQGEZplLPalnGadIF4p3q/3nd1rVb491qCNl/A5QwhI9r
+ZV62O90M9fu3+cAynBLbMT09IZecNwP1gXmunlY6YH+ymM+3NFqC8q2tnzomiz8/
+Fee0ftZ2C/jK62fET0Y8LPWGkVQGHtvZH0FPg4suA0GMmYAe0tQl93A+jFltfKKZ
+RgCDrYs6Wv76E9gnWVnEdQKCAQEA8L76LjZUTKOg83Bra+hP+cXnwGsgwOwJfGBp
+OM++5HzlpYjtbD38esBZVJtwb/8xJGdsHtP2n7ZgbSDuAnRj5S50QHIApvRkz1Y+
+1hL8tAdgVP2JkYjpyG3bPk4QVKyXkKvBcp2BCidXs75+HzfOxqkazumaYOYo2guh
+azHdka2xSqxcZqo4yyORc/oue25RU4skmuNDOlP0+OTxU/uXnl7QZmlaOfT5TqO4
+s7uER4BXt/87j44mnOBdXmtqrsL49+R9bzVskx76aeuaBbwf7jnpR058E71OZwSd
+F1P3fx6hl0yLOZF/5Jnq+14rEna6jH50XtzlhB6deSZFTOw2gwKCAQEAz/qXRzwH
+I0YWISgkUG2zBJseHmfHqV4CDzb5+tTJ3B2I8cXE0m2sQJXi2s7oMhWSc1cQOHCX
+txpgWaD59uBz2lcwnGRNp27TRXv8Wo+X0+O+lGWU2cO+j8AB2Vtb7F7rCySp0+Uu
+z+dBfoQ2zhKEQlkX0YldVILGzCL3QBHVvPC4iDlwkMRbcejDoh9NsBtHL8lG+MAw
+ZXbwJjhaJkhTXJFpJpejq70naS8VVlLt8Os80iuBXe5JK/ecAHtsNcJlXO02sMNZ
+Fbcy8WosGyvRKQ/tHtTjAlxZ7Ey8usWE8BvWBdUgiIBkIcjLtE2GrA8eOGNb3v1I
+HRt8NsV8yaLWuwKCAQAR7SaT6le8nTKO7gARuOq7npDzMwbtVqYeLM+o+08rlGFF
+QjzronH6cfg05J4quMXgABN8+CuVGO91MM6IQEJv/lWJtvN1ex1GkxV6u0812JbD
+vV1RCPDfi86XhRiSNYfTrfZponDJYMSXDcg2auFqyYzFe3+TV5ATLGqIoN3uyxA4
+jz0SJ/qypaNfD3IGnuBPaD0Bi4ql/TpwjhuqNUHE+SprdczSI/usb2SBfaUL7fKa
+MNcuiVc2tz48maMIAFypmMn+TewXyGa9HF4Lr0ZxZr6IIL/8eEwuP5my8v2q6Yz+
+xyRW1Q7A5vUoYoqyhUS+0Wu45JnyjJUNQFxIrg4hAoIBAF1uBIGSvN4iwRQ6FT4w
+WahrCre8BVzXh3NQTjJZXylL91YtcwLZE/Wbn+KN6o99U2IPLZE9O1qdNcVt5Hz8
+Te87FfJbuOrLhYuEbFQ+h4U/nUDK9XhyT+wB5JLBUOU5qrtByC0Rmtr411o/iONA
+PDwWC/YskEnDygywdIRKvsr3FN7VdvUB0Na2KxRsnZjMWElmUUS0Ccm7CZ0R2aWy
+/gfqpuMYYgVnnwnIhfxWmt+MvbDorGAHCMYAoQsyZuUrpB9/zP7RcvanavI6sP+v
+ynF43xvnpOdNl3Po8SuyScsXpijOmqPXkaP/sUsZPLOUww2vzPi6raetzjpIs4td
+ZLsCggEAe42Zj3FEbruJZeDgmd9lSc0j8UF90mNw8KH44IbuA6R9fGv3WkrNHEVd
+XZOwjWqAxhOj6pFoJk8n6h5d8iS/yXFZ0AfBMc21XMecu9mnfx9E9LFAIWmv7Wut
+vy3h2BqY+crglpg5RAw+3J97HAGMYCvp+hH2il+9zzjpmCtTD21LRMkw34szY7RR
+CDy9G5FTmKVlxw5eegvyj164olQRLurEdUIfSr5UnBjrWftJHy9JW8KWCeFDSmm9
+xCl3nGDyQuZmOTngxPtrOYAhb5LoKR9BeGcy6jlom7V4nYYqm3t1IDBgMqjYGT9c
+vqQgxO2OFsQOJQ/4PRYEKd1neTlZrw==
+-----END PRIVATE KEY-----
diff --git a/tools/releasetools/testdata/test_transparency_key.pub b/tools/releasetools/testdata/test_transparency_key.pub
new file mode 100644
index 0000000..8bfd816
--- /dev/null
+++ b/tools/releasetools/testdata/test_transparency_key.pub
@@ -0,0 +1,15 @@
+-----BEGIN PUBLIC KEY-----
+MIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEA4ilqCNsenNA013iCdwgD
+YPxZ853nbHG9lMBp9boXiwRcqT/8bUKHIL7YX5z7s+QoRYVY3rkMKppRabclXzyx
+H59YnPMaU4uv7NqwWzjgaZo7E+vo7IF+KBjV3cJulId5Av0yIYUCsrwd7MpGtWdC
+Q3S+7Vd4zwzCKEhcvliNIhnNlp1U3wNkPCxOyCAsMEn6k8O5ar12ke5TvxDv15db
+rPDeHh8G2OYWoCkWL+lSN35L2kOJqKqVbLKWrrOd96RCYrrtbPCi580OADJRcUlG
+lgcjwmNwmypBWvQMZ6ITj0P0ksHnl1zZz1DE2rXe1goLI1doghb5KxLaezlR8c2C
+E3w/uo9KJgNmNgUVzzqZZ6FE0moyIDNOpP7KtZAL0DvEZj6jqLbB0ccPQElrg52m
+Dv2/A3nYSr0mYBKeskT4+Bg7PGgoC8p7WyLSxMyzJEDYdtrj9OFx6eZaA23oqTQx
+k3Qq5H8RfNBeeSUEeKF7pKH/7gyqZ2bNzBFMA2EBZgBozwRfaeN/HCv3qbaCnwvu
+6caacmAsK+RxiYxSL1QsJqyhCWWGxVyenmxdc1KG/u5ypi7OIioztyzR3t2tAzD3
+Nb+2t8lgHBRxbV24yiPlnvPmB1ZYEctXnlRR9Evpl1o9xA9NnybPHKr9rozN39CZ
+V/USB8K6ao1y5xPZxa8CZksCAwEAAQ==
+-----END PUBLIC KEY-----
+
diff --git a/tools/releasetools/testdata/testkey_EC.key b/tools/releasetools/testdata/testkey_EC.key
new file mode 100644
index 0000000..9e65a68
--- /dev/null
+++ b/tools/releasetools/testdata/testkey_EC.key
@@ -0,0 +1,5 @@
+-----BEGIN PRIVATE KEY-----
+MIGHAgEAMBMGByqGSM49AgEGCCqGSM49AwEHBG0wawIBAQQgGaguGj8Yb1KkqKHd
+ISblUsjtOCbzAuVpX81i02sm8FWhRANCAARBnuotwKOsuvjH6iwTDhOAi7Q5pLWz
+xDkZjg2pcfbfi9FFTvLYETas7B2W6fx9PUezUmHTFTDV2JZuMYYFdZOw
+-----END PRIVATE KEY-----
diff --git a/tools/releasetools/testdata/vintf/kernel/SYSTEM/compatibility_matrix.xml b/tools/releasetools/testdata/vintf/kernel/SYSTEM/etc/vintf/compatibility_matrix.1.xml
similarity index 74%
rename from tools/releasetools/testdata/vintf/kernel/SYSTEM/compatibility_matrix.xml
rename to tools/releasetools/testdata/vintf/kernel/SYSTEM/etc/vintf/compatibility_matrix.1.xml
index ed46b6b..a92dd6e 100644
--- a/tools/releasetools/testdata/vintf/kernel/SYSTEM/compatibility_matrix.xml
+++ b/tools/releasetools/testdata/vintf/kernel/SYSTEM/etc/vintf/compatibility_matrix.1.xml
@@ -1,4 +1,4 @@
-<compatibility-matrix version="1.0" type="framework">
+<compatibility-matrix version="1.0" level="1" type="framework">
<kernel version="4.14.1" />
<sepolicy>
<sepolicy-version>0.0</sepolicy-version>
diff --git a/tools/releasetools/testdata/vintf/matrix_incompat/SYSTEM/compatibility_matrix.xml b/tools/releasetools/testdata/vintf/matrix_incompat/SYSTEM/etc/vintf/compatibility_matrix.1.xml
similarity index 71%
rename from tools/releasetools/testdata/vintf/matrix_incompat/SYSTEM/compatibility_matrix.xml
rename to tools/releasetools/testdata/vintf/matrix_incompat/SYSTEM/etc/vintf/compatibility_matrix.1.xml
index 5d891fa..1700e21 100644
--- a/tools/releasetools/testdata/vintf/matrix_incompat/SYSTEM/compatibility_matrix.xml
+++ b/tools/releasetools/testdata/vintf/matrix_incompat/SYSTEM/etc/vintf/compatibility_matrix.1.xml
@@ -1,4 +1,4 @@
-<compatibility-matrix version="1.0" type="framework">
+<compatibility-matrix version="1.0" level="1" type="framework">
<sepolicy>
<sepolicy-version>1.0</sepolicy-version>
<kernel-sepolicy-version>0</kernel-sepolicy-version>
diff --git a/tools/releasetools/testdata/vintf/sku_compat/SYSTEM/compatibility_matrix.xml b/tools/releasetools/testdata/vintf/sku_compat/SYSTEM/etc/vintf/compatibility_matrix.1.xml
similarity index 85%
rename from tools/releasetools/testdata/vintf/sku_compat/SYSTEM/compatibility_matrix.xml
rename to tools/releasetools/testdata/vintf/sku_compat/SYSTEM/etc/vintf/compatibility_matrix.1.xml
index 19a9b6a..22272fd 100644
--- a/tools/releasetools/testdata/vintf/sku_compat/SYSTEM/compatibility_matrix.xml
+++ b/tools/releasetools/testdata/vintf/sku_compat/SYSTEM/etc/vintf/compatibility_matrix.1.xml
@@ -1,4 +1,4 @@
-<compatibility-matrix version="1.0" type="framework">
+<compatibility-matrix version="1.0" level="1" type="framework">
<hal format="hidl" optional="false">
<name>foo</name>
<version>1.0</version>
diff --git a/tools/releasetools/testdata/vintf/sku_incompat/SYSTEM/compatibility_matrix.xml b/tools/releasetools/testdata/vintf/sku_incompat/SYSTEM/etc/vintf/compatibility_matrix.1.xml
similarity index 85%
rename from tools/releasetools/testdata/vintf/sku_incompat/SYSTEM/compatibility_matrix.xml
rename to tools/releasetools/testdata/vintf/sku_incompat/SYSTEM/etc/vintf/compatibility_matrix.1.xml
index e0e0d6c..1a3fc43 100644
--- a/tools/releasetools/testdata/vintf/sku_incompat/SYSTEM/compatibility_matrix.xml
+++ b/tools/releasetools/testdata/vintf/sku_incompat/SYSTEM/etc/vintf/compatibility_matrix.1.xml
@@ -1,4 +1,4 @@
-<compatibility-matrix version="1.0" type="framework">
+<compatibility-matrix version="1.0" level="1" type="framework">
<hal format="hidl" optional="false">
<name>foo</name>
<version>1.1</version>
diff --git a/tools/releasetools/validate_target_files.py b/tools/releasetools/validate_target_files.py
index c299a48..69be511 100755
--- a/tools/releasetools/validate_target_files.py
+++ b/tools/releasetools/validate_target_files.py
@@ -36,20 +36,21 @@
import os.path
import re
import zipfile
+from hashlib import sha1
import common
+import rangelib
def _ReadFile(file_name, unpacked_name, round_up=False):
"""Constructs and returns a File object. Rounds up its size if needed."""
-
assert os.path.exists(unpacked_name)
with open(unpacked_name, 'rb') as f:
file_data = f.read()
file_size = len(file_data)
if round_up:
file_size_rounded_up = common.RoundUpTo4K(file_size)
- file_data += '\0' * (file_size_rounded_up - file_size)
+ file_data += b'\0' * (file_size_rounded_up - file_size)
return common.File(file_name, file_data)
@@ -96,13 +97,15 @@
logging.warning('Skipping %s that has incomplete block list', entry)
continue
- # TODO(b/79951650): Handle files with non-monotonic ranges.
+ # If the file has non-monotonic ranges, read each range in order.
if not file_ranges.monotonic:
- logging.warning(
- 'Skipping %s that has non-monotonic ranges: %s', entry, file_ranges)
- continue
-
- blocks_sha1 = image.RangeSha1(file_ranges)
+ h = sha1()
+ for file_range in file_ranges.extra['text_str'].split(' '):
+ for data in image.ReadRangeSet(rangelib.RangeSet(file_range)):
+ h.update(data)
+ blocks_sha1 = h.hexdigest()
+ else:
+ blocks_sha1 = image.RangeSha1(file_ranges)
# The filename under unpacked directory, such as SYSTEM/bin/sh.
unpacked_name = os.path.join(
@@ -138,7 +141,7 @@
1. full recovery:
...
if ! applypatch --check type:device:size:sha1; then
- applypatch --flash /system/etc/recovery.img \\
+ applypatch --flash /vendor/etc/recovery.img \\
type:device:size:sha1 && \\
...
@@ -146,18 +149,26 @@
...
if ! applypatch --check type:recovery_device:recovery_size:recovery_sha1; then
applypatch [--bonus bonus_args] \\
- --patch /system/recovery-from-boot.p \\
+ --patch /vendor/recovery-from-boot.p \\
--source type:boot_device:boot_size:boot_sha1 \\
--target type:recovery_device:recovery_size:recovery_sha1 && \\
...
- For full recovery, we want to calculate the SHA-1 of /system/etc/recovery.img
+ For full recovery, we want to calculate the SHA-1 of /vendor/etc/recovery.img
and compare it against the one embedded in the script. While for recovery
from boot, we want to check the SHA-1 for both recovery.img and boot.img
under IMAGES/.
"""
- script_path = 'SYSTEM/bin/install-recovery.sh'
+ board_uses_vendorimage = info_dict.get("board_uses_vendorimage") == "true"
+
+ if board_uses_vendorimage:
+ script_path = 'VENDOR/bin/install-recovery.sh'
+ recovery_img = 'VENDOR/etc/recovery.img'
+ else:
+ script_path = 'SYSTEM/vendor/bin/install-recovery.sh'
+ recovery_img = 'SYSTEM/vendor/etc/recovery.img'
+
if not os.path.exists(os.path.join(input_tmp, script_path)):
logging.info('%s does not exist in input_tmp', script_path)
return
@@ -188,7 +199,7 @@
# Validate the SHA-1 of the recovery image.
recovery_sha1 = flash_partition.split(':')[3]
ValidateFileAgainstSha1(
- input_tmp, 'recovery.img', 'SYSTEM/etc/recovery.img', recovery_sha1)
+ input_tmp, 'recovery.img', recovery_img, recovery_sha1)
else:
assert len(lines) == 11, "Invalid line count: {}".format(lines)
@@ -335,20 +346,30 @@
key = info_dict['avb_vbmeta_key_path']
# avbtool verifies all the images that have descriptors listed in vbmeta.
+ # Using `--follow_chain_partitions` so it would additionally verify chained
+ # vbmeta partitions (e.g. vbmeta_system).
image = os.path.join(input_tmp, 'IMAGES', 'vbmeta.img')
cmd = [info_dict['avb_avbtool'], 'verify_image', '--image', image,
- '--key', key]
+ '--follow_chain_partitions']
+
+ # Custom images.
+ custom_partitions = info_dict.get(
+ "avb_custom_images_partition_list", "").strip().split()
# Append the args for chained partitions if any.
- for partition in common.AVB_PARTITIONS + common.AVB_VBMETA_PARTITIONS:
+ for partition in (common.AVB_PARTITIONS + common.AVB_VBMETA_PARTITIONS +
+ tuple(custom_partitions)):
key_name = 'avb_' + partition + '_key_path'
if info_dict.get(key_name) is not None:
+ if info_dict.get('ab_update') != 'true' and partition == 'recovery':
+ continue
+
# Use the key file from command line if specified; otherwise fall back
# to the one in info dict.
key_file = options.get(key_name, info_dict[key_name])
chained_partition_arg = common.GetAvbChainedPartitionArg(
partition, info_dict, key_file)
- cmd.extend(["--expected_chain_partition", chained_partition_arg])
+ cmd.extend(['--expected_chain_partition', chained_partition_arg])
proc = common.Run(cmd)
stdoutdata, _ = proc.communicate()
@@ -360,6 +381,22 @@
'Verified %s with avbtool (key: %s):\n%s', image, key,
stdoutdata.rstrip())
+ # avbtool verifies recovery image for non-A/B devices.
+ if (info_dict.get('ab_update') != 'true' and
+ info_dict.get('no_recovery') != 'true'):
+ image = os.path.join(input_tmp, 'IMAGES', 'recovery.img')
+ key = info_dict['avb_recovery_key_path']
+ cmd = [info_dict['avb_avbtool'], 'verify_image', '--image', image,
+ '--key', key]
+ proc = common.Run(cmd)
+ stdoutdata, _ = proc.communicate()
+ assert proc.returncode == 0, \
+ 'Failed to verify {} with avbtool (key: {}):\n{}'.format(
+ image, key, stdoutdata)
+ logging.info(
+ 'Verified %s with avbtool (key: %s):\n%s', image, key,
+ stdoutdata.rstrip())
+
def main():
parser = argparse.ArgumentParser(
diff --git a/tools/releasetools/verity_utils.py b/tools/releasetools/verity_utils.py
index e7f84f5..fc83689 100644
--- a/tools/releasetools/verity_utils.py
+++ b/tools/releasetools/verity_utils.py
@@ -695,3 +695,22 @@
raise HashtreeInfoGenerationError("Failed to reconstruct the verity tree")
return self.hashtree_info
+
+
+def CreateCustomImageBuilder(info_dict, partition_name, partition_size,
+ key_path, algorithm, signing_args):
+ builder = None
+ if info_dict.get("avb_enable") == "true":
+ builder = VerifiedBootVersion2VerityImageBuilder(
+ partition_name,
+ partition_size,
+ VerifiedBootVersion2VerityImageBuilder.AVB_HASHTREE_FOOTER,
+ info_dict.get("avb_avbtool"),
+ key_path,
+ algorithm,
+ # Salt is None because custom images have no fingerprint property to be
+ # used as the salt.
+ None,
+ signing_args)
+
+ return builder
diff --git a/tools/signapk/src/com/android/signapk/SignApk.java b/tools/signapk/src/com/android/signapk/SignApk.java
index 9809ed4..95ef05f 100644
--- a/tools/signapk/src/com/android/signapk/SignApk.java
+++ b/tools/signapk/src/com/android/signapk/SignApk.java
@@ -36,6 +36,7 @@
import com.android.apksig.ApkSignerEngine;
import com.android.apksig.DefaultApkSignerEngine;
+import com.android.apksig.SigningCertificateLineage;
import com.android.apksig.Hints;
import com.android.apksig.apk.ApkUtils;
import com.android.apksig.apk.MinSdkVersionException;
@@ -1042,6 +1043,7 @@
int alignment = 4;
Integer minSdkVersionOverride = null;
boolean signUsingApkSignatureSchemeV2 = true;
+ SigningCertificateLineage certLineage = null;
int argstart = 0;
while (argstart < args.length && args[argstart].startsWith("-")) {
@@ -1069,6 +1071,15 @@
} else if ("--disable-v2".equals(args[argstart])) {
signUsingApkSignatureSchemeV2 = false;
++argstart;
+ } else if ("--lineage".equals(args[argstart])) {
+ File lineageFile = new File(args[++argstart]);
+ try {
+ certLineage = SigningCertificateLineage.readFromFile(lineageFile);
+ } catch (Exception e) {
+ throw new IllegalArgumentException(
+ "Error reading lineage file: " + e.getMessage());
+ }
+ ++argstart;
} else {
usage();
}
@@ -1149,6 +1160,7 @@
.setV2SigningEnabled(signUsingApkSignatureSchemeV2)
.setOtherSignersSignaturesPreserved(false)
.setCreatedBy("1.0 (Android SignApk)")
+ .setSigningCertificateLineage(certLineage)
.build()) {
// We don't preserve the input APK's APK Signing Block (which contains v2
// signatures)
diff --git a/tools/warn.py b/tools/warn.py
index f91c811..22ac872 100755
--- a/tools/warn.py
+++ b/tools/warn.py
@@ -1,2686 +1,35 @@
#!/usr/bin/python
-# Prefer python3 but work also with python2.
+#
+# Copyright (C) 2019 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.
-"""Grep warnings messages and output HTML tables or warning counts in CSV.
+"""Call -m warn.warn to process warning messages.
-Default is to output warnings in HTML tables grouped by warning severity.
-Use option --byproject to output tables grouped by source file projects.
-Use option --gencsv to output warning counts in CSV format.
+This script is used by Android continuous build bots for all branches.
+Old frozen branches will continue to use the old warn.py, and active
+branches will use this new version to call -m warn.warn.
"""
-# List of important data structures and functions in this script.
-#
-# To parse and keep warning message in the input file:
-# severity: classification of message severity
-# severity.range [0, 1, ... last_severity_level]
-# severity.colors for header background
-# severity.column_headers for the warning count table
-# severity.headers for warning message tables
-# warn_patterns:
-# warn_patterns[w]['category'] tool that issued the warning, not used now
-# warn_patterns[w]['description'] table heading
-# warn_patterns[w]['members'] matched warnings from input
-# warn_patterns[w]['option'] compiler flag to control the warning
-# warn_patterns[w]['patterns'] regular expressions to match warnings
-# warn_patterns[w]['projects'][p] number of warnings of pattern w in p
-# warn_patterns[w]['severity'] severity level
-# project_list[p][0] project name
-# project_list[p][1] regular expression to match a project path
-# project_patterns[p] re.compile(project_list[p][1])
-# project_names[p] project_list[p][0]
-# warning_messages array of each warning message, without source url
-# warning_records array of [idx to warn_patterns,
-# idx to project_names,
-# idx to warning_messages]
-# android_root
-# platform_version
-# target_product
-# target_variant
-# compile_patterns, parse_input_file
-#
-# To emit html page of warning messages:
-# flags: --byproject, --url, --separator
-# Old stuff for static html components:
-# html_script_style: static html scripts and styles
-# htmlbig:
-# dump_stats, dump_html_prologue, dump_html_epilogue:
-# emit_buttons:
-# dump_fixed
-# sort_warnings:
-# emit_stats_by_project:
-# all_patterns,
-# findproject, classify_warning
-# dump_html
-#
-# New dynamic HTML page's static JavaScript data:
-# Some data are copied from Python to JavaScript, to generate HTML elements.
-# FlagURL args.url
-# FlagSeparator args.separator
-# SeverityColors: severity.colors
-# SeverityHeaders: severity.headers
-# SeverityColumnHeaders: severity.column_headers
-# ProjectNames: project_names, or project_list[*][0]
-# WarnPatternsSeverity: warn_patterns[*]['severity']
-# WarnPatternsDescription: warn_patterns[*]['description']
-# WarnPatternsOption: warn_patterns[*]['option']
-# WarningMessages: warning_messages
-# Warnings: warning_records
-# StatsHeader: warning count table header row
-# StatsRows: array of warning count table rows
-#
-# New dynamic HTML page's dynamic JavaScript data:
-#
-# New dynamic HTML related function to emit data:
-# escape_string, strip_escape_string, emit_warning_arrays
-# emit_js_data():
-
-from __future__ import print_function
-import argparse
-import cgi
-import csv
-import io
-import multiprocessing
import os
-import re
-import signal
+import subprocess
import sys
-parser = argparse.ArgumentParser(description='Convert a build log into HTML')
-parser.add_argument('--csvpath',
- help='Save CSV warning file to the passed absolute path',
- default=None)
-parser.add_argument('--gencsv',
- help='Generate a CSV file with number of various warnings',
- action='store_true',
- default=False)
-parser.add_argument('--byproject',
- help='Separate warnings in HTML output by project names',
- action='store_true',
- default=False)
-parser.add_argument('--url',
- help='Root URL of an Android source code tree prefixed '
- 'before files in warnings')
-parser.add_argument('--separator',
- help='Separator between the end of a URL and the line '
- 'number argument. e.g. #')
-parser.add_argument('--processes',
- type=int,
- default=multiprocessing.cpu_count(),
- help='Number of parallel processes to process warnings')
-parser.add_argument(dest='buildlog', metavar='build.log',
- help='Path to build.log file')
-args = parser.parse_args()
-
-
-class Severity(object):
- """Severity levels and attributes."""
- # numbered by dump order
- FIXMENOW = 0
- HIGH = 1
- MEDIUM = 2
- LOW = 3
- ANALYZER = 4
- TIDY = 5
- HARMLESS = 6
- UNKNOWN = 7
- SKIP = 8
- range = range(SKIP + 1)
- attributes = [
- # pylint:disable=bad-whitespace
- ['fuchsia', 'FixNow', 'Critical warnings, fix me now'],
- ['red', 'High', 'High severity warnings'],
- ['orange', 'Medium', 'Medium severity warnings'],
- ['yellow', 'Low', 'Low severity warnings'],
- ['hotpink', 'Analyzer', 'Clang-Analyzer warnings'],
- ['peachpuff', 'Tidy', 'Clang-Tidy warnings'],
- ['limegreen', 'Harmless', 'Harmless warnings'],
- ['lightblue', 'Unknown', 'Unknown warnings'],
- ['grey', 'Unhandled', 'Unhandled warnings']
- ]
- colors = [a[0] for a in attributes]
- column_headers = [a[1] for a in attributes]
- headers = [a[2] for a in attributes]
-
-
-def tidy_warn_pattern(description, pattern):
- return {
- 'category': 'C/C++',
- 'severity': Severity.TIDY,
- 'description': 'clang-tidy ' + description,
- 'patterns': [r'.*: .+\[' + pattern + r'\]$']
- }
-
-
-def simple_tidy_warn_pattern(description):
- return tidy_warn_pattern(description, description)
-
-
-def group_tidy_warn_pattern(description):
- return tidy_warn_pattern(description, description + r'-.+')
-
-
-def analyzer_high(description, patterns):
- # Important clang analyzer warnings to be fixed ASAP.
- return {
- 'category': 'C/C++',
- 'severity': Severity.HIGH,
- 'description': description,
- 'patterns': patterns
- }
-
-
-def analyzer_high_check(check):
- return analyzer_high(check, [r'.*: .+\[' + check + r'\]$'])
-
-
-def analyzer_group_high(check):
- return analyzer_high(check, [r'.*: .+\[' + check + r'.+\]$'])
-
-
-def analyzer_warn(description, patterns):
- return {
- 'category': 'C/C++',
- 'severity': Severity.ANALYZER,
- 'description': description,
- 'patterns': patterns
- }
-
-
-def analyzer_warn_check(check):
- return analyzer_warn(check, [r'.*: .+\[' + check + r'\]$'])
-
-
-def analyzer_group_check(check):
- return analyzer_warn(check, [r'.*: .+\[' + check + r'.+\]$'])
-
-
-def java_warn(severity, description, patterns):
- return {
- 'category': 'Java',
- 'severity': severity,
- 'description': 'Java: ' + description,
- 'patterns': patterns
- }
-
-
-def java_high(description, patterns):
- return java_warn(Severity.HIGH, description, patterns)
-
-
-def java_medium(description, patterns):
- return java_warn(Severity.MEDIUM, description, patterns)
-
-
-def java_low(description, patterns):
- return java_warn(Severity.LOW, description, patterns)
-
-
-warn_patterns = [
- # pylint:disable=line-too-long,g-inconsistent-quotes
- {'category': 'make', 'severity': Severity.MEDIUM,
- 'description': 'make: overriding commands/ignoring old commands',
- 'patterns': [r".*: warning: overriding commands for target .+",
- r".*: warning: ignoring old commands for target .+"]},
- {'category': 'make', 'severity': Severity.HIGH,
- 'description': 'make: LOCAL_CLANG is false',
- 'patterns': [r".*: warning: LOCAL_CLANG is set to false"]},
- {'category': 'make', 'severity': Severity.HIGH,
- 'description': 'SDK App using platform shared library',
- 'patterns': [r".*: warning: .+ \(.*app:sdk.*\) should not link to .+ \(native:platform\)"]},
- {'category': 'make', 'severity': Severity.HIGH,
- 'description': 'System module linking to a vendor module',
- 'patterns': [r".*: warning: .+ \(.+\) should not link to .+ \(partition:.+\)"]},
- {'category': 'make', 'severity': Severity.MEDIUM,
- 'description': 'Invalid SDK/NDK linking',
- 'patterns': [r".*: warning: .+ \(.+\) should not link to .+ \(.+\)"]},
- {'category': 'make', 'severity': Severity.MEDIUM,
- 'description': 'Duplicate header copy',
- 'patterns': [r".*: warning: Duplicate header copy: .+"]},
- {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wimplicit-function-declaration',
- 'description': 'Implicit function declaration',
- 'patterns': [r".*: warning: implicit declaration of function .+",
- r".*: warning: implicitly declaring library function"]},
- {'category': 'C/C++', 'severity': Severity.SKIP,
- 'description': 'skip, conflicting types for ...',
- 'patterns': [r".*: warning: conflicting types for '.+'"]},
- {'category': 'C/C++', 'severity': Severity.HIGH, 'option': '-Wtype-limits',
- 'description': 'Expression always evaluates to true or false',
- 'patterns': [r".*: warning: comparison is always .+ due to limited range of data type",
- r".*: warning: comparison of unsigned .*expression .+ is always true",
- r".*: warning: comparison of unsigned .*expression .+ is always false"]},
- # {'category': 'C/C++', 'severity': Severity.HIGH,
- # 'description': 'Potential leak of memory, bad free, use after free',
- # 'patterns': [r".*: warning: Potential leak of memory",
- # r".*: warning: Potential memory leak",
- # r".*: warning: Memory allocated by alloca\(\) should not be deallocated",
- # r".*: warning: Memory allocated by .+ should be deallocated by .+ not .+",
- # r".*: warning: 'delete' applied to a pointer that was allocated",
- # r".*: warning: Use of memory after it is freed",
- # r".*: warning: Argument to .+ is the address of .+ variable",
- # r".*: warning: Argument to free\(\) is offset by .+ of memory allocated by",
- # r".*: warning: Attempt to .+ released memory"]},
- {'category': 'C/C++', 'severity': Severity.HIGH,
- 'description': 'Use transient memory for control value',
- 'patterns': [r".*: warning: .+Using such transient memory for the control value is .*dangerous."]},
- {'category': 'C/C++', 'severity': Severity.HIGH,
- 'description': 'Return address of stack memory',
- 'patterns': [r".*: warning: Address of stack memory .+ returned to caller",
- r".*: warning: Address of stack memory .+ will be a dangling reference"]},
- # {'category': 'C/C++', 'severity': Severity.HIGH,
- # 'description': 'Problem with vfork',
- # 'patterns': [r".*: warning: This .+ is prohibited after a successful vfork",
- # r".*: warning: Call to function '.+' is insecure "]},
- {'category': 'C/C++', 'severity': Severity.HIGH, 'option': 'infinite-recursion',
- 'description': 'Infinite recursion',
- 'patterns': [r".*: warning: all paths through this function will call itself"]},
- {'category': 'C/C++', 'severity': Severity.HIGH,
- 'description': 'Potential buffer overflow',
- 'patterns': [r".*: warning: Size argument is greater than .+ the destination buffer",
- r".*: warning: Potential buffer overflow.",
- r".*: warning: String copy function overflows destination buffer"]},
- {'category': 'C/C++', 'severity': Severity.MEDIUM,
- 'description': 'Incompatible pointer types',
- 'patterns': [r".*: warning: assignment from incompatible pointer type",
- r".*: warning: return from incompatible pointer type",
- r".*: warning: passing argument [0-9]+ of '.*' from incompatible pointer type",
- r".*: warning: initialization from incompatible pointer type"]},
- {'category': 'C/C++', 'severity': Severity.HIGH, 'option': '-fno-builtin',
- 'description': 'Incompatible declaration of built in function',
- 'patterns': [r".*: warning: incompatible implicit declaration of built-in function .+"]},
- {'category': 'C/C++', 'severity': Severity.HIGH, 'option': '-Wincompatible-library-redeclaration',
- 'description': 'Incompatible redeclaration of library function',
- 'patterns': [r".*: warning: incompatible redeclaration of library function .+"]},
- {'category': 'C/C++', 'severity': Severity.HIGH,
- 'description': 'Null passed as non-null argument',
- 'patterns': [r".*: warning: Null passed to a callee that requires a non-null"]},
- {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wunused-parameter',
- 'description': 'Unused parameter',
- 'patterns': [r".*: warning: unused parameter '.*'"]},
- {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wunused',
- 'description': 'Unused function, variable, label, comparison, etc.',
- 'patterns': [r".*: warning: '.+' defined but not used",
- r".*: warning: unused function '.+'",
- r".*: warning: unused label '.+'",
- r".*: warning: relational comparison result unused",
- r".*: warning: lambda capture .* is not used",
- r".*: warning: private field '.+' is not used",
- r".*: warning: unused variable '.+'"]},
- {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wunused-value',
- 'description': 'Statement with no effect or result unused',
- 'patterns': [r".*: warning: statement with no effect",
- r".*: warning: expression result unused"]},
- {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wunused-result',
- 'description': 'Ignoreing return value of function',
- 'patterns': [r".*: warning: ignoring return value of function .+Wunused-result"]},
- {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wmissing-field-initializers',
- 'description': 'Missing initializer',
- 'patterns': [r".*: warning: missing initializer"]},
- {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wdelete-non-virtual-dtor',
- 'description': 'Need virtual destructor',
- 'patterns': [r".*: warning: delete called .* has virtual functions but non-virtual destructor"]},
- {'category': 'cont.', 'severity': Severity.SKIP,
- 'description': 'skip, near initialization for ...',
- 'patterns': [r".*: warning: \(near initialization for '.+'\)"]},
- {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wdate-time',
- 'description': 'Expansion of data or time macro',
- 'patterns': [r".*: warning: expansion of date or time macro is not reproducible"]},
- {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wexpansion-to-defined',
- 'description': 'Macro expansion has undefined behavior',
- 'patterns': [r".*: warning: macro expansion .* has undefined behavior"]},
- {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wformat',
- 'description': 'Format string does not match arguments',
- 'patterns': [r".*: warning: format '.+' expects type '.+', but argument [0-9]+ has type '.+'",
- r".*: warning: more '%' conversions than data arguments",
- r".*: warning: data argument not used by format string",
- r".*: warning: incomplete format specifier",
- r".*: warning: unknown conversion type .* in format",
- r".*: warning: format .+ expects .+ but argument .+Wformat=",
- r".*: warning: field precision should have .+ but argument has .+Wformat",
- r".*: warning: format specifies type .+ but the argument has .*type .+Wformat"]},
- {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wformat-extra-args',
- 'description': 'Too many arguments for format string',
- 'patterns': [r".*: warning: too many arguments for format"]},
- {'category': 'C/C++', 'severity': Severity.MEDIUM,
- 'description': 'Too many arguments in call',
- 'patterns': [r".*: warning: too many arguments in call to "]},
- {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wformat-invalid-specifier',
- 'description': 'Invalid format specifier',
- 'patterns': [r".*: warning: invalid .+ specifier '.+'.+format-invalid-specifier"]},
- {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wsign-compare',
- 'description': 'Comparison between signed and unsigned',
- 'patterns': [r".*: warning: comparison between signed and unsigned",
- r".*: warning: comparison of promoted \~unsigned with unsigned",
- r".*: warning: signed and unsigned type in conditional expression"]},
- {'category': 'C/C++', 'severity': Severity.MEDIUM,
- 'description': 'Comparison between enum and non-enum',
- 'patterns': [r".*: warning: enumeral and non-enumeral type in conditional expression"]},
- {'category': 'libpng', 'severity': Severity.MEDIUM,
- 'description': 'libpng: zero area',
- 'patterns': [r".*libpng warning: Ignoring attempt to set cHRM RGB triangle with zero area"]},
- {'category': 'aapt', 'severity': Severity.MEDIUM,
- 'description': 'aapt: no comment for public symbol',
- 'patterns': [r".*: warning: No comment for public symbol .+"]},
- {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wmissing-braces',
- 'description': 'Missing braces around initializer',
- 'patterns': [r".*: warning: missing braces around initializer.*"]},
- {'category': 'C/C++', 'severity': Severity.HARMLESS,
- 'description': 'No newline at end of file',
- 'patterns': [r".*: warning: no newline at end of file"]},
- {'category': 'C/C++', 'severity': Severity.HARMLESS,
- 'description': 'Missing space after macro name',
- 'patterns': [r".*: warning: missing whitespace after the macro name"]},
- {'category': 'C/C++', 'severity': Severity.LOW, 'option': '-Wcast-align',
- 'description': 'Cast increases required alignment',
- 'patterns': [r".*: warning: cast from .* to .* increases required alignment .*"]},
- {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wcast-qual',
- 'description': 'Qualifier discarded',
- 'patterns': [r".*: warning: passing argument [0-9]+ of '.+' discards qualifiers from pointer target type",
- r".*: warning: assignment discards qualifiers from pointer target type",
- r".*: warning: passing .+ to parameter of type .+ discards qualifiers",
- r".*: warning: assigning to .+ from .+ discards qualifiers",
- r".*: warning: initializing .+ discards qualifiers .+types-discards-qualifiers",
- r".*: warning: return discards qualifiers from pointer target type"]},
- {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wunknown-attributes',
- 'description': 'Unknown attribute',
- 'patterns': [r".*: warning: unknown attribute '.+'"]},
- {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wignored-attributes',
- 'description': 'Attribute ignored',
- 'patterns': [r".*: warning: '_*packed_*' attribute ignored",
- r".*: warning: attribute declaration must precede definition .+ignored-attributes"]},
- {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wvisibility',
- 'description': 'Visibility problem',
- 'patterns': [r".*: warning: declaration of '.+' will not be visible outside of this function"]},
- {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wattributes',
- 'description': 'Visibility mismatch',
- 'patterns': [r".*: warning: '.+' declared with greater visibility than the type of its field '.+'"]},
- {'category': 'C/C++', 'severity': Severity.MEDIUM,
- 'description': 'Shift count greater than width of type',
- 'patterns': [r".*: warning: (left|right) shift count >= width of type"]},
- {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wextern-initializer',
- 'description': 'extern <foo> is initialized',
- 'patterns': [r".*: warning: '.+' initialized and declared 'extern'",
- r".*: warning: 'extern' variable has an initializer"]},
- {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wold-style-declaration',
- 'description': 'Old style declaration',
- 'patterns': [r".*: warning: 'static' is not at beginning of declaration"]},
- {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wreturn-type',
- 'description': 'Missing return value',
- 'patterns': [r".*: warning: control reaches end of non-void function"]},
- {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wimplicit-int',
- 'description': 'Implicit int type',
- 'patterns': [r".*: warning: type specifier missing, defaults to 'int'",
- r".*: warning: type defaults to 'int' in declaration of '.+'"]},
- {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wmain-return-type',
- 'description': 'Main function should return int',
- 'patterns': [r".*: warning: return type of 'main' is not 'int'"]},
- {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wuninitialized',
- 'description': 'Variable may be used uninitialized',
- 'patterns': [r".*: warning: '.+' may be used uninitialized in this function"]},
- {'category': 'C/C++', 'severity': Severity.HIGH, 'option': '-Wuninitialized',
- 'description': 'Variable is used uninitialized',
- 'patterns': [r".*: warning: '.+' is used uninitialized in this function",
- r".*: warning: variable '.+' is uninitialized when used here"]},
- {'category': 'ld', 'severity': Severity.MEDIUM, 'option': '-fshort-enums',
- 'description': 'ld: possible enum size mismatch',
- 'patterns': [r".*: warning: .* uses variable-size enums yet the output is to use 32-bit enums; use of enum values across objects may fail"]},
- {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wpointer-sign',
- 'description': 'Pointer targets differ in signedness',
- 'patterns': [r".*: warning: pointer targets in initialization differ in signedness",
- r".*: warning: pointer targets in assignment differ in signedness",
- r".*: warning: pointer targets in return differ in signedness",
- r".*: warning: pointer targets in passing argument [0-9]+ of '.+' differ in signedness"]},
- {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wstrict-overflow',
- 'description': 'Assuming overflow does not occur',
- 'patterns': [r".*: warning: assuming signed overflow does not occur when assuming that .* is always (true|false)"]},
- {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wempty-body',
- 'description': 'Suggest adding braces around empty body',
- 'patterns': [r".*: warning: suggest braces around empty body in an 'if' statement",
- r".*: warning: empty body in an if-statement",
- r".*: warning: suggest braces around empty body in an 'else' statement",
- r".*: warning: empty body in an else-statement"]},
- {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wparentheses',
- 'description': 'Suggest adding parentheses',
- 'patterns': [r".*: warning: suggest explicit braces to avoid ambiguous 'else'",
- r".*: warning: suggest parentheses around arithmetic in operand of '.+'",
- r".*: warning: suggest parentheses around comparison in operand of '.+'",
- r".*: warning: logical not is only applied to the left hand side of this comparison",
- r".*: warning: using the result of an assignment as a condition without parentheses",
- r".*: warning: .+ has lower precedence than .+ be evaluated first .+Wparentheses",
- r".*: warning: suggest parentheses around '.+?' .+ '.+?'",
- r".*: warning: suggest parentheses around assignment used as truth value"]},
- {'category': 'C/C++', 'severity': Severity.MEDIUM,
- 'description': 'Static variable used in non-static inline function',
- 'patterns': [r".*: warning: '.+' is static but used in inline function '.+' which is not static"]},
- {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wimplicit int',
- 'description': 'No type or storage class (will default to int)',
- 'patterns': [r".*: warning: data definition has no type or storage class"]},
- # {'category': 'C/C++', 'severity': Severity.MEDIUM,
- # 'description': 'Null pointer',
- # 'patterns': [r".*: warning: Dereference of null pointer",
- # r".*: warning: Called .+ pointer is null",
- # r".*: warning: Forming reference to null pointer",
- # r".*: warning: Returning null reference",
- # r".*: warning: Null pointer passed as an argument to a 'nonnull' parameter",
- # r".*: warning: .+ results in a null pointer dereference",
- # r".*: warning: Access to .+ results in a dereference of a null pointer",
- # r".*: warning: Null pointer argument in"]},
- {'category': 'cont.', 'severity': Severity.SKIP,
- 'description': 'skip, parameter name (without types) in function declaration',
- 'patterns': [r".*: warning: parameter names \(without types\) in function declaration"]},
- {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wstrict-aliasing',
- 'description': 'Dereferencing <foo> breaks strict aliasing rules',
- 'patterns': [r".*: warning: dereferencing .* break strict-aliasing rules"]},
- {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wpointer-to-int-cast',
- 'description': 'Cast from pointer to integer of different size',
- 'patterns': [r".*: warning: cast from pointer to integer of different size",
- r".*: warning: initialization makes pointer from integer without a cast"]},
- {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wint-to-pointer-cast',
- 'description': 'Cast to pointer from integer of different size',
- 'patterns': [r".*: warning: cast to pointer from integer of different size"]},
- {'category': 'C/C++', 'severity': Severity.MEDIUM,
- 'description': 'Macro redefined',
- 'patterns': [r".*: warning: '.+' macro redefined"]},
- {'category': 'cont.', 'severity': Severity.SKIP,
- 'description': 'skip, ... location of the previous definition',
- 'patterns': [r".*: warning: this is the location of the previous definition"]},
- {'category': 'ld', 'severity': Severity.MEDIUM,
- 'description': 'ld: type and size of dynamic symbol are not defined',
- 'patterns': [r".*: warning: type and size of dynamic symbol `.+' are not defined"]},
- {'category': 'C/C++', 'severity': Severity.MEDIUM,
- 'description': 'Pointer from integer without cast',
- 'patterns': [r".*: warning: assignment makes pointer from integer without a cast"]},
- {'category': 'C/C++', 'severity': Severity.MEDIUM,
- 'description': 'Pointer from integer without cast',
- 'patterns': [r".*: warning: passing argument [0-9]+ of '.+' makes pointer from integer without a cast"]},
- {'category': 'C/C++', 'severity': Severity.MEDIUM,
- 'description': 'Integer from pointer without cast',
- 'patterns': [r".*: warning: assignment makes integer from pointer without a cast"]},
- {'category': 'C/C++', 'severity': Severity.MEDIUM,
- 'description': 'Integer from pointer without cast',
- 'patterns': [r".*: warning: passing argument [0-9]+ of '.+' makes integer from pointer without a cast"]},
- {'category': 'C/C++', 'severity': Severity.MEDIUM,
- 'description': 'Integer from pointer without cast',
- 'patterns': [r".*: warning: return makes integer from pointer without a cast"]},
- {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wunknown-pragmas',
- 'description': 'Ignoring pragma',
- 'patterns': [r".*: warning: ignoring #pragma .+"]},
- {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-W#pragma-messages',
- 'description': 'Pragma warning messages',
- 'patterns': [r".*: warning: .+W#pragma-messages"]},
- {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wclobbered',
- 'description': 'Variable might be clobbered by longjmp or vfork',
- 'patterns': [r".*: warning: variable '.+' might be clobbered by 'longjmp' or 'vfork'"]},
- {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wclobbered',
- 'description': 'Argument might be clobbered by longjmp or vfork',
- 'patterns': [r".*: warning: argument '.+' might be clobbered by 'longjmp' or 'vfork'"]},
- {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wredundant-decls',
- 'description': 'Redundant declaration',
- 'patterns': [r".*: warning: redundant redeclaration of '.+'"]},
- {'category': 'cont.', 'severity': Severity.SKIP,
- 'description': 'skip, previous declaration ... was here',
- 'patterns': [r".*: warning: previous declaration of '.+' was here"]},
- {'category': 'C/C++', 'severity': Severity.HIGH, 'option': '-Wswitch-enum',
- 'description': 'Enum value not handled in switch',
- 'patterns': [r".*: warning: .*enumeration value.* not handled in switch.+Wswitch"]},
- {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wuser-defined-warnings',
- 'description': 'User defined warnings',
- 'patterns': [r".*: warning: .* \[-Wuser-defined-warnings\]$"]},
-
- # Java warnings
- java_medium('Non-ascii characters used, but ascii encoding specified',
- [r".*: warning: unmappable character for encoding ascii"]),
- java_medium('Non-varargs call of varargs method with inexact argument type for last parameter',
- [r".*: warning: non-varargs call of varargs method with inexact argument type for last parameter"]),
- java_medium('Unchecked method invocation',
- [r".*: warning: \[unchecked\] unchecked method invocation: .+ in class .+"]),
- java_medium('Unchecked conversion',
- [r".*: warning: \[unchecked\] unchecked conversion"]),
- java_medium('_ used as an identifier',
- [r".*: warning: '_' used as an identifier"]),
- java_medium('hidden superclass',
- [r".*: warning: .* stripped of .* superclass .* \[HiddenSuperclass\]"]),
- java_high('Use of internal proprietary API',
- [r".*: warning: .* is internal proprietary API and may be removed"]),
-
- # Warnings from Javac
- java_medium('Use of deprecated member',
- [r'.*: warning: \[deprecation\] .+']),
- java_medium('Unchecked conversion',
- [r'.*: warning: \[unchecked\] .+']),
-
- # Begin warnings generated by Error Prone
- java_low('Use parameter comments to document ambiguous literals',
- [r".*: warning: \[BooleanParameter\] .+"]),
- java_low('This class\'s name looks like a Type Parameter.',
- [r".*: warning: \[ClassNamedLikeTypeParameter\] .+"]),
- java_low('Field name is CONSTANT_CASE, but field is not static and final',
- [r".*: warning: \[ConstantField\] .+"]),
- java_low('@Multibinds is a more efficient and declarative mechanism for ensuring that a set multibinding is present in the graph.',
- [r".*: warning: \[EmptySetMultibindingContributions\] .+"]),
- java_low('Prefer assertThrows to ExpectedException',
- [r".*: warning: \[ExpectedExceptionRefactoring\] .+"]),
- java_low('This field is only assigned during initialization; consider making it final',
- [r".*: warning: \[FieldCanBeFinal\] .+"]),
- java_low('Fields that can be null should be annotated @Nullable',
- [r".*: warning: \[FieldMissingNullable\] .+"]),
- java_low('Refactors uses of the JSR 305 @Immutable to Error Prone\'s annotation',
- [r".*: warning: \[ImmutableRefactoring\] .+"]),
- java_low(u'Use Java\'s utility functional interfaces instead of Function\u003cA, B> for primitive types.',
- [r".*: warning: \[LambdaFunctionalInterface\] .+"]),
- java_low('A private method that does not reference the enclosing instance can be static',
- [r".*: warning: \[MethodCanBeStatic\] .+"]),
- java_low('C-style array declarations should not be used',
- [r".*: warning: \[MixedArrayDimensions\] .+"]),
- java_low('Variable declarations should declare only one variable',
- [r".*: warning: \[MultiVariableDeclaration\] .+"]),
- java_low('Source files should not contain multiple top-level class declarations',
- [r".*: warning: \[MultipleTopLevelClasses\] .+"]),
- java_low('Avoid having multiple unary operators acting on the same variable in a method call',
- [r".*: warning: \[MultipleUnaryOperatorsInMethodCall\] .+"]),
- java_low('Package names should match the directory they are declared in',
- [r".*: warning: \[PackageLocation\] .+"]),
- java_low('Non-standard parameter comment; prefer `/* paramName= */ arg`',
- [r".*: warning: \[ParameterComment\] .+"]),
- java_low('Method parameters that aren\'t checked for null shouldn\'t be annotated @Nullable',
- [r".*: warning: \[ParameterNotNullable\] .+"]),
- java_low('Add a private constructor to modules that will not be instantiated by Dagger.',
- [r".*: warning: \[PrivateConstructorForNoninstantiableModule\] .+"]),
- java_low('Utility classes (only static members) are not designed to be instantiated and should be made noninstantiable with a default constructor.',
- [r".*: warning: \[PrivateConstructorForUtilityClass\] .+"]),
- java_low('Unused imports',
- [r".*: warning: \[RemoveUnusedImports\] .+"]),
- java_low('Methods that can return null should be annotated @Nullable',
- [r".*: warning: \[ReturnMissingNullable\] .+"]),
- java_low('Scopes on modules have no function and will soon be an error.',
- [r".*: warning: \[ScopeOnModule\] .+"]),
- java_low('The default case of a switch should appear at the end of the last statement group',
- [r".*: warning: \[SwitchDefault\] .+"]),
- java_low('Prefer assertThrows to @Test(expected=...)',
- [r".*: warning: \[TestExceptionRefactoring\] .+"]),
- java_low('Unchecked exceptions do not need to be declared in the method signature.',
- [r".*: warning: \[ThrowsUncheckedException\] .+"]),
- java_low('Prefer assertThrows to try/fail',
- [r".*: warning: \[TryFailRefactoring\] .+"]),
- java_low('Type parameters must be a single letter with an optional numeric suffix, or an UpperCamelCase name followed by the letter \'T\'.',
- [r".*: warning: \[TypeParameterNaming\] .+"]),
- java_low('Constructors and methods with the same name should appear sequentially with no other code in between. Please re-order or re-name methods.',
- [r".*: warning: \[UngroupedOverloads\] .+"]),
- java_low('Unnecessary call to NullPointerTester#setDefault',
- [r".*: warning: \[UnnecessarySetDefault\] .+"]),
- java_low('Using static imports for types is unnecessary',
- [r".*: warning: \[UnnecessaryStaticImport\] .+"]),
- java_low('@Binds is a more efficient and declarative mechanism for delegating a binding.',
- [r".*: warning: \[UseBinds\] .+"]),
- java_low('Wildcard imports, static or otherwise, should not be used',
- [r".*: warning: \[WildcardImport\] .+"]),
- java_medium('Method reference is ambiguous',
- [r".*: warning: \[AmbiguousMethodReference\] .+"]),
- java_medium('This method passes a pair of parameters through to String.format, but the enclosing method wasn\'t annotated @FormatMethod. Doing so gives compile-time rather than run-time protection against malformed format strings.',
- [r".*: warning: \[AnnotateFormatMethod\] .+"]),
- java_medium('Annotations should be positioned after Javadocs, but before modifiers..',
- [r".*: warning: \[AnnotationPosition\] .+"]),
- java_medium('Arguments are in the wrong order or could be commented for clarity.',
- [r".*: warning: \[ArgumentSelectionDefectChecker\] .+"]),
- java_medium('Arrays do not override equals() or hashCode, so comparisons will be done on reference equality only. If neither deduplication nor lookup are needed, consider using a List instead. Otherwise, use IdentityHashMap/Set, a Map from a library that handles object arrays, or an Iterable/List of pairs.',
- [r".*: warning: \[ArrayAsKeyOfSetOrMap\] .+"]),
- java_medium('Arguments are swapped in assertEquals-like call',
- [r".*: warning: \[AssertEqualsArgumentOrderChecker\] .+"]),
- java_medium('Assertions may be disabled at runtime and do not guarantee that execution will halt here; consider throwing an exception instead',
- [r".*: warning: \[AssertFalse\] .+"]),
- java_medium('The lambda passed to assertThrows should contain exactly one statement',
- [r".*: warning: \[AssertThrowsMultipleStatements\] .+"]),
- java_medium('This assertion throws an AssertionError if it fails, which will be caught by an enclosing try block.',
- [r".*: warning: \[AssertionFailureIgnored\] .+"]),
- java_medium('@AssistedInject and @Inject should not be used on different constructors in the same class.',
- [r".*: warning: \[AssistedInjectAndInjectOnConstructors\] .+"]),
- java_medium('Make toString(), hashCode() and equals() final in AutoValue classes, so it is clear to readers that AutoValue is not overriding them',
- [r".*: warning: \[AutoValueFinalMethods\] .+"]),
- java_medium('Classes that implement Annotation must override equals and hashCode. Consider using AutoAnnotation instead of implementing Annotation by hand.',
- [r".*: warning: \[BadAnnotationImplementation\] .+"]),
- java_medium('Possible sign flip from narrowing conversion',
- [r".*: warning: \[BadComparable\] .+"]),
- java_medium('Importing nested classes/static methods/static fields with commonly-used names can make code harder to read, because it may not be clear from the context exactly which type is being referred to. Qualifying the name with that of the containing class can make the code clearer.',
- [r".*: warning: \[BadImport\] .+"]),
- java_medium('instanceof used in a way that is equivalent to a null check.',
- [r".*: warning: \[BadInstanceof\] .+"]),
- java_medium('BigDecimal#equals has surprising behavior: it also compares scale.',
- [r".*: warning: \[BigDecimalEquals\] .+"]),
- java_medium('new BigDecimal(double) loses precision in this case.',
- [r".*: warning: \[BigDecimalLiteralDouble\] .+"]),
- java_medium('A call to Binder.clearCallingIdentity() should be followed by Binder.restoreCallingIdentity() in a finally block. Otherwise the wrong Binder identity may be used by subsequent code.',
- [r".*: warning: \[BinderIdentityRestoredDangerously\] .+"]),
- java_medium('This code declares a binding for a common value type without a Qualifier annotation.',
- [r".*: warning: \[BindingToUnqualifiedCommonType\] .+"]),
- java_medium('valueOf or autoboxing provides better time and space performance',
- [r".*: warning: \[BoxedPrimitiveConstructor\] .+"]),
- java_medium('ByteBuffer.array() shouldn\'t be called unless ByteBuffer.arrayOffset() is used or if the ByteBuffer was initialized using ByteBuffer.wrap() or ByteBuffer.allocate().',
- [r".*: warning: \[ByteBufferBackingArray\] .+"]),
- java_medium('Mockito cannot mock final classes',
- [r".*: warning: \[CannotMockFinalClass\] .+"]),
- java_medium('Duration can be expressed more clearly with different units',
- [r".*: warning: \[CanonicalDuration\] .+"]),
- java_medium('Logging or rethrowing exceptions should usually be preferred to catching and calling printStackTrace',
- [r".*: warning: \[CatchAndPrintStackTrace\] .+"]),
- java_medium('Ignoring exceptions and calling fail() is unnecessary, and makes test output less useful',
- [r".*: warning: \[CatchFail\] .+"]),
- java_medium('Inner class is non-static but does not reference enclosing class',
- [r".*: warning: \[ClassCanBeStatic\] .+"]),
- java_medium('Class.newInstance() bypasses exception checking; prefer getDeclaredConstructor().newInstance()',
- [r".*: warning: \[ClassNewInstance\] .+"]),
- java_medium('Providing Closeable resources makes their lifecycle unclear',
- [r".*: warning: \[CloseableProvides\] .+"]),
- java_medium('The type of the array parameter of Collection.toArray needs to be compatible with the array type',
- [r".*: warning: \[CollectionToArraySafeParameter\] .+"]),
- java_medium('Collector.of() should not use state',
- [r".*: warning: \[CollectorShouldNotUseState\] .+"]),
- java_medium('Class should not implement both `Comparable` and `Comparator`',
- [r".*: warning: \[ComparableAndComparator\] .+"]),
- java_medium('Constructors should not invoke overridable methods.',
- [r".*: warning: \[ConstructorInvokesOverridable\] .+"]),
- java_medium('Constructors should not pass the \'this\' reference out in method invocations, since the object may not be fully constructed.',
- [r".*: warning: \[ConstructorLeaksThis\] .+"]),
- java_medium('DateFormat is not thread-safe, and should not be used as a constant field.',
- [r".*: warning: \[DateFormatConstant\] .+"]),
- java_medium('Implicit use of the platform default charset, which can result in differing behaviour between JVM executions or incorrect behavior if the encoding of the data source doesn\'t match expectations.',
- [r".*: warning: \[DefaultCharset\] .+"]),
- java_medium('Avoid deprecated Thread methods; read the method\'s javadoc for details.',
- [r".*: warning: \[DeprecatedThreadMethods\] .+"]),
- java_medium('Prefer collection factory methods or builders to the double-brace initialization pattern.',
- [r".*: warning: \[DoubleBraceInitialization\] .+"]),
- java_medium('Double-checked locking on non-volatile fields is unsafe',
- [r".*: warning: \[DoubleCheckedLocking\] .+"]),
- java_medium('Empty top-level type declaration',
- [r".*: warning: \[EmptyTopLevelDeclaration\] .+"]),
- java_medium('equals() implementation may throw NullPointerException when given null',
- [r".*: warning: \[EqualsBrokenForNull\] .+"]),
- java_medium('Overriding Object#equals in a non-final class by using getClass rather than instanceof breaks substitutability of subclasses.',
- [r".*: warning: \[EqualsGetClass\] .+"]),
- java_medium('Classes that override equals should also override hashCode.',
- [r".*: warning: \[EqualsHashCode\] .+"]),
- java_medium('An equality test between objects with incompatible types always returns false',
- [r".*: warning: \[EqualsIncompatibleType\] .+"]),
- java_medium('The contract of #equals states that it should return false for incompatible types, while this implementation may throw ClassCastException.',
- [r".*: warning: \[EqualsUnsafeCast\] .+"]),
- java_medium('Implementing #equals by just comparing hashCodes is fragile. Hashes collide frequently, and this will lead to false positives in #equals.',
- [r".*: warning: \[EqualsUsingHashCode\] .+"]),
- java_medium('Calls to ExpectedException#expect should always be followed by exactly one statement.',
- [r".*: warning: \[ExpectedExceptionChecker\] .+"]),
- java_medium('When only using JUnit Assert\'s static methods, you should import statically instead of extending.',
- [r".*: warning: \[ExtendingJUnitAssert\] .+"]),
- java_medium('Switch case may fall through',
- [r".*: warning: \[FallThrough\] .+"]),
- java_medium('If you return or throw from a finally, then values returned or thrown from the try-catch block will be ignored. Consider using try-with-resources instead.',
- [r".*: warning: \[Finally\] .+"]),
- java_medium('Use parentheses to make the precedence explicit',
- [r".*: warning: \[FloatCast\] .+"]),
- java_medium('This fuzzy equality check is using a tolerance less than the gap to the next number. You may want a less restrictive tolerance, or to assert equality.',
- [r".*: warning: \[FloatingPointAssertionWithinEpsilon\] .+"]),
- java_medium('Floating point literal loses precision',
- [r".*: warning: \[FloatingPointLiteralPrecision\] .+"]),
- java_medium('Classes extending PreferenceActivity must implement isValidFragment such that it does not unconditionally return true to prevent vulnerability to fragment injection attacks.',
- [r".*: warning: \[FragmentInjection\] .+"]),
- java_medium('Subclasses of Fragment must be instantiable via Class#newInstance(): the class must be public, static and have a public nullary constructor',
- [r".*: warning: \[FragmentNotInstantiable\] .+"]),
- java_medium('Overloads will be ambiguous when passing lambda arguments',
- [r".*: warning: \[FunctionalInterfaceClash\] .+"]),
- java_medium('Return value of methods returning Future must be checked. Ignoring returned Futures suppresses exceptions thrown from the code that completes the Future.',
- [r".*: warning: \[FutureReturnValueIgnored\] .+"]),
- java_medium('Calling getClass() on an enum may return a subclass of the enum type',
- [r".*: warning: \[GetClassOnEnum\] .+"]),
- java_medium('Hardcoded reference to /sdcard',
- [r".*: warning: \[HardCodedSdCardPath\] .+"]),
- java_medium('Hiding fields of superclasses may cause confusion and errors',
- [r".*: warning: \[HidingField\] .+"]),
- java_medium('Annotations should always be immutable',
- [r".*: warning: \[ImmutableAnnotationChecker\] .+"]),
- java_medium('Enums should always be immutable',
- [r".*: warning: \[ImmutableEnumChecker\] .+"]),
- java_medium('This annotation has incompatible modifiers as specified by its @IncompatibleModifiers annotation',
- [r".*: warning: \[IncompatibleModifiers\] .+"]),
- java_medium('It is confusing to have a field and a parameter under the same scope that differ only in capitalization.',
- [r".*: warning: \[InconsistentCapitalization\] .+"]),
- java_medium('Including fields in hashCode which are not compared in equals violates the contract of hashCode.',
- [r".*: warning: \[InconsistentHashCode\] .+"]),
- java_medium('The ordering of parameters in overloaded methods should be as consistent as possible (when viewed from left to right)',
- [r".*: warning: \[InconsistentOverloads\] .+"]),
- java_medium('This for loop increments the same variable in the header and in the body',
- [r".*: warning: \[IncrementInForLoopAndHeader\] .+"]),
- java_medium('Constructors on abstract classes are never directly @Injected, only the constructors of their subclasses can be @Inject\'ed.',
- [r".*: warning: \[InjectOnConstructorOfAbstractClass\] .+"]),
- java_medium('Please also override int read(byte[], int, int), otherwise multi-byte reads from this input stream are likely to be slow.',
- [r".*: warning: \[InputStreamSlowMultibyteRead\] .+"]),
- java_medium('Casting inside an if block should be plausibly consistent with the instanceof type',
- [r".*: warning: \[InstanceOfAndCastMatchWrongType\] .+"]),
- java_medium('Expression of type int may overflow before being assigned to a long',
- [r".*: warning: \[IntLongMath\] .+"]),
- java_medium('This @param tag doesn\'t refer to a parameter of the method.',
- [r".*: warning: \[InvalidParam\] .+"]),
- java_medium('This tag is invalid.',
- [r".*: warning: \[InvalidTag\] .+"]),
- java_medium('The documented method doesn\'t actually throw this checked exception.',
- [r".*: warning: \[InvalidThrows\] .+"]),
- java_medium('Class should not implement both `Iterable` and `Iterator`',
- [r".*: warning: \[IterableAndIterator\] .+"]),
- java_medium('Floating-point comparison without error tolerance',
- [r".*: warning: \[JUnit3FloatingPointComparisonWithoutDelta\] .+"]),
- java_medium('Some JUnit4 construct cannot be used in a JUnit3 context. Convert your class to JUnit4 style to use them.',
- [r".*: warning: \[JUnit4ClassUsedInJUnit3\] .+"]),
- java_medium('Test class inherits from JUnit 3\'s TestCase but has JUnit 4 @Test annotations.',
- [r".*: warning: \[JUnitAmbiguousTestClass\] .+"]),
- java_medium('Never reuse class names from java.lang',
- [r".*: warning: \[JavaLangClash\] .+"]),
- java_medium('Suggests alternatives to obsolete JDK classes.',
- [r".*: warning: \[JdkObsolete\] .+"]),
- java_medium('Calls to Lock#lock should be immediately followed by a try block which releases the lock.',
- [r".*: warning: \[LockNotBeforeTry\] .+"]),
- java_medium('Assignment where a boolean expression was expected; use == if this assignment wasn\'t expected or add parentheses for clarity.',
- [r".*: warning: \[LogicalAssignment\] .+"]),
- java_medium('Math.abs does not always give a positive result. Please consider other methods for positive random numbers.',
- [r".*: warning: \[MathAbsoluteRandom\] .+"]),
- java_medium('Switches on enum types should either handle all values, or have a default case.',
- [r".*: warning: \[MissingCasesInEnumSwitch\] .+"]),
- java_medium('The Google Java Style Guide requires that each switch statement includes a default statement group, even if it contains no code. (This requirement is lifted for any switch statement that covers all values of an enum.)',
- [r".*: warning: \[MissingDefault\] .+"]),
- java_medium('Not calling fail() when expecting an exception masks bugs',
- [r".*: warning: \[MissingFail\] .+"]),
- java_medium('method overrides method in supertype; expected @Override',
- [r".*: warning: \[MissingOverride\] .+"]),
- java_medium('A collection or proto builder was created, but its values were never accessed.',
- [r".*: warning: \[ModifiedButNotUsed\] .+"]),
- java_medium('Modifying a collection while iterating over it in a loop may cause a ConcurrentModificationException to be thrown.',
- [r".*: warning: \[ModifyCollectionInEnhancedForLoop\] .+"]),
- java_medium('Multiple calls to either parallel or sequential are unnecessary and cause confusion.',
- [r".*: warning: \[MultipleParallelOrSequentialCalls\] .+"]),
- java_medium('Constant field declarations should use the immutable type (such as ImmutableList) instead of the general collection interface type (such as List)',
- [r".*: warning: \[MutableConstantField\] .+"]),
- java_medium('Method return type should use the immutable type (such as ImmutableList) instead of the general collection interface type (such as List)',
- [r".*: warning: \[MutableMethodReturnType\] .+"]),
- java_medium('Compound assignments may hide dangerous casts',
- [r".*: warning: \[NarrowingCompoundAssignment\] .+"]),
- java_medium('Nested instanceOf conditions of disjoint types create blocks of code that never execute',
- [r".*: warning: \[NestedInstanceOfConditions\] .+"]),
- java_medium('Instead of returning a functional type, return the actual type that the returned function would return and use lambdas at use site.',
- [r".*: warning: \[NoFunctionalReturnType\] .+"]),
- java_medium('This update of a volatile variable is non-atomic',
- [r".*: warning: \[NonAtomicVolatileUpdate\] .+"]),
- java_medium('Static import of member uses non-canonical name',
- [r".*: warning: \[NonCanonicalStaticMemberImport\] .+"]),
- java_medium('equals method doesn\'t override Object.equals',
- [r".*: warning: \[NonOverridingEquals\] .+"]),
- java_medium('Constructors should not be annotated with @Nullable since they cannot return null',
- [r".*: warning: \[NullableConstructor\] .+"]),
- java_medium('Dereference of possibly-null value',
- [r".*: warning: \[NullableDereference\] .+"]),
- java_medium('@Nullable should not be used for primitive types since they cannot be null',
- [r".*: warning: \[NullablePrimitive\] .+"]),
- java_medium('void-returning methods should not be annotated with @Nullable, since they cannot return null',
- [r".*: warning: \[NullableVoid\] .+"]),
- java_medium('Calling toString on Objects that don\'t override toString() doesn\'t provide useful information',
- [r".*: warning: \[ObjectToString\] .+"]),
- java_medium('Objects.hashCode(Object o) should not be passed a primitive value',
- [r".*: warning: \[ObjectsHashCodePrimitive\] .+"]),
- java_medium('Use grouping parenthesis to make the operator precedence explicit',
- [r".*: warning: \[OperatorPrecedence\] .+"]),
- java_medium('One should not call optional.get() inside an if statement that checks !optional.isPresent',
- [r".*: warning: \[OptionalNotPresent\] .+"]),
- java_medium('String literal contains format specifiers, but is not passed to a format method',
- [r".*: warning: \[OrphanedFormatString\] .+"]),
- java_medium('To return a custom message with a Throwable class, one should override getMessage() instead of toString() for Throwable.',
- [r".*: warning: \[OverrideThrowableToString\] .+"]),
- java_medium('Varargs doesn\'t agree for overridden method',
- [r".*: warning: \[Overrides\] .+"]),
- java_medium('This method is not annotated with @Inject, but it overrides a method that is annotated with @com.google.inject.Inject. Guice will inject this method, and it is recommended to annotate it explicitly.',
- [r".*: warning: \[OverridesGuiceInjectableMethod\] .+"]),
- java_medium('Detects `/* name= */`-style comments on actual parameters where the name doesn\'t match the formal parameter',
- [r".*: warning: \[ParameterName\] .+"]),
- java_medium('Preconditions only accepts the %s placeholder in error message strings',
- [r".*: warning: \[PreconditionsInvalidPlaceholder\] .+"]),
- java_medium('Passing a primitive array to a varargs method is usually wrong',
- [r".*: warning: \[PrimitiveArrayPassedToVarargsMethod\] .+"]),
- java_medium('A field on a protocol buffer was set twice in the same chained expression.',
- [r".*: warning: \[ProtoRedundantSet\] .+"]),
- java_medium('Protos should not be used as a key to a map, in a set, or in a contains method on a descendant of a collection. Protos have non deterministic ordering and proto equality is deep, which is a performance issue.',
- [r".*: warning: \[ProtosAsKeyOfSetOrMap\] .+"]),
- java_medium('BugChecker has incorrect ProvidesFix tag, please update',
- [r".*: warning: \[ProvidesFix\] .+"]),
- java_medium('Qualifiers/Scope annotations on @Inject methods don\'t have any effect. Move the qualifier annotation to the binding location.',
- [r".*: warning: \[QualifierOrScopeOnInjectMethod\] .+"]),
- java_medium('Injection frameworks currently don\'t understand Qualifiers in TYPE_PARAMETER or TYPE_USE contexts.',
- [r".*: warning: \[QualifierWithTypeUse\] .+"]),
- java_medium('reachabilityFence should always be called inside a finally block',
- [r".*: warning: \[ReachabilityFenceUsage\] .+"]),
- java_medium('Thrown exception is a subtype of another',
- [r".*: warning: \[RedundantThrows\] .+"]),
- java_medium('Comparison using reference equality instead of value equality',
- [r".*: warning: \[ReferenceEquality\] .+"]),
- java_medium('This annotation is missing required modifiers as specified by its @RequiredModifiers annotation',
- [r".*: warning: \[RequiredModifiers\] .+"]),
- java_medium('Void methods should not have a @return tag.',
- [r".*: warning: \[ReturnFromVoid\] .+"]),
- java_medium(u'Prefer the short-circuiting boolean operators \u0026\u0026 and || to \u0026 and |.',
- [r".*: warning: \[ShortCircuitBoolean\] .+"]),
- java_medium('Writes to static fields should not be guarded by instance locks',
- [r".*: warning: \[StaticGuardedByInstance\] .+"]),
- java_medium('A static variable or method should be qualified with a class name, not expression',
- [r".*: warning: \[StaticQualifiedUsingExpression\] .+"]),
- java_medium('Streams that encapsulate a closeable resource should be closed using try-with-resources',
- [r".*: warning: \[StreamResourceLeak\] .+"]),
- java_medium('String comparison using reference equality instead of value equality',
- [r".*: warning: \[StringEquality\] .+"]),
- java_medium('String.split(String) has surprising behavior',
- [r".*: warning: \[StringSplitter\] .+"]),
- java_medium('SWIG generated code that can\'t call a C++ destructor will leak memory',
- [r".*: warning: \[SwigMemoryLeak\] .+"]),
- java_medium('Synchronizing on non-final fields is not safe: if the field is ever updated, different threads may end up locking on different objects.',
- [r".*: warning: \[SynchronizeOnNonFinalField\] .+"]),
- java_medium('Code that contains System.exit() is untestable.',
- [r".*: warning: \[SystemExitOutsideMain\] .+"]),
- java_medium('Using @Test(expected=...) is discouraged, since the test will pass if *any* statement in the test method throws the expected exception',
- [r".*: warning: \[TestExceptionChecker\] .+"]),
- java_medium('Thread.join needs to be surrounded by a loop until it succeeds, as in Uninterruptibles.joinUninterruptibly.',
- [r".*: warning: \[ThreadJoinLoop\] .+"]),
- java_medium('ThreadLocals should be stored in static fields',
- [r".*: warning: \[ThreadLocalUsage\] .+"]),
- java_medium('Relying on the thread scheduler is discouraged; see Effective Java Item 72 (2nd edition) / 84 (3rd edition).',
- [r".*: warning: \[ThreadPriorityCheck\] .+"]),
- java_medium('Three-letter time zone identifiers are deprecated, may be ambiguous, and might not do what you intend; the full IANA time zone ID should be used instead.',
- [r".*: warning: \[ThreeLetterTimeZoneID\] .+"]),
- java_medium('An implementation of Object.toString() should never return null.',
- [r".*: warning: \[ToStringReturnsNull\] .+"]),
- java_medium('The actual and expected values appear to be swapped, which results in poor assertion failure messages. The actual value should come first.',
- [r".*: warning: \[TruthAssertExpected\] .+"]),
- java_medium('Truth Library assert is called on a constant.',
- [r".*: warning: \[TruthConstantAsserts\] .+"]),
- java_medium('Argument is not compatible with the subject\'s type.',
- [r".*: warning: \[TruthIncompatibleType\] .+"]),
- java_medium('Type parameter declaration shadows another named type',
- [r".*: warning: \[TypeNameShadowing\] .+"]),
- java_medium('Type parameter declaration overrides another type parameter already declared',
- [r".*: warning: \[TypeParameterShadowing\] .+"]),
- java_medium('Declaring a type parameter that is only used in the return type is a misuse of generics: operations on the type parameter are unchecked, it hides unsafe casts at invocations of the method, and it interacts badly with method overload resolution.',
- [r".*: warning: \[TypeParameterUnusedInFormals\] .+"]),
- java_medium('Avoid hash-based containers of java.net.URL--the containers rely on equals() and hashCode(), which cause java.net.URL to make blocking internet connections.',
- [r".*: warning: \[URLEqualsHashCode\] .+"]),
- java_medium('Collection, Iterable, Multimap, and Queue do not have well-defined equals behavior',
- [r".*: warning: \[UndefinedEquals\] .+"]),
- java_medium('Switch handles all enum values: an explicit default case is unnecessary and defeats error checking for non-exhaustive switches.',
- [r".*: warning: \[UnnecessaryDefaultInEnumSwitch\] .+"]),
- java_medium('Unnecessary use of grouping parentheses',
- [r".*: warning: \[UnnecessaryParentheses\] .+"]),
- java_medium('Finalizer may run before native code finishes execution',
- [r".*: warning: \[UnsafeFinalization\] .+"]),
- java_medium('Prefer `asSubclass` instead of casting the result of `newInstance`, to detect classes of incorrect type before invoking their constructors.This way, if the class is of the incorrect type,it will throw an exception before invoking its constructor.',
- [r".*: warning: \[UnsafeReflectiveConstructionCast\] .+"]),
- java_medium('Unsynchronized method overrides a synchronized method.',
- [r".*: warning: \[UnsynchronizedOverridesSynchronized\] .+"]),
- java_medium('Unused.',
- [r".*: warning: \[Unused\] .+"]),
- java_medium('This catch block catches an exception and re-throws another, but swallows the caught exception rather than setting it as a cause. This can make debugging harder.',
- [r".*: warning: \[UnusedException\] .+"]),
- java_medium('Java assert is used in test. For testing purposes Assert.* matchers should be used.',
- [r".*: warning: \[UseCorrectAssertInTests\] .+"]),
- java_medium('Non-constant variable missing @Var annotation',
- [r".*: warning: \[Var\] .+"]),
- java_medium('variableName and type with the same name would refer to the static field instead of the class',
- [r".*: warning: \[VariableNameSameAsType\] .+"]),
- java_medium('Because of spurious wakeups, Object.wait() and Condition.await() must always be called in a loop',
- [r".*: warning: \[WaitNotInLoop\] .+"]),
- java_medium('A wakelock acquired with a timeout may be released by the system before calling `release`, even after checking `isHeld()`. If so, it will throw a RuntimeException. Please wrap in a try/catch block.',
- [r".*: warning: \[WakelockReleasedDangerously\] .+"]),
- java_high('AndroidInjection.inject() should always be invoked before calling super.lifecycleMethod()',
- [r".*: warning: \[AndroidInjectionBeforeSuper\] .+"]),
- java_high('Use of class, field, or method that is not compatible with legacy Android devices',
- [r".*: warning: \[AndroidJdkLibsChecker\] .+"]),
- java_high('Reference equality used to compare arrays',
- [r".*: warning: \[ArrayEquals\] .+"]),
- java_high('Arrays.fill(Object[], Object) called with incompatible types.',
- [r".*: warning: \[ArrayFillIncompatibleType\] .+"]),
- java_high('hashcode method on array does not hash array contents',
- [r".*: warning: \[ArrayHashCode\] .+"]),
- java_high('Calling toString on an array does not provide useful information',
- [r".*: warning: \[ArrayToString\] .+"]),
- java_high('Arrays.asList does not autobox primitive arrays, as one might expect.',
- [r".*: warning: \[ArraysAsListPrimitiveArray\] .+"]),
- java_high('@AssistedInject and @Inject cannot be used on the same constructor.',
- [r".*: warning: \[AssistedInjectAndInjectOnSameConstructor\] .+"]),
- java_high('AsyncCallable should not return a null Future, only a Future whose result is null.',
- [r".*: warning: \[AsyncCallableReturnsNull\] .+"]),
- java_high('AsyncFunction should not return a null Future, only a Future whose result is null.',
- [r".*: warning: \[AsyncFunctionReturnsNull\] .+"]),
- java_high('@AutoFactory and @Inject should not be used in the same type.',
- [r".*: warning: \[AutoFactoryAtInject\] .+"]),
- java_high('Arguments to AutoValue constructor are in the wrong order',
- [r".*: warning: \[AutoValueConstructorOrderChecker\] .+"]),
- java_high('Shift by an amount that is out of range',
- [r".*: warning: \[BadShiftAmount\] .+"]),
- java_high('Object serialized in Bundle may have been flattened to base type.',
- [r".*: warning: \[BundleDeserializationCast\] .+"]),
- java_high('The called constructor accepts a parameter with the same name and type as one of its caller\'s parameters, but its caller doesn\'t pass that parameter to it. It\'s likely that it was intended to.',
- [r".*: warning: \[ChainingConstructorIgnoresParameter\] .+"]),
- java_high('Ignored return value of method that is annotated with @CheckReturnValue',
- [r".*: warning: \[CheckReturnValue\] .+"]),
- java_high('The source file name should match the name of the top-level class it contains',
- [r".*: warning: \[ClassName\] .+"]),
- java_high('Incompatible type as argument to Object-accepting Java collections method',
- [r".*: warning: \[CollectionIncompatibleType\] .+"]),
- java_high(u'Implementing \'Comparable\u003cT>\' where T is not compatible with the implementing class.',
- [r".*: warning: \[ComparableType\] .+"]),
- java_high('this == null is always false, this != null is always true',
- [r".*: warning: \[ComparingThisWithNull\] .+"]),
- java_high('This comparison method violates the contract',
- [r".*: warning: \[ComparisonContractViolated\] .+"]),
- java_high('Comparison to value that is out of range for the compared type',
- [r".*: warning: \[ComparisonOutOfRange\] .+"]),
- java_high('@CompatibleWith\'s value is not a type argument.',
- [r".*: warning: \[CompatibleWithAnnotationMisuse\] .+"]),
- java_high('Non-compile-time constant expression passed to parameter with @CompileTimeConstant type annotation.',
- [r".*: warning: \[CompileTimeConstant\] .+"]),
- java_high('Non-trivial compile time constant boolean expressions shouldn\'t be used.',
- [r".*: warning: \[ComplexBooleanConstant\] .+"]),
- java_high('A conditional expression with numeric operands of differing types will perform binary numeric promotion of the operands; when these operands are of reference types, the expression\'s result may not be of the expected type.',
- [r".*: warning: \[ConditionalExpressionNumericPromotion\] .+"]),
- java_high('Compile-time constant expression overflows',
- [r".*: warning: \[ConstantOverflow\] .+"]),
- java_high('Dagger @Provides methods may not return null unless annotated with @Nullable',
- [r".*: warning: \[DaggerProvidesNull\] .+"]),
- java_high('Exception created but not thrown',
- [r".*: warning: \[DeadException\] .+"]),
- java_high('Thread created but not started',
- [r".*: warning: \[DeadThread\] .+"]),
- java_high('Deprecated item is not annotated with @Deprecated',
- [r".*: warning: \[DepAnn\] .+"]),
- java_high('Division by integer literal zero',
- [r".*: warning: \[DivZero\] .+"]),
- java_high('This method should not be called.',
- [r".*: warning: \[DoNotCall\] .+"]),
- java_high('Empty statement after if',
- [r".*: warning: \[EmptyIf\] .+"]),
- java_high('== NaN always returns false; use the isNaN methods instead',
- [r".*: warning: \[EqualsNaN\] .+"]),
- java_high('== must be used in equals method to check equality to itself or an infinite loop will occur.',
- [r".*: warning: \[EqualsReference\] .+"]),
- java_high('Comparing different pairs of fields/getters in an equals implementation is probably a mistake.',
- [r".*: warning: \[EqualsWrongThing\] .+"]),
- java_high('Method annotated @ForOverride must be protected or package-private and only invoked from declaring class, or from an override of the method',
- [r".*: warning: \[ForOverride\] .+"]),
- java_high('Invalid printf-style format string',
- [r".*: warning: \[FormatString\] .+"]),
- java_high('Invalid format string passed to formatting method.',
- [r".*: warning: \[FormatStringAnnotation\] .+"]),
- java_high('Casting a lambda to this @FunctionalInterface can cause a behavior change from casting to a functional superinterface, which is surprising to users. Prefer decorator methods to this surprising behavior.',
- [r".*: warning: \[FunctionalInterfaceMethodChanged\] .+"]),
- java_high('Futures.getChecked requires a checked exception type with a standard constructor.',
- [r".*: warning: \[FuturesGetCheckedIllegalExceptionType\] .+"]),
- java_high('DoubleMath.fuzzyEquals should never be used in an Object.equals() method',
- [r".*: warning: \[FuzzyEqualsShouldNotBeUsedInEqualsMethod\] .+"]),
- java_high('Calling getClass() on an annotation may return a proxy class',
- [r".*: warning: \[GetClassOnAnnotation\] .+"]),
- java_high('Calling getClass() on an object of type Class returns the Class object for java.lang.Class; you probably meant to operate on the object directly',
- [r".*: warning: \[GetClassOnClass\] .+"]),
- java_high('Checks for unguarded accesses to fields and methods with @GuardedBy annotations',
- [r".*: warning: \[GuardedBy\] .+"]),
- java_high('Scope annotation on implementation class of AssistedInject factory is not allowed',
- [r".*: warning: \[GuiceAssistedInjectScoping\] .+"]),
- java_high('A constructor cannot have two @Assisted parameters of the same type unless they are disambiguated with named @Assisted annotations.',
- [r".*: warning: \[GuiceAssistedParameters\] .+"]),
- java_high('Although Guice allows injecting final fields, doing so is disallowed because the injected value may not be visible to other threads.',
- [r".*: warning: \[GuiceInjectOnFinalField\] .+"]),
- java_high('contains() is a legacy method that is equivalent to containsValue()',
- [r".*: warning: \[HashtableContains\] .+"]),
- java_high('A binary expression where both operands are the same is usually incorrect.',
- [r".*: warning: \[IdentityBinaryExpression\] .+"]),
- java_high('Type declaration annotated with @Immutable is not immutable',
- [r".*: warning: \[Immutable\] .+"]),
- java_high('Modifying an immutable collection is guaranteed to throw an exception and leave the collection unmodified',
- [r".*: warning: \[ImmutableModification\] .+"]),
- java_high('Passing argument to a generic method with an incompatible type.',
- [r".*: warning: \[IncompatibleArgumentType\] .+"]),
- java_high('The first argument to indexOf is a Unicode code point, and the second is the index to start the search from',
- [r".*: warning: \[IndexOfChar\] .+"]),
- java_high('Conditional expression in varargs call contains array and non-array arguments',
- [r".*: warning: \[InexactVarargsConditional\] .+"]),
- java_high('This method always recurses, and will cause a StackOverflowError',
- [r".*: warning: \[InfiniteRecursion\] .+"]),
- java_high('A scoping annotation\'s Target should include TYPE and METHOD.',
- [r".*: warning: \[InjectInvalidTargetingOnScopingAnnotation\] .+"]),
- java_high('Using more than one qualifier annotation on the same element is not allowed.',
- [r".*: warning: \[InjectMoreThanOneQualifier\] .+"]),
- java_high('A class can be annotated with at most one scope annotation.',
- [r".*: warning: \[InjectMoreThanOneScopeAnnotationOnClass\] .+"]),
- java_high('Members shouldn\'t be annotated with @Inject if constructor is already annotated @Inject',
- [r".*: warning: \[InjectOnMemberAndConstructor\] .+"]),
- java_high('Scope annotation on an interface or abstact class is not allowed',
- [r".*: warning: \[InjectScopeAnnotationOnInterfaceOrAbstractClass\] .+"]),
- java_high('Scoping and qualifier annotations must have runtime retention.',
- [r".*: warning: \[InjectScopeOrQualifierAnnotationRetention\] .+"]),
- java_high('Injected constructors cannot be optional nor have binding annotations',
- [r".*: warning: \[InjectedConstructorAnnotations\] .+"]),
- java_high('A standard cryptographic operation is used in a mode that is prone to vulnerabilities',
- [r".*: warning: \[InsecureCryptoUsage\] .+"]),
- java_high('Invalid syntax used for a regular expression',
- [r".*: warning: \[InvalidPatternSyntax\] .+"]),
- java_high('Invalid time zone identifier. TimeZone.getTimeZone(String) will silently return GMT instead of the time zone you intended.',
- [r".*: warning: \[InvalidTimeZoneID\] .+"]),
- java_high('The argument to Class#isInstance(Object) should not be a Class',
- [r".*: warning: \[IsInstanceOfClass\] .+"]),
- java_high('Log tag too long, cannot exceed 23 characters.',
- [r".*: warning: \[IsLoggableTagLength\] .+"]),
- java_high(u'Path implements Iterable\u003cPath>; prefer Collection\u003cPath> for clarity',
- [r".*: warning: \[IterablePathParameter\] .+"]),
- java_high('jMock tests must have a @RunWith(JMock.class) annotation, or the Mockery field must have a @Rule JUnit annotation',
- [r".*: warning: \[JMockTestWithoutRunWithOrRuleAnnotation\] .+"]),
- java_high('Test method will not be run; please correct method signature (Should be public, non-static, and method name should begin with "test").',
- [r".*: warning: \[JUnit3TestNotRun\] .+"]),
- java_high('This method should be static',
- [r".*: warning: \[JUnit4ClassAnnotationNonStatic\] .+"]),
- java_high('setUp() method will not be run; please add JUnit\'s @Before annotation',
- [r".*: warning: \[JUnit4SetUpNotRun\] .+"]),
- java_high('tearDown() method will not be run; please add JUnit\'s @After annotation',
- [r".*: warning: \[JUnit4TearDownNotRun\] .+"]),
- java_high('This looks like a test method but is not run; please add @Test and @Ignore, or, if this is a helper method, reduce its visibility.',
- [r".*: warning: \[JUnit4TestNotRun\] .+"]),
- java_high('An object is tested for reference equality to itself using JUnit library.',
- [r".*: warning: \[JUnitAssertSameCheck\] .+"]),
- java_high('Use of class, field, or method that is not compatible with JDK 7',
- [r".*: warning: \[Java7ApiChecker\] .+"]),
- java_high('Abstract and default methods are not injectable with javax.inject.Inject',
- [r".*: warning: \[JavaxInjectOnAbstractMethod\] .+"]),
- java_high('@javax.inject.Inject cannot be put on a final field.',
- [r".*: warning: \[JavaxInjectOnFinalField\] .+"]),
- java_high('This pattern will silently corrupt certain byte sequences from the serialized protocol message. Use ByteString or byte[] directly',
- [r".*: warning: \[LiteByteStringUtf8\] .+"]),
- java_high('This method does not acquire the locks specified by its @LockMethod annotation',
- [r".*: warning: \[LockMethodChecker\] .+"]),
- java_high('Prefer \'L\' to \'l\' for the suffix to long literals',
- [r".*: warning: \[LongLiteralLowerCaseSuffix\] .+"]),
- java_high('Loop condition is never modified in loop body.',
- [r".*: warning: \[LoopConditionChecker\] .+"]),
- java_high('Math.round(Integer) results in truncation',
- [r".*: warning: \[MathRoundIntLong\] .+"]),
- java_high('Certain resources in `android.R.string` have names that do not match their content',
- [r".*: warning: \[MislabeledAndroidString\] .+"]),
- java_high('Overriding method is missing a call to overridden super method',
- [r".*: warning: \[MissingSuperCall\] .+"]),
- java_high('A terminating method call is required for a test helper to have any effect.',
- [r".*: warning: \[MissingTestCall\] .+"]),
- java_high('Use of "YYYY" (week year) in a date pattern without "ww" (week in year). You probably meant to use "yyyy" (year) instead.',
- [r".*: warning: \[MisusedWeekYear\] .+"]),
- java_high('A bug in Mockito will cause this test to fail at runtime with a ClassCastException',
- [r".*: warning: \[MockitoCast\] .+"]),
- java_high('Missing method call for verify(mock) here',
- [r".*: warning: \[MockitoUsage\] .+"]),
- java_high('Using a collection function with itself as the argument.',
- [r".*: warning: \[ModifyingCollectionWithItself\] .+"]),
- java_high('This class has more than one @Inject-annotated constructor. Please remove the @Inject annotation from all but one of them.',
- [r".*: warning: \[MoreThanOneInjectableConstructor\] .+"]),
- java_high('The result of this method must be closed.',
- [r".*: warning: \[MustBeClosedChecker\] .+"]),
- java_high('The first argument to nCopies is the number of copies, and the second is the item to copy',
- [r".*: warning: \[NCopiesOfChar\] .+"]),
- java_high('@NoAllocation was specified on this method, but something was found that would trigger an allocation',
- [r".*: warning: \[NoAllocation\] .+"]),
- java_high('Static import of type uses non-canonical name',
- [r".*: warning: \[NonCanonicalStaticImport\] .+"]),
- java_high('@CompileTimeConstant parameters should be final or effectively final',
- [r".*: warning: \[NonFinalCompileTimeConstant\] .+"]),
- java_high('Calling getAnnotation on an annotation that is not retained at runtime.',
- [r".*: warning: \[NonRuntimeAnnotation\] .+"]),
- java_high('This conditional expression may evaluate to null, which will result in an NPE when the result is unboxed.',
- [r".*: warning: \[NullTernary\] .+"]),
- java_high('Numeric comparison using reference equality instead of value equality',
- [r".*: warning: \[NumericEquality\] .+"]),
- java_high('Comparison using reference equality instead of value equality',
- [r".*: warning: \[OptionalEquality\] .+"]),
- java_high('Annotations cannot be both Scope annotations and Qualifier annotations: this causes confusion when trying to use them.',
- [r".*: warning: \[OverlappingQualifierAndScopeAnnotation\] .+"]),
- java_high('This method is not annotated with @Inject, but it overrides a method that is annotated with @javax.inject.Inject. The method will not be Injected.',
- [r".*: warning: \[OverridesJavaxInjectableMethod\] .+"]),
- java_high('Declaring types inside package-info.java files is very bad form',
- [r".*: warning: \[PackageInfo\] .+"]),
- java_high('Method parameter has wrong package',
- [r".*: warning: \[ParameterPackage\] .+"]),
- java_high('Detects classes which implement Parcelable but don\'t have CREATOR',
- [r".*: warning: \[ParcelableCreator\] .+"]),
- java_high('Literal passed as first argument to Preconditions.checkNotNull() can never be null',
- [r".*: warning: \[PreconditionsCheckNotNull\] .+"]),
- java_high('First argument to `Preconditions.checkNotNull()` is a primitive rather than an object reference',
- [r".*: warning: \[PreconditionsCheckNotNullPrimitive\] .+"]),
- java_high('Using ::equals or ::isInstance as an incompatible Predicate; the predicate will always return false',
- [r".*: warning: \[PredicateIncompatibleType\] .+"]),
- java_high('Access to a private protocol buffer field is forbidden. This protocol buffer carries a security contract, and can only be created using an approved library. Direct access to the fields is forbidden.',
- [r".*: warning: \[PrivateSecurityContractProtoAccess\] .+"]),
- java_high('Protobuf fields cannot be null.',
- [r".*: warning: \[ProtoFieldNullComparison\] .+"]),
- java_high('Comparing protobuf fields of type String using reference equality',
- [r".*: warning: \[ProtoStringFieldReferenceEquality\] .+"]),
- java_high('To get the tag number of a protocol buffer enum, use getNumber() instead.',
- [r".*: warning: \[ProtocolBufferOrdinal\] .+"]),
- java_high('@Provides methods need to be declared in a Module to have any effect.',
- [r".*: warning: \[ProvidesMethodOutsideOfModule\] .+"]),
- java_high('Casting a random number in the range [0.0, 1.0) to an integer or long always results in 0.',
- [r".*: warning: \[RandomCast\] .+"]),
- java_high('Use Random.nextInt(int). Random.nextInt() % n can have negative results',
- [r".*: warning: \[RandomModInteger\] .+"]),
- java_high('Return value of android.graphics.Rect.intersect() must be checked',
- [r".*: warning: \[RectIntersectReturnValueIgnored\] .+"]),
- java_high('Use of method or class annotated with @RestrictTo',
- [r".*: warning: \[RestrictTo\] .+"]),
- java_high(' Check for non-whitelisted callers to RestrictedApiChecker.',
- [r".*: warning: \[RestrictedApiChecker\] .+"]),
- java_high('Return value of this method must be used',
- [r".*: warning: \[ReturnValueIgnored\] .+"]),
- java_high('Variable assigned to itself',
- [r".*: warning: \[SelfAssignment\] .+"]),
- java_high('An object is compared to itself',
- [r".*: warning: \[SelfComparison\] .+"]),
- java_high('Testing an object for equality with itself will always be true.',
- [r".*: warning: \[SelfEquals\] .+"]),
- java_high('This method must be called with an even number of arguments.',
- [r".*: warning: \[ShouldHaveEvenArgs\] .+"]),
- java_high('Comparison of a size >= 0 is always true, did you intend to check for non-emptiness?',
- [r".*: warning: \[SizeGreaterThanOrEqualsZero\] .+"]),
- java_high('Static and default interface methods are not natively supported on older Android devices. ',
- [r".*: warning: \[StaticOrDefaultInterfaceMethod\] .+"]),
- java_high('Calling toString on a Stream does not provide useful information',
- [r".*: warning: \[StreamToString\] .+"]),
- java_high('StringBuilder does not have a char constructor; this invokes the int constructor.',
- [r".*: warning: \[StringBuilderInitWithChar\] .+"]),
- java_high('String.substring(0) returns the original String',
- [r".*: warning: \[SubstringOfZero\] .+"]),
- java_high('Suppressing "deprecated" is probably a typo for "deprecation"',
- [r".*: warning: \[SuppressWarningsDeprecated\] .+"]),
- java_high('throwIfUnchecked(knownCheckedException) is a no-op.',
- [r".*: warning: \[ThrowIfUncheckedKnownChecked\] .+"]),
- java_high('Throwing \'null\' always results in a NullPointerException being thrown.',
- [r".*: warning: \[ThrowNull\] .+"]),
- java_high('isEqualTo should not be used to test an object for equality with itself; the assertion will never fail.',
- [r".*: warning: \[TruthSelfEquals\] .+"]),
- java_high('Catching Throwable/Error masks failures from fail() or assert*() in the try block',
- [r".*: warning: \[TryFailThrowable\] .+"]),
- java_high('Type parameter used as type qualifier',
- [r".*: warning: \[TypeParameterQualifier\] .+"]),
- java_high('This method does not acquire the locks specified by its @UnlockMethod annotation',
- [r".*: warning: \[UnlockMethod\] .+"]),
- java_high('Non-generic methods should not be invoked with type arguments',
- [r".*: warning: \[UnnecessaryTypeArgument\] .+"]),
- java_high('Instance created but never used',
- [r".*: warning: \[UnusedAnonymousClass\] .+"]),
- java_high('Collection is modified in place, but the result is not used',
- [r".*: warning: \[UnusedCollectionModifiedInPlace\] .+"]),
- java_high('`var` should not be used as a type name.',
- [r".*: warning: \[VarTypeName\] .+"]),
-
- # End warnings generated by Error Prone
-
- java_warn(Severity.UNKNOWN,
- 'Unclassified/unrecognized warnings',
- [r".*: warning: \[.+\] .+"]), # TODO(chh) use more specific pattern
-
- # aapt warnings
- {'category': 'aapt', 'severity': Severity.MEDIUM,
- 'description': 'aapt: No default translation',
- 'patterns': [r".*: warning: string '.+' has no default translation in .*"]},
- {'category': 'aapt', 'severity': Severity.MEDIUM,
- 'description': 'aapt: Missing default or required localization',
- 'patterns': [r".*: warning: \*\*\*\* string '.+' has no default or required localization for '.+' in .+"]},
- {'category': 'aapt', 'severity': Severity.MEDIUM,
- 'description': 'aapt: String marked untranslatable, but translation exists',
- 'patterns': [r".*: warning: string '.+' in .* marked untranslatable but exists in locale '??_??'"]},
- {'category': 'aapt', 'severity': Severity.MEDIUM,
- 'description': 'aapt: empty span in string',
- 'patterns': [r".*: warning: empty '.+' span found in text '.+"]},
-
- # C/C++ warnings
- {'category': 'C/C++', 'severity': Severity.MEDIUM,
- 'description': 'Taking address of temporary',
- 'patterns': [r".*: warning: taking address of temporary"]},
- {'category': 'C/C++', 'severity': Severity.MEDIUM,
- 'description': 'Taking address of packed member',
- 'patterns': [r".*: warning: taking address of packed member"]},
- {'category': 'C/C++', 'severity': Severity.MEDIUM,
- 'description': 'Possible broken line continuation',
- 'patterns': [r".*: warning: backslash and newline separated by space"]},
- {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wundefined-var-template',
- 'description': 'Undefined variable template',
- 'patterns': [r".*: warning: instantiation of variable .* no definition is available"]},
- {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wundefined-inline',
- 'description': 'Inline function is not defined',
- 'patterns': [r".*: warning: inline function '.*' is not defined"]},
- # {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Warray-bounds',
- # 'description': 'Array subscript out of bounds',
- # 'patterns': [r".*: warning: array subscript is above array bounds",
- # r".*: warning: Array subscript is undefined",
- # r".*: warning: array subscript is below array bounds"]},
- {'category': 'C/C++', 'severity': Severity.MEDIUM,
- 'description': 'Excess elements in initializer',
- 'patterns': [r".*: warning: excess elements in .+ initializer"]},
- {'category': 'C/C++', 'severity': Severity.MEDIUM,
- 'description': 'Decimal constant is unsigned only in ISO C90',
- 'patterns': [r".*: warning: this decimal constant is unsigned only in ISO C90"]},
- {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wmain',
- 'description': 'main is usually a function',
- 'patterns': [r".*: warning: 'main' is usually a function"]},
- {'category': 'C/C++', 'severity': Severity.MEDIUM,
- 'description': 'Typedef ignored',
- 'patterns': [r".*: warning: 'typedef' was ignored in this declaration"]},
- {'category': 'C/C++', 'severity': Severity.HIGH, 'option': '-Waddress',
- 'description': 'Address always evaluates to true',
- 'patterns': [r".*: warning: the address of '.+' will always evaluate as 'true'"]},
- {'category': 'C/C++', 'severity': Severity.FIXMENOW,
- 'description': 'Freeing a non-heap object',
- 'patterns': [r".*: warning: attempt to free a non-heap object '.+'"]},
- {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wchar-subscripts',
- 'description': 'Array subscript has type char',
- 'patterns': [r".*: warning: array subscript .+ type 'char'.+Wchar-subscripts"]},
- {'category': 'C/C++', 'severity': Severity.MEDIUM,
- 'description': 'Constant too large for type',
- 'patterns': [r".*: warning: integer constant is too large for '.+' type"]},
- {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Woverflow',
- 'description': 'Constant too large for type, truncated',
- 'patterns': [r".*: warning: large integer implicitly truncated to unsigned type"]},
- {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Winteger-overflow',
- 'description': 'Overflow in expression',
- 'patterns': [r".*: warning: overflow in expression; .*Winteger-overflow"]},
- {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Woverflow',
- 'description': 'Overflow in implicit constant conversion',
- 'patterns': [r".*: warning: overflow in implicit constant conversion"]},
- {'category': 'C/C++', 'severity': Severity.MEDIUM,
- 'description': 'Declaration does not declare anything',
- 'patterns': [r".*: warning: declaration 'class .+' does not declare anything"]},
- {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wreorder',
- 'description': 'Initialization order will be different',
- 'patterns': [r".*: warning: '.+' will be initialized after",
- r".*: warning: field .+ will be initialized after .+Wreorder"]},
- {'category': 'cont.', 'severity': Severity.SKIP,
- 'description': 'skip, ....',
- 'patterns': [r".*: warning: '.+'"]},
- {'category': 'cont.', 'severity': Severity.SKIP,
- 'description': 'skip, base ...',
- 'patterns': [r".*: warning: base '.+'"]},
- {'category': 'cont.', 'severity': Severity.SKIP,
- 'description': 'skip, when initialized here',
- 'patterns': [r".*: warning: when initialized here"]},
- {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wmissing-parameter-type',
- 'description': 'Parameter type not specified',
- 'patterns': [r".*: warning: type of '.+' defaults to 'int'"]},
- {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wmissing-declarations',
- 'description': 'Missing declarations',
- 'patterns': [r".*: warning: declaration does not declare anything"]},
- {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wmissing-noreturn',
- 'description': 'Missing noreturn',
- 'patterns': [r".*: warning: function '.*' could be declared with attribute 'noreturn'"]},
- # pylint:disable=anomalous-backslash-in-string
- # TODO(chh): fix the backslash pylint warning.
- {'category': 'gcc', 'severity': Severity.MEDIUM,
- 'description': 'Invalid option for C file',
- 'patterns': [r".*: warning: command line option "".+"" is valid for C\+\+\/ObjC\+\+ but not for C"]},
- {'category': 'C/C++', 'severity': Severity.MEDIUM,
- 'description': 'User warning',
- 'patterns': [r".*: warning: #warning "".+"""]},
- {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wvexing-parse',
- 'description': 'Vexing parsing problem',
- 'patterns': [r".*: warning: empty parentheses interpreted as a function declaration"]},
- {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wextra',
- 'description': 'Dereferencing void*',
- 'patterns': [r".*: warning: dereferencing 'void \*' pointer"]},
- {'category': 'C/C++', 'severity': Severity.MEDIUM,
- 'description': 'Comparison of pointer and integer',
- 'patterns': [r".*: warning: ordered comparison of pointer with integer zero",
- r".*: warning: .*comparison between pointer and integer"]},
- {'category': 'C/C++', 'severity': Severity.MEDIUM,
- 'description': 'Use of error-prone unary operator',
- 'patterns': [r".*: warning: use of unary operator that may be intended as compound assignment"]},
- {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wwrite-strings',
- 'description': 'Conversion of string constant to non-const char*',
- 'patterns': [r".*: warning: deprecated conversion from string constant to '.+'"]},
- {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wstrict-prototypes',
- 'description': 'Function declaration isn''t a prototype',
- 'patterns': [r".*: warning: function declaration isn't a prototype"]},
- {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wignored-qualifiers',
- 'description': 'Type qualifiers ignored on function return value',
- 'patterns': [r".*: warning: type qualifiers ignored on function return type",
- r".*: warning: .+ type qualifier .+ has no effect .+Wignored-qualifiers"]},
- {'category': 'C/C++', 'severity': Severity.MEDIUM,
- 'description': '<foo> declared inside parameter list, scope limited to this definition',
- 'patterns': [r".*: warning: '.+' declared inside parameter list"]},
- {'category': 'cont.', 'severity': Severity.SKIP,
- 'description': 'skip, its scope is only this ...',
- 'patterns': [r".*: warning: its scope is only this definition or declaration, which is probably not what you want"]},
- {'category': 'C/C++', 'severity': Severity.LOW, 'option': '-Wcomment',
- 'description': 'Line continuation inside comment',
- 'patterns': [r".*: warning: multi-line comment"]},
- {'category': 'C/C++', 'severity': Severity.LOW, 'option': '-Wcomment',
- 'description': 'Comment inside comment',
- 'patterns': [r".*: warning: '.+' within block comment .*-Wcomment"]},
- {'category': 'C/C++', 'severity': Severity.LOW, 'option': '-Wdeprecated-declarations',
- 'description': 'Deprecated declarations',
- 'patterns': [r".*: warning: .+ is deprecated.+deprecated-declarations"]},
- {'category': 'C/C++', 'severity': Severity.LOW, 'option': '-Wdeprecated-register',
- 'description': 'Deprecated register',
- 'patterns': [r".*: warning: 'register' storage class specifier is deprecated"]},
- {'category': 'C/C++', 'severity': Severity.LOW, 'option': '-Wpointer-sign',
- 'description': 'Converts between pointers to integer types with different sign',
- 'patterns': [r".*: warning: .+ converts between pointers to integer types with different sign"]},
- {'category': 'C/C++', 'severity': Severity.HARMLESS,
- 'description': 'Extra tokens after #endif',
- 'patterns': [r".*: warning: extra tokens at end of #endif directive"]},
- {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wenum-compare',
- 'description': 'Comparison between different enums',
- 'patterns': [r".*: warning: comparison between '.+' and '.+'.+Wenum-compare",
- r".*: warning: comparison of .* enumeration types .*-Wenum-compare-switch"]},
- {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wconversion',
- 'description': 'Conversion may change value',
- 'patterns': [r".*: warning: converting negative value '.+' to '.+'",
- r".*: warning: conversion to '.+' .+ may (alter|change)"]},
- {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wconversion-null',
- 'description': 'Converting to non-pointer type from NULL',
- 'patterns': [r".*: warning: converting to non-pointer type '.+' from NULL"]},
- {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wsign-conversion',
- 'description': 'Implicit sign conversion',
- 'patterns': [r".*: warning: implicit conversion changes signedness"]},
- {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wnull-conversion',
- 'description': 'Converting NULL to non-pointer type',
- 'patterns': [r".*: warning: implicit conversion of NULL constant to '.+'"]},
- {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wnon-literal-null-conversion',
- 'description': 'Zero used as null pointer',
- 'patterns': [r".*: warning: expression .* zero treated as a null pointer constant"]},
- {'category': 'C/C++', 'severity': Severity.MEDIUM,
- 'description': 'Implicit conversion changes value or loses precision',
- 'patterns': [r".*: warning: implicit conversion .* changes value from .* to .*-conversion",
- r".*: warning: implicit conversion loses integer precision:"]},
- {'category': 'C/C++', 'severity': Severity.MEDIUM,
- 'description': 'Passing NULL as non-pointer argument',
- 'patterns': [r".*: warning: passing NULL to non-pointer argument [0-9]+ of '.+'"]},
- {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wctor-dtor-privacy',
- 'description': 'Class seems unusable because of private ctor/dtor',
- 'patterns': [r".*: warning: all member functions in class '.+' are private"]},
- # skip this next one, because it only points out some RefBase-based classes where having a private destructor is perfectly fine
- {'category': 'C/C++', 'severity': Severity.SKIP, 'option': '-Wctor-dtor-privacy',
- 'description': 'Class seems unusable because of private ctor/dtor',
- 'patterns': [r".*: warning: 'class .+' only defines a private destructor and has no friends"]},
- {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wctor-dtor-privacy',
- 'description': 'Class seems unusable because of private ctor/dtor',
- 'patterns': [r".*: warning: 'class .+' only defines private constructors and has no friends"]},
- {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wgnu-static-float-init',
- 'description': 'In-class initializer for static const float/double',
- 'patterns': [r".*: warning: in-class initializer for static data member of .+const (float|double)"]},
- {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wpointer-arith',
- 'description': 'void* used in arithmetic',
- 'patterns': [r".*: warning: pointer of type 'void \*' used in (arithmetic|subtraction)",
- r".*: warning: arithmetic on .+ to void is a GNU extension.*Wpointer-arith",
- r".*: warning: wrong type argument to increment"]},
- {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wsign-promo',
- 'description': 'Overload resolution chose to promote from unsigned or enum to signed type',
- 'patterns': [r".*: warning: passing '.+' chooses '.+' over '.+'.*Wsign-promo"]},
- {'category': 'cont.', 'severity': Severity.SKIP,
- 'description': 'skip, in call to ...',
- 'patterns': [r".*: warning: in call to '.+'"]},
- {'category': 'C/C++', 'severity': Severity.HIGH, 'option': '-Wextra',
- 'description': 'Base should be explicitly initialized in copy constructor',
- 'patterns': [r".*: warning: base class '.+' should be explicitly initialized in the copy constructor"]},
- # {'category': 'C/C++', 'severity': Severity.MEDIUM,
- # 'description': 'VLA has zero or negative size',
- # 'patterns': [r".*: warning: Declared variable-length array \(VLA\) has .+ size"]},
- {'category': 'C/C++', 'severity': Severity.MEDIUM,
- 'description': 'Return value from void function',
- 'patterns': [r".*: warning: 'return' with a value, in function returning void"]},
- {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': 'multichar',
- 'description': 'Multi-character character constant',
- 'patterns': [r".*: warning: multi-character character constant"]},
- {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': 'writable-strings',
- 'description': 'Conversion from string literal to char*',
- 'patterns': [r".*: warning: .+ does not allow conversion from string literal to 'char \*'"]},
- {'category': 'C/C++', 'severity': Severity.LOW, 'option': '-Wextra-semi',
- 'description': 'Extra \';\'',
- 'patterns': [r".*: warning: extra ';' .+extra-semi"]},
- {'category': 'C/C++', 'severity': Severity.LOW,
- 'description': 'Useless specifier',
- 'patterns': [r".*: warning: useless storage class specifier in empty declaration"]},
- {'category': 'C/C++', 'severity': Severity.LOW, 'option': '-Wduplicate-decl-specifier',
- 'description': 'Duplicate declaration specifier',
- 'patterns': [r".*: warning: duplicate '.+' declaration specifier"]},
- {'category': 'logtags', 'severity': Severity.LOW,
- 'description': 'Duplicate logtag',
- 'patterns': [r".*: warning: tag \".+\" \(.+\) duplicated in .+"]},
- {'category': 'logtags', 'severity': Severity.LOW, 'option': 'typedef-redefinition',
- 'description': 'Typedef redefinition',
- 'patterns': [r".*: warning: redefinition of typedef '.+' is a C11 feature"]},
- {'category': 'logtags', 'severity': Severity.LOW, 'option': 'gnu-designator',
- 'description': 'GNU old-style field designator',
- 'patterns': [r".*: warning: use of GNU old-style field designator extension"]},
- {'category': 'logtags', 'severity': Severity.LOW, 'option': 'missing-field-initializers',
- 'description': 'Missing field initializers',
- 'patterns': [r".*: warning: missing field '.+' initializer"]},
- {'category': 'logtags', 'severity': Severity.LOW, 'option': 'missing-braces',
- 'description': 'Missing braces',
- 'patterns': [r".*: warning: suggest braces around initialization of",
- r".*: warning: too many braces around scalar initializer .+Wmany-braces-around-scalar-init",
- r".*: warning: braces around scalar initializer"]},
- {'category': 'logtags', 'severity': Severity.LOW, 'option': 'sign-compare',
- 'description': 'Comparison of integers of different signs',
- 'patterns': [r".*: warning: comparison of integers of different signs.+sign-compare"]},
- {'category': 'logtags', 'severity': Severity.LOW, 'option': 'dangling-else',
- 'description': 'Add braces to avoid dangling else',
- 'patterns': [r".*: warning: add explicit braces to avoid dangling else"]},
- {'category': 'logtags', 'severity': Severity.LOW, 'option': 'initializer-overrides',
- 'description': 'Initializer overrides prior initialization',
- 'patterns': [r".*: warning: initializer overrides prior initialization of this subobject"]},
- {'category': 'logtags', 'severity': Severity.LOW, 'option': 'self-assign',
- 'description': 'Assigning value to self',
- 'patterns': [r".*: warning: explicitly assigning value of .+ to itself"]},
- {'category': 'logtags', 'severity': Severity.LOW, 'option': 'gnu-variable-sized-type-not-at-end',
- 'description': 'GNU extension, variable sized type not at end',
- 'patterns': [r".*: warning: field '.+' with variable sized type '.+' not at the end of a struct or class"]},
- {'category': 'logtags', 'severity': Severity.LOW, 'option': 'tautological-constant-out-of-range-compare',
- 'description': 'Comparison of constant is always false/true',
- 'patterns': [r".*: comparison of .+ is always .+Wtautological-constant-out-of-range-compare"]},
- {'category': 'logtags', 'severity': Severity.LOW, 'option': 'overloaded-virtual',
- 'description': 'Hides overloaded virtual function',
- 'patterns': [r".*: '.+' hides overloaded virtual function"]},
- {'category': 'logtags', 'severity': Severity.LOW,
- 'description': 'Incompatible pointer types',
- 'patterns': [r".*: warning: incompatible .*pointer types .*-Wincompatible-.*pointer-types"]},
- {'category': 'logtags', 'severity': Severity.LOW, 'option': 'asm-operand-widths',
- 'description': 'ASM value size does not match register size',
- 'patterns': [r".*: warning: value size does not match register size specified by the constraint and modifier"]},
- {'category': 'C/C++', 'severity': Severity.LOW, 'option': 'tautological-compare',
- 'description': 'Comparison of self is always false',
- 'patterns': [r".*: self-comparison always evaluates to false"]},
- {'category': 'C/C++', 'severity': Severity.LOW, 'option': 'constant-logical-operand',
- 'description': 'Logical op with constant operand',
- 'patterns': [r".*: use of logical '.+' with constant operand"]},
- {'category': 'C/C++', 'severity': Severity.LOW, 'option': 'literal-suffix',
- 'description': 'Needs a space between literal and string macro',
- 'patterns': [r".*: warning: invalid suffix on literal.+ requires a space .+Wliteral-suffix"]},
- {'category': 'C/C++', 'severity': Severity.LOW, 'option': '#warnings',
- 'description': 'Warnings from #warning',
- 'patterns': [r".*: warning: .+-W#warnings"]},
- {'category': 'C/C++', 'severity': Severity.LOW, 'option': 'absolute-value',
- 'description': 'Using float/int absolute value function with int/float argument',
- 'patterns': [r".*: warning: using .+ absolute value function .+ when argument is .+ type .+Wabsolute-value",
- r".*: warning: absolute value function '.+' given .+ which may cause truncation .+Wabsolute-value"]},
- {'category': 'C/C++', 'severity': Severity.LOW, 'option': '-Wc++11-extensions',
- 'description': 'Using C++11 extensions',
- 'patterns': [r".*: warning: 'auto' type specifier is a C\+\+11 extension"]},
- {'category': 'C/C++', 'severity': Severity.LOW,
- 'description': 'Refers to implicitly defined namespace',
- 'patterns': [r".*: warning: using directive refers to implicitly-defined namespace .+"]},
- {'category': 'C/C++', 'severity': Severity.LOW, 'option': '-Winvalid-pp-token',
- 'description': 'Invalid pp token',
- 'patterns': [r".*: warning: missing .+Winvalid-pp-token"]},
- {'category': 'link', 'severity': Severity.LOW,
- 'description': 'need glibc to link',
- 'patterns': [r".*: warning: .* requires at runtime .* glibc .* for linking"]},
-
- {'category': 'C/C++', 'severity': Severity.MEDIUM,
- 'description': 'Operator new returns NULL',
- 'patterns': [r".*: warning: 'operator new' must not return NULL unless it is declared 'throw\(\)' .+"]},
- {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wnull-arithmetic',
- 'description': 'NULL used in arithmetic',
- 'patterns': [r".*: warning: NULL used in arithmetic",
- r".*: warning: comparison between NULL and non-pointer"]},
- {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': 'header-guard',
- 'description': 'Misspelled header guard',
- 'patterns': [r".*: warning: '.+' is used as a header guard .+ followed by .+ different macro"]},
- {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': 'empty-body',
- 'description': 'Empty loop body',
- 'patterns': [r".*: warning: .+ loop has empty body"]},
- {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': 'enum-conversion',
- 'description': 'Implicit conversion from enumeration type',
- 'patterns': [r".*: warning: implicit conversion from enumeration type '.+'"]},
- {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': 'switch',
- 'description': 'case value not in enumerated type',
- 'patterns': [r".*: warning: case value not in enumerated type '.+'"]},
- # {'category': 'C/C++', 'severity': Severity.MEDIUM,
- # 'description': 'Undefined result',
- # 'patterns': [r".*: warning: The result of .+ is undefined",
- # r".*: warning: passing an object that .+ has undefined behavior \[-Wvarargs\]",
- # r".*: warning: 'this' pointer cannot be null in well-defined C\+\+ code;",
- # r".*: warning: shifting a negative signed value is undefined"]},
- # {'category': 'C/C++', 'severity': Severity.MEDIUM,
- # 'description': 'Division by zero',
- # 'patterns': [r".*: warning: Division by zero"]},
- {'category': 'C/C++', 'severity': Severity.MEDIUM,
- 'description': 'Use of deprecated method',
- 'patterns': [r".*: warning: '.+' is deprecated .+"]},
- {'category': 'C/C++', 'severity': Severity.MEDIUM,
- 'description': 'Use of garbage or uninitialized value',
- 'patterns': [r".*: warning: .+ uninitialized .+\[-Wsometimes-uninitialized\]"]},
- # {'category': 'C/C++', 'severity': Severity.MEDIUM,
- # 'description': 'Use of garbage or uninitialized value',
- # 'patterns': [r".*: warning: .+ is a garbage value",
- # r".*: warning: Function call argument is an uninitialized value",
- # r".*: warning: Undefined or garbage value returned to caller",
- # r".*: warning: Called .+ pointer is.+uninitialized",
- # r".*: warning: Called .+ pointer is.+uninitalized", # match a typo in compiler message
- # r".*: warning: Use of zero-allocated memory",
- # r".*: warning: Dereference of undefined pointer value",
- # r".*: warning: Passed-by-value .+ contains uninitialized data",
- # r".*: warning: Branch condition evaluates to a garbage value",
- # r".*: warning: The .+ of .+ is an uninitialized value.",
- # r".*: warning: .+ is used uninitialized whenever .+sometimes-uninitialized",
- # r".*: warning: Assigned value is garbage or undefined"]},
- # {'category': 'C/C++', 'severity': Severity.MEDIUM,
- # 'description': 'Result of malloc type incompatible with sizeof operand type',
- # 'patterns': [r".*: warning: Result of '.+' is converted to .+ incompatible with sizeof operand type"]},
- {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wsizeof-array-argument',
- 'description': 'Sizeof on array argument',
- 'patterns': [r".*: warning: sizeof on array function parameter will return"]},
- {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wsizeof-pointer-memacces',
- 'description': 'Bad argument size of memory access functions',
- 'patterns': [r".*: warning: .+\[-Wsizeof-pointer-memaccess\]"]},
- {'category': 'C/C++', 'severity': Severity.MEDIUM,
- 'description': 'Return value not checked',
- 'patterns': [r".*: warning: The return value from .+ is not checked"]},
- {'category': 'C/C++', 'severity': Severity.MEDIUM,
- 'description': 'Possible heap pollution',
- 'patterns': [r".*: warning: .*Possible heap pollution from .+ type .+"]},
- # {'category': 'C/C++', 'severity': Severity.MEDIUM,
- # 'description': 'Allocation size of 0 byte',
- # 'patterns': [r".*: warning: Call to .+ has an allocation size of 0 byte"]},
- # {'category': 'C/C++', 'severity': Severity.MEDIUM,
- # 'description': 'Result of malloc type incompatible with sizeof operand type',
- # 'patterns': [r".*: warning: Result of '.+' is converted to .+ incompatible with sizeof operand type"]},
- {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wfor-loop-analysis',
- 'description': 'Variable used in loop condition not modified in loop body',
- 'patterns': [r".*: warning: variable '.+' used in loop condition.*Wfor-loop-analysis"]},
- {'category': 'C/C++', 'severity': Severity.MEDIUM,
- 'description': 'Closing a previously closed file',
- 'patterns': [r".*: warning: Closing a previously closed file"]},
- {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wunnamed-type-template-args',
- 'description': 'Unnamed template type argument',
- 'patterns': [r".*: warning: template argument.+Wunnamed-type-template-args"]},
- {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wimplicit-fallthrough',
- 'description': 'Unannotated fall-through between switch labels',
- 'patterns': [r".*: warning: unannotated fall-through between switch labels.+Wimplicit-fallthrough"]},
-
- {'category': 'C/C++', 'severity': Severity.HARMLESS,
- 'description': 'Discarded qualifier from pointer target type',
- 'patterns': [r".*: warning: .+ discards '.+' qualifier from pointer target type"]},
- {'category': 'C/C++', 'severity': Severity.HARMLESS,
- 'description': 'Use snprintf instead of sprintf',
- 'patterns': [r".*: warning: .*sprintf is often misused; please use snprintf"]},
- {'category': 'C/C++', 'severity': Severity.HARMLESS,
- 'description': 'Unsupported optimizaton flag',
- 'patterns': [r".*: warning: optimization flag '.+' is not supported"]},
- {'category': 'C/C++', 'severity': Severity.HARMLESS,
- 'description': 'Extra or missing parentheses',
- 'patterns': [r".*: warning: equality comparison with extraneous parentheses",
- r".*: warning: .+ within .+Wlogical-op-parentheses"]},
- {'category': 'C/C++', 'severity': Severity.HARMLESS, 'option': 'mismatched-tags',
- 'description': 'Mismatched class vs struct tags',
- 'patterns': [r".*: warning: '.+' defined as a .+ here but previously declared as a .+mismatched-tags",
- r".*: warning: .+ was previously declared as a .+mismatched-tags"]},
- {'category': 'FindEmulator', 'severity': Severity.HARMLESS,
- 'description': 'FindEmulator: No such file or directory',
- 'patterns': [r".*: warning: FindEmulator: .* No such file or directory"]},
- {'category': 'make', 'severity': Severity.HARMLESS,
- 'description': 'make: unknown installed file',
- 'patterns': [r".*: warning: .*_tests: Unknown installed file for module"]},
- {'category': 'make', 'severity': Severity.HARMLESS,
- 'description': 'unusual tags debug eng',
- 'patterns': [r".*: warning: .*: unusual tags debug eng"]},
- {'category': 'make', 'severity': Severity.MEDIUM,
- 'description': 'make: please convert to soong',
- 'patterns': [r".*: warning: .* has been deprecated. Please convert to Soong."]},
-
- # these next ones are to deal with formatting problems resulting from the log being mixed up by 'make -j'
- {'category': 'C/C++', 'severity': Severity.SKIP,
- 'description': 'skip, ,',
- 'patterns': [r".*: warning: ,$"]},
- {'category': 'C/C++', 'severity': Severity.SKIP,
- 'description': 'skip,',
- 'patterns': [r".*: warning: $"]},
- {'category': 'C/C++', 'severity': Severity.SKIP,
- 'description': 'skip, In file included from ...',
- 'patterns': [r".*: warning: In file included from .+,"]},
-
- # warnings from clang-tidy
- group_tidy_warn_pattern('android'),
- simple_tidy_warn_pattern('abseil-string-find-startswith'),
- simple_tidy_warn_pattern('bugprone-argument-comment'),
- simple_tidy_warn_pattern('bugprone-copy-constructor-init'),
- simple_tidy_warn_pattern('bugprone-fold-init-type'),
- simple_tidy_warn_pattern('bugprone-forward-declaration-namespace'),
- simple_tidy_warn_pattern('bugprone-forwarding-reference-overload'),
- simple_tidy_warn_pattern('bugprone-inaccurate-erase'),
- simple_tidy_warn_pattern('bugprone-incorrect-roundings'),
- simple_tidy_warn_pattern('bugprone-integer-division'),
- simple_tidy_warn_pattern('bugprone-lambda-function-name'),
- simple_tidy_warn_pattern('bugprone-macro-parentheses'),
- simple_tidy_warn_pattern('bugprone-misplaced-widening-cast'),
- simple_tidy_warn_pattern('bugprone-move-forwarding-reference'),
- simple_tidy_warn_pattern('bugprone-sizeof-expression'),
- simple_tidy_warn_pattern('bugprone-string-constructor'),
- simple_tidy_warn_pattern('bugprone-string-integer-assignment'),
- simple_tidy_warn_pattern('bugprone-suspicious-enum-usage'),
- simple_tidy_warn_pattern('bugprone-suspicious-missing-comma'),
- simple_tidy_warn_pattern('bugprone-suspicious-string-compare'),
- simple_tidy_warn_pattern('bugprone-suspicious-semicolon'),
- simple_tidy_warn_pattern('bugprone-undefined-memory-manipulation'),
- simple_tidy_warn_pattern('bugprone-unused-raii'),
- simple_tidy_warn_pattern('bugprone-use-after-move'),
- group_tidy_warn_pattern('bugprone'),
- group_tidy_warn_pattern('cert'),
- group_tidy_warn_pattern('clang-diagnostic'),
- group_tidy_warn_pattern('cppcoreguidelines'),
- group_tidy_warn_pattern('llvm'),
- simple_tidy_warn_pattern('google-default-arguments'),
- simple_tidy_warn_pattern('google-runtime-int'),
- simple_tidy_warn_pattern('google-runtime-operator'),
- simple_tidy_warn_pattern('google-runtime-references'),
- group_tidy_warn_pattern('google-build'),
- group_tidy_warn_pattern('google-explicit'),
- group_tidy_warn_pattern('google-redability'),
- group_tidy_warn_pattern('google-global'),
- group_tidy_warn_pattern('google-redability'),
- group_tidy_warn_pattern('google-redability'),
- group_tidy_warn_pattern('google'),
- simple_tidy_warn_pattern('hicpp-explicit-conversions'),
- simple_tidy_warn_pattern('hicpp-function-size'),
- simple_tidy_warn_pattern('hicpp-invalid-access-moved'),
- simple_tidy_warn_pattern('hicpp-member-init'),
- simple_tidy_warn_pattern('hicpp-delete-operators'),
- simple_tidy_warn_pattern('hicpp-special-member-functions'),
- simple_tidy_warn_pattern('hicpp-use-equals-default'),
- simple_tidy_warn_pattern('hicpp-use-equals-delete'),
- simple_tidy_warn_pattern('hicpp-no-assembler'),
- simple_tidy_warn_pattern('hicpp-noexcept-move'),
- simple_tidy_warn_pattern('hicpp-use-override'),
- group_tidy_warn_pattern('hicpp'),
- group_tidy_warn_pattern('modernize'),
- group_tidy_warn_pattern('misc'),
- simple_tidy_warn_pattern('performance-faster-string-find'),
- simple_tidy_warn_pattern('performance-for-range-copy'),
- simple_tidy_warn_pattern('performance-implicit-cast-in-loop'),
- simple_tidy_warn_pattern('performance-inefficient-string-concatenation'),
- simple_tidy_warn_pattern('performance-type-promotion-in-math-fn'),
- simple_tidy_warn_pattern('performance-unnecessary-copy-initialization'),
- simple_tidy_warn_pattern('performance-unnecessary-value-param'),
- simple_tidy_warn_pattern('portability-simd-intrinsics'),
- group_tidy_warn_pattern('performance'),
- group_tidy_warn_pattern('readability'),
-
- # warnings from clang-tidy's clang-analyzer checks
- analyzer_high('clang-analyzer-core, null pointer',
- [r".*: warning: .+ pointer is null .*\[clang-analyzer-core"]),
- analyzer_high('clang-analyzer-core, uninitialized value',
- [r".*: warning: .+ uninitialized (value|data) .*\[clang-analyzer-core"]),
- analyzer_warn('clang-analyzer-optin.performance.Padding',
- [r".*: warning: Excessive padding in '.*'"]),
- # analyzer_warn('clang-analyzer Unreachable code',
- # [r".*: warning: This statement is never executed.*UnreachableCode"]),
- analyzer_warn('clang-analyzer Size of malloc may overflow',
- [r".*: warning: .* size of .* may overflow .*MallocOverflow"]),
- analyzer_warn('clang-analyzer sozeof() on a pointer type',
- [r".*: warning: .*calls sizeof.* on a pointer type.*SizeofPtr"]),
- analyzer_warn('clang-analyzer Pointer arithmetic on non-array variables',
- [r".*: warning: Pointer arithmetic on non-array variables .*PointerArithm"]),
- analyzer_warn('clang-analyzer Subtraction of pointers of different memory chunks',
- [r".*: warning: Subtraction of two pointers .*PointerSub"]),
- analyzer_warn('clang-analyzer Access out-of-bound array element',
- [r".*: warning: Access out-of-bound array element .*ArrayBound"]),
- analyzer_warn('clang-analyzer Out of bound memory access',
- [r".*: warning: Out of bound memory access .*ArrayBoundV2"]),
- analyzer_warn('clang-analyzer Possible lock order reversal',
- [r".*: warning: .* Possible lock order reversal.*PthreadLock"]),
- analyzer_warn('clang-analyzer call path problems',
- [r".*: warning: Call Path : .+"]),
- analyzer_warn_check('clang-analyzer-core.CallAndMessage'),
- analyzer_high_check('clang-analyzer-core.NonNullParamChecker'),
- analyzer_high_check('clang-analyzer-core.NullDereference'),
- analyzer_warn_check('clang-analyzer-core.UndefinedBinaryOperatorResult'),
- analyzer_warn_check('clang-analyzer-core.DivideZero'),
- analyzer_warn_check('clang-analyzer-core.VLASize'),
- analyzer_warn_check('clang-analyzer-core.uninitialized.ArraySubscript'),
- analyzer_warn_check('clang-analyzer-core.uninitialized.Assign'),
- analyzer_warn_check('clang-analyzer-core.uninitialized.UndefReturn'),
- analyzer_warn_check('clang-analyzer-cplusplus.Move'),
- analyzer_warn_check('clang-analyzer-deadcode.DeadStores'),
- analyzer_warn_check('clang-analyzer-optin.cplusplus.UninitializedObject'),
- analyzer_warn_check('clang-analyzer-optin.cplusplus.VirtualCall'),
- analyzer_warn_check('clang-analyzer-portability.UnixAPI'),
- analyzer_warn_check('clang-analyzer-unix.cstring.NullArg'),
- analyzer_high_check('clang-analyzer-unix.MallocSizeof'),
- analyzer_warn_check('clang-analyzer-valist.Uninitialized'),
- analyzer_warn_check('clang-analyzer-valist.Unterminated'),
- analyzer_group_check('clang-analyzer-core.uninitialized'),
- analyzer_group_check('clang-analyzer-deadcode'),
- analyzer_warn_check('clang-analyzer-security.insecureAPI.strcpy'),
- analyzer_group_high('clang-analyzer-security.insecureAPI'),
- analyzer_group_high('clang-analyzer-security'),
- analyzer_group_check('clang-analyzer-unix.Malloc'),
- analyzer_group_check('clang-analyzer-unix'),
- analyzer_group_check('clang-analyzer'), # catch al
-
- # Assembler warnings
- {'category': 'Asm', 'severity': Severity.MEDIUM,
- 'description': 'Asm: IT instruction is deprecated',
- 'patterns': [r".*: warning: applying IT instruction .* is deprecated"]},
-
- # NDK warnings
- {'category': 'NDK', 'severity': Severity.HIGH,
- 'description': 'NDK: Generate guard with empty availability, obsoleted',
- 'patterns': [r".*: warning: .* generate guard with empty availability: obsoleted ="]},
-
- # Protoc warnings
- {'category': 'Protoc', 'severity': Severity.MEDIUM,
- 'description': 'Proto: Enum name colision after strip',
- 'patterns': [r".*: warning: Enum .* has the same name .* ignore case and strip"]},
-
- # Kotlin warnings
- {'category': 'Kotlin', 'severity': Severity.MEDIUM,
- 'description': 'Kotlin: never used parameter',
- 'patterns': [r".*: warning: parameter '.*' is never used"]},
- {'category': 'Kotlin', 'severity': Severity.MEDIUM,
- 'description': 'Kotlin: Deprecated in Java',
- 'patterns': [r".*: warning: '.*' is deprecated. Deprecated in Java"]},
- {'category': 'Kotlin', 'severity': Severity.MEDIUM,
- 'description': 'Kotlin: library has Kotlin runtime',
- 'patterns': [r".*: warning: library has Kotlin runtime bundled into it",
- r".*: warning: some JAR files .* have the Kotlin Runtime library"]},
-
- # rustc warnings
- {'category': 'Rust', 'severity': Severity.HIGH,
- 'description': 'Rust: Does not derive Copy',
- 'patterns': [r".*: warning: .+ does not derive Copy"]},
- {'category': 'Rust', 'severity': Severity.MEDIUM,
- 'description': 'Rust: Deprecated range pattern',
- 'patterns': [r".*: warning: .+ range patterns are deprecated"]},
- {'category': 'Rust', 'severity': Severity.MEDIUM,
- 'description': 'Rust: Deprecated missing explicit \'dyn\'',
- 'patterns': [r".*: warning: .+ without an explicit `dyn` are deprecated"]},
-
- # catch-all for warnings this script doesn't know about yet
- {'category': 'C/C++', 'severity': Severity.UNKNOWN,
- 'description': 'Unclassified/unrecognized warnings',
- 'patterns': [r".*: warning: .+"]},
-]
-
-
-def project_name_and_pattern(name, pattern):
- return [name, '(^|.*/)' + pattern + '/.*: warning:']
-
-
-def simple_project_pattern(pattern):
- return project_name_and_pattern(pattern, pattern)
-
-
-# A list of [project_name, file_path_pattern].
-# project_name should not contain comma, to be used in CSV output.
-project_list = [
- simple_project_pattern('art'),
- simple_project_pattern('bionic'),
- simple_project_pattern('bootable'),
- simple_project_pattern('build'),
- simple_project_pattern('cts'),
- simple_project_pattern('dalvik'),
- simple_project_pattern('developers'),
- simple_project_pattern('development'),
- simple_project_pattern('device'),
- simple_project_pattern('doc'),
- # match external/google* before external/
- project_name_and_pattern('external/google', 'external/google.*'),
- project_name_and_pattern('external/non-google', 'external'),
- simple_project_pattern('frameworks/av/camera'),
- simple_project_pattern('frameworks/av/cmds'),
- simple_project_pattern('frameworks/av/drm'),
- simple_project_pattern('frameworks/av/include'),
- simple_project_pattern('frameworks/av/media/img_utils'),
- simple_project_pattern('frameworks/av/media/libcpustats'),
- simple_project_pattern('frameworks/av/media/libeffects'),
- simple_project_pattern('frameworks/av/media/libmediaplayerservice'),
- simple_project_pattern('frameworks/av/media/libmedia'),
- simple_project_pattern('frameworks/av/media/libstagefright'),
- simple_project_pattern('frameworks/av/media/mtp'),
- simple_project_pattern('frameworks/av/media/ndk'),
- simple_project_pattern('frameworks/av/media/utils'),
- project_name_and_pattern('frameworks/av/media/Other',
- 'frameworks/av/media'),
- simple_project_pattern('frameworks/av/radio'),
- simple_project_pattern('frameworks/av/services'),
- simple_project_pattern('frameworks/av/soundtrigger'),
- project_name_and_pattern('frameworks/av/Other', 'frameworks/av'),
- simple_project_pattern('frameworks/base/cmds'),
- simple_project_pattern('frameworks/base/core'),
- simple_project_pattern('frameworks/base/drm'),
- simple_project_pattern('frameworks/base/media'),
- simple_project_pattern('frameworks/base/libs'),
- simple_project_pattern('frameworks/base/native'),
- simple_project_pattern('frameworks/base/packages'),
- simple_project_pattern('frameworks/base/rs'),
- simple_project_pattern('frameworks/base/services'),
- simple_project_pattern('frameworks/base/tests'),
- simple_project_pattern('frameworks/base/tools'),
- project_name_and_pattern('frameworks/base/Other', 'frameworks/base'),
- simple_project_pattern('frameworks/compile/libbcc'),
- simple_project_pattern('frameworks/compile/mclinker'),
- simple_project_pattern('frameworks/compile/slang'),
- project_name_and_pattern('frameworks/compile/Other', 'frameworks/compile'),
- simple_project_pattern('frameworks/minikin'),
- simple_project_pattern('frameworks/ml'),
- simple_project_pattern('frameworks/native/cmds'),
- simple_project_pattern('frameworks/native/include'),
- simple_project_pattern('frameworks/native/libs'),
- simple_project_pattern('frameworks/native/opengl'),
- simple_project_pattern('frameworks/native/services'),
- simple_project_pattern('frameworks/native/vulkan'),
- project_name_and_pattern('frameworks/native/Other', 'frameworks/native'),
- simple_project_pattern('frameworks/opt'),
- simple_project_pattern('frameworks/rs'),
- simple_project_pattern('frameworks/webview'),
- simple_project_pattern('frameworks/wilhelm'),
- project_name_and_pattern('frameworks/Other', 'frameworks'),
- simple_project_pattern('hardware/akm'),
- simple_project_pattern('hardware/broadcom'),
- simple_project_pattern('hardware/google'),
- simple_project_pattern('hardware/intel'),
- simple_project_pattern('hardware/interfaces'),
- simple_project_pattern('hardware/libhardware'),
- simple_project_pattern('hardware/libhardware_legacy'),
- simple_project_pattern('hardware/qcom'),
- simple_project_pattern('hardware/ril'),
- project_name_and_pattern('hardware/Other', 'hardware'),
- simple_project_pattern('kernel'),
- simple_project_pattern('libcore'),
- simple_project_pattern('libnativehelper'),
- simple_project_pattern('ndk'),
- # match vendor/unbungled_google/packages before other packages
- simple_project_pattern('unbundled_google'),
- simple_project_pattern('packages'),
- simple_project_pattern('pdk'),
- simple_project_pattern('prebuilts'),
- simple_project_pattern('system/bt'),
- simple_project_pattern('system/connectivity'),
- simple_project_pattern('system/core/adb'),
- simple_project_pattern('system/core/base'),
- simple_project_pattern('system/core/debuggerd'),
- simple_project_pattern('system/core/fastboot'),
- simple_project_pattern('system/core/fingerprintd'),
- simple_project_pattern('system/core/fs_mgr'),
- simple_project_pattern('system/core/gatekeeperd'),
- simple_project_pattern('system/core/healthd'),
- simple_project_pattern('system/core/include'),
- simple_project_pattern('system/core/init'),
- simple_project_pattern('system/core/libbacktrace'),
- simple_project_pattern('system/core/liblog'),
- simple_project_pattern('system/core/libpixelflinger'),
- simple_project_pattern('system/core/libprocessgroup'),
- simple_project_pattern('system/core/libsysutils'),
- simple_project_pattern('system/core/logcat'),
- simple_project_pattern('system/core/logd'),
- simple_project_pattern('system/core/run-as'),
- simple_project_pattern('system/core/sdcard'),
- simple_project_pattern('system/core/toolbox'),
- project_name_and_pattern('system/core/Other', 'system/core'),
- simple_project_pattern('system/extras/ANRdaemon'),
- simple_project_pattern('system/extras/cpustats'),
- simple_project_pattern('system/extras/crypto-perf'),
- simple_project_pattern('system/extras/ext4_utils'),
- simple_project_pattern('system/extras/f2fs_utils'),
- simple_project_pattern('system/extras/iotop'),
- simple_project_pattern('system/extras/libfec'),
- simple_project_pattern('system/extras/memory_replay'),
- simple_project_pattern('system/extras/mmap-perf'),
- simple_project_pattern('system/extras/multinetwork'),
- simple_project_pattern('system/extras/procrank'),
- simple_project_pattern('system/extras/runconuid'),
- simple_project_pattern('system/extras/showmap'),
- simple_project_pattern('system/extras/simpleperf'),
- simple_project_pattern('system/extras/su'),
- simple_project_pattern('system/extras/tests'),
- simple_project_pattern('system/extras/verity'),
- project_name_and_pattern('system/extras/Other', 'system/extras'),
- simple_project_pattern('system/gatekeeper'),
- simple_project_pattern('system/keymaster'),
- simple_project_pattern('system/libhidl'),
- simple_project_pattern('system/libhwbinder'),
- simple_project_pattern('system/media'),
- simple_project_pattern('system/netd'),
- simple_project_pattern('system/nvram'),
- simple_project_pattern('system/security'),
- simple_project_pattern('system/sepolicy'),
- simple_project_pattern('system/tools'),
- simple_project_pattern('system/update_engine'),
- simple_project_pattern('system/vold'),
- project_name_and_pattern('system/Other', 'system'),
- simple_project_pattern('toolchain'),
- simple_project_pattern('test'),
- simple_project_pattern('tools'),
- # match vendor/google* before vendor/
- project_name_and_pattern('vendor/google', 'vendor/google.*'),
- project_name_and_pattern('vendor/non-google', 'vendor'),
- # keep out/obj and other patterns at the end.
- ['out/obj',
- '.*/(gen|obj[^/]*)/(include|EXECUTABLES|SHARED_LIBRARIES|'
- 'STATIC_LIBRARIES|NATIVE_TESTS)/.*: warning:'],
- ['other', '.*'] # all other unrecognized patterns
-]
-
-project_patterns = []
-project_names = []
-warning_messages = []
-warning_records = []
-
-
-def initialize_arrays():
- """Complete global arrays before they are used."""
- global project_names, project_patterns
- project_names = [p[0] for p in project_list]
- project_patterns = [re.compile(p[1]) for p in project_list]
- for w in warn_patterns:
- w['members'] = []
- if 'option' not in w:
- w['option'] = ''
- # Each warning pattern has a 'projects' dictionary, that
- # maps a project name to number of warnings in that project.
- w['projects'] = {}
-
-
-initialize_arrays()
-
-
-android_root = ''
-platform_version = 'unknown'
-target_product = 'unknown'
-target_variant = 'unknown'
-
-
-##### Data and functions to dump html file. ##################################
-
-html_head_scripts = """\
- <script type="text/javascript">
- function expand(id) {
- var e = document.getElementById(id);
- var f = document.getElementById(id + "_mark");
- if (e.style.display == 'block') {
- e.style.display = 'none';
- f.innerHTML = '⊕';
- }
- else {
- e.style.display = 'block';
- f.innerHTML = '⊖';
- }
- };
- function expandCollapse(show) {
- for (var id = 1; ; id++) {
- var e = document.getElementById(id + "");
- var f = document.getElementById(id + "_mark");
- if (!e || !f) break;
- e.style.display = (show ? 'block' : 'none');
- f.innerHTML = (show ? '⊖' : '⊕');
- }
- };
- </script>
- <style type="text/css">
- th,td{border-collapse:collapse; border:1px solid black;}
- .button{color:blue;font-size:110%;font-weight:bolder;}
- .bt{color:black;background-color:transparent;border:none;outline:none;
- font-size:140%;font-weight:bolder;}
- .c0{background-color:#e0e0e0;}
- .c1{background-color:#d0d0d0;}
- .t1{border-collapse:collapse; width:100%; border:1px solid black;}
- </style>
- <script src="https://www.gstatic.com/charts/loader.js"></script>
-"""
-
-
-def html_big(param):
- return '<font size="+2">' + param + '</font>'
-
-
-def dump_html_prologue(title):
- print('<html>\n<head>')
- print('<title>' + title + '</title>')
- print(html_head_scripts)
- emit_stats_by_project()
- print('</head>\n<body>')
- print(html_big(title))
- print('<p>')
-
-
-def dump_html_epilogue():
- print('</body>\n</head>\n</html>')
-
-
-def sort_warnings():
- for i in warn_patterns:
- i['members'] = sorted(set(i['members']))
-
-
-def emit_stats_by_project():
- """Dump a google chart table of warnings per project and severity."""
- # warnings[p][s] is number of warnings in project p of severity s.
- # pylint:disable=g-complex-comprehension
- warnings = {p: {s: 0 for s in Severity.range} for p in project_names}
- for i in warn_patterns:
- s = i['severity']
- for p in i['projects']:
- warnings[p][s] += i['projects'][p]
-
- # total_by_project[p] is number of warnings in project p.
- total_by_project = {p: sum(warnings[p][s] for s in Severity.range)
- for p in project_names}
-
- # total_by_severity[s] is number of warnings of severity s.
- total_by_severity = {s: sum(warnings[p][s] for p in project_names)
- for s in Severity.range}
-
- # emit table header
- stats_header = ['Project']
- for s in Severity.range:
- if total_by_severity[s]:
- stats_header.append("<span style='background-color:{}'>{}</span>".
- format(Severity.colors[s],
- Severity.column_headers[s]))
- stats_header.append('TOTAL')
-
- # emit a row of warning counts per project, skip no-warning projects
- total_all_projects = 0
- stats_rows = []
- for p in project_names:
- if total_by_project[p]:
- one_row = [p]
- for s in Severity.range:
- if total_by_severity[s]:
- one_row.append(warnings[p][s])
- one_row.append(total_by_project[p])
- stats_rows.append(one_row)
- total_all_projects += total_by_project[p]
-
- # emit a row of warning counts per severity
- total_all_severities = 0
- one_row = ['<b>TOTAL</b>']
- for s in Severity.range:
- if total_by_severity[s]:
- one_row.append(total_by_severity[s])
- total_all_severities += total_by_severity[s]
- one_row.append(total_all_projects)
- stats_rows.append(one_row)
- print('<script>')
- emit_const_string_array('StatsHeader', stats_header)
- emit_const_object_array('StatsRows', stats_rows)
- print(draw_table_javascript)
- print('</script>')
-
-
-def dump_stats():
- """Dump some stats about total number of warnings and such."""
- known = 0
- skipped = 0
- unknown = 0
- sort_warnings()
- for i in warn_patterns:
- if i['severity'] == Severity.UNKNOWN:
- unknown += len(i['members'])
- elif i['severity'] == Severity.SKIP:
- skipped += len(i['members'])
- else:
- known += len(i['members'])
- print('Number of classified warnings: <b>' + str(known) + '</b><br>')
- print('Number of skipped warnings: <b>' + str(skipped) + '</b><br>')
- print('Number of unclassified warnings: <b>' + str(unknown) + '</b><br>')
- total = unknown + known + skipped
- extra_msg = ''
- if total < 1000:
- extra_msg = ' (low count may indicate incremental build)'
- print('Total number of warnings: <b>' + str(total) + '</b>' + extra_msg)
-
-
-# New base table of warnings, [severity, warn_id, project, warning_message]
-# Need buttons to show warnings in different grouping options.
-# (1) Current, group by severity, id for each warning pattern
-# sort by severity, warn_id, warning_message
-# (2) Current --byproject, group by severity,
-# id for each warning pattern + project name
-# sort by severity, warn_id, project, warning_message
-# (3) New, group by project + severity,
-# id for each warning pattern
-# sort by project, severity, warn_id, warning_message
-def emit_buttons():
- print('<button class="button" onclick="expandCollapse(1);">'
- 'Expand all warnings</button>\n'
- '<button class="button" onclick="expandCollapse(0);">'
- 'Collapse all warnings</button>\n'
- '<button class="button" onclick="groupBySeverity();">'
- 'Group warnings by severity</button>\n'
- '<button class="button" onclick="groupByProject();">'
- 'Group warnings by project</button><br>')
-
-
-def all_patterns(category):
- patterns = ''
- for i in category['patterns']:
- patterns += i
- patterns += ' / '
- return patterns
-
-
-def dump_fixed():
- """Show which warnings no longer occur."""
- anchor = 'fixed_warnings'
- mark = anchor + '_mark'
- print('\n<br><p style="background-color:lightblue"><b>'
- '<button id="' + mark + '" '
- 'class="bt" onclick="expand(\'' + anchor + '\');">'
- '⊕</button> Fixed warnings. '
- 'No more occurrences. Please consider turning these into '
- 'errors if possible, before they are reintroduced in to the build'
- ':</b></p>')
- print('<blockquote>')
- fixed_patterns = []
- for i in warn_patterns:
- if not i['members']:
- fixed_patterns.append(i['description'] + ' (' +
- all_patterns(i) + ')')
- if i['option']:
- fixed_patterns.append(' ' + i['option'])
- fixed_patterns = sorted(fixed_patterns)
- print('<div id="' + anchor + '" style="display:none;"><table>')
- cur_row_class = 0
- for text in fixed_patterns:
- cur_row_class = 1 - cur_row_class
- # remove last '\n'
- t = text[:-1] if text[-1] == '\n' else text
- print('<tr><td class="c' + str(cur_row_class) + '">' + t + '</td></tr>')
- print('</table></div>')
- print('</blockquote>')
-
-
-def find_project_index(line):
- for p in range(len(project_patterns)):
- if project_patterns[p].match(line):
- return p
- return -1
-
-
-def classify_one_warning(line, results):
- """Classify one warning line."""
- for i in range(len(warn_patterns)):
- w = warn_patterns[i]
- for cpat in w['compiled_patterns']:
- if cpat.match(line):
- p = find_project_index(line)
- results.append([line, i, p])
- return
- else:
- # If we end up here, there was a problem parsing the log
- # probably caused by 'make -j' mixing the output from
- # 2 or more concurrent compiles
- pass
-
-
-def classify_warnings(lines):
- results = []
- for line in lines:
- classify_one_warning(line, results)
- # After the main work, ignore all other signals to a child process,
- # to avoid bad warning/error messages from the exit clean-up process.
- if args.processes > 1:
- signal.signal(signal.SIGTERM, lambda *args: sys.exit(-signal.SIGTERM))
- return results
-
-
-def parallel_classify_warnings(warning_lines):
- """Classify all warning lines with num_cpu parallel processes."""
- compile_patterns()
- num_cpu = args.processes
- if num_cpu > 1:
- groups = [[] for x in range(num_cpu)]
- i = 0
- for x in warning_lines:
- groups[i].append(x)
- i = (i + 1) % num_cpu
- pool = multiprocessing.Pool(num_cpu)
- group_results = pool.map(classify_warnings, groups)
- else:
- group_results = [classify_warnings(warning_lines)]
-
- for result in group_results:
- for line, pattern_idx, project_idx in result:
- pattern = warn_patterns[pattern_idx]
- pattern['members'].append(line)
- message_idx = len(warning_messages)
- warning_messages.append(line)
- warning_records.append([pattern_idx, project_idx, message_idx])
- pname = '???' if project_idx < 0 else project_names[project_idx]
- # Count warnings by project.
- if pname in pattern['projects']:
- pattern['projects'][pname] += 1
- else:
- pattern['projects'][pname] = 1
-
-
-def compile_patterns():
- """Precompiling every pattern speeds up parsing by about 30x."""
- for i in warn_patterns:
- i['compiled_patterns'] = []
- for pat in i['patterns']:
- i['compiled_patterns'].append(re.compile(pat))
-
-
-def find_android_root(path):
- """Set and return android_root path if it is found."""
- global android_root
- parts = path.split('/')
- for idx in reversed(range(2, len(parts))):
- root_path = '/'.join(parts[:idx])
- # Android root directory should contain this script.
- if os.path.exists(root_path + '/build/make/tools/warn.py'):
- android_root = root_path
- return root_path
- return ''
-
-
-def remove_android_root_prefix(path):
- """Remove android_root prefix from path if it is found."""
- if path.startswith(android_root):
- return path[1 + len(android_root):]
- else:
- return path
-
-
-def normalize_path(path):
- """Normalize file path relative to android_root."""
- # If path is not an absolute path, just normalize it.
- path = os.path.normpath(path)
- if path[0] != '/':
- return path
- # Remove known prefix of root path and normalize the suffix.
- if android_root or find_android_root(path):
- return remove_android_root_prefix(path)
- else:
- return path
-
-
-def normalize_warning_line(line):
- """Normalize file path relative to android_root in a warning line."""
- # replace fancy quotes with plain ol' quotes
- line = re.sub(u'[\u2018\u2019]', '\'', line)
- # replace non-ASCII chars to spaces
- line = re.sub(u'[^\x00-\x7f]', ' ', line)
- line = line.strip()
- first_column = line.find(':')
- if first_column > 0:
- return normalize_path(line[:first_column]) + line[first_column:]
- else:
- return line
-
-
-def parse_input_file(infile):
- """Parse input file, collect parameters and warning lines."""
- global android_root
- global platform_version
- global target_product
- global target_variant
- line_counter = 0
-
- # rustc warning messages have two lines that should be combined:
- # warning: description
- # --> file_path:line_number:column_number
- # Some warning messages have no file name:
- # warning: macro replacement list ... [bugprone-macro-parentheses]
- # Some makefile warning messages have no line number:
- # some/path/file.mk: warning: description
- # C/C++ compiler warning messages have line and column numbers:
- # some/path/file.c:line_number:column_number: warning: description
- warning_pattern = re.compile('(^[^ ]*/[^ ]*: warning: .*)|(^warning: .*)')
- warning_without_file = re.compile('^warning: .*')
- rustc_file_position = re.compile('^[ ]+--> [^ ]*/[^ ]*:[0-9]+:[0-9]+')
-
- # Collect all warnings into the warning_lines set.
- warning_lines = set()
- prev_warning = ''
- for line in infile:
- if prev_warning:
- if rustc_file_position.match(line):
- # must be a rustc warning, combine 2 lines into one warning
- line = line.strip().replace('--> ', '') + ': ' + prev_warning
- warning_lines.add(normalize_warning_line(line))
- prev_warning = ''
- continue
- # add prev_warning, and then process the current line
- prev_warning = 'unknown_source_file: ' + prev_warning
- warning_lines.add(normalize_warning_line(prev_warning))
- prev_warning = ''
- if warning_pattern.match(line):
- if warning_without_file.match(line):
- # save this line and combine it with the next line
- prev_warning = line
- else:
- warning_lines.add(normalize_warning_line(line))
- continue
- if line_counter < 100:
- # save a little bit of time by only doing this for the first few lines
- line_counter += 1
- m = re.search('(?<=^PLATFORM_VERSION=).*', line)
- if m is not None:
- platform_version = m.group(0)
- m = re.search('(?<=^TARGET_PRODUCT=).*', line)
- if m is not None:
- target_product = m.group(0)
- m = re.search('(?<=^TARGET_BUILD_VARIANT=).*', line)
- if m is not None:
- target_variant = m.group(0)
- m = re.search('.* TOP=([^ ]*) .*', line)
- if m is not None:
- android_root = m.group(1)
- return warning_lines
-
-
-# Return s with escaped backslash and quotation characters.
-def escape_string(s):
- return s.replace('\\', '\\\\').replace('"', '\\"')
-
-
-# Return s without trailing '\n' and escape the quotation characters.
-def strip_escape_string(s):
- if not s:
- return s
- s = s[:-1] if s[-1] == '\n' else s
- return escape_string(s)
-
-
-def emit_warning_array(name):
- print('var warning_{} = ['.format(name))
- for i in range(len(warn_patterns)):
- print('{},'.format(warn_patterns[i][name]))
- print('];')
-
-
-def emit_warning_arrays():
- emit_warning_array('severity')
- print('var warning_description = [')
- for i in range(len(warn_patterns)):
- if warn_patterns[i]['members']:
- print('"{}",'.format(escape_string(warn_patterns[i]['description'])))
- else:
- print('"",') # no such warning
- print('];')
-
-
-scripts_for_warning_groups = """
- function compareMessages(x1, x2) { // of the same warning type
- return (WarningMessages[x1[2]] <= WarningMessages[x2[2]]) ? -1 : 1;
- }
- function byMessageCount(x1, x2) {
- return x2[2] - x1[2]; // reversed order
- }
- function bySeverityMessageCount(x1, x2) {
- // orer by severity first
- if (x1[1] != x2[1])
- return x1[1] - x2[1];
- return byMessageCount(x1, x2);
- }
- const ParseLinePattern = /^([^ :]+):(\\d+):(.+)/;
- function addURL(line) {
- if (FlagURL == "") return line;
- if (FlagSeparator == "") {
- return line.replace(ParseLinePattern,
- "<a target='_blank' href='" + FlagURL + "/$1'>$1</a>:$2:$3");
- }
- return line.replace(ParseLinePattern,
- "<a target='_blank' href='" + FlagURL + "/$1" + FlagSeparator +
- "$2'>$1:$2</a>:$3");
- }
- function createArrayOfDictionaries(n) {
- var result = [];
- for (var i=0; i<n; i++) result.push({});
- return result;
- }
- function groupWarningsBySeverity() {
- // groups is an array of dictionaries,
- // each dictionary maps from warning type to array of warning messages.
- var groups = createArrayOfDictionaries(SeverityColors.length);
- for (var i=0; i<Warnings.length; i++) {
- var w = Warnings[i][0];
- var s = WarnPatternsSeverity[w];
- var k = w.toString();
- if (!(k in groups[s]))
- groups[s][k] = [];
- groups[s][k].push(Warnings[i]);
- }
- return groups;
- }
- function groupWarningsByProject() {
- var groups = createArrayOfDictionaries(ProjectNames.length);
- for (var i=0; i<Warnings.length; i++) {
- var w = Warnings[i][0];
- var p = Warnings[i][1];
- var k = w.toString();
- if (!(k in groups[p]))
- groups[p][k] = [];
- groups[p][k].push(Warnings[i]);
- }
- return groups;
- }
- var GlobalAnchor = 0;
- function createWarningSection(header, color, group) {
- var result = "";
- var groupKeys = [];
- var totalMessages = 0;
- for (var k in group) {
- totalMessages += group[k].length;
- groupKeys.push([k, WarnPatternsSeverity[parseInt(k)], group[k].length]);
- }
- groupKeys.sort(bySeverityMessageCount);
- for (var idx=0; idx<groupKeys.length; idx++) {
- var k = groupKeys[idx][0];
- var messages = group[k];
- var w = parseInt(k);
- var wcolor = SeverityColors[WarnPatternsSeverity[w]];
- var description = WarnPatternsDescription[w];
- if (description.length == 0)
- description = "???";
- GlobalAnchor += 1;
- result += "<table class='t1'><tr bgcolor='" + wcolor + "'><td>" +
- "<button class='bt' id='" + GlobalAnchor + "_mark" +
- "' onclick='expand(\\"" + GlobalAnchor + "\\");'>" +
- "⊕</button> " +
- description + " (" + messages.length + ")</td></tr></table>";
- result += "<div id='" + GlobalAnchor +
- "' style='display:none;'><table class='t1'>";
- var c = 0;
- messages.sort(compareMessages);
- for (var i=0; i<messages.length; i++) {
- result += "<tr><td class='c" + c + "'>" +
- addURL(WarningMessages[messages[i][2]]) + "</td></tr>";
- c = 1 - c;
- }
- result += "</table></div>";
- }
- if (result.length > 0) {
- return "<br><span style='background-color:" + color + "'><b>" +
- header + ": " + totalMessages +
- "</b></span><blockquote><table class='t1'>" +
- result + "</table></blockquote>";
-
- }
- return ""; // empty section
- }
- function generateSectionsBySeverity() {
- var result = "";
- var groups = groupWarningsBySeverity();
- for (s=0; s<SeverityColors.length; s++) {
- result += createWarningSection(SeverityHeaders[s], SeverityColors[s], groups[s]);
- }
- return result;
- }
- function generateSectionsByProject() {
- var result = "";
- var groups = groupWarningsByProject();
- for (i=0; i<groups.length; i++) {
- result += createWarningSection(ProjectNames[i], 'lightgrey', groups[i]);
- }
- return result;
- }
- function groupWarnings(generator) {
- GlobalAnchor = 0;
- var e = document.getElementById("warning_groups");
- e.innerHTML = generator();
- }
- function groupBySeverity() {
- groupWarnings(generateSectionsBySeverity);
- }
- function groupByProject() {
- groupWarnings(generateSectionsByProject);
- }
-"""
-
-
-# Emit a JavaScript const string
-def emit_const_string(name, value):
- print('const ' + name + ' = "' + escape_string(value) + '";')
-
-
-# Emit a JavaScript const integer array.
-def emit_const_int_array(name, array):
- print('const ' + name + ' = [')
- for n in array:
- print(str(n) + ',')
- print('];')
-
-
-# Emit a JavaScript const string array.
-def emit_const_string_array(name, array):
- print('const ' + name + ' = [')
- for s in array:
- print('"' + strip_escape_string(s) + '",')
- print('];')
-
-
-# Emit a JavaScript const string array for HTML.
-def emit_const_html_string_array(name, array):
- print('const ' + name + ' = [')
- for s in array:
- # Not using html.escape yet, to work for both python 2 and 3,
- # until all users switch to python 3.
- # pylint:disable=deprecated-method
- print('"' + cgi.escape(strip_escape_string(s)) + '",')
- print('];')
-
-
-# Emit a JavaScript const object array.
-def emit_const_object_array(name, array):
- print('const ' + name + ' = [')
- for x in array:
- print(str(x) + ',')
- print('];')
-
-
-def emit_js_data():
- """Dump dynamic HTML page's static JavaScript data."""
- emit_const_string('FlagURL', args.url if args.url else '')
- emit_const_string('FlagSeparator', args.separator if args.separator else '')
- emit_const_string_array('SeverityColors', Severity.colors)
- emit_const_string_array('SeverityHeaders', Severity.headers)
- emit_const_string_array('SeverityColumnHeaders', Severity.column_headers)
- emit_const_string_array('ProjectNames', project_names)
- emit_const_int_array('WarnPatternsSeverity',
- [w['severity'] for w in warn_patterns])
- emit_const_html_string_array('WarnPatternsDescription',
- [w['description'] for w in warn_patterns])
- emit_const_html_string_array('WarnPatternsOption',
- [w['option'] for w in warn_patterns])
- emit_const_html_string_array('WarningMessages', warning_messages)
- emit_const_object_array('Warnings', warning_records)
-
-draw_table_javascript = """
-google.charts.load('current', {'packages':['table']});
-google.charts.setOnLoadCallback(drawTable);
-function drawTable() {
- var data = new google.visualization.DataTable();
- data.addColumn('string', StatsHeader[0]);
- for (var i=1; i<StatsHeader.length; i++) {
- data.addColumn('number', StatsHeader[i]);
- }
- data.addRows(StatsRows);
- for (var i=0; i<StatsRows.length; i++) {
- for (var j=0; j<StatsHeader.length; j++) {
- data.setProperty(i, j, 'style', 'border:1px solid black;');
- }
- }
- var table = new google.visualization.Table(document.getElementById('stats_table'));
- table.draw(data, {allowHtml: true, alternatingRowStyle: true});
-}
-"""
-
-
-def dump_html():
- """Dump the html output to stdout."""
- dump_html_prologue('Warnings for ' + platform_version + ' - ' +
- target_product + ' - ' + target_variant)
- dump_stats()
- print('<br><div id="stats_table"></div><br>')
- print('\n<script>')
- emit_js_data()
- print(scripts_for_warning_groups)
- print('</script>')
- emit_buttons()
- # Warning messages are grouped by severities or project names.
- print('<br><div id="warning_groups"></div>')
- if args.byproject:
- print('<script>groupByProject();</script>')
- else:
- print('<script>groupBySeverity();</script>')
- dump_fixed()
- dump_html_epilogue()
-
-
-##### Functions to count warnings and dump csv file. #########################
-
-
-def description_for_csv(category):
- if not category['description']:
- return '?'
- return category['description']
-
-
-def count_severity(writer, sev, kind):
- """Count warnings of given severity."""
- total = 0
- for i in warn_patterns:
- if i['severity'] == sev and i['members']:
- n = len(i['members'])
- total += n
- warning = kind + ': ' + description_for_csv(i)
- writer.writerow([n, '', warning])
- # print number of warnings for each project, ordered by project name.
- projects = sorted(i['projects'].keys())
- for p in projects:
- writer.writerow([i['projects'][p], p, warning])
- writer.writerow([total, '', kind + ' warnings'])
-
- return total
-
-
-# dump number of warnings in csv format to stdout
-def dump_csv(writer):
- """Dump number of warnings in csv format to stdout."""
- sort_warnings()
- total = 0
- for s in Severity.range:
- total += count_severity(writer, s, Severity.column_headers[s])
- writer.writerow([total, '', 'All warnings'])
-
def main():
- # We must use 'utf-8' codec to parse some non-ASCII code in warnings.
- warning_lines = parse_input_file(
- io.open(args.buildlog, mode='r', encoding='utf-8'))
- parallel_classify_warnings(warning_lines)
- # If a user pases a csv path, save the fileoutput to the path
- # If the user also passed gencsv write the output to stdout
- # If the user did not pass gencsv flag dump the html report to stdout.
- if args.csvpath:
- with open(args.csvpath, 'w') as f:
- dump_csv(csv.writer(f, lineterminator='\n'))
- if args.gencsv:
- dump_csv(csv.writer(sys.stdout, lineterminator='\n'))
- else:
- dump_html()
+ os.environ['PYTHONPATH'] = os.path.dirname(os.path.abspath(__file__))
+ subprocess.check_call(['/usr/bin/python', '-m', 'warn.warn'] + sys.argv[1:])
-# Run main function if warn.py is the main program.
if __name__ == '__main__':
main()
diff --git a/tools/warn/OWNERS b/tools/warn/OWNERS
new file mode 100644
index 0000000..8551802
--- /dev/null
+++ b/tools/warn/OWNERS
@@ -0,0 +1 @@
+per-file * = chh@google.com,srhines@google.com
diff --git a/tools/warn/__init__.py b/tools/warn/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/tools/warn/__init__.py
diff --git a/tools/warn/android_project_list.py b/tools/warn/android_project_list.py
new file mode 100644
index 0000000..4726fa2
--- /dev/null
+++ b/tools/warn/android_project_list.py
@@ -0,0 +1,175 @@
+# python3
+# Copyright (C) 2019 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.
+
+"""Define a project list to sort warnings by project directory path."""
+
+
+def create_pattern(name, pattern=None):
+ if pattern is not None:
+ return [name, '(^|.*/)' + pattern + '/.*: warning:']
+ return [name, '(^|.*/)' + name + '/.*: warning:']
+
+
+# A list of [project_name, file_path_pattern].
+# project_name should not contain comma, to be used in CSV output.
+project_list = [
+ create_pattern('art'),
+ create_pattern('bionic'),
+ create_pattern('bootable'),
+ create_pattern('build'),
+ create_pattern('cts'),
+ create_pattern('dalvik'),
+ create_pattern('developers'),
+ create_pattern('development'),
+ create_pattern('device'),
+ create_pattern('doc'),
+ # match external/google* before external/
+ create_pattern('external/google', 'external/google.*'),
+ create_pattern('external/non-google', 'external'),
+ create_pattern('frameworks/av/camera'),
+ create_pattern('frameworks/av/cmds'),
+ create_pattern('frameworks/av/drm'),
+ create_pattern('frameworks/av/include'),
+ create_pattern('frameworks/av/media/img_utils'),
+ create_pattern('frameworks/av/media/libcpustats'),
+ create_pattern('frameworks/av/media/libeffects'),
+ create_pattern('frameworks/av/media/libmediaplayerservice'),
+ create_pattern('frameworks/av/media/libmedia'),
+ create_pattern('frameworks/av/media/libstagefright'),
+ create_pattern('frameworks/av/media/mtp'),
+ create_pattern('frameworks/av/media/ndk'),
+ create_pattern('frameworks/av/media/utils'),
+ create_pattern('frameworks/av/media/Other', 'frameworks/av/media'),
+ create_pattern('frameworks/av/radio'),
+ create_pattern('frameworks/av/services'),
+ create_pattern('frameworks/av/soundtrigger'),
+ create_pattern('frameworks/av/Other', 'frameworks/av'),
+ create_pattern('frameworks/base/cmds'),
+ create_pattern('frameworks/base/core'),
+ create_pattern('frameworks/base/drm'),
+ create_pattern('frameworks/base/media'),
+ create_pattern('frameworks/base/libs'),
+ create_pattern('frameworks/base/native'),
+ create_pattern('frameworks/base/packages'),
+ create_pattern('frameworks/base/rs'),
+ create_pattern('frameworks/base/services'),
+ create_pattern('frameworks/base/tests'),
+ create_pattern('frameworks/base/tools'),
+ create_pattern('frameworks/base/Other', 'frameworks/base'),
+ create_pattern('frameworks/compile/libbcc'),
+ create_pattern('frameworks/compile/mclinker'),
+ create_pattern('frameworks/compile/slang'),
+ create_pattern('frameworks/compile/Other', 'frameworks/compile'),
+ create_pattern('frameworks/minikin'),
+ create_pattern('frameworks/ml'),
+ create_pattern('frameworks/native/cmds'),
+ create_pattern('frameworks/native/include'),
+ create_pattern('frameworks/native/libs'),
+ create_pattern('frameworks/native/opengl'),
+ create_pattern('frameworks/native/services'),
+ create_pattern('frameworks/native/vulkan'),
+ create_pattern('frameworks/native/Other', 'frameworks/native'),
+ create_pattern('frameworks/opt'),
+ create_pattern('frameworks/rs'),
+ create_pattern('frameworks/webview'),
+ create_pattern('frameworks/wilhelm'),
+ create_pattern('frameworks/Other', 'frameworks'),
+ create_pattern('hardware/akm'),
+ create_pattern('hardware/broadcom'),
+ create_pattern('hardware/google'),
+ create_pattern('hardware/intel'),
+ create_pattern('hardware/interfaces'),
+ create_pattern('hardware/libhardware'),
+ create_pattern('hardware/libhardware_legacy'),
+ create_pattern('hardware/qcom'),
+ create_pattern('hardware/ril'),
+ create_pattern('hardware/Other', 'hardware'),
+ create_pattern('kernel'),
+ create_pattern('libcore'),
+ create_pattern('libnativehelper'),
+ create_pattern('ndk'),
+ # match vendor/unbungled_google/packages before other packages
+ create_pattern('unbundled_google'),
+ create_pattern('packages'),
+ create_pattern('pdk'),
+ create_pattern('prebuilts'),
+ create_pattern('system/bt'),
+ create_pattern('system/connectivity'),
+ create_pattern('system/core/adb'),
+ create_pattern('system/core/base'),
+ create_pattern('system/core/debuggerd'),
+ create_pattern('system/core/fastboot'),
+ create_pattern('system/core/fingerprintd'),
+ create_pattern('system/core/fs_mgr'),
+ create_pattern('system/core/gatekeeperd'),
+ create_pattern('system/core/healthd'),
+ create_pattern('system/core/include'),
+ create_pattern('system/core/init'),
+ create_pattern('system/core/libbacktrace'),
+ create_pattern('system/core/liblog'),
+ create_pattern('system/core/libpixelflinger'),
+ create_pattern('system/core/libprocessgroup'),
+ create_pattern('system/core/libsysutils'),
+ create_pattern('system/core/logcat'),
+ create_pattern('system/core/logd'),
+ create_pattern('system/core/run-as'),
+ create_pattern('system/core/sdcard'),
+ create_pattern('system/core/toolbox'),
+ create_pattern('system/core/Other', 'system/core'),
+ create_pattern('system/extras/ANRdaemon'),
+ create_pattern('system/extras/cpustats'),
+ create_pattern('system/extras/crypto-perf'),
+ create_pattern('system/extras/ext4_utils'),
+ create_pattern('system/extras/f2fs_utils'),
+ create_pattern('system/extras/iotop'),
+ create_pattern('system/extras/libfec'),
+ create_pattern('system/extras/memory_replay'),
+ create_pattern('system/extras/mmap-perf'),
+ create_pattern('system/extras/multinetwork'),
+ create_pattern('system/extras/perfprofd'),
+ create_pattern('system/extras/procrank'),
+ create_pattern('system/extras/runconuid'),
+ create_pattern('system/extras/showmap'),
+ create_pattern('system/extras/simpleperf'),
+ create_pattern('system/extras/su'),
+ create_pattern('system/extras/tests'),
+ create_pattern('system/extras/verity'),
+ create_pattern('system/extras/Other', 'system/extras'),
+ create_pattern('system/gatekeeper'),
+ create_pattern('system/keymaster'),
+ create_pattern('system/libhidl'),
+ create_pattern('system/libhwbinder'),
+ create_pattern('system/media'),
+ create_pattern('system/netd'),
+ create_pattern('system/nvram'),
+ create_pattern('system/security'),
+ create_pattern('system/sepolicy'),
+ create_pattern('system/tools'),
+ create_pattern('system/update_engine'),
+ create_pattern('system/vold'),
+ create_pattern('system/Other', 'system'),
+ create_pattern('toolchain'),
+ create_pattern('test'),
+ create_pattern('tools'),
+ # match vendor/google* before vendor/
+ create_pattern('vendor/google', 'vendor/google.*'),
+ create_pattern('vendor/non-google', 'vendor'),
+ # keep out/obj and other patterns at the end.
+ [
+ 'out/obj', '.*/(gen|obj[^/]*)/(include|EXECUTABLES|SHARED_LIBRARIES|'
+ 'STATIC_LIBRARIES|NATIVE_TESTS)/.*: warning:'
+ ],
+ ['other', '.*'] # all other unrecognized patterns
+]
diff --git a/tools/warn/chrome_project_list.py b/tools/warn/chrome_project_list.py
new file mode 100644
index 0000000..6096522
--- /dev/null
+++ b/tools/warn/chrome_project_list.py
@@ -0,0 +1,686 @@
+# python3
+"""Clang_Tidy_Warn Project List data for Chrome.
+
+This file stores the Chrome project_list used in warn.py and
+its dependencies. It has been put into this file for easier navigation and
+unification of the Chrome and Android warn.py.
+"""
+
+
+def create_pattern(pattern):
+ return [pattern, '(^|.*/)' + pattern + '/.*: warning:']
+
+
+# A list of [project_name, file_path_pattern].
+project_list = [
+ create_pattern('android_webview'),
+ create_pattern('apps'),
+ create_pattern('ash/app_list'),
+ create_pattern('ash/public'),
+ create_pattern('ash/assistant'),
+ create_pattern('ash/display'),
+ create_pattern('ash/resources'),
+ create_pattern('ash/login'),
+ create_pattern('ash/system'),
+ create_pattern('ash/wm'),
+ create_pattern('ash/shelf'),
+ create_pattern('ash'),
+ create_pattern('base/trace_event'),
+ create_pattern('base/debug'),
+ create_pattern('base/third_party'),
+ create_pattern('base/files'),
+ create_pattern('base/test'),
+ create_pattern('base/util'),
+ create_pattern('base/task'),
+ create_pattern('base/metrics'),
+ create_pattern('base/strings'),
+ create_pattern('base/memory'),
+ create_pattern('base'),
+ create_pattern('build'),
+ create_pattern('build_overrides'),
+ create_pattern('buildtools'),
+ create_pattern('cc'),
+ create_pattern('chrome/services'),
+ create_pattern('chrome/app'),
+ create_pattern('chrome/renderer'),
+ create_pattern('chrome/test'),
+ create_pattern('chrome/common/safe_browsing'),
+ create_pattern('chrome/common/importer'),
+ create_pattern('chrome/common/media_router'),
+ create_pattern('chrome/common/extensions'),
+ create_pattern('chrome/common'),
+ create_pattern('chrome/browser/sync_file_system'),
+ create_pattern('chrome/browser/safe_browsing'),
+ create_pattern('chrome/browser/download'),
+ create_pattern('chrome/browser/ui'),
+ create_pattern('chrome/browser/supervised_user'),
+ create_pattern('chrome/browser/search'),
+ create_pattern('chrome/browser/browsing_data'),
+ create_pattern('chrome/browser/predictors'),
+ create_pattern('chrome/browser/net'),
+ create_pattern('chrome/browser/devtools'),
+ create_pattern('chrome/browser/resource_coordinator'),
+ create_pattern('chrome/browser/page_load_metrics'),
+ create_pattern('chrome/browser/extensions'),
+ create_pattern('chrome/browser/ssl'),
+ create_pattern('chrome/browser/printing'),
+ create_pattern('chrome/browser/profiles'),
+ create_pattern('chrome/browser/chromeos'),
+ create_pattern('chrome/browser/performance_manager'),
+ create_pattern('chrome/browser/metrics'),
+ create_pattern('chrome/browser/component_updater'),
+ create_pattern('chrome/browser/media'),
+ create_pattern('chrome/browser/notifications'),
+ create_pattern('chrome/browser/web_applications'),
+ create_pattern('chrome/browser/media_galleries'),
+ create_pattern('chrome/browser'),
+ create_pattern('chrome'),
+ create_pattern('chromecast'),
+ create_pattern('chromeos/services'),
+ create_pattern('chromeos/dbus'),
+ create_pattern('chromeos/assistant'),
+ create_pattern('chromeos/components'),
+ create_pattern('chromeos/settings'),
+ create_pattern('chromeos/constants'),
+ create_pattern('chromeos/network'),
+ create_pattern('chromeos'),
+ create_pattern('cloud_print'),
+ create_pattern('components/crash'),
+ create_pattern('components/subresource_filter'),
+ create_pattern('components/invalidation'),
+ create_pattern('components/autofill'),
+ create_pattern('components/onc'),
+ create_pattern('components/arc'),
+ create_pattern('components/safe_browsing'),
+ create_pattern('components/services'),
+ create_pattern('components/cast_channel'),
+ create_pattern('components/download'),
+ create_pattern('components/feed'),
+ create_pattern('components/offline_pages'),
+ create_pattern('components/bookmarks'),
+ create_pattern('components/cloud_devices'),
+ create_pattern('components/mirroring'),
+ create_pattern('components/spellcheck'),
+ create_pattern('components/viz'),
+ create_pattern('components/gcm_driver'),
+ create_pattern('components/ntp_snippets'),
+ create_pattern('components/translate'),
+ create_pattern('components/search_engines'),
+ create_pattern('components/background_task_scheduler'),
+ create_pattern('components/signin'),
+ create_pattern('components/chromeos_camera'),
+ create_pattern('components/reading_list'),
+ create_pattern('components/assist_ranker'),
+ create_pattern('components/payments'),
+ create_pattern('components/feedback'),
+ create_pattern('components/ui_devtools'),
+ create_pattern('components/password_manager'),
+ create_pattern('components/omnibox'),
+ create_pattern('components/content_settings'),
+ create_pattern('components/dom_distiller'),
+ create_pattern('components/nacl'),
+ create_pattern('components/metrics'),
+ create_pattern('components/policy'),
+ create_pattern('components/optimization_guide'),
+ create_pattern('components/exo'),
+ create_pattern('components/update_client'),
+ create_pattern('components/data_reduction_proxy'),
+ create_pattern('components/sync'),
+ create_pattern('components/drive'),
+ create_pattern('components/variations'),
+ create_pattern('components/history'),
+ create_pattern('components/webcrypto'),
+ create_pattern('components'),
+ create_pattern('content/public'),
+ create_pattern('content/renderer'),
+ create_pattern('content/test'),
+ create_pattern('content/common'),
+ create_pattern('content/browser'),
+ create_pattern('content/zygote'),
+ create_pattern('content'),
+ create_pattern('courgette'),
+ create_pattern('crypto'),
+ create_pattern('dbus'),
+ create_pattern('device/base'),
+ create_pattern('device/vr'),
+ create_pattern('device/gamepad'),
+ create_pattern('device/test'),
+ create_pattern('device/fido'),
+ create_pattern('device/bluetooth'),
+ create_pattern('device'),
+ create_pattern('docs'),
+ create_pattern('extensions/docs'),
+ create_pattern('extensions/components'),
+ create_pattern('extensions/buildflags'),
+ create_pattern('extensions/renderer'),
+ create_pattern('extensions/test'),
+ create_pattern('extensions/common'),
+ create_pattern('extensions/shell'),
+ create_pattern('extensions/browser'),
+ create_pattern('extensions/strings'),
+ create_pattern('extensions'),
+ create_pattern('fuchsia'),
+ create_pattern('gin'),
+ create_pattern('google_apis'),
+ create_pattern('google_update'),
+ create_pattern('gpu/perftests'),
+ create_pattern('gpu/GLES2'),
+ create_pattern('gpu/command_buffer'),
+ create_pattern('gpu/tools'),
+ create_pattern('gpu/gles2_conform_support'),
+ create_pattern('gpu/ipc'),
+ create_pattern('gpu/khronos_glcts_support'),
+ create_pattern('gpu'),
+ create_pattern('headless'),
+ create_pattern('infra'),
+ create_pattern('ipc'),
+ create_pattern('jingle'),
+ create_pattern('media'),
+ create_pattern('mojo'),
+ create_pattern('native_client'),
+ create_pattern('ative_client_sdk'),
+ create_pattern('net'),
+ create_pattern('out'),
+ create_pattern('pdf'),
+ create_pattern('ppapi'),
+ create_pattern('printing'),
+ create_pattern('remoting'),
+ create_pattern('rlz'),
+ create_pattern('sandbox'),
+ create_pattern('services/audio'),
+ create_pattern('services/content'),
+ create_pattern('services/data_decoder'),
+ create_pattern('services/device'),
+ create_pattern('services/file'),
+ create_pattern('services/identity'),
+ create_pattern('services/image_annotation'),
+ create_pattern('services/media_session'),
+ create_pattern('services/metrics'),
+ create_pattern('services/network'),
+ create_pattern('services/preferences'),
+ create_pattern('services/proxy_resolver'),
+ create_pattern('services/resource_coordinator'),
+ create_pattern('services/service_manager'),
+ create_pattern('services/shape_detection'),
+ create_pattern('services/strings'),
+ create_pattern('services/test'),
+ create_pattern('services/tracing'),
+ create_pattern('services/video_capture'),
+ create_pattern('services/viz'),
+ create_pattern('services/ws'),
+ create_pattern('services'),
+ create_pattern('skia/config'),
+ create_pattern('skia/ext'),
+ create_pattern('skia/public'),
+ create_pattern('skia/tools'),
+ create_pattern('skia'),
+ create_pattern('sql'),
+ create_pattern('storage'),
+ create_pattern('styleguide'),
+ create_pattern('testing'),
+ create_pattern('third_party/Python-Markdown'),
+ create_pattern('third_party/SPIRV-Tools'),
+ create_pattern('third_party/abseil-cpp'),
+ create_pattern('third_party/accessibility-audit'),
+ create_pattern('third_party/accessibility_test_framework'),
+ create_pattern('third_party/adobe'),
+ create_pattern('third_party/afl'),
+ create_pattern('third_party/android_build_tools'),
+ create_pattern('third_party/android_crazy_linker'),
+ create_pattern('third_party/android_data_chart'),
+ create_pattern('third_party/android_deps'),
+ create_pattern('third_party/android_media'),
+ create_pattern('third_party/android_ndk'),
+ create_pattern('third_party/android_opengl'),
+ create_pattern('third_party/android_platform'),
+ create_pattern('third_party/android_protobuf'),
+ create_pattern('third_party/android_sdk'),
+ create_pattern('third_party/android_support_test_runner'),
+ create_pattern('third_party/android_swipe_refresh'),
+ create_pattern('third_party/android_system_sdk'),
+ create_pattern('third_party/android_tools'),
+ create_pattern('third_party/angle'),
+ create_pattern('third_party/apache-mac'),
+ create_pattern('third_party/apache-portable-runtime'),
+ create_pattern('third_party/apache-win32'),
+ create_pattern('third_party/apk-patch-size-estimator'),
+ create_pattern('third_party/apple_apsl'),
+ create_pattern('third_party/arcore-android-sdk'),
+ create_pattern('third_party/ashmem'),
+ create_pattern('third_party/auto'),
+ create_pattern('third_party/axe-core'),
+ create_pattern('third_party/bazel'),
+ create_pattern('third_party/binutils'),
+ create_pattern('third_party/bison'),
+ create_pattern('third_party/blanketjs'),
+ create_pattern('third_party/blink/common'),
+ create_pattern('third_party/blink/manual_tests'),
+ create_pattern('third_party/blink/perf_tests'),
+ create_pattern('third_party/blink/public/common'),
+ create_pattern('third_party/blink/public/default_100_percent'),
+ create_pattern('third_party/blink/public/default_200_percent'),
+ create_pattern('third_party/blink/public/platform'),
+ create_pattern('third_party/blink/public/mojom/ad_tagging'),
+ create_pattern('third_party/blink/public/mojom/app_banner'),
+ create_pattern('third_party/blink/public/mojom/appcache'),
+ create_pattern('third_party/blink/public/mojom/array_buffer'),
+ create_pattern('third_party/blink/public/mojom/associated_interfaces'),
+ create_pattern('third_party/blink/public/mojom/autoplay'),
+ create_pattern('third_party/blink/public/mojom/background_fetch'),
+ create_pattern('third_party/blink/public/mojom/background_sync'),
+ create_pattern('third_party/blink/public/mojom/badging'),
+ create_pattern('third_party/blink/public/mojom/blob'),
+ create_pattern('third_party/blink/public/mojom/bluetooth'),
+ create_pattern('third_party/blink/public/mojom/broadcastchannel'),
+ create_pattern('third_party/blink/public/mojom/cache_storage'),
+ create_pattern('third_party/blink/public/mojom/choosers'),
+ create_pattern('third_party/blink/public/mojom/clipboard'),
+ create_pattern('third_party/blink/public/mojom/commit_result'),
+ create_pattern('third_party/blink/public/mojom/contacts'),
+ create_pattern('third_party/blink/public/mojom/cookie_store'),
+ create_pattern('third_party/blink/public/mojom/crash'),
+ create_pattern('third_party/blink/public/mojom/credentialmanager'),
+ create_pattern('third_party/blink/public/mojom/csp'),
+ create_pattern('third_party/blink/public/mojom/devtools'),
+ create_pattern('third_party/blink/public/mojom/document_metadata'),
+ create_pattern('third_party/blink/public/mojom/dom_storage'),
+ create_pattern('third_party/blink/public/mojom/dwrite_font_proxy'),
+ create_pattern('third_party/blink/public/mojom/feature_policy'),
+ create_pattern('third_party/blink/public/mojom/fetch'),
+ create_pattern('third_party/blink/public/mojom/file'),
+ create_pattern('third_party/blink/public/mojom/filesystem'),
+ create_pattern('third_party/blink/public/mojom/font_unique_name_lookup'),
+ create_pattern('third_party/blink/public/mojom/frame'),
+ create_pattern('third_party/blink/public/mojom/frame_sinks'),
+ create_pattern('third_party/blink/public/mojom/geolocation'),
+ create_pattern('third_party/blink/public/mojom/hyphenation'),
+ create_pattern('third_party/blink/public/mojom/idle'),
+ create_pattern('third_party/blink/public/mojom/indexeddb'),
+ create_pattern('third_party/blink/public/mojom/input'),
+ create_pattern('third_party/blink/public/mojom/insecure_input'),
+ create_pattern('third_party/blink/public/mojom/installation'),
+ create_pattern('third_party/blink/public/mojom/installedapp'),
+ create_pattern('third_party/blink/public/mojom/keyboard_lock'),
+ create_pattern('third_party/blink/public/mojom/leak_detector'),
+ create_pattern('third_party/blink/public/mojom/loader'),
+ create_pattern('third_party/blink/public/mojom/locks'),
+ create_pattern('third_party/blink/public/mojom/manifest'),
+ create_pattern('third_party/blink/public/mojom/media_controls'),
+ create_pattern('third_party/blink/public/mojom/mediasession'),
+ create_pattern('third_party/blink/public/mojom/mediastream'),
+ create_pattern('third_party/blink/public/mojom/messaging'),
+ create_pattern('third_party/blink/public/mojom/mime'),
+ create_pattern('third_party/blink/public/mojom/native_file_system'),
+ create_pattern('third_party/blink/public/mojom/net'),
+ create_pattern('third_party/blink/public/mojom/notifications'),
+ create_pattern('third_party/blink/public/mojom/oom_intervention'),
+ create_pattern('third_party/blink/public/mojom/page'),
+ create_pattern('third_party/blink/public/mojom/payments'),
+ create_pattern('third_party/blink/public/mojom/permissions'),
+ create_pattern('third_party/blink/public/mojom/picture_in_picture'),
+ create_pattern('third_party/blink/public/mojom/plugins'),
+ create_pattern('third_party/blink/public/mojom/portal'),
+ create_pattern('third_party/blink/public/mojom/presentation'),
+ create_pattern('third_party/blink/public/mojom/push_messaging'),
+ create_pattern('third_party/blink/public/mojom/quota'),
+ create_pattern('third_party/blink/public/mojom/remote_objects'),
+ create_pattern('third_party/blink/public/mojom/reporting'),
+ create_pattern('third_party/blink/public/mojom/script'),
+ create_pattern('third_party/blink/public/mojom/selection_menu'),
+ create_pattern('third_party/blink/public/mojom/serial'),
+ create_pattern('third_party/blink/public/mojom/service_worker'),
+ create_pattern('third_party/blink/public/mojom/site_engagement'),
+ create_pattern('third_party/blink/public/mojom/sms'),
+ create_pattern('third_party/blink/public/mojom/speech'),
+ create_pattern('third_party/blink/public/mojom/ukm'),
+ create_pattern('third_party/blink/public/mojom/unhandled_tap_notifier'),
+ create_pattern('third_party/blink/public/mojom/usb'),
+ create_pattern('third_party/blink/public/mojom/use_counter'),
+ create_pattern('third_party/blink/public/mojom/user_agent'),
+ create_pattern('third_party/blink/public/mojom/wake_lock'),
+ create_pattern('third_party/blink/public/mojom/web_client_hints'),
+ create_pattern('third_party/blink/public/mojom/web_feature'),
+ create_pattern('third_party/blink/public/mojom/webaudio'),
+ create_pattern('third_party/blink/public/mojom/webauthn'),
+ create_pattern('third_party/blink/public/mojom/webdatabase'),
+ create_pattern('third_party/blink/public/mojom/webshare'),
+ create_pattern('third_party/blink/public/mojom/window_features'),
+ create_pattern('third_party/blink/public/mojom/worker'),
+ create_pattern('third_party/blink/public/web'),
+ create_pattern('third_party/blink/renderer/bindings'),
+ create_pattern('third_party/blink/renderer/build'),
+ create_pattern('third_party/blink/renderer/controller'),
+ create_pattern('third_party/blink/renderer/core/accessibility'),
+ create_pattern('third_party/blink/renderer/core/animation'),
+ create_pattern('third_party/blink/renderer/core/aom'),
+ create_pattern('third_party/blink/renderer/core/clipboard'),
+ create_pattern('third_party/blink/renderer/core/content_capture'),
+ create_pattern('third_party/blink/renderer/core/context_features'),
+ create_pattern('third_party/blink/renderer/core/css'),
+ create_pattern('third_party/blink/renderer/core/display_lock'),
+ create_pattern('third_party/blink/renderer/core/dom'),
+ create_pattern('third_party/blink/renderer/core/editing'),
+ create_pattern('third_party/blink/renderer/core/events'),
+ create_pattern('third_party/blink/renderer/core/execution_context'),
+ create_pattern('third_party/blink/renderer/core/exported'),
+ create_pattern('third_party/blink/renderer/core/feature_policy'),
+ create_pattern('third_party/blink/renderer/core/fetch'),
+ create_pattern('third_party/blink/renderer/core/fileapi'),
+ create_pattern('third_party/blink/renderer/core/frame'),
+ create_pattern('third_party/blink/renderer/core/fullscreen'),
+ create_pattern('third_party/blink/renderer/core/geometry'),
+ create_pattern('third_party/blink/renderer/core/html'),
+ create_pattern('third_party/blink/renderer/core/imagebitmap'),
+ create_pattern('third_party/blink/renderer/core/input'),
+ create_pattern('third_party/blink/renderer/core/inspector'),
+ create_pattern('third_party/blink/renderer/core/intersection_observer'),
+ create_pattern('third_party/blink/renderer/core/invisible_dom'),
+ create_pattern('third_party/blink/renderer/core/layout'),
+ create_pattern('third_party/blink/renderer/core/loader'),
+ create_pattern('third_party/blink/renderer/core/messaging'),
+ create_pattern('third_party/blink/renderer/core/mojo'),
+ create_pattern('third_party/blink/renderer/core/offscreencanvas'),
+ create_pattern('third_party/blink/renderer/core/origin_trials'),
+ create_pattern('third_party/blink/renderer/core/page'),
+ create_pattern('third_party/blink/renderer/core/paint'),
+ create_pattern('third_party/blink/renderer/core/probe'),
+ create_pattern('third_party/blink/renderer/core/resize_observer'),
+ create_pattern('third_party/blink/renderer/core/scheduler'),
+ create_pattern('third_party/blink/renderer/core/script'),
+ create_pattern('third_party/blink/renderer/core/scroll'),
+ create_pattern('third_party/blink/renderer/core/streams'),
+ create_pattern('third_party/blink/renderer/core/style'),
+ create_pattern('third_party/blink/renderer/core/svg'),
+ create_pattern('third_party/blink/renderer/core/testing'),
+ create_pattern('third_party/blink/renderer/core/timezone'),
+ create_pattern('third_party/blink/renderer/core/timing'),
+ create_pattern('third_party/blink/renderer/core/trustedtypes'),
+ create_pattern('third_party/blink/renderer/core/typed_arrays'),
+ create_pattern('third_party/blink/renderer/core/url'),
+ create_pattern('third_party/blink/renderer/core/win'),
+ create_pattern('third_party/blink/renderer/core/workers'),
+ create_pattern('third_party/blink/renderer/core/xml'),
+ create_pattern('third_party/blink/renderer/core/xmlhttprequest'),
+ create_pattern('third_party/blink/renderer/devtools'),
+ create_pattern('third_party/blink/renderer/modules'),
+ create_pattern('third_party/blink/renderer/platform'),
+ create_pattern('third_party/blink/tools'),
+ create_pattern('third_party/blink/web_tests'),
+ create_pattern('third_party/boringssl'),
+ create_pattern('third_party/bouncycastle'),
+ create_pattern('third_party/breakpad'),
+ create_pattern('third_party/brotli'),
+ create_pattern('third_party/bspatch'),
+ create_pattern('third_party/byte_buddy'),
+ create_pattern('third_party/cacheinvalidation'),
+ create_pattern('third_party/catapult'),
+ create_pattern('third_party/cct_dynamic_module'),
+ create_pattern('third_party/ced'),
+ create_pattern('third_party/chaijs'),
+ create_pattern('third_party/checkstyle'),
+ create_pattern('third_party/chromevox'),
+ create_pattern('third_party/chromite'),
+ create_pattern('third_party/cld_3'),
+ create_pattern('third_party/closure_compiler'),
+ create_pattern('third_party/colorama'),
+ create_pattern('third_party/crashpad'),
+ create_pattern('third_party/crc32c'),
+ create_pattern('third_party/cros_system_api'),
+ create_pattern('third_party/custom_tabs_client'),
+ create_pattern('third_party/d3'),
+ create_pattern('third_party/dav1d'),
+ create_pattern('third_party/dawn'),
+ create_pattern('third_party/decklink'),
+ create_pattern('third_party/depot_tools'),
+ create_pattern('third_party/devscripts'),
+ create_pattern('third_party/devtools-node-modules'),
+ create_pattern('third_party/dom_distiller_js'),
+ create_pattern('third_party/elfutils'),
+ create_pattern('third_party/emoji-segmenter'),
+ create_pattern('third_party/errorprone'),
+ create_pattern('third_party/espresso'),
+ create_pattern('third_party/expat'),
+ create_pattern('third_party/feed'),
+ create_pattern('third_party/ffmpeg'),
+ create_pattern('third_party/flac'),
+ create_pattern('third_party/flatbuffers'),
+ create_pattern('third_party/flot'),
+ create_pattern('third_party/fontconfig'),
+ create_pattern('third_party/freetype'),
+ create_pattern('third_party/fuchsia-sdk'),
+ create_pattern('third_party/gestures'),
+ create_pattern('third_party/gif_player'),
+ create_pattern('third_party/glfw'),
+ create_pattern('third_party/glslang'),
+ create_pattern('third_party/gnu_binutils'),
+ create_pattern('third_party/google-truth'),
+ create_pattern('third_party/google_android_play_core'),
+ create_pattern('third_party/google_appengine_cloudstorage'),
+ create_pattern('third_party/google_input_tools'),
+ create_pattern('third_party/google_toolbox_for_mac'),
+ create_pattern('third_party/google_trust_services'),
+ create_pattern('third_party/googletest'),
+ create_pattern('third_party/gperf'),
+ create_pattern('third_party/gradle_wrapper'),
+ create_pattern('third_party/grpc'),
+ create_pattern('third_party/gson'),
+ create_pattern('third_party/guava'),
+ create_pattern('third_party/gvr-android-keyboard'),
+ create_pattern('third_party/gvr-android-sdk'),
+ create_pattern('third_party/hamcrest'),
+ create_pattern('third_party/harfbuzz-ng'),
+ create_pattern('third_party/hunspell'),
+ create_pattern('third_party/hunspell_dictionaries'),
+ create_pattern('third_party/iaccessible2'),
+ create_pattern('third_party/iccjpeg'),
+ create_pattern('third_party/icu/android'),
+ create_pattern('third_party/icu/android_small'),
+ create_pattern('third_party/icu/cast'),
+ create_pattern('third_party/icu/chromeos'),
+ create_pattern('third_party/icu/common'),
+ create_pattern('third_party/icu/filters'),
+ create_pattern('third_party/icu/flutter'),
+ create_pattern('third_party/icu/fuzzers'),
+ create_pattern('third_party/icu/ios'),
+ create_pattern('third_party/icu/patches'),
+ create_pattern('third_party/icu/scripts'),
+ create_pattern('third_party/icu/source'),
+ create_pattern('third_party/icu/tzres'),
+ create_pattern('third_party/icu4j'),
+ create_pattern('third_party/ijar'),
+ create_pattern('third_party/ink'),
+ create_pattern('third_party/inspector_protocol'),
+ create_pattern('third_party/instrumented_libraries'),
+ create_pattern('third_party/intellij'),
+ create_pattern('third_party/isimpledom'),
+ create_pattern('third_party/jacoco'),
+ create_pattern('third_party/jinja2'),
+ create_pattern('third_party/jsoncpp'),
+ create_pattern('third_party/jsr-305'),
+ create_pattern('third_party/jstemplate'),
+ create_pattern('third_party/junit'),
+ create_pattern('third_party/khronos'),
+ create_pattern('third_party/lcov'),
+ create_pattern('third_party/leveldatabase'),
+ create_pattern('third_party/libFuzzer'),
+ create_pattern('third_party/libXNVCtrl'),
+ create_pattern('third_party/libaddressinput'),
+ create_pattern('third_party/libaom'),
+ create_pattern('third_party/libcxx-pretty-printers'),
+ create_pattern('third_party/libdrm'),
+ create_pattern('third_party/libevdev'),
+ create_pattern('third_party/libjingle_xmpp'),
+ create_pattern('third_party/libjpeg'),
+ create_pattern('third_party/libjpeg_turbo'),
+ create_pattern('third_party/liblouis'),
+ create_pattern('third_party/libovr'),
+ create_pattern('third_party/libphonenumber'),
+ create_pattern('third_party/libpng'),
+ create_pattern('third_party/libprotobuf-mutator'),
+ create_pattern('third_party/libsecret'),
+ create_pattern('third_party/libsrtp'),
+ create_pattern('third_party/libsync'),
+ create_pattern('third_party/libudev'),
+ create_pattern('third_party/libusb'),
+ create_pattern('third_party/libvpx'),
+ create_pattern('third_party/libwebm'),
+ create_pattern('third_party/libwebp'),
+ create_pattern('third_party/libxml'),
+ create_pattern('third_party/libxslt'),
+ create_pattern('third_party/libyuv'),
+ create_pattern('third_party/lighttpd'),
+ create_pattern('third_party/logilab'),
+ create_pattern('third_party/lss'),
+ create_pattern('third_party/lzma_sdk'),
+ create_pattern('third_party/mach_override'),
+ create_pattern('third_party/markdown'),
+ create_pattern('third_party/markupsafe'),
+ create_pattern('third_party/material_design_icons'),
+ create_pattern('third_party/mesa_headers'),
+ create_pattern('third_party/metrics_proto'),
+ create_pattern('third_party/microsoft_webauthn'),
+ create_pattern('third_party/mingw-w64'),
+ create_pattern('third_party/minigbm'),
+ create_pattern('third_party/minizip'),
+ create_pattern('third_party/mocha'),
+ create_pattern('third_party/mockito'),
+ create_pattern('third_party/modp_b64'),
+ create_pattern('third_party/motemplate'),
+ create_pattern('third_party/mozilla'),
+ create_pattern('third_party/nacl_sdk_binaries'),
+ create_pattern('third_party/nasm'),
+ create_pattern('third_party/netty-tcnative'),
+ create_pattern('third_party/netty4'),
+ create_pattern('third_party/node'),
+ create_pattern('third_party/nvml'),
+ create_pattern('third_party/objenesis'),
+ create_pattern('third_party/ocmock'),
+ create_pattern('third_party/openh264'),
+ create_pattern('third_party/openscreen'),
+ create_pattern('third_party/openvr'),
+ create_pattern('third_party/opus'),
+ create_pattern('third_party/ots'),
+ create_pattern('third_party/ow2_asm'),
+ create_pattern('third_party/pdfium'),
+ create_pattern('third_party/pefile'),
+ create_pattern('third_party/perfetto'),
+ create_pattern('third_party/perl'),
+ create_pattern('third_party/pexpect'),
+ create_pattern('third_party/pffft'),
+ create_pattern('third_party/ply'),
+ create_pattern('third_party/polymer'),
+ create_pattern('third_party/proguard'),
+ create_pattern('third_party/protobuf'),
+ create_pattern('third_party/protoc_javalite'),
+ create_pattern('third_party/pycoverage'),
+ create_pattern('third_party/pyelftools'),
+ create_pattern('third_party/pyjson5'),
+ create_pattern('third_party/pylint'),
+ create_pattern('third_party/pymock'),
+ create_pattern('third_party/pystache'),
+ create_pattern('third_party/pywebsocket'),
+ create_pattern('third_party/qcms'),
+ create_pattern('third_party/quic_trace'),
+ create_pattern('third_party/qunit'),
+ create_pattern('third_party/r8'),
+ create_pattern('third_party/re2'),
+ create_pattern('third_party/requests'),
+ create_pattern('third_party/rnnoise'),
+ create_pattern('third_party/robolectric'),
+ create_pattern('third_party/s2cellid'),
+ create_pattern('third_party/sfntly'),
+ create_pattern('third_party/shaderc'),
+ create_pattern('third_party/simplejson'),
+ create_pattern('third_party/sinonjs'),
+ create_pattern('third_party/skia'),
+ create_pattern('third_party/smhasher'),
+ create_pattern('third_party/snappy'),
+ create_pattern('third_party/speech-dispatcher'),
+ create_pattern('third_party/spirv-cross'),
+ create_pattern('third_party/spirv-headers'),
+ create_pattern('third_party/sqlite'),
+ create_pattern('third_party/sqlite4java'),
+ create_pattern('third_party/sudden_motion_sensor'),
+ create_pattern('third_party/swiftshader'),
+ create_pattern('third_party/tcmalloc'),
+ create_pattern('third_party/test_fonts'),
+ create_pattern('third_party/tlslite'),
+ create_pattern('third_party/ub-uiautomator'),
+ create_pattern('third_party/unrar'),
+ create_pattern('third_party/usb_ids'),
+ create_pattern('third_party/usrsctp'),
+ create_pattern('third_party/v4l-utils'),
+ create_pattern('third_party/vulkan'),
+ create_pattern('third_party/wayland'),
+ create_pattern('third_party/wayland-protocols'),
+ create_pattern('third_party/wds'),
+ create_pattern('third_party/web-animations-js'),
+ create_pattern('third_party/webdriver'),
+ create_pattern('third_party/webgl'),
+ create_pattern('third_party/webrtc'),
+ create_pattern('third_party/webrtc_overrides'),
+ create_pattern('third_party/webxr_test_pages'),
+ create_pattern('third_party/widevine'),
+ create_pattern('third_party/win_build_output'),
+ create_pattern('third_party/woff2'),
+ create_pattern('third_party/wtl'),
+ create_pattern('third_party/xdg-utils'),
+ create_pattern('third_party/xstream'),
+ create_pattern('third_party/yasm'),
+ create_pattern('third_party/zlib'),
+ create_pattern('tools'),
+ create_pattern('ui/accelerated_widget_mac'),
+ create_pattern('ui/accessibility'),
+ create_pattern('ui/android'),
+ create_pattern('ui/aura'),
+ create_pattern('ui/aura_extra'),
+ create_pattern('ui/base'),
+ create_pattern('ui/chromeos'),
+ create_pattern('ui/compositor'),
+ create_pattern('ui/compositor_extra'),
+ create_pattern('ui/content_accelerators'),
+ create_pattern('ui/display'),
+ create_pattern('ui/events'),
+ create_pattern('ui/file_manager'),
+ create_pattern('ui/gfx'),
+ create_pattern('ui/gl'),
+ create_pattern('ui/latency'),
+ create_pattern('ui/login'),
+ create_pattern('ui/message_center'),
+ create_pattern('ui/native_theme'),
+ create_pattern('ui/ozone'),
+ create_pattern('ui/platform_window'),
+ create_pattern('ui/resources'),
+ create_pattern('ui/shell_dialogs'),
+ create_pattern('ui/snapshot'),
+ create_pattern('ui/strings'),
+ create_pattern('ui/surface'),
+ create_pattern('ui/touch_selection'),
+ create_pattern('ui/views'),
+ create_pattern('ui/views_bridge_mac'),
+ create_pattern('ui/views_content_client'),
+ create_pattern('ui/web_dialogs'),
+ create_pattern('ui/webui'),
+ create_pattern('ui/wm'),
+ create_pattern('url'),
+ create_pattern('v8/benchmarks'),
+ create_pattern('v8/build_overrides'),
+ create_pattern('v8/custom_deps'),
+ create_pattern('v8/docs'),
+ create_pattern('v8/gni'),
+ create_pattern('v8/include'),
+ create_pattern('v8/infra'),
+ create_pattern('v8/samples'),
+ create_pattern('v8/src'),
+ create_pattern('v8/test'),
+ create_pattern('v8/testing'),
+ create_pattern('v8/third_party'),
+ create_pattern('v8/tools'),
+
+ # keep out/obj and other patterns at the end.
+ [
+ 'out/obj', '.*/(gen|obj[^/]*)/(include|EXECUTABLES|SHARED_LIBRARIES|'
+ 'STATIC_LIBRARIES|NATIVE_TESTS)/.*: warning:'
+ ],
+ ['other', '.*'] # all other unrecognized patterns
+]
diff --git a/tools/warn/cpp_warn_patterns.py b/tools/warn/cpp_warn_patterns.py
new file mode 100644
index 0000000..65ce73a
--- /dev/null
+++ b/tools/warn/cpp_warn_patterns.py
@@ -0,0 +1,485 @@
+# python3
+# Copyright (C) 2019 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.
+
+"""Warning patterns for C/C++ compiler, but not clang-tidy."""
+
+import re
+
+# pylint:disable=relative-beyond-top-level
+# pylint:disable=g-importing-member
+from .severity import Severity
+
+
+def cpp_warn(severity, description, pattern_list):
+ return {
+ 'category': 'C/C++',
+ 'severity': severity,
+ 'description': description,
+ 'patterns': pattern_list
+ }
+
+
+def fixmenow(description, pattern_list):
+ return cpp_warn(Severity.FIXMENOW, description, pattern_list)
+
+
+def high(description, pattern_list):
+ return cpp_warn(Severity.HIGH, description, pattern_list)
+
+
+def medium(description, pattern_list):
+ return cpp_warn(Severity.MEDIUM, description, pattern_list)
+
+
+def low(description, pattern_list):
+ return cpp_warn(Severity.LOW, description, pattern_list)
+
+
+def skip(description, pattern_list):
+ return cpp_warn(Severity.SKIP, description, pattern_list)
+
+
+def harmless(description, pattern_list):
+ return cpp_warn(Severity.HARMLESS, description, pattern_list)
+
+
+warn_patterns = [
+ # pylint:disable=line-too-long,g-inconsistent-quotes
+ medium('Implicit function declaration',
+ [r".*: warning: implicit declaration of function .+",
+ r".*: warning: implicitly declaring library function"]),
+ skip('skip, conflicting types for ...',
+ [r".*: warning: conflicting types for '.+'"]),
+ high('Expression always evaluates to true or false',
+ [r".*: warning: comparison is always .+ due to limited range of data type",
+ r".*: warning: comparison of unsigned .*expression .+ is always true",
+ r".*: warning: comparison of unsigned .*expression .+ is always false"]),
+ high('Use transient memory for control value',
+ [r".*: warning: .+Using such transient memory for the control value is .*dangerous."]),
+ high('Return address of stack memory',
+ [r".*: warning: Address of stack memory .+ returned to caller",
+ r".*: warning: Address of stack memory .+ will be a dangling reference"]),
+ high('Infinite recursion',
+ [r".*: warning: all paths through this function will call itself"]),
+ high('Potential buffer overflow',
+ [r".*: warning: Size argument is greater than .+ the destination buffer",
+ r".*: warning: Potential buffer overflow.",
+ r".*: warning: String copy function overflows destination buffer"]),
+ medium('Incompatible pointer types',
+ [r".*: warning: assignment from incompatible pointer type",
+ r".*: warning: return from incompatible pointer type",
+ r".*: warning: passing argument [0-9]+ of '.*' from incompatible pointer type",
+ r".*: warning: initialization from incompatible pointer type"]),
+ high('Incompatible declaration of built in function',
+ [r".*: warning: incompatible implicit declaration of built-in function .+"]),
+ high('Incompatible redeclaration of library function',
+ [r".*: warning: incompatible redeclaration of library function .+"]),
+ high('Null passed as non-null argument',
+ [r".*: warning: Null passed to a callee that requires a non-null"]),
+ medium('Unused parameter',
+ [r".*: warning: unused parameter '.*'"]),
+ medium('Unused function, variable, label, comparison, etc.',
+ [r".*: warning: '.+' defined but not used",
+ r".*: warning: unused function '.+'",
+ r".*: warning: unused label '.+'",
+ r".*: warning: relational comparison result unused",
+ r".*: warning: lambda capture .* is not used",
+ r".*: warning: private field '.+' is not used",
+ r".*: warning: unused variable '.+'"]),
+ medium('Statement with no effect or result unused',
+ [r".*: warning: statement with no effect",
+ r".*: warning: expression result unused"]),
+ medium('Ignoreing return value of function',
+ [r".*: warning: ignoring return value of function .+Wunused-result"]),
+ medium('Missing initializer',
+ [r".*: warning: missing initializer"]),
+ medium('Need virtual destructor',
+ [r".*: warning: delete called .* has virtual functions but non-virtual destructor"]),
+ skip('skip, near initialization for ...',
+ [r".*: warning: \(near initialization for '.+'\)"]),
+ medium('Expansion of data or time macro',
+ [r".*: warning: expansion of date or time macro is not reproducible"]),
+ medium('Macro expansion has undefined behavior',
+ [r".*: warning: macro expansion .* has undefined behavior"]),
+ medium('Format string does not match arguments',
+ [r".*: warning: format '.+' expects type '.+', but argument [0-9]+ has type '.+'",
+ r".*: warning: more '%' conversions than data arguments",
+ r".*: warning: data argument not used by format string",
+ r".*: warning: incomplete format specifier",
+ r".*: warning: unknown conversion type .* in format",
+ r".*: warning: format .+ expects .+ but argument .+Wformat=",
+ r".*: warning: field precision should have .+ but argument has .+Wformat",
+ r".*: warning: format specifies type .+ but the argument has .*type .+Wformat"]),
+ medium('Too many arguments for format string',
+ [r".*: warning: too many arguments for format"]),
+ medium('Too many arguments in call',
+ [r".*: warning: too many arguments in call to "]),
+ medium('Invalid format specifier',
+ [r".*: warning: invalid .+ specifier '.+'.+format-invalid-specifier"]),
+ medium('Comparison between signed and unsigned',
+ [r".*: warning: comparison between signed and unsigned",
+ r".*: warning: comparison of promoted \~unsigned with unsigned",
+ r".*: warning: signed and unsigned type in conditional expression"]),
+ medium('Comparison between enum and non-enum',
+ [r".*: warning: enumeral and non-enumeral type in conditional expression"]),
+ medium('libpng: zero area',
+ [r".*libpng warning: Ignoring attempt to set cHRM RGB triangle with zero area"]),
+ medium('Missing braces around initializer',
+ [r".*: warning: missing braces around initializer.*"]),
+ harmless('No newline at end of file',
+ [r".*: warning: no newline at end of file"]),
+ harmless('Missing space after macro name',
+ [r".*: warning: missing whitespace after the macro name"]),
+ low('Cast increases required alignment',
+ [r".*: warning: cast from .* to .* increases required alignment .*"]),
+ medium('Qualifier discarded',
+ [r".*: warning: passing argument [0-9]+ of '.+' discards qualifiers from pointer target type",
+ r".*: warning: assignment discards qualifiers from pointer target type",
+ r".*: warning: passing .+ to parameter of type .+ discards qualifiers",
+ r".*: warning: assigning to .+ from .+ discards qualifiers",
+ r".*: warning: initializing .+ discards qualifiers .+types-discards-qualifiers",
+ r".*: warning: return discards qualifiers from pointer target type"]),
+ medium('Unknown attribute',
+ [r".*: warning: unknown attribute '.+'"]),
+ medium('Attribute ignored',
+ [r".*: warning: '_*packed_*' attribute ignored",
+ r".*: warning: attribute declaration must precede definition .+ignored-attributes"]),
+ medium('Visibility problem',
+ [r".*: warning: declaration of '.+' will not be visible outside of this function"]),
+ medium('Visibility mismatch',
+ [r".*: warning: '.+' declared with greater visibility than the type of its field '.+'"]),
+ medium('Shift count greater than width of type',
+ [r".*: warning: (left|right) shift count >= width of type"]),
+ medium('extern <foo> is initialized',
+ [r".*: warning: '.+' initialized and declared 'extern'",
+ r".*: warning: 'extern' variable has an initializer"]),
+ medium('Old style declaration',
+ [r".*: warning: 'static' is not at beginning of declaration"]),
+ medium('Missing return value',
+ [r".*: warning: control reaches end of non-void function"]),
+ medium('Implicit int type',
+ [r".*: warning: type specifier missing, defaults to 'int'",
+ r".*: warning: type defaults to 'int' in declaration of '.+'"]),
+ medium('Main function should return int',
+ [r".*: warning: return type of 'main' is not 'int'"]),
+ medium('Variable may be used uninitialized',
+ [r".*: warning: '.+' may be used uninitialized in this function"]),
+ high('Variable is used uninitialized',
+ [r".*: warning: '.+' is used uninitialized in this function",
+ r".*: warning: variable '.+' is uninitialized when used here"]),
+ medium('ld: possible enum size mismatch',
+ [r".*: warning: .* uses variable-size enums yet the output is to use 32-bit enums; use of enum values across objects may fail"]),
+ medium('Pointer targets differ in signedness',
+ [r".*: warning: pointer targets in initialization differ in signedness",
+ r".*: warning: pointer targets in assignment differ in signedness",
+ r".*: warning: pointer targets in return differ in signedness",
+ r".*: warning: pointer targets in passing argument [0-9]+ of '.+' differ in signedness"]),
+ medium('Assuming overflow does not occur',
+ [r".*: warning: assuming signed overflow does not occur when assuming that .* is always (true|false)"]),
+ medium('Suggest adding braces around empty body',
+ [r".*: warning: suggest braces around empty body in an 'if' statement",
+ r".*: warning: empty body in an if-statement",
+ r".*: warning: suggest braces around empty body in an 'else' statement",
+ r".*: warning: empty body in an else-statement"]),
+ medium('Suggest adding parentheses',
+ [r".*: warning: suggest explicit braces to avoid ambiguous 'else'",
+ r".*: warning: suggest parentheses around arithmetic in operand of '.+'",
+ r".*: warning: suggest parentheses around comparison in operand of '.+'",
+ r".*: warning: logical not is only applied to the left hand side of this comparison",
+ r".*: warning: using the result of an assignment as a condition without parentheses",
+ r".*: warning: .+ has lower precedence than .+ be evaluated first .+Wparentheses",
+ r".*: warning: suggest parentheses around '.+?' .+ '.+?'",
+ r".*: warning: suggest parentheses around assignment used as truth value"]),
+ medium('Static variable used in non-static inline function',
+ [r".*: warning: '.+' is static but used in inline function '.+' which is not static"]),
+ medium('No type or storage class (will default to int)',
+ [r".*: warning: data definition has no type or storage class"]),
+ skip('skip, parameter name (without types) in function declaration',
+ [r".*: warning: parameter names \(without types\) in function declaration"]),
+ medium('Dereferencing <foo> breaks strict aliasing rules',
+ [r".*: warning: dereferencing .* break strict-aliasing rules"]),
+ medium('Cast from pointer to integer of different size',
+ [r".*: warning: cast from pointer to integer of different size",
+ r".*: warning: initialization makes pointer from integer without a cast"]),
+ medium('Cast to pointer from integer of different size',
+ [r".*: warning: cast to pointer from integer of different size"]),
+ medium('Macro redefined',
+ [r".*: warning: '.+' macro redefined"]),
+ skip('skip, ... location of the previous definition',
+ [r".*: warning: this is the location of the previous definition"]),
+ medium('ld: type and size of dynamic symbol are not defined',
+ [r".*: warning: type and size of dynamic symbol `.+' are not defined"]),
+ medium('Pointer from integer without cast',
+ [r".*: warning: assignment makes pointer from integer without a cast"]),
+ medium('Pointer from integer without cast',
+ [r".*: warning: passing argument [0-9]+ of '.+' makes pointer from integer without a cast"]),
+ medium('Integer from pointer without cast',
+ [r".*: warning: assignment makes integer from pointer without a cast"]),
+ medium('Integer from pointer without cast',
+ [r".*: warning: passing argument [0-9]+ of '.+' makes integer from pointer without a cast"]),
+ medium('Integer from pointer without cast',
+ [r".*: warning: return makes integer from pointer without a cast"]),
+ medium('Ignoring pragma',
+ [r".*: warning: ignoring #pragma .+"]),
+ medium('Pragma warning messages',
+ [r".*: warning: .+W#pragma-messages"]),
+ medium('Variable might be clobbered by longjmp or vfork',
+ [r".*: warning: variable '.+' might be clobbered by 'longjmp' or 'vfork'"]),
+ medium('Argument might be clobbered by longjmp or vfork',
+ [r".*: warning: argument '.+' might be clobbered by 'longjmp' or 'vfork'"]),
+ medium('Redundant declaration',
+ [r".*: warning: redundant redeclaration of '.+'"]),
+ skip('skip, previous declaration ... was here',
+ [r".*: warning: previous declaration of '.+' was here"]),
+ high('Enum value not handled in switch',
+ [r".*: warning: .*enumeration value.* not handled in switch.+Wswitch"]),
+ medium('User defined warnings',
+ [r".*: warning: .* \[-Wuser-defined-warnings\]$"]),
+ medium('Taking address of temporary',
+ [r".*: warning: taking address of temporary"]),
+ medium('Taking address of packed member',
+ [r".*: warning: taking address of packed member"]),
+ medium('Possible broken line continuation',
+ [r".*: warning: backslash and newline separated by space"]),
+ medium('Undefined variable template',
+ [r".*: warning: instantiation of variable .* no definition is available"]),
+ medium('Inline function is not defined',
+ [r".*: warning: inline function '.*' is not defined"]),
+ medium('Excess elements in initializer',
+ [r".*: warning: excess elements in .+ initializer"]),
+ medium('Decimal constant is unsigned only in ISO C90',
+ [r".*: warning: this decimal constant is unsigned only in ISO C90"]),
+ medium('main is usually a function',
+ [r".*: warning: 'main' is usually a function"]),
+ medium('Typedef ignored',
+ [r".*: warning: 'typedef' was ignored in this declaration"]),
+ high('Address always evaluates to true',
+ [r".*: warning: the address of '.+' will always evaluate as 'true'"]),
+ fixmenow('Freeing a non-heap object',
+ [r".*: warning: attempt to free a non-heap object '.+'"]),
+ medium('Array subscript has type char',
+ [r".*: warning: array subscript .+ type 'char'.+Wchar-subscripts"]),
+ medium('Constant too large for type',
+ [r".*: warning: integer constant is too large for '.+' type"]),
+ medium('Constant too large for type, truncated',
+ [r".*: warning: large integer implicitly truncated to unsigned type"]),
+ medium('Overflow in expression',
+ [r".*: warning: overflow in expression; .*Winteger-overflow"]),
+ medium('Overflow in implicit constant conversion',
+ [r".*: warning: overflow in implicit constant conversion"]),
+ medium('Declaration does not declare anything',
+ [r".*: warning: declaration 'class .+' does not declare anything"]),
+ medium('Initialization order will be different',
+ [r".*: warning: '.+' will be initialized after",
+ r".*: warning: field .+ will be initialized after .+Wreorder"]),
+ skip('skip, ....',
+ [r".*: warning: '.+'"]),
+ skip('skip, base ...',
+ [r".*: warning: base '.+'"]),
+ skip('skip, when initialized here',
+ [r".*: warning: when initialized here"]),
+ medium('Parameter type not specified',
+ [r".*: warning: type of '.+' defaults to 'int'"]),
+ medium('Missing declarations',
+ [r".*: warning: declaration does not declare anything"]),
+ medium('Missing noreturn',
+ [r".*: warning: function '.*' could be declared with attribute 'noreturn'"]),
+ medium('User warning',
+ [r".*: warning: #warning "".+"""]),
+ medium('Vexing parsing problem',
+ [r".*: warning: empty parentheses interpreted as a function declaration"]),
+ medium('Dereferencing void*',
+ [r".*: warning: dereferencing 'void \*' pointer"]),
+ medium('Comparison of pointer and integer',
+ [r".*: warning: ordered comparison of pointer with integer zero",
+ r".*: warning: .*comparison between pointer and integer"]),
+ medium('Use of error-prone unary operator',
+ [r".*: warning: use of unary operator that may be intended as compound assignment"]),
+ medium('Conversion of string constant to non-const char*',
+ [r".*: warning: deprecated conversion from string constant to '.+'"]),
+ medium('Function declaration isn''t a prototype',
+ [r".*: warning: function declaration isn't a prototype"]),
+ medium('Type qualifiers ignored on function return value',
+ [r".*: warning: type qualifiers ignored on function return type",
+ r".*: warning: .+ type qualifier .+ has no effect .+Wignored-qualifiers"]),
+ medium('<foo> declared inside parameter list, scope limited to this definition',
+ [r".*: warning: '.+' declared inside parameter list"]),
+ skip('skip, its scope is only this ...',
+ [r".*: warning: its scope is only this definition or declaration, which is probably not what you want"]),
+ low('Line continuation inside comment',
+ [r".*: warning: multi-line comment"]),
+ low('Comment inside comment',
+ [r".*: warning: '.+' within block comment .*-Wcomment"]),
+ low('Deprecated declarations',
+ [r".*: warning: .+ is deprecated.+deprecated-declarations"]),
+ low('Deprecated register',
+ [r".*: warning: 'register' storage class specifier is deprecated"]),
+ low('Converts between pointers to integer types with different sign',
+ [r".*: warning: .+ converts between pointers to integer types with different sign"]),
+ harmless('Extra tokens after #endif',
+ [r".*: warning: extra tokens at end of #endif directive"]),
+ medium('Comparison between different enums',
+ [r".*: warning: comparison between '.+' and '.+'.+Wenum-compare",
+ r".*: warning: comparison of .* enumeration types .*-Wenum-compare-switch"]),
+ medium('Conversion may change value',
+ [r".*: warning: converting negative value '.+' to '.+'",
+ r".*: warning: conversion to '.+' .+ may (alter|change)"]),
+ medium('Converting to non-pointer type from NULL',
+ [r".*: warning: converting to non-pointer type '.+' from NULL"]),
+ medium('Implicit sign conversion',
+ [r".*: warning: implicit conversion changes signedness"]),
+ medium('Converting NULL to non-pointer type',
+ [r".*: warning: implicit conversion of NULL constant to '.+'"]),
+ medium('Zero used as null pointer',
+ [r".*: warning: expression .* zero treated as a null pointer constant"]),
+ medium('Compare pointer to null character',
+ [r".*: warning: comparing a pointer to a null character constant"]),
+ medium('Implicit conversion changes value or loses precision',
+ [r".*: warning: implicit conversion .* changes value from .* to .*-conversion",
+ r".*: warning: implicit conversion loses integer precision:"]),
+ medium('Passing NULL as non-pointer argument',
+ [r".*: warning: passing NULL to non-pointer argument [0-9]+ of '.+'"]),
+ medium('Class seems unusable because of private ctor/dtor',
+ [r".*: warning: all member functions in class '.+' are private"]),
+ # skip this next one, because it only points out some RefBase-based classes
+ # where having a private destructor is perfectly fine
+ skip('Class seems unusable because of private ctor/dtor',
+ [r".*: warning: 'class .+' only defines a private destructor and has no friends"]),
+ medium('Class seems unusable because of private ctor/dtor',
+ [r".*: warning: 'class .+' only defines private constructors and has no friends"]),
+ medium('In-class initializer for static const float/double',
+ [r".*: warning: in-class initializer for static data member of .+const (float|double)"]),
+ medium('void* used in arithmetic',
+ [r".*: warning: pointer of type 'void \*' used in (arithmetic|subtraction)",
+ r".*: warning: arithmetic on .+ to void is a GNU extension.*Wpointer-arith",
+ r".*: warning: wrong type argument to increment"]),
+ medium('Overload resolution chose to promote from unsigned or enum to signed type',
+ [r".*: warning: passing '.+' chooses '.+' over '.+'.*Wsign-promo"]),
+ skip('skip, in call to ...',
+ [r".*: warning: in call to '.+'"]),
+ high('Base should be explicitly initialized in copy constructor',
+ [r".*: warning: base class '.+' should be explicitly initialized in the copy constructor"]),
+ medium('Return value from void function',
+ [r".*: warning: 'return' with a value, in function returning void"]),
+ medium('Multi-character character constant',
+ [r".*: warning: multi-character character constant"]),
+ medium('Conversion from string literal to char*',
+ [r".*: warning: .+ does not allow conversion from string literal to 'char \*'"]),
+ low('Extra \';\'',
+ [r".*: warning: extra ';' .+extra-semi"]),
+ low('Useless specifier',
+ [r".*: warning: useless storage class specifier in empty declaration"]),
+ low('Duplicate declaration specifier',
+ [r".*: warning: duplicate '.+' declaration specifier"]),
+ low('Comparison of self is always false',
+ [r".*: self-comparison always evaluates to false"]),
+ low('Logical op with constant operand',
+ [r".*: use of logical '.+' with constant operand"]),
+ low('Needs a space between literal and string macro',
+ [r".*: warning: invalid suffix on literal.+ requires a space .+Wliteral-suffix"]),
+ low('Warnings from #warning',
+ [r".*: warning: .+-W#warnings"]),
+ low('Using float/int absolute value function with int/float argument',
+ [r".*: warning: using .+ absolute value function .+ when argument is .+ type .+Wabsolute-value",
+ r".*: warning: absolute value function '.+' given .+ which may cause truncation .+Wabsolute-value"]),
+ low('Using C++11 extensions',
+ [r".*: warning: 'auto' type specifier is a C\+\+11 extension"]),
+ low('Refers to implicitly defined namespace',
+ [r".*: warning: using directive refers to implicitly-defined namespace .+"]),
+ low('Invalid pp token',
+ [r".*: warning: missing .+Winvalid-pp-token"]),
+ low('need glibc to link',
+ [r".*: warning: .* requires at runtime .* glibc .* for linking"]),
+ medium('Operator new returns NULL',
+ [r".*: warning: 'operator new' must not return NULL unless it is declared 'throw\(\)' .+"]),
+ medium('NULL used in arithmetic',
+ [r".*: warning: NULL used in arithmetic",
+ r".*: warning: comparison between NULL and non-pointer"]),
+ medium('Misspelled header guard',
+ [r".*: warning: '.+' is used as a header guard .+ followed by .+ different macro"]),
+ medium('Empty loop body',
+ [r".*: warning: .+ loop has empty body"]),
+ medium('Implicit conversion from enumeration type',
+ [r".*: warning: implicit conversion from enumeration type '.+'"]),
+ medium('case value not in enumerated type',
+ [r".*: warning: case value not in enumerated type '.+'"]),
+ medium('Use of deprecated method',
+ [r".*: warning: '.+' is deprecated .+"]),
+ medium('Use of garbage or uninitialized value',
+ [r".*: warning: .+ uninitialized .+\[-Wsometimes-uninitialized\]"]),
+ medium('Sizeof on array argument',
+ [r".*: warning: sizeof on array function parameter will return"]),
+ medium('Bad argument size of memory access functions',
+ [r".*: warning: .+\[-Wsizeof-pointer-memaccess\]"]),
+ medium('Return value not checked',
+ [r".*: warning: The return value from .+ is not checked"]),
+ medium('Possible heap pollution',
+ [r".*: warning: .*Possible heap pollution from .+ type .+"]),
+ medium('Variable used in loop condition not modified in loop body',
+ [r".*: warning: variable '.+' used in loop condition.*Wfor-loop-analysis"]),
+ medium('Closing a previously closed file',
+ [r".*: warning: Closing a previously closed file"]),
+ medium('Unnamed template type argument',
+ [r".*: warning: template argument.+Wunnamed-type-template-args"]),
+ medium('Unannotated fall-through between switch labels',
+ [r".*: warning: unannotated fall-through between switch labels.+Wimplicit-fallthrough"]),
+ medium('Invalid partial specialization',
+ [r".*: warning: class template partial specialization.+Winvalid-partial-specialization"]),
+ medium('Overlapping compatisons',
+ [r".*: warning: overlapping comparisons.+Wtautological-overlap-compare"]),
+ medium('int in bool context',
+ [r".*: warning: converting.+to a boolean.+Wint-in-bool-context"]),
+ medium('bitwise conditional parentheses',
+ [r".*: warning: operator.+has lower precedence.+Wbitwise-conditional-parentheses"]),
+ medium('sizeof array div',
+ [r".*: warning: .+number of elements in.+array.+Wsizeof-array-div"]),
+ medium('bool operation',
+ [r".*: warning: .+boolean.+always.+Wbool-operation"]),
+ medium('Undefined bool conversion',
+ [r".*: warning: .+may be.+always.+true.+Wundefined-bool-conversion"]),
+ medium('Typedef requires a name',
+ [r".*: warning: typedef requires a name.+Wmissing-declaration"]),
+ medium('Unknown escape sequence',
+ [r".*: warning: unknown escape sequence.+Wunknown-escape-sequence"]),
+ medium('Unicode whitespace',
+ [r".*: warning: treating Unicode.+as whitespace.+Wunicode-whitespace"]),
+ medium('Unused local typedef',
+ [r".*: warning: unused typedef.+Wunused-local-typedef"]),
+ medium('varargs warnings',
+ [r".*: warning: .*argument to 'va_start'.+\[-Wvarargs\]"]),
+ harmless('Discarded qualifier from pointer target type',
+ [r".*: warning: .+ discards '.+' qualifier from pointer target type"]),
+ harmless('Use snprintf instead of sprintf',
+ [r".*: warning: .*sprintf is often misused; please use snprintf"]),
+ harmless('Unsupported optimizaton flag',
+ [r".*: warning: optimization flag '.+' is not supported"]),
+ harmless('Extra or missing parentheses',
+ [r".*: warning: equality comparison with extraneous parentheses",
+ r".*: warning: .+ within .+Wlogical-op-parentheses"]),
+ harmless('Mismatched class vs struct tags',
+ [r".*: warning: '.+' defined as a .+ here but previously declared as a .+mismatched-tags",
+ r".*: warning: .+ was previously declared as a .+mismatched-tags"]),
+]
+
+
+def compile_patterns(patterns):
+ """Precompiling every pattern speeds up parsing by about 30x."""
+ for i in patterns:
+ i['compiled_patterns'] = []
+ for pat in i['patterns']:
+ i['compiled_patterns'].append(re.compile(pat))
+
+
+compile_patterns(warn_patterns)
diff --git a/tools/warn/html_writer.py b/tools/warn/html_writer.py
new file mode 100644
index 0000000..b8d3fe6
--- /dev/null
+++ b/tools/warn/html_writer.py
@@ -0,0 +1,673 @@
+# Lint as: python3
+# Copyright (C) 2019 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.
+
+"""Emit warning messages to html or csv files."""
+
+# To emit html page of warning messages:
+# flags: --byproject, --url, --separator
+# Old stuff for static html components:
+# html_script_style: static html scripts and styles
+# htmlbig:
+# dump_stats, dump_html_prologue, dump_html_epilogue:
+# emit_buttons:
+# dump_fixed
+# sort_warnings:
+# emit_stats_by_project:
+# all_patterns,
+# findproject, classify_warning
+# dump_html
+#
+# New dynamic HTML page's static JavaScript data:
+# Some data are copied from Python to JavaScript, to generate HTML elements.
+# FlagPlatform flags.platform
+# FlagURL flags.url, used by 'android'
+# FlagSeparator flags.separator, used by 'android'
+# SeverityColors: list of colors for all severity levels
+# SeverityHeaders: list of headers for all severity levels
+# SeverityColumnHeaders: list of column_headers for all severity levels
+# ProjectNames: project_names, or project_list[*][0]
+# WarnPatternsSeverity: warn_patterns[*]['severity']
+# WarnPatternsDescription: warn_patterns[*]['description']
+# WarningMessages: warning_messages
+# Warnings: warning_records
+# StatsHeader: warning count table header row
+# StatsRows: array of warning count table rows
+#
+# New dynamic HTML page's dynamic JavaScript data:
+#
+# New dynamic HTML related function to emit data:
+# escape_string, strip_escape_string, emit_warning_arrays
+# emit_js_data():
+
+from __future__ import print_function
+import cgi
+import csv
+import sys
+
+# pylint:disable=relative-beyond-top-level
+# pylint:disable=g-importing-member
+from .severity import Severity
+
+
+html_head_scripts = """\
+ <script type="text/javascript">
+ function expand(id) {
+ var e = document.getElementById(id);
+ var f = document.getElementById(id + "_mark");
+ if (e.style.display == 'block') {
+ e.style.display = 'none';
+ f.innerHTML = '⊕';
+ }
+ else {
+ e.style.display = 'block';
+ f.innerHTML = '⊖';
+ }
+ };
+ function expandCollapse(show) {
+ for (var id = 1; ; id++) {
+ var e = document.getElementById(id + "");
+ var f = document.getElementById(id + "_mark");
+ if (!e || !f) break;
+ e.style.display = (show ? 'block' : 'none');
+ f.innerHTML = (show ? '⊖' : '⊕');
+ }
+ };
+ </script>
+ <style type="text/css">
+ th,td{border-collapse:collapse; border:1px solid black;}
+ .button{color:blue;font-size:110%;font-weight:bolder;}
+ .bt{color:black;background-color:transparent;border:none;outline:none;
+ font-size:140%;font-weight:bolder;}
+ .c0{background-color:#e0e0e0;}
+ .c1{background-color:#d0d0d0;}
+ .t1{border-collapse:collapse; width:100%; border:1px solid black;}
+ </style>
+ <script src="https://www.gstatic.com/charts/loader.js"></script>
+"""
+
+
+def make_writer(output_stream):
+
+ def writer(text):
+ return output_stream.write(text + '\n')
+
+ return writer
+
+
+def html_big(param):
+ return '<font size="+2">' + param + '</font>'
+
+
+def dump_html_prologue(title, writer, warn_patterns, project_names):
+ writer('<html>\n<head>')
+ writer('<title>' + title + '</title>')
+ writer(html_head_scripts)
+ emit_stats_by_project(writer, warn_patterns, project_names)
+ writer('</head>\n<body>')
+ writer(html_big(title))
+ writer('<p>')
+
+
+def dump_html_epilogue(writer):
+ writer('</body>\n</head>\n</html>')
+
+
+def sort_warnings(warn_patterns):
+ for i in warn_patterns:
+ i['members'] = sorted(set(i['members']))
+
+
+def create_warnings(warn_patterns, project_names):
+ """Creates warnings s.t.
+
+ warnings[p][s] is as specified in above docs.
+
+ Args:
+ warn_patterns: list of warning patterns for specified platform
+ project_names: list of project names
+
+ Returns:
+ 2D warnings array where warnings[p][s] is # of warnings in project name p of
+ severity level s
+ """
+ # pylint:disable=g-complex-comprehension
+ warnings = {p: {s.value: 0 for s in Severity.levels} for p in project_names}
+ for i in warn_patterns:
+ s = i['severity'].value
+ for p in i['projects']:
+ warnings[p][s] += i['projects'][p]
+ return warnings
+
+
+def get_total_by_project(warnings, project_names):
+ """Returns dict, project as key and # warnings for that project as value."""
+ # pylint:disable=g-complex-comprehension
+ return {
+ p: sum(warnings[p][s.value] for s in Severity.levels)
+ for p in project_names
+ }
+
+
+def get_total_by_severity(warnings, project_names):
+ """Returns dict, severity as key and # warnings of that severity as value."""
+ # pylint:disable=g-complex-comprehension
+ return {
+ s.value: sum(warnings[p][s.value] for p in project_names)
+ for s in Severity.levels
+ }
+
+
+def emit_table_header(total_by_severity):
+ """Returns list of HTML-formatted content for severity stats."""
+
+ stats_header = ['Project']
+ for s in Severity.levels:
+ if total_by_severity[s.value]:
+ stats_header.append(
+ '<span style=\'background-color:{}\'>{}</span>'.format(
+ s.color, s.column_header))
+ stats_header.append('TOTAL')
+ return stats_header
+
+
+def emit_row_counts_per_project(warnings, total_by_project, total_by_severity,
+ project_names):
+ """Returns total project warnings and row of stats for each project.
+
+ Args:
+ warnings: output of create_warnings(warn_patterns, project_names)
+ total_by_project: output of get_total_by_project(project_names)
+ total_by_severity: output of get_total_by_severity(project_names)
+ project_names: list of project names
+
+ Returns:
+ total_all_projects, the total number of warnings over all projects
+ stats_rows, a 2d list where each row is [Project Name, <severity counts>,
+ total # warnings for this project]
+ """
+
+ total_all_projects = 0
+ stats_rows = []
+ for p in project_names:
+ if total_by_project[p]:
+ one_row = [p]
+ for s in Severity.levels:
+ if total_by_severity[s.value]:
+ one_row.append(warnings[p][s.value])
+ one_row.append(total_by_project[p])
+ stats_rows.append(one_row)
+ total_all_projects += total_by_project[p]
+ return total_all_projects, stats_rows
+
+
+def emit_row_counts_per_severity(total_by_severity, stats_header, stats_rows,
+ total_all_projects, writer):
+ """Emits stats_header and stats_rows as specified above.
+
+ Args:
+ total_by_severity: output of get_total_by_severity()
+ stats_header: output of emit_table_header()
+ stats_rows: output of emit_row_counts_per_project()
+ total_all_projects: output of emit_row_counts_per_project()
+ writer: writer returned by make_writer(output_stream)
+ """
+
+ total_all_severities = 0
+ one_row = ['<b>TOTAL</b>']
+ for s in Severity.levels:
+ if total_by_severity[s.value]:
+ one_row.append(total_by_severity[s.value])
+ total_all_severities += total_by_severity[s.value]
+ one_row.append(total_all_projects)
+ stats_rows.append(one_row)
+ writer('<script>')
+ emit_const_string_array('StatsHeader', stats_header, writer)
+ emit_const_object_array('StatsRows', stats_rows, writer)
+ writer(draw_table_javascript)
+ writer('</script>')
+
+
+def emit_stats_by_project(writer, warn_patterns, project_names):
+ """Dump a google chart table of warnings per project and severity."""
+
+ warnings = create_warnings(warn_patterns, project_names)
+ total_by_project = get_total_by_project(warnings, project_names)
+ total_by_severity = get_total_by_severity(warnings, project_names)
+ stats_header = emit_table_header(total_by_severity)
+ total_all_projects, stats_rows = \
+ emit_row_counts_per_project(warnings, total_by_project, total_by_severity, project_names)
+ emit_row_counts_per_severity(total_by_severity, stats_header, stats_rows,
+ total_all_projects, writer)
+
+
+def dump_stats(writer, warn_patterns):
+ """Dump some stats about total number of warnings and such."""
+
+ known = 0
+ skipped = 0
+ unknown = 0
+ sort_warnings(warn_patterns)
+ for i in warn_patterns:
+ if i['severity'] == Severity.UNMATCHED:
+ unknown += len(i['members'])
+ elif i['severity'] == Severity.SKIP:
+ skipped += len(i['members'])
+ else:
+ known += len(i['members'])
+ writer('Number of classified warnings: <b>' + str(known) + '</b><br>')
+ writer('Number of skipped warnings: <b>' + str(skipped) + '</b><br>')
+ writer('Number of unclassified warnings: <b>' + str(unknown) + '</b><br>')
+ total = unknown + known + skipped
+ extra_msg = ''
+ if total < 1000:
+ extra_msg = ' (low count may indicate incremental build)'
+ writer('Total number of warnings: <b>' + str(total) + '</b>' + extra_msg)
+
+
+# New base table of warnings, [severity, warn_id, project, warning_message]
+# Need buttons to show warnings in different grouping options.
+# (1) Current, group by severity, id for each warning pattern
+# sort by severity, warn_id, warning_message
+# (2) Current --byproject, group by severity,
+# id for each warning pattern + project name
+# sort by severity, warn_id, project, warning_message
+# (3) New, group by project + severity,
+# id for each warning pattern
+# sort by project, severity, warn_id, warning_message
+def emit_buttons(writer):
+ writer('<button class="button" onclick="expandCollapse(1);">'
+ 'Expand all warnings</button>\n'
+ '<button class="button" onclick="expandCollapse(0);">'
+ 'Collapse all warnings</button>\n'
+ '<button class="button" onclick="groupBySeverity();">'
+ 'Group warnings by severity</button>\n'
+ '<button class="button" onclick="groupByProject();">'
+ 'Group warnings by project</button><br>')
+
+
+def all_patterns(category):
+ patterns = ''
+ for i in category['patterns']:
+ patterns += i
+ patterns += ' / '
+ return patterns
+
+
+def dump_fixed(writer, warn_patterns):
+ """Show which warnings no longer occur."""
+ anchor = 'fixed_warnings'
+ mark = anchor + '_mark'
+ writer('\n<br><p style="background-color:lightblue"><b>'
+ '<button id="' + mark + '" '
+ 'class="bt" onclick="expand(\'' + anchor + '\');">'
+ '⊕</button> Fixed warnings. '
+ 'No more occurrences. Please consider turning these into '
+ 'errors if possible, before they are reintroduced in to the build'
+ ':</b></p>')
+ writer('<blockquote>')
+ fixed_patterns = []
+ for i in warn_patterns:
+ if not i['members']:
+ fixed_patterns.append(i['description'] + ' (' + all_patterns(i) + ')')
+ fixed_patterns = sorted(fixed_patterns)
+ writer('<div id="' + anchor + '" style="display:none;"><table>')
+ cur_row_class = 0
+ for text in fixed_patterns:
+ cur_row_class = 1 - cur_row_class
+ # remove last '\n'
+ t = text[:-1] if text[-1] == '\n' else text
+ writer('<tr><td class="c' + str(cur_row_class) + '">' + t + '</td></tr>')
+ writer('</table></div>')
+ writer('</blockquote>')
+
+
+def write_severity(csvwriter, sev, kind, warn_patterns):
+ """Count warnings of given severity and write CSV entries to writer."""
+ total = 0
+ for pattern in warn_patterns:
+ if pattern['severity'] == sev and pattern['members']:
+ n = len(pattern['members'])
+ total += n
+ warning = kind + ': ' + (pattern['description'] or '?')
+ csvwriter.writerow([n, '', warning])
+ # print number of warnings for each project, ordered by project name
+ projects = sorted(pattern['projects'].keys())
+ for project in projects:
+ csvwriter.writerow([pattern['projects'][project], project, warning])
+ csvwriter.writerow([total, '', kind + ' warnings'])
+ return total
+
+
+def dump_csv(csvwriter, warn_patterns):
+ """Dump number of warnings in CSV format to writer."""
+ sort_warnings(warn_patterns)
+ total = 0
+ for s in Severity.levels:
+ total += write_severity(csvwriter, s, s.column_header, warn_patterns)
+ csvwriter.writerow([total, '', 'All warnings'])
+
+
+# Return s with escaped backslash and quotation characters.
+def escape_string(s):
+ return s.replace('\\', '\\\\').replace('"', '\\"')
+
+
+# Return s without trailing '\n' and escape the quotation characters.
+def strip_escape_string(s):
+ if not s:
+ return s
+ s = s[:-1] if s[-1] == '\n' else s
+ return escape_string(s)
+
+
+def emit_warning_array(name, writer, warn_patterns):
+ writer('var warning_{} = ['.format(name))
+ for w in warn_patterns:
+ if name == 'severity':
+ writer('{},'.format(w[name].value))
+ else:
+ writer('{},'.format(w[name]))
+ writer('];')
+
+
+def emit_warning_arrays(writer, warn_patterns):
+ emit_warning_array('severity', writer, warn_patterns)
+ writer('var warning_description = [')
+ for w in warn_patterns:
+ if w['members']:
+ writer('"{}",'.format(escape_string(w['description'])))
+ else:
+ writer('"",') # no such warning
+ writer('];')
+
+
+scripts_for_warning_groups = """
+ function compareMessages(x1, x2) { // of the same warning type
+ return (WarningMessages[x1[2]] <= WarningMessages[x2[2]]) ? -1 : 1;
+ }
+ function byMessageCount(x1, x2) {
+ return x2[2] - x1[2]; // reversed order
+ }
+ function bySeverityMessageCount(x1, x2) {
+ // orer by severity first
+ if (x1[1] != x2[1])
+ return x1[1] - x2[1];
+ return byMessageCount(x1, x2);
+ }
+ const ParseLinePattern = /^([^ :]+):(\\d+):(.+)/;
+ function addURL(line) { // used by Android
+ if (FlagURL == "") return line;
+ if (FlagSeparator == "") {
+ return line.replace(ParseLinePattern,
+ "<a target='_blank' href='" + FlagURL + "/$1'>$1</a>:$2:$3");
+ }
+ return line.replace(ParseLinePattern,
+ "<a target='_blank' href='" + FlagURL + "/$1" + FlagSeparator +
+ "$2'>$1:$2</a>:$3");
+ }
+ function addURLToLine(line, link) { // used by Chrome
+ let line_split = line.split(":");
+ let path = line_split.slice(0,3).join(":");
+ let msg = line_split.slice(3).join(":");
+ let html_link = `<a target="_blank" href="${link}">${path}</a>${msg}`;
+ return html_link;
+ }
+ function createArrayOfDictionaries(n) {
+ var result = [];
+ for (var i=0; i<n; i++) result.push({});
+ return result;
+ }
+ function groupWarningsBySeverity() {
+ // groups is an array of dictionaries,
+ // each dictionary maps from warning type to array of warning messages.
+ var groups = createArrayOfDictionaries(SeverityColors.length);
+ for (var i=0; i<Warnings.length; i++) {
+ var w = Warnings[i][0];
+ var s = WarnPatternsSeverity[w];
+ var k = w.toString();
+ if (!(k in groups[s]))
+ groups[s][k] = [];
+ groups[s][k].push(Warnings[i]);
+ }
+ return groups;
+ }
+ function groupWarningsByProject() {
+ var groups = createArrayOfDictionaries(ProjectNames.length);
+ for (var i=0; i<Warnings.length; i++) {
+ var w = Warnings[i][0];
+ var p = Warnings[i][1];
+ var k = w.toString();
+ if (!(k in groups[p]))
+ groups[p][k] = [];
+ groups[p][k].push(Warnings[i]);
+ }
+ return groups;
+ }
+ var GlobalAnchor = 0;
+ function createWarningSection(header, color, group) {
+ var result = "";
+ var groupKeys = [];
+ var totalMessages = 0;
+ for (var k in group) {
+ totalMessages += group[k].length;
+ groupKeys.push([k, WarnPatternsSeverity[parseInt(k)], group[k].length]);
+ }
+ groupKeys.sort(bySeverityMessageCount);
+ for (var idx=0; idx<groupKeys.length; idx++) {
+ var k = groupKeys[idx][0];
+ var messages = group[k];
+ var w = parseInt(k);
+ var wcolor = SeverityColors[WarnPatternsSeverity[w]];
+ var description = WarnPatternsDescription[w];
+ if (description.length == 0)
+ description = "???";
+ GlobalAnchor += 1;
+ result += "<table class='t1'><tr bgcolor='" + wcolor + "'><td>" +
+ "<button class='bt' id='" + GlobalAnchor + "_mark" +
+ "' onclick='expand(\\"" + GlobalAnchor + "\\");'>" +
+ "⊕</button> " +
+ description + " (" + messages.length + ")</td></tr></table>";
+ result += "<div id='" + GlobalAnchor +
+ "' style='display:none;'><table class='t1'>";
+ var c = 0;
+ messages.sort(compareMessages);
+ if (FlagPlatform == "chrome") {
+ for (var i=0; i<messages.length; i++) {
+ result += "<tr><td class='c" + c + "'>" +
+ addURLToLine(WarningMessages[messages[i][2]], WarningLinks[messages[i][3]]) + "</td></tr>";
+ c = 1 - c;
+ }
+ } else {
+ for (var i=0; i<messages.length; i++) {
+ result += "<tr><td class='c" + c + "'>" +
+ addURL(WarningMessages[messages[i][2]]) + "</td></tr>";
+ c = 1 - c;
+ }
+ }
+ result += "</table></div>";
+ }
+ if (result.length > 0) {
+ return "<br><span style='background-color:" + color + "'><b>" +
+ header + ": " + totalMessages +
+ "</b></span><blockquote><table class='t1'>" +
+ result + "</table></blockquote>";
+
+ }
+ return ""; // empty section
+ }
+ function generateSectionsBySeverity() {
+ var result = "";
+ var groups = groupWarningsBySeverity();
+ for (s=0; s<SeverityColors.length; s++) {
+ result += createWarningSection(SeverityHeaders[s], SeverityColors[s],
+ groups[s]);
+ }
+ return result;
+ }
+ function generateSectionsByProject() {
+ var result = "";
+ var groups = groupWarningsByProject();
+ for (i=0; i<groups.length; i++) {
+ result += createWarningSection(ProjectNames[i], 'lightgrey', groups[i]);
+ }
+ return result;
+ }
+ function groupWarnings(generator) {
+ GlobalAnchor = 0;
+ var e = document.getElementById("warning_groups");
+ e.innerHTML = generator();
+ }
+ function groupBySeverity() {
+ groupWarnings(generateSectionsBySeverity);
+ }
+ function groupByProject() {
+ groupWarnings(generateSectionsByProject);
+ }
+"""
+
+
+# Emit a JavaScript const string
+def emit_const_string(name, value, writer):
+ writer('const ' + name + ' = "' + escape_string(value) + '";')
+
+
+# Emit a JavaScript const integer array.
+def emit_const_int_array(name, array, writer):
+ writer('const ' + name + ' = [')
+ for n in array:
+ writer(str(n) + ',')
+ writer('];')
+
+
+# Emit a JavaScript const string array.
+def emit_const_string_array(name, array, writer):
+ writer('const ' + name + ' = [')
+ for s in array:
+ writer('"' + strip_escape_string(s) + '",')
+ writer('];')
+
+
+# Emit a JavaScript const string array for HTML.
+def emit_const_html_string_array(name, array, writer):
+ writer('const ' + name + ' = [')
+ for s in array:
+ # Not using html.escape yet, to work for both python 2 and 3,
+ # until all users switch to python 3.
+ # pylint:disable=deprecated-method
+ writer('"' + cgi.escape(strip_escape_string(s)) + '",')
+ writer('];')
+
+
+# Emit a JavaScript const object array.
+def emit_const_object_array(name, array, writer):
+ writer('const ' + name + ' = [')
+ for x in array:
+ writer(str(x) + ',')
+ writer('];')
+
+
+def emit_js_data(writer, flags, warning_messages, warning_links,
+ warning_records, warn_patterns, project_names):
+ """Dump dynamic HTML page's static JavaScript data."""
+ emit_const_string('FlagPlatform', flags.platform, writer)
+ emit_const_string('FlagURL', flags.url, writer)
+ emit_const_string('FlagSeparator', flags.separator, writer)
+ emit_const_string_array('SeverityColors', [s.color for s in Severity.levels],
+ writer)
+ emit_const_string_array('SeverityHeaders',
+ [s.header for s in Severity.levels], writer)
+ emit_const_string_array('SeverityColumnHeaders',
+ [s.column_header for s in Severity.levels], writer)
+ emit_const_string_array('ProjectNames', project_names, writer)
+ # pytype: disable=attribute-error
+ emit_const_int_array('WarnPatternsSeverity',
+ [w['severity'].value for w in warn_patterns], writer)
+ # pytype: enable=attribute-error
+ emit_const_html_string_array('WarnPatternsDescription',
+ [w['description'] for w in warn_patterns],
+ writer)
+ emit_const_html_string_array('WarningMessages', warning_messages, writer)
+ emit_const_object_array('Warnings', warning_records, writer)
+ if flags.platform == 'chrome':
+ emit_const_html_string_array('WarningLinks', warning_links, writer)
+
+
+draw_table_javascript = """
+google.charts.load('current', {'packages':['table']});
+google.charts.setOnLoadCallback(drawTable);
+function drawTable() {
+ var data = new google.visualization.DataTable();
+ data.addColumn('string', StatsHeader[0]);
+ for (var i=1; i<StatsHeader.length; i++) {
+ data.addColumn('number', StatsHeader[i]);
+ }
+ data.addRows(StatsRows);
+ for (var i=0; i<StatsRows.length; i++) {
+ for (var j=0; j<StatsHeader.length; j++) {
+ data.setProperty(i, j, 'style', 'border:1px solid black;');
+ }
+ }
+ var table = new google.visualization.Table(
+ document.getElementById('stats_table'));
+ table.draw(data, {allowHtml: true, alternatingRowStyle: true});
+}
+"""
+
+
+def dump_html(flags, output_stream, warning_messages, warning_links,
+ warning_records, header_str, warn_patterns, project_names):
+ """Dump the flags output to output_stream."""
+ writer = make_writer(output_stream)
+ dump_html_prologue('Warnings for ' + header_str, writer, warn_patterns,
+ project_names)
+ dump_stats(writer, warn_patterns)
+ writer('<br><div id="stats_table"></div><br>')
+ writer('\n<script>')
+ emit_js_data(writer, flags, warning_messages, warning_links, warning_records,
+ warn_patterns, project_names)
+ writer(scripts_for_warning_groups)
+ writer('</script>')
+ emit_buttons(writer)
+ # Warning messages are grouped by severities or project names.
+ writer('<br><div id="warning_groups"></div>')
+ if flags.byproject:
+ writer('<script>groupByProject();</script>')
+ else:
+ writer('<script>groupBySeverity();</script>')
+ dump_fixed(writer, warn_patterns)
+ dump_html_epilogue(writer)
+
+
+def write_html(flags, project_names, warn_patterns, html_path, warning_messages,
+ warning_links, warning_records, header_str):
+ """Write warnings html file."""
+ if html_path:
+ with open(html_path, 'w') as f:
+ dump_html(flags, f, warning_messages, warning_links, warning_records,
+ header_str, warn_patterns, project_names)
+
+
+def write_out_csv(flags, warn_patterns, warning_messages, warning_links,
+ warning_records, header_str, project_names):
+ """Write warnings csv file."""
+ if flags.csvpath:
+ with open(flags.csvpath, 'w') as f:
+ dump_csv(csv.writer(f, lineterminator='\n'), warn_patterns)
+
+ if flags.gencsv:
+ dump_csv(csv.writer(sys.stdout, lineterminator='\n'), warn_patterns)
+ else:
+ dump_html(flags, sys.stdout, warning_messages, warning_links,
+ warning_records, header_str, warn_patterns, project_names)
diff --git a/tools/warn/java_warn_patterns.py b/tools/warn/java_warn_patterns.py
new file mode 100644
index 0000000..17e3864
--- /dev/null
+++ b/tools/warn/java_warn_patterns.py
@@ -0,0 +1,800 @@
+# python3
+# Copyright (C) 2019 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.
+
+"""Warning patterns for Java compiler tools."""
+
+# pylint:disable=relative-beyond-top-level
+# pylint:disable=g-importing-member
+from .cpp_warn_patterns import compile_patterns
+from .severity import Severity
+
+
+def java_warn(severity, description, pattern_list):
+ return {
+ 'category': 'Java',
+ 'severity': severity,
+ 'description': 'Java: ' + description,
+ 'patterns': pattern_list
+ }
+
+
+def java_high(description, pattern_list):
+ return java_warn(Severity.HIGH, description, pattern_list)
+
+
+def java_medium(description, pattern_list):
+ return java_warn(Severity.MEDIUM, description, pattern_list)
+
+
+def warn_with_name(name, severity, description=None):
+ if description is None:
+ description = name
+ return java_warn(severity, description,
+ [r'.*\.java:.*: warning: .+ \[' + name + r'\]$',
+ r'.*\.java:.*: warning: \[' + name + r'\] .+'])
+
+
+def high(name, description=None):
+ return warn_with_name(name, Severity.HIGH, description)
+
+
+def medium(name, description=None):
+ return warn_with_name(name, Severity.MEDIUM, description)
+
+
+def low(name, description=None):
+ return warn_with_name(name, Severity.LOW, description)
+
+
+warn_patterns = [
+ # pylint:disable=line-too-long,g-inconsistent-quotes
+ # Warnings from Javac
+ java_medium('Use of deprecated',
+ [r'.*: warning: \[deprecation\] .+',
+ r'.*: warning: \[removal\] .+ has been deprecated and marked for removal$']),
+ java_medium('Incompatible SDK implementation',
+ [r'.*\.java:.*: warning: @Implementation .+ has .+ not .+ as in the SDK ']),
+ medium('unchecked', 'Unchecked conversion'),
+ java_medium('No annotation method',
+ [r'.*\.class\): warning: Cannot find annotation method .+ in']),
+ java_medium('No class/method in SDK ...',
+ [r'.*\.java:.*: warning: No such (class|method) .* for SDK']),
+ # Warnings generated by Error Prone
+ java_medium('Non-ascii characters used, but ascii encoding specified',
+ [r".*: warning: unmappable character for encoding ascii"]),
+ java_medium('Non-varargs call of varargs method with inexact argument type for last parameter',
+ [r".*: warning: non-varargs call of varargs method with inexact argument type for last parameter"]),
+ java_medium('Unchecked method invocation',
+ [r".*: warning: \[unchecked\] unchecked method invocation: .+ in class .+"]),
+ java_medium('Unchecked conversion',
+ [r".*: warning: \[unchecked\] unchecked conversion"]),
+ java_medium('_ used as an identifier',
+ [r".*: warning: '_' used as an identifier"]),
+ java_medium('hidden superclass',
+ [r".*: warning: .* stripped of .* superclass .* \[HiddenSuperclass\]"]),
+ java_high('Use of internal proprietary API',
+ [r".*: warning: .* is internal proprietary API and may be removed"]),
+ low('BooleanParameter',
+ 'Use parameter comments to document ambiguous literals'),
+ low('ClassNamedLikeTypeParameter',
+ 'This class\'s name looks like a Type Parameter.'),
+ low('ConstantField',
+ 'Field name is CONSTANT_CASE, but field is not static and final'),
+ low('EmptySetMultibindingContributions',
+ '@Multibinds is a more efficient and declarative mechanism for ensuring that a set multibinding is present in the graph.'),
+ low('ExpectedExceptionRefactoring',
+ 'Prefer assertThrows to ExpectedException'),
+ low('FieldCanBeFinal',
+ 'This field is only assigned during initialization; consider making it final'),
+ low('FieldMissingNullable',
+ 'Fields that can be null should be annotated @Nullable'),
+ low('ImmutableRefactoring',
+ 'Refactors uses of the JSR 305 @Immutable to Error Prone\'s annotation'),
+ low('LambdaFunctionalInterface',
+ u'Use Java\'s utility functional interfaces instead of Function\u003cA, B> for primitive types.'),
+ low('MethodCanBeStatic',
+ 'A private method that does not reference the enclosing instance can be static'),
+ low('MixedArrayDimensions',
+ 'C-style array declarations should not be used'),
+ low('MultiVariableDeclaration',
+ 'Variable declarations should declare only one variable'),
+ low('MultipleTopLevelClasses',
+ 'Source files should not contain multiple top-level class declarations'),
+ low('MultipleUnaryOperatorsInMethodCall',
+ 'Avoid having multiple unary operators acting on the same variable in a method call'),
+ low('OnNameExpected',
+ 'OnNameExpected naming style'),
+ low('PackageLocation',
+ 'Package names should match the directory they are declared in'),
+ low('ParameterComment',
+ 'Non-standard parameter comment; prefer `/* paramName= */ arg`'),
+ low('ParameterNotNullable',
+ 'Method parameters that aren\'t checked for null shouldn\'t be annotated @Nullable'),
+ low('PrivateConstructorForNoninstantiableModule',
+ 'Add a private constructor to modules that will not be instantiated by Dagger.'),
+ low('PrivateConstructorForUtilityClass',
+ 'Utility classes (only static members) are not designed to be instantiated and should be made noninstantiable with a default constructor.'),
+ low('RemoveUnusedImports',
+ 'Unused imports'),
+ low('ReturnMissingNullable',
+ 'Methods that can return null should be annotated @Nullable'),
+ low('ScopeOnModule',
+ 'Scopes on modules have no function and will soon be an error.'),
+ low('SwitchDefault',
+ 'The default case of a switch should appear at the end of the last statement group'),
+ low('TestExceptionRefactoring',
+ 'Prefer assertThrows to @Test(expected=...)'),
+ low('ThrowsUncheckedException',
+ 'Unchecked exceptions do not need to be declared in the method signature.'),
+ low('TryFailRefactoring',
+ 'Prefer assertThrows to try/fail'),
+ low('TypeParameterNaming',
+ 'Type parameters must be a single letter with an optional numeric suffix, or an UpperCamelCase name followed by the letter \'T\'.'),
+ low('UngroupedOverloads',
+ 'Constructors and methods with the same name should appear sequentially with no other code in between. Please re-order or re-name methods.'),
+ low('UnnecessarySetDefault',
+ 'Unnecessary call to NullPointerTester#setDefault'),
+ low('UnnecessaryStaticImport',
+ 'Using static imports for types is unnecessary'),
+ low('UseBinds',
+ '@Binds is a more efficient and declarative mechanism for delegating a binding.'),
+ low('WildcardImport',
+ 'Wildcard imports, static or otherwise, should not be used'),
+ medium('AcronymName',
+ 'AcronymName'),
+ medium('AmbiguousMethodReference',
+ 'Method reference is ambiguous'),
+ medium('AnnotateFormatMethod',
+ 'This method passes a pair of parameters through to String.format, but the enclosing method wasn\'t annotated @FormatMethod. Doing so gives compile-time rather than run-time protection against malformed format strings.'),
+ medium('AnnotationPosition',
+ 'Annotations should be positioned after Javadocs, but before modifiers..'),
+ medium('ArgumentSelectionDefectChecker',
+ 'Arguments are in the wrong order or could be commented for clarity.'),
+ medium('ArrayAsKeyOfSetOrMap',
+ 'Arrays do not override equals() or hashCode, so comparisons will be done on reference equality only. If neither deduplication nor lookup are needed, consider using a List instead. Otherwise, use IdentityHashMap/Set, a Map from a library that handles object arrays, or an Iterable/List of pairs.'),
+ medium('AssertEqualsArgumentOrderChecker',
+ 'Arguments are swapped in assertEquals-like call'),
+ medium('AssertFalse',
+ 'Assertions may be disabled at runtime and do not guarantee that execution will halt here; consider throwing an exception instead'),
+ medium('AssertThrowsMultipleStatements',
+ 'The lambda passed to assertThrows should contain exactly one statement'),
+ medium('AssertionFailureIgnored',
+ 'This assertion throws an AssertionError if it fails, which will be caught by an enclosing try block.'),
+ medium('AssistedInjectAndInjectOnConstructors',
+ '@AssistedInject and @Inject should not be used on different constructors in the same class.'),
+ medium('AutoValueFinalMethods',
+ 'Make toString(), hashCode() and equals() final in AutoValue classes, so it is clear to readers that AutoValue is not overriding them'),
+ medium('BadAnnotationImplementation',
+ 'Classes that implement Annotation must override equals and hashCode. Consider using AutoAnnotation instead of implementing Annotation by hand.'),
+ medium('BadComparable',
+ 'Possible sign flip from narrowing conversion'),
+ medium('BadImport',
+ 'Importing nested classes/static methods/static fields with commonly-used names can make code harder to read, because it may not be clear from the context exactly which type is being referred to. Qualifying the name with that of the containing class can make the code clearer.'),
+ medium('BadInstanceof',
+ 'instanceof used in a way that is equivalent to a null check.'),
+ medium('BigDecimalEquals',
+ 'BigDecimal#equals has surprising behavior: it also compares scale.'),
+ medium('BigDecimalLiteralDouble',
+ 'new BigDecimal(double) loses precision in this case.'),
+ medium('BinderIdentityRestoredDangerously',
+ 'A call to Binder.clearCallingIdentity() should be followed by Binder.restoreCallingIdentity() in a finally block. Otherwise the wrong Binder identity may be used by subsequent code.'),
+ medium('BindingToUnqualifiedCommonType',
+ 'This code declares a binding for a common value type without a Qualifier annotation.'),
+ medium('BoxedPrimitiveConstructor',
+ 'valueOf or autoboxing provides better time and space performance'),
+ medium('ByteBufferBackingArray',
+ 'ByteBuffer.array() shouldn\'t be called unless ByteBuffer.arrayOffset() is used or if the ByteBuffer was initialized using ByteBuffer.wrap() or ByteBuffer.allocate().'),
+ medium('CannotMockFinalClass',
+ 'Mockito cannot mock final classes'),
+ medium('CanonicalDuration',
+ 'Duration can be expressed more clearly with different units'),
+ medium('CatchAndPrintStackTrace',
+ 'Logging or rethrowing exceptions should usually be preferred to catching and calling printStackTrace'),
+ medium('CatchFail',
+ 'Ignoring exceptions and calling fail() is unnecessary, and makes test output less useful'),
+ medium('ClassCanBeStatic',
+ 'Inner class is non-static but does not reference enclosing class'),
+ medium('ClassNewInstance',
+ 'Class.newInstance() bypasses exception checking; prefer getDeclaredConstructor().newInstance()'),
+ medium('CloseableProvides',
+ 'Providing Closeable resources makes their lifecycle unclear'),
+ medium('CollectionToArraySafeParameter',
+ 'The type of the array parameter of Collection.toArray needs to be compatible with the array type'),
+ medium('CollectorShouldNotUseState',
+ 'Collector.of() should not use state'),
+ medium('ComparableAndComparator',
+ 'Class should not implement both `Comparable` and `Comparator`'),
+ medium('ConstructorInvokesOverridable',
+ 'Constructors should not invoke overridable methods.'),
+ medium('ConstructorLeaksThis',
+ 'Constructors should not pass the \'this\' reference out in method invocations, since the object may not be fully constructed.'),
+ medium('DateFormatConstant',
+ 'DateFormat is not thread-safe, and should not be used as a constant field.'),
+ medium('DefaultCharset',
+ 'Implicit use of the platform default charset, which can result in differing behaviour between JVM executions or incorrect behavior if the encoding of the data source doesn\'t match expectations.'),
+ medium('DeprecatedThreadMethods',
+ 'Avoid deprecated Thread methods; read the method\'s javadoc for details.'),
+ medium('DoubleBraceInitialization',
+ 'Prefer collection factory methods or builders to the double-brace initialization pattern.'),
+ medium('DoubleCheckedLocking',
+ 'Double-checked locking on non-volatile fields is unsafe'),
+ medium('EmptyTopLevelDeclaration',
+ 'Empty top-level type declaration'),
+ medium('EqualsBrokenForNull',
+ 'equals() implementation may throw NullPointerException when given null'),
+ medium('EqualsGetClass',
+ 'Overriding Object#equals in a non-final class by using getClass rather than instanceof breaks substitutability of subclasses.'),
+ medium('EqualsHashCode',
+ 'Classes that override equals should also override hashCode.'),
+ medium('EqualsIncompatibleType',
+ 'An equality test between objects with incompatible types always returns false'),
+ medium('EqualsUnsafeCast',
+ 'The contract of #equals states that it should return false for incompatible types, while this implementation may throw ClassCastException.'),
+ medium('EqualsUsingHashCode',
+ 'Implementing #equals by just comparing hashCodes is fragile. Hashes collide frequently, and this will lead to false positives in #equals.'),
+ medium('ExpectedExceptionChecker',
+ 'Calls to ExpectedException#expect should always be followed by exactly one statement.'),
+ medium('ExtendingJUnitAssert',
+ 'When only using JUnit Assert\'s static methods, you should import statically instead of extending.'),
+ medium('FallThrough',
+ 'Switch case may fall through'),
+ medium('Finally',
+ 'If you return or throw from a finally, then values returned or thrown from the try-catch block will be ignored. Consider using try-with-resources instead.'),
+ medium('FloatCast',
+ 'Use parentheses to make the precedence explicit'),
+ medium('FloatingPointAssertionWithinEpsilon',
+ 'This fuzzy equality check is using a tolerance less than the gap to the next number. You may want a less restrictive tolerance, or to assert equality.'),
+ medium('FloatingPointLiteralPrecision',
+ 'Floating point literal loses precision'),
+ medium('FragmentInjection',
+ 'Classes extending PreferenceActivity must implement isValidFragment such that it does not unconditionally return true to prevent vulnerability to fragment injection attacks.'),
+ medium('FragmentNotInstantiable',
+ 'Subclasses of Fragment must be instantiable via Class#newInstance(): the class must be public, static and have a public nullary constructor'),
+ medium('FunctionalInterfaceClash',
+ 'Overloads will be ambiguous when passing lambda arguments'),
+ medium('FutureReturnValueIgnored',
+ 'Return value of methods returning Future must be checked. Ignoring returned Futures suppresses exceptions thrown from the code that completes the Future.'),
+ medium('GetClassOnEnum',
+ 'Calling getClass() on an enum may return a subclass of the enum type'),
+ medium('HardCodedSdCardPath',
+ 'Hardcoded reference to /sdcard'),
+ medium('HidingField',
+ 'Hiding fields of superclasses may cause confusion and errors'),
+ medium('ImmutableAnnotationChecker',
+ 'Annotations should always be immutable'),
+ medium('ImmutableEnumChecker',
+ 'Enums should always be immutable'),
+ medium('IncompatibleModifiers',
+ 'This annotation has incompatible modifiers as specified by its @IncompatibleModifiers annotation'),
+ medium('InconsistentCapitalization',
+ 'It is confusing to have a field and a parameter under the same scope that differ only in capitalization.'),
+ medium('InconsistentHashCode',
+ 'Including fields in hashCode which are not compared in equals violates the contract of hashCode.'),
+ medium('InconsistentOverloads',
+ 'The ordering of parameters in overloaded methods should be as consistent as possible (when viewed from left to right)'),
+ medium('IncrementInForLoopAndHeader',
+ 'This for loop increments the same variable in the header and in the body'),
+ medium('InjectOnConstructorOfAbstractClass',
+ 'Constructors on abstract classes are never directly @Injected, only the constructors of their subclasses can be @Inject\'ed.'),
+ medium('InputStreamSlowMultibyteRead',
+ 'Please also override int read(byte[], int, int), otherwise multi-byte reads from this input stream are likely to be slow.'),
+ medium('InstanceOfAndCastMatchWrongType',
+ 'Casting inside an if block should be plausibly consistent with the instanceof type'),
+ medium('IntLongMath',
+ 'Expression of type int may overflow before being assigned to a long'),
+ medium('IntentBuilderName',
+ 'IntentBuilderName'),
+ medium('InvalidParam',
+ 'This @param tag doesn\'t refer to a parameter of the method.'),
+ medium('InvalidTag',
+ 'This tag is invalid.'),
+ medium('InvalidThrows',
+ 'The documented method doesn\'t actually throw this checked exception.'),
+ medium('IterableAndIterator',
+ 'Class should not implement both `Iterable` and `Iterator`'),
+ medium('JUnit3FloatingPointComparisonWithoutDelta',
+ 'Floating-point comparison without error tolerance'),
+ medium('JUnit4ClassUsedInJUnit3',
+ 'Some JUnit4 construct cannot be used in a JUnit3 context. Convert your class to JUnit4 style to use them.'),
+ medium('JUnitAmbiguousTestClass',
+ 'Test class inherits from JUnit 3\'s TestCase but has JUnit 4 @Test annotations.'),
+ medium('JavaLangClash',
+ 'Never reuse class names from java.lang'),
+ medium('JdkObsolete',
+ 'Suggests alternatives to obsolete JDK classes.'),
+ medium('LockNotBeforeTry',
+ 'Calls to Lock#lock should be immediately followed by a try block which releases the lock.'),
+ medium('LogicalAssignment',
+ 'Assignment where a boolean expression was expected; use == if this assignment wasn\'t expected or add parentheses for clarity.'),
+ medium('MathAbsoluteRandom',
+ 'Math.abs does not always give a positive result. Please consider other methods for positive random numbers.'),
+ medium('MissingCasesInEnumSwitch',
+ 'Switches on enum types should either handle all values, or have a default case.'),
+ medium('MissingDefault',
+ 'The Google Java Style Guide requires that each switch statement includes a default statement group, even if it contains no code. (This requirement is lifted for any switch statement that covers all values of an enum.)'),
+ medium('MissingFail',
+ 'Not calling fail() when expecting an exception masks bugs'),
+ medium('MissingOverride',
+ 'method overrides method in supertype; expected @Override'),
+ medium('ModifiedButNotUsed',
+ 'A collection or proto builder was created, but its values were never accessed.'),
+ medium('ModifyCollectionInEnhancedForLoop',
+ 'Modifying a collection while iterating over it in a loop may cause a ConcurrentModificationException to be thrown.'),
+ medium('MultipleParallelOrSequentialCalls',
+ 'Multiple calls to either parallel or sequential are unnecessary and cause confusion.'),
+ medium('MutableConstantField',
+ 'Constant field declarations should use the immutable type (such as ImmutableList) instead of the general collection interface type (such as List)'),
+ medium('MutableMethodReturnType',
+ 'Method return type should use the immutable type (such as ImmutableList) instead of the general collection interface type (such as List)'),
+ medium('NarrowingCompoundAssignment',
+ 'Compound assignments may hide dangerous casts'),
+ medium('NestedInstanceOfConditions',
+ 'Nested instanceOf conditions of disjoint types create blocks of code that never execute'),
+ medium('NoFunctionalReturnType',
+ 'Instead of returning a functional type, return the actual type that the returned function would return and use lambdas at use site.'),
+ medium('NonAtomicVolatileUpdate',
+ 'This update of a volatile variable is non-atomic'),
+ medium('NonCanonicalStaticMemberImport',
+ 'Static import of member uses non-canonical name'),
+ medium('NonOverridingEquals',
+ 'equals method doesn\'t override Object.equals'),
+ medium('NotCloseable',
+ 'Not closeable'),
+ medium('NullableConstructor',
+ 'Constructors should not be annotated with @Nullable since they cannot return null'),
+ medium('NullableDereference',
+ 'Dereference of possibly-null value'),
+ medium('NullablePrimitive',
+ '@Nullable should not be used for primitive types since they cannot be null'),
+ medium('NullableVoid',
+ 'void-returning methods should not be annotated with @Nullable, since they cannot return null'),
+ medium('ObjectToString',
+ 'Calling toString on Objects that don\'t override toString() doesn\'t provide useful information'),
+ medium('ObjectsHashCodePrimitive',
+ 'Objects.hashCode(Object o) should not be passed a primitive value'),
+ medium('OperatorPrecedence',
+ 'Use grouping parenthesis to make the operator precedence explicit'),
+ medium('OptionalNotPresent',
+ 'One should not call optional.get() inside an if statement that checks !optional.isPresent'),
+ medium('OrphanedFormatString',
+ 'String literal contains format specifiers, but is not passed to a format method'),
+ medium('OverrideThrowableToString',
+ 'To return a custom message with a Throwable class, one should override getMessage() instead of toString() for Throwable.'),
+ medium('Overrides',
+ 'Varargs doesn\'t agree for overridden method'),
+ medium('OverridesGuiceInjectableMethod',
+ 'This method is not annotated with @Inject, but it overrides a method that is annotated with @com.google.inject.Inject. Guice will inject this method, and it is recommended to annotate it explicitly.'),
+ medium('ParameterName',
+ 'Detects `/* name= */`-style comments on actual parameters where the name doesn\'t match the formal parameter'),
+ medium('PreconditionsInvalidPlaceholder',
+ 'Preconditions only accepts the %s placeholder in error message strings'),
+ medium('PrimitiveArrayPassedToVarargsMethod',
+ 'Passing a primitive array to a varargs method is usually wrong'),
+ medium('ProtoRedundantSet',
+ 'A field on a protocol buffer was set twice in the same chained expression.'),
+ medium('ProtosAsKeyOfSetOrMap',
+ 'Protos should not be used as a key to a map, in a set, or in a contains method on a descendant of a collection. Protos have non deterministic ordering and proto equality is deep, which is a performance issue.'),
+ medium('ProvidesFix',
+ 'BugChecker has incorrect ProvidesFix tag, please update'),
+ medium('QualifierOrScopeOnInjectMethod',
+ 'Qualifiers/Scope annotations on @Inject methods don\'t have any effect. Move the qualifier annotation to the binding location.'),
+ medium('QualifierWithTypeUse',
+ 'Injection frameworks currently don\'t understand Qualifiers in TYPE_PARAMETER or TYPE_USE contexts.'),
+ medium('ReachabilityFenceUsage',
+ 'reachabilityFence should always be called inside a finally block'),
+ medium('RedundantThrows',
+ 'Thrown exception is a subtype of another'),
+ medium('ReferenceEquality',
+ 'Comparison using reference equality instead of value equality'),
+ medium('RequiredModifiers',
+ 'This annotation is missing required modifiers as specified by its @RequiredModifiers annotation'),
+ medium('ReturnFromVoid',
+ 'Void methods should not have a @return tag.'),
+ medium('SamShouldBeLast',
+ 'SAM-compatible parameters should be last'),
+ medium('ShortCircuitBoolean',
+ u'Prefer the short-circuiting boolean operators \u0026\u0026 and || to \u0026 and |.'),
+ medium('StaticGuardedByInstance',
+ 'Writes to static fields should not be guarded by instance locks'),
+ medium('StaticQualifiedUsingExpression',
+ 'A static variable or method should be qualified with a class name, not expression'),
+ medium('StreamResourceLeak',
+ 'Streams that encapsulate a closeable resource should be closed using try-with-resources'),
+ medium('StringEquality',
+ 'String comparison using reference equality instead of value equality'),
+ medium('StringSplitter',
+ 'String.split(String) has surprising behavior'),
+ medium('SwigMemoryLeak',
+ 'SWIG generated code that can\'t call a C++ destructor will leak memory'),
+ medium('SynchronizeOnNonFinalField',
+ 'Synchronizing on non-final fields is not safe: if the field is ever updated, different threads may end up locking on different objects.'),
+ medium('SystemExitOutsideMain',
+ 'Code that contains System.exit() is untestable.'),
+ medium('TestExceptionChecker',
+ 'Using @Test(expected=...) is discouraged, since the test will pass if *any* statement in the test method throws the expected exception'),
+ medium('ThreadJoinLoop',
+ 'Thread.join needs to be surrounded by a loop until it succeeds, as in Uninterruptibles.joinUninterruptibly.'),
+ medium('ThreadLocalUsage',
+ 'ThreadLocals should be stored in static fields'),
+ medium('ThreadPriorityCheck',
+ 'Relying on the thread scheduler is discouraged; see Effective Java Item 72 (2nd edition) / 84 (3rd edition).'),
+ medium('ThreeLetterTimeZoneID',
+ 'Three-letter time zone identifiers are deprecated, may be ambiguous, and might not do what you intend; the full IANA time zone ID should be used instead.'),
+ medium('ToStringReturnsNull',
+ 'An implementation of Object.toString() should never return null.'),
+ medium('TruthAssertExpected',
+ 'The actual and expected values appear to be swapped, which results in poor assertion failure messages. The actual value should come first.'),
+ medium('TruthConstantAsserts',
+ 'Truth Library assert is called on a constant.'),
+ medium('TruthIncompatibleType',
+ 'Argument is not compatible with the subject\'s type.'),
+ medium('TypeNameShadowing',
+ 'Type parameter declaration shadows another named type'),
+ medium('TypeParameterShadowing',
+ 'Type parameter declaration overrides another type parameter already declared'),
+ medium('TypeParameterUnusedInFormals',
+ 'Declaring a type parameter that is only used in the return type is a misuse of generics: operations on the type parameter are unchecked, it hides unsafe casts at invocations of the method, and it interacts badly with method overload resolution.'),
+ medium('URLEqualsHashCode',
+ 'Avoid hash-based containers of java.net.URL--the containers rely on equals() and hashCode(), which cause java.net.URL to make blocking internet connections.'),
+ medium('UndefinedEquals',
+ 'Collection, Iterable, Multimap, and Queue do not have well-defined equals behavior'),
+ medium('UnnecessaryDefaultInEnumSwitch',
+ 'Switch handles all enum values: an explicit default case is unnecessary and defeats error checking for non-exhaustive switches.'),
+ medium('UnnecessaryParentheses',
+ 'Unnecessary use of grouping parentheses'),
+ medium('UnsafeFinalization',
+ 'Finalizer may run before native code finishes execution'),
+ medium('UnsafeReflectiveConstructionCast',
+ 'Prefer `asSubclass` instead of casting the result of `newInstance`, to detect classes of incorrect type before invoking their constructors.This way, if the class is of the incorrect type,it will throw an exception before invoking its constructor.'),
+ medium('UnsynchronizedOverridesSynchronized',
+ 'Unsynchronized method overrides a synchronized method.'),
+ medium('Unused',
+ 'Unused.'),
+ medium('UnusedException',
+ 'This catch block catches an exception and re-throws another, but swallows the caught exception rather than setting it as a cause. This can make debugging harder.'),
+ medium('UseCorrectAssertInTests',
+ 'Java assert is used in test. For testing purposes Assert.* matchers should be used.'),
+ medium('UserHandle',
+ 'UserHandle'),
+ medium('UserHandleName',
+ 'UserHandleName'),
+ medium('Var',
+ 'Non-constant variable missing @Var annotation'),
+ medium('VariableNameSameAsType',
+ 'variableName and type with the same name would refer to the static field instead of the class'),
+ medium('WaitNotInLoop',
+ 'Because of spurious wakeups, Object.wait() and Condition.await() must always be called in a loop'),
+ medium('WakelockReleasedDangerously',
+ 'A wakelock acquired with a timeout may be released by the system before calling `release`, even after checking `isHeld()`. If so, it will throw a RuntimeException. Please wrap in a try/catch block.'),
+ java_medium('Found raw type',
+ [r'.*\.java:.*: warning: \[rawtypes\] found raw type']),
+ java_medium('Redundant cast',
+ [r'.*\.java:.*: warning: \[cast\] redundant cast to']),
+ java_medium('Static method should be qualified',
+ [r'.*\.java:.*: warning: \[static\] static method should be qualified']),
+ medium('AbstractInner'),
+ medium('BothPackageInfoAndHtml'),
+ medium('CallbackName'),
+ medium('ExecutorRegistration'),
+ medium('HiddenTypeParameter'),
+ medium('JavaApiUsedByMainlineModule'),
+ medium('ListenerLast'),
+ medium('MinMaxConstant'),
+ medium('MissingBuildMethod'),
+ medium('NoByteOrShort'),
+ medium('OverlappingConstants'),
+ medium('SetterReturnsThis'),
+ medium('StreamFiles'),
+ medium('Typo'),
+ medium('UseIcu'),
+ medium('fallthrough'),
+ medium('overrides'),
+ medium('serial'),
+ medium('try'),
+ high('AndroidInjectionBeforeSuper',
+ 'AndroidInjection.inject() should always be invoked before calling super.lifecycleMethod()'),
+ high('AndroidJdkLibsChecker',
+ 'Use of class, field, or method that is not compatible with legacy Android devices'),
+ high('ArrayEquals',
+ 'Reference equality used to compare arrays'),
+ high('ArrayFillIncompatibleType',
+ 'Arrays.fill(Object[], Object) called with incompatible types.'),
+ high('ArrayHashCode',
+ 'hashcode method on array does not hash array contents'),
+ high('ArrayReturn',
+ 'ArrayReturn'),
+ high('ArrayToString',
+ 'Calling toString on an array does not provide useful information'),
+ high('ArraysAsListPrimitiveArray',
+ 'Arrays.asList does not autobox primitive arrays, as one might expect.'),
+ high('AssistedInjectAndInjectOnSameConstructor',
+ '@AssistedInject and @Inject cannot be used on the same constructor.'),
+ high('AsyncCallableReturnsNull',
+ 'AsyncCallable should not return a null Future, only a Future whose result is null.'),
+ high('AsyncFunctionReturnsNull',
+ 'AsyncFunction should not return a null Future, only a Future whose result is null.'),
+ high('AutoFactoryAtInject',
+ '@AutoFactory and @Inject should not be used in the same type.'),
+ high('AutoValueConstructorOrderChecker',
+ 'Arguments to AutoValue constructor are in the wrong order'),
+ high('BadShiftAmount',
+ 'Shift by an amount that is out of range'),
+ high('BundleDeserializationCast',
+ 'Object serialized in Bundle may have been flattened to base type.'),
+ high('ChainingConstructorIgnoresParameter',
+ 'The called constructor accepts a parameter with the same name and type as one of its caller\'s parameters, but its caller doesn\'t pass that parameter to it. It\'s likely that it was intended to.'),
+ high('CheckReturnValue',
+ 'Ignored return value of method that is annotated with @CheckReturnValue'),
+ high('ClassName',
+ 'The source file name should match the name of the top-level class it contains'),
+ high('CollectionIncompatibleType',
+ 'Incompatible type as argument to Object-accepting Java collections method'),
+ high('ComparableType',
+ u'Implementing \'Comparable\u003cT>\' where T is not compatible with the implementing class.'),
+ high('ComparingThisWithNull',
+ 'this == null is always false, this != null is always true'),
+ high('ComparisonContractViolated',
+ 'This comparison method violates the contract'),
+ high('ComparisonOutOfRange',
+ 'Comparison to value that is out of range for the compared type'),
+ high('CompatibleWithAnnotationMisuse',
+ '@CompatibleWith\'s value is not a type argument.'),
+ high('CompileTimeConstant',
+ 'Non-compile-time constant expression passed to parameter with @CompileTimeConstant type annotation.'),
+ high('ComplexBooleanConstant',
+ 'Non-trivial compile time constant boolean expressions shouldn\'t be used.'),
+ high('ConditionalExpressionNumericPromotion',
+ 'A conditional expression with numeric operands of differing types will perform binary numeric promotion of the operands; when these operands are of reference types, the expression\'s result may not be of the expected type.'),
+ high('ConstantOverflow',
+ 'Compile-time constant expression overflows'),
+ high('DaggerProvidesNull',
+ 'Dagger @Provides methods may not return null unless annotated with @Nullable'),
+ high('DeadException',
+ 'Exception created but not thrown'),
+ high('DeadThread',
+ 'Thread created but not started'),
+ java_high('Deprecated item is not annotated with @Deprecated',
+ [r".*\.java:.*: warning: \[.*\] .+ is not annotated with @Deprecated$"]),
+ high('DivZero',
+ 'Division by integer literal zero'),
+ high('DoNotCall',
+ 'This method should not be called.'),
+ high('EmptyIf',
+ 'Empty statement after if'),
+ high('EqualsNaN',
+ '== NaN always returns false; use the isNaN methods instead'),
+ high('EqualsReference',
+ '== must be used in equals method to check equality to itself or an infinite loop will occur.'),
+ high('EqualsWrongThing',
+ 'Comparing different pairs of fields/getters in an equals implementation is probably a mistake.'),
+ high('ForOverride',
+ 'Method annotated @ForOverride must be protected or package-private and only invoked from declaring class, or from an override of the method'),
+ high('FormatString',
+ 'Invalid printf-style format string'),
+ high('FormatStringAnnotation',
+ 'Invalid format string passed to formatting method.'),
+ high('FunctionalInterfaceMethodChanged',
+ 'Casting a lambda to this @FunctionalInterface can cause a behavior change from casting to a functional superinterface, which is surprising to users. Prefer decorator methods to this surprising behavior.'),
+ high('FuturesGetCheckedIllegalExceptionType',
+ 'Futures.getChecked requires a checked exception type with a standard constructor.'),
+ high('FuzzyEqualsShouldNotBeUsedInEqualsMethod',
+ 'DoubleMath.fuzzyEquals should never be used in an Object.equals() method'),
+ high('GetClassOnAnnotation',
+ 'Calling getClass() on an annotation may return a proxy class'),
+ high('GetClassOnClass',
+ 'Calling getClass() on an object of type Class returns the Class object for java.lang.Class; you probably meant to operate on the object directly'),
+ high('GuardedBy',
+ 'Checks for unguarded accesses to fields and methods with @GuardedBy annotations'),
+ high('GuiceAssistedInjectScoping',
+ 'Scope annotation on implementation class of AssistedInject factory is not allowed'),
+ high('GuiceAssistedParameters',
+ 'A constructor cannot have two @Assisted parameters of the same type unless they are disambiguated with named @Assisted annotations.'),
+ high('GuiceInjectOnFinalField',
+ 'Although Guice allows injecting final fields, doing so is disallowed because the injected value may not be visible to other threads.'),
+ high('HashtableContains',
+ 'contains() is a legacy method that is equivalent to containsValue()'),
+ high('IdentityBinaryExpression',
+ 'A binary expression where both operands are the same is usually incorrect.'),
+ high('Immutable',
+ 'Type declaration annotated with @Immutable is not immutable'),
+ high('ImmutableModification',
+ 'Modifying an immutable collection is guaranteed to throw an exception and leave the collection unmodified'),
+ high('IncompatibleArgumentType',
+ 'Passing argument to a generic method with an incompatible type.'),
+ high('IndexOfChar',
+ 'The first argument to indexOf is a Unicode code point, and the second is the index to start the search from'),
+ high('InexactVarargsConditional',
+ 'Conditional expression in varargs call contains array and non-array arguments'),
+ high('InfiniteRecursion',
+ 'This method always recurses, and will cause a StackOverflowError'),
+ high('InjectInvalidTargetingOnScopingAnnotation',
+ 'A scoping annotation\'s Target should include TYPE and METHOD.'),
+ high('InjectMoreThanOneQualifier',
+ 'Using more than one qualifier annotation on the same element is not allowed.'),
+ high('InjectMoreThanOneScopeAnnotationOnClass',
+ 'A class can be annotated with at most one scope annotation.'),
+ high('InjectOnMemberAndConstructor',
+ 'Members shouldn\'t be annotated with @Inject if constructor is already annotated @Inject'),
+ high('InjectScopeAnnotationOnInterfaceOrAbstractClass',
+ 'Scope annotation on an interface or abstact class is not allowed'),
+ high('InjectScopeOrQualifierAnnotationRetention',
+ 'Scoping and qualifier annotations must have runtime retention.'),
+ high('InjectedConstructorAnnotations',
+ 'Injected constructors cannot be optional nor have binding annotations'),
+ high('InsecureCryptoUsage',
+ 'A standard cryptographic operation is used in a mode that is prone to vulnerabilities'),
+ high('InvalidPatternSyntax',
+ 'Invalid syntax used for a regular expression'),
+ high('InvalidTimeZoneID',
+ 'Invalid time zone identifier. TimeZone.getTimeZone(String) will silently return GMT instead of the time zone you intended.'),
+ high('IsInstanceOfClass',
+ 'The argument to Class#isInstance(Object) should not be a Class'),
+ high('IsLoggableTagLength',
+ 'Log tag too long, cannot exceed 23 characters.'),
+ high('IterablePathParameter',
+ u'Path implements Iterable\u003cPath>; prefer Collection\u003cPath> for clarity'),
+ high('JMockTestWithoutRunWithOrRuleAnnotation',
+ 'jMock tests must have a @RunWith(JMock.class) annotation, or the Mockery field must have a @Rule JUnit annotation'),
+ high('JUnit3TestNotRun',
+ 'Test method will not be run; please correct method signature (Should be public, non-static, and method name should begin with "test").'),
+ high('JUnit4ClassAnnotationNonStatic',
+ 'This method should be static'),
+ high('JUnit4SetUpNotRun',
+ 'setUp() method will not be run; please add JUnit\'s @Before annotation'),
+ high('JUnit4TearDownNotRun',
+ 'tearDown() method will not be run; please add JUnit\'s @After annotation'),
+ high('JUnit4TestNotRun',
+ 'This looks like a test method but is not run; please add @Test and @Ignore, or, if this is a helper method, reduce its visibility.'),
+ high('JUnitAssertSameCheck',
+ 'An object is tested for reference equality to itself using JUnit library.'),
+ high('Java7ApiChecker',
+ 'Use of class, field, or method that is not compatible with JDK 7'),
+ high('JavaxInjectOnAbstractMethod',
+ 'Abstract and default methods are not injectable with javax.inject.Inject'),
+ high('JavaxInjectOnFinalField',
+ '@javax.inject.Inject cannot be put on a final field.'),
+ high('LiteByteStringUtf8',
+ 'This pattern will silently corrupt certain byte sequences from the serialized protocol message. Use ByteString or byte[] directly'),
+ high('LockMethodChecker',
+ 'This method does not acquire the locks specified by its @LockMethod annotation'),
+ high('LongLiteralLowerCaseSuffix',
+ 'Prefer \'L\' to \'l\' for the suffix to long literals'),
+ high('LoopConditionChecker',
+ 'Loop condition is never modified in loop body.'),
+ high('MathRoundIntLong',
+ 'Math.round(Integer) results in truncation'),
+ high('MislabeledAndroidString',
+ 'Certain resources in `android.R.string` have names that do not match their content'),
+ high('MissingSuperCall',
+ 'Overriding method is missing a call to overridden super method'),
+ high('MissingTestCall',
+ 'A terminating method call is required for a test helper to have any effect.'),
+ high('MisusedWeekYear',
+ 'Use of "YYYY" (week year) in a date pattern without "ww" (week in year). You probably meant to use "yyyy" (year) instead.'),
+ high('MockitoCast',
+ 'A bug in Mockito will cause this test to fail at runtime with a ClassCastException'),
+ high('MockitoUsage',
+ 'Missing method call for verify(mock) here'),
+ high('ModifyingCollectionWithItself',
+ 'Using a collection function with itself as the argument.'),
+ high('MoreThanOneInjectableConstructor',
+ 'This class has more than one @Inject-annotated constructor. Please remove the @Inject annotation from all but one of them.'),
+ high('MustBeClosedChecker',
+ 'The result of this method must be closed.'),
+ high('NCopiesOfChar',
+ 'The first argument to nCopies is the number of copies, and the second is the item to copy'),
+ high('NoAllocation',
+ '@NoAllocation was specified on this method, but something was found that would trigger an allocation'),
+ high('NonCanonicalStaticImport',
+ 'Static import of type uses non-canonical name'),
+ high('NonFinalCompileTimeConstant',
+ '@CompileTimeConstant parameters should be final or effectively final'),
+ high('NonRuntimeAnnotation',
+ 'Calling getAnnotation on an annotation that is not retained at runtime.'),
+ high('NullTernary',
+ 'This conditional expression may evaluate to null, which will result in an NPE when the result is unboxed.'),
+ high('NumericEquality',
+ 'Numeric comparison using reference equality instead of value equality'),
+ high('OptionalEquality',
+ 'Comparison using reference equality instead of value equality'),
+ high('OverlappingQualifierAndScopeAnnotation',
+ 'Annotations cannot be both Scope annotations and Qualifier annotations: this causes confusion when trying to use them.'),
+ high('OverridesJavaxInjectableMethod',
+ 'This method is not annotated with @Inject, but it overrides a method that is annotated with @javax.inject.Inject. The method will not be Injected.'),
+ high('PackageInfo',
+ 'Declaring types inside package-info.java files is very bad form'),
+ high('ParameterPackage',
+ 'Method parameter has wrong package'),
+ high('ParcelableCreator',
+ 'Detects classes which implement Parcelable but don\'t have CREATOR'),
+ high('PreconditionsCheckNotNull',
+ 'Literal passed as first argument to Preconditions.checkNotNull() can never be null'),
+ high('PreconditionsCheckNotNullPrimitive',
+ 'First argument to `Preconditions.checkNotNull()` is a primitive rather than an object reference'),
+ high('PredicateIncompatibleType',
+ 'Using ::equals or ::isInstance as an incompatible Predicate; the predicate will always return false'),
+ high('PrivateSecurityContractProtoAccess',
+ 'Access to a private protocol buffer field is forbidden. This protocol buffer carries a security contract, and can only be created using an approved library. Direct access to the fields is forbidden.'),
+ high('ProtoFieldNullComparison',
+ 'Protobuf fields cannot be null.'),
+ high('ProtoStringFieldReferenceEquality',
+ 'Comparing protobuf fields of type String using reference equality'),
+ high('ProtocolBufferOrdinal',
+ 'To get the tag number of a protocol buffer enum, use getNumber() instead.'),
+ high('ProvidesMethodOutsideOfModule',
+ '@Provides methods need to be declared in a Module to have any effect.'),
+ high('RandomCast',
+ 'Casting a random number in the range [0.0, 1.0) to an integer or long always results in 0.'),
+ high('RandomModInteger',
+ 'Use Random.nextInt(int). Random.nextInt() % n can have negative results'),
+ high('RectIntersectReturnValueIgnored',
+ 'Return value of android.graphics.Rect.intersect() must be checked'),
+ high('RestrictTo',
+ 'Use of method or class annotated with @RestrictTo'),
+ high('RestrictedApiChecker',
+ ' Check for non-whitelisted callers to RestrictedApiChecker.'),
+ high('ReturnValueIgnored',
+ 'Return value of this method must be used'),
+ high('SelfAssignment',
+ 'Variable assigned to itself'),
+ high('SelfComparison',
+ 'An object is compared to itself'),
+ high('SelfEquals',
+ 'Testing an object for equality with itself will always be true.'),
+ high('ShouldHaveEvenArgs',
+ 'This method must be called with an even number of arguments.'),
+ high('SizeGreaterThanOrEqualsZero',
+ 'Comparison of a size >= 0 is always true, did you intend to check for non-emptiness?'),
+ high('StaticOrDefaultInterfaceMethod',
+ 'Static and default interface methods are not natively supported on older Android devices. '),
+ high('StreamToString',
+ 'Calling toString on a Stream does not provide useful information'),
+ high('StringBuilderInitWithChar',
+ 'StringBuilder does not have a char constructor; this invokes the int constructor.'),
+ high('SubstringOfZero',
+ 'String.substring(0) returns the original String'),
+ high('SuppressWarningsDeprecated',
+ 'Suppressing "deprecated" is probably a typo for "deprecation"'),
+ high('ThrowIfUncheckedKnownChecked',
+ 'throwIfUnchecked(knownCheckedException) is a no-op.'),
+ high('ThrowNull',
+ 'Throwing \'null\' always results in a NullPointerException being thrown.'),
+ high('TruthSelfEquals',
+ 'isEqualTo should not be used to test an object for equality with itself; the assertion will never fail.'),
+ high('TryFailThrowable',
+ 'Catching Throwable/Error masks failures from fail() or assert*() in the try block'),
+ high('TypeParameterQualifier',
+ 'Type parameter used as type qualifier'),
+ high('UnlockMethod',
+ 'This method does not acquire the locks specified by its @UnlockMethod annotation'),
+ high('UnnecessaryTypeArgument',
+ 'Non-generic methods should not be invoked with type arguments'),
+ high('UnusedAnonymousClass',
+ 'Instance created but never used'),
+ high('UnusedCollectionModifiedInPlace',
+ 'Collection is modified in place, but the result is not used'),
+ high('VarTypeName',
+ '`var` should not be used as a type name.'),
+
+ # Other javac tool warnings
+ java_medium('addNdkApiCoverage failed to getPackage',
+ [r".*: warning: addNdkApiCoverage failed to getPackage"]),
+ java_medium('bad path element',
+ [r".*: warning: \[path\] bad path element .*\.jar"]),
+ java_medium('Supported version from annotation processor',
+ [r".*: warning: Supported source version .+ from annotation processor"]),
+]
+
+compile_patterns(warn_patterns)
diff --git a/tools/warn/make_warn_patterns.py b/tools/warn/make_warn_patterns.py
new file mode 100644
index 0000000..4b20493
--- /dev/null
+++ b/tools/warn/make_warn_patterns.py
@@ -0,0 +1,62 @@
+# python3
+# Copyright (C) 2019 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.
+
+"""Warning patterns for build make tools."""
+
+# pylint:disable=relative-beyond-top-level
+# pylint:disable=g-importing-member
+from .cpp_warn_patterns import compile_patterns
+from .severity import Severity
+
+warn_patterns = [
+ # pylint:disable=line-too-long,g-inconsistent-quotes
+ {'category': 'make', 'severity': Severity.MEDIUM,
+ 'description': 'make: overriding commands/ignoring old commands',
+ 'patterns': [r".*: warning: overriding commands for target .+",
+ r".*: warning: ignoring old commands for target .+"]},
+ {'category': 'make', 'severity': Severity.HIGH,
+ 'description': 'make: LOCAL_CLANG is false',
+ 'patterns': [r".*: warning: LOCAL_CLANG is set to false"]},
+ {'category': 'make', 'severity': Severity.HIGH,
+ 'description': 'SDK App using platform shared library',
+ 'patterns': [r".*: warning: .+ \(.*app:sdk.*\) should not link to .+ \(native:platform\)"]},
+ {'category': 'make', 'severity': Severity.HIGH,
+ 'description': 'System module linking to a vendor module',
+ 'patterns': [r".*: warning: .+ \(.+\) should not link to .+ \(partition:.+\)"]},
+ {'category': 'make', 'severity': Severity.MEDIUM,
+ 'description': 'Invalid SDK/NDK linking',
+ 'patterns': [r".*: warning: .+ \(.+\) should not link to .+ \(.+\)"]},
+ {'category': 'make', 'severity': Severity.MEDIUM,
+ 'description': 'Duplicate header copy',
+ 'patterns': [r".*: warning: Duplicate header copy: .+"]},
+ {'category': 'FindEmulator', 'severity': Severity.HARMLESS,
+ 'description': 'FindEmulator: No such file or directory',
+ 'patterns': [r".*: warning: FindEmulator: .* No such file or directory"]},
+ {'category': 'make', 'severity': Severity.HARMLESS,
+ 'description': 'make: unknown installed file',
+ 'patterns': [r".*: warning: .*_tests: Unknown installed file for module"]},
+ {'category': 'make', 'severity': Severity.HARMLESS,
+ 'description': 'unusual tags debug eng',
+ 'patterns': [r".*: warning: .*: unusual tags debug eng"]},
+ {'category': 'make', 'severity': Severity.MEDIUM,
+ 'description': 'make: please convert to soong',
+ 'patterns': [r".*: warning: .* has been deprecated. Please convert to Soong."]},
+ {'category': 'make', 'severity': Severity.MEDIUM,
+ 'description': 'make: deprecated macros',
+ 'patterns': [r".*\.mk:.* warning:.* [A-Z_]+ (is|has been) deprecated."]},
+]
+
+
+compile_patterns(warn_patterns)
diff --git a/tools/warn/other_warn_patterns.py b/tools/warn/other_warn_patterns.py
new file mode 100644
index 0000000..318c3d4
--- /dev/null
+++ b/tools/warn/other_warn_patterns.py
@@ -0,0 +1,180 @@
+# python3
+# Copyright (C) 2019 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.
+
+"""Warning patterns from other tools."""
+
+# pylint:disable=relative-beyond-top-level
+# pylint:disable=g-importing-member
+from .cpp_warn_patterns import compile_patterns
+from .severity import Severity
+
+
+def warn(name, severity, description, pattern_list):
+ return {
+ 'category': name,
+ 'severity': severity,
+ 'description': name + ': ' + description,
+ 'patterns': pattern_list
+ }
+
+
+def aapt(description, pattern_list):
+ return warn('aapt', Severity.MEDIUM, description, pattern_list)
+
+
+def misc(description, pattern_list):
+ return warn('logtags', Severity.LOW, description, pattern_list)
+
+
+def asm(description, pattern_list):
+ return warn('asm', Severity.MEDIUM, description, pattern_list)
+
+
+def kotlin(description, pattern):
+ return warn('Kotlin', Severity.MEDIUM, description,
+ [r'.*\.kt:.*: warning: ' + pattern])
+
+
+def yacc(description, pattern_list):
+ return warn('yacc', Severity.MEDIUM, description, pattern_list)
+
+
+def rust(severity, description, pattern):
+ return warn('Rust', severity, description,
+ [r'.*\.rs:.*: warning: ' + pattern])
+
+
+warn_patterns = [
+ # pylint:disable=line-too-long,g-inconsistent-quotes
+ # aapt warnings
+ aapt('No comment for public symbol',
+ [r".*: warning: No comment for public symbol .+"]),
+ aapt('No default translation',
+ [r".*: warning: string '.+' has no default translation in .*"]),
+ aapt('Missing default or required localization',
+ [r".*: warning: \*\*\*\* string '.+' has no default or required localization for '.+' in .+"]),
+ aapt('String marked untranslatable, but translation exists',
+ [r".*: warning: string '.+' in .* marked untranslatable but exists in locale '??_??'"]),
+ aapt('empty span in string',
+ [r".*: warning: empty '.+' span found in text '.+"]),
+ # misc warnings
+ misc('Duplicate logtag',
+ [r".*: warning: tag \".+\" \(.+\) duplicated in .+"]),
+ misc('Typedef redefinition',
+ [r".*: warning: redefinition of typedef '.+' is a C11 feature"]),
+ misc('GNU old-style field designator',
+ [r".*: warning: use of GNU old-style field designator extension"]),
+ misc('Missing field initializers',
+ [r".*: warning: missing field '.+' initializer"]),
+ misc('Missing braces',
+ [r".*: warning: suggest braces around initialization of",
+ r".*: warning: too many braces around scalar initializer .+Wmany-braces-around-scalar-init",
+ r".*: warning: braces around scalar initializer"]),
+ misc('Comparison of integers of different signs',
+ [r".*: warning: comparison of integers of different signs.+sign-compare"]),
+ misc('Add braces to avoid dangling else',
+ [r".*: warning: add explicit braces to avoid dangling else"]),
+ misc('Initializer overrides prior initialization',
+ [r".*: warning: initializer overrides prior initialization of this subobject"]),
+ misc('Assigning value to self',
+ [r".*: warning: explicitly assigning value of .+ to itself"]),
+ misc('GNU extension, variable sized type not at end',
+ [r".*: warning: field '.+' with variable sized type '.+' not at the end of a struct or class"]),
+ misc('Comparison of constant is always false/true',
+ [r".*: comparison of .+ is always .+Wtautological-constant-out-of-range-compare"]),
+ misc('Hides overloaded virtual function',
+ [r".*: '.+' hides overloaded virtual function"]),
+ misc('Incompatible pointer types',
+ [r".*: warning: incompatible .*pointer types .*-Wincompatible-.*pointer-types"]),
+ # Assembler warnings
+ asm('ASM value size does not match register size',
+ [r".*: warning: value size does not match register size specified by the constraint and modifier"]),
+ asm('IT instruction is deprecated',
+ [r".*: warning: applying IT instruction .* is deprecated"]),
+ # NDK warnings
+ {'category': 'NDK', 'severity': Severity.HIGH,
+ 'description': 'NDK: Generate guard with empty availability, obsoleted',
+ 'patterns': [r".*: warning: .* generate guard with empty availability: obsoleted ="]},
+ # Protoc warnings
+ {'category': 'Protoc', 'severity': Severity.MEDIUM,
+ 'description': 'Proto: Enum name collision after strip',
+ 'patterns': [r".*: warning: Enum .* has the same name .* ignore case and strip"]},
+ {'category': 'Protoc', 'severity': Severity.MEDIUM,
+ 'description': 'Proto: Import not used',
+ 'patterns': [r".*: warning: Import .*/.*\.proto but not used.$"]},
+ # Kotlin warnings
+ kotlin('never used parameter or variable', '.+ \'.*\' is never used'),
+ kotlin('multiple labels', '.+ more than one label .+ in this scope'),
+ kotlin('type mismatch', 'type mismatch: '),
+ kotlin('is always true', '.+ is always \'true\''),
+ kotlin('no effect', '.+ annotation has no effect for '),
+ kotlin('no cast needed', 'no cast needed'),
+ kotlin('accessor not generated', 'an accessor will not be generated '),
+ kotlin('initializer is redundant', '.* initializer is redundant$'),
+ kotlin('elvis operator always returns ...',
+ 'elvis operator (?:) always returns .+'),
+ kotlin('shadowed name', 'name shadowed: .+'),
+ kotlin('unchecked cast', 'unchecked cast: .* to .*$'),
+ kotlin('unreachable code', 'unreachable code'),
+ kotlin('unnecessary assertion', 'unnecessary .+ assertion .+'),
+ kotlin('unnecessary safe call on a non-null receiver',
+ 'unnecessary safe call on a non-null receiver'),
+ kotlin('Deprecated in Java',
+ '\'.*\' is deprecated. Deprecated in Java'),
+ kotlin('Replacing Handler for Executor',
+ '.+ Replacing Handler for Executor in '),
+ kotlin('library has Kotlin runtime',
+ '.+ has Kotlin runtime (bundled|library)'),
+ warn('Kotlin', Severity.MEDIUM, 'bundled Kotlin runtime',
+ ['.*warning: .+ (has|have the) Kotlin (runtime|Runtime library) bundled']),
+ kotlin('other warnings', '.+'), # catch all other Kotlin warnings
+ # Yacc warnings
+ yacc('deprecate directive',
+ [r".*\.yy?:.*: warning: deprecated directive: "]),
+ yacc('shift/reduce conflicts',
+ [r".*\.yy?: warning: .+ shift/reduce conflicts "]),
+ {'category': 'yacc', 'severity': Severity.SKIP,
+ 'description': 'yacc: fix-its can be applied',
+ 'patterns': [r".*\.yy?: warning: fix-its can be applied."]},
+ # Rust warnings
+ rust(Severity.HIGH, 'Does not derive Copy', '.+ does not derive Copy'),
+ rust(Severity.MEDIUM, '... are deprecated',
+ ('(.+ are deprecated$|' +
+ 'use of deprecated item .* (use .* instead|is now preferred))')),
+ rust(Severity.MEDIUM, 'never used', '.* is never used:'),
+ rust(Severity.MEDIUM, 'unused import', 'unused import: '),
+ rust(Severity.MEDIUM, 'unnecessary attribute',
+ '.+ no longer requires an attribute'),
+ rust(Severity.MEDIUM, 'unnecessary parentheses',
+ 'unnecessary parentheses around'),
+ # Catch all RenderScript warnings
+ {'category': 'RenderScript', 'severity': Severity.LOW,
+ 'description': 'RenderScript warnings',
+ 'patterns': [r'.*\.rscript:.*: warning: ']},
+ # Broken/partial warning messages will be skipped.
+ {'category': 'Misc', 'severity': Severity.SKIP,
+ 'description': 'skip, ,',
+ 'patterns': [r".*: warning: ,?$"]},
+ {'category': 'C/C++', 'severity': Severity.SKIP,
+ 'description': 'skip, In file included from ...',
+ 'patterns': [r".*: warning: In file included from .+,"]},
+ # catch-all for warnings this script doesn't know about yet
+ {'category': 'C/C++', 'severity': Severity.UNMATCHED,
+ 'description': 'Unclassified/unrecognized warnings',
+ 'patterns': [r".*: warning: .+"]},
+]
+
+
+compile_patterns(warn_patterns)
diff --git a/tools/warn/severity.py b/tools/warn/severity.py
new file mode 100644
index 0000000..b4c03c9
--- /dev/null
+++ b/tools/warn/severity.py
@@ -0,0 +1,59 @@
+# python3
+# Copyright (C) 2019 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.
+
+"""Clang_Tidy_Warn Severity class definition.
+
+This file stores definition for class Severity that is used in warn_patterns.
+"""
+
+
+# pylint:disable=old-style-class
+class SeverityInfo:
+
+ def __init__(self, value, color, column_header, header):
+ self.value = value
+ self.color = color
+ self.column_header = column_header
+ self.header = header
+
+
+# pylint:disable=old-style-class
+class Severity:
+ """Class of Severity levels where each level is a SeverityInfo."""
+
+ # SEVERITY_UNKNOWN should never occur since every warn_pattern listed has
+ # a specified severity. It exists for protobuf, the other values must
+ # map to non-zero values (since 0 is reserved for a default UNKNOWN), but
+ # logic in clang_tidy_warn.py assumes severity level values are consecutive
+ # ints starting with 0.
+ SEVERITY_UNKNOWN = SeverityInfo(0, 'blueviolet', 'Unknown',
+ 'Unknown-severity warnings)')
+ FIXMENOW = SeverityInfo(1, 'fuschia', 'FixNow',
+ 'Critical warnings, fix me now')
+ HIGH = SeverityInfo(2, 'red', 'High', 'High severity warnings')
+ MEDIUM = SeverityInfo(3, 'orange', 'Medium', 'Medium severity warnings')
+ LOW = SeverityInfo(4, 'yellow', 'Low', 'Low severity warnings')
+ ANALYZER = SeverityInfo(5, 'hotpink', 'Analyzer', 'Clang-Analyzer warnings')
+ TIDY = SeverityInfo(6, 'peachpuff', 'Tidy', 'Clang-Tidy warnings')
+ HARMLESS = SeverityInfo(7, 'limegreen', 'Harmless', 'Harmless warnings')
+ UNMATCHED = SeverityInfo(8, 'lightblue', 'Unmatched', 'Unmatched warnings')
+ SKIP = SeverityInfo(9, 'grey', 'Unhandled', 'Unhandled warnings')
+
+ levels = [
+ SEVERITY_UNKNOWN, FIXMENOW, HIGH, MEDIUM, LOW, ANALYZER, TIDY, HARMLESS,
+ UNMATCHED, SKIP
+ ]
+ # HTML relies on ordering by value. Sort here to ensure that this is proper
+ levels = sorted(levels, key=lambda severity: severity.value)
diff --git a/tools/warn/tidy_warn_patterns.py b/tools/warn/tidy_warn_patterns.py
new file mode 100644
index 0000000..5416cb2
--- /dev/null
+++ b/tools/warn/tidy_warn_patterns.py
@@ -0,0 +1,225 @@
+# python3
+# Copyright (C) 2019 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.
+
+"""Warning patterns for clang-tidy."""
+
+# pylint:disable=relative-beyond-top-level
+# pylint:disable=g-importing-member
+from .cpp_warn_patterns import compile_patterns
+from .severity import Severity
+
+
+def tidy_warn_pattern(description, pattern):
+ return {
+ 'category': 'C/C++',
+ 'severity': Severity.TIDY,
+ 'description': 'clang-tidy ' + description,
+ 'patterns': [r'.*: .+\[' + pattern + r'\]$']
+ }
+
+
+def simple_tidy_warn_pattern(description):
+ return tidy_warn_pattern(description, description)
+
+
+def group_tidy_warn_pattern(description):
+ return tidy_warn_pattern(description, description + r'-.+')
+
+
+def analyzer_high(description, patterns):
+ # Important clang analyzer warnings to be fixed ASAP.
+ return {
+ 'category': 'C/C++',
+ 'severity': Severity.HIGH,
+ 'description': description,
+ 'patterns': patterns
+ }
+
+
+def analyzer_high_check(check):
+ return analyzer_high(check, [r'.*: .+\[' + check + r'\]$'])
+
+
+def analyzer_group_high(check):
+ return analyzer_high(check, [r'.*: .+\[' + check + r'.+\]$'])
+
+
+def analyzer_warn(description, patterns):
+ return {
+ 'category': 'C/C++',
+ 'severity': Severity.ANALYZER,
+ 'description': description,
+ 'patterns': patterns
+ }
+
+
+def analyzer_warn_check(check):
+ return analyzer_warn(check, [r'.*: .+\[' + check + r'\]$'])
+
+
+def analyzer_group_check(check):
+ return analyzer_warn(check, [r'.*: .+\[' + check + r'.+\]$'])
+
+
+warn_patterns = [
+ # pylint:disable=line-too-long,g-inconsistent-quotes
+ group_tidy_warn_pattern('android'),
+ simple_tidy_warn_pattern('abseil-string-find-startswith'),
+ simple_tidy_warn_pattern('bugprone-argument-comment'),
+ simple_tidy_warn_pattern('bugprone-branch-clone'),
+ simple_tidy_warn_pattern('bugprone-copy-constructor-init'),
+ simple_tidy_warn_pattern('bugprone-fold-init-type'),
+ simple_tidy_warn_pattern('bugprone-forward-declaration-namespace'),
+ simple_tidy_warn_pattern('bugprone-forwarding-reference-overload'),
+ simple_tidy_warn_pattern('bugprone-inaccurate-erase'),
+ simple_tidy_warn_pattern('bugprone-incorrect-roundings'),
+ simple_tidy_warn_pattern('bugprone-integer-division'),
+ simple_tidy_warn_pattern('bugprone-lambda-function-name'),
+ simple_tidy_warn_pattern('bugprone-macro-parentheses'),
+ simple_tidy_warn_pattern('bugprone-misplaced-widening-cast'),
+ simple_tidy_warn_pattern('bugprone-move-forwarding-reference'),
+ simple_tidy_warn_pattern('bugprone-parent-virtual-call'),
+ simple_tidy_warn_pattern('bugprone-posix-return'),
+ simple_tidy_warn_pattern('bugprone-sizeof-container'),
+ simple_tidy_warn_pattern('bugprone-sizeof-expression'),
+ simple_tidy_warn_pattern('bugprone-string-constructor'),
+ simple_tidy_warn_pattern('bugprone-string-integer-assignment'),
+ simple_tidy_warn_pattern('bugprone-suspicious-enum-usage'),
+ simple_tidy_warn_pattern('bugprone-suspicious-missing-comma'),
+ simple_tidy_warn_pattern('bugprone-suspicious-string-compare'),
+ simple_tidy_warn_pattern('bugprone-suspicious-semicolon'),
+ simple_tidy_warn_pattern('bugprone-terminating-continue'),
+ simple_tidy_warn_pattern('bugprone-too-small-loop-variable'),
+ simple_tidy_warn_pattern('bugprone-undefined-memory-manipulation'),
+ simple_tidy_warn_pattern('bugprone-unhandled-self-assignment'),
+ simple_tidy_warn_pattern('bugprone-unused-raii'),
+ simple_tidy_warn_pattern('bugprone-unused-return-value'),
+ simple_tidy_warn_pattern('bugprone-use-after-move'),
+ group_tidy_warn_pattern('bugprone'),
+ simple_tidy_warn_pattern('cert-dcl16-c'),
+ simple_tidy_warn_pattern('cert-dcl21-cpp'),
+ simple_tidy_warn_pattern('cert-dcl50-cpp'),
+ simple_tidy_warn_pattern('cert-dcl54-cpp'),
+ simple_tidy_warn_pattern('cert-dcl59-cpp'),
+ simple_tidy_warn_pattern('cert-env33-c'),
+ simple_tidy_warn_pattern('cert-err34-c'),
+ simple_tidy_warn_pattern('cert-err52-cpp'),
+ simple_tidy_warn_pattern('cert-msc30-c'),
+ simple_tidy_warn_pattern('cert-msc50-cpp'),
+ simple_tidy_warn_pattern('cert-oop54-cpp'),
+ group_tidy_warn_pattern('cert'),
+ group_tidy_warn_pattern('clang-diagnostic'),
+ group_tidy_warn_pattern('cppcoreguidelines'),
+ group_tidy_warn_pattern('llvm'),
+ simple_tidy_warn_pattern('google-default-arguments'),
+ simple_tidy_warn_pattern('google-runtime-int'),
+ simple_tidy_warn_pattern('google-runtime-operator'),
+ simple_tidy_warn_pattern('google-runtime-references'),
+ group_tidy_warn_pattern('google-build'),
+ group_tidy_warn_pattern('google-explicit'),
+ group_tidy_warn_pattern('google-redability'),
+ group_tidy_warn_pattern('google-global'),
+ group_tidy_warn_pattern('google-redability'),
+ group_tidy_warn_pattern('google-redability'),
+ group_tidy_warn_pattern('google'),
+ simple_tidy_warn_pattern('hicpp-explicit-conversions'),
+ simple_tidy_warn_pattern('hicpp-function-size'),
+ simple_tidy_warn_pattern('hicpp-invalid-access-moved'),
+ simple_tidy_warn_pattern('hicpp-member-init'),
+ simple_tidy_warn_pattern('hicpp-delete-operators'),
+ simple_tidy_warn_pattern('hicpp-special-member-functions'),
+ simple_tidy_warn_pattern('hicpp-use-equals-default'),
+ simple_tidy_warn_pattern('hicpp-use-equals-delete'),
+ simple_tidy_warn_pattern('hicpp-no-assembler'),
+ simple_tidy_warn_pattern('hicpp-noexcept-move'),
+ simple_tidy_warn_pattern('hicpp-use-override'),
+ group_tidy_warn_pattern('hicpp'),
+ group_tidy_warn_pattern('modernize'),
+ group_tidy_warn_pattern('misc'),
+ simple_tidy_warn_pattern('performance-faster-string-find'),
+ simple_tidy_warn_pattern('performance-for-range-copy'),
+ simple_tidy_warn_pattern('performance-implicit-cast-in-loop'),
+ simple_tidy_warn_pattern('performance-inefficient-string-concatenation'),
+ simple_tidy_warn_pattern('performance-type-promotion-in-math-fn'),
+ simple_tidy_warn_pattern('performance-unnecessary-copy-initialization'),
+ simple_tidy_warn_pattern('performance-unnecessary-value-param'),
+ simple_tidy_warn_pattern('portability-simd-intrinsics'),
+ group_tidy_warn_pattern('performance'),
+ group_tidy_warn_pattern('readability'),
+ simple_tidy_warn_pattern('abseil-string-find-startwith'),
+ simple_tidy_warn_pattern('abseil-faster-strsplit-delimiter'),
+ simple_tidy_warn_pattern('abseil-no-namespace'),
+ simple_tidy_warn_pattern('abseil-no-internal-dependencies'),
+ group_tidy_warn_pattern('abseil'),
+ simple_tidy_warn_pattern('portability-simd-intrinsics'),
+ group_tidy_warn_pattern('portability'),
+
+ # warnings from clang-tidy's clang-analyzer checks
+ analyzer_high('clang-analyzer-core, null pointer',
+ [r".*: warning: .+ pointer is null .*\[clang-analyzer-core"]),
+ analyzer_high('clang-analyzer-core, uninitialized value',
+ [r".*: warning: .+ uninitialized (value|data) .*\[clang-analyzer-core"]),
+ analyzer_warn('clang-analyzer-optin.performance.Padding',
+ [r".*: warning: Excessive padding in '.*'"]),
+ # analyzer_warn('clang-analyzer Unreachable code',
+ # [r".*: warning: This statement is never executed.*UnreachableCode"]),
+ analyzer_warn('clang-analyzer Size of malloc may overflow',
+ [r".*: warning: .* size of .* may overflow .*MallocOverflow"]),
+ analyzer_warn('clang-analyzer sozeof() on a pointer type',
+ [r".*: warning: .*calls sizeof.* on a pointer type.*SizeofPtr"]),
+ analyzer_warn('clang-analyzer Pointer arithmetic on non-array variables',
+ [r".*: warning: Pointer arithmetic on non-array variables .*PointerArithm"]),
+ analyzer_warn('clang-analyzer Subtraction of pointers of different memory chunks',
+ [r".*: warning: Subtraction of two pointers .*PointerSub"]),
+ analyzer_warn('clang-analyzer Access out-of-bound array element',
+ [r".*: warning: Access out-of-bound array element .*ArrayBound"]),
+ analyzer_warn('clang-analyzer Out of bound memory access',
+ [r".*: warning: Out of bound memory access .*ArrayBoundV2"]),
+ analyzer_warn('clang-analyzer Possible lock order reversal',
+ [r".*: warning: .* Possible lock order reversal.*PthreadLock"]),
+ analyzer_warn('clang-analyzer call path problems',
+ [r".*: warning: Call Path : .+"]),
+ analyzer_warn_check('clang-analyzer-core.CallAndMessage'),
+ analyzer_high_check('clang-analyzer-core.NonNullParamChecker'),
+ analyzer_high_check('clang-analyzer-core.NullDereference'),
+ analyzer_warn_check('clang-analyzer-core.UndefinedBinaryOperatorResult'),
+ analyzer_warn_check('clang-analyzer-core.DivideZero'),
+ analyzer_warn_check('clang-analyzer-core.VLASize'),
+ analyzer_warn_check('clang-analyzer-core.uninitialized.ArraySubscript'),
+ analyzer_warn_check('clang-analyzer-core.uninitialized.Assign'),
+ analyzer_warn_check('clang-analyzer-core.uninitialized.UndefReturn'),
+ analyzer_warn_check('clang-analyzer-cplusplus.Move'),
+ analyzer_warn_check('clang-analyzer-deadcode.DeadStores'),
+ analyzer_warn_check('clang-analyzer-optin.cplusplus.UninitializedObject'),
+ analyzer_warn_check('clang-analyzer-optin.cplusplus.VirtualCall'),
+ analyzer_warn_check('clang-analyzer-portability.UnixAPI'),
+ analyzer_warn_check('clang-analyzer-unix.cstring.NullArg'),
+ analyzer_high_check('clang-analyzer-unix.MallocSizeof'),
+ analyzer_warn_check('clang-analyzer-valist.Uninitialized'),
+ analyzer_warn_check('clang-analyzer-valist.Unterminated'),
+ analyzer_group_check('clang-analyzer-core.uninitialized'),
+ analyzer_group_check('clang-analyzer-deadcode'),
+ analyzer_warn_check('clang-analyzer-security.insecureAPI.strcpy'),
+ analyzer_group_high('clang-analyzer-security.insecureAPI'),
+ analyzer_group_high('clang-analyzer-security'),
+ analyzer_high_check('clang-analyzer-unix.Malloc'),
+ analyzer_high_check('clang-analyzer-cplusplus.NewDeleteLeaks'),
+ analyzer_high_check('clang-analyzer-cplusplus.NewDelete'),
+ analyzer_group_check('clang-analyzer-unix'),
+ analyzer_group_check('clang-analyzer'), # catch all
+]
+
+
+compile_patterns(warn_patterns)
diff --git a/tools/warn/warn.py b/tools/warn/warn.py
new file mode 100755
index 0000000..56e8787
--- /dev/null
+++ b/tools/warn/warn.py
@@ -0,0 +1,68 @@
+#!/usr/bin/python
+#
+# Copyright (C) 2019 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.
+
+"""Simple wrapper to run warn_common with Python standard Pool."""
+
+import multiprocessing
+import signal
+import sys
+
+# pylint:disable=relative-beyond-top-level
+from . import warn_common as common
+
+
+def classify_warnings(args):
+ """Classify a list of warning lines.
+
+ Args:
+ args: dictionary {
+ 'group': list of (warning, link),
+ 'project_patterns': re.compile(project_list[p][1]),
+ 'warn_patterns': list of warn_pattern,
+ 'num_processes': number of processes being used for multiprocessing }
+ Returns:
+ results: a list of the classified warnings.
+ """
+ results = []
+ for line, link in args['group']:
+ common.classify_one_warning(line, link, results, args['project_patterns'],
+ args['warn_patterns'])
+
+ # After the main work, ignore all other signals to a child process,
+ # to avoid bad warning/error messages from the exit clean-up process.
+ if args['num_processes'] > 1:
+ signal.signal(signal.SIGTERM, lambda *args: sys.exit(-signal.SIGTERM))
+ return results
+
+
+def create_and_launch_subprocesses(num_cpu, classify_warnings_fn, arg_groups,
+ group_results):
+ pool = multiprocessing.Pool(num_cpu)
+ for cpu in range(num_cpu):
+ proc_result = pool.map(classify_warnings_fn, arg_groups[cpu])
+ if proc_result is not None:
+ group_results.append(proc_result)
+ return group_results
+
+
+def main():
+ use_google3 = False
+ common.common_main(use_google3, create_and_launch_subprocesses,
+ classify_warnings)
+
+
+if __name__ == '__main__':
+ main()
diff --git a/tools/warn/warn_common.py b/tools/warn/warn_common.py
new file mode 100755
index 0000000..68ed995
--- /dev/null
+++ b/tools/warn/warn_common.py
@@ -0,0 +1,583 @@
+# python3
+# Copyright (C) 2019 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.
+
+"""Grep warnings messages and output HTML tables or warning counts in CSV.
+
+Default is to output warnings in HTML tables grouped by warning severity.
+Use option --byproject to output tables grouped by source file projects.
+Use option --gencsv to output warning counts in CSV format.
+
+Default input file is build.log, which can be changed with the --log flag.
+"""
+
+# List of important data structures and functions in this script.
+#
+# To parse and keep warning message in the input file:
+# severity: classification of message severity
+# warn_patterns:
+# warn_patterns[w]['category'] tool that issued the warning, not used now
+# warn_patterns[w]['description'] table heading
+# warn_patterns[w]['members'] matched warnings from input
+# warn_patterns[w]['patterns'] regular expressions to match warnings
+# warn_patterns[w]['projects'][p] number of warnings of pattern w in p
+# warn_patterns[w]['severity'] severity tuple
+# project_list[p][0] project name
+# project_list[p][1] regular expression to match a project path
+# project_patterns[p] re.compile(project_list[p][1])
+# project_names[p] project_list[p][0]
+# warning_messages array of each warning message, without source url
+# warning_links array of each warning code search link; for 'chrome'
+# warning_records array of [idx to warn_patterns,
+# idx to project_names,
+# idx to warning_messages,
+# idx to warning_links]
+# parse_input_file
+#
+import argparse
+import io
+import multiprocessing
+import os
+import re
+import sys
+
+# pylint:disable=relative-beyond-top-level
+# pylint:disable=g-importing-member
+from . import android_project_list
+from . import chrome_project_list
+from . import cpp_warn_patterns as cpp_patterns
+from . import html_writer
+from . import java_warn_patterns as java_patterns
+from . import make_warn_patterns as make_patterns
+from . import other_warn_patterns as other_patterns
+from . import tidy_warn_patterns as tidy_patterns
+
+
+def parse_args(use_google3):
+ """Define and parse the args. Return the parse_args() result."""
+ parser = argparse.ArgumentParser(
+ description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter)
+ parser.add_argument('--capacitor_path', default='',
+ help='Save capacitor warning file to the passed absolute'
+ ' path')
+ # csvpath has a different naming than the above path because historically the
+ # original Android script used csvpath, so other scripts rely on it
+ parser.add_argument('--csvpath', default='',
+ help='Save CSV warning file to the passed path')
+ parser.add_argument('--gencsv', action='store_true',
+ help='Generate CSV file with number of various warnings')
+ parser.add_argument('--byproject', action='store_true',
+ help='Separate warnings in HTML output by project names')
+ parser.add_argument('--url', default='',
+ help='Root URL of an Android source code tree prefixed '
+ 'before files in warnings')
+ parser.add_argument('--separator', default='?l=',
+ help='Separator between the end of a URL and the line '
+ 'number argument. e.g. #')
+ parser.add_argument('--processes', default=multiprocessing.cpu_count(),
+ type=int,
+ help='Number of parallel processes to process warnings')
+ # Old Android build scripts call warn.py without --platform,
+ # so the default platform is set to 'android'.
+ parser.add_argument('--platform', default='android',
+ choices=['chrome', 'android'],
+ help='Platform of the build log')
+ # Old Android build scripts call warn.py with only a build.log file path.
+ parser.add_argument('--log', help='Path to build log file')
+ parser.add_argument(dest='buildlog', metavar='build.log',
+ default='build.log', nargs='?',
+ help='Path to build.log file')
+ flags = parser.parse_args()
+ if not flags.log:
+ flags.log = flags.buildlog
+ if not use_google3 and not os.path.exists(flags.log):
+ sys.exit('Cannot find log file: ' + flags.log)
+ return flags
+
+
+def get_project_names(project_list):
+ """Get project_names from project_list."""
+ return [p[0] for p in project_list]
+
+
+def find_project_index(line, project_patterns):
+ for i, p in enumerate(project_patterns):
+ if p.match(line):
+ return i
+ return -1
+
+
+def classify_one_warning(warning, link, results, project_patterns,
+ warn_patterns):
+ """Classify one warning line."""
+ for i, w in enumerate(warn_patterns):
+ for cpat in w['compiled_patterns']:
+ if cpat.match(warning):
+ p = find_project_index(warning, project_patterns)
+ results.append([warning, link, i, p])
+ return
+ else:
+ # If we end up here, there was a problem parsing the log
+ # probably caused by 'make -j' mixing the output from
+ # 2 or more concurrent compiles
+ pass
+
+
+def remove_prefix(s, sub):
+ """Remove everything before last occurrence of substring sub in string s."""
+ if sub in s:
+ inc_sub = s.rfind(sub)
+ return s[inc_sub:]
+ return s
+
+
+# TODO(emmavukelj): Don't have any generate_*_cs_link functions call
+# normalize_path a second time (the first time being in parse_input_file)
+def generate_cs_link(warning_line, flags, android_root=None):
+ if flags.platform == 'chrome':
+ return generate_chrome_cs_link(warning_line, flags)
+ if flags.platform == 'android':
+ return generate_android_cs_link(warning_line, flags, android_root)
+ return 'https://cs.corp.google.com/'
+
+
+def generate_android_cs_link(warning_line, flags, android_root):
+ """Generate the code search link for a warning line in Android."""
+ # max_splits=2 -> only 3 items
+ raw_path, line_number_str, _ = warning_line.split(':', 2)
+ normalized_path = normalize_path(raw_path, flags, android_root)
+ if not flags.url:
+ return normalized_path
+ link_path = flags.url + '/' + normalized_path
+ if line_number_str.isdigit():
+ link_path += flags.separator + line_number_str
+ return link_path
+
+
+def generate_chrome_cs_link(warning_line, flags):
+ """Generate the code search link for a warning line in Chrome."""
+ split_line = warning_line.split(':')
+ raw_path = split_line[0]
+ normalized_path = normalize_path(raw_path, flags)
+ link_base = 'https://cs.chromium.org/'
+ link_add = 'chromium'
+ link_path = None
+
+ # Basically just going through a few specific directory cases and specifying
+ # the proper behavior for that case. This list of cases was accumulated
+ # through trial and error manually going through the warnings.
+ #
+ # This code pattern of using case-specific "if"s instead of "elif"s looks
+ # possibly accidental and mistaken but it is intentional because some paths
+ # fall under several cases (e.g. third_party/lib/nghttp2_frame.c) and for
+ # those we want the most specific case to be applied. If there is reliable
+ # knowledge of exactly where these occur, this could be changed to "elif"s
+ # but there is no reliable set of paths falling under multiple cases at the
+ # moment.
+ if '/src/third_party' in raw_path:
+ link_path = remove_prefix(raw_path, '/src/third_party/')
+ if '/chrome_root/src_internal/' in raw_path:
+ link_path = remove_prefix(raw_path, '/chrome_root/src_internal/')
+ link_path = link_path[len('/chrome_root'):] # remove chrome_root
+ if '/chrome_root/src/' in raw_path:
+ link_path = remove_prefix(raw_path, '/chrome_root/src/')
+ link_path = link_path[len('/chrome_root'):] # remove chrome_root
+ if '/libassistant/' in raw_path:
+ link_add = 'eureka_internal/chromium/src'
+ link_base = 'https://cs.corp.google.com/' # internal data
+ link_path = remove_prefix(normalized_path, '/libassistant/')
+ if raw_path.startswith('gen/'):
+ link_path = '/src/out/Debug/gen/' + normalized_path
+ if '/gen/' in raw_path:
+ return '%s?q=file:%s' % (link_base, remove_prefix(normalized_path, '/gen/'))
+
+ if not link_path and (raw_path.startswith('src/') or
+ raw_path.startswith('src_internal/')):
+ link_path = '/%s' % raw_path
+
+ if not link_path: # can't find specific link, send a query
+ return '%s?q=file:%s' % (link_base, normalized_path)
+
+ line_number = int(split_line[1])
+ link = '%s%s%s?l=%d' % (link_base, link_add, link_path, line_number)
+ return link
+
+
+def find_warn_py_and_android_root(path):
+ """Return android source root path if warn.py is found."""
+ parts = path.split('/')
+ for idx in reversed(range(2, len(parts))):
+ root_path = '/'.join(parts[:idx])
+ # Android root directory should contain this script.
+ if os.path.exists(root_path + '/build/make/tools/warn.py'):
+ return root_path
+ return ''
+
+
+def find_android_root(buildlog):
+ """Guess android source root from common prefix of file paths."""
+ # Use the longest common prefix of the absolute file paths
+ # of the first 10000 warning messages as the android_root.
+ warning_lines = []
+ warning_pattern = re.compile('^/[^ ]*/[^ ]*: warning: .*')
+ count = 0
+ for line in buildlog:
+ if warning_pattern.match(line):
+ warning_lines.append(line)
+ count += 1
+ if count > 9999:
+ break
+ # Try to find warn.py and use its location to find
+ # the source tree root.
+ if count < 100:
+ path = os.path.normpath(re.sub(':.*$', '', line))
+ android_root = find_warn_py_and_android_root(path)
+ if android_root:
+ return android_root
+ # Do not use common prefix of a small number of paths.
+ if count > 10:
+ # pytype: disable=wrong-arg-types
+ root_path = os.path.commonprefix(warning_lines)
+ # pytype: enable=wrong-arg-types
+ if len(root_path) > 2 and root_path[len(root_path) - 1] == '/':
+ return root_path[:-1]
+ return ''
+
+
+def remove_android_root_prefix(path, android_root):
+ """Remove android_root prefix from path if it is found."""
+ if path.startswith(android_root):
+ return path[1 + len(android_root):]
+ return path
+
+
+def normalize_path(path, flags, android_root=None):
+ """Normalize file path relative to src/ or src-internal/ directory."""
+ path = os.path.normpath(path)
+
+ if flags.platform == 'android':
+ if android_root:
+ return remove_android_root_prefix(path, android_root)
+ return path
+
+ # Remove known prefix of root path and normalize the suffix.
+ idx = path.find('chrome_root/')
+ if idx >= 0:
+ # remove chrome_root/, we want path relative to that
+ return path[idx + len('chrome_root/'):]
+ else:
+ return path
+
+
+def normalize_warning_line(line, flags, android_root=None):
+ """Normalize file path relative to src directory in a warning line."""
+ line = re.sub(u'[\u2018\u2019]', '\'', line)
+ # replace non-ASCII chars to spaces
+ line = re.sub(u'[^\x00-\x7f]', ' ', line)
+ line = line.strip()
+ first_column = line.find(':')
+ return normalize_path(line[:first_column], flags,
+ android_root) + line[first_column:]
+
+
+def parse_input_file_chrome(infile, flags):
+ """Parse Chrome input file, collect parameters and warning lines."""
+ platform_version = 'unknown'
+ board_name = 'unknown'
+ architecture = 'unknown'
+
+ # only handle warning lines of format 'file_path:line_no:col_no: warning: ...'
+ chrome_warning_pattern = r'^[^ ]*/[^ ]*:[0-9]+:[0-9]+: warning: .*'
+
+ warning_pattern = re.compile(chrome_warning_pattern)
+
+ # Collect all unique warning lines
+ # Remove the duplicated warnings save ~8% of time when parsing
+ # one typical build log than before
+ unique_warnings = dict()
+ for line in infile:
+ if warning_pattern.match(line):
+ normalized_line = normalize_warning_line(line, flags)
+ if normalized_line not in unique_warnings:
+ unique_warnings[normalized_line] = generate_cs_link(line, flags)
+ elif (platform_version == 'unknown' or board_name == 'unknown' or
+ architecture == 'unknown'):
+ m = re.match(r'.+Package:.+chromeos-base/chromeos-chrome-', line)
+ if m is not None:
+ platform_version = 'R' + line.split('chrome-')[1].split('_')[0]
+ continue
+ m = re.match(r'.+Source\sunpacked\sin\s(.+)', line)
+ if m is not None:
+ board_name = m.group(1).split('/')[2]
+ continue
+ m = re.match(r'.+USE:\s*([^\s]*).*', line)
+ if m is not None:
+ architecture = m.group(1)
+ continue
+
+ header_str = '%s - %s - %s' % (platform_version, board_name, architecture)
+ return unique_warnings, header_str
+
+
+def add_normalized_line_to_warnings(line, flags, android_root, unique_warnings):
+ """Parse/normalize path, updating warning line and add to warnings dict."""
+ normalized_line = normalize_warning_line(line, flags, android_root)
+ if normalized_line not in unique_warnings:
+ unique_warnings[normalized_line] = generate_cs_link(line, flags,
+ android_root)
+ return unique_warnings
+
+
+def parse_input_file_android(infile, flags):
+ """Parse Android input file, collect parameters and warning lines."""
+ platform_version = 'unknown'
+ target_product = 'unknown'
+ target_variant = 'unknown'
+ android_root = find_android_root(infile)
+ infile.seek(0)
+
+ # rustc warning messages have two lines that should be combined:
+ # warning: description
+ # --> file_path:line_number:column_number
+ # Some warning messages have no file name:
+ # warning: macro replacement list ... [bugprone-macro-parentheses]
+ # Some makefile warning messages have no line number:
+ # some/path/file.mk: warning: description
+ # C/C++ compiler warning messages have line and column numbers:
+ # some/path/file.c:line_number:column_number: warning: description
+ warning_pattern = re.compile('(^[^ ]*/[^ ]*: warning: .*)|(^warning: .*)')
+ warning_without_file = re.compile('^warning: .*')
+ rustc_file_position = re.compile('^[ ]+--> [^ ]*/[^ ]*:[0-9]+:[0-9]+')
+
+ # Collect all unique warning lines
+ # Remove the duplicated warnings save ~8% of time when parsing
+ # one typical build log than before
+ unique_warnings = dict()
+ line_counter = 0
+ prev_warning = ''
+ for line in infile:
+ if prev_warning:
+ if rustc_file_position.match(line):
+ # must be a rustc warning, combine 2 lines into one warning
+ line = line.strip().replace('--> ', '') + ': ' + prev_warning
+ unique_warnings = add_normalized_line_to_warnings(
+ line, flags, android_root, unique_warnings)
+ prev_warning = ''
+ continue
+ # add prev_warning, and then process the current line
+ prev_warning = 'unknown_source_file: ' + prev_warning
+ unique_warnings = add_normalized_line_to_warnings(
+ prev_warning, flags, android_root, unique_warnings)
+ prev_warning = ''
+
+ if warning_pattern.match(line):
+ if warning_without_file.match(line):
+ # save this line and combine it with the next line
+ prev_warning = line
+ else:
+ unique_warnings = add_normalized_line_to_warnings(
+ line, flags, android_root, unique_warnings)
+ continue
+
+ if line_counter < 100:
+ # save a little bit of time by only doing this for the first few lines
+ line_counter += 1
+ m = re.search('(?<=^PLATFORM_VERSION=).*', line)
+ if m is not None:
+ platform_version = m.group(0)
+ m = re.search('(?<=^TARGET_PRODUCT=).*', line)
+ if m is not None:
+ target_product = m.group(0)
+ m = re.search('(?<=^TARGET_BUILD_VARIANT=).*', line)
+ if m is not None:
+ target_variant = m.group(0)
+ m = re.search('(?<=^TOP=).*', line)
+ if m is not None:
+ android_root = m.group(1)
+
+ if android_root:
+ new_unique_warnings = dict()
+ for warning_line in unique_warnings:
+ normalized_line = normalize_warning_line(warning_line, flags,
+ android_root)
+ new_unique_warnings[normalized_line] = generate_android_cs_link(
+ warning_line, flags, android_root)
+ unique_warnings = new_unique_warnings
+
+ header_str = '%s - %s - %s' % (platform_version, target_product,
+ target_variant)
+ return unique_warnings, header_str
+
+
+def parse_input_file(infile, flags):
+ if flags.platform == 'chrome':
+ return parse_input_file_chrome(infile, flags)
+ if flags.platform == 'android':
+ return parse_input_file_android(infile, flags)
+ raise RuntimeError('parse_input_file not defined for platform %s' %
+ flags.platform)
+
+
+def parse_compiler_output(compiler_output):
+ """Parse compiler output for relevant info."""
+ split_output = compiler_output.split(':', 3) # 3 = max splits
+ file_path = split_output[0]
+ line_number = int(split_output[1])
+ col_number = int(split_output[2].split(' ')[0])
+ warning_message = split_output[3]
+ return file_path, line_number, col_number, warning_message
+
+
+def get_warn_patterns(platform):
+ """Get and initialize warn_patterns."""
+ warn_patterns = []
+ if platform == 'chrome':
+ warn_patterns = cpp_patterns.warn_patterns
+ elif platform == 'android':
+ warn_patterns = make_patterns.warn_patterns + cpp_patterns.warn_patterns + java_patterns.warn_patterns + tidy_patterns.warn_patterns + other_patterns.warn_patterns
+ else:
+ raise Exception('platform name %s is not valid' % platform)
+ for w in warn_patterns:
+ w['members'] = []
+ # Each warning pattern has a 'projects' dictionary, that
+ # maps a project name to number of warnings in that project.
+ w['projects'] = {}
+ return warn_patterns
+
+
+def get_project_list(platform):
+ """Return project list for appropriate platform."""
+ if platform == 'chrome':
+ return chrome_project_list.project_list
+ if platform == 'android':
+ return android_project_list.project_list
+ raise Exception('platform name %s is not valid' % platform)
+
+
+def parallel_classify_warnings(warning_data, args, project_names,
+ project_patterns, warn_patterns,
+ use_google3, create_launch_subprocs_fn,
+ classify_warnings_fn):
+ """Classify all warning lines with num_cpu parallel processes."""
+ num_cpu = args.processes
+ group_results = []
+
+ if num_cpu > 1:
+ # set up parallel processing for this...
+ warning_groups = [[] for _ in range(num_cpu)]
+ i = 0
+ for warning, link in warning_data.items():
+ warning_groups[i].append((warning, link))
+ i = (i + 1) % num_cpu
+ arg_groups = [[] for _ in range(num_cpu)]
+ for i, group in enumerate(warning_groups):
+ arg_groups[i] = [{
+ 'group': group,
+ 'project_patterns': project_patterns,
+ 'warn_patterns': warn_patterns,
+ 'num_processes': num_cpu
+ }]
+
+ group_results = create_launch_subprocs_fn(num_cpu,
+ classify_warnings_fn,
+ arg_groups,
+ group_results)
+ else:
+ group_results = []
+ for warning, link in warning_data.items():
+ classify_one_warning(warning, link, group_results,
+ project_patterns, warn_patterns)
+ group_results = [group_results]
+
+ warning_messages = []
+ warning_links = []
+ warning_records = []
+ if use_google3:
+ group_results = [group_results]
+ for group_result in group_results:
+ for result in group_result:
+ for line, link, pattern_idx, project_idx in result:
+ pattern = warn_patterns[pattern_idx]
+ pattern['members'].append(line)
+ message_idx = len(warning_messages)
+ warning_messages.append(line)
+ link_idx = len(warning_links)
+ warning_links.append(link)
+ warning_records.append([pattern_idx, project_idx, message_idx,
+ link_idx])
+ pname = '???' if project_idx < 0 else project_names[project_idx]
+ # Count warnings by project.
+ if pname in pattern['projects']:
+ pattern['projects'][pname] += 1
+ else:
+ pattern['projects'][pname] = 1
+ return warning_messages, warning_links, warning_records
+
+
+def process_log(logfile, flags, project_names, project_patterns, warn_patterns,
+ html_path, use_google3, create_launch_subprocs_fn,
+ classify_warnings_fn, logfile_object):
+ # pylint: disable=g-doc-args
+ # pylint: disable=g-doc-return-or-yield
+ """Function that handles processing of a log.
+
+ This is isolated into its own function (rather than just taking place in main)
+ so that it can be used by both warn.py and the borg job process_gs_logs.py, to
+ avoid duplication of code.
+ Note that if the arguments to this function change, process_gs_logs.py must
+ be updated accordingly.
+ """
+ if logfile_object is None:
+ with io.open(logfile, encoding='utf-8') as log:
+ warning_lines_and_links, header_str = parse_input_file(log, flags)
+ else:
+ warning_lines_and_links, header_str = parse_input_file(
+ logfile_object, flags)
+ warning_messages, warning_links, warning_records = parallel_classify_warnings(
+ warning_lines_and_links, flags, project_names, project_patterns,
+ warn_patterns, use_google3, create_launch_subprocs_fn,
+ classify_warnings_fn)
+
+ html_writer.write_html(flags, project_names, warn_patterns, html_path,
+ warning_messages, warning_links, warning_records,
+ header_str)
+
+ return warning_messages, warning_links, warning_records, header_str
+
+
+def common_main(use_google3, create_launch_subprocs_fn, classify_warnings_fn,
+ logfile_object=None):
+ """Shared main function for Google3 and non-Google3 versions of warn.py."""
+ flags = parse_args(use_google3)
+ warn_patterns = get_warn_patterns(flags.platform)
+ project_list = get_project_list(flags.platform)
+
+ project_names = get_project_names(project_list)
+ project_patterns = [re.compile(p[1]) for p in project_list]
+
+ # html_path=None because we output html below if not outputting CSV
+ warning_messages, warning_links, warning_records, header_str = process_log(
+ logfile=flags.log, flags=flags, project_names=project_names,
+ project_patterns=project_patterns, warn_patterns=warn_patterns,
+ html_path=None, use_google3=use_google3,
+ create_launch_subprocs_fn=create_launch_subprocs_fn,
+ classify_warnings_fn=classify_warnings_fn,
+ logfile_object=logfile_object)
+
+ html_writer.write_out_csv(flags, warn_patterns, warning_messages,
+ warning_links, warning_records, header_str,
+ project_names)
+
+ # Return these values, so that caller can use them, if desired.
+ return flags, warning_messages, warning_records, warn_patterns
diff --git a/tools/zipalign/ZipFile.cpp b/tools/zipalign/ZipFile.cpp
index 63fb962..88505b7 100644
--- a/tools/zipalign/ZipFile.cpp
+++ b/tools/zipalign/ZipFile.cpp
@@ -1221,7 +1221,7 @@
FileReader(FILE* fp) : Reader(), fp_(fp), current_offset_(0) {
}
- bool ReadAtOffset(uint8_t* buf, size_t len, uint32_t offset) const {
+ bool ReadAtOffset(uint8_t* buf, size_t len, off64_t offset) const {
// Data is usually requested sequentially, so this helps avoid pointless
// fseeks every time we perform a read. There's an impedence mismatch
// here because the original API was designed around pread and pwrite.
@@ -1244,7 +1244,7 @@
private:
FILE* fp_;
- mutable uint32_t current_offset_;
+ mutable off64_t current_offset_;
};
// free the memory when you're done