2026-12-02 14:23:58 +00:00
|
|
|
package artifacts
|
|
|
|
|
|
|
|
|
|
import (
|
2026-12-03 02:01:48 +00:00
|
|
|
"gitea.maximumdirect.net/eric/narratio/v4/internal/artifactdeps"
|
|
|
|
|
"gitea.maximumdirect.net/eric/narratio/v4/internal/config"
|
2026-12-02 14:23:58 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
|
|
// AnalyzeTargetClosure returns targets and their prerequisites in work order.
|
2026-12-02 21:20:01 +00:00
|
|
|
func AnalyzeTargetClosure(configured map[string]config.ScriptoriumArtifactConfig, targets []string) ([]string, error) {
|
|
|
|
|
graph, err := config.BuildArtifactGraph(configured)
|
2026-12-02 14:23:58 +00:00
|
|
|
if err != nil {
|
|
|
|
|
return nil, err
|
|
|
|
|
}
|
2026-12-02 21:20:01 +00:00
|
|
|
return graph.Prerequisites(targets, nil)
|
2026-12-02 14:23:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// OrderConfiguredArtifacts returns configured keys in prerequisite-first order.
|
2026-12-02 21:20:01 +00:00
|
|
|
func OrderConfiguredArtifacts(configured map[string]config.ScriptoriumArtifactConfig) ([]string, error) {
|
|
|
|
|
graph, err := config.BuildArtifactGraph(configured)
|
|
|
|
|
if err != nil {
|
|
|
|
|
return nil, err
|
2026-12-02 14:23:58 +00:00
|
|
|
}
|
2026-12-02 21:20:01 +00:00
|
|
|
return graph.Order(), nil
|
2026-12-02 14:23:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// NormalizedDependencyKeys deduplicates and sorts dependency keys.
|
2026-12-02 21:20:01 +00:00
|
|
|
func NormalizedDependencyKeys(values []string) []string { return artifactdeps.Normalize(values) }
|