builder

package
v0.13.0 Latest Latest
Warning

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

Go to latest
Published: May 19, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package builder compiles a wick app into a raw Go binary plus the platform-native distributable that ships with each release:

windows → .exe with embedded brand icon + version metadata
darwin  → .app bundle, then .dmg disk image (host-darwin only)
linux   → .deb binary package

Cross-compilation is supported for everything except .dmg (which requires the macOS-only `hdiutil` tool); cross-builds from non-darwin hosts produce the .app bundle and skip the .dmg step.

Set Config.Installer to opt into installer-friendly artifacts:

windows → adds an .msi that installs per-user to
          %LocalAppData%\Programs\<AppName> (no UAC; the in-app
          self-updater can rewrite the .exe in place — same flow
          as portable .exe). Needs `wixl` from msitools on PATH;
          skipped with a warning when missing.
darwin  → .dmg is staged with an Applications symlink so Finder
          shows the standard drag-to-install layout.
linux   → unchanged (.deb is already a proper installer).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ResolveBundleID

func ResolveBundleID(appName string) string

ResolveBundleID derives a CFBundleIdentifier-style reverse-DNS string from go.mod's module path. github.com/owner/app → com.owner.app. Falls back to com.example.<appName> when go.mod is missing or the module path can't be parsed.

Lowercased, dots only — anything outside [a-z0-9.-] gets replaced with "-" so Apple's bundle ID rules ([A-Za-z0-9-.]) hold.

Types

type Config

type Config struct {
	AppName    string
	AppVersion string
	GOOS       string
	GOARCH     string
	Output     string
	GitHubPAT  string
	GitHubRepo string
	Headless   bool
	// Installer opts the windows target into building an .msi on top
	// of the raw .exe (requires `wixl` from msitools on PATH). The
	// .msi is always built per-user — installs to %LocalAppData%\
	// Programs\<AppName>, requires no UAC, and lets the in-app
	// self-updater rewrite the .exe without elevation. Off by default
	// so existing pipelines keep producing the same artifacts.
	Installer bool
}

Config drives a Build invocation. AppName + AppVersion are baked into the binary via -ldflags; GOOS / GOARCH select the target. Empty fields fall back to runtime defaults.

type Result

type Result struct {
	Binary  string
	Bundles []string
}

Result lists the artifacts a Build produced. Binary is always the raw compiled binary; Bundles are the platform-native distributables (.app, .dmg, .deb) layered on top.

func Build

func Build(cfg Config) (Result, error)

Build compiles the Go source in CWD per cfg, then wraps the resulting binary into the platform-native distributable. Returns the artifacts produced (raw binary always, plus platform bundles).

Directories

Path Synopsis
Package darwin handles macOS-specific build steps — wrapping the raw binary into a .app bundle and (host-darwin only) further wrapping that into a .dmg disk image.
Package darwin handles macOS-specific build steps — wrapping the raw binary into a .app bundle and (host-darwin only) further wrapping that into a .dmg disk image.
Package linux handles Linux-specific build steps — wrapping the raw binary into a Debian binary package (.deb).
Package linux handles Linux-specific build steps — wrapping the raw binary into a Debian binary package (.deb).
Package windows handles Windows-specific build steps — currently the .syso resource that embeds the brand icon plus version metadata into the .exe.
Package windows handles Windows-specific build steps — currently the .syso resource that embeds the brand icon plus version metadata into the .exe.

Jump to

Keyboard shortcuts

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