build

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 16, 2024 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EnvSConsCache = "SCONS_CACHE"
	EnvSConsFlags = "SCONSFLAGS"
)

Variables

View Source
var (
	ErrMissingArch      = errors.New("missing architecture")
	ErrUnrecognizedArch = errors.New("unrecognized architecture")
)
View Source
var (
	// ErrInvalidInput is returned when a function is provided invalid input.
	ErrInvalidInput = errors.New("invalid input")
	// ErrMissingInput is returned when a function is missing required input.
	ErrMissingInput = errors.New("missing input")
)
View Source
var (
	ErrMissingOptimize      = errors.New("missing optimize")
	ErrUnrecognizedOptimize = errors.New("unrecognized optimize")
)
View Source
var (
	ErrMissingOS      = errors.New("missing OS")
	ErrUnrecognizedOS = errors.New("unrecognized OS")
)
View Source
var (
	ErrMissingProfile      = errors.New("missing profile")
	ErrUnrecognizedProfile = errors.New("unrecognized profile")
)
View Source
var ErrConflictingValue = errors.New("conflicting setting")

ErrConflictingValue is returned when two settings conflict with eachother.

Functions

This section is empty.

Types

type Arch

type Arch uint

CPU architectures which Godot supports targeting.

const (
	ArchUnknown Arch = iota
	ArchAmd64
	ArchArm32
	ArchArm64
	ArchI386
	ArchUniversal
)

func MustParseArch

func MustParseArch(input string) Arch

Parses an input string as a CPU architecture specification but panics if it would fail.

func ParseArch

func ParseArch(input string) (Arch, error)

Parses an input string as a CPU architecture specification.

NOTE: This is a best effort implementation. Please open an issue on GitHub if some values are missing: github.com/coffeebeats/gdbuild/issues/new?labels=bug&template=%F0%9F%90%9B-bug-report.md.

func (Arch) String

func (a Arch) String() string

String implements 'fmt.Stringer' for 'Arch' according to the architecture names passed to SCons during compilation.

func (*Arch) UnmarshalText

func (a *Arch) UnmarshalText(bb []byte) error

type Configurer

type Configurer interface {
	Configure(i *Invocation) error
}

Configurer is a type which can configure itself based on the current invocation.

type Godot

type Godot struct {
	// PathSource is a path to a directory containing the Godot source code.
	PathSource Path `toml:"src_path"`
	// Version is a specific version label to download.
	Version string `toml:"version"`
	// VersionFile is a file containing just the a version label to download.
	VersionFile Path `toml:"version_file"`
}

Godot defines options and settings for which Godot version to use. Note that only one of these options can be used at a time, but one *must* be specified.

func (*Godot) Configure

func (c *Godot) Configure(inv *Invocation) error

func (*Godot) IsEmpty

func (c *Godot) IsEmpty() bool

IsEmpty returns whether all properties are unset, implying there is no need to vendor Godot source code.

func (*Godot) Validate

func (c *Godot) Validate() error

func (*Godot) VendorTo

func (c *Godot) VendorTo(ctx context.Context, out string) error

VendorTo vendors the Godot source code to the specified directory.

type Hook

type Hook struct {
	// Pre contains a command to run *before* a build step.
	Pre []action.Command `toml:"prebuild"`
	// Post contains a command to run *after* a build step.
	Post []action.Command `toml:"postbuild"`
	// Shell defines which shell process to run these commands in.
	Shell exec.Shell `toml:"shell"`
}

Hook contains commands to execute before and after a build step.

TODO: Allow per-hook shell settings.

func (*Hook) Merge

func (c *Hook) Merge(other *Hook) error

type Invocation

type Invocation struct {
	// Verbose determines whether to enable additional logging output.
	Verbose bool

	// Features is the list of feature tags to enable.
	Features []string
	// Platform is the target platform to build for.
	Platform OS
	// Profile is the GDBuild optimization level to build with.
	Profile Profile

	// PathBuild is the directory in which to build the template in. All input
	// artifacts will be copied here and the SCons build command will be
	// executed within this directory. Defaults to a temporary directory.
	PathBuild Path
	// PathManifest is the path to the GDBuild manifest. This is used to locate
	// relative paths in various other properties.
	PathManifest Path
	// PathOut is the directory in which to move built artifacts to.
	PathOut Path
}

Invocation are build command inputs that are invocation-specific. These need to be explicitly set per invocation as they can't be parsed from a GDBuild manifest.

func (*Invocation) BinPath added in v0.0.4

func (c *Invocation) BinPath() Path

BinPath returns the path to the Godot template artifacts are compilation.

func (*Invocation) Validate

func (c *Invocation) Validate() error

type OS

type OS uint

Operating systems which the Godot project supports building for.

const (
	OSUnknown OS = iota
	OSAndroid
	OSIOS
	OSLinux
	OSMacOS
	OSWeb
	OSWindows
)

func MustParseOS

func MustParseOS(input string) OS

