formula

package
v0.0.0-...-46d3403 Latest Latest
Warning

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

Go to latest
Published: Nov 2, 2026 License: Apache-2.0 Imports: 7 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	XGoPackage = true
)

Variables

This section is empty.

Functions

func XGot_ModuleF_Main

func XGot_ModuleF_Main(this interface {
	app() *gsh.App
	MainEntry()
})

XGot_ModuleF_Main is main entry of this classfile.

Types

type BuildResult

type BuildResult struct {
	// contains filtered or unexported fields
}

BuildResult represents the result of building a project.

func (*BuildResult) Metadata

func (b *BuildResult) Metadata() string

Metadata returns the build output metadata.

func (*BuildResult) SetMetadata

func (b *BuildResult) SetMetadata(metadata string)

SetMetadata sets the build output metadata.

type Context

type Context struct {
	Proj      *Project
	SourceDir string
	Out       BuildResult
	Errs      errors.List
	// contains filtered or unexported fields
}

Context represents the build context.

func NewContext

func NewContext(proj *Project, sourceDir, installDir, matrixStr string, getOutputDir func(string, module.Version) (string, error)) *Context

func (*Context) AddBuildResult

func (c *Context) AddBuildResult(mod module.Version, result BuildResult)

AddBuildResult stores the build result for the given module.

func (*Context) BuildResult

func (c *Context) BuildResult(mod module.Version) (BuildResult, bool)

BuildResult returns the stored build result for the module, if any.

func (*Context) OutputDir__0

func (c *Context) OutputDir__0() string

OutputDir__0 returns the current module's output (install) directory. In DSL: ctx.outputDir()

func (*Context) OutputDir__1

func (c *Context) OutputDir__1(mod module.Version) string

OutputDir__1 returns the output (install) directory for the given dependency. In DSL: ctx.outputDir(dep)

func (*Context) SetMetadata

func (c *Context) SetMetadata(metadata string)

SetMetadata sets the build output metadata.

type Matrix

type Matrix struct {
	Require        map[string][]string
	Options        map[string][]string
	DefaultOptions map[string][]string
}

func (*Matrix) CombinationCount

func (m *Matrix) CombinationCount() int

CombinationCount returns the total number of cartesian product combinations.

func (*Matrix) Combinations

func (m *Matrix) Combinations() []string

Combinations returns all cartesian product combinations of the matrix. Keys are sorted alphabetically, and combinations are built layer by layer. Require fields are joined with "-", then combined with options using "|".

type ModuleDeps

type ModuleDeps struct {
	// contains filtered or unexported fields
}

ModuleDeps represents the dependencies of a module.

func (*ModuleDeps) Deps

func (p *ModuleDeps) Deps() []module.Version

Deps returns the collected module dependencies.

func (*ModuleDeps) Require

func (p *ModuleDeps) Require(path, ver string)

Require declares that the module being built depends on the specified module (by its path and version).

type ModuleF

type ModuleF struct {
	gsh.App
	// contains filtered or unexported fields
}

ModuleF represents the build formula of a module.

func (*ModuleF) Defaults

func (p *ModuleF) Defaults(options map[string]string)

Defaults sets the formula's default option selections and initializes the active options exposed through target.options.

func (*ModuleF) Filter

func (p *ModuleF) Filter(f func() bool)

Filter records a predicate used to reject unsupported matrix selections.

func (*ModuleF) FromVer

func (p *ModuleF) FromVer(ver string)

FromVer sets the minimum version of the module that this formula serves.

func (*ModuleF) Id

func (p *ModuleF) Id(path string)

Id sets the module path that this formula serves. path should be in the form of "owner/repo".

func (*ModuleF) OnBuild

func (p *ModuleF) OnBuild(f func(ctx *Context))

OnBuild event is used to instruct the Formula to compile a project.

func (*ModuleF) OnRequire

func (p *ModuleF) OnRequire(f func(proj *Project, deps *ModuleDeps))

OnRequire event is used to retrieve all direct dependencies of a project (module). proj is the project being built, deps is used to declare dependencies.

func (*ModuleF) OnTest

func (p *ModuleF) OnTest(f func(ctx *Context))

OnTest event is used to run post-build verification for a project. It fires after OnBuild has completed successfully, reusing the same build context so tests can locate built artifacts via ctx.OutputDir.

func (*ModuleF) Target

func (p *ModuleF) Target() matrixTarget

type Project

type Project struct {
	Deps     []module.Version
	SourceFS fs.ReadFileFS
}

Project represents a project (module) being built.

func (*Project) ReadFile

func (p *Project) ReadFile(path string) ([]byte, error)

ReadFile reads the content of a file in the project.

Jump to

Keyboard shortcuts

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