sigildocs

(sigil build deps)

(sigil build deps) - Dependency Resolution

This library provides dependency graph construction and resolution for building packages in the correct order.

Example usage: (define packages (workspace-load-packages ws ws-dir)) (define graph (build-dependency-graph packages)) (define order (topological-sort graph)) ;; order is a list of package names in build order

Exports

Extract direct dependency names from a package Returns a list of package name strings

Get the name from a dependency (handles different dep types)

Extract package name from git URL

Build a dependency graph from a list of packages Input: alist of (package-name . package) pairs Returns: alist of (package-name . (list of dep-names)) Only includes deps that are in packages-alist (filters out external deps that aren't part of this build, like internal workspace deps of redirected packages)

Get build order for all packages in a workspace Returns list of package names in build order (dependencies first)

Get build order for a specific package and its dependencies Returns list of package names needed to build target (in order)

Topologically sort a dependency graph.

Input: graph as alist of (node . (list of dependencies)) Returns: list of nodes in dependency order (dependencies first) Raises error if cycle detected.

Example:

(topological-sort '(("a" . ("b")) ("b" . ("c")) ("c" . ())))
; => ("c" "b" "a")

Re-exported from (sigil build graph)

Topologically sort a subgraph reachable from a target node.

Useful for building just the dependencies of a specific target. Returns only the nodes needed to build TARGET, in dependency order.

Re-exported from (sigil build graph)

detect-cyclesprocedure

Detect cycles in graph using depth-first search. Returns list of nodes involved in cycles, or empty list if none.

Uses three-color marking:

  • white: unvisited
  • gray: currently being visited (on stack)
  • black: completely visited

A cycle exists when we encounter a gray node during DFS.

Re-exported from (sigil build graph)

has-cycle?procedure

Check if graph has any cycles.

Re-exported from (sigil build graph)