Documentation
¶
Overview ¶
Package gb is a tool kit for building Go packages and programs.
The executable, cmd/gb, is located in the respective subdirectory along with several plugin programs.
Index ¶
- Variables
- func Build(pkgs ...*Package) error
- func Debugf(format string, args ...interface{})
- func Errorf(format string, args ...interface{})
- func Fatalf(format string, args ...interface{})
- func Gc(pkg *Package, gofiles []string, deps ...Target) objpkgtarget
- func GcToolchain(opts ...func(*gcoption)) func(c *Context) error
- func Infof(format string, args ...interface{})
- func Ldflags(flags string) func(*Context) error
- func Warnf(format string, args ...interface{})
- type Context
- func (c *Context) AllPackages(pattern string) []string
- func (c *Context) Destroy() error
- func (c *Context) IncludePaths() []string
- func (c *Context) Pkgdir() string
- func (c *Context) ResolvePackage(path string) (*Package, error)
- func (c *Context) ResolvePackageWithTests(path string) (*Package, error)
- func (c *Context) Run(cmd *exec.Cmd, deps ...Target) Target
- func (c *Context) Workdir() string
- type ErrTarget
- type ObjTarget
- type Package
- type PkgTarget
- type Project
- type Statistics
- type Target
- type Toolchain
Constants ¶
This section is empty.
Variables ¶
var ( // Quiet suppresses all logging output below ERROR Quiet = false // Verbose enables logging output below INFO Verbose = false )
Functions ¶
func Build ¶
Build builds each of pkgs in succession. If pkg is a command, then the results of build include linking the final binary into pkg.Context.Bindir().
func Gc ¶
Gc returns a Target representing the result of compiling a set of gofiles with the Context specified gc Compiler.
func GcToolchain ¶
Types ¶
type Context ¶
type Context struct { *Project *build.Context Statistics Force bool // force rebuild of packages SkipInstall bool // do not cache compiled packages // contains filtered or unexported fields }
Context represents an execution of one or more Targets inside a Project.
func (*Context) AllPackages ¶
AllPackages returns all the packages that can be found under the $PROJECT/src directory. The pattern is a path including "...".
func (*Context) IncludePaths ¶
IncludePaths returns the include paths visible in this context.
func (*Context) ResolvePackage ¶
ResolvePackage resolves the package at path using the current context.
func (*Context) ResolvePackageWithTests ¶
ResolvePackageWithTests resolves the package at path using the current context it also resolves the internal and external test dependenices, although these are not returned, only cached in the Context.
type ObjTarget ¶
type ObjTarget interface { Target // Objfile is the name of the file that is produced if the target is successful. Objfile() string }
ObjTarget represents a compiled Go object (.5, .6, etc)
type Package ¶
type Package struct { *Context *build.Package Scope string // scope: build, test, etc ExtraIncludes string // hook for test Stale bool // is the package out of date wrt. its cached copy }
Package represents a resolved package from the Project with respect to the Context.
func NewPackage ¶
NewPackage creates a resolved Package.
func (*Package) Binfile ¶
Binfile returns the destination of the compiled target of this command. TODO(dfc) this should be Target.
func (*Package) Complete ¶
Complete indicates if this is a pure Go package TODO(dfc) this should be pure go with respect to tags and scope
type PkgTarget ¶
type PkgTarget interface { Target // Pkgfile returns the name of the file that is produced by the Target if successful. Pkgfile() string }
PkgTarget represents a Target that produces a pkg (.a) file.
type Project ¶
type Project struct {
// contains filtered or unexported fields
}
Project represents a gb project. A gb project has a simlar layout to a $GOPATH workspace. Each gb project has a standard directory layout starting at the project root, which we'll refer too as $PROJECT.
$PROJECT/ - the project root $PROJECT/.gogo/ - used internally by gogo and identifies the root of the project. $PROJECT/src/ - base directory for the source of packages $PROJECT/bin/ - base directory for the compiled binaries
func NewProject ¶
func (*Project) NewContext ¶
NewContext returns a new build context from this project. By default this context will use the gc toolchain with the host's GOOS and GOARCH values.
func (*Project) Projectdir ¶
Projectdir returns the path root of this project.
type Statistics ¶
Statistics records the various Durations
func (*Statistics) String ¶
func (s *Statistics) String() string
func (*Statistics) Total ¶
func (s *Statistics) Total() time.Duration
type Target ¶
type Target interface { // Result returns the result of the work as an error, or nil if the work // was performed successfully. // Implementers must observe these invariants // 1. There may be multiple concurrent callers to Result, or Result may // be called many times in sequence, it must always return the same // 2. Result blocks until the work has been performed. Result() error }
A Target is a placeholder for work which is completed asyncronusly.
func BuildDependencies ¶
BuildDependencies returns a []Target representing the results of compiling the dependencies of pkg.
type Toolchain ¶
type Toolchain interface { Gc(pkg *Package, searchpaths []string, importpath, srcdir, outfile string, files []string, complete bool) error Asm(pkg *Package, srcdir, ofile, sfile string) error Pack(pkg *Package, afiles ...string) error Ld(*Package, []string, []string, string, string) error Cc(pkg *Package, ofile string, cfile string) error // contains filtered or unexported methods }
Toolchain represents a standardised set of command line tools used to build and test Go programs.
Source Files
¶
Directories
¶
Path | Synopsis |
---|---|
Package command holds support functions and types for writing gb and gb plugins
|
Package command holds support functions and types for writing gb and gb plugins |
gb-list
gb-list lists the packages named by the import paths, one per line.
|
gb-list lists the packages named by the import paths, one per line. |