From 49f582bfb6ff31013181d3d2d96ced08dcf6d141 Mon Sep 17 00:00:00 2001 From: Akash Yadav Date: Sun, 26 Oct 2025 12:23:11 +0530 Subject: [PATCH] fix(builder): show progress when adding tasks for no-op endpoints Signed-off-by: Akash Yadav --- builder/src/steps/prepare/__init__.py | 21 +++++++++++++++++-- .../src/steps/prepare/noop_moz_endpoints.py | 4 +++- 2 files changed, 22 insertions(+), 3 deletions(-) diff --git a/builder/src/steps/prepare/__init__.py b/builder/src/steps/prepare/__init__.py index 572b5361..4c7869e8 100644 --- a/builder/src/steps/prepare/__init__.py +++ b/builder/src/steps/prepare/__init__.py @@ -1,7 +1,9 @@ +import logging from pathlib import Path from commands.prepare import PrepareConfig from common.paths import Paths from execution.definition import BuildDefinition +from rich.progress import Progress from steps.common.java import setup_java from .android_components import prepare_android_components @@ -11,6 +13,8 @@ from .glean import prepare_glean from .firefox import prepare_firefox from .noop_moz_endpoints import get_moz_endpoints, noop_moz_endpoints +logger = logging.getLogger("prepare") + def _require_dir_exists(dir: Path): if not dir.exists() or not dir.is_dir(): @@ -59,7 +63,20 @@ def get_definition(config: PrepareConfig, paths: Paths) -> BuildDefinition: # fmt:on # No-op Mozilla endpoints - for endpoint, dir in get_moz_endpoints(paths): - noop_moz_endpoints(d, endpoint=endpoint, dir=dir) + with Progress(transient=False ) as progress: + items = get_moz_endpoints(paths) + total = len(items) + task_name = "No-op endpoints" + task_id = progress.add_task(task_name, total=total) + + try: + for index, (endpoint, dir) in enumerate(items): + noop_moz_endpoints(d, endpoint=endpoint, dir=dir) + progress.update( + task_id=task_id, + description=f"{task_id}: {index + 1}/{total} ({dir.relative_to(paths.root_dir)})", + ) + finally: + progress.remove_task(task_id=task_id) return d diff --git a/builder/src/steps/prepare/noop_moz_endpoints.py b/builder/src/steps/prepare/noop_moz_endpoints.py index f29c0adb..e5d0aef1 100644 --- a/builder/src/steps/prepare/noop_moz_endpoints.py +++ b/builder/src/steps/prepare/noop_moz_endpoints.py @@ -28,7 +28,9 @@ def _should_skip(path: Path) -> bool: def noop_moz_endpoints( - d: BuildDefinition, endpoint: str, dir: Path + d: BuildDefinition, + endpoint: str, + dir: Path ) -> List[TaskDefinition]: """ Find occurrences of endpoint in files under `dir` and return a list