feat: add regenerate command to force rebuild of specific targets
The regenerate command accepts one or more target names and forces them to be rebuilt even if they are up to date. This respects the archive_folder setting, archiving previous versions before overwriting.
This commit is contained in:
parent
612ea0ae9d
commit
d76951fe47
3 changed files with 124 additions and 3 deletions
|
|
@ -179,6 +179,7 @@ async def run_build(
|
|||
project_dir: Path,
|
||||
project_name: str,
|
||||
target: str | None = None,
|
||||
force_dirty: set[str] | None = None,
|
||||
on_progress: ProgressCallback = _noop_callback,
|
||||
) -> BuildResult:
|
||||
"""Execute the build.
|
||||
|
|
@ -186,10 +187,14 @@ async def run_build(
|
|||
If *target* is specified, only build that target and its transitive
|
||||
dependencies. Otherwise build all targets.
|
||||
|
||||
If *force_dirty* is provided, those targets are always considered dirty
|
||||
regardless of their actual state (used by the ``regenerate`` command).
|
||||
|
||||
Execution proceeds in topological generations — each generation is a
|
||||
set of independent targets that run concurrently via
|
||||
:func:`asyncio.gather`.
|
||||
"""
|
||||
force_dirty = force_dirty or set()
|
||||
result = BuildResult()
|
||||
providers = _create_providers()
|
||||
provider_index = _build_provider_index(providers)
|
||||
|
|
@ -221,7 +226,8 @@ async def run_build(
|
|||
on_progress(BuildEvent.TARGET_DEP_FAILED, name, "Dependency failed")
|
||||
continue
|
||||
|
||||
if _is_dirty(name, config, project_dir, state):
|
||||
is_forced = name in force_dirty
|
||||
if is_forced or _is_dirty(name, config, project_dir, state):
|
||||
if not _has_provider(name, config, provider_index, result, on_progress):
|
||||
continue
|
||||
dirty_targets.append(name)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue