Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 0 additions & 58 deletions .bazelci/presubmit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -95,39 +95,6 @@ platforms:
- "-@io_bazel_rules_go//proto/wkt:timestamp_go_proto"
- "-@io_bazel_rules_go//proto/wkt:type_go_proto"
- "-@io_bazel_rules_go//proto/wkt:wrappers_go_proto"
- "-@org_golang_google_grpc//balancer/grpclb:go_default_library"
- "-@org_golang_google_grpc//balancer/grpclb:go_default_test"
- "-@org_golang_google_grpc//balancer/grpclb/grpc_lb_v1:go_default_library"
- "-@org_golang_google_grpc//balancer/roundrobin:go_default_test"
- "-@org_golang_google_grpc//benchmark:go_default_library"
- "-@org_golang_google_grpc//benchmark:go_default_test"
- "-@org_golang_google_grpc//benchmark/grpc_testing:go_default_library"
- "-@org_golang_google_grpc//channelz/grpc_channelz_v1:go_default_library"
- "-@org_golang_google_grpc//channelz/service:go_default_library"
- "-@org_golang_google_grpc//channelz/service:go_default_test"
- "-@org_golang_google_grpc//codes:go_default_test"
- "-@org_golang_google_grpc//credentials/alts/internal/authinfo:go_default_library"
- "-@org_golang_google_grpc//credentials/alts/internal/authinfo:go_default_test"
- "-@org_golang_google_grpc//credentials/alts/internal/handshaker:go_default_library"
- "-@org_golang_google_grpc//credentials/alts/internal/handshaker:go_default_test"
- "-@org_golang_google_grpc//credentials/alts/internal/handshaker/service:go_default_library"
- "-@org_golang_google_grpc//credentials/alts/internal/handshaker/service:go_default_test"
- "-@org_golang_google_grpc//credentials/alts/internal/proto/grpc_gcp:go_default_library"
- "-@org_golang_google_grpc//:go_default_library"
- "-@org_golang_google_grpc//health:go_default_library"
- "-@org_golang_google_grpc//health:go_default_test"
- "-@org_golang_google_grpc//health/grpc_health_v1:go_default_library"
- "-@org_golang_google_grpc//internal/transport:go_default_library"
- "-@org_golang_google_grpc//reflection:go_default_library"
- "-@org_golang_google_grpc//reflection:go_default_test"
- "-@org_golang_google_grpc//reflection/grpc_reflection_v1alpha:go_default_library"
- "-@org_golang_google_grpc//reflection/grpc_testing:go_default_library"
- "-@org_golang_google_grpc//reflection/grpc_testingv3:go_default_library"
- "-@org_golang_google_grpc//stats:go_default_test"
- "-@org_golang_google_grpc//stats/grpc_testing:go_default_library"
- "-@org_golang_google_grpc//status:go_default_library"
- "-@org_golang_google_grpc//status:go_default_test"
- "-@org_golang_google_grpc//test/grpc_testing:go_default_library"
- "-@org_golang_x_crypto//ed25519:go_default_test"
- "-@org_golang_x_crypto//sha3:go_default_test"
- "-@org_golang_x_sys//windows/registry:go_default_test"
Expand Down Expand Up @@ -223,7 +190,6 @@ platforms:
- "-//tests/integration/googleapis:color_service_go_proto"
- "-//tests/integration/googleapis:color_service_proto"
- "-//tests/integration/googleapis:color_service_test"
- "-//tests/integration/popular_repos:org_golang_google_grpc"
- "-//tests/legacy/build_with_old_sdk:build_with_old_sdk"
- "-//tests/legacy/cgo_library_root_dir:cgo_library_root_dir"
- "-//tests/legacy/custom_go_toolchain:custom_go_toolchain"
Expand Down Expand Up @@ -292,30 +258,6 @@ platforms:
- "--"
- "..."
- "-//go/tools/bazel:go_default_test"
- "-@org_golang_google_grpc//balancer/grpclb:go_default_test"
- "-@org_golang_google_grpc//balancer/roundrobin:go_default_test"
- "-@org_golang_google_grpc//benchmark:go_default_test"
- "-@org_golang_google_grpc//benchmark/latency:go_default_test"
- "-@org_golang_google_grpc//benchmark/primitives:go_default_test"
- "-@org_golang_google_grpc//channelz/service:go_default_test"
- "-@org_golang_google_grpc//codes:go_default_test"
- "-@org_golang_google_grpc//credentials/alts/internal/authinfo:go_default_test"
- "-@org_golang_google_grpc//credentials/alts/internal/conn:go_default_test"
- "-@org_golang_google_grpc//credentials/alts/internal/handshaker:go_default_test"
- "-@org_golang_google_grpc//credentials/alts/internal/handshaker/service:go_default_test"
- "-@org_golang_google_grpc//encoding/proto:go_default_test"
- "-@org_golang_google_grpc//grpclog:go_default_test"
- "-@org_golang_google_grpc//health:go_default_test"
- "-@org_golang_google_grpc//internal/channelz:go_default_test"
- "-@org_golang_google_grpc//internal/grpcsync:go_default_test"
- "-@org_golang_google_grpc//internal/leakcheck:go_default_test"
- "-@org_golang_google_grpc//metadata:go_default_test"
- "-@org_golang_google_grpc//naming:go_default_test"
- "-@org_golang_google_grpc//reflection:go_default_test"
- "-@org_golang_google_grpc//resolver/dns:go_default_test"
- "-@org_golang_google_grpc//stats:go_default_test"
- "-@org_golang_google_grpc//status:go_default_test"
- "-@org_golang_google_grpc//test/bufconn:go_default_test"
- "-@org_golang_x_crypto//ed25519:go_default_test"
- "-@org_golang_x_crypto//sha3:go_default_test"
- "-@org_golang_x_net//ipv4:go_default_test"
Expand Down
22 changes: 15 additions & 7 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ Go rules for Bazel_
.. _rules_go and Gazelle roadmap: roadmap.rst
.. _Deprecation schedule: deprecation.rst
.. _Avoiding conflicts: proto/core.rst#avoiding-conflicts
.. _Proto dependencies: go/workspace.rst#proto-dependencies
.. _gRPC dependencies: go/workspace.rst#grpc-dependencies
.. _Overriding dependencies: go/workspace.rst#overriding-dependencies
.. _nogo: go/nogo.rst
.. _Using rules_go on Windows: windows.rst
Expand Down Expand Up @@ -623,15 +625,21 @@ How do I avoid conflicts with protocol buffers?

See `Avoiding conflicts`_ in the proto documentation.

How do I use a specific version of gRPC or golang.org/x/...?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
How do I build proto libraries and gRPC?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

The `go_rules_dependencies`_ macro declares several external repositories
at specific versions. These are needed for `go_proto_library`_ to work,
especially with gRPC.
The `go_rules_dependencies`_ macro used to declare all dependencies needed
to generate and compile protocol buffers. Managing this got too complicated,
and the declarations caused confusion in workspaces that declared different
versions of the same repositories, so these dependencies are no longer
declared in ``go_rules_dependencies``. They must be declared separately.

See `Overriding dependencies`_ for information and an example of how to
replace these repositories with different versions.
In order to build anything that uses ``protoc`` (including ``proto_library``),
you must declare a repository rule for ``com_google_protobuf``. See
`Proto dependencies`_ for an example.

In order to build anything that uses gRPC, several additional repositories
must be declared. See `gRPC dependencies`_ for instructions and an example.

Can I use a vendored gRPC with go_proto_library?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Expand Down
24 changes: 22 additions & 2 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,21 @@ go_rules_dependencies()

go_register_toolchains()

git_repository(
name = "com_google_protobuf",
commit = "09745575a923640154bcf307fba8aedff47f240a",
remote = "https://github.com/protocolbuffers/protobuf",
shallow_since = "1558721209 -0700",
)

load("@com_google_protobuf//:protobuf_deps.bzl", "protobuf_deps")

protobuf_deps()

load("@io_bazel_rules_go//extras:embed_data_deps.bzl", "go_embed_data_dependencies")

go_embed_data_dependencies()

# For manual testing against an LLVM toolchain.
# Use --crosstool_top=@llvm_toolchain//:toolchain
http_archive(
Expand Down Expand Up @@ -49,9 +64,10 @@ bazel_skylib_workspace()

git_repository(
name = "bazel_gazelle",
commit = "aa1a9cfe4845bc83482af92addbfcd41f8dc51f0", # master as of 2019-01-27
# master as of 2019-07-08
commit = "7c3b97b8e8bf4699353fcdf7437c195e2cdcef3b",
remote = "https://github.com/bazelbuild/bazel-gazelle",
shallow_since = "1548631399 -0500",
shallow_since = "1562699102 -0400",
)

load("@bazel_gazelle//:deps.bzl", "gazelle_dependencies")
Expand All @@ -70,6 +86,10 @@ load("@io_bazel_rules_go//tests/integration/popular_repos:popular_repos.bzl", "p

popular_repos()

load("@io_bazel_rules_go//tests:grpc_repos.bzl", "grpc_dependencies")

grpc_dependencies()

local_repository(
name = "runfiles_remote_test",
path = "tests/core/runfiles/runfiles_remote_test",
Expand Down
31 changes: 31 additions & 0 deletions extras/embed_data_deps.bzl
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Copyright 2019 The Bazel Authors. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

load(
"@bazel_tools//tools/build_defs/repo:git.bzl",
"git_repository",
)

def go_embed_data_dependencies():
if "com_github_kevinburke_go_bindata" not in native.existing_rules():
git_repository(
name = "com_github_kevinburke_go_bindata",
remote = "https://github.com/kevinburke/go-bindata",
# v3.13.0+incompatible, "latest" as of 2019-07-08
commit = "53d73b98acf3bd9f56d7f9136ed8e1be64756e1d",
patches = ["@io_bazel_rules_go//third_party:com_github_kevinburke_go_bindata-gazelle.patch"],
patch_args = ["-p1"],
shallow_since = "1545009224 +0000",
# gazelle args: -go_prefix github.com/kevinburke/go-bindata
)
17 changes: 15 additions & 2 deletions go/extras.rst
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,21 @@ This rule allows you to generate mock interfaces with mockgen (from `golang/mock
go_embed_data
-------------

go_embed_data generates a .go file that contains data from a file or a list of files.
It should be consumed in the srcs list of one of the `core go rules`_.
``go_embed_data`` generates a .go file that contains data from a file or a
list of files. It should be consumed in the srcs list of one of the
`core go rules`_.

Before using ``go_embed_data``, you must add the following snippet to your
WORKSPACE:

.. code:: bzl

load("@io_bazel_rules_go//extras:embed_data_deps.bzl", "go_embed_data_dependencies")

go_embed_data_dependencies()


``go_embed_data`` accepts the attributes listed below.

+----------------------------+-----------------------------+---------------------------------------+
| **Name** | **Type** | **Default value** |
Expand Down
Loading