export

package
v0.3.25 Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2024 License: MIT Imports: 26 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ModeUnknown    = ""
	ModeResources  = "resources"
	ModeCustomized = "customized"
)
View Source
const (
	FileVisualModeUnknown = ""
	FileVisualModeKeep    = "keep"
	FileVisualModeRemove  = "remove"
	FileVisualModeStrip   = "strip"
)

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(rc *run.Context, x *Export) (string, error)

Checksum produces a checksum hash of the export specification. When the checksums of two 'Export' definitions matches, the resulting exported artifacts will be equivalent.

func NewExportAction added in v0.3.0

func NewExportAction(
	rc *run.Context,
	preset *Preset,
	pathGodot osutil.Path,
) action.Action

NewExportAction creates a new 'action.Action' which exports the specified pack file.

func NewInstallEditorGodotAction added in v0.3.0

func NewInstallEditorGodotAction(
	_ *run.Context,
	ev engine.Version,
	pathGodot osutil.Path,
) action.WithDescription[action.Function]

NewInstallEditorGodotAction creates an 'action.Action' which installs the Godot editor into the build directory.

func NewLoadProjectAction added in v0.3.0

func NewLoadProjectAction(
	rc *run.Context,
	pathGodotEditor osutil.Path,
) *action.Process

NewLoadProjectAction creates an 'action.Action' which opens the Godot project is the editor for the purpose of generating import files.

func NewMkdirAllAction added in v0.3.0

func NewMkdirAllAction(path string, perm os.FileMode) action.WithDescription[action.Function]

NewMkdirAllAction creates a new 'action.Action' which creates the specified directory if missing.

func NewRemoveAllAction added in v0.3.18

func NewRemoveAllAction(path string) action.WithDescription[action.Function]

NewRemoveAllAction creates a new 'action.Action' which removes the specified directory if preset.

func NewWriteExportPresetsAction added in v0.3.0

func NewWriteExportPresetsAction(
	rc *run.Context,
	x *Export,
) action.WithDescription[action.Function]

NewWriteExportPresetsAction creates a new 'action.Action' which constructs an 'export_presets.cfg' file based on the target. It will be written to the workspace directory and overwrite any existing files.

Types

type Export

type Export struct {
	// Arch is the architecture of the exported artifacts.
	Arch platform.Arch
	// EncryptionKey is an encryption key used to encrypt game assets with.
	EncryptionKey string
	// Features contains the slice of Godot project feature tags to build with.
	Features []string
	// Options are 'export_presets.cfg' overrides, specifically the preset
	// 'options' table, for the exported artifact.
	Options map[string]any
	// PackFiles defines the game files exported as part of this artifact.
	PackFiles []PackFile
	// PathTemplate is a path to the export template to use during exporting.
	PathTemplate osutil.Path `hash:"ignore"`
	// PathTemplateArchive is an optional path to a non-cached export template
	// archive containing the export template to use. If specified, this will
	// take priority over 'Template'.
	PathTemplateArchive osutil.Path `hash:"ignore"`
	// Template specifies the export template to use.
	Template *template.Template `hash:"string"`
	// RunBefore contains an ordered list of actions to execute prior to
	// exporting the target.
	RunBefore action.Action `hash:"string"`
	// RunAfter contains an ordered list of actions to execute after exporting
	// the target.
	RunAfter action.Action `hash:"string"`
	// Runnable is whether the export artifact should be executable. This should
	// be true for client and server targets and false for artifacts like DLC.
	Runnable bool
	// Server configures the target as a server-only executable, enabling some
	// optimizations like disabling graphics.
	Server bool
	// Version is the editor version to use for exporting.
	Version engine.Version
}

Export specifies a single, platform-agnostic exportable artifact within the Godot project.

func (*Export) Action

func (x *Export) Action(rc *run.Context, pathGodot osutil.Path) (action.Action, error)

Action creates an 'action.Action' for running the export action.

func (*Export) Artifacts

func (x *Export) Artifacts(rc *run.Context) ([]string, error)

Artifacts returns the set of exported project artifacts required by the underlying target definition.

func (*Export) Presets added in v0.3.0

func (x *Export) Presets(rc *run.Context) ([]*Preset, error)

Presets constructs the list of 'Preset' types for the specified pack files.

type FileVisualMode added in v0.3.18

type FileVisualMode string

type Mode added in v0.3.18

type Mode string

type PackFile

