compiler

package
v1.14.3 Latest Latest
Warning

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

Go to latest
Published: Mar 16, 2023 License: MPL-2.0 Imports: 36 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenUserFacing added in v1.5.0

func GenUserFacing(appRoot string) error

GenUserFacing generates user-facing application code.

func Test

func Test(ctx context.Context, appRoot string, cfg *Config) error

Test tests the application.

Types

type Config

type Config struct {
	// Revision specifies the app version to encode
	// into the app metadata.
	Revision string

	// This boolean returns if there are uncommitted changes
	UncommittedChanges bool

	// WorkingDir is the path relative to the app root from which the user
	// is running the build. It is used to resolve relative filenames.
	// If empty it defaults to "." which resolves to the app root.
	WorkingDir string

	// GOOS sets the GOOS to build for, if nonempty.
	GOOS string

	// GOARCH sets the GOARCH to build for, if nonempty.
	GOARCH string

	// CgoEnabled decides whether to build with cgo enabled.
	CgoEnabled bool

	// Debug specifies whether to compile in debug mode.
	Debug bool

	// BuildTags are additional build tags to specify when building.
	BuildTags []string

	// StaticLink enables static linking of C libraries.
	StaticLink bool

	// EncoreCompilerVersion is the version of the compiler used to build the app
	// it is used purely for information purposes within the healthz response.
	EncoreCompilerVersion string

	// EncoreRuntimePath if set, causes builds to introduce a temporary replace directive
	// that replaces the module path to the "encore.dev" module.
	// This lets us replace the implementation for building.
	EncoreRuntimePath string

	// EncoreGoRoot is the path to the Encore GOROOT.
	EncoreGoRoot string

	// Test is the specific settings for running tests.
	Test *TestConfig

	// ExecScript is the specific settings for executing scripts.
	ExecScript *ExecScriptConfig

	// The meta config we pass to CUE when computing the runtime configuration for the services within this
	// application
	Meta *cueutil.Meta

	// If Parse is set, the build will skip parsing the app again
	// and use the information provided.
	Parse *parser.Result

	// KeepOutput keeps the temporary build directory from being deleted in the case of failure.
	KeepOutput bool

	// OpTracker is an option tracker to output the progress to the UI
	OpTracker *optracker.OpTracker

	// Are experimental features of Encore switched on?
	Experiments *experiments.Set

	// Log is the logger to use.
	Log zerolog.Logger
}

func (*Config) Validate

func (cfg *Config) Validate() error

Validate validates the config.

type Error

type Error struct {
	Output []byte
}

func (*Error) Error

func (err *Error) Error() string

type ExecScriptConfig added in v1.11.0

type ExecScriptConfig struct {
	// ScriptMainPkg is the relative path to the main package.
	ScriptMainPkg string
}

type Result

type Result struct {
	Dir         string            // absolute path to build temp dir
	Exe         string            // absolute path to the build executable
	Parse       *parser.Result    // set only if build succeeded
	ConfigFiles fs.FS             // all found configuration files within the application source
	Configs     map[string]string // each services runtime config as defined
}

Result is the combined results of a build.

func Build

func Build(appRoot string, cfg *Config) (*Result, error)

Build builds the application.

On success, it is the caller's responsibility to delete the temp dir returned in Result.Dir.

func ExecScript added in v1.11.0

func ExecScript(appRoot string, cfg *Config) (*Result, error)

ExecScript executes a one-off script.

On success, it is the caller's responsibility to delete the temp dir returned in Result.Dir.

type TestConfig

type TestConfig struct {
	// Env sets environment variables for "go test".
	Env []string

	// Args sets extra arguments for "go test".
	Args []string

	// Stdout and Stderr are where to redirect "go test" output.
	Stdout, Stderr io.Writer
}

Directories

Path Synopsis
internal

Jump to

Keyboard shortcuts

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