build

package
v0.0.0-...-bed99a8 Latest Latest
Warning

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

Go to latest
Published: Feb 2, 2021 License: BSD-2-Clause Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultGOROOT = func() string {
	if goroot, ok := os.LookupEnv("GOPHERJS_GOROOT"); ok {

		return goroot
	}

	return build.Default.GOROOT
}()

DefaultGOROOT is the default GOROOT value for builds.

It uses the GOPHERJS_GOROOT environment variable if it is set, or else the default GOROOT value of the system Go distrubtion.

Functions

func NewBuildContext

func NewBuildContext(installSuffix string, buildTags []string) *build.Context

NewBuildContext creates a build context for building Go packages with GopherJS compiler.

Core GopherJS packages (i.e., "github.com/gopherjs/gopherjs/js", "github.com/gopherjs/gopherjs/nosync") are loaded from gopherjspkg.FS virtual filesystem rather than GOPATH.

func NewMappingCallback

func NewMappingCallback(m *sourcemap.Map, goroot, gopath string, localMap bool) func(generatedLine, generatedColumn int, originalPos token.Position)

Types

type ImportCError

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

func (*ImportCError) Error

func (e *ImportCError) Error() string

type Options

type Options struct {
	GOROOT         string
	GOPATH         string
	Verbose        bool
	Quiet          bool
	Watch          bool
	CreateMapFile  bool
	MapToLocalDisk bool
	Minify         bool
	Color          bool
	BuildTags      []string
}

func (*Options) PrintError

func (o *Options) PrintError(format string, a ...interface{})

func (*Options) PrintSuccess

func (o *Options) PrintSuccess(format string, a ...interface{})

type PackageData

type PackageData struct {
	*build.Package
	JSFiles    []string
	IsTest     bool // IsTest is true if the package is being built for running tests.
	SrcModTime time.Time
	UpToDate   bool
	IsVirtual  bool // If true, the package does not have a corresponding physical directory on disk.
}

func Import

func Import(path string, mode build.ImportMode, installSuffix string, buildTags []string) (*PackageData, error)

Import returns details about the Go package named by the import path. If the path is a local import path naming a package that can be imported using a standard import path, the returned package will set p.ImportPath to that path.

In the directory containing the package, .go and .inc.js files are considered part of the package except for:

  • .go files in package documentation
  • files starting with _ or . (likely editor temporary files)
  • files with build constraints not satisfied by the context

If an error occurs, Import returns a non-nil error and a nil *PackageData.

func ImportDir

func ImportDir(dir string, mode build.ImportMode, installSuffix string, buildTags []string) (*PackageData, error)

ImportDir is like Import but processes the Go package found in the named directory.

type Session

type Session struct {
	Archives map[string]*compiler.Archive
	Types    map[string]*types.Package
	Watcher  *fsnotify.Watcher
	// contains filtered or unexported fields
}

func NewSession

func NewSession(options *Options) (*Session, error)

func (*Session) BuildContext

func (s *Session) BuildContext() *build.Context

BuildContext returns the session's build context.

func (*Session) BuildDir

func (s *Session) BuildDir(packagePath string, importPath string, pkgObj string) error

func (*Session) BuildFiles

func (s *Session) BuildFiles(filenames []string, pkgObj string, packagePath string) error

func (*Session) BuildImportPath

func (s *Session) BuildImportPath(path string) (*compiler.Archive, error)

func (*Session) BuildPackage

func (s *Session) BuildPackage(pkg *PackageData) (*compiler.Archive, error)

func (*Session) InstallSuffix

func (s *Session) InstallSuffix() string

func (*Session) WaitForChange

func (s *Session) WaitForChange()

func (*Session) WriteCommandPackage

func (s *Session) WriteCommandPackage(archive *compiler.Archive, pkgObj string) error

Jump to

Keyboard shortcuts

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