Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
82469: bazel: upgrade rules_go to v0.32 r=rail a=rickystewart

Also had to bump a couple deps (`go_googleapis`, `gazelle`) to match up
to what `rules_go` currently has at v0.32.

Release note: None

Co-authored-by: Ricky Stewart <[email protected]>
  • Loading branch information
craig[bot] and rickystewart committed Jun 8, 2022
2 parents 1ee37de + dc1e920 commit 6336800
Show file tree
Hide file tree
Showing 5 changed files with 79 additions and 26 deletions.
72 changes: 51 additions & 21 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@ load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
# Load go bazel tools. This gives us access to the go bazel SDK/toolchains.
http_archive(
name = "io_bazel_rules_go",
sha256 = "8a993815a6a7cfe47e46238383f0e36a80b9ce0ac482f855c7288a31565b5661",
strip_prefix = "cockroachdb-rules_go-58cb947",
sha256 = "8b4ac0c07e95679766c55dba4b83df3f466fe9e383ae06177bc0e00198ffb907",
strip_prefix = "cockroachdb-rules_go-3fc3373",
urls = [
# cockroachdb/rules_go as of 58cb94707783f529462d4c6d3c698933a1022942
# (upstream release-0.29 plus a few patches).
"https://storage.googleapis.com/public-bazel-artifacts/bazel/cockroachdb-rules_go-v0.27.0-56-g58cb947.tar.gz",
# cockroachdb/rules_go as of 3fc33735d71366159674389f49a9f9141060a614
# (upstream release-0.32 plus a few patches).
"https://storage.googleapis.com/public-bazel-artifacts/bazel/cockroachdb-rules_go-v0.27.0-117-g3fc3373.tar.gz",
],
)

Expand All @@ -42,11 +42,9 @@ http_archive(
# repo.
http_archive(
name = "bazel_gazelle",
sha256 = "9fba095e4bebd8c6748154ca53c365862af47fa1651f7c0d25459e6ca5bb208f",
strip_prefix = "bazelbuild-bazel-gazelle-3ea1d64",
sha256 = "5982e5463f171da99e3bdaeff8c0f48283a7a5f396ec5282910b9e8a49c0dd7e",
urls = [
# v0.24.0
"https://storage.googleapis.com/public-bazel-artifacts/bazel/bazelbuild-bazel-gazelle-v0.24.0-0-g3ea1d64.tar.gz",
"https://storage.googleapis.com/public-bazel-artifacts/bazel/bazel-gazelle-v0.25.0.tar.gz",
],
)

Expand Down Expand Up @@ -104,6 +102,7 @@ http_archive(
],
)

# org_golang_x_sys handled in DEPS.bzl.
# org_golang_x_tools handled in DEPS.bzl.
# org_golang_x_xerrors handled in DEPS.bzl.

Expand Down Expand Up @@ -134,14 +133,16 @@ http_archive(
"@io_bazel_rules_go//third_party:go_googleapis-gazelle.patch",
"@com_github_cockroachdb_cockroach//build/patches:go_googleapis.patch",
],
sha256 = "a85c6a00e9cf0f004992ebea1d10688e3beea9f8e1a5a04ee53f367e72ee85af",
strip_prefix = "googleapis-409e134ffaacc243052b08e6fb8e2d458014ed37",
# master, as of 2021-10-06
sha256 = "e8b434794608a9af0c0721cfaeedebe37d3676a4ee9dbeed868e5e2982b5abcc",
strip_prefix = "googleapis-10c88bb5c489c8ad1edb0e7f6a17cdd07147966e",
# master, as of 2022-05-09
urls = [
"https://storage.googleapis.com/public-bazel-artifacts/bazel/409e134ffaacc243052b08e6fb8e2d458014ed37.zip",
"https://storage.googleapis.com/public-bazel-artifacts/bazel/10c88bb5c489c8ad1edb0e7f6a17cdd07147966e.zip",
],
)

# com_github_golang_mock handled in DEPS.bzl.

