Documentation ¶
Index ¶
- Variables
- type ArtifactString
- type ArtifactStrings
- type BuildInfo
- type BuildOutput
- type Cmd
- type CmdSpec
- type CompileParams
- type CompileResult
- type DebugMode
- type Entrypoint
- type GenUserFacingParams
- type GoBuildOutput
- type Impl
- type JSBuildOutput
- type ParseParams
- type ParseResult
- type RunTestsParams
- type ServiceConfigsParams
- type ServiceConfigsResult
- type TestSpecParams
- type TestSpecResult
Constants ¶
This section is empty.
Variables ¶
var ErrNoTests = errors.New("no tests found")
ErrNoTests is reported by TestSpec when there aren't any tests to run.
var LocalBuildTags = []string{
"encore_local",
"encore_no_gcp", "encore_no_aws", "encore_no_azure",
"encore_no_datadog", "encore_no_prometheus",
}
Functions ¶
This section is empty.
Types ¶
type ArtifactString ¶ added in v1.33.0
type ArtifactString string
func (ArtifactString) Expand ¶ added in v1.33.0
func (a ArtifactString) Expand(artifactDir paths.FS) string
func (ArtifactString) Join ¶ added in v1.33.0
func (a ArtifactString) Join(strs ...string) ArtifactString
type ArtifactStrings ¶ added in v1.33.0
type ArtifactStrings []ArtifactString
type BuildInfo ¶
type BuildInfo struct { BuildTags []string CgoEnabled bool StaticLink bool DebugMode DebugMode Environ []string GOOS, GOARCH string KeepOutput bool Revision string UncommittedChanges bool // MainPkg is the path to the existing main package to use, if any. MainPkg option.Option[paths.Pkg] // Overrides to explicitly set the GoRoot and EncoreRuntime paths. // if not set, they will be inferred from the current executable. GoRoot option.Option[paths.FS] EncoreRuntimes option.Option[paths.FS] // UseLocalJSRuntime specifies whether to override the installed Encore version // with the local JS runtime. UseLocalJSRuntime bool // Logger allows a custom logger to be used by the various phases of the builder. Logger option.Option[zerolog.Logger] }
func DefaultBuildInfo ¶ added in v1.16.1
func DefaultBuildInfo() BuildInfo
DefaultBuildInfo returns a BuildInfo with default values. It can be modified afterwards.
func (*BuildInfo) IsCrossBuild ¶ added in v1.41.7
type BuildOutput ¶ added in v1.33.0
type BuildOutput interface { GetArtifactDir() paths.FS GetEntrypoints() []Entrypoint }
type Cmd ¶ added in v1.33.0
type Cmd struct { // The command to execute, with arguments. Command []string // Additional env variables to pass in. Env []string }
Cmd defines a command to run. It's like CmdSpec, but uses expanded paths instead of ArtifactStrings. A CmdSpec can be turned into a Cmd using Expand.
type CmdSpec ¶ added in v1.33.0
type CmdSpec struct { // The command to execute. Can either be a filesystem path // or a path to a binary (using "${ARTIFACT_DIR}" as a placeholder). Command ArtifactStrings `json:"command"` // Additional env variables to pass in. Env ArtifactStrings `json:"env"` // PrioritizedFiles are file paths that should be prioritized when // building a streamable docker image. PrioritizedFiles ArtifactStrings `json:"prioritized_files"` }
CmdSpec is a specification for a command to run.
The fields can refer to file paths within the artifact directory using the "${ARTIFACT_DIR}" placeholder (substituted with os.ExpandEnv). This is necessary when building docker images, as otherwise the file paths will refer to the wrong filesystem location in the built docker image.
type CompileParams ¶
type CompileResult ¶
type CompileResult struct { OS string Arch string Outputs []BuildOutput }
type DebugMode ¶ added in v1.40.0
type DebugMode string
DebugMode specifies how to compile the application for debugging.
type Entrypoint ¶ added in v1.33.0
type Entrypoint struct { // How to run this entrypoint. Cmd CmdSpec `json:"cmd"` // Services hosted by this entrypoint. Services []string `json:"services"` // Gateways hosted by this entrypoint. Gateways []string `json:"gateways"` // Whether this entrypoint uses the new runtime config. UseRuntimeConfigV2 bool `json:"use_runtime_config_v2"` }
type GenUserFacingParams ¶
type GenUserFacingParams struct { Build BuildInfo App *apps.Instance Parse *ParseResult }
type GoBuildOutput ¶ added in v1.33.0
type GoBuildOutput struct { // The folder containing the build artifacts. // These artifacts are assumed to be relocatable. ArtifactDir paths.FS `json:"artifact_dir"` // The entrypoints that are part of this build output. Entrypoints []Entrypoint `json:"entrypoints"` }
func (*GoBuildOutput) GetArtifactDir ¶ added in v1.33.0
func (o *GoBuildOutput) GetArtifactDir() paths.FS
func (*GoBuildOutput) GetEntrypoints ¶ added in v1.33.0
func (o *GoBuildOutput) GetEntrypoints() []Entrypoint
type Impl ¶
type Impl interface { Parse(context.Context, ParseParams) (*ParseResult, error) Compile(context.Context, CompileParams) (*CompileResult, error) TestSpec(context.Context, TestSpecParams) (*TestSpecResult, error) RunTests(context.Context, RunTestsParams) error ServiceConfigs(context.Context, ServiceConfigsParams) (*ServiceConfigsResult, error) GenUserFacing(context.Context, GenUserFacingParams) error UseNewRuntimeConfig() bool NeedsMeta() bool Close() error }
type JSBuildOutput ¶ added in v1.33.0
type JSBuildOutput struct { // NodeModules are the node modules that the build artifacts rely on. // It's None if the artifacts don't rely on any node modules. NodeModules option.Option[paths.FS] `json:"node_modules"` // The folder containing the build artifacts. // These artifacts are assumed to be relocatable. ArtifactDir paths.FS `json:"artifact_dir"` // PackageJson is the path to the package.json file to use. PackageJson paths.FS `json:"package_json"` // The entrypoints that are part of this build output. Entrypoints []Entrypoint `json:"entrypoints"` // Whether the build output uses the local runtime on the builder, // as opposed to installing a published release via e.g. 'npm install'. UsesLocalRuntime bool `json:"uses_local_runtime"` }
func (*JSBuildOutput) GetArtifactDir ¶ added in v1.33.0
func (o *JSBuildOutput) GetArtifactDir() paths.FS
func (*JSBuildOutput) GetEntrypoints ¶ added in v1.33.0
func (o *JSBuildOutput) GetEntrypoints() []Entrypoint
type ParseParams ¶
type ParseResult ¶
type RunTestsParams ¶ added in v1.34.0
type RunTestsParams struct { Spec *TestSpecResult // WorkingDir is the directory to invoke the test command from. WorkingDir paths.FS // Stdout and Stderr are where to redirect the command output. Stdout, Stderr io.Writer }
type ServiceConfigsParams ¶ added in v1.33.0
type ServiceConfigsParams struct { Parse *ParseResult CueMeta *cueutil.Meta }
type ServiceConfigsResult ¶ added in v1.33.0
type TestSpecParams ¶ added in v1.34.0
type TestSpecParams struct { Compile CompileParams // Env sets environment variables for "go test". Env []string // Args sets extra arguments for "go test". Args []string }