Merge "Add an option to skip the allowed deps check." into main

This commit is contained in:
Martin Stjernholm
2023-09-13 10:45:42 +00:00
committed by Gerrit Code Review

View File

@@ -322,6 +322,9 @@ class SnapshotBuilder:
# The out/soong/mainline-sdks directory. # The out/soong/mainline-sdks directory.
mainline_sdks_dir: str = "" mainline_sdks_dir: str = ""
# True if apex-allowed-deps-check is to be skipped.
skip_allowed_deps_check: bool = False
def __post_init__(self): def __post_init__(self):
self.mainline_sdks_dir = os.path.join(self.out_dir, self.mainline_sdks_dir = os.path.join(self.out_dir,
"soong/mainline-sdks") "soong/mainline-sdks")
@@ -356,8 +359,9 @@ class SnapshotBuilder:
f"TARGET_BUILD_VARIANT={target_build_variant}", f"TARGET_BUILD_VARIANT={target_build_variant}",
"TARGET_PRODUCT=mainline_sdk", "TARGET_PRODUCT=mainline_sdk",
"MODULE_BUILD_FROM_SOURCE=true", "MODULE_BUILD_FROM_SOURCE=true",
"out/soong/apex/depsinfo/new-allowed-deps.txt.check",
] + target_paths ] + target_paths
if not self.skip_allowed_deps_check:
cmd += ["apex-allowed-deps-check"]
print_command(extraEnv, cmd) print_command(extraEnv, cmd)
env = os.environ.copy() env = os.environ.copy()
env.update(extraEnv) env.update(extraEnv)
@@ -1409,7 +1413,7 @@ def apply_transformations(producer, tmp_dir, transformations, build_release):
os.utime(path, (modified, modified)) os.utime(path, (modified, modified))
def create_producer(tool_path): def create_producer(tool_path, skip_allowed_deps_check):
# Variables initialized from environment variables that are set by the # Variables initialized from environment variables that are set by the
# calling mainline_modules_sdks.sh. # calling mainline_modules_sdks.sh.
out_dir = os.environ["OUT_DIR"] out_dir = os.environ["OUT_DIR"]
@@ -1424,6 +1428,7 @@ def create_producer(tool_path):
tool_path=tool_path, tool_path=tool_path,
subprocess_runner=subprocess_runner, subprocess_runner=subprocess_runner,
out_dir=out_dir, out_dir=out_dir,
skip_allowed_deps_check=skip_allowed_deps_check,
) )
return SdkDistProducer( return SdkDistProducer(
subprocess_runner=subprocess_runner, subprocess_runner=subprocess_runner,
@@ -1519,6 +1524,11 @@ def main(args):
"Defaults to true when TARGET_BUILD_APPS is not set. " "Defaults to true when TARGET_BUILD_APPS is not set. "
"Applicable only if the \"latest\" build release is built.", "Applicable only if the \"latest\" build release is built.",
) )
args_parser.add_argument(
"--skip-allowed-deps-check",
action="store_true",
help="Skip apex-allowed-deps-check.",
)
args = args_parser.parse_args(args) args = args_parser.parse_args(args)
build_releases = ALL_BUILD_RELEASES build_releases = ALL_BUILD_RELEASES
@@ -1538,7 +1548,7 @@ def main(args):
if not target_build_apps or args.build_platform_sdks_for_mainline: if not target_build_apps or args.build_platform_sdks_for_mainline:
modules += PLATFORM_SDKS_FOR_MAINLINE modules += PLATFORM_SDKS_FOR_MAINLINE
producer = create_producer(args.tool_path) producer = create_producer(args.tool_path, args.skip_allowed_deps_check)
producer.dist_generate_sdk_supported_modules_file(modules) producer.dist_generate_sdk_supported_modules_file(modules)
producer.produce_dist(modules, build_releases) producer.produce_dist(modules, build_releases)