compiler

package
v0.0.0-...-ae00d02 Latest Latest
Warning

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

Go to latest
Published: Oct 16, 2026 License: GPL-3.0 Imports: 34 Imported by: 0

Documentation

Overview

Package compiler provides an API for acquiring the compiler binaries and compiling Pawn code

Index

Constants

View Source
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 FromNet

func FromNet(ctx context.Context, request CompilerFetchRequest) (pkg download.Compiler, err error)

FromNet downloads and installs a compiler package.

func GetCompilerFilename

func GetCompilerFilename(version, platform, method string) string

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

func GetCompilerPackageInfo(cacheDir, platform string) (download.Compiler, error)

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

func PrepareCommand(ctx context.Context, request PrepareCommandRequest) (cmd *exec.Cmd, err error)

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

func RepairManagedCompilerPermissions(ctx context.Context, dir, binary string) (err error)

RepairManagedCompilerPermissions restores execute permission under the installation lock.

func RunPostBuildCommands

func RunPostBuildCommands(ctx context.Context, cfg build.Config, output io.Writer) (err error)

RunPostBuildCommands executes commands after a build is ran for a certain build config

func RunPreBuildCommands

func RunPreBuildCommands(ctx context.Context, cfg build.Config, output io.Writer) (err error)

RunPreBuildCommands executes commands before a build is ran for a certain build config

Types

type CompileRequest

type CompileRequest struct {
	GitHub   *github.Client
	ExecDir  string
	ErrorDir string
	CacheDir string
	Platform string
	Config   build.Config
	Relative bool
}

type CompilerFetchRequest

type CompilerFetchRequest struct {
	GitHub   *github.Client
	Meta     versioning.DependencyMeta
	Dir      string
	Platform string
	CacheDir string
}

type ExecutionError

type ExecutionError struct {
	Kind   string
	Path   string
	Output string
	Err    error
}

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.

type PrepareCommandRequest

type PrepareCommandRequest struct {
	GitHub   *github.Client
	ExecDir  string
	CacheDir string
	Platform string
	Config   build.Config
}

Jump to

Keyboard shortcuts

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