# Load the go dependencies and invoke them.
load(
"@io_bazel_rules_go//go:deps.bzl",
Expand Down Expand Up @@ -321,6 +322,7 @@ load(
# Ref: https://github.com/bazelbuild/bazel-gazelle/blob/master/deps.bzl

# bazel_skylib handled above.
# co_honnef_go_tools handled in DEPS.bzl.

# keep
go_repository(
Expand All @@ -337,29 +339,57 @@ go_repository(

# keep
go_repository(
name = "com_github_bmatcuk_doublestar",
importpath = "github.com/bmatcuk/doublestar",
sha256 = "50b02a6a30e186ba189c037901719248667b595b3131a4f6b29aebe3c874e83b",
strip_prefix = "doublestar",
name = "com_github_bmatcuk_doublestar_v4",
importpath = "github.com/bmatcuk/doublestar/v4",
sha256 = "d11c3b3a45574f89d6a6b2f50e53feea50df60407b35f36193bf5815d32c79d1",
strip_prefix = "bmatcuk-doublestar-f7a8118",
urls = [
"https://storage.googleapis.com/public-bazel-artifacts/gomod/github.com/bmatcuk/doublestar/v1.2.2/doublestar-1.2.2.tar.gz",
"https://storage.googleapis.com/public-bazel-artifacts/bazel/bmatcuk-doublestar-v4.0.1-0-gf7a8118.tar.gz",
],
)

# com_github_burntsushi_toml handled in DEPS.bzl.
# com_github_census_instrumentation_opencensus_proto handled in DEPS.bzl.
# com_github_chzyer_logex handled in DEPS.bzl.
# com_github_chzyer_readline handled in DEPS.bzl.
# com_github_chzyer_test handled in DEPS.bzl.
# com_github_client9_misspell handled in DEPS.bzl.
# com_github_davecgh_go_spew handled in DEPS.bzl.
# com_github_envoyproxy_go_control_plane handled in DEPS.bzl.
# com_github_envoyproxy_protoc_gen_validate handled in DEPS.bzl.
# com_github_fsnotify_fsnotify handled in DEPS.bzl.
# com_github_golang_glog handled in DEPS.bzl.
# com_github_golang_mock handled in DEPS.bzl.
# com_github_golang_protobuf handled in DEPS.bzl.
# com_github_google_go_cmp handled in DEPS.bzl.
# com_github_kr_pretty handled in DEPS.bzl.
# com_github_kr_pty handled in DEPS.bzl.
# com_github_kr_text handled in DEPS.bzl.
# com_github_pelletier_go_toml handled in DEPS.bzl.
# com_github_pmezard_go_difflib handled in DEPS.bzl.
# com_github_prometheus_client_model handled in DEPS.bzl.
# com_github_yuin_goldmark handled in DEPS.bzl.
# com_google_cloud_go handled in DEPS.bzl.
# in_gopkg_check_v1 handled in DEPS.bzl.
# in_gopkg_yaml_v2 handled in DEPS.bzl.

# keep
go_repository(
name = "net_starlark_go",
importpath = "go.starlark.net",
sha256 = "a35c6468e0e0921833a63290161ff903295eaaf5915200bbce272cbc8dfd1c1c",
strip_prefix = "google-starlark-go-e043a3d",
urls = [
"https://storage.googleapis.com/public-bazel-artifacts/bazel/google-starlark-go-e043a3d.tar.gz",
],
)

# org_golang_google_genproto handled in DEPS.bzl.
# org_golang_google_grpc handled in DEPS.bzl.
# org_golang_google_protobuf handled in DEPS.bzl.
# org_golang_x_crypto handled in DEPS.bzl.
# org_golang_x_exp handled in DEPS.bzl.
# org_golang_x_lint handled in DEPS.bzl.
# org_golang_x_mod handled in DEPS.bzl.
# org_golang_x_net handled in DEPS.bzl.
# org_golang_x_oauth2 handled in DEPS.bzl.
# org_golang_x_sync handled in DEPS.bzl.
# org_golang_x_sys handled in DEPS.bzl.
# org_golang_x_text handled in DEPS.bzl.
Expand Down
9 changes: 6 additions & 3 deletions build/bazelutil/distdir_files.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -937,13 +937,15 @@ DISTDIR_FILES = {
"https://storage.googleapis.com/cockroach-godeps/gomod/sigs.k8s.io/structured-merge-diff/v4/io_k8s_sigs_structured_merge_diff_v4-v4.1.2.zip": "b32af97dadd79179a8f62aaf4ef1e0562e051be77053a60c7a4e724a5cbd00ce",
"https://storage.googleapis.com/cockroach-godeps/gomod/sigs.k8s.io/yaml/io_k8s_sigs_yaml-v1.2.0.zip": "55ed08c5df448a033bf7e2c2912d4daa85b856a05c854b0c87ccc85c7f3fbfc7",
"https://storage.googleapis.com/cockroach-godeps/gomod/sourcegraph.com/sourcegraph/appdash/com_sourcegraph_sourcegraph_appdash-v0.0.0-20190731080439-ebfcffb1b5c0.zip": "bd2492d9db05362c2fecd0b3d0f6002c89a6d90d678fb93b4158298ab883736f",
"https://storage.googleapis.com/public-bazel-artifacts/bazel/409e134ffaacc243052b08e6fb8e2d458014ed37.zip": "a85c6a00e9cf0f004992ebea1d10688e3beea9f8e1a5a04ee53f367e72ee85af",
"https://storage.googleapis.com/public-bazel-artifacts/bazel/10c88bb5c489c8ad1edb0e7f6a17cdd07147966e.zip": "e8b434794608a9af0c0721cfaeedebe37d3676a4ee9dbeed868e5e2982b5abcc",
"https://storage.googleapis.com/public-bazel-artifacts/bazel/88ef31b429631b787ceb5e4556d773b20ad797c8.zip": "92a89a2bbe6c6db2a8b87da4ce723aff6253656e8417f37e50d362817c39b98b",
"https://storage.googleapis.com/public-bazel-artifacts/bazel/bazel-gazelle-v0.25.0.tar.gz": "5982e5463f171da99e3bdaeff8c0f48283a7a5f396ec5282910b9e8a49c0dd7e",
"https://storage.googleapis.com/public-bazel-artifacts/bazel/bazel-skylib-1.0.3.tar.gz": "1c531376ac7e5a180e0237938a2536de0c54d93f5c278634818e0efc952dd56c",
"https://storage.googleapis.com/public-bazel-artifacts/bazel/bazel_gomock-fde78c91cf1783cc1e33ba278922ba67a6ee2a84.tar.gz": "692421b0c5e04ae4bc0bfff42fb1ce8671fe68daee2b8d8ea94657bb1fcddc0a",
"https://storage.googleapis.com/public-bazel-artifacts/bazel/bazelbuild-bazel-gazelle-v0.24.0-0-g3ea1d64.tar.gz": "9fba095e4bebd8c6748154ca53c365862af47fa1651f7c0d25459e6ca5bb208f",
"https://storage.googleapis.com/public-bazel-artifacts/bazel/bmatcuk-doublestar-v4.0.1-0-gf7a8118.tar.gz": "d11c3b3a45574f89d6a6b2f50e53feea50df60407b35f36193bf5815d32c79d1",
"https://storage.googleapis.com/public-bazel-artifacts/bazel/cockroachdb-rules_foreign_cc-6f7f1b1.tar.gz": "272ac2cde4efd316c8d7c0140dee411c89da104466701ac179286ef5a89c7b58",
"https://storage.googleapis.com/public-bazel-artifacts/bazel/cockroachdb-rules_go-v0.27.0-56-g58cb947.tar.gz": "8a993815a6a7cfe47e46238383f0e36a80b9ce0ac482f855c7288a31565b5661",
"https://storage.googleapis.com/public-bazel-artifacts/bazel/cockroachdb-rules_go-v0.27.0-117-g3fc3373.tar.gz": "8b4ac0c07e95679766c55dba4b83df3f466fe9e383ae06177bc0e00198ffb907",
"https://storage.googleapis.com/public-bazel-artifacts/bazel/google-starlark-go-e043a3d.tar.gz": "a35c6468e0e0921833a63290161ff903295eaaf5915200bbce272cbc8dfd1c1c",
"https://storage.googleapis.com/public-bazel-artifacts/bazel/platforms-0.0.4.tar.gz": "079945598e4b6cc075846f7fd6a9d0857c33a7afc0de868c2ccb96405225135d",
"https://storage.googleapis.com/public-bazel-artifacts/bazel/protobuf-e809d75ecb5770fdc531081eef306b3e672bcdd2.tar.gz": "071ccf561d127d5702910340cf038cb869aa239683544e1cca68a78ea865099e",
"https://storage.googleapis.com/public-bazel-artifacts/bazel/rules_java-981f06c3d2bd10225e85209904090eb7b5fb26bd.tar.gz": "f5a3e477e579231fca27bf202bb0e8fbe4fc6339d63b38ccb87c2760b533d1c3",
Expand Down Expand Up @@ -984,6 +986,7 @@ DISTDIR_FILES = {
"https://storage.googleapis.com/public-bazel-artifacts/go/go1.17.10.windows-386.zip": "60840a079a04c838dc44b7d48f74ac37506298d34d2a002ced48831ccce6bdae",
"https://storage.googleapis.com/public-bazel-artifacts/go/go1.17.10.windows-amd64.zip": "ba9198a29fa5c4f322212d21569e8507165c3b34e1ed1f1f9cf6dfb71ddcdeb2",
"https://storage.googleapis.com/public-bazel-artifacts/go/go1.17.10.windows-arm64.zip": "9d06da8d3e9c3f4a5905c4ea9cb271294e2ff956926380322feb2561e84b4d68",
"https://storage.googleapis.com/public-bazel-artifacts/gomod/github.com/bazelbuild/buildtools/v0.0.0-20200718160251-b1667ff58f71/buildtools-v0.0.0-20200718160251-b1667ff58f71.tar.gz": "a9ef5103739dfb5ed2a5b47ab1654842a89695812e4af09e57d7015a5caf97e0",
"https://storage.googleapis.com/public-bazel-artifacts/java/railroad/rr-1.63-java8.zip": "d2791cd7a44ea5be862f33f5a9b3d40aaad9858455828ebade7007ad7113fb41",
"https://storage.googleapis.com/public-bazel-artifacts/js/node/v16.13.0/node-v16.13.0-darwin-arm64.tar.gz": "46d83fc0bd971db5050ef1b15afc44a6665dee40bd6c1cbaec23e1b40fa49e6d",
"https://storage.googleapis.com/public-bazel-artifacts/js/node/v16.13.0/node-v16.13.0-darwin-x64.tar.gz": "37e09a8cf2352f340d1204c6154058d81362fef4ec488b0197b2ce36b3f0367a",
Expand Down
2 changes: 1 addition & 1 deletion build/teamcity/cockroach/ci/tests/unit_tests_impl.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
set -xeuo pipefail

bazel build //pkg/cmd/bazci --config=ci
$(bazel info bazel-bin --config=ci)/pkg/cmd/bazci/bazci_/bazci --config=ci --config=simplestamp \
$(bazel info bazel-bin --config=ci)/pkg/cmd/bazci/bazci_/bazci --config=ci --config=simplestamp --compilation_mode=fastbuild \
test //pkg:small_tests //pkg:medium_tests //pkg:large_tests //pkg:enormous_tests -- \
--profile=/artifacts/profile.gz
15 changes: 14 additions & 1 deletion pkg/build/starlarkutil/starlarkutil.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,20 @@ func downloadableArtifactsFromGoDeps(def *syntax.DefStmt) (map[string]Downloadab
return ret, nil
}

// maybeGetDownloadableArtifact returns the artifact pointed to by the given
// GetArtifactFromGoRepository returns the DownloadableArtifact pointed to by the given
// go_repository.
func GetArtifactFromGoRepository(call *syntax.CallExpr) (DownloadableArtifact, error) {
name, art, err := maybeGetDownloadableArtifact(call)
if err != nil {
return art, err
}
if name == "" {
return DownloadableArtifact{}, fmt.Errorf("could not parse downloadable artifact from given go_repository call")
}
return art, err
}

// maybeGetDownloadableArtifact returns the DownloadableArtifact pointed to by the given
// go_repository or http_repository expression, returning the name of the repo
// and the location of the mirror if one can be found, or the empty string/an
// empty existingMirror if not. Returns an error iff an unrecoverable problem
Expand Down
7 changes: 7 additions & 0 deletions pkg/cmd/generate-distdir/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,13 @@ func getShasFromWorkspace(workspace string, shas map[string]string) error {
}
shas[artifact.URL] = artifact.Sha256
}
if fun == "go_repository" {
artifact, err := starlarkutil.GetArtifactFromGoRepository(x)
if err != nil {
return err
}
shas[artifact.URL] = artifact.Sha256
}
if fun == "go_download_sdk" {
if err := getShasFromGoDownloadSdkCall(x, shas); err != nil {
return err
Expand Down

0 comments on commit 6336800

Please sign in to comment.