build

package
v0.0.0-...-43216c9 Latest Latest
Warning

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

Go to latest
Published: Jul 16, 2013 License: BSD-2-Clause Imports: 12 Imported by: 1

Documentation

Overview

Package gogo/build provides functions for building Go packages.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Context

type Context struct {
	project.Resolver

	project.Statistics

	Toolchain
	SearchPaths []string
	// contains filtered or unexported fields
}

func NewContext

func NewContext(p *project.Project, toolchain, goroot, goos, goarch string) (*Context, error)

NewContext returns a Context that can be used to build *Project using the specified goroot, goos, and goarch.

func NewDefaultContext

func NewDefaultContext(p *project.Project) (*Context, error)

NewDefaultContext returns a Context that represents the version of Go that compiled gogo.

func (*Context) Bindir

func (ctx *Context) Bindir() string

Bindir returns the path when final binary executables will be stored.

func (*Context) Destroy

func (ctx *Context) Destroy() error

Destroy removes any temporary files associated with this Context.

func (*Context) Mkdir

func (c *Context) Mkdir(path string) error

Mkdir creates a directory named path, along with any necessary parents, and returns nil, or else returns an error. If path is already a directory, MkdirAll does nothing and returns nil.

func (*Context) Pkgdir

func (ctx *Context) Pkgdir() string

Pkgdir returns the path to the temporary location where intermediary packages are created during build and test phases.

func (*Context) Workdir

func (ctx *Context) Workdir() string

Workdir returns the path to the temporary working directory for this context. The contents of Workdir are removed when the Destroy method is invoked.

type Future

type Future 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 Future represents the result of a build operation.

func Build

func Build(ctx *Context, pkg *build.Package) Future

Build returns a Future representing the result of compiling the package pkg and its dependencies. If pkg is a command, then the results of build include linking the final binary into pkg.Context.Bindir().

func Cgo

func Cgo(ctx *Context, pkg *build.Package, deps []Future, args []string) Future

Cgo returns a Future representing the result of running the cgo command.

func Gcc

func Gcc(ctx *Context, pkg *build.Package, deps []Future, args []string) Future

Gcc returns a Future representing the result of invoking the system gcc compiler.

func Ld

func Ld(ctx *Context, pkg *build.Package, afile PkgFuture) Future

Ld returns a Future representing the result of linking a Package into a command with the Context provided linker.

type ObjFuture

type ObjFuture interface {
	Future

	// Objfile returns the name of the file that is
	// produced by the Target if successful.
	Objfile() string
}

ObjFuture represents a Future that produces an Object file.

func Asm

func Asm(ctx *Context, pkg *build.Package, sfile string) ObjFuture

Asm returns a Future representing the result of assembling sfile with the Context specified asssembler.

func Cc

func Cc(ctx *Context, pkg *build.Package, dep Future, cfile string) ObjFuture

Cc returns a Future representing the result of compiling a .c source file with the Context specified cc compiler.

func Gc

func Gc(ctx *Context, pkg *build.Package, deps []Future, gofiles []string) ObjFuture

Gc returns a Future representing the result of compiling a set of gofiles with the Context specified gc Compiler.

type PkgFuture

type PkgFuture interface {
	Future
	// contains filtered or unexported methods
}

PkgFuture represents a Future that produces a pkg (.a) file.

func Compile

func Compile(ctx *Context, pkg *build.Package, deps []Future) PkgFuture

Compile returns a Future representing all the steps required to build a go package.

func Pack

func Pack(ctx *Context, pkg *build.Package, deps []ObjFuture) PkgFuture

Pack returns a Future representing the result of packing a set of Context specific object files into an archive.

type Toolchain

type Toolchain interface {
	Gc(importpath, srcdir, outfile string, files []string) error
	Asm(srcdir, ofile, sfile string) error
	Pack(string, ...string) error
	Ld(string, string) error
	Cc(srcdir, objdir, ofile, cfile string) error

	Cgo(string, []string) error
	Gcc(string, []string) error
	Libgcc() (string, error)
	// contains filtered or unexported methods
}

Toolchain represents a standardised set of command line tools used to build and test Go programs.

Jump to

Keyboard shortcuts

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