Skip to content

Fix example for later bazel #14

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

snapsam
Copy link

@snapsam snapsam commented May 20, 2019

Background
Cloning and attempting to use this example repo breaks:

ERROR: /Users/snapsam/code/proto_library/WORKSPACE:4:1: name 'http_archive' is not defined
ERROR: /Users/snapsam/code/proto_library/WORKSPACE:13:1: name 'http_archive' is not defined
ERROR: Error evaluating WORKSPACE file
ERROR: error loading package '': Encountered error while reading extension file 'tools/build_defs/repo/http.bzl': no such package '@bazel_tools//tools/build_defs/repo': error loading package 'external': Could not load //external package
ERROR: error loading package '': Encountered error while reading extension file 'tools/build_defs/repo/http.bzl': no such package '@bazel_tools//tools/build_defs/repo': error loading package 'external': Could not load //external package
INFO: Elapsed time: 0.296s
INFO: 0 processes.
FAILED: Build did NOT complete successfully (0 packages loaded)

Fixing http_archive gives the next error:

ERROR: /private/var/tmp/_bazel_snapsam/c0003f367b02e98a87175911e30b666a/external/com_google_protobuf/BUILD:597:1: Traceback (most recent call last):
        File "/private/var/tmp/_bazel_snapsam/c0003f367b02e98a87175911e30b666a/external/com_google_protobuf/BUILD", line 597
                internal_gen_well_known_protos_java(srcs = WELL_KNOWN_PROTOS)
        File "/private/var/tmp/_bazel_snapsam/c0003f367b02e98a87175911e30b666a/external/com_google_protobuf/protobuf.bzl", line 266, in internal_gen_well_known_protos_java
                Label(("%s//protobuf_java" % REPOSITOR...))
        File "/private/var/tmp/_bazel_snapsam/c0003f367b02e98a87175911e30b666a/external/com_google_protobuf/protobuf.bzl", line 266, in Label
                REPOSITORY_NAME
