-
Notifications
You must be signed in to change notification settings - Fork 201
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update build to support Bazel 8/bzlmod (#192)
* Update GNMI to support Bazel 8 * Mark gazelle overrides as dev dependencies * Fix comment position * Set version number in MODULE.bazel. * Update GitHub actions to trigger properly and add go/linter actions. * Add bazel test and remove go/staticcheck analysis for now. * Keep bazel build cache. * Fix syntax error with bazel cache
- Loading branch information
Showing
71 changed files
with
4,471 additions
and
4,469 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
8.0.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
bazel-* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
module( | ||
name = "openconfig_gnmi", | ||
version = "0.13.0", | ||
) | ||
|
||
bazel_dep(name = "gazelle", version = "0.41.0", repo_name = "bazel_gazelle") | ||
bazel_dep(name = "grpc", version = "1.69.0", repo_name = "com_github_grpc_grpc") | ||
bazel_dep(name = "protobuf", version = "29.3", repo_name = "com_google_protobuf") | ||
bazel_dep(name = "rules_go", version = "0.51.0", repo_name = "io_bazel_rules_go") | ||
|
||
go_sdk = use_extension("@io_bazel_rules_go//go:extensions.bzl", "go_sdk") | ||
go_sdk.download(version = "1.23.4") | ||
|
||
go_deps = use_extension("@bazel_gazelle//:extensions.bzl", "go_deps") | ||
go_deps.from_file(go_mod = "//:go.mod") | ||
use_repo(go_deps, "com_github_cenkalti_backoff_v4", "com_github_golang_glog", "com_github_google_go_cmp", "com_github_kylelemons_godebug", "com_github_openconfig_grpctunnel", "com_github_openconfig_ygot", "com_github_protocolbuffers_txtpbfmt", "org_bitbucket_creachadair_stringset", "org_golang_google_grpc", "org_golang_google_grpc_cmd_protoc_gen_go_grpc", "org_golang_google_protobuf", "org_golang_x_crypto", "org_golang_x_net") | ||
|
||
go_deps_dev = use_extension("@bazel_gazelle//:extensions.bzl", "go_deps", dev_dependency = True) | ||
go_deps_dev.gazelle_override( | ||
directives = [ | ||
"gazelle:proto disable", # keep | ||
"gazelle:resolve go github.com/openconfig/gnmi/errlist @openconfig_gnmi//errlist:errlist", # keep | ||
], | ||
path = "github.com/openconfig/grpctunnel", | ||
) | ||
go_deps_dev.gazelle_override( | ||
directives = [ | ||
"gazelle:resolve go github.com/openconfig/gnmi/proto/gnmi @openconfig_gnmi//proto/gnmi:gnmi", # keep | ||
"gazelle:resolve go github.com/openconfig/gnmi/errlist @openconfig_gnmi//errlist:errlist", # keep | ||
"gazelle:resolve go github.com/openconfig/gnmi/value @openconfig_gnmi//value:value", # keep | ||
], | ||
path = "github.com/openconfig/ygot", | ||
) | ||
|
||
inject_repo(go_deps, "openconfig_gnmi") |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
# Copyright 2021 Google LLC | ||
# | ||
# 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 | ||
# | ||
# https://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. | ||
|
||
workspace(name = "gnmi") | ||
|
||
load("//:gnmi_deps.bzl", "gnmi_deps") | ||
|
||
gnmi_deps() | ||
|
||
load("@com_google_googleapis//:repository_rules.bzl", "switched_rules_by_language") | ||
|
||
switched_rules_by_language( | ||
name = "com_google_googleapis_imports", | ||
cc = True, | ||
go = True, | ||
grpc = True, | ||
) | ||
|
||
load("@bazel_features//:deps.bzl", "bazel_features_deps") | ||
|
||
bazel_features_deps() | ||
|
||
load("@bazel_gazelle//:deps.bzl", "gazelle_dependencies") | ||
load("@io_bazel_rules_go//go:deps.bzl", "go_register_toolchains", "go_rules_dependencies") | ||
load("//:gnmi_go_deps.bzl", "gnmi_go_deps") | ||
|
||
# gazelle:repository_macro gnmi_go_deps.bzl%gnmi_go_deps | ||
gnmi_go_deps() | ||
|
||
go_rules_dependencies() | ||
|
||
go_register_toolchains(version = "1.23.4") | ||
|
||
gazelle_dependencies() | ||
|
||
load("@com_google_protobuf//:protobuf_deps.bzl", "protobuf_deps") | ||
|
||
protobuf_deps() | ||
|
||
load("@com_github_grpc_grpc//bazel:grpc_deps.bzl", "grpc_deps") | ||
|
||
grpc_deps() | ||
|
||
# Required by grpc | ||
load("@build_bazel_apple_support//lib:repositories.bzl", "apple_support_dependencies") | ||
load("@build_bazel_rules_apple//apple:repositories.bzl", "apple_rules_dependencies") | ||
load("@rules_python//python:repositories.bzl", "py_repositories") | ||
|
||
py_repositories() | ||
|
||
apple_rules_dependencies(ignore_version_differences = False) | ||
|
||
apple_support_dependencies() |
This file was deleted.
Oops, something went wrong.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# Copyright 2024 Google LLC | ||
# | ||
# 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 | ||
# | ||
# https://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. | ||
|
||
package( | ||
default_visibility = ["//visibility:public"], | ||
licenses = ["notice"], | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
// Copyright 2025 Google LLC | ||
// | ||
// 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. | ||
|
||
//go:build tools | ||
|
||
// Package bazel contains imports to keep go.mod entries for packages that are | ||
// referenced in BUILD files, but not in Go code. | ||
package bazel | ||
|
||
import ( | ||
_ "google.golang.org/grpc/cmd/protoc-gen-go-grpc" // protoc-gen-go-grpc | ||
_ "google.golang.org/protobuf/cmd/protoc-gen-go" // protoc-gen-go | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test") | ||
|
||
go_library( | ||
name = "cache", | ||
srcs = ["cache.go"], | ||
importpath = "github.com/openconfig/gnmi/cache", | ||
visibility = ["//visibility:public"], | ||
deps = [ | ||
"//ctree", | ||
"//errlist", | ||
"//latency", | ||
"//metadata", | ||
"//path", | ||
"//proto/gnmi", | ||
"//value", | ||
"@com_github_golang_glog//:glog", | ||
"@org_bitbucket_creachadair_stringset//:stringset", | ||
"@org_golang_google_protobuf//encoding/prototext", | ||
"@org_golang_google_protobuf//proto", | ||
], | ||
) | ||
|
||
go_test( | ||
name = "cache_test", | ||
srcs = ["cache_test.go"], | ||
embed = [":cache"], | ||
deps = [ | ||
"//ctree", | ||
"//errdiff", | ||
"//latency", | ||
"//metadata", | ||
"//proto/gnmi", | ||
"//value", | ||
"@com_github_google_go_cmp//cmp", | ||
"@com_github_google_go_cmp//cmp/cmpopts", | ||
"@org_golang_google_protobuf//encoding/prototext", | ||
"@org_golang_google_protobuf//proto", | ||
"@org_golang_google_protobuf//testing/protocmp", | ||
], | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test") | ||
|
||
go_library( | ||
name = "cli", | ||
srcs = ["cli.go"], | ||
importpath = "github.com/openconfig/gnmi/cli", | ||
visibility = ["//visibility:public"], | ||
deps = [ | ||
"//client", | ||
"//ctree", | ||
"//proto/gnmi", | ||
"@com_github_protocolbuffers_txtpbfmt//parser", | ||
"@org_golang_google_protobuf//encoding/prototext", | ||
"@org_golang_google_protobuf//proto", | ||
], | ||
) | ||
|
||
go_test( | ||
name = "cli_test", | ||
srcs = ["cli_test.go"], | ||
embed = [":cli"], | ||
deps = [ | ||
"//client", | ||
"//client/gnmi", | ||
"//testing/fake/gnmi", | ||
"//testing/fake/proto", | ||
"//testing/fake/testing/grpc/config", | ||
"@org_golang_google_grpc//:grpc", | ||
], | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.