build

package
v0.0.0-...-e289d49 Latest Latest
Warning

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

Go to latest
Published: Jan 16, 2024 License: GPL-3.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CompilerConfig

type CompilerConfig struct {
	Site    string `json:"site,omitempty" yaml:"site,omitempty"`       // The site hosting the repo
	User    string `json:"user,omitempty" yaml:"user,omitempty"`       // Name of the github user
	Repo    string `json:"repo,omitempty" yaml:"repo,omitempty"`       // Name of the github repository
	Version string `json:"version,omitempty" yaml:"version,omitempty"` // The version of the compiler to use
}

CompilerConfig represents a configuration for a compiler repository

type CompilerVersion

type CompilerVersion string

CompilerVersion represents a compiler version number

type Config

type Config struct {
	Name              string            `json:"name" yaml:"name"`                                 // name of the configuration
	Version           CompilerVersion   `json:"version,omitempty" yaml:"version,omitempty"`       // compiler version to use for this build
	WorkingDir        string            `json:"workingDir,omitempty" yaml:"workingDir,omitempty"` // working directory for the -D flag
	Args              []string          `json:"args,omitempty" yaml:"args,omitempty"`             // list of arguments to pass to the compiler
	Input             string            `json:"input,omitempty" yaml:"input,omitempty"`           // input .pwn file
	Output            string            `json:"output,omitempty" yaml:"output,omitempty"`         // output .amx file
	Includes          []string          `json:"includes,omitempty" yaml:"includes,omitempty"`     // list of include files to pass to compiler via -i flags
	Constants         map[string]string `json:"constants,omitempty" yaml:"constants,omitempty"`   // set of constant definitions to pass to the compiler
	Plugins           [][]string        `json:"plugins,omitempty" yaml:"plugins,omitempty"`       // set of commands to run before compilation
	Compiler          CompilerConfig    `json:"compiler,omitempty" yaml:"compiler,omitempty"`     // a set of configurations for using a compiler
	PreBuildCommands  [][]string        `json:"prebuild,omitempty" yaml:"prebuild,omitempty"`     // allows the execution of commands before a build is ran
	PostBuildCommands [][]string        `json:"postbuild,omitempty" yaml:"postbuild,omitempty"`   // allows the execution of commands after a build is ran
}

Config represents a configuration for compiling a file

func Default

func Default() *Config

Default defines and returns a default compiler configuration

type Problem

type Problem struct {
	File        string
	Line        int
	Severity    ProblemSeverity
	Description string
}

Problem represents an issue with a line in a file with a severity level, these have a full file path, a line number, a severity level (warnings, errors and fatal errors) and a short description of the problem.

func (Problem) String

func (bp Problem) String() string

String creates a structured representation of a problem, for editor integration

type ProblemSeverity

type ProblemSeverity int8

ProblemSeverity represents the severity of a problem, warning error or fatal

const (
	// ProblemWarning is an issue that does not stop compilation but is still a concern
	ProblemWarning ProblemSeverity = iota
	// ProblemError is an issue that prevents AMX generation and may or may not stop compilation
	ProblemError ProblemSeverity = iota
	// ProblemFatal is an issue that stops compilation completely
	ProblemFatal ProblemSeverity = iota
)

func (ProblemSeverity) String

func (ps ProblemSeverity) String() string

type Problems

type Problems []Problem

Problems is a slice of Problem objects with additional methods

func (Problems) Errors

func (bps Problems) Errors() (warnings []Problem)

Errors returns a slice of only errors from a Problems object

func (Problems) Fatal

func (bps Problems) Fatal() (fatal bool)

Fatal returns true if the build problems contain any fatal problems

func (Problems) IsValid

func (bps Problems) IsValid() bool

IsValid returns true if the Problems only contains warnings, if there are errors it's false

func (Problems) Warnings

func (bps Problems) Warnings() (warnings []Problem)

Warnings returns a slice of only warnings from a Problems object

type Result

type Result struct {
	Header    int
	Code      int
	Data      int
	StackHeap int
	Estimate  int
	Total     int
}

Result represents the final statistics (in bytes) of a successfully built .amx file.

Jump to

Keyboard shortcuts

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