Skip to content

Commit

Permalink
Depend on remote-apis as a Bazel module
Browse files Browse the repository at this point in the history
remote-apis just switched to bzlmod. This change patches up bb-storage
to depend on it as a module, instead of pulling it in via Gazelle. Right
now this still requires us to apply a local patch, because the
go_proto_library() targets in remote-apis use the old gRPC v1 compiler
for generating sources. See this PR for more details:

bazelbuild/remote-apis#308
  • Loading branch information
EdSchouten committed Sep 10, 2024
1 parent 45c5763 commit f74342a
Show file tree
Hide file tree
Showing 29 changed files with 609 additions and 107 deletions.
6 changes: 4 additions & 2 deletions BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@ load("@gazelle//:def.bzl", "gazelle")

# gazelle:go_grpc_compilers @rules_go//proto:go_proto,@rules_go//proto:go_grpc_v2
# gazelle:prefix github.com/buildbarn/bb-storage
# gazelle:resolve proto build/bazel/remote/execution/v2/remote_execution.proto @com_github_bazelbuild_remote_apis//build/bazel/remote/execution/v2:remote_execution_proto
# gazelle:resolve proto go build/bazel/remote/execution/v2/remote_execution.proto @com_github_bazelbuild_remote_apis//build/bazel/remote/execution/v2:execution
# gazelle:resolve go github.com/bazelbuild/remote-apis/build/bazel/remote/execution/v2 @bazel_remote_apis//build/bazel/remote/execution/v2:remote_execution_go_proto
# gazelle:resolve go github.com/bazelbuild/remote-apis/build/bazel/semver @bazel_remote_apis//build/bazel/semver:semver_go_proto
# gazelle:resolve proto build/bazel/remote/execution/v2/remote_execution.proto @bazel_remote_apis//build/bazel/remote/execution/v2:remote_execution_proto
# gazelle:resolve proto go build/bazel/remote/execution/v2/remote_execution.proto @bazel_remote_apis//build/bazel/remote/execution/v2:remote_execution_go_proto
# gazelle:resolve proto go google/bytestream/bytestream.proto @org_golang_google_genproto_googleapis_bytestream//:bytestream
# gazelle:resolve proto go google/rpc/status.proto @org_golang_google_genproto_googleapis_rpc//status
# gazelle:resolve proto go opentelemetry/proto/common/v1/common.proto @io_opentelemetry_go_proto_otlp//common/v1:common
Expand Down
23 changes: 8 additions & 15 deletions MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ module(name = "com_github_buildbarn_bb_storage")

bazel_dep(name = "aspect_bazel_lib", version = "2.8.1")
bazel_dep(name = "aspect_rules_js", version = "2.0.1")
bazel_dep(name = "bazel_remote_apis", version = "0.0.0")
bazel_dep(name = "gazelle", version = "0.38.0")
bazel_dep(name = "googleapis", version = "0.0.0-20240326-1c8d509c5")
bazel_dep(name = "jsonnet_go", version = "0.20.0")
Expand All @@ -14,6 +15,13 @@ bazel_dep(name = "rules_pkg", version = "1.0.1")
bazel_dep(name = "rules_proto", version = "6.0.2")
bazel_dep(name = "toolchains_llvm", version = "1.1.2")

git_override(
module_name = "bazel_remote_apis",
commit = "9a250a0f817fe63a426ede43b133c3dc4549d75f",
patches = ["//:patches/bazel_remote_apis/grpc-v2.diff"],
remote = "https://github.com/bazelbuild/remote-apis.git",
)