Parses an input string as an operating system specification but panics if it would fail.

func ParseOS

func ParseOS(input string) (OS, error)

Parses an input string as an operating system specification.

NOTE: This is a best effort implementation. Please open an issue on GitHub if some values are missing: github.com/coffeebeats/gdbuild/issues/new?labels=bug&template=%F0%9F%90%9B-bug-report.md.

func (OS) String

func (o OS) String() string

String implements 'fmt.Stringer' for 'OS' according to the platform names passed to SCons during compilation.

func (*OS) UnmarshalText

func (o *OS) UnmarshalText(bb []byte) error

type Optimize

type Optimize uint

Optimize is the level of optimization for a Godot export template.

const (
	OptimizeUnknown Optimize = iota
	OptimizeCustom
	OptimizeDebug
	OptimizeNone
	OptimizeSize
	OptimizeSpeed
	OptimizeSpeedTrace
)

func MustParseOptimize

func MustParseOptimize(input string) Optimize

Parses an input string as an operating system specification but panics if it would fail.

func ParseOptimize

func ParseOptimize(input string) (Optimize, error)

Parses an input string as an operating system specification.

NOTE: This is a best effort implementation. Please open an issue on GitHub if some values are missing: github.com/coffeebeats/gdbuild/issues/new?labels=bug&template=%F0%9F%90%9B-bug-report.md.

func (Optimize) String

func (o Optimize) String() string

String implements 'fmt.Stringer' for 'Optimize' according to the optimization levels passed to SCons during compilation.

func (*Optimize) UnmarshalText

func (o *Optimize) UnmarshalText(bb []byte) error

type Path

type Path string

Path is a string type that's expected to be a path.

func (Path) CheckIsDir

func (p Path) CheckIsDir() error

CheckIsDir verifies that the underlying path is a valid directory.

func (Path) CheckIsDirOrEmpty

func (p Path) CheckIsDirOrEmpty() error

CheckIsDirOrEmpty verifies that the underlying path is either empty or a valid directory.

func (Path) CheckIsFile added in v0.0.4

func (p Path) CheckIsFile() error

CheckIsFile verifies that the underlying path is a valid file.

func (Path) CheckIsFileOrEmpty

func (p Path) CheckIsFileOrEmpty() error

CheckIsFileOrEmpty verifies that the underlying path is either empty or a valid file.

func (*Path) RelTo

func (p *Path) RelTo(base Path) error

RelTo converts the underlying path into a cleaned, absolute path. If the path is relative it's first resolved against the provided base path (or current working directory if 'base' is empty).

func (Path) String

func (p Path) String() string

type Profile

type Profile uint

Optimization levels supported by Godot.

const (
	ProfileUnknown Profile = iota
	ProfileDebug
	ProfileReleaseDebug
	ProfileRelease
)

func MustParseProfile

func MustParseProfile(input string) Profile

Parses an input string as a build profile specification but panics if it would fail.

func ParseProfile

func ParseProfile(input string) (Profile, error)

Parses an input string as a build 'Profile' optimization level.

func (Profile) IsRelease added in v0.0.4

func (p Profile) IsRelease() bool

IsRelease returns whether the profile setting is a "release" type.

func (Profile) String

func (p Profile) String() string

String implements 'fmt.Stringer' for 'Profile' according to the profile names passed to SCons during compilation.

func (*Profile) UnmarshalText

func (p *Profile) UnmarshalText(bb []byte) error

type SCons

type SCons struct {
	// CCFlags are additional 'CFLAGS' to append to the SCons build command.
	// Note that 'CCFLAGS=...' will be appended *before* 'ExtraArgs'.
	CCFlags []string `toml:"ccflags"`
	// CFlags are additional 'CFLAGS' to append to the SCons build command. Note
	// that 'CFLAGS=...' will be appended *before* 'ExtraArgs'.
	CFlags []string `toml:"cflags"`
	// CXXFlags are additional 'CXXFLAGS' to append to the SCons build command.
	// Note that 'CXXFLAGS=...' will be appended *before* 'ExtraArgs'.
	CXXFlags []string `toml:"cxxflags"`
	// Command contains arguments used to invoke SCons. Defaults to ["scons"].
	Command []string `toml:"command"`
	// ExtraArgs are additional arguments to append to the SCons build command.
	ExtraArgs []string `toml:"extra_args"`
	// LinkFlags are additional flags passed to the linker during the SCons
	// build command.
	LinkFlags []string `toml:"link_flags"`
	// PathCache is the path to the SCons cache, relative to the manifest.
	PathCache Path `toml:"cache_path"`
}

SCons defines options and settings for use with the Godot build system.

func (*SCons) Configure

func (c *SCons) Configure(inv *Invocation) error

func (*SCons) Validate

func (c *SCons) Validate() error

type Validater

type Validater interface {
	Validate() error
}

Validater is a type which can validate itself.

Jump to

Keyboard shortcuts

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