Merge changes from topic "colefaust_artifact_path_requirements" am: 7b51e8cbdf

Original change: https://android-review.googlesource.com/c/platform/build/+/2035323

Change-Id: I56ab0dda40d6c9325312299930423f448ad8e67a
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Treehugger Robot
2022-04-08 17:50:52 +00:00
committed by Automerger Merge Worker
3 changed files with 30 additions and 9 deletions

View File

@@ -1351,7 +1351,7 @@ else ifdef FULL_BUILD
# Verify the artifact path requirements made by included products.
is_asan := $(if $(filter address,$(SANITIZE_TARGET)),true)
ifeq (,$(or $(is_asan),$(DISABLE_ARTIFACT_PATH_REQUIREMENTS),$(RBC_PRODUCT_CONFIG),$(RBC_BOARD_CONFIG)))
ifeq (,$(or $(is_asan),$(DISABLE_ARTIFACT_PATH_REQUIREMENTS)))
include $(BUILD_SYSTEM)/artifact_path_requirements.mk
endif
else

View File

@@ -263,7 +263,10 @@ endif # Import all or just the current product makefile
# Quick check
$(check-all-products)
ifeq ($(SKIP_ARTIFACT_PATH_REQUIREMENT_PRODUCTS_CHECK),)
# This step was already handled in the RBC product configuration.
# Since the equivalent starlark code will not add the partial products to
# the PRODUCTS variable, it's ok for them to be set before check-all-products
ifeq ($(RBC_PRODUCT_CONFIG)$(SKIP_ARTIFACT_PATH_REQUIREMENT_PRODUCTS_CHECK),)
# Import all the products that have made artifact path requirements, so that we can verify
# the artifacts they produce.
# These are imported after check-all-products because some of them might not be real products.

View File

@@ -157,6 +157,13 @@ def _product_configuration(top_pcm_name, top_pcm, input_variables_init):
handle = __h_new()
pcm(globals, handle)
if handle.artifact_path_requirements:
globals["PRODUCTS."+name+".mk.ARTIFACT_PATH_REQUIREMENTS"] = handle.artifact_path_requirements
globals["PRODUCTS."+name+".mk.ARTIFACT_PATH_ALLOWED_LIST"] = handle.artifact_path_allowed_list
globals["PRODUCTS."+name+".mk.ARTIFACT_PATH_REQUIREMENT_IS_RELAXED"] = "true" if handle.artifact_path_requirement_is_relaxed[0] else ""
globals.setdefault("ARTIFACT_PATH_REQUIREMENT_PRODUCTS", [])
globals["ARTIFACT_PATH_REQUIREMENT_PRODUCTS"] += [name+".mk"]
# Now we know everything about this PCM, record it in 'configs'.
children = handle.inherited_modules
if _options.trace_modules:
@@ -211,6 +218,10 @@ def _product_configuration(top_pcm_name, top_pcm, input_variables_init):
_percolate_inherited(configs, pcm_name, cfg, children_names)
configs[pcm_name] = pcm, cfg, children_names, True
if (pcm_name + ".mk") in globals.get("ARTIFACT_PATH_REQUIREMENT_PRODUCTS", []):
for var, val in cfg.items():
globals["PRODUCTS."+pcm_name+".mk."+var] = val
# Copy product config variables from the cfg dictionary to the
# PRODUCTS.<top_level_makefile_name>.<var_name> global variables.
for var, val in configs[top_pcm_name][1].items():
@@ -419,7 +430,10 @@ def __h_new():
return struct(
cfg = dict(),
inherited_modules = dict(),
default_list_value = list()
default_list_value = list(),
artifact_path_requirements = list(),
artifact_path_allowed_list = list(),
artifact_path_requirement_is_relaxed = [False], # as a list so that we can reassign it
)
def __h_cfg(handle):
@@ -564,13 +578,17 @@ def _notdir(paths):
"""
return " ".join([__base(w) for w in __words(paths)])
def _require_artifacts_in_path(paths, allowed_paths):
"""TODO."""
pass
def _require_artifacts_in_path(handle, paths, allowed_paths):
"""Equivalent to require-artifacts-in-path in Make."""
handle.artifact_path_requirements.clear()
handle.artifact_path_requirements.extend(__words(paths))
handle.artifact_path_allowed_list.clear()
handle.artifact_path_allowed_list.extend(__words(allowed_paths))
def _require_artifacts_in_path_relaxed(paths, allowed_paths):
"""TODO."""
pass
def _require_artifacts_in_path_relaxed(handle, paths, allowed_paths):
"""Equivalent to require-artifacts-in-path-relaxed in Make."""
_require_artifacts_in_path(handle, paths, allowed_paths)
handle.artifact_path_requirement_is_relaxed[0] = True
def _expand_wildcard(pattern):
"""Expands shell wildcard pattern."""