mainline_modules_sdks.py: Optimize snapshot build order am: b3805c1d35
Original change: https://android-review.googlesource.com/c/platform/packages/modules/common/+/2047367 Change-Id: I46b8bea13ccaa1a72f1031f6c6c503b984753f24 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
@@ -28,6 +28,7 @@ import subprocess
|
|||||||
import sys
|
import sys
|
||||||
import tempfile
|
import tempfile
|
||||||
import typing
|
import typing
|
||||||
|
from collections import defaultdict
|
||||||
from typing import Callable, List
|
from typing import Callable, List
|
||||||
import zipfile
|
import zipfile
|
||||||
|
|
||||||
@@ -852,7 +853,14 @@ class SdkDistProducer:
|
|||||||
# Prepare the dist directory for the sdks.
|
# Prepare the dist directory for the sdks.
|
||||||
self.prepare()
|
self.prepare()
|
||||||
|
|
||||||
|
# Group build releases so that those with the same Soong environment are
|
||||||
|
# run consecutively to avoid having to regenerate ninja files.
|
||||||
|
grouped_by_env = defaultdict(list)
|
||||||
for build_release in build_releases:
|
for build_release in build_releases:
|
||||||
|
grouped_by_env[str(build_release.soong_env)].append(build_release)
|
||||||
|
ordered = [br for _, group in grouped_by_env.items() for br in group]
|
||||||
|
|
||||||
|
for build_release in ordered:
|
||||||
# Only build modules that are required for this build release.
|
# Only build modules that are required for this build release.
|
||||||
filtered_modules = [
|
filtered_modules = [
|
||||||
m for m in modules if m.is_required_for(build_release)
|
m for m in modules if m.is_required_for(build_release)
|
||||||
@@ -887,11 +895,11 @@ class SdkDistProducer:
|
|||||||
|
|
||||||
def produce_bundled_dist_for_build_release(self, build_release, modules):
|
def produce_bundled_dist_for_build_release(self, build_release, modules):
|
||||||
modules = [m for m in modules if m.is_bundled()]
|
modules = [m for m in modules if m.is_bundled()]
|
||||||
sdk_versions = build_release.sdk_versions
|
if modules:
|
||||||
snapshots_dir = self.snapshot_builder.build_snapshots(
|
sdk_versions = build_release.sdk_versions
|
||||||
build_release, sdk_versions, modules)
|
snapshots_dir = self.snapshot_builder.build_snapshots(
|
||||||
self.populate_bundled_dist(build_release, modules, snapshots_dir)
|
build_release, sdk_versions, modules)
|
||||||
return snapshots_dir
|
self.populate_bundled_dist(build_release, modules, snapshots_dir)
|
||||||
|
|
||||||
def populate_unbundled_dist(self, build_release, sdk_versions, modules,
|
def populate_unbundled_dist(self, build_release, sdk_versions, modules,
|
||||||
snapshots_dir):
|
snapshots_dir):
|
||||||
|
|||||||
@@ -300,17 +300,6 @@ class TestProduceDist(unittest.TestCase):
|
|||||||
["current"],
|
["current"],
|
||||||
["com.android.ipsec", "com.google.android.wifi"],
|
["com.android.ipsec", "com.google.android.wifi"],
|
||||||
),
|
),
|
||||||
(
|
|
||||||
"S",
|
|
||||||
{
|
|
||||||
"SOONG_SDK_SNAPSHOT_TARGET_BUILD_RELEASE": "S"
|
|
||||||
},
|
|
||||||
["current"],
|
|
||||||
[
|
|
||||||
"com.android.art", "com.android.ipsec",
|
|
||||||
"com.google.android.wifi"
|
|
||||||
],
|
|
||||||
),
|
|
||||||
(
|
(
|
||||||
"latest",
|
"latest",
|
||||||
{},
|
{},
|
||||||
@@ -320,7 +309,6 @@ class TestProduceDist(unittest.TestCase):
|
|||||||
"com.google.android.wifi"
|
"com.google.android.wifi"
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
('latest', {}, ['current'], []),
|
|
||||||
(
|
(
|
||||||
"legacy",
|
"legacy",
|
||||||
{},
|
{},
|
||||||
@@ -330,6 +318,17 @@ class TestProduceDist(unittest.TestCase):
|
|||||||
"com.google.android.wifi"
|
"com.google.android.wifi"
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
(
|
||||||
|
"S",
|
||||||
|
{
|
||||||
|
"SOONG_SDK_SNAPSHOT_TARGET_BUILD_RELEASE": "S"
|
||||||
|
},
|
||||||
|
["current"],
|
||||||
|
[
|
||||||
|
"com.android.art", "com.android.ipsec",
|
||||||
|
"com.google.android.wifi"
|
||||||
|
],
|
||||||
|
),
|
||||||
], snapshot_builder.snapshots)
|
], snapshot_builder.snapshots)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user