Merge "Code refactoring to build targets in a separate method." am: c21ce9240c

Original change: https://android-review.googlesource.com/c/platform/packages/modules/common/+/2119227

Change-Id: I4e9ea7e9c876f5c2a840204181245703c33d738b
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Treehugger Robot
2022-06-08 13:45:20 +00:00
committed by Automerger Merge Worker

View File

@@ -246,17 +246,7 @@ class SnapshotBuilder:
return os.path.join(self.mainline_sdks_dir,
f"{sdk_name}-{sdk_version}.zip")
def build_snapshots(self, build_release, sdk_versions, modules):
# Build the SDKs once for each version.
for sdk_version in sdk_versions:
# Compute the paths to all the Soong generated sdk snapshot files
# required by this script.
paths = [
sdk_snapshot_zip_file(self.mainline_sdks_dir, sdk, sdk_version)
for module in modules
for sdk in module.sdks
]
def build_target_paths(self, build_release, sdk_version, target_paths):
# Extra environment variables to pass to the build process.
extraEnv = {
# TODO(ngeoffray): remove SOONG_ALLOW_MISSING_DEPENDENCIES, but
@@ -276,8 +266,7 @@ class SnapshotBuilder:
# This MUST be identical to the TARGET_BUILD_VARIANT used to build
# the corresponding APEXes otherwise it could result in different
# hidden API flags, see http://b/202398851#comment29 for more info.
target_build_variant = os.environ.get("TARGET_BUILD_VARIANT",
"user")
target_build_variant = os.environ.get("TARGET_BUILD_VARIANT", "user")
cmd = [
"build/soong/soong_ui.bash",
"--make-mode",
@@ -286,11 +275,24 @@ class SnapshotBuilder:
"TARGET_PRODUCT=mainline_sdk",
"MODULE_BUILD_FROM_SOURCE=true",
"out/soong/apex/depsinfo/new-allowed-deps.txt.check",
] + paths
] + target_paths
print_command(extraEnv, cmd)
env = os.environ.copy()
env.update(extraEnv)
self.subprocess_runner.run(cmd, env=env)
def build_snapshots(self, build_release, sdk_versions, modules):
# Build the SDKs once for each version.
for sdk_version in sdk_versions:
# Compute the paths to all the Soong generated sdk snapshot files
# required by this script.
paths = [
sdk_snapshot_zip_file(self.mainline_sdks_dir, sdk, sdk_version)
for module in modules
for sdk in module.sdks
]
self.build_target_paths(build_release, sdk_version, paths)
return self.mainline_sdks_dir
def build_snapshots_for_build_r(self, build_release, sdk_versions, modules):