The value 'REPOSITORY_NAME' has been removed in favor of 'repository_name()', please use the latter (https://docs.bazel.build/versions/master/skylark/lib/native.html#repository_name).
INFO: An error occurred during the fetch of repository 'com_google_protobuf_javalite'
INFO: Call stack for the definition of repository 'com_google_protobuf_javalite':
 - /Users/snapsam/code/proto_library/WORKSPACE:15:1
ERROR: /Users/snapsam/code/proto_library/src/BUILD:52:1: every rule of type proto_library implicitly depends upon the target '@com_google_protobuf//:protoc', but this target could not be found because of: Target '@com_go
ogle_protobuf//:protoc' contains an error and its package is in error
ERROR: /Users/snapsam/code/proto_library/src/BUILD:46:1: every rule of type proto_library implicitly depends upon the target '@com_google_protobuf//:protoc', but this target could not be found because of: Target '@com_go
ogle_protobuf//:protoc' contains an error and its package is in error
ERROR: /Users/snapsam/code/proto_library/src/BUILD:32:1: Target '@com_google_protobuf//:any_proto' contains an error and its package is in error and referenced by '//src:person_proto'
ERROR: /Users/snapsam/code/proto_library/src/BUILD:32:1: every rule of type proto_library implicitly depends upon the target '@com_google_protobuf//:protoc', but this target could not be found because of: Target '@com_go
ogle_protobuf//:protoc' contains an error and its package is in error
ERROR: Analysis of target '//src:zip_code_proto' failed; build aborted: Analysis failed
INFO: Elapsed time: 2.218s
INFO: 0 processes.
FAILED: Build did NOT complete successfully (6 packages loaded, 34 targets configured)

Both of these are due to incompatibility with recent versions of bazel. The
former is a problem in this repository's WORKSPACE, where as the latter is a
problem in the dependency

Change

  • Provide a drop-in replacement for http_archive
  • Upgrade proto dependencies to working version see

Test Plan

  • Compiles locally with Bazel 0.25.2

**Background**
Cloning and attempting to use this example repo breaks:
```
ERROR: /Users/snapsam/code/proto_library/WORKSPACE:4:1: name 'http_archive' is not defined
ERROR: /Users/snapsam/code/proto_library/WORKSPACE:13:1: name 'http_archive' is not defined
ERROR: Error evaluating WORKSPACE file
ERROR: error loading package '': Encountered error while reading extension file 'tools/build_defs/repo/http.bzl': no such package '@bazel_tools//tools/build_defs/repo': error loading package 'external': Could not load //external package
ERROR: error loading package '': Encountered error while reading extension file 'tools/build_defs/repo/http.bzl': no such package '@bazel_tools//tools/build_defs/repo': error loading package 'external': Could not load //external package
INFO: Elapsed time: 0.296s
INFO: 0 processes.
FAILED: Build did NOT complete successfully (0 packages loaded)
```

Fixing http_archive gives the next error:

```
ERROR: /private/var/tmp/_bazel_snapsam/c0003f367b02e98a87175911e30b666a/external/com_google_protobuf/BUILD:597:1: Traceback (most recent call last):
        File "/private/var/tmp/_bazel_snapsam/c0003f367b02e98a87175911e30b666a/external/com_google_protobuf/BUILD", line 597
                internal_gen_well_known_protos_java(srcs = WELL_KNOWN_PROTOS)
        File "/private/var/tmp/_bazel_snapsam/c0003f367b02e98a87175911e30b666a/external/com_google_protobuf/protobuf.bzl", line 266, in internal_gen_well_known_protos_java
                Label(("%s//protobuf_java" % REPOSITOR...))
        File "/private/var/tmp/_bazel_snapsam/c0003f367b02e98a87175911e30b666a/external/com_google_protobuf/protobuf.bzl", line 266, in Label
                REPOSITORY_NAME
The value 'REPOSITORY_NAME' has been removed in favor of 'repository_name()', please use the latter (https://docs.bazel.build/versions/master/skylark/lib/native.html#repository_name).
INFO: An error occurred during the fetch of repository 'com_google_protobuf_javalite'
INFO: Call stack for the definition of repository 'com_google_protobuf_javalite':
 - /Users/snapsam/code/proto_library/WORKSPACE:15:1
ERROR: /Users/snapsam/code/proto_library/src/BUILD:52:1: every rule of type proto_library implicitly depends upon the target '@com_google_protobuf//:protoc', but this target could not be found because of: Target '@com_go
ogle_protobuf//:protoc' contains an error and its package is in error
ERROR: /Users/snapsam/code/proto_library/src/BUILD:46:1: every rule of type proto_library implicitly depends upon the target '@com_google_protobuf//:protoc', but this target could not be found because of: Target '@com_go
ogle_protobuf//:protoc' contains an error and its package is in error
ERROR: /Users/snapsam/code/proto_library/src/BUILD:32:1: Target '@com_google_protobuf//:any_proto' contains an error and its package is in error and referenced by '//src:person_proto'
ERROR: /Users/snapsam/code/proto_library/src/BUILD:32:1: every rule of type proto_library implicitly depends upon the target '@com_google_protobuf//:protoc', but this target could not be found because of: Target '@com_go
ogle_protobuf//:protoc' contains an error and its package is in error
ERROR: Analysis of target '//src:zip_code_proto' failed; build aborted: Analysis failed
INFO: Elapsed time: 2.218s
INFO: 0 processes.
FAILED: Build did NOT complete successfully (6 packages loaded, 34 targets configured)
```

Both of these are due to incompatibility with recent versions of bazel.  The
former is a problem in this repository's WORKSPACE, where as the latter is a
problem in the dependency

**Change**
 * Provide a drop-in replacement for http_archive
 * Upgrade proto dependencies to working version [see](protocolbuffers/protobuf#4650)

**Test Plan**
 - [x] Compiles locally with Bazel 0.25.2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant