bau/affected

Computes which Bau targets and tests are affected by changed files.

Types

AffectedReport = object
  changedFiles*: seq[string] ## Changed paths relative to the project root.
  sourceFiles*: seq[string]  ## Source modules affected directly or transitively.
  targets*: seq[string]      ## Build target names affected by changed sources.
  tests*: seq[string]        ## Test files affected by changed sources or test config.
  tasks*: seq[string]        ## Task names affected by changed inputs.
Files and Bau work items affected by a change set.

Procs

proc computeAffected(cfg: BauConfig; projectDir: string; since: string = "HEAD"): AffectedReport {.
    ...raises: [OSError, ValueError, IOError, KeyError], tags: [ReadDirEffect,
    RootEffect, ReadIOEffect, WriteDirEffect, ExecIOEffect, ReadEnvEffect,
    TimeEffect], forbids: [].}
Compute affected work from files changed since a Git revision or ref.
proc computeAffectedFromChanges(cfg: BauConfig; projectDir: string;
                                changedFiles: openArray[string]): AffectedReport {.
    ...raises: [OSError, ValueError, IOError, KeyError], tags: [ReadDirEffect,
    RootEffect, ReadIOEffect, WriteDirEffect, ExecIOEffect, ReadEnvEffect,
    TimeEffect], forbids: [].}
Compute affected sources, targets, tests, and tasks from explicit paths.
proc gitChangedFiles(projectDir: string; since: string = "HEAD"): seq[string] {.
    ...raises: [OSError, IOError, ValueError],
    tags: [ExecIOEffect, ReadEnvEffect, RootEffect, ReadIOEffect, TimeEffect],
    forbids: [].}

Return files changed since a Git revision or ref.

If Git cannot produce a diff, returns an empty sequence.