Ran
|
Files
354
|
Run time
12s
|
Badge
Embed ▾
README BADGES
|
push
travis-ci
Initial support for Go BUILD gen. This adds support for both dynamically discovering and injecting Go targets into the in-memory BuildGraph as well as adding support for materializing BUILD files for those targets to disk. The target creation scope can optionally include direct remote dependencies, but otherwise defaults to only handling local source targets. Additionally, a simple templating system is provided to allow for BUILD materialization that suits the local BUILD style. To support some of the BUILD gen calculations and keep path calculation code DRY, utilities are moved into the go target hierarchy. Auto re-gen Go BUILD files in the repo with: `./pants buildgen.go --remote --materialize ::` Also used this task to generate Go BUILD graphs in the Medium mono repo by just seeding go_binary targets for their main packages' dirs with: `echo "go_binary(name='[parent dir]')" > BUILD` and then running `buildgen.go`, finally pinning revs in the BUILD files generated to their `3rdparty/golang` `go_remote_library` source root. Testing Done: New tests for GoBuildgen: ```console $ ./pants test.pytest --coverage=modules:pants.contrib.go.tasks.go_buildgen contrib/go/tests/python/pants_test/contrib/go/tasks/:go_buildgen ... contrib/go/tests/python/pants_test/contrib/go/tasks/test_go_buildgen.py ................ =========== 16 passed in 1.97 seconds ============ Name Stmts Miss Branch BrMiss Cover -------------------------------------------------------------------------------------------- contrib/go/src/python/pants/contrib/go/tasks/go_buildgen 192 4 72 8 95% ``` An example of the buildgen.go output with emphasis on contrib/go/examples/3rdparty and a note that the FLOATING lines are warn/yellow: ```console $ ./pants buildgen.go --remote --materialize :: ... 9:32:29 00:00 [main] (To run a reporting server: ./pants server) 19:32:29 00:00 [bootstrap] 19:32:29 00:00 [setup] 19:32:29 00:00 [parse] Executing tasks in goals: buildgen 19:32:30 00:01 [buildgen] 19:32:30 00:01 [go] Auto generated the following Go BUILD files: BUILD file (import paths) contrib/go/examples/src/go/libA/BUILD (libA) contrib/go/examples/src/go/libC/BUILD (libC) contrib/go/examples/src/go/libB/BUILD (libB) contrib/go/examples/src/go/libE/BUILD (libE) contrib/go/examples/src/go/libD/BUILD (libD) contrib/go/examples/3rdparty/go/github.com/gorilla/context/BUILD (github.com/gorilla/context) FLOATING contrib/go/examples/3rdparty/go/github.com/AdRoll/goamz/BUILD (github.com/AdRoll/goamz/dynamodb) 51b70b003 contrib/go/examples/src/go/hello/BUILD (hello) contrib/go/examples/src/go/server/BUILD (server) contrib/go/examples/3rdparty/go/github.com/bitly/go-simplejson/BUILD (github.com/bitly/go-simplejson) v0.4.3 contrib/go/examples/3rdparty/go/github.com/gorilla/mux/BUILD (github.com/gorilla/mux) FLOATING contrib/go/examples/3rdparty/go/github.com/cbroglie/mapstructure/BUILD (github.com/cbroglie/mapstructure) 25325b46b 19:32:30 00:01 [complete] SUCCESS ``` CI went green here: https://travis-ci.org/pantsbuild/pants/builds/76587511 Bugs closed: 2016, 2039 Reviewed at https://rbcommons.com/s/twitter/r/2676/
14994 of 21534 relevant lines covered (69.63%)
0.7 hits per line
Coverage | ∆ | File | Lines | Relevant | Covered | Missed | Hits/Line |
---|