type PackFile struct {
	// Embed defines whether the associated '.pck' file should be embedded in
	// the binary. If true, then the target this 'PackFile' is associated with
	// must be runnable.
	Embed *bool `toml:"embed"`
	// Encrypt determines whether or not to encrypt the game files contained in
	// the resulting '.pck' files.
	Encrypt *bool `toml:"encrypt"`
	// Exclude is a slice of glob expressions to filter *out* game files for
	// this pack file. These expressions will be evaluated from the directory
	// containing the GDBuild manifest.
	Exclude []string `hash:"ignore" toml:"exclude"`
	// Include is a slice of glob expressions to match game files against to
	// include in this pack file. These expressions will be evaluated from the
	// directory containing the GDBuild manifest.
	Include []string `hash:"ignore" toml:"include"`
	// Name is the name of the pack file. If omitted a name will be chosen based
	// on the pack files index within the target configuration.
	Name osutil.Path `toml:"name"`
	// PackFilePartition is a ruleset for how to split the files matched by
	// 'glob' into one or more '.pck' files.
	Partition PackFilePartition `toml:"partition"`
	// Visuals sets whether the resources in this pack file will have visuals
	// stripped. Only usable when exporting as a server and defaults to 'true'.
	Visuals *bool `toml:"visuals"`
	// Zip defines whether to compress the matching game files. The pack files
	// will use the '.zip' extension instead of '.pck'.
	Zip *bool `toml:"zip"`
}

PackFile defines instructions for assembling one or more '.pck' files containing exported game files.

func (*PackFile) Configure

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

func (*PackFile) Extension added in v0.3.0

func (c *PackFile) Extension(pl platform.OS) string

func (*PackFile) Filename added in v0.3.0

func (c *PackFile) Filename(pl platform.OS, targetName string, index int) string

func (*PackFile) Files

func (c *PackFile) Files(path osutil.Path) ([]osutil.Path, error)

func (*PackFile) Preset added in v0.3.0

func (c *PackFile) Preset(rc *run.Context, xp *Export, index int) (Preset, error)

Preset constructs a 'Preset' for the pack file based on the current context.

func (*PackFile) StripVisuals added in v0.3.0

func (c *PackFile) StripVisuals() bool

StripVisuals determines whether the included resources should have visuals stripped as part of a server-side optimization.

func (*PackFile) Validate

func (c *PackFile) Validate(rc *run.Context) error

type PackFilePartition

type PackFilePartition struct {
	// Depth is the maximum folder depth from the project directory containing
	// the GDBuild manifest to split files between. Any folders past this depth
	// limit will all be included within the same '.pck' file.
	Depth uint `toml:"depth"`
	// Limit describes limits on the files within individual '.pck' files in the
	// partition.
	Limit PackFilePartitionLimit `toml:"limit"`
}

PackFilePartition describes how to automatically partition a collection of files into multiple '.pck' files.

NOTE: This struct contains multiple different expressions of limits, multiple of which may be true at a time. If any of the contained rules would trigger a new '.pck' to be formed within a partition, then that rule will be respected.

type PackFilePartitionLimit

type PackFilePartitionLimit struct {
	// Size is a human-readable file size limit that all '.pck' files within the
	// partition must adhere to.
	Size string `toml:"size"`
	// Files is the maximum count of files within a single '.pck' file within a
	// partition.
	Files uint `toml:"files"`
}

PackFilePartitionLimit describes limits used to determine when a new '.pck' file within a partition should be started.

type Preset added in v0.3.0

type Preset struct {
	Arch            platform.Arch     `ini:"-"`
	CustomizedFiles map[string]string `ini:"-"`
	Embed           bool              `ini:"-"`
	Encrypt         bool              `ini:"encrypt_pck"`
	EncryptIndex    bool              `ini:"encrypt_directory"`
	Encrypted       []string          `ini:"encryption_include_filters"`
	EncryptionKey   string            `ini:"-"`
	Exclude         string            `ini:"exclude_filter"`
	ExportedFiles   []string          `ini:"export_files"`
	// ExportMode sets the type of export to use. Should be 'resources' for a
	// standard pack file and 'customized' for dedicated server pack files.
	ExportMode   Mode        `ini:"export_filter"`
	Features     []string    `ini:"custom_features"`
	Include      string      `ini:"include_filter"`
	Name         string      `ini:"name"`
	PathTemplate osutil.Path `ini:"-"`
	Platform     platform.OS `ini:"-"`
	Runnable     bool        `ini:"runnable"`
	Server       bool        `ini:"dedicated_server"`

	Options map[string]string `ini:"-"`
}

Preset defines the parameters used in a Godot export preset.

func (*Preset) AddFile added in v0.3.0

func (p *Preset) AddFile(rc *run.Context, path osutil.Path) error

func (*Preset) AddServerFile added in v0.3.18

func (p *Preset) AddServerFile(rc *run.Context, path osutil.Path, visuals FileVisualMode) error

func (*Preset) Marshal added in v0.3.0

func (p *Preset) Marshal(w io.Writer, index int) error

Jump to

Keyboard shortcuts

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