Documentation
¶
Overview ¶
Package compiler provides an API for acquiring the compiler binaries and compiling Pawn code
Index ¶
- Constants
- func CompileSource(ctx context.Context, request CompileRequest) (problems build.Problems, result build.Result, err error)
- func CompileWithCommand(cmd *exec.Cmd, workingDir, errorDir string, relative bool) (problems build.Problems, result build.Result, err error)
- func CompileWithCommandContext(ctx context.Context, cmd *exec.Cmd, workingDir, errorDir string, relative bool) (problems build.Problems, result build.Result, err error)
- func FromCache(request CompilerFetchRequest) (download.Compiler, bool, error)
- func FromCacheContext(ctx context.Context, request CompilerFetchRequest) (pkg download.Compiler, hit bool, err error)
- func FromNet(ctx context.Context, request CompilerFetchRequest) (pkg download.Compiler, err error)
- func GetCompilerFilename(version, platform, method string) string
- func GetCompilerPackage(ctx context.Context, request CompilerFetchRequest) (pkg download.Compiler, err error)
- func GetCompilerPackageInfo(cacheDir, platform string) (download.Compiler, error)
- func GetCompilerPackageInfoContext(ctx context.Context, cacheDir, platform string) (download.Compiler, error)
- func PrepareCommand(ctx context.Context, request PrepareCommandRequest) (cmd *exec.Cmd, err error)
- func RepairManagedCompiler(ctx context.Context, request CompilerFetchRequest) (err error)
- func RepairManagedCompilerPermissions(ctx context.Context, dir, binary string) (err error)
- func RunPostBuildCommands(ctx context.Context, cfg build.Config, output io.Writer) (err error)
- func RunPreBuildCommands(ctx context.Context, cfg build.Config, output io.Writer) (err error)
- type CompileRequest
- type CompilerFetchRequest
- type ExecutionError
- type InstallationError
- type ManagedCompilerStatus
- type PrepareCommandRequest
Constants ¶
const ( ExecutionMissing = "missing" ExecutionStart = "start" ExecutionCrash = "crash" ExecutionCancelled = "cancelled" ExecutionOutput = "output" )
Variables ¶
This section is empty.
Functions ¶
func CompileSource ¶
func CompileSource( ctx context.Context, request CompileRequest, ) ( problems build.Problems, result build.Result, err error, )
CompileSource compiles a given input script to the specified output path using compiler version
func CompileWithCommand ¶
func CompileWithCommand( cmd *exec.Cmd, workingDir, errorDir string, relative bool, ) (problems build.Problems, result build.Result, err error)
CompileWithCommand takes a prepared command and executes it
func CompileWithCommandContext ¶
func CompileWithCommandContext( ctx context.Context, cmd *exec.Cmd, workingDir, errorDir string, relative bool, ) (problems build.Problems, result build.Result, err error)
CompileWithCommandContext runs a compiler while protecting its managed installation.
func FromCache ¶
func FromCache(request CompilerFetchRequest) (download.Compiler, bool, error)
FromCache installs a compiler from an existing cached archive.
func FromCacheContext ¶
func FromCacheContext(ctx context.Context, request CompilerFetchRequest) (pkg download.Compiler, hit bool, err error)
FromCacheContext installs a compiler from an existing cached archive.
func GetCompilerFilename ¶
GetCompilerFilename returns the archive filename for a compiler version.
func GetCompilerPackage ¶
func GetCompilerPackage(ctx context.Context, request CompilerFetchRequest) (pkg download.Compiler, err error)
GetCompilerPackage installs a complete compiler, reusing verified cached files.
func GetCompilerPackageInfo ¶
GetCompilerPackageInfo returns compiler distribution metadata for a platform.
func GetCompilerPackageInfoContext ¶
func GetCompilerPackageInfoContext(ctx context.Context, cacheDir, platform string) (download.Compiler, error)
GetCompilerPackageInfoContext returns compiler distribution metadata for a platform.
func PrepareCommand ¶
PrepareCommand prepares a build command for compiling the given input script
func RepairManagedCompiler ¶
func RepairManagedCompiler(ctx context.Context, request CompilerFetchRequest) (err error)
RepairManagedCompiler recovers an interruption or reinstalls from a verified cached archive. It never downloads a compiler or changes the selected version.
func RepairManagedCompilerPermissions ¶
RepairManagedCompilerPermissions restores execute permission under the installation lock.
func RunPostBuildCommands ¶
RunPostBuildCommands executes commands after a build is ran for a certain build config
Types ¶
type CompileRequest ¶
type CompilerFetchRequest ¶
type CompilerFetchRequest struct {
GitHub *github.Client
Meta versioning.DependencyMeta
Dir string
Platform string
CacheDir string
}
type ExecutionError ¶
ExecutionError identifies a compiler process or output failure. Pawn source errors remain in the returned build problems.
func (*ExecutionError) Error ¶
func (e *ExecutionError) Error() string
func (*ExecutionError) Unwrap ¶
func (e *ExecutionError) Unwrap() error
type InstallationError ¶
type InstallationError struct {
Path string
Restored bool
Committed bool
RecoveryPending bool
Err error
}
InstallationError reports an invalid or interrupted managed compiler installation.
func (*InstallationError) Error ¶
func (e *InstallationError) Error() string
func (*InstallationError) Unwrap ¶
func (e *InstallationError) Unwrap() error
type ManagedCompilerStatus ¶
type ManagedCompilerStatus struct {
Path string
Pending bool
Active bool
Committed bool
Valid bool
Legacy bool
CanRepair bool
HasCompletion bool
PermissionsOnly bool
}
ManagedCompilerStatus describes a managed installation without changing files.
func InspectManagedCompiler ¶
func InspectManagedCompiler(ctx context.Context, request CompilerFetchRequest) (status ManagedCompilerStatus, err error)
InspectManagedCompiler checks existing files and recovery metadata without downloading.