Merge "Revert "Set up IRadioConfig 1.3""
diff --git a/Changes.md b/Changes.md
index 461de97..2720a0f 100644
--- a/Changes.md
+++ b/Changes.md
@@ -1,5 +1,90 @@
# Build System Changes for Android.mk Writers
+## 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 +562,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 9627093..c8631ee 100644
--- a/CleanSpec.mk
+++ b/CleanSpec.mk
@@ -505,9 +505,9 @@
# Remove *_OUT_INTERMEDIATE_LIBRARIES
$(call add-clean-step, rm -rf $(addsuffix /lib,\
- $(HOST_OUT_INTERMEDIATES) $(2ND_HOST_OUT_INTERMEDIATES) \
- $(HOST_CROSS_OUT_INTERMEDIATES) $(2ND_HOST_CROSS_OUT_INTERMEDIATES) \
- $(TARGET_OUT_INTERMEDIATES) $(2ND_TARGET_OUT_INTERMEDIATES)))
+$(HOST_OUT_INTERMEDIATES) $(2ND_HOST_OUT_INTERMEDIATES) \
+$(HOST_CROSS_OUT_INTERMEDIATES) $(2ND_HOST_CROSS_OUT_INTERMEDIATES) \
+$(TARGET_OUT_INTERMEDIATES) $(2ND_TARGET_OUT_INTERMEDIATES)))
# Remove strip.sh intermediates to save space
$(call add-clean-step, find $(OUT_DIR) \( -name "*.so.debug" -o -name "*.so.dynsyms" -o -name "*.so.funcsyms" -o -name "*.so.keep_symbols" -o -name "*.so.mini_debuginfo.xz" \) -print0 | xargs -0 rm -f)
@@ -704,6 +704,38 @@
# again, as the original change removing them was reverted.
$(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/framework/*.jar)
+# Remove cas@1.1 from the vendor partition
+$(call add-clean-step, rm -rf $(PRODUCT_OUT)/vendor/bin/hw/android.hardware.cas@1.1*)
+$(call add-clean-step, rm -rf $(PRODUCT_OUT)/vendor/etc/init/android.hardware.cas@1.1*)
+$(call add-clean-step, rm -rf $(PRODUCT_OUT)/vendor/etc/vintf/manifest/android.hardware.cas@1.1*)
+
+# Remove com.android.cellbroadcast apex for Go devices
+$(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/apex/com.android.cellbroadcast.apex)
+$(call add-clean-step, rm -rf $(PRODUCT_OUT)/apex/com.android.cellbroadcast)
+
+# Remove MediaProvider after moving into APEX
+$(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/priv-app/MediaProvider)
+
+# 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 'media' command
+$(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/bin/media)
+
+# 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)
+
+# Remove PermissionController after moving into APEX
+$(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/priv-app/*PermissionController)
+
# ************************************************
# NEWER CLEAN STEPS MUST BE AT THE END OF THE LIST
# ************************************************
diff --git a/Deprecation.md b/Deprecation.md
index 9378e1a..5e26492 100644
--- a/Deprecation.md
+++ b/Deprecation.md
@@ -16,8 +16,11 @@
| -------------------------------- | --------- |
| `BUILD_AUX_EXECUTABLE` | Error |
| `BUILD_AUX_STATIC_LIBRARY` | Error |
+| `BUILD_COPY_HEADERS` | Warning |
+| `BUILD_HOST_EXECUTABLE` | Warning |
| `BUILD_HOST_FUZZ_TEST` | Error |
| `BUILD_HOST_NATIVE_TEST` | Error |
+| `BUILD_HOST_SHARED_LIBRARY` | Warning |
| `BUILD_HOST_SHARED_TEST_LIBRARY` | Error |
| `BUILD_HOST_STATIC_LIBRARY` | Warning |
| `BUILD_HOST_STATIC_TEST_LIBRARY` | Error |
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/core/Makefile b/core/Makefile
index 4798df0..f49b871 100644
--- a/core/Makefile
+++ b/core/Makefile
@@ -16,7 +16,28 @@
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
# filter out the duplicate <source file>:<dest file> pairs.
unique_product_copy_files_pairs :=
@@ -94,6 +115,8 @@
$(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))
@@ -218,6 +241,7 @@
BUILD_VERSION_TAGS="$(BUILD_VERSION_TAGS)" \
DATE="$(DATE_FROM_FILE)" \
PLATFORM_SDK_VERSION="$(PLATFORM_SDK_VERSION)" \
+ PLATFORM_VERSION_LAST_STABLE="$(PLATFORM_VERSION_LAST_STABLE)" \
PLATFORM_VERSION="$(PLATFORM_VERSION)" \
TARGET_BUILD_TYPE="$(TARGET_BUILD_VARIANT)" \
bash $(BUILDINFO_COMMON_SH) "$(1)" >> $(2)
@@ -423,6 +447,7 @@
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)" \
@@ -478,6 +503,12 @@
INSTALLED_VENDOR_BUILD_PROP_TARGET := $(TARGET_OUT_VENDOR)/build.prop
ALL_DEFAULT_INSTALLED_MODULES += $(INSTALLED_VENDOR_BUILD_PROP_TARGET)
+ifdef TARGET_VENDOR_PROP
+vendor_prop_files := $(TARGET_VENDOR_PROP)
+else
+vendor_prop_files := $(wildcard $(TARGET_DEVICE_DIR)/vendor.prop)
+endif
+
ifdef property_overrides_split_enabled
FINAL_VENDOR_BUILD_PROPERTIES += \
$(call collapse-pairs, $(PRODUCT_PROPERTY_OVERRIDES))
@@ -485,7 +516,7 @@
$(FINAL_VENDOR_BUILD_PROPERTIES),=)
endif # property_overrides_split_enabled
-$(INSTALLED_VENDOR_BUILD_PROP_TARGET): $(BUILDINFO_COMMON_SH) $(POST_PROCESS_PROPS) $(intermediate_system_build_prop)
+$(INSTALLED_VENDOR_BUILD_PROP_TARGET): $(BUILDINFO_COMMON_SH) $(POST_PROCESS_PROPS) $(intermediate_system_build_prop) $(vendor_prop_files)
@echo Target vendor buildinfo: $@
@mkdir -p $(dir $@)
$(hide) echo > $@
@@ -521,6 +552,16 @@
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 file,$(vendor_prop_files), \
+ if [ -f "$(file)" ]; then \
+ echo Target vendor properties from: "$(file)"; \
+ echo "" >> $@; \
+ echo "#" >> $@; \
+ echo "# from $(file)" >> $@; \
+ echo "#" >> $@; \
+ cat $(file) >> $@; \
+ echo "# end of $(file)" >> $@; \
+ fi;)
$(hide) $(foreach line,$(FINAL_VENDOR_BUILD_PROPERTIES), \
echo "$(line)" >> $@;)
endif # property_overrides_split_enabled
@@ -572,12 +613,18 @@
INSTALLED_ODM_BUILD_PROP_TARGET := $(TARGET_OUT_ODM)/etc/build.prop
ALL_DEFAULT_INSTALLED_MODULES += $(INSTALLED_ODM_BUILD_PROP_TARGET)
+ifdef TARGET_ODM_PROP
+odm_prop_files := $(TARGET_ODM_PROP)
+else
+odm_prop_files := $(wildcard $(TARGET_DEVICE_DIR)/odm.prop)
+endif
+
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)
+$(INSTALLED_ODM_BUILD_PROP_TARGET): $(BUILDINFO_COMMON_SH) $(POST_PROCESS_PROPS) $(odm_prop_files)
@echo Target odm buildinfo: $@
@mkdir -p $(dir $@)
$(hide) echo > $@
@@ -585,6 +632,16 @@
$(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) $(foreach file,$(odm_prop_files), \
+ if [ -f "$(file)" ]; then \
+ echo Target odm properties from: "$(file)"; \
+ echo "" >> $@; \
+ echo "#" >> $@; \
+ echo "# from $(file)" >> $@; \
+ echo "#" >> $@; \
+ cat $(file) >> $@; \
+ echo "# end of $(file)" >> $@; \
+ fi;)
$(hide) echo "#" >> $@; \
echo "# ADDITIONAL ODM BUILD PROPERTIES" >> $@; \
echo "#" >> $@;
@@ -670,10 +727,11 @@
# $(4): staging dir
# $(5): module load list
# $(6): module load list filename
+# $(7): module archive
# 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))) \
+ $(eval $(call build-image-kernel-modules-depmod,$(1),$(3),$(4),$(5),$(6),$(7),$(2))) \
$(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 \
@@ -685,6 +743,13 @@
# $(3): staging dir
# $(4): module load list
# $(5): module load list filename
+# $(6): module archive
+# $(7): output dir
+# 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)
@@ -694,16 +759,29 @@
$(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; \
+ rm -rf $$(PRIVATE_OUTPUT_DIR)/lib/modules; \
+ cp -r $$(PRIVATE_MODULE_DIR) $$(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
@@ -747,40 +825,40 @@
endif
endif
-ifneq ($(strip $(BOARD_RECOVERY_KERNEL_MODULES)),)
+ifneq ($(strip $(BOARD_RECOVERY_KERNEL_MODULES))$(strip $(BOARD_RECOVERY_KERNEL_MODULES_ARCHIVE)),)
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))
+ 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,$(BOARD_RECOVERY_KERNEL_MODULES_ARCHIVE)))
endif
-ifneq ($(strip $(BOARD_VENDOR_RAMDISK_KERNEL_MODULES)),)
+ifneq ($(strip $(BOARD_VENDOR_RAMDISK_KERNEL_MODULES))$(strip $(BOARD_VENDOR_RAMDISK_KERNEL_MODULES_ARCHIVE)),)
ifeq ($(BOARD_VENDOR_RAMDISK_KERNEL_MODULES_LOAD),)
BOARD_VENDOR_RAMDISK_KERNEL_MODULES_LOAD := $(BOARD_VENDOR_RAMDISK_KERNEL_MODULES)
endif
- ALL_DEFAULT_INSTALLED_MODULES += $(call copy-many-files,$(call build-image-kernel-modules,$(BOARD_VENDOR_RAMDISK_KERNEL_MODULES),$(TARGET_VENDOR_RAMDISK_OUT),,$(call intermediates-dir-for,PACKAGING,depmod_vendor_ramdisk),$(BOARD_VENDOR_RAMDISK_KERNEL_MODULES_LOAD),modules.load))
+ ALL_DEFAULT_INSTALLED_MODULES += $(call copy-many-files,$(call build-image-kernel-modules,$(BOARD_VENDOR_RAMDISK_KERNEL_MODULES),$(TARGET_VENDOR_RAMDISK_OUT),,$(call intermediates-dir-for,PACKAGING,depmod_vendor_ramdisk),$(BOARD_VENDOR_RAMDISK_KERNEL_MODULES_LOAD),modules.load,$(BOARD_VENDOR_RAMDISK_KERNEL_MODULES_ARCHIVE)))
endif
ifneq ($(BOARD_USES_RECOVERY_AS_BOOT), true)
ifneq ($(strip $(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))
+ 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
endif
-ifneq ($(strip $(BOARD_VENDOR_KERNEL_MODULES)),)
+ifneq ($(strip $(BOARD_VENDOR_KERNEL_MODULES)$(strip $(BOARD_VENDOR_KERNEL_MODULES_ARCHIVE))),)
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))
+ 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,$(BOARD_VENDOR_KERNEL_MODULES_ARCHIVE)))
endif
-ifneq ($(strip $(BOARD_ODM_KERNEL_MODULES)),)
+ifneq ($(strip $(BOARD_ODM_KERNEL_MODULES))$(strip $(BOARD_ODM_KERNEL_MODULES_ARCHIVE)),)
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))
+ 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,$(BOARD_ODM_KERNEL_MODULES_ARCHIVE)))
endif
# -----------------------------------------------------------------
@@ -1075,7 +1153,7 @@
endif
INTERNAL_MKBOOTIMG_VERSION_ARGS := \
- --os_version $(PLATFORM_VERSION) \
+ --os_version $(PLATFORM_VERSION_LAST_STABLE) \
--os_patch_level $(PLATFORM_SECURITY_PATCH)
# Define these only if we are building boot
@@ -1462,6 +1540,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) \
@@ -1524,6 +1605,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),\
@@ -1598,6 +1681,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))
@@ -1664,7 +1748,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
@@ -1733,7 +1818,6 @@
$(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 \
@@ -2027,7 +2111,6 @@
$(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/*
@@ -2092,13 +2175,14 @@
$(INTERNAL_ROOT_FILES) \
$(INSTALLED_RAMDISK_TARGET) \
$(INTERNAL_RECOVERYIMAGE_FILES) \
- $(recovery_initrc) $(recovery_sepolicy) $(recovery_kernel) \
+ $(recovery_sepolicy) $(recovery_kernel) \
$(INSTALLED_2NDBOOTLOADER_TARGET) \
$(INSTALLED_RECOVERY_BUILD_PROP_TARGET) \
$(recovery_resource_deps) \
$(recovery_fstab)
$(call pretty,"Target boot image from recovery: $@")
$(call build-recoveryimage-target, $@)
+$(INSTALLED_BOOTIMAGE_TARGET): .KATI_IMPLICIT_OUTPUTS += $(recovery_ramdisk)
endif # BOARD_USES_RECOVERY_AS_BOOT
ifdef BOARD_INCLUDE_RECOVERY_DTBO
@@ -2120,7 +2204,7 @@
$(INSTALLED_RAMDISK_TARGET) \
$(INSTALLED_BOOTIMAGE_TARGET) \
$(INTERNAL_RECOVERYIMAGE_FILES) \
- $(recovery_initrc) $(recovery_sepolicy) $(recovery_kernel) \
+ $(recovery_sepolicy) $(recovery_kernel) \
$(INSTALLED_2NDBOOTLOADER_TARGET) \
$(INSTALLED_RECOVERY_BUILD_PROP_TARGET) \
$(recovery_resource_deps) \
@@ -2464,7 +2548,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)
@@ -2845,94 +2928,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)
@@ -2979,9 +2974,6 @@
# 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) \
@@ -3056,52 +3048,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 := \
@@ -3304,22 +3250,22 @@
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.os_version:$(PLATFORM_VERSION_LAST_STABLE) \
--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.os_version:$(PLATFORM_VERSION_LAST_STABLE) \
--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.os_version:$(PLATFORM_VERSION_LAST_STABLE) \
--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)
+ --prop com.android.build.boot.os_version:$(PLATFORM_VERSION_LAST_STABLE)
BOARD_AVB_VENDOR_BOOT_ADD_HASH_FOOTER_ARGS += \
--prop com.android.build.vendor_boot.fingerprint:$(BUILD_FINGERPRINT_FROM_FILE) \
@@ -3329,11 +3275,11 @@
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)
+ --prop com.android.build.vendor.os_version:$(PLATFORM_VERSION_LAST_STABLE)
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)
+ --prop com.android.build.odm.os_version:$(PLATFORM_VERSION_LAST_STABLE)
BOARD_AVB_DTBO_ADD_HASH_FOOTER_ARGS += \
--prop com.android.build.dtbo.fingerprint:$(BUILD_FINGERPRINT_FROM_FILE)
@@ -3602,6 +3548,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
@@ -3609,6 +3557,186 @@
endif # BOARD_AVB_ENABLE
# -----------------------------------------------------------------
+# Check VINTF of build
+
+ifndef TARGET_BUILD_APPS
+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 :=
+
+# -- 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_vintf_vendor_log): $(HOST_OUT_EXECUTABLES)/checkvintf $(check_vintf_vendor_deps)
+ @( $< --check-one --dirmap /vendor:$(TARGET_OUT_VENDOR) > $@ 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_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)" >> $@
+ @echo -n -e 'For empty SKU:' >> $@
+ @( $< --check-compat $(PRIVATE_CHECK_VINTF_ARGS) >> $@ 2>&1 ) || ( cat $@ && exit 1 )
+ $(foreach sku,$(ODM_MANIFEST_SKUS), \
+ echo "For SKU = $(sku):" >> $@; \
+ ( $< --check-compat $(PRIVATE_CHECK_VINTF_ARGS) \
+ --property ro.boot.product.hardware.sku=$(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_APPS
+
+# -----------------------------------------------------------------
# Check image sizes <= size of super partition
ifeq (,$(TARGET_BUILD_APPS))
@@ -3616,33 +3744,32 @@
ifeq (true,$(PRODUCT_BUILD_SUPER_PARTITION))
-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)
-
-$(check_all_partition_sizes_file): \
- $(CHECK_PARTITION_SIZES) \
- $(call images-for-partitions,$(BOARD_SUPER_PARTITION_PARTITION_LIST))
-
# $(1): misc_info.txt
+# #(2): optional log file
define check-all-partition-sizes-target
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) -v $(1)
+ $(CHECK_PARTITION_SIZES) $(if $(2),--logfile $(2),-v) $(1)
endef
-$(check_all_partition_sizes_file):
- $(call check-all-partition-sizes-target, \
- $(call intermediates-dir-for,PACKAGING,check-all-partition-sizes)/misc_info.txt)
- 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 intermediates-dir-for,PACKAGING,check-all-partition-sizes-nodeps)/misc_info.txt)
@@ -3738,6 +3865,7 @@
mkbootfs \
mkbootimg \
mke2fs \
+ mke2fs.conf \
mkf2fsuserimg.sh \
mksquashfs \
mksquashfsimage.sh \
@@ -3752,12 +3880,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 \
@@ -3813,7 +3951,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
@@ -4091,6 +4229,8 @@
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), \
@@ -4101,6 +4241,10 @@
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
@@ -4326,10 +4470,12 @@
$(hide) cp $(PRODUCT_ODM_BASE_FS_PATH) \
$(zip_root)/META/$(notdir $(PRODUCT_ODM_BASE_FS_PATH))
endif
+ifneq ($(AB_OTA_UPDATER),true)
ifneq ($(INSTALLED_RECOVERYIMAGE_TARGET),)
$(hide) PATH=$(INTERNAL_USERIMAGES_BINARY_PATHS):$$PATH MKBOOTIMG=$(MKBOOTIMG) \
$(MAKE_RECOVERY_PATCH) $(zip_root) $(zip_root)
endif
+endif
ifeq ($(AB_OTA_UPDATER),true)
@# When using the A/B updater, include the updater config files in the zip.
$(hide) cp $(TOPDIR)system/update_engine/update_engine.conf $(zip_root)/META/update_engine_config.txt
@@ -4421,21 +4567,10 @@
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
-ifeq ($(PRODUCT_VIRTUAL_AB_OTA),true)
- echo "virtual_ab=true" >> $(zip_root)/META/dynamic_partitions_info.txt
-endif # PRODUCT_VIRTUAL_AB_OTA
+ 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)
@@ -4632,13 +4767,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
@@ -4677,10 +4807,6 @@
$(call dump-dynamic-partitions-info,$(1))
$(if $(filter true,$(AB_OTA_UPDATER)), \
echo "ab_update=true" >> $(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
endif # PRODUCT_USE_DYNAMIC_PARTITIONS
@@ -5108,6 +5234,19 @@
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
@@ -5115,8 +5254,12 @@
# 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 'fuzz' as being a file, not a
+# directory`, because kati will see 'haiku' as being a file, not a
# phony target.
-.PHONY: fuzz
-fuzz: $(SOONG_FUZZ_PACKAGING_ARCH_MODULES)
-$(call dist-for-goals,fuzz,$(SOONG_FUZZ_PACKAGING_ARCH_MODULES))
+.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/base_rules.mk b/core/base_rules.mk
index 32c5807..cce6ec1 100644
--- a/core/base_rules.mk
+++ b/core/base_rules.mk
@@ -321,6 +321,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
@@ -798,22 +800,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
diff --git a/core/binary.mk b/core/binary.mk
index 51259b2..38ff9d6 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))
@@ -286,6 +273,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
@@ -428,15 +418,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
@@ -469,8 +450,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
###########################################################
@@ -812,7 +793,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))
@@ -825,7 +806,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))
@@ -841,6 +822,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)
@@ -853,6 +835,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)
@@ -874,7 +857,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)))
@@ -885,6 +869,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)
@@ -904,6 +889,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: \
@@ -922,6 +908,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)
@@ -933,6 +920,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)
@@ -960,7 +948,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)))
@@ -971,6 +960,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)
@@ -989,6 +979,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 \
@@ -1007,6 +998,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)
@@ -1022,6 +1014,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)
@@ -1042,10 +1035,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)
@@ -1062,10 +1057,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)
@@ -1125,22 +1122,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
@@ -1187,6 +1197,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
@@ -1195,6 +1206,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
@@ -1275,9 +1292,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;
@@ -1441,10 +1464,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))
@@ -1463,6 +1486,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
@@ -1775,7 +1805,7 @@
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.$(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 4c128f1..91d4fd6 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,9 +87,11 @@
_build_broken_var_list := \
BUILD_BROKEN_DUP_RULES \
+ 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) \
@@ -97,7 +100,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)
@@ -108,6 +112,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
@@ -254,6 +259,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)
@@ -398,6 +416,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
@@ -437,11 +457,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 :=
@@ -481,11 +497,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 :=
@@ -520,11 +532,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),)
@@ -574,9 +582,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 :=
@@ -614,11 +621,15 @@
###########################################
# Handle BUILD_BROKEN_USES_BUILD_*
-$(foreach m,$(DEFAULT_WARNING_BUILD_MODULE_TYPES),\
+$(foreach m,$(filter-out BUILD_COPY_HEADERS,$(DEFAULT_WARNING_BUILD_MODULE_TYPES)),\
$(if $(filter false,$(BUILD_BROKEN_USES_$(m))),\
$(KATI_obsolete_var $(m),Please convert to Soong),\
$(KATI_deprecated_var $(m),Please convert to Soong)))
+$(if $(filter false,$(BUILD_BROKEN_USES_BUILD_COPY_HEADERS)),\
+ $(KATI_obsolete_var BUILD_COPY_HEADERS,See $(CHANGES_URL)#copy_headers),\
+ $(KATI_deprecated_var BUILD_COPY_HEADERS,See $(CHANGES_URL)#copy_headers))
+
$(foreach m,$(DEFAULT_ERROR_BUILD_MODULE_TYPES),\
$(if $(filter true,$(BUILD_BROKEN_USES_$(m))),\
$(KATI_deprecated_var $(m),Please convert to Soong),\
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..1d959b5 100644
--- a/core/cc_prebuilt_internal.mk
+++ b/core/cc_prebuilt_internal.mk
@@ -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 7a5de67..da4168d 100644
--- a/core/check_elf_file.mk
+++ b/core/check_elf_file.mk
@@ -40,13 +40,7 @@
ifneq ($(strip $(LOCAL_CHECK_ELF_FILES)),false)
ifneq ($(strip $(BUILD_BROKEN_PREBUILT_ELF_FILES)),true)
-# TODO(b/141176116): Remove the PRODUCT_CHECK_ELF_FILES condition below and
-# cover `make droid` targets after everything goes well with `make checkbuild`
-# targets.
-ifneq ($(PRODUCT_CHECK_ELF_FILES)$(CHECK_ELF_FILES),)
$(LOCAL_BUILT_MODULE): $(check_elf_files_stamp)
-endif # PRODUCT_CHECK_ELF_FILES or CHECK_ELF_FILES
-
check-elf-files: $(check_elf_files_stamp)
endif # BUILD_BROKEN_PREBUILT_ELF_FILES
endif # LOCAL_CHECK_ELF_FILES
diff --git a/core/clear_vars.mk b/core/clear_vars.mk
index 4818c01..e27d91c 100644
--- a/core/clear_vars.mk
+++ b/core/clear_vars.mk
@@ -29,6 +29,7 @@
LOCAL_CC:=
LOCAL_CERTIFICATE:=
LOCAL_CFLAGS:=
+LOCAL_CHECK_SAME_VNDK_VARIANTS:=
LOCAL_CHECKED_MODULE:=
LOCAL_C_INCLUDES:=
LOCAL_CLANG:=
@@ -106,12 +107,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:=
@@ -184,7 +185,6 @@
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:=
@@ -304,6 +304,7 @@
LOCAL_USE_AAPT2:=
LOCAL_USE_CLANG_LLD:=
LOCAL_USE_VNDK:=
+LOCAL_USE_VNDK_PRODUCT:=
LOCAL_USES_LIBRARIES:=
LOCAL_VENDOR_MODULE:=
LOCAL_VINTF_FRAGMENTS:=
@@ -313,7 +314,6 @@
LOCAL_VTS_MODE:=
LOCAL_WARNINGS_ENABLE:=
LOCAL_WHOLE_STATIC_LIBRARIES:=
-LOCAL_XOM:=
LOCAL_YACCFLAGS:=
LOCAL_CHECK_ELF_FILES:=
# TODO: deprecate, it does nothing
diff --git a/core/config.mk b/core/config.mk
index a1bbe18..844d7d6 100644
--- a/core/config.mk
+++ b/core/config.mk
@@ -120,6 +120,8 @@
)
$(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)
# Used to force goals to build. Only use for conditionally defined goals.
.PHONY: FORCE
@@ -226,6 +228,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
@@ -551,6 +583,7 @@
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
@@ -707,19 +740,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.
@@ -1150,6 +1201,21 @@
$(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 \
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 6571d99..a2abb1a 100644
--- a/core/cxx_stl_setup.mk
+++ b/core/cxx_stl_setup.mk
@@ -76,17 +76,27 @@
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
+ 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)
diff --git a/core/definitions.mk b/core/definitions.mk
index eb3e612a..fb11ab6 100644
--- a/core/definitions.mk
+++ b/core/definitions.mk
@@ -108,6 +108,9 @@
# All tests that should be skipped in presubmit check.
ALL_DISABLED_PRESUBMIT_TESTS :=
+# All compatibility suites mentioned in LOCAL_COMPATIBILITY_SUITES
+ALL_COMPATIBILITY_SUITES :=
+
###########################################################
## Debugging; prints a variable list to stdout
###########################################################
@@ -886,7 +889,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 +900,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 +1366,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 +1381,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 +1396,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 +1411,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)
@@ -1709,7 +1720,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 +1755,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 +1801,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
@@ -2101,10 +2109,10 @@
--javacopts $(PRIVATE_JAVACFLAGS) $(COMMON_JDK_FLAGS) -- \
$(if $(PRIVATE_USE_SYSTEM_MODULES), \
--system $(PRIVATE_SYSTEM_MODULES_DIR), \
- $(addprefix --bootclasspath ,$(strip $(PRIVATE_BOOTCLASSPATH)))) \
- $(addprefix --classpath ,$(strip $(if $(PRIVATE_USE_SYSTEM_MODULES), \
+ --bootclasspath $(strip $(PRIVATE_BOOTCLASSPATH))) \
+ --classpath $(strip $(if $(PRIVATE_USE_SYSTEM_MODULES), \
$(filter-out $(PRIVATE_SYSTEM_MODULES_LIBS),$(PRIVATE_BOOTCLASSPATH))) \
- $(PRIVATE_ALL_JAVA_HEADER_LIBRARIES))) \
+ $(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 \
@@ -2189,17 +2197,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.
@@ -2461,12 +2471,22 @@
$(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 \
+ --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)
@@ -2607,17 +2627,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 $$@
@@ -2663,7 +2681,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 \
@@ -2876,6 +2894,7 @@
# and use my_compat_dist_$(suite) to define the others.
define create-suite-dependencies
$(foreach suite, $(LOCAL_COMPATIBILITY_SUITE), \
+ $(if $(filter $(suite),$(ALL_COMPATIBILITY_SUITES)),,$(eval ALL_COMPATIBILITY_SUITES += $(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)))) \
diff --git a/core/deprecation.mk b/core/deprecation.mk
index 761a9b6..cc620a3 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,6 +24,9 @@
# relevant BUILD_BROKEN_USES_BUILD_* variables, then these would move to
# DEFAULT_ERROR_BUILD_MODULE_TYPES.
DEFAULT_WARNING_BUILD_MODULE_TYPES :=$= \
+ BUILD_COPY_HEADERS \
+ BUILD_HOST_EXECUTABLE \
+ BUILD_HOST_SHARED_LIBRARY \
BUILD_HOST_STATIC_LIBRARY \
# These are BUILD_* variables that are errors to reference, but you can set
diff --git a/core/dex_preopt.mk b/core/dex_preopt.mk
index 32690fe..55eeec6 100644
--- a/core/dex_preopt.mk
+++ b/core/dex_preopt.mk
@@ -34,13 +34,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 64ad8d9..ccf53f5 100644
--- a/core/dex_preopt_config.mk
+++ b/core/dex_preopt_config.mk
@@ -37,16 +37,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))))
@@ -83,8 +73,7 @@
$(call add_json_bool, DisablePreopt, $(call invert_bool,$(and $(filter true,$(PRODUCT_USES_DEFAULT_ART_CONFIG)),$(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, 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))
@@ -92,11 +81,11 @@
$(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, 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, UpdatableSystemServerJars, $(PRODUCT_UPDATABLE_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))
@@ -136,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)))
@@ -158,11 +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 \
diff --git a/core/dex_preopt_odex_install.mk b/core/dex_preopt_odex_install.mk
index 6705c82..a33b2b4 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))
@@ -229,6 +237,7 @@
$(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))
@@ -250,12 +259,16 @@
.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): $(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_GEN) \
+ -global_soong $(PRIVATE_GLOBAL_SOONG_CONFIG) \
+ -global $(PRIVATE_GLOBAL_CONFIG) \
+ -module $(PRIVATE_MODULE_CONFIG) \
-dexpreopt_script $@ \
-out_dir $(OUT_DIR)
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/executable.mk b/core/executable.mk
index c8d9272..db8dcc6 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))
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/host_dalvik_java_library.mk b/core/host_dalvik_java_library.mk
index 8e655ff..882fe3a 100644
--- a/core/host_dalvik_java_library.mk
+++ b/core/host_dalvik_java_library.mk
@@ -79,6 +79,7 @@
$(java_source_list_file): $(java_sources_deps)
$(write-java-source-list)
+$(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 :=
diff --git a/core/host_java_library.mk b/core/host_java_library.mk
index 6c23789..beaea2a 100644
--- a/core/host_java_library.mk
+++ b/core/host_java_library.mk
@@ -70,6 +70,7 @@
$(java_source_list_file): $(java_sources_deps)
$(write-java-source-list)
+$(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 :=
diff --git a/core/host_shared_library.mk b/core/host_shared_library.mk
index 81236d1..c22af97 100644
--- a/core/host_shared_library.mk
+++ b/core/host_shared_library.mk
@@ -37,4 +37,7 @@
###########################################################
## Copy headers to the install tree
###########################################################
-include $(BUILD_COPY_HEADERS)
+ifdef LOCAL_COPY_HEADERS
+$(call pretty-warning,LOCAL_COPY_HEADERS is deprecated. See $(CHANGES_URL)#copy_headers)
+include $(BUILD_SYSTEM)/copy_headers.mk
+endif
diff --git a/core/host_static_library.mk b/core/host_static_library.mk
index 469da29..3dbd144 100644
--- a/core/host_static_library.mk
+++ b/core/host_static_library.mk
@@ -37,4 +37,7 @@
###########################################################
## Copy headers to the install tree
###########################################################
-include $(BUILD_COPY_HEADERS)
+ifdef LOCAL_COPY_HEADERS
+$(call pretty-warning,LOCAL_COPY_HEADERS is deprecated. See $(CHANGES_URL)#copy_headers)
+include $(BUILD_SYSTEM)/copy_headers.mk
+endif
diff --git a/core/install_jni_libs_internal.mk b/core/install_jni_libs_internal.mk
index eac0414..d87513b 100644
--- a/core/install_jni_libs_internal.mk
+++ b/core/install_jni_libs_internal.mk
@@ -49,29 +49,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)
# 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.$$(LOCAL_MODULE).INSTALLED += $$(my_app_lib_path)/$$(lib)))
endif
# Clear jni_shared_libraries to not embed it into the apk.
@@ -114,11 +106,13 @@
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))
diff --git a/core/java.mk b/core/java.mk
index 99774cf..a041321 100644
--- a/core/java.mk
+++ b/core/java.mk
@@ -274,6 +274,7 @@
endif # TURBINE_ENABLED != false
+$(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)
@@ -412,8 +413,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
diff --git a/core/line_coverage.mk b/core/line_coverage.mk
new file mode 100644
index 0000000..a32eea6
--- /dev/null
+++ b/core/line_coverage.mk
@@ -0,0 +1,93 @@
+# -----------------------------------------------------------------
+# 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
+
+critical_components_shared := \
+ libaudioprocessing \
+ libbinder \
+ libbluetooth_gd \
+ libbrillo \
+ libcameraservice \
+ libcurl \
+ libhardware \
+ libinputflinger \
+ libopus \
+ libstagefright \
+ libunwind \
+ libvixl
+
+# 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), \
+ $(call intermediates-dir-for,SHARED_LIBRARIES,$(lib))/$(lib).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/local_systemsdk.mk b/core/local_systemsdk.mk
index 6c022f2..2b73f93 100644
--- a/core/local_systemsdk.mk
+++ b/core/local_systemsdk.mk
@@ -16,16 +16,20 @@
ifdef BOARD_SYSTEMSDK_VERSIONS
# Apps and jars in vendor or odm partition are forced to build against System SDK.
- _is_vendor_app :=
+ _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 (,$(findstring __auto_generated_rro_,$(LOCAL_MODULE)))
# Runtime resource overlays are exempted from building against System SDK.
# TODO(b/35859726): remove this exception
LOCAL_SDK_VERSION := system_current
@@ -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 08fb7ef..0cde2c6 100644
--- a/core/main.mk
+++ b/core/main.mk
@@ -231,6 +231,17 @@
# mount system_other partition.
ADDITIONAL_DEFAULT_PROPERTIES += ro.postinstall.fstab.prefix=/system
+# 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
+
# -----------------------------------------------------------------
###
### In this section we set up the things that are different
@@ -432,10 +443,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 ...)
# -------------------------------------------------------------------
@@ -924,10 +931,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),\
@@ -969,7 +972,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
###########################################################
@@ -1022,7 +1025,7 @@
# 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 $(ODM_MANIFEST_FILES),odm_manifest.xml) \
$(if $(ODM_MANIFEST_SKUS),$(foreach sku, $(ODM_MANIFEST_SKUS),odm_manifest_$(sku).xml)) \
@@ -1106,178 +1109,6 @@
)
endef
-# Check that libraries that should only be in APEXes don't end up in the system
-# image. For the ART APEX this complements the checks in
-# art/build/apex/art_apex_test.py.
-# TODO(b/128708192): Implement this restriction in Soong instead.
-
-# ART APEX (native) 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 \
- libdexfile.so \
- libdexfile_external.so \
- libdexfiled.so \
- libdexfiled_external.so \
- libdt_fd_forward.so \
- libdt_socket.so \
- libicui18n.so \
- libicuuc.so \
- libicu_jni.so \
- libjavacore.so \
- libjdwp.so \
- libnativebridge.so \
- libnativehelper.so \
- libnativeloader.so \
- libnpt.so \
- libopenjdk.so \
- libopenjdkjvm.so \
- libopenjdkjvmd.so \
- libopenjdkjvmti.so \
- libopenjdkjvmtid.so \
- libpac.so \
- libprofile.so \
- libprofiled.so \
- libsigchain.so \
-
-# Runtime (Bionic) APEX (native) libraries
-APEX_MODULE_LIBS += \
- libc.so \
- libc_malloc_debug.so \
- libc_malloc_hooks.so \
- libdl.so \
- libm.so \
-
-# Conscrypt APEX libraries
-APEX_MODULE_LIBS += \
- libjavacrypto.so \
-
-# Android Neural Network API (NNAPI) APEX (native) libraries
-APEX_MODULE_LIBS += \
- libneuralnetworks.so \
-
-# ART APEX JARs (Java libraries)
-APEX_MODULE_LIBS += \
- apache-xml.jar \
- bouncycastle.jar \
- core-icu4j.jar \
- core-libart.jar \
- core-oj.jar \
- okhttp.jar \
-
-# Conscrypt APEX JARs (Java libraries)
-APEX_MODULE_LIBS += \
- conscrypt.jar \
-
-# 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 ?=
-
-# Allow APEX libraries under /system/apex, which happens when APEX flattening
-# is enabled.
-APEX_LIBS_ABSENCE_CHECK_EXCLUDE := apex
-
-# 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.
- #
- # Likewise, we check for the absence of APEX Java libraries (JARs).
- 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),$(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.
- #
- # Likewise, we check for the absence of APEX Java libraries (JARs).
- define check-apex-libs-absence-on-disk
- $(hide) ( \
- cd $(TARGET_OUT) && \
- findres=$$(find . \
- $(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)
@@ -1398,8 +1229,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
@@ -1418,6 +1247,28 @@
$(CUSTOM_MODULES) \
)
+#
+# 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 :=
+
+
# 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
@@ -1481,7 +1332,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))
@@ -1702,6 +1553,7 @@
$(INSTALLED_BUILD_PROP_TARGET) \
$(BUILT_TARGET_FILES_PACKAGE) \
$(INSTALLED_ANDROID_INFO_TXT_TARGET) \
+ $(INSTALLED_MISC_INFO_TARGET) \
$(INSTALLED_RAMDISK_TARGET) \
)
@@ -1738,15 +1590,21 @@
)
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):
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/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.mk b/core/product.mk
index bc09c2b..25a9c44 100644
--- a/core/product.mk
+++ b/core/product.mk
@@ -228,6 +228,8 @@
_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
# All of the apps that we force preopt, this overrides WITH_DEXPREOPT.
_product_list_vars += PRODUCT_ALWAYS_PREOPT_EXTRACTED_APK
@@ -307,6 +309,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 +350,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 +368,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,6 +380,11 @@
# If set, device retrofits virtual A/B.
_product_single_value_vars += PRODUCT_VIRTUAL_AB_OTA_RETROFIT
+# 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)
diff --git a/core/product_config.mk b/core/product_config.mk
index 4fc7bf6..c4361d0 100644
--- a/core/product_config.mk
+++ b/core/product_config.mk
@@ -264,6 +264,13 @@
endif
endif
+$(foreach pair,$(PRODUCT_UPDATABLE_BOOT_JARS), \
+ $(if $(findstring $(call word-colon,2,$(pair)),$(PRODUCT_BOOT_JARS)), \
+ $(error A jar in PRODUCT_UPDATABLE_BOOT_JARS must not be in PRODUCT_BOOT_JARS, \
+ but $(call word-colon,2,$(pair)) is) \
+ ) \
+)
+
ENFORCE_SYSTEM_CERTIFICATE := $(PRODUCT_ENFORCE_ARTIFACT_SYSTEM_CERTIFICATE_REQUIREMENT)
ENFORCE_SYSTEM_CERTIFICATE_WHITELIST := $(PRODUCT_ARTIFACT_SYSTEM_CERTIFICATE_REQUIREMENT_WHITELIST)
@@ -328,6 +335,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
@@ -337,6 +350,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..7886e1a 100644
--- a/core/rbe.mk
+++ b/core/rbe.mk
@@ -21,12 +21,50 @@
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_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
+
+ RBE_WRAPPER := $(rbe_dir)/rewrapper
+ RBE_CXX := --labels=type=compile,lang=cpp,compiler=clang --env_var_whitelist=PWD --exec_strategy=$(cxx_rbe_exec_strategy)
# 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,shallow=true --exec_strategy=$(javac_exec_strategy))
+ endif
+
+ ifdef RBE_R8
+ R8_WRAPPER := $(strip $(RBE_WRAPPER) --labels=type=compile,compiler=r8,shallow=true --exec_strategy=$(r8_exec_strategy))
+ endif
+
+ ifdef RBE_D8
+ D8_WRAPPER := $(strip $(RBE_WRAPPER) --labels=type=compile,compiler=d8,shallow=true --exec_strategy=$(d8_exec_strategy))
+ 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/sdk_font.mk b/core/sdk_font.mk
index 0259a9c..1742925 100644
--- a/core/sdk_font.mk
+++ b/core/sdk_font.mk
@@ -19,9 +19,9 @@
# The font configuration files - system_fonts.xml, fallback_fonts.xml etc.
sdk_font_config := $(sort $(wildcard frameworks/base/data/fonts/*.xml))
-sdk_font_config := $(addprefix $(SDK_FONT_TEMP)/, $(notdir $(sdk_font_config)))
+sdk_font_config := $(addprefix $(SDK_FONT_TEMP)/standard/, $(notdir $(sdk_font_config)))
-$(sdk_font_config): $(SDK_FONT_TEMP)/%.xml: \
+$(sdk_font_config): $(SDK_FONT_TEMP)/standard/%.xml: \
frameworks/base/data/fonts/%.xml
$(hide) mkdir -p $(dir $@)
$(hide) cp -vf $< $@
diff --git a/core/shared_library.mk b/core/shared_library.mk
index 2832c17..ca17151 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,7 @@
###########################################################
## Copy headers to the install tree
###########################################################
-include $(BUILD_COPY_HEADERS)
+ifdef LOCAL_COPY_HEADERS
+$(call pretty-warning,LOCAL_COPY_HEADERS is deprecated. 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/soong_app_prebuilt.mk b/core/soong_app_prebuilt.mk
index c402717..0a5ba9d 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.
@@ -104,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,$(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 :=
@@ -125,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.
diff --git a/core/soong_cc_prebuilt.mk b/core/soong_cc_prebuilt.mk
index 20950ca..190a7ed 100644
--- a/core/soong_cc_prebuilt.mk
+++ b/core/soong_cc_prebuilt.mk
@@ -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,33 +109,35 @@
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)),)
+ my_check_same_vndk_variants := true
+ 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))
+
+ $(LOCAL_BUILT_MODULE): $(same_vndk_variants_stamp)
endif
-ifeq ($(LOCAL_VNDK_DEPEND_ON_CORE_VARIANT),true)
-$(LOCAL_BUILT_MODULE): PRIVATE_TOOLS_PREFIX := $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)TOOLS_PREFIX)
-$(LOCAL_BUILT_MODULE): $(LOCAL_PREBUILT_MODULE_FILE) $(LIBRARY_IDENTITY_CHECK_SCRIPT)
- $(call verify-vndk-libs-identical,\
- $(PRIVATE_CORE_VARIANT),\
- $<,\
- $(PRIVATE_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
@@ -220,3 +227,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 1138f08..f31c9a0 100644
--- a/core/soong_config.mk
+++ b/core/soong_config.mk
@@ -101,8 +101,6 @@
$(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)))
@@ -112,7 +110,9 @@
$(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))
@@ -124,6 +124,7 @@
$(call add_json_bool, DevicePrefer32BitExecutables, $(filter true,$(TARGET_PREFER_32_BIT_EXECUTABLES)))
$(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))
@@ -135,6 +136,7 @@
$(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))
@@ -154,6 +156,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))
@@ -197,6 +202,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_rust_prebuilt.mk b/core/soong_rust_prebuilt.mk
index 23d18c4..4a9eb4a 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
diff --git a/core/static_library.mk b/core/static_library.mk
index 8002e5c..78908cf 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,7 @@
###########################################################
## Copy headers to the install tree
###########################################################
-include $(BUILD_COPY_HEADERS)
+ifdef LOCAL_COPY_HEADERS
+$(call pretty-warning,LOCAL_COPY_HEADERS is deprecated. See $(CHANGES_URL)#copy_headers)
+include $(BUILD_SYSTEM)/copy_headers.mk
+endif
diff --git a/core/tasks/boot_jars_package_check.mk b/core/tasks/boot_jars_package_check.mk
index dc79e23..05243e5 100644
--- a/core/tasks/boot_jars_package_check.mk
+++ b/core/tasks/boot_jars_package_check.mk
@@ -22,7 +22,19 @@
intermediates := $(call intermediates-dir-for, PACKAGING, boot-jars-package-check,,COMMON)
stamp := $(intermediates)/stamp
-built_boot_jars := $(foreach j, $(PRODUCT_BOOT_JARS), \
+
+# The actual names for the updatable jars are <jar_name>.<apex_name> e.g., updatable-media.com.android.media
+updatable_boot_jars := $(foreach pair,$(PRODUCT_UPDATABLE_BOOT_JARS),\
+ $(eval apex := $(call word-colon,1,$(pair)))\
+ $(eval jar := $(call word-colon,2,$(pair)))\
+ $(jar).$(apex)\
+)
+#TODO(jiyong) merge art_boot_jars into updatable_boot_jars
+art_boot_jars := $(addsuffix .com.android.art.release,$(filter $(ART_APEX_JARS),$(PRODUCT_BOOT_JARS)))
+
+platform_boot_jars := $(filter-out $(ART_APEX_JARS),$(PRODUCT_BOOT_JARS))
+
+built_boot_jars := $(foreach j, $(updatable_boot_jars) $(art_boot_jars) $(platform_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..8adf877 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
@@ -120,8 +122,6 @@
libcore\..*
android\..*
com\.android\..*
-
-
###################################################
# android.test.base.jar
junit\.extensions
@@ -239,6 +239,8 @@
# Packages in the google namespace across all bootclasspath jars.
com\.google\.android\..*
com\.google\.vr\.platform.*
+com\.google\.i18n\.phonenumbers\..*
+com\.google\.i18n\.phonenumbers
###################################################
# Packages used for Android in Chrome OS
diff --git a/core/tasks/general-tests.mk b/core/tasks/general-tests.mk
index 9ea4e62..7bcc915 100644
--- a/core/tasks/general-tests.mk
+++ b/core/tasks/general-tests.mk
@@ -17,6 +17,7 @@
general_tests_tools := \
$(HOST_OUT_JAVA_LIBRARIES)/cts-tradefed.jar \
$(HOST_OUT_JAVA_LIBRARIES)/compatibility-host-util.jar \
+ $(HOST_OUT_JAVA_LIBRARIES)/vts-core-tradefed.jar \
intermediates_dir := $(call intermediates-dir-for,PACKAGING,general-tests)
general_tests_zip := $(PRODUCT_OUT)/general-tests.zip
diff --git a/core/tasks/tools/package-modules.mk b/core/tasks/tools/package-modules.mk
index d7b3010..7c4266c 100644
--- a/core/tasks/tools/package-modules.mk
+++ b/core/tasks/tools/package-modules.mk
@@ -5,6 +5,11 @@
# 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.
#
@@ -15,6 +20,7 @@
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 +32,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 ifneq ($(my_modules_strict),false)
+ 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,6 +76,10 @@
$(eval my_copy_pairs += $(bui):$(my_staging_dir)/$(my_copy_dest)))\
))
+ifneq ($(my_missing_error),)
+ $(error done)
+endif
+
my_package_zip := $(my_staging_dir)/$(my_package_name).zip
$(my_package_zip): PRIVATE_COPY_PAIRS := $(my_copy_pairs)
$(my_package_zip): PRIVATE_PICKUP_FILES := $(my_pickup_files)
@@ -84,4 +101,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 dccb5f6..a2973b4 100644
--- a/core/tasks/vndk.mk
+++ b/core/tasks/vndk.mk
@@ -43,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..f67d722 100644
--- a/core/tasks/vts-core-tests.mk
+++ b/core/tasks/vts-core-tests.mk
@@ -12,45 +12,20 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-.PHONY: vts-core
-
-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_readme := test/vts/tools/vts-core-tradefed/README
-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))
+# TODO(b/149249068): Clean up after all VTS tests are converted.
+vts_test_artifact_paths :=
+# Some repo may not include vts project.
+-include test/vts/tools/build/tasks/framework/vts_for_core_suite.mk
+
+include $(BUILD_SYSTEM)/tasks/tools/compatibility.mk
+
+.PHONY: vts-core
+$(compatibility_zip): $(vts_test_artifact_paths)
+vts-core: $(compatibility_zip)
+$(call dist-for-goals, vts-core, $(compatibility_zip))
tests: vts-core
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/version_defaults.mk b/core/version_defaults.mk
index 8095212..ed88551 100644
--- a/core/version_defaults.mk
+++ b/core/version_defaults.mk
@@ -84,38 +84,17 @@
# generate the range of allowed SDK versions, so it must have an entry for every
# unreleased API level targetable by this branch, not just those that are valid
# lunch targets for this branch.
-PLATFORM_VERSION.RP1A := R
+
+# The last stable version name of the platform that was released. During
+# development, this stays at that previous version, while the codename indicates
+# further work based on the previous version.
+PLATFORM_VERSION_LAST_STABLE := 10
+.KATI_READONLY := PLATFORM_VERSION_LAST_STABLE
# 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
-ifndef PLATFORM_VERSION
- PLATFORM_VERSION := $(PLATFORM_VERSION.$(TARGET_PLATFORM_VERSION))
- ifndef PLATFORM_VERSION
- # PLATFORM_VERSION falls back to TARGET_PLATFORM_VERSION
- PLATFORM_VERSION := $(TARGET_PLATFORM_VERSION)
- endif
-endif
-.KATI_READONLY := PLATFORM_VERSION
-
-ifndef PLATFORM_SDK_VERSION
- # This is the canonical definition of the SDK version, which defines
- # the set of APIs and functionality available in the platform. It
- # is a single integer that increases monotonically as updates to
- # the SDK are released. It should only be incremented when the APIs for
- # the new release are frozen (so that developers don't write apps against
- # intermediate builds). During development, this number remains at the
- # SDK version the branch is based on and PLATFORM_VERSION_CODENAME holds
- # the code-name of the new development work.
-
- # When you increment the PLATFORM_SDK_VERSION please ensure you also
- # clear out the following text file of all older PLATFORM_VERSION's:
- # cts/tests/tests/os/assets/platform_versions.txt
- PLATFORM_SDK_VERSION := 29
-endif
-.KATI_READONLY := PLATFORM_SDK_VERSION
-
ifndef PLATFORM_VERSION_CODENAME
PLATFORM_VERSION_CODENAME := $(PLATFORM_VERSION_CODENAME.$(TARGET_PLATFORM_VERSION))
ifndef PLATFORM_VERSION_CODENAME
@@ -165,6 +144,32 @@
PLATFORM_VERSION_ALL_CODENAMES \
PLATFORM_VERSION_FUTURE_CODENAMES
+ifndef PLATFORM_VERSION
+ ifeq (REL,$(PLATFORM_VERSION_CODENAME))
+ PLATFORM_VERSION := $(PLATFORM_VERSION_LAST_STABLE)
+ else
+ PLATFORM_VERSION := $(PLATFORM_VERSION_CODENAME)
+ endif
+endif
+.KATI_READONLY := PLATFORM_VERSION
+
+ifndef PLATFORM_SDK_VERSION
+ # This is the canonical definition of the SDK version, which defines
+ # the set of APIs and functionality available in the platform. It
+ # is a single integer that increases monotonically as updates to
+ # the SDK are released. It should only be incremented when the APIs for
+ # the new release are frozen (so that developers don't write apps against
+ # intermediate builds). During development, this number remains at the
+ # SDK version the branch is based on and PLATFORM_VERSION_CODENAME holds
+ # the code-name of the new development work.
+
+ # When you increment the PLATFORM_SDK_VERSION please ensure you also
+ # clear out the following text file of all older PLATFORM_VERSION's:
+ # cts/tests/tests/os/assets/platform_versions.txt
+ PLATFORM_SDK_VERSION := 29
+endif
+.KATI_READONLY := PLATFORM_SDK_VERSION
+
ifeq (REL,$(PLATFORM_VERSION_CODENAME))
PLATFORM_PREVIEW_SDK_VERSION := 0
else
@@ -250,7 +255,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-12-05
+ PLATFORM_SECURITY_PATCH := 2020-04-05
endif
.KATI_READONLY := PLATFORM_SECURITY_PATCH
diff --git a/envsetup.sh b/envsetup.sh
index a44cd50..793f4b6 100644
--- a/envsetup.sh
+++ b/envsetup.sh
@@ -254,6 +254,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
@@ -1342,7 +1345,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
@@ -1368,7 +1371,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/target/board/Android.mk b/target/board/Android.mk
index c8705c3..2c7d2da 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,7 +50,6 @@
LOCAL_PREBUILT_MODULE_FILE := $(GEN)
include $(BUILD_PREBUILT)
-BUILT_VENDOR_MANIFEST := $(LOCAL_BUILT_MODULE)
endif
# ODM manifest
diff --git a/target/board/BoardConfigMainlineCommon.mk b/target/board/BoardConfigMainlineCommon.mk
index 52ba814..c57968e 100644
--- a/target/board/BoardConfigMainlineCommon.mk
+++ b/target/board/BoardConfigMainlineCommon.mk
@@ -46,6 +46,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/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_64_ab/BoardConfig.mk b/target/board/generic_x86_64_ab/BoardConfig.mk
new file mode 100644
index 0000000..1dd5e48
--- /dev/null
+++ b/target/board/generic_x86_64_ab/BoardConfig.mk
@@ -0,0 +1,25 @@
+#
+# 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_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
diff --git a/target/board/generic_x86_ab/BoardConfig.mk b/target/board/generic_x86_ab/BoardConfig.mk
new file mode 100644
index 0000000..53acffd
--- /dev/null
+++ b/target/board/generic_x86_ab/BoardConfig.mk
@@ -0,0 +1,24 @@
+#
+# 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_CPU_ABI := x86
+TARGET_ARCH := x86
+TARGET_ARCH_VARIANT := x86
+
+# Legacy GSI keeps 32 bits binder for 32 bits CPU Arch
+TARGET_USES_64_BIT_BINDER := false
diff --git a/target/board/mainline_arm64/BoardConfig.mk b/target/board/mainline_arm64/BoardConfig.mk
index 7cb2609..a09960f 100644
--- a/target/board/mainline_arm64/BoardConfig.mk
+++ b/target/board/mainline_arm64/BoardConfig.mk
@@ -26,6 +26,11 @@
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.
@@ -35,8 +40,3 @@
BOARD_PRODUCTIMAGE_FILE_SYSTEM_TYPE := ext4
BOARD_SYSTEM_EXTIMAGE_FILE_SYSTEM_TYPE := ext4
BOARD_VENDORIMAGE_FILE_SYSTEM_TYPE := ext4
-
-# Mainline devices support apex
-# TODO: move this to BoardConfigMainlineCommon. Currently, GSI wants flattened
-# apexes, but emulator wants .apex files, preventing this.
-TARGET_FLATTEN_APEX := false
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
index a20d17c..4dda058 100644
--- a/target/board/mainline_x86/BoardConfig.mk
+++ b/target/board/mainline_x86/BoardConfig.mk
@@ -29,7 +29,3 @@
BOARD_PRODUCTIMAGE_FILE_SYSTEM_TYPE := ext4
BOARD_SYSTEM_EXTIMAGE_FILE_SYSTEM_TYPE := ext4
BOARD_VENDORIMAGE_FILE_SYSTEM_TYPE := ext4
-
-# Mainline devices support apex
-# TODO: move this to product makefile and use updatable_apex.mk
-TARGET_FLATTEN_APEX := false
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
index 6b282c2..d775a77 100644
--- a/target/board/mainline_x86_arm/BoardConfig.mk
+++ b/target/board/mainline_x86_arm/BoardConfig.mk
@@ -34,7 +34,3 @@
BOARD_PRODUCTIMAGE_FILE_SYSTEM_TYPE := ext4
BOARD_SYSTEM_EXTIMAGE_FILE_SYSTEM_TYPE := ext4
BOARD_VENDORIMAGE_FILE_SYSTEM_TYPE := ext4
-
-# Mainline devices support apex
-# TODO: move this to product makefile and use updatable_apex.mk
-TARGET_FLATTEN_APEX := false
diff --git a/target/product/AndroidProducts.mk b/target/product/AndroidProducts.mk
index ca4ed2c..4121bc1 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 \
@@ -57,6 +61,7 @@
$(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 dda805f..e133db4 100644
--- a/target/product/aosp_arm64.mk
+++ b/target/product/aosp_arm64.mk
@@ -40,6 +40,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_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 aefad82..e3819e6 100644
--- a/target/product/aosp_product.mk
+++ b/target/product/aosp_product.mk
@@ -31,7 +31,7 @@
PRODUCT_PACKAGES += \
messaging \
PhotoTable \
- WAPPushManager \
+ preinstalled-packages-platform-aosp-product.xml \
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 153f499..9b26716 100644
--- a/target/product/aosp_x86_64.mk
+++ b/target/product/aosp_x86_64.mk
@@ -40,6 +40,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_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_system.mk b/target/product/base_system.mk
index b0861a3..04808ae 100644
--- a/target/product/base_system.mk
+++ b/target/product/base_system.mk
@@ -37,6 +37,7 @@
bcc \
blank_screen \
blkid \
+ service-blobstore \
bmgr \
bootanimation \
bootstat \
@@ -48,20 +49,29 @@
charger \
cmd \
com.android.adbd \
- com.android.apex.cts.shim.v1_prebuilt \
+ com.android.apex.cts.shim.v1 \
+ com.android.appsearch \
com.android.conscrypt \
+ com.android.cronet \
+ com.android.extservices \
com.android.i18n \
+ com.android.ipsec \
com.android.location.provider \
com.android.media \
com.android.media.swcodec \
+ com.android.mediaprovider \
+ com.android.os.statsd \
+ com.android.permission \
com.android.resolv \
com.android.neuralnetworks \
+ com.android.os.statsd \
+ com.android.sdkext \
+ com.android.tethering \
com.android.tzdata \
+ com.android.wifi \
ContactsProvider \
content \
crash_dump \
- CtsShimPrebuilt \
- CtsShimPrivPrebuilt \
debuggerd\
device_config \
dmctl \
@@ -72,12 +82,12 @@
dumpsys \
DynamicSystemInstallationService \
e2fsck \
- ExtServices \
ExtShared \
flags_health_check \
framework-minus-apex \
framework-res \
framework-sysconfig.xml \
+ framework-telephony \
fsck_msdos \
fs_config_files_system \
fs_config_dirs_system \
@@ -90,7 +100,6 @@
gpuservice \
hid \
hwservicemanager \
- idmap \
idmap2 \
idmap2d \
ime \
@@ -98,8 +107,8 @@
incident \
incidentd \
incident_helper \
+ incident-helper-cmd \
init.environ.rc \
- init.rc \
init_system \
input \
installd \
@@ -109,9 +118,8 @@
iptables \
ip-up-vpn \
javax.obex \
- jobscheduler-service \
+ service-jobscheduler \
keystore \
- ld.config.txt \
ld.mc \
libaaudio \
libamidi \
@@ -127,10 +135,12 @@
libcamera2ndk \
libcutils \
libdl.bootstrap \
+ libdl_android.bootstrap \
libdrmframework \
libdrmframework_jni \
libEGL \
libETC1 \
+ libfdtrack \
libFFTEm \
libfilterfw \
libgatekeeper \
@@ -192,26 +202,24 @@
lpdump \
lshal \
mdnsd \
- media \
mediacodec.policy \
- mediadrmserver \
mediaextractor \
mediametrics \
media_profiles_V1_0.dtd \
- MediaProvider \
+ MediaProviderLegacy \
mediaserver \
mke2fs \
monkey \
mtpd \
ndc \
netd \
- NetworkStack \
+ NativeAdbDataLoaderService \
+ NetworkStackNext \
org.apache.http.legacy \
otacerts \
PackageInstaller \
passwd_system \
perfetto \
- PermissionController \
ping \
ping6 \
platform.xml \
@@ -244,7 +252,6 @@
snapshotctl \
SoundPicker \
statsd \
- statsd-service \
storaged \
surfaceflinger \
svc \
@@ -266,7 +273,6 @@
vold \
WallpaperBackup \
watchdogd \
- InProcessWifiStack \
wificond \
wm \
@@ -317,23 +323,29 @@
# The order matters for runtime class lookup performance.
PRODUCT_BOOT_JARS := \
- $(TARGET_CORE_JARS) \
+ $(ART_APEX_JARS) \
framework-minus-apex \
ext \
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
+ framework-telephony
+PRODUCT_UPDATABLE_BOOT_JARS := \
+ com.android.appsearch:framework-appsearch \
+ com.android.conscrypt:conscrypt \
+ com.android.ipsec:ike \
+ com.android.media:updatable-media \
+ com.android.mediaprovider:framework-mediaprovider \
+ com.android.os.statsd:framework-statsd \
+ com.android.permission:framework-permission \
+ com.android.sdkext:framework-sdkextensions \
+ com.android.wifi:framework-wifi \
+ 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
@@ -346,10 +358,11 @@
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
+PRODUCT_SYSTEM_DEFAULT_PROPERTIES += persist.traced.enable=1
# Packages included only for eng or userdebug builds, previously debug tagged
PRODUCT_PACKAGES_DEBUG := \
diff --git a/target/product/base_system_ext.mk b/target/product/base_system_ext.mk
new file mode 100644
index 0000000..6847bfa
--- /dev/null
+++ b/target/product/base_system_ext.mk
@@ -0,0 +1,20 @@
+#
+# 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.
+#
+
+# Base modules and settings for the system_ext partition.
+PRODUCT_PACKAGES += \
+ group_system_ext \
+ passwd_system_ext \
diff --git a/target/product/base_vendor.mk b/target/product/base_vendor.mk
index 1657e71..471340b 100644
--- a/target/product/base_vendor.mk
+++ b/target/product/base_vendor.mk
@@ -40,8 +40,7 @@
# Base modules and settings for the vendor partition.
PRODUCT_PACKAGES += \
- android.hardware.cas@1.1-service \
- android.hardware.configstore@1.1-service \
+ android.hardware.cas@1.2-service \
android.hardware.media.omx@1.0-service \
boringssl_self_test_vendor \
dumpsys_vendor \
@@ -49,7 +48,6 @@
fs_config_dirs_nonsystem \
gralloc.default \
group_odm \
- group_system_ext \
group_vendor \
init_vendor \
libbundlewrapper \
@@ -65,16 +63,19 @@
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.
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..79451ad
--- /dev/null
+++ b/target/product/developer_gsi_keys.mk
@@ -0,0 +1,29 @@
+#
+# 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 \
diff --git a/target/product/emulated_storage.mk b/target/product/emulated_storage.mk
new file mode 100644
index 0000000..89de192
--- /dev/null
+++ b/target/product/emulated_storage.mk
@@ -0,0 +1,21 @@
+#
+# 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_QUOTA_PROJID := 1
+PRODUCT_PRODUCT_PROPERTIES += ro.emulated_storage.projid=1
+
+PRODUCT_FS_CASEFOLD := 1
+PRODUCT_PRODUCT_PROPERTIES += ro.emulated_storage.casefold=1
diff --git a/target/product/emulator.mk b/target/product/emulator.mk
index 52fa1a7..93c861f 100644
--- a/target/product/emulator.mk
+++ b/target/product/emulator.mk
@@ -50,12 +50,6 @@
#PRODUCT_DEFAULT_PROPERTY_OVERRIDES += \
#config.disable_location=true
-# Enable Perfetto traced
-# There is a stable property API for this prop so we can move it to /product.
-# https://android-review.googlesource.com/c/platform/system/libsysprop/+/952375
-PRODUCT_PRODUCT_PROPERTIES += \
- persist.traced.enable=1
-
# enable Google-specific location features,
# like NetworkLocationProvider and LocationCollector
PRODUCT_SYSTEM_EXT_PROPERTIES += \
diff --git a/target/product/emulator_vendor.mk b/target/product/emulator_vendor.mk
index 7891a26..a935d58 100644
--- a/target/product/emulator_vendor.mk
+++ b/target/product/emulator_vendor.mk
@@ -42,12 +42,6 @@
#PRODUCT_DEFAULT_PROPERTY_OVERRIDES += \
#config.disable_location=true
-# Enable Perfetto traced
-# There is a stable property API for this prop so we can move it to /product.
-# https://android-review.googlesource.com/c/platform/system/libsysprop/+/952375
-PRODUCT_PRODUCT_PROPERTIES += \
- persist.traced.enable=1
-
# enable Google-specific location features,
# like NetworkLocationProvider and LocationCollector
PRODUCT_SYSTEM_EXT_PROPERTIES += \
diff --git a/target/product/full_base.mk b/target/product/full_base.mk
index 447576c..ffd3cde 100644
--- a/target/product/full_base.mk
+++ b/target/product/full_base.mk
@@ -25,7 +25,8 @@
PRODUCT_PACKAGES += \
LiveWallpapersPicker \
- PhotoTable
+ PhotoTable \
+ preinstalled-packages-platform-full-base.xml
# Bluetooth:
# audio.a2dp.default is a system module. Generic system image includes
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 6bdcd60..64728f0 100644
--- a/target/product/go_defaults_common.mk
+++ b/target/product/go_defaults_common.mk
@@ -20,7 +20,6 @@
# Set lowram options and enable traced by default
PRODUCT_PROPERTY_OVERRIDES += \
ro.config.low_ram=true \
- persist.traced.enable=1 \
# Speed profile services and wifi-service to reduce RAM and storage.
PRODUCT_SYSTEM_SERVER_COMPILER_FILTER := speed-profile
@@ -39,8 +38,9 @@
# Do not spin up a separate process for the network stack on go devices, use an in-process APK.
PRODUCT_PACKAGES += InProcessNetworkStack
-PRODUCT_PACKAGES += InProcessWifiStack
PRODUCT_PACKAGES += CellBroadcastAppPlatform
+PRODUCT_PACKAGES += CellBroadcastServiceModulePlatform
+PRODUCT_PACKAGES += InProcessTethering
# 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.mk b/target/product/gsi/Android.mk
index 536fe0c..cf0d5c7 100644
--- a/target/product/gsi/Android.mk
+++ b/target/product/gsi/Android.mk
@@ -51,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
@@ -93,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.
@@ -104,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 $@
@@ -146,6 +163,7 @@
vndkcorevariant.libraries.txt \
$(addsuffix .vendor,$(VNDK_CORE_LIBRARIES)) \
$(addsuffix .vendor,$(VNDK_SAMEPROCESS_LIBRARIES)) \
+ $(VNDK_USING_CORE_VARIANT_LIBRARIES) \
com.android.vndk.current
endif
include $(BUILD_PHONY_PACKAGE)
@@ -158,14 +176,24 @@
_binder32 := _binder32
endif
endif
+_vndk_versions := $(PRODUCT_EXTRA_VNDK_VERSIONS)
+ifneq ($(BOARD_VNDK_VERSION),current)
+ _vndk_versions += $(BOARD_VNDK_VERSION)
+endif
# Phony targets are installed for **.libraries.txt files.
# TODO(b/141450808): remove following VNDK phony targets when **.libraries.txt files are provided by apexes.
LOCAL_REQUIRED_MODULES := \
- $(foreach vndk_ver,$(PRODUCT_EXTRA_VNDK_VERSIONS),vndk_v$(vndk_ver)_$(TARGET_ARCH)$(_binder32))
-LOCAL_REQUIRED_MODULES += $(foreach vndk_ver,$(PRODUCT_EXTRA_VNDK_VERSIONS),com.android.vndk.v$(vndk_ver))
+ $(foreach vndk_ver,$(_vndk_versions),vndk_v$(vndk_ver)_$(TARGET_ARCH)$(_binder32))
_binder32 :=
include $(BUILD_PHONY_PACKAGE)
+include $(CLEAR_VARS)
+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 4b5f780..5efdee4 100644
--- a/target/product/gsi/current.txt
+++ b/target/product/gsi/current.txt
@@ -17,6 +17,8 @@
LLNDK: libsync.so
LLNDK: libvndksupport.so
LLNDK: libvulkan.so
+VNDK-SP: android.hardware.common-V1-ndk_platform.so
+VNDK-SP: android.hardware.graphics.common-V1-ndk_platform.so
VNDK-SP: android.hardware.graphics.common@1.0.so
VNDK-SP: android.hardware.graphics.common@1.1.so
VNDK-SP: android.hardware.graphics.common@1.2.so
@@ -35,11 +37,11 @@
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
VNDK-SP: libcutils.so
+VNDK-SP: libgralloctypes.so
VNDK-SP: libhardware.so
VNDK-SP: libhidlbase.so
VNDK-SP: libhidlmemory.so
@@ -51,9 +53,11 @@
VNDK-SP: libutils.so
VNDK-SP: libutilscallstack.so
VNDK-SP: libz.so
+VNDK-core: android.frameworks.automotive.display@1.0.so
VNDK-core: android.frameworks.cameraservice.common@2.0.so
VNDK-core: android.frameworks.cameraservice.device@2.0.so
VNDK-core: android.frameworks.cameraservice.service@2.0.so
+VNDK-core: android.frameworks.cameraservice.service@2.1.so
VNDK-core: android.frameworks.displayservice@1.0.so
VNDK-core: android.frameworks.schedulerservice@1.0.so
VNDK-core: android.frameworks.sensorservice@1.0.so
@@ -73,15 +77,20 @@
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.audiocontrol@2.0.so
VNDK-core: android.hardware.automotive.can@1.0.so
VNDK-core: android.hardware.automotive.evs@1.0.so
VNDK-core: android.hardware.automotive.evs@1.1.so
+VNDK-core: android.hardware.automotive.occupant_awareness-V1-ndk_platform.so
VNDK-core: android.hardware.automotive.vehicle@2.0.so
VNDK-core: android.hardware.biometrics.face@1.0.so
+VNDK-core: android.hardware.biometrics.face@1.1.so
VNDK-core: android.hardware.biometrics.fingerprint@2.1.so
+VNDK-core: android.hardware.biometrics.fingerprint@2.2.so
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
@@ -93,12 +102,14 @@
VNDK-core: android.hardware.camera.device@3.3.so
VNDK-core: android.hardware.camera.device@3.4.so
VNDK-core: android.hardware.camera.device@3.5.so
+VNDK-core: android.hardware.camera.device@3.6.so
VNDK-core: android.hardware.camera.metadata@3.2.so
VNDK-core: android.hardware.camera.metadata@3.3.so
VNDK-core: android.hardware.camera.metadata@3.4.so
VNDK-core: android.hardware.camera.metadata@3.5.so
VNDK-core: android.hardware.camera.provider@2.4.so
VNDK-core: android.hardware.camera.provider@2.5.so
+VNDK-core: android.hardware.camera.provider@2.6.so
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
@@ -109,17 +120,22 @@
VNDK-core: android.hardware.confirmationui-support-lib.so
VNDK-core: android.hardware.confirmationui@1.0.so
VNDK-core: android.hardware.contexthub@1.0.so
+VNDK-core: android.hardware.contexthub@1.1.so
VNDK-core: android.hardware.drm@1.0.so
VNDK-core: android.hardware.drm@1.1.so
VNDK-core: android.hardware.drm@1.2.so
+VNDK-core: android.hardware.drm@1.3.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
+VNDK-core: android.hardware.gnss.measurement_corrections@1.1.so
VNDK-core: android.hardware.gnss.visibility_control@1.0.so
VNDK-core: android.hardware.gnss@1.0.so
VNDK-core: android.hardware.gnss@1.1.so
VNDK-core: android.hardware.gnss@2.0.so
+VNDK-core: android.hardware.gnss@2.1.so
VNDK-core: android.hardware.graphics.allocator@2.0.so
VNDK-core: android.hardware.graphics.allocator@3.0.so
VNDK-core: android.hardware.graphics.allocator@4.0.so
@@ -133,15 +149,20 @@
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-V1-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-V1-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
VNDK-core: android.hardware.media.c2@1.0.so
+VNDK-core: android.hardware.media.c2@1.1.so
VNDK-core: android.hardware.media.omx@1.0.so
VNDK-core: android.hardware.media@1.0.so
VNDK-core: android.hardware.memtrack@1.0.so
@@ -153,6 +174,7 @@
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
@@ -168,14 +190,18 @@
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.rebootescrow-V1-ndk_platform.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.sensors@2.1.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.soundtrigger@2.3.so
VNDK-core: android.hardware.tetheroffload.config@1.0.so
VNDK-core: android.hardware.tetheroffload.control@1.0.so
VNDK-core: android.hardware.thermal@1.0.so
@@ -186,18 +212,20 @@
VNDK-core: android.hardware.tv.input@1.0.so
VNDK-core: android.hardware.tv.tuner@1.0.so
VNDK-core: android.hardware.usb.gadget@1.0.so
+VNDK-core: android.hardware.usb.gadget@1.1.so
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
VNDK-core: android.hardware.vibrator@1.3.so
-VNDK-core: android.hardware.vibrator@1.4.so
VNDK-core: android.hardware.vr@1.0.so
VNDK-core: android.hardware.weaver@1.0.so
VNDK-core: android.hardware.wifi.hostapd@1.0.so
VNDK-core: android.hardware.wifi.hostapd@1.1.so
+VNDK-core: android.hardware.wifi.hostapd@1.2.so
VNDK-core: android.hardware.wifi.offload@1.0.so
VNDK-core: android.hardware.wifi.supplicant@1.0.so
VNDK-core: android.hardware.wifi.supplicant@1.1.so
@@ -220,6 +248,7 @@
VNDK-core: libaudioroute.so
VNDK-core: libaudioutils.so
VNDK-core: libbinder.so
+VNDK-core: libbufferqueueconverter.so
VNDK-core: libcamera_metadata.so
VNDK-core: libcap.so
VNDK-core: libcn-cbor.so
@@ -238,8 +267,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
@@ -255,12 +282,8 @@
VNDK-core: libpng.so
VNDK-core: libpower.so
VNDK-core: libprocinfo.so
-VNDK-core: libprotobuf-cpp-full-3.9.1.so
-VNDK-core: libprotobuf-cpp-lite-3.9.1.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
@@ -280,7 +303,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 645bc3a..adf7ca5 100644
--- a/target/product/gsi_arm64.mk
+++ b/target/product/gsi_arm64.mk
@@ -24,6 +24,12 @@
PRODUCT_ENFORCE_ARTIFACT_PATH_REQUIREMENTS := relaxed
#
+# 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/gsi_release.mk b/target/product/gsi_release.mk
index faaa935..a6dd418 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,6 +38,12 @@
# 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 \
diff --git a/target/product/handheld_product.mk b/target/product/handheld_product.mk
index 54dcaf2..2199c57 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,11 @@
DeskClock \
Gallery2 \
LatinIME \
- Launcher3QuickStep \
Music \
OneTimeInitializer \
- Provision \
+ preinstalled-packages-platform-handheld-product.xml \
QuickSearchBox \
- Settings \
SettingsIntelligence \
- StorageManager \
- SystemUI \
- WallpaperCropper \
frameworks-base-overlays
PRODUCT_PACKAGES_DEBUG += \
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
index 7900cdf..22436e6 100644
--- a/target/product/mainline.mk
+++ b/target/product/mainline.mk
@@ -16,11 +16,13 @@
# 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.
+# defaults for the system_ext, product and vendor partitions.
$(call inherit-product, $(SRC_TARGET_DIR)/product/mainline_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)
+$(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/mainline_system.mk b/target/product/mainline_system.mk
index f7eb8ad..f8d85bf 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 \
@@ -93,11 +96,6 @@
libhidltransport \
libhwbinder \
-# Camera service uses 'libdepthphoto' for adding dynamic depth
-# metadata inside depth jpegs.
-PRODUCT_PACKAGES += \
- libdepthphoto \
-
PRODUCT_PACKAGES_DEBUG += \
avbctl \
bootctl \
@@ -112,10 +110,10 @@
# Include all zygote init scripts. "ro.zygote" will select one of them.
PRODUCT_COPY_FILES += \
- system/core/rootdir/init.zygote32.rc:root/init.zygote32.rc \
- system/core/rootdir/init.zygote64.rc:root/init.zygote64.rc \
- system/core/rootdir/init.zygote32_64.rc:root/init.zygote32_64.rc \
- system/core/rootdir/init.zygote64_32.rc:root/init.zygote64_32.rc
+ 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.zygote32_64.rc:system/etc/init/hw/init.zygote32_64.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
@@ -125,6 +123,14 @@
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_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/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 0bc5800..76debb3 100644
--- a/target/product/media_system.mk
+++ b/target/product/media_system.mk
@@ -54,8 +54,15 @@
services \
ethernet-service \
com.android.location.provider \
- jobscheduler-service \
- statsd-service \
+ service-jobscheduler \
+ service-blobstore
+
+# 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.appsearch:service-appsearch \
+ com.android.permission:service-permission \
+ com.android.wifi:wifi-service
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 4a19ab4..b59feaf 100644
--- a/target/product/runtime_libart.mk
+++ b/target/product/runtime_libart.mk
@@ -93,7 +93,7 @@
dalvik.vm.minidebuginfo=true \
dalvik.vm.dex2oat-minidebuginfo=true
-# Disable iorapd by default
+# Enable iorapd by default
PRODUCT_SYSTEM_DEFAULT_PROPERTIES += \
ro.iorapd.enable=true
diff --git a/target/product/sdk_phone_x86.mk b/target/product/sdk_phone_x86.mk
index efb3c6e..9df26a9 100644
--- a/target/product/sdk_phone_x86.mk
+++ b/target/product/sdk_phone_x86.mk
@@ -27,6 +27,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/sdk_phone_x86_64.mk b/target/product/sdk_phone_x86_64.mk
index 2d0d6e1..862c66e 100644
--- a/target/product/sdk_phone_x86_64.mk
+++ b/target/product/sdk_phone_x86_64.mk
@@ -28,6 +28,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/security/com_google_android_permissioncontroller-container.x509.pem b/target/product/security/com_google_android_permissioncontroller-container.x509.pem
deleted file mode 100644
index 95f476f..0000000
--- a/target/product/security/com_google_android_permissioncontroller-container.x509.pem
+++ /dev/null
@@ -1,30 +0,0 @@
------BEGIN CERTIFICATE-----
-MIIGHDCCBASgAwIBAgIUQ6US4BMtEWcSr2vuqJ5tlHLrBuYwDQYJKoZIhvcNAQELBQAwgZ4xCzAJ
-BgNVBAYTAlVTMRMwEQYDVQQIEwpDYWxpZm9ybmlhMRYwFAYDVQQHEw1Nb3VudGFpbiBWaWV3MRQw
-EgYDVQQKEwtHb29nbGUgSW5jLjEQMA4GA1UECxMHQW5kcm9pZDE6MDgGA1UEAwwxY29tX2dvb2ds
-ZV9hbmRyb2lkX3Blcm1pc3Npb25jb250cm9sbGVyLWNvbnRhaW5lcjAeFw0xOTAyMDEwMzU2MDZa
-Fw00OTAyMDEwMzU2MDZaMIGeMQswCQYDVQQGEwJVUzETMBEGA1UECBMKQ2FsaWZvcm5pYTEWMBQG
-A1UEBxMNTW91bnRhaW4gVmlldzEUMBIGA1UEChMLR29vZ2xlIEluYy4xEDAOBgNVBAsTB0FuZHJv
-aWQxOjA4BgNVBAMMMWNvbV9nb29nbGVfYW5kcm9pZF9wZXJtaXNzaW9uY29udHJvbGxlci1jb250
-YWluZXIwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCFBJYVLl8bg+dW9nE2R7pnwPAA
-q6JpnMzYnQb4lycDxugACxiWRTZ7wUSpIv/QY3Mu/dv6GnWJhrRwJFhCq0jISzsmRwMMi7DFEujc
-osO80s6kVjaQ71yYqMRhw2IfSIphFU0YMEgcucNAUG/ELFBDsnqxHqVdLxGDQZAwJ/Iz30olEBS4
-26VuwlpZrbIku/k0IO0B5NdzvSAQJECo2uOzEhEgQFQlTE5Lku9MX1PsC+pkokIRcYiOkXoXT6Qk
-wSkP23bpvsjbjwNOgavPs8Pdx4tHfTs60ysOdbNpHl5dWlDKvKRelxxUPS9yjTRFd6U8MZN0Ldt1
-8k4bzuptQ1yXML4csFGjsbhapqzEEO267ULdrWz58L+C1Rx/fBIV1efZOkNfdrrgGTIfnD8kbI9j
-kLPPPhOuPgMl2huflB4CcLLGyk2h7BkTYn6tM16Q/+i/qHtph81GZqdeDZRG9dG/VFqR8vD6JwCS
-aVci28zmzBR1kUlWoSRk2xiQmv7/ZGtgKVXppipVVasR2XUr+z3AFJm41TPAqei9xqeA6eRUmBbs
-YS0q/zSBPef0zTyyrQQLhkSW/D5sELEg9lidbpMUwe+myE9yNXnvbsQbzJFHrPanVLLeY896opaV
-GSjiIMaJdWrcp9OOYZQHO7W05UWmDvQHKg7Un6OxdFL/TEaZAwIDAQABo1AwTjAMBgNVHRMEBTAD
-AQH/MB0GA1UdDgQWBBTuRKWeFsHYvfDR4eoKuuMEz3iJrTAfBgNVHSMEGDAWgBTuRKWeFsHYvfDR
-4eoKuuMEz3iJrTANBgkqhkiG9w0BAQsFAAOCAgEAY6ua1I9ERwbs6SXZFqMGe5oryg/3Kbhx5Q+z
-uL8B8Nr85Ez/DR6Lr9PNBqR4Mc0/Rb8f1lHlxx5DcKggT1YjbbM9aULdrGI+wpvDwHp6kCo1T58L
-xn97KeJbTMy5uogLiBabXIiScyDEzz2GpdajbgsI9Io1i+v9uDv/RFWnZV+C7l3ZEZ2klo8Elexo
-BFOD0WdAptxERyBF549URonUxq3UWLbUisg0j8P3yKe9lmhZwO2tUmxaKQGlL4LAGRsQ4kTgXCwN
-WWUMRIYcdmW4TxLZy/KDKwLc6ezik07Ifc5bHajY3OSzRtp17Hf3U+/LnQt5KZD6MuoQu7Rxh1Fv
-pbUAgsD4UPEjUcsEEa3BbIcSfN6l68mkbf7AioGaKvOKXx9DVrrQYfW4gy5vskFyRMbLw5iTQ3Od
-WdViiw3ZmrCtnZLnUQY29B/04Ma0ejrtSonEJBl2VIakpyM0g5gyOcg17vl9xrAoITkbMp26GcUd
-1DQOlyBI2Uct7KKM2d9nuIEJwHn6D2eboRBk0Y/XPeg8IDNDUMx6K2ArOL5RUkBz3oGCdPQkLT+b
-PIps1fAOCGbE6HEPB6OEcTZNv8XXnchEjdwocTUgjAtnDhuGqcooQnCFbPodXISJURNZb5QUH2Ic
-Q4BDiSNSs38AF9dzBaFoUowHUySA0wrVDjT5tC0=
------END CERTIFICATE-----
diff --git a/target/product/sysconfig/Android.bp b/target/product/sysconfig/Android.bp
new file mode 100644
index 0000000..5632d17
--- /dev/null
+++ b/target/product/sysconfig/Android.bp
@@ -0,0 +1,33 @@
+// 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.
+
+prebuilt_etc {
+ name: "preinstalled-packages-platform-aosp-product.xml",
+ product_specific: true,
+ sub_dir: "sysconfig",
+ src: "preinstalled-packages-platform-aosp-product.xml",
+}
+
+prebuilt_etc {
+ name: "preinstalled-packages-platform-full-base.xml",
+ sub_dir: "sysconfig",
+ src: "preinstalled-packages-platform-full-base.xml",
+}
+
+prebuilt_etc {
+ name: "preinstalled-packages-platform-handheld-product.xml",
+ product_specific: true,
+ sub_dir: "sysconfig",
+ src: "preinstalled-packages-platform-handheld-product.xml",
+}
\ No newline at end of file
diff --git a/target/product/sysconfig/preinstalled-packages-platform-aosp-product.xml b/target/product/sysconfig/preinstalled-packages-platform-aosp-product.xml
new file mode 100644
index 0000000..eec1326
--- /dev/null
+++ b/target/product/sysconfig/preinstalled-packages-platform-aosp-product.xml
@@ -0,0 +1,23 @@
+<?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.
+-->
+<!-- System packages to preinstall on all devices with aosp_product, per user type.
+ Documentation at frameworks/base/data/etc/preinstalled-packages-platform.xml
+-->
+<config>
+ <install-in-user-type package="com.android.wallpaperpicker">
+ <install-in user-type="FULL" />
+ </install-in-user-type>
+</config>
diff --git a/target/product/sysconfig/preinstalled-packages-platform-full-base.xml b/target/product/sysconfig/preinstalled-packages-platform-full-base.xml
new file mode 100644
index 0000000..f601355
--- /dev/null
+++ b/target/product/sysconfig/preinstalled-packages-platform-full-base.xml
@@ -0,0 +1,23 @@
+<?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.
+-->
+<!-- System packages to preinstall on all devices with full_base, per user type.
+ Documentation at frameworks/base/data/etc/preinstalled-packages-platform.xml
+-->
+<config>
+ <install-in-user-type package="com.android.wallpaper.livepicker">
+ <install-in user-type="FULL" />
+ </install-in-user-type>
+</config>
diff --git a/target/product/sysconfig/preinstalled-packages-platform-handheld-product.xml b/target/product/sysconfig/preinstalled-packages-platform-handheld-product.xml
new file mode 100644
index 0000000..a5d9ba2
--- /dev/null
+++ b/target/product/sysconfig/preinstalled-packages-platform-handheld-product.xml
@@ -0,0 +1,23 @@
+<?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.
+-->
+<!-- System packages to preinstall on all devices with handheld_product, per user type.
+ Documentation at frameworks/base/data/etc/preinstalled-packages-platform.xml
+-->
+<config>
+ <install-in-user-type package="com.android.wallpapercropper">
+ <install-in user-type="FULL" />
+ </install-in-user-type>
+</config>
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 c306a04..9c585b3 100644
--- a/target/product/telephony_system.mk
+++ b/target/product/telephony_system.mk
@@ -21,7 +21,6 @@
ONS \
CarrierDefaultApp \
CallLogBackup \
- CellBroadcastApp \
- CellBroadcastServiceModule \
+ com.android.cellbroadcast \
PRODUCT_COPY_FILES := \
diff --git a/target/product/telephony_system_ext.mk b/target/product/telephony_system_ext.mk
new file mode 100644
index 0000000..f81a607
--- /dev/null
+++ b/target/product/telephony_system_ext.mk
@@ -0,0 +1,23 @@
+#
+# 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 is the list of modules that are specific to products that have telephony
+# hardware, and install to the system_ext partition.
+
+# /system_ext packages
+PRODUCT_PACKAGES += \
+ CarrierConfig \
+ EmergencyInfo \
diff --git a/target/product/updatable_apex.mk b/target/product/updatable_apex.mk
index bdaf545..e5a647c 100644
--- a/target/product/updatable_apex.mk
+++ b/target/product/updatable_apex.mk
@@ -17,6 +17,7 @@
# Inherit this when the target needs to support updating APEXes
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/target/product/userspace_reboot.mk b/target/product/userspace_reboot.mk
new file mode 100644
index 0000000..76ec83d
--- /dev/null
+++ b/target/product/userspace_reboot.mk
@@ -0,0 +1,21 @@
+#
+# 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.
+#
+
+# Inherit this when the target supports userspace reboot
+
+PRODUCT_PROPERTY_OVERRIDES := ro.init.userspace_reboot.is_supported=true
+
+# TODO(b/135984674): configure userspace reboot related properties
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/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..8c7eb38
--- /dev/null
+++ b/tools/Android.bp
@@ -0,0 +1,26 @@
+// 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,
+ },
+ },
+}
diff --git a/tools/buildinfo.sh b/tools/buildinfo.sh
index 09d8f70..9bee115 100755
--- a/tools/buildinfo.sh
+++ b/tools/buildinfo.sh
@@ -11,7 +11,8 @@
echo "ro.build.version.preview_sdk_fingerprint=$PLATFORM_PREVIEW_SDK_FINGERPRINT"
echo "ro.build.version.codename=$PLATFORM_VERSION_CODENAME"
echo "ro.build.version.all_codenames=$PLATFORM_VERSION_ALL_CODENAMES"
-echo "ro.build.version.release=$PLATFORM_VERSION"
+echo "ro.build.version.release=$PLATFORM_VERSION_LAST_STABLE"
+echo "ro.build.version.release_or_codename=$PLATFORM_VERSION"
echo "ro.build.version.security_patch=$PLATFORM_SECURITY_PATCH"
echo "ro.build.version.base_os=$PLATFORM_BASE_OS"
echo "ro.build.version.min_supported_target_sdk=$PLATFORM_MIN_SUPPORTED_TARGET_SDK_VERSION"
diff --git a/tools/buildinfo_common.sh b/tools/buildinfo_common.sh
index 6041d79..673e06f 100755
--- a/tools/buildinfo_common.sh
+++ b/tools/buildinfo_common.sh
@@ -17,7 +17,8 @@
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.release=$PLATFORM_VERSION_LAST_STABLE"
+echo "ro.${partition}.build.version.release_or_codename=$PLATFORM_VERSION"
echo "ro.${partition}.build.version.sdk=$PLATFORM_SDK_VERSION"
echo "ro.product.${partition}.brand=$PRODUCT_BRAND"
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/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/releasetools/apex_utils.py b/tools/releasetools/apex_utils.py
index ee3c463..4fac6f3 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
@@ -41,6 +42,140 @@
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, payload_public_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.
+ payload_key: The path to the apex payload signing key.
+ payload_public_key: The path to the public key corresponding to the
+ payload signing key.
+
+ 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, payload_public_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, payload_public_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)
+
+ android_jar_path = common.OPTIONS.android_jar_path
+ if not android_jar_path:
+ android_jar_path = os.path.join(os.environ.get('ANDROID_BUILD_TOP', ''),
+ 'prebuilts', 'sdk', 'current', 'public',
+ 'android.jar')
+ logger.warning('android_jar_path not found in options, falling back to'
+ ' use %s', android_jar_path)
+
+ arguments_dict = {
+ 'manifest': os.path.join(apex_dir, 'apex_manifest.pb'),
+ 'build_info': os.path.join(apex_dir, 'apex_build_info.pb'),
+ 'android_jar_path': android_jar_path,
+ 'key': payload_key,
+ 'pubkey': payload_public_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)
+
+ repacked_apex = common.MakeTempFile(suffix='.apex')
+ repack_cmd = ['apexer', '--force', '--include_build_info',
+ '--do_not_check_keyname', '--apexer_tool_path',
+ os.getenv('PATH')]
+ for key, val in arguments_dict.items():
+ repack_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:
+ repack_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):
+ repack_cmd.extend(['--manifest_json', manifest_json])
+ assets_dir = os.path.join(apex_dir, 'assets')
+ if os.path.isdir(assets_dir):
+ repack_cmd.extend(['--assets_dir', assets_dir])
+ repack_cmd.extend([payload_dir, repacked_apex])
+ if OPTIONS.verbose:
+ repack_cmd.append('-v')
+ common.RunAndCheckOutput(repack_cmd)
+
+ return repacked_apex
+
+
def SignApexPayload(avbtool, payload_file, payload_key_path, payload_key_name,
algorithm, salt, no_hashtree, signing_args=None):
"""Signs a given payload_file with the payload key."""
@@ -155,7 +290,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 +299,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.
@@ -177,7 +314,15 @@
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.
+ payload_public_key = common.ExtractAvbPublicKey(avbtool, payload_key)
+ apk_signer = ApexApkSigner(apex_file, container_pw,
+ codename_to_api_level_map)
+ apex_file = apk_signer.ProcessApexFile(apk_keys, payload_key,
+ payload_public_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:
@@ -195,8 +340,7 @@
no_hashtree,
signing_args)
- # 1b. Update the embedded payload public key.
- payload_public_key = common.ExtractAvbPublicKey(avbtool, payload_key)
+ # 2b. Update the embedded payload public key.
common.ZipDelete(apex_file, APEX_PAYLOAD_IMAGE)
if APEX_PUBKEY in zip_items:
@@ -206,11 +350,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/build_image.py b/tools/releasetools/build_image.py
index af508fe..ed9183e 100755
--- a/tools/releasetools/build_image.py
+++ b/tools/releasetools/build_image.py
@@ -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))
@@ -519,6 +530,7 @@
common_props = (
"extfs_sparse_flag",
"squashfs_sparse_flag",
+ "f2fs_sparse_flag",
"skip_fsck",
"ext_mkuserimg",
"verity",
@@ -582,7 +594,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 +607,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")
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
index 04d832c..745c136 100644
--- a/tools/releasetools/check_partition_sizes.py
+++ b/tools/releasetools/check_partition_sizes.py
@@ -76,11 +76,17 @@
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
@@ -175,6 +181,14 @@
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
diff --git a/tools/releasetools/check_target_files_vintf.py b/tools/releasetools/check_target_files_vintf.py
index 543147c..f41df37 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']
diff --git a/tools/releasetools/common.py b/tools/releasetools/common.py
index 031db1d..2e235ee 100644
--- a/tools/releasetools/common.py
+++ b/tools/releasetools/common.py
@@ -62,13 +62,14 @@
'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(exec_path, '..'))
+ self.search_path = os.path.realpath(os.path.join(os.path.dirname(exec_path), '..'))
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
@@ -76,6 +77,10 @@
self.boot_signer_args = []
self.verity_signer_path = None
self.verity_signer_args = []
+ 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
@@ -87,6 +92,7 @@
# Stash size cannot exceed cache_size * threshold.
self.cache_size = None
self.stash_threshold = 0.8
+ self.logfile = None
OPTIONS = Options()
@@ -158,13 +164,14 @@
'default': {
'class': 'logging.StreamHandler',
'formatter': 'standard',
+ 'level': 'WARNING',
},
},
'loggers': {
'': {
'handlers': ['default'],
- 'level': 'WARNING',
'propagate': True,
+ 'level': 'INFO',
}
}
}
@@ -177,8 +184,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)
@@ -578,26 +596,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:
@@ -779,13 +790,7 @@
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:
@@ -793,18 +798,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.
@@ -813,27 +806,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
@@ -974,6 +970,12 @@
RunAndCheckOutput(cmd)
+ if OPTIONS.aftl_server is not None:
+ # Ensure the other AFTL parameters are set as well.
+ 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.'
+ assert OPTIONS.aftl_signer_helper is not None, 'No AFTL signer helper provided.'
+ # AFTL inclusion proof generation code will go here.
def _MakeRamdisk(sourcedir, fs_config_file=None):
ramdisk_img = tempfile.NamedTemporaryFile()
@@ -1241,7 +1243,7 @@
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"]
+ "--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():
@@ -1797,6 +1799,9 @@
-h (--help)
Display this usage message and exit.
+
+ --logfile <file>
+ Put verbose logs to specified file (regardless of --verbose option.)
"""
def Usage(docstring):
@@ -1819,10 +1824,11 @@
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="] +
+ "extra=", "logfile=", "aftl_server=", "aftl_key_path=",
+ "aftl_manufacturer_key_path=", "aftl_signer_helper="] +
list(extra_long_opts))
except getopt.GetoptError as err:
Usage(docstring)
@@ -1847,6 +1853,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",):
@@ -1859,11 +1867,21 @@
OPTIONS.verity_signer_path = a
elif o in ("--verity_signer_args",):
OPTIONS.verity_signer_args = shlex.split(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,)
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 544f996..eb68bc3 100755
--- a/tools/releasetools/merge_target_files.py
+++ b/tools/releasetools/merge_target_files.py
@@ -416,12 +416,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
@@ -480,11 +475,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')
diff --git a/tools/releasetools/sign_apex.py b/tools/releasetools/sign_apex.py
index f2daa46..b0128dc 100755
--- a/tools/releasetools/sign_apex.py
+++ b/tools/releasetools/sign_apex.py
@@ -31,6 +31,10 @@
--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.
"""
import logging
@@ -43,8 +47,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):
"""Signs the given apex file."""
with open(apex_file, 'rb') as input_fp:
apex_data = input_fp.read()
@@ -56,7 +60,8 @@
container_key=container_key,
container_pw=None,
codename_to_api_level_map=None,
- no_hashtree=False,
+ no_hashtree=no_hashtree,
+ apk_keys=apk_keys,
signing_args=signing_args)
@@ -77,18 +82,26 @@
options['payload_key'] = a
elif o == '--payload_extra_args':
options['payload_extra_args'] = a
+ 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=',
'container_key=',
'payload_extra_args=',
'payload_key=',
+ 'extra_apks=',
],
extra_option_handler=option_handler)
@@ -105,6 +118,7 @@
options['payload_key'],
options['container_key'],
no_hashtree=False,
+ apk_keys=options.get('extra_apks', {}),
signing_args=options.get('payload_extra_args'))
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 0f4f1da..cce771c 100755
--- a/tools/releasetools/sign_target_files_apks.py
+++ b/tools/releasetools/sign_target_files_apks.py
@@ -103,6 +103,9 @@
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.
+
+ --android_jar_path <path>
+ Path to the android.jar to repack the apex file.
"""
from __future__ import print_function
@@ -151,6 +154,7 @@
OPTIONS.avb_keys = {}
OPTIONS.avb_algorithms = {}
OPTIONS.avb_extra_args = {}
+OPTIONS.android_jar_path = None
AVB_FOOTER_ARGS_BY_PARTITION = {
@@ -492,6 +496,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'))
@@ -552,8 +557,13 @@
# 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.
@@ -972,6 +982,7 @@
devkeydir + "/media": d + "/media",
devkeydir + "/shared": d + "/shared",
devkeydir + "/platform": d + "/platform",
+ devkeydir + "/networkstack": d + "/networkstack",
})
else:
OPTIONS.key_map[s] = d
@@ -1241,6 +1252,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/test_apex_utils.py b/tools/releasetools/test_apex_utils.py
index 5d4cc77..07284ad 100644
--- a/tools/releasetools/test_apex_utils.py
+++ b/tools/releasetools/test_apex_utils.py
@@ -16,6 +16,7 @@
import os
import os.path
+import zipfile
import apex_utils
import common
@@ -32,6 +33,8 @@
# The default payload signing key.
self.payload_key = os.path.join(self.testdata_dir, 'testkey.key')
+ common.OPTIONS.search_path = test_utils.get_search_path()
+
@staticmethod
def _GetTestPayload():
payload_file = common.MakeTempFile(prefix='apex-', suffix='.img')
@@ -126,3 +129,67 @@
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,
+ None)
+ self.assertEqual(apex_path, processed_apex)
+
+ @test_utils.SkipIfExternalToolsUnavailable()
+ def test_ApexApkSigner_apkKeyNotPresent(self):
+ apex_path = os.path.join(self.testdata_dir, 'has_apk.apex')
+ signer = apex_utils.ApexApkSigner(apex_path, None, None)
+ self.assertRaises(apex_utils.ApexSigningError, signer.ProcessApexFile, {},
+ self.payload_key, None)
+
+ @test_utils.SkipIfExternalToolsUnavailable()
+ def test_ApexApkSigner_signApk(self):
+ apex_path = os.path.join(self.testdata_dir, 'has_apk.apex')
+ 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')
+ payload_pubkey = common.ExtractAvbPublicKey('avbtool',
+ self.payload_key)
+ signer.ProcessApexFile(apk_keys, self.payload_key, payload_pubkey)
+
+ @test_utils.SkipIfExternalToolsUnavailable()
+ def test_ApexApkSigner_noAssetDir(self):
+ apex_path = os.path.join(self.testdata_dir, 'has_apk.apex')
+ no_asset = common.MakeTempFile(suffix='.apex')
+ with zipfile.ZipFile(no_asset, 'w') as output_zip:
+ with zipfile.ZipFile(apex_path, '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')
+ payload_pubkey = common.ExtractAvbPublicKey('avbtool',
+ self.payload_key)
+ signer.ProcessApexFile(apk_keys, self.payload_key, payload_pubkey)
+
+ @test_utils.SkipIfExternalToolsUnavailable()
+ def test_ApexApkSigner_withSignerHelper(self):
+ apex_path = os.path.join(self.testdata_dir, 'has_apk.apex')
+ 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')
+ payload_pubkey = common.ExtractAvbPublicKey('avbtool', self.payload_key)
+
+ signing_helper = os.path.join(self.testdata_dir, 'signing_helper.sh')
+ os.chmod(signing_helper, 0o700)
+ payload_signer_args = '--signing_helper_with_files={}'.format(
+ signing_helper)
+ signer.ProcessApexFile(apk_keys, self.payload_key, payload_pubkey,
+ payload_signer_args)
diff --git a/tools/releasetools/test_check_partition_sizes.py b/tools/releasetools/test_check_partition_sizes.py
index 5482b1c..ed20873 100644
--- a/tools/releasetools/test_check_partition_sizes.py
+++ b/tools/releasetools/test_check_partition_sizes.py
@@ -92,3 +92,37 @@
""".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_common.py b/tools/releasetools/test_common.py
index 8a52419..53b5b76 100644
--- a/tools/releasetools/test_common.py
+++ b/tools/releasetools/test_common.py
@@ -1290,30 +1290,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)
@@ -1321,31 +1317,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)
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/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/validate_target_files.py b/tools/releasetools/validate_target_files.py
index 9c2bc51..1b918cc 100755
--- a/tools/releasetools/validate_target_files.py
+++ b/tools/releasetools/validate_target_files.py
@@ -350,7 +350,7 @@
# 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']
+ '--follow_chain_partitions']
# Append the args for chained partitions if any.
for partition in common.AVB_PARTITIONS + common.AVB_VBMETA_PARTITIONS:
diff --git a/tools/warn.py b/tools/warn.py
index 6218f93..22ac872 100755
--- a/tools/warn.py
+++ b/tools/warn.py
@@ -1,2717 +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_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 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"]},
- {'category': 'Protoc', 'severity': Severity.MEDIUM,
- 'description': 'Proto: Import not used',
- 'patterns': [r".*: warning: Import .*/.*\.proto but not used.$"]},
-
- # Kotlin warnings
- {'category': 'Kotlin', 'severity': Severity.MEDIUM,
- 'description': 'Kotlin: never used parameter or variable',
- 'patterns': [r".*: warning: (parameter|variable) '.*' 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_warn_py_and_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 True
- return False
-
-
-def find_android_root():
- """Guess android_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.
- global android_root
- warning_lines = set()
- warning_pattern = re.compile('^/[^ ]*/[^ ]*: warning: .*')
- count = 0
- infile = io.open(args.buildlog, mode='r', encoding='utf-8')
- for line in infile:
- if warning_pattern.match(line):
- warning_lines.add(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))
- if find_warn_py_and_android_root(path):
- return
- # Do not use common prefix of a small number of paths.
- if count > 10:
- root_path = os.path.commonprefix(warning_lines)
- if len(root_path) > 2 and root_path[len(root_path) - 1] == '/':
- android_root = root_path[:-1]
-
-
-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)
- # Remove known prefix of root path and normalize the suffix.
- if path[0] == '/' and android_root:
- return remove_android_root_prefix(path)
- 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():
- find_android_root()
- # 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/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/java_warn_patterns.py b/tools/warn/java_warn_patterns.py
new file mode 100644
index 0000000..80e2e1d
--- /dev/null
+++ b/tools/warn/java_warn_patterns.py
@@ -0,0 +1,790 @@
+# 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
+from .cpp_warn_patterns import compile_patterns
+# pylint:disable=g-importing-member
+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('CallbackName'),
+ medium('ExecutorRegistration'),
+ medium('JavaApiUsedByMainlineModule'),
+ medium('ListenerLast'),
+ medium('MissingBuildMethod'),
+ medium('NoByteOrShort'),
+ medium('OverlappingConstants'),
+ medium('SetterReturnsThis'),
+ medium('Typo'),
+ medium('UseIcu'),
+ 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('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..dd6a1b0
--- /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
+from .cpp_warn_patterns import compile_patterns
+# pylint:disable=g-importing-member
+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..1350936
--- /dev/null
+++ b/tools/warn/other_warn_patterns.py
@@ -0,0 +1,164 @@
+# 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
+from .cpp_warn_patterns import compile_patterns
+# pylint:disable=g-importing-member
+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_list):
+ return warn('Kotlin', Severity.MEDIUM, description, pattern_list)
+
+
+def yacc(description, pattern_list):
+ return warn('yacc', Severity.MEDIUM, description, pattern_list)
+
+
+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',
+ [r".*\.kt:.*: warning: (parameter|variable) '.*' is never used$",
+ r".*\.kt:.*: warning: (parameter|variable) '.*' is never used, could be renamed to _$"]),
+ kotlin('initializer is redundant',
+ [r".*\.kt:.*: warning: .* initializer is redundant$"]),
+ kotlin('elvis operator always returns ...',
+ [r".*\.kt:.*: warning: elvis operator \(\?:\) always returns .+"]),
+ kotlin('shadowed name',
+ [r".*\.kt:.*: warning: name shadowed: .+"]),
+ kotlin('unchecked cast',
+ [r".*\.kt:.*: warning: unchecked cast: .* to .*$"]),
+ kotlin('unnecessary safe call on a non-null receiver',
+ [r".*\.kt:.*: warning: unnecessary safe call on a non-null receiver"]),
+ kotlin('Deprecated in Java',
+ [r".*\.kt:.*: warning: '.*' is deprecated. Deprecated in Java"]),
+ kotlin('Replacing Handler for Executor',
+ [r".*\.kt:.*: warning: .+ Replacing Handler for Executor in "]),
+ kotlin('library has Kotlin runtime',
+ [r".*: warning: library has Kotlin runtime bundled into it",
+ r".*: warning: some JAR files .* have the Kotlin Runtime library"]),
+ # 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
+ {'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"]},
+ # 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..b1c38e4
--- /dev/null
+++ b/tools/warn/severity.py
@@ -0,0 +1,57 @@
+# 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 Severity:
+ """Class of Severity levels where each level is a SeverityInfo."""
+
+ class SeverityInfo:
+
+ def __init__(self, value, color, column_header, header):
+ self.value = value
+ self.color = color
+ self.column_header = column_header
+ self.header = header
+
+ # 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', 'Errors of unknown severity',
+ 'Unknown severity (should not occur)')
+ 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..2c5ab79
--- /dev/null
+++ b/tools/warn/tidy_warn_patterns.py
@@ -0,0 +1,206 @@
+# 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
+from .cpp_warn_patterns import compile_patterns
+# pylint:disable=g-importing-member
+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-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'),
+ 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..bdfd489
--- /dev/null
+++ b/tools/warn/warn.py
@@ -0,0 +1,38 @@
+#!/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
+
+# pylint:disable=relative-beyond-top-level
+# pylint:disable=g-importing-member
+from .warn_common import common_main
+
+
+# This parallel_process could be changed depending on platform
+# and availability of multi-process library functions.
+def parallel_process(num_cpu, classify_warnings, groups):
+ pool = multiprocessing.Pool(num_cpu)
+ return pool.map(classify_warnings, groups)
+
+
+def main():
+ common_main(parallel_process)
+
+
+if __name__ == '__main__':
+ main()
diff --git a/tools/warn/warn_common.py b/tools/warn/warn_common.py
new file mode 100755
index 0000000..0c9d9ef
--- /dev/null
+++ b/tools/warn/warn_common.py
@@ -0,0 +1,903 @@
+# 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.
+"""
+
+# 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_records array of [idx to warn_patterns,
+# idx to project_names,
+# idx to warning_messages]
+# android_root
+# platform_version
+# target_product
+# target_variant
+# 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: 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 argparse
+import cgi
+import csv
+import io
+import multiprocessing
+import os
+import re
+import signal
+import sys
+
+# pylint:disable=relative-beyond-top-level
+from . import cpp_warn_patterns
+from . import java_warn_patterns
+from . import make_warn_patterns
+from . import other_warn_patterns
+from . import tidy_warn_patterns
+# pylint:disable=g-importing-member
+from .android_project_list import project_list
+from .severity import Severity
+
+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()
+
+warn_patterns = make_warn_patterns.warn_patterns
+warn_patterns.extend(cpp_warn_patterns.warn_patterns)
+warn_patterns.extend(java_warn_patterns.warn_patterns)
+warn_patterns.extend(tidy_warn_patterns.warn_patterns)
+warn_patterns.extend(other_warn_patterns.warn_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'] = []
+ # 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 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):
+ writer('<html>\n<head>')
+ writer('<title>' + title + '</title>')
+ writer(html_head_scripts)
+ emit_stats_by_project(writer)
+ writer('</head>\n<body>')
+ writer(html_big(title))
+ writer('<p>')
+
+
+def dump_html_epilogue(writer):
+ writer('</body>\n</head>\n</html>')
+
+
+def sort_warnings():
+ for i in warn_patterns:
+ i['members'] = sorted(set(i['members']))
+
+
+def emit_stats_by_project(writer):
+ """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.value: 0 for s in Severity.levels} for p in project_names}
+ for i in warn_patterns:
+ # pytype: disable=attribute-error
+ s = i['severity'].value
+ # pytype: enable=attribute-error
+ 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.value] for s in Severity.levels)
+ for p in project_names
+ }
+
+ # total_by_severity[s] is number of warnings of severity s.
+ total_by_severity = {
+ s.value: sum(warnings[p][s.value] for p in project_names)
+ for s in Severity.levels
+ }
+
+ # emit table header
+ 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')
+
+ # 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.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]
+
+ # emit a row of warning counts per severity
+ 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 dump_stats(writer):
+ """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.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):
+ """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 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']:
+ # pytype: disable=attribute-error
+ 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
+ # pytype: enable=attribute-error
+
+
+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, parallel_process):
+ """Classify all warning lines with num_cpu parallel processes."""
+ num_cpu = args.processes
+ if num_cpu > 1:
+ groups = [[] for x in range(num_cpu)]
+ i = 0
+ for x in warning_lines:
+ groups[i].append(x)
+ i = (i + 1) % num_cpu
+ group_results = parallel_process(num_cpu, 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 find_warn_py_and_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 True
+ return False
+
+
+def find_android_root():
+ """Guess android_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.
+ global android_root
+ warning_lines = set()
+ warning_pattern = re.compile('^/[^ ]*/[^ ]*: warning: .*')
+ count = 0
+ infile = io.open(args.buildlog, mode='r', encoding='utf-8')
+ for line in infile:
+ if warning_pattern.match(line):
+ warning_lines.add(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))
+ if find_warn_py_and_android_root(path):
+ return
+ # 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] == '/':
+ android_root = root_path[:-1]
+
+
+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)
+ # Remove known prefix of root path and normalize the suffix.
+ if path[0] == '/' and android_root:
+ return remove_android_root_prefix(path)
+ 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):
+ # pytype: disable=attribute-error
+ return s.replace('\\', '\\\\').replace('"', '\\"')
+ # pytype: enable=attribute-error
+
+
+# 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):
+ writer('var warning_{} = ['.format(name))
+ for i in range(len(warn_patterns)):
+ writer('{},'.format(warn_patterns[i][name]))
+ writer('];')
+
+
+def emit_warning_arrays(writer):
+ emit_warning_array('severity', writer)
+ writer('var warning_description = [')
+ for i in range(len(warn_patterns)):
+ if warn_patterns[i]['members']:
+ writer('"{}",'.format(escape_string(warn_patterns[i]['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) {
+ 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, 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):
+ """Dump dynamic HTML page's static JavaScript data."""
+ emit_const_string('FlagURL',
+ args.url if args.url else '', writer)
+ emit_const_string('FlagSeparator',
+ args.separator if args.separator else '', 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)
+
+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(output_stream):
+ """Dump the html output to output_stream."""
+ writer = make_writer(output_stream)
+ dump_html_prologue('Warnings for ' + platform_version + ' - ' +
+ target_product + ' - ' + target_variant, writer)
+ dump_stats(writer)
+ writer('<br><div id="stats_table"></div><br>')
+ writer('\n<script>')
+ emit_js_data(writer)
+ 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 args.byproject:
+ writer('<script>groupByProject();</script>')
+ else:
+ writer('<script>groupBySeverity();</script>')
+ dump_fixed(writer)
+ dump_html_epilogue(writer)
+
+
+##### 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.
+ # pytype: disable=attribute-error
+ projects = sorted(i['projects'].keys())
+ # pytype: enable=attribute-error
+ 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.levels:
+ if s != Severity.SEVERITY_UNKNOWN:
+ total += count_severity(writer, s, s.column_header)
+ writer.writerow([total, '', 'All warnings'])
+
+
+def common_main(parallel_process):
+ """Real main function to classify warnings and generate .html file."""
+ find_android_root()
+ # 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, parallel_process)
+ # 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(sys.stdout)