Commit graph

18 commits

Author SHA1 Message Date
Haamed Gheibi
c10b49b5e9 Use relative GOPATH for microfactory golang builds.
Bug: b/336890676
Change-Id: I15ff839986d6c4997d5abccaa2ae8a9703d6cfb6
2024-04-25 04:44:01 +00:00
Sam Delmerico
26e44b7b78 apply gofmt
Change-Id: I2416e246b3d8485a6b7810b998cff2f45f6a0494
2023-02-21 15:11:20 -05:00
Usta Shrestha
d5b704c089 move microfactory main.main() to microfactory.bash
package renaming and addition of func main() both done in the same place for clarity

Test: m nothing
Bug: N/A
Change-Id: Icc7d18033fe6049001007fb35271335f19395b8a
2022-08-09 13:04:33 -04:00
Lukacs T. Berki
122b3ee153 Make debugging easier:
- Add the -N -l command line arguments to Microfactory
- Pass the the Delve arguments to the primary builder on the command line

Test: Manual.

Change-Id: I4034f2d48b3e40d9863529053715183dc3dce1f5
2021-03-03 09:15:04 +01:00
Dan Willemsen
db29636ba2 Disable parallel compilation when using race detector
These options aren't compatible with one another.

Change-Id: I1ec52b8fa8465edd551bcd1c20a9a902a5669e52
2018-04-30 14:44:22 -07:00
Colin Cross
c1d878159c Fix format issues found by go vet
Test: m checkbuild
Change-Id: I5135e0daecd20abce9a66631f5f55230168613de
2018-02-23 14:05:03 -08:00
Jeff
6b60fcefa3
Merge pull request #182 from mathjeff/microfactory-cmd-err
Update microfactory compile error message to show the command that fa…
2017-12-05 16:37:10 -08:00
Dan Willemsen
c09771a5e9
Merge pull request #169 from danw/buildtags
Make microfactory support go build tags
2017-11-03 14:34:49 -07:00
Jeff Gaston
4334d39a22 Update microfactory compile error message to show the command that failed
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
2017-11-02 13:56:32 -07:00
Dan Willemsen
987ed9ba29 Add file locking to microfactory
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
2017-10-18 15:11:03 -07:00
Dan Willemsen
64c10381ad Make microfactory support go build tags
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
2017-08-23 16:34:16 -07:00
Dan Willemsen
269248ff2d Support custom trace functions
Change-Id: I43207fd55f79d4adb783ad39eb5ee1b641ecce68
2017-08-08 13:50:44 -07:00
Dan Willemsen
5136c43117 Implement microfactory Config, Build
To make it easier to use as a package.

Change-Id: Idcb4856f34b91943a320e8281ef9e29af0faab98
2017-08-08 13:49:07 -07:00
Dan Willemsen
ff092863b3 Allow microfactory to be used as a package
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
2017-08-08 13:19:26 -07:00
Dan Willemsen
f00c03da53 Stop passing path to microfactory source
It can be discovered via the existing pkg-path mappings.

Change-Id: I0b6ad7a9cccec195d602508104d6cf1e80936299
2017-08-08 13:05:02 -07:00
Dan Willemsen
c54c072667 Support parallel Go compiles with Go 1.9
Change-Id: I80f3ad6e563fef1b4f22e936016675262f7ce8bf
2017-07-25 11:08:20 -07:00
Dan Willemsen
1e72321e58 Use microfactory to build the bootstrap minibp
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
2017-07-24 14:02:51 -07:00
Dan Willemsen
7dafbbcf6a Add microfactory directly from Soong
From commit 38cef8ac3979da8e13037540981fe7aecc1e1fbe

Removes Go 1.7 from travis, since this depends on os.Executable

Change-Id: I58e2ae542621ffad66e9e145031091cb93ebb497
2017-07-24 14:02:15 -07:00