microfactory

package
v0.0.0-...-e415610 Latest Latest
Warning

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

Go to latest
Published: May 8, 2018 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Overview

Microfactory is a tool to incrementally compile a go program. It's similar to `go install`, but doesn't require a GOPATH. A package->path mapping can be specified as command line options:

-pkg-path android/soong=build/soong
-pkg-path github.com/google/blueprint=build/blueprint

The paths can be relative to the current working directory, or an absolute path. Both packages and paths are compared with full directory names, so the android/soong-test package wouldn't be mapped in the above case.

Microfactory will ignore *_test.go files, and limits *_darwin.go and *_linux.go files to MacOS and Linux respectively. It does not support build tags or any other suffixes.

Builds are incremental by package. All input files are hashed, and if the hash of an input or dependency changes, the package is rebuilt.

It also exposes the -trimpath option from go's compiler so that embedded path names (such as in log.Llongfile) are relative paths instead of absolute paths.

If you don't have a previously built version of Microfactory, when used with -b <microfactory_bin_file>, Microfactory can rebuild itself as necessary. Combined with a shell script like microfactory.bash that uses `go run` to run Microfactory for the first time, go programs can be quickly bootstrapped entirely from source (and a standard go distribution).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Main

func Main()

Types

type Config

type Config struct {
	Race    bool
	Verbose bool

	TrimPath string

	TraceFunc func(name string) func()
	// contains filtered or unexported fields
}

func (*Config) Map

func (c *Config) Map(pkgPrefix, pathPrefix string) error

func (*Config) Path

func (c *Config) Path(pkg string) (string, bool, error)

Path takes a package name, applies the path mappings and returns the resulting path.

If the package isn't mapped, we'll return false to prevent compilation attempts.

type GoPackage

type GoPackage struct {
	Name string
	// contains filtered or unexported fields
}

func Build

func Build(config *Config, out, pkg string) (*GoPackage, error)

func (*GoPackage) Compile

func (p *GoPackage) Compile(config *Config, outDir string) error

func (*GoPackage) FindDeps

func (p *GoPackage) FindDeps(config *Config, path string) error

FindDeps searches all applicable go files in `path`, parses all of them for import dependencies that exist in pkgMap, then recursively does the same for all of those dependencies.

func (p *GoPackage) Link(config *Config, out string) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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