template

package
v0.3.22 Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2024 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrConflictingValue = errors.New("conflicting setting")
	ErrInvalidInput     = errors.New("invalid input")
	ErrMissingInput     = errors.New("missing input")
)

Functions

func Checksum added in v0.3.0

func Checksum(t *Template) (string, error)

Checksum produces a checksum hash of the export template specification. When the checksums of two 'Template' definitions matches, the resulting export templates will be equivalent.

NOTE: This implementation relies on producers of 'Template' to correctly register all file system dependencies within 'Paths'.

func EncryptionKeyFromEnv added in v0.2.2

func EncryptionKeyFromEnv() string

EncryptionKeyFromEnv returns the encryption key set via environment variable.

func NewVendorGodotAction added in v0.3.0

func NewVendorGodotAction(src *engine.Source, rc *run.Context) action.WithDescription[action.Function]

NewVendorGodotAction creates an 'action.Action' which vendors Godot source code into the build directory.

Types

type Build added in v0.2.2

type Build struct {
	// Arch is the CPU architecture of the Godot export template.
	Arch platform.Arch

	// CustomModules is a list of paths to custom modules to include in the
	// template build.
	CustomModules []osutil.Path `hash:"ignore"` // Ignore; paths are separately hashed.

	// CustomPy is a path to a 'custom.py' file which defines export template
	// build options.
	CustomPy osutil.Path `hash:"ignore"` // Ignore; path is separately hashed.

	// DoublePrecision enables double floating-point precision.
	DoublePrecision bool

	// EncryptionKey is an encryption key to embed in the export template.
	//
	// NOTE: While this could just be set in 'Env', exposing it here simplifies
	// setting it externally (i.e. via the 'target' command).
	EncryptionKey string

	// Env is a map of environment variables to set during the build step.
	Env map[string]string

	// Source is the source code specification for the build.
	Source engine.Source

	// Optimize is the level of optimization for the Godot export template.
	Optimize engine.Optimize

	// Platform defines which OS/platform to build for.
	Platform platform.OS

	// Profile is the optimization level of the template.
	Profile engine.Profile

	// SCons contains a specification for how to invoke the compiler.
	SCons SCons
}

Build uniquely specifies a compilation of a Godot export template.

func (*Build) Basename added in v0.3.20

func (b *Build) Basename(rc *run.Context) string

Basename returns the base name of the compiled engine artifact generated by this 'Build' specification.

func (*Build) SConsCommand added in v0.2.2

func (b *Build) SConsCommand(rc *run.Context) *action.Process

SConsCommand returns the 'SCons' command to build the export template.

type SCons added in v0.2.2

type SCons struct {
	// CCFlags are additional 'CFLAGS' to append to the SCons build command.
	// Note that 'CCFLAGS=...' will be appended *before* 'ExtraArgs'.
	CCFlags []string `hash:"set" toml:"ccflags"`
	// CFlags are additional 'CFLAGS' to append to the SCons build command. Note
	// that 'CFLAGS=...' will be appended *before* 'ExtraArgs'.
	CFlags []string `hash:"set" toml:"cflags"`
	// CXXFlags are additional 'CXXFLAGS' to append to the SCons build command.
	// Note that 'CXXFLAGS=...' will be appended *before* 'ExtraArgs'.
	CXXFlags []string `hash:"set" toml:"cxxflags"`
	// CacheSizeLimit is the limit in MiB.
	CacheSizeLimit *uint32 `hash:"ignore" toml:"cache_size_limit"` // Ignore; doesn't affect binary.
	// Command contains arguments used to invoke SCons. Defaults to ["scons"].
	Command []string `hash:"set" toml:"command"`
	// ExtraArgs are additional arguments to append to the SCons build command.
	ExtraArgs []string `hash:"set" toml:"extra_args"`
	// LinkFlags are additional flags passed to the linker during the SCons
	// build command.
	LinkFlags []string `hash:"set" toml:"link_flags"`
	// PathCache is the path to the SCons cache, relative to the manifest.
	PathCache osutil.Path `hash:"ignore" toml:"cache_path"` // Ignore; doesn't affect binary.
}

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

func (*SCons) CacheSizeLimitFromEnv added in v0.2.2

func (c *SCons) CacheSizeLimitFromEnv() *uint32

CacheSizeLimitFromEnv returns a SCons cache size limit set via environment variable.

func (*SCons) Configure added in v0.2.2

func (c *SCons) Configure(rc *run.Context) error

func (*SCons) ExtraArgsFromEnv added in v0.2.2

func (c *SCons) ExtraArgsFromEnv() []string

ExtraArgsFromEnv returns extra SCons arguments set via environment variable.

func (*SCons) PathCacheFromEnv added in v0.2.2

func (c *SCons) PathCacheFromEnv() osutil.Path

PathCacheFromEnv returns a SCons cache path set via environment variable.

func (*SCons) Validate added in v0.2.2

func (c *SCons) Validate(_ *run.Context) error

type Template

type Template struct {
	// Arch is a record of the overall architecture that's being targeted. This
	// exists for convenience when exporting, since some templates may be have
	// multiple builds and the correct architecture label opaque as a result.
	Arch platform.Arch `hash:"ignore"`

	// Builds is a list of export template compilation definitions that are
	// required by the resulting export template artifact.
	Builds []Build `hash:"set"`

	// ExtraArtifacts are the base names of export template artifacts which are
	// expected to be found in the 'bin' directory post-compilation. If these
	// are missing, 'gdbuild' will consider the build to have failed. Note that
	// the artifacts pertaining to 'Builds' do not need to be specified.
	ExtraArtifacts []string `hash:"ignore"`

	// NameOverride is an override for the base name of the resulting export
	// template. This exists for platforms where the export template is not
	// named the same as the engine template file.
	NameOverride string `hash:"ignore"`

	// Paths is a list of additional files and folders which this template
	// depends on. Useful for recording dependencies which are defined in
	// otherwise opaque properties like 'Hook'.
	Paths []osutil.Path `hash:"ignore"`

	// Prebuild contains an ordered list of actions to execute prior to
	// compilation of the export templates.
	Prebuild action.Action `hash:"string"`

	// Postbuild contains an ordered list of actions to execute after
	// compilation of the export templates.
	Postbuild action.Action `hash:"string"`
}

Template defines a Godot export template compilation. Its scope is limited to the compilation step.

func (*Template) Action

func (t *Template) Action(rc *run.Context) action.Action

Action creates an 'action.Action' for running the build actions.

func (*Template) Artifacts

func (t *Template) Artifacts(rc *run.Context) []string

Artifacts returns the set of export template artifacts required by the underlying template build definition. This will join the files generated by the included 'Binary' definitions with those added in 'ExtraArtifacts'.

func (*Template) Basename added in v0.3.20

func (t *Template) Basename(rc *run.Context) string

Basename returns the base name of the export template generated by this 'Template' specification.

NOTE: If the length of 'Builds' is *not* '1', then the value set in 'NameOverride' will be used. This is because '0' or '2+' builds wouldn't result in a definitive template name.

func (*Template) RegisterDependencyPath

func (t *Template) RegisterDependencyPath(path osutil.Path)

RegisterDependencyPath is a convenience function for registering a 'Path' dependency, but only if it hasn't been added yet.

func (*Template) String

func (t *Template) String() string

Jump to

Keyboard shortcuts

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