config

package
v0.1.43 Latest Latest
Warning

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

Go to latest
Published: Dec 26, 2023 License: BSD-3-Clause Imports: 14 Imported by: 0

Documentation

Overview

Package config contains the configuration structs for the Goki tool.

Index

Constants

This section is empty.

Variables

View Source
var ArchsForOS = map[string][]string{
	"darwin":  {"386", "amd64", "arm", "arm64"},
	"windows": {"386", "amd64", "arm", "arm64"},
	"linux":   {"386", "amd64", "arm", "arm64"},
	"android": {"386", "amd64", "arm", "arm64"},
	"ios":     {"386", "amd64", "arm", "arm64"},
}

ArchsForOS returns contains all of the architectures supported for each operating system.

View Source
var SupportedArch = map[string]bool{
	"386":         true,
	"amd64":       true,
	"amd64p32":    true,
	"arm":         true,
	"armbe":       true,
	"arm64":       true,
	"arm64be":     true,
	"loong64":     false,
	"mips":        false,
	"mipsle":      false,
	"mips64":      false,
	"mips64le":    false,
	"mips64p32":   false,
	"mips64p32le": false,
	"ppc":         false,
	"ppc64":       false,
	"ppc64le":     false,
	"riscv":       false,
	"riscv64":     false,
	"s390":        false,
	"s390x":       false,
	"sparc":       false,
	"sparc64":     false,
	"wasm":        true,
}

SupportedArch is a map containing all computer architectures and whether they are supported by Goki.

View Source
var SupportedOS = map[string]bool{
	"aix":       false,
	"android":   true,
	"darwin":    true,
	"dragonfly": false,
	"freebsd":   false,
	"hurd":      false,
	"illumos":   false,
	"ios":       true,
	"js":        true,
	"linux":     true,
	"nacl":      false,
	"netbsd":    false,
	"openbsd":   false,
	"plan9":     false,
	"solaris":   false,
	"wasip1":    false,
	"windows":   true,
	"zos":       false,
}

SupportedOS is a map containing all operating systems and whether they are supported by Goki.

Functions

func ArchSupported

func ArchSupported(arch string) error

ArchSupported determines whether the given architecture is supported by Goki. If it is, it returns nil. If it isn't, it also returns an error detailing the issue with the architecture (not found or not supported).

func OSSupported

func OSSupported(os string) error

OSSupported determines whether the given operating system is supported by Goki. If it is, it returns nil. If it isn't, it returns an error detailing the issue with the operating system (not found or not supported).

Types

type Build

type Build struct {

	// the path of the package to build
	Package string `def:"." posarg:"0" required:"-"`

	// the target platforms to build executables for
	Target []Platform `flag:"t,target"`

	// the output file name; if not specified, it depends on the package being built
	Output string `flag:"o,output"`

	// the bundle / package ID to use for the app (required for mobile platforms and N/A otherwise); it is typically in the format com.org.app (eg: com.goki.widgets)
	ID string

	// whether to build/run the app in debug mode; this currently only works on mobile platforms
	Debug bool `flag:"d,debug"`

	// force rebuilding of packages that are already up-to-date
	Rebuild bool `flag:"a,rebuild"`

	// install the generated executable
	Install bool `flag:"i,install"`

	// print the commands but do not run them
	PrintOnly bool `flag:"n,print-only"`

	// print the commands
	Print bool `flag:"x,print"`

	// arguments to pass on each go tool compile invocation
	GCFlags []string

	// arguments to pass on each go tool link invocation
	LDFlags []string

	// a comma-separated list of additional build tags to consider satisfied during the build
	Tags []string

	// remove all file system paths from the resulting executable. Instead of absolute file system paths, the recorded file names will begin either a module path@version (when using modules), or a plain import path (when using the standard library, or GOPATH).
	Trimpath bool

	// print the name of the temporary work directory and do not delete it when exiting
	Work bool

	// the minimal version of the iOS SDK to compile against
	IOSVersion string `def:"13.0"`

	// the minimum supported Android SDK (uses-sdk/android:minSdkVersion in AndroidManifest.xml)
	AndroidMinSDK int `def:"23" min:"23"`

	// the target Android SDK version (uses-sdk/android:targetSdkVersion in AndroidManifest.xml)
	AndroidTargetSDK int `def:"29"`
}

type Config

type Config struct {

	// the name of the project
	Name string

	// the description of the project
	Desc string

	// the version of the project
	Version string `cmd:"set-version" posarg:"0" def:"v0.0.0"`

	// the type of the project (app/library)
	Type Types

	// the configuration options for the build, install, and run commands
	Build Build `cmd:"build,install,run" view:"add-fields"`

	// the configuration information for web
	Web Web `cmd:"build,install,run" view:"add-fields"`

	// the configuration options for the setup command
	Setup Setup `cmd:"setup" view:"add-fields"`

	// the configuration options for the log command
	Log Log `cmd:"log" view:"add-fields"`

	// the configuration options for the release command
	Release Release `cmd:"release" view:"add-fields"`

	// the configuration options for the generate command
	Generate Generate `cmd:"generate" view:"add-fields"`
}

Config is the main config struct that contains all of the configuration options for the Goki tool

func (*Config) OnConfig added in v0.1.23

func (c *Config) OnConfig(cmd string) error

type Generate added in v0.1.13

type Generate struct {

	// the enum generation configuration options passed to enumgen
	Enumgen enumgen.Config

	// the generation configuration options passed to gtigen
	Gtigen gtigen.Config

	// the source directory to run generate on (can be multiple through ./...)
	Dir string `def:"." posarg:"0" required:"-" nest:"-"`

	// the output file location relative to the package on which generate is being called
	Output string `def:"gokigen.go"`
}

type Log

type Log struct {

	// the target platform to view the logs for (ios or android)
	Target string `def:"android"`

	// whether to keep the previous log messages or clear them
	Keep bool `def:"false"`

	// messages not generated from your app equal to or above this log level will be shown
	All string `def:"F"`
}

type Platform

type Platform struct {
	OS   string
	Arch string
}

Platform is a platform with an operating system and an architecture

func (*Platform) SetString added in v0.1.23

func (p *Platform) SetString(platform string) error

SetString sets the platform from the given string of format os[/arch]

func (Platform) String added in v0.1.21

func (p Platform) String() string

String returns the platform as a string in the form "os/arch"

type Release

type Release struct {

	// the Go file to store version information in
	VersionFile string `def:"version.go"`

	// the Go package in which the version file will be stored
	Package string `def:"main"`
}

type Setup added in v0.1.23

type Setup struct {

	// the platform to set things up for
	Platform Platform `posarg:"0"`
}

type Types

type Types int32 //enums:enum -trim-prefix Type

Types is an enum with all of the possible types of packages.

const (
	// TypeApp is an executable app
	TypeApp Types = iota
	// TypeLibrary is an importable library
	TypeLibrary
)
const TypesN Types = 2

TypesN is the highest valid value for type Types, plus one.

func TypesValues

func TypesValues() []Types

TypesValues returns all possible values for the type Types.

func (Types) Desc

func (i Types) Desc() string

Desc returns the description of the Types value.

func (Types) Int64

func (i Types) Int64() int64

Int64 returns the Types value as an int64.

func (Types) IsValid

func (i Types) IsValid() bool

IsValid returns whether the value is a valid option for type Types.

func (Types) MarshalText

func (i Types) MarshalText() ([]byte, error)

MarshalText implements the encoding.TextMarshaler interface.

func (*Types) SetInt64

func (i *Types) SetInt64(in int64)

SetInt64 sets the Types value from an int64.

func (*Types) SetString

func (i *Types) SetString(s string) error

SetString sets the Types value from its string representation, and returns an error if the string is invalid.

func (Types) String

func (i Types) String() string

String returns the string representation of this Types value.

func (*Types) UnmarshalText

func (i *Types) UnmarshalText(text []byte) error

UnmarshalText implements the encoding.TextUnmarshaler interface.

func (Types) Values

func (i Types) Values() []enums.Enum

Values returns all possible values for the type Types.

type Web added in v0.1.28

type Web struct {

	// Port is the port to serve the page at when using the serve command.
	Port string `def:"8080"`

	// RandomVersion is whether to automatically add a random string to the
	// end of the version string for the app when building for web. This is
	// necessary in order for changes made during local development to show up,
	// but should not be enabled in release builds to prevent constant inaccurate
	// update messages. It is enabled by default in the serve command and disabled
	// by default otherwise.
	RandomVersion bool

	// Gzip is whether to gzip the app.wasm file that is built in the build command
	// and serve it as a gzip-encoded file in the run command.
	Gzip bool

	// A placeholder background color for the application page to display before
	// its stylesheets are loaded.
	//
	// DEFAULT: #2d2c2c.
	BackgroundColor string `def:"#2d2c2c"`

	// The theme color for the application. This affects how the OS displays the
	// app (e.g., PWA title bar or Android's task switcher).
	//
	// DEFAULT: #2d2c2c.
	ThemeColor string `def:"#2d2c2c"`

	// The text displayed while loading a page. Load progress can be inserted by
	// including "{progress}" in the loading label.
	//
	// DEFAULT: "{progress}%".
	LoadingLabel string

	// The page language.
	//
	// DEFAULT: en.
	Lang string `def:"en"`

	// The page title.
	Title string

	// The page description.
	Description string

	// The page authors.
	Author string

	// The page keywords.
	Keywords []string

	// The path of the default image that is used by social networks when
	// linking the app.
	Image string

	// The interval between each app auto-update while running in a web browser.
	// Zero or negative values deactivates the auto-update mechanism.
	//
	// Default is 10 seconds.
	AutoUpdateInterval time.Duration `def:"10000000000"`

	// The environment variables that are passed to the progressive web app.
	//
	// Reserved keys:
	// - GOAPP_VERSION
	// - GOAPP_GOAPP_STATIC_RESOURCES_URL
	Env map[string]string

	// The HTTP header to retrieve the WebAssembly file content length.
	//
	// Content length finding falls back to the Content-Length HTTP header when
	// no content length is found with the defined header.
	WasmContentLengthHeader string

	// The template used to generate app-worker.js. The template follows the
	// text/template package model.
	//
	// By default set to DefaultAppWorkerJS, changing the template have very
	// high chances to mess up go-app usage. Any issue related to a custom app
	// worker template is not supported and will be closed.
	ServiceWorkerTemplate string
}

Web containts the configuration information for building for web and creating the HTML page that loads a Go wasm app and its resources.

Jump to

Keyboard shortcuts

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