Easier to debug than "Failed to compile: main: exit status 2"
Bug: 68770962
Test: sed -i 's/build.FindSources/files := build.FindSources/' build/soong/cmd/soong_ui/main.go \
&& m -j nothing
Change-Id: If78a4fa1c3999e7c658dce072c05d7d3e23b8683
To prevent against multiple instances attempting to rebuild the same
executable, add a file lock to Build().
The trace file may not be consistent in this case, but everything that
reads it should be able to handle a corrupted trace file.
Test: `while true; do <microfactory-enabled executable>; done` in
parallel, and modify the code to microfactory (echo "//"
>>microfactory.go)
Change-Id: I30cb22bb9c790c57c507354127d4a5f82526a489
This is necessary to support other go code that uses build tags to
control which files build on which platforms. For example, the
github.com/golang/protobuf/proto package includes two implementations of
pointer:
pointer_reflect:
// ...
// +build appengine js
// This file contains an implementation of proto field accesses using package reflect.
// It is slower than the code in pointer_unsafe.go but it avoids package unsafe and can
// be used on App Engine.
pointer_unsafe.go:
// ...
// +build !appengine,!js
// This file contains the implementation of the proto field accesses using package unsafe.
Without this change, microfactory tries to include both files, which
breaks, since that enables multiple implementations of the same symbols.
This implements the logic to find the +build comments (following the
spirit of the functionality in go/build, even though they make different
choices of parsers), and the logic to match the tags to the current
system (which isn't exported as public API, so we have a simplified
version).
Since we're only parsing the comments before the import statement, this
does not significantly affect performance.
Test: Build github.com/golang/protobuf/proto
Change-Id: I10c48472d3f9f3e96b800a5d7c15450b1737002b
In addition to running with `go run` and creating a microfactory binary,
allow microfactory to be used as a package from other go tools as well.
To allow other packages to use this, it needs to be in a non-main
package, but `go run` requires a main package. So microfactory.bash runs
a sed script before running microfactory with `go run`.
This could also be solved by using a relative import, but neither
blueprint nor microfactory currently support that.
Change-Id: I084163b14720102b3fb93a3c9d44b5d0225ff2c8
This duplicates building common blueprint go packages between minibp and
the primary builder, but drastically simplifies the first stage,
removing the need to check in a generated build.ninja.in.
Change-Id: I639a9637f1ed36d4210823ef276c0f7a064a83bd
From commit 38cef8ac3979da8e13037540981fe7aecc1e1fbe
Removes Go 1.7 from travis, since this depends on os.Executable
Change-Id: I58e2ae542621ffad66e9e145031091cb93ebb497