platform_build_blueprint/microfactory
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
..
main Allow microfactory to be used as a package 2017-08-08 13:19:26 -07:00
microfactory.bash Allow microfactory to be used as a package 2017-08-08 13:19:26 -07:00
microfactory.go Make microfactory support go build tags 2017-08-23 16:34:16 -07:00
microfactory_test.go Implement microfactory Config, Build 2017-08-08 13:49:07 -07:00