From 751dd847b8757801756aba4f472a43792ecf976b Mon Sep 17 00:00:00 2001 From: Preston Van Loon Date: Fri, 11 Aug 2023 11:39:35 -0500 Subject: [PATCH] Update rules go & gazelle (#12721) * Update rules_go to v0.40.0 * Update gazelle to v0.26.0 * Update gazelle to v0.27.0 * Update gazelle to v0.28.0 * Update gazelle to v0.29.0 * Update gazelle to v0.30.0 * Update gazelle to v0.31.0 --- BUILD.bazel | 2 +- WORKSPACE | 23 ++--- build/bazel/BUILD.bazel | 1 - config/fieldparams/BUILD.bazel | 1 - config/params/BUILD.bazel | 2 +- crypto/bls/blst/BUILD.bazel | 156 ++++++++++++++++++++++++++--- deps.bzl | 22 ++-- encoding/ssz/htrutils_fuzz_test.go | 2 +- nogo_config.json | 3 +- 9 files changed, 163 insertions(+), 49 deletions(-) diff --git a/BUILD.bazel b/BUILD.bazel index 3aa08378470c..a11d68cf44f2 100644 --- a/BUILD.bazel +++ b/BUILD.bazel @@ -133,8 +133,8 @@ nogo( # nogo checks that fail with coverage enabled. ":coverage_enabled": [], "//conditions:default": [ - "@org_golang_x_tools//go/analysis/passes/lostcancel:go_default_library", "@org_golang_x_tools//go/analysis/passes/composite:go_default_library", + "@org_golang_x_tools//go/analysis/passes/lostcancel:go_default_library", ], }), ) diff --git a/WORKSPACE b/WORKSPACE index fc4df44dcad8..094d5f9fbe93 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -67,10 +67,10 @@ bazel_skylib_workspace() http_archive( name = "bazel_gazelle", - sha256 = "5982e5463f171da99e3bdaeff8c0f48283a7a5f396ec5282910b9e8a49c0dd7e", + sha256 = "29d5dafc2a5582995488c6735115d1d366fcd6a0fc2e2a153f02988706349825", urls = [ - "https://mirror.bazel.build/github.com/bazelbuild/bazel-gazelle/releases/download/v0.25.0/bazel-gazelle-v0.25.0.tar.gz", - "https://github.com/bazelbuild/bazel-gazelle/releases/download/v0.25.0/bazel-gazelle-v0.25.0.tar.gz", + "https://mirror.bazel.build/github.com/bazelbuild/bazel-gazelle/releases/download/v0.31.0/bazel-gazelle-v0.31.0.tar.gz", + "https://github.com/bazelbuild/bazel-gazelle/releases/download/v0.31.0/bazel-gazelle-v0.31.0.tar.gz", ], ) @@ -94,10 +94,10 @@ http_archive( # Expose internals of go_test for custom build transitions. "//third_party:io_bazel_rules_go_test.patch", ], - sha256 = "6b65cb7917b4d1709f9410ffe00ecf3e160edf674b78c54a894471320862184f", + sha256 = "bfc5ce70b9d1634ae54f4e7b495657a18a04e0d596785f672d35d5f505ab491a", urls = [ - "https://mirror.bazel.build/github.com/bazelbuild/rules_go/releases/download/v0.39.0/rules_go-v0.39.0.zip", - "https://github.com/bazelbuild/rules_go/releases/download/v0.39.0/rules_go-v0.39.0.zip", + "https://mirror.bazel.build/github.com/bazelbuild/rules_go/releases/download/v0.40.0/rules_go-v0.40.0.zip", + "https://github.com/bazelbuild/rules_go/releases/download/v0.40.0/rules_go-v0.40.0.zip", ], ) @@ -312,13 +312,6 @@ filegroup( url = "https://github.com/eth-clients/eth2-networks/archive/7b4897888cebef23801540236f73123e21774954.tar.gz", ) -http_archive( - name = "com_github_bazelbuild_buildtools", - sha256 = "7a182df18df1debabd9e36ae07c8edfa1378b8424a04561b674d933b965372b3", - strip_prefix = "buildtools-f2aed9ee205d62d45c55cfabbfd26342f8526862", - url = "https://github.com/bazelbuild/buildtools/archive/f2aed9ee205d62d45c55cfabbfd26342f8526862.zip", -) - http_archive( name = "com_google_protobuf", sha256 = "4e176116949be52b0408dfd24f8925d1eb674a781ae242a75296b17a1c721395", @@ -391,10 +384,6 @@ load("@bazel_gazelle//:deps.bzl", "gazelle_dependencies") gazelle_dependencies() -load("@com_github_bazelbuild_buildtools//buildifier:deps.bzl", "buildifier_dependencies") - -buildifier_dependencies() - load("@com_google_protobuf//:protobuf_deps.bzl", "protobuf_deps") protobuf_deps() diff --git a/build/bazel/BUILD.bazel b/build/bazel/BUILD.bazel index 31be278fbd53..1a6de144b2cb 100644 --- a/build/bazel/BUILD.bazel +++ b/build/bazel/BUILD.bazel @@ -6,7 +6,6 @@ go_library( srcs = [ "bazel.go", "data_path.go", - "non_bazel.go", ], importpath = "github.com/prysmaticlabs/prysm/v4/build/bazel", visibility = ["//visibility:public"], diff --git a/config/fieldparams/BUILD.bazel b/config/fieldparams/BUILD.bazel index 1e0d2af074cb..a1012c8ee79b 100644 --- a/config/fieldparams/BUILD.bazel +++ b/config/fieldparams/BUILD.bazel @@ -15,7 +15,6 @@ go_test( srcs = [ "common_test.go", "mainnet_test.go", - "minimal_test.go", ], deps = [ ":go_default_library", diff --git a/config/params/BUILD.bazel b/config/params/BUILD.bazel index be0854db9df5..064c16c6a868 100644 --- a/config/params/BUILD.bazel +++ b/config/params/BUILD.bazel @@ -49,11 +49,11 @@ go_test( "testnet_prater_config_test.go", ], data = glob(["*.yaml"]) + [ + "testdata/e2e_config.yaml", "@consensus_spec//:spec_data", "@consensus_spec_tests_mainnet//:test_data", "@consensus_spec_tests_minimal//:test_data", "@eth2_networks//:configs", - "testdata/e2e_config.yaml", ], embed = [":go_default_library"], gotags = ["develop"], diff --git a/crypto/bls/blst/BUILD.bazel b/crypto/bls/blst/BUILD.bazel index c470ed730111..9c7b69d371ba 100644 --- a/crypto/bls/blst/BUILD.bazel +++ b/crypto/bls/blst/BUILD.bazel @@ -16,15 +16,90 @@ go_library( ], importpath = "github.com/prysmaticlabs/prysm/v4/crypto/bls/blst", visibility = ["//visibility:public"], - deps = [ - "//cache/nonblocking:go_default_library", - "//config/fieldparams:go_default_library", - "//config/params:go_default_library", - "//crypto/bls/common:go_default_library", - "//crypto/rand:go_default_library", - "@com_github_pkg_errors//:go_default_library", - "@com_github_supranational_blst//:go_default_library", - ], + deps = select({ + "@io_bazel_rules_go//go/platform:android_amd64": [ + "//cache/nonblocking:go_default_library", + "//config/fieldparams:go_default_library", + "//config/params:go_default_library", + "//crypto/bls/common:go_default_library", + "//crypto/rand:go_default_library", + "@com_github_pkg_errors//:go_default_library", + "@com_github_supranational_blst//:go_default_library", + ], + "@io_bazel_rules_go//go/platform:android_arm64": [ + "//cache/nonblocking:go_default_library", + "//config/fieldparams:go_default_library", + "//config/params:go_default_library", + "//crypto/bls/common:go_default_library", + "//crypto/rand:go_default_library", + "@com_github_pkg_errors//:go_default_library", + "@com_github_supranational_blst//:go_default_library", + ], + "@io_bazel_rules_go//go/platform:darwin_amd64": [ + "//cache/nonblocking:go_default_library", + "//config/fieldparams:go_default_library", + "//config/params:go_default_library", + "//crypto/bls/common:go_default_library", + "//crypto/rand:go_default_library", + "@com_github_pkg_errors//:go_default_library", + "@com_github_supranational_blst//:go_default_library", + ], + "@io_bazel_rules_go//go/platform:darwin_arm64": [ + "//cache/nonblocking:go_default_library", + "//config/fieldparams:go_default_library", + "//config/params:go_default_library", + "//crypto/bls/common:go_default_library", + "//crypto/rand:go_default_library", + "@com_github_pkg_errors//:go_default_library", + "@com_github_supranational_blst//:go_default_library", + ], + "@io_bazel_rules_go//go/platform:ios_amd64": [ + "//cache/nonblocking:go_default_library", + "//config/fieldparams:go_default_library", + "//config/params:go_default_library", + "//crypto/bls/common:go_default_library", + "//crypto/rand:go_default_library", + "@com_github_pkg_errors//:go_default_library", + "@com_github_supranational_blst//:go_default_library", + ], + "@io_bazel_rules_go//go/platform:ios_arm64": [ + "//cache/nonblocking:go_default_library", + "//config/fieldparams:go_default_library", + "//config/params:go_default_library", + "//crypto/bls/common:go_default_library", + "//crypto/rand:go_default_library", + "@com_github_pkg_errors//:go_default_library", + "@com_github_supranational_blst//:go_default_library", + ], + "@io_bazel_rules_go//go/platform:linux_amd64": [ + "//cache/nonblocking:go_default_library", + "//config/fieldparams:go_default_library", + "//config/params:go_default_library", + "//crypto/bls/common:go_default_library", + "//crypto/rand:go_default_library", + "@com_github_pkg_errors//:go_default_library", + "@com_github_supranational_blst//:go_default_library", + ], + "@io_bazel_rules_go//go/platform:linux_arm64": [ + "//cache/nonblocking:go_default_library", + "//config/fieldparams:go_default_library", + "//config/params:go_default_library", + "//crypto/bls/common:go_default_library", + "//crypto/rand:go_default_library", + "@com_github_pkg_errors//:go_default_library", + "@com_github_supranational_blst//:go_default_library", + ], + "@io_bazel_rules_go//go/platform:windows_amd64": [ + "//cache/nonblocking:go_default_library", + "//config/fieldparams:go_default_library", + "//config/params:go_default_library", + "//crypto/bls/common:go_default_library", + "//crypto/rand:go_default_library", + "@com_github_pkg_errors//:go_default_library", + "@com_github_supranational_blst//:go_default_library", + ], + "//conditions:default": [], + }), ) go_test( @@ -37,10 +112,61 @@ go_test( "test_helper_test.go", ], embed = [":go_default_library"], - deps = [ - "//crypto/bls/common:go_default_library", - "//encoding/bytesutil:go_default_library", - "//testing/assert:go_default_library", - "//testing/require:go_default_library", - ], + deps = select({ + "@io_bazel_rules_go//go/platform:android_amd64": [ + "//crypto/bls/common:go_default_library", + "//encoding/bytesutil:go_default_library", + "//testing/assert:go_default_library", + "//testing/require:go_default_library", + ], + "@io_bazel_rules_go//go/platform:android_arm64": [ + "//crypto/bls/common:go_default_library", + "//encoding/bytesutil:go_default_library", + "//testing/assert:go_default_library", + "//testing/require:go_default_library", + ], + "@io_bazel_rules_go//go/platform:darwin_amd64": [ + "//crypto/bls/common:go_default_library", + "//encoding/bytesutil:go_default_library", + "//testing/assert:go_default_library", + "//testing/require:go_default_library", + ], + "@io_bazel_rules_go//go/platform:darwin_arm64": [ + "//crypto/bls/common:go_default_library", + "//encoding/bytesutil:go_default_library", + "//testing/assert:go_default_library", + "//testing/require:go_default_library", + ], + "@io_bazel_rules_go//go/platform:ios_amd64": [ + "//crypto/bls/common:go_default_library", + "//encoding/bytesutil:go_default_library", + "//testing/assert:go_default_library", + "//testing/require:go_default_library", + ], + "@io_bazel_rules_go//go/platform:ios_arm64": [ + "//crypto/bls/common:go_default_library", + "//encoding/bytesutil:go_default_library", + "//testing/assert:go_default_library", + "//testing/require:go_default_library", + ], + "@io_bazel_rules_go//go/platform:linux_amd64": [ + "//crypto/bls/common:go_default_library", + "//encoding/bytesutil:go_default_library", + "//testing/assert:go_default_library", + "//testing/require:go_default_library", + ], + "@io_bazel_rules_go//go/platform:linux_arm64": [ + "//crypto/bls/common:go_default_library", + "//encoding/bytesutil:go_default_library", + "//testing/assert:go_default_library", + "//testing/require:go_default_library", + ], + "@io_bazel_rules_go//go/platform:windows_amd64": [ + "//crypto/bls/common:go_default_library", + "//encoding/bytesutil:go_default_library", + "//testing/assert:go_default_library", + "//testing/require:go_default_library", + ], + "//conditions:default": [], + }), ) diff --git a/deps.bzl b/deps.bzl index bdaacda7a8c1..98450a5e8014 100644 --- a/deps.bzl +++ b/deps.bzl @@ -1,6 +1,6 @@ -load("@prysm//tools/go:def.bzl", "go_repository", "maybe") # gazelle:keep -load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") # gazelle:keep load("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository") +load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") # gazelle:keep +load("@prysm//tools/go:def.bzl", "go_repository", "maybe") # gazelle:keep # Prysm's third party / external dependencies. # @@ -3876,15 +3876,6 @@ def prysm_deps(): version = "v1.2.0", ) - http_archive( - name = "com_github_supranational_blst", - urls = [ - "https://github.com/supranational/blst/archive/3dd0f804b1819e5d03fb22ca2e6fac105932043a.tar.gz", - ], - strip_prefix = "blst-3dd0f804b1819e5d03fb22ca2e6fac105932043a", - build_file = "//third_party:blst/blst.BUILD", - sha256 = "132124c074e59ead77e1828cc54b587a182ea67b781b72198e802af4696d78fe", - ) go_repository( name = "com_github_syndtr_goleveldb", importpath = "github.com/syndtr/goleveldb", @@ -5607,3 +5598,12 @@ def prysm_deps(): sum = "h1:FiJd5l1UOLj0wCgbSE0rwwXHzEdAZS6hiiSnxJN/D60=", version = "v1.24.0", ) + http_archive( + name = "com_github_supranational_blst", + urls = [ + "https://github.com/supranational/blst/archive/3dd0f804b1819e5d03fb22ca2e6fac105932043a.tar.gz", + ], + strip_prefix = "blst-3dd0f804b1819e5d03fb22ca2e6fac105932043a", + build_file = "//third_party:blst/blst.BUILD", + sha256 = "132124c074e59ead77e1828cc54b587a182ea67b781b72198e802af4696d78fe", + ) diff --git a/encoding/ssz/htrutils_fuzz_test.go b/encoding/ssz/htrutils_fuzz_test.go index f72a5e83df80..86db084a6605 100644 --- a/encoding/ssz/htrutils_fuzz_test.go +++ b/encoding/ssz/htrutils_fuzz_test.go @@ -1,4 +1,4 @@ -//go:build fuzz && go1.18 +//go:build go1.18 package ssz_test diff --git a/nogo_config.json b/nogo_config.json index 282523f08719..8ed38bf9c8cb 100644 --- a/nogo_config.json +++ b/nogo_config.json @@ -94,7 +94,8 @@ }, "logruswitherror": { "exclude_files": { - "external/.*": "Third party code" + "external/.*": "Third party code", + ".*/testmain.go": "Generated/test code" } }, "cryptorand": {