build

package
v0.4.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 18, 2026 License: EUPL-1.2 Imports: 32 Imported by: 0

Documentation

Overview

Package build provides project type detection and cross-compilation for the Core build system.

Package build provides project type detection and cross-compilation for the Core build system. It supports Go, Wails, Node.js, PHP, Python, Rust, Docs, Docker, LinuxKit, C++, and Taskfile projects with automatic detection based on marker files and builder-specific probes.

Package build provides project type detection and cross-compilation for the Core build system. This file handles build cache configuration and key generation.

Package build provides project type detection and cross-compilation for the Core build system.

Package build provides project type detection and cross-compilation for the Core build system. This file handles CI environment detection and GitHub Actions output formatting.

Package build provides project type detection and cross-compilation for the Core build system. This file handles configuration loading from .core/build.yaml files.

Package build provides project type detection and cross-compilation for the Core build system. This file handles build options computation from config + discovery.

Package build provides project type detection and cross-compilation for the Core build system. This file exposes the release workflow generator and its path-resolution helpers.

Index

Examples

Constants

View Source
const (
	// XcodeCloudScriptsDir is the repository-relative directory used by Xcode Cloud.
	XcodeCloudScriptsDir = "ci_scripts"

	// XcodeCloudPostCloneScriptName installs toolchains and project dependencies.
	XcodeCloudPostCloneScriptName = "ci_post_clone.sh"
	// XcodeCloudPreXcodebuildScriptName runs the Apple pipeline before xcodebuild.
	XcodeCloudPreXcodebuildScriptName = "ci_pre_xcodebuild.sh"
	// XcodeCloudPostXcodebuildScriptName verifies the built bundle after xcodebuild.
	XcodeCloudPostXcodebuildScriptName = "ci_post_xcodebuild.sh"
)
View Source
const ConfigDir = ".core"

ConfigDir is the directory where build configuration is stored.

configPath := ax.Join(projectDir, build.ConfigDir, build.ConfigFileName)

View Source
const ConfigFileName = "build.yaml"

ConfigFileName is the name of the build configuration file.

configPath := ax.Join(projectDir, build.ConfigDir, build.ConfigFileName)

View Source
const DefaultCacheDirectory = ".core/cache"

DefaultCacheDirectory is the project-local cache metadata directory used when no cache directory is supplied.

cfg := build.CacheConfig{Enabled: true}
// SetupCache(storage.Local, ".", &cfg) -> ".core/cache"
View Source
const DefaultProcessCacheDirectory = "~/.cache/core-build"

DefaultProcessCacheDirectory is the RFC-documented cache directory used by the single-argument SetupCache form when only environment wiring is needed.

View Source
const DefaultReleaseWorkflowFileName = "release.yml"

DefaultReleaseWorkflowFileName is the workflow filename used when a directory-style output path is supplied.

View Source
const DefaultReleaseWorkflowPath = ".github/workflows/release.yml"

DefaultReleaseWorkflowPath is the conventional output path for the release workflow.

path := build.DefaultReleaseWorkflowPath // ".github/workflows/release.yml"

Variables

This section is empty.

Functions

func ApplyOptions

func ApplyOptions(cfg *Config, options *BuildOptions)

ApplyOptions copies computed build options onto a runtime build config.

build.ApplyOptions(cfg, build.ComputeOptions(config, discovery))

Example

ExampleApplyOptions references ApplyOptions on this package API surface.

_ = ApplyOptions
core.Println("ApplyOptions")
Output:
ApplyOptions

func Archive

func Archive(fs io_interface.Medium, artifact Artifact) core.Result

Archive creates an archive for a single artifact using gzip compression. Uses tar.gz for linux/darwin and zip for windows. The archive is created alongside the binary (e.g., dist/myapp_linux_amd64.tar.gz). Returns a new Artifact with Path pointing to the archive.

archived, err := build.Archive(io.Local, artifact)

Example

ExampleArchive references Archive on this package API surface.

_ = Archive
core.Println("Archive")
Output:
Archive

func ArchiveAll

func ArchiveAll(fs io_interface.Medium, artifacts []Artifact) core.Result

ArchiveAll archives all artifacts using gzip compression. Returns a slice of new artifacts pointing to the archives.

archived, err := build.ArchiveAll(io.Local, artifacts)

Example

ExampleArchiveAll references ArchiveAll on this package API surface.

_ = ArchiveAll
core.Println("ArchiveAll")
Output:
ArchiveAll

func ArchiveAllWithFormat

func ArchiveAllWithFormat(fs io_interface.Medium, artifacts []Artifact, format ArchiveFormat) core.Result

ArchiveAllWithFormat archives all artifacts with the specified format. Returns a slice of new artifacts pointing to the archives.

archived, err := build.ArchiveAllWithFormat(io.Local, artifacts, build.ArchiveFormatXZ)

Example

ExampleArchiveAllWithFormat references ArchiveAllWithFormat on this package API surface.

_ = ArchiveAllWithFormat
core.Println("ArchiveAllWithFormat")
Output:
ArchiveAllWithFormat

func ArchiveAllXZ

func ArchiveAllXZ(fs io_interface.Medium, artifacts []Artifact) core.Result

ArchiveAllXZ archives all artifacts using xz compression. Returns a slice of new artifacts pointing to the archives.

archived, err := build.ArchiveAllXZ(io.Local, artifacts)

Example

ExampleArchiveAllXZ references ArchiveAllXZ on this package API surface.

_ = ArchiveAllXZ
core.Println("ArchiveAllXZ")
Output:
ArchiveAllXZ

func ArchiveWithFormat

func ArchiveWithFormat(fs io_interface.Medium, artifact Artifact, format ArchiveFormat) core.Result

ArchiveWithFormat creates an archive for a single artifact with the specified format. Uses tar.gz, tar.xz, or zip depending on the requested format. Windows artifacts always use zip unless zip is requested explicitly. The archive is created alongside the binary (e.g., dist/myapp_linux_amd64.tar.xz). Returns a new Artifact with Path pointing to the archive.

archived, err := build.ArchiveWithFormat(io.Local, artifact, build.ArchiveFormatXZ)

Example

ExampleArchiveWithFormat references ArchiveWithFormat on this package API surface.

_ = ArchiveWithFormat
core.Println("ArchiveWithFormat")
Output:
ArchiveWithFormat

func ArchiveXZ

func ArchiveXZ(fs io_interface.Medium, artifact Artifact) core.Result

ArchiveXZ creates an archive for a single artifact using xz compression. Uses tar.xz for linux/darwin and zip for windows. Returns a new Artifact with Path pointing to the archive.

archived, err := build.ArchiveXZ(io.Local, artifact)

Example

ExampleArchiveXZ references ArchiveXZ on this package API surface.

_ = ArchiveXZ
core.Println("ArchiveXZ")
Output:
ArchiveXZ

func ArtifactName

func ArtifactName(buildName string, ci *CIContext, target Target) string

ArtifactName generates a canonical artifact filename from the build name, CI context, and target. Format: {name}_{OS}_{ARCH}_{TAG|SHORT_SHA} When ci is nil or has no tag or SHA, only the name and target are used.

name := build.ArtifactName("core", ci, build.Target{OS: "linux", Arch: "amd64"})
// "core_linux_amd64_v1.2.3"  (when ci.IsTag)
// "core_linux_amd64_abc1234" (when ci != nil, not a tag)
// "core_linux_amd64"         (when ci is nil)
Example

ExampleArtifactName references ArtifactName on this package API surface.

_ = ArtifactName
core.Println("ArtifactName")
Output:
ArtifactName

func BuildApple

func BuildApple(ctx context.Context, cfg *Config, options AppleOptions, buildNumber string) core.Result

BuildApple runs the end-to-end macOS Apple pipeline for a Wails app.

Example

ExampleBuildApple references BuildApple on this package API surface.

_ = BuildApple
core.Println("BuildApple")
Output:
BuildApple

func BuildEnvironment

func BuildEnvironment(cfg *Config, extra ...string) []string

BuildEnvironment returns a fresh environment slice that includes the configured build environment, any derived cache variables, and optional builder-specific values.

Example

ExampleBuildEnvironment references BuildEnvironment on this package API surface.

_ = BuildEnvironment
core.Println("BuildEnvironment")
Output:
BuildEnvironment

func BuildWailsApp

func BuildWailsApp(ctx context.Context, cfg WailsBuildConfig) core.Result

BuildWailsApp builds a single-architecture Wails app bundle for macOS.

Example

ExampleBuildWailsApp references BuildWailsApp on this package API surface.

_ = BuildWailsApp
core.Println("BuildWailsApp")
Output:
BuildWailsApp

func CIArtifactPath

func CIArtifactPath(buildName string, ci *CIContext, artifact Artifact) string

CIArtifactPath returns the CI-stamped artifact path for a build output. The filename keeps the original packaging suffix, such as `.tar.gz`, `.zip`, `.exe`, or `.app`.

path := build.CIArtifactPath("core", ci, build.Artifact{
    Path: "/tmp/dist/linux_amd64/core.tar.gz",
    OS: "linux",
    Arch: "amd64",
})
Example

ExampleCIArtifactPath references CIArtifactPath on this package API surface.

_ = CIArtifactPath
core.Println("CIArtifactPath")
Output:
CIArtifactPath

func CacheEnvironment

func CacheEnvironment(cfg *CacheConfig) []string

CacheEnvironment returns environment variables derived from the cache config.

env := build.CacheEnvironment(&build.CacheConfig{Enabled: true, Paths: []string{"/tmp/go-build"}})
Example

ExampleCacheEnvironment references CacheEnvironment on this package API surface.

_ = CacheEnvironment
core.Println("CacheEnvironment")
Output:
CacheEnvironment

func CacheKey

func CacheKey(fs storage.Medium, dir, goos, goarch string) string

CacheKey returns a deterministic cache key from go.sum, go.work.sum, and the target platform.

key := build.CacheKey(storage.Local, ".", "linux", "amd64") // "go-linux-amd64-abc123..."
Example

ExampleCacheKey references CacheKey on this package API surface.

_ = CacheKey
core.Println("CacheKey")
Output:
CacheKey

func CacheKeyWithConfig

func CacheKeyWithConfig(fs storage.Medium, dir, goos, goarch string, cfg *CacheConfig) string

CacheKeyWithConfig returns a deterministic cache key and applies the optional cache key prefix from configuration.

key := build.CacheKeyWithConfig(storage.Local, ".", "linux", "amd64", &cfg.Cache)
// "demo-go-linux-amd64-abc123..."
Example

ExampleCacheKeyWithConfig references CacheKeyWithConfig on this package API surface.

_ = CacheKeyWithConfig
core.Println("CacheKeyWithConfig")
Output:
CacheKeyWithConfig

func CacheRestoreKeys

func CacheRestoreKeys(cfg *CacheConfig) []string

CacheRestoreKeys returns the configured restore-key prefixes in stable order.

keys := build.CacheRestoreKeys(&build.CacheConfig{
    KeyPrefix: "demo",
    RestoreKeys: []string{"go-", "core-"},
})
// ["demo", "go-", "core-"]
Example

ExampleCacheRestoreKeys references CacheRestoreKeys on this package API surface.

_ = CacheRestoreKeys
core.Println("CacheRestoreKeys")
Output:
CacheRestoreKeys

func Checksum

func Checksum(fs io_interface.Medium, artifact Artifact) core.Result

Checksum computes SHA256 for an artifact and returns the artifact with the Checksum field filled.

cs, err := build.Checksum(io.Local, artifact)

Example

ExampleChecksum references Checksum on this package API surface.

_ = Checksum
core.Println("Checksum")
Output:
Checksum

func ChecksumAll

func ChecksumAll(fs io_interface.Medium, artifacts []Artifact) core.Result

ChecksumAll computes checksums for all artifacts. Returns a slice of artifacts with their Checksum fields filled.

checked, err := build.ChecksumAll(io.Local, artifacts)

Example

ExampleChecksumAll references ChecksumAll on this package API surface.

_ = ChecksumAll
core.Println("ChecksumAll")
Output:
ChecksumAll

func CloneStringMap

func CloneStringMap(values map[string]string) map[string]string

CloneStringMap returns a shallow copy of a string map.

clone := build.CloneStringMap(map[string]string{"VERSION": "v1.2.3"})

Example

ExampleCloneStringMap references CloneStringMap on this package API surface.

_ = CloneStringMap
core.Println("CloneStringMap")
Output:
CloneStringMap

func ComputeSetupPlan

func ComputeSetupPlan(fs storage.Medium, dir string, cfg *BuildConfig, discovery *DiscoveryResult) core.Result

ComputeSetupPlan derives the action-style setup requirements from discovery and config. When discovery is nil the function performs a fresh DiscoverFull pass using the provided filesystem and directory.

Example

ExampleComputeSetupPlan references ComputeSetupPlan on this package API surface.

_ = ComputeSetupPlan
core.Println("ComputeSetupPlan")
Output:
ComputeSetupPlan

func ConfigExists

func ConfigExists(fs storage.Medium, dir string) bool

ConfigExists checks if a build config file exists in the given directory.

if build.ConfigExists(storage.Local, ".") { ... }

Example

ExampleConfigExists references ConfigExists on this package API surface.

_ = ConfigExists
core.Println("ConfigExists")
Output:
ConfigExists

func ConfigPath

func ConfigPath(dir string) string

ConfigPath returns the path to the build config file for a given directory.

path := build.ConfigPath("/home/user/my-project") // → "/home/user/my-project/.core/build.yaml"

Example

ExampleConfigPath references ConfigPath on this package API surface.

_ = ConfigPath
core.Println("ConfigPath")
Output:
ConfigPath

func CopyMediumPath

func CopyMediumPath(source storage.Medium, sourcePath string, destination storage.Medium, destinationPath string) core.Result

CopyMediumPath copies a file or directory tree between media while preserving file modes where the source medium exposes them.

Example

ExampleCopyMediumPath references CopyMediumPath on this package API surface.

_ = CopyMediumPath
core.Println("CopyMediumPath")
Output:
CopyMediumPath

func CreateDMG

func CreateDMG(ctx context.Context, cfg DMGConfig) core.Result

CreateDMG packages an app bundle into a distributable DMG.

Example

ExampleCreateDMG references CreateDMG on this package API surface.

_ = CreateDMG
core.Println("CreateDMG")
Output:
CreateDMG

func CreateUniversal

func CreateUniversal(arm64Path, amd64Path, outputPath string) core.Result

CreateUniversal merges two architecture-specific app bundles into a universal app.

Example

ExampleCreateUniversal references CreateUniversal on this package API surface.

_ = CreateUniversal
core.Println("CreateUniversal")
Output:
CreateUniversal

func DefaultBuildCachePaths

func DefaultBuildCachePaths(baseDir string) []string

DefaultBuildCachePaths returns the project-local Go cache directories used when no cache paths are configured.

paths := build.DefaultBuildCachePaths("/workspace/project")
// ["/workspace/project/cache/go-build", "/workspace/project/cache/go-mod"]
Example

ExampleDefaultBuildCachePaths references DefaultBuildCachePaths on this package API surface.

_ = DefaultBuildCachePaths
core.Println("DefaultBuildCachePaths")
Output:
DefaultBuildCachePaths

func DenoRequested

func DenoRequested(configuredBuild string) bool

DenoRequested reports whether the current build should prefer a Deno-backed frontend build. It honours the action-style environment overrides first and then the persisted/configured command override.

Example

ExampleDenoRequested references DenoRequested on this package API surface.

_ = DenoRequested
core.Println("DenoRequested")
Output:
DenoRequested

func Discover

func Discover(fs storage.Medium, dir string) core.Result

Discover detects project types in the given directory by checking for marker files. Returns a slice of detected project types, ordered by priority (most specific first). For example, a Wails project returns [wails, go] since it has both wails.json and go.mod.

types, err := build.Discover(storage.Local, "/home/user/my-project") // → go

Example

ExampleDiscover references Discover on this package API surface.

_ = Discover
core.Println("Discover")
Output:
Discover

func DiscoverFull

func DiscoverFull(fs storage.Medium, dir string) core.Result

DiscoverFull returns a rich discovery result with all markers and metadata.

result, err := build.DiscoverFull(storage.Local, ".")
if result.HasFrontend { ... }
Example

ExampleDiscoverFull references DiscoverFull on this package API surface.

_ = DiscoverFull
core.Println("DiscoverFull")
Output:
DiscoverFull

func ExpandVersionTemplate

func ExpandVersionTemplate(value, version string) string

ExpandVersionTemplate resolves the RFC-documented version placeholders used across build and release config surfaces.

Supported placeholders:

  • {{.Tag}} / {{Tag}} → v-prefixed version/tag
  • {{.Version}} / {{Version}} → legacy full version value

The helper also understands v{{.Version}} / v{{Version}} so RFC examples that prefix the placeholder do not render a duplicated "v".

Example

ExampleExpandVersionTemplate references ExpandVersionTemplate on this package API surface.

_ = ExpandVersionTemplate
core.Println("ExpandVersionTemplate")
Output:
ExpandVersionTemplate

func ExpandVersionTemplateMap

func ExpandVersionTemplateMap(values map[string]string, version string) map[string]string

ExpandVersionTemplateMap resolves version placeholders across a string map.

Example

ExampleExpandVersionTemplateMap references ExpandVersionTemplateMap on this package API surface.

_ = ExpandVersionTemplateMap
core.Println("ExpandVersionTemplateMap")
Output:
ExpandVersionTemplateMap

func ExpandVersionTemplates

func ExpandVersionTemplates(values []string, version string) []string

ExpandVersionTemplates resolves version placeholders across a string slice.

Example

ExampleExpandVersionTemplates references ExpandVersionTemplates on this package API surface.

_ = ExpandVersionTemplates
core.Println("ExpandVersionTemplates")
Output:
ExpandVersionTemplates

func FormatGitHubAnnotation

func FormatGitHubAnnotation(level, file string, line int, message string) string

FormatGitHubAnnotation formats a build message as a GitHub Actions annotation.

s := build.FormatGitHubAnnotation("error", "main.go", 42, "undefined: foo")
// "::error file=main.go,line=42::undefined: foo"

s := build.FormatGitHubAnnotation("warning", "pkg/build/ci.go", 10, "unused import")
// "::warning file=pkg/build/ci.go,line=10::unused import"
Example

ExampleFormatGitHubAnnotation references FormatGitHubAnnotation on this package API surface.

_ = FormatGitHubAnnotation
core.Println("FormatGitHubAnnotation")
Output:
FormatGitHubAnnotation

func GenerateAll

func GenerateAll(version, repo string) core.Result

GenerateAll is the backwards-compatible alias for GenerateAllInstallerScripts.

Example

ExampleGenerateAll references GenerateAll on this package API surface.

_ = GenerateAll
core.Println("GenerateAll")
Output:
GenerateAll

func GenerateAllInstallerScripts

func GenerateAllInstallerScripts(version, repo string) core.Result

GenerateAllInstallerScripts renders every installer script variant from the release version and repository.

scripts, err := build.GenerateAllInstallerScripts("v1.2.3", "dappcore/core")
// scripts["setup.sh"], scripts["ci.sh"], scripts["go.sh"], ...
Example

ExampleGenerateAllInstallerScripts references GenerateAllInstallerScripts on this package API surface.

_ = GenerateAllInstallerScripts
core.Println("GenerateAllInstallerScripts")
Output:
GenerateAllInstallerScripts

func GenerateInstaller

func GenerateInstaller(variant InstallerVariant, version, repo string) core.Result

GenerateInstaller is the backwards-compatible alias for GenerateInstallerScript.

Example

ExampleGenerateInstaller references GenerateInstaller on this package API surface.

_ = GenerateInstaller
core.Println("GenerateInstaller")
Output:
GenerateInstaller

func GenerateInstallerScript

func GenerateInstallerScript(variant InstallerVariant, version, repo string) core.Result

GenerateInstallerScript renders a single installer script variant from the release version and repository.

script, err := build.GenerateInstallerScript(build.VariantCI, "v1.2.3", "dappcore/core")
// script starts with the ci.sh template rendered for core binaries
Example

ExampleGenerateInstallerScript references GenerateInstallerScript on this package API surface.

_ = GenerateInstallerScript
core.Println("GenerateInstallerScript")
Output:
GenerateInstallerScript

func GenerateXcodeCloudScripts

func GenerateXcodeCloudScripts(projectDir string, cfg *BuildConfig) map[string]string

GenerateXcodeCloudScripts renders the three Xcode Cloud helper scripts.

Example

ExampleGenerateXcodeCloudScripts references GenerateXcodeCloudScripts on this package API surface.

_ = GenerateXcodeCloudScripts
core.Println("GenerateXcodeCloudScripts")
Output:
GenerateXcodeCloudScripts

func HasSubtreeNpm

func HasSubtreeNpm(fs storage.Medium, dir string) bool

HasSubtreeNpm checks for package.json within depth 2 subdirectories. Ignores root package.json, the conventional frontend/ directory, hidden directories, and node_modules directories. Returns true when a monorepo-style nested package.json is found.

ok := build.HasSubtreeNpm(storage.Local, ".") // true if apps/web/package.json exists
Example

ExampleHasSubtreeNpm references HasSubtreeNpm on this package API surface.

_ = HasSubtreeNpm
core.Println("HasSubtreeNpm")
Output:
HasSubtreeNpm

func HasXcodeCloudConfig

func HasXcodeCloudConfig(cfg *BuildConfig) bool

HasXcodeCloudConfig reports whether apple.xcode_cloud contains workflow metadata.

Example

ExampleHasXcodeCloudConfig references HasXcodeCloudConfig on this package API surface.

_ = HasXcodeCloudConfig
core.Println("HasXcodeCloudConfig")
Output:
HasXcodeCloudConfig

func InjectWebKitTag

func InjectWebKitTag(tags []string, distro string) []string

InjectWebKitTag adds webkit2_41 tag for Ubuntu 24.04+ if not already present. Called automatically by ComputeOptions when discovery detects Linux.

tags := build.InjectWebKitTag(tags, "24.04")  // ["webkit2_41"]
tags := build.InjectWebKitTag(tags, "22.04")  // unchanged
Example

ExampleInjectWebKitTag references InjectWebKitTag on this package API surface.

_ = InjectWebKitTag
core.Println("InjectWebKitTag")
Output:
InjectWebKitTag

func InstallerOutputName

func InstallerOutputName(variant InstallerVariant) string

InstallerOutputName returns the filename emitted for a variant.

Example

ExampleInstallerOutputName references InstallerOutputName on this package API surface.

_ = InstallerOutputName
core.Println("InstallerOutputName")
Output:
InstallerOutputName

func IsCPPProject

func IsCPPProject(fs storage.Medium, dir string) bool

IsCPPProject checks if the directory contains a C++ project (CMakeLists.txt).

if build.IsCPPProject(storage.Local, ".") { ... }

Example

ExampleIsCPPProject references IsCPPProject on this package API surface.

_ = IsCPPProject
core.Println("IsCPPProject")
Output:
IsCPPProject

func IsDockerProject

func IsDockerProject(fs storage.Medium, dir string) bool

IsDockerProject checks if the directory contains a Dockerfile or Containerfile.

if build.IsDockerProject(storage.Local, ".") { ... }
Example

ExampleIsDockerProject references IsDockerProject on this package API surface.

_ = IsDockerProject
core.Println("IsDockerProject")
Output:
IsDockerProject

func IsDocsProject

func IsDocsProject(fs storage.Medium, dir string) bool

IsDocsProject is the predictable alias for IsMkDocsProject.

ok := build.IsDocsProject(storage.Local, ".")
Example

ExampleIsDocsProject references IsDocsProject on this package API surface.

_ = IsDocsProject
core.Println("IsDocsProject")
Output:
IsDocsProject

func IsGoProject

func IsGoProject(fs storage.Medium, dir string) bool

IsGoProject checks if the directory contains a Go project (go.mod, go.work, or wails.json).

if build.IsGoProject(storage.Local, ".") { ... }

Example

ExampleIsGoProject references IsGoProject on this package API surface.

_ = IsGoProject
core.Println("IsGoProject")
Output:
IsGoProject

func IsLinuxKitProject

func IsLinuxKitProject(fs storage.Medium, dir string) bool

IsLinuxKitProject checks for linuxkit.yml or .core/linuxkit/*.yml.

ok := build.IsLinuxKitProject(storage.Local, ".")
Example

ExampleIsLinuxKitProject references IsLinuxKitProject on this package API surface.

_ = IsLinuxKitProject
core.Println("IsLinuxKitProject")
Output:
IsLinuxKitProject

func IsMkDocsProject

func IsMkDocsProject(fs storage.Medium, dir string) bool

IsMkDocsProject checks for MkDocs config at the project root or in docs/.

ok := build.IsMkDocsProject(storage.Local, ".")
Example

ExampleIsMkDocsProject references IsMkDocsProject on this package API surface.

_ = IsMkDocsProject
core.Println("IsMkDocsProject")
Output:
IsMkDocsProject

func IsNodeProject

func IsNodeProject(fs storage.Medium, dir string) bool

IsNodeProject checks if the directory contains a Node.js or Deno frontend project at the root, under frontend/, or in a visible nested subtree.

if build.IsNodeProject(storage.Local, ".") { ... }

Example

ExampleIsNodeProject references IsNodeProject on this package API surface.

_ = IsNodeProject
core.Println("IsNodeProject")
Output:
IsNodeProject

func IsPHPProject

func IsPHPProject(fs storage.Medium, dir string) bool

IsPHPProject checks if the directory contains a PHP project.

if build.IsPHPProject(storage.Local, ".") { ... }

Example

ExampleIsPHPProject references IsPHPProject on this package API surface.

_ = IsPHPProject
core.Println("IsPHPProject")
Output:
IsPHPProject

func IsPythonProject

func IsPythonProject(fs storage.Medium, dir string) bool

IsPythonProject checks for pyproject.toml or requirements.txt at the project root.

ok := build.IsPythonProject(storage.Local, ".")
Example

ExampleIsPythonProject references IsPythonProject on this package API surface.

_ = IsPythonProject
core.Println("IsPythonProject")
Output:
IsPythonProject

func IsRustProject

func IsRustProject(fs storage.Medium, dir string) bool

IsRustProject checks for Cargo.toml at the project root.

ok := build.IsRustProject(storage.Local, ".")
Example

ExampleIsRustProject references IsRustProject on this package API surface.

_ = IsRustProject
core.Println("IsRustProject")
Output:
IsRustProject

func IsTaskfileProject

func IsTaskfileProject(fs storage.Medium, dir string) bool

IsTaskfileProject checks for supported Taskfile names in the project root.

ok := build.IsTaskfileProject(storage.Local, ".")
Example

ExampleIsTaskfileProject references IsTaskfileProject on this package API surface.

_ = IsTaskfileProject
core.Println("IsTaskfileProject")
Output:
IsTaskfileProject

func IsWailsProject

func IsWailsProject(fs storage.Medium, dir string) bool

IsWailsProject checks if the directory contains a Wails project.

if build.IsWailsProject(storage.Local, ".") { ... }

Example

ExampleIsWailsProject references IsWailsProject on this package API surface.

_ = IsWailsProject
core.Println("IsWailsProject")
Output:
IsWailsProject

func LinuxKitBaseTemplate

func LinuxKitBaseTemplate(name string) core.Result

LinuxKitBaseTemplate loads the built-in LinuxKit template for a named base image.

Example

ExampleLinuxKitBaseTemplate references LinuxKitBaseTemplate on this package API surface.

_ = LinuxKitBaseTemplate
core.Println("LinuxKitBaseTemplate")
Output:
LinuxKitBaseTemplate

func LinuxKitResolve

func LinuxKitResolve(ctx context.Context, cfg LinuxKitResolveConfig) core.Result

LinuxKitResolve builds (or returns a cached) VZ guest artefact set and yields the artefact directory satisfying go-container's vzResolveGuestArtefacts contract (kernel + initrd.img + cmdline). This is the non-stopgap source for core/agent's vzResolveImage.

Resolve renders the embedded core-dev-vz definition (or cfg.Definition) with the staged vzagent binary, builds the kernel+initrd format with linuxkit, then renames linuxkit's <name>-kernel/<name>-initrd.img/<name>-cmdline outputs to the canonical kernel/initrd.img/cmdline names in cfg.OutputDir. A signature over the definition + the vzagent binary content guards the cache: an unchanged input set with kernel + initrd.img already present in OutputDir skips the build.

r := build.LinuxKitResolve(ctx, build.LinuxKitResolveConfig{
    VZAgentBinary: "/path/to/vzagent",
    OutputDir:     "/srv/core/vz/guest",
})
res := r.Value.(build.LinuxKitResolveResult)
// res.Dir → VZProvider Image.Path

func LoadConfig

func LoadConfig(fs storage.Medium, dir string) core.Result

LoadConfig loads build configuration from the .core/build.yaml file in the given directory. If the config file does not exist, it returns DefaultConfig(). Returns an error if the file exists but cannot be parsed.

cfg, err := build.LoadConfig(storage.Local, ".")

Example

ExampleLoadConfig references LoadConfig on this package API surface.

_ = LoadConfig
core.Println("LoadConfig")
Output:
LoadConfig

func LoadConfigAtPath

func LoadConfigAtPath(fs storage.Medium, configPath string) core.Result

LoadConfigAtPath loads build configuration from an explicit file path. If the file does not exist, it returns DefaultConfig(). Returns an error if the file exists but cannot be parsed.

cfg, err := build.LoadConfigAtPath(storage.Local, "/tmp/project/build.yaml")

Example

ExampleLoadConfigAtPath references LoadConfigAtPath on this package API surface.

_ = LoadConfigAtPath
core.Println("LoadConfigAtPath")
Output:
LoadConfigAtPath

func MediumIsLocal

func MediumIsLocal(medium storage.Medium) bool

MediumIsLocal reports whether a medium is the package-level local filesystem.

Example

ExampleMediumIsLocal references MediumIsLocal on this package API surface.

_ = MediumIsLocal
core.Println("MediumIsLocal")
Output:
MediumIsLocal

func Notarise

func Notarise(ctx context.Context, cfg NotariseConfig) core.Result

Notarise submits a signed app bundle or DMG to Apple and staples the ticket.

Example

ExampleNotarise references Notarise on this package API surface.

_ = Notarise
core.Println("Notarise")
Output:
Notarise

func NpmRequested

func NpmRequested(configuredBuild string) bool

NpmRequested reports whether the current build should prefer an npm-backed frontend build. It honours the action-style environment override first and then the persisted/configured command override.

Example

ExampleNpmRequested references NpmRequested on this package API surface.

_ = NpmRequested
core.Println("NpmRequested")
Output:
NpmRequested

func ParseArchiveFormat

func ParseArchiveFormat(value string) core.Result

ParseArchiveFormat converts a user-facing archive format string into an ArchiveFormat.

format, err := build.ParseArchiveFormat("xz")  // → build.ArchiveFormatXZ
format, err := build.ParseArchiveFormat("zip") // → build.ArchiveFormatZip
Example

ExampleParseArchiveFormat references ParseArchiveFormat on this package API surface.

_ = ParseArchiveFormat
core.Println("ParseArchiveFormat")
Output:
ParseArchiveFormat

func PrimaryType

func PrimaryType(fs storage.Medium, dir string) core.Result

PrimaryType returns the most specific project type detected in the directory. Returns empty string if no project type is detected.

pt, err := build.PrimaryType(storage.Local, ".") // → "go"

Example

ExamplePrimaryType references PrimaryType on this package API surface.

_ = PrimaryType
core.Println("PrimaryType")
Output:
PrimaryType

func RegisterDefaultBuilderResolver

func RegisterDefaultBuilderResolver(resolver BuilderResolver)

RegisterDefaultBuilderResolver installs the builder resolver used by Run when the caller does not provide one explicitly.

Example

ExampleRegisterDefaultBuilderResolver references RegisterDefaultBuilderResolver on this package API surface.

_ = RegisterDefaultBuilderResolver
core.Println("RegisterDefaultBuilderResolver")
Output:
RegisterDefaultBuilderResolver

func ReleaseWorkflowPath

func ReleaseWorkflowPath(projectDir string) string

ReleaseWorkflowPath joins a project directory with the conventional workflow path.

build.ReleaseWorkflowPath("/home/user/project") // /home/user/project/.github/workflows/release.yml

Example

ExampleReleaseWorkflowPath references ReleaseWorkflowPath on this package API surface.

_ = ReleaseWorkflowPath
core.Println("ReleaseWorkflowPath")
Output:
ReleaseWorkflowPath

func ResolveBuildName

func ResolveBuildName(projectDir string, cfg *BuildConfig, override string) string

ResolveBuildName resolves the output name from an explicit override, config, or the project directory name.

name := build.ResolveBuildName("/tmp/project", cfg, "")
Example

ExampleResolveBuildName references ResolveBuildName on this package API surface.

_ = ResolveBuildName
core.Println("ResolveBuildName")
Output:
ResolveBuildName

func ResolveDockerfilePath

func ResolveDockerfilePath(fs storage.Medium, dir string) string

ResolveDockerfilePath returns the first Docker manifest path that exists.

dockerfile := build.ResolveDockerfilePath(storage.Local, ".")
Example

ExampleResolveDockerfilePath references ResolveDockerfilePath on this package API surface.

_ = ResolveDockerfilePath
core.Println("ResolveDockerfilePath")
Output:
ResolveDockerfilePath

func ResolveFrontendSetupDirs

func ResolveFrontendSetupDirs(fs storage.Medium, dir string, allowEmptyFallback bool) []string

ResolveFrontendSetupDirs returns frontend directories that participate in the action-style setup phase.

dirs := build.ResolveFrontendSetupDirs(storage.Local, ".", true)
// ["./frontend"] when the project only has an empty frontend/ directory
// ["./apps/web"] when a nested package.json is detected
Example

ExampleResolveFrontendSetupDirs references ResolveFrontendSetupDirs on this package API surface.

_ = ResolveFrontendSetupDirs
core.Println("ResolveFrontendSetupDirs")
Output:
ResolveFrontendSetupDirs

func ResolveLinuxPackages

func ResolveLinuxPackages(types []ProjectType, distro string) []string

ResolveLinuxPackages returns distro-aware system dependencies for the detected stack.

packages := build.ResolveLinuxPackages([]build.ProjectType{build.ProjectTypeWails}, "24.04")
// []string{"libwebkit2gtk-4.1-dev"}
Example

ExampleResolveLinuxPackages references ResolveLinuxPackages on this package API surface.

_ = ResolveLinuxPackages
core.Println("ResolveLinuxPackages")
Output:
ResolveLinuxPackages

func ResolveMkDocsConfigPath

func ResolveMkDocsConfigPath(fs storage.Medium, dir string) string

ResolveMkDocsConfigPath returns the first MkDocs config path that exists.

configPath := build.ResolveMkDocsConfigPath(storage.Local, ".")
Example

ExampleResolveMkDocsConfigPath references ResolveMkDocsConfigPath on this package API surface.

_ = ResolveMkDocsConfigPath
core.Println("ResolveMkDocsConfigPath")
Output:
ResolveMkDocsConfigPath

func ResolveOutputMedium

func ResolveOutputMedium(cfg *Config) storage.Medium

ResolveOutputMedium returns the artifact output medium for a runtime build config, falling back to storage.Local when no explicit medium was provided.

Example

ExampleResolveOutputMedium references ResolveOutputMedium on this package API surface.

_ = ResolveOutputMedium
core.Println("ResolveOutputMedium")
Output:
ResolveOutputMedium

func ResolveReleaseWorkflowInputPath

func ResolveReleaseWorkflowInputPath(projectDir, pathInput, outputPathInput string) core.Result

ResolveReleaseWorkflowInputPath resolves a workflow target from the CLI/API `path` field and its `output` alias.

build.ResolveReleaseWorkflowInputPath("/tmp/project", "", "") // /tmp/project/.github/workflows/release.yml build.ResolveReleaseWorkflowInputPath("/tmp/project", "./ci", "") // /tmp/project/ci/release.yml build.ResolveReleaseWorkflowInputPath("/tmp/project", "ci/release.yml", "") // /tmp/project/ci/release.yml build.ResolveReleaseWorkflowInputPath("/tmp/project", "", "ci/release.yml") // /tmp/project/ci/release.yml build.ResolveReleaseWorkflowInputPath("/tmp/project", "ci/release.yml", "ci.yml") // error

Example

ExampleResolveReleaseWorkflowInputPath references ResolveReleaseWorkflowInputPath on this package API surface.

_ = ResolveReleaseWorkflowInputPath
core.Println("ResolveReleaseWorkflowInputPath")
Output:
ResolveReleaseWorkflowInputPath

func ResolveReleaseWorkflowInputPathAliases

func ResolveReleaseWorkflowInputPathAliases(filesystem io_interface.Medium, projectDir, pathInput, workflowPathInput, workflowPathSnakeInput, workflowPathHyphenInput string) core.Result

ResolveReleaseWorkflowInputPathAliases resolves the workflow path across the public path aliases and treats an existing directory as a directory even when the caller omits a trailing slash.

build.ResolveReleaseWorkflowInputPathAliases(io.Local, "/tmp/project", "ci", "", "", "") // /tmp/project/ci/release.yml build.ResolveReleaseWorkflowInputPathAliases(io.Local, "/tmp/project", "", "ci", "", "") // /tmp/project/ci/release.yml build.ResolveReleaseWorkflowInputPathAliases(io.Local, "/tmp/project", "", "", "ci", "") // /tmp/project/ci/release.yml build.ResolveReleaseWorkflowInputPathAliases(io.Local, "/tmp/project", "", "", "", "ci") // /tmp/project/ci/release.yml

Example

ExampleResolveReleaseWorkflowInputPathAliases references ResolveReleaseWorkflowInputPathAliases on this package API surface.

_ = ResolveReleaseWorkflowInputPathAliases
core.Println("ResolveReleaseWorkflowInputPathAliases")
Output:
ResolveReleaseWorkflowInputPathAliases

func ResolveReleaseWorkflowInputPathWithMedium

func ResolveReleaseWorkflowInputPathWithMedium(filesystem io_interface.Medium, projectDir, pathInput, outputPathInput string) core.Result

ResolveReleaseWorkflowInputPathWithMedium resolves the workflow path and treats an existing directory as a directory even when the caller omits a trailing slash.

build.ResolveReleaseWorkflowInputPathWithMedium(io.Local, "/tmp/project", "ci", "") // /tmp/project/ci/release.yml when /tmp/project/ci exists build.ResolveReleaseWorkflowInputPathWithMedium(io.Local, "/tmp/project", "./ci", "") // /tmp/project/ci/release.yml

Example

ExampleResolveReleaseWorkflowInputPathWithMedium references ResolveReleaseWorkflowInputPathWithMedium on this package API surface.

_ = ResolveReleaseWorkflowInputPathWithMedium
core.Println("ResolveReleaseWorkflowInputPathWithMedium")
Output:
ResolveReleaseWorkflowInputPathWithMedium

func ResolveReleaseWorkflowOutputPath

func ResolveReleaseWorkflowOutputPath(outputPathInput, outputPathSnakeInput, legacyOutputInput string) core.Result

ResolveReleaseWorkflowOutputPath("ci/release.yml", "", "") // "ci/release.yml" ResolveReleaseWorkflowOutputPath("", "ci/release.yml", "") // "ci/release.yml" ResolveReleaseWorkflowOutputPath("", "", "ci/release.yml") // "ci/release.yml" ResolveReleaseWorkflowOutputPath("ci/release.yml", "ops.yml", "") // error

Example

ExampleResolveReleaseWorkflowOutputPath references ResolveReleaseWorkflowOutputPath on this package API surface.

_ = ResolveReleaseWorkflowOutputPath
core.Println("ResolveReleaseWorkflowOutputPath")
Output:
ResolveReleaseWorkflowOutputPath

func ResolveReleaseWorkflowOutputPathAliases

func ResolveReleaseWorkflowOutputPathAliases(
	outputPathInput,
	outputPathHyphenInput,
	outputPathSnakeInput,
	legacyOutputInput,
	workflowOutputPathInput,
	workflowOutputSnakeInput,
	workflowOutputHyphenInput,
	workflowOutputPathSnakeInput,
	workflowOutputPathHyphenInput string,
) core.Result

ResolveReleaseWorkflowOutputPathAliases resolves every public workflow output alias across the CLI, API, and UI layers.

build.ResolveReleaseWorkflowOutputPathAliases("ci/release.yml", "", "", "", "", "", "", "", "") // "ci/release.yml" build.ResolveReleaseWorkflowOutputPathAliases("", "ci/release.yml", "", "", "", "", "", "", "") // "ci/release.yml" build.ResolveReleaseWorkflowOutputPathAliases("", "", "", "", "ci/release.yml", "", "", "", "") // "ci/release.yml" build.ResolveReleaseWorkflowOutputPathAliases("", "", "", "", "", "ci/release.yml", "", "", "") // "ci/release.yml"

Example

ExampleResolveReleaseWorkflowOutputPathAliases references ResolveReleaseWorkflowOutputPathAliases on this package API surface.

_ = ResolveReleaseWorkflowOutputPathAliases
core.Println("ResolveReleaseWorkflowOutputPathAliases")
Output:
ResolveReleaseWorkflowOutputPathAliases

func ResolveReleaseWorkflowOutputPathAliasesInProject

func ResolveReleaseWorkflowOutputPathAliasesInProject(
	projectDir,
	outputPathInput,
	outputPathHyphenInput,
	outputPathSnakeInput,
	legacyOutputInput,
	workflowOutputPathInput,
	workflowOutputSnakeInput,
	workflowOutputHyphenInput,
	workflowOutputPathSnakeInput,
	workflowOutputPathHyphenInput string,
) core.Result

ResolveReleaseWorkflowOutputPathAliasesInProject resolves the workflow output aliases relative to a project directory before checking for conflicts.

build.ResolveReleaseWorkflowOutputPathAliasesInProject("/tmp/project", "ci/release.yml", "", "", "", "", "", "", "") // "/tmp/project/ci/release.yml" build.ResolveReleaseWorkflowOutputPathAliasesInProject("/tmp/project", "", "", "", "", "/tmp/project/ci/release.yml", "", "", "") // "/tmp/project/ci/release.yml"

Example

ExampleResolveReleaseWorkflowOutputPathAliasesInProject references ResolveReleaseWorkflowOutputPathAliasesInProject on this package API surface.

_ = ResolveReleaseWorkflowOutputPathAliasesInProject
core.Println("ResolveReleaseWorkflowOutputPathAliasesInProject")
Output:
ResolveReleaseWorkflowOutputPathAliasesInProject

func ResolveReleaseWorkflowOutputPathAliasesInProjectWithMedium

func ResolveReleaseWorkflowOutputPathAliasesInProjectWithMedium(
	filesystem io_interface.Medium,
	projectDir,
	outputPathInput,
	outputPathHyphenInput,
	outputPathSnakeInput,
	legacyOutputInput,
	workflowOutputPathInput,
	workflowOutputSnakeInput,
	workflowOutputHyphenInput,
	workflowOutputPathSnakeInput,
	workflowOutputPathHyphenInput string,
) core.Result

ResolveReleaseWorkflowOutputPathAliasesInProjectWithMedium resolves the workflow output aliases relative to a project directory and uses the provided filesystem medium to treat existing directories as workflow directories even when callers omit a trailing separator.

build.ResolveReleaseWorkflowOutputPathAliasesInProjectWithMedium(io.Local, "/tmp/project", "", "", "", "", "/tmp/project/ci", "", "", "") // "/tmp/project/ci/release.yml"

Example

ExampleResolveReleaseWorkflowOutputPathAliasesInProjectWithMedium references ResolveReleaseWorkflowOutputPathAliasesInProjectWithMedium on this package API surface.

_ = ResolveReleaseWorkflowOutputPathAliasesInProjectWithMedium
core.Println("ResolveReleaseWorkflowOutputPathAliasesInProjectWithMedium")
Output:
ResolveReleaseWorkflowOutputPathAliasesInProjectWithMedium

func ResolveReleaseWorkflowOutputPathWithMedium

func ResolveReleaseWorkflowOutputPathWithMedium(filesystem io_interface.Medium, projectDir, outputPath string) string

ResolveReleaseWorkflowOutputPathWithMedium resolves the workflow output path relative to the project directory and treats an existing directory as a workflow directory even when the caller omits a trailing slash.

build.ResolveReleaseWorkflowOutputPathWithMedium(io.Local, "/tmp/project", "ci") // /tmp/project/ci/release.yml when /tmp/project/ci exists build.ResolveReleaseWorkflowOutputPathWithMedium(io.Local, "/tmp/project", ".github/workflows") // /tmp/project/.github/workflows/release.yml

Example

ExampleResolveReleaseWorkflowOutputPathWithMedium references ResolveReleaseWorkflowOutputPathWithMedium on this package API surface.

_ = ResolveReleaseWorkflowOutputPathWithMedium
core.Println("ResolveReleaseWorkflowOutputPathWithMedium")
Output:
ResolveReleaseWorkflowOutputPathWithMedium

func ResolveReleaseWorkflowPath

func ResolveReleaseWorkflowPath(projectDir, outputPath string) string

ResolveReleaseWorkflowPath resolves the workflow output path relative to the project directory when the caller supplies a relative path.

build.ResolveReleaseWorkflowPath("/tmp/project", "") // /tmp/project/.github/workflows/release.yml build.ResolveReleaseWorkflowPath("/tmp/project", "./ci") // /tmp/project/ci/release.yml build.ResolveReleaseWorkflowPath("/tmp/project", ".github/workflows") // /tmp/project/.github/workflows/release.yml build.ResolveReleaseWorkflowPath("/tmp/project", "ci/release.yml") // /tmp/project/ci/release.yml build.ResolveReleaseWorkflowPath("/tmp/project", "ci") // /tmp/project/ci/release.yml build.ResolveReleaseWorkflowPath("/tmp/project", "/tmp/release.yml") // /tmp/release.yml

Example

ExampleResolveReleaseWorkflowPath references ResolveReleaseWorkflowPath on this package API surface.

_ = ResolveReleaseWorkflowPath
core.Println("ResolveReleaseWorkflowPath")
Output:
ResolveReleaseWorkflowPath

func Run

func Run(opts ...RunOption) core.Result

Run executes the build pipeline and mirrors produced artifacts into the configured output medium.

result := build.Run(build.WithOutput(io.Local))
Example

ExampleRun references Run on this package API surface.

_ = Run
core.Println("Run")
Output:
Run

func SetupBuildCache

func SetupBuildCache(fs storage.Medium, dir string, cfg *BuildConfig) core.Result

SetupBuildCache prepares the cache configuration stored on a build config.

err := build.SetupBuildCache(storage.Local, ".", cfg)
Example

ExampleSetupBuildCache references SetupBuildCache on this package API surface.

_ = SetupBuildCache
core.Println("SetupBuildCache")
Output:
SetupBuildCache

func SetupCache

func SetupCache(args ...any) core.Result

SetupCache normalises cache paths and ensures the cache directories exist.

The canonical form is the 3-argument variant:

err := build.SetupCache(storage.Local, ".", &build.CacheConfig{
    Enabled: true,
    Paths: []string{"~/.cache/go-build", "~/go/pkg/mod"},
})

A compatibility 1-argument form is also supported for the RFC-shaped API:

err := build.SetupCache(build.CacheConfig{Enabled: true})
Example

ExampleSetupCache references SetupCache on this package API surface.

_ = SetupCache
core.Println("SetupCache")
Output:
SetupCache

func Sign

func Sign(ctx context.Context, cfg SignConfig) core.Result

Sign code-signs an app bundle or Apple artefact.

Example

ExampleSign references Sign on this package API surface.

_ = Sign
core.Println("Sign")
Output:
Sign

func SubmitAppStore

func SubmitAppStore(ctx context.Context, cfg AppStoreConfig) core.Result

SubmitAppStore uploads a packaged macOS artefact for App Store Connect review.

Example

ExampleSubmitAppStore references SubmitAppStore on this package API surface.

_ = SubmitAppStore
core.Println("SubmitAppStore")
Output:
SubmitAppStore

func SuggestStack

func SuggestStack(types []ProjectType) string

SuggestStack returns the action-oriented stack suggestion for the detected project markers. This keeps discovery compatible with the v3 action naming, where Wails-backed projects use the "wails2" stack identifier.

stack := build.SuggestStack([]build.ProjectType{build.ProjectTypeWails}) // "wails2"
Example

ExampleSuggestStack references SuggestStack on this package API surface.

_ = SuggestStack
core.Println("SuggestStack")
Output:
SuggestStack

func UploadTestFlight

func UploadTestFlight(ctx context.Context, cfg TestFlightConfig) core.Result

UploadTestFlight uploads a packaged macOS artefact to TestFlight.

Example

ExampleUploadTestFlight references UploadTestFlight on this package API surface.

_ = UploadTestFlight
core.Println("UploadTestFlight")
Output:
UploadTestFlight

func ValidateVersionIdentifier

func ValidateVersionIdentifier(version string) core.Result

ValidateVersionIdentifier reports whether a version override is safe when a caller also permits the absence of a version.

Example

ExampleValidateVersionIdentifier references ValidateVersionIdentifier on this package API surface.

_ = ValidateVersionIdentifier
core.Println("ValidateVersionIdentifier")
Output:
ValidateVersionIdentifier

func ValidateVersionString

func ValidateVersionString(version string) core.Result

ValidateVersionString reports whether a version string is safe to embed in linker flags, generated installers, and release metadata.

Safe identifiers are non-empty ASCII strings limited to characters that cannot split a linker flag or shell token.

Example

ExampleValidateVersionString references ValidateVersionString on this package API surface.

_ = ValidateVersionString
core.Println("ValidateVersionString")
Output:
ValidateVersionString

func VersionLinkerFlag

func VersionLinkerFlag(version string) core.Result

VersionLinkerFlag returns a safe -X linker flag for injecting the build version. Only ASCII version strings without whitespace or shell metacharacters are accepted so the resulting ldflags string cannot be split into extra linker options.

flag, err := build.VersionLinkerFlag("v1.2.3")
Example

ExampleVersionLinkerFlag references VersionLinkerFlag on this package API surface.

_ = VersionLinkerFlag
core.Println("VersionLinkerFlag")
Output:
VersionLinkerFlag

func WriteArtifactMeta

func WriteArtifactMeta(fs io_interface.Medium, path string, buildName string, target Target, ci *CIContext) core.Result

WriteArtifactMeta writes an artifact_meta.json file to path. The file contains the build name, target OS/arch, and CI metadata if available.

err := build.WriteArtifactMeta(io.Local, "dist/artifact_meta.json", "core", build.Target{OS: "linux", Arch: "amd64"}, ci)
// writes metadata fields for name, platform, arch, tag, and CI status.
Example

ExampleWriteArtifactMeta references WriteArtifactMeta on this package API surface.

_ = WriteArtifactMeta
core.Println("WriteArtifactMeta")
Output:
WriteArtifactMeta

func WriteChecksumFile

func WriteChecksumFile(fs io_interface.Medium, artifacts []Artifact, path string) core.Result

WriteChecksumFile writes a CHECKSUMS.txt file with the format:

sha256hash  filename1
sha256hash  filename2

The artifacts should have their Checksum fields filled (call ChecksumAll first). Filenames are relative to the output directory (just the basename).

err := build.WriteChecksumFile(io.Local, artifacts, "dist/CHECKSUMS.txt")

Example

ExampleWriteChecksumFile references WriteChecksumFile on this package API surface.

_ = WriteChecksumFile
core.Println("WriteChecksumFile")
Output:
WriteChecksumFile

func WriteEntitlements

func WriteEntitlements(filesystem storage.Medium, path string, entitlements Entitlements) core.Result

WriteEntitlements writes an entitlements plist file.

Example

ExampleWriteEntitlements references WriteEntitlements on this package API surface.

_ = WriteEntitlements
core.Println("WriteEntitlements")
Output:
WriteEntitlements

func WriteInfoPlist

func WriteInfoPlist(filesystem storage.Medium, appPath string, plist InfoPlist) core.Result

WriteInfoPlist writes the app bundle Info.plist and returns its path.

Example

ExampleWriteInfoPlist references WriteInfoPlist on this package API surface.

_ = WriteInfoPlist
core.Println("WriteInfoPlist")
Output:
WriteInfoPlist

func WriteReleaseWorkflow

func WriteReleaseWorkflow(filesystem io_interface.Medium, outputPath string) core.Result

WriteReleaseWorkflow writes the embedded release workflow template to outputPath.

build.WriteReleaseWorkflow(io.Local, "") // writes .github/workflows/release.yml build.WriteReleaseWorkflow(io.Local, "ci") // writes ./ci/release.yml under the project root build.WriteReleaseWorkflow(io.Local, "./ci") // writes ./ci/release.yml under the project root build.WriteReleaseWorkflow(io.Local, ".github/workflows") // writes .github/workflows/release.yml build.WriteReleaseWorkflow(io.Local, "ci/release.yml") // writes ./ci/release.yml under the project root build.WriteReleaseWorkflow(io.Local, "/tmp/repo/.github/workflows/release.yml") // writes the absolute path unchanged

Example

ExampleWriteReleaseWorkflow references WriteReleaseWorkflow on this package API surface.

_ = WriteReleaseWorkflow
core.Println("WriteReleaseWorkflow")
Output:
WriteReleaseWorkflow

func WriteXcodeCloudScripts

func WriteXcodeCloudScripts(filesystem storage.Medium, projectDir string, cfg *BuildConfig) core.Result

WriteXcodeCloudScripts writes the Xcode Cloud helper scripts to ci_scripts/.

Example

ExampleWriteXcodeCloudScripts references WriteXcodeCloudScripts on this package API surface.

_ = WriteXcodeCloudScripts
core.Println("WriteXcodeCloudScripts")
Output:
WriteXcodeCloudScripts

Types

type AppStoreConfig

type AppStoreConfig struct {
	AppPath        string `json:"app_path" yaml:"app_path"`
	APIKeyID       string `json:"api_key_id" yaml:"api_key_id"`
	APIKeyIssuerID string `json:"api_key_issuer_id" yaml:"api_key_issuer_id"`
	APIKeyPath     string `json:"api_key_path" yaml:"api_key_path"`
	CertIdentity   string `json:"cert_identity" yaml:"cert_identity"`
	Version        string `json:"version" yaml:"version"`
	ReleaseType    string `json:"release_type" yaml:"release_type"`
}

AppStoreConfig defines the App Store Connect submission inputs.

type AppleBuildResult

type AppleBuildResult struct {
	BundlePath       string
	DMGPath          string
	DistributionPath string
	InfoPlistPath    string
	EntitlementsPath string
	BuildNumber      string
	Version          string
}

AppleBuildResult captures the primary outputs of the Apple pipeline.

type AppleConfig

type AppleConfig struct {
	TeamID       string `json:"team_id,omitempty" yaml:"team_id,omitempty"`
	BundleID     string `json:"bundle_id,omitempty" yaml:"bundle_id,omitempty"`
	Arch         string `json:"arch,omitempty" yaml:"arch,omitempty"`
	CertIdentity string `json:"cert_identity,omitempty" yaml:"cert_identity,omitempty"`
	ProfilePath  string `json:"profile_path,omitempty" yaml:"profile_path,omitempty"`
	KeychainPath string `json:"keychain_path,omitempty" yaml:"keychain_path,omitempty"`
	MetadataPath string `json:"metadata_path,omitempty" yaml:"metadata_path,omitempty"`

	Sign       *bool `json:"sign,omitempty" yaml:"sign,omitempty"`
	Notarise   *bool `json:"notarise,omitempty" yaml:"notarise,omitempty"`
	DMG        *bool `json:"dmg,omitempty" yaml:"dmg,omitempty"`
	TestFlight *bool `json:"testflight,omitempty" yaml:"testflight,omitempty"`
	AppStore   *bool `json:"appstore,omitempty" yaml:"appstore,omitempty"`

	APIKeyID       string `json:"api_key_id,omitempty" yaml:"api_key_id,omitempty"`
	APIKeyIssuerID string `json:"api_key_issuer_id,omitempty" yaml:"api_key_issuer_id,omitempty"`
	APIKeyPath     string `json:"api_key_path,omitempty" yaml:"api_key_path,omitempty"`
	AppleID        string `json:"apple_id,omitempty" yaml:"apple_id,omitempty"`
	Password       string `json:"password,omitempty" yaml:"password,omitempty"`

	BundleDisplayName string           `json:"bundle_display_name,omitempty" yaml:"bundle_display_name,omitempty"`
	MinSystemVersion  string           `json:"min_system_version,omitempty" yaml:"min_system_version,omitempty"`
	Category          string           `json:"category,omitempty" yaml:"category,omitempty"`
	Copyright         string           `json:"copyright,omitempty" yaml:"copyright,omitempty"`
	PrivacyPolicyURL  string           `json:"privacy_policy_url,omitempty" yaml:"privacy_policy_url,omitempty"`
	DMGBackground     string           `json:"dmg_background,omitempty" yaml:"dmg_background,omitempty"`
	DMGVolumeName     string           `json:"dmg_volume_name,omitempty" yaml:"dmg_volume_name,omitempty"`
	EntitlementsPath  string           `json:"entitlements_path,omitempty" yaml:"entitlements_path,omitempty"`
	XcodeCloud        XcodeCloudConfig `json:"xcode_cloud" yaml:"xcode_cloud,omitempty"`
}

AppleConfig holds macOS Apple pipeline settings loaded from .core/build.yaml. Pointer booleans preserve the difference between an explicit false and an unset field.

func (AppleConfig) Resolve

func (cfg AppleConfig) Resolve() AppleOptions

Resolve materialises a config-backed Apple runtime option set.

Example

ExampleAppleConfig_Resolve references AppleConfig.Resolve on this package API surface.

_ = (*AppleConfig).Resolve
core.Println("AppleConfig.Resolve")
Output:
AppleConfig.Resolve

type AppleOptions

type AppleOptions struct {
	TeamID       string `json:"team_id" yaml:"team_id"`
	BundleID     string `json:"bundle_id" yaml:"bundle_id"`
	Arch         string `json:"arch" yaml:"arch"`
	CertIdentity string `json:"cert_identity" yaml:"cert_identity"`
	ProfilePath  string `json:"profile_path" yaml:"profile_path"`
	KeychainPath string `json:"keychain_path" yaml:"keychain_path"`
	MetadataPath string `json:"metadata_path" yaml:"metadata_path"`

	Sign       bool `json:"sign" yaml:"sign"`
	Notarise   bool `json:"notarise" yaml:"notarise"`
	DMG        bool `json:"dmg" yaml:"dmg"`
	TestFlight bool `json:"testflight" yaml:"testflight"`
	AppStore   bool `json:"appstore" yaml:"appstore"`

	APIKeyID       string `json:"api_key_id" yaml:"api_key_id"`
	APIKeyIssuerID string `json:"api_key_issuer_id" yaml:"api_key_issuer_id"`
	APIKeyPath     string `json:"api_key_path" yaml:"api_key_path"`
	AppleID        string `json:"apple_id" yaml:"apple_id"`
	Password       string `json:"password" yaml:"password"`

	BundleDisplayName string `json:"bundle_display_name" yaml:"bundle_display_name"`
	MinSystemVersion  string `json:"min_system_version" yaml:"min_system_version"`
	Category          string `json:"category" yaml:"category"`
	Copyright         string `json:"copyright" yaml:"copyright"`
	PrivacyPolicyURL  string `json:"privacy_policy_url" yaml:"privacy_policy_url"`
	DMGBackground     string `json:"dmg_background" yaml:"dmg_background"`
	DMGVolumeName     string `json:"dmg_volume_name" yaml:"dmg_volume_name"`
	EntitlementsPath  string `json:"entitlements_path" yaml:"entitlements_path"`
}

AppleOptions holds the resolved runtime settings for the macOS Apple pipeline.

func DefaultAppleOptions

func DefaultAppleOptions() AppleOptions

DefaultAppleOptions returns the runtime defaults for the Apple build pipeline.

Example

ExampleDefaultAppleOptions references DefaultAppleOptions on this package API surface.

_ = DefaultAppleOptions
core.Println("DefaultAppleOptions")
Output:
DefaultAppleOptions

type ArchiveFormat

type ArchiveFormat string

ArchiveFormat specifies the compression format for archives.

var fmt build.ArchiveFormat = build.ArchiveFormatGzip

const (
	// ArchiveFormatGzip uses tar.gz (gzip compression) - widely compatible.
	ArchiveFormatGzip ArchiveFormat = "gz"
	// ArchiveFormatXZ uses tar.xz (xz/LZMA2 compression) - better compression ratio.
	ArchiveFormatXZ ArchiveFormat = "xz"
	// ArchiveFormatZip uses zip archives on any platform.
	ArchiveFormatZip ArchiveFormat = "zip"
)

type Artifact

type Artifact struct {
	Path     string
	OS       string
	Arch     string
	Checksum string
}

Artifact represents a build output file.

a := build.Artifact{Path: "dist/linux_amd64/myapp", OS: "linux", Arch: "amd64"}

type Build

type Build struct {
	// Type overrides project type auto-detection (e.g., "go", "wails", "docker").
	Type string `json:"type" yaml:"type"`
	// CGO enables CGO for the build.
	CGO bool `json:"cgo" yaml:"cgo"`
	// Obfuscate uses garble instead of go build for binary obfuscation.
	Obfuscate bool `json:"obfuscate" yaml:"obfuscate"`
	// DenoBuild overrides the default `deno task build` invocation for Deno-backed builds.
	DenoBuild string `json:"deno_build,omitempty" yaml:"deno_build,omitempty"`
	// NpmBuild overrides the default `npm run build` invocation for npm-backed builds.
	NpmBuild string `json:"npm_build,omitempty" yaml:"npm_build,omitempty"`
	// NSIS enables Windows NSIS installer generation (Wails projects only).
	NSIS bool `json:"nsis" yaml:"nsis"`
	// WebView2 sets the WebView2 delivery method: download|embed|browser|error.
	WebView2 string `json:"webview2,omitempty" yaml:"webview2,omitempty"`
	// Flags are additional build flags (e.g., ["-trimpath"]).
	Flags []string `json:"flags" yaml:"flags"`
	// LDFlags are linker flags (e.g., ["-s", "-w"]).
	LDFlags []string `json:"ldflags" yaml:"ldflags"`
	// BuildTags are Go build tags passed through to `go build`.
	BuildTags []string `json:"build_tags,omitempty" yaml:"build_tags,omitempty"`
	// ArchiveFormat selects the archive compression format for build outputs.
	// Supported values are "gz", "xz", and "zip"; empty uses gzip.
	ArchiveFormat string `json:"archive_format,omitempty" yaml:"archive_format,omitempty"`
	// Env are additional environment variables.
	Env []string `json:"env" yaml:"env"`
	// Cache controls build cache setup.
	Cache CacheConfig `json:"cache" yaml:"cache,omitempty"`
	// Dockerfile is the path to the Dockerfile used by Docker builds.
	Dockerfile string `json:"dockerfile,omitempty" yaml:"dockerfile,omitempty"`
	// Registry is the container registry used for Docker image references.
	Registry string `json:"registry,omitempty" yaml:"registry,omitempty"`
	// Image is the image name used for Docker builds.
	Image string `json:"image,omitempty" yaml:"image,omitempty"`
	// Tags are Docker image tags to apply.
	Tags []string `json:"tags,omitempty" yaml:"tags,omitempty"`
	// BuildArgs are Docker build arguments.
	BuildArgs map[string]string `json:"build_args,omitempty" yaml:"build_args,omitempty"`
	// Push enables pushing Docker images after build.
	Push bool `json:"push,omitempty" yaml:"push,omitempty"`
	// Load loads a single-platform Docker image into the local daemon after build.
	Load bool `json:"load,omitempty" yaml:"load,omitempty"`
	// LinuxKitConfig is the path to the LinuxKit config file.
	LinuxKitConfig string `json:"linuxkit_config,omitempty" yaml:"linuxkit_config,omitempty"`
	// Formats is the list of LinuxKit output formats.
	// Supported values include iso, raw, qcow2, vmdk, vhd, gcp, aws, docker, tar, and kernel+initrd.
	Formats []string `json:"formats,omitempty" yaml:"formats,omitempty"`
}

Build holds build-time settings.

cfg.Build.LDFlags = []string{"-s", "-w", "-X main.version=" + version}

type BuildConfig

type BuildConfig struct {
	// Version is the config file format version.
	Version int `json:"version" yaml:"version"`
	// Project contains project metadata.
	Project Project `json:"project" yaml:"project"`
	// Build contains build settings.
	Build Build `json:"build" yaml:"build"`
	// Apple contains macOS Apple pipeline settings.
	Apple AppleConfig `json:"apple" yaml:"apple,omitempty"`
	// PreBuild contains declarative frontend build hooks such as Deno or npm.
	PreBuild PreBuild `json:"pre_build" yaml:"pre_build,omitempty"`
	// Targets defines the build targets.
	Targets []TargetConfig `json:"targets" yaml:"targets"`
	// Sign contains code signing configuration.
	Sign signing.SignConfig `json:"sign" yaml:"sign,omitempty"`
	// SDK contains OpenAPI SDK generation configuration.
	SDK *sdk.Config `json:"sdk,omitempty" yaml:"sdk,omitempty"`
	// LinuxKit contains immutable image configuration for `core build image`.
	LinuxKit LinuxKitConfig `json:"linuxkit" yaml:"linuxkit,omitempty"`
}

BuildConfig holds the complete build configuration loaded from .core/build.yaml. This is distinct from Config which holds runtime build parameters.

cfg, err := build.LoadConfig(storage.Local, ".")

func CloneBuildConfig

func CloneBuildConfig(cfg *BuildConfig) *BuildConfig

CloneBuildConfig returns a deep copy of a build config so callers can apply runtime overrides without mutating the persisted or caller-owned config.

clone := build.CloneBuildConfig(cfg)
Example

ExampleCloneBuildConfig references CloneBuildConfig on this package API surface.

_ = CloneBuildConfig
core.Println("CloneBuildConfig")
Output:
CloneBuildConfig

func DefaultConfig

func DefaultConfig() *BuildConfig

DefaultConfig returns sensible defaults for Go projects.

cfg := build.DefaultConfig()

Example

ExampleDefaultConfig references DefaultConfig on this package API surface.

_ = DefaultConfig
core.Println("DefaultConfig")
Output:
DefaultConfig

func (*BuildConfig) ExpandEnv

func (cfg *BuildConfig) ExpandEnv()

ExpandEnv expands environment variables across the build config.

cfg.ExpandEnv() // expands $APP_NAME, $IMAGE_TAG, $GPG_KEY_ID, etc.

Example

ExampleBuildConfig_ExpandEnv references BuildConfig.ExpandEnv on this package API surface.

_ = (*BuildConfig).ExpandEnv
core.Println("BuildConfig.ExpandEnv")
Output:
BuildConfig.ExpandEnv

func (BuildConfig) MarshalYAML

func (cfg BuildConfig) MarshalYAML() core.Result

MarshalYAML emits the documented `.core/build.yaml` shape, including the top-level `cache:` block, while continuing to use Build.Cache internally.

Example

ExampleBuildConfig_MarshalYAML references BuildConfig.MarshalYAML on this package API surface.

_ = (*BuildConfig).MarshalYAML
core.Println("BuildConfig.MarshalYAML")
Output:
BuildConfig.MarshalYAML

func (*BuildConfig) TargetsIter

func (cfg *BuildConfig) TargetsIter() iter.Seq[TargetConfig]

TargetsIter returns an iterator for the build targets.

for t := range cfg.TargetsIter() { fmt.Println(t.OS, t.Arch) }

Example

ExampleBuildConfig_TargetsIter references BuildConfig.TargetsIter on this package API surface.

_ = (*BuildConfig).TargetsIter
core.Println("BuildConfig.TargetsIter")
Output:
BuildConfig.TargetsIter

func (*BuildConfig) ToTargets

func (cfg *BuildConfig) ToTargets() []Target

ToTargets converts TargetConfig slice to Target slice for use with builders.

targets := cfg.ToTargets()

Example

ExampleBuildConfig_ToTargets references BuildConfig.ToTargets on this package API surface.

_ = (*BuildConfig).ToTargets
core.Println("BuildConfig.ToTargets")
Output:
BuildConfig.ToTargets

func (*BuildConfig) UnmarshalYAML

func (cfg *BuildConfig) UnmarshalYAML(value *yaml.Node) core.Result

UnmarshalYAML accepts both the documented top-level `cache:` block and the legacy nested `build.cache:` shape. When both are present, the nested `build.cache` form wins to preserve compatibility with existing callers.

Example

ExampleBuildConfig_UnmarshalYAML references BuildConfig.UnmarshalYAML on this package API surface.

_ = (*BuildConfig).UnmarshalYAML
core.Println("BuildConfig.UnmarshalYAML")
Output:
BuildConfig.UnmarshalYAML

type BuildOptions

type BuildOptions struct {
	// Obfuscate uses garble instead of go build for obfuscation.
	Obfuscate bool
	// Tags holds de-duplicated Go build tags.
	Tags []string
	// NSIS enables Windows NSIS installer generation (Wails only).
	NSIS bool
	// WebView2 sets the WebView2 delivery method: download|embed|browser|error.
	WebView2 string
	// LDFlags holds linker flags merged from config.
	LDFlags []string
}

BuildOptions holds computed build flags from config + discovery.

opts := build.ComputeOptions(cfg, discovery)
fmt.Println(opts.String()) // "-tags webkit2_41"

func ComputeOptions

func ComputeOptions(cfg *BuildConfig, discovery *DiscoveryResult) *BuildOptions

ComputeOptions merges config + discovery into build flags. Handles distro-aware WebKit tag injection for Ubuntu 24.04+ Wails builds. Returns safe defaults when cfg or discovery is nil.

opts := build.ComputeOptions(cfg, result)
if opts.Obfuscate { /* use garble */ }
Example

ExampleComputeOptions references ComputeOptions on this package API surface.

_ = ComputeOptions
core.Println("ComputeOptions")
Output:
ComputeOptions

func (*BuildOptions) String

func (o *BuildOptions) String() string

String returns the options as a CLI flag string.

s := opts.String()  // "-tags webkit2_41 -ldflags '-s -w'"
Example

ExampleBuildOptions_String references BuildOptions.String on this package API surface.

_ = (*BuildOptions).String
core.Println("BuildOptions.String")
Output:
BuildOptions.String

type Builder

type Builder interface {
	// Name returns the builder's identifier.
	Name() string
	// Detect checks if this builder can handle the project in the given directory.
	Detect(fs storage.Medium, dir string) core.Result
	// Build compiles the project for the specified targets.
	Build(ctx context.Context, cfg *Config, targets []Target) core.Result
}

Builder defines the interface for project-specific build implementations.

var b build.Builder = builders.NewGoBuilder() result := b.Build(ctx, cfg, targets)

type BuilderResolver

type BuilderResolver func(ProjectType) core.Result

BuilderResolver resolves a project type into a concrete builder.

resolver := func(projectType build.ProjectType) core.Result { return builders.ResolveBuilder(projectType) }

func DefaultBuilderResolver

func DefaultBuilderResolver() BuilderResolver

DefaultBuilderResolver returns the currently registered default builder resolver.

Example

ExampleDefaultBuilderResolver references DefaultBuilderResolver on this package API surface.

_ = DefaultBuilderResolver
core.Println("DefaultBuilderResolver")
Output:
DefaultBuilderResolver

type CIContext

type CIContext struct {
	// Ref is the full git ref (GITHUB_REF).
	//   ci.Ref // "refs/tags/v1.2.3"
	Ref string
	// SHA is the full commit hash (GITHUB_SHA).
	//   ci.SHA // "abc1234def5678..."
	SHA string
	// ShortSHA is the first 7 characters of SHA.
	//   ci.ShortSHA // "abc1234"
	ShortSHA string
	// Tag is the tag name when the ref is a tag ref.
	//   ci.Tag // "v1.2.3"
	Tag string
	// IsTag is true when the ref is a tag ref (refs/tags/...).
	//   ci.IsTag // true
	IsTag bool
	// Branch is the branch name when the ref is a branch ref.
	//   ci.Branch // "main"
	Branch string
	// Repo is the owner/repo string (GITHUB_REPOSITORY).
	//   ci.Repo // "dappcore/core"
	Repo string
	// Owner is the repository owner derived from Repo.
	//   ci.Owner // "dappcore"
	Owner string
}

CIContext holds environment information detected from a GitHub Actions run.

ci := build.DetectCI()
if ci != nil {
    fmt.Println(ci.ShortSHA) // "abc1234"
}

func DetectCI

func DetectCI() *CIContext

DetectCI reads GitHub Actions environment variables and returns a populated CIContext. Returns nil if GITHUB_ACTIONS is not set or GITHUB_SHA is empty, which indicates the process is not running inside GitHub Actions.

ci := build.DetectCI()
if ci == nil {
    // running locally, skip CI-specific output
}
if ci != nil && ci.IsTag {
    // upload release assets
}
Example

ExampleDetectCI references DetectCI on this package API surface.

_ = DetectCI
core.Println("DetectCI")
Output:
DetectCI

func DetectGitHubMetadata

func DetectGitHubMetadata() *CIContext

DetectGitHubMetadata returns GitHub CI metadata when the standard environment variables are present, even if GITHUB_ACTIONS is unset.

This is useful for metadata emission paths that only need the GitHub ref/SHA shape and should not be coupled to a specific runner environment.

Example

ExampleDetectGitHubMetadata references DetectGitHubMetadata on this package API surface.

_ = DetectGitHubMetadata
core.Println("DetectGitHubMetadata")
Output:
DetectGitHubMetadata

type CacheConfig

type CacheConfig struct {
	// Enabled turns cache setup on for the build.
	Enabled bool `json:"enabled" yaml:"enabled"`
	// Dir is where cache metadata is stored.
	Dir string `json:"dir,omitempty" yaml:"dir,omitempty"`
	// Directory is the deprecated alias for Dir.
	Directory string `json:"-" yaml:"-"`
	// KeyPrefix prefixes the generated cache key.
	KeyPrefix string `json:"key_prefix,omitempty" yaml:"key_prefix,omitempty"`
	// Paths are cache directories that should exist before the build starts.
	Paths []string `json:"paths,omitempty" yaml:"paths,omitempty"`
	// RestoreKeys are fallback prefixes used when the exact cache key is not present.
	RestoreKeys []string `json:"restore_keys,omitempty" yaml:"restore_keys,omitempty"`
}

CacheConfig holds build cache configuration loaded from .core/build.yaml.

cfg := build.CacheConfig{
    Enabled: true,
    Directory: ".core/cache",
    Paths: []string{"~/.cache/go-build", "~/go/pkg/mod"},
}

func (CacheConfig) MarshalYAML

func (c CacheConfig) MarshalYAML() core.Result

MarshalYAML emits the documented cache configuration shape with the Dir field.

data, err := yaml.Marshal(build.CacheConfig{Enabled: true, Dir: ".core/cache"})
Example

ExampleCacheConfig_MarshalYAML references CacheConfig.MarshalYAML on this package API surface.

_ = (*CacheConfig).MarshalYAML
core.Println("CacheConfig.MarshalYAML")
Output:
CacheConfig.MarshalYAML

func (*CacheConfig) UnmarshalYAML

func (c *CacheConfig) UnmarshalYAML(value *yaml.Node) core.Result

UnmarshalYAML accepts both the concise build config keys and the longer aliases.

err := yaml.Unmarshal([]byte("dir: .core/cache"), &cfg)
Example

ExampleCacheConfig_UnmarshalYAML references CacheConfig.UnmarshalYAML on this package API surface.

_ = (*CacheConfig).UnmarshalYAML
core.Println("CacheConfig.UnmarshalYAML")
Output:
CacheConfig.UnmarshalYAML

type Config

type Config struct {
	// FS is the medium used for file operations.
	FS storage.Medium
	// OutputMedium is the medium used for build artifact output.
	OutputMedium storage.Medium
	// Project holds build-time project metadata.
	Project Project
	// ProjectDir is the root directory of the project.
	ProjectDir string
	// OutputDir is where build artifacts are placed.
	OutputDir string
	// Name is the output binary name.
	Name string
	// Version is the build version string.
	Version string
	// LDFlags are additional linker flags.
	LDFlags []string
	// Flags are additional build flags.
	Flags []string
	// BuildTags are Go build tags passed through to `go build`.
	BuildTags []string
	// Env are additional environment variables.
	Env []string
	// Cache holds build cache configuration for builders that can use it.
	Cache CacheConfig
	// CGO enables CGO for the build (required for Wails, FrankenPHP, etc).
	CGO bool
	// Obfuscate uses garble instead of go build for binary obfuscation.
	Obfuscate bool
	// DenoBuild overrides the default `deno task build` invocation for Deno-backed builds.
	DenoBuild string
	// NpmBuild overrides the default `npm run build` invocation for npm-backed builds.
	NpmBuild string
	// NSIS enables Windows NSIS installer generation (Wails projects only).
	NSIS bool
	// WebView2 sets the WebView2 delivery method: download|embed|browser|error.
	WebView2 string

	// Docker-specific config
	Dockerfile string            // Path to Dockerfile (default: Dockerfile)
	Registry   string            // Container registry (default: ghcr.io)
	Image      string            // Image name (owner/repo format)
	Tags       []string          // Additional tags to apply
	BuildArgs  map[string]string // Docker build arguments
	Push       bool              // Whether to push after build
	Load       bool              // Whether to load a single-platform image into the local daemon after build

	// LinuxKit-specific config
	LinuxKitConfig string   // Path to LinuxKit YAML config, relative to ProjectDir or absolute.
	Formats        []string // Output formats (iso, qcow2, raw, vmdk)
	LinuxKit       LinuxKitConfig
}

Config holds build configuration.

cfg := &build.Config{FS: storage.Local, ProjectDir: ".", OutputDir: "dist", Name: "myapp"}

func RuntimeConfigFromBuildConfig

func RuntimeConfigFromBuildConfig(filesystem storage.Medium, projectDir, outputDir, binaryName string, buildConfig *BuildConfig, push bool, imageName string, version string) *Config

RuntimeConfigFromBuildConfig maps persisted build settings onto a runtime builder config while preserving the caller's output/name/version overrides.

Example

ExampleRuntimeConfigFromBuildConfig references RuntimeConfigFromBuildConfig on this package API surface.

_ = RuntimeConfigFromBuildConfig
core.Println("RuntimeConfigFromBuildConfig")
Output:
RuntimeConfigFromBuildConfig

type DMGConfig

type DMGConfig struct {
	AppPath    string `json:"app_path" yaml:"app_path"`
	OutputPath string `json:"output_path" yaml:"output_path"`
	VolumeName string `json:"volume_name" yaml:"volume_name"`
	Background string `json:"background" yaml:"background"`
	IconSize   int    `json:"icon_size" yaml:"icon_size"`
	WindowSize [2]int `json:"window_size" yaml:"window_size"`
}

DMGConfig defines the DMG packaging inputs.

type DiscoveryResult

type DiscoveryResult struct {
	// Types lists all detected project types in priority order.
	Types []ProjectType
	// ConfiguredType is the explicit build.type override from .core/build.yaml when present.
	ConfiguredType string
	// ConfiguredBuildType mirrors the workflow-facing discovery output name.
	ConfiguredBuildType string
	// OS is the current host operating system for the discovery run.
	OS string
	// Arch is the current host architecture for the discovery run.
	Arch string
	// PrimaryStack is the best stack suggestion based on detected types.
	PrimaryStack string
	// SuggestedStack is the richer action-oriented stack hint derived from markers.
	// This preserves the v3 action naming where Wails projects map to "wails2".
	SuggestedStack string
	// HasFrontend is true when a root or frontend/ package.json/deno manifest is found,
	// or when a nested frontend tree is detected.
	HasFrontend bool
	// HasRootPackageJSON reports whether package.json exists at the project root.
	HasRootPackageJSON bool
	// HasFrontendPackageJSON reports whether frontend/package.json exists.
	HasFrontendPackageJSON bool
	// HasRootComposerJSON reports whether composer.json exists at the project root.
	HasRootComposerJSON bool
	// HasRootCargoToml reports whether Cargo.toml exists at the project root.
	HasRootCargoToml bool
	// HasRootGoMod reports whether go.mod exists at the project root.
	HasRootGoMod bool
	// HasRootGoWork reports whether go.work exists at the project root.
	HasRootGoWork bool
	// HasRootMainGo reports whether main.go exists at the project root.
	HasRootMainGo bool
	// HasRootCMakeLists reports whether CMakeLists.txt exists at the project root.
	HasRootCMakeLists bool
	// HasRootWailsJSON reports whether wails.json exists at the project root.
	HasRootWailsJSON bool
	// HasPackageJSON reports whether package.json exists at the root, in frontend/,
	// or in a supported nested subtree.
	HasPackageJSON bool
	// HasDenoManifest reports whether deno.json or deno.jsonc exists at the root,
	// in frontend/, or in a supported nested subtree.
	HasDenoManifest bool
	// HasTaskfile reports whether any supported Taskfile name exists at the project root.
	HasTaskfile bool
	// HasSubtreeNpm is true when a nested package.json exists within depth 2.
	HasSubtreeNpm bool
	// HasSubtreePackageJSON mirrors the workflow-facing discovery output name.
	HasSubtreePackageJSON bool
	// HasSubtreeDenoManifest is true when a nested Deno manifest exists within depth 2.
	HasSubtreeDenoManifest bool
	// HasDocsConfig reports whether MkDocs config exists at the root or under docs/.
	HasDocsConfig bool
	// HasGoToolchain reports whether Go markers exist at the root or in a visible
	// nested subtree, mirroring the action discovery contract used for setup.
	HasGoToolchain bool
	// PrimaryStackSuggestion mirrors the richer action output name and marker-based
	// precedence used by the generated workflow discovery step.
	PrimaryStackSuggestion string
	// LinuxPackages lists distro-aware system dependencies needed by the detected stack.
	LinuxPackages []string
	// WebKitPackage is the Ubuntu-aware WebKit dependency selected for Wails builds.
	WebKitPackage string
	// Markers records the presence of each raw marker file checked.
	Markers map[string]bool
	// Distro holds the detected Linux distribution version (e.g., "24.04").
	// Used by ComputeOptions to inject webkit2_41 tag on Ubuntu 24.04+.
	Distro string
	// Ref is the Git ref when discovery runs under GitHub metadata.
	Ref string
	// Branch is the branch name when available from GitHub metadata.
	Branch string
	// Tag is the tag name when available from GitHub metadata.
	Tag string
	// IsTag reports whether Ref points at a tag.
	IsTag bool
	// SHA is the current GitHub commit SHA when available.
	SHA string
	// ShortSHA is the short GitHub commit SHA when available.
	ShortSHA string
	// Repo is the GitHub owner/repo string when available.
	Repo string
	// Owner is the GitHub repository owner when available.
	Owner string
}

DiscoveryResult holds the full project analysis from DiscoverFull().

result, err := build.DiscoverFull(storage.Local, ".")
fmt.Println(result.PrimaryStack) // "wails"

type Entitlements

type Entitlements struct {
	Sandbox               bool `json:"sandbox" plist:"com.apple.security.app-sandbox"`
	NetworkClient         bool `json:"network_client" plist:"com.apple.security.network.client"`
	NetworkServer         bool `json:"network_server" plist:"com.apple.security.network.server"`
	MetalGPU              bool `json:"metal_gpu" plist:"com.apple.security.device.metal"`
	UserSelectedReadWrite bool `json:"user_selected_read_write" plist:"com.apple.security.files.user-selected.read-write"`
	Downloads             bool `json:"downloads" plist:"com.apple.security.files.downloads.read-write"`
	HardenedRuntime       bool `json:"hardened_runtime" plist:"com.apple.security.cs.allow-unsigned-executable-memory"`
	JIT                   bool `json:"jit" plist:"com.apple.security.cs.allow-jit"`
	DylibEnvVar           bool `json:"dylib_env_var" plist:"com.apple.security.cs.allow-dylib-environment-variables"`
}

Entitlements defines the generated macOS entitlements profile.

func (Entitlements) Values

func (e Entitlements) Values() map[string]any

Values converts Entitlements to plist key/value pairs.

Example

ExampleEntitlements_Values references Entitlements.Values on this package API surface.

_ = (*Entitlements).Values
core.Println("Entitlements.Values")
Output:
Entitlements.Values

type InfoPlist

type InfoPlist struct {
	BundleID                      string `json:"bundle_id" plist:"CFBundleIdentifier"`
	BundleName                    string `json:"bundle_name" plist:"CFBundleName"`
	BundleDisplayName             string `json:"bundle_display_name" plist:"CFBundleDisplayName"`
	BundleVersion                 string `json:"bundle_version" plist:"CFBundleShortVersionString"`
	BuildNumber                   string `json:"build_number" plist:"CFBundleVersion"`
	MinSystemVersion              string `json:"min_system_version" plist:"LSMinimumSystemVersion"`
	Category                      string `json:"category" plist:"LSApplicationCategoryType"`
	Copyright                     string `json:"copyright" plist:"NSHumanReadableCopyright"`
	Executable                    string `json:"executable" plist:"CFBundleExecutable"`
	HighResCapable                bool   `json:"high_res_capable" plist:"NSHighResolutionCapable"`
	SupportsSecureRestorableState bool   `json:"supports_secure_restorable_state" plist:"NSSupportsSecureRestorableState"`
}

InfoPlist defines the generated macOS application metadata.

func (InfoPlist) Values

func (p InfoPlist) Values() map[string]any

Values converts InfoPlist to plist key/value pairs.

Example

ExampleInfoPlist_Values references InfoPlist.Values on this package API surface.

_ = (*InfoPlist).Values
core.Println("InfoPlist.Values")
Output:
InfoPlist.Values

type InstallerVariant

type InstallerVariant = buildinstallers.InstallerVariant

InstallerVariant identifies an installer script profile.

const (
	// VariantFull generates setup.sh — full installer with PATH setup and shell completions.
	VariantFull InstallerVariant = buildinstallers.VariantFull
	// VariantCI generates ci.sh — minimal download-only installer for CI environments.
	VariantCI InstallerVariant = buildinstallers.VariantCI
	// VariantPHP generates php.sh — installs core CLI + FrankenPHP + Composer.
	VariantPHP InstallerVariant = buildinstallers.VariantPHP
	// VariantGo generates go.sh — installs core CLI + Go toolchain + gopls.
	VariantGo InstallerVariant = buildinstallers.VariantGo
	// VariantAgent generates agent.sh — installs core CLI + core-agent + Claude Code.
	VariantAgent InstallerVariant = buildinstallers.VariantAgent
	// VariantAgentic is the RFC-documented alias for the AI agent installer variant.
	VariantAgentic InstallerVariant = buildinstallers.VariantAgentic
	// VariantDev generates dev.sh — installs core CLI + pulls the core-dev LinuxKit image.
	VariantDev InstallerVariant = buildinstallers.VariantDev
)

func InstallerVariants

func InstallerVariants() []InstallerVariant

InstallerVariants returns the supported variants in stable output order.

Example

ExampleInstallerVariants references InstallerVariants on this package API surface.

_ = InstallerVariants
core.Println("InstallerVariants")
Output:
InstallerVariants

type LinuxKitBaseImage

type LinuxKitBaseImage struct {
	Name            string
	Description     string
	Version         string
	DefaultPackages []string
}

LinuxKitBaseImage describes a built-in immutable image template.

func LinuxKitBaseImages

func LinuxKitBaseImages() []LinuxKitBaseImage

LinuxKitBaseImages returns the built-in immutable image templates.

Example

ExampleLinuxKitBaseImages references LinuxKitBaseImages on this package API surface.

_ = LinuxKitBaseImages
core.Println("LinuxKitBaseImages")
Output:
LinuxKitBaseImages

func LookupLinuxKitBaseImage

func LookupLinuxKitBaseImage(name string) (LinuxKitBaseImage, bool)

LookupLinuxKitBaseImage resolves a built-in immutable image template.

Example

ExampleLookupLinuxKitBaseImage references LookupLinuxKitBaseImage on this package API surface.

_ = LookupLinuxKitBaseImage
core.Println("LookupLinuxKitBaseImage")
Output:
LookupLinuxKitBaseImage

type LinuxKitConfig

type LinuxKitConfig struct {
	Base     string   `json:"base,omitempty" yaml:"base,omitempty"`
	Packages []string `json:"packages,omitempty" yaml:"packages,omitempty"`
	Mounts   []string `json:"mounts,omitempty" yaml:"mounts,omitempty"`
	GPU      bool     `json:"gpu,omitempty" yaml:"gpu,omitempty"`
	Formats  []string `json:"formats,omitempty" yaml:"formats,omitempty"`
	Registry string   `json:"registry,omitempty" yaml:"registry,omitempty"`
}

LinuxKitConfig defines an immutable LinuxKit image.

cfg := build.DefaultLinuxKitConfig()

func DefaultLinuxKitConfig

func DefaultLinuxKitConfig() LinuxKitConfig

DefaultLinuxKitConfig returns the RFC defaults for immutable image builds.

Example

ExampleDefaultLinuxKitConfig references DefaultLinuxKitConfig on this package API surface.

_ = DefaultLinuxKitConfig
core.Println("DefaultLinuxKitConfig")
Output:
DefaultLinuxKitConfig

type LinuxKitImage

type LinuxKitImage struct {
	Config LinuxKitConfig
}

LinuxKitImage models an immutable LinuxKit image definition.

image := build.LinuxKit(
	build.WithBase("core-dev"),
	build.WithPackages("git", "task"),
	build.WithMount("/workspace"),
	build.WithGPU(true),
)

func LinuxKit

func LinuxKit(opts ...LinuxKitOption) *LinuxKitImage

LinuxKit builds an immutable LinuxKit image definition with sensible defaults.

Example

ExampleLinuxKit references LinuxKit on this package API surface.

_ = LinuxKit
core.Println("LinuxKit")
Output:
LinuxKit

type LinuxKitOption

type LinuxKitOption func(*LinuxKitConfig)

LinuxKitOption configures an immutable LinuxKit image definition.

func WithBase

func WithBase(base string) LinuxKitOption

WithBase overrides the base image template name.

Example

ExampleWithBase references WithBase on this package API surface.

_ = WithBase
core.Println("WithBase")
Output:
WithBase

func WithFormats

func WithFormats(formats ...string) LinuxKitOption

WithFormats overrides the requested output formats.

Example

ExampleWithFormats references WithFormats on this package API surface.

_ = WithFormats
core.Println("WithFormats")
Output:
WithFormats

func WithGPU

func WithGPU(enabled bool) LinuxKitOption

WithGPU toggles GPU support for the immutable image.

Example

ExampleWithGPU references WithGPU on this package API surface.

_ = WithGPU
core.Println("WithGPU")
Output:
WithGPU

func WithMount

func WithMount(path string) LinuxKitOption

WithMount appends a writable mount point exposed inside the image.

Example

ExampleWithMount references WithMount on this package API surface.

_ = WithMount
core.Println("WithMount")
Output:
WithMount

func WithPackages

func WithPackages(packages ...string) LinuxKitOption

WithPackages appends extra OS packages to the immutable image.

Example

ExampleWithPackages references WithPackages on this package API surface.

_ = WithPackages
core.Println("WithPackages")
Output:
WithPackages

func WithRegistry

func WithRegistry(registry string) LinuxKitOption

WithRegistry sets the OCI registry namespace for image publication metadata.

Example

ExampleWithRegistry references WithRegistry on this package API surface.

_ = WithRegistry
core.Println("WithRegistry")
Output:
WithRegistry

type LinuxKitResolveConfig

type LinuxKitResolveConfig struct {
	// FS is the filesystem the artefact directory lives on. Nil uses
	// storage.Local.
	FS storage.Medium
	// BaseName names the embedded VZ guest definition to render. Empty uses
	// the default core-dev-vz definition.
	BaseName string
	// Definition is a verbatim linuxkit definition (rendered as a template).
	// When set it overrides BaseName — lets callers/tests supply a definition
	// without embedding one.
	Definition string
	// VZAgentBinary is the cross-compiled vzagent binary path
	// (CGO_ENABLED=0 GOOS=linux GOARCH=arm64). Required: the guest has no
	// control channel without it.
	VZAgentBinary string
	// OutputDir is the artefact directory resolve assembles — the directory
	// passed to the VZProvider as Image.Path. Required.
	OutputDir string
	// Rebuild forces a rebuild even when a matching cached artefact set
	// already exists in OutputDir.
	Rebuild bool
	// ProjectDir is the working directory the linuxkit build runs in (for
	// version derivation parity with the rest of the build system). Empty uses
	// the process working directory.
	ProjectDir string
}

LinuxKitResolveConfig drives a VZ guest-image resolve.

cfg := build.LinuxKitResolveConfig{
    VZAgentBinary: "/path/to/vzagent",   // cross-compiled GOOS=linux GOARCH=arm64
    OutputDir:     "/srv/core/vz/guest", // artefact directory the VM boots
}

type LinuxKitResolveResult

type LinuxKitResolveResult struct {
	// Dir is the artefact directory satisfying the §4 guest contract — pass it
	// to the VZProvider as Image.Path.
	Dir string
	// Kernel is the resolved kernel path (Dir/kernel).
	Kernel string
	// Initrd is the resolved initial-ramdisk path (Dir/initrd.img).
	Initrd string
	// Cmdline is the resolved kernel-command-line path (Dir/cmdline); "" when
	// linuxkit produced none.
	Cmdline string
	// Cached reports whether the artefacts were reused (no linuxkit build ran).
	Cached bool
}

LinuxKitResolveResult reports a completed resolve.

type LinuxKitResolveTemplateData

type LinuxKitResolveTemplateData struct {
	// VZAgentBinary is the staged path of the cross-compiled vzagent binary,
	// substituted into the definition's files: source.
	VZAgentBinary string
}

LinuxKitResolveTemplateData is the render input for a VZ guest definition. Only the staged vzagent binary path varies between builds today; the field is exported so callers reading the contract can see what the embedded def expects.

type NotariseConfig

type NotariseConfig struct {
	AppPath string `json:"app_path" yaml:"app_path"`

	APIKeyID       string `json:"api_key_id" yaml:"api_key_id"`
	APIKeyIssuerID string `json:"api_key_issuer_id" yaml:"api_key_issuer_id"`
	APIKeyPath     string `json:"api_key_path" yaml:"api_key_path"`

	TeamID   string `json:"team_id" yaml:"team_id"`
	AppleID  string `json:"apple_id" yaml:"apple_id"`
	Password string `json:"password" yaml:"password"`
}

NotariseConfig defines the Apple notarisation request.

type Pipeline

type Pipeline struct {
	FS             storage.Medium
	ResolveBuilder BuilderResolver
	ResolveVersion VersionResolver
}

Pipeline coordinates the action-style gateway phases for a build request: discovery, option computation, setup planning, builder resolution, and build.

pipeline := &build.Pipeline{FS: storage.Local, ResolveBuilder: resolver}

func (*Pipeline) Plan

func (p *Pipeline) Plan(ctx context.Context, req PipelineRequest) core.Result

Plan resolves the action-style gateway phases without executing the builder.

result := pipeline.Plan(ctx, build.PipelineRequest{ProjectDir: "."})
Example

ExamplePipeline_Plan references Pipeline.Plan on this package API surface.

_ = (*Pipeline).Plan
core.Println("Pipeline.Plan")
Output:
Pipeline.Plan

func (*Pipeline) Run

func (p *Pipeline) Run(ctx context.Context, plan *PipelinePlan) core.Result

Run executes the builder for a precomputed plan.

result := pipeline.Run(ctx, plan)
Example

ExamplePipeline_Run references Pipeline.Run on this package API surface.

_ = (*Pipeline).Run
core.Println("Pipeline.Run")
Output:
Pipeline.Run

type PipelinePlan

type PipelinePlan struct {
	ProjectDir    string
	ProjectTypes  []ProjectType
	BuildConfig   *BuildConfig
	ProjectType   ProjectType
	Builders      []Builder
	Builder       Builder
	Discovery     *DiscoveryResult
	Options       *BuildOptions
	SetupPlan     *SetupPlan
	Targets       []Target
	OutputDir     string
	BuildName     string
	Version       string
	RuntimeConfig *Config
}

PipelinePlan is the fully resolved gateway state before the builder runs.

type PipelineRequest

type PipelineRequest struct {
	ProjectDir    string
	ConfigPath    string
	BuildConfig   *BuildConfig
	BuildType     string
	BuildTags     []string
	Obfuscate     bool
	ObfuscateSet  bool
	NSIS          bool
	NSISSet       bool
	WebView2      string
	WebView2Set   bool
	DenoBuild     string
	DenoBuildSet  bool
	NpmBuild      string
	NpmBuildSet   bool
	BuildCache    bool
	BuildCacheSet bool
	OutputDir     string
	BuildName     string
	Targets       []Target
	Push          bool
	ImageName     string
	Version       string
}

PipelineRequest captures the inputs required to plan or run a build.

type PipelineResult

type PipelineResult struct {
	Plan      *PipelinePlan
	Artifacts []Artifact
}

PipelineResult contains the executed plan and the produced artifacts.

type PreBuild

type PreBuild struct {
	// Deno overrides the default `deno task build` invocation.
	Deno string `json:"deno,omitempty" yaml:"deno,omitempty"`
	// Npm overrides the default `npm run build` invocation.
	Npm string `json:"npm,omitempty" yaml:"npm,omitempty"`
}

PreBuild holds declarative frontend build hooks loaded from the RFC `pre_build:` block.

cfg.PreBuild = build.PreBuild{Deno: "deno task build", Npm: "npm run build"}

type Project

type Project struct {
	// Name is the project name.
	Name string `json:"name" yaml:"name"`
	// Description is a brief description of the project.
	Description string `json:"description" yaml:"description"`
	// Main is the path to the main package (e.g., ./cmd/core).
	Main string `json:"main" yaml:"main"`
	// Binary is the output binary name.
	Binary string `json:"binary" yaml:"binary"`
}

Project holds project metadata.

cfg.Project.Binary = "core-build"

type ProjectType

type ProjectType string

ProjectType represents a detected project type.

var t build.ProjectType = build.ProjectTypeGo

const (
	// ProjectTypeGo indicates a standard Go project with go.mod or go.work.
	ProjectTypeGo ProjectType = "go"
	// ProjectTypeWails indicates a Wails desktop application.
	ProjectTypeWails ProjectType = "wails"
	// ProjectTypeNode indicates a Node.js project with package.json.
	ProjectTypeNode ProjectType = "node"
	// ProjectTypePHP indicates a PHP/Laravel project with composer.json.
	ProjectTypePHP ProjectType = "php"
	// ProjectTypeCPP indicates a C++ project with CMakeLists.txt.
	ProjectTypeCPP ProjectType = "cpp"
	// ProjectTypeDocker indicates a Docker-based project with Dockerfile.
	ProjectTypeDocker ProjectType = "docker"
	// ProjectTypeLinuxKit indicates a LinuxKit VM configuration.
	ProjectTypeLinuxKit ProjectType = "linuxkit"
	// ProjectTypeTaskfile indicates a project using Taskfile automation.
	ProjectTypeTaskfile ProjectType = "taskfile"
	// ProjectTypeDocs indicates a documentation project with mkdocs.yml.
	ProjectTypeDocs ProjectType = "docs"
	// ProjectTypePython indicates a Python project with pyproject.toml or requirements.txt.
	ProjectTypePython ProjectType = "python"
	// ProjectTypeRust indicates a Rust project with Cargo.toml.
	ProjectTypeRust ProjectType = "rust"
)

Project type constants for build detection.

type RunConfig

type RunConfig struct {
	Context        context.Context
	ProjectDir     string
	ConfigPath     string
	BuildConfig    *BuildConfig
	BuildType      string
	BuildTags      []string
	Obfuscate      bool
	ObfuscateSet   bool
	NSIS           bool
	NSISSet        bool
	WebView2       string
	WebView2Set    bool
	DenoBuild      string
	DenoBuildSet   bool
	NpmBuild       string
	NpmBuildSet    bool
	BuildCache     bool
	BuildCacheSet  bool
	BuildName      string
	OutputDir      string
	Output         coreio.Medium
	Targets        []Target
	Version        string
	ResolveBuilder BuilderResolver
	ResolveVersion VersionResolver
}

RunConfig captures the option-style inputs for the RFC-documented build API.

func DefaultRunConfig

func DefaultRunConfig() *RunConfig

DefaultRunConfig returns the default configuration for the option-style Run API.

Example

ExampleDefaultRunConfig references DefaultRunConfig on this package API surface.

_ = DefaultRunConfig
core.Println("DefaultRunConfig")
Output:
DefaultRunConfig

type RunOption

type RunOption func(*RunConfig)

RunOption mutates a RunConfig before the pipeline executes.

func WithBuildCache

func WithBuildCache(enabled bool) RunOption

WithBuildCache enables or disables build cache setup before the pipeline runs.

Example

ExampleWithBuildCache references WithBuildCache on this package API surface.

_ = WithBuildCache
core.Println("WithBuildCache")
Output:
WithBuildCache

func WithBuildConfig

func WithBuildConfig(buildConfig *BuildConfig) RunOption

WithBuildConfig injects a preloaded build config instead of loading .core/build.yaml.

Example

ExampleWithBuildConfig references WithBuildConfig on this package API surface.

_ = WithBuildConfig
core.Println("WithBuildConfig")
Output:
WithBuildConfig

func WithBuildName

func WithBuildName(name string) RunOption

WithBuildName overrides the resolved artifact name.

Example

ExampleWithBuildName references WithBuildName on this package API surface.

_ = WithBuildName
core.Println("WithBuildName")
Output:
WithBuildName

func WithBuildTags

func WithBuildTags(tags ...string) RunOption

WithBuildTags overrides the Go build tags passed through the pipeline.

Example

ExampleWithBuildTags references WithBuildTags on this package API surface.

_ = WithBuildTags
core.Println("WithBuildTags")
Output:
WithBuildTags

func WithBuildType

func WithBuildType(buildType string) RunOption

WithBuildType forces a specific project type instead of auto-detection.

Example

ExampleWithBuildType references WithBuildType on this package API surface.

_ = WithBuildType
core.Println("WithBuildType")
Output:
WithBuildType

func WithBuilderResolver

func WithBuilderResolver(resolver BuilderResolver) RunOption

WithBuilderResolver provides an explicit builder resolver for Run.

Example

ExampleWithBuilderResolver references WithBuilderResolver on this package API surface.

_ = WithBuilderResolver
core.Println("WithBuilderResolver")
Output:
WithBuilderResolver

func WithConfigPath

func WithConfigPath(path string) RunOption

WithConfigPath points Run at an explicit build config file.

Example

ExampleWithConfigPath references WithConfigPath on this package API surface.

_ = WithConfigPath
core.Println("WithConfigPath")
Output:
WithConfigPath

func WithContext

func WithContext(ctx context.Context) RunOption

WithContext overrides the context used for discovery, versioning, and builds.

Example

ExampleWithContext references WithContext on this package API surface.

_ = WithContext
core.Println("WithContext")
Output:
WithContext

func WithDenoBuild

func WithDenoBuild(command string) RunOption

WithDenoBuild overrides the default Deno frontend build command.

Example

ExampleWithDenoBuild references WithDenoBuild on this package API surface.

_ = WithDenoBuild
core.Println("WithDenoBuild")
Output:
WithDenoBuild

func WithNSIS

func WithNSIS(enabled bool) RunOption

WithNSIS enables or disables Windows NSIS installer generation for Wails builds.

Example

ExampleWithNSIS references WithNSIS on this package API surface.

_ = WithNSIS
core.Println("WithNSIS")
Output:
WithNSIS

func WithNpmBuild

func WithNpmBuild(command string) RunOption

WithNpmBuild overrides the default npm frontend build command.

Example

ExampleWithNpmBuild references WithNpmBuild on this package API surface.

_ = WithNpmBuild
core.Println("WithNpmBuild")
Output:
WithNpmBuild

func WithObfuscate

func WithObfuscate(enabled bool) RunOption

WithObfuscate enables or disables garble-backed obfuscation for the build.

Example

ExampleWithObfuscate references WithObfuscate on this package API surface.

_ = WithObfuscate
core.Println("WithObfuscate")
Output:
WithObfuscate

func WithOutput

func WithOutput(output coreio.Medium) RunOption

WithOutput sets the destination medium used for final build artifacts.

Example

ExampleWithOutput references WithOutput on this package API surface.

_ = WithOutput
core.Println("WithOutput")
Output:
WithOutput

func WithOutputDir

func WithOutputDir(dir string) RunOption

WithOutputDir sets the destination directory or key prefix for mirrored artifacts.

Example

ExampleWithOutputDir references WithOutputDir on this package API surface.

_ = WithOutputDir
core.Println("WithOutputDir")
Output:
WithOutputDir

func WithProjectDir

func WithProjectDir(dir string) RunOption

WithProjectDir sets the project directory to build.

Example

ExampleWithProjectDir references WithProjectDir on this package API surface.

_ = WithProjectDir
core.Println("WithProjectDir")
Output:
WithProjectDir

func WithTargets

func WithTargets(targets ...Target) RunOption

WithTargets overrides the build matrix targets.

Example

ExampleWithTargets references WithTargets on this package API surface.

_ = WithTargets
core.Println("WithTargets")
Output:
WithTargets

func WithVersion

func WithVersion(version string) RunOption

WithVersion overrides the resolved build version.

Example

ExampleWithVersion references WithVersion on this package API surface.

_ = WithVersion
core.Println("WithVersion")
Output:
WithVersion

func WithVersionResolver

func WithVersionResolver(resolver VersionResolver) RunOption

WithVersionResolver provides an explicit version resolver for Run.

Example

ExampleWithVersionResolver references WithVersionResolver on this package API surface.

_ = WithVersionResolver
core.Println("WithVersionResolver")
Output:
WithVersionResolver

func WithWebView2

func WithWebView2(mode string) RunOption

WithWebView2 sets the Wails WebView2 delivery mode: download, embed, browser, or error.

Example

ExampleWithWebView2 references WithWebView2 on this package API surface.

_ = WithWebView2
core.Println("WithWebView2")
Output:
WithWebView2

type SetupPlan

type SetupPlan struct {
	ProjectDir             string
	PrimaryStack           string
	PrimaryStackSuggestion string
	FrontendDirs           []string
	LinuxPackages          []string
	Steps                  []SetupStep
}

SetupPlan is the Go-side equivalent of the action setup orchestration. It is pure data: discovery + config in, setup requirements out.

type SetupStep

type SetupStep struct {
	Tool   SetupTool `json:"tool"`
	Reason string    `json:"reason"`
}

SetupStep describes one toolchain requirement in the setup plan.

type SetupTool

type SetupTool string

SetupTool identifies a toolchain or installer surface required by the action-style setup phase.

const (
	// SetupToolGo installs the Go toolchain.
	SetupToolGo SetupTool = "go"
	// SetupToolGarble installs garble for obfuscated Go and Wails builds.
	SetupToolGarble SetupTool = "garble"
	// SetupToolTask installs the Task CLI for Taskfile-driven builds.
	SetupToolTask SetupTool = "task"
	// SetupToolNode installs Node.js/Corepack for frontend-backed builds.
	SetupToolNode SetupTool = "node"
	// SetupToolWails installs the Wails CLI for Wails-backed builds.
	SetupToolWails SetupTool = "wails"
	// SetupToolPython installs Python for Conan and MkDocs flows.
	SetupToolPython SetupTool = "python"
	// SetupToolPHP installs PHP for Composer-backed builds.
	SetupToolPHP SetupTool = "php"
	// SetupToolComposer installs Composer for PHP builds.
	SetupToolComposer SetupTool = "composer"
	// SetupToolRust installs Rust/Cargo for Rust builds.
	SetupToolRust SetupTool = "rust"
	// SetupToolConan installs Conan for C++ builds.
	SetupToolConan SetupTool = "conan"
	// SetupToolMkDocs installs MkDocs for docs builds.
	SetupToolMkDocs SetupTool = "mkdocs"
	// SetupToolDeno installs Deno for manifest-backed or override-driven builds.
	SetupToolDeno SetupTool = "deno"
)

type SignConfig

type SignConfig struct {
	AppPath      string `json:"app_path" yaml:"app_path"`
	Identity     string `json:"identity" yaml:"identity"`
	Entitlements string `json:"entitlements" yaml:"entitlements"`
	Hardened     bool   `json:"hardened" yaml:"hardened"`
	Deep         bool   `json:"deep" yaml:"deep"`
	KeychainPath string `json:"keychain_path" yaml:"keychain_path"`
}

SignConfig defines the codesign inputs for a macOS app bundle.

type Target

type Target struct {
	OS   string
	Arch string
}

Target represents a build target platform.

t := build.Target{OS: "linux", Arch: "amd64"}

func (Target) String

func (t Target) String() string

String returns the target in GOOS/GOARCH format.

s := t.String() // → "linux/amd64"

Example

ExampleTarget_String references Target.String on this package API surface.

_ = (*Target).String
core.Println("Target.String")
Output:
Target.String

type TargetConfig

type TargetConfig struct {
	// OS is the target operating system (e.g., "linux", "darwin", "windows").
	OS string
	// Arch is the target architecture (e.g., "amd64", "arm64").
	Arch string `json:"arch" yaml:"arch"`
}

TargetConfig defines a build target in the config file. This is separate from Target to allow for additional config-specific fields.

cfg.Targets = []build.TargetConfig{{OS: "linux", Arch: "amd64"}, {OS: "darwin", Arch: "arm64"}}

func (TargetConfig) MarshalYAML

func (t TargetConfig) MarshalYAML() core.Result
Example

ExampleTargetConfig_MarshalYAML references TargetConfig.MarshalYAML on this package API surface.

_ = (*TargetConfig).MarshalYAML
core.Println("TargetConfig.MarshalYAML")
Output:
TargetConfig.MarshalYAML

func (*TargetConfig) UnmarshalYAML

func (t *TargetConfig) UnmarshalYAML(value *yaml.Node) core.Result
Example

ExampleTargetConfig_UnmarshalYAML references TargetConfig.UnmarshalYAML on this package API surface.

_ = (*TargetConfig).UnmarshalYAML
core.Println("TargetConfig.UnmarshalYAML")
Output:
TargetConfig.UnmarshalYAML

type TestFlightConfig

type TestFlightConfig struct {
	AppPath        string `json:"app_path" yaml:"app_path"`
	APIKeyID       string `json:"api_key_id" yaml:"api_key_id"`
	APIKeyIssuerID string `json:"api_key_issuer_id" yaml:"api_key_issuer_id"`
	APIKeyPath     string `json:"api_key_path" yaml:"api_key_path"`
	CertIdentity   string `json:"cert_identity" yaml:"cert_identity"`
}

TestFlightConfig defines the TestFlight upload inputs.

type VersionResolver

type VersionResolver func(context.Context, string) core.Result

VersionResolver determines the build version for a project directory.

resolver := func(ctx context.Context, dir string) core.Result { return release.DetermineVersionWithContext(ctx, dir) }

type WailsBuildConfig

type WailsBuildConfig struct {
	ProjectDir string   `json:"project_dir" yaml:"project_dir"`
	Name       string   `json:"name" yaml:"name"`
	Arch       string   `json:"arch" yaml:"arch"`
	BuildTags  []string `json:"build_tags" yaml:"build_tags"`
	LDFlags    []string `json:"ldflags" yaml:"ldflags"`
	OutputDir  string   `json:"output_dir" yaml:"output_dir"`
	Version    string   `json:"version" yaml:"version"`
	Env        []string `json:"env" yaml:"env"`
	DenoBuild  string   `json:"deno_build" yaml:"deno_build"`
}

WailsBuildConfig defines the Wails v3 build inputs for a macOS app bundle.

type XcodeCloudConfig

type XcodeCloudConfig struct {
	Workflow string              `json:"workflow,omitempty" yaml:"workflow,omitempty"`
	Triggers []XcodeCloudTrigger `json:"triggers,omitempty" yaml:"triggers,omitempty"`
}

XcodeCloudConfig defines the Xcode Cloud workflow metadata stored in build config.

type XcodeCloudTrigger

type XcodeCloudTrigger struct {
	Branch string `json:"branch,omitempty" yaml:"branch,omitempty"`
	Tag    string `json:"tag,omitempty" yaml:"tag,omitempty"`
	Action string `json:"action,omitempty" yaml:"action,omitempty"`
}

XcodeCloudTrigger defines a single Xcode Cloud trigger rule.

Directories

Path Synopsis
Package builders provides build implementations for different project types.
Package builders provides build implementations for different project types.
Package installers generates installer shell scripts for Core CLI releases.
Package installers generates installer shell scripts for Core CLI releases.
Package packages builds native OS package formats from a built binary.
Package packages builds native OS package formats from a built binary.
Package signing provides code signing for build artifacts.
Package signing provides code signing for build artifacts.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL