Merge "Revert submission 1182953-1576003954286-8455af5a"
diff --git a/Changes.md b/Changes.md
index 5a0fd23..04e0161 100644
--- a/Changes.md
+++ b/Changes.md
@@ -1,5 +1,23 @@
# Build System Changes for Android.mk Writers
+## Rules executed within limited environment
+
+With `ALLOW_NINJA_ENV=false` (soon to be the default), ninja, and all the
+rules/actions executed within it will only have access to a limited number of
+environment variables. Ninja does not track when environment variables change
+in order to trigger rebuilds, so changing behavior based on arbitrary variables
+is not safe with incremental builds.
+
+Kati and Soong can safely use environment variables, so the expectation is that
+you'd embed any environment variables that you need to use within the command
+line generated by those tools. See the [export section](#export_keyword) below
+for examples.
+
+For a temporary workaround, you can set `ALLOW_NINJA_ENV=true` in your
+environment to restore the previous behavior, or set
+`BUILD_BROKEN_NINJA_USES_ENV_VAR := <var> <var2> ...` in your `BoardConfig.mk`
+to allow specific variables to be passed through until you've fixed the rules.
+
## LOCAL_C_INCLUDES outside the source/output trees are an error {#BUILD_BROKEN_OUTSIDE_INCLUDE_DIRS}
Include directories are expected to be within the source tree (or in the output
@@ -31,7 +49,7 @@
offending line.
-# `BOARD_HAL_STATIC_LIBRARIES` and `LOCAL_HAL_STATIC_LIBRARIES` are obsolete {#BOARD_HAL_STATIC_LIBRARIES}
+## `BOARD_HAL_STATIC_LIBRARIES` and `LOCAL_HAL_STATIC_LIBRARIES` are obsolete {#BOARD_HAL_STATIC_LIBRARIES}
Define proper HIDL / Stable AIDL HAL instead.
diff --git a/core/Makefile b/core/Makefile
index c650022..67d5d3f 100644
--- a/core/Makefile
+++ b/core/Makefile
@@ -3778,6 +3778,7 @@
simg2img \
sload_f2fs \
tune2fs \
+ unpack_bootimg \
update_host_simulator \
validate_target_files \
verity_signer \
diff --git a/core/board_config.mk b/core/board_config.mk
index 00ac0be..b9b4dc2 100644
--- a/core/board_config.mk
+++ b/core/board_config.mk
@@ -98,7 +98,8 @@
BUILD_BROKEN_USES_$(m))
_board_true_false_vars := $(_build_broken_var_list)
-_board_strip_readonly_list += $(_build_broken_var_list)
+_board_strip_readonly_list += $(_build_broken_var_list) \
+ BUILD_BROKEN_NINJA_USES_ENV_VARS
# Conditional to building on linux, as dex2oat currently does not work on darwin.
ifeq ($(HOST_OS),linux)
@@ -109,6 +110,7 @@
# Broken build defaults
# ###############################################################
$(foreach v,$(_build_broken_var_list),$(eval $(v) :=))
+BUILD_BROKEN_NINJA_USES_ENV_VARS :=
# Boards may be defined under $(SRC_TARGET_DIR)/board/$(TARGET_DEVICE)
# or under vendor/*/$(TARGET_DEVICE). Search in both places, but
diff --git a/core/copy_headers.mk b/core/copy_headers.mk
index c26d51d..054d271 100644
--- a/core/copy_headers.mk
+++ b/core/copy_headers.mk
@@ -4,15 +4,13 @@
###########################################################
$(call record-module-type,COPY_HEADERS)
ifneq ($(strip $(LOCAL_IS_HOST_MODULE)),)
- $(shell echo $(LOCAL_MODULE_MAKEFILE): $(LOCAL_MODULE): LOCAL_COPY_HEADERS may not be used with host modules >&2)
- $(error done)
+ $(call pretty-error,LOCAL_COPY_HEADERS may not be used with host modules)
endif
# Modules linking against the SDK do not have the include path to use
# COPY_HEADERS, so prevent them from exporting any either.
ifdef LOCAL_SDK_VERSION
-$(shell echo $(LOCAL_MODULE_MAKEFILE): $(LOCAL_MODULE): Modules using LOCAL_SDK_VERSION may not use LOCAL_COPY_HEADERS >&2)
-$(error done)
+ $(call pretty-error,Modules using LOCAL_SDK_VERSION may not use LOCAL_COPY_HEADERS)
endif
include $(BUILD_SYSTEM)/local_vndk.mk
@@ -22,11 +20,20 @@
# present.
ifdef BOARD_VNDK_VERSION
ifndef LOCAL_USE_VNDK
-$(shell echo $(LOCAL_MODULE_MAKEFILE): $(LOCAL_MODULE): Only vendor modules using LOCAL_USE_VNDK may use LOCAL_COPY_HEADERS >&2)
-$(error done)
+ $(call pretty-error,Only vendor modules using LOCAL_USE_VNDK may use LOCAL_COPY_HEADERS)
endif
endif
+# Clean up LOCAL_COPY_HEADERS_TO, since soong_ui will be comparing cleaned
+# paths to figure out which headers are obsolete and should be removed.
+LOCAL_COPY_HEADERS_TO := $(call clean-path,$(LOCAL_COPY_HEADERS_TO))
+ifneq ($(filter /% .. ../%,$(LOCAL_COPY_HEADERS_TO)),)
+ $(call pretty-error,LOCAL_COPY_HEADERS_TO may not start with / or ../ : $(LOCAL_COPY_HEADERS_TO))
+endif
+ifeq ($(LOCAL_COPY_HEADERS_TO),.)
+ LOCAL_COPY_HEADERS_TO :=
+endif
+
# Create a rule to copy each header, and make the
# all_copied_headers phony target depend on each
# destination header. copy-one-header defines the
diff --git a/core/definitions.mk b/core/definitions.mk
index 63e609e..ff435e2 100644
--- a/core/definitions.mk
+++ b/core/definitions.mk
@@ -108,6 +108,9 @@
# All tests that should be skipped in presubmit check.
ALL_DISABLED_PRESUBMIT_TESTS :=
+# All compatibility suites mentioned in LOCAL_COMPATIBILITY_SUITES
+ALL_COMPATIBILITY_SUITES :=
+
###########################################################
## Debugging; prints a variable list to stdout
###########################################################
@@ -2625,17 +2628,15 @@
endef
# Define a rule to create a symlink to a file.
-# $(1): full path to source
+# $(1): any dependencies
# $(2): source (may be relative)
# $(3): full path to destination
define symlink-file
$(eval $(_symlink-file))
endef
-# Order-only dependency because make/ninja will follow the link when checking
-# the timestamp, so the file must exist
define _symlink-file
-$(3): | $(1)
+$(3): $(1)
@echo "Symlink: $$@ -> $(2)"
@mkdir -p $(dir $$@)
@rm -rf $$@
@@ -2894,6 +2895,7 @@
# and use my_compat_dist_$(suite) to define the others.
define create-suite-dependencies
$(foreach suite, $(LOCAL_COMPATIBILITY_SUITE), \
+ $(if $(filter $(suite),$(ALL_COMPATIBILITY_SUITES)),,$(eval ALL_COMPATIBILITY_SUITES += $(suite))) \
$(eval COMPATIBILITY.$(suite).FILES := \
$$(COMPATIBILITY.$(suite).FILES) $$(foreach f,$$(my_compat_dist_$(suite)),$$(call word-colon,2,$$(f))) \
$$(foreach f,$$(my_compat_dist_config_$(suite)),$$(call word-colon,2,$$(f)))) \
diff --git a/core/dex_preopt_config.mk b/core/dex_preopt_config.mk
index 0f994c4..78cc012 100644
--- a/core/dex_preopt_config.mk
+++ b/core/dex_preopt_config.mk
@@ -45,8 +45,6 @@
DEX2OAT := $(SOONG_HOST_OUT_EXECUTABLES)/dex2oatd$(HOST_EXECUTABLE_SUFFIX)
endif
-DEX2OAT_DEPENDENCY += $(DEX2OAT)
-
# Use the first preloaded-classes file in PRODUCT_COPY_FILES.
PRELOADED_CLASSES := $(call word-colon,1,$(firstword \
$(filter %system/etc/preloaded-classes,$(PRODUCT_COPY_FILES))))
diff --git a/core/dex_preopt_odex_install.mk b/core/dex_preopt_odex_install.mk
index aa3fd80..e6b5010 100644
--- a/core/dex_preopt_odex_install.mk
+++ b/core/dex_preopt_odex_install.mk
@@ -111,6 +111,7 @@
my_dexpreopt_archs :=
my_dexpreopt_images :=
my_dexpreopt_images_deps :=
+my_dexpreopt_image_locations :=
my_dexpreopt_infix := boot
ifeq (true, $(DEXPREOPT_USE_APEX_IMAGE))
my_dexpreopt_infix := apex
@@ -183,6 +184,8 @@
endif # TARGET_2ND_ARCH
endif # LOCAL_MODULE_CLASS
+ my_dexpreopt_image_locations += $(DEXPREOPT_IMAGE_LOCATIONS_$(my_dexpreopt_infix))
+
my_filtered_optional_uses_libraries := $(filter-out $(INTERNAL_PLATFORM_MISSING_USES_LIBRARIES), \
$(LOCAL_OPTIONAL_USES_LIBRARIES))
@@ -234,7 +237,7 @@
$(call end_json_map)
$(call add_json_list, Archs, $(my_dexpreopt_archs))
$(call add_json_list, DexPreoptImages, $(my_dexpreopt_images))
- $(call add_json_list, DexPreoptImageLocations, $(DEXPREOPT_IMAGE_LOCATIONS))
+ $(call add_json_list, DexPreoptImageLocations, $(my_dexpreopt_image_locations))
$(call add_json_list, PreoptBootClassPathDexFiles, $(DEXPREOPT_BOOTCLASSPATH_DEX_FILES))
$(call add_json_list, PreoptBootClassPathDexLocations,$(DEXPREOPT_BOOTCLASSPATH_DEX_LOCATIONS))
$(call add_json_bool, PreoptExtractedApk, $(my_preopt_for_extracted_apk))
diff --git a/core/install_jni_libs_internal.mk b/core/install_jni_libs_internal.mk
index eac0414..25a16a3 100644
--- a/core/install_jni_libs_internal.mk
+++ b/core/install_jni_libs_internal.mk
@@ -49,29 +49,21 @@
my_shared_library_path := $(call get_non_asan_path,\
$($(my_2nd_arch_prefix)TARGET_OUT$(partition_tag)_SHARED_LIBRARIES))
my_installed_library := $(addprefix $(my_shared_library_path)/, $(my_jni_filenames))
- # Do not use order-only dependency, because we want to rebuild the image if an jni is updated.
- $(LOCAL_INSTALLED_MODULE) : $(my_installed_library)
ALL_MODULES.$(LOCAL_MODULE).INSTALLED += $(my_installed_library)
# Create symlink in the app specific lib path
# Skip creating this symlink when running the second part of a target sanitization build.
ifeq ($(filter address,$(SANITIZE_TARGET)),)
- ifdef LOCAL_POST_INSTALL_CMD
- # Add a shell command separator
- LOCAL_POST_INSTALL_CMD += ;
- endif
-
my_symlink_target_dir := $(patsubst $(PRODUCT_OUT)%,%,\
- $(my_shared_library_path))
- LOCAL_POST_INSTALL_CMD += \
- mkdir -p $(my_app_lib_path) \
- $(foreach lib, $(my_jni_filenames), ;ln -sf $(my_symlink_target_dir)/$(lib) $(my_app_lib_path)/$(lib))
- $(LOCAL_INSTALLED_MODULE): PRIVATE_POST_INSTALL_CMD := $(LOCAL_POST_INSTALL_CMD)
- else
- ifdef LOCAL_POST_INSTALL_CMD
- $(LOCAL_INSTALLED_MODULE): PRIVATE_POST_INSTALL_CMD := $(LOCAL_POST_INSTALL_CMD)
- endif
+ $(my_shared_library_path))
+ $(foreach lib,$(my_jni_filenames),\
+ $(call symlink-file, \
+ $(my_shared_library_path)/$(lib), \
+ $(my_symlink_target_dir)/$(lib), \
+ $(my_app_lib_path)/$(lib)) \
+ $(eval $$(LOCAL_INSTALLED_MODULE) : $$(my_app_lib_path)/$$(lib)) \
+ $(eval ALL_MODULES.$$(LOCAL_MODULE).INSTALLED += $$(my_app_lib_path)/$$(lib)))
endif
# Clear jni_shared_libraries to not embed it into the apk.
diff --git a/core/main.mk b/core/main.mk
index b51603d..e0bf6ea 100644
--- a/core/main.mk
+++ b/core/main.mk
@@ -1256,6 +1256,28 @@
$(CUSTOM_MODULES) \
)
+#
+# Used by the cleanup logic in soong_ui to remove files that should no longer
+# be installed.
+#
+
+# Include all tests, so that we remove them from the test suites / testcase
+# folders when they are removed.
+test_files := $(foreach ts,$(ALL_COMPATIBILITY_SUITES),$(COMPATIBILITY.$(ts).FILES))
+
+$(shell mkdir -p $(PRODUCT_OUT) $(HOST_OUT))
+
+$(file >$(PRODUCT_OUT)/.installable_files$(if $(filter address,$(SANITIZE_TARGET)),_asan), \
+ $(sort $(patsubst $(PRODUCT_OUT)/%,%,$(filter $(PRODUCT_OUT)/%, \
+ $(modules_to_install) $(test_files)))))
+
+$(file >$(HOST_OUT)/.installable_test_files,$(sort \
+ $(patsubst $(HOST_OUT)/%,%,$(filter $(HOST_OUT)/%, \
+ $(test_files)))))
+
+test_files :=
+
+
# Don't include any GNU General Public License shared objects or static
# libraries in SDK images. GPL executables (not static/dynamic libraries)
# are okay if they don't link against any closed source libraries (directly
diff --git a/core/soong_app_prebuilt.mk b/core/soong_app_prebuilt.mk
index 98c646a..ebb22c5 100644
--- a/core/soong_app_prebuilt.mk
+++ b/core/soong_app_prebuilt.mk
@@ -41,6 +41,10 @@
$(eval $(call copy-one-file,$(full_classes_jar),$(full_classes_header_jar)))
endif
endif # TURBINE_ENABLED != false
+
+ javac-check : $(full_classes_jar)
+ javac-check-$(LOCAL_MODULE) : $(full_classes_jar)
+ .PHONY: javac-check-$(LOCAL_MODULE)
endif
# Run veridex on product, system_ext and vendor modules.
diff --git a/target/board/mainline_arm64/BoardConfig.mk b/target/board/mainline_arm64/BoardConfig.mk
index c53da9e..a09960f 100644
--- a/target/board/mainline_arm64/BoardConfig.mk
+++ b/target/board/mainline_arm64/BoardConfig.mk
@@ -40,8 +40,3 @@
BOARD_PRODUCTIMAGE_FILE_SYSTEM_TYPE := ext4
BOARD_SYSTEM_EXTIMAGE_FILE_SYSTEM_TYPE := ext4
BOARD_VENDORIMAGE_FILE_SYSTEM_TYPE := ext4
-
-# Mainline devices support apex
-# TODO: move this to BoardConfigMainlineCommon. Currently, GSI wants flattened
-# apexes, but emulator wants .apex files, preventing this.
-TARGET_FLATTEN_APEX := false
diff --git a/target/board/mainline_x86/BoardConfig.mk b/target/board/mainline_x86/BoardConfig.mk
index a20d17c..4dda058 100644
--- a/target/board/mainline_x86/BoardConfig.mk
+++ b/target/board/mainline_x86/BoardConfig.mk
@@ -29,7 +29,3 @@
BOARD_PRODUCTIMAGE_FILE_SYSTEM_TYPE := ext4
BOARD_SYSTEM_EXTIMAGE_FILE_SYSTEM_TYPE := ext4
BOARD_VENDORIMAGE_FILE_SYSTEM_TYPE := ext4
-
-# Mainline devices support apex
-# TODO: move this to product makefile and use updatable_apex.mk
-TARGET_FLATTEN_APEX := false
diff --git a/target/board/mainline_x86_arm/BoardConfig.mk b/target/board/mainline_x86_arm/BoardConfig.mk
index 6b282c2..d775a77 100644
--- a/target/board/mainline_x86_arm/BoardConfig.mk
+++ b/target/board/mainline_x86_arm/BoardConfig.mk
@@ -34,7 +34,3 @@
BOARD_PRODUCTIMAGE_FILE_SYSTEM_TYPE := ext4
BOARD_SYSTEM_EXTIMAGE_FILE_SYSTEM_TYPE := ext4
BOARD_VENDORIMAGE_FILE_SYSTEM_TYPE := ext4
-
-# Mainline devices support apex
-# TODO: move this to product makefile and use updatable_apex.mk
-TARGET_FLATTEN_APEX := false
diff --git a/target/product/base_system.mk b/target/product/base_system.mk
index ca40824..2895801 100644
--- a/target/product/base_system.mk
+++ b/target/product/base_system.mk
@@ -112,7 +112,6 @@
ip-up-vpn \
javax.obex \
keystore \
- ld.config.txt \
ld.mc \
libaaudio \
libamidi \
@@ -271,10 +270,6 @@
wifi-service \
wm \
-# TODO(b/146549048) remove this
-PRODUCT_PACKAGES += \
- boringssl_self_test
-
# VINTF data for system image
PRODUCT_PACKAGES += \
system_manifest.xml \
diff --git a/target/product/gsi/Android.mk b/target/product/gsi/Android.mk
index 424cf05..243c00f 100644
--- a/target/product/gsi/Android.mk
+++ b/target/product/gsi/Android.mk
@@ -51,7 +51,7 @@
ifeq (REL,$(PLATFORM_VERSION_CODENAME))
_vndk_check_failure_message += " Changing the VNDK library list is not allowed in API locked branches."
else
-_vndk_check_failure_message += " Run update-vndk-list.sh to update $(LATEST_VNDK_LIB_LIST)"
+_vndk_check_failure_message += " Run \`update-vndk-list.sh\` to update $(LATEST_VNDK_LIB_LIST)"
endif
$(check-vndk-list-timestamp): $(INTERNAL_VNDK_LIB_LIST) $(LATEST_VNDK_LIB_LIST) $(HOST_OUT_EXECUTABLES)/update-vndk-list.sh
diff --git a/target/product/mainline_system_x86_64.mk b/target/product/mainline_system_x86_64.mk
index 1b1a42f..473ff72 100644
--- a/target/product/mainline_system_x86_64.mk
+++ b/target/product/mainline_system_x86_64.mk
@@ -24,9 +24,6 @@
# Enable mainline checking
PRODUCT_ENFORCE_ARTIFACT_PATH_REQUIREMENTS := true
-# Enable nonflat APEX
-$(call inherit-product, $(SRC_TARGET_DIR)/product/updatable_apex.mk)
-
PRODUCT_BUILD_CACHE_IMAGE := false
PRODUCT_BUILD_ODM_IMAGE := false
PRODUCT_BUILD_PRODUCT_IMAGE := false
diff --git a/tools/releasetools/common.py b/tools/releasetools/common.py
index 556d25a..b0a0e02 100644
--- a/tools/releasetools/common.py
+++ b/tools/releasetools/common.py
@@ -823,6 +823,12 @@
merged_dict[key] = (
"%s %s" %
(framework_dict.get(key, ""), vendor_dict.get(key, ""))).strip()
+
+ # Pick virtual ab related flags from vendor dict, if defined.
+ if "virtual_ab" in vendor_dict.keys():
+ merged_dict["virtual_ab"] = vendor_dict["virtual_ab"]
+ if "virtual_ab_retrofit" in vendor_dict.keys():
+ merged_dict["virtual_ab_retrofit"] = vendor_dict["virtual_ab_retrofit"]
return merged_dict