git_override(
module_name = "gazelle",
commit = "4d0129d7adae33e8e648d3624aff8fa8f93f375b",
Expand All @@ -39,7 +47,6 @@ use_repo(
"com_github_aws_aws_sdk_go_v2_service_s3",
"com_github_aws_aws_sdk_go_v2_service_sts",
"com_github_bazelbuild_buildtools",
"com_github_bazelbuild_remote_apis",
"com_github_fxtlabs_primes",
"com_github_go_jose_go_jose_v3",
"com_github_google_uuid",
Expand Down Expand Up @@ -78,20 +85,6 @@ use_repo(
)

go_deps_dev = use_extension("@gazelle//:extensions.bzl", "go_deps", dev_dependency = True)
go_deps_dev.gazelle_override(
build_file_generation = "on",
directives = [
"gazelle:go_grpc_compilers @io_bazel_rules_go//proto:go_proto,@io_bazel_rules_go//proto:go_grpc_v2",
"gazelle:resolve proto go build/bazel/semver/semver.proto //build/bazel/semver",
"gazelle:resolve proto go google/api/annotations.proto @org_golang_google_genproto_googleapis_api//annotations",
"gazelle:resolve proto go google/longrunning/operations.proto @com_google_cloud_go_longrunning//autogen/longrunningpb",
"gazelle:resolve proto go google/rpc/status.proto @org_golang_google_genproto_googleapis_rpc//status",
"gazelle:resolve proto google/api/annotations.proto @googleapis//google/api:annotations_proto",
"gazelle:resolve proto google/longrunning/operations.proto @googleapis//google/longrunning:operations_proto",
"gazelle:resolve proto google/rpc/status.proto @googleapis//google/rpc:status_proto",
],
path = "github.com/bazelbuild/remote-apis",
)
go_deps_dev.module_override(
patches = ["//:patches/com_github_grpc_ecosystem_go_grpc_prometheus/client-metrics-prevent-handled-twice.diff"],
path = "github.com/grpc-ecosystem/go-grpc-prometheus",
Expand Down
402 changes: 388 additions & 14 deletions MODULE.bazel.lock

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion cmd/bb_storage/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ go_library(
"//pkg/proto/icas",
"//pkg/proto/iscc",
"//pkg/util",
"@com_github_bazelbuild_remote_apis//build/bazel/remote/execution/v2:execution",
"@bazel_remote_apis//build/bazel/remote/execution/v2:remote_execution_go_proto",
"@org_golang_google_genproto_googleapis_bytestream//:bytestream",
"@org_golang_google_grpc//:grpc",
"@org_golang_google_grpc//codes",
Expand Down
64 changes: 32 additions & 32 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@ require (
cloud.google.com/go/longrunning v0.6.0
cloud.google.com/go/storage v1.43.0
github.com/aohorodnyk/mimeheader v0.0.6
github.com/aws/aws-sdk-go-v2 v1.30.4
github.com/aws/aws-sdk-go-v2/config v1.27.31
github.com/aws/aws-sdk-go-v2/credentials v1.17.30
github.com/aws/aws-sdk-go-v2/service/s3 v1.61.0
github.com/aws/aws-sdk-go-v2/service/sts v1.30.5
github.com/aws/aws-sdk-go-v2 v1.30.5
github.com/aws/aws-sdk-go-v2/config v1.27.33
github.com/aws/aws-sdk-go-v2/credentials v1.17.32
github.com/aws/aws-sdk-go-v2/service/s3 v1.61.2
github.com/aws/aws-sdk-go-v2/service/sts v1.30.7
github.com/bazelbuild/buildtools v0.0.0-20240827154017-dd10159baa91
github.com/bazelbuild/remote-apis v0.0.0-20240703191324-0d21f29acdb9
github.com/bazelbuild/remote-apis v0.0.0-20240910125346-9a250a0f817f
github.com/fxtlabs/primes v0.0.0-20150821004651-dad82d10a449
github.com/go-jose/go-jose/v3 v3.0.3
github.com/google/go-jsonnet v0.20.0
Expand All @@ -26,9 +26,9 @@ require (
github.com/jmespath/go-jmespath v0.4.0
github.com/klauspost/compress v1.17.9
github.com/lazybeaver/xorshift v0.0.0-20170702203709-ce511d4823dd
github.com/prometheus/client_golang v1.20.2
github.com/prometheus/client_golang v1.20.3
github.com/prometheus/client_model v0.6.1
github.com/prometheus/common v0.57.0
github.com/prometheus/common v0.59.1
github.com/sercand/kuberesolver/v5 v5.1.1
github.com/stretchr/testify v1.9.0
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.54.0
Expand All @@ -41,36 +41,36 @@ require (
go.opentelemetry.io/proto/otlp v1.3.1
go.uber.org/mock v0.4.0
golang.org/x/lint v0.0.0-20210508222113-6edffad5e616
golang.org/x/oauth2 v0.22.0
golang.org/x/oauth2 v0.23.0
golang.org/x/sync v0.8.0
golang.org/x/sys v0.24.0
google.golang.org/api v0.195.0
google.golang.org/genproto/googleapis/bytestream v0.0.0-20240827150818-7e3bb234dfed
google.golang.org/genproto/googleapis/rpc v0.0.0-20240827150818-7e3bb234dfed
google.golang.org/grpc v1.66.0
golang.org/x/sys v0.25.0
google.golang.org/api v0.196.0
google.golang.org/genproto/googleapis/bytestream v0.0.0-20240903143218-8af14fe29dc1
google.golang.org/genproto/googleapis/rpc v0.0.0-20240903143218-8af14fe29dc1
google.golang.org/grpc v1.66.1
google.golang.org/grpc/security/advancedtls v1.0.0
google.golang.org/protobuf v1.34.2
mvdan.cc/gofumpt v0.7.0
)

require (
cloud.google.com/go v0.115.1 // indirect
cloud.google.com/go/auth v0.9.2 // indirect
cloud.google.com/go/auth v0.9.3 // indirect
cloud.google.com/go/auth/oauth2adapt v0.2.4 // indirect
cloud.google.com/go/compute/metadata v0.5.0 // indirect
cloud.google.com/go/iam v1.2.0 // indirect
github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.6.4 // indirect
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.12 // indirect
github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.16 // indirect
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.16 // indirect
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.13 // indirect
github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.17 // indirect
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.17 // indirect
github.com/aws/aws-sdk-go-v2/internal/ini v1.8.1 // indirect
github.com/aws/aws-sdk-go-v2/internal/v4a v1.3.16 // indirect
github.com/aws/aws-sdk-go-v2/internal/v4a v1.3.17 // indirect
github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.11.4 // indirect
github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.3.18 // indirect
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.11.18 // indirect
github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.17.16 // indirect
github.com/aws/aws-sdk-go-v2/service/sso v1.22.5 // indirect
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.26.5 // indirect
github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.3.19 // indirect
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.11.19 // indirect
github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.17.17 // indirect
github.com/aws/aws-sdk-go-v2/service/sso v1.22.7 // indirect
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.26.7 // indirect
github.com/aws/smithy-go v1.20.4 // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/cespare/xxhash/v2 v2.3.0 // indirect
Expand All @@ -83,7 +83,7 @@ require (
github.com/golang/protobuf v1.5.4 // indirect
github.com/google/go-cmp v0.6.0 // indirect
github.com/google/s2a-go v0.1.8 // indirect
github.com/googleapis/enterprise-certificate-proxy v0.3.3 // indirect
github.com/googleapis/enterprise-certificate-proxy v0.3.4 // indirect
github.com/googleapis/gax-go/v2 v2.13.0 // indirect
github.com/grpc-ecosystem/grpc-gateway/v2 v2.22.0 // indirect
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
Expand All @@ -92,14 +92,14 @@ require (
go.opencensus.io v0.24.0 // indirect
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.54.0 // indirect
go.opentelemetry.io/otel/metric v1.29.0 // indirect
golang.org/x/crypto v0.26.0 // indirect
golang.org/x/mod v0.20.0 // indirect
golang.org/x/net v0.28.0 // indirect
golang.org/x/text v0.17.0 // indirect
golang.org/x/crypto v0.27.0 // indirect
golang.org/x/mod v0.21.0 // indirect
golang.org/x/net v0.29.0 // indirect
golang.org/x/text v0.18.0 // indirect
golang.org/x/time v0.6.0 // indirect
golang.org/x/tools v0.24.0 // indirect
google.golang.org/genproto v0.0.0-20240827150818-7e3bb234dfed // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20240827150818-7e3bb234dfed // indirect
golang.org/x/tools v0.25.0 // indirect
google.golang.org/genproto v0.0.0-20240903143218-8af14fe29dc1 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20240903143218-8af14fe29dc1 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
sigs.k8s.io/yaml v1.4.0 // indirect
)
Loading

0 comments on commit f74342a

Please sign in to comment.