cgrushko / proto_library

Apache License 2.0
39 stars 20 forks source link

Fix example for later bazel #14

Open snapsam opened 5 years ago

snapsam commented 5 years ago

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

Test Plan