diff options
156 files changed, 3930 insertions, 3106 deletions
diff --git a/Changes.md b/Changes.md index 2720a0f402..453ea6c7e0 100644 --- a/Changes.md +++ b/Changes.md @@ -1,5 +1,18 @@ # Build System Changes for Android.mk Writers +## ELF prebuilts in PRODUCT_COPY_FILES + +ELF prebuilts in PRODUCT_COPY_FILES that are installed into these paths are an +error: + +* `<partition>/bin/*` +* `<partition>/lib/*` +* `<partition>/lib64/*` + +Define prebuilt modules and add them to PRODUCT_PACKAGES instead. +To temporarily relax this check and restore the behavior prior to this change, +set `BUILD_BROKEN_ELF_PREBUILT_PRODUCT_COPY_FILES := true` in `BoardConfig.mk`. + ## COPY_HEADERS usage now produces warnings {#copy_headers} We've considered `BUILD_COPY_HEADERS`/`LOCAL_COPY_HEADERS` to be deprecated for diff --git a/CleanSpec.mk b/CleanSpec.mk index 3fc7cbcf02..67aca7c81a 100644 --- a/CleanSpec.mk +++ b/CleanSpec.mk @@ -748,6 +748,9 @@ $(call add-clean-step, rm -rf $(HOST_OUT)/framework/vts10-tradefed.jar) $(call add-clean-step, rm -rf $(HOST_OUT)/vts/*) $(call add-clean-step, rm -rf $(HOST_OUT)/framework/vts-tradefed.jar) +$(call add-clean-step, rm -rf $(PRODUCT_OUT)/vendor/default.prop) +$(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/etc/prop.default) + # ************************************************ # NEWER CLEAN STEPS MUST BE AT THE END OF THE LIST # ************************************************ diff --git a/Deprecation.md b/Deprecation.md index 2f936e3542..74b54fadd5 100644 --- a/Deprecation.md +++ b/Deprecation.md @@ -14,21 +14,21 @@ have any problems converting, please contact us via: | Module type | State | | -------------------------------- | --------- | -| `BUILD_AUX_EXECUTABLE` | Error | -| `BUILD_AUX_STATIC_LIBRARY` | Error | +| `BUILD_AUX_EXECUTABLE` | Obsolete | +| `BUILD_AUX_STATIC_LIBRARY` | Obsolete | | `BUILD_COPY_HEADERS` | Error | | `BUILD_HOST_EXECUTABLE` | Error | -| `BUILD_HOST_FUZZ_TEST` | Error | -| `BUILD_HOST_NATIVE_TEST` | Error | +| `BUILD_HOST_FUZZ_TEST` | Obsolete | +| `BUILD_HOST_NATIVE_TEST` | Obsolete | | `BUILD_HOST_SHARED_LIBRARY` | Error | -| `BUILD_HOST_SHARED_TEST_LIBRARY` | Error | +| `BUILD_HOST_SHARED_TEST_LIBRARY` | Obsolete | | `BUILD_HOST_STATIC_LIBRARY` | Error | -| `BUILD_HOST_STATIC_TEST_LIBRARY` | Error | -| `BUILD_HOST_TEST_CONFIG` | Error | -| `BUILD_NATIVE_BENCHMARK` | Error | -| `BUILD_SHARED_TEST_LIBRARY` | Error | -| `BUILD_STATIC_TEST_LIBRARY` | Error | -| `BUILD_TARGET_TEST_CONFIG` | Error | +| `BUILD_HOST_STATIC_TEST_LIBRARY` | Obsolete | +| `BUILD_HOST_TEST_CONFIG` | Obsolete | +| `BUILD_NATIVE_BENCHMARK` | Obsolete | +| `BUILD_SHARED_TEST_LIBRARY` | Obsolete | +| `BUILD_STATIC_TEST_LIBRARY` | Obsolete | +| `BUILD_TARGET_TEST_CONFIG` | Obsolete | | `BUILD_*` | Available | ## Module Type Deprecation Process diff --git a/core/Makefile b/core/Makefile index 4d4021d1e4..9d564ce385 100644 --- a/core/Makefile +++ b/core/Makefile @@ -39,6 +39,14 @@ $(if $(filter true,$(BUILD_BROKEN_VINTF_PRODUCT_COPY_FILES)),, \ use ODM_MANIFEST_FILES / vintf_fragments instead!)) \ ) endef + +check_elf_prebuilt_product_copy_files := true +ifneq (,$(filter true,$(BUILD_BROKEN_ELF_PREBUILT_PRODUCT_COPY_FILES))) +check_elf_prebuilt_product_copy_files := +endif +check_elf_prebuilt_product_copy_files_hint := \ + found ELF prebuilt in PRODUCT_COPY_FILES, use cc_prebuilt_binary / cc_prebuilt_library_shared instead. + # filter out the duplicate <source file>:<dest file> pairs. unique_product_copy_files_pairs := $(foreach cf,$(PRODUCT_COPY_FILES), \ @@ -59,7 +67,10 @@ $(foreach cf,$(unique_product_copy_files_pairs), \ $(eval $(call copy-and-uncompress-dexs,$(_src),$(_fulldest))), \ $(if $(filter init%rc,$(notdir $(_dest)))$(filter %/etc/init,$(dir $(_dest))),\ $(eval $(call copy-init-script-file-checked,$(_src),$(_fulldest))),\ - $(eval $(call copy-one-file,$(_src),$(_fulldest)))))) \ + $(if $(and $(filter true,$(check_elf_prebuilt_product_copy_files)), \ + $(filter bin lib lib64,$(subst /,$(space),$(_dest)))), \ + $(eval $(call copy-non-elf-file-checked,$(_src),$(_fulldest),$(check_elf_prebuilt_product_copy_files_hint))), \ + $(eval $(call copy-one-file,$(_src),$(_fulldest))))))) \ $(eval unique_product_copy_files_destinations += $(_dest)))) # Dump a list of overriden (and ignored PRODUCT_COPY_FILES entries) @@ -119,7 +130,7 @@ $(file >$(PRODUCT_OUT)/.copied_headers_list,$(TARGET_OUT_HEADERS) $(ALL_COPIED_H # ----------------------------------------------------------------- # docs/index.html -ifeq (,$(TARGET_BUILD_APPS)) +ifeq (,$(TARGET_BUILD_UNBUNDLED)) gen := $(OUT_DOCS)/index.html ALL_DOCS += $(gen) $(gen): frameworks/base/docs/docs-redirect-index.html @@ -150,341 +161,6 @@ endif $(call dist-for-goals,sdk,$(API_FINGERPRINT)) -# ----------------------------------------------------------------- -# property_overrides_split_enabled -property_overrides_split_enabled := -ifeq ($(BOARD_PROPERTY_OVERRIDES_SPLIT_ENABLED), true) - property_overrides_split_enabled := true -endif - -# ----------------------------------------------------------------- -# FINAL_VENDOR_DEFAULT_PROPERTIES will be installed in vendor/default.prop if -# property_overrides_split_enabled is true. Otherwise it will be installed in -# ROOT/default.prop. -ifdef BOARD_VNDK_VERSION - ifeq ($(BOARD_VNDK_VERSION),current) - FINAL_VENDOR_DEFAULT_PROPERTIES := ro.vndk.version=$(PLATFORM_VNDK_VERSION) - else - FINAL_VENDOR_DEFAULT_PROPERTIES := ro.vndk.version=$(BOARD_VNDK_VERSION) - endif - ifdef BOARD_VNDK_RUNTIME_DISABLE - FINAL_VENDOR_DEFAULT_PROPERTIES += ro.vndk.lite=true - endif -else - FINAL_VENDOR_DEFAULT_PROPERTIES := ro.vndk.version=$(PLATFORM_VNDK_VERSION) - FINAL_VENDOR_DEFAULT_PROPERTIES += ro.vndk.lite=true -endif -FINAL_VENDOR_DEFAULT_PROPERTIES += \ - $(call collapse-pairs, $(PRODUCT_DEFAULT_PROPERTY_OVERRIDES)) - -# Add cpu properties for bionic and ART. -FINAL_VENDOR_DEFAULT_PROPERTIES += ro.bionic.arch=$(TARGET_ARCH) -FINAL_VENDOR_DEFAULT_PROPERTIES += ro.bionic.cpu_variant=$(TARGET_CPU_VARIANT_RUNTIME) -FINAL_VENDOR_DEFAULT_PROPERTIES += ro.bionic.2nd_arch=$(TARGET_2ND_ARCH) -FINAL_VENDOR_DEFAULT_PROPERTIES += ro.bionic.2nd_cpu_variant=$(TARGET_2ND_CPU_VARIANT_RUNTIME) - -FINAL_VENDOR_DEFAULT_PROPERTIES += persist.sys.dalvik.vm.lib.2=libart.so -FINAL_VENDOR_DEFAULT_PROPERTIES += dalvik.vm.isa.$(TARGET_ARCH).variant=$(DEX2OAT_TARGET_CPU_VARIANT_RUNTIME) -ifneq ($(DEX2OAT_TARGET_INSTRUCTION_SET_FEATURES),) - FINAL_VENDOR_DEFAULT_PROPERTIES += dalvik.vm.isa.$(TARGET_ARCH).features=$(DEX2OAT_TARGET_INSTRUCTION_SET_FEATURES) -endif - -ifdef TARGET_2ND_ARCH - FINAL_VENDOR_DEFAULT_PROPERTIES += dalvik.vm.isa.$(TARGET_2ND_ARCH).variant=$($(TARGET_2ND_ARCH_VAR_PREFIX)DEX2OAT_TARGET_CPU_VARIANT_RUNTIME) - ifneq ($($(TARGET_2ND_ARCH_VAR_PREFIX)DEX2OAT_TARGET_INSTRUCTION_SET_FEATURES),) - FINAL_VENDOR_DEFAULT_PROPERTIES += dalvik.vm.isa.$(TARGET_2ND_ARCH).features=$($(TARGET_2ND_ARCH_VAR_PREFIX)DEX2OAT_TARGET_INSTRUCTION_SET_FEATURES) - endif -endif - -# Although these variables are prefixed with TARGET_RECOVERY_, they are also needed under charger -# mode (via libminui). -ifdef TARGET_RECOVERY_DEFAULT_ROTATION -FINAL_VENDOR_DEFAULT_PROPERTIES += \ - ro.minui.default_rotation=$(TARGET_RECOVERY_DEFAULT_ROTATION) -endif -ifdef TARGET_RECOVERY_OVERSCAN_PERCENT -FINAL_VENDOR_DEFAULT_PROPERTIES += \ - ro.minui.overscan_percent=$(TARGET_RECOVERY_OVERSCAN_PERCENT) -endif -ifdef TARGET_RECOVERY_PIXEL_FORMAT -FINAL_VENDOR_DEFAULT_PROPERTIES += \ - ro.minui.pixel_format=$(TARGET_RECOVERY_PIXEL_FORMAT) -endif -FINAL_VENDOR_DEFAULT_PROPERTIES := $(call uniq-pairs-by-first-component, \ - $(FINAL_VENDOR_DEFAULT_PROPERTIES),=) - -# ----------------------------------------------------------------- -# prop.default - -BUILDINFO_SH := build/make/tools/buildinfo.sh -BUILDINFO_COMMON_SH := build/make/tools/buildinfo_common.sh -POST_PROCESS_PROPS :=$= build/make/tools/post_process_props.py - -# Generates a set of sysprops common to all partitions to a file. -# $(1): Partition name -# $(2): Output file name -define generate-common-build-props - PRODUCT_BRAND="$(PRODUCT_BRAND)" \ - PRODUCT_DEVICE="$(TARGET_DEVICE)" \ - PRODUCT_MANUFACTURER="$(PRODUCT_MANUFACTURER)" \ - PRODUCT_MODEL="$(PRODUCT_MODEL)" \ - PRODUCT_NAME="$(TARGET_PRODUCT)" \ - $(call generate-common-build-props-with-product-vars-set,$(1),$(2)) -endef - -# Like the above macro, but requiring the relevant PRODUCT_ environment -# variables to be set when called. -define generate-common-build-props-with-product-vars-set - BUILD_FINGERPRINT="$(BUILD_FINGERPRINT_FROM_FILE)" \ - BUILD_ID="$(BUILD_ID)" \ - BUILD_NUMBER="$(BUILD_NUMBER_FROM_FILE)" \ - BUILD_VERSION_TAGS="$(BUILD_VERSION_TAGS)" \ - DATE="$(DATE_FROM_FILE)" \ - PLATFORM_SDK_VERSION="$(PLATFORM_SDK_VERSION)" \ - PLATFORM_VERSION_LAST_STABLE="$(PLATFORM_VERSION_LAST_STABLE)" \ - PLATFORM_VERSION="$(PLATFORM_VERSION)" \ - TARGET_BUILD_TYPE="$(TARGET_BUILD_VARIANT)" \ - bash $(BUILDINFO_COMMON_SH) "$(1)" >> $(2) -endef - -ifdef property_overrides_split_enabled -INSTALLED_DEFAULT_PROP_TARGET := $(TARGET_OUT)/etc/prop.default -INSTALLED_DEFAULT_PROP_OLD_TARGET := $(TARGET_ROOT_OUT)/default.prop -ALL_DEFAULT_INSTALLED_MODULES += $(INSTALLED_DEFAULT_PROP_OLD_TARGET) -$(INSTALLED_DEFAULT_PROP_OLD_TARGET): $(INSTALLED_DEFAULT_PROP_TARGET) -else -# legacy path -INSTALLED_DEFAULT_PROP_TARGET := $(TARGET_ROOT_OUT)/default.prop -endif -ALL_DEFAULT_INSTALLED_MODULES += $(INSTALLED_DEFAULT_PROP_TARGET) -FINAL_DEFAULT_PROPERTIES := \ - $(call collapse-pairs, $(ADDITIONAL_DEFAULT_PROPERTIES)) \ - $(call collapse-pairs, $(PRODUCT_SYSTEM_DEFAULT_PROPERTIES)) -ifndef property_overrides_split_enabled - FINAL_DEFAULT_PROPERTIES += \ - $(call collapse-pairs, $(FINAL_VENDOR_DEFAULT_PROPERTIES)) -endif -FINAL_DEFAULT_PROPERTIES := $(call uniq-pairs-by-first-component, \ - $(FINAL_DEFAULT_PROPERTIES),=) - -intermediate_system_build_prop := $(call intermediates-dir-for,ETC,system_build_prop)/build.prop - -$(INSTALLED_DEFAULT_PROP_TARGET): $(BUILDINFO_COMMON_SH) $(POST_PROCESS_PROPS) $(intermediate_system_build_prop) - @echo Target buildinfo: $@ - @mkdir -p $(dir $@) - @rm -f $@ - $(hide) echo "#" > $@; \ - echo "# ADDITIONAL_DEFAULT_PROPERTIES" >> $@; \ - echo "#" >> $@; - $(hide) $(foreach line,$(FINAL_DEFAULT_PROPERTIES), \ - echo "$(line)" >> $@;) - $(hide) $(POST_PROCESS_PROPS) $@ -ifdef property_overrides_split_enabled - $(hide) mkdir -p $(TARGET_ROOT_OUT) - $(hide) ln -sf system/etc/prop.default $(INSTALLED_DEFAULT_PROP_OLD_TARGET) -endif - -# ----------------------------------------------------------------- -# vendor default.prop -INSTALLED_VENDOR_DEFAULT_PROP_TARGET := -ifdef property_overrides_split_enabled -INSTALLED_VENDOR_DEFAULT_PROP_TARGET := $(TARGET_OUT_VENDOR)/default.prop -ALL_DEFAULT_INSTALLED_MODULES += $(INSTALLED_VENDOR_DEFAULT_PROP_TARGET) - -$(INSTALLED_VENDOR_DEFAULT_PROP_TARGET): $(INSTALLED_DEFAULT_PROP_TARGET) $(POST_PROCESS_PROPS) - @echo Target buildinfo: $@ - @mkdir -p $(dir $@) - $(hide) echo "#" > $@; \ - echo "# ADDITIONAL VENDOR DEFAULT PROPERTIES" >> $@; \ - echo "#" >> $@; - $(hide) $(foreach line,$(FINAL_VENDOR_DEFAULT_PROPERTIES), \ - echo "$(line)" >> $@;) - $(hide) $(POST_PROCESS_PROPS) $@ - -endif # property_overrides_split_enabled - -# ----------------------------------------------------------------- -# build.prop -INSTALLED_BUILD_PROP_TARGET := $(TARGET_OUT)/build.prop -ALL_DEFAULT_INSTALLED_MODULES += $(INSTALLED_BUILD_PROP_TARGET) -FINAL_BUILD_PROPERTIES := \ - $(call collapse-pairs, $(ADDITIONAL_BUILD_PROPERTIES)) -FINAL_BUILD_PROPERTIES := $(call uniq-pairs-by-first-component, \ - $(FINAL_BUILD_PROPERTIES),=) - -# A list of arbitrary tags describing the build configuration. -# Force ":=" so we can use += -BUILD_VERSION_TAGS := $(BUILD_VERSION_TAGS) -ifeq ($(TARGET_BUILD_TYPE),debug) - BUILD_VERSION_TAGS += debug -endif -# The "test-keys" tag marks builds signed with the old test keys, -# which are available in the SDK. "dev-keys" marks builds signed with -# non-default dev keys (usually private keys from a vendor directory). -# Both of these tags will be removed and replaced with "release-keys" -# when the target-files is signed in a post-build step. -ifeq ($(DEFAULT_SYSTEM_DEV_CERTIFICATE),build/make/target/product/security/testkey) -BUILD_KEYS := test-keys -else -BUILD_KEYS := dev-keys -endif -BUILD_VERSION_TAGS += $(BUILD_KEYS) -BUILD_VERSION_TAGS := $(subst $(space),$(comma),$(sort $(BUILD_VERSION_TAGS))) - -# A human-readable string that descibes this build in detail. -build_desc := $(TARGET_PRODUCT)-$(TARGET_BUILD_VARIANT) $(PLATFORM_VERSION) $(BUILD_ID) $(BUILD_NUMBER_FROM_FILE) $(BUILD_VERSION_TAGS) -$(intermediate_system_build_prop): PRIVATE_BUILD_DESC := $(build_desc) - -# The string used to uniquely identify the combined build and product; used by the OTA server. -ifeq (,$(strip $(BUILD_FINGERPRINT))) - ifeq ($(strip $(HAS_BUILD_NUMBER)),false) - BF_BUILD_NUMBER := $(BUILD_USERNAME)$$($(DATE_FROM_FILE) +%m%d%H%M) - else - BF_BUILD_NUMBER := $(file <$(BUILD_NUMBER_FILE)) - endif - BUILD_FINGERPRINT := $(PRODUCT_BRAND)/$(TARGET_PRODUCT)/$(TARGET_DEVICE):$(PLATFORM_VERSION)/$(BUILD_ID)/$(BF_BUILD_NUMBER):$(TARGET_BUILD_VARIANT)/$(BUILD_VERSION_TAGS) -endif -# unset it for safety. -BF_BUILD_NUMBER := - -BUILD_FINGERPRINT_FILE := $(PRODUCT_OUT)/build_fingerprint.txt -ifneq (,$(shell mkdir -p $(PRODUCT_OUT) && echo $(BUILD_FINGERPRINT) >$(BUILD_FINGERPRINT_FILE) && grep " " $(BUILD_FINGERPRINT_FILE))) - $(error BUILD_FINGERPRINT cannot contain spaces: "$(file <$(BUILD_FINGERPRINT_FILE))") -endif -BUILD_FINGERPRINT_FROM_FILE := $$(cat $(BUILD_FINGERPRINT_FILE)) -# unset it for safety. -BUILD_FINGERPRINT := - -# The string used to uniquely identify the system build; used by the OTA server. -# This purposefully excludes any product-specific variables. -ifeq (,$(strip $(BUILD_THUMBPRINT))) - BUILD_THUMBPRINT := $(PLATFORM_VERSION)/$(BUILD_ID)/$(BUILD_NUMBER_FROM_FILE):$(TARGET_BUILD_VARIANT)/$(BUILD_VERSION_TAGS) -endif - -BUILD_THUMBPRINT_FILE := $(PRODUCT_OUT)/build_thumbprint.txt -ifneq (,$(shell mkdir -p $(PRODUCT_OUT) && echo $(BUILD_THUMBPRINT) >$(BUILD_THUMBPRINT_FILE) && grep " " $(BUILD_THUMBPRINT_FILE))) - $(error BUILD_THUMBPRINT cannot contain spaces: "$(file <$(BUILD_THUMBPRINT_FILE))") -endif -BUILD_THUMBPRINT_FROM_FILE := $$(cat $(BUILD_THUMBPRINT_FILE)) -# unset it for safety. -BUILD_THUMBPRINT := - -KNOWN_OEM_THUMBPRINT_PROPERTIES := \ - ro.product.brand \ - ro.product.name \ - ro.product.device -OEM_THUMBPRINT_PROPERTIES := $(filter $(KNOWN_OEM_THUMBPRINT_PROPERTIES),\ - $(PRODUCT_OEM_PROPERTIES)) - -# Display parameters shown under Settings -> About Phone -ifeq ($(TARGET_BUILD_VARIANT),user) - # User builds should show: - # release build number or branch.buld_number non-release builds - - # Dev. branches should have DISPLAY_BUILD_NUMBER set - ifeq (true,$(DISPLAY_BUILD_NUMBER)) - BUILD_DISPLAY_ID := $(BUILD_ID).$(BUILD_NUMBER_FROM_FILE) $(BUILD_KEYS) - else - BUILD_DISPLAY_ID := $(BUILD_ID) $(BUILD_KEYS) - endif -else - # Non-user builds should show detailed build information - BUILD_DISPLAY_ID := $(build_desc) -endif - -# Accepts a whitespace separated list of product locales such as -# (en_US en_AU en_GB...) and returns the first locale in the list with -# underscores replaced with hyphens. In the example above, this will -# return "en-US". -define get-default-product-locale -$(strip $(subst _,-, $(firstword $(1)))) -endef - -# TARGET_BUILD_FLAVOR and ro.build.flavor are used only by the test -# harness to distinguish builds. Only add _asan for a sanitized build -# if it isn't already a part of the flavor (via a dedicated lunch -# config for example). -TARGET_BUILD_FLAVOR := $(TARGET_PRODUCT)-$(TARGET_BUILD_VARIANT) -ifneq (, $(filter address, $(SANITIZE_TARGET))) -ifeq (,$(findstring _asan,$(TARGET_BUILD_FLAVOR))) -TARGET_BUILD_FLAVOR := $(TARGET_BUILD_FLAVOR)_asan -endif -endif - -ifdef TARGET_SYSTEM_PROP -system_prop_file := $(TARGET_SYSTEM_PROP) -else -system_prop_file := $(wildcard $(TARGET_DEVICE_DIR)/system.prop) -endif -$(intermediate_system_build_prop): $(BUILDINFO_SH) $(BUILDINFO_COMMON_SH) $(INTERNAL_BUILD_ID_MAKEFILE) $(BUILD_SYSTEM)/version_defaults.mk $(system_prop_file) $(INSTALLED_ANDROID_INFO_TXT_TARGET) $(API_FINGERPRINT) $(POST_PROCESS_PROPS) - @echo Target buildinfo: $@ - @mkdir -p $(dir $@) - $(hide) echo > $@ -ifneq ($(PRODUCT_OEM_PROPERTIES),) - $(hide) echo "#" >> $@; \ - echo "# PRODUCT_OEM_PROPERTIES" >> $@; \ - echo "#" >> $@; - $(hide) $(foreach prop,$(PRODUCT_OEM_PROPERTIES), \ - echo "import /oem/oem.prop $(prop)" >> $@;) -endif - $(hide) PRODUCT_BRAND="$(PRODUCT_SYSTEM_BRAND)" \ - PRODUCT_MANUFACTURER="$(PRODUCT_SYSTEM_MANUFACTURER)" \ - PRODUCT_MODEL="$(PRODUCT_SYSTEM_MODEL)" \ - PRODUCT_NAME="$(PRODUCT_SYSTEM_NAME)" \ - PRODUCT_DEVICE="$(PRODUCT_SYSTEM_DEVICE)" \ - $(call generate-common-build-props-with-product-vars-set,system,$@) - $(hide) TARGET_BUILD_TYPE="$(TARGET_BUILD_VARIANT)" \ - TARGET_BUILD_FLAVOR="$(TARGET_BUILD_FLAVOR)" \ - TARGET_DEVICE="$(TARGET_DEVICE)" \ - PRODUCT_DEFAULT_LOCALE="$(call get-default-product-locale,$(PRODUCT_LOCALES))" \ - PRODUCT_DEFAULT_WIFI_CHANNELS="$(PRODUCT_DEFAULT_WIFI_CHANNELS)" \ - PRIVATE_BUILD_DESC="$(PRIVATE_BUILD_DESC)" \ - BUILD_ID="$(BUILD_ID)" \ - BUILD_DISPLAY_ID="$(BUILD_DISPLAY_ID)" \ - DATE="$(DATE_FROM_FILE)" \ - BUILD_USERNAME="$(BUILD_USERNAME)" \ - BUILD_HOSTNAME="$(BUILD_HOSTNAME)" \ - BUILD_NUMBER="$(BUILD_NUMBER_FROM_FILE)" \ - BOARD_BUILD_SYSTEM_ROOT_IMAGE="$(BOARD_BUILD_SYSTEM_ROOT_IMAGE)" \ - PLATFORM_VERSION="$(PLATFORM_VERSION)" \ - PLATFORM_VERSION_LAST_STABLE="$(PLATFORM_VERSION_LAST_STABLE)" \ - PLATFORM_SECURITY_PATCH="$(PLATFORM_SECURITY_PATCH)" \ - PLATFORM_BASE_OS="$(PLATFORM_BASE_OS)" \ - PLATFORM_SDK_VERSION="$(PLATFORM_SDK_VERSION)" \ - PLATFORM_PREVIEW_SDK_VERSION="$(PLATFORM_PREVIEW_SDK_VERSION)" \ - PLATFORM_PREVIEW_SDK_FINGERPRINT="$$(cat $(API_FINGERPRINT))" \ - PLATFORM_VERSION_CODENAME="$(PLATFORM_VERSION_CODENAME)" \ - PLATFORM_VERSION_ALL_CODENAMES="$(PLATFORM_VERSION_ALL_CODENAMES)" \ - PLATFORM_MIN_SUPPORTED_TARGET_SDK_VERSION="$(PLATFORM_MIN_SUPPORTED_TARGET_SDK_VERSION)" \ - BUILD_VERSION_TAGS="$(BUILD_VERSION_TAGS)" \ - $(if $(OEM_THUMBPRINT_PROPERTIES),BUILD_THUMBPRINT="$(BUILD_THUMBPRINT_FROM_FILE)") \ - TARGET_CPU_ABI_LIST="$(TARGET_CPU_ABI_LIST)" \ - TARGET_CPU_ABI_LIST_32_BIT="$(TARGET_CPU_ABI_LIST_32_BIT)" \ - TARGET_CPU_ABI_LIST_64_BIT="$(TARGET_CPU_ABI_LIST_64_BIT)" \ - TARGET_CPU_ABI="$(TARGET_CPU_ABI)" \ - TARGET_CPU_ABI2="$(TARGET_CPU_ABI2)" \ - bash $(BUILDINFO_SH) >> $@ - $(hide) $(foreach file,$(system_prop_file), \ - if [ -f "$(file)" ]; then \ - echo Target buildinfo from: "$(file)"; \ - echo "" >> $@; \ - echo "#" >> $@; \ - echo "# from $(file)" >> $@; \ - echo "#" >> $@; \ - cat $(file) >> $@; \ - echo "# end of $(file)" >> $@; \ - fi;) - $(if $(FINAL_BUILD_PROPERTIES), \ - $(hide) echo >> $@; \ - echo "#" >> $@; \ - echo "# ADDITIONAL_BUILD_PROPERTIES" >> $@; \ - echo "#" >> $@; ) - $(hide) $(foreach line,$(FINAL_BUILD_PROPERTIES), \ - echo "$(line)" >> $@;) - $(hide) $(POST_PROCESS_PROPS) $@ $(PRODUCT_SYSTEM_PROPERTY_BLACKLIST) - -build_desc := - INSTALLED_RECOVERYIMAGE_TARGET := ifdef BUILDING_RECOVERY_IMAGE ifneq ($(BOARD_USES_RECOVERY_AS_BOOT),true) @@ -492,198 +168,7 @@ INSTALLED_RECOVERYIMAGE_TARGET := $(PRODUCT_OUT)/recovery.img endif endif -$(INSTALLED_BUILD_PROP_TARGET): $(intermediate_system_build_prop) - @echo "Target build info: $@" - $(hide) grep -v 'ro.product.first_api_level' $(intermediate_system_build_prop) > $@ - -# ----------------------------------------------------------------- -# vendor build.prop -# -# For verifying that the vendor build is what we think it is -INSTALLED_VENDOR_BUILD_PROP_TARGET := $(TARGET_OUT_VENDOR)/build.prop -ALL_DEFAULT_INSTALLED_MODULES += $(INSTALLED_VENDOR_BUILD_PROP_TARGET) - -ifdef 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)) -FINAL_VENDOR_BUILD_PROPERTIES := $(call uniq-pairs-by-first-component, \ - $(FINAL_VENDOR_BUILD_PROPERTIES),=) -endif # property_overrides_split_enabled - -$(INSTALLED_VENDOR_BUILD_PROP_TARGET): $(BUILDINFO_COMMON_SH) $(POST_PROCESS_PROPS) $(intermediate_system_build_prop) $(vendor_prop_files) - @echo Target vendor buildinfo: $@ - @mkdir -p $(dir $@) - $(hide) echo > $@ -ifeq ($(PRODUCT_USE_DYNAMIC_PARTITIONS),true) - $(hide) echo ro.boot.dynamic_partitions=true >> $@ -endif -ifeq ($(PRODUCT_RETROFIT_DYNAMIC_PARTITIONS),true) - $(hide) echo ro.boot.dynamic_partitions_retrofit=true >> $@ -endif - $(hide) grep 'ro.product.first_api_level' $(intermediate_system_build_prop) >> $@ || true - $(hide) echo ro.vendor.build.security_patch="$(VENDOR_SECURITY_PATCH)">>$@ - $(hide) echo ro.vendor.product.cpu.abilist="$(TARGET_CPU_ABI_LIST)">>$@ - $(hide) echo ro.vendor.product.cpu.abilist32="$(TARGET_CPU_ABI_LIST_32_BIT)">>$@ - $(hide) echo ro.vendor.product.cpu.abilist64="$(TARGET_CPU_ABI_LIST_64_BIT)">>$@ - $(hide) echo ro.product.board="$(TARGET_BOOTLOADER_BOARD_NAME)">>$@ - $(hide) echo ro.board.platform="$(TARGET_BOARD_PLATFORM)">>$@ - $(hide) echo ro.hwui.use_vulkan="$(TARGET_USES_VULKAN)">>$@ -ifdef TARGET_SCREEN_DENSITY - $(hide) echo ro.sf.lcd_density="$(TARGET_SCREEN_DENSITY)">>$@ -endif -ifeq ($(AB_OTA_UPDATER),true) - $(hide) echo ro.build.ab_update=true >> $@ -endif - $(hide) $(call generate-common-build-props,vendor,$@) - $(hide) echo "#" >> $@; \ - echo "# BOOTIMAGE_BUILD_PROPERTIES" >> $@; \ - echo "#" >> $@; - $(hide) echo ro.bootimage.build.date=`$(DATE_FROM_FILE)`>>$@ - $(hide) echo ro.bootimage.build.date.utc=`$(DATE_FROM_FILE) +%s`>>$@ - $(hide) echo ro.bootimage.build.fingerprint="$(BUILD_FINGERPRINT_FROM_FILE)">>$@ - $(hide) echo "#" >> $@; \ - echo "# ADDITIONAL VENDOR BUILD PROPERTIES" >> $@; \ - echo "#" >> $@; - $(hide) cat $(INSTALLED_ANDROID_INFO_TXT_TARGET) | grep 'require version-' | sed -e 's/require version-/ro.build.expect./g' >> $@ -ifdef property_overrides_split_enabled - $(hide) $(foreach 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 - $(hide) $(POST_PROCESS_PROPS) $@ $(PRODUCT_VENDOR_PROPERTY_BLACKLIST) - -# ----------------------------------------------------------------- -# product build.prop -INSTALLED_PRODUCT_BUILD_PROP_TARGET := $(TARGET_OUT_PRODUCT)/build.prop -ALL_DEFAULT_INSTALLED_MODULES += $(INSTALLED_PRODUCT_BUILD_PROP_TARGET) - -ifdef TARGET_PRODUCT_PROP -product_prop_files := $(TARGET_PRODUCT_PROP) -else -product_prop_files := $(wildcard $(TARGET_DEVICE_DIR)/product.prop) -endif - -FINAL_PRODUCT_PROPERTIES += \ - $(call collapse-pairs, $(PRODUCT_PRODUCT_PROPERTIES) $(ADDITIONAL_PRODUCT_PROPERTIES)) -FINAL_PRODUCT_PROPERTIES := $(call uniq-pairs-by-first-component, \ - $(FINAL_PRODUCT_PROPERTIES),=) - -$(INSTALLED_PRODUCT_BUILD_PROP_TARGET): $(BUILDINFO_COMMON_SH) $(POST_PROCESS_PROPS) $(product_prop_files) - @echo Target product buildinfo: $@ - @mkdir -p $(dir $@) - $(hide) echo > $@ - $(hide) $(call generate-common-build-props,product,$@) - $(hide) $(foreach file,$(product_prop_files), \ - if [ -f "$(file)" ]; then \ - echo Target product properties from: "$(file)"; \ - echo "" >> $@; \ - echo "#" >> $@; \ - echo "# from $(file)" >> $@; \ - echo "#" >> $@; \ - cat $(file) >> $@; \ - echo "# end of $(file)" >> $@; \ - fi;) - $(hide) echo "#" >> $@; \ - echo "# ADDITIONAL PRODUCT PROPERTIES" >> $@; \ - echo "#" >> $@; \ - echo "ro.build.characteristics=$(TARGET_AAPT_CHARACTERISTICS)" >> $@; - $(hide) $(foreach line,$(FINAL_PRODUCT_PROPERTIES), \ - echo "$(line)" >> $@;) - $(hide) $(POST_PROCESS_PROPS) $@ - -# ---------------------------------------------------------------- -# odm build.prop -INSTALLED_ODM_BUILD_PROP_TARGET := $(TARGET_OUT_ODM)/etc/build.prop -ALL_DEFAULT_INSTALLED_MODULES += $(INSTALLED_ODM_BUILD_PROP_TARGET) - -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) $(odm_prop_files) - @echo Target odm buildinfo: $@ - @mkdir -p $(dir $@) - $(hide) echo > $@ - $(hide) echo ro.odm.product.cpu.abilist="$(TARGET_CPU_ABI_LIST)">>$@ - $(hide) echo ro.odm.product.cpu.abilist32="$(TARGET_CPU_ABI_LIST_32_BIT)">>$@ - $(hide) echo ro.odm.product.cpu.abilist64="$(TARGET_CPU_ABI_LIST_64_BIT)">>$@ - $(hide) $(call generate-common-build-props,odm,$@) - $(hide) $(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 "#" >> $@; - $(hide) $(foreach line,$(FINAL_ODM_BUILD_PROPERTIES), \ - echo "$(line)" >> $@;) - $(hide) $(POST_PROCESS_PROPS) $@ - -# ----------------------------------------------------------------- -# system_ext build.prop -INSTALLED_SYSTEM_EXT_BUILD_PROP_TARGET := $(TARGET_OUT_SYSTEM_EXT)/build.prop -ALL_DEFAULT_INSTALLED_MODULES += $(INSTALLED_SYSTEM_EXT_BUILD_PROP_TARGET) - -ifdef TARGET_SYSTEM_EXT_PROP -system_ext_prop_files := $(TARGET_SYSTEM_EXT_PROP) -else -system_ext_prop_files := $(wildcard $(TARGET_DEVICE_DIR)/system_ext.prop) -endif - -FINAL_SYSTEM_EXT_PROPERTIES += \ - $(call collapse-pairs, $(PRODUCT_SYSTEM_EXT_PROPERTIES)) -FINAL_SYSTEM_EXT_PROPERTIES := $(call uniq-pairs-by-first-component, \ - $(FINAL_SYSTEM_EXT_PROPERTIES),=) - -$(INSTALLED_SYSTEM_EXT_BUILD_PROP_TARGET): $(BUILDINFO_COMMON_SH) $(POST_PROCESS_PROPS) $(system_ext_prop_files) - @echo Target system_ext buildinfo: $@ - @mkdir -p $(dir $@) - $(hide) echo > $@ - $(hide) $(call generate-common-build-props,system_ext,$@) - $(hide) $(foreach file,$(system_ext_prop_files), \ - if [ -f "$(file)" ]; then \ - echo Target system_ext properties from: "$(file)"; \ - echo "" >> $@; \ - echo "#" >> $@; \ - echo "# from $(file)" >> $@; \ - echo "#" >> $@; \ - cat $(file) >> $@; \ - echo "# end of $(file)" >> $@; \ - fi;) - $(hide) echo "#" >> $@; \ - echo "# ADDITIONAL SYSTEM_EXT BUILD PROPERTIES" >> $@; \ - echo "#" >> $@; - $(hide) $(foreach line,$(FINAL_SYSTEM_EXT_PROPERTIES), \ - echo "$(line)" >> $@;) - $(hide) $(POST_PROCESS_PROPS) $@ +include $(BUILD_SYSTEM)/sysprop.mk # ---------------------------------------------------------------- @@ -1045,7 +530,7 @@ $(all_event_log_tags_file): $(all_event_log_tags_src) $(pdk_fusion_log_tags_file # directory). event_log_tags_src := \ $(sort $(foreach m,\ - $(PRODUCT_PACKAGES) \ + $(call resolve-bitness-for-modules,TARGET,$(PRODUCT_PACKAGES)) \ $(call module-names-for-tag-list,user), \ $(ALL_MODULES.$(m).EVENT_LOG_TAGS)) \ $(filter-out vendor/% device/% out/%,$(all_event_log_tags_src))) @@ -1350,7 +835,7 @@ $(INSTALLED_VENDOR_BOOTIMAGE_TARGET): $(MKBOOTIMG) $(INTERNAL_VENDOR_RAMDISK_TAR ifeq ($(BOARD_AVB_ENABLE),true) $(INSTALLED_VENDOR_BOOTIMAGE_TARGET): $(AVBTOOL) $(BOARD_AVB_VENDOR_BOOTIMAGE_KEY_PATH) $(call pretty,"Target vendor_boot image: $@") - $(MKBOOTIMG) $(INTERNAL_VENDOR_BOOTIMAGE_ARGS) $(INTERNAL_MKBOOTIMG_VERSION_ARGS) $(BOARD_MKBOOTIMG_ARGS) --vendor_ramdisk $(INTERNAL_VENDOR_RAMDISK_TARGET) --vendor_boot $@ + $(MKBOOTIMG) $(INTERNAL_VENDOR_BOOTIMAGE_ARGS) $(BOARD_MKBOOTIMG_ARGS) --vendor_ramdisk $(INTERNAL_VENDOR_RAMDISK_TARGET) --vendor_boot $@ $(call assert-max-image-size,$@,$(BOARD_VENDOR_BOOTIMAGE_PARTITION_SIZE)) $(AVBTOOL) add_hash_footer \ --image $@ \ @@ -1360,7 +845,7 @@ $(INSTALLED_VENDOR_BOOTIMAGE_TARGET): $(AVBTOOL) $(BOARD_AVB_VENDOR_BOOTIMAGE_KE else $(INSTALLED_VENDOR_BOOTIMAGE_TARGET): $(call pretty,"Target vendor_boot image: $@") - $(MKBOOTIMG) $(INTERNAL_VENDOR_BOOTIMAGE_ARGS) $(INTERNAL_MKBOOTIMG_VERSION_ARGS) $(BOARD_MKBOOTIMG_ARGS) --vendor_ramdisk $(INTERNAL_VENDOR_RAMDISK_TARGET) --vendor_boot $@ + $(MKBOOTIMG) $(INTERNAL_VENDOR_BOOTIMAGE_ARGS) $(BOARD_MKBOOTIMG_ARGS) --vendor_ramdisk $(INTERNAL_VENDOR_RAMDISK_TARGET) --vendor_boot $@ $(call assert-max-image-size,$@,$(BOARD_VENDOR_BOOTIMAGE_PARTITION_SIZE)) endif endif # BUILDING_VENDOR_BOOT_IMAGE @@ -1388,6 +873,7 @@ endif # BUILDING_VENDOR_BOOT_IMAGE # $(5) - Directory to use. Notice files are all $(5)/src. Other # directories in there will be used for scratch # $(6) - Dependencies for the output files +# $(7) - Directories to exclude # # The algorithm here is that we go collect a hash for each of the notice # files and write the names of the files that match that hash. Then @@ -1401,11 +887,11 @@ endif # BUILDING_VENDOR_BOOT_IMAGE # original notice files instead of making rules to copy them somwehere. # Then we could traverse that without quite as much bash drama. define combine-notice-files -$(2) $(3): PRIVATE_MESSAGE := $(4) -$(2) $(3): PRIVATE_DIR := $(5) -$(2) : $(3) -$(3) : $(6) $(BUILD_SYSTEM)/Makefile build/make/tools/generate-notice-files.py - build/make/tools/generate-notice-files.py --text-output $(2) \ +$(2): PRIVATE_MESSAGE := $(4) +$(2): PRIVATE_DIR := $(5) +$(2): .KATI_IMPLICIT_OUTPUTS := $(3) +$(2): $(6) $(BUILD_SYSTEM)/Makefile build/make/tools/generate-notice-files.py + build/make/tools/generate-notice-files.py --text-output $(2) $(foreach xdir, $(7), -e $(xdir) )\ $(if $(filter $(1),xml_excluded_vendor_product_odm),-e vendor -e product -e system_ext -e odm --xml-output, \ $(if $(filter $(1),xml_excluded_system_product_odm),-e system -e product -e system_ext -e odm --xml-output, \ $(if $(filter $(1),xml_product),-i product --xml-output, \ @@ -1430,6 +916,11 @@ kernel_notice_file := $(TARGET_OUT_NOTICE_FILES)/src/kernel.txt winpthreads_notice_file := $(TARGET_OUT_NOTICE_FILES)/src/winpthreads.txt pdk_fusion_notice_files := $(filter $(TARGET_OUT_NOTICE_FILES)/%, $(ALL_PDK_FUSION_FILES)) +# Some targets get included under $(PRODUCT_OUT) for debug symbols or other +# reasons--not to be flashed onto any device. Targets under these directories +# need no associated notice file on the device UI. +exclude_target_dirs := apex + # TODO(b/69865032): Make PRODUCT_NOTICE_SPLIT the default behavior. ifneq ($(PRODUCT_NOTICE_SPLIT),true) target_notice_file_html := $(TARGET_OUT_INTERMEDIATES)/NOTICE.html @@ -1440,7 +931,8 @@ $(eval $(call combine-notice-files, html, \ $(target_notice_file_html), \ "Notices for files contained in the filesystem images in this directory:", \ $(TARGET_OUT_NOTICE_FILES), \ - $(ALL_DEFAULT_INSTALLED_MODULES) $(kernel_notice_file) $(pdk_fusion_notice_files))) + $(ALL_DEFAULT_INSTALLED_MODULES) $(kernel_notice_file) $(pdk_fusion_notice_files), \ + $(exclude_target_dirs))) $(target_notice_file_html_gz): $(target_notice_file_html) | $(MINIGZIP) $(hide) $(MINIGZIP) -9 < $< > $@ $(installed_notice_html_or_xml_gz): $(target_notice_file_html_gz) @@ -1474,10 +966,13 @@ installed_odm_notice_xml_gz := $(TARGET_OUT_ODM)/etc/NOTICE.xml.gz # being built. A notice xml file must depend on all modules that could potentially # install a license file relevant to it. license_modules := $(ALL_DEFAULT_INSTALLED_MODULES) $(kernel_notice_file) $(pdk_fusion_notice_files) +# Only files copied to a system image need system image notices. +license_modules := $(filter $(PRODUCT_OUT)/%,$(license_modules)) # Phonys/fakes don't have notice files (though their deps might) license_modules := $(filter-out $(TARGET_OUT_FAKE)/%,$(license_modules)) # testcases are not relevant to the system image. license_modules := $(filter-out $(TARGET_OUT_TESTCASES)/%,$(license_modules)) +# filesystem images: system, vendor, product, system_ext, and odm license_modules_system := $(filter $(TARGET_OUT)/%,$(license_modules)) # system_other is relevant to system partition. license_modules_system += $(filter $(TARGET_OUT_SYSTEM_OTHER)/%,$(license_modules)) @@ -1490,16 +985,44 @@ license_modules_agg := $(license_modules_system) \ $(license_modules_product) \ $(license_modules_system_ext) \ $(license_modules_odm) +# targets used for debug symbols only and do not get copied to the device +license_modules_symbols_only := $(filter $(PRODUCT_OUT)/apex/%,$(license_modules)) + license_modules_rest := $(filter-out $(license_modules_agg),$(license_modules)) +license_modules_rest := $(filter-out $(license_modules_symbols_only),$(license_modules_rest)) + +# Identify the other targets we expect to have notices for: +# targets copied to the device but are not readable by the UI (e.g. must boot +# into a different partition to read or don't have an associated /etc +# directory) must have their notices built somewhere readable. +license_modules_rehomed := $(filter-out $(PRODUCT_OUT)/%/%,$(license_modules_rest)) # files in root have no /etc +license_modules_rehomed += $(filter $(PRODUCT_OUT)/recovery/%,$(license_modules_rest)) +license_modules_rehomed += $(filter $(PRODUCT_OUT)/root/%,$(license_modules_rest)) +license_modules_rehomed += $(filter $(PRODUCT_OUT)/data/%,$(license_modules_rest)) +license_modules_rehomed += $(filter $(PRODUCT_OUT)/ramdisk/%,$(license_modules_rest)) +license_modules_rehomed += $(filter $(PRODUCT_OUT)/debug_ramdisk/%,$(license_modules_rest)) +license_modules_rehomed += $(filter $(PRODUCT_OUT)/vendor-ramdisk/%,$(license_modules_rest)) +license_modules_rehomed += $(filter $(PRODUCT_OUT)/persist/%,$(license_modules_rest)) +license_modules_rehomed += $(filter $(PRODUCT_OUT)/persist.img,$(license_modules_rest)) +license_modules_rehomed += $(filter $(PRODUCT_OUT)/system_other/%,$(license_modules_rest)) +license_modules_rehomed += $(filter $(PRODUCT_OUT)/kernel%,$(license_modules_rest)) +license_modules_rehomed += $(filter $(PRODUCT_OUT)/%.img,$(license_modules_rest)) +license_modules_rehomed += $(filter $(PRODUCT_OUT)/%.bin,$(license_modules_rest)) + +# after removing targets in system images, targets reported in system images, and +# targets used for debug symbols that do not need notices, nothing must remain. +license_modules_rest := $(filter-out $(license_modules_rehomed),$(license_modules_rest)) +$(call maybe-print-list-and-error, $(license_modules_rest), \ + "Targets added under $(PRODUCT_OUT)/ unaccounted for notice handling.") # If we are building in a configuration that includes a prebuilt vendor.img, we can't # update its notice file, so include those notices in the system partition instead ifdef BOARD_PREBUILT_VENDORIMAGE -license_modules_system += $(license_modules_rest) +license_modules_system += $(license_modules_rehomed) system_xml_directories := xml_excluded_vendor_product_odm system_notice_file_message := "Notices for files contained in all filesystem images except vendor/system_ext/product/odm in this directory:" else -license_modules_vendor += $(license_modules_rest) +license_modules_vendor += $(license_modules_rehomed) system_xml_directories := xml_system system_notice_file_message := "Notices for files contained in the system filesystem image in this directory:" endif @@ -1509,31 +1032,36 @@ $(eval $(call combine-notice-files, $(system_xml_directories), \ $(target_notice_file_xml), \ $(system_notice_file_message), \ $(TARGET_OUT_NOTICE_FILES), \ - $(license_modules_system))) + $(license_modules_system), \ + $(exclude_target_dirs))) $(eval $(call combine-notice-files, xml_excluded_system_product_odm, \ $(target_vendor_notice_file_txt), \ $(target_vendor_notice_file_xml), \ "Notices for files contained in all filesystem images except system/system_ext/product/odm in this directory:", \ $(TARGET_OUT_NOTICE_FILES), \ - $(license_modules_vendor))) + $(license_modules_vendor), \ + $(exclude_target_dirs))) $(eval $(call combine-notice-files, xml_product, \ $(target_product_notice_file_txt), \ $(target_product_notice_file_xml), \ "Notices for files contained in the product filesystem image in this directory:", \ $(TARGET_OUT_NOTICE_FILES), \ - $(license_modules_product))) + $(license_modules_product), \ + $(exclude_target_dirs))) $(eval $(call combine-notice-files, xml_system_ext, \ $(target_system_ext_notice_file_txt), \ $(target_system_ext_notice_file_xml), \ "Notices for files contained in the system_ext filesystem image in this directory:", \ $(TARGET_OUT_NOTICE_FILES), \ - $(license_modules_system_ext))) + $(license_modules_system_ext), \ + $(exclude_target_dirs))) $(eval $(call combine-notice-files, xml_odm, \ $(target_odm_notice_file_txt), \ $(target_odm_notice_file_xml), \ "Notices for files contained in the odm filesystem image in this directory:", \ $(TARGET_OUT_NOTICE_FILES), \ - $(license_modules_odm))) + $(license_modules_odm), \ + $(exclude_target_dirs))) $(target_notice_file_xml_gz): $(target_notice_file_xml) | $(MINIGZIP) $(hide) $(MINIGZIP) -9 < $< > $@ @@ -1571,7 +1099,8 @@ $(eval $(call combine-notice-files, html, \ "Notices for files contained in the tools directory:", \ $(HOST_OUT_NOTICE_FILES), \ $(ALL_DEFAULT_INSTALLED_MODULES) \ - $(winpthreads_notice_file))) + $(winpthreads_notice_file), \ + $(exclude_target_dirs))) endif # TARGET_BUILD_APPS @@ -1910,7 +1439,7 @@ IGNORE_RECOVERY_SEPOLICY := $(patsubst $(TARGET_RECOVERY_OUT)/%,--exclude=/%,$(r recovery_kernel := $(INSTALLED_KERNEL_TARGET) # same as a non-recovery system recovery_ramdisk := $(PRODUCT_OUT)/ramdisk-recovery.img -recovery_resources_common := $(call include-path-for, recovery)/res +recovery_resources_common := bootable/recovery/res # Set recovery_density to a density bucket based on TARGET_SCREEN_DENSITY, PRODUCT_AAPT_PREF_CONFIG, # or mdpi, in order of preference. We support both specific buckets (e.g. xdpi) and numbers, @@ -1938,9 +1467,9 @@ endif # Note that the font selected here can be overridden for a particular device by putting a font.png # in its private recovery resources. ifneq (,$(filter xxxhdpi xxhdpi xhdpi,$(recovery_density))) -recovery_font := $(call include-path-for, recovery)/fonts/18x32.png +recovery_font := bootable/recovery/fonts/18x32.png else -recovery_font := $(call include-path-for, recovery)/fonts/12x22.png +recovery_font := bootable/recovery/fonts/12x22.png endif @@ -1964,7 +1493,7 @@ else endif -RECOVERY_INSTALLING_TEXT_FILE := $(call intermediates-dir-for,PACKAGING,recovery_text_res)/installing_text.png +RECOVERY_INSTALLING_TEXT_FILE := $(call intermediates-dir-for,ETC,recovery_text_res)/installing_text.png RECOVERY_INSTALLING_SECURITY_TEXT_FILE := $(dir $(RECOVERY_INSTALLING_TEXT_FILE))/installing_security_text.png RECOVERY_ERASING_TEXT_FILE := $(dir $(RECOVERY_INSTALLING_TEXT_FILE))/erasing_text.png RECOVERY_ERROR_TEXT_FILE := $(dir $(RECOVERY_INSTALLING_TEXT_FILE))/error_text.png @@ -1988,11 +1517,12 @@ generated_recovery_text_files := \ $(RECOVERY_WIPE_DATA_CONFIRMATION_TEXT_FILE) \ $(RECOVERY_WIPE_DATA_MENU_HEADER_TEXT_FILE) -resource_dir := $(call include-path-for, recovery)/tools/recovery_l10n/res/ +resource_dir := bootable/recovery/tools/recovery_l10n/res/ +resource_dir_deps := $(sort $(shell find $(resource_dir) -name *.xml -not -name .*)) image_generator_jar := $(HOST_OUT_JAVA_LIBRARIES)/RecoveryImageGenerator.jar zopflipng := $(HOST_OUT_EXECUTABLES)/zopflipng $(RECOVERY_INSTALLING_TEXT_FILE): PRIVATE_SOURCE_FONTS := $(recovery_noto-fonts_dep) $(recovery_roboto-fonts_dep) -$(RECOVERY_INSTALLING_TEXT_FILE): PRIVATE_RECOVERY_FONT_FILES_DIR := $(call intermediates-dir-for,PACKAGING,recovery_font_files) +$(RECOVERY_INSTALLING_TEXT_FILE): PRIVATE_RECOVERY_FONT_FILES_DIR := $(call intermediates-dir-for,ETC,recovery_font_files) $(RECOVERY_INSTALLING_TEXT_FILE): PRIVATE_RESOURCE_DIR := $(resource_dir) $(RECOVERY_INSTALLING_TEXT_FILE): PRIVATE_IMAGE_GENERATOR_JAR := $(image_generator_jar) $(RECOVERY_INSTALLING_TEXT_FILE): PRIVATE_ZOPFLIPNG := $(zopflipng) @@ -2010,7 +1540,7 @@ $(RECOVERY_INSTALLING_TEXT_FILE): PRIVATE_RECOVERY_WIPE_DATA_TEXT_LIST := \ recovery_wipe_data_menu_header \ recovery_wipe_data_confirmation $(RECOVERY_INSTALLING_TEXT_FILE): .KATI_IMPLICIT_OUTPUTS := $(filter-out $(RECOVERY_INSTALLING_TEXT_FILE),$(generated_recovery_text_files)) -$(RECOVERY_INSTALLING_TEXT_FILE): $(image_generator_jar) $(resource_dir) $(recovery_noto-fonts_dep) $(recovery_roboto-fonts_dep) $(zopflipng) +$(RECOVERY_INSTALLING_TEXT_FILE): $(image_generator_jar) $(resource_dir_deps) $(recovery_noto-fonts_dep) $(recovery_roboto-fonts_dep) $(zopflipng) # Prepares the font directory. @rm -rf $(PRIVATE_RECOVERY_FONT_FILES_DIR) @mkdir -p $(PRIVATE_RECOVERY_FONT_FILES_DIR) @@ -2117,9 +1647,7 @@ $(foreach prop,$(1), \ endef $(INSTALLED_RECOVERY_BUILD_PROP_TARGET): \ - $(INSTALLED_DEFAULT_PROP_TARGET) \ - $(INSTALLED_VENDOR_DEFAULT_PROP_TARGET) \ - $(intermediate_system_build_prop) \ + $(INSTALLED_BUILD_PROP_TARGET) \ $(INSTALLED_VENDOR_BUILD_PROP_TARGET) \ $(INSTALLED_ODM_BUILD_PROP_TARGET) \ $(INSTALLED_PRODUCT_BUILD_PROP_TARGET) \ @@ -2127,9 +1655,7 @@ $(INSTALLED_RECOVERY_BUILD_PROP_TARGET): \ @echo "Target recovery buildinfo: $@" $(hide) mkdir -p $(dir $@) $(hide) rm -f $@ - $(hide) cat $(INSTALLED_DEFAULT_PROP_TARGET) > $@ - $(hide) cat $(INSTALLED_VENDOR_DEFAULT_PROP_TARGET) >> $@ - $(hide) cat $(intermediate_system_build_prop) >> $@ + $(hide) cat $(INSTALLED_BUILD_PROP_TARGET) >> $@ $(hide) cat $(INSTALLED_VENDOR_BUILD_PROP_TARGET) >> $@ $(hide) cat $(INSTALLED_ODM_BUILD_PROP_TARGET) >> $@ $(hide) cat $(INSTALLED_PRODUCT_BUILD_PROP_TARGET) >> $@ @@ -2501,7 +2027,7 @@ endif # Depends on vendor_boot.img and vendor-ramdisk-debug.cpio.gz to build the new vendor_boot-debug.img $(INSTALLED_VENDOR_DEBUG_BOOTIMAGE_TARGET): $(MKBOOTIMG) $(INSTALLED_VENDOR_BOOTIMAGE_TARGET) $(INSTALLED_VENDOR_DEBUG_RAMDISK_TARGET) $(call pretty,"Target vendor_boot debug image: $@") - $(MKBOOTIMG) $(INTERNAL_VENDOR_BOOTIMAGE_ARGS) $(INTERNAL_MKBOOTIMG_VERSION_ARGS) $(BOARD_MKBOOTIMG_ARGS) --vendor_ramdisk $(INSTALLED_VENDOR_DEBUG_RAMDISK_TARGET) --vendor_boot $@ + $(MKBOOTIMG) $(INTERNAL_VENDOR_BOOTIMAGE_ARGS) $(BOARD_MKBOOTIMG_ARGS) --vendor_ramdisk $(INSTALLED_VENDOR_DEBUG_RAMDISK_TARGET) --vendor_boot $@ $(call assert-max-image-size,$@,$(BOARD_VENDOR_BOOTIMAGE_PARTITION_SIZE)) $(if $(BOARD_AVB_VENDOR_BOOT_KEY_PATH),$(call test-key-sign-vendor-bootimage,$@)) @@ -2767,11 +2293,8 @@ systemimage-nodeps snod: $(filter-out systemimage-nodeps snod,$(MAKECMDGOALS)) \ @echo "make $@: ignoring dependencies" $(call build-systemimage-target,$(INSTALLED_SYSTEMIMAGE_TARGET)) $(hide) $(call assert-max-image-size,$(INSTALLED_SYSTEMIMAGE_TARGET),$(BOARD_SYSTEMIMAGE_PARTITION_SIZE)) - -ifneq (,$(filter systemimage-nodeps snod, $(MAKECMDGOALS))) ifeq (true,$(WITH_DEXPREOPT)) -$(warning Warning: with dexpreopt enabled, you may need a full rebuild.) -endif + $(warning Warning: with dexpreopt enabled, you may need a full rebuild.) endif endif # BUILDING_SYSTEM_IMAGE @@ -3776,7 +3299,7 @@ endif # BOARD_AVB_ENABLE # ----------------------------------------------------------------- # Check VINTF of build -ifndef TARGET_BUILD_APPS +ifeq (,$(TARGET_BUILD_UNBUNDLED)) intermediates := $(call intermediates-dir-for,PACKAGING,check_vintf_all) check_vintf_all_deps := @@ -3982,13 +3505,12 @@ check_vintf_has_system := check_vintf_common_srcs := check_vintf_all_deps := intermediates := -endif # !TARGET_BUILD_APPS +endif # !TARGET_BUILD_UNBUNDLED # ----------------------------------------------------------------- # Check image sizes <= size of super partition -ifeq (,$(TARGET_BUILD_APPS)) -# Do not check for apps-only build +ifeq (,$(TARGET_BUILD_UNBUNDLED)) ifeq (true,$(PRODUCT_BUILD_SUPER_PARTITION)) @@ -4024,7 +3546,7 @@ check-all-partition-sizes-nodeps: endif # PRODUCT_BUILD_SUPER_PARTITION -endif # TARGET_BUILD_APPS +endif # !TARGET_BUILD_UNBUNDLED # ----------------------------------------------------------------- # bring in the installer image generation defines if necessary @@ -4077,6 +3599,7 @@ ifeq ($(build_otatools_package),true) INTERNAL_OTATOOLS_MODULES := \ aapt2 \ add_img_to_target_files \ + aftltool \ apksigner \ append2simg \ avbtool \ @@ -4427,7 +3950,7 @@ built_ota_tools := # We can't build static executables when SANITIZE_TARGET=address ifeq (,$(filter address, $(SANITIZE_TARGET))) built_ota_tools += \ - $(call intermediates-dir-for,EXECUTABLES,updater,,,$(TARGET_PREFER_32_BIT))/updater + $(call intermediates-dir-for,EXECUTABLES,updater)/updater endif $(BUILT_TARGET_FILES_PACKAGE): PRIVATE_OTA_TOOLS := $(built_ota_tools) @@ -4953,7 +4476,7 @@ endif # build_ota_package # A zip of the appcompat directory containing logs APPCOMPAT_ZIP := $(PRODUCT_OUT)/appcompat.zip # For apps_only build we'll establish the dependency later in build/make/core/main.mk. -ifndef TARGET_BUILD_APPS +ifeq (,$(TARGET_BUILD_UNBUNDLED)) $(APPCOMPAT_ZIP): $(INSTALLED_SYSTEMIMAGE_TARGET) \ $(INSTALLED_RAMDISK_TARGET) \ $(INSTALLED_BOOTIMAGE_TARGET) \ @@ -4982,7 +4505,7 @@ name := $(name)-symbols-$(FILE_NAME_TAG) SYMBOLS_ZIP := $(PRODUCT_OUT)/$(name).zip # For apps_only build we'll establish the dependency later in build/make/core/main.mk. -ifndef TARGET_BUILD_APPS +ifeq (,$(TARGET_BUILD_UNBUNDLED)) $(SYMBOLS_ZIP): $(INSTALLED_SYSTEMIMAGE_TARGET) \ $(INSTALLED_RAMDISK_TARGET) \ $(INSTALLED_BOOTIMAGE_TARGET) \ @@ -5008,7 +4531,7 @@ ifeq ($(TARGET_BUILD_TYPE),debug) name := $(name)_debug endif COVERAGE_ZIP := $(PRODUCT_OUT)/$(name).zip -ifndef TARGET_BUILD_APPS +ifeq (,$(TARGET_BUILD_UNBUNDLED)) $(COVERAGE_ZIP): $(INSTALLED_SYSTEMIMAGE_TARGET) \ $(INSTALLED_RAMDISK_TARGET) \ $(INSTALLED_BOOTIMAGE_TARGET) \ @@ -5083,7 +4606,7 @@ endif # EMMA_INSTRUMENT=true # PROGUARD_DICT_ZIP := $(PRODUCT_OUT)/$(TARGET_PRODUCT)-proguard-dict-$(FILE_NAME_TAG).zip # For apps_only build we'll establish the dependency later in build/make/core/main.mk. -ifndef TARGET_BUILD_APPS +ifeq (,$(TARGET_BUILD_UNBUNDLED)) $(PROGUARD_DICT_ZIP): \ $(INSTALLED_SYSTEMIMAGE_TARGET) \ $(INSTALLED_RAMDISK_TARGET) \ diff --git a/core/aux_config.mk b/core/aux_config.mk deleted file mode 100644 index 10d2536bc2..0000000000 --- a/core/aux_config.mk +++ /dev/null @@ -1,187 +0,0 @@ -variant_list := $(filter AUX-%,$(MAKECMDGOALS)) - -ifdef variant_list -AUX_OS_VARIANT_LIST := $(patsubst AUX-%,%,$(variant_list)) -else -AUX_OS_VARIANT_LIST := $(TARGET_AUX_OS_VARIANT_LIST) -endif - -# exclude AUX targets from build -ifeq ($(AUX_OS_VARIANT_LIST),none) -AUX_OS_VARIANT_LIST := -endif - -# temporary workaround to support external toolchain -ifeq ($(NANOHUB_TOOLCHAIN),) -AUX_OS_VARIANT_LIST := -endif - -# setup toolchain paths for various CPU architectures -# this one will come from android prebuilts eventually -AUX_TOOLCHAIN_cortexm4 := $(NANOHUB_TOOLCHAIN) -ifeq ($(wildcard $(AUX_TOOLCHAIN_cortexm4)gcc),) -AUX_TOOLCHAIN_cortexm4:= -endif - -# there is no MAKE var that defines path to HOST toolchain -# all the interesting paths are hardcoded in soong, and are not available from here -# There is no other way but to hardcode them again, as we may need host x86 toolcain for AUX -ifeq ($(HOST_OS),linux) -AUX_TOOLCHAIN_x86 := prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.15-4.8/bin/x86_64-linux- -endif - -# setup AUX globals -AUX_SHLIB_SUFFIX := .so -AUX_GLOBAL_ARFLAGS := crsPD -AUX_STATIC_LIB_SUFFIX := .a - -# Load ever-lasting "indexed" version of AUX variant environment; it is treated as READ-ONLY from this -# moment on. -# -# $(1) - variant -# no return value -define aux-variant-setup-paths -$(eval AUX_OUT_ROOT_$(1) := $(PRODUCT_OUT)/aux/$(1)) \ -$(eval AUX_COMMON_OUT_ROOT_$(1) := $(AUX_OUT_ROOT_$(1))/common) \ -$(eval AUX_OUT_$(1) := $(AUX_OUT_ROOT_$(1))/$(AUX_OS_$(1))-$(AUX_ARCH_$(1))-$(AUX_CPU_$(1))) \ -$(eval AUX_OUT_INTERMEDIATES_$(1) := $(AUX_OUT_$(1))/obj) \ -$(eval AUX_OUT_COMMON_INTERMEDIATES_$(1) := $(AUX_COMMON_OUT_ROOT_$(1))/obj) \ -$(eval AUX_OUT_HEADERS_$(1) := $(AUX_OUT_INTERMEDIATES_$(1))/include) \ -$(eval AUX_OUT_NOTICE_FILES_$(1) := $(AUX_OUT_INTERMEDIATES_$(1))/NOTICE_FILES) \ -$(eval AUX_OUT_FAKE_$(1) := $(AUX_OUT_$(1))/fake_packages) \ -$(eval AUX_OUT_GEN_$(1) := $(AUX_OUT_$(1))/gen) \ -$(eval AUX_OUT_COMMON_GEN_$(1) := $(AUX_COMMON_OUT_ROOT_$(1))/gen) \ -$(eval AUX_OUT_EXECUTABLES_$(1) := $(AUX_OUT_$(1))/bin) \ -$(eval AUX_OUT_UNSTRIPPED_$(1) := $(AUX_OUT_$(1))/symbols) -endef - -# Copy "indexed" AUX environment for given VARIANT into -# volatile not-indexed set of variables for simplicity of access. -# Injection of index support throughout the build system is suboptimal -# hence volatile environment is constructed -# Unlike HOST*, TARGET* variables, AUX* variables are NOT read-only, but their -# indexed versions are. -# -# $(1) - variant -# no return value -define aux-variant-load-env -$(eval AUX_OS_VARIANT:=$(1)) \ -$(eval AUX_OS:=$(AUX_OS_$(1))) \ -$(eval AUX_ARCH:=$(AUX_ARCH_$(1))) \ -$(eval AUX_SUBARCH:=$(AUX_SUBARCH_$(1))) \ -$(eval AUX_CPU:=$(AUX_CPU_$(1))) \ -$(eval AUX_OS_PATH:=$(AUX_OS_PATH_$(1))) \ -$(eval AUX_OUT_ROOT := $(AUX_OUT_ROOT_$(1))) \ -$(eval AUX_COMMON_OUT_ROOT := $(AUX_COMMON_OUT_ROOT_$(1))) \ -$(eval AUX_OUT := $(AUX_OUT_$(1))) \ -$(eval AUX_OUT_INTERMEDIATES := $(AUX_OUT_INTERMEDIATES_$(1))) \ -$(eval AUX_OUT_COMMON_INTERMEDIATES := $(AUX_OUT_COMMON_INTERMEDIATES_$(1))) \ -$(eval AUX_OUT_HEADERS := $(AUX_OUT_HEADERS_$(1))) \ -$(eval AUX_OUT_NOTICE_FILES := $(AUX_OUT_NOTICE_FILES_$(1))) \ -$(eval AUX_OUT_FAKE := $(AUX_OUT_FAKE_$(1))) \ -$(eval AUX_OUT_GEN := $(AUX_OUT_GEN_$(1))) \ -$(eval AUX_OUT_COMMON_GEN := $(AUX_OUT_COMMON_GEN_$(1))) \ -$(eval AUX_OUT_EXECUTABLES := $(AUX_OUT_EXECUTABLES_$(1))) \ -$(eval AUX_OUT_UNSTRIPPED := $(AUX_OUT_UNSTRIPPED_$(1))) -endef - -# given a variant:path pair, load the variant conviguration with aux-variant-setup-paths from file -# this is a build system extension mechainsm, since configuration typically resides in non-build -# project space -# -# $(1) - variant:path pair -# $(2) - file suffix -# no return value -define aux-variant-import-from-pair -$(eval _pair := $(subst :, ,$(1))) \ -$(eval _name:=$(word 1,$(_pair))) \ -$(eval _path:=$(word 2,$(_pair))) \ -$(eval include $(_path)/$(_name)$(2)) \ -$(eval AUX_OS_VARIANT_LIST_$(AUX_OS_$(1)):=) \ -$(call aux-variant-setup-paths,$(_name)) \ -$(eval AUX_ALL_VARIANTS += $(_name)) \ -$(eval AUX_ALL_OSES := $(filter-out $(AUX_OS_$(_name)),$(AUX_ALL_OSES)) $(AUX_OS_$(_name))) \ -$(eval AUX_ALL_CPUS := $(filter-out $(AUX_CPU_$(_name)),$(AUX_ALL_CPUS)) $(AUX_CPU_$(_name))) \ -$(eval AUX_ALL_ARCHS := $(filter-out $(AUX_ARCH_$(_name)),$(AUX_ALL_ARCHS)) $(AUX_ARCH_$(_name))) \ -$(eval AUX_ALL_SUBARCHS := $(filter-out $(AUX_SUBARCH_$(_name)),$(AUX_ALL_SUBARCHS)) $(AUX_SUBARCH_$(_name))) -endef - -# Load system configuration referenced by AUX variant config; -# this is a build extension mechanism; typically system config -# resides in a non-build projects; -# system config may define new rules and globally visible BUILD* -# includes to support project-specific build steps and toolchains -# MAintains list of valiants that reference this os config in OS "indexed" var -# this facilitates multivariant build of the OS (or whataver it is the name of common component these variants share) -# -# $(1) - variant -# no return value -define aux-import-os-config -$(eval _aioc_os := $(AUX_OS_$(1))) \ -$(eval AUX_OS_PATH_$(1) := $(patsubst $(_aioc_os):%,%,$(filter $(_aioc_os):%,$(AUX_ALL_OS_PATHS)))) \ -$(eval _aioc_os_cfg := $(AUX_OS_PATH_$(1))/$(_aioc_os)$(os_sfx)) \ -$(if $(wildcard $(_aioc_os_cfg)),,$(error AUX '$(_aioc_os)' OS config file [$(notdir $(_aioc_os_cfg))] required by AUX variant '$(1)' does not exist)) \ -$(if $(filter $(_aioc_os),$(_os_list)),,$(eval include $(_aioc_os_cfg))) \ -$(eval AUX_OS_VARIANT_LIST_$(_aioc_os) += $(1)) \ -$(eval _os_list += $(_aioc_os)) -endef - -# make sure that AUX config variables are minimally sane; -# as a bare minimum they must contain the vars described by aux_env -# Generate error if requirement is not met. -# -#$(1) - variant -# no return value -define aux-variant-validate -$(eval _all:=) \ -$(eval _req:=$(addsuffix _$(1),$(aux_env))) \ -$(foreach var,$(_req),$(eval _all += $(var))) \ -$(eval _missing := $(filter-out $(_all),$(_req))) \ -$(if $(_missing),$(error AUX variant $(1) must define vars: $(_missing))) -endef - -AUX_ALL_VARIANTS := -AUX_ALL_OSES := -AUX_ALL_CPUS := -AUX_ALL_ARCHS := -AUX_ALL_SUBARCHS := - -variant_sfx :=_aux_variant_config.mk -os_sfx :=_aux_os_config.mk - -ifdef AUX_OS_VARIANT_LIST - -config_roots := $(wildcard device vendor) -all_configs := -ifdef config_roots -all_configs := $(sort $(shell find $(config_roots) -maxdepth 4 -name '*$(variant_sfx)' -o -name '*$(os_sfx)')) -endif -all_os_configs := $(filter %$(os_sfx),$(all_configs)) -all_variant_configs := $(filter %$(variant_sfx),$(all_configs)) - -AUX_ALL_OS_PATHS := $(foreach f,$(all_os_configs),$(patsubst %$(os_sfx),%,$(notdir $(f))):$(patsubst %/,%,$(dir $(f)))) -AUX_ALL_OS_VARIANT_PATHS := $(foreach f,$(all_variant_configs),$(patsubst %$(variant_sfx),%,$(notdir $(f))):$(patsubst %/,%,$(dir $(f)))) - -my_variant_pairs := $(foreach v,$(AUX_OS_VARIANT_LIST),$(filter $(v):%,$(AUX_ALL_OS_VARIANT_PATHS))) -my_missing_variants := $(foreach v,$(AUX_OS_VARIANT_LIST),$(if $(filter $(v):%,$(AUX_ALL_OS_VARIANT_PATHS)),,$(v))) - -ifneq ($(strip $(my_missing_variants)),) -$(error Don't know how to build variant(s): $(my_missing_variants)) -endif - -# mandatory variables -aux_env := AUX_OS AUX_ARCH AUX_SUBARCH AUX_CPU - -$(foreach v,$(my_variant_pairs),$(if $(filter $(v),$(AUX_ALL_VARIANTS)),,$(call aux-variant-import-from-pair,$(v),$(variant_sfx)))) - -ifdef AUX_ALL_VARIANTS -_os_list := -$(foreach v,$(AUX_ALL_VARIANTS),\ - $(call aux-import-os-config,$(v)) \ - $(call aux-variant-validate,$(v)) \ -) -endif - -endif # AUX_OS_VARIANT_LIST - -INSTALLED_AUX_TARGETS := diff --git a/core/aux_executable.mk b/core/aux_executable.mk deleted file mode 100644 index 5395e61964..0000000000 --- a/core/aux_executable.mk +++ /dev/null @@ -1,95 +0,0 @@ -# caller might have included aux_toolchain, e.g. if custom build steps are defined -ifeq ($(LOCAL_IS_AUX_MODULE),) -include $(BUILD_SYSTEM)/aux_toolchain.mk -endif - -ifeq ($(AUX_BUILD_NOT_COMPATIBLE),) - -########################################################### -## Standard rules for building an executable file. -## -## Additional inputs from base_rules.make: -## None. -########################################################### - -ifeq ($(strip $(LOCAL_MODULE_CLASS)),) -LOCAL_MODULE_CLASS := EXECUTABLES -endif - -$(call $(aux-executable-hook)) - -########################################################### -## Standard rules for building any target-side binaries -## with dynamic linkage (dynamic libraries or executables -## that link with dynamic libraries) -## -## Files including this file must define a rule to build -## the target $(linked_module). -########################################################### - -# The name of the target file, without any path prepended. -# This duplicates logic from base_rules.mk because we need to -# know its results before base_rules.mk is included. -include $(BUILD_SYSTEM)/configure_module_stem.mk - -intermediates := $(call local-intermediates-dir) - -# Define the target that is the unmodified output of the linker. -# The basename of this target must be the same as the final output -# binary name, because it's used to set the "soname" in the binary. -# The includer of this file will define a rule to build this target. -linked_module := $(intermediates)/LINKED/$(my_built_module_stem) - -ALL_ORIGINAL_DYNAMIC_BINARIES += $(linked_module) - -# Because AUX_SYMBOL_FILTER_FILE depends on ALL_ORIGINAL_DYNAMIC_BINARIES, -# the linked_module rules won't necessarily inherit the PRIVATE_ -# variables from LOCAL_BUILT_MODULE. This tells binary.make to explicitly -# define the PRIVATE_ variables for linked_module as well as for -# LOCAL_BUILT_MODULE. -LOCAL_INTERMEDIATE_TARGETS += $(linked_module) - -################################### -include $(BUILD_SYSTEM)/binary.mk -################################### - -aux_output := $(linked_module) - -ifneq ($(LOCAL_CUSTOM_BUILD_STEP_INPUT),) -ifneq ($(LOCAL_CUSTOM_BUILD_STEP_OUTPUT),) - -# injecting custom build steps -$(LOCAL_CUSTOM_BUILD_STEP_INPUT): $(aux_output) - @echo "$(AUX_DISPLAY) custom copy: $(PRIVATE_MODULE) ($@)" - @mkdir -p $(dir $@) - $(hide) $(copy-file-to-target) - -aux_output := $(LOCAL_CUSTOM_BUILD_STEP_OUTPUT) - -endif -endif - -$(LOCAL_BUILT_MODULE): $(aux_output) - @echo "$(AUX_DISPLAY) final copy: $(PRIVATE_MODULE) ($@)" - @mkdir -p $(dir $@) - $(hide) $(copy-file-to-target) - -INSTALLED_AUX_TARGETS += $(LOCAL_INSTALLED_MODULE) - -$(cleantarget): PRIVATE_CLEAN_FILES += \ - $(linked_module) \ - -# Define PRIVATE_ variables from global vars -$(linked_module): PRIVATE_POST_LINK_CMD := $(LOCAL_POST_LINK_CMD) - -ifeq ($(LOCAL_FORCE_STATIC_EXECUTABLE),true) -$(linked_module): $(all_objects) $(all_libraries) $(LOCAL_ADDITIONAL_DEPENDENCIES) - $(transform-o-to-aux-static-executable) - $(PRIVATE_POST_LINK_CMD) -else -$(linked_module): $(all_objects) $(all_libraries) $(LOCAL_ADDITIONAL_DEPENDENCIES) - $(transform-o-to-aux-executable) - $(PRIVATE_POST_LINK_CMD) -endif - -endif # AUX_BUILD_NOT_COMPATIBLE diff --git a/core/aux_static_library.mk b/core/aux_static_library.mk deleted file mode 100644 index d88478d83e..0000000000 --- a/core/aux_static_library.mk +++ /dev/null @@ -1,27 +0,0 @@ -ifeq ($(LOCAL_IS_AUX_MODULE),) -include $(BUILD_SYSTEM)/aux_toolchain.mk -endif - -ifeq ($(AUX_BUILD_NOT_COMPATIBLE),) - -ifeq ($(strip $(LOCAL_MODULE_CLASS)),) -LOCAL_MODULE_CLASS := STATIC_LIBRARIES -endif -ifeq ($(strip $(LOCAL_MODULE_SUFFIX)),) -LOCAL_MODULE_SUFFIX := .a -endif - -LOCAL_UNINSTALLABLE_MODULE := true - -ifneq ($(strip $(LOCAL_MODULE_STEM)$(LOCAL_BUILT_MODULE_STEM)),) -$(error $(LOCAL_PATH): Cannot set module stem for a library) -endif - -include $(BUILD_SYSTEM)/binary.mk - -$(LOCAL_BUILT_MODULE) : PRIVATE_AR := $(AUX_AR) -$(LOCAL_BUILT_MODULE) : $(built_whole_libraries) -$(LOCAL_BUILT_MODULE) : $(all_objects) - $(transform-o-to-aux-static-lib) - -endif # AUX_BUILD_NOT_COMPATIBLE diff --git a/core/aux_toolchain.mk b/core/aux_toolchain.mk deleted file mode 100644 index c7102288d0..0000000000 --- a/core/aux_toolchain.mk +++ /dev/null @@ -1,52 +0,0 @@ -########################################################### -# takes form LOCAL_AUX_TOOLCHAIN_$(LOCAL_AUX_CPU) -########################################################### - -############################### -# setup AUX environment -############################### - -# shortcuts for targets with a single instance of OS, ARCH, VARIANT, CPU -AUX_TOOLCHAIN := $(if $(LOCAL_AUX_TOOLCHAIN),$(LOCAL_AUX_TOOLCHAIN),$(AUX_TOOLCHAIN_$(AUX_CPU))) -AUX_BUILD_NOT_COMPATIBLE:= -ifeq ($(strip $(AUX_TOOLCHAIN)),) - ifeq ($(strip $(AUX_CPU)),) - $(warning $(LOCAL_PATH): $(LOCAL_MODULE): Undefined CPU for AUX toolchain) - AUX_BUILD_NOT_COMPATIBLE += TOOLCHAIN - else - $(warning $(LOCAL_PATH): $(LOCAL_MODULE): Undefined AUX toolchain for CPU=$(AUX_CPU)) - AUX_BUILD_NOT_COMPATIBLE += TOOLCHAIN - endif -endif - -AUX_BUILD_NOT_COMPATIBLE += $(foreach var,OS ARCH SUBARCH CPU OS_VARIANT,$(if $(LOCAL_AUX_$(var)),$(if \ - $(filter $(LOCAL_AUX_$(var)),$(AUX_$(var))),,$(var)))) - -AUX_BUILD_NOT_COMPATIBLE := $(strip $(AUX_BUILD_NOT_COMPATIBLE)) - -ifneq ($(AUX_BUILD_NOT_COMPATIBLE),) -$(info $(LOCAL_PATH): $(LOCAL_MODULE): not compatible: "$(AUX_BUILD_NOT_COMPATIBLE)" with) -$(info ====> OS=$(AUX_OS) CPU=$(AUX_CPU) ARCH=$(AUX_ARCH) SUBARCH=$(AUX_SUBARCH) OS_VARIANT=$(AUX_OS_VARIANT)) -$(info ====> TOOLCHAIN=$(AUX_TOOLCHAIN)) -endif - -AUX_AR := $(AUX_TOOLCHAIN)ar -AUX_AS := $(AUX_TOOLCHAIN)gcc -AUX_CC := $(AUX_TOOLCHAIN)gcc -AUX_CXX := $(AUX_TOOLCHAIN)g++ -AUX_LINKER := $(AUX_TOOLCHAIN)ld -AUX_OBJCOPY := $(AUX_TOOLCHAIN)objcopy -AUX_OBJDUMP := $(AUX_TOOLCHAIN)objdump - -############################### -# setup Android environment -############################### - -LOCAL_IS_AUX_MODULE := true -LOCAL_2ND_ARCH_VAR_PREFIX := -LOCAL_CC := $(AUX_CC) -LOCAL_CXX := $(AUX_CXX) -LOCAL_NO_DEFAULT_COMPILER_FLAGS := true -LOCAL_SYSTEM_SHARED_LIBRARIES := -LOCAL_CXX_STL := none -LOCAL_NO_PIC := true diff --git a/core/base_rules.mk b/core/base_rules.mk index e608ee7e14..d604480be1 100644 --- a/core/base_rules.mk +++ b/core/base_rules.mk @@ -34,7 +34,6 @@ endif $(call verify-module-name) LOCAL_IS_HOST_MODULE := $(strip $(LOCAL_IS_HOST_MODULE)) -LOCAL_IS_AUX_MODULE := $(strip $(LOCAL_IS_AUX_MODULE)) ifdef LOCAL_IS_HOST_MODULE ifneq ($(LOCAL_IS_HOST_MODULE),true) $(error $(LOCAL_PATH): LOCAL_IS_HOST_MODULE must be "true" or empty, not "$(LOCAL_IS_HOST_MODULE)") @@ -47,16 +46,8 @@ ifdef LOCAL_IS_HOST_MODULE my_host := host- my_kind := HOST else - ifdef LOCAL_IS_AUX_MODULE - ifneq ($(LOCAL_IS_AUX_MODULE),true) - $(error $(LOCAL_PATH): LOCAL_IS_AUX_MODULE must be "true" or empty, not "$(LOCAL_IS_AUX_MODULE)") - endif - my_prefix := AUX_ - my_kind := AUX - else - my_prefix := TARGET_ - my_kind := - endif + my_prefix := TARGET_ + my_kind := my_host := endif @@ -205,6 +196,7 @@ my_module_path := $(strip $(LOCAL_MODULE_PATH)) endif my_module_path := $(patsubst %/,%,$(my_module_path)) my_module_relative_path := $(strip $(LOCAL_MODULE_RELATIVE_PATH)) + ifdef LOCAL_IS_HOST_MODULE partition_tag := actual_partition_tag := @@ -315,12 +307,9 @@ else my_all_targets := device_$(my_register_name)_all_targets endif -# variant is enough to make nano class unique; it serves as a key to lookup (OS,ARCH) tuple -aux_class := $($(my_prefix)OS_VARIANT) # Make sure that this IS_HOST/CLASS/MODULE combination is unique. module_id := MODULE.$(if \ - $(LOCAL_IS_HOST_MODULE),$($(my_prefix)OS),$(if \ - $(LOCAL_IS_AUX_MODULE),$(aux_class),TARGET)).$(LOCAL_MODULE_CLASS).$(my_register_name) + $(LOCAL_IS_HOST_MODULE),$($(my_prefix)OS),TARGET).$(LOCAL_MODULE_CLASS).$(my_register_name) ifdef $(module_id) $(error $(LOCAL_PATH): $(module_id) already defined by $($(module_id))) endif @@ -366,16 +355,16 @@ LOCAL_BUILT_MODULE := $(intermediates)/$(my_built_module_stem) ifneq (true,$(LOCAL_UNINSTALLABLE_MODULE)) # Apk and its attachments reside in its own subdir. ifeq ($(LOCAL_MODULE_CLASS),APPS) - # framework-res.apk doesn't like the additional layer. - ifeq ($(LOCAL_NO_STANDARD_LIBRARIES),true) - # Neither do Runtime Resource Overlay apks, which contain just the overlaid resources. - else ifeq ($(LOCAL_IS_RUNTIME_RESOURCE_OVERLAY),true) - else - ifneq ($(use_testcase_folder),true) - my_module_path := $(my_module_path)/$(LOCAL_MODULE) + # framework-res.apk doesn't like the additional layer. + ifeq ($(LOCAL_NO_STANDARD_LIBRARIES),true) + # Neither do Runtime Resource Overlay apks, which contain just the overlaid resources. + else ifeq ($(LOCAL_IS_RUNTIME_RESOURCE_OVERLAY),true) + else + ifneq ($(use_testcase_folder),true) + my_module_path := $(my_module_path)/$(LOCAL_MODULE) + endif endif endif - endif LOCAL_INSTALLED_MODULE := $(my_module_path)/$(my_installed_module_stem) endif @@ -437,7 +426,6 @@ $(cleantarget):: ########################################################### $(LOCAL_INTERMEDIATE_TARGETS) : PRIVATE_PATH:=$(LOCAL_PATH) $(LOCAL_INTERMEDIATE_TARGETS) : PRIVATE_IS_HOST_MODULE := $(LOCAL_IS_HOST_MODULE) -$(LOCAL_INTERMEDIATE_TARGETS) : PRIVATE_IS_AUX_MODULE := $(LOCAL_IS_AUX_MODULE) $(LOCAL_INTERMEDIATE_TARGETS) : PRIVATE_HOST:= $(my_host) $(LOCAL_INTERMEDIATE_TARGETS) : PRIVATE_PREFIX := $(my_prefix) @@ -464,12 +452,33 @@ endif # Set up phony targets that covers all modules under the given paths. # This allows us to build everything in given paths by running mmma/mma. -my_path_components := $(subst /,$(space),$(LOCAL_PATH)) -my_path_prefix := MODULES-IN -$(foreach c, $(my_path_components),\ - $(eval my_path_prefix := $(my_path_prefix)-$(c))\ - $(eval .PHONY : $(my_path_prefix))\ - $(eval $(my_path_prefix) : $(my_all_targets))) +define my_path_comp +parent := $(patsubst %/,%,$(dir $(1))) +parent_target := MODULES-IN-$$(subst /,-,$$(parent)) +.PHONY: $$(parent_target) +$$(parent_target): $(2) +ifndef $$(parent_target) + $$(parent_target) := true + ifneq (,$$(findstring /,$$(parent))) + $$(eval $$(call my_path_comp,$$(parent),$$(parent_target))) + endif +endif +endef + +_local_path := $(patsubst %/,%,$(LOCAL_PATH)) +_local_path_target := MODULES-IN-$(subst /,-,$(_local_path)) + +.PHONY: $(_local_path_target) +$(_local_path_target): $(my_register_name) + +ifndef $(_local_path_target) + $(_local_path_target) := true + $(eval $(call my_path_comp,$(_local_path),$(_local_path_target))) +endif + +_local_path := +_local_path_target := +my_path_comp := ########################################################### ## Module installation rule @@ -749,13 +758,19 @@ endif ifeq ($(use_testcase_folder),true) ifneq ($(my_test_data_file_pairs),) +# Filter out existng installed test data paths when collecting test data files to be installed and +# indexed as they cause build rule conflicts. Instead put them in a separate list which is only +# used for indexing. $(foreach pair, $(my_test_data_file_pairs), \ $(eval parts := $(subst :,$(space),$(pair))) \ $(eval src_path := $(word 1,$(parts))) \ $(eval file := $(word 2,$(parts))) \ $(foreach suite, $(LOCAL_COMPATIBILITY_SUITE), \ $(eval my_compat_dist_$(suite) += $(foreach dir, $(call compatibility_suite_dirs,$(suite),$(arch_dir)), \ - $(call filter-copy-pair,$(src_path),$(call append-path,$(dir),$(file)),$(my_installed_test_data)))))) + $(call filter-copy-pair,$(src_path),$(call append-path,$(dir),$(file)),$(my_installed_test_data)))) \ + $(eval my_compat_dist_test_data_$(suite) += \ + $(foreach dir, $(call compatibility_suite_dirs,$(suite),$(arch_dir)), \ + $(filter $(my_installed_test_data),$(call append-path,$(dir),$(file))))))) endif else ifneq ($(my_test_data_file_pairs),) @@ -776,7 +791,8 @@ is_native := $(call create-suite-dependencies) $(foreach suite, $(LOCAL_COMPATIBILITY_SUITE), \ - $(eval my_compat_dist_config_$(suite) := )) + $(eval my_compat_dist_config_$(suite) := ) \ + $(eval my_compat_dist_test_data_$(suite) := )) endif # LOCAL_UNINSTALLABLE_MODULE endif # LOCAL_COMPATIBILITY_SUITE @@ -938,7 +954,7 @@ INSTALLABLE_FILES.$(LOCAL_INSTALLED_MODULE).MODULE := $(my_register_name) ########################################################## # Track module-level dependencies. # Use $(LOCAL_MODULE) instead of $(my_register_name) to ignore module's bitness. -ifneq (,$(filter deps-license,$(MAKECMDGOALS))) +ifdef RECORD_ALL_DEPS ALL_DEPS.MODULES += $(LOCAL_MODULE) ALL_DEPS.$(LOCAL_MODULE).ALL_DEPS := $(sort \ $(ALL_DEPS.$(LOCAL_MODULE).ALL_DEPS) \ diff --git a/core/binary.mk b/core/binary.mk index 7ee8c5c7e0..200724a664 100644 --- a/core/binary.mk +++ b/core/binary.mk @@ -71,8 +71,12 @@ 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))))) +# TODO(b/158212027): Remove `$(COVERAGE_PATHS)` from this condition when all users have been moved +# to `NATIVE_COVERAGE_PATHS`. +ifneq (,$(strip $(foreach dir,$(COVERAGE_PATHS) $(NATIVE_COVERAGE_PATHS),$(filter $(dir)%,$(LOCAL_PATH))))) +# TODO(b/158212027): Remove `$(COVERAGE_EXCLUDE_PATHS)` from this condition when all users have been +# moved to `NATIVE_COVERAGE_EXCLUDE_PATHS`. +ifeq (,$(strip $(foreach dir,$(COVERAGE_EXCLUDE_PATHS) $(NATIVE_COVERAGE_EXCLUDE_PATHS),$(filter $(dir)%,$(LOCAL_PATH))))) my_native_coverage := true else my_native_coverage := false @@ -110,19 +114,8 @@ ifneq ($(LOCAL_SDK_VERSION),) # Make sure we've built the NDK. my_additional_dependencies += $(SOONG_OUT_DIR)/ndk_base.timestamp - # mips32r6 is not supported by the NDK. No released NDK contains these - # libraries, but the r10 in prebuilts/ndk had a local hack to add them :( - # - # We need to find a real solution to this problem, but until we do just drop - # mips32r6 things back to r10 to get the tree building again. - ifeq (mips32r6,$(TARGET_$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH_VARIANT)) - ifeq ($(LOCAL_NDK_VERSION), current) - LOCAL_NDK_VERSION := r10 - endif - endif - my_arch := $(TARGET_$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH) - ifneq (,$(filter arm64 mips64 x86_64,$(my_arch))) + ifneq (,$(filter arm64 x86_64,$(my_arch))) my_min_sdk_version := 21 else my_min_sdk_version := $(MIN_SUPPORTED_SDK_VERSION) @@ -156,17 +149,11 @@ ifneq ($(LOCAL_SDK_VERSION),) $(my_built_ndk)/sysroot/usr/include/$(my_ndk_triple) \ $(my_ndk_sysroot)/usr/include \ - # x86_64 and and mips64 are both multilib toolchains, so their libraries are + # x86_64 is a multilib toolchain, so their libraries are # installed in /usr/lib64. Aarch64, on the other hand, is not a multilib # compiler, so its libraries are in /usr/lib. - # - # Mips32r6 is yet another variation, with libraries installed in libr6. - # - # For the rest, the libraries are installed simply to /usr/lib. - ifneq (,$(filter x86_64 mips64,$(my_arch))) + ifneq (,$(filter x86_64,$(my_arch))) my_ndk_libdir_name := lib64 - else ifeq (mips32r6,$(TARGET_$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH_VARIANT)) - my_ndk_libdir_name := libr6 else my_ndk_libdir_name := lib endif @@ -180,11 +167,7 @@ ifneq ($(LOCAL_SDK_VERSION),) # hashes (which are much faster!), but shipping to older devices requires # the old style hash. Fortunately, we can build with both and it'll work # anywhere. - # - # This is not currently supported on MIPS architectures. - ifeq (,$(filter mips mips64,$(TARGET_$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH))) - my_ldflags += -Wl,--hash-style=both - endif + my_ldflags += -Wl,--hash-style=both # We don't want to expose the relocation packer to the NDK just yet. LOCAL_PACK_MODULE_RELOCATIONS := false @@ -195,9 +178,6 @@ ifneq ($(LOCAL_SDK_VERSION),) my_ndk_stl_shared_lib_fullpath := my_ndk_stl_static_lib := my_cpu_variant := $(TARGET_$(LOCAL_2ND_ARCH_VAR_PREFIX)CPU_ABI) - ifeq (mips32r6,$(TARGET_$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH_VARIANT)) - my_cpu_variant := mips32r6 - endif LOCAL_NDK_STL_VARIANT := $(strip $(LOCAL_NDK_STL_VARIANT)) ifeq (,$(LOCAL_NDK_STL_VARIANT)) LOCAL_NDK_STL_VARIANT := system @@ -1594,28 +1574,22 @@ my_ldlibs += $(my_cxx_ldlibs) ## Define PRIVATE_ variables from global vars ########################################################### ifndef LOCAL_IS_HOST_MODULE + ifdef LOCAL_USE_VNDK -my_target_global_c_includes := \ - $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)PROJECT_INCLUDES) -my_target_global_c_system_includes := \ - $(TARGET_OUT_HEADERS) \ - $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)PROJECT_SYSTEM_INCLUDES) + my_target_global_c_includes := + my_target_global_c_system_includes := $(TARGET_OUT_HEADERS) else ifdef LOCAL_SDK_VERSION -my_target_global_c_includes := -my_target_global_c_system_includes := $(my_ndk_stl_include_path) $(my_ndk_sysroot_include) + my_target_global_c_includes := + my_target_global_c_system_includes := $(my_ndk_stl_include_path) $(my_ndk_sysroot_include) else ifdef BOARD_VNDK_VERSION -my_target_global_c_includes := $(SRC_HEADERS) \ - $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)PROJECT_INCLUDES) \ + my_target_global_c_includes := $(SRC_HEADERS) \ $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)C_INCLUDES) -my_target_global_c_system_includes := $(SRC_SYSTEM_HEADERS) \ - $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)PROJECT_SYSTEM_INCLUDES) \ + my_target_global_c_system_includes := $(SRC_SYSTEM_HEADERS) \ $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)C_SYSTEM_INCLUDES) else -my_target_global_c_includes := $(SRC_HEADERS) \ - $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)PROJECT_INCLUDES) \ + my_target_global_c_includes := $(SRC_HEADERS) \ $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)C_INCLUDES) -my_target_global_c_system_includes := $(SRC_SYSTEM_HEADERS) $(TARGET_OUT_HEADERS) \ - $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)PROJECT_SYSTEM_INCLUDES) \ + my_target_global_c_system_includes := $(SRC_SYSTEM_HEADERS) $(TARGET_OUT_HEADERS) \ $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)C_SYSTEM_INCLUDES) endif @@ -1698,9 +1672,22 @@ endif #################################################### ## Import includes #################################################### +imported_includes := + +ifdef LOCAL_USE_VNDK + imported_includes += $(call intermediates-dir-for,HEADER_LIBRARIES,device_kernel_headers,$(my_kind),,$(LOCAL_2ND_ARCH_VAR_PREFIX),$(my_host_cross)) +else ifdef LOCAL_SDK_VERSION + # Apps shouldn't need device-specific kernel headers +else ifdef BOARD_VNDK_VERSION + # For devices building with the VNDK, only the VNDK gets device-specific kernel headers by default + # In soong, it's entirely opt-in +else + # For older non-VNDK builds, continue adding in kernel headers to everything like we used to + imported_includes += $(call intermediates-dir-for,HEADER_LIBRARIES,device_kernel_headers,$(my_kind),,$(LOCAL_2ND_ARCH_VAR_PREFIX),$(my_host_cross)) +endif + imported_includes := $(strip \ - $(if $(LOCAL_USE_VNDK),\ - $(call intermediates-dir-for,HEADER_LIBRARIES,device_kernel_headers,$(my_kind),,$(LOCAL_2ND_ARCH_VAR_PREFIX),$(my_host_cross))) \ + $(imported_includes) \ $(foreach l, $(installed_shared_library_module_names), \ $(call intermediates-dir-for,SHARED_LIBRARIES,$(l),$(my_kind),,$(LOCAL_2ND_ARCH_VAR_PREFIX),$(my_host_cross))) \ $(foreach l, $(my_static_libraries) $(my_whole_static_libraries), \ diff --git a/core/board_config.mk b/core/board_config.mk index 86162b6f37..ae1614f24f 100644 --- a/core/board_config.mk +++ b/core/board_config.mk @@ -87,6 +87,7 @@ _board_strip_readonly_list += $(_dynamic_partitions_var_list) _build_broken_var_list := \ BUILD_BROKEN_DUP_RULES \ + BUILD_BROKEN_ELF_PREBUILT_PRODUCT_COPY_FILES \ BUILD_BROKEN_OUTSIDE_INCLUDE_DIRS \ BUILD_BROKEN_PREBUILT_ELF_FILES \ BUILD_BROKEN_TREBLE_SYSPROP_NEVERALLOW \ @@ -241,13 +242,8 @@ endif # build a list out of the TARGET_CPU_ABIs specified by the config. # Add NATIVE_BRIDGE_ABIs at the end to keep order of preference. ifeq (,$(TARGET_CPU_ABI_LIST)) - ifeq ($(TARGET_IS_64_BIT)|$(TARGET_PREFER_32_BIT_APPS),true|true) - TARGET_CPU_ABI_LIST := $(TARGET_CPU_ABI_LIST_32_BIT) $(TARGET_CPU_ABI_LIST_64_BIT) \ - $(_target_native_bridge_abi_list_32_bit) $(_target_native_bridge_abi_list_64_bit) - else - TARGET_CPU_ABI_LIST := $(TARGET_CPU_ABI_LIST_64_BIT) $(TARGET_CPU_ABI_LIST_32_BIT) \ - $(_target_native_bridge_abi_list_64_bit) $(_target_native_bridge_abi_list_32_bit) - endif + TARGET_CPU_ABI_LIST := $(TARGET_CPU_ABI_LIST_64_BIT) $(TARGET_CPU_ABI_LIST_32_BIT) \ + $(_target_native_bridge_abi_list_64_bit) $(_target_native_bridge_abi_list_32_bit) endif # Add NATIVE_BRIDGE_ABIs at the end of 32 and 64 bit CPU_ABIs to keep order of preference. @@ -621,7 +617,7 @@ else endif endif -ifeq (,$(TARGET_BUILD_APPS)) +ifeq (,$(TARGET_BUILD_UNBUNDLED)) ifdef PRODUCT_EXTRA_VNDK_VERSIONS $(foreach v,$(PRODUCT_EXTRA_VNDK_VERSIONS),$(call check_vndk_version,$(v))) endif diff --git a/core/build-system.html b/core/build-system.html index cc242d9b6e..9cd7b0bc7e 100644 --- a/core/build-system.html +++ b/core/build-system.html @@ -467,8 +467,6 @@ set to and some examples.</p> <b>TARGET_ARCH</b><br/> arm<br/> arm64<br/> - mips<br/> - mips64<br/> x86<br/> x86_64 </td> diff --git a/core/check_elf_file.mk b/core/check_elf_file.mk index da4168df8a..d54a5b70ba 100644 --- a/core/check_elf_file.mk +++ b/core/check_elf_file.mk @@ -38,6 +38,8 @@ $(check_elf_files_stamp): $(my_prebuilt_src_file) $(my_check_elf_file_shared_lib $< $(hide) touch $@ +CHECK_ELF_FILES.$(check_elf_files_stamp) := 1 + ifneq ($(strip $(LOCAL_CHECK_ELF_FILES)),false) ifneq ($(strip $(BUILD_BROKEN_PREBUILT_ELF_FILES)),true) $(LOCAL_BUILT_MODULE): $(check_elf_files_stamp) diff --git a/core/clang/TARGET_mips.mk b/core/clang/TARGET_mips.mk deleted file mode 100644 index 3e54a6626a..0000000000 --- a/core/clang/TARGET_mips.mk +++ /dev/null @@ -1,9 +0,0 @@ -$(clang_2nd_arch_prefix)RS_TRIPLE := renderscript32-linux-androideabi -$(clang_2nd_arch_prefix)RS_TRIPLE_CFLAGS := -RS_COMPAT_TRIPLE := mipsel-linux-android - -$(clang_2nd_arch_prefix)TARGET_LIBPROFILE_RT := $(LLVM_RTLIB_PATH)/libclang_rt.profile-mipsel-android.a - -# Address sanitizer clang config -$(clang_2nd_arch_prefix)ADDRESS_SANITIZER_LINKER := /system/bin/linker_asan -$(clang_2nd_arch_prefix)ADDRESS_SANITIZER_LINKER_FILE := /system/bin/bootstrap/linker_asan diff --git a/core/clang/TARGET_mips64.mk b/core/clang/TARGET_mips64.mk deleted file mode 100644 index cb6a3cde23..0000000000 --- a/core/clang/TARGET_mips64.mk +++ /dev/null @@ -1,9 +0,0 @@ -RS_TRIPLE := renderscript64-linux-android -RS_TRIPLE_CFLAGS := -RS_COMPAT_TRIPLE := mips64el-linux-android - -TARGET_LIBPROFILE_RT := $(LLVM_RTLIB_PATH)/libclang_rt.profile-mips64el-android.a - -# Address sanitizer clang config -$(clang_2nd_arch_prefix)ADDRESS_SANITIZER_LINKER := /system/bin/linker_asan64 -$(clang_2nd_arch_prefix)ADDRESS_SANITIZER_LINKER_FILE := /system/bin/bootstrap/linker_asan64 diff --git a/core/clear_vars.mk b/core/clear_vars.mk index c01912cd81..c88a1cd950 100644 --- a/core/clear_vars.mk +++ b/core/clear_vars.mk @@ -295,7 +295,6 @@ LOCAL_STRIP_MODULE:= LOCAL_SYSTEM_SHARED_LIBRARIES:=none LOCAL_TARGET_REQUIRED_MODULES:= LOCAL_TEST_CONFIG:= -LOCAL_TEST_CONFIG_OPTIONS:= LOCAL_TEST_DATA:= LOCAL_TEST_MODULE_TO_PROGUARD_WITH:= LOCAL_TIDY:= @@ -476,17 +475,6 @@ LOCAL_ROBOTEST_FILES := LOCAL_ROBOTEST_TIMEOUT := LOCAL_TEST_PACKAGE := -# Aux specific variables -LOCAL_AUX_ARCH := -LOCAL_AUX_CPU := -LOCAL_AUX_OS := -LOCAL_AUX_OS_VARIANT := -LOCAL_AUX_SUBARCH := -LOCAL_AUX_TOOLCHAIN := -LOCAL_CUSTOM_BUILD_STEP_INPUT:= -LOCAL_CUSTOM_BUILD_STEP_OUTPUT:= -LOCAL_IS_AUX_MODULE := - full_android_manifest := non_system_module := diff --git a/core/combo/TARGET_linux-mips.mk b/core/combo/TARGET_linux-mips.mk deleted file mode 100644 index 9f14aa20d2..0000000000 --- a/core/combo/TARGET_linux-mips.mk +++ /dev/null @@ -1,44 +0,0 @@ -# -# Copyright (C) 2010 The Android Open Source Project -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -# Configuration for Linux on MIPS. -# Included by combo/select.mk - -# You can set TARGET_ARCH_VARIANT to use an arch version other -# than mips32r2-fp. Each value should correspond to a file named -# $(BUILD_COMBOS)/arch/<name>.mk which must contain -# makefile variable definitions. Their -# purpose is to allow module Android.mk files to selectively compile -# different versions of code based upon the funtionality and -# instructions available in a given architecture version. -# -# The blocks also define specific arch_variant_cflags, which -# include defines, and compiler settings for the given architecture -# version. -# -ifeq ($(strip $(TARGET_$(combo_2nd_arch_prefix)ARCH_VARIANT)),) -TARGET_$(combo_2nd_arch_prefix)ARCH_VARIANT := mips32r2-fp -endif - -include $(BUILD_SYSTEM)/combo/fdo.mk - -define $(combo_var_prefix)transform-shared-lib-to-toc -$(call _gen_toc_command_for_elf,$(1),$(2)) -endef - -$(combo_2nd_arch_prefix)TARGET_PACK_MODULE_RELOCATIONS := true - -$(combo_2nd_arch_prefix)TARGET_LINKER := /system/bin/linker diff --git a/core/combo/TARGET_linux-mips64.mk b/core/combo/TARGET_linux-mips64.mk deleted file mode 100644 index ae17e465ac..0000000000 --- a/core/combo/TARGET_linux-mips64.mk +++ /dev/null @@ -1,44 +0,0 @@ -# -# Copyright (C) 2013 The Android Open Source Project -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -# Configuration for Linux on MIPS64. -# Included by combo/select.mk - -# You can set TARGET_ARCH_VARIANT to use an arch version other -# than mips64r6. Each value should correspond to a file named -# $(BUILD_COMBOS)/arch/<name>.mk which must contain -# makefile variable definitions. Their -# purpose is to allow module Android.mk files to selectively compile -# different versions of code based upon the funtionality and -# instructions available in a given architecture version. -# -# The blocks also define specific arch_variant_cflags, which -# include defines, and compiler settings for the given architecture -# version. -# -ifeq ($(strip $(TARGET_ARCH_VARIANT)),) -TARGET_ARCH_VARIANT := mips64r6 -endif - -include $(BUILD_SYSTEM)/combo/fdo.mk - -define $(combo_var_prefix)transform-shared-lib-to-toc -$(call _gen_toc_command_for_elf,$(1),$(2)) -endef - -TARGET_PACK_MODULE_RELOCATIONS := true - -TARGET_LINKER := /system/bin/linker64 diff --git a/core/config.mk b/core/config.mk index 0b9ff52bcf..4b1a19e106 100644 --- a/core/config.mk +++ b/core/config.mk @@ -22,6 +22,13 @@ BUILD_SYSTEM_COMMON :=$= build/make/common include $(BUILD_SYSTEM_COMMON)/core.mk +# ----------------------------------------------------------------- +# Rules and functions to help copy important files to DIST_DIR +# when requested. This must be included once only, and must be included before +# soong_config (as soong_config calls make_vars-$(TARGET).mk, and soong may +# propagate calls to dist-for-goals there). +include $(BUILD_SYSTEM)/distdir.mk + # Mark variables that should be coming as environment variables from soong_ui # as readonly .KATI_READONLY := OUT_DIR TMPDIR BUILD_DATETIME_FILE @@ -122,6 +129,26 @@ $(KATI_obsolete_var PRODUCT_IOT) $(KATI_obsolete_var MD5SUM) $(KATI_obsolete_var BOARD_HAL_STATIC_LIBRARIES, See $(CHANGES_URL)#BOARD_HAL_STATIC_LIBRARIES) $(KATI_obsolete_var LOCAL_HAL_STATIC_LIBRARIES, See $(CHANGES_URL)#BOARD_HAL_STATIC_LIBRARIES) +$(KATI_obsolete_var \ + TARGET_AUX_OS_VARIANT_LIST \ + LOCAL_AUX_ARCH \ + LOCAL_AUX_CPU \ + LOCAL_AUX_OS \ + LOCAL_AUX_OS_VARIANT \ + LOCAL_AUX_SUBARCH \ + LOCAL_AUX_TOOLCHAIN \ + LOCAL_CUSTOM_BUILD_STEP_INPUT \ + LOCAL_CUSTOM_BUILD_STEP_OUTPUT \ + LOCAL_IS_AUX_MODULE \ + ,AUX support has been removed) +$(KATI_obsolete_var HOST_OUT_TEST_CONFIG TARGET_OUT_TEST_CONFIG LOCAL_TEST_CONFIG_OPTIONS) +$(KATI_obsolete_var \ + TARGET_PROJECT_INCLUDES \ + 2ND_TARGET_PROJECT_INCLUDES \ + TARGET_PROJECT_SYSTEM_INCLUDES \ + 2ND_TARGET_PROJECT_SYSTEM_INCLUDES \ + ,Project include variables have been removed) +$(KATI_obsolete_var TARGET_PREFER_32_BIT TARGET_PREFER_32_BIT_APPS TARGET_PREFER_32_BIT_EXECUTABLES) $(KATI_obsolete_var PRODUCT_ARTIFACT_SYSTEM_CERTIFICATE_REQUIREMENT_WHITELIST,Use PRODUCT_ARTIFACT_SYSTEM_CERTIFICATE_REQUIREMENT_ALLOW_LIST.) # Used to force goals to build. Only use for conditionally defined goals. @@ -171,8 +198,6 @@ BUILD_HOST_STATIC_LIBRARY :=$= $(BUILD_SYSTEM)/host_static_library.mk BUILD_HOST_SHARED_LIBRARY :=$= $(BUILD_SYSTEM)/host_shared_library.mk BUILD_STATIC_LIBRARY :=$= $(BUILD_SYSTEM)/static_library.mk BUILD_HEADER_LIBRARY :=$= $(BUILD_SYSTEM)/header_library.mk -BUILD_AUX_STATIC_LIBRARY :=$= $(BUILD_SYSTEM)/aux_static_library.mk -BUILD_AUX_EXECUTABLE :=$= $(BUILD_SYSTEM)/aux_executable.mk BUILD_SHARED_LIBRARY :=$= $(BUILD_SYSTEM)/shared_library.mk BUILD_EXECUTABLE :=$= $(BUILD_SYSTEM)/executable.mk BUILD_HOST_EXECUTABLE :=$= $(BUILD_SYSTEM)/host_executable.mk @@ -187,23 +212,12 @@ BUILD_STATIC_JAVA_LIBRARY :=$= $(BUILD_SYSTEM)/static_java_library.mk BUILD_HOST_JAVA_LIBRARY :=$= $(BUILD_SYSTEM)/host_java_library.mk BUILD_COPY_HEADERS :=$= $(BUILD_SYSTEM)/copy_headers.mk BUILD_NATIVE_TEST :=$= $(BUILD_SYSTEM)/native_test.mk -BUILD_NATIVE_BENCHMARK :=$= $(BUILD_SYSTEM)/native_benchmark.mk -BUILD_HOST_NATIVE_TEST :=$= $(BUILD_SYSTEM)/host_native_test.mk BUILD_FUZZ_TEST :=$= $(BUILD_SYSTEM)/fuzz_test.mk -BUILD_HOST_FUZZ_TEST :=$= $(BUILD_SYSTEM)/host_fuzz_test.mk - -BUILD_SHARED_TEST_LIBRARY :=$= $(BUILD_SYSTEM)/shared_test_lib.mk -BUILD_HOST_SHARED_TEST_LIBRARY :=$= $(BUILD_SYSTEM)/host_shared_test_lib.mk -BUILD_STATIC_TEST_LIBRARY :=$= $(BUILD_SYSTEM)/static_test_lib.mk -BUILD_HOST_STATIC_TEST_LIBRARY :=$= $(BUILD_SYSTEM)/host_static_test_lib.mk BUILD_NOTICE_FILE :=$= $(BUILD_SYSTEM)/notice_files.mk BUILD_HOST_DALVIK_JAVA_LIBRARY :=$= $(BUILD_SYSTEM)/host_dalvik_java_library.mk BUILD_HOST_DALVIK_STATIC_JAVA_LIBRARY :=$= $(BUILD_SYSTEM)/host_dalvik_static_java_library.mk -BUILD_HOST_TEST_CONFIG :=$= $(BUILD_SYSTEM)/host_test_config.mk -BUILD_TARGET_TEST_CONFIG :=$= $(BUILD_SYSTEM)/target_test_config.mk - include $(BUILD_SYSTEM)/deprecation.mk # ############################################################### @@ -370,11 +384,6 @@ include $(BUILD_SYSTEM)/goma.mk include $(BUILD_SYSTEM)/rbe.mk endif -ifdef TARGET_PREFER_32_BIT -TARGET_PREFER_32_BIT_APPS := true -TARGET_PREFER_32_BIT_EXECUTABLES := true -endif - # GCC version selection TARGET_GCC_VERSION := 4.9 ifdef TARGET_2ND_ARCH @@ -580,7 +589,7 @@ LEX := $(prebuilt_build_tools_bin_noasan)/flex # prebuilts/build-tools/common/bison. # To run bison from elsewhere you need to set up enviromental variable # BISON_PKGDATADIR. -BISON_PKGDATADIR := $(PWD)/prebuilts/build-tools/common/bison +BISON_PKGDATADIR := $(prebuilt_build_tools)/common/bison BISON := $(prebuilt_build_tools_bin_noasan)/bison YACC := $(BISON) -d BISON_DATA := $(wildcard $(BISON_PKGDATADIR)/* $(BISON_PKGDATADIR)/*/*) @@ -666,7 +675,7 @@ EXTRACT_KERNEL := build/make/tools/extract_kernel.py # Path to tools.jar HOST_JDK_TOOLS_JAR := $(ANDROID_JAVA8_HOME)/lib/tools.jar -APICHECK_COMMAND := $(JAVA) -Xmx4g -jar $(APICHECK) --no-banner --compatible-output=yes +APICHECK_COMMAND := $(JAVA) -Xmx4g -jar $(APICHECK) --no-banner --compatible-output=no # Boolean variable determining if the allow list for compatible properties is enabled PRODUCT_COMPATIBLE_PROPERTY := false @@ -1060,16 +1069,6 @@ else RELATIVE_PWD := endif -TARGET_PROJECT_INCLUDES := -TARGET_PROJECT_SYSTEM_INCLUDES := \ - $(TARGET_DEVICE_KERNEL_HEADERS) $(TARGET_BOARD_KERNEL_HEADERS) \ - $(TARGET_PRODUCT_KERNEL_HEADERS) - -ifdef TARGET_2ND_ARCH -$(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_PROJECT_INCLUDES := $(TARGET_PROJECT_INCLUDES) -$(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_PROJECT_SYSTEM_INCLUDES := $(TARGET_PROJECT_SYSTEM_INCLUDES) -endif - # Flags for DEX2OAT first_non_empty_of_three = $(if $(1),$(1),$(if $(2),$(2),$(3))) DEX2OAT_TARGET_ARCH := $(TARGET_ARCH) @@ -1209,23 +1208,6 @@ endif # These goals don't need to collect and include Android.mks/CleanSpec.mks # in the source tree. dont_bother_goals := out \ - snod systemimage-nodeps \ - userdataimage-nodeps \ - cacheimage-nodeps \ - bptimage-nodeps \ - vnod vendorimage-nodeps \ - pnod productimage-nodeps \ - senod systemextimage-nodeps \ - onod odmimage-nodeps \ - systemotherimage-nodeps \ - ramdisk-nodeps \ - ramdisk_debug-nodeps \ - ramdisk_test_harness-nodeps \ - bootimage-nodeps \ - bootimage_debug-nodeps \ - bootimage_test_harness-nodeps \ - recoveryimage-nodeps \ - vbmetaimage-nodeps \ product-graph dump-products ifeq ($(CALLED_FROM_SETUP),true) @@ -1238,4 +1220,7 @@ endif DEFAULT_DATA_OUT_MODULES := ltp $(ltp_packages) $(kselftest_modules) .KATI_READONLY := DEFAULT_DATA_OUT_MODULES +# Make RECORD_ALL_DEPS readonly. +RECORD_ALL_DEPS :=$= $(filter true,$(RECORD_ALL_DEPS)) + include $(BUILD_SYSTEM)/dumpvar.mk diff --git a/core/config_sanitizers.mk b/core/config_sanitizers.mk index efb21e7c6a..c5cb91c102 100644 --- a/core/config_sanitizers.mk +++ b/core/config_sanitizers.mk @@ -134,12 +134,6 @@ ifneq ($(filter address,$(my_sanitize)),) my_sanitize_diag := $(filter-out cfi,$(my_sanitize_diag)) endif -# CFI needs gold linker, and mips toolchain does not have one. -ifneq ($(filter mips mips64,$(TARGET_$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH)),) - my_sanitize := $(filter-out cfi,$(my_sanitize)) - my_sanitize_diag := $(filter-out cfi,$(my_sanitize_diag)) -endif - # Disable sanitizers which need the UBSan runtime for host targets. ifdef LOCAL_IS_HOST_MODULE my_sanitize := $(filter-out cfi,$(my_sanitize)) @@ -378,8 +372,8 @@ ifneq ($(filter hwaddress,$(my_sanitize)),) my_cflags += $(HWADDRESS_SANITIZER_CONFIG_EXTRA_CFLAGS) endif -# Use minimal diagnostics when integer overflow is enabled; never do it for HOST or AUX modules -ifeq ($(LOCAL_IS_HOST_MODULE)$(LOCAL_IS_AUX_MODULE),) +# Use minimal diagnostics when integer overflow is enabled; never do it for HOST modules +ifeq ($(LOCAL_IS_HOST_MODULE),) # Pre-emptively add UBSAN minimal runtime incase a static library dependency requires it ifeq ($(filter STATIC_LIBRARIES,$(LOCAL_MODULE_CLASS)),) ifndef LOCAL_SDK_VERSION diff --git a/core/construct_context.sh b/core/construct_context.sh index 794795a7b5..d620d0846b 100755 --- a/core/construct_context.sh +++ b/core/construct_context.sh @@ -67,6 +67,10 @@ if [[ "${target_sdk_version}" -lt "29" ]]; then add_to_contexts "${conditional_host_libs_29}" "${conditional_target_libs_29}" fi +if [[ "${target_sdk_version}" -lt "30" ]]; then + add_to_contexts "${conditional_host_libs_30}" "${conditional_target_libs_30}" +fi + add_to_contexts "${dex_preopt_host_libraries}" "${dex_preopt_target_libraries}" # Generate the actual context string. diff --git a/core/definitions.mk b/core/definitions.mk index 89c2e276a3..fd48922b14 100644 --- a/core/definitions.mk +++ b/core/definitions.mk @@ -95,7 +95,6 @@ ANDROID_RESOURCE_GENERATED_CLASSES := 'R.class' 'R$$*.class' 'Manifest.class' 'M # Display names for various build targets TARGET_DISPLAY := target -AUX_DISPLAY := aux HOST_DISPLAY := host HOST_CROSS_DISPLAY := host cross @@ -522,29 +521,32 @@ define reverse-list $(if $(1),$(call reverse-list,$(wordlist 2,$(words $(1)),$(1)))) $(firstword $(1)) endef -define def-host-aux-target -$(eval _idf_val_:=$(if $(strip $(LOCAL_IS_HOST_MODULE)),HOST,$(if $(strip $(LOCAL_IS_AUX_MODULE)),AUX,))) \ -$(_idf_val_) -endef - ########################################################### ## Returns correct _idfPrefix from the list: -## { HOST, HOST_CROSS, AUX, TARGET } +## { HOST, HOST_CROSS, TARGET } ########################################################### # the following rules checked in order: -# ($1 is in {AUX, HOST_CROSS} => $1; +# ($1 is in {HOST_CROSS} => $1; # ($1 is empty) => TARGET; # ($2 is not empty) => HOST_CROSS; # => HOST; define find-idf-prefix $(strip \ - $(eval _idf_pfx_:=$(strip $(filter AUX HOST_CROSS,$(1)))) \ + $(eval _idf_pfx_:=$(strip $(filter HOST_CROSS,$(1)))) \ $(eval _idf_pfx_:=$(if $(strip $(1)),$(if $(_idf_pfx_),$(_idf_pfx_),$(if $(strip $(2)),HOST_CROSS,HOST)),TARGET)) \ $(_idf_pfx_) ) endef ########################################################### +## Convert install path to on-device path. +########################################################### +# $(1): install path +define install-path-to-on-device-path +$(patsubst $(PRODUCT_OUT)%,%,$(1)) +endef + +########################################################### ## The intermediates directory. Where object files go for ## a given target. We could technically get away without ## the "_intermediates" suffix on the directory, but it's @@ -554,7 +556,7 @@ endef # $(1): target class, like "APPS" # $(2): target name, like "NotePad" -# $(3): { HOST, HOST_CROSS, AUX, <empty (TARGET)>, <other non-empty (HOST)> } +# $(3): { HOST, HOST_CROSS, <empty (TARGET)>, <other non-empty (HOST)> } # $(4): if non-empty, force the intermediates to be COMMON # $(5): if non-empty, force the intermediates to be for the 2nd arch # $(6): if non-empty, force the intermediates to be for the host cross os @@ -591,7 +593,7 @@ $(strip \ $(error $(LOCAL_PATH): LOCAL_MODULE_CLASS not defined before call to local-intermediates-dir)) \ $(if $(strip $(LOCAL_MODULE)),, \ $(error $(LOCAL_PATH): LOCAL_MODULE not defined before call to local-intermediates-dir)) \ - $(call intermediates-dir-for,$(LOCAL_MODULE_CLASS),$(LOCAL_MODULE),$(call def-host-aux-target),$(1),$(2),$(3)) \ + $(call intermediates-dir-for,$(LOCAL_MODULE_CLASS),$(LOCAL_MODULE),$(if $(strip $(LOCAL_IS_HOST_MODULE)),HOST),$(1),$(2),$(3)) \ ) endef @@ -606,7 +608,7 @@ endef # $(1): target class, like "APPS" # $(2): target name, like "NotePad" -# $(3): { HOST, HOST_CROSS, AUX, <empty (TARGET)>, <other non-empty (HOST)> } +# $(3): { HOST, HOST_CROSS, <empty (TARGET)>, <other non-empty (HOST)> } # $(4): if non-empty, force the generated sources to be COMMON define generated-sources-dir-for $(strip \ @@ -636,7 +638,7 @@ $(strip \ $(error $(LOCAL_PATH): LOCAL_MODULE_CLASS not defined before call to local-generated-sources-dir)) \ $(if $(strip $(LOCAL_MODULE)),, \ $(error $(LOCAL_PATH): LOCAL_MODULE not defined before call to local-generated-sources-dir)) \ - $(call generated-sources-dir-for,$(LOCAL_MODULE_CLASS),$(LOCAL_MODULE),$(call def-host-aux-target),$(1)) \ + $(call generated-sources-dir-for,$(LOCAL_MODULE_CLASS),$(LOCAL_MODULE),$(if $(strip $(LOCAL_IS_HOST_MODULE)),HOST),$(1)) \ ) endef @@ -1511,89 +1513,6 @@ $(call split-long-arguments,$($(PRIVATE_2ND_ARCH_VAR_PREFIX)TARGET_AR) \ $(hide) mv -f $@.tmp $@ endef -# $(1): the full path of the source static library. -# $(2): the full path of the destination static library. -define _extract-and-include-single-aux-whole-static-lib -$(hide) ldir=$(PRIVATE_INTERMEDIATES_DIR)/WHOLE/$(basename $(notdir $(1)))_objs;\ - rm -rf $$ldir; \ - mkdir -p $$ldir; \ - cp $(1) $$ldir; \ - lib_to_include=$$ldir/$(notdir $(1)); \ - filelist=; \ - subdir=0; \ - for f in `$(PRIVATE_AR) t $(1)`; do \ - if [ -e $$ldir/$$f ]; then \ - mkdir $$ldir/$$subdir; \ - ext=$$subdir/; \ - subdir=$$((subdir+1)); \ - $(PRIVATE_AR) m $$lib_to_include $$f; \ - else \ - ext=; \ - fi; \ - $(PRIVATE_AR) p $$lib_to_include $$f > $$ldir/$$ext$$f; \ - filelist="$$filelist $$ldir/$$ext$$f"; \ - done ; \ - $(PRIVATE_AR) $(AUX_GLOBAL_ARFLAGS) $(2) $$filelist - -endef - -define extract-and-include-aux-whole-static-libs -$(call extract-and-include-whole-static-libs-first, $(firstword $(PRIVATE_ALL_WHOLE_STATIC_LIBRARIES)),$(1)) -$(foreach lib,$(wordlist 2,999,$(PRIVATE_ALL_WHOLE_STATIC_LIBRARIES)), \ - $(call _extract-and-include-single-aux-whole-static-lib, $(lib), $(1))) -endef - -# Explicitly delete the archive first so that ar doesn't -# try to add to an existing archive. -define transform-o-to-aux-static-lib -@echo "$($(PRIVATE_PREFIX)DISPLAY) StaticLib: $(PRIVATE_MODULE) ($@)" -@mkdir -p $(dir $@) -@rm -f $@ $@.tmp -$(call extract-and-include-aux-whole-static-libs,$@.tmp) -$(call split-long-arguments,$(PRIVATE_AR) \ - $(AUX_GLOBAL_ARFLAGS) $@.tmp,$(PRIVATE_ALL_OBJECTS)) -$(hide) mv -f $@.tmp $@ -endef - -define transform-o-to-aux-executable-inner -$(hide) $(PRIVATE_CXX_LINK) -pie \ - -Bdynamic \ - -Wl,--gc-sections \ - $(PRIVATE_ALL_OBJECTS) \ - -Wl,--whole-archive \ - $(PRIVATE_ALL_WHOLE_STATIC_LIBRARIES) \ - -Wl,--no-whole-archive \ - $(PRIVATE_ALL_STATIC_LIBRARIES) \ - $(PRIVATE_LDFLAGS) \ - -o $@ -endef - -define transform-o-to-aux-executable -@echo "$(AUX_DISPLAY) Executable: $(PRIVATE_MODULE) ($@)" -@mkdir -p $(dir $@) -$(transform-o-to-aux-executable-inner) -endef - -define transform-o-to-aux-static-executable-inner -$(hide) $(PRIVATE_CXX_LINK) \ - -Bstatic \ - -Wl,--gc-sections \ - $(PRIVATE_ALL_OBJECTS) \ - -Wl,--whole-archive \ - $(PRIVATE_ALL_WHOLE_STATIC_LIBRARIES) \ - -Wl,--no-whole-archive \ - $(PRIVATE_ALL_STATIC_LIBRARIES) \ - $(PRIVATE_LDFLAGS) \ - -Wl,-Map=$(@).map \ - -o $@ -endef - -define transform-o-to-aux-static-executable -@echo "$(AUX_DISPLAY) StaticExecutable: $(PRIVATE_MODULE) ($@)" -@mkdir -p $(dir $@) -$(transform-o-to-aux-static-executable-inner) -endef - ########################################################### ## Commands for running host ar ########################################################### @@ -2105,7 +2024,7 @@ $(if $(PRIVATE_JAR_PACKAGES), \ $(if $(PRIVATE_JAR_EXCLUDE_PACKAGES), $(hide) rm -rf \ $(foreach pkg, $(PRIVATE_JAR_EXCLUDE_PACKAGES), \ $(PRIVATE_CLASS_INTERMEDIATES_DIR)/$(subst .,/,$(pkg)))) -$(hide) $(JAR) -cf $@ $(call jar-args-sorted-files-in-directory,$(PRIVATE_CLASS_INTERMEDIATES_DIR)) +$(hide) $(SOONG_ZIP) -jar -o $@ -C $(PRIVATE_CLASS_INTERMEDIATES_DIR) -D $(PRIVATE_CLASS_INTERMEDIATES_DIR) $(if $(PRIVATE_EXTRA_JAR_ARGS),$(call add-java-resources-to,$@)) endef @@ -2564,6 +2483,22 @@ $(foreach f, $(1), $(strip \ $(_cmf_dest))) endef +# Copy the file only if it's not an ELF file. For use via $(eval). +# $(1): source file +# $(2): destination file +# $(3): message to print on error +define copy-non-elf-file-checked +$(2): $(1) $(LLVM_READOBJ) + @echo "Copy non-ELF: $$@" + $(hide) \ + if $(LLVM_READOBJ) -h $$< >/dev/null 2>&1; then \ + $(call echo-error,$$@,$(3)); \ + $(call echo-error,$$@,found ELF file: $$<); \ + false; \ + fi + $$(copy-file-to-target) +endef + # The -t option to acp and the -p option to cp is # required for OSX. OSX has a ridiculous restriction # where it's an error for a .a file's modification time @@ -2778,32 +2713,6 @@ $$(PRODUCT_OUT)/$(2) : $$(LOCAL_PATH)/$(1) $$(transform-prebuilt-to-target) endef - -########################################################### -## API Check -########################################################### - -# eval this to define a rule that runs apicheck. -# -# Args: -# $(1) target -# $(2) stable api file -# $(3) api file to be tested -# $(4) stable removed api file -# $(5) removed api file to be tested -# $(6) arguments for apicheck -# $(7) command to run if apicheck failed -# $(8) target dependent on this api check -# $(9) additional dependencies -define check-api -$(TARGET_OUT_COMMON_INTERMEDIATES)/PACKAGING/$(strip $(1))-timestamp: $(2) $(3) $(4) $(APICHECK) $(9) - @echo "Checking API:" $(1) - $(hide) ( $(APICHECK_COMMAND) --check-api-files $(6) $(2) $(3) $(4) $(5) || ( $(7) ; exit 38 ) ) - $(hide) mkdir -p $$(dir $$@) - $(hide) touch $$@ -$(8): $(TARGET_OUT_COMMON_INTERMEDIATES)/PACKAGING/$(strip $(1))-timestamp -endef - ## Whether to build from source if prebuilt alternative exists ########################################################### # $(1): module name @@ -2913,7 +2822,8 @@ $(foreach suite, $(LOCAL_COMPATIBILITY_SUITE), \ $(eval COMPATIBILITY.$(suite).MODULES :=)) \ $(eval COMPATIBILITY.$(suite).FILES += \ $$(foreach f,$$(my_compat_dist_$(suite)),$$(call word-colon,2,$$(f))) \ - $$(foreach f,$$(my_compat_dist_config_$(suite)),$$(call word-colon,2,$$(f)))) \ + $$(foreach f,$$(my_compat_dist_config_$(suite)),$$(call word-colon,2,$$(f))) \ + $$(my_compat_dist_test_data_$(suite))) \ $(eval COMPATIBILITY.$(suite).MODULES += $$(my_register_name))) \ $(eval $(my_all_targets) : $(call copy-many-files, \ $(sort $(foreach suite,$(LOCAL_COMPATIBILITY_SUITE),$(my_compat_dist_$(suite))))) \ @@ -3176,11 +3086,6 @@ endef ## Other includes ########################################################### -# ----------------------------------------------------------------- -# Rules and functions to help copy important files to DIST_DIR -# when requested. -include $(BUILD_SYSTEM)/distdir.mk - # Include any vendor specific definitions.mk file -include $(TOPDIR)vendor/*/build/core/definitions.mk -include $(TOPDIR)device/*/build/core/definitions.mk diff --git a/core/deprecation.mk b/core/deprecation.mk index 19bd4cfb94..2b7a869914 100644 --- a/core/deprecation.mk +++ b/core/deprecation.mk @@ -29,25 +29,25 @@ DEFAULT_WARNING_BUILD_MODULE_TYPES :=$= \ # BUILD_BROKEN_USES_BUILD_* in your BoardConfig.mk in order to turn them back # to warnings. DEFAULT_ERROR_BUILD_MODULE_TYPES :=$= \ - BUILD_AUX_EXECUTABLE \ - BUILD_AUX_STATIC_LIBRARY \ BUILD_COPY_HEADERS \ BUILD_HOST_EXECUTABLE \ - BUILD_HOST_FUZZ_TEST \ - BUILD_HOST_NATIVE_TEST \ BUILD_HOST_SHARED_LIBRARY \ BUILD_HOST_STATIC_LIBRARY \ - BUILD_HOST_STATIC_TEST_LIBRARY \ - BUILD_HOST_TEST_CONFIG \ - BUILD_NATIVE_BENCHMARK \ - BUILD_STATIC_TEST_LIBRARY \ - BUILD_TARGET_TEST_CONFIG \ # These are BUILD_* variables that are always errors to reference. # Setting the BUILD_BROKEN_USES_BUILD_* variables is also an error. OBSOLETE_BUILD_MODULE_TYPES :=$= \ + BUILD_AUX_EXECUTABLE \ + BUILD_AUX_STATIC_LIBRARY \ + BUILD_HOST_FUZZ_TEST \ + BUILD_HOST_NATIVE_TEST \ BUILD_HOST_SHARED_TEST_LIBRARY \ + BUILD_HOST_STATIC_TEST_LIBRARY \ + BUILD_HOST_TEST_CONFIG \ + BUILD_NATIVE_BENCHMARK \ BUILD_SHARED_TEST_LIBRARY \ + BUILD_STATIC_TEST_LIBRARY \ + BUILD_TARGET_TEST_CONFIG \ $(foreach m,$(OBSOLETE_BUILD_MODULE_TYPES),\ $(KATI_obsolete_var $(m),Please convert to Soong) \ diff --git a/core/dex_preopt.mk b/core/dex_preopt.mk index 55eeec663d..20b40518d3 100644 --- a/core/dex_preopt.mk +++ b/core/dex_preopt.mk @@ -18,9 +18,35 @@ endif ALL_DEFAULT_INSTALLED_MODULES += $(call copy-many-files,$(DEXPREOPT_IMAGE_PROFILE_BUILT_INSTALLED),$(PRODUCT_OUT)) # Install boot images. Note that there can be multiple. +my_boot_image_arch := TARGET_ARCH +my_boot_image_out := $(PRODUCT_OUT) +my_boot_image_syms := $(TARGET_OUT_UNSTRIPPED) +my_boot_image_root := DEFAULT_DEX_PREOPT_INSTALLED_IMAGE DEFAULT_DEX_PREOPT_INSTALLED_IMAGE := -$(TARGET_2ND_ARCH_VAR_PREFIX)DEFAULT_DEX_PREOPT_INSTALLED_IMAGE := $(foreach my_boot_image_name,$(DEXPREOPT_IMAGE_NAMES),$(eval include $(BUILD_SYSTEM)/dex_preopt_libart.mk)) +ifdef TARGET_2ND_ARCH + my_boot_image_arch := TARGET_2ND_ARCH + my_boot_image_root := 2ND_DEFAULT_DEX_PREOPT_INSTALLED_IMAGE + 2ND_DEFAULT_DEX_PREOPT_INSTALLED_IMAGE := + $(foreach my_boot_image_name,$(DEXPREOPT_IMAGE_NAMES),$(eval include $(BUILD_SYSTEM)/dex_preopt_libart.mk)) +endif +# Install boot images for testing on host. We exclude framework image as it is not part of art manifest. +my_boot_image_arch := HOST_ARCH +my_boot_image_out := $(HOST_OUT) +my_boot_image_syms := $(HOST_OUT)/symbols +my_boot_image_root := HOST_BOOT_IMAGE +HOST_BOOT_IMAGE := +$(foreach my_boot_image_name,art_host,$(eval include $(BUILD_SYSTEM)/dex_preopt_libart.mk)) +ifdef HOST_2ND_ARCH + my_boot_image_arch := HOST_2ND_ARCH + my_boot_image_root := 2ND_HOST_BOOT_IMAGE + 2ND_HOST_BOOT_IMAGE := + $(foreach my_boot_image_name,art_host,$(eval include $(BUILD_SYSTEM)/dex_preopt_libart.mk)) +endif +my_boot_image_arch := +my_boot_image_out := +my_boot_image_syms := +my_boot_image_root := # Build the boot.zip which contains the boot jars and their compilation output # We can do this only if preopt is enabled and if the product uses libart config (which sets the diff --git a/core/dex_preopt_config.mk b/core/dex_preopt_config.mk index ccf53f5229..55f6f0bec6 100644 --- a/core/dex_preopt_config.mk +++ b/core/dex_preopt_config.mk @@ -1,5 +1,14 @@ DEX_PREOPT_CONFIG := $(SOONG_OUT_DIR)/dexpreopt.config +ENABLE_PREOPT := true +ifneq (true,$(filter true,$(WITH_DEXPREOPT))) + ENABLE_PREOPT := +else ifneq (true,$(filter true,$(PRODUCT_USES_DEFAULT_ART_CONFIG))) + ENABLE_PREOPT := +else ifneq (,$(TARGET_BUILD_APPS)) + ENABLE_PREOPT := +endif + # The default value for LOCAL_DEX_PREOPT DEX_PREOPT_DEFAULT ?= true @@ -45,10 +54,13 @@ PRELOADED_CLASSES := $(call word-colon,1,$(firstword \ DIRTY_IMAGE_OBJECTS := $(call word-colon,1,$(firstword \ $(filter %system/etc/dirty-image-objects,$(PRODUCT_COPY_FILES)))) +# Get value of a property. It is first searched from PRODUCT_VENDOR_PROPERTIES +# and then falls back to PRODUCT_SYSTEM_PROPERTIES +# $1: name of the property define get-product-default-property $(strip \ - $(eval _prop := $(patsubst $(1)=%,%,$(filter $(1)=%,$(PRODUCT_DEFAULT_PROPERTY_OVERRIDES))))\ - $(if $(_prop),$(_prop),$(patsubst $(1)=%,%,$(filter $(1)=%,$(PRODUCT_SYSTEM_DEFAULT_PROPERTIES))))) + $(eval _prop := $(patsubst $(1)=%,%,$(filter $(1)=%,$(PRODUCT_VENDOR_PROPERTIES))))\ + $(if $(_prop),$(_prop),$(patsubst $(1)=%,%,$(filter $(1)=%,$(PRODUCT_SYSTEM_PROPERTIES))))) endef DEX2OAT_IMAGE_XMS := $(call get-product-default-property,dalvik.vm.image-dex2oat-Xms) @@ -56,54 +68,45 @@ DEX2OAT_IMAGE_XMX := $(call get-product-default-property,dalvik.vm.image-dex2oat DEX2OAT_XMS := $(call get-product-default-property,dalvik.vm.dex2oat-Xms) DEX2OAT_XMX := $(call get-product-default-property,dalvik.vm.dex2oat-Xmx) -ifeq ($(TARGET_ARCH),$(filter $(TARGET_ARCH),mips mips64)) -# MIPS specific overrides. -# For MIPS the ART image is loaded at a lower address. This causes issues -# with the image overlapping with memory on the host cross-compiling and -# building the image. We therefore limit the Xmx value. This isn't done -# via a property as we want the larger Xmx value if we're running on a -# MIPS device. -DEX2OAT_XMX := 128m -endif - ifeq ($(WRITE_SOONG_VARIABLES),true) $(call json_start) - $(call add_json_bool, 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, UseArtImage, $(filter true,$(DEXPREOPT_USE_ART_IMAGE))) - $(call add_json_bool, DontUncompressPrivAppsDex, $(filter true,$(DONT_UNCOMPRESS_PRIV_APPS_DEXS))) - $(call add_json_list, ModulesLoadedByPrivilegedModules, $(PRODUCT_LOADED_BY_PRIVILEGED_MODULES)) - $(call add_json_bool, HasSystemOther, $(BOARD_USES_SYSTEM_OTHER_ODEX)) - $(call add_json_list, PatternsOnSystemOther, $(SYSTEM_OTHER_ODEX_FILTER)) - $(call add_json_bool, DisableGenerateProfile, $(filter false,$(WITH_DEX_PREOPT_GENERATE_PROFILE))) - $(call add_json_str, ProfileDir, $(PRODUCT_DEX_PREOPT_PROFILE_DIR)) - $(call add_json_list, BootJars, $(PRODUCT_BOOT_JARS)) - $(call add_json_list, UpdatableBootJars, $(PRODUCT_UPDATABLE_BOOT_JARS)) - $(call add_json_list, ArtApexJars, $(ART_APEX_JARS)) - $(call add_json_list, SystemServerJars, $(PRODUCT_SYSTEM_SERVER_JARS)) - $(call add_json_list, SystemServerApps, $(PRODUCT_SYSTEM_SERVER_APPS)) - $(call add_json_list, UpdatableSystemServerJars, $(PRODUCT_UPDATABLE_SYSTEM_SERVER_JARS)) - $(call add_json_list, SpeedApps, $(PRODUCT_DEXPREOPT_SPEED_APPS)) - $(call add_json_list, PreoptFlags, $(PRODUCT_DEX_PREOPT_DEFAULT_FLAGS)) - $(call add_json_str, DefaultCompilerFilter, $(PRODUCT_DEX_PREOPT_DEFAULT_COMPILER_FILTER)) - $(call add_json_str, SystemServerCompilerFilter, $(PRODUCT_SYSTEM_SERVER_COMPILER_FILTER)) - $(call add_json_bool, GenerateDmFiles, $(PRODUCT_DEX_PREOPT_GENERATE_DM_FILES)) - $(call add_json_bool, NeverAllowStripping, $(PRODUCT_DEX_PREOPT_NEVER_ALLOW_STRIPPING)) - $(call add_json_bool, NoDebugInfo, $(filter false,$(WITH_DEXPREOPT_DEBUG_INFO))) - $(call add_json_bool, DontResolveStartupStrings, $(filter false,$(PRODUCT_DEX_PREOPT_RESOLVE_STARTUP_STRINGS))) - $(call add_json_bool, AlwaysSystemServerDebugInfo, $(filter true,$(PRODUCT_SYSTEM_SERVER_DEBUG_INFO))) - $(call add_json_bool, NeverSystemServerDebugInfo, $(filter false,$(PRODUCT_SYSTEM_SERVER_DEBUG_INFO))) - $(call add_json_bool, AlwaysOtherDebugInfo, $(filter true,$(PRODUCT_OTHER_JAVA_DEBUG_INFO))) - $(call add_json_bool, NeverOtherDebugInfo, $(filter false,$(PRODUCT_OTHER_JAVA_DEBUG_INFO))) - $(call add_json_bool, IsEng, $(filter eng,$(TARGET_BUILD_VARIANT))) - $(call add_json_bool, SanitizeLite, $(SANITIZE_LITE)) - $(call add_json_bool, DefaultAppImages, $(WITH_DEX_PREOPT_APP_IMAGE)) - $(call add_json_str, Dex2oatXmx, $(DEX2OAT_XMX)) - $(call add_json_str, Dex2oatXms, $(DEX2OAT_XMS)) - $(call add_json_str, EmptyDirectory, $(OUT_DIR)/empty) + $(call add_json_bool, DisablePreopt, $(call invert_bool,$(ENABLE_PREOPT))) + $(call add_json_list, DisablePreoptModules, $(DEXPREOPT_DISABLED_MODULES)) + $(call add_json_bool, OnlyPreoptBootImageAndSystemServer, $(filter true,$(WITH_DEXPREOPT_BOOT_IMG_AND_SYSTEM_SERVER_ONLY))) + $(call add_json_bool, UseArtImage, $(filter true,$(DEXPREOPT_USE_ART_IMAGE))) + $(call add_json_bool, DontUncompressPrivAppsDex, $(filter true,$(DONT_UNCOMPRESS_PRIV_APPS_DEXS))) + $(call add_json_list, ModulesLoadedByPrivilegedModules, $(PRODUCT_LOADED_BY_PRIVILEGED_MODULES)) + $(call add_json_bool, HasSystemOther, $(BOARD_USES_SYSTEM_OTHER_ODEX)) + $(call add_json_list, PatternsOnSystemOther, $(SYSTEM_OTHER_ODEX_FILTER)) + $(call add_json_bool, DisableGenerateProfile, $(filter false,$(WITH_DEX_PREOPT_GENERATE_PROFILE))) + $(call add_json_str, ProfileDir, $(PRODUCT_DEX_PREOPT_PROFILE_DIR)) + $(call add_json_list, BootJars, $(PRODUCT_BOOT_JARS)) + $(call add_json_list, UpdatableBootJars, $(PRODUCT_UPDATABLE_BOOT_JARS)) + $(call add_json_list, ArtApexJars, $(ART_APEX_JARS)) + $(call add_json_list, SystemServerJars, $(PRODUCT_SYSTEM_SERVER_JARS)) + $(call add_json_list, SystemServerApps, $(PRODUCT_SYSTEM_SERVER_APPS)) + $(call add_json_list, UpdatableSystemServerJars, $(PRODUCT_UPDATABLE_SYSTEM_SERVER_JARS)) + $(call add_json_bool, BrokenSuboptimalOrderOfSystemServerJars, $(PRODUCT_BROKEN_SUBOPTIMAL_ORDER_OF_SYSTEM_SERVER_JARS)) + $(call add_json_list, SpeedApps, $(PRODUCT_DEXPREOPT_SPEED_APPS)) + $(call add_json_list, PreoptFlags, $(PRODUCT_DEX_PREOPT_DEFAULT_FLAGS)) + $(call add_json_str, DefaultCompilerFilter, $(PRODUCT_DEX_PREOPT_DEFAULT_COMPILER_FILTER)) + $(call add_json_str, SystemServerCompilerFilter, $(PRODUCT_SYSTEM_SERVER_COMPILER_FILTER)) + $(call add_json_bool, GenerateDmFiles, $(PRODUCT_DEX_PREOPT_GENERATE_DM_FILES)) + $(call add_json_bool, NeverAllowStripping, $(PRODUCT_DEX_PREOPT_NEVER_ALLOW_STRIPPING)) + $(call add_json_bool, NoDebugInfo, $(filter false,$(WITH_DEXPREOPT_DEBUG_INFO))) + $(call add_json_bool, DontResolveStartupStrings, $(filter false,$(PRODUCT_DEX_PREOPT_RESOLVE_STARTUP_STRINGS))) + $(call add_json_bool, AlwaysSystemServerDebugInfo, $(filter true,$(PRODUCT_SYSTEM_SERVER_DEBUG_INFO))) + $(call add_json_bool, NeverSystemServerDebugInfo, $(filter false,$(PRODUCT_SYSTEM_SERVER_DEBUG_INFO))) + $(call add_json_bool, AlwaysOtherDebugInfo, $(filter true,$(PRODUCT_OTHER_JAVA_DEBUG_INFO))) + $(call add_json_bool, NeverOtherDebugInfo, $(filter false,$(PRODUCT_OTHER_JAVA_DEBUG_INFO))) + $(call add_json_bool, IsEng, $(filter eng,$(TARGET_BUILD_VARIANT))) + $(call add_json_bool, SanitizeLite, $(SANITIZE_LITE)) + $(call add_json_bool, DefaultAppImages, $(WITH_DEX_PREOPT_APP_IMAGE)) + $(call add_json_str, Dex2oatXmx, $(DEX2OAT_XMX)) + $(call add_json_str, Dex2oatXms, $(DEX2OAT_XMS)) + $(call add_json_str, EmptyDirectory, $(OUT_DIR)/empty) $(call add_json_map, CpuVariant) $(call add_json_str, $(TARGET_ARCH), $(DEX2OAT_TARGET_CPU_VARIANT)) diff --git a/core/dex_preopt_libart.mk b/core/dex_preopt_libart.mk index 79d5f8cd8b..12b29f4ad7 100644 --- a/core/dex_preopt_libart.mk +++ b/core/dex_preopt_libart.mk @@ -1,45 +1,42 @@ #################################### # ART boot image installation -# Input variable: +# Input variables: # my_boot_image_name: the boot image to install +# my_boot_image_arch: the architecture to install (e.g. TARGET_ARCH, not expanded) +# my_boot_image_out: the install directory (e.g. $(PRODUCT_OUT)) +# my_boot_image_syms: the symbols director (e.g. $(TARGET_OUT_UNSTRIPPED)) +# my_boot_image_root: make variable used to store installed image path # #################################### -# Install primary arch vdex files into a shared location, and then symlink them to both the primary -# and secondary arch directories. -my_vdex_copy_pairs := $(DEXPREOPT_IMAGE_VDEX_BUILT_INSTALLED_$(my_boot_image_name)_$(TARGET_ARCH)) -my_installed := $(foreach v,$(my_vdex_copy_pairs),$(PRODUCT_OUT)$(call word-colon,2,$(v))) -$(firstword $(my_installed)): $(wordlist 2,9999,$(my_installed)) - -my_built_vdex_dir := $(dir $(call word-colon,1,$(firstword $(my_vdex_copy_pairs)))) -my_installed_vdex_dir := $(PRODUCT_OUT)$(dir $(call word-colon,2,$(firstword $(my_vdex_copy_pairs)))) - -$(my_installed): $(my_installed_vdex_dir)% : $(my_built_vdex_dir)% - @echo "Install: $@" - @rm -f $@ - $(copy-file-to-target) - mkdir -p $(dir $@)/$(TARGET_ARCH) - ln -sfn ../$(notdir $@) $(dir $@)/$(TARGET_ARCH) -ifdef TARGET_2ND_ARCH - mkdir -p $(dir $@)/$(TARGET_2ND_ARCH) - ln -sfn ../$(notdir $@) $(dir $@)/$(TARGET_2ND_ARCH) +# Install $(1) to $(2) so that it is shared between architectures. +define copy-vdex-file +my_vdex_shared := $$(dir $$(patsubst %/,%,$$(dir $(2))))$$(notdir $(2)) # Remove the arch dir. +ifneq ($(my_boot_image_arch),$(filter $(my_boot_image_arch), TARGET_2ND_ARCH HOST_2ND_ARCH)) +$$(my_vdex_shared): $(1) # Copy $(1) to directory one level up (i.e. with the arch dir removed). + @echo "Install: $$@" + $$(copy-file-to-target) endif - -my_dexpreopt_image_extra_deps := $(firstword $(my_installed)) - -my_2nd_arch_prefix := -include $(BUILD_SYSTEM)/dex_preopt_libart_boot.mk - -ifdef TARGET_2ND_ARCH - my_2nd_arch_prefix := $(TARGET_2ND_ARCH_VAR_PREFIX) - include $(BUILD_SYSTEM)/dex_preopt_libart_boot.mk -endif - -my_2nd_arch_prefix := - - -my_vdex_copy_pairs := +$(2): $$(my_vdex_shared) # Create symlink at $(2) which points to the actual physical copy. + @echo "Symlink: $$@" + mkdir -p $$(dir $$@) + ln -sfn ../$$(notdir $$@) $$@ +my_vdex_shared := +endef + +# Same as 'copy-many-files' but it uses the vdex-specific helper above. +define copy-vdex-files +$(foreach v,$(1),$(eval $(call copy-vdex-file, $(call word-colon,1,$(v)), $(2)$(call word-colon,2,$(v))))) +$(foreach v,$(1),$(2)$(call word-colon,2,$(v))) +endef + +# Install the boot images compiled by Soong. +# The first file is saved in $(my_boot_image_root) and the rest are added as it's dependencies. +my_suffix := BUILT_INSTALLED_$(my_boot_image_name)_$($(my_boot_image_arch)) +my_installed := $(call copy-many-files,$(DEXPREOPT_IMAGE_$(my_suffix)),$(my_boot_image_out)) +my_installed += $(call copy-many-files,$(DEXPREOPT_IMAGE_UNSTRIPPED_$(my_suffix)),$(my_boot_image_syms)) +my_installed += $(call copy-vdex-files,$(DEXPREOPT_IMAGE_VDEX_$(my_suffix)),$(my_boot_image_out)) +$(my_boot_image_root) += $(firstword $(my_installed)) +$(firstword $(my_installed)): $(wordlist 2,9999,$(my_installed)) my_installed := -my_built_vdex_dir := -my_installed_vdex_dir := -my_dexpreopt_image_extra_deps := +my_suffix := diff --git a/core/dex_preopt_libart_boot.mk b/core/dex_preopt_libart_boot.mk deleted file mode 100644 index 34b8526581..0000000000 --- a/core/dex_preopt_libart_boot.mk +++ /dev/null @@ -1,25 +0,0 @@ -# Rules to install a boot image built by dexpreopt_bootjars.go -# Input variables: -# my_boot_image_name: the boot image to install -# my_2nd_arch_prefix: indicates if this is to build for the 2nd arch. -# my_dexpreopt_image_extra_deps: extra dependencies to add on the installed boot.art - -# Install the boot images compiled by Soong -# The first file (generally boot.art) is saved as DEFAULT_DEX_PREOPT_INSTALLED_IMAGE, -# and the rest are added as dependencies of the first. - -my_installed := $(call copy-many-files,$(DEXPREOPT_IMAGE_BUILT_INSTALLED_$(my_boot_image_name)_$(TARGET_$(my_2nd_arch_prefix)ARCH)),$(PRODUCT_OUT)) -$(firstword $(my_installed)): $(wordlist 2,9999,$(my_installed)) -$(my_2nd_arch_prefix)DEFAULT_DEX_PREOPT_INSTALLED_IMAGE += $(firstword $(my_installed)) - -# Install the unstripped boot images compiled by Soong into the symbols directory -# The first file (generally boot.art) made a dependency of DEFAULT_DEX_PREOPT_INSTALLED_IMAGE, -# and the rest are added as dependencies of the first. -my_installed := $(call copy-many-files,$(DEXPREOPT_IMAGE_UNSTRIPPED_BUILT_INSTALLED_$(my_boot_image_name)_$(TARGET_$(my_2nd_arch_prefix)ARCH)),$(TARGET_OUT_UNSTRIPPED)) -$(firstword $(my_installed)): $(wordlist 2,9999,$(my_installed)) -$($(my_2nd_arch_prefix)DEFAULT_DEX_PREOPT_INSTALLED_IMAGE): $(firstword $(my_installed)) - -$($(my_2nd_arch_prefix)DEFAULT_DEX_PREOPT_INSTALLED_IMAGE): $(my_dexpreopt_image_extra_deps) - -my_installed := -my_built_installed := diff --git a/core/dex_preopt_odex_install.mk b/core/dex_preopt_odex_install.mk index a33b2b4d53..440ffd99a3 100644 --- a/core/dex_preopt_odex_install.mk +++ b/core/dex_preopt_odex_install.mk @@ -195,6 +195,7 @@ ifdef LOCAL_DEX_PREOPT org.apache.http.legacy \ android.hidl.base-V1.0-java \ android.hidl.manager-V1.0-java \ + android.test.base \ my_dexpreopt_libs := $(sort \ $(LOCAL_USES_LIBRARIES) \ @@ -233,7 +234,11 @@ ifdef LOCAL_DEX_PREOPT $(call add_json_list, UsesLibraries, $(LOCAL_USES_LIBRARIES)) $(call add_json_map, LibraryPaths) $(foreach lib,$(my_dexpreopt_libs),\ - $(call add_json_str, $(lib), $(call intermediates-dir-for,JAVA_LIBRARIES,$(lib),,COMMON)/javalib.jar)) + $(call add_json_map, $(lib)) \ + $(eval file := $(filter %/$(lib).jar, $(call module-installed-files,$(lib)))) \ + $(call add_json_str, Host, $(call intermediates-dir-for,JAVA_LIBRARIES,$(lib),,COMMON)/javalib.jar) \ + $(call add_json_str, Device, $(call install-path-to-on-device-path,$(file))) \ + $(call end_json_map)) $(call end_json_map) $(call add_json_list, Archs, $(my_dexpreopt_archs)) $(call add_json_list, DexPreoptImages, $(my_dexpreopt_images)) diff --git a/core/envsetup.mk b/core/envsetup.mk index f4650f99f3..3aff0079ca 100644 --- a/core/envsetup.mk +++ b/core/envsetup.mk @@ -94,14 +94,28 @@ endif TARGET_BUILD_APPS ?= +# Set to true for an unbundled build, i.e. a build without +# support for platform targets like the system image. This also +# disables consistency checks that only apply to full platform +# builds. +TARGET_BUILD_UNBUNDLED ?= + +# TARGET_BUILD_APPS implies unbundled build, otherwise we default +# to bundled (i.e. platform targets such as the system image are +# included). +ifneq ($(TARGET_BUILD_APPS),) + TARGET_BUILD_UNBUNDLED := true +endif + .KATI_READONLY := \ TARGET_PRODUCT \ TARGET_BUILD_VARIANT \ - TARGET_BUILD_APPS + TARGET_BUILD_APPS \ + TARGET_BUILD_UNBUNDLED \ # --------------------------------------------------------------- # Set up configuration for host machine. We don't do cross- -# compiles except for arm/mips, so the HOST is whatever we are +# compiles except for arm, so the HOST is whatever we are # running on # HOST_OS @@ -258,7 +272,12 @@ endef # java code with dalvikvm/art. # Jars present in the ART apex. These should match exactly the list of # Java libraries in the ART apex build rule. -ART_APEX_JARS := core-oj core-libart core-icu4j okhttp bouncycastle apache-xml +ART_APEX_JARS := \ + com.android.art:core-oj \ + com.android.art:core-libart \ + com.android.art:okhttp \ + com.android.art:bouncycastle \ + com.android.art:apache-xml ################################################################# # Read the product specs so we can get TARGET_DEVICE and other @@ -360,9 +379,6 @@ HOST_OUT_FAKE := $(HOST_OUT)/fake_packages HOST_OUT_COMMON_INTERMEDIATES \ HOST_OUT_FAKE -# Nano environment config -include $(BUILD_SYSTEM)/aux_config.mk - HOST_CROSS_OUT_INTERMEDIATES := $(HOST_CROSS_OUT)/obj HOST_CROSS_OUT_NOTICE_FILES := $(HOST_CROSS_OUT_INTERMEDIATES)/NOTICE_FILES .KATI_READONLY := \ @@ -378,9 +394,6 @@ HOST_OUT_COMMON_GEN := $(HOST_COMMON_OUT_ROOT)/gen HOST_CROSS_OUT_GEN := $(HOST_CROSS_OUT)/gen .KATI_READONLY := HOST_CROSS_OUT_GEN -HOST_OUT_TEST_CONFIG := $(HOST_OUT)/test_config -.KATI_READONLY := HOST_OUT_TEST_CONFIG - # Out for HOST_2ND_ARCH $(HOST_2ND_ARCH_VAR_PREFIX)HOST_OUT_INTERMEDIATES := $(HOST_OUT)/obj32 $(HOST_2ND_ARCH_VAR_PREFIX)HOST_OUT_SHARED_LIBRARIES := $(HOST_OUT)/lib @@ -466,7 +479,6 @@ TARGET_OUT_ETC := $(TARGET_OUT)/etc TARGET_OUT_NOTICE_FILES := $(TARGET_OUT_INTERMEDIATES)/NOTICE_FILES TARGET_OUT_FAKE := $(PRODUCT_OUT)/fake_packages TARGET_OUT_TESTCASES := $(PRODUCT_OUT)/testcases -TARGET_OUT_TEST_CONFIG := $(PRODUCT_OUT)/test_config .KATI_READONLY := \ TARGET_OUT_EXECUTABLES \ TARGET_OUT_OPTIONAL_EXECUTABLES \ @@ -480,8 +492,7 @@ TARGET_OUT_TEST_CONFIG := $(PRODUCT_OUT)/test_config TARGET_OUT_ETC \ TARGET_OUT_NOTICE_FILES \ TARGET_OUT_FAKE \ - TARGET_OUT_TESTCASES \ - TARGET_OUT_TEST_CONFIG + TARGET_OUT_TESTCASES ifeq ($(SANITIZE_LITE),true) # When using SANITIZE_LITE, APKs must not be packaged with sanitized libraries, as they will not diff --git a/core/executable.mk b/core/executable.mk index db8dcc6318..9175e0ad65 100644 --- a/core/executable.mk +++ b/core/executable.mk @@ -40,14 +40,9 @@ else #!LOCAL_MULTILIB == both LOCAL_NO_2ND_ARCH_MODULE_SUFFIX := true endif -# if TARGET_PREFER_32_BIT_EXECUTABLES is set, try to build 32-bit first ifdef TARGET_2ND_ARCH -ifeq ($(TARGET_PREFER_32_BIT_EXECUTABLES),true) -LOCAL_2ND_ARCH_VAR_PREFIX := $(TARGET_2ND_ARCH_VAR_PREFIX) -else LOCAL_2ND_ARCH_VAR_PREFIX := endif -endif my_skip_non_preferred_arch := @@ -65,12 +60,7 @@ endif ifndef my_skip_non_preferred_arch ifdef TARGET_2ND_ARCH -# check if the non-preferred arch is the primary or secondary -ifeq ($(TARGET_PREFER_32_BIT_EXECUTABLES),true) -LOCAL_2ND_ARCH_VAR_PREFIX := -else LOCAL_2ND_ARCH_VAR_PREFIX := $(TARGET_2ND_ARCH_VAR_PREFIX) -endif # check if non-preferred arch is supported include $(BUILD_SYSTEM)/module_arch_supported.mk diff --git a/core/executable_prefer_symlink.mk b/core/executable_prefer_symlink.mk index 9b9814e3b8..fea0bef64b 100644 --- a/core/executable_prefer_symlink.mk +++ b/core/executable_prefer_symlink.mk @@ -5,22 +5,13 @@ # Note: now only limited to the binaries that will be installed under system/bin directory # Create link to the one used depending on the target -# configuration. Note that we require the TARGET_IS_64_BIT -# check because 32 bit targets may not define TARGET_PREFER_32_BIT_APPS -# et al. since those variables make no sense in that context. +# configuration. ifneq ($(LOCAL_IS_HOST_MODULE),true) my_symlink := $(addprefix $(TARGET_OUT)/bin/, $(LOCAL_MODULE)) my_src_binary_name := ifeq ($(TARGET_IS_64_BIT),true) ifeq ($(TARGET_SUPPORTS_64_BIT_APPS)|$(TARGET_SUPPORTS_32_BIT_APPS),true|true) - # We support both 32 and 64 bit apps, so we will have to - # base our decision on whether the target prefers one or the - # other. - ifeq ($(TARGET_PREFER_32_BIT_APPS),true) - my_src_binary_name := $(LOCAL_MODULE_STEM_32) - else - my_src_binary_name := $(LOCAL_MODULE_STEM_64) - endif + my_src_binary_name := $(LOCAL_MODULE_STEM_64) else ifeq ($(TARGET_SUPPORTS_64_BIT_APPS),true) # We support only 64 bit apps. my_src_binary_name := $(LOCAL_MODULE_STEM_64) @@ -40,7 +31,7 @@ $(call symlink-file,$(my_module_path)/$(my_src_binary_name),$(my_src_binary_name # We need this so that the installed files could be picked up based on the # local module name -ALL_MODULES.$(LOCAL_MODULE).INSTALLED += $(my_symlink) +ALL_MODULES.$(my_register_name).INSTALLED += $(my_symlink) # Create the symlink when you run mm/mmm or "make <module_name>" $(LOCAL_MODULE) : $(my_symlink) diff --git a/core/goma.mk b/core/goma.mk index c265259da0..2b51d8be44 100644 --- a/core/goma.mk +++ b/core/goma.mk @@ -27,7 +27,8 @@ ifneq ($(filter-out false,$(USE_GOMA)),) # use both ccache and gomacc. CC_WRAPPER := $(strip $(CC_WRAPPER) $(GOMA_CC)) CXX_WRAPPER := $(strip $(CXX_WRAPPER) $(GOMA_CC)) - JAVAC_WRAPPER := $(strip $(JAVAC_WRAPPER) $(GOMA_CC)) + # b/143658984: goma can't handle the --system argument to javac + #JAVAC_WRAPPER := $(strip $(JAVAC_WRAPPER) $(GOMA_CC)) goma_dir := endif diff --git a/core/host_dalvik_java_library.mk b/core/host_dalvik_java_library.mk index 882fe3a835..da329788e8 100644 --- a/core/host_dalvik_java_library.mk +++ b/core/host_dalvik_java_library.mk @@ -79,7 +79,8 @@ java_sources_deps := \ $(java_source_list_file): $(java_sources_deps) $(write-java-source-list) -$(full_classes_compiled_jar): .KATI_NINJA_POOL := $(GOMA_POOL) +# TODO(b/143658984): goma can't handle the --system argument to javac. +#$(full_classes_compiled_jar): .KATI_NINJA_POOL := $(GOMA_POOL) $(full_classes_compiled_jar): PRIVATE_JAVA_LAYERS_FILE := $(layers_file) $(full_classes_compiled_jar): PRIVATE_JAVACFLAGS := $(LOCAL_JAVACFLAGS) $(annotation_processor_flags) $(full_classes_compiled_jar): PRIVATE_JAR_EXCLUDE_FILES := @@ -98,6 +99,7 @@ $(full_classes_compiled_jar): \ $(NORMALIZE_PATH) \ $(JAR_ARGS) \ $(ZIPSYNC) \ + $(SOONG_ZIP) \ | $(SOONG_JAVAC_WRAPPER) $(transform-host-java-to-dalvik-package) diff --git a/core/host_fuzz_test.mk b/core/host_fuzz_test.mk deleted file mode 100644 index 54c6577fdb..0000000000 --- a/core/host_fuzz_test.mk +++ /dev/null @@ -1,10 +0,0 @@ -################################################ -## A thin wrapper around BUILD_HOST_EXECUTABLE -## Common flags for host fuzz tests are added. -################################################ -$(call record-module-type,HOST_FUZZ_TEST) - -LOCAL_SANITIZE += fuzzer -LOCAL_STATIC_LIBRARIES += libLLVMFuzzer - -include $(BUILD_HOST_EXECUTABLE) diff --git a/core/host_java_library.mk b/core/host_java_library.mk index beaea2ad71..f9abe9bc4e 100644 --- a/core/host_java_library.mk +++ b/core/host_java_library.mk @@ -70,7 +70,8 @@ java_sources_deps := \ $(java_source_list_file): $(java_sources_deps) $(write-java-source-list) -$(full_classes_compiled_jar): .KATI_NINJA_POOL := $(GOMA_POOL) +# TODO(b/143658984): goma can't handle the --system argument to javac. +#$(full_classes_compiled_jar): .KATI_NINJA_POOL := $(GOMA_POOL) $(full_classes_compiled_jar): PRIVATE_JAVA_LAYERS_FILE := $(layers_file) $(full_classes_compiled_jar): PRIVATE_JAVACFLAGS := $(LOCAL_JAVACFLAGS) $(annotation_processor_flags) $(full_classes_compiled_jar): PRIVATE_JAR_EXCLUDE_FILES := @@ -89,6 +90,7 @@ $(full_classes_compiled_jar): \ $(ZIPTIME) \ $(JAR_ARGS) \ $(ZIPSYNC) \ + $(SOONG_ZIP) \ | $(SOONG_JAVAC_WRAPPER) $(transform-host-java-to-package) $(remove-timestamps-from-package) diff --git a/core/host_native_test.mk b/core/host_native_test.mk deleted file mode 100644 index aa05bb3156..0000000000 --- a/core/host_native_test.mk +++ /dev/null @@ -1,23 +0,0 @@ -################################################ -## A thin wrapper around BUILD_HOST_EXECUTABLE -## Common flags for host native tests are added. -################################################ -$(call record-module-type,HOST_NATIVE_TEST) - -ifdef LOCAL_MODULE_CLASS -ifneq ($(LOCAL_MODULE_CLASS),NATIVE_TESTS) -$(error $(LOCAL_PATH): LOCAL_MODULE_CLASS must be NATIVE_TESTS with BUILD_HOST_NATIVE_TEST) -endif -endif - -LOCAL_MODULE_CLASS := NATIVE_TESTS - -include $(BUILD_SYSTEM)/host_test_internal.mk - -ifndef LOCAL_MULTILIB -ifndef LOCAL_32_BIT_ONLY -LOCAL_MULTILIB := both -endif -endif - -include $(BUILD_HOST_EXECUTABLE) diff --git a/core/host_shared_test_lib.mk b/core/host_shared_test_lib.mk deleted file mode 100644 index ed7e23abc1..0000000000 --- a/core/host_shared_test_lib.mk +++ /dev/null @@ -1 +0,0 @@ -$(error BUILD_HOST_SHARED_TEST_LIBRARY is obsolete) diff --git a/core/host_static_test_lib.mk b/core/host_static_test_lib.mk deleted file mode 100644 index a9e39b1baf..0000000000 --- a/core/host_static_test_lib.mk +++ /dev/null @@ -1,9 +0,0 @@ -################################################## -## A thin wrapper around BUILD_HOST_STATIC_LIBRARY -## Common flags for host native tests are added. -################################################## -$(call record-module-type,HOST_STATIC_TEST_LIBRARY) - -include $(BUILD_SYSTEM)/host_test_internal.mk - -include $(BUILD_SYSTEM)/host_static_library.mk diff --git a/core/host_test_internal.mk b/core/host_test_internal.mk deleted file mode 100644 index dfe8cf1505..0000000000 --- a/core/host_test_internal.mk +++ /dev/null @@ -1,28 +0,0 @@ -##################################################### -## Shared definitions for all host test compilations. -##################################################### - -ifeq ($(LOCAL_GTEST),true) - LOCAL_CFLAGS_linux += -DGTEST_OS_LINUX - LOCAL_CFLAGS_darwin += -DGTEST_OS_MAC - - LOCAL_CFLAGS += -DGTEST_HAS_STD_STRING -O0 -g - - LOCAL_STATIC_LIBRARIES += libgtest_main_host libgtest_host -endif - -ifdef LOCAL_MODULE_PATH -$(error $(LOCAL_PATH): Do not set LOCAL_MODULE_PATH when building test $(LOCAL_MODULE)) -endif - -ifdef LOCAL_MODULE_PATH_32 -$(error $(LOCAL_PATH): Do not set LOCAL_MODULE_PATH_32 when building test $(LOCAL_MODULE)) -endif - -ifdef LOCAL_MODULE_PATH_64 -$(error $(LOCAL_PATH): Do not set LOCAL_MODULE_PATH_64 when building test $(LOCAL_MODULE)) -endif - -ifndef LOCAL_MODULE_RELATIVE_PATH -LOCAL_MODULE_RELATIVE_PATH := $(LOCAL_MODULE) -endif diff --git a/core/install_jni_libs_internal.mk b/core/install_jni_libs_internal.mk index 48c93de45f..289d16fc6e 100644 --- a/core/install_jni_libs_internal.mk +++ b/core/install_jni_libs_internal.mk @@ -57,9 +57,9 @@ else ifneq ($(my_jni_shared_libraries),) # not my_embed_jni # Make sure the JNI libraries get installed 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)) - ALL_MODULES.$(LOCAL_MODULE).INSTALLED += $(my_installed_library) + bit_suffix := $(if $(filter %64,$(TARGET_$(my_2nd_arch_prefix)ARCH)),:64,:32) + ALL_MODULES.$(my_register_name).REQUIRED_FROM_TARGET += $(addsuffix $(bit_suffix),$(LOCAL_JNI_SHARED_LIBRARIES)) # Create symlink in the app specific lib path # Skip creating this symlink when running the second part of a target sanitization build. @@ -72,7 +72,7 @@ else ifneq ($(my_jni_shared_libraries),) # not my_embed_jni $(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))) + $(eval ALL_MODULES.$(my_register_name).INSTALLED += $$(my_app_lib_path)/$$(lib))) endif # Clear jni_shared_libraries to not embed it into the apk. @@ -100,7 +100,7 @@ ifdef my_prebuilt_jni_libs my_installed_library := $(addprefix $(my_app_lib_path)/, $(notdir $(my_prebuilt_jni_libs))) $(LOCAL_INSTALLED_MODULE) : $(my_installed_library) - ALL_MODULES.$(LOCAL_MODULE).INSTALLED += $(my_installed_library) + ALL_MODULES.$(my_register_name).INSTALLED += $(my_installed_library) endif # my_embed_jni endif # inner my_prebuilt_jni_libs endif # outer my_prebuilt_jni_libs diff --git a/core/java.mk b/core/java.mk index a041321b63..9d42775a9b 100644 --- a/core/java.mk +++ b/core/java.mk @@ -207,7 +207,7 @@ ifdef full_classes_jar # allowing it to use the classes.jar as the "stubs" that would be use to link # against, for the cases where someone needs the jar to link against. $(eval $(call copy-one-file,$(full_classes_jar),$(full_classes_stubs_jar))) -ALL_MODULES.$(LOCAL_MODULE).STUBS := $(full_classes_stubs_jar) +ALL_MODULES.$(my_register_name).STUBS := $(full_classes_stubs_jar) # The layers file allows you to enforce a layering between java packages. # Run build/make/tools/java-layers.py for more details. @@ -274,7 +274,8 @@ $(eval $(call copy-one-file,$(full_classes_header_jarjar),$(full_classes_header_ endif # TURBINE_ENABLED != false -$(full_classes_compiled_jar): .KATI_NINJA_POOL := $(GOMA_POOL) +# TODO(b/143658984): goma can't handle the --system argument to javac. +#$(full_classes_compiled_jar): .KATI_NINJA_POOL := $(GOMA_POOL) $(full_classes_compiled_jar): PRIVATE_JAVACFLAGS := $(LOCAL_JAVACFLAGS) $(annotation_processor_flags) $(full_classes_compiled_jar): PRIVATE_JAR_EXCLUDE_FILES := $(LOCAL_JAR_EXCLUDE_FILES) $(full_classes_compiled_jar): PRIVATE_JAR_PACKAGES := $(LOCAL_JAR_PACKAGES) @@ -295,6 +296,7 @@ $(full_classes_compiled_jar): \ $(NORMALIZE_PATH) \ $(JAR_ARGS) \ $(ZIPSYNC) \ + $(SOONG_ZIP) \ | $(SOONG_JAVAC_WRAPPER) @echo "Target Java: $@ $(call compile-java,$(TARGET_JAVAC),$(PRIVATE_ALL_JAVA_HEADER_LIBRARIES)) @@ -499,9 +501,9 @@ else # !LOCAL_PROGUARD_ENABLED $(transform-classes.jar-to-dex) endif -ifneq ($(filter $(LOCAL_MODULE),$(PRODUCT_BOOT_JARS)),) - $(call pretty-error,Modules in PRODUCT_BOOT_JARS must be defined in Android.bp files) -endif +$(foreach pair,$(PRODUCT_BOOT_JARS), \ + $(if $(filter $(LOCAL_MODULE),$(call word-colon,2,$(pair))), \ + $(call pretty-error,Modules in PRODUCT_BOOT_JARS must be defined in Android.bp files))) $(built_dex): $(built_dex_intermediate) @echo Copying: $@ diff --git a/core/java_common.mk b/core/java_common.mk index f6e01d226f..b218c0d8b8 100644 --- a/core/java_common.mk +++ b/core/java_common.mk @@ -382,7 +382,9 @@ else # LOCAL_IS_HOST_MODULE endif # USE_CORE_LIB_BOOTCLASSPATH endif # !LOCAL_IS_HOST_MODULE +ifdef RECORD_ALL_DEPS ALL_DEPS.$(LOCAL_MODULE).ALL_DEPS := $(ALL_DEPS.$(LOCAL_MODULE).ALL_DEPS) $(full_java_bootclasspath_libs) +endif # Export the SDK libs. The sdk library names listed in LOCAL_SDK_LIBRARIES are first exported. # Then sdk library names exported from dependencies are all re-exported. diff --git a/core/java_prebuilt_internal.mk b/core/java_prebuilt_internal.mk index 8a2091e7e2..95ae2f8d45 100644 --- a/core/java_prebuilt_internal.mk +++ b/core/java_prebuilt_internal.mk @@ -35,9 +35,9 @@ ifeq ($(prebuilt_module_is_dex_javalib),true) my_dex_jar := $(my_prebuilt_src_file) # This is a target shared library, i.e. a jar with classes.dex. -ifneq ($(filter $(LOCAL_MODULE),$(PRODUCT_BOOT_JARS)),) - $(call pretty-error,Modules in PRODUCT_BOOT_JARS must be defined in Android.bp files) -endif +$(foreach pair,$(PRODUCT_BOOT_JARS), \ + $(if $(filter $(LOCAL_MODULE),$(call word-colon,2,$(pair))), \ + $(call pretty-error,Modules in PRODUCT_BOOT_JARS must be defined in Android.bp files))) ALL_MODULES.$(my_register_name).CLASSES_JAR := $(common_classes_jar) diff --git a/core/java_renderscript.mk b/core/java_renderscript.mk index 672863ba49..bfcf59e325 100644 --- a/core/java_renderscript.mk +++ b/core/java_renderscript.mk @@ -129,7 +129,7 @@ LOCAL_JNI_SHARED_LIBRARIES += libRSSupportIO endif my_arch := $(TARGET_$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH) -ifneq (,$(filter arm64 mips64 x86_64,$(my_arch))) +ifneq (,$(filter arm64 x86_64,$(my_arch))) my_min_sdk_version := 21 else my_min_sdk_version := $(MIN_SUPPORTED_SDK_VERSION) diff --git a/core/line_coverage.mk b/core/line_coverage.mk index 9b0b528600..b920e285d4 100644 --- a/core/line_coverage.mk +++ b/core/line_coverage.mk @@ -9,7 +9,7 @@ # # To run the make target set the coverage related envvars first: # NATIVE_LINE_COVERAGE=true NATIVE_COVERAGE=true \ -# COVERAGE_PATHS=* make haiku-line-coverage +# NATIVE_COVERAGE_PATHS=* make haiku-line-coverage # ----------------------------------------------------------------- # TODO(b/148306195): Due this issue some fuzz targets cannot be built with diff --git a/core/link_type.mk b/core/link_type.mk index e8cfd2e7f8..48cd8f3e8a 100644 --- a/core/link_type.mk +++ b/core/link_type.mk @@ -10,7 +10,7 @@ # my_link_deps: the dependencies, in the form of <MODULE_CLASS>:<name> # -my_link_prefix := LINK_TYPE:$(call find-idf-prefix,$(my_kind),$(my_host_cross))$(if $(filter AUX,$(my_kind)),-$(AUX_OS_VARIANT)):$(if $(my_common),$(my_common):_,_:$(if $(my_2nd_arch_prefix),$(my_2nd_arch_prefix),_)) +my_link_prefix := LINK_TYPE:$(call find-idf-prefix,$(my_kind),$(my_host_cross)):$(if $(my_common),$(my_common):_,_:$(if $(my_2nd_arch_prefix),$(my_2nd_arch_prefix),_)) link_type := $(my_link_prefix):$(LOCAL_MODULE_CLASS):$(LOCAL_MODULE) ALL_LINK_TYPES += $(link_type) $(link_type).TYPE := $(my_link_type) diff --git a/core/main.mk b/core/main.mk index a7a69f086e..925162c884 100644 --- a/core/main.mk +++ b/core/main.mk @@ -113,44 +113,38 @@ SKIP_BOOT_JARS_CHECK := true endif endif -# -# ----------------------------------------------------------------- -# Validate ADDITIONAL_DEFAULT_PROPERTIES. -ifneq ($(ADDITIONAL_DEFAULT_PROPERTIES),) -$(error ADDITIONAL_DEFAULT_PROPERTIES must not be set before here: $(ADDITIONAL_DEFAULT_PROPERTIES)) -endif - -# -# ----------------------------------------------------------------- -# Validate ADDITIONAL_BUILD_PROPERTIES. -ifneq ($(ADDITIONAL_BUILD_PROPERTIES),) -$(error ADDITIONAL_BUILD_PROPERTIES must not be set before here: $(ADDITIONAL_BUILD_PROPERTIES)) -endif - -ADDITIONAL_BUILD_PROPERTIES := - -# -# ----------------------------------------------------------------- -# Validate ADDITIONAL_PRODUCT_PROPERTIES. -ifneq ($(ADDITIONAL_PRODUCT_PROPERTIES),) -$(error ADDITIONAL_PRODUCT_PROPERTIES must not be set before here: $(ADDITIONAL_PRODUCT_PROPERTIES)) -endif +# ADDITIONAL_<partition>_PROPERTIES are properties that are determined by the +# build system itself. Don't let it be defined from outside of the core build +# system like Android.mk or <product>.mk files. +_additional_prop_var_names := \ + ADDITIONAL_SYSTEM_PROPERTIES \ + ADDITIONAL_VENDOR_PROPERTIES \ + ADDITIONAL_ODM_PROPERTIES \ + ADDITIONAL_PRODUCT_PROPERTIES + +$(foreach name, $(_additional_prop_var_names),\ + $(if $($(name)),\ + $(error $(name) must not set before here. $($(name)))\ + ,)\ + $(eval $(name) :=)\ +) +_additional_prop_var_names := -ADDITIONAL_PRODUCT_PROPERTIES := +$(KATI_obsolete_var ADDITIONAL_BUILD_PROPERTIES, Please use ADDITIONAL_SYSTEM_PROPERTIES) # # ----------------------------------------------------------------- # Add the product-defined properties to the build properties. ifdef PRODUCT_SHIPPING_API_LEVEL -ADDITIONAL_BUILD_PROPERTIES += \ +ADDITIONAL_SYSTEM_PROPERTIES += \ ro.product.first_api_level=$(PRODUCT_SHIPPING_API_LEVEL) endif ifneq ($(BOARD_PROPERTY_OVERRIDES_SPLIT_ENABLED), true) - ADDITIONAL_BUILD_PROPERTIES += $(PRODUCT_PROPERTY_OVERRIDES) + ADDITIONAL_SYSTEM_PROPERTIES += $(PRODUCT_PROPERTY_OVERRIDES) else ifndef BOARD_VENDORIMAGE_FILE_SYSTEM_TYPE - ADDITIONAL_BUILD_PROPERTIES += $(PRODUCT_PROPERTY_OVERRIDES) + ADDITIONAL_SYSTEM_PROPERTIES += $(PRODUCT_PROPERTY_OVERRIDES) endif endif @@ -199,7 +193,7 @@ include build/make/core/pdk_config.mk # ----------------------------------------------------------------- -ADDITIONAL_BUILD_PROPERTIES += ro.treble.enabled=${PRODUCT_FULL_TREBLE} +ADDITIONAL_SYSTEM_PROPERTIES += ro.treble.enabled=${PRODUCT_FULL_TREBLE} $(KATI_obsolete_var PRODUCT_FULL_TREBLE,\ Code should be written to work regardless of a device being Treble or \ @@ -209,9 +203,9 @@ $(KATI_obsolete_var PRODUCT_FULL_TREBLE,\ # Sets ro.actionable_compatible_property.enabled to know on runtime whether the # allowed list of actionable compatible properties is enabled or not. ifeq ($(PRODUCT_ACTIONABLE_COMPATIBLE_PROPERTY_DISABLE),true) -ADDITIONAL_DEFAULT_PROPERTIES += ro.actionable_compatible_property.enabled=false +ADDITIONAL_SYSTEM_PROPERTIES += ro.actionable_compatible_property.enabled=false else -ADDITIONAL_DEFAULT_PROPERTIES += ro.actionable_compatible_property.enabled=${PRODUCT_COMPATIBLE_PROPERTY} +ADDITIONAL_SYSTEM_PROPERTIES += ro.actionable_compatible_property.enabled=${PRODUCT_COMPATIBLE_PROPERTY} endif # Add the system server compiler filter if they are specified for the product. @@ -221,7 +215,7 @@ endif # Enable core platform API violation warnings on userdebug and eng builds. ifneq ($(TARGET_BUILD_VARIANT),user) -ADDITIONAL_BUILD_PROPERTIES += persist.debug.dalvik.vm.core_platform_api_policy=just-warn +ADDITIONAL_SYSTEM_PROPERTIES += persist.debug.dalvik.vm.core_platform_api_policy=just-warn endif # Sets the default value of ro.postinstall.fstab.prefix to /system. @@ -231,7 +225,98 @@ endif # # It then uses ${ro.postinstall.fstab.prefix}/etc/fstab.postinstall to # mount system_other partition. -ADDITIONAL_DEFAULT_PROPERTIES += ro.postinstall.fstab.prefix=/system +ADDITIONAL_SYSTEM_PROPERTIES += ro.postinstall.fstab.prefix=/system + +# ----------------------------------------------------------------- +# ADDITIONAL_VENDOR_PROPERTIES will be installed in vendor/build.prop if +# property_overrides_split_enabled is true. Otherwise it will be installed in +# /system/build.prop +ifdef BOARD_VNDK_VERSION + ifeq ($(BOARD_VNDK_VERSION),current) + ADDITIONAL_VENDOR_PROPERTIES := ro.vndk.version=$(PLATFORM_VNDK_VERSION) + else + ADDITIONAL_VENDOR_PROPERTIES := ro.vndk.version=$(BOARD_VNDK_VERSION) + endif + ifdef BOARD_VNDK_RUNTIME_DISABLE + ADDITIONAL_VENDOR_PROPERTIES += ro.vndk.lite=true + endif +else + ADDITIONAL_VENDOR_PROPERTIES := ro.vndk.version=$(PLATFORM_VNDK_VERSION) + ADDITIONAL_VENDOR_PROPERTIES += ro.vndk.lite=true +endif + +# Add cpu properties for bionic and ART. +ADDITIONAL_VENDOR_PROPERTIES += ro.bionic.arch=$(TARGET_ARCH) +ADDITIONAL_VENDOR_PROPERTIES += ro.bionic.cpu_variant=$(TARGET_CPU_VARIANT_RUNTIME) +ADDITIONAL_VENDOR_PROPERTIES += ro.bionic.2nd_arch=$(TARGET_2ND_ARCH) +ADDITIONAL_VENDOR_PROPERTIES += ro.bionic.2nd_cpu_variant=$(TARGET_2ND_CPU_VARIANT_RUNTIME) + +ADDITIONAL_VENDOR_PROPERTIES += persist.sys.dalvik.vm.lib.2=libart.so +ADDITIONAL_VENDOR_PROPERTIES += dalvik.vm.isa.$(TARGET_ARCH).variant=$(DEX2OAT_TARGET_CPU_VARIANT_RUNTIME) +ifneq ($(DEX2OAT_TARGET_INSTRUCTION_SET_FEATURES),) + ADDITIONAL_VENDOR_PROPERTIES += dalvik.vm.isa.$(TARGET_ARCH).features=$(DEX2OAT_TARGET_INSTRUCTION_SET_FEATURES) +endif + +ifdef TARGET_2ND_ARCH + ADDITIONAL_VENDOR_PROPERTIES += dalvik.vm.isa.$(TARGET_2ND_ARCH).variant=$($(TARGET_2ND_ARCH_VAR_PREFIX)DEX2OAT_TARGET_CPU_VARIANT_RUNTIME) + ifneq ($($(TARGET_2ND_ARCH_VAR_PREFIX)DEX2OAT_TARGET_INSTRUCTION_SET_FEATURES),) + ADDITIONAL_VENDOR_PROPERTIES += dalvik.vm.isa.$(TARGET_2ND_ARCH).features=$($(TARGET_2ND_ARCH_VAR_PREFIX)DEX2OAT_TARGET_INSTRUCTION_SET_FEATURES) + endif +endif + +# Although these variables are prefixed with TARGET_RECOVERY_, they are also needed under charger +# mode (via libminui). +ifdef TARGET_RECOVERY_DEFAULT_ROTATION +ADDITIONAL_VENDOR_PROPERTIES += \ + ro.minui.default_rotation=$(TARGET_RECOVERY_DEFAULT_ROTATION) +endif +ifdef TARGET_RECOVERY_OVERSCAN_PERCENT +ADDITIONAL_VENDOR_PROPERTIES += \ + ro.minui.overscan_percent=$(TARGET_RECOVERY_OVERSCAN_PERCENT) +endif +ifdef TARGET_RECOVERY_PIXEL_FORMAT +ADDITIONAL_VENDOR_PROPERTIES += \ + ro.minui.pixel_format=$(TARGET_RECOVERY_PIXEL_FORMAT) +endif + +ifdef PRODUCT_USE_DYNAMIC_PARTITIONS +ADDITIONAL_VENDOR_PROPERTIES += \ + ro.boot.dynamic_partitions=$(PRODUCT_USE_DYNAMIC_PARTITIONS) +endif + +ifdef PRODUCT_RETROFIT_DYNAMIC_PARTITIONS +ADDITIONAL_VENDOR_PROPERTIES += \ + ro.boot.dynamic_partitions_retrofit=$(PRODUCT_RETROFIT_DYNAMIC_PARTITIONS) +endif + +ifdef PRODUCT_SHIPPING_API_LEVEL +ADDITIONAL_VENDOR_PROPERTIES += \ + ro.product.first_api_level=$(PRODUCT_SHIPPING_API_LEVEL) +endif + +ADDITIONAL_VENDOR_PROPERTIES += \ + ro.vendor.build.security_patch=$(VENDOR_SECURITY_PATCH) \ + ro.vendor.product.cpu.abilist=$(TARGET_CPU_ABI_LIST) \ + ro.vendor.product.cpu.abilist32=$(TARGET_CPU_ABI_LIST_32_BIT) \ + ro.vendor.product.cpu.abilist64=$(TARGET_CPU_ABI_LIST_64_BIT) \ + ro.product.board=$(TARGET_BOOTLOADER_BOARD_NAME) \ + ro.board.platform=$(TARGET_BOARD_PLATFORM) \ + ro.hwui.use_vulkan=$(TARGET_USES_VULKAN) + +ifdef TARGET_SCREEN_DENSITY +ADDITIONAL_VENDOR_PROPERTIES += \ + ro.sf.lcd_density=$(TARGET_SCREEN_DENSITY) +endif + +ifdef AB_OTA_UPDATER +ADDITIONAL_VENDOR_PROPERTIES += \ + ro.build.ab_update=$(AB_OTA_UPDATER) +endif + +ADDITIONAL_ODM_PROPERTIES += \ + ro.odm.product.cpu.abilist=$(TARGET_CPU_ABI_LIST) \ + ro.odm.product.cpu.abilist32=$(TARGET_CPU_ABI_LIST_32_BIT) \ + ro.odm.product.cpu.abilist64=$(TARGET_CPU_ABI_LIST_64_BIT) # Set ro.product.vndk.version to know the VNDK version required by product # modules. It uses the version in PRODUCT_PRODUCT_VNDK_VERSION. If the value @@ -244,6 +329,8 @@ ADDITIONAL_PRODUCT_PROPERTIES += ro.product.vndk.version=$(PRODUCT_PRODUCT_VNDK_ endif endif +ADDITIONAL_PRODUCT_PROPERTIES += ro.build.characteristics=$(TARGET_AAPT_CHARACTERISTICS) + # ----------------------------------------------------------------- ### ### In this section we set up the things that are different @@ -263,11 +350,11 @@ enable_target_debugging := true tags_to_install := ifneq (,$(user_variant)) # Target is secure in user builds. - ADDITIONAL_DEFAULT_PROPERTIES += ro.secure=1 - ADDITIONAL_DEFAULT_PROPERTIES += security.perf_harden=1 + ADDITIONAL_SYSTEM_PROPERTIES += ro.secure=1 + ADDITIONAL_SYSTEM_PROPERTIES += security.perf_harden=1 ifeq ($(user_variant),user) - ADDITIONAL_DEFAULT_PROPERTIES += ro.adb.secure=1 + ADDITIONAL_SYSTEM_PROPERTIES += ro.adb.secure=1 endif ifeq ($(user_variant),userdebug) @@ -279,40 +366,40 @@ ifneq (,$(user_variant)) endif # Disallow mock locations by default for user builds - ADDITIONAL_DEFAULT_PROPERTIES += ro.allow.mock.location=0 + ADDITIONAL_SYSTEM_PROPERTIES += ro.allow.mock.location=0 else # !user_variant # Turn on checkjni for non-user builds. - ADDITIONAL_BUILD_PROPERTIES += ro.kernel.android.checkjni=1 + ADDITIONAL_SYSTEM_PROPERTIES += ro.kernel.android.checkjni=1 # Set device insecure for non-user builds. - ADDITIONAL_DEFAULT_PROPERTIES += ro.secure=0 + ADDITIONAL_SYSTEM_PROPERTIES += ro.secure=0 # Allow mock locations by default for non user builds - ADDITIONAL_DEFAULT_PROPERTIES += ro.allow.mock.location=1 + ADDITIONAL_SYSTEM_PROPERTIES += ro.allow.mock.location=1 endif # !user_variant ifeq (true,$(strip $(enable_target_debugging))) # Target is more debuggable and adbd is on by default - ADDITIONAL_DEFAULT_PROPERTIES += ro.debuggable=1 + ADDITIONAL_SYSTEM_PROPERTIES += ro.debuggable=1 # Enable Dalvik lock contention logging. - ADDITIONAL_BUILD_PROPERTIES += dalvik.vm.lockprof.threshold=500 + ADDITIONAL_SYSTEM_PROPERTIES += dalvik.vm.lockprof.threshold=500 else # !enable_target_debugging # Target is less debuggable and adbd is off by default - ADDITIONAL_DEFAULT_PROPERTIES += ro.debuggable=0 + ADDITIONAL_SYSTEM_PROPERTIES += ro.debuggable=0 endif # !enable_target_debugging ## eng ## ifeq ($(TARGET_BUILD_VARIANT),eng) tags_to_install := debug eng -ifneq ($(filter ro.setupwizard.mode=ENABLED, $(call collapse-pairs, $(ADDITIONAL_BUILD_PROPERTIES))),) +ifneq ($(filter ro.setupwizard.mode=ENABLED, $(call collapse-pairs, $(ADDITIONAL_SYSTEM_PROPERTIES))),) # Don't require the setup wizard on eng builds - ADDITIONAL_BUILD_PROPERTIES := $(filter-out ro.setupwizard.mode=%,\ - $(call collapse-pairs, $(ADDITIONAL_BUILD_PROPERTIES))) \ + ADDITIONAL_SYSTEM_PROPERTIES := $(filter-out ro.setupwizard.mode=%,\ + $(call collapse-pairs, $(ADDITIONAL_SYSTEM_PROPERTIES))) \ ro.setupwizard.mode=OPTIONAL endif ifndef is_sdk_build # To speedup startup of non-preopted builds, don't verify or compile the boot image. - ADDITIONAL_BUILD_PROPERTIES += dalvik.vm.image-dex2oat-filter=extract + ADDITIONAL_SYSTEM_PROPERTIES += dalvik.vm.image-dex2oat-filter=extract endif endif @@ -346,20 +433,17 @@ ifneq ($(words $(sort $(filter-out $(INTERNAL_MODIFIER_TARGETS) checkbuild emula $(error The 'sdk' target may not be specified with any other targets) endif -# AUX dependencies are already added by now; remove triggers from the MAKECMDGOALS -MAKECMDGOALS := $(strip $(filter-out AUX-%,$(MAKECMDGOALS))) - # TODO: this should be eng I think. Since the sdk is built from the eng # variant. tags_to_install := debug eng -ADDITIONAL_BUILD_PROPERTIES += xmpp.auto-presence=true -ADDITIONAL_BUILD_PROPERTIES += ro.config.nocheckin=yes +ADDITIONAL_SYSTEM_PROPERTIES += xmpp.auto-presence=true +ADDITIONAL_SYSTEM_PROPERTIES += ro.config.nocheckin=yes else # !sdk endif BUILD_WITHOUT_PV := true -ADDITIONAL_BUILD_PROPERTIES += net.bt.name=Android +ADDITIONAL_SYSTEM_PROPERTIES += net.bt.name=Android # ------------------------------------------------------------ # Define a function that, given a list of module tags, returns @@ -393,10 +477,8 @@ endif # Strip and readonly a few more variables so they won't be modified. $(readonly-final-product-vars) -ADDITIONAL_DEFAULT_PROPERTIES := $(strip $(ADDITIONAL_DEFAULT_PROPERTIES)) -.KATI_READONLY := ADDITIONAL_DEFAULT_PROPERTIES -ADDITIONAL_BUILD_PROPERTIES := $(strip $(ADDITIONAL_BUILD_PROPERTIES)) -.KATI_READONLY := ADDITIONAL_BUILD_PROPERTIES +ADDITIONAL_SYSTEM_PROPERTIES := $(strip $(ADDITIONAL_SYSTEM_PROPERTIES)) +.KATI_READONLY := ADDITIONAL_SYSTEM_PROPERTIES ADDITIONAL_PRODUCT_PROPERTIES := $(strip $(ADDITIONAL_PRODUCT_PROPERTIES)) .KATI_READONLY := ADDITIONAL_PRODUCT_PROPERTIES @@ -472,6 +554,13 @@ $(call generate_all_enforce_rro_packages) endif # ------------------------------------------------------------------- +# Sort ALL_MODULES to remove duplicate entries. +# ------------------------------------------------------------------- +ALL_MODULES := $(sort $(ALL_MODULES)) +# Cannot set to readonly because Makefile extends ALL_MODULES +# .KATI_READONLY := ALL_MODULES + +# ------------------------------------------------------------------- # Fix up CUSTOM_MODULES to refer to installed files rather than # just bare module names. Leave unknown modules alone in case # they're actually full paths to a particular file. @@ -492,96 +581,99 @@ CUSTOM_MODULES := \ # brought in as requirements of other modules. # # Resolve the required module name to 32-bit or 64-bit variant. -# Get a list of corresponding 32-bit module names, if one exists. -define get-32-bit-modules -$(sort $(foreach m,$(1),\ - $(if $(ALL_MODULES.$(m)$(TARGET_2ND_ARCH_MODULE_SUFFIX).CLASS),\ - $(m)$(TARGET_2ND_ARCH_MODULE_SUFFIX)))) -endef -# Get a list of corresponding 32-bit module names, if one exists; -# otherwise return the original module name -define get-32-bit-modules-if-we-can -$(sort $(foreach m,$(1),\ - $(if $(ALL_MODULES.$(m)$(TARGET_2ND_ARCH_MODULE_SUFFIX).CLASS),\ - $(m)$(TARGET_2ND_ARCH_MODULE_SUFFIX), \ - $(m)))) -endef - -# TODO: we can probably check to see if these modules are actually host -# modules -define get-host-32-bit-modules -$(sort $(foreach m,$(1),\ - $(if $(ALL_MODULES.$(m)$(HOST_2ND_ARCH_MODULE_SUFFIX).CLASS),\ - $(m)$(HOST_2ND_ARCH_MODULE_SUFFIX)))) -endef -# Get a list of corresponding 32-bit module names, if one exists; -# otherwise return the original module name -define get-host-32-bit-modules-if-we-can -$(sort $(foreach m,$(1),\ - $(if $(ALL_MODULES.$(m)$(HOST_2ND_ARCH_MODULE_SUFFIX).CLASS),\ - $(m)$(HOST_2ND_ARCH_MODULE_SUFFIX),\ - $(m)))) -endef -# If a module is for a cross host os, the required modules must be for -# that OS too. -# If a module is built for 32-bit, the required modules must be 32-bit too; -# Otherwise if the module is an executable or shared library, -# the required modules must be 64-bit; -# otherwise we require both 64-bit and 32-bit variant, if one exists. -define target-select-bitness-of-required-modules -$(foreach m,$(ALL_MODULES),\ - $(eval r := $(ALL_MODULES.$(m).REQUIRED_FROM_TARGET))\ - $(if $(r),\ - $(if $(ALL_MODULES.$(m).FOR_2ND_ARCH),\ - $(eval r_r := $(call get-32-bit-modules-if-we-can,$(r))),\ - $(if $(filter EXECUTABLES SHARED_LIBRARIES NATIVE_TESTS,$(ALL_MODULES.$(m).CLASS)),\ - $(eval r_r := $(r)),\ - $(eval r_r := $(r) $(call get-32-bit-modules,$(r)))\ - )\ - )\ - $(eval ALL_MODULES.$(m).REQUIRED_FROM_TARGET := $(strip $(r_r)))\ - )\ +# Get a list of corresponding module names for the second arch, if they exist. +# $(1): TARGET, HOST or HOST_CROSS +# $(2): A list of module names +define get-modules-for-2nd-arch +$(strip \ + $(foreach m,$(2), \ + $(if $(filter true,$(ALL_MODULES.$(m)$($(1)_2ND_ARCH_MODULE_SUFFIX).FOR_2ND_ARCH)), \ + $(m)$($(1)_2ND_ARCH_MODULE_SUFFIX) \ + ) \ + ) \ ) endef -$(call target-select-bitness-of-required-modules) - -define host-select-bitness-of-required-modules -$(foreach m,$(ALL_MODULES),\ - $(eval r := $(ALL_MODULES.$(m).REQUIRED_FROM_HOST))\ - $(if $(r),\ - $(if $(ALL_MODULES.$(m).FOR_2ND_ARCH),\ - $(eval r_r := $(call get-host-32-bit-modules-if-we-can,$(r))),\ - $(if $(filter EXECUTABLES SHARED_LIBRARIES NATIVE_TESTS,$(ALL_MODULES.$(m).CLASS)),\ - $(eval r_r := $(r)),\ - $(eval r_r := $(r) $(call get-host-32-bit-modules,$(r)))\ - )\ - )\ - $(eval ALL_MODULES.$(m).REQUIRED_FROM_HOST := $(strip $(r_r)))\ - )\ + +# Resolves module bitness for PRODUCT_PACKAGES and PRODUCT_HOST_PACKAGES. +# The returned list of module names can be used to access +# ALL_MODULES.<module>.<*> variables. +# Name resolution for PRODUCT_PACKAGES / PRODUCT_HOST_PACKAGES: +# foo:32 resolves to foo_32; +# foo:64 resolves to foo; +# foo resolves to both foo and foo_32 (if foo_32 is defined). +# +# Name resolution for HOST_CROSS modules: +# foo:32 resolves to foo; +# foo:64 resolves to foo_64; +# foo resolves to both foo and foo_64 (if foo_64 is defined). +# +# $(1): TARGET, HOST or HOST_CROSS +# $(2): A list of simple module names with :32 and :64 suffix +define resolve-bitness-for-modules +$(strip \ + $(eval modules_32 := $(patsubst %:32,%,$(filter %:32,$(2)))) \ + $(eval modules_64 := $(patsubst %:64,%,$(filter %:64,$(2)))) \ + $(eval modules_both := $(filter-out %:32 %:64,$(2))) \ + $(eval ### For host cross modules, the primary arch is windows x86 and secondary is x86_64) \ + $(if $(filter HOST_CROSS,$(1)), \ + $(eval modules_1st_arch := $(modules_32)) \ + $(eval modules_2nd_arch := $(modules_64)), \ + $(eval modules_1st_arch := $(modules_64)) \ + $(eval modules_2nd_arch := $(modules_32))) \ + $(eval ### Note for 32-bit product, 32 and 64 will be added as their original module names.) \ + $(eval modules := $(modules_1st_arch)) \ + $(if $($(1)_2ND_ARCH), \ + $(eval modules += $(call get-modules-for-2nd-arch,$(1),$(modules_2nd_arch))), \ + $(eval modules += $(modules_2nd_arch))) \ + $(eval ### For the rest we add both) \ + $(eval modules += $(modules_both)) \ + $(if $($(1)_2ND_ARCH), \ + $(eval modules += $(call get-modules-for-2nd-arch,$(1),$(modules_both)))) \ + $(modules) \ ) endef -$(call host-select-bitness-of-required-modules) - -define host-cross-select-bitness-of-required-modules -$(foreach m,$(ALL_MODULES),\ - $(eval r := $(ALL_MODULES.$(m).REQUIRED_FROM_HOST_CROSS))\ - $(if $(r),\ - $(if $(ALL_MODULES.$(m).FOR_HOST_CROSS),,$(error Only expected REQUIRED_FROM_HOST_CROSS on FOR_HOST_CROSS modules - $(m)))\ - $(eval r := $(addprefix host_cross_,$(r)))\ - $(if $(ALL_MODULES.$(m).FOR_2ND_ARCH),\ - $(eval r_r := $(call get-host-32-bit-modules-if-we-can,$(r))),\ - $(if $(filter EXECUTABLES SHARED_LIBRARIES NATIVE_TESTS,$(ALL_MODULES.$(m).CLASS)),\ - $(eval r_r := $(r)),\ - $(eval r_r := $(r) $(call get-host-32-bit-modules,$(r)))\ - )\ - )\ - $(eval ALL_MODULES.$(m).REQUIRED_FROM_HOST_CROSS := $(strip $(r_r)))\ - )\ + +# TODO(b/7456955): error if a required module doesn't exist. +# Resolve the required module names in ALL_MODULES.*.REQUIRED_FROM_TARGET, +# ALL_MODULES.*.REQUIRED_FROM_HOST and ALL_MODULES.*.REQUIRED_FROM_HOST_CROSS +# to 32-bit or 64-bit variant. +# If a module is for cross host OS, the required modules are also for that OS. +# Required modules explicitly suffixed with :32 or :64 resolve to that bitness. +# Otherwise if the requiring module is native and the required module is shared +# library or native test, then the required module resolves to the same bitness. +# Otherwise the required module resolves to both variants, if they exist. +# $(1): TARGET, HOST or HOST_CROSS +define select-bitness-of-required-modules +$(foreach m,$(ALL_MODULES), \ + $(eval r := $(ALL_MODULES.$(m).REQUIRED_FROM_$(1))) \ + $(if $(r), \ + $(if $(filter HOST_CROSS,$(1)), \ + $(if $(ALL_MODULES.$(m).FOR_HOST_CROSS),,$(error Only expected REQUIRED_FROM_HOST_CROSS on FOR_HOST_CROSS modules - $(m))) \ + $(eval r := $(addprefix host_cross_,$(r)))) \ + $(eval module_is_native := \ + $(filter EXECUTABLES SHARED_LIBRARIES NATIVE_TESTS,$(ALL_MODULES.$(m).CLASS))) \ + $(eval r_r := $(foreach r_i,$(r), \ + $(if $(filter %:32 %:64,$(r_i)), \ + $(eval r_m := $(call resolve-bitness-for-modules,$(1),$(r_i))), \ + $(eval r_m := \ + $(eval r_i_2nd := $(call get-modules-for-2nd-arch,$(1),$(r_i))) \ + $(eval required_is_shared_library_or_native_test := \ + $(filter SHARED_LIBRARIES NATIVE_TESTS, \ + $(ALL_MODULES.$(r_i).CLASS) $(ALL_MODULES.$(r_i_2nd).CLASS))) \ + $(if $(and $(module_is_native),$(required_is_shared_library_or_native_test)), \ + $(if $(ALL_MODULES.$(m).FOR_2ND_ARCH),$(r_i_2nd),$(r_i)), \ + $(r_i) $(r_i_2nd)))) \ + $(eval ### TODO(b/7456955): error if r_m is empty / does not exist) \ + $(r_m))) \ + $(eval ALL_MODULES.$(m).REQUIRED_FROM_$(1) := $(sort $(r_r))) \ + ) \ ) endef -$(call host-cross-select-bitness-of-required-modules) -r_r := + +$(call select-bitness-of-required-modules,TARGET) +$(call select-bitness-of-required-modules,HOST) +$(call select-bitness-of-required-modules,HOST_CROSS) define add-required-deps $(1): | $(2) @@ -800,9 +892,10 @@ $(foreach m,$($(if $(2),$($(1)2ND_ARCH_VAR_PREFIX))$(1)DEPENDENCIES_ON_SHARED_LI $($(if $(2),$($(1)2ND_ARCH_VAR_PREFIX))TARGET_OUT_INTERMEDIATES)/SHARED_LIBRARIES/%,\ $(call module-built-files,$(mod)))))\ \ - $(if $(r),\ + $(if $(and $(r),$(deps)),\ $(eval stamp := $(dir $(r))check_elf_files.timestamp)\ - $(eval $(call add-elf-file-check-shared-lib,$(stamp),$(deps)))\ + $(if $(CHECK_ELF_FILES.$(stamp)),\ + $(eval $(call add-elf-file-check-shared-lib,$(stamp),$(deps))))\ )) endef @@ -832,7 +925,6 @@ add-required-deps := # - TARGET # - HOST # - HOST_CROSS -# - AUX-<variant-name> # 3: Whether to use the common intermediates directory or not # - _ # - COMMON @@ -859,14 +951,8 @@ add-required-deps := link_type_error := -define link-type-prefix-base -$(word 2,$(subst :,$(space),$(1))) -endef define link-type-prefix -$(if $(filter AUX-%,$(link-type-prefix-base)),$(patsubst AUX-%,AUX,$(link-type-prefix-base)),$(link-type-prefix-base)) -endef -define link-type-aux-variant -$(if $(filter AUX-%,$(link-type-prefix-base)),$(patsubst AUX-%,%,$(link-type-prefix-base))) +$(word 2,$(subst :,$(space),$(1))) endef define link-type-common $(patsubst _,,$(word 3,$(subst :,$(space),$(1)))) @@ -884,7 +970,7 @@ define link-type-os $(strip $(eval _p := $(link-type-prefix))\ $(if $(filter HOST HOST_CROSS,$(_p)),\ $($(_p)_OS),\ - $(if $(filter AUX,$(_p)),AUX,android))) + android)) endef define link-type-arch $($(link-type-prefix)_$(link-type-2ndarchprefix)ARCH) @@ -1049,8 +1135,7 @@ endef # foo resolves to both foo and foo_32 (if foo_32 is defined). # # Name resolution for LOCAL_REQUIRED_MODULES: -# If a module is built for 2nd arch, its required module resolves to -# 32-bit variant, if it exits. See the select-bitness-of-required-modules definition. +# See the select-bitness-of-required-modules definition. # $(1): product makefile define product-installed-files $(eval _pif_modules := \ @@ -1066,15 +1151,7 @@ define product-installed-files $(eval _pif_overrides := $(call module-overrides,$(_pif_modules))) \ $(eval _pif_modules := $(filter-out $(_pif_overrides), $(_pif_modules))) \ $(eval ### Resolve the :32 :64 module name) \ - $(eval _pif_modules_32 := $(patsubst %:32,%,$(filter %:32, $(_pif_modules)))) \ - $(eval _pif_modules_64 := $(patsubst %:64,%,$(filter %:64, $(_pif_modules)))) \ - $(eval _pif_modules_rest := $(filter-out %:32 %:64,$(_pif_modules))) \ - $(eval ### Note for 32-bit product, 32 and 64 will be added as their original module names.) \ - $(eval _pif_modules := $(call get-32-bit-modules-if-we-can, $(_pif_modules_32))) \ - $(eval _pif_modules += $(_pif_modules_64)) \ - $(eval ### For the rest we add both) \ - $(eval _pif_modules += $(call get-32-bit-modules, $(_pif_modules_rest))) \ - $(eval _pif_modules += $(_pif_modules_rest)) \ + $(eval _pif_modules := $(sort $(call resolve-bitness-for-modules,TARGET,$(_pif_modules)))) \ $(call expand-required-modules,_pif_modules,$(_pif_modules),$(_pif_overrides)) \ $(filter-out $(HOST_OUT_ROOT)/%,$(call module-installed-files, $(_pif_modules))) \ $(call resolve-product-relative-paths,\ @@ -1085,18 +1162,12 @@ endef # This does support the :32 / :64 syntax, but does not support module overrides. define host-installed-files $(eval _hif_modules := $(call get-product-var,$(1),PRODUCT_HOST_PACKAGES)) \ - $(eval ### Resolve the :32 :64 module name) \ - $(eval _hif_modules_32 := $(patsubst %:32,%,$(filter %:32, $(_hif_modules)))) \ - $(eval _hif_modules_64 := $(patsubst %:64,%,$(filter %:64, $(_hif_modules)))) \ - $(eval _hif_modules_rest := $(filter-out %:32 %:64,$(_hif_modules))) \ - $(eval _hif_modules := $(call get-host-32-bit-modules-if-we-can, $(_hif_modules_32))) \ - $(eval _hif_modules += $(_hif_modules_64)) \ - $(eval ### For the rest we add both) \ - $(eval _hif_modules += $(call get-host-32-bit-modules, $(_hif_modules_rest))) \ - $(eval _hif_modules += $(_hif_modules_rest)) \ $(eval ### Split host vs host cross modules) \ $(eval _hcif_modules := $(filter host_cross_%,$(_hif_modules))) \ $(eval _hif_modules := $(filter-out host_cross_%,$(_hif_modules))) \ + $(eval ### Resolve the :32 :64 module name) \ + $(eval _hif_modules := $(sort $(call resolve-bitness-for-modules,HOST,$(_hif_modules)))) \ + $(eval _hcif_modules := $(sort $(call resolve-bitness-for-modules,HOST_CROSS,$(_hcif_modules)))) \ $(call expand-required-host-modules,_hif_modules,$(_hif_modules),HOST) \ $(call expand-required-host-modules,_hcif_modules,$(_hcif_modules),HOST_CROSS) \ $(filter $(HOST_OUT)/%,$(call module-installed-files, $(_hif_modules))) \ @@ -1126,9 +1197,8 @@ ifdef FULL_BUILD _modules := $(patsubst %:64,%,$(_modules)) # Sanity check all modules in PRODUCT_PACKAGES exist. We check for the # existence if either <module> or the <module>_32 variant. - _nonexistent_modules := $(filter-out $(ALL_MODULES),$(_modules)) - _nonexistent_modules := $(foreach m,$(_nonexistent_modules),\ - $(if $(call get-32-bit-modules,$(m)),,$(m))) + _nonexistent_modules := $(foreach m,$(_modules), \ + $(if $(or $(ALL_MODULES.$(m).PATH),$(call get-modules-for-2nd-arch,TARGET,$(m))),,$(m))) $(call maybe-print-list-and-error,$(filter-out $(_allow_list),$(_nonexistent_modules)),\ $(INTERNAL_PRODUCT) includes non-existent modules in PRODUCT_PACKAGES) $(call maybe-print-list-and-error,$(filter-out $(_nonexistent_modules),$(_allow_list)),\ @@ -1151,17 +1221,19 @@ ifdef FULL_BUILD endif endif - # Some modules produce only host installed files when building with TARGET_BUILD_APPS - ifeq ($(TARGET_BUILD_APPS),) - _modules := $(foreach m,$(PRODUCT_PACKAGES) \ - $(PRODUCT_PACKAGES_DEBUG) \ - $(PRODUCT_PACKAGES_DEBUG_ASAN) \ - $(PRODUCT_PACKAGES_ENG) \ - $(PRODUCT_PACKAGES_TESTS),\ + # Modules may produce only host installed files in unbundled builds. + ifeq (,$(TARGET_BUILD_UNBUNDLED)) + _modules := $(call resolve-bitness-for-modules,TARGET, \ + $(PRODUCT_PACKAGES) \ + $(PRODUCT_PACKAGES_DEBUG) \ + $(PRODUCT_PACKAGES_DEBUG_ASAN) \ + $(PRODUCT_PACKAGES_ENG) \ + $(PRODUCT_PACKAGES_TESTS)) + _host_modules := $(foreach m,$(_modules), \ $(if $(ALL_MODULES.$(m).INSTALLED),\ $(if $(filter-out $(HOST_OUT_ROOT)/%,$(ALL_MODULES.$(m).INSTALLED)),,\ $(m)))) - $(call maybe-print-list-and-error,$(sort $(_modules)),\ + $(call maybe-print-list-and-error,$(sort $(_host_modules)),\ Host modules should be in PRODUCT_HOST_PACKAGES$(comma) not PRODUCT_PACKAGES) endif @@ -1434,9 +1506,6 @@ bootimage_test_harness: $(INSTALLED_TEST_HARNESS_BOOTIMAGE_TARGET) .PHONY: vbmetaimage vbmetaimage: $(INSTALLED_VBMETAIMAGE_TARGET) -.PHONY: auxiliary -auxiliary: $(INSTALLED_AUX_TARGETS) - # Build files and then package it into the rom formats .PHONY: droidcore droidcore: $(filter $(HOST_OUT_ROOT)/%,$(modules_to_install)) \ @@ -1482,7 +1551,6 @@ droidcore: $(filter $(HOST_OUT_ROOT)/%,$(modules_to_install)) \ $(INSTALLED_FILES_FILE_RECOVERY) \ $(INSTALLED_FILES_JSON_RECOVERY) \ $(INSTALLED_ANDROID_INFO_TXT_TARGET) \ - auxiliary \ soong_docs # dist_files only for putting your library into the dist directory with a full build. @@ -1544,7 +1612,7 @@ $(eval $(call combine-notice-files, html, \ $(apps_only_installed_files))) -else # TARGET_BUILD_APPS +else ifeq (,$(TARGET_BUILD_UNBUNDLED)) $(call dist-for-goals, droidcore, \ $(INTERNAL_UPDATE_PACKAGE_TARGET) \ $(INTERNAL_OTA_PACKAGE_TARGET) \ @@ -1640,10 +1708,15 @@ else # TARGET_BUILD_APPS $(call dist-for-goals, dist_files, $(api_xmls)) api_xmls := + ifdef CLANG_COVERAGE + $(foreach f,$(SOONG_NDK_API_XML), \ + $(call dist-for-goals,droidcore,$(f):ndk_apis/$(notdir $(f)))) + endif + # Building a full system-- the default is to build droidcore droid_targets: droidcore dist_files -endif # TARGET_BUILD_APPS +endif # !TARGET_BUILD_UNBUNDLED .PHONY: docs docs: $(ALL_DOCS) diff --git a/core/native_benchmark.mk b/core/native_benchmark.mk deleted file mode 100644 index 073d8dd2e2..0000000000 --- a/core/native_benchmark.mk +++ /dev/null @@ -1,15 +0,0 @@ -########################################### -## A thin wrapper around BUILD_EXECUTABLE -## Common flags for native benchmarks are added. -########################################### -$(call record-module-type,NATIVE_BENCHMARK) - -LOCAL_STATIC_LIBRARIES += libgoogle-benchmark - -ifndef LOCAL_MULTILIB -ifndef LOCAL_32_BIT_ONLY -LOCAL_MULTILIB := both -endif -endif - -include $(BUILD_EXECUTABLE) diff --git a/core/ninja_config.mk b/core/ninja_config.mk index 591937c0da..336048fe38 100644 --- a/core/ninja_config.mk +++ b/core/ninja_config.mk @@ -15,7 +15,6 @@ PARSE_TIME_MAKE_GOALS := \ $(dont_bother_goals) \ all \ ECLIPSE-% \ - AUX-% \ brillo_tests \ btnod \ build-art% \ @@ -25,7 +24,6 @@ PARSE_TIME_MAKE_GOALS := \ continuous_native_tests \ cts \ custom_images \ - deps-license \ dicttool_aosp \ dump-products \ eng \ @@ -40,9 +38,7 @@ PARSE_TIME_MAKE_GOALS := \ sdk \ sdk_addon \ sdk_repo \ - snod \ stnod \ - systemimage-nodeps \ target-files-package \ test-art% \ user \ diff --git a/core/notice_files.mk b/core/notice_files.mk index 22f8e41844..721a03411f 100644 --- a/core/notice_files.mk +++ b/core/notice_files.mk @@ -6,7 +6,7 @@ $(call record-module-type,NOTICE_FILE) ifneq ($(LOCAL_NOTICE_FILE),) notice_file:=$(strip $(LOCAL_NOTICE_FILE)) else -notice_file:=$(strip $(wildcard $(LOCAL_PATH)/NOTICE)) +notice_file:=$(strip $(wildcard $(LOCAL_PATH)/LICENSE $(LOCAL_PATH)/LICENCE $(LOCAL_PATH)/NOTICE)) endif ifeq ($(LOCAL_MODULE_CLASS),GYP) @@ -105,7 +105,7 @@ $(installed_notice_file): PRIVATE_INSTALLED_MODULE := $(module_installed_filenam $(installed_notice_file): $(notice_file) @echo Notice file: $< -- $@ $(hide) mkdir -p $(dir $@) - $(hide) cat $< > $@ + $(hide) awk 'FNR==1 && NR > 1 {print "\n"} {print}' $^ > $@ ifdef LOCAL_INSTALLED_MODULE # Make LOCAL_INSTALLED_MODULE depend on NOTICE files if they exist diff --git a/core/package.mk b/core/package.mk index 6bde48553d..591f7aafdb 100644 --- a/core/package.mk +++ b/core/package.mk @@ -41,15 +41,7 @@ else endif LOCAL_NO_2ND_ARCH_MODULE_SUFFIX := true - -# if TARGET_PREFER_32_BIT_APPS is set, try to build 32-bit first -ifdef TARGET_2ND_ARCH -ifeq ($(TARGET_PREFER_32_BIT_APPS),true) -LOCAL_2ND_ARCH_VAR_PREFIX := $(TARGET_2ND_ARCH_VAR_PREFIX) -else LOCAL_2ND_ARCH_VAR_PREFIX := -endif -endif # check if preferred arch is supported include $(BUILD_SYSTEM)/module_arch_supported.mk @@ -57,13 +49,7 @@ ifeq ($(my_module_arch_supported),true) # first arch is supported include $(BUILD_SYSTEM)/package_internal.mk else ifneq (,$(TARGET_2ND_ARCH)) -# check if the non-preferred arch is the primary or secondary -ifeq ($(TARGET_PREFER_32_BIT_APPS),true) -LOCAL_2ND_ARCH_VAR_PREFIX := -else LOCAL_2ND_ARCH_VAR_PREFIX := $(TARGET_2ND_ARCH_VAR_PREFIX) -endif - # check if non-preferred arch is supported include $(BUILD_SYSTEM)/module_arch_supported.mk ifeq ($(my_module_arch_supported),true) diff --git a/core/package_internal.mk b/core/package_internal.mk index 692ff49fcc..775ee4853a 100644 --- a/core/package_internal.mk +++ b/core/package_internal.mk @@ -377,9 +377,11 @@ ifeq ($(need_compile_res),true) # they want to use this module's R.java file. $(LOCAL_BUILT_MODULE): $(R_file_stamp) +ifneq ($(full_classes_jar),) # The R.java file must exist by the time the java source # list is generated $(java_source_list_file): $(R_file_stamp) +endif endif # need_compile_res @@ -627,7 +629,7 @@ $(my_bundle_module): $(MERGE_ZIPS) $(SOONG_ZIP) $(ZIP2ZIP) endif # full_classes_jar $(MERGE_ZIPS) $@ $@.parts/*.zip rm -rf $@.parts -ALL_MODULES.$(LOCAL_MODULE).BUNDLE := $(my_bundle_module) +ALL_MODULES.$(my_register_name).BUNDLE := $(my_bundle_module) ifdef TARGET_BUILD_APPS ifdef LOCAL_DPI_VARIANTS diff --git a/core/pathmap.mk b/core/pathmap.mk index af33f5de35..dacbe2195d 100644 --- a/core/pathmap.mk +++ b/core/pathmap.mk @@ -40,7 +40,6 @@ pathmap_INCL := \ libhardware:hardware/libhardware/include \ libhardware_legacy:hardware/libhardware_legacy/include \ libril:hardware/ril/include \ - recovery:bootable/recovery \ system-core:system/core/include \ audio:system/media/audio/include \ audio-effects:system/media/audio_effects/include \ diff --git a/core/product.mk b/core/product.mk index 3d96d23590..0eee2ab286 100644 --- a/core/product.mk +++ b/core/product.mk @@ -145,25 +145,27 @@ _product_single_value_vars += \ PRODUCT_SYSTEM_BRAND \ PRODUCT_SYSTEM_MANUFACTURER \ -# A list of property assignments, like "key = value", with zero or more -# whitespace characters on either side of the '='. +# PRODUCT_<PARTITION>_PROPERTIES are lists of property assignments +# that go to <partition>/build.prop. Each property assignment is +# "key = value" with zero or more whitespace characters on either +# side of the '='. +_product_list_vars += \ + PRODUCT_SYSTEM_PROPERTIES \ + PRODUCT_SYSTEM_EXT_PROPERTIES \ + PRODUCT_VENDOR_PROPERTIES \ + PRODUCT_ODM_PROPERTIES \ + PRODUCT_PRODUCT_PROPERTIES + +# TODO(b/117892318) deprecate these: +# ... in favor or PRODUCT_SYSTEM_PROPERTIES +_product_list_vars += PRODUCT_SYSTEM_DEFAULT_PROPERTIES +# ... in favor of PRODUCT_VENDOR_PROPERTIES _product_list_vars += PRODUCT_PROPERTY_OVERRIDES - -# A list of property assignments, like "key = value", with zero or more -# whitespace characters on either side of the '='. -# used for adding properties to default.prop _product_list_vars += PRODUCT_DEFAULT_PROPERTY_OVERRIDES -# A list of property assignments, like "key = value", with zero or more -# whitespace characters on either side of the '='. -# used for adding properties to build.prop of product partition -_product_list_vars += PRODUCT_PRODUCT_PROPERTIES - -# A list of property assignments, like "key = value", with zero or more -# whitespace characters on either side of the '='. -# used for adding properties to build.prop of system_ext and odm partitions -_product_list_vars += PRODUCT_SYSTEM_EXT_PROPERTIES -_product_list_vars += PRODUCT_ODM_PROPERTIES +# TODO(b/117892318) consider deprecating these too +_product_list_vars += PRODUCT_SYSTEM_PROPERTY_BLACKLIST +_product_list_vars += PRODUCT_VENDOR_PROPERTY_BLACKLIST # The characteristics of the product, which among other things is passed to aapt _product_single_value_vars += PRODUCT_CHARACTERISTICS @@ -226,19 +228,12 @@ _product_list_vars += PRODUCT_SUPPORTS_BOOT_SIGNER _product_list_vars += PRODUCT_SUPPORTS_VBOOT _product_list_vars += PRODUCT_SUPPORTS_VERITY _product_list_vars += PRODUCT_SUPPORTS_VERITY_FEC -_product_list_vars += PRODUCT_OEM_PROPERTIES - -# A list of property assignments, like "key = value", with zero or more -# whitespace characters on either side of the '='. -# used for adding properties to default.prop of system partition -_product_list_vars += PRODUCT_SYSTEM_DEFAULT_PROPERTIES - -_product_list_vars += PRODUCT_SYSTEM_PROPERTY_BLACKLIST -_product_list_vars += PRODUCT_VENDOR_PROPERTY_BLACKLIST _product_list_vars += PRODUCT_SYSTEM_SERVER_APPS _product_list_vars += PRODUCT_SYSTEM_SERVER_JARS # List of system_server jars delivered via apex. Format = <apex name>:<jar name>. _product_list_vars += PRODUCT_UPDATABLE_SYSTEM_SERVER_JARS +# If true, then suboptimal order of system server jars does not cause an error. +_product_list_vars += PRODUCT_BROKEN_SUBOPTIMAL_ORDER_OF_SYSTEM_SERVER_JARS # Additional system server jars to be appended at the end of the common list. # This is necessary to avoid jars reordering due to makefile inheritance order. diff --git a/core/product_config.mk b/core/product_config.mk index a16af05cf4..7a7c4b7e2b 100644 --- a/core/product_config.mk +++ b/core/product_config.mk @@ -231,6 +231,10 @@ PRODUCT_AAPT_CONFIG := $(subst $(space),$(comma),$(PRODUCT_AAPT_CONFIG)) # Extra boot jars must be appended at the end after common boot jars. PRODUCT_BOOT_JARS += $(PRODUCT_BOOT_JARS_EXTRA) +# Add 'platform:' prefix to unqualified boot jars +PRODUCT_BOOT_JARS := $(foreach pair,$(PRODUCT_BOOT_JARS), \ + $(if $(findstring :,$(pair)),,platform:)$(pair)) + # The extra system server jars must be appended at the end after common system server jars. PRODUCT_SYSTEM_SERVER_JARS += $(PRODUCT_SYSTEM_SERVER_JARS_EXTRA) @@ -271,11 +275,9 @@ ifdef PRODUCT_DEFAULT_DEV_CERTIFICATE 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) \ - ) \ -) + $(eval jar := $(call word-colon,2,$(pair))) \ + $(if $(findstring $(jar), $(PRODUCT_BOOT_JARS)), \ + $(error A jar in PRODUCT_UPDATABLE_BOOT_JARS must not be in PRODUCT_BOOT_JARS, but $(jar) is))) ENFORCE_SYSTEM_CERTIFICATE := $(PRODUCT_ENFORCE_ARTIFACT_SYSTEM_CERTIFICATE_REQUIREMENT) ENFORCE_SYSTEM_CERTIFICATE_ALLOW_LIST := $(PRODUCT_ARTIFACT_SYSTEM_CERTIFICATE_REQUIREMENT_ALLOW_LIST) diff --git a/core/rbe.mk b/core/rbe.mk index 019ac04efd..9ec8481662 100644 --- a/core/rbe.mk +++ b/core/rbe.mk @@ -28,6 +28,12 @@ ifneq ($(filter-out false,$(USE_RBE)),) cxx_rbe_exec_strategy := "local" endif + ifdef RBE_CXX_COMPARE + cxx_compare := $(RBE_CXX_COMPARE) + else + cxx_compare := "false" + endif + ifdef RBE_JAVAC_EXEC_STRATEGY javac_exec_strategy := $(RBE_JAVAC_EXEC_STRATEGY) else @@ -51,7 +57,7 @@ ifneq ($(filter-out false,$(USE_RBE)),) java_r8_d8_platform := $(platform)",Pool=java16" RBE_WRAPPER := $(rbe_dir)/rewrapper - RBE_CXX := --labels=type=compile,lang=cpp,compiler=clang --env_var_whitelist=PWD --exec_strategy=$(cxx_rbe_exec_strategy) --platform="$(cxx_platform)" + RBE_CXX := --labels=type=compile,lang=cpp,compiler=clang --env_var_whitelist=PWD --exec_strategy=$(cxx_rbe_exec_strategy) --platform="$(cxx_platform)" --compare="$(cxx_compare)" # Append rewrapper to existing *_WRAPPER variables so it's possible to # use both ccache and rewrapper. diff --git a/core/shared_test_lib.mk b/core/shared_test_lib.mk deleted file mode 100644 index 1ea9fe790e..0000000000 --- a/core/shared_test_lib.mk +++ /dev/null @@ -1 +0,0 @@ -$(error BUILD_SHARED_TEST_LIBRARY is obsolete) diff --git a/core/soong_app_prebuilt.mk b/core/soong_app_prebuilt.mk index 01e980029b..3549c1df5a 100644 --- a/core/soong_app_prebuilt.mk +++ b/core/soong_app_prebuilt.mk @@ -167,7 +167,7 @@ endif PACKAGES.$(LOCAL_MODULE).PARTITION := $(actual_partition_tag) ifdef LOCAL_SOONG_BUNDLE - ALL_MODULES.$(LOCAL_MODULE).BUNDLE := $(LOCAL_SOONG_BUNDLE) + ALL_MODULES.$(my_register_name).BUNDLE := $(LOCAL_SOONG_BUNDLE) endif ifndef LOCAL_IS_HOST_MODULE diff --git a/core/soong_cc_prebuilt.mk b/core/soong_cc_prebuilt.mk index 51549bd2a5..986609b501 100644 --- a/core/soong_cc_prebuilt.mk +++ b/core/soong_cc_prebuilt.mk @@ -112,7 +112,9 @@ endif my_check_same_vndk_variants := ifeq ($(LOCAL_CHECK_SAME_VNDK_VARIANTS),true) ifeq ($(filter hwaddress address, $(SANITIZE_TARGET)),) - my_check_same_vndk_variants := true + ifneq ($(CLANG_COVERAGE),true) + my_check_same_vndk_variants := true + endif endif endif diff --git a/core/soong_config.mk b/core/soong_config.mk index 3f4ba24bc3..84bfd1e3d2 100644 --- a/core/soong_config.mk +++ b/core/soong_config.mk @@ -39,7 +39,8 @@ $(call add_json_str, Platform_base_os, $(PLATFORM_BASE_OS)) $(call add_json_str, Platform_min_supported_target_sdk_version, $(PLATFORM_MIN_SUPPORTED_TARGET_SDK_VERSION)) $(call add_json_bool, Allow_missing_dependencies, $(ALLOW_MISSING_DEPENDENCIES)) -$(call add_json_bool, Unbundled_build, $(TARGET_BUILD_APPS)) +$(call add_json_bool, Unbundled_build, $(TARGET_BUILD_UNBUNDLED)) +$(call add_json_bool, Unbundled_build_apps, $(TARGET_BUILD_APPS)) $(call add_json_bool, Unbundled_build_sdks_from_source, $(UNBUNDLED_BUILD_SDKS_FROM_SOURCE)) $(call add_json_bool, Pdk, $(filter true,$(TARGET_BUILD_PDK))) @@ -110,20 +111,25 @@ $(call add_json_bool, DisableScudo, $(filter true,$(PRODUCT $(call add_json_bool, ClangTidy, $(filter 1 true,$(WITH_TIDY))) $(call add_json_str, TidyChecks, $(WITH_TIDY_CHECKS)) +$(call add_json_list, JavaCoveragePaths, $(JAVA_COVERAGE_PATHS)) +$(call add_json_list, JavaCoverageExcludePaths, $(JAVA_COVERAGE_EXCLUDE_PATHS)) + $(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)) +# TODO(b/158212027): Remove `$(COVERAGE_PATHS)` from this list when all users have been moved to +# `NATIVE_COVERAGE_PATHS`. +$(call add_json_list, NativeCoveragePaths, $(COVERAGE_PATHS) $(NATIVE_COVERAGE_PATHS)) +# TODO(b/158212027): Remove `$(COVERAGE_EXCLUDE_PATHS)` from this list when all users have been +# moved to `NATIVE_COVERAGE_EXCLUDE_PATHS`. +$(call add_json_list, NativeCoverageExcludePaths, $(COVERAGE_EXCLUDE_PATHS) $(NATIVE_COVERAGE_EXCLUDE_PATHS)) $(call add_json_bool, SamplingPGO, $(filter true,$(SAMPLING_PGO))) $(call add_json_bool, ArtUseReadBarrier, $(call invert_bool,$(filter false,$(PRODUCT_ART_USE_READ_BARRIER)))) $(call add_json_bool, Binder32bit, $(BINDER32BIT)) $(call add_json_str, BtConfigIncludeDir, $(BOARD_BLUETOOTH_BDROID_BUILDCFG_INCLUDE_DIR)) -$(call add_json_list, DeviceKernelHeaders, $(TARGET_PROJECT_SYSTEM_INCLUDES)) -$(call add_json_bool, DevicePrefer32BitApps, $(filter true,$(TARGET_PREFER_32_BIT_APPS))) -$(call add_json_bool, DevicePrefer32BitExecutables, $(filter true,$(TARGET_PREFER_32_BIT_EXECUTABLES))) +$(call add_json_list, DeviceKernelHeaders, $(TARGET_DEVICE_KERNEL_HEADERS) $(TARGET_BOARD_KERNEL_HEADERS) $(TARGET_PRODUCT_KERNEL_HEADERS)) $(call add_json_str, DeviceVndkVersion, $(BOARD_VNDK_VERSION)) $(call add_json_str, Platform_vndk_version, $(PLATFORM_VNDK_VERSION)) $(call add_json_str, ProductVndkVersion, $(PRODUCT_PRODUCT_VNDK_VERSION)) @@ -132,6 +138,8 @@ $(call add_json_bool, BoardVndkRuntimeDisable, $(BOARD_VNDK_RUNTIME_DI $(call add_json_list, DeviceSystemSdkVersions, $(BOARD_SYSTEMSDK_VERSIONS)) $(call add_json_list, Platform_systemsdk_versions, $(PLATFORM_SYSTEMSDK_VERSIONS)) $(call add_json_bool, Malloc_not_svelte, $(call invert_bool,$(filter true,$(MALLOC_SVELTE)))) +$(call add_json_bool, Malloc_zero_contents, $(MALLOC_ZERO_CONTENTS)) +$(call add_json_bool, Malloc_pattern_fill_contents, $(MALLOC_PATTERN_FILL_CONTENTS)) $(call add_json_str, Override_rs_driver, $(OVERRIDE_RS_DRIVER)) $(call add_json_bool, UncompressPrivAppDex, $(call invert_bool,$(filter true,$(DONT_UNCOMPRESS_PRIV_APPS_DEXS)))) diff --git a/core/soong_java_prebuilt.mk b/core/soong_java_prebuilt.mk index bfde9446cd..e4c84e091c 100644 --- a/core/soong_java_prebuilt.mk +++ b/core/soong_java_prebuilt.mk @@ -91,7 +91,8 @@ endif # LOCAL_SOONG_RESOURCE_EXPORT_PACKAGE ifdef LOCAL_SOONG_DEX_JAR ifndef LOCAL_IS_HOST_MODULE - ifneq ($(filter $(LOCAL_MODULE),$(PRODUCT_BOOT_JARS)),) # is_boot_jar + boot_jars := $(foreach pair,$(PRODUCT_BOOT_JARS), $(call word-colon,2,$(pair))) + ifneq ($(filter $(LOCAL_MODULE),$(boot_jars)),) # is_boot_jar ifeq (true,$(WITH_DEXPREOPT)) # For libart, the boot jars' odex files are replaced by $(DEFAULT_DEX_PREOPT_INSTALLED_IMAGE). # We use this installed_odex trick to get boot.art installed. @@ -132,7 +133,7 @@ ALL_MODULES.$(my_register_name).CLASSES_JAR := $(full_classes_jar) $(my_register_name): $(my_installed) ifdef LOCAL_SOONG_AAR - ALL_MODULES.$(LOCAL_MODULE).AAR := $(LOCAL_SOONG_AAR) + ALL_MODULES.$(my_register_name).AAR := $(LOCAL_SOONG_AAR) endif javac-check : $(full_classes_jar) diff --git a/core/soong_rust_prebuilt.mk b/core/soong_rust_prebuilt.mk index 4a9eb4ab6f..804e37edf9 100644 --- a/core/soong_rust_prebuilt.mk +++ b/core/soong_rust_prebuilt.mk @@ -75,6 +75,23 @@ ifndef LOCAL_IS_HOST_MODULE endif endif + +ifeq ($(NATIVE_COVERAGE),true) + ifneq (,$(strip $(LOCAL_PREBUILT_COVERAGE_ARCHIVE))) + $(eval $(call copy-one-file,$(LOCAL_PREBUILT_COVERAGE_ARCHIVE),$(intermediates)/$(LOCAL_MODULE).zip)) + ifneq ($(LOCAL_UNINSTALLABLE_MODULE),true) + ifdef LOCAL_IS_HOST_MODULE + my_coverage_path := $($(my_prefix)OUT_COVERAGE)/$(patsubst $($(my_prefix)OUT)/%,%,$(my_module_path)) + else + my_coverage_path := $(TARGET_OUT_COVERAGE)/$(patsubst $(PRODUCT_OUT)/%,%,$(my_module_path)) + endif + my_coverage_path := $(my_coverage_path)/$(patsubst %.so,%,$(my_installed_module_stem)).zip + $(eval $(call copy-one-file,$(LOCAL_PREBUILT_COVERAGE_ARCHIVE),$(my_coverage_path))) + $(LOCAL_BUILT_MODULE): $(my_coverage_path) + endif + endif +endif + # A product may be configured to strip everything in some build variants. # We do the stripping as a post-install command so that LOCAL_BUILT_MODULE # is still with the symbols and we don't need to clean it (and relink) when diff --git a/core/static_java_library.mk b/core/static_java_library.mk index 7eef167e11..81dc2dfc4e 100644 --- a/core/static_java_library.mk +++ b/core/static_java_library.mk @@ -209,7 +209,7 @@ $(built_aar) : $(aar_classes_jar) $(full_android_manifest) $(intermediates.COMMO $(call jar-args-sorted-files-in-directory,$(dir $@)aar) # Register the aar file. -ALL_MODULES.$(LOCAL_MODULE).AAR := $(built_aar) +ALL_MODULES.$(my_register_name).AAR := $(built_aar) endif # need_compile_res # Reset internal variables. diff --git a/core/static_test_lib.mk b/core/static_test_lib.mk deleted file mode 100644 index a0e2970698..0000000000 --- a/core/static_test_lib.mk +++ /dev/null @@ -1,9 +0,0 @@ -############################################# -## A thin wrapper around BUILD_STATIC_LIBRARY -## Common flags for native tests are added. -############################################# -$(call record-module-type,STATIC_TEST_LIBRARY) - -include $(BUILD_SYSTEM)/target_test_internal.mk - -include $(BUILD_STATIC_LIBRARY) diff --git a/core/sysprop.mk b/core/sysprop.mk new file mode 100644 index 0000000000..0cee81c6c1 --- /dev/null +++ b/core/sysprop.mk @@ -0,0 +1,401 @@ +# +# Copyright (C) 2020 The Android Open Source Project +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +# sysprop.mk defines rules for generating <partition>/build.prop files + +# ----------------------------------------------------------------- +# property_overrides_split_enabled +property_overrides_split_enabled := +ifeq ($(BOARD_PROPERTY_OVERRIDES_SPLIT_ENABLED), true) + property_overrides_split_enabled := true +endif + +BUILDINFO_SH := build/make/tools/buildinfo.sh +POST_PROCESS_PROPS := $(HOST_OUT_EXECUTABLES)/post_process_props$(HOST_EXECUTABLE_SUFFIX) + +# Emits a set of sysprops common to all partitions to a file. +# $(1): Partition name +# $(2): Output file name +define generate-common-build-props + echo "####################################" >> $(2);\ + echo "# from generate-common-build-props" >> $(2);\ + echo "# These properties identify this partition image." >> $(2);\ + echo "####################################" >> $(2);\ + $(if $(filter system,$(1)),\ + echo "ro.product.$(1).brand=$(PRODUCT_SYSTEM_BRAND)" >> $(2);\ + echo "ro.product.$(1).device=$(PRODUCT_SYSTEM_DEVICE)" >> $(2);\ + echo "ro.product.$(1).manufacturer=$(PRODUCT_SYSTEM_MANUFACTURER)" >> $(2);\ + echo "ro.product.$(1).model=$(PRODUCT_SYSTEM_MODEL)" >> $(2);\ + echo "ro.product.$(1).name=$(PRODUCT_SYSTEM_NAME)" >> $(2);\ + ,\ + echo "ro.product.$(1).brand=$(PRODUCT_BRAND)" >> $(2);\ + echo "ro.product.$(1).device=$(TARGET_DEVICE)" >> $(2);\ + echo "ro.product.$(1).manufacturer=$(PRODUCT_MANUFACTURER)" >> $(2);\ + echo "ro.product.$(1).model=$(PRODUCT_MODEL)" >> $(2);\ + echo "ro.product.$(1).name=$(TARGET_PRODUCT)" >> $(2);\ + )\ + echo "ro.$(1).build.date=`$(DATE_FROM_FILE)`" >> $(2);\ + echo "ro.$(1).build.date.utc=`$(DATE_FROM_FILE) +%s`" >> $(2);\ + echo "ro.$(1).build.fingerprint=$(BUILD_FINGERPRINT_FROM_FILE)" >> $(2);\ + echo "ro.$(1).build.id=$(BUILD_ID)" >> $(2);\ + echo "ro.$(1).build.tags=$(BUILD_VERSION_TAGS)" >> $(2);\ + echo "ro.$(1).build.type=$(TARGET_BUILD_VARIANT)" >> $(2);\ + echo "ro.$(1).build.version.incremental=$(BUILD_NUMBER_FROM_FILE)" >> $(2);\ + echo "ro.$(1).build.version.release=$(PLATFORM_VERSION)" >> $(2);\ + echo "ro.$(1).build.version.sdk=$(PLATFORM_SDK_VERSION)" >> $(2);\ + +endef + +# Rule for generating <partition>/build.prop file +# +# $(1): partition name +# $(2): path to the output +# $(3): path to the input *.prop files. The contents of the files are directly +# emitted to the output +# $(4): list of variable names each of which contains name=value pairs +# $(5): optional list of prop names to force remove from the output. Properties from both +# $(3) and (4) are affected. +define build-properties +ALL_DEFAULT_INSTALLED_MODULES += $(2) + +# TODO(b/117892318): eliminate the call to uniq-pairs-by-first-component when +# it is guaranteed that there is no dup. +$(foreach name,$(strip $(4)),\ + $(eval _resolved_$(name) := $$(call collapse-pairs, $$(call uniq-pairs-by-first-component,$$($(name)),=)))\ +) + +$(2): $(POST_PROCESS_PROPS) $(INTERNAL_BUILD_ID_MAKEFILE) $(API_FINGERPRINT) $(3) + $(hide) echo Building $$@ + $(hide) mkdir -p $$(dir $$@) + $(hide) rm -f $$@ && touch $$@ + $(hide) $$(call generate-common-build-props,$(call to-lower,$(strip $(1))),$$@) + $(hide) $(foreach file,$(strip $(3)),\ + if [ -f "$(file)" ]; then\ + echo "" >> $$@;\ + echo "####################################" >> $$@;\ + echo "# from $(file)" >> $$@;\ + echo "####################################" >> $$@;\ + cat $(file) >> $$@;\ + fi;) + $(hide) $(foreach name,$(strip $(4)),\ + echo "" >> $$@;\ + echo "####################################" >> $$@;\ + echo "# from variable $(name)" >> $$@;\ + echo "####################################" >> $$@;\ + $$(foreach line,$$(_resolved_$(name)),\ + echo "$$(line)" >> $$@;\ + )\ + ) + $(hide) $(POST_PROCESS_PROPS) $$@ $(5) + $(hide) echo "# end of file" >> $$@ +endef + +# ----------------------------------------------------------------- +# Define fingerprint, thumbprint, and version tags for the current build +# +# BUILD_VERSION_TAGS is a comma-separated list of tags chosen by the device +# implementer that further distinguishes the build. It's basically defined +# by the device implementer. Here, we are adding a mandatory tag that +# identifies the signing config of the build. +BUILD_VERSION_TAGS := $(BUILD_VERSION_TAGS) +ifeq ($(TARGET_BUILD_TYPE),debug) + BUILD_VERSION_TAGS += debug +endif +# The "test-keys" tag marks builds signed with the old test keys, +# which are available in the SDK. "dev-keys" marks builds signed with +# non-default dev keys (usually private keys from a vendor directory). +# Both of these tags will be removed and replaced with "release-keys" +# when the target-files is signed in a post-build step. +ifeq ($(DEFAULT_SYSTEM_DEV_CERTIFICATE),build/make/target/product/security/testkey) +BUILD_KEYS := test-keys +else +BUILD_KEYS := dev-keys +endif +BUILD_VERSION_TAGS += $(BUILD_KEYS) +BUILD_VERSION_TAGS := $(subst $(space),$(comma),$(sort $(BUILD_VERSION_TAGS))) + +# BUILD_FINGERPRINT is used used to uniquely identify the combined build and +# product; used by the OTA server. +ifeq (,$(strip $(BUILD_FINGERPRINT))) + ifeq ($(strip $(HAS_BUILD_NUMBER)),false) + BF_BUILD_NUMBER := $(BUILD_USERNAME)$$($(DATE_FROM_FILE) +%m%d%H%M) + else + BF_BUILD_NUMBER := $(file <$(BUILD_NUMBER_FILE)) + endif + BUILD_FINGERPRINT := $(PRODUCT_BRAND)/$(TARGET_PRODUCT)/$(TARGET_DEVICE):$(PLATFORM_VERSION)/$(BUILD_ID)/$(BF_BUILD_NUMBER):$(TARGET_BUILD_VARIANT)/$(BUILD_VERSION_TAGS) +endif +# unset it for safety. +BF_BUILD_NUMBER := + +BUILD_FINGERPRINT_FILE := $(PRODUCT_OUT)/build_fingerprint.txt +ifneq (,$(shell mkdir -p $(PRODUCT_OUT) && echo $(BUILD_FINGERPRINT) >$(BUILD_FINGERPRINT_FILE) && grep " " $(BUILD_FINGERPRINT_FILE))) + $(error BUILD_FINGERPRINT cannot contain spaces: "$(file <$(BUILD_FINGERPRINT_FILE))") +endif +BUILD_FINGERPRINT_FROM_FILE := $$(cat $(BUILD_FINGERPRINT_FILE)) +# unset it for safety. +BUILD_FINGERPRINT := + +# BUILD_THUMBPRINT is used to uniquely identify the system build; used by the +# OTA server. This purposefully excludes any product-specific variables. +ifeq (,$(strip $(BUILD_THUMBPRINT))) + BUILD_THUMBPRINT := $(PLATFORM_VERSION)/$(BUILD_ID)/$(BUILD_NUMBER_FROM_FILE):$(TARGET_BUILD_VARIANT)/$(BUILD_VERSION_TAGS) +endif + +BUILD_THUMBPRINT_FILE := $(PRODUCT_OUT)/build_thumbprint.txt +ifneq (,$(shell mkdir -p $(PRODUCT_OUT) && echo $(BUILD_THUMBPRINT) >$(BUILD_THUMBPRINT_FILE) && grep " " $(BUILD_THUMBPRINT_FILE))) + $(error BUILD_THUMBPRINT cannot contain spaces: "$(file <$(BUILD_THUMBPRINT_FILE))") +endif +BUILD_THUMBPRINT_FROM_FILE := $$(cat $(BUILD_THUMBPRINT_FILE)) +# unset it for safety. +BUILD_THUMBPRINT := + +# ----------------------------------------------------------------- +# Define human readable strings that describe this build +# + +# BUILD_ID: detail info; has the same info as the build fingerprint +BUILD_DESC := $(TARGET_PRODUCT)-$(TARGET_BUILD_VARIANT) $(PLATFORM_VERSION) $(BUILD_ID) $(BUILD_NUMBER_FROM_FILE) $(BUILD_VERSION_TAGS) + +# BUILD_DISPLAY_ID is shown under Settings -> About Phone +ifeq ($(TARGET_BUILD_VARIANT),user) + # User builds should show: + # release build number or branch.buld_number non-release builds + + # Dev. branches should have DISPLAY_BUILD_NUMBER set + ifeq (true,$(DISPLAY_BUILD_NUMBER)) + BUILD_DISPLAY_ID := $(BUILD_ID).$(BUILD_NUMBER_FROM_FILE) $(BUILD_KEYS) + else + BUILD_DISPLAY_ID := $(BUILD_ID) $(BUILD_KEYS) + endif +else + # Non-user builds should show detailed build information + BUILD_DISPLAY_ID := $(BUILD_DESC) +endif + +# TARGET_BUILD_FLAVOR and ro.build.flavor are used only by the test +# harness to distinguish builds. Only add _asan for a sanitized build +# if it isn't already a part of the flavor (via a dedicated lunch +# config for example). +TARGET_BUILD_FLAVOR := $(TARGET_PRODUCT)-$(TARGET_BUILD_VARIANT) +ifneq (, $(filter address, $(SANITIZE_TARGET))) +ifeq (,$(findstring _asan,$(TARGET_BUILD_FLAVOR))) +TARGET_BUILD_FLAVOR := $(TARGET_BUILD_FLAVOR)_asan +endif +endif + +KNOWN_OEM_THUMBPRINT_PROPERTIES := \ + ro.product.brand \ + ro.product.name \ + ro.product.device +OEM_THUMBPRINT_PROPERTIES := $(filter $(KNOWN_OEM_THUMBPRINT_PROPERTIES),\ + $(PRODUCT_OEM_PROPERTIES)) +KNOWN_OEM_THUMBPRINT_PROPERTIES:= + +# ----------------------------------------------------------------- +# system/build.prop +# +# Note: parts of this file that can't be generated by the build-properties +# macro are manually created as separate files and then fed into the macro + +# Accepts a whitespace separated list of product locales such as +# (en_US en_AU en_GB...) and returns the first locale in the list with +# underscores replaced with hyphens. In the example above, this will +# return "en-US". +define get-default-product-locale +$(strip $(subst _,-, $(firstword $(1)))) +endef + +gen_from_buildinfo_sh := $(call intermediates-dir-for,ETC,system_build_prop)/buildinfo.prop +$(gen_from_buildinfo_sh): $(INTERNAL_BUILD_ID_MAKEFILE) $(API_FINGERPRINT) + $(hide) TARGET_BUILD_TYPE="$(TARGET_BUILD_VARIANT)" \ + TARGET_BUILD_FLAVOR="$(TARGET_BUILD_FLAVOR)" \ + TARGET_DEVICE="$(TARGET_DEVICE)" \ + PRODUCT_DEFAULT_LOCALE="$(call get-default-product-locale,$(PRODUCT_LOCALES))" \ + PRODUCT_DEFAULT_WIFI_CHANNELS="$(PRODUCT_DEFAULT_WIFI_CHANNELS)" \ + PRIVATE_BUILD_DESC="$(BUILD_DESC)" \ + BUILD_ID="$(BUILD_ID)" \ + BUILD_DISPLAY_ID="$(BUILD_DISPLAY_ID)" \ + DATE="$(DATE_FROM_FILE)" \ + BUILD_USERNAME="$(BUILD_USERNAME)" \ + BUILD_HOSTNAME="$(BUILD_HOSTNAME)" \ + BUILD_NUMBER="$(BUILD_NUMBER_FROM_FILE)" \ + BOARD_BUILD_SYSTEM_ROOT_IMAGE="$(BOARD_BUILD_SYSTEM_ROOT_IMAGE)" \ + PLATFORM_VERSION="$(PLATFORM_VERSION)" \ + PLATFORM_VERSION_LAST_STABLE="$(PLATFORM_VERSION_LAST_STABLE)" \ + PLATFORM_SECURITY_PATCH="$(PLATFORM_SECURITY_PATCH)" \ + PLATFORM_BASE_OS="$(PLATFORM_BASE_OS)" \ + PLATFORM_SDK_VERSION="$(PLATFORM_SDK_VERSION)" \ + PLATFORM_PREVIEW_SDK_VERSION="$(PLATFORM_PREVIEW_SDK_VERSION)" \ + PLATFORM_PREVIEW_SDK_FINGERPRINT="$$(cat $(API_FINGERPRINT))" \ + PLATFORM_VERSION_CODENAME="$(PLATFORM_VERSION_CODENAME)" \ + PLATFORM_VERSION_ALL_CODENAMES="$(PLATFORM_VERSION_ALL_CODENAMES)" \ + PLATFORM_MIN_SUPPORTED_TARGET_SDK_VERSION="$(PLATFORM_MIN_SUPPORTED_TARGET_SDK_VERSION)" \ + BUILD_VERSION_TAGS="$(BUILD_VERSION_TAGS)" \ + $(if $(OEM_THUMBPRINT_PROPERTIES),BUILD_THUMBPRINT="$(BUILD_THUMBPRINT_FROM_FILE)") \ + TARGET_CPU_ABI_LIST="$(TARGET_CPU_ABI_LIST)" \ + TARGET_CPU_ABI_LIST_32_BIT="$(TARGET_CPU_ABI_LIST_32_BIT)" \ + TARGET_CPU_ABI_LIST_64_BIT="$(TARGET_CPU_ABI_LIST_64_BIT)" \ + TARGET_CPU_ABI="$(TARGET_CPU_ABI)" \ + TARGET_CPU_ABI2="$(TARGET_CPU_ABI2)" \ + bash $(BUILDINFO_SH) > $@ + +ifneq ($(PRODUCT_OEM_PROPERTIES),) +import_oem_prop := $(call intermediates-dir-for,ETC,system_build_prop)/oem.prop + +$(import_oem_prop): + $(hide) echo "#" >> $@; \ + echo "# PRODUCT_OEM_PROPERTIES" >> $@; \ + echo "#" >> $@; + $(hide) $(foreach prop,$(PRODUCT_OEM_PROPERTIES), \ + echo "import /oem/oem.prop $(prop)" >> $@;) +else +import_oem_prop := +endif + +ifdef TARGET_SYSTEM_PROP +system_prop_file := $(TARGET_SYSTEM_PROP) +else +system_prop_file := $(wildcard $(TARGET_DEVICE_DIR)/system.prop) +endif + +_prop_files_ := \ + $(import_oem_prop) \ + $(gen_from_buildinfo_sh) \ + $(system_prop_file) + +# Order matters here. When there are duplicates, the last one wins. +# TODO(b/117892318): don't allow duplicates so that the ordering doesn't matter +_prop_vars_ := \ + ADDITIONAL_SYSTEM_PROPERTIES \ + PRODUCT_SYSTEM_PROPERTIES + +# TODO(b/117892318): deprecate this +_prop_vars_ += \ + PRODUCT_SYSTEM_DEFAULT_PROPERTIES + +ifndef property_overrides_split_enabled +_prop_vars_ += \ + ADDITIONAL_VENDOR_PROPERTIES +endif + +_blacklist_names_ := \ + $(PRODUCT_SYSTEM_PROPERTY_BLACKLIST) \ + ro.product.first_api_level + +INSTALLED_BUILD_PROP_TARGET := $(TARGET_OUT)/build.prop + +$(eval $(call build-properties,system,$(INSTALLED_BUILD_PROP_TARGET),\ +$(_prop_files_),$(_prop_vars_),\ +$(_blacklist_names_))) + + +# ----------------------------------------------------------------- +# vendor/build.prop +# +_prop_files_ := $(if $(TARGET_VENDOR_PROP),\ + $(TARGET_VENDOR_PROP),\ + $(wildcard $(TARGET_DEVICE_DIR)/vendor.prop)) + +android_info_prop := $(call intermediates-dir-for,ETC,android_info_prop)/android_info.prop +$(android_info_prop): $(INSTALLED_ANDROID_INFO_TXT_TARGET) + cat $< | grep 'require version-' | sed -e 's/require version-/ro.build.expect./g' > $@ + +_prop_files_ += $(android_info_pro) + +ifdef property_overrides_split_enabled +# Order matters here. When there are duplicates, the last one wins. +# TODO(b/117892318): don't allow duplicates so that the ordering doesn't matter +_prop_vars_ := \ + ADDITIONAL_VENDOR_PROPERTIES \ + PRODUCT_VENDOR_PROPERTIES + +# TODO(b/117892318): deprecate this +_prop_vars_ += \ + PRODUCT_DEFAULT_PROPERTY_OVERRIDES \ + PRODUCT_PROPERTY_OVERRIDES +else +_prop_vars_ := +endif + +INSTALLED_VENDOR_BUILD_PROP_TARGET := $(TARGET_OUT_VENDOR)/build.prop +$(eval $(call build-properties,\ + vendor,\ + $(INSTALLED_VENDOR_BUILD_PROP_TARGET),\ + $(_prop_files_),\ + $(_prop_vars_),\ + $(PRODUCT_VENDOR_PROPERTY_BLACKLIST))) + +# ----------------------------------------------------------------- +# product/build.prop +# + +_prop_files_ := $(if $(TARGET_PRODUCT_PROP),\ + $(TARGET_PRODUCT_PROP),\ + $(wildcard $(TARGET_DEVICE_DIR)/product.prop)) + +# Order matters here. When there are duplicates, the last one wins. +# TODO(b/117892318): don't allow duplicates so that the ordering doesn't matter +_prop_vars_ := \ + ADDITIONAL_PRODUCT_PROPERTIES \ + PRODUCT_PRODUCT_PROPERTIES + +INSTALLED_PRODUCT_BUILD_PROP_TARGET := $(TARGET_OUT_PRODUCT)/build.prop +$(eval $(call build-properties,\ + product,\ + $(INSTALLED_PRODUCT_BUILD_PROP_TARGET),\ + $(_prop_files_),\ + $(_prop_vars_),\ + $(empty))) + +# ---------------------------------------------------------------- +# odm/build.prop +# +_prop_files_ := $(if $(TARGET_ODM_PROP),\ + $(TARGET_ODM_PROP),\ + $(wildcard $(TARGET_DEVICE_DIR)/odm.prop)) + +# Order matters here. When there are duplicates, the last one wins. +# TODO(b/117892318): don't allow duplicates so that the ordering doesn't matter +_prop_vars_ := \ + ADDITIONAL_ODM_PROPERTIES \ + PRODUCT_ODM_PROPERTIES + +INSTALLED_ODM_BUILD_PROP_TARGET := $(TARGET_OUT_ODM)/build.prop +$(eval $(call build-properties,\ + odm,\ + $(INSTALLED_ODM_BUILD_PROP_TARGET),\ + $(_prop_files),\ + $(_prop_vars_),\ + $(empty))) + +# ----------------------------------------------------------------- +# system_ext/build.prop +# +_prop_files_ := $(if $(TARGET_SYSTEM_EXT_PROP),\ + $(TARGET_SYSTEM_EXT_PROP),\ + $(wildcard $(TARGET_DEVICE_DIR)/system_ext.prop)) + +# Order matters here. When there are duplicates, the last one wins. +# TODO(b/117892318): don't allow duplicates so that the ordering doesn't matter +_prop_vars_ := PRODUCT_SYSTEM_EXT_PROPERTIES + +INSTALLED_SYSTEM_EXT_BUILD_PROP_TARGET := $(TARGET_OUT_SYSTEM_EXT)/build.prop +$(eval $(call build-properties,\ + system_ext,\ + $(INSTALLED_SYSTEM_EXT_BUILD_PROP_TARGET),\ + $(_prop_files_),\ + $(_prop_vars_),\ + $(empty))) diff --git a/core/tasks/boot_jars_package_check.mk b/core/tasks/boot_jars_package_check.mk index 825bbc37d7..a17aaff321 100644 --- a/core/tasks/boot_jars_package_check.mk +++ b/core/tasks/boot_jars_package_check.mk @@ -23,19 +23,26 @@ ifdef PRODUCT_BOOT_JARS intermediates := $(call intermediates-dir-for, PACKAGING, boot-jars-package-check,,COMMON) stamp := $(intermediates)/stamp -# 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), \ +# Convert the colon-separated components <apex>:<jar> to <jar>.<apex> names +# (e.g. com.android.media:updatable-media -> updatable-media.com.android.media). +# Special cases: +# - for the "platform" or "system_ext" apex drop the .<apex> suffix +# - for the ART apex select release variant +boot_jars := $(foreach pair,$(PRODUCT_BOOT_JARS) $(PRODUCT_UPDATABLE_BOOT_JARS), \ + $(eval apex := $(call word-colon,1,$(pair))) \ + $(eval jar := $(call word-colon,2,$(pair))) \ + $(eval q := :) \ + $(eval sfx := $(q).$(apex)$(q)) \ + $(eval sfx := $(subst $(q).platform$(q),$(q)$(q),$(sfx))) \ + $(eval sfx := $(subst $(q).system_ext$(q),$(q)$(q),$(sfx))) \ + $(eval sfx := $(subst $(q).com.android.art$(q),$(q).com.android.art.release$(q),$(sfx))) \ + $(eval sfx := $(patsubst $(q)%$(q),%,$(sfx))) \ + $(jar)$(sfx)) + +# Convert boot jar names to build paths. +built_boot_jars := $(foreach j, $(boot_jars), \ $(call intermediates-dir-for, JAVA_LIBRARIES, $(j),,COMMON)/classes.jar) + script := build/make/core/tasks/check_boot_jars/check_boot_jars.py allowed_file := build/make/core/tasks/check_boot_jars/package_allowed_list.txt diff --git a/core/tasks/deps_licenses.mk b/core/tasks/deps_licenses.mk deleted file mode 100644 index daf986f606..0000000000 --- a/core/tasks/deps_licenses.mk +++ /dev/null @@ -1,59 +0,0 @@ -# -# Copyright (C) 2015 The Android Open Source Project -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -# Print modules and their transitive dependencies with license files. -# To invoke, run "make deps-license PROJ_PATH=<proj-path-patterns> DEP_PATH=<dep-path-patterns>". -# PROJ_PATH restricts the paths of the source modules; DEP_PATH restricts the paths of the dependency modules. -# Both can be makefile patterns supported by makefile function $(filter). -# Example: "make deps-license packages/app/% external/%" prints all modules in packages/app/ with their dpendencies in external/. -# The printout lines look like "<module_name> :: <module_paths> :: <license_files>". - -ifneq (,$(filter deps-license,$(MAKECMDGOALS))) -ifndef PROJ_PATH -$(error To "make deps-license" you must specify PROJ_PATH and DEP_PATH.) -endif -ifndef DEP_PATH -$(error To "make deps-license" you must specify PROJ_PATH and DEP_PATH.) -endif - -# Expand a module's dependencies transitively. -# $(1): the variable name to hold the result. -# $(2): the initial module name. -define get-module-all-dependencies -$(eval _gmad_new := $(sort $(filter-out $($(1)),\ - $(foreach m,$(2),$(ALL_DEPS.$(m).ALL_DEPS)))))\ -$(if $(_gmad_new),$(eval $(1) += $(_gmad_new))\ - $(call get-module-all-dependencies,$(1),$(_gmad_new))) -endef - -define print-deps-license -$(foreach m, $(sort $(ALL_DEPS.MODULES)),\ - $(eval m_p := $(sort $(ALL_MODULES.$(m).PATH) $(ALL_MODULES.$(m)$(TARGET_2ND_ARCH_MODULE_SUFFIX).PATH)))\ - $(if $(filter $(PROJ_PATH),$(m_p)),\ - $(eval deps :=)\ - $(eval $(call get-module-all-dependencies,deps,$(m)))\ - $(info $(m) :: $(m_p) :: $(ALL_DEPS.$(m).LICENSE))\ - $(foreach d,$(deps),\ - $(eval d_p := $(sort $(ALL_MODULES.$(d).PATH) $(ALL_MODULES.$(d)$(TARGET_2ND_ARCH_MODULE_SUFFIX).PATH)))\ - $(if $(filter $(DEP_PATH),$(d_p)),\ - $(info $(space)$(space)$(space)$(space)$(d) :: $(d_p) :: $(ALL_DEPS.$(d).LICENSE)))))) -endef - -.PHONY: deps-license -deps-license: - @$(call print-deps-license) - -endif diff --git a/core/tasks/tools/package-modules.mk b/core/tasks/tools/package-modules.mk index 7c4266ce4f..2b43f0fed3 100644 --- a/core/tasks/tools/package-modules.mk +++ b/core/tasks/tools/package-modules.mk @@ -16,7 +16,16 @@ # my_makefile := $(lastword $(filter-out $(lastword $(MAKEFILE_LIST)),$(MAKEFILE_LIST))) -my_staging_dir := $(call intermediates-dir-for,PACKAGING,$(my_package_name)) + +include $(CLEAR_VARS) +LOCAL_MODULE := $(my_package_name) +LOCAL_MODULE_CLASS := PACKAGING +LOCAL_MODULE_STEM := $(my_package_name).zip +LOCAL_UNINSTALLABLE_MODULE := true +include $(BUILD_SYSTEM)/base_rules.mk +my_staging_dir := $(intermediates) +my_package_zip := $(LOCAL_BUILT_MODULE) + my_built_modules := $(foreach p,$(my_copy_pairs),$(call word-colon,1,$(p))) my_copy_pairs := $(foreach p,$(my_copy_pairs),$(call word-colon,1,$(p)):$(my_staging_dir)/$(call word-colon,2,$(p))) my_pickup_files := @@ -80,7 +89,6 @@ 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) $(my_package_zip) : $(my_built_modules) diff --git a/core/test_config_common.mk b/core/test_config_common.mk deleted file mode 100644 index 487f9f2277..0000000000 --- a/core/test_config_common.mk +++ /dev/null @@ -1,56 +0,0 @@ -# -# Copyright (C) 2017 The Android Open Source Project -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -LOCAL_MODULE_CLASS := TEST_CONFIG - -# Output test config files to testcases directory. -ifeq (,$(filter general-tests, $(LOCAL_COMPATIBILITY_SUITE))) - LOCAL_COMPATIBILITY_SUITE += general-tests -endif - -LOCAL_MODULE_SUFFIX := .config - -my_test_config_file := $(wildcard $(LOCAL_PATH)/$(LOCAL_MODULE).xml) -LOCAL_SRC_FILES := - -include $(BUILD_SYSTEM)/base_rules.mk - -# The test config is not in a standalone XML file. -ifndef my_test_config_file - -ifndef LOCAL_TEST_CONFIG_OPTIONS - $(call pretty-error,LOCAL_TEST_CONFIG_OPTIONS must be set if the test XML file is not provided.) -endif - -my_base_test_config_file := $(LOCAL_PATH)/AndroidTest.xml -my_test_config_file := $(dir $(LOCAL_BUILT_MODULE))AndroidTest.xml - -$(my_test_config_file) : PRIVATE_test_config_options := $(LOCAL_TEST_CONFIG_OPTIONS) -$(my_test_config_file) : $(my_base_test_config_file) - @echo "Create $(notdir $@) with options: $(PRIVATE_test_config_options)." - $(eval _option_xml := \ - $(foreach option,$(PRIVATE_test_config_options), \ - $(eval p := $(subst :,$(space),$(option))) \ - <option name="$(word 1,$(p))" value="$(word 2,$(p))" \/>\n)) - $(hide) sed 's&</configuration>&$(_option_xml)</configuration>&' $< > $@ - -endif # my_test_config_file - -$(LOCAL_BUILT_MODULE) : $(my_test_config_file) - $(copy-file-to-target) - -my_base_test_config_file := -my_test_config_file := diff --git a/core/version_defaults.mk b/core/version_defaults.mk index a33f4e7098..5da20931ff 100644 --- a/core/version_defaults.mk +++ b/core/version_defaults.mk @@ -39,9 +39,9 @@ ifdef INTERNAL_BUILD_ID_MAKEFILE include $(INTERNAL_BUILD_ID_MAKEFILE) endif -DEFAULT_PLATFORM_VERSION := RP1A -MIN_PLATFORM_VERSION := RP1A -MAX_PLATFORM_VERSION := RP1A +DEFAULT_PLATFORM_VERSION := SP1A +MIN_PLATFORM_VERSION := SP1A +MAX_PLATFORM_VERSION := SP1A ALLOWED_VERSIONS := $(call allowed-platform-versions,\ $(MIN_PLATFORM_VERSION),\ @@ -93,7 +93,7 @@ PLATFORM_VERSION_LAST_STABLE := 11 # 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 := REL +PLATFORM_VERSION_CODENAME.SP1A := S ifndef PLATFORM_VERSION_CODENAME PLATFORM_VERSION_CODENAME := $(PLATFORM_VERSION_CODENAME.$(TARGET_PLATFORM_VERSION)) diff --git a/envsetup.sh b/envsetup.sh index 793f4b6cfa..e981034979 100644 --- a/envsetup.sh +++ b/envsetup.sh @@ -8,7 +8,7 @@ Invoke ". build/envsetup.sh" from your shell to add the following functions to y Selects <product_name> as the product to build, and <build_variant> as the variant to build, and stores those selections in the environment to be read by subsequent invocations of 'm' etc. -- tapas: tapas [<App1> <App2> ...] [arm|x86|mips|arm64|x86_64|mips64] [eng|userdebug|user] +- tapas: tapas [<App1> <App2> ...] [arm|x86|arm64|x86_64] [eng|userdebug|user] - croot: Changes directory to the top of the tree, or a subdirectory thereof. - m: Makes from the top of the tree. - mm: Builds and installs all of the modules in the current directory, and their @@ -33,7 +33,7 @@ Invoke ". build/envsetup.sh" from your shell to add the following functions to y - allmod: List all modules. - gomod: Go to the directory containing a module. - pathmod: Get the directory containing a module. -- refreshmod: Refresh list of modules for allmod/gomod. +- refreshmod: Refresh list of modules for allmod/gomod/pathmod. Environment options: - SANITIZE_HOST: Set to 'address' to use ASAN for all host modules. @@ -119,13 +119,13 @@ function get_build_var() if [ "$BUILD_VAR_CACHE_READY" = "true" ] then eval "echo \"\${var_cache_$1}\"" - return + return 0 fi local T=$(gettop) if [ ! "$T" ]; then echo "Couldn't locate the top of the tree. Try setting TOP." >&2 - return + return 1 fi (\cd $T; build/soong/soong_ui.bash --dumpvar-mode $1) } @@ -218,8 +218,6 @@ function setpaths() arm64) toolchaindir=aarch64/aarch64-linux-android-$targetgccversion/bin; toolchaindir2=arm/arm-linux-androideabi-$targetgccversion2/bin ;; - mips|mips64) toolchaindir=mips/mips64el-linux-android-$targetgccversion/bin - ;; *) echo "Can't find toolchain for unknown architecture: $ARCH" toolchaindir=xxxxxxxxx @@ -578,10 +576,25 @@ function add_lunch_combo() function print_lunch_menu() { local uname=$(uname) - local choices=$(TARGET_BUILD_APPS= get_build_var COMMON_LUNCH_CHOICES) + local choices + choices=$(TARGET_BUILD_APPS= get_build_var COMMON_LUNCH_CHOICES 2>/dev/null) + local ret=$? + echo echo "You're building on" $uname echo + + if [ $ret -ne 0 ] + then + echo "Warning: Cannot display lunch menu." + echo + echo "Note: You can invoke lunch with an explicit target:" + echo + echo " usage: lunch [target]" >&2 + echo + return + fi + echo "Lunch menu... pick a combo:" local i=1 @@ -599,7 +612,12 @@ function lunch() { local answer - if [ "$1" ] ; then + if [[ $# -gt 1 ]]; then + echo "usage: lunch [target]" >&2 + return 1 + fi + + if [ "$1" ]; then answer=$1 else print_lunch_menu @@ -632,7 +650,6 @@ function lunch() export TARGET_BUILD_APPS= local product variant_and_version variant version - product=${selection%%-*} # Trim everything after first dash variant_and_version=${selection#*-} # Trim everything up to first dash if [ "$variant_and_version" != "$selection" ]; then @@ -657,7 +674,6 @@ function lunch() then return 1 fi - export TARGET_PRODUCT=$(get_build_var TARGET_PRODUCT) export TARGET_BUILD_VARIANT=$(get_build_var TARGET_BUILD_VARIANT) if [ -n "$version" ]; then @@ -667,10 +683,10 @@ function lunch() fi export TARGET_BUILD_TYPE=release - echo + [[ -n "${ANDROID_QUIET_BUILD:-}" ]] || echo set_stuff_for_environment - printconfig + [[ -n "${ANDROID_QUIET_BUILD:-}" ]] || printconfig destroy_build_var_cache } @@ -696,10 +712,10 @@ function _lunch() function tapas() { local showHelp="$(echo $* | xargs -n 1 echo | \grep -E '^(help)$' | xargs)" - local arch="$(echo $* | xargs -n 1 echo | \grep -E '^(arm|x86|mips|arm64|x86_64|mips64)$' | xargs)" + local arch="$(echo $* | xargs -n 1 echo | \grep -E '^(arm|x86|arm64|x86_64)$' | xargs)" local variant="$(echo $* | xargs -n 1 echo | \grep -E '^(user|userdebug|eng)$' | xargs)" local density="$(echo $* | xargs -n 1 echo | \grep -E '^(ldpi|mdpi|tvdpi|hdpi|xhdpi|xxhdpi|xxxhdpi|alldpi)$' | xargs)" - local apps="$(echo $* | xargs -n 1 echo | \grep -E -v '^(user|userdebug|eng|arm|x86|mips|arm64|x86_64|mips64|ldpi|mdpi|tvdpi|hdpi|xhdpi|xxhdpi|xxxhdpi|alldpi)$' | xargs)" + local apps="$(echo $* | xargs -n 1 echo | \grep -E -v '^(user|userdebug|eng|arm|x86|arm64|x86_64|ldpi|mdpi|tvdpi|hdpi|xhdpi|xxhdpi|xxxhdpi|alldpi)$' | xargs)" if [ "$showHelp" != "" ]; then $(gettop)/build/make/tapasHelp.sh @@ -722,10 +738,8 @@ function tapas() local product=aosp_arm case $arch in x86) product=aosp_x86;; - mips) product=aosp_mips;; arm64) product=aosp_arm64;; x86_64) product=aosp_x86_64;; - mips64) product=aosp_mips64;; esac if [ -z "$variant" ]; then variant=eng @@ -949,7 +963,7 @@ case `uname -s` in Darwin) function sgrep() { - find -E . -name .repo -prune -o -name .git -prune -o -type f -iregex '.*\.(c|h|cc|cpp|hpp|S|java|xml|sh|mk|aidl|vts)' \ + find -E . -name .repo -prune -o -name .git -prune -o -type f -iregex '.*\.(c|h|cc|cpp|hpp|S|java|xml|sh|mk|aidl|vts|proto)' \ -exec grep --color -n "$@" {} + } @@ -957,7 +971,7 @@ case `uname -s` in *) function sgrep() { - find . -name .repo -prune -o -name .git -prune -o -type f -iregex '.*\.\(c\|h\|cc\|cpp\|hpp\|S\|java\|xml\|sh\|mk\|aidl\|vts\)' \ + find . -name .repo -prune -o -name .git -prune -o -type f -iregex '.*\.\(c\|h\|cc\|cpp\|hpp\|S\|java\|xml\|sh\|mk\|aidl\|vts\|proto\)' \ -exec grep --color -n "$@" {} + } ;; diff --git a/tapasHelp.sh b/tapasHelp.sh index 38b3e345bb..0f461304a3 100755 --- a/tapasHelp.sh +++ b/tapasHelp.sh @@ -6,7 +6,7 @@ SCRIPT_DIR="${PWD}" cd ../.. TOP="${PWD}" -message='usage: tapas [<App1> <App2> ...] [arm|x86|mips|arm64|x86_64|mips64] [eng|userdebug|user] +message='usage: tapas [<App1> <App2> ...] [arm|x86|arm64|x86_64] [eng|userdebug|user] tapas selects individual apps to be built by the Android build system. Unlike "lunch", "tapas" does not request the building of images for a device. diff --git a/target/board/BoardConfigGsiCommon.mk b/target/board/BoardConfigGsiCommon.mk index 49f6edcde4..0f36aaec14 100644 --- a/target/board/BoardConfigGsiCommon.mk +++ b/target/board/BoardConfigGsiCommon.mk @@ -58,7 +58,7 @@ endif BOARD_CACHEIMAGE_FILE_SYSTEM_TYPE := ext4 BOARD_CACHEIMAGE_PARTITION_SIZE := 16777216 -# Setup a vendor image to let PRODUCT_PROPERTY_OVERRIDES does not affect GSI +# Setup a vendor image to let PRODUCT_VENDOR_PROPERTIES does not affect GSI BOARD_VENDORIMAGE_FILE_SYSTEM_TYPE := ext4 # Disable 64 bit mediadrmserver diff --git a/target/board/emulator_arm/AndroidBoard.mk b/target/board/emulator_arm/AndroidBoard.mk new file mode 100644 index 0000000000..7911f6105f --- /dev/null +++ b/target/board/emulator_arm/AndroidBoard.mk @@ -0,0 +1 @@ +LOCAL_PATH := $(call my-dir) diff --git a/target/board/emulator_arm/BoardConfig.mk b/target/board/emulator_arm/BoardConfig.mk new file mode 100644 index 0000000000..287824fa7b --- /dev/null +++ b/target/board/emulator_arm/BoardConfig.mk @@ -0,0 +1,37 @@ +# Copyright (C) 2020 The Android Open Source Project +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +# arm emulator specific definitions +TARGET_ARCH := arm +TARGET_ARCH_VARIANT := armv7-a-neon +TARGET_CPU_VARIANT := generic +TARGET_CPU_ABI := armeabi-v7a +TARGET_CPU_ABI2 := armeabi + +include build/make/target/board/BoardConfigGsiCommon.mk +include build/make/target/board/BoardConfigEmuCommon.mk + +BOARD_USERDATAIMAGE_PARTITION_SIZE := 576716800 + +# Wifi. +BOARD_WLAN_DEVICE := emulator +BOARD_HOSTAPD_DRIVER := NL80211 +BOARD_WPA_SUPPLICANT_DRIVER := NL80211 +BOARD_HOSTAPD_PRIVATE_LIB := lib_driver_cmd_simulated +BOARD_WPA_SUPPLICANT_PRIVATE_LIB := lib_driver_cmd_simulated +WPA_SUPPLICANT_VERSION := VER_0_8_X +WIFI_DRIVER_FW_PATH_PARAM := "/dev/null" +WIFI_DRIVER_FW_PATH_STA := "/dev/null" +WIFI_DRIVER_FW_PATH_AP := "/dev/null" diff --git a/core/target_test_config.mk b/target/board/emulator_arm/device.mk index 61f5d2b2e3..af023eb25c 100644 --- a/core/target_test_config.mk +++ b/target/board/emulator_arm/device.mk @@ -1,5 +1,5 @@ # -# Copyright (C) 2017 The Android Open Source Project +# Copyright (C) 2020 The Android Open Source Project # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -14,10 +14,5 @@ # limitations under the License. # -# -# Common rules for building a TradeFed test XML file for target side tests. -# - -$(call record-module-type,TARGET_TEST_CONFIG) - -include $(BUILD_SYSTEM)/test_config_common.mk +PRODUCT_SOONG_NAMESPACES += device/generic/goldfish # for libwifi-hal-emu +PRODUCT_SOONG_NAMESPACES += device/generic/goldfish-opengl # for goldfish deps. diff --git a/target/board/emulator_arm/system_ext.prop b/target/board/emulator_arm/system_ext.prop new file mode 100644 index 0000000000..64829f3ce4 --- /dev/null +++ b/target/board/emulator_arm/system_ext.prop @@ -0,0 +1,5 @@ +# +# system.prop for generic sdk +# + +rild.libpath=/vendor/lib/libreference-ril.so diff --git a/target/board/emulator_x86/BoardConfig.mk b/target/board/emulator_x86/BoardConfig.mk new file mode 100644 index 0000000000..8f79166b48 --- /dev/null +++ b/target/board/emulator_x86/BoardConfig.mk @@ -0,0 +1,40 @@ +# Copyright (C) 2020 The Android Open Source Project +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +# x86 emulator specific definitions +TARGET_CPU_ABI := x86 +TARGET_ARCH := x86 +TARGET_ARCH_VARIANT := x86 + +TARGET_PRELINK_MODULE := false + +include build/make/target/board/BoardConfigGsiCommon.mk +include build/make/target/board/BoardConfigEmuCommon.mk + +# Resize to 4G to accommodate ASAN and CTS +BOARD_USERDATAIMAGE_PARTITION_SIZE := 4294967296 + +BOARD_SEPOLICY_DIRS += device/generic/goldfish/sepolicy/x86 + +# Wifi. +BOARD_WLAN_DEVICE := emulator +BOARD_HOSTAPD_DRIVER := NL80211 +BOARD_WPA_SUPPLICANT_DRIVER := NL80211 +BOARD_HOSTAPD_PRIVATE_LIB := lib_driver_cmd_simulated +BOARD_WPA_SUPPLICANT_PRIVATE_LIB := lib_driver_cmd_simulated +WPA_SUPPLICANT_VERSION := VER_0_8_X +WIFI_DRIVER_FW_PATH_PARAM := "/dev/null" +WIFI_DRIVER_FW_PATH_STA := "/dev/null" +WIFI_DRIVER_FW_PATH_AP := "/dev/null" diff --git a/target/board/emulator_x86/device.mk b/target/board/emulator_x86/device.mk new file mode 100644 index 0000000000..8a9d8da921 --- /dev/null +++ b/target/board/emulator_x86/device.mk @@ -0,0 +1,27 @@ +# +# Copyright (C) 2020 The Android Open Source Project +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +PRODUCT_SOONG_NAMESPACES += device/generic/goldfish # for libwifi-hal-emu +PRODUCT_SOONG_NAMESPACES += device/generic/goldfish-opengl # for goldfish deps. + +ifdef NET_ETH0_STARTONBOOT + PRODUCT_VENDOR_PROPERTIES += net.eth0.startonboot=1 +endif + +# Ensure we package the BIOS files too. +PRODUCT_HOST_PACKAGES += \ + bios.bin \ + vgabios-cirrus.bin \ diff --git a/target/board/emulator_x86/system_ext.prop b/target/board/emulator_x86/system_ext.prop new file mode 100644 index 0000000000..64829f3ce4 --- /dev/null +++ b/target/board/emulator_x86/system_ext.prop @@ -0,0 +1,5 @@ +# +# system.prop for generic sdk +# + +rild.libpath=/vendor/lib/libreference-ril.so diff --git a/target/board/emulator_x86_64/BoardConfig.mk b/target/board/emulator_x86_64/BoardConfig.mk new file mode 100755 index 0000000000..b9cbd8a243 --- /dev/null +++ b/target/board/emulator_x86_64/BoardConfig.mk @@ -0,0 +1,42 @@ +# Copyright (C) 2020 The Android Open Source Project +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +# x86_64 emulator specific definitions +TARGET_CPU_ABI := x86_64 +TARGET_ARCH := x86_64 +TARGET_ARCH_VARIANT := x86_64 + +TARGET_2ND_CPU_ABI := x86 +TARGET_2ND_ARCH := x86 +TARGET_2ND_ARCH_VARIANT := x86_64 + +TARGET_PRELINK_MODULE := false +include build/make/target/board/BoardConfigGsiCommon.mk +include build/make/target/board/BoardConfigEmuCommon.mk + +BOARD_USERDATAIMAGE_PARTITION_SIZE := 576716800 + +BOARD_SEPOLICY_DIRS += device/generic/goldfish/sepolicy/x86 + +# Wifi. +BOARD_WLAN_DEVICE := emulator +BOARD_HOSTAPD_DRIVER := NL80211 +BOARD_WPA_SUPPLICANT_DRIVER := NL80211 +BOARD_HOSTAPD_PRIVATE_LIB := lib_driver_cmd_simulated +BOARD_WPA_SUPPLICANT_PRIVATE_LIB := lib_driver_cmd_simulated +WPA_SUPPLICANT_VERSION := VER_0_8_X +WIFI_DRIVER_FW_PATH_PARAM := "/dev/null" +WIFI_DRIVER_FW_PATH_STA := "/dev/null" +WIFI_DRIVER_FW_PATH_AP := "/dev/null" diff --git a/target/board/emulator_x86_64/device.mk b/target/board/emulator_x86_64/device.mk new file mode 100755 index 0000000000..8a9d8da921 --- /dev/null +++ b/target/board/emulator_x86_64/device.mk @@ -0,0 +1,27 @@ +# +# Copyright (C) 2020 The Android Open Source Project +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +PRODUCT_SOONG_NAMESPACES += device/generic/goldfish # for libwifi-hal-emu +PRODUCT_SOONG_NAMESPACES += device/generic/goldfish-opengl # for goldfish deps. + +ifdef NET_ETH0_STARTONBOOT + PRODUCT_VENDOR_PROPERTIES += net.eth0.startonboot=1 +endif + +# Ensure we package the BIOS files too. +PRODUCT_HOST_PACKAGES += \ + bios.bin \ + vgabios-cirrus.bin \ diff --git a/target/board/emulator_x86_64/system_ext.prop b/target/board/emulator_x86_64/system_ext.prop new file mode 100644 index 0000000000..ed9d1731c7 --- /dev/null +++ b/target/board/emulator_x86_64/system_ext.prop @@ -0,0 +1,5 @@ +# +# system.prop for generic sdk +# + +rild.libpath=/vendor/lib64/libreference-ril.so diff --git a/target/board/emulator_x86_64_arm64/BoardConfig.mk b/target/board/emulator_x86_64_arm64/BoardConfig.mk new file mode 100755 index 0000000000..26b61a6787 --- /dev/null +++ b/target/board/emulator_x86_64_arm64/BoardConfig.mk @@ -0,0 +1,59 @@ +# Copyright (C) 2020 The Android Open Source Project +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +# x86_64 emulator specific definitions +TARGET_CPU_ABI := x86_64 +TARGET_ARCH := x86_64 +TARGET_ARCH_VARIANT := x86_64 + +TARGET_2ND_CPU_ABI := x86 +TARGET_2ND_ARCH := x86 +TARGET_2ND_ARCH_VARIANT := x86_64 + +TARGET_NATIVE_BRIDGE_ARCH := arm64 +TARGET_NATIVE_BRIDGE_ARCH_VARIANT := armv8-a +TARGET_NATIVE_BRIDGE_CPU_VARIANT := generic +TARGET_NATIVE_BRIDGE_ABI := arm64-v8a + +TARGET_NATIVE_BRIDGE_2ND_ARCH := arm +TARGET_NATIVE_BRIDGE_2ND_ARCH_VARIANT := armv7-a-neon +TARGET_NATIVE_BRIDGE_2ND_CPU_VARIANT := generic +TARGET_NATIVE_BRIDGE_2ND_ABI := armeabi-v7a armeabi + +BUILD_BROKEN_DUP_RULES := true + +TARGET_PRELINK_MODULE := false + +include build/make/target/board/BoardConfigMainlineCommon.mk +include build/make/target/board/BoardConfigEmuCommon.mk + +# the settings differ from BoardConfigMainlineCommon.mk +BOARD_USES_SYSTEM_OTHER_ODEX := + +# Resize to 4G to accommodate ASAN and CTS +BOARD_USERDATAIMAGE_PARTITION_SIZE := 4294967296 + +BOARD_SEPOLICY_DIRS += device/generic/goldfish/sepolicy/x86 + +# Wifi. +BOARD_WLAN_DEVICE := emulator +BOARD_HOSTAPD_DRIVER := NL80211 +BOARD_WPA_SUPPLICANT_DRIVER := NL80211 +BOARD_HOSTAPD_PRIVATE_LIB := lib_driver_cmd_simulated +BOARD_WPA_SUPPLICANT_PRIVATE_LIB := lib_driver_cmd_simulated +WPA_SUPPLICANT_VERSION := VER_0_8_X +WIFI_DRIVER_FW_PATH_PARAM := "/dev/null" +WIFI_DRIVER_FW_PATH_STA := "/dev/null" +WIFI_DRIVER_FW_PATH_AP := "/dev/null" diff --git a/core/host_test_config.mk b/target/board/emulator_x86_64_arm64/device.mk index b9975e54e0..af023eb25c 100644..100755 --- a/core/host_test_config.mk +++ b/target/board/emulator_x86_64_arm64/device.mk @@ -1,5 +1,5 @@ # -# Copyright (C) 2017 The Android Open Source Project +# Copyright (C) 2020 The Android Open Source Project # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -14,12 +14,5 @@ # limitations under the License. # -# -# Common rules for building a TradeFed test XML file for host side tests. -# - -$(call record-module-type,HOST_TEST_CONFIG) - -LOCAL_IS_HOST_MODULE := true - -include $(BUILD_SYSTEM)/test_config_common.mk +PRODUCT_SOONG_NAMESPACES += device/generic/goldfish # for libwifi-hal-emu +PRODUCT_SOONG_NAMESPACES += device/generic/goldfish-opengl # for goldfish deps. diff --git a/target/board/emulator_x86_64_arm64/system_ext.prop b/target/board/emulator_x86_64_arm64/system_ext.prop new file mode 100644 index 0000000000..ed9d1731c7 --- /dev/null +++ b/target/board/emulator_x86_64_arm64/system_ext.prop @@ -0,0 +1,5 @@ +# +# system.prop for generic sdk +# + +rild.libpath=/vendor/lib64/libreference-ril.so diff --git a/target/board/emulator_x86_arm/BoardConfig.mk b/target/board/emulator_x86_arm/BoardConfig.mk new file mode 100644 index 0000000000..21fdbc8e99 --- /dev/null +++ b/target/board/emulator_x86_arm/BoardConfig.mk @@ -0,0 +1,52 @@ +# Copyright (C) 2020 The Android Open Source Project +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +# x86 emulator specific definitions +TARGET_CPU_ABI := x86 +TARGET_ARCH := x86 +TARGET_ARCH_VARIANT := x86 + +TARGET_NATIVE_BRIDGE_ARCH := arm +TARGET_NATIVE_BRIDGE_ARCH_VARIANT := armv7-a-neon +TARGET_NATIVE_BRIDGE_CPU_VARIANT := generic +TARGET_NATIVE_BRIDGE_ABI := armeabi-v7a armeabi + +BUILD_BROKEN_DUP_RULES := true + +# +# The inclusion order below is important. +# The settings in latter makefiles overwrite those in the former. +# +include build/make/target/board/BoardConfigMainlineCommon.mk +include build/make/target/board/BoardConfigEmuCommon.mk + +# the settings differ from BoardConfigMainlineCommon.mk +BOARD_USES_SYSTEM_OTHER_ODEX := + +# Resize to 4G to accommodate ASAN and CTS +BOARD_USERDATAIMAGE_PARTITION_SIZE := 4294967296 + +BOARD_SEPOLICY_DIRS += device/generic/goldfish/sepolicy/x86 + +# Wifi. +BOARD_WLAN_DEVICE := emulator +BOARD_HOSTAPD_DRIVER := NL80211 +BOARD_WPA_SUPPLICANT_DRIVER := NL80211 +BOARD_HOSTAPD_PRIVATE_LIB := lib_driver_cmd_simulated +BOARD_WPA_SUPPLICANT_PRIVATE_LIB := lib_driver_cmd_simulated +WPA_SUPPLICANT_VERSION := VER_0_8_X +WIFI_DRIVER_FW_PATH_PARAM := "/dev/null" +WIFI_DRIVER_FW_PATH_STA := "/dev/null" +WIFI_DRIVER_FW_PATH_AP := "/dev/null" diff --git a/target/board/emulator_x86_arm/device.mk b/target/board/emulator_x86_arm/device.mk new file mode 100644 index 0000000000..af023eb25c --- /dev/null +++ b/target/board/emulator_x86_arm/device.mk @@ -0,0 +1,18 @@ +# +# Copyright (C) 2020 The Android Open Source Project +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +PRODUCT_SOONG_NAMESPACES += device/generic/goldfish # for libwifi-hal-emu +PRODUCT_SOONG_NAMESPACES += device/generic/goldfish-opengl # for goldfish deps. diff --git a/target/board/emulator_x86_arm/system_ext.prop b/target/board/emulator_x86_arm/system_ext.prop new file mode 100644 index 0000000000..64829f3ce4 --- /dev/null +++ b/target/board/emulator_x86_arm/system_ext.prop @@ -0,0 +1,5 @@ +# +# system.prop for generic sdk +# + +rild.libpath=/vendor/lib/libreference-ril.so diff --git a/target/board/generic/device.mk b/target/board/generic/device.mk index cfb15f0656..76242c90b2 100644 --- a/target/board/generic/device.mk +++ b/target/board/generic/device.mk @@ -16,12 +16,3 @@ PRODUCT_SOONG_NAMESPACES += device/generic/goldfish # for libwifi-hal-emu PRODUCT_SOONG_NAMESPACES += device/generic/goldfish-opengl # for goldfish deps. - -# NFC: -# Provide default libnfc-nci.conf file for devices that does not have one in -# vendor/etc because aosp system image (of aosp_$arch products) is going to -# be used as GSI. -# May need to remove the following for newly launched devices in P since this -# NFC configuration file should be in vendor/etc, instead of system/etc -PRODUCT_COPY_FILES += \ - device/generic/common/nfc/libnfc-nci.conf:system/etc/libnfc-nci.conf diff --git a/target/board/generic_x86/device.mk b/target/board/generic_x86/device.mk index 2b10a3dfa1..5ad008f119 100644 --- a/target/board/generic_x86/device.mk +++ b/target/board/generic_x86/device.mk @@ -18,7 +18,7 @@ PRODUCT_SOONG_NAMESPACES += device/generic/goldfish # for libwifi-hal-emu PRODUCT_SOONG_NAMESPACES += device/generic/goldfish-opengl # for goldfish deps. ifdef NET_ETH0_STARTONBOOT - PRODUCT_PROPERTY_OVERRIDES += net.eth0.startonboot=1 + PRODUCT_VENDOR_PROPERTIES += net.eth0.startonboot=1 endif # Ensure we package the BIOS files too. diff --git a/target/board/generic_x86_64/device.mk b/target/board/generic_x86_64/device.mk index 2b10a3dfa1..5ad008f119 100755 --- a/target/board/generic_x86_64/device.mk +++ b/target/board/generic_x86_64/device.mk @@ -18,7 +18,7 @@ PRODUCT_SOONG_NAMESPACES += device/generic/goldfish # for libwifi-hal-emu PRODUCT_SOONG_NAMESPACES += device/generic/goldfish-opengl # for goldfish deps. ifdef NET_ETH0_STARTONBOOT - PRODUCT_PROPERTY_OVERRIDES += net.eth0.startonboot=1 + PRODUCT_VENDOR_PROPERTIES += net.eth0.startonboot=1 endif # Ensure we package the BIOS files too. diff --git a/target/product/AndroidProducts.mk b/target/product/AndroidProducts.mk index 4121bc10e2..3949737d16 100644 --- a/target/product/AndroidProducts.mk +++ b/target/product/AndroidProducts.mk @@ -57,7 +57,6 @@ PRODUCT_MAKEFILES := \ $(LOCAL_DIR)/generic.mk \ $(LOCAL_DIR)/generic_x86.mk \ $(LOCAL_DIR)/gsi_arm64.mk \ - $(LOCAL_DIR)/mainline_arm64.mk \ $(LOCAL_DIR)/mainline_system_arm64.mk \ $(LOCAL_DIR)/mainline_system_x86.mk \ $(LOCAL_DIR)/mainline_system_x86_arm.mk \ diff --git a/target/product/aosp_arm64.mk b/target/product/aosp_arm64.mk index e88a36683c..3254ccf061 100644 --- a/target/product/aosp_arm64.mk +++ b/target/product/aosp_arm64.mk @@ -49,7 +49,7 @@ $(call inherit-product, $(SRC_TARGET_DIR)/product/telephony_system_ext.mk) $(call inherit-product, $(SRC_TARGET_DIR)/product/aosp_product.mk) # -# All components inherited here go to vendor image +# All components inherited here go to vendor or vendor_boot image # $(call inherit-product, $(SRC_TARGET_DIR)/product/emulator_vendor.mk) $(call inherit-product, $(SRC_TARGET_DIR)/board/generic_arm64/device.mk) diff --git a/target/product/aosp_arm64_ab.mk b/target/product/aosp_arm64_ab.mk index 75b9cc4f4b..0b2ae09d45 100644 --- a/target/product/aosp_arm64_ab.mk +++ b/target/product/aosp_arm64_ab.mk @@ -14,7 +14,7 @@ # limitations under the License. # -# PRODUCT_PROPERTY_OVERRIDES cannot be used here because sysprops will be at +# PRODUCT_VENDOR_PROPERTIES 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. diff --git a/target/product/aosp_arm_ab.mk b/target/product/aosp_arm_ab.mk index 80ebdb1518..ec2e5d7fce 100644 --- a/target/product/aosp_arm_ab.mk +++ b/target/product/aosp_arm_ab.mk @@ -14,7 +14,7 @@ # limitations under the License. # -# PRODUCT_PROPERTY_OVERRIDES cannot be used here because sysprops will be at +# PRODUCT_VENDOR_PROPERTIES 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. diff --git a/target/product/aosp_product.mk b/target/product/aosp_product.mk index e3819e6115..bf3d9939b6 100644 --- a/target/product/aosp_product.mk +++ b/target/product/aosp_product.mk @@ -38,8 +38,3 @@ PRODUCT_PACKAGES += \ # Provide a APN configuration to GSI product PRODUCT_COPY_FILES += \ device/sample/etc/apns-full-conf.xml:$(TARGET_COPY_OUT_PRODUCT)/etc/apns-conf.xml - -# NFC: -# Provide a libnfc-nci.conf to GSI product -PRODUCT_COPY_FILES += \ - device/generic/common/nfc/libnfc-nci.conf:$(TARGET_COPY_OUT_PRODUCT)/etc/libnfc-nci.conf diff --git a/target/product/aosp_x86_64_ab.mk b/target/product/aosp_x86_64_ab.mk index 9d23fc7b08..578a2548fc 100644 --- a/target/product/aosp_x86_64_ab.mk +++ b/target/product/aosp_x86_64_ab.mk @@ -14,7 +14,7 @@ # limitations under the License. # -# PRODUCT_PROPERTY_OVERRIDES cannot be used here because sysprops will be at +# PRODUCT_VENDOR_PROPERTIES 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. diff --git a/target/product/aosp_x86_ab.mk b/target/product/aosp_x86_ab.mk index 6b6a4c61ad..40c1d83250 100644 --- a/target/product/aosp_x86_ab.mk +++ b/target/product/aosp_x86_ab.mk @@ -14,7 +14,7 @@ # limitations under the License. # -# PRODUCT_PROPERTY_OVERRIDES cannot be used here because sysprops will be at +# PRODUCT_VENDOR_PROPERTIES 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. diff --git a/target/product/base_system.mk b/target/product/base_system.mk index 4569bceff9..3187274f5f 100644 --- a/target/product/base_system.mk +++ b/target/product/base_system.mk @@ -51,6 +51,7 @@ PRODUCT_PACKAGES += \ cmd \ com.android.adbd \ com.android.conscrypt \ + com.android.cronet \ com.android.extservices \ com.android.i18n \ com.android.ipsec \ @@ -68,7 +69,6 @@ PRODUCT_PACKAGES += \ com.android.wifi \ ContactsProvider \ content \ - crash_dump \ CtsShimPrebuilt \ CtsShimPrivPrebuilt \ debuggerd\ @@ -212,7 +212,7 @@ PRODUCT_PACKAGES += \ mtpd \ ndc \ netd \ - NetworkStack \ + NetworkStackNext \ org.apache.http.legacy \ otacerts \ PackageInstaller \ @@ -324,6 +324,7 @@ PRODUCT_BOOT_JARS := \ $(ART_APEX_JARS) \ framework-minus-apex \ ext \ + com.android.i18n:core-icu4j \ telephony-common \ voip-common \ ims-common @@ -354,10 +355,10 @@ PRODUCT_BOOT_JARS += android.test.base endif 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_PROPERTIES += ro.zygote=zygote32 -PRODUCT_SYSTEM_DEFAULT_PROPERTIES += debug.atrace.tags.enableflags=0 -PRODUCT_SYSTEM_DEFAULT_PROPERTIES += persist.traced.enable=1 +PRODUCT_SYSTEM_PROPERTIES += debug.atrace.tags.enableflags=0 +PRODUCT_SYSTEM_PROPERTIES += persist.traced.enable=1 # Packages included only for eng or userdebug builds, previously debug tagged PRODUCT_PACKAGES_DEBUG := \ diff --git a/target/product/core_64_bit.mk b/target/product/core_64_bit.mk index f9baa270a5..7fa6ed2b7f 100644 --- a/target/product/core_64_bit.mk +++ b/target/product/core_64_bit.mk @@ -27,7 +27,7 @@ PRODUCT_COPY_FILES += system/core/rootdir/init.zygote64_32.rc:system/etc/init/hw # 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 -PRODUCT_DEFAULT_PROPERTY_OVERRIDES += ro.zygote=zygote64_32 +PRODUCT_SYSTEM_PROPERTIES += ro.zygote=zygote64_32 TARGET_SUPPORTS_32_BIT_APPS := true TARGET_SUPPORTS_64_BIT_APPS := true diff --git a/target/product/core_64_bit_only.mk b/target/product/core_64_bit_only.mk index 8901a50434..63beea9943 100644 --- a/target/product/core_64_bit_only.mk +++ b/target/product/core_64_bit_only.mk @@ -24,7 +24,7 @@ PRODUCT_COPY_FILES += system/core/rootdir/init.zygote64.rc:system/etc/init/hw/in # Set the zygote property to select the 64-bit script. # This line must be parsed before the one in core_minimal.mk -PRODUCT_DEFAULT_PROPERTY_OVERRIDES += ro.zygote=zygote64 +PRODUCT_SYSTEM_PROPERTIES += ro.zygote=zygote64 TARGET_SUPPORTS_32_BIT_APPS := false TARGET_SUPPORTS_64_BIT_APPS := true diff --git a/target/product/emulated_storage.mk b/target/product/emulated_storage.mk index ea5d9ad94d..7d380d9ba7 100644 --- a/target/product/emulated_storage.mk +++ b/target/product/emulated_storage.mk @@ -15,9 +15,9 @@ # PRODUCT_QUOTA_PROJID := 1 -PRODUCT_PROPERTY_OVERRIDES += external_storage.projid.enabled=1 +PRODUCT_VENDOR_PROPERTIES += external_storage.projid.enabled=1 PRODUCT_FS_CASEFOLD := 1 -PRODUCT_PROPERTY_OVERRIDES += external_storage.casefold.enabled=1 +PRODUCT_VENDOR_PROPERTIES += external_storage.casefold.enabled=1 -PRODUCT_PROPERTY_OVERRIDES += external_storage.sdcardfs.enabled=0 +PRODUCT_VENDOR_PROPERTIES += external_storage.sdcardfs.enabled=0 diff --git a/target/product/emulator.mk b/target/product/emulator.mk index 93c861f84c..36da1f7034 100644 --- a/target/product/emulator.mk +++ b/target/product/emulator.mk @@ -47,7 +47,7 @@ $(call inherit-product-if-exists, device/generic/goldfish/vendor.mk) #responding, disble it for now. #still keep it on internal master as it is still working #once it is fixed in aosp, remove this block of comment. -#PRODUCT_DEFAULT_PROPERTY_OVERRIDES += \ +#PRODUCT_VENDOR_PROPERTIES += \ #config.disable_location=true # enable Google-specific location features, diff --git a/target/product/emulator_vendor.mk b/target/product/emulator_vendor.mk index a935d58b15..89c3f3ab69 100644 --- a/target/product/emulator_vendor.mk +++ b/target/product/emulator_vendor.mk @@ -39,7 +39,7 @@ $(call inherit-product-if-exists, device/generic/goldfish/vendor.mk) #responding, disble it for now. #still keep it on internal master as it is still working #once it is fixed in aosp, remove this block of comment. -#PRODUCT_DEFAULT_PROPERTY_OVERRIDES += \ +#PRODUCT_VENDOR_PROPERTIES += \ #config.disable_location=true # enable Google-specific location features, diff --git a/target/product/full.mk b/target/product/full.mk index b356f9d424..adb54ab662 100644 --- a/target/product/full.mk +++ b/target/product/full.mk @@ -19,6 +19,7 @@ # build quite specifically for the emulator, and might not be # entirely appropriate to inherit from for on-device configurations. +$(call inherit-product-if-exists, device/generic/goldfish/arm32-vendor.mk) $(call inherit-product, $(SRC_TARGET_DIR)/product/emulator.mk) $(call inherit-product, $(SRC_TARGET_DIR)/product/aosp_base_telephony.mk) $(call inherit-product, $(SRC_TARGET_DIR)/board/generic/device.mk) diff --git a/target/product/full_base.mk b/target/product/full_base.mk index ffd3cde11a..d31e574a72 100644 --- a/target/product/full_base.mk +++ b/target/product/full_base.mk @@ -43,7 +43,7 @@ PRODUCT_PACKAGES += \ netutils-wrapper-1.0 # Additional settings used in all AOSP builds -PRODUCT_PROPERTY_OVERRIDES := \ +PRODUCT_VENDOR_PROPERTIES := \ ro.config.ringtone=Ring_Synth_04.ogg \ ro.config.notification_sound=pixiedust.ogg diff --git a/target/product/full_base_telephony.mk b/target/product/full_base_telephony.mk index af4097d87a..5e18c058c7 100644 --- a/target/product/full_base_telephony.mk +++ b/target/product/full_base_telephony.mk @@ -19,7 +19,7 @@ # build quite specifically for the emulator, and might not be # entirely appropriate to inherit from for on-device configurations. -PRODUCT_PROPERTY_OVERRIDES := \ +PRODUCT_VENDOR_PROPERTIES := \ keyguard.no_require_sim=true \ ro.com.android.dataroaming=true diff --git a/target/product/full_x86.mk b/target/product/full_x86.mk index 55c450a80f..2f40c03d16 100644 --- a/target/product/full_x86.mk +++ b/target/product/full_x86.mk @@ -28,7 +28,7 @@ $(call inherit-product, $(SRC_TARGET_DIR)/product/aosp_base_telephony.mk) $(call inherit-product, $(SRC_TARGET_DIR)/board/generic_x86/device.mk) ifdef NET_ETH0_STARTONBOOT - PRODUCT_PROPERTY_OVERRIDES += net.eth0.startonboot=1 + PRODUCT_VENDOR_PROPERTIES += net.eth0.startonboot=1 endif # Ensure we package the BIOS files too. diff --git a/target/product/go_defaults_common.mk b/target/product/go_defaults_common.mk index ca171dff5c..7f19615edf 100644 --- a/target/product/go_defaults_common.mk +++ b/target/product/go_defaults_common.mk @@ -18,7 +18,7 @@ # Set lowram options and enable traced by default -PRODUCT_PROPERTY_OVERRIDES += \ +PRODUCT_VENDOR_PROPERTIES += \ ro.config.low_ram=true \ # Speed profile services and wifi-service to reduce RAM and storage. diff --git a/target/product/gsi_release.mk b/target/product/gsi_release.mk index d786177fb1..e1adaeb0f5 100644 --- a/target/product/gsi_release.mk +++ b/target/product/gsi_release.mk @@ -49,5 +49,5 @@ PRODUCT_PACKAGES += \ gsi_skip_mount.cfg \ init.gsi.rc -# Support addtional P and Q VNDK packages -PRODUCT_EXTRA_VNDK_VERSIONS := 28 29 +# Support additional P, Q and R VNDK packages +PRODUCT_EXTRA_VNDK_VERSIONS := 28 29 30 diff --git a/target/product/handheld_system.mk b/target/product/handheld_system.mk index 77c103d7ee..f5ae91c580 100644 --- a/target/product/handheld_system.mk +++ b/target/product/handheld_system.mk @@ -43,7 +43,6 @@ PRODUCT_PACKAGES += \ CaptivePortalLogin \ CertInstaller \ clatd \ - clatd.conf \ DocumentsUI \ DownloadProviderUi \ EasterEgg \ @@ -83,7 +82,7 @@ PRODUCT_SYSTEM_SERVER_APPS += \ PRODUCT_COPY_FILES += \ frameworks/av/media/libeffects/data/audio_effects.conf:system/etc/audio_effects.conf -PRODUCT_PROPERTY_OVERRIDES += \ +PRODUCT_VENDOR_PROPERTIES += \ ro.carrier=unknown \ ro.config.notification_sound=OnTheHunt.ogg \ ro.config.alarm_alert=Alarm_Classic.ogg diff --git a/target/product/mainline.mk b/target/product/mainline.mk deleted file mode 100644 index 22436e66b3..0000000000 --- a/target/product/mainline.mk +++ /dev/null @@ -1,39 +0,0 @@ -# -# Copyright (C) 2019 The Android Open Source Project -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -# This makefile is intended to serve as a base for completely AOSP based -# mainline devices, It contain the mainline system partition and sensible -# defaults for the 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) - -$(call inherit-product, frameworks/base/data/sounds/AllAudio.mk) - -PRODUCT_PROPERTY_OVERRIDES += \ - ro.config.ringtone=Ring_Synth_04.ogg \ - ro.com.android.dataroaming=true \ - -PRODUCT_PACKAGES += \ - PhotoTable \ - WallpaperPicker \ - -PRODUCT_COPY_FILES += device/sample/etc/apns-full-conf.xml:$(TARGET_COPY_OUT_PRODUCT)/etc/apns-conf.xml diff --git a/target/product/mainline_arm64.mk b/target/product/mainline_arm64.mk deleted file mode 100644 index 52b3222958..0000000000 --- a/target/product/mainline_arm64.mk +++ /dev/null @@ -1,36 +0,0 @@ -# -# Copyright (C) 2018 The Android Open Source Project -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -$(call inherit-product, $(SRC_TARGET_DIR)/product/core_64_bit.mk) -$(call inherit-product, $(SRC_TARGET_DIR)/product/mainline.mk) -whitelist := product_manifest.xml -$(call enforce-product-packages-exist,$(whitelist)) - -PRODUCT_ENFORCE_ARTIFACT_PATH_REQUIREMENTS := relaxed - -# Modules that should probably be moved to /product -PRODUCT_ARTIFACT_PATH_REQUIREMENT_WHITELIST += \ - system/bin/healthd \ - system/etc/init/healthd.rc \ - system/etc/vintf/manifest/manifest_healthd.xml \ - -PRODUCT_SHIPPING_API_LEVEL := 29 - -PRODUCT_RESTRICT_VENDOR_FILES := all - -PRODUCT_NAME := mainline_arm64 -PRODUCT_DEVICE := mainline_arm64 -PRODUCT_BRAND := generic diff --git a/target/product/mainline_system.mk b/target/product/mainline_system.mk index a787707a04..bc1d5b1ec9 100644 --- a/target/product/mainline_system.mk +++ b/target/product/mainline_system.mk @@ -99,10 +99,11 @@ PRODUCT_PACKAGES += \ PRODUCT_PACKAGES_DEBUG += \ avbctl \ bootctl \ - tinyplay \ tinycap \ + tinyhostless \ tinymix \ tinypcminfo \ + tinyplay \ update_engine_client \ PRODUCT_HOST_PACKAGES += \ @@ -112,7 +113,6 @@ PRODUCT_HOST_PACKAGES += \ PRODUCT_COPY_FILES += \ system/core/rootdir/init.zygote32.rc:system/etc/init/hw/init.zygote32.rc \ system/core/rootdir/init.zygote64.rc:system/etc/init/hw/init.zygote64.rc \ - system/core/rootdir/init.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 diff --git a/target/product/media_system.mk b/target/product/media_system.mk index 26fb7f34ba..d06d353334 100644 --- a/target/product/media_system.mk +++ b/target/product/media_system.mk @@ -74,11 +74,11 @@ PRODUCT_COPY_FILES += $(call add-to-product-copy-files-if-exists,\ # On userdebug builds, collect more tombstones by default. ifneq (,$(filter userdebug eng,$(TARGET_BUILD_VARIANT))) -PRODUCT_SYSTEM_DEFAULT_PROPERTIES += \ +PRODUCT_VENDOR_PROPERTIES += \ tombstoned.max_tombstone_count=50 endif -PRODUCT_DEFAULT_PROPERTY_OVERRIDES += \ +PRODUCT_VENDOR_PROPERTIES += \ ro.logd.size.stats=64K \ log.tag.stats_log=I diff --git a/target/product/profile_boot_common.mk b/target/product/profile_boot_common.mk index a40b3e9449..fa2e163e1e 100644 --- a/target/product/profile_boot_common.mk +++ b/target/product/profile_boot_common.mk @@ -23,7 +23,7 @@ PRODUCT_DEX_PREOPT_BOOT_IMAGE_PROFILE_LOCATION := build/make/target/product/empt DEX_PREOPT_DEFAULT := nostripping # Boot image property overrides. -PRODUCT_PROPERTY_OVERRIDES += \ +PRODUCT_VENDOR_PROPERTIES += \ dalvik.vm.profilesystemserver=true \ dalvik.vm.profilebootclasspath=true diff --git a/target/product/runtime_libart.mk b/target/product/runtime_libart.mk index ad361dc09e..2aadded242 100644 --- a/target/product/runtime_libart.mk +++ b/target/product/runtime_libart.mk @@ -40,7 +40,7 @@ PRODUCT_PACKAGES += \ PRODUCT_PACKAGES += \ hiddenapi-package-whitelist.xml \ -PRODUCT_SYSTEM_DEFAULT_PROPERTIES += \ +PRODUCT_SYSTEM_PROPERTIES += \ dalvik.vm.image-dex2oat-Xms=64m \ dalvik.vm.image-dex2oat-Xmx=64m \ dalvik.vm.dex2oat-Xms=64m \ @@ -50,17 +50,17 @@ PRODUCT_SYSTEM_DEFAULT_PROPERTIES += \ dalvik.vm.dexopt.secondary=true \ dalvik.vm.appimageformat=lz4 -PRODUCT_SYSTEM_DEFAULT_PROPERTIES += \ +PRODUCT_SYSTEM_PROPERTIES += \ ro.dalvik.vm.native.bridge=0 # Different dexopt types for different package update/install times. # On eng builds, make "boot" reasons only extract for faster turnaround. ifeq (eng,$(TARGET_BUILD_VARIANT)) - PRODUCT_SYSTEM_DEFAULT_PROPERTIES += \ + PRODUCT_SYSTEM_PROPERTIES += \ pm.dexopt.first-boot=extract \ pm.dexopt.boot=extract else - PRODUCT_SYSTEM_DEFAULT_PROPERTIES += \ + PRODUCT_SYSTEM_PROPERTIES += \ pm.dexopt.first-boot=quicken \ pm.dexopt.boot=verify endif @@ -68,7 +68,7 @@ endif # The install filter is speed-profile in order to enable the use of # profiles from the dex metadata files. Note that if a profile is not provided # or if it is empty speed-profile is equivalent to (quicken + empty app image). -PRODUCT_SYSTEM_DEFAULT_PROPERTIES += \ +PRODUCT_SYSTEM_PROPERTIES += \ pm.dexopt.install=speed-profile \ pm.dexopt.bg-dexopt=speed-profile \ pm.dexopt.ab-ota=speed-profile \ @@ -76,24 +76,24 @@ PRODUCT_SYSTEM_DEFAULT_PROPERTIES += \ pm.dexopt.shared=speed # Pass file with the list of updatable boot class path packages to dex2oat. -PRODUCT_SYSTEM_DEFAULT_PROPERTIES += \ +PRODUCT_SYSTEM_PROPERTIES += \ dalvik.vm.dex2oat-updatable-bcp-packages-file=/system/etc/updatable-bcp-packages.txt # Enable resolution of startup const strings. -PRODUCT_SYSTEM_DEFAULT_PROPERTIES += \ +PRODUCT_SYSTEM_PROPERTIES += \ dalvik.vm.dex2oat-resolve-startup-strings=true # Specify default block size of 512K to enable parallel image decompression. -PRODUCT_SYSTEM_DEFAULT_PROPERTIES += \ +PRODUCT_SYSTEM_PROPERTIES += \ dalvik.vm.dex2oat-max-image-block-size=524288 # Enable minidebuginfo generation unless overridden. -PRODUCT_SYSTEM_DEFAULT_PROPERTIES += \ +PRODUCT_SYSTEM_PROPERTIES += \ dalvik.vm.minidebuginfo=true \ dalvik.vm.dex2oat-minidebuginfo=true # Enable iorapd by default -PRODUCT_SYSTEM_DEFAULT_PROPERTIES += \ +PRODUCT_SYSTEM_PROPERTIES += \ ro.iorapd.enable=true PRODUCT_USES_DEFAULT_ART_CONFIG := true diff --git a/target/product/sdk_phone_arm64.mk b/target/product/sdk_phone_arm64.mk index 3ab0c57fe4..cefa288a90 100644 --- a/target/product/sdk_phone_arm64.mk +++ b/target/product/sdk_phone_arm64.mk @@ -14,7 +14,6 @@ # limitations under the License. # QEMU_USE_SYSTEM_EXT_PARTITIONS := true - PRODUCT_USE_DYNAMIC_PARTITIONS := true # This is a build configuration for a full-featured build of the @@ -22,6 +21,11 @@ PRODUCT_USE_DYNAMIC_PARTITIONS := true # build quite specifically for the emulator, and might not be # entirely appropriate to inherit from for on-device configurations. +# Enable mainline checking for exact this product name +ifeq (sdk_phone_arm64,$(TARGET_PRODUCT)) +PRODUCT_ENFORCE_ARTIFACT_PATH_REQUIREMENTS := relaxed +endif + # # All components inherited here go to system image # diff --git a/target/product/sdk_phone_armv7.mk b/target/product/sdk_phone_armv7.mk index 77b8b50644..c4c5a38757 100644 --- a/target/product/sdk_phone_armv7.mk +++ b/target/product/sdk_phone_armv7.mk @@ -14,8 +14,40 @@ # limitations under the License. # QEMU_USE_SYSTEM_EXT_PARTITIONS := true +PRODUCT_USE_DYNAMIC_PARTITIONS := true -$(call inherit-product, $(SRC_TARGET_DIR)/product/aosp_arm.mk) +# This is a build configuration for a full-featured build of the +# Open-Source part of the tree. It's geared toward a US-centric +# build quite specifically for the emulator, and might not be +# entirely appropriate to inherit from for on-device configurations. + +# Enable mainline checking for exact this product name +ifeq (sdk_phone_armv7,$(TARGET_PRODUCT)) +PRODUCT_ENFORCE_ARTIFACT_PATH_REQUIREMENTS := relaxed +endif + +# +# All components inherited here go to system image +# +$(call inherit-product, $(SRC_TARGET_DIR)/product/mainline_system.mk) + +# +# All components inherited here go to system_ext image +# +$(call inherit-product, $(SRC_TARGET_DIR)/product/handheld_system_ext.mk) +$(call inherit-product, $(SRC_TARGET_DIR)/product/telephony_system_ext.mk) + +# +# All components inherited here go to product image +# +$(call inherit-product, $(SRC_TARGET_DIR)/product/aosp_product.mk) + +# +# All components inherited here go to vendor image +# +$(call inherit-product-if-exists, device/generic/goldfish/arm32-vendor.mk) +$(call inherit-product, $(SRC_TARGET_DIR)/product/emulator_vendor.mk) +$(call inherit-product, $(SRC_TARGET_DIR)/board/emulator_arm/device.mk) # Define the host tools and libs that are parts of the SDK. $(call inherit-product, sdk/build/product_sdk.mk) @@ -29,4 +61,5 @@ PRODUCT_PACKAGES += \ # Overrides PRODUCT_BRAND := Android PRODUCT_NAME := sdk_phone_armv7 -PRODUCT_DEVICE := generic +PRODUCT_DEVICE := emulator_arm +PRODUCT_MODEL := Android SDK built for arm diff --git a/target/product/sdk_phone_x86.mk b/target/product/sdk_phone_x86.mk index 9df26a9c0a..bcee0663ec 100644 --- a/target/product/sdk_phone_x86.mk +++ b/target/product/sdk_phone_x86.mk @@ -16,12 +16,17 @@ QEMU_USE_SYSTEM_EXT_PARTITIONS := true PRODUCT_USE_DYNAMIC_PARTITIONS := true +# This is a build configuration for a full-featured build of the +# Open-Source part of the tree. It's geared toward a US-centric +# build quite specifically for the emulator, and might not be +# entirely appropriate to inherit from for on-device configurations. + # # All components inherited here go to system image # $(call inherit-product, $(SRC_TARGET_DIR)/product/mainline_system.mk) -# Enable mainline checking for excat this product name +# Enable mainline checking for exact this product name ifeq (sdk_phone_x86,$(TARGET_PRODUCT)) PRODUCT_ENFORCE_ARTIFACT_PATH_REQUIREMENTS := relaxed endif @@ -42,9 +47,7 @@ $(call inherit-product, $(SRC_TARGET_DIR)/product/aosp_product.mk) # $(call inherit-product-if-exists, device/generic/goldfish/x86-vendor.mk) $(call inherit-product, $(SRC_TARGET_DIR)/product/emulator_vendor.mk) -$(call inherit-product, $(SRC_TARGET_DIR)/board/generic_x86/device.mk) - -$(call inherit-product, $(SRC_TARGET_DIR)/product/aosp_x86.mk) +$(call inherit-product, $(SRC_TARGET_DIR)/board/emulator_x86/device.mk) # Define the host tools and libs that are parts of the SDK. -include sdk/build/product_sdk.mk @@ -53,5 +56,5 @@ $(call inherit-product, $(SRC_TARGET_DIR)/product/aosp_x86.mk) # Overrides PRODUCT_BRAND := Android PRODUCT_NAME := sdk_phone_x86 -PRODUCT_DEVICE := generic_x86 +PRODUCT_DEVICE := emulator_x86 PRODUCT_MODEL := Android SDK built for x86 diff --git a/target/product/sdk_phone_x86_64.mk b/target/product/sdk_phone_x86_64.mk index 862c66e599..82bbee5157 100644 --- a/target/product/sdk_phone_x86_64.mk +++ b/target/product/sdk_phone_x86_64.mk @@ -16,13 +16,18 @@ QEMU_USE_SYSTEM_EXT_PARTITIONS := true PRODUCT_USE_DYNAMIC_PARTITIONS := true +# This is a build configuration for a full-featured build of the +# Open-Source part of the tree. It's geared toward a US-centric +# build quite specifically for the emulator, and might not be +# entirely appropriate to inherit from for on-device configurations. + # # All components inherited here go to system image # $(call inherit-product, $(SRC_TARGET_DIR)/product/core_64_bit.mk) $(call inherit-product, $(SRC_TARGET_DIR)/product/mainline_system.mk) -# Enable mainline checking for excat this product name +# Enable mainline checking for exact this product name ifeq (sdk_phone_x86_64,$(TARGET_PRODUCT)) PRODUCT_ENFORCE_ARTIFACT_PATH_REQUIREMENTS := relaxed endif @@ -43,7 +48,7 @@ $(call inherit-product, $(SRC_TARGET_DIR)/product/aosp_product.mk) # $(call inherit-product-if-exists, device/generic/goldfish/x86_64-vendor.mk) $(call inherit-product, $(SRC_TARGET_DIR)/product/emulator_vendor.mk) -$(call inherit-product, $(SRC_TARGET_DIR)/board/generic_x86_64/device.mk) +$(call inherit-product, $(SRC_TARGET_DIR)/board/emulator_x86_64/device.mk) # Define the host tools and libs that are parts of the SDK. -include sdk/build/product_sdk.mk @@ -52,5 +57,5 @@ $(call inherit-product, $(SRC_TARGET_DIR)/board/generic_x86_64/device.mk) # Overrides PRODUCT_BRAND := Android PRODUCT_NAME := sdk_phone_x86_64 -PRODUCT_DEVICE := generic_x86_64 +PRODUCT_DEVICE := emulator_x86_64 PRODUCT_MODEL := Android SDK built for x86_64 diff --git a/target/product/updatable_apex.mk b/target/product/updatable_apex.mk index a84a0d2ba3..c8dc8b0027 100644 --- a/target/product/updatable_apex.mk +++ b/target/product/updatable_apex.mk @@ -20,6 +20,6 @@ ifneq ($(OVERRIDE_TARGET_FLATTEN_APEX),true) #Â com.android.apex.cts.shim.v1_prebuilt overrides CtsShimPrebuilt # and CtsShimPrivPrebuilt since they are packaged inside the APEX. PRODUCT_PACKAGES += com.android.apex.cts.shim.v1_prebuilt - PRODUCT_PROPERTY_OVERRIDES := ro.apex.updatable=true + PRODUCT_VENDOR_PROPERTIES := ro.apex.updatable=true TARGET_FLATTEN_APEX := false endif diff --git a/target/product/userspace_reboot.mk b/target/product/userspace_reboot.mk index 3f881af7e6..f235d146e3 100644 --- a/target/product/userspace_reboot.mk +++ b/target/product/userspace_reboot.mk @@ -16,4 +16,4 @@ # Inherit this when the target supports userspace reboot -PRODUCT_PROPERTY_OVERRIDES := init.userspace_reboot.is_supported=true +PRODUCT_VENDOR_PROPERTIES := init.userspace_reboot.is_supported=true diff --git a/target/product/virtual_ab_ota.mk b/target/product/virtual_ab_ota.mk index 1774de42e4..e4c45758ba 100644 --- a/target/product/virtual_ab_ota.mk +++ b/target/product/virtual_ab_ota.mk @@ -16,6 +16,6 @@ PRODUCT_VIRTUAL_AB_OTA := true -PRODUCT_PROPERTY_OVERRIDES += ro.virtual_ab.enabled=true +PRODUCT_VENDOR_PROPERTIES += ro.virtual_ab.enabled=true PRODUCT_PACKAGES += e2fsck_ramdisk diff --git a/target/product/virtual_ab_ota_plus_non_ab.mk b/target/product/virtual_ab_ota_plus_non_ab.mk index 325d75e3e7..99a10ed9c3 100644 --- a/target/product/virtual_ab_ota_plus_non_ab.mk +++ b/target/product/virtual_ab_ota_plus_non_ab.mk @@ -18,4 +18,4 @@ $(call inherit-product, $(SRC_TARGET_DIR)/product/virtual_ab_ota.mk) PRODUCT_OTA_FORCE_NON_AB_PACKAGE := true -PRODUCT_PROPERTY_OVERRIDES += ro.virtual_ab.allow_non_ab=true +PRODUCT_VENDOR_PROPERTIES += ro.virtual_ab.allow_non_ab=true diff --git a/target/product/virtual_ab_ota_retrofit.mk b/target/product/virtual_ab_ota_retrofit.mk index 3e857412e7..3416a4fd81 100644 --- a/target/product/virtual_ab_ota_retrofit.mk +++ b/target/product/virtual_ab_ota_retrofit.mk @@ -18,4 +18,4 @@ $(call inherit-product, $(SRC_TARGET_DIR)/product/virtual_ab_ota.mk) PRODUCT_VIRTUAL_AB_OTA_RETROFIT := true -PRODUCT_PROPERTY_OVERRIDES += ro.virtual_ab.retrofit=true +PRODUCT_VENDOR_PROPERTIES += ro.virtual_ab.retrofit=true diff --git a/tools/Android.bp b/tools/Android.bp index 8c7eb38373..159890ce49 100644 --- a/tools/Android.bp +++ b/tools/Android.bp @@ -24,3 +24,16 @@ python_binary_host { }, }, } + +python_binary_host { + name: "post_process_props", + srcs: ["post_process_props.py"], + version: { + py2: { + enabled: false, + }, + py3: { + enabled: true, + }, + }, +} diff --git a/tools/buildinfo_common.sh b/tools/buildinfo_common.sh deleted file mode 100755 index 673e06f3da..0000000000 --- a/tools/buildinfo_common.sh +++ /dev/null @@ -1,30 +0,0 @@ -#!/bin/bash - -partition="$1" - -if [ "$#" -ne 1 ]; then - echo "Usage: $0 <partition>" 1>&2 - exit 1 -fi - -echo "# begin common build properties" -echo "# autogenerated by $0" - -echo "ro.${partition}.build.date=`$DATE`" -echo "ro.${partition}.build.date.utc=`$DATE +%s`" -echo "ro.${partition}.build.fingerprint=$BUILD_FINGERPRINT" -echo "ro.${partition}.build.id=$BUILD_ID" -echo "ro.${partition}.build.tags=$BUILD_VERSION_TAGS" -echo "ro.${partition}.build.type=$TARGET_BUILD_TYPE" -echo "ro.${partition}.build.version.incremental=$BUILD_NUMBER" -echo "ro.${partition}.build.version.release=$PLATFORM_VERSION_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" -echo "ro.product.${partition}.device=$PRODUCT_DEVICE" -echo "ro.product.${partition}.manufacturer=$PRODUCT_MANUFACTURER" -echo "ro.product.${partition}.model=$PRODUCT_MODEL" -echo "ro.product.${partition}.name=$PRODUCT_NAME" - -echo "# end common build properties" diff --git a/tools/fs_config/fs_config.c b/tools/fs_config/fs_config.c index 2952875f64..2a75add096 100644 --- a/tools/fs_config/fs_config.c +++ b/tools/fs_config/fs_config.c @@ -26,6 +26,7 @@ #include <selinux/label.h> #include "private/android_filesystem_config.h" +#include "private/fs_config.h" // This program takes a list of files and directories (indicated by a // trailing slash) on the stdin, and prints to stdout each input diff --git a/tools/fs_get_stats/fs_get_stats.c b/tools/fs_get_stats/fs_get_stats.c index 159e2aa912..64ef0e2312 100644 --- a/tools/fs_get_stats/fs_get_stats.c +++ b/tools/fs_get_stats/fs_get_stats.c @@ -4,6 +4,7 @@ #include <unistd.h> #include <private/android_filesystem_config.h> +#include <private/fs_config.h> #define DO_DEBUG 1 diff --git a/tools/post_process_props.py b/tools/post_process_props.py index 9ddd5d7677..4fa15bcd61 100755 --- a/tools/post_process_props.py +++ b/tools/post_process_props.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # Copyright (C) 2009 The Android Open Source Project # @@ -24,121 +24,117 @@ import sys # so we decrease the value by 1 here. PROP_VALUE_MAX = 91 -# Put the modifications that you need to make into the /system/build.prop into this -# function. The prop object has get(name) and put(name,value) methods. -def mangle_build_prop(prop): - pass - -# Put the modifications that you need to make into /vendor/default.prop and -# /odm/default.prop into this function. The prop object has get(name) and -# put(name,value) methods. -def mangle_default_prop_override(prop): - pass - -# Put the modifications that you need to make into the /system/etc/prop.default into this -# function. The prop object has get(name) and put(name,value) methods. -def mangle_default_prop(prop): +# Put the modifications that you need to make into the */build.prop into this +# function. +def mangle_build_prop(prop_list): # If ro.debuggable is 1, then enable adb on USB by default # (this is for userdebug builds) - if prop.get("ro.debuggable") == "1": - val = prop.get("persist.sys.usb.config") + if prop_list.get("ro.debuggable") == "1": + val = prop_list.get("persist.sys.usb.config") if "adb" not in val: if val == "": val = "adb" else: val = val + ",adb" - prop.put("persist.sys.usb.config", val) + prop_list.put("persist.sys.usb.config", val) # UsbDeviceManager expects a value here. If it doesn't get it, it will # default to "adb". That might not the right policy there, but it's better # to be explicit. - if not prop.get("persist.sys.usb.config"): - prop.put("persist.sys.usb.config", "none"); + if not prop_list.get("persist.sys.usb.config"): + prop_list.put("persist.sys.usb.config", "none"); -def validate(prop): +def validate(prop_list): """Validate the properties. Returns: True if nothing is wrong. """ check_pass = True - buildprops = prop.to_dict() - for key, value in buildprops.iteritems(): - # Check build properties' length. - if len(value) > PROP_VALUE_MAX and not key.startswith("ro."): + for p in prop_list.get_all(): + if len(p.value) > PROP_VALUE_MAX and not p.name.startswith("ro."): check_pass = False sys.stderr.write("error: %s cannot exceed %d bytes: " % - (key, PROP_VALUE_MAX)) - sys.stderr.write("%s (%d)\n" % (value, len(value))) + (p.name, PROP_VALUE_MAX)) + sys.stderr.write("%s (%d)\n" % (p.value, len(p.value))) return check_pass -class PropFile: - - def __init__(self, lines): - self.lines = [s.strip() for s in lines] - - def to_dict(self): - props = {} - for line in self.lines: - if not line or line.startswith("#"): - continue - if "=" in line: - key, value = line.split("=", 1) - props[key] = value - return props +class Prop: + + def __init__(self, name, value, comment=None): + self.name = name.strip() + self.value = value.strip() + self.comment = comment + + @staticmethod + def from_line(line): + line = line.rstrip('\n') + if line.startswith("#"): + return Prop("", "", line) + elif "=" in line: + name, value = line.split("=", 1) + return Prop(name, value) + else: + # don't fail on invalid line + # TODO(jiyong) make this a hard error + return Prop("", "", line) + + def is_comment(self): + return self.comment != None + + def __str__(self): + if self.is_comment(): + return self.comment + else: + return self.name + "=" + self.value + +class PropList: + + def __init__(self, filename): + with open(filename) as f: + self.props = [Prop.from_line(l) + for l in f.readlines() if l.strip() != ""] + + def get_all(self): + return [p for p in self.props if not p.is_comment()] def get(self, name): - key = name + "=" - for line in self.lines: - if line.startswith(key): - return line[len(key):] - return "" + return next((p.value for p in self.props if p.name == name), "") def put(self, name, value): - key = name + "=" - for i in range(0,len(self.lines)): - if self.lines[i].startswith(key): - self.lines[i] = key + value - return - self.lines.append(key + value) + index = next((i for i,p in enumerate(self.props) if p.name == name), -1) + if index == -1: + self.props.append(Prop(name, value)) + else: + self.props[index].value = value def delete(self, name): - key = name + "=" - self.lines = [ line for line in self.lines if not line.startswith(key) ] + index = next((i for i,p in enumerate(self.props) if p.name == name), -1) + if index != -1: + new_comment = "# removed by post_process_props.py\n#" + str(self.props[index]) + self.props[index] = Prop.from_line(new_comment) - def write(self, f): - f.write("\n".join(self.lines)) - f.write("\n") + def write(self, filename): + with open(filename, 'w+') as f: + for p in self.props: + f.write(str(p) + "\n") def main(argv): filename = argv[1] - f = open(filename) - lines = f.readlines() - f.close() - - properties = PropFile(lines) - - if filename.endswith("/build.prop"): - mangle_build_prop(properties) - elif (filename.endswith("/vendor/default.prop") or - filename.endswith("/odm/default.prop")): - mangle_default_prop_override(properties) - elif (filename.endswith("/default.prop") or # legacy - filename.endswith("/prop.default")): - mangle_default_prop(properties) - else: + + if not filename.endswith("/build.prop"): sys.stderr.write("bad command line: " + str(argv) + "\n") sys.exit(1) - if not validate(properties): + props = PropList(filename) + mangle_build_prop(props) + if not validate(props): sys.exit(1) # Drop any blacklisted keys for key in argv[2:]: - properties.delete(key) + props.delete(key) - f = open(filename, 'w+') - properties.write(f) - f.close() + props.write(filename) if __name__ == "__main__": main(sys.argv) diff --git a/tools/releasetools/Android.bp b/tools/releasetools/Android.bp index 5785688473..11f92abb17 100644 --- a/tools/releasetools/Android.bp +++ b/tools/releasetools/Android.bp @@ -73,9 +73,6 @@ python_defaults { "releasetools_build_super_image", "releasetools_common", ], - required: [ - "zip2zip", - ], } python_defaults { @@ -239,6 +236,16 @@ python_defaults { embedded_launcher: false, }, }, + // TODO (b/140144201) Build imgdiff from releasetools_common + required: [ + "aapt2", + "boot_signer", + "brotli", + "bsdiff", + "imgdiff", + "minigzip", + "mkbootfs", + ], } python_binary_host { @@ -459,9 +466,6 @@ python_defaults { data: [ "testdata/**/*", ], - required: [ - "otatools", - ], } python_test_host { diff --git a/tools/releasetools/OWNERS b/tools/releasetools/OWNERS index a8295d45b0..d7fc540807 100644 --- a/tools/releasetools/OWNERS +++ b/tools/releasetools/OWNERS @@ -1,3 +1,4 @@ +elsk@google.com nhdo@google.com xunchang@google.com zhaojiac@google.com diff --git a/tools/releasetools/build_image.py b/tools/releasetools/build_image.py index 8cf074147e..7567346493 100755 --- a/tools/releasetools/build_image.py +++ b/tools/releasetools/build_image.py @@ -57,7 +57,7 @@ def GetDiskUsage(path): Returns: The number of bytes based on a 1K block_size. """ - cmd = ["du", "-k", "-s", path] + cmd = ["du", "-b", "-k", "-s", path] output = common.RunAndCheckOutput(cmd, verbose=False) return int(output.split()[0]) * 1024 diff --git a/tools/releasetools/common.py b/tools/releasetools/common.py index ae7da2fb64..74c3125b97 100644 --- a/tools/releasetools/common.py +++ b/tools/releasetools/common.py @@ -77,6 +77,7 @@ class Options(object): self.boot_signer_args = [] self.verity_signer_path = None self.verity_signer_args = [] + self.aftl_tool_path = None self.aftl_server = None self.aftl_key_path = None self.aftl_manufacturer_key_path = None @@ -1082,6 +1083,46 @@ def GetAvbChainedPartitionArg(partition, info_dict, key=None): return "{}:{}:{}".format(partition, rollback_index_location, pubkey_path) +def ConstructAftlMakeImageCommands(output_image): + """Constructs the command to append the aftl image to vbmeta.""" + + # Ensure the other AFTL parameters are set as well. + assert OPTIONS.aftl_tool_path is not None, 'No aftl tool provided.' + assert OPTIONS.aftl_key_path is not None, 'No AFTL key provided.' + assert OPTIONS.aftl_manufacturer_key_path is not None, \ + 'No AFTL manufacturer key provided.' + + vbmeta_image = MakeTempFile() + os.rename(output_image, vbmeta_image) + build_info = BuildInfo(OPTIONS.info_dict) + version_incremental = build_info.GetBuildProp("ro.build.version.incremental") + aftltool = OPTIONS.aftl_tool_path + server_argument_list = [OPTIONS.aftl_server, OPTIONS.aftl_key_path] + aftl_cmd = [aftltool, "make_icp_from_vbmeta", + "--vbmeta_image_path", vbmeta_image, + "--output", output_image, + "--version_incremental", version_incremental, + "--transparency_log_servers", ','.join(server_argument_list), + "--manufacturer_key", OPTIONS.aftl_manufacturer_key_path, + "--algorithm", "SHA256_RSA4096", + "--padding", "4096"] + if OPTIONS.aftl_signer_helper: + aftl_cmd.extend(shlex.split(OPTIONS.aftl_signer_helper)) + return aftl_cmd + + +def AddAftlInclusionProof(output_image): + """Appends the aftl inclusion proof to the vbmeta image.""" + + aftl_cmd = ConstructAftlMakeImageCommands(output_image) + RunAndCheckOutput(aftl_cmd) + + verify_cmd = ['aftltool', 'verify_image_icp', '--vbmeta_image_path', + output_image, '--transparency_log_pub_keys', + OPTIONS.aftl_key_path] + RunAndCheckOutput(verify_cmd) + + def BuildVBMeta(image_path, partitions, name, needed_partitions): """Creates a VBMeta image. @@ -1129,28 +1170,26 @@ def BuildVBMeta(image_path, partitions, name, needed_partitions): # zip only). For such cases, we additionally scan other locations (e.g. # IMAGES/, RADIO/, etc) before bailing out. if arg == '--include_descriptors_from_image': - image_path = split_args[index + 1] - if os.path.exists(image_path): + chained_image = split_args[index + 1] + if os.path.exists(chained_image): continue found = False for dir_name in ['IMAGES', 'RADIO', 'PREBUILT_IMAGES']: alt_path = os.path.join( - OPTIONS.input_tmp, dir_name, os.path.basename(image_path)) + OPTIONS.input_tmp, dir_name, os.path.basename(chained_image)) if os.path.exists(alt_path): split_args[index + 1] = alt_path found = True break - assert found, 'Failed to find {}'.format(image_path) + assert found, 'Failed to find {}'.format(chained_image) cmd.extend(split_args) RunAndCheckOutput(cmd) + # Generate the AFTL inclusion proof. if OPTIONS.aftl_server is not None: - # 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. + AddAftlInclusionProof(image_path) + def _MakeRamdisk(sourcedir, fs_config_file=None, lz4_ramdisks=False): ramdisk_img = tempfile.NamedTemporaryFile() @@ -2024,9 +2063,9 @@ def ParseOptions(argv, "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=", "logfile=", "aftl_server=", "aftl_key_path=", - "aftl_manufacturer_key_path=", "aftl_signer_helper="] + - list(extra_long_opts)) + "extra=", "logfile=", "aftl_tool_path=", "aftl_server=", + "aftl_key_path=", "aftl_manufacturer_key_path=", + "aftl_signer_helper="] + list(extra_long_opts)) except getopt.GetoptError as err: Usage(docstring) print("**", str(err), "**") @@ -2064,6 +2103,8 @@ def ParseOptions(argv, OPTIONS.verity_signer_path = a elif o in ("--verity_signer_args",): OPTIONS.verity_signer_args = shlex.split(a) + elif o in ("--aftl_tool_path",): + OPTIONS.aftl_tool_path = a elif o in ("--aftl_server",): OPTIONS.aftl_server = a elif o in ("--aftl_key_path",): diff --git a/tools/releasetools/merge_target_files.py b/tools/releasetools/merge_target_files.py index dd7806bde0..d9d3854056 100755 --- a/tools/releasetools/merge_target_files.py +++ b/tools/releasetools/merge_target_files.py @@ -95,6 +95,8 @@ import ota_from_target_files logger = logging.getLogger(__name__) OPTIONS = common.OPTIONS +# Always turn on verbose logging. +OPTIONS.verbose = True OPTIONS.framework_target_files = None OPTIONS.framework_item_list = None OPTIONS.framework_misc_info_keys = None @@ -1109,9 +1111,6 @@ def main(): common.Usage(__doc__) sys.exit(1) - # Always turn on verbose logging. - OPTIONS.verbose = True - if OPTIONS.framework_item_list: framework_item_list = common.LoadListFromFile(OPTIONS.framework_item_list) else: diff --git a/tools/releasetools/sign_target_files_apks.py b/tools/releasetools/sign_target_files_apks.py index 47360c9464..c2bfd32816 100755 --- a/tools/releasetools/sign_target_files_apks.py +++ b/tools/releasetools/sign_target_files_apks.py @@ -383,8 +383,8 @@ def CheckApkAndApexKeysAvailable(input_tf_zip, known_keys, def SignApk(data, keyname, pw, platform_api_level, codename_to_api_level_map, - is_compressed): - unsigned = tempfile.NamedTemporaryFile() + is_compressed, apk_name): + unsigned = tempfile.NamedTemporaryFile(suffix='_' + apk_name) unsigned.write(data) unsigned.flush() @@ -402,7 +402,7 @@ def SignApk(data, keyname, pw, platform_api_level, codename_to_api_level_map, unsigned.close() unsigned = uncompressed - signed = tempfile.NamedTemporaryFile() + signed = tempfile.NamedTemporaryFile(suffix='_' + apk_name) # For pre-N builds, don't upgrade to SHA-256 JAR signatures based on the APK's # minSdkVersion to avoid increasing incremental OTA update sizes. If an APK @@ -488,7 +488,7 @@ def ProcessTargetFiles(input_tf_zip, output_tf_zip, misc_info, if key not in common.SPECIAL_CERT_STRINGS: print(" signing: %-*s (%s)" % (maxsize, name, key)) signed_data = SignApk(data, key, key_passwords[key], platform_api_level, - codename_to_api_level_map, is_compressed) + codename_to_api_level_map, is_compressed, name) common.ZipWriteStr(output_tf_zip, out_info, signed_data) else: # an APK we're not supposed to sign. diff --git a/tools/releasetools/test_check_target_files_vintf.py b/tools/releasetools/test_check_target_files_vintf.py index 79f9018774..d32622932a 100644 --- a/tools/releasetools/test_check_target_files_vintf.py +++ b/tools/releasetools/test_check_target_files_vintf.py @@ -35,20 +35,20 @@ SKELETON_TARGET_FILE_STRUCTURE = { 'SYSTEM_EXT/etc/build.prop': '', # Non-empty files - 'SYSTEM/compatibility_matrix.xml':""" - <compatibility-matrix version="1.0" type="framework"> + 'SYSTEM/etc/vintf/compatibility_matrix.1.xml':""" + <compatibility-matrix version="1.0" level="1" type="framework"> <sepolicy> <sepolicy-version>0.0</sepolicy-version> <kernel-sepolicy-version>0</kernel-sepolicy-version> </sepolicy> </compatibility-matrix>""", 'SYSTEM/manifest.xml': - '<manifest version="1.0" type="framework" />', + '<manifest version="1.0" type="framework"/>', 'VENDOR/build.prop': 'ro.product.first_api_level=29\n', 'VENDOR/compatibility_matrix.xml': '<compatibility-matrix version="1.0" type="device" />', - 'VENDOR/manifest.xml': - '<manifest version="1.0" type="device"/>', + 'VENDOR/etc/vintf/manifest.xml': + '<manifest version="1.0" target-level="1" type="device"/>', 'META/misc_info.txt': 'recovery_api_version=3\nfstab_version=2\nvintf_enforce=true\n', } @@ -140,6 +140,6 @@ class CheckTargetFilesVintfTest(test_utils.ReleaseToolsTestCase): def test_CheckVintf_bad_xml(self): test_dir = self.prepare_test_dir('does-not-exist') write_string_to_file('not an XML', - os.path.join(test_dir, 'VENDOR/manifest.xml')) + os.path.join(test_dir, 'VENDOR/etc/vintf/manifest.xml')) # Should raise an error because a file has invalid format. self.assertRaises(common.ExternalError, CheckVintf, test_dir) diff --git a/tools/releasetools/test_common.py b/tools/releasetools/test_common.py index e4f0812372..787e6757ec 100644 --- a/tools/releasetools/test_common.py +++ b/tools/releasetools/test_common.py @@ -19,6 +19,7 @@ import os import subprocess import tempfile import time +import unittest import zipfile from hashlib import sha1 @@ -1527,6 +1528,88 @@ class CommonUtilsTest(test_utils.ReleaseToolsTestCase): self.assertEqual('3', chained_partition_args[1]) self.assertTrue(os.path.exists(chained_partition_args[2])) + def test_BuildVBMeta_appendAftlCommandSyntax(self): + testdata_dir = test_utils.get_testdata_dir() + common.OPTIONS.info_dict = { + 'ab_update': 'true', + 'avb_avbtool': 'avbtool', + 'build.prop': common.PartitionBuildProps.FromDictionary( + 'system', { + 'ro.build.version.incremental': '6285659', + 'ro.product.device': 'coral', + 'ro.build.fingerprint': + 'google/coral/coral:R/RP1A.200311.002/' + '6285659:userdebug/dev-keys'} + ), + } + common.OPTIONS.aftl_tool_path = 'aftltool' + common.OPTIONS.aftl_server = 'log.endpoints.aftl-dev.cloud.goog:9000' + common.OPTIONS.aftl_key_path = os.path.join(testdata_dir, + 'test_transparency_key.pub') + common.OPTIONS.aftl_manufacturer_key_path = os.path.join( + testdata_dir, 'test_aftl_rsa4096.pem') + + vbmeta_image = tempfile.NamedTemporaryFile(delete=False) + cmd = common.ConstructAftlMakeImageCommands(vbmeta_image.name) + expected_cmd = [ + 'aftltool', 'make_icp_from_vbmeta', + '--vbmeta_image_path', 'place_holder', + '--output', vbmeta_image.name, + '--version_incremental', '6285659', + '--transparency_log_servers', + 'log.endpoints.aftl-dev.cloud.goog:9000,{}'.format( + common.OPTIONS.aftl_key_path), + '--manufacturer_key', common.OPTIONS.aftl_manufacturer_key_path, + '--algorithm', 'SHA256_RSA4096', + '--padding', '4096'] + + # ignore the place holder, i.e. path to a temp file + self.assertEqual(cmd[:3], expected_cmd[:3]) + self.assertEqual(cmd[4:], expected_cmd[4:]) + + @unittest.skip("enable after we have a server for public") + def test_BuildVBMeta_appendAftlContactServer(self): + testdata_dir = test_utils.get_testdata_dir() + common.OPTIONS.info_dict = { + 'ab_update': 'true', + 'avb_avbtool': 'avbtool', + 'build.prop': common.PartitionBuildProps.FromDictionary( + 'system', { + 'ro.build.version.incremental': '6285659', + 'ro.product.device': 'coral', + 'ro.build.fingerprint': + 'google/coral/coral:R/RP1A.200311.002/' + '6285659:userdebug/dev-keys'} + ) + } + common.OPTIONS.aftl_tool_path = "aftltool" + common.OPTIONS.aftl_server = "log.endpoints.aftl-dev.cloud.goog:9000" + common.OPTIONS.aftl_key_path = os.path.join(testdata_dir, + 'test_transparency_key.pub') + common.OPTIONS.aftl_manufacturer_key_path = os.path.join( + testdata_dir, 'test_aftl_rsa4096.pem') + + input_dir = common.MakeTempDir() + system_image = common.MakeTempFile() + build_image_cmd = ['mkuserimg_mke2fs', input_dir, system_image, 'ext4', + '/system', str(4096 * 100), '-j', '0', '-s'] + common.RunAndCheckOutput(build_image_cmd) + + add_footer_cmd = ['avbtool', 'add_hashtree_footer', + '--partition_size', str(4096 * 150), + '--partition_name', 'system', + '--image', system_image] + common.RunAndCheckOutput(add_footer_cmd) + + vbmeta_image = common.MakeTempFile() + common.BuildVBMeta(vbmeta_image, {'system': system_image}, 'vbmeta', + ['system']) + + verify_cmd = ['aftltool', 'verify_image_icp', '--vbmeta_image_path', + vbmeta_image, '--transparency_log_pub_keys', + common.OPTIONS.aftl_key_path] + common.RunAndCheckOutput(verify_cmd) + class InstallRecoveryScriptFormatTest(test_utils.ReleaseToolsTestCase): """Checks the format of install-recovery.sh. diff --git a/tools/releasetools/testdata/test_aftl_rsa4096.pem b/tools/releasetools/testdata/test_aftl_rsa4096.pem new file mode 100644 index 0000000000..89f1ef3e59 --- /dev/null +++ b/tools/releasetools/testdata/test_aftl_rsa4096.pem @@ -0,0 +1,52 @@ +-----BEGIN PRIVATE KEY----- +MIIJQgIBADANBgkqhkiG9w0BAQEFAASCCSwwggkoAgEAAoICAQDDlhUPUgtWL6LB +Wybp6wsEJeioV1aRLPGSA2/xIpTiJUK46cb/MD5eBTWjKENoIgX23eL/ePy2I68e ++WvcZ5ITGOTRQqNVZIdc5qvr03wkV0BsJQMHSMAHacePpB/4xM5MzN/6Ku1wA8Dw +uK+v/Cw4hqq8H/gP0oPVQ1bwcIePzRPX4YkkyXusoyzTIm5DJ9reVtyFucKqANCN +aFmGxcaEc2nADtARQWJpO95joFsMvr68+JBxpCt8aWbxuSz/rLJ9Y8Z46V/++XG+ +E4QEob/WVY5pUD/RyogLrfhIf+zO7R3wJklXElSFacIX9+RzR9dgkQVbqxLfBKIP +XWLCsF4I4EnvqUtaVjIMl8UpZpoq8pDLRqZ71Os5xZYq06x9E02M6DnvFbZEdaOX +MCz2mmNX3g5FahvJayBhCuNhyTkd79MFR71Wp48TvWxKz3S7q0T0cWHNhtPkHSCa +KwD93AQnqtLKYDGkHIZBzJPcs+QxbzdHyGzhXZb+qh5KmQvNA9HRBQY1RkMmzIbI +8pzYTwpOkbCEhVoCWcRaaF1Pgl+zcpgJOMbBBUabx/dConFIhMDW/I5fHgKgwGqm +tWUibrMPdnfS6W5MXi8jC0eDuZl0VwmdE+4dLujiOofUYnb7D+GXojf3PrSLcTw1 +PmG0f7l5xDKN9a0N+IXqvD2oAANTsQIDAQABAoICAQCW5HXw8OogHvYg2HMIKrbA +B4McRO1baWIhtRcq4PQeGIMGaA2HmS+0l65O5uRCNWWGlJ7pW+0TlCop6mHFk/4F +T8JQk2mxmrI4ARqIAQwYeVwRUuioOP81eO1mK0gjQ6qpY7I0reOq9KpozQN18UYo +gfS82Kkng9EDukUbkKV1UtFJTw3gXLVWdjlB1qFcnCXmPPs7DBpbz+8V+XiAWpsS +WnwumP77IQeMiozDLdaw2YQMBHRjyDVocWTjfmpyAkleJZjcdagC7W1MKIBElomL +EUyigTALaYZWBGy1ekQ3TIY5XUBdtZ2RpAsDNNOCAN3v+VI565zOhCOHWRO1gh24 +vyhBFR0HYqBRoLbLAqo8bM5iLPz1EWGyaTnfxt38J8Va0TD7KihcBnphiA+dkhEF +oc0yIp/8S2o3CfkNok7Ju8Amb7M4JJuKhuP8wxn86fAHpjjd3Y4SlZp0NrTrd7T2 +msLIneb1OUZZxFxyJG1XQGEZplLPalnGadIF4p3q/3nd1rVb491qCNl/A5QwhI9r +ZV62O90M9fu3+cAynBLbMT09IZecNwP1gXmunlY6YH+ymM+3NFqC8q2tnzomiz8/ +Fee0ftZ2C/jK62fET0Y8LPWGkVQGHtvZH0FPg4suA0GMmYAe0tQl93A+jFltfKKZ +RgCDrYs6Wv76E9gnWVnEdQKCAQEA8L76LjZUTKOg83Bra+hP+cXnwGsgwOwJfGBp +OM++5HzlpYjtbD38esBZVJtwb/8xJGdsHtP2n7ZgbSDuAnRj5S50QHIApvRkz1Y+ +1hL8tAdgVP2JkYjpyG3bPk4QVKyXkKvBcp2BCidXs75+HzfOxqkazumaYOYo2guh +azHdka2xSqxcZqo4yyORc/oue25RU4skmuNDOlP0+OTxU/uXnl7QZmlaOfT5TqO4 +s7uER4BXt/87j44mnOBdXmtqrsL49+R9bzVskx76aeuaBbwf7jnpR058E71OZwSd +F1P3fx6hl0yLOZF/5Jnq+14rEna6jH50XtzlhB6deSZFTOw2gwKCAQEAz/qXRzwH +I0YWISgkUG2zBJseHmfHqV4CDzb5+tTJ3B2I8cXE0m2sQJXi2s7oMhWSc1cQOHCX +txpgWaD59uBz2lcwnGRNp27TRXv8Wo+X0+O+lGWU2cO+j8AB2Vtb7F7rCySp0+Uu +z+dBfoQ2zhKEQlkX0YldVILGzCL3QBHVvPC4iDlwkMRbcejDoh9NsBtHL8lG+MAw +ZXbwJjhaJkhTXJFpJpejq70naS8VVlLt8Os80iuBXe5JK/ecAHtsNcJlXO02sMNZ +Fbcy8WosGyvRKQ/tHtTjAlxZ7Ey8usWE8BvWBdUgiIBkIcjLtE2GrA8eOGNb3v1I +HRt8NsV8yaLWuwKCAQAR7SaT6le8nTKO7gARuOq7npDzMwbtVqYeLM+o+08rlGFF +QjzronH6cfg05J4quMXgABN8+CuVGO91MM6IQEJv/lWJtvN1ex1GkxV6u0812JbD +vV1RCPDfi86XhRiSNYfTrfZponDJYMSXDcg2auFqyYzFe3+TV5ATLGqIoN3uyxA4 +jz0SJ/qypaNfD3IGnuBPaD0Bi4ql/TpwjhuqNUHE+SprdczSI/usb2SBfaUL7fKa +MNcuiVc2tz48maMIAFypmMn+TewXyGa9HF4Lr0ZxZr6IIL/8eEwuP5my8v2q6Yz+ +xyRW1Q7A5vUoYoqyhUS+0Wu45JnyjJUNQFxIrg4hAoIBAF1uBIGSvN4iwRQ6FT4w +WahrCre8BVzXh3NQTjJZXylL91YtcwLZE/Wbn+KN6o99U2IPLZE9O1qdNcVt5Hz8 +Te87FfJbuOrLhYuEbFQ+h4U/nUDK9XhyT+wB5JLBUOU5qrtByC0Rmtr411o/iONA +PDwWC/YskEnDygywdIRKvsr3FN7VdvUB0Na2KxRsnZjMWElmUUS0Ccm7CZ0R2aWy +/gfqpuMYYgVnnwnIhfxWmt+MvbDorGAHCMYAoQsyZuUrpB9/zP7RcvanavI6sP+v +ynF43xvnpOdNl3Po8SuyScsXpijOmqPXkaP/sUsZPLOUww2vzPi6raetzjpIs4td +ZLsCggEAe42Zj3FEbruJZeDgmd9lSc0j8UF90mNw8KH44IbuA6R9fGv3WkrNHEVd +XZOwjWqAxhOj6pFoJk8n6h5d8iS/yXFZ0AfBMc21XMecu9mnfx9E9LFAIWmv7Wut +vy3h2BqY+crglpg5RAw+3J97HAGMYCvp+hH2il+9zzjpmCtTD21LRMkw34szY7RR +CDy9G5FTmKVlxw5eegvyj164olQRLurEdUIfSr5UnBjrWftJHy9JW8KWCeFDSmm9 +xCl3nGDyQuZmOTngxPtrOYAhb5LoKR9BeGcy6jlom7V4nYYqm3t1IDBgMqjYGT9c +vqQgxO2OFsQOJQ/4PRYEKd1neTlZrw== +-----END PRIVATE KEY----- diff --git a/tools/releasetools/testdata/test_transparency_key.pub b/tools/releasetools/testdata/test_transparency_key.pub new file mode 100644 index 0000000000..8bfd81619d --- /dev/null +++ b/tools/releasetools/testdata/test_transparency_key.pub @@ -0,0 +1,15 @@ +-----BEGIN PUBLIC KEY----- +MIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEA4ilqCNsenNA013iCdwgD +YPxZ853nbHG9lMBp9boXiwRcqT/8bUKHIL7YX5z7s+QoRYVY3rkMKppRabclXzyx +H59YnPMaU4uv7NqwWzjgaZo7E+vo7IF+KBjV3cJulId5Av0yIYUCsrwd7MpGtWdC +Q3S+7Vd4zwzCKEhcvliNIhnNlp1U3wNkPCxOyCAsMEn6k8O5ar12ke5TvxDv15db +rPDeHh8G2OYWoCkWL+lSN35L2kOJqKqVbLKWrrOd96RCYrrtbPCi580OADJRcUlG +lgcjwmNwmypBWvQMZ6ITj0P0ksHnl1zZz1DE2rXe1goLI1doghb5KxLaezlR8c2C +E3w/uo9KJgNmNgUVzzqZZ6FE0moyIDNOpP7KtZAL0DvEZj6jqLbB0ccPQElrg52m +Dv2/A3nYSr0mYBKeskT4+Bg7PGgoC8p7WyLSxMyzJEDYdtrj9OFx6eZaA23oqTQx +k3Qq5H8RfNBeeSUEeKF7pKH/7gyqZ2bNzBFMA2EBZgBozwRfaeN/HCv3qbaCnwvu +6caacmAsK+RxiYxSL1QsJqyhCWWGxVyenmxdc1KG/u5ypi7OIioztyzR3t2tAzD3 +Nb+2t8lgHBRxbV24yiPlnvPmB1ZYEctXnlRR9Evpl1o9xA9NnybPHKr9rozN39CZ +V/USB8K6ao1y5xPZxa8CZksCAwEAAQ== +-----END PUBLIC KEY----- + diff --git a/tools/releasetools/testdata/vintf/kernel/SYSTEM/compatibility_matrix.xml b/tools/releasetools/testdata/vintf/kernel/SYSTEM/etc/vintf/compatibility_matrix.1.xml index ed46b6b761..a92dd6e667 100644 --- a/tools/releasetools/testdata/vintf/kernel/SYSTEM/compatibility_matrix.xml +++ b/tools/releasetools/testdata/vintf/kernel/SYSTEM/etc/vintf/compatibility_matrix.1.xml @@ -1,4 +1,4 @@ -<compatibility-matrix version="1.0" type="framework"> +<compatibility-matrix version="1.0" level="1" type="framework"> <kernel version="4.14.1" /> <sepolicy> <sepolicy-version>0.0</sepolicy-version> diff --git a/tools/releasetools/testdata/vintf/matrix_incompat/SYSTEM/compatibility_matrix.xml b/tools/releasetools/testdata/vintf/matrix_incompat/SYSTEM/etc/vintf/compatibility_matrix.1.xml index 5d891fa4a1..1700e214e9 100644 --- a/tools/releasetools/testdata/vintf/matrix_incompat/SYSTEM/compatibility_matrix.xml +++ b/tools/releasetools/testdata/vintf/matrix_incompat/SYSTEM/etc/vintf/compatibility_matrix.1.xml @@ -1,4 +1,4 @@ -<compatibility-matrix version="1.0" type="framework"> +<compatibility-matrix version="1.0" level="1" type="framework"> <sepolicy> <sepolicy-version>1.0</sepolicy-version> <kernel-sepolicy-version>0</kernel-sepolicy-version> diff --git a/tools/releasetools/testdata/vintf/sku_compat/SYSTEM/compatibility_matrix.xml b/tools/releasetools/testdata/vintf/sku_compat/SYSTEM/etc/vintf/compatibility_matrix.1.xml index 19a9b6a0d4..22272fd30e 100644 --- a/tools/releasetools/testdata/vintf/sku_compat/SYSTEM/compatibility_matrix.xml +++ b/tools/releasetools/testdata/vintf/sku_compat/SYSTEM/etc/vintf/compatibility_matrix.1.xml @@ -1,4 +1,4 @@ -<compatibility-matrix version="1.0" type="framework"> +<compatibility-matrix version="1.0" level="1" type="framework"> <hal format="hidl" optional="false"> <name>foo</name> <version>1.0</version> diff --git a/tools/releasetools/testdata/vintf/sku_incompat/SYSTEM/compatibility_matrix.xml b/tools/releasetools/testdata/vintf/sku_incompat/SYSTEM/etc/vintf/compatibility_matrix.1.xml index e0e0d6c20a..1a3fc43f5a 100644 --- a/tools/releasetools/testdata/vintf/sku_incompat/SYSTEM/compatibility_matrix.xml +++ b/tools/releasetools/testdata/vintf/sku_incompat/SYSTEM/etc/vintf/compatibility_matrix.1.xml @@ -1,4 +1,4 @@ -<compatibility-matrix version="1.0" type="framework"> +<compatibility-matrix version="1.0" level="1" type="framework"> <hal format="hidl" optional="false"> <name>foo</name> <version>1.1</version> diff --git a/tools/warn/chrome_project_list.py b/tools/warn/chrome_project_list.py new file mode 100644 index 0000000000..609652267b --- /dev/null +++ b/tools/warn/chrome_project_list.py @@ -0,0 +1,686 @@ +# python3 +"""Clang_Tidy_Warn Project List data for Chrome. + +This file stores the Chrome project_list used in warn.py and +its dependencies. It has been put into this file for easier navigation and +unification of the Chrome and Android warn.py. +""" + + +def create_pattern(pattern): + return [pattern, '(^|.*/)' + pattern + '/.*: warning:'] + + +# A list of [project_name, file_path_pattern]. +project_list = [ + create_pattern('android_webview'), + create_pattern('apps'), + create_pattern('ash/app_list'), + create_pattern('ash/public'), + create_pattern('ash/assistant'), + create_pattern('ash/display'), + create_pattern('ash/resources'), + create_pattern('ash/login'), + create_pattern('ash/system'), + create_pattern('ash/wm'), + create_pattern('ash/shelf'), + create_pattern('ash'), + create_pattern('base/trace_event'), + create_pattern('base/debug'), + create_pattern('base/third_party'), + create_pattern('base/files'), + create_pattern('base/test'), + create_pattern('base/util'), + create_pattern('base/task'), + create_pattern('base/metrics'), + create_pattern('base/strings'), + create_pattern('base/memory'), + create_pattern('base'), + create_pattern('build'), + create_pattern('build_overrides'), + create_pattern('buildtools'), + create_pattern('cc'), + create_pattern('chrome/services'), + create_pattern('chrome/app'), + create_pattern('chrome/renderer'), + create_pattern('chrome/test'), + create_pattern('chrome/common/safe_browsing'), + create_pattern('chrome/common/importer'), + create_pattern('chrome/common/media_router'), + create_pattern('chrome/common/extensions'), + create_pattern('chrome/common'), + create_pattern('chrome/browser/sync_file_system'), + create_pattern('chrome/browser/safe_browsing'), + create_pattern('chrome/browser/download'), + create_pattern('chrome/browser/ui'), + create_pattern('chrome/browser/supervised_user'), + create_pattern('chrome/browser/search'), + create_pattern('chrome/browser/browsing_data'), + create_pattern('chrome/browser/predictors'), + create_pattern('chrome/browser/net'), + create_pattern('chrome/browser/devtools'), + create_pattern('chrome/browser/resource_coordinator'), + create_pattern('chrome/browser/page_load_metrics'), + create_pattern('chrome/browser/extensions'), + create_pattern('chrome/browser/ssl'), + create_pattern('chrome/browser/printing'), + create_pattern('chrome/browser/profiles'), + create_pattern('chrome/browser/chromeos'), + create_pattern('chrome/browser/performance_manager'), + create_pattern('chrome/browser/metrics'), + create_pattern('chrome/browser/component_updater'), + create_pattern('chrome/browser/media'), + create_pattern('chrome/browser/notifications'), + create_pattern('chrome/browser/web_applications'), + create_pattern('chrome/browser/media_galleries'), + create_pattern('chrome/browser'), + create_pattern('chrome'), + create_pattern('chromecast'), + create_pattern('chromeos/services'), + create_pattern('chromeos/dbus'), + create_pattern('chromeos/assistant'), + create_pattern('chromeos/components'), + create_pattern('chromeos/settings'), + create_pattern('chromeos/constants'), + create_pattern('chromeos/network'), + create_pattern('chromeos'), + create_pattern('cloud_print'), + create_pattern('components/crash'), + create_pattern('components/subresource_filter'), + create_pattern('components/invalidation'), + create_pattern('components/autofill'), + create_pattern('components/onc'), + create_pattern('components/arc'), + create_pattern('components/safe_browsing'), + create_pattern('components/services'), + create_pattern('components/cast_channel'), + create_pattern('components/download'), + create_pattern('components/feed'), + create_pattern('components/offline_pages'), + create_pattern('components/bookmarks'), + create_pattern('components/cloud_devices'), + create_pattern('components/mirroring'), + create_pattern('components/spellcheck'), + create_pattern('components/viz'), + create_pattern('components/gcm_driver'), + create_pattern('components/ntp_snippets'), + create_pattern('components/translate'), + create_pattern('components/search_engines'), + create_pattern('components/background_task_scheduler'), + create_pattern('components/signin'), + create_pattern('components/chromeos_camera'), + create_pattern('components/reading_list'), + create_pattern('components/assist_ranker'), + create_pattern('components/payments'), + create_pattern('components/feedback'), + create_pattern('components/ui_devtools'), + create_pattern('components/password_manager'), + create_pattern('components/omnibox'), + create_pattern('components/content_settings'), + create_pattern('components/dom_distiller'), + create_pattern('components/nacl'), + create_pattern('components/metrics'), + create_pattern('components/policy'), + create_pattern('components/optimization_guide'), + create_pattern('components/exo'), + create_pattern('components/update_client'), + create_pattern('components/data_reduction_proxy'), + create_pattern('components/sync'), + create_pattern('components/drive'), + create_pattern('components/variations'), + create_pattern('components/history'), + create_pattern('components/webcrypto'), + create_pattern('components'), + create_pattern('content/public'), + create_pattern('content/renderer'), + create_pattern('content/test'), + create_pattern('content/common'), + create_pattern('content/browser'), + create_pattern('content/zygote'), + create_pattern('content'), + create_pattern('courgette'), + create_pattern('crypto'), + create_pattern('dbus'), + create_pattern('device/base'), + create_pattern('device/vr'), + create_pattern('device/gamepad'), + create_pattern('device/test'), + create_pattern('device/fido'), + create_pattern('device/bluetooth'), + create_pattern('device'), + create_pattern('docs'), + create_pattern('extensions/docs'), + create_pattern('extensions/components'), + create_pattern('extensions/buildflags'), + create_pattern('extensions/renderer'), + create_pattern('extensions/test'), + create_pattern('extensions/common'), + create_pattern('extensions/shell'), + create_pattern('extensions/browser'), + create_pattern('extensions/strings'), + create_pattern('extensions'), + create_pattern('fuchsia'), + create_pattern('gin'), + create_pattern('google_apis'), + create_pattern('google_update'), + create_pattern('gpu/perftests'), + create_pattern('gpu/GLES2'), + create_pattern('gpu/command_buffer'), + create_pattern('gpu/tools'), + create_pattern('gpu/gles2_conform_support'), + create_pattern('gpu/ipc'), + create_pattern('gpu/khronos_glcts_support'), + create_pattern('gpu'), + create_pattern('headless'), + create_pattern('infra'), + create_pattern('ipc'), + create_pattern('jingle'), + create_pattern('media'), + create_pattern('mojo'), + create_pattern('native_client'), + create_pattern('ative_client_sdk'), + create_pattern('net'), + create_pattern('out'), + create_pattern('pdf'), + create_pattern('ppapi'), + create_pattern('printing'), + create_pattern('remoting'), + create_pattern('rlz'), + create_pattern('sandbox'), + create_pattern('services/audio'), + create_pattern('services/content'), + create_pattern('services/data_decoder'), + create_pattern('services/device'), + create_pattern('services/file'), + create_pattern('services/identity'), + create_pattern('services/image_annotation'), + create_pattern('services/media_session'), + create_pattern('services/metrics'), + create_pattern('services/network'), + create_pattern('services/preferences'), + create_pattern('services/proxy_resolver'), + create_pattern('services/resource_coordinator'), + create_pattern('services/service_manager'), + create_pattern('services/shape_detection'), + create_pattern('services/strings'), + create_pattern('services/test'), + create_pattern('services/tracing'), + create_pattern('services/video_capture'), + create_pattern('services/viz'), + create_pattern('services/ws'), + create_pattern('services'), + create_pattern('skia/config'), + create_pattern('skia/ext'), + create_pattern('skia/public'), + create_pattern('skia/tools'), + create_pattern('skia'), + create_pattern('sql'), + create_pattern('storage'), + create_pattern('styleguide'), + create_pattern('testing'), + create_pattern('third_party/Python-Markdown'), + create_pattern('third_party/SPIRV-Tools'), + create_pattern('third_party/abseil-cpp'), + create_pattern('third_party/accessibility-audit'), + create_pattern('third_party/accessibility_test_framework'), + create_pattern('third_party/adobe'), + create_pattern('third_party/afl'), + create_pattern('third_party/android_build_tools'), + create_pattern('third_party/android_crazy_linker'), + create_pattern('third_party/android_data_chart'), + create_pattern('third_party/android_deps'), + create_pattern('third_party/android_media'), + create_pattern('third_party/android_ndk'), + create_pattern('third_party/android_opengl'), + create_pattern('third_party/android_platform'), + create_pattern('third_party/android_protobuf'), + create_pattern('third_party/android_sdk'), + create_pattern('third_party/android_support_test_runner'), + create_pattern('third_party/android_swipe_refresh'), + create_pattern('third_party/android_system_sdk'), + create_pattern('third_party/android_tools'), + create_pattern('third_party/angle'), + create_pattern('third_party/apache-mac'), + create_pattern('third_party/apache-portable-runtime'), + create_pattern('third_party/apache-win32'), + create_pattern('third_party/apk-patch-size-estimator'), + create_pattern('third_party/apple_apsl'), + create_pattern('third_party/arcore-android-sdk'), + create_pattern('third_party/ashmem'), + create_pattern('third_party/auto'), + create_pattern('third_party/axe-core'), + create_pattern('third_party/bazel'), + create_pattern('third_party/binutils'), + create_pattern('third_party/bison'), + create_pattern('third_party/blanketjs'), + create_pattern('third_party/blink/common'), + create_pattern('third_party/blink/manual_tests'), + create_pattern('third_party/blink/perf_tests'), + create_pattern('third_party/blink/public/common'), + create_pattern('third_party/blink/public/default_100_percent'), + create_pattern('third_party/blink/public/default_200_percent'), + create_pattern('third_party/blink/public/platform'), + create_pattern('third_party/blink/public/mojom/ad_tagging'), + create_pattern('third_party/blink/public/mojom/app_banner'), + create_pattern('third_party/blink/public/mojom/appcache'), + create_pattern('third_party/blink/public/mojom/array_buffer'), + create_pattern('third_party/blink/public/mojom/associated_interfaces'), + create_pattern('third_party/blink/public/mojom/autoplay'), + create_pattern('third_party/blink/public/mojom/background_fetch'), + create_pattern('third_party/blink/public/mojom/background_sync'), + create_pattern('third_party/blink/public/mojom/badging'), + create_pattern('third_party/blink/public/mojom/blob'), + create_pattern('third_party/blink/public/mojom/bluetooth'), + create_pattern('third_party/blink/public/mojom/broadcastchannel'), + create_pattern('third_party/blink/public/mojom/cache_storage'), + create_pattern('third_party/blink/public/mojom/choosers'), + create_pattern('third_party/blink/public/mojom/clipboard'), + create_pattern('third_party/blink/public/mojom/commit_result'), + create_pattern('third_party/blink/public/mojom/contacts'), + create_pattern('third_party/blink/public/mojom/cookie_store'), + create_pattern('third_party/blink/public/mojom/crash'), + create_pattern('third_party/blink/public/mojom/credentialmanager'), + create_pattern('third_party/blink/public/mojom/csp'), + create_pattern('third_party/blink/public/mojom/devtools'), + create_pattern('third_party/blink/public/mojom/document_metadata'), + create_pattern('third_party/blink/public/mojom/dom_storage'), + create_pattern('third_party/blink/public/mojom/dwrite_font_proxy'), + create_pattern('third_party/blink/public/mojom/feature_policy'), + create_pattern('third_party/blink/public/mojom/fetch'), + create_pattern('third_party/blink/public/mojom/file'), + create_pattern('third_party/blink/public/mojom/filesystem'), + create_pattern('third_party/blink/public/mojom/font_unique_name_lookup'), + create_pattern('third_party/blink/public/mojom/frame'), + create_pattern('third_party/blink/public/mojom/frame_sinks'), + create_pattern('third_party/blink/public/mojom/geolocation'), + create_pattern('third_party/blink/public/mojom/hyphenation'), + create_pattern('third_party/blink/public/mojom/idle'), + create_pattern('third_party/blink/public/mojom/indexeddb'), + create_pattern('third_party/blink/public/mojom/input'), + create_pattern('third_party/blink/public/mojom/insecure_input'), + create_pattern('third_party/blink/public/mojom/installation'), + create_pattern('third_party/blink/public/mojom/installedapp'), + create_pattern('third_party/blink/public/mojom/keyboard_lock'), + create_pattern('third_party/blink/public/mojom/leak_detector'), + create_pattern('third_party/blink/public/mojom/loader'), + create_pattern('third_party/blink/public/mojom/locks'), + create_pattern('third_party/blink/public/mojom/manifest'), + create_pattern('third_party/blink/public/mojom/media_controls'), + create_pattern('third_party/blink/public/mojom/mediasession'), + create_pattern('third_party/blink/public/mojom/mediastream'), + create_pattern('third_party/blink/public/mojom/messaging'), + create_pattern('third_party/blink/public/mojom/mime'), + create_pattern('third_party/blink/public/mojom/native_file_system'), + create_pattern('third_party/blink/public/mojom/net'), + create_pattern('third_party/blink/public/mojom/notifications'), + create_pattern('third_party/blink/public/mojom/oom_intervention'), + create_pattern('third_party/blink/public/mojom/page'), + create_pattern('third_party/blink/public/mojom/payments'), + create_pattern('third_party/blink/public/mojom/permissions'), + create_pattern('third_party/blink/public/mojom/picture_in_picture'), + create_pattern('third_party/blink/public/mojom/plugins'), + create_pattern('third_party/blink/public/mojom/portal'), + create_pattern('third_party/blink/public/mojom/presentation'), + create_pattern('third_party/blink/public/mojom/push_messaging'), + create_pattern('third_party/blink/public/mojom/quota'), + create_pattern('third_party/blink/public/mojom/remote_objects'), + create_pattern('third_party/blink/public/mojom/reporting'), + create_pattern('third_party/blink/public/mojom/script'), + create_pattern('third_party/blink/public/mojom/selection_menu'), + create_pattern('third_party/blink/public/mojom/serial'), + create_pattern('third_party/blink/public/mojom/service_worker'), + create_pattern('third_party/blink/public/mojom/site_engagement'), + create_pattern('third_party/blink/public/mojom/sms'), + create_pattern('third_party/blink/public/mojom/speech'), + create_pattern('third_party/blink/public/mojom/ukm'), + create_pattern('third_party/blink/public/mojom/unhandled_tap_notifier'), + create_pattern('third_party/blink/public/mojom/usb'), + create_pattern('third_party/blink/public/mojom/use_counter'), + create_pattern('third_party/blink/public/mojom/user_agent'), + create_pattern('third_party/blink/public/mojom/wake_lock'), + create_pattern('third_party/blink/public/mojom/web_client_hints'), + create_pattern('third_party/blink/public/mojom/web_feature'), + create_pattern('third_party/blink/public/mojom/webaudio'), + create_pattern('third_party/blink/public/mojom/webauthn'), + create_pattern('third_party/blink/public/mojom/webdatabase'), + create_pattern('third_party/blink/public/mojom/webshare'), + create_pattern('third_party/blink/public/mojom/window_features'), + create_pattern('third_party/blink/public/mojom/worker'), + create_pattern('third_party/blink/public/web'), + create_pattern('third_party/blink/renderer/bindings'), + create_pattern('third_party/blink/renderer/build'), + create_pattern('third_party/blink/renderer/controller'), + create_pattern('third_party/blink/renderer/core/accessibility'), + create_pattern('third_party/blink/renderer/core/animation'), + create_pattern('third_party/blink/renderer/core/aom'), + create_pattern('third_party/blink/renderer/core/clipboard'), + create_pattern('third_party/blink/renderer/core/content_capture'), + create_pattern('third_party/blink/renderer/core/context_features'), + create_pattern('third_party/blink/renderer/core/css'), + create_pattern('third_party/blink/renderer/core/display_lock'), + create_pattern('third_party/blink/renderer/core/dom'), + create_pattern('third_party/blink/renderer/core/editing'), + create_pattern('third_party/blink/renderer/core/events'), + create_pattern('third_party/blink/renderer/core/execution_context'), + create_pattern('third_party/blink/renderer/core/exported'), + create_pattern('third_party/blink/renderer/core/feature_policy'), + create_pattern('third_party/blink/renderer/core/fetch'), + create_pattern('third_party/blink/renderer/core/fileapi'), + create_pattern('third_party/blink/renderer/core/frame'), + create_pattern('third_party/blink/renderer/core/fullscreen'), + create_pattern('third_party/blink/renderer/core/geometry'), + create_pattern('third_party/blink/renderer/core/html'), + create_pattern('third_party/blink/renderer/core/imagebitmap'), + create_pattern('third_party/blink/renderer/core/input'), + create_pattern('third_party/blink/renderer/core/inspector'), + create_pattern('third_party/blink/renderer/core/intersection_observer'), + create_pattern('third_party/blink/renderer/core/invisible_dom'), + create_pattern('third_party/blink/renderer/core/layout'), + create_pattern('third_party/blink/renderer/core/loader'), + create_pattern('third_party/blink/renderer/core/messaging'), + create_pattern('third_party/blink/renderer/core/mojo'), + create_pattern('third_party/blink/renderer/core/offscreencanvas'), + create_pattern('third_party/blink/renderer/core/origin_trials'), + create_pattern('third_party/blink/renderer/core/page'), + create_pattern('third_party/blink/renderer/core/paint'), + create_pattern('third_party/blink/renderer/core/probe'), + create_pattern('third_party/blink/renderer/core/resize_observer'), + create_pattern('third_party/blink/renderer/core/scheduler'), + create_pattern('third_party/blink/renderer/core/script'), + create_pattern('third_party/blink/renderer/core/scroll'), + create_pattern('third_party/blink/renderer/core/streams'), + create_pattern('third_party/blink/renderer/core/style'), + create_pattern('third_party/blink/renderer/core/svg'), + create_pattern('third_party/blink/renderer/core/testing'), + create_pattern('third_party/blink/renderer/core/timezone'), + create_pattern('third_party/blink/renderer/core/timing'), + create_pattern('third_party/blink/renderer/core/trustedtypes'), + create_pattern('third_party/blink/renderer/core/typed_arrays'), + create_pattern('third_party/blink/renderer/core/url'), + create_pattern('third_party/blink/renderer/core/win'), + create_pattern('third_party/blink/renderer/core/workers'), + create_pattern('third_party/blink/renderer/core/xml'), + create_pattern('third_party/blink/renderer/core/xmlhttprequest'), + create_pattern('third_party/blink/renderer/devtools'), + create_pattern('third_party/blink/renderer/modules'), + create_pattern('third_party/blink/renderer/platform'), + create_pattern('third_party/blink/tools'), + create_pattern('third_party/blink/web_tests'), + create_pattern('third_party/boringssl'), + create_pattern('third_party/bouncycastle'), + create_pattern('third_party/breakpad'), + create_pattern('third_party/brotli'), + create_pattern('third_party/bspatch'), + create_pattern('third_party/byte_buddy'), + create_pattern('third_party/cacheinvalidation'), + create_pattern('third_party/catapult'), + create_pattern('third_party/cct_dynamic_module'), + create_pattern('third_party/ced'), + create_pattern('third_party/chaijs'), + create_pattern('third_party/checkstyle'), + create_pattern('third_party/chromevox'), + create_pattern('third_party/chromite'), + create_pattern('third_party/cld_3'), + create_pattern('third_party/closure_compiler'), + create_pattern('third_party/colorama'), + create_pattern('third_party/crashpad'), + create_pattern('third_party/crc32c'), + create_pattern('third_party/cros_system_api'), + create_pattern('third_party/custom_tabs_client'), + create_pattern('third_party/d3'), + create_pattern('third_party/dav1d'), + create_pattern('third_party/dawn'), + create_pattern('third_party/decklink'), + create_pattern('third_party/depot_tools'), + create_pattern('third_party/devscripts'), + create_pattern('third_party/devtools-node-modules'), + create_pattern('third_party/dom_distiller_js'), + create_pattern('third_party/elfutils'), + create_pattern('third_party/emoji-segmenter'), + create_pattern('third_party/errorprone'), + create_pattern('third_party/espresso'), + create_pattern('third_party/expat'), + create_pattern('third_party/feed'), + create_pattern('third_party/ffmpeg'), + create_pattern('third_party/flac'), + create_pattern('third_party/flatbuffers'), + create_pattern('third_party/flot'), + create_pattern('third_party/fontconfig'), + create_pattern('third_party/freetype'), + create_pattern('third_party/fuchsia-sdk'), + create_pattern('third_party/gestures'), + create_pattern('third_party/gif_player'), + create_pattern('third_party/glfw'), + create_pattern('third_party/glslang'), + create_pattern('third_party/gnu_binutils'), + create_pattern('third_party/google-truth'), + create_pattern('third_party/google_android_play_core'), + create_pattern('third_party/google_appengine_cloudstorage'), + create_pattern('third_party/google_input_tools'), + create_pattern('third_party/google_toolbox_for_mac'), + create_pattern('third_party/google_trust_services'), + create_pattern('third_party/googletest'), + create_pattern('third_party/gperf'), + create_pattern('third_party/gradle_wrapper'), + create_pattern('third_party/grpc'), + create_pattern('third_party/gson'), + create_pattern('third_party/guava'), + create_pattern('third_party/gvr-android-keyboard'), + create_pattern('third_party/gvr-android-sdk'), + create_pattern('third_party/hamcrest'), + create_pattern('third_party/harfbuzz-ng'), + create_pattern('third_party/hunspell'), + create_pattern('third_party/hunspell_dictionaries'), + create_pattern('third_party/iaccessible2'), + create_pattern('third_party/iccjpeg'), + create_pattern('third_party/icu/android'), + create_pattern('third_party/icu/android_small'), + create_pattern('third_party/icu/cast'), + create_pattern('third_party/icu/chromeos'), + create_pattern('third_party/icu/common'), + create_pattern('third_party/icu/filters'), + create_pattern('third_party/icu/flutter'), + create_pattern('third_party/icu/fuzzers'), + create_pattern('third_party/icu/ios'), + create_pattern('third_party/icu/patches'), + create_pattern('third_party/icu/scripts'), + create_pattern('third_party/icu/source'), + create_pattern('third_party/icu/tzres'), + create_pattern('third_party/icu4j'), + create_pattern('third_party/ijar'), + create_pattern('third_party/ink'), + create_pattern('third_party/inspector_protocol'), + create_pattern('third_party/instrumented_libraries'), + create_pattern('third_party/intellij'), + create_pattern('third_party/isimpledom'), + create_pattern('third_party/jacoco'), + create_pattern('third_party/jinja2'), + create_pattern('third_party/jsoncpp'), + create_pattern('third_party/jsr-305'), + create_pattern('third_party/jstemplate'), + create_pattern('third_party/junit'), + create_pattern('third_party/khronos'), + create_pattern('third_party/lcov'), + create_pattern('third_party/leveldatabase'), + create_pattern('third_party/libFuzzer'), + create_pattern('third_party/libXNVCtrl'), + create_pattern('third_party/libaddressinput'), + create_pattern('third_party/libaom'), + create_pattern('third_party/libcxx-pretty-printers'), + create_pattern('third_party/libdrm'), + create_pattern('third_party/libevdev'), + create_pattern('third_party/libjingle_xmpp'), + create_pattern('third_party/libjpeg'), + create_pattern('third_party/libjpeg_turbo'), + create_pattern('third_party/liblouis'), + create_pattern('third_party/libovr'), + create_pattern('third_party/libphonenumber'), + create_pattern('third_party/libpng'), + create_pattern('third_party/libprotobuf-mutator'), + create_pattern('third_party/libsecret'), + create_pattern('third_party/libsrtp'), + create_pattern('third_party/libsync'), + create_pattern('third_party/libudev'), + create_pattern('third_party/libusb'), + create_pattern('third_party/libvpx'), + create_pattern('third_party/libwebm'), + create_pattern('third_party/libwebp'), + create_pattern('third_party/libxml'), + create_pattern('third_party/libxslt'), + create_pattern('third_party/libyuv'), + create_pattern('third_party/lighttpd'), + create_pattern('third_party/logilab'), + create_pattern('third_party/lss'), + create_pattern('third_party/lzma_sdk'), + create_pattern('third_party/mach_override'), + create_pattern('third_party/markdown'), + create_pattern('third_party/markupsafe'), + create_pattern('third_party/material_design_icons'), + create_pattern('third_party/mesa_headers'), + create_pattern('third_party/metrics_proto'), + create_pattern('third_party/microsoft_webauthn'), + create_pattern('third_party/mingw-w64'), + create_pattern('third_party/minigbm'), + create_pattern('third_party/minizip'), + create_pattern('third_party/mocha'), + create_pattern('third_party/mockito'), + create_pattern('third_party/modp_b64'), + create_pattern('third_party/motemplate'), + create_pattern('third_party/mozilla'), + create_pattern('third_party/nacl_sdk_binaries'), + create_pattern('third_party/nasm'), + create_pattern('third_party/netty-tcnative'), + create_pattern('third_party/netty4'), + create_pattern('third_party/node'), + create_pattern('third_party/nvml'), + create_pattern('third_party/objenesis'), + create_pattern('third_party/ocmock'), + create_pattern('third_party/openh264'), + create_pattern('third_party/openscreen'), + create_pattern('third_party/openvr'), + create_pattern('third_party/opus'), + create_pattern('third_party/ots'), + create_pattern('third_party/ow2_asm'), + create_pattern('third_party/pdfium'), + create_pattern('third_party/pefile'), + create_pattern('third_party/perfetto'), + create_pattern('third_party/perl'), + create_pattern('third_party/pexpect'), + create_pattern('third_party/pffft'), + create_pattern('third_party/ply'), + create_pattern('third_party/polymer'), + create_pattern('third_party/proguard'), + create_pattern('third_party/protobuf'), + create_pattern('third_party/protoc_javalite'), + create_pattern('third_party/pycoverage'), + create_pattern('third_party/pyelftools'), + create_pattern('third_party/pyjson5'), + create_pattern('third_party/pylint'), + create_pattern('third_party/pymock'), + create_pattern('third_party/pystache'), + create_pattern('third_party/pywebsocket'), + create_pattern('third_party/qcms'), + create_pattern('third_party/quic_trace'), + create_pattern('third_party/qunit'), + create_pattern('third_party/r8'), + create_pattern('third_party/re2'), + create_pattern('third_party/requests'), + create_pattern('third_party/rnnoise'), + create_pattern('third_party/robolectric'), + create_pattern('third_party/s2cellid'), + create_pattern('third_party/sfntly'), + create_pattern('third_party/shaderc'), + create_pattern('third_party/simplejson'), + create_pattern('third_party/sinonjs'), + create_pattern('third_party/skia'), + create_pattern('third_party/smhasher'), + create_pattern('third_party/snappy'), + create_pattern('third_party/speech-dispatcher'), + create_pattern('third_party/spirv-cross'), + create_pattern('third_party/spirv-headers'), + create_pattern('third_party/sqlite'), + create_pattern('third_party/sqlite4java'), + create_pattern('third_party/sudden_motion_sensor'), + create_pattern('third_party/swiftshader'), + create_pattern('third_party/tcmalloc'), + create_pattern('third_party/test_fonts'), + create_pattern('third_party/tlslite'), + create_pattern('third_party/ub-uiautomator'), + create_pattern('third_party/unrar'), + create_pattern('third_party/usb_ids'), + create_pattern('third_party/usrsctp'), + create_pattern('third_party/v4l-utils'), + create_pattern('third_party/vulkan'), + create_pattern('third_party/wayland'), + create_pattern('third_party/wayland-protocols'), + create_pattern('third_party/wds'), + create_pattern('third_party/web-animations-js'), + create_pattern('third_party/webdriver'), + create_pattern('third_party/webgl'), + create_pattern('third_party/webrtc'), + create_pattern('third_party/webrtc_overrides'), + create_pattern('third_party/webxr_test_pages'), + create_pattern('third_party/widevine'), + create_pattern('third_party/win_build_output'), + create_pattern('third_party/woff2'), + create_pattern('third_party/wtl'), + create_pattern('third_party/xdg-utils'), + create_pattern('third_party/xstream'), + create_pattern('third_party/yasm'), + create_pattern('third_party/zlib'), + create_pattern('tools'), + create_pattern('ui/accelerated_widget_mac'), + create_pattern('ui/accessibility'), + create_pattern('ui/android'), + create_pattern('ui/aura'), + create_pattern('ui/aura_extra'), + create_pattern('ui/base'), + create_pattern('ui/chromeos'), + create_pattern('ui/compositor'), + create_pattern('ui/compositor_extra'), + create_pattern('ui/content_accelerators'), + create_pattern('ui/display'), + create_pattern('ui/events'), + create_pattern('ui/file_manager'), + create_pattern('ui/gfx'), + create_pattern('ui/gl'), + create_pattern('ui/latency'), + create_pattern('ui/login'), + create_pattern('ui/message_center'), + create_pattern('ui/native_theme'), + create_pattern('ui/ozone'), + create_pattern('ui/platform_window'), + create_pattern('ui/resources'), + create_pattern('ui/shell_dialogs'), + create_pattern('ui/snapshot'), + create_pattern('ui/strings'), + create_pattern('ui/surface'), + create_pattern('ui/touch_selection'), + create_pattern('ui/views'), + create_pattern('ui/views_bridge_mac'), + create_pattern('ui/views_content_client'), + create_pattern('ui/web_dialogs'), + create_pattern('ui/webui'), + create_pattern('ui/wm'), + create_pattern('url'), + create_pattern('v8/benchmarks'), + create_pattern('v8/build_overrides'), + create_pattern('v8/custom_deps'), + create_pattern('v8/docs'), + create_pattern('v8/gni'), + create_pattern('v8/include'), + create_pattern('v8/infra'), + create_pattern('v8/samples'), + create_pattern('v8/src'), + create_pattern('v8/test'), + create_pattern('v8/testing'), + create_pattern('v8/third_party'), + create_pattern('v8/tools'), + + # keep out/obj and other patterns at the end. + [ + 'out/obj', '.*/(gen|obj[^/]*)/(include|EXECUTABLES|SHARED_LIBRARIES|' + 'STATIC_LIBRARIES|NATIVE_TESTS)/.*: warning:' + ], + ['other', '.*'] # all other unrecognized patterns +] diff --git a/tools/warn/html_writer.py b/tools/warn/html_writer.py new file mode 100644 index 0000000000..b8d3fe6f5d --- /dev/null +++ b/tools/warn/html_writer.py @@ -0,0 +1,673 @@ +# Lint as: python3 +# Copyright (C) 2019 The Android Open Source Project +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +"""Emit warning messages to html or csv files.""" + +# To emit html page of warning messages: +# flags: --byproject, --url, --separator +# Old stuff for static html components: +# html_script_style: static html scripts and styles +# htmlbig: +# dump_stats, dump_html_prologue, dump_html_epilogue: +# emit_buttons: +# dump_fixed +# sort_warnings: +# emit_stats_by_project: +# all_patterns, +# findproject, classify_warning +# dump_html +# +# New dynamic HTML page's static JavaScript data: +# Some data are copied from Python to JavaScript, to generate HTML elements. +# FlagPlatform flags.platform +# FlagURL flags.url, used by 'android' +# FlagSeparator flags.separator, used by 'android' +# SeverityColors: list of colors for all severity levels +# SeverityHeaders: list of headers for all severity levels +# SeverityColumnHeaders: list of column_headers for all severity levels +# ProjectNames: project_names, or project_list[*][0] +# WarnPatternsSeverity: warn_patterns[*]['severity'] +# WarnPatternsDescription: warn_patterns[*]['description'] +# WarningMessages: warning_messages +# Warnings: warning_records +# StatsHeader: warning count table header row +# StatsRows: array of warning count table rows +# +# New dynamic HTML page's dynamic JavaScript data: +# +# New dynamic HTML related function to emit data: +# escape_string, strip_escape_string, emit_warning_arrays +# emit_js_data(): + +from __future__ import print_function +import cgi +import csv +import sys + +# pylint:disable=relative-beyond-top-level +# pylint:disable=g-importing-member +from .severity import Severity + + +html_head_scripts = """\ + <script type="text/javascript"> + function expand(id) { + var e = document.getElementById(id); + var f = document.getElementById(id + "_mark"); + if (e.style.display == 'block') { + e.style.display = 'none'; + f.innerHTML = '⊕'; + } + else { + e.style.display = 'block'; + f.innerHTML = '⊖'; + } + }; + function expandCollapse(show) { + for (var id = 1; ; id++) { + var e = document.getElementById(id + ""); + var f = document.getElementById(id + "_mark"); + if (!e || !f) break; + e.style.display = (show ? 'block' : 'none'); + f.innerHTML = (show ? '⊖' : '⊕'); + } + }; + </script> + <style type="text/css"> + th,td{border-collapse:collapse; border:1px solid black;} + .button{color:blue;font-size:110%;font-weight:bolder;} + .bt{color:black;background-color:transparent;border:none;outline:none; + font-size:140%;font-weight:bolder;} + .c0{background-color:#e0e0e0;} + .c1{background-color:#d0d0d0;} + .t1{border-collapse:collapse; width:100%; border:1px solid black;} + </style> + <script src="https://www.gstatic.com/charts/loader.js"></script> +""" + + +def make_writer(output_stream): + + def writer(text): + return output_stream.write(text + '\n') + + return writer + + +def html_big(param): + return '<font size="+2">' + param + '</font>' + + +def dump_html_prologue(title, writer, warn_patterns, project_names): + writer('<html>\n<head>') + writer('<title>' + title + '</title>') + writer(html_head_scripts) + emit_stats_by_project(writer, warn_patterns, project_names) + writer('</head>\n<body>') + writer(html_big(title)) + writer('<p>') + + +def dump_html_epilogue(writer): + writer('</body>\n</head>\n</html>') + + +def sort_warnings(warn_patterns): + for i in warn_patterns: + i['members'] = sorted(set(i['members'])) + + +def create_warnings(warn_patterns, project_names): + """Creates warnings s.t. + + warnings[p][s] is as specified in above docs. + + Args: + warn_patterns: list of warning patterns for specified platform + project_names: list of project names + + Returns: + 2D warnings array where warnings[p][s] is # of warnings in project name p of + severity level s + """ + # pylint:disable=g-complex-comprehension + warnings = {p: {s.value: 0 for s in Severity.levels} for p in project_names} + for i in warn_patterns: + s = i['severity'].value + for p in i['projects']: + warnings[p][s] += i['projects'][p] + return warnings + + +def get_total_by_project(warnings, project_names): + """Returns dict, project as key and # warnings for that project as value.""" + # pylint:disable=g-complex-comprehension + return { + p: sum(warnings[p][s.value] for s in Severity.levels) + for p in project_names + } + + +def get_total_by_severity(warnings, project_names): + """Returns dict, severity as key and # warnings of that severity as value.""" + # pylint:disable=g-complex-comprehension + return { + s.value: sum(warnings[p][s.value] for p in project_names) + for s in Severity.levels + } + + +def emit_table_header(total_by_severity): + """Returns list of HTML-formatted content for severity stats.""" + + stats_header = ['Project'] + for s in Severity.levels: + if total_by_severity[s.value]: + stats_header.append( + '<span style=\'background-color:{}\'>{}</span>'.format( + s.color, s.column_header)) + stats_header.append('TOTAL') + return stats_header + + +def emit_row_counts_per_project(warnings, total_by_project, total_by_severity, + project_names): + """Returns total project warnings and row of stats for each project. + + Args: + warnings: output of create_warnings(warn_patterns, project_names) + total_by_project: output of get_total_by_project(project_names) + total_by_severity: output of get_total_by_severity(project_names) + project_names: list of project names + + Returns: + total_all_projects, the total number of warnings over all projects + stats_rows, a 2d list where each row is [Project Name, <severity counts>, + total # warnings for this project] + """ + + total_all_projects = 0 + stats_rows = [] + for p in project_names: + if total_by_project[p]: + one_row = [p] + for s in Severity.levels: + if total_by_severity[s.value]: + one_row.append(warnings[p][s.value]) + one_row.append(total_by_project[p]) + stats_rows.append(one_row) + total_all_projects += total_by_project[p] + return total_all_projects, stats_rows + + +def emit_row_counts_per_severity(total_by_severity, stats_header, stats_rows, + total_all_projects, writer): + """Emits stats_header and stats_rows as specified above. + + Args: + total_by_severity: output of get_total_by_severity() + stats_header: output of emit_table_header() + stats_rows: output of emit_row_counts_per_project() + total_all_projects: output of emit_row_counts_per_project() + writer: writer returned by make_writer(output_stream) + """ + + total_all_severities = 0 + one_row = ['<b>TOTAL</b>'] + for s in Severity.levels: + if total_by_severity[s.value]: + one_row.append(total_by_severity[s.value]) + total_all_severities += total_by_severity[s.value] + one_row.append(total_all_projects) + stats_rows.append(one_row) + writer('<script>') + emit_const_string_array('StatsHeader', stats_header, writer) + emit_const_object_array('StatsRows', stats_rows, writer) + writer(draw_table_javascript) + writer('</script>') + + +def emit_stats_by_project(writer, warn_patterns, project_names): + """Dump a google chart table of warnings per project and severity.""" + + warnings = create_warnings(warn_patterns, project_names) + total_by_project = get_total_by_project(warnings, project_names) + total_by_severity = get_total_by_severity(warnings, project_names) + stats_header = emit_table_header(total_by_severity) + total_all_projects, stats_rows = \ + emit_row_counts_per_project(warnings, total_by_project, total_by_severity, project_names) + emit_row_counts_per_severity(total_by_severity, stats_header, stats_rows, + total_all_projects, writer) + + +def dump_stats(writer, warn_patterns): + """Dump some stats about total number of warnings and such.""" + + known = 0 + skipped = 0 + unknown = 0 + sort_warnings(warn_patterns) + for i in warn_patterns: + if i['severity'] == Severity.UNMATCHED: + unknown += len(i['members']) + elif i['severity'] == Severity.SKIP: + skipped += len(i['members']) + else: + known += len(i['members']) + writer('Number of classified warnings: <b>' + str(known) + '</b><br>') + writer('Number of skipped warnings: <b>' + str(skipped) + '</b><br>') + writer('Number of unclassified warnings: <b>' + str(unknown) + '</b><br>') + total = unknown + known + skipped + extra_msg = '' + if total < 1000: + extra_msg = ' (low count may indicate incremental build)' + writer('Total number of warnings: <b>' + str(total) + '</b>' + extra_msg) + + +# New base table of warnings, [severity, warn_id, project, warning_message] +# Need buttons to show warnings in different grouping options. +# (1) Current, group by severity, id for each warning pattern +# sort by severity, warn_id, warning_message +# (2) Current --byproject, group by severity, +# id for each warning pattern + project name +# sort by severity, warn_id, project, warning_message +# (3) New, group by project + severity, +# id for each warning pattern +# sort by project, severity, warn_id, warning_message +def emit_buttons(writer): + writer('<button class="button" onclick="expandCollapse(1);">' + 'Expand all warnings</button>\n' + '<button class="button" onclick="expandCollapse(0);">' + 'Collapse all warnings</button>\n' + '<button class="button" onclick="groupBySeverity();">' + 'Group warnings by severity</button>\n' + '<button class="button" onclick="groupByProject();">' + 'Group warnings by project</button><br>') + + +def all_patterns(category): + patterns = '' + for i in category['patterns']: + patterns += i + patterns += ' / ' + return patterns + + +def dump_fixed(writer, warn_patterns): + """Show which warnings no longer occur.""" + anchor = 'fixed_warnings' + mark = anchor + '_mark' + writer('\n<br><p style="background-color:lightblue"><b>' + '<button id="' + mark + '" ' + 'class="bt" onclick="expand(\'' + anchor + '\');">' + '⊕</button> Fixed warnings. ' + 'No more occurrences. Please consider turning these into ' + 'errors if possible, before they are reintroduced in to the build' + ':</b></p>') + writer('<blockquote>') + fixed_patterns = [] + for i in warn_patterns: + if not i['members']: + fixed_patterns.append(i['description'] + ' (' + all_patterns(i) + ')') + fixed_patterns = sorted(fixed_patterns) + writer('<div id="' + anchor + '" style="display:none;"><table>') + cur_row_class = 0 + for text in fixed_patterns: + cur_row_class = 1 - cur_row_class + # remove last '\n' + t = text[:-1] if text[-1] == '\n' else text + writer('<tr><td class="c' + str(cur_row_class) + '">' + t + '</td></tr>') + writer('</table></div>') + writer('</blockquote>') + + +def write_severity(csvwriter, sev, kind, warn_patterns): + """Count warnings of given severity and write CSV entries to writer.""" + total = 0 + for pattern in warn_patterns: + if pattern['severity'] == sev and pattern['members']: + n = len(pattern['members']) + total += n + warning = kind + ': ' + (pattern['description'] or '?') + csvwriter.writerow([n, '', warning]) + # print number of warnings for each project, ordered by project name + projects = sorted(pattern['projects'].keys()) + for project in projects: + csvwriter.writerow([pattern['projects'][project], project, warning]) + csvwriter.writerow([total, '', kind + ' warnings']) + return total + + +def dump_csv(csvwriter, warn_patterns): + """Dump number of warnings in CSV format to writer.""" + sort_warnings(warn_patterns) + total = 0 + for s in Severity.levels: + total += write_severity(csvwriter, s, s.column_header, warn_patterns) + csvwriter.writerow([total, '', 'All warnings']) + + +# Return s with escaped backslash and quotation characters. +def escape_string(s): + return s.replace('\\', '\\\\').replace('"', '\\"') + + +# Return s without trailing '\n' and escape the quotation characters. +def strip_escape_string(s): + if not s: + return s + s = s[:-1] if s[-1] == '\n' else s + return escape_string(s) + + +def emit_warning_array(name, writer, warn_patterns): + writer('var warning_{} = ['.format(name)) + for w in warn_patterns: + if name == 'severity': + writer('{},'.format(w[name].value)) + else: + writer('{},'.format(w[name])) + writer('];') + + +def emit_warning_arrays(writer, warn_patterns): + emit_warning_array('severity', writer, warn_patterns) + writer('var warning_description = [') + for w in warn_patterns: + if w['members']: + writer('"{}",'.format(escape_string(w['description']))) + else: + writer('"",') # no such warning + writer('];') + + +scripts_for_warning_groups = """ + function compareMessages(x1, x2) { // of the same warning type + return (WarningMessages[x1[2]] <= WarningMessages[x2[2]]) ? -1 : 1; + } + function byMessageCount(x1, x2) { + return x2[2] - x1[2]; // reversed order + } + function bySeverityMessageCount(x1, x2) { + // orer by severity first + if (x1[1] != x2[1]) + return x1[1] - x2[1]; + return byMessageCount(x1, x2); + } + const ParseLinePattern = /^([^ :]+):(\\d+):(.+)/; + function addURL(line) { // used by Android + if (FlagURL == "") return line; + if (FlagSeparator == "") { + return line.replace(ParseLinePattern, + "<a target='_blank' href='" + FlagURL + "/$1'>$1</a>:$2:$3"); + } + return line.replace(ParseLinePattern, + "<a target='_blank' href='" + FlagURL + "/$1" + FlagSeparator + + "$2'>$1:$2</a>:$3"); + } + function addURLToLine(line, link) { // used by Chrome + let line_split = line.split(":"); + let path = line_split.slice(0,3).join(":"); + let msg = line_split.slice(3).join(":"); + let html_link = `<a target="_blank" href="${link}">${path}</a>${msg}`; + return html_link; + } + function createArrayOfDictionaries(n) { + var result = []; + for (var i=0; i<n; i++) result.push({}); + return result; + } + function groupWarningsBySeverity() { + // groups is an array of dictionaries, + // each dictionary maps from warning type to array of warning messages. + var groups = createArrayOfDictionaries(SeverityColors.length); + for (var i=0; i<Warnings.length; i++) { + var w = Warnings[i][0]; + var s = WarnPatternsSeverity[w]; + var k = w.toString(); + if (!(k in groups[s])) + groups[s][k] = []; + groups[s][k].push(Warnings[i]); + } + return groups; + } + function groupWarningsByProject() { + var groups = createArrayOfDictionaries(ProjectNames.length); + for (var i=0; i<Warnings.length; i++) { + var w = Warnings[i][0]; + var p = Warnings[i][1]; + var k = w.toString(); + if (!(k in groups[p])) + groups[p][k] = []; + groups[p][k].push(Warnings[i]); + } + return groups; + } + var GlobalAnchor = 0; + function createWarningSection(header, color, group) { + var result = ""; + var groupKeys = []; + var totalMessages = 0; + for (var k in group) { + totalMessages += group[k].length; + groupKeys.push([k, WarnPatternsSeverity[parseInt(k)], group[k].length]); + } + groupKeys.sort(bySeverityMessageCount); + for (var idx=0; idx<groupKeys.length; idx++) { + var k = groupKeys[idx][0]; + var messages = group[k]; + var w = parseInt(k); + var wcolor = SeverityColors[WarnPatternsSeverity[w]]; + var description = WarnPatternsDescription[w]; + if (description.length == 0) + description = "???"; + GlobalAnchor += 1; + result += "<table class='t1'><tr bgcolor='" + wcolor + "'><td>" + + "<button class='bt' id='" + GlobalAnchor + "_mark" + + "' onclick='expand(\\"" + GlobalAnchor + "\\");'>" + + "⊕</button> " + + description + " (" + messages.length + ")</td></tr></table>"; + result += "<div id='" + GlobalAnchor + + "' style='display:none;'><table class='t1'>"; + var c = 0; + messages.sort(compareMessages); + if (FlagPlatform == "chrome") { + for (var i=0; i<messages.length; i++) { + result += "<tr><td class='c" + c + "'>" + + addURLToLine(WarningMessages[messages[i][2]], WarningLinks[messages[i][3]]) + "</td></tr>"; + c = 1 - c; + } + } else { + for (var i=0; i<messages.length; i++) { + result += "<tr><td class='c" + c + "'>" + + addURL(WarningMessages[messages[i][2]]) + "</td></tr>"; + c = 1 - c; + } + } + result += "</table></div>"; + } + if (result.length > 0) { + return "<br><span style='background-color:" + color + "'><b>" + + header + ": " + totalMessages + + "</b></span><blockquote><table class='t1'>" + + result + "</table></blockquote>"; + + } + return ""; // empty section + } + function generateSectionsBySeverity() { + var result = ""; + var groups = groupWarningsBySeverity(); + for (s=0; s<SeverityColors.length; s++) { + result += createWarningSection(SeverityHeaders[s], SeverityColors[s], + groups[s]); + } + return result; + } + function generateSectionsByProject() { + var result = ""; + var groups = groupWarningsByProject(); + for (i=0; i<groups.length; i++) { + result += createWarningSection(ProjectNames[i], 'lightgrey', groups[i]); + } + return result; + } + function groupWarnings(generator) { + GlobalAnchor = 0; + var e = document.getElementById("warning_groups"); + e.innerHTML = generator(); + } + function groupBySeverity() { + groupWarnings(generateSectionsBySeverity); + } + function groupByProject() { + groupWarnings(generateSectionsByProject); + } +""" + + +# Emit a JavaScript const string +def emit_const_string(name, value, writer): + writer('const ' + name + ' = "' + escape_string(value) + '";') + + +# Emit a JavaScript const integer array. +def emit_const_int_array(name, array, writer): + writer('const ' + name + ' = [') + for n in array: + writer(str(n) + ',') + writer('];') + + +# Emit a JavaScript const string array. +def emit_const_string_array(name, array, writer): + writer('const ' + name + ' = [') + for s in array: + writer('"' + strip_escape_string(s) + '",') + writer('];') + + +# Emit a JavaScript const string array for HTML. +def emit_const_html_string_array(name, array, writer): + writer('const ' + name + ' = [') + for s in array: + # Not using html.escape yet, to work for both python 2 and 3, + # until all users switch to python 3. + # pylint:disable=deprecated-method + writer('"' + cgi.escape(strip_escape_string(s)) + '",') + writer('];') + + +# Emit a JavaScript const object array. +def emit_const_object_array(name, array, writer): + writer('const ' + name + ' = [') + for x in array: + writer(str(x) + ',') + writer('];') + + +def emit_js_data(writer, flags, warning_messages, warning_links, + warning_records, warn_patterns, project_names): + """Dump dynamic HTML page's static JavaScript data.""" + emit_const_string('FlagPlatform', flags.platform, writer) + emit_const_string('FlagURL', flags.url, writer) + emit_const_string('FlagSeparator', flags.separator, writer) + emit_const_string_array('SeverityColors', [s.color for s in Severity.levels], + writer) + emit_const_string_array('SeverityHeaders', + [s.header for s in Severity.levels], writer) + emit_const_string_array('SeverityColumnHeaders', + [s.column_header for s in Severity.levels], writer) + emit_const_string_array('ProjectNames', project_names, writer) + # pytype: disable=attribute-error + emit_const_int_array('WarnPatternsSeverity', + [w['severity'].value for w in warn_patterns], writer) + # pytype: enable=attribute-error + emit_const_html_string_array('WarnPatternsDescription', + [w['description'] for w in warn_patterns], + writer) + emit_const_html_string_array('WarningMessages', warning_messages, writer) + emit_const_object_array('Warnings', warning_records, writer) + if flags.platform == 'chrome': + emit_const_html_string_array('WarningLinks', warning_links, writer) + + +draw_table_javascript = """ +google.charts.load('current', {'packages':['table']}); +google.charts.setOnLoadCallback(drawTable); +function drawTable() { + var data = new google.visualization.DataTable(); + data.addColumn('string', StatsHeader[0]); + for (var i=1; i<StatsHeader.length; i++) { + data.addColumn('number', StatsHeader[i]); + } + data.addRows(StatsRows); + for (var i=0; i<StatsRows.length; i++) { + for (var j=0; j<StatsHeader.length; j++) { + data.setProperty(i, j, 'style', 'border:1px solid black;'); + } + } + var table = new google.visualization.Table( + document.getElementById('stats_table')); + table.draw(data, {allowHtml: true, alternatingRowStyle: true}); +} +""" + + +def dump_html(flags, output_stream, warning_messages, warning_links, + warning_records, header_str, warn_patterns, project_names): + """Dump the flags output to output_stream.""" + writer = make_writer(output_stream) + dump_html_prologue('Warnings for ' + header_str, writer, warn_patterns, + project_names) + dump_stats(writer, warn_patterns) + writer('<br><div id="stats_table"></div><br>') + writer('\n<script>') + emit_js_data(writer, flags, warning_messages, warning_links, warning_records, + warn_patterns, project_names) + writer(scripts_for_warning_groups) + writer('</script>') + emit_buttons(writer) + # Warning messages are grouped by severities or project names. + writer('<br><div id="warning_groups"></div>') + if flags.byproject: + writer('<script>groupByProject();</script>') + else: + writer('<script>groupBySeverity();</script>') + dump_fixed(writer, warn_patterns) + dump_html_epilogue(writer) + + +def write_html(flags, project_names, warn_patterns, html_path, warning_messages, + warning_links, warning_records, header_str): + """Write warnings html file.""" + if html_path: + with open(html_path, 'w') as f: + dump_html(flags, f, warning_messages, warning_links, warning_records, + header_str, warn_patterns, project_names) + + +def write_out_csv(flags, warn_patterns, warning_messages, warning_links, + warning_records, header_str, project_names): + """Write warnings csv file.""" + if flags.csvpath: + with open(flags.csvpath, 'w') as f: + dump_csv(csv.writer(f, lineterminator='\n'), warn_patterns) + + if flags.gencsv: + dump_csv(csv.writer(sys.stdout, lineterminator='\n'), warn_patterns) + else: + dump_html(flags, sys.stdout, warning_messages, warning_links, + warning_records, header_str, warn_patterns, project_names) diff --git a/tools/warn/java_warn_patterns.py b/tools/warn/java_warn_patterns.py index 80e2e1d5cf..17e3864daf 100644 --- a/tools/warn/java_warn_patterns.py +++ b/tools/warn/java_warn_patterns.py @@ -16,8 +16,8 @@ """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 .cpp_warn_patterns import compile_patterns from .severity import Severity @@ -485,16 +485,24 @@ warn_patterns = [ java_medium('Static method should be qualified', [r'.*\.java:.*: warning: \[static\] static method should be qualified']), medium('AbstractInner'), + medium('BothPackageInfoAndHtml'), medium('CallbackName'), medium('ExecutorRegistration'), + medium('HiddenTypeParameter'), medium('JavaApiUsedByMainlineModule'), medium('ListenerLast'), + medium('MinMaxConstant'), medium('MissingBuildMethod'), medium('NoByteOrShort'), medium('OverlappingConstants'), medium('SetterReturnsThis'), + medium('StreamFiles'), medium('Typo'), medium('UseIcu'), + medium('fallthrough'), + medium('overrides'), + medium('serial'), + medium('try'), high('AndroidInjectionBeforeSuper', 'AndroidInjection.inject() should always be invoked before calling super.lifecycleMethod()'), high('AndroidJdkLibsChecker', @@ -783,6 +791,8 @@ warn_patterns = [ # Other javac tool warnings java_medium('addNdkApiCoverage failed to getPackage', [r".*: warning: addNdkApiCoverage failed to getPackage"]), + java_medium('bad path element', + [r".*: warning: \[path\] bad path element .*\.jar"]), java_medium('Supported version from annotation processor', [r".*: warning: Supported source version .+ from annotation processor"]), ] diff --git a/tools/warn/make_warn_patterns.py b/tools/warn/make_warn_patterns.py index dd6a1b0419..4b20493ba1 100644 --- a/tools/warn/make_warn_patterns.py +++ b/tools/warn/make_warn_patterns.py @@ -16,8 +16,8 @@ """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 .cpp_warn_patterns import compile_patterns from .severity import Severity warn_patterns = [ diff --git a/tools/warn/other_warn_patterns.py b/tools/warn/other_warn_patterns.py index 1350936cf1..318c3d47f5 100644 --- a/tools/warn/other_warn_patterns.py +++ b/tools/warn/other_warn_patterns.py @@ -16,8 +16,8 @@ """Warning patterns from other tools.""" # pylint:disable=relative-beyond-top-level -from .cpp_warn_patterns import compile_patterns # pylint:disable=g-importing-member +from .cpp_warn_patterns import compile_patterns from .severity import Severity @@ -42,14 +42,20 @@ 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 kotlin(description, pattern): + return warn('Kotlin', Severity.MEDIUM, description, + [r'.*\.kt:.*: warning: ' + pattern]) def yacc(description, pattern_list): return warn('yacc', Severity.MEDIUM, description, pattern_list) +def rust(severity, description, pattern): + return warn('Rust', severity, description, + [r'.*\.rs:.*: warning: ' + pattern]) + + warn_patterns = [ # pylint:disable=line-too-long,g-inconsistent-quotes # aapt warnings @@ -109,26 +115,31 @@ warn_patterns = [ '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('never used parameter or variable', '.+ \'.*\' is never used'), + kotlin('multiple labels', '.+ more than one label .+ in this scope'), + kotlin('type mismatch', 'type mismatch: '), + kotlin('is always true', '.+ is always \'true\''), + kotlin('no effect', '.+ annotation has no effect for '), + kotlin('no cast needed', 'no cast needed'), + kotlin('accessor not generated', 'an accessor will not be generated '), + kotlin('initializer is redundant', '.* initializer is redundant$'), kotlin('elvis operator always returns ...', - [r".*\.kt:.*: warning: elvis operator \(\?:\) always returns .+"]), - kotlin('shadowed name', - [r".*\.kt:.*: warning: name shadowed: .+"]), - kotlin('unchecked cast', - [r".*\.kt:.*: warning: unchecked cast: .* to .*$"]), + 'elvis operator (?:) always returns .+'), + kotlin('shadowed name', 'name shadowed: .+'), + kotlin('unchecked cast', 'unchecked cast: .* to .*$'), + kotlin('unreachable code', 'unreachable code'), + kotlin('unnecessary assertion', 'unnecessary .+ assertion .+'), kotlin('unnecessary safe call on a non-null receiver', - [r".*\.kt:.*: warning: unnecessary safe call on a non-null receiver"]), + 'unnecessary safe call on a non-null receiver'), kotlin('Deprecated in Java', - [r".*\.kt:.*: warning: '.*' is deprecated. Deprecated in Java"]), + '\'.*\' is deprecated. Deprecated in Java'), kotlin('Replacing Handler for Executor', - [r".*\.kt:.*: warning: .+ Replacing Handler for Executor in "]), + '.+ 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"]), + '.+ has Kotlin runtime (bundled|library)'), + warn('Kotlin', Severity.MEDIUM, 'bundled Kotlin runtime', + ['.*warning: .+ (has|have the) Kotlin (runtime|Runtime library) bundled']), + kotlin('other warnings', '.+'), # catch all other Kotlin warnings # Yacc warnings yacc('deprecate directive', [r".*\.yy?:.*: warning: deprecated directive: "]), @@ -138,15 +149,20 @@ warn_patterns = [ '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"]}, + rust(Severity.HIGH, 'Does not derive Copy', '.+ does not derive Copy'), + rust(Severity.MEDIUM, '... are deprecated', + ('(.+ are deprecated$|' + + 'use of deprecated item .* (use .* instead|is now preferred))')), + rust(Severity.MEDIUM, 'never used', '.* is never used:'), + rust(Severity.MEDIUM, 'unused import', 'unused import: '), + rust(Severity.MEDIUM, 'unnecessary attribute', + '.+ no longer requires an attribute'), + rust(Severity.MEDIUM, 'unnecessary parentheses', + 'unnecessary parentheses around'), + # Catch all RenderScript warnings + {'category': 'RenderScript', 'severity': Severity.LOW, + 'description': 'RenderScript warnings', + 'patterns': [r'.*\.rscript:.*: warning: ']}, # Broken/partial warning messages will be skipped. {'category': 'Misc', 'severity': Severity.SKIP, 'description': 'skip, ,', diff --git a/tools/warn/severity.py b/tools/warn/severity.py index b1c38e4a37..b4c03c9efe 100644 --- a/tools/warn/severity.py +++ b/tools/warn/severity.py @@ -20,24 +20,26 @@ 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 - class SeverityInfo: - def __init__(self, value, color, column_header, header): - self.value = value - self.color = color - self.column_header = column_header - self.header = header +# pylint:disable=old-style-class +class Severity: + """Class of Severity levels where each level is a SeverityInfo.""" # SEVERITY_UNKNOWN should never occur since every warn_pattern listed has # a specified severity. It exists for protobuf, the other values must # map to non-zero values (since 0 is reserved for a default UNKNOWN), but # logic in clang_tidy_warn.py assumes severity level values are consecutive # ints starting with 0. - SEVERITY_UNKNOWN = SeverityInfo(0, 'blueviolet', 'Errors of unknown severity', - 'Unknown severity (should not occur)') + SEVERITY_UNKNOWN = SeverityInfo(0, 'blueviolet', 'Unknown', + 'Unknown-severity warnings)') FIXMENOW = SeverityInfo(1, 'fuschia', 'FixNow', 'Critical warnings, fix me now') HIGH = SeverityInfo(2, 'red', 'High', 'High severity warnings') diff --git a/tools/warn/tidy_warn_patterns.py b/tools/warn/tidy_warn_patterns.py index 2c5ab79bd4..5416cb23d7 100644 --- a/tools/warn/tidy_warn_patterns.py +++ b/tools/warn/tidy_warn_patterns.py @@ -16,8 +16,8 @@ """Warning patterns for clang-tidy.""" # pylint:disable=relative-beyond-top-level -from .cpp_warn_patterns import compile_patterns # pylint:disable=g-importing-member +from .cpp_warn_patterns import compile_patterns from .severity import Severity @@ -78,6 +78,7 @@ warn_patterns = [ group_tidy_warn_pattern('android'), simple_tidy_warn_pattern('abseil-string-find-startswith'), simple_tidy_warn_pattern('bugprone-argument-comment'), + simple_tidy_warn_pattern('bugprone-branch-clone'), simple_tidy_warn_pattern('bugprone-copy-constructor-init'), simple_tidy_warn_pattern('bugprone-fold-init-type'), simple_tidy_warn_pattern('bugprone-forward-declaration-namespace'), @@ -89,6 +90,9 @@ warn_patterns = [ simple_tidy_warn_pattern('bugprone-macro-parentheses'), simple_tidy_warn_pattern('bugprone-misplaced-widening-cast'), simple_tidy_warn_pattern('bugprone-move-forwarding-reference'), + simple_tidy_warn_pattern('bugprone-parent-virtual-call'), + simple_tidy_warn_pattern('bugprone-posix-return'), + simple_tidy_warn_pattern('bugprone-sizeof-container'), simple_tidy_warn_pattern('bugprone-sizeof-expression'), simple_tidy_warn_pattern('bugprone-string-constructor'), simple_tidy_warn_pattern('bugprone-string-integer-assignment'), @@ -96,10 +100,25 @@ warn_patterns = [ simple_tidy_warn_pattern('bugprone-suspicious-missing-comma'), simple_tidy_warn_pattern('bugprone-suspicious-string-compare'), simple_tidy_warn_pattern('bugprone-suspicious-semicolon'), + simple_tidy_warn_pattern('bugprone-terminating-continue'), + simple_tidy_warn_pattern('bugprone-too-small-loop-variable'), simple_tidy_warn_pattern('bugprone-undefined-memory-manipulation'), + simple_tidy_warn_pattern('bugprone-unhandled-self-assignment'), simple_tidy_warn_pattern('bugprone-unused-raii'), + simple_tidy_warn_pattern('bugprone-unused-return-value'), simple_tidy_warn_pattern('bugprone-use-after-move'), group_tidy_warn_pattern('bugprone'), + simple_tidy_warn_pattern('cert-dcl16-c'), + simple_tidy_warn_pattern('cert-dcl21-cpp'), + simple_tidy_warn_pattern('cert-dcl50-cpp'), + simple_tidy_warn_pattern('cert-dcl54-cpp'), + simple_tidy_warn_pattern('cert-dcl59-cpp'), + simple_tidy_warn_pattern('cert-env33-c'), + simple_tidy_warn_pattern('cert-err34-c'), + simple_tidy_warn_pattern('cert-err52-cpp'), + simple_tidy_warn_pattern('cert-msc30-c'), + simple_tidy_warn_pattern('cert-msc50-cpp'), + simple_tidy_warn_pattern('cert-oop54-cpp'), group_tidy_warn_pattern('cert'), group_tidy_warn_pattern('clang-diagnostic'), group_tidy_warn_pattern('cppcoreguidelines'), diff --git a/tools/warn/warn.py b/tools/warn/warn.py index bdfd489847..56e8787d99 100755 --- a/tools/warn/warn.py +++ b/tools/warn/warn.py @@ -17,21 +17,51 @@ """Simple wrapper to run warn_common with Python standard Pool.""" import multiprocessing +import signal +import sys # pylint:disable=relative-beyond-top-level -# pylint:disable=g-importing-member -from .warn_common import common_main +from . import warn_common as common -# This parallel_process could be changed depending on platform -# and availability of multi-process library functions. -def parallel_process(num_cpu, classify_warnings, groups): +def classify_warnings(args): + """Classify a list of warning lines. + + Args: + args: dictionary { + 'group': list of (warning, link), + 'project_patterns': re.compile(project_list[p][1]), + 'warn_patterns': list of warn_pattern, + 'num_processes': number of processes being used for multiprocessing } + Returns: + results: a list of the classified warnings. + """ + results = [] + for line, link in args['group']: + common.classify_one_warning(line, link, results, args['project_patterns'], + args['warn_patterns']) + + # After the main work, ignore all other signals to a child process, + # to avoid bad warning/error messages from the exit clean-up process. + if args['num_processes'] > 1: + signal.signal(signal.SIGTERM, lambda *args: sys.exit(-signal.SIGTERM)) + return results + + +def create_and_launch_subprocesses(num_cpu, classify_warnings_fn, arg_groups, + group_results): pool = multiprocessing.Pool(num_cpu) - return pool.map(classify_warnings, groups) + for cpu in range(num_cpu): + proc_result = pool.map(classify_warnings_fn, arg_groups[cpu]) + if proc_result is not None: + group_results.append(proc_result) + return group_results def main(): - common_main(parallel_process) + use_google3 = False + common.common_main(use_google3, create_and_launch_subprocesses, + classify_warnings) if __name__ == '__main__': diff --git a/tools/warn/warn_common.py b/tools/warn/warn_common.py index 0c9d9efbbd..68ed995c00 100755 --- a/tools/warn/warn_common.py +++ b/tools/warn/warn_common.py @@ -18,6 +18,8 @@ Default is to output warnings in HTML tables grouped by warning severity. Use option --byproject to output tables grouped by source file projects. Use option --gencsv to output warning counts in CSV format. + +Default input file is build.log, which can be changed with the --log flag. """ # List of important data structures and functions in this script. @@ -36,431 +38,203 @@ Use option --gencsv to output warning counts in CSV format. # project_patterns[p] re.compile(project_list[p][1]) # project_names[p] project_list[p][0] # warning_messages array of each warning message, without source url +# warning_links array of each warning code search link; for 'chrome' # warning_records array of [idx to warn_patterns, # idx to project_names, -# idx to warning_messages] -# android_root -# platform_version -# target_product -# target_variant +# idx to warning_messages, +# idx to warning_links] # 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 +from . import android_project_list +from . import chrome_project_list +from . import cpp_warn_patterns as cpp_patterns +from . import html_writer +from . import java_warn_patterns as java_patterns +from . import make_warn_patterns as make_patterns +from . import other_warn_patterns as other_patterns +from . import tidy_warn_patterns as tidy_patterns + + +def parse_args(use_google3): + """Define and parse the args. Return the parse_args() result.""" + parser = argparse.ArgumentParser( + description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter) + parser.add_argument('--capacitor_path', default='', + help='Save capacitor warning file to the passed absolute' + ' path') + # csvpath has a different naming than the above path because historically the + # original Android script used csvpath, so other scripts rely on it + parser.add_argument('--csvpath', default='', + help='Save CSV warning file to the passed path') + parser.add_argument('--gencsv', action='store_true', + help='Generate CSV file with number of various warnings') + parser.add_argument('--byproject', action='store_true', + help='Separate warnings in HTML output by project names') + parser.add_argument('--url', default='', + help='Root URL of an Android source code tree prefixed ' + 'before files in warnings') + parser.add_argument('--separator', default='?l=', + help='Separator between the end of a URL and the line ' + 'number argument. e.g. #') + parser.add_argument('--processes', default=multiprocessing.cpu_count(), + type=int, + help='Number of parallel processes to process warnings') + # Old Android build scripts call warn.py without --platform, + # so the default platform is set to 'android'. + parser.add_argument('--platform', default='android', + choices=['chrome', 'android'], + help='Platform of the build log') + # Old Android build scripts call warn.py with only a build.log file path. + parser.add_argument('--log', help='Path to build log file') + parser.add_argument(dest='buildlog', metavar='build.log', + default='build.log', nargs='?', + help='Path to build.log file') + flags = parser.parse_args() + if not flags.log: + flags.log = flags.buildlog + if not use_google3 and not os.path.exists(flags.log): + sys.exit('Cannot find log file: ' + flags.log) + return flags + + +def get_project_names(project_list): + """Get project_names from project_list.""" + return [p[0] for p in project_list] + + +def find_project_index(line, project_patterns): + for i, p in enumerate(project_patterns): + if p.match(line): + return i return -1 -def classify_one_warning(line, results): +def classify_one_warning(warning, link, results, project_patterns, + warn_patterns): """Classify one warning line.""" - for i in range(len(warn_patterns)): - w = warn_patterns[i] + for i, w in enumerate(warn_patterns): for cpat in w['compiled_patterns']: - # pytype: disable=attribute-error - if cpat.match(line): - p = find_project_index(line) - results.append([line, i, p]) + if cpat.match(warning): + p = find_project_index(warning, project_patterns) + results.append([warning, link, i, p]) return else: # If we end up here, there was a problem parsing the log # probably caused by 'make -j' mixing the output from # 2 or more concurrent compiles pass - # 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 remove_prefix(s, sub): + """Remove everything before last occurrence of substring sub in string s.""" + if sub in s: + inc_sub = s.rfind(sub) + return s[inc_sub:] + return s + + +# TODO(emmavukelj): Don't have any generate_*_cs_link functions call +# normalize_path a second time (the first time being in parse_input_file) +def generate_cs_link(warning_line, flags, android_root=None): + if flags.platform == 'chrome': + return generate_chrome_cs_link(warning_line, flags) + if flags.platform == 'android': + return generate_android_cs_link(warning_line, flags, android_root) + return 'https://cs.corp.google.com/' + + +def generate_android_cs_link(warning_line, flags, android_root): + """Generate the code search link for a warning line in Android.""" + # max_splits=2 -> only 3 items + raw_path, line_number_str, _ = warning_line.split(':', 2) + normalized_path = normalize_path(raw_path, flags, android_root) + if not flags.url: + return normalized_path + link_path = flags.url + '/' + normalized_path + if line_number_str.isdigit(): + link_path += flags.separator + line_number_str + return link_path + + +def generate_chrome_cs_link(warning_line, flags): + """Generate the code search link for a warning line in Chrome.""" + split_line = warning_line.split(':') + raw_path = split_line[0] + normalized_path = normalize_path(raw_path, flags) + link_base = 'https://cs.chromium.org/' + link_add = 'chromium' + link_path = None + + # Basically just going through a few specific directory cases and specifying + # the proper behavior for that case. This list of cases was accumulated + # through trial and error manually going through the warnings. + # + # This code pattern of using case-specific "if"s instead of "elif"s looks + # possibly accidental and mistaken but it is intentional because some paths + # fall under several cases (e.g. third_party/lib/nghttp2_frame.c) and for + # those we want the most specific case to be applied. If there is reliable + # knowledge of exactly where these occur, this could be changed to "elif"s + # but there is no reliable set of paths falling under multiple cases at the + # moment. + if '/src/third_party' in raw_path: + link_path = remove_prefix(raw_path, '/src/third_party/') + if '/chrome_root/src_internal/' in raw_path: + link_path = remove_prefix(raw_path, '/chrome_root/src_internal/') + link_path = link_path[len('/chrome_root'):] # remove chrome_root + if '/chrome_root/src/' in raw_path: + link_path = remove_prefix(raw_path, '/chrome_root/src/') + link_path = link_path[len('/chrome_root'):] # remove chrome_root + if '/libassistant/' in raw_path: + link_add = 'eureka_internal/chromium/src' + link_base = 'https://cs.corp.google.com/' # internal data + link_path = remove_prefix(normalized_path, '/libassistant/') + if raw_path.startswith('gen/'): + link_path = '/src/out/Debug/gen/' + normalized_path + if '/gen/' in raw_path: + return '%s?q=file:%s' % (link_base, remove_prefix(normalized_path, '/gen/')) + + if not link_path and (raw_path.startswith('src/') or + raw_path.startswith('src_internal/')): + link_path = '/%s' % raw_path + + if not link_path: # can't find specific link, send a query + return '%s?q=file:%s' % (link_base, normalized_path) + + line_number = int(split_line[1]) + link = '%s%s%s?l=%d' % (link_base, link_add, link_path, line_number) + return link def find_warn_py_and_android_root(path): - """Set and return android_root path if it is found.""" - global android_root + """Return android source root path if warn.py is found.""" parts = path.split('/') for idx in reversed(range(2, len(parts))): root_path = '/'.join(parts[:idx]) # Android root directory should contain this script. if os.path.exists(root_path + '/build/make/tools/warn.py'): - android_root = root_path - return True - return False + return root_path + return '' -def find_android_root(): - """Guess android_root from common prefix of file paths.""" +def find_android_root(buildlog): + """Guess android source root from common prefix of file paths.""" # Use the longest common prefix of the absolute file paths # of the first 10000 warning messages as the android_root. - global android_root - warning_lines = set() + warning_lines = [] warning_pattern = re.compile('^/[^ ]*/[^ ]*: warning: .*') count = 0 - infile = io.open(args.buildlog, mode='r', encoding='utf-8') - for line in infile: + for line in buildlog: if warning_pattern.match(line): - warning_lines.add(line) + warning_lines.append(line) count += 1 if count > 9999: break @@ -468,56 +242,110 @@ def find_android_root(): # the source tree root. if count < 100: path = os.path.normpath(re.sub(':.*$', '', line)) - if find_warn_py_and_android_root(path): - return + android_root = find_warn_py_and_android_root(path) + if android_root: + return android_root # Do not use common prefix of a small number of paths. if count > 10: # pytype: disable=wrong-arg-types root_path = os.path.commonprefix(warning_lines) # pytype: enable=wrong-arg-types if len(root_path) > 2 and root_path[len(root_path) - 1] == '/': - android_root = root_path[:-1] + return root_path[:-1] + return '' -def remove_android_root_prefix(path): +def remove_android_root_prefix(path, android_root): """Remove android_root prefix from path if it is found.""" if path.startswith(android_root): return path[1 + len(android_root):] - else: - return path + return path -def normalize_path(path): - """Normalize file path relative to android_root.""" - # If path is not an absolute path, just normalize it. +def normalize_path(path, flags, android_root=None): + """Normalize file path relative to src/ or src-internal/ directory.""" path = os.path.normpath(path) + + if flags.platform == 'android': + if android_root: + return remove_android_root_prefix(path, android_root) + return path + # Remove known prefix of root path and normalize the suffix. - if path[0] == '/' and android_root: - return remove_android_root_prefix(path) - return path + idx = path.find('chrome_root/') + if idx >= 0: + # remove chrome_root/, we want path relative to that + return path[idx + len('chrome_root/'):] + else: + return path -def normalize_warning_line(line): - """Normalize file path relative to android_root in a warning line.""" - # replace fancy quotes with plain ol' quotes +def normalize_warning_line(line, flags, android_root=None): + """Normalize file path relative to src directory in a warning line.""" line = re.sub(u'[\u2018\u2019]', '\'', line) # replace non-ASCII chars to spaces line = re.sub(u'[^\x00-\x7f]', ' ', line) line = line.strip() first_column = line.find(':') - if first_column > 0: - return normalize_path(line[:first_column]) + line[first_column:] - else: - return line + return normalize_path(line[:first_column], flags, + android_root) + line[first_column:] -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 +def parse_input_file_chrome(infile, flags): + """Parse Chrome input file, collect parameters and warning lines.""" + platform_version = 'unknown' + board_name = 'unknown' + architecture = 'unknown' + + # only handle warning lines of format 'file_path:line_no:col_no: warning: ...' + chrome_warning_pattern = r'^[^ ]*/[^ ]*:[0-9]+:[0-9]+: warning: .*' + + warning_pattern = re.compile(chrome_warning_pattern) + + # Collect all unique warning lines + # Remove the duplicated warnings save ~8% of time when parsing + # one typical build log than before + unique_warnings = dict() + for line in infile: + if warning_pattern.match(line): + normalized_line = normalize_warning_line(line, flags) + if normalized_line not in unique_warnings: + unique_warnings[normalized_line] = generate_cs_link(line, flags) + elif (platform_version == 'unknown' or board_name == 'unknown' or + architecture == 'unknown'): + m = re.match(r'.+Package:.+chromeos-base/chromeos-chrome-', line) + if m is not None: + platform_version = 'R' + line.split('chrome-')[1].split('_')[0] + continue + m = re.match(r'.+Source\sunpacked\sin\s(.+)', line) + if m is not None: + board_name = m.group(1).split('/')[2] + continue + m = re.match(r'.+USE:\s*([^\s]*).*', line) + if m is not None: + architecture = m.group(1) + continue + + header_str = '%s - %s - %s' % (platform_version, board_name, architecture) + return unique_warnings, header_str + + +def add_normalized_line_to_warnings(line, flags, android_root, unique_warnings): + """Parse/normalize path, updating warning line and add to warnings dict.""" + normalized_line = normalize_warning_line(line, flags, android_root) + if normalized_line not in unique_warnings: + unique_warnings[normalized_line] = generate_cs_link(line, flags, + android_root) + return unique_warnings + + +def parse_input_file_android(infile, flags): + """Parse Android input file, collect parameters and warning lines.""" + platform_version = 'unknown' + target_product = 'unknown' + target_variant = 'unknown' + android_root = find_android_root(infile) + infile.seek(0) # rustc warning messages have two lines that should be combined: # warning: description @@ -532,20 +360,25 @@ def parse_input_file(infile): 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() + # Collect all unique warning lines + # Remove the duplicated warnings save ~8% of time when parsing + # one typical build log than before + unique_warnings = dict() + line_counter = 0 prev_warning = '' for line in infile: if prev_warning: if rustc_file_position.match(line): # must be a rustc warning, combine 2 lines into one warning line = line.strip().replace('--> ', '') + ': ' + prev_warning - warning_lines.add(normalize_warning_line(line)) + unique_warnings = add_normalized_line_to_warnings( + line, flags, android_root, unique_warnings) prev_warning = '' continue # add prev_warning, and then process the current line prev_warning = 'unknown_source_file: ' + prev_warning - warning_lines.add(normalize_warning_line(prev_warning)) + unique_warnings = add_normalized_line_to_warnings( + prev_warning, flags, android_root, unique_warnings) prev_warning = '' if warning_pattern.match(line): @@ -553,7 +386,8 @@ def parse_input_file(infile): # save this line and combine it with the next line prev_warning = line else: - warning_lines.add(normalize_warning_line(line)) + unique_warnings = add_normalized_line_to_warnings( + line, flags, android_root, unique_warnings) continue if line_counter < 100: @@ -568,336 +402,182 @@ def parse_input_file(infile): m = re.search('(?<=^TARGET_BUILD_VARIANT=).*', line) if m is not None: target_variant = m.group(0) - m = re.search('.* TOP=([^ ]*) .*', line) + 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); - } -""" + + if android_root: + new_unique_warnings = dict() + for warning_line in unique_warnings: + normalized_line = normalize_warning_line(warning_line, flags, + android_root) + new_unique_warnings[normalized_line] = generate_android_cs_link( + warning_line, flags, android_root) + unique_warnings = new_unique_warnings + + header_str = '%s - %s - %s' % (platform_version, target_product, + target_variant) + return unique_warnings, header_str + + +def parse_input_file(infile, flags): + if flags.platform == 'chrome': + return parse_input_file_chrome(infile, flags) + if flags.platform == 'android': + return parse_input_file_android(infile, flags) + raise RuntimeError('parse_input_file not defined for platform %s' % + flags.platform) + + +def parse_compiler_output(compiler_output): + """Parse compiler output for relevant info.""" + split_output = compiler_output.split(':', 3) # 3 = max splits + file_path = split_output[0] + line_number = int(split_output[1]) + col_number = int(split_output[2].split(' ')[0]) + warning_message = split_output[3] + return file_path, line_number, col_number, warning_message + + +def get_warn_patterns(platform): + """Get and initialize warn_patterns.""" + warn_patterns = [] + if platform == 'chrome': + warn_patterns = cpp_patterns.warn_patterns + elif platform == 'android': + warn_patterns = make_patterns.warn_patterns + cpp_patterns.warn_patterns + java_patterns.warn_patterns + tidy_patterns.warn_patterns + other_patterns.warn_patterns + else: + raise Exception('platform name %s is not valid' % platform) + for w in warn_patterns: + w['members'] = [] + # Each warning pattern has a 'projects' dictionary, that + # maps a project name to number of warnings in that project. + w['projects'] = {} + return warn_patterns -# 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 get_project_list(platform): + """Return project list for appropriate platform.""" + if platform == 'chrome': + return chrome_project_list.project_list + if platform == 'android': + return android_project_list.project_list + raise Exception('platform name %s is not valid' % platform) -def 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>') +def parallel_classify_warnings(warning_data, args, project_names, + project_patterns, warn_patterns, + use_google3, create_launch_subprocs_fn, + classify_warnings_fn): + """Classify all warning lines with num_cpu parallel processes.""" + num_cpu = args.processes + group_results = [] + + if num_cpu > 1: + # set up parallel processing for this... + warning_groups = [[] for _ in range(num_cpu)] + i = 0 + for warning, link in warning_data.items(): + warning_groups[i].append((warning, link)) + i = (i + 1) % num_cpu + arg_groups = [[] for _ in range(num_cpu)] + for i, group in enumerate(warning_groups): + arg_groups[i] = [{ + 'group': group, + 'project_patterns': project_patterns, + 'warn_patterns': warn_patterns, + 'num_processes': num_cpu + }] + + group_results = create_launch_subprocs_fn(num_cpu, + classify_warnings_fn, + arg_groups, + group_results) else: - 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')) + group_results = [] + for warning, link in warning_data.items(): + classify_one_warning(warning, link, group_results, + project_patterns, warn_patterns) + group_results = [group_results] + + warning_messages = [] + warning_links = [] + warning_records = [] + if use_google3: + group_results = [group_results] + for group_result in group_results: + for result in group_result: + for line, link, pattern_idx, project_idx in result: + pattern = warn_patterns[pattern_idx] + pattern['members'].append(line) + message_idx = len(warning_messages) + warning_messages.append(line) + link_idx = len(warning_links) + warning_links.append(link) + warning_records.append([pattern_idx, project_idx, message_idx, + link_idx]) + pname = '???' if project_idx < 0 else project_names[project_idx] + # Count warnings by project. + if pname in pattern['projects']: + pattern['projects'][pname] += 1 + else: + pattern['projects'][pname] = 1 + return warning_messages, warning_links, warning_records + + +def process_log(logfile, flags, project_names, project_patterns, warn_patterns, + html_path, use_google3, create_launch_subprocs_fn, + classify_warnings_fn, logfile_object): + # pylint: disable=g-doc-args + # pylint: disable=g-doc-return-or-yield + """Function that handles processing of a log. + + This is isolated into its own function (rather than just taking place in main) + so that it can be used by both warn.py and the borg job process_gs_logs.py, to + avoid duplication of code. + Note that if the arguments to this function change, process_gs_logs.py must + be updated accordingly. + """ + if logfile_object is None: + with io.open(logfile, encoding='utf-8') as log: + warning_lines_and_links, header_str = parse_input_file(log, flags) else: - dump_html(sys.stdout) + warning_lines_and_links, header_str = parse_input_file( + logfile_object, flags) + warning_messages, warning_links, warning_records = parallel_classify_warnings( + warning_lines_and_links, flags, project_names, project_patterns, + warn_patterns, use_google3, create_launch_subprocs_fn, + classify_warnings_fn) + + html_writer.write_html(flags, project_names, warn_patterns, html_path, + warning_messages, warning_links, warning_records, + header_str) + + return warning_messages, warning_links, warning_records, header_str + + +def common_main(use_google3, create_launch_subprocs_fn, classify_warnings_fn, + logfile_object=None): + """Shared main function for Google3 and non-Google3 versions of warn.py.""" + flags = parse_args(use_google3) + warn_patterns = get_warn_patterns(flags.platform) + project_list = get_project_list(flags.platform) + + project_names = get_project_names(project_list) + project_patterns = [re.compile(p[1]) for p in project_list] + + # html_path=None because we output html below if not outputting CSV + warning_messages, warning_links, warning_records, header_str = process_log( + logfile=flags.log, flags=flags, project_names=project_names, + project_patterns=project_patterns, warn_patterns=warn_patterns, + html_path=None, use_google3=use_google3, + create_launch_subprocs_fn=create_launch_subprocs_fn, + classify_warnings_fn=classify_warnings_fn, + logfile_object=logfile_object) + + html_writer.write_out_csv(flags, warn_patterns, warning_messages, + warning_links, warning_records, header_str, + project_names) + + # Return these values, so that caller can use them, if desired. + return flags, warning_messages, warning_records, warn_patterns diff --git a/tools/zipalign/ZipFile.cpp b/tools/zipalign/ZipFile.cpp index 63fb962767..88505b7508 100644 --- a/tools/zipalign/ZipFile.cpp +++ b/tools/zipalign/ZipFile.cpp @@ -1221,7 +1221,7 @@ class FileReader : public zip_archive::Reader { FileReader(FILE* fp) : Reader(), fp_(fp), current_offset_(0) { } - bool ReadAtOffset(uint8_t* buf, size_t len, uint32_t offset) const { + bool ReadAtOffset(uint8_t* buf, size_t len, off64_t offset) const { // Data is usually requested sequentially, so this helps avoid pointless // fseeks every time we perform a read. There's an impedence mismatch // here because the original API was designed around pread and pwrite. @@ -1244,7 +1244,7 @@ class FileReader : public zip_archive::Reader { private: FILE* fp_; - mutable uint32_t current_offset_; + mutable off64_t current_offset_; }; // free the memory when you're done |