packages feed

hydra-build-0.17.5: src/main/haskell/Hydra/Build/Assembly.hs

-- Note: this is an automatically generated file. Do not edit.

-- | Type-level model of a distribution package's assembly plan: the ordered copy/symlink entries and keep-paths that a host-native executor realizes on disk when merging overlay source onto a generated distribution package. Factors the copy(overlay/<lang>/<pkg>/) half of the governing equation into data, so the per-host copy scripts share one translingual description. See https://github.com/CategoricalData/hydra/issues/416

module Hydra.Build.Assembly where

import qualified Hydra.Core as Core
import Prelude hiding  (Enum, Ordering, decodeFloat, encodeFloat, fail, lines, map, pure, sum, unlines)
import qualified Data.Scientific as Sci

-- | A single copy-or-link operation in an assembly plan: realize a source tree at a destination tree by the given kind, optionally excluding matching relative paths.
data AssemblyEntry =
  AssemblyEntry {
    -- | The source tree to realize, as a worktree-relative path (e.g. overlay/<lang>/<pkg>/src)
    assemblyEntrySourceTree :: String,
    -- | The destination tree, as a worktree-relative path (e.g. dist/<lang>/<pkg>/src)
    assemblyEntryDestTree :: String,
    -- | How the source tree is realized at the destination
    assemblyEntryKind :: AssemblyEntryKind,
    -- | Relative path fragments to exclude when realizing the entry (e.g. __pycache__); empty means copy everything
    assemblyEntryExclude :: [String]}
  deriving (Eq, Ord, Read, Show)

_AssemblyEntry = Core.Name "hydra.build.assembly.AssemblyEntry"

_AssemblyEntry_sourceTree = Core.Name "sourceTree"

_AssemblyEntry_destTree = Core.Name "destTree"

_AssemblyEntry_kind = Core.Name "kind"

_AssemblyEntry_exclude = Core.Name "exclude"

-- | How an assembly entry's source tree is realized at its destination. The distinction gates the host-native executor's dispatch (merge-copy vs. wipe-then-copy vs. symlink).
data AssemblyEntryKind =
  -- | Merge-copy the source tree's files into the destination, leaving pre-existing files intact
  AssemblyEntryKindMerge |
  -- | Remove the destination tree entirely, then copy the source tree (an exact-mirror replacement)
  AssemblyEntryKindWipeThenCopy |
  -- | Symlink each of the source tree's files into the destination (per-file links; own real files win)
  AssemblyEntryKindSymlinkTree |
  -- | Symlink the source directory itself into the destination as a single directory link
  AssemblyEntryKindSymlinkDir
  deriving (Eq, Ord, Read, Show)

_AssemblyEntryKind = Core.Name "hydra.build.assembly.AssemblyEntryKind"

_AssemblyEntryKind_merge = Core.Name "merge"

_AssemblyEntryKind_wipeThenCopy = Core.Name "wipeThenCopy"

_AssemblyEntryKind_symlinkTree = Core.Name "symlinkTree"

_AssemblyEntryKind_symlinkDir = Core.Name "symlinkDir"

-- | The complete assembly plan for one distribution package in one target language: the ordered copy/symlink entries to realize and the keep-paths a pruning consumer must protect. Entries are ordered because realization order can matter (e.g. a package that links its own subtree back into an already-assembled dependency's tree).
data AssemblyPlan =
  AssemblyPlan {
    -- | The copy/symlink entries to realize, in application order
    assemblyPlanEntries :: [AssemblyEntry],
    -- | The files this plan is responsible for, recorded so a prune-stale pass does not delete them
    assemblyPlanKeepPaths :: [KeepPathEntry]}
  deriving (Eq, Ord, Read, Show)

_AssemblyPlan = Core.Name "hydra.build.assembly.AssemblyPlan"

_AssemblyPlan_entries = Core.Name "entries"

_AssemblyPlan_keepPaths = Core.Name "keepPaths"

-- | One protected path in a keep-paths manifest: a source-set directory paired with a file's path relative to it. Serialized by the native executor as <sourceSetDir>\t<relPath>, bit-compatible with the prune-stale (#357) and digest-check --keep-paths-from consumers.
data KeepPathEntry =
  KeepPathEntry {
    -- | The source-set directory the file belongs to, as a worktree-relative path
    keepPathEntrySourceSetDir :: String,
    -- | The file's path relative to its source-set directory
    keepPathEntryRelPath :: String}
  deriving (Eq, Ord, Read, Show)

_KeepPathEntry = Core.Name "hydra.build.assembly.KeepPathEntry"

_KeepPathEntry_sourceSetDir = Core.Name "sourceSetDir"

_KeepPathEntry_relPath = Core.Name "relPath"