mirror of
https://github.com/ironfox-oss/IronFox.git
synced 2026-05-24 16:45:44 -04:00
fix(builder): show progress when adding tasks for no-op endpoints
Signed-off-by: Akash Yadav <itsaky01@gmail.com>
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user