builder

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Dec 5, 2019 License: MIT, BSD-2-Clause Imports: 28 Imported by: 1

README

Builder

This is a fork of guthub.com/gopherjs/gopherjs/build @ 178c176a91fe05e3e6c58fa5c989bad19e6cdcb3.

Done: 296de816d4fe28b61803072c3f89360e9d1823ff build: Add "purego" build tag to default context. 8fc1f3cabe719f570ed9a95ca3574aca26408855 build: Exclude linux-specific crypto/rand tests. f681903bc8cc21f8940c141d2beb8660511bed5a build: Make fewer copies of NewBuildContext. c121b3d6abdf0d7534656ac098f9ae8c3c204abe build: Load js, nosync packages from gopherjspkg rather than GOPATH. b90dbcb0f8851c1daa21542996b5f23d9779f720 build, compiler/typesutil: Don't use vendor directory to resolve js, nosync. b24e3563d0efa33b32250411d469ba59fa5cf254 Restore support for testing js package.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Bytes

func Bytes(in string) []byte

func GetPackageCode

func GetPackageCode(ctx context.Context, archive *compiler.Archive, minify, initializer bool) (contents []byte, hash []byte, err error)

func UnvendorPath

func UnvendorPath(path string) string

func WithCancel

func WithCancel(ctx context.Context, f func()) bool

WithCancel executes the provided function, but returns early with true if the context cancellation signal was recieved.

Types

type Builder

type Builder struct {
	Archives map[string]*compiler.Archive
	Types    map[string]*types.Package
	Callback func(*compiler.Archive) error
	// contains filtered or unexported fields
}

func New

func New(sess *session.Session, options *Options) *Builder

func (*Builder) BuildDir

func (b *Builder) BuildDir(ctx context.Context, packagePath string, importPath string, pkgObj string) (*CommandOutput, error)

func (*Builder) BuildFiles

func (b *Builder) BuildFiles(ctx context.Context, filenames []string, pkgObj string, packagePath string) (*CommandOutput, error)

func (*Builder) BuildImportPath

func (b *Builder) BuildImportPath(ctx context.Context, path string) (*PackageData, *compiler.Archive, error)

func (*Builder) BuildPackage

func (b *Builder) BuildPackage(ctx context.Context, pkg *PackageData) (*compiler.Archive, error)

func (*Builder) GetDependencies

func (b *Builder) GetDependencies(ctx context.Context, archive *compiler.Archive) ([]*compiler.Archive, error)

func (*Builder) GetProgramCode

func (b *Builder) GetProgramCode(ctx context.Context, pkgs []*compiler.Archive) (string, []*PackageOutput, error)

func (*Builder) Import

func (b *Builder) Import(ctx context.Context, path string, mode build.ImportMode, installSuffix 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 (*Builder) ImportDir

func (b *Builder) ImportDir(ctx context.Context, dir string, mode build.ImportMode, installSuffix string) (*PackageData, error)

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

func (*Builder) ImportStandardArchive

func (b *Builder) ImportStandardArchive(ctx context.Context, importPath string) (*compiler.Archive, error)

func (*Builder) InstallSuffix

func (b *Builder) InstallSuffix() string

func (*Builder) WriteCommandPackage

func (b *Builder) WriteCommandPackage(ctx context.Context, archive *compiler.Archive) (*CommandOutput, error)

type CommandOutput

type CommandOutput struct {
	Path     string
	Packages []*PackageOutput
}

type ImportCError

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

func (*ImportCError) Error

func (e *ImportCError) Error() string

type Options

type Options struct {
	Temporary      billy.Filesystem // Filesystem for temporary Archive storage (optional)
	Unvendor       bool             // Render JS with unvendored paths
	Initializer    bool             // Render JS with deferred initialization
	Send           func(services.Message)
	Log            io.Writer
	Verbose        bool
	Quiet          bool
	CreateMapFile  bool
	MapToLocalDisk bool
	Minify         bool
	Color          bool
	Standard       map[string]map[bool]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.
}

type PackageOutput

type PackageOutput struct {
	Path     string
	Hash     []byte
	Contents []byte
	Standard bool
	Store    bool
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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