Documentation ¶
Overview ¶
Package config contains the configuration structs for the Cogent Core tool.
Index ¶
Constants ¶
This section is empty.
Variables ¶
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": {"arm64"},
}
ArchsForOS returns contains all of the architectures supported for each operating system.
Functions ¶
func ArchSupported ¶
ArchSupported determines whether the given architecture is supported by Cogent Core. 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 LinkerFlags ¶ added in v0.1.3
LinkerFlags returns the ld linker flags that specify the app and core version, the app about information, the app icon, and the optional [Build.Ldflags].
func OSSupported ¶
OSSupported determines whether the given operating system is supported by Cogent Core. 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 target platforms to build executables for Target []Platform `flag:"t,target" posarg:"0" required:"-" save:"-"` // Dir is the directory to build the app from. // It defaults to the current directory. Dir string // Output is the directory to output the built app to. // It defaults to the current directory for desktop executables // and "bin/{platform}" for all other platforms and command "pack". Output string `flag:"o,output"` // Debug is whether to build/run the app in debug mode, which sets // the "debug" tag when building and prevents the default stripping // of debug symbols. On iOS and Android, this also prints the program output. Debug bool `flag:"d,debug"` // Ldflags are optional additional linker flags to pass to go build commands. Ldflags string // Trimpath is whether to replace file system paths with module paths // in the resulting executable. It is on by default for commands other // than core run. Trimpath bool `default:"true"` // Windowsgui is whether to make this a "Windows GUI" application that // opens without a terminal window on Windows. It is on by default for // commands other than core run. Windowsgui bool `default:"true"` // the minimum version of the iOS SDK to compile against IOSVersion string `default:"13.0"` // the minimum supported Android SDK (uses-sdk/android:minSdkVersion in AndroidManifest.xml) AndroidMinSDK int `default:"23" min:"23"` // the target Android SDK version (uses-sdk/android:targetSdkVersion in AndroidManifest.xml) AndroidTargetSDK int `default:"29"` }
type Config ¶
type Config struct { // Name is the user-friendly name of the project. // The default is based on the current directory name. Name string // NamePrefix is the prefix to add to the default name of the project // and any projects nested below it. A separating space is automatically included. NamePrefix string // ID is the bundle / package ID to use for the project // (required for building for mobile platforms and packaging // for desktop platforms). It is typically in the format com.org.app // (eg: com.cogent.mail). It defaults to com.parentDirectory.currentDirectory. ID string // About is the about information for the project, which can be viewed via // the "About" button in the app bar. It is also used when packaging the app. About string // the version of the project to release Version string `cmd:"release" posarg:"0" save:"-"` // Pages, if specified, indicates that the app has core // pages located at this directory. If so, markdown code blocks with // language Go (must be uppercase, as that indicates that is an // "exported" example) will be collected and stored at pagegen.go, and // a directory tree will be made for all of the pages when building // for platform web. This defaults to "content" when building an app // for platform web that imports pages. Pages string // the configuration options for the build, install, run, and pack commands Build Build `cmd:"build,install,run,pack"` // the configuration information for the pack command Pack Pack `cmd:"pack"` // the configuration information for web Web Web `cmd:"build,install,run,pack"` // the configuration options for the log and run commands Log Log `cmd:"log,run"` // the configuration options for the generate command Generate Generate `cmd:"generate"` }
Config is the main config struct that contains all of the configuration options for the Cogent Core command line tool.
type Generate ¶
type Generate struct { // the enum generation configuration options passed to enumgen Enumgen enumgen.Config // the generation configuration options passed to typegen Typegen typegen.Config // the source directory to run generate on (can be multiple through ./...) Dir string `default:"." posarg:"0" required:"-" nest:"-"` // Icons, if specified, indicates to generate an icongen.go file with // icon variables for the icon svg files in the specified folder. Icons string }
type Log ¶
type Log struct { // the target platform to view the logs for (ios or android) Target string `default:"android"` // whether to keep the previous log messages or clear them Keep bool `default:"false"` // messages not generated from your app equal to or above this log level will be shown All string `default:"F"` }
type Pack ¶
type Pack struct { // whether to build a .dmg file on macOS in addition to a .app file. // This is automatically disabled for the install command. DMG bool `default:"true"` }
type Platform ¶
Platform is a platform with an operating system and an architecture
type Web ¶
type Web struct { // Port is the port to serve the page at when using the serve command. Port string `default:"8080"` // RandomVersion is whether to make the app worker version random. // It is enabled by default and should be kept on for easy deployment. RandomVersion bool `default:"true"` // 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 // GenerateHTML is whether to generate an HTML version of app content for // preview and SEO purposes. GenerateHTML bool `default:"true"` // The page language. // // DEFAULT: en. Lang string `default:"en"` // 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 `default:"10s"` // If specified, make this page a Go import vanity URL with this // module URL, pointing to the GitHub repository specified by GithubVanityURL // (eg: cogentcore.org/core). VanityURL string // If VanityURL is specified, the underlying GitHub repository for the vanity URL // (eg: cogentcore/core). GithubVanityRepository string // The environment variables that are passed to the progressive web app. // // Reserved keys: // - 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 }
Web containts the configuration information for building for web and creating the HTML page that loads a Go wasm app and its resources.