Documentation
¶
Overview ¶
Package releaseplan plans and formats `nsgo build` release invocations and credits checks shared by `cmd/game release` and the scene editor's Export panel.
Index ¶
- Constants
- Variables
- func Args(dir string, opts Options, settings Settings, nsgo NSGoSettings) ([]string, error)
- func OutputDir(dir string, opts Options, settings Settings, nsgo NSGoSettings) (string, error)
- func ShellQuote(args []string) string
- func WriteDryRun(w io.Writer, p *Plan)
- type NSGoSettings
- type Options
- type Plan
- type Settings
Constants ¶
const DefaultOutput = "dist"
DefaultOutput is the directory nsgo build writes to when nsgo.yaml's build.output is empty, from NSGo v0.3.0's cmd/nsgo/project.go.
const NoCreditsNote = "game release: note: game.yaml has no assets section, so no " + credits.FileName + " is written; credit the assets the game ships yourself"
NoCreditsNote is what game release prints when game.yaml has no assets section, and so no credits file is written.
Variables ¶
var Channels = []string{"direct", "store", "steam", "none"}
Channels are the distribution channels nsgo build accepts for -channel.
var DefaultPlatforms = []string{"macos", "windows", "linux", "web", "ios", "android"}
DefaultPlatforms are what game release builds when neither -target nor game.yaml's export presets say otherwise, as nsgo build -target names them: macos, windows, linux and android expand to their architectures, and ios and web are one target each.
var ErrInvalidTarget = errors.New("invalid target")
ErrInvalidTarget is wrapped when Options.Targets contains an empty target entry.
var SteamPlatforms = []string{"macos", "windows", "linux"}
SteamPlatforms are what game release builds by default for the steam channel, whose depots nsgo build makes only of desktop targets.
Functions ¶
func Args ¶
Args returns the arguments of the go command that builds the project in dir: go -C dir tool nsgo build with the targets and output resolved from opts, then game.yaml's settings, then the defaults, the channel coming from opts, then nsgo.yaml. nsgo.yaml's build.targets is not a default: it is plain nsgo build's everyday list, which in the starter holds a simulator build and leaves out Linux. Paths in opts are relative to the working directory, and game.yaml's output to dir.
func OutputDir ¶
OutputDir returns the absolute directory nsgo build writes the release to, as Args passes it and nsgo resolves it: -output, relative to the working directory, else game.yaml's export.output, else nsgo.yaml's build.output, else dist, these relative to dir.
func ShellQuote ¶
ShellQuote writes args as one line a POSIX shell reads back as the same arguments.
func WriteDryRun ¶
WriteDryRun writes the exact dry-run lines printed by `game release -dry-run` for p.
Types ¶
type NSGoSettings ¶
type NSGoSettings struct {
// Channel is updates.channel, the channel nsgo build hands the packages out through when -channel does not say.
Channel string
// Output is build.output, the directory nsgo build writes to when neither -output nor game.yaml's export.output says, relative to the project unless absolute; empty is nsgo's default, dist.
Output string
}
NSGoSettings are the parts of nsgo.yaml that game release reads.
func ReadNSGoSettings ¶
func ReadNSGoSettings(dir string) (NSGoSettings, error)
ReadNSGoSettings reads dir's nsgo.yaml. The file is nsgo's, which validates it when it builds, so fields game release does not read are left alone rather than refused.
type Options ¶
type Options struct {
// Targets is -target, comma-separated; empty takes game.yaml's presets, else SteamPlatforms for the steam channel, else DefaultPlatforms.
Targets string
// Output is -output; empty takes game.yaml's export.output, else nsgo.yaml's build.output.
Output string
// Channel is -channel, which nsgo build takes as the channel the packages are handed out through.
Channel string
// Notes is -release-notes, a Markdown file nsgo build puts in the appcasts.
Notes string
// Jobs is -jobs, how many targets build at once; 0 leaves nsgo's default.
Jobs int
}
Options are game release's build flags.
type Plan ¶
type Plan struct {
// Dir is the absolute project directory.
Dir string
// Args are the arguments passed to the `go` command.
Args []string
// CommandLine is the POSIX-quoted `go ...` command printed by -dry-run.
CommandLine string
// OutputDir is the resolved absolute directory where release packages are written.
OutputDir string
// AssetsConfigured reports whether game.yaml declared an assets section.
AssetsConfigured bool
// Credits are the collected asset credits when AssetsConfigured is true.
Credits []credits.Entry
// CreditsPath is the full path where CREDITS.md will be written, or empty when AssetsConfigured is false.
CreditsPath string
}
Plan is a validated release build plan ready for dry-run printing or execution.
type Settings ¶
type Settings struct {
// Output is export.output, a slash-separated directory inside the project; empty leaves nsgo.yaml's build.output.
Output string
// Targets are the presets' targets in order, a preset without targets giving its platform name; nil without presets.
Targets []string
// Assets is the assets section as package project parses it with the whole file; nil when game.yaml has none, and then no credits file is written.
Assets *project.Assets
}
Settings are the parts of game.yaml that game release reads: the build output directory, the build targets of the export presets and the assets section, whose assets the credits file lists.
func SettingsFromProject ¶
SettingsFromProject extracts release Settings from an in-memory project.File.