Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var DefaultTargets = []Target{ NewTarget("windows/386"), NewTarget("windows/amd64"), NewTarget("windows/arm"), NewTarget("darwin/amd64"), NewTarget("linux/386"), NewTarget("linux/amd64"), NewTarget("linux/arm"), NewTarget("linux/arm64"), NewTarget("js/wasm"), }
DefaultTargets is a static list of supported targets as a subset of output by `go tool dist list`.
Functions ¶
This section is empty.
Types ¶
type Architecture ¶
type Architecture uint8
Architecture of the machine.
const ( X86 Architecture = iota AMD64 ARM ARM64 WASM )
Architectures supported.
func (*Architecture) FromStr ¶
func (a *Architecture) FromStr(s string) Architecture
func (Architecture) List ¶
func (a Architecture) List() []Architecture
func (Architecture) String ¶
func (a Architecture) String() string
type FlagSet ¶
type FlagSet struct { // Compiler flags. // go tool compile Compiler []string // Linker flags. // go tool link Linker []string }
Flags contains tooling flags.
type MetaData ¶
type MetaData struct { // Icon contains the image data for the icon. Icon image.Image Darwin struct { // ICNS contains icon encoded as ICNS. ICNS io.Reader // Plist contains the Info.plist metadata file. Plist io.Reader } Windows struct { // ICO contains icon encoded as ICO. ICO io.Reader // Manifest contains the windows manifest metadata file. Manifest io.Reader } Linux struct { } }
MetaData pulls together all platform specific metadata require to create a bundle.
Note: we don't care about the structure of the platform files, hence they are represented as blobs.
@Todo Generate plist, manifest, et al from common data (author, version, access requirements, etc). This would allow streamlined use, as the user wouldn't need to individually create such files; which is very much part of the mission statement of this software. If the user has already created those files for whatever reason, we can fallback to copying them.
type Packer ¶
type Packer struct { // Info contains information regarding the project to pack. Info *ProjectInfo // MetaData required to produce valid application bundles. MetaData MetaData // Artifacts that are generated by compilation. Artifacts []Artifact // PreCompile is run prior to compiling. // Allows modification of the compilation environment, such as generating a // Windows resource file to be compiled in. PreCompile func(root string, md MetaData, t Target) error }
Packer packs a Go project into native artifacts and bundles.
func (*Packer) Compile ¶
Compile the Go project. Requires Go toolchain to be installed. Compiles targets in parallel.
Note: copies source files to a sandbox for clean parallel compiles. This is IO heavy and was primary done because Windows requires a resource file to get linked to provide an icon for the binary. The presence of such file breaks compiles for other platforms.
@Enhance is there a more lightweight strategy that supports windows resource files? Such as manipulating the compiled PE directly.
type ProjectInfo ¶
type ProjectInfo struct { // Name specifies the output name of the artifact. // Defaults to the package name if empty. Name string // Root path to Go project. // Defaults to current working directory. Root string // Name of package to build. // Defaults to root if empty. Pkg string // Dist is the output directory to place Artifacts. // Defaults to "dist". Dist string // Flags are values to pass to the compiler. Flags Flags // Targets lists all targets to compile for. Targets []Target }
ProjectInfo contains data required to compile a Go project.