google / shipshape

Program analysis platform
Apache License 2.0
271 stars 35 forks source link

Shipshape doesn't build with Bazel 0.1.0 #79

Closed clconway closed 9 years ago

clconway commented 9 years ago

Synced to commit dcafb8b35 from origin/master and using the 0.1.0 release of Bazel, I get errors like:

$ bazel build //...
........
____Loading package: third_party/openjdk
ERROR: $HOME/git/shipshape/third_party/go-glog/BUILD:19:6: syntax error at '"//tools/build_rules/go"': First argument of load() is a path, not a label. It should start with a single slash if it is an absolute path..
ERROR: $HOME/git/shipshape/third_party/go-glog/BUILD:19:6: file '/tools/build_rules/go.bzl' was not correctly loaded. Make sure the 'load' statement appears in the global scope, in the BUILD file.
ERROR: $HOME/git/shipshape/third_party/go-glog/BUILD:21:1: name 'go_library' is not defined.
ERROR: package contains errors: third_party/go-glog.
ERROR: error loading package 'third_party/go-glog': Package 'third_party/go-glog' contains errors.
____Elapsed time: 0.740s

It looks like this check was recently added to Bazel: https://github.com/bazelbuild/bazel/commit/45deb33b92aa92f46e494a7cd4379b7040468883

I tried converting the load statements thusly:

find . -name BUILD -print0 | xargs -0 sed -i 's/"\/\/tools\/build_rules\//"\/tools\/build_rules\//'

but that leads to a whole different kind of error:

$ bazel build //...
____Loading package: tools
____Loading package: shipshape/util/httpencoding
____Loading package: shipshape/test/dind/docker
____Loading package: shipshape/java/com/google/shipshape/util/rpc
____Loading package: shipshape/jenkins_plugin/src/main/java/com/google/shipshape/jenkins
____Loading package: third_party
ERROR: $HOME/.bazel/base_workspace/third_party/BUILD:183:12: Label '//third_party:gson/gson-2.2.4.jar' crosses boundary of subpackage 'third_party/gson' (have you deleted third_party/gson/BUILD? If so, use the --deleted_packages=third_party/gson option).
ERROR: $HOME/.bazel/base_workspace/third_party/BUILD:231:12: Label '//third_party:guava/guava-18.0.jar' crosses boundary of subpackage 'third_party/guava' (have you deleted third_party/guava/BUILD? If so, use the --deleted_packages=third_party/guava option).
ERROR: $HOME/.bazel/base_workspace/third_party/BUILD:313:12: Label '//third_party:guava/guava-testlib.jar' crosses boundary of subpackage 'third_party/guava' (have you deleted third_party/guava/BUILD? If so, use the --deleted_packages=third_party/guava option).
ERROR: package contains errors: third_party.
ERROR: error loading package 'third_party': Package 'third_party' contains errors.
clconway commented 9 years ago

I get the same errors when I run the version built with ./download_bazel.sh (from Bazel commit https://github.com/bazelbuild/bazel/commit/14cd308832a681af9a6755cd01ca145c58a318f6)

clconway commented 9 years ago

I started a thread on bazel-discuss: https://groups.google.com/d/msgid/bazel-discuss/CAJ5fxHLz7WQ-ZzmVT4Km-mujcChn7YW%2BBXBu889NjqQU%2BqOKZQ%40mail.gmail.com.

clconway commented 9 years ago

I've confirmed that the build goes through fine if you start with a fresh checkout, then

$ ./download_bazel.sh
$ ./setup_bazel.sh
$ bazel build //...

I've also confirmed that Kythe fails in more-or-less the same way with Bazel 0.1.0.

clconway commented 9 years ago

A breadcrumb: bazel --bazelrc=/dev/null seems to help (a little). The crux of the problem is that Bazel is trying to load tools from ~/.bazel/base_workspace instead of from the repo's bazel directory.

clconway commented 9 years ago

This branch fixes the issues with v0.1.0 by copying over needed tools and configs: https://github.com/google/shipshape/tree/fix-build-breakages It works with any recent Bazel built from source, and with the v0.1.0 binary distribution (but only with --bazelrc=/dev/null, for some reason).

I'm not sure this is the right approach, as it involves brittle config duplication and checking in binary blobs.