diff --git a/Makefile b/Makefile index 698d69685..4c8720016 100644 --- a/Makefile +++ b/Makefile @@ -32,9 +32,6 @@ gazelle: # runs gazelle against the codebase to generate Bazel BUILD files bazel run //:gazelle -- update-repos -from_file=go.mod -prune -to_macro=dependencies.bzl%go_third_party bazel run //:gazelle - buildozer 'replace deps @com_github_golang_protobuf//ptypes:go_default_library_gen @com_github_golang_protobuf//ptypes:go_default_library' '//...:%go_library' - buildozer 'replace deps @io_bazel_rules_go//proto/wkt:duration_go_proto @com_github_golang_protobuf//ptypes/duration:go_default_library' '//...:%go_library' - buildozer 'replace deps @io_bazel_rules_go//proto/wkt:timestamp_go_proto @com_github_golang_protobuf//ptypes/timestamp:go_default_library' '//...:%go_library' .PHONY: lint lint: bin/golint bin/shadow diff --git a/bazel/dependency_imports.bzl b/bazel/dependency_imports.bzl index 237df236e..bdcf51b9a 100644 --- a/bazel/dependency_imports.bzl +++ b/bazel/dependency_imports.bzl @@ -18,7 +18,9 @@ def _pgv_pip_dependencies(): def _pgv_go_dependencies(): go_rules_dependencies() - go_register_toolchains() + go_register_toolchains( + version = "1.15.6", + ) gazelle_dependencies() def pgv_dependency_imports(): diff --git a/bazel/repositories.bzl b/bazel/repositories.bzl index eac44bd27..4831ae8e5 100644 --- a/bazel/repositories.bzl +++ b/bazel/repositories.bzl @@ -8,17 +8,21 @@ def pgv_dependencies(): if not native.existing_rule("io_bazel_rules_go"): http_archive( name = "io_bazel_rules_go", - sha256 = "608bb3e3788a21aa0653faaa6a3e00ddf806e26aa97a6f0d960ace2b2c958950", - strip_prefix = "rules_go-0.23.3", - urls = ["https://github.com/bazelbuild/rules_go/archive/v0.23.3.tar.gz"], + sha256 = "6f111c57fd50baf5b8ee9d63024874dd2a014b069426156c55adbf6d3d22cb7b", + urls = [ + "https://mirror.bazel.build/github.com/bazelbuild/rules_go/releases/download/v0.25.0/rules_go-v0.25.0.tar.gz", + "https://github.com/bazelbuild/rules_go/releases/download/v0.25.0/rules_go-v0.25.0.tar.gz", + ], ) if not native.existing_rule("bazel_gazelle"): http_archive( name = "bazel_gazelle", - sha256 = "2423201f91471ea87925b81962258e27a22cd8ebb4fe355bf033dcf2ad668541", - strip_prefix = "bazel-gazelle-0.21.1", - urls = ["https://github.com/bazelbuild/bazel-gazelle/archive/v0.21.1.tar.gz"], + sha256 = "b85f48fa105c4403326e9525ad2b2cc437babaa6e15a3fc0b1dbab0ab064bc7c", + urls = [ + "https://mirror.bazel.build/github.com/bazelbuild/bazel-gazelle/releases/download/v0.22.2/bazel-gazelle-v0.22.2.tar.gz", + "https://github.com/bazelbuild/bazel-gazelle/releases/download/v0.22.2/bazel-gazelle-v0.22.2.tar.gz", + ], ) if not native.existing_rule("com_google_protobuf"): diff --git a/dependencies.bzl b/dependencies.bzl index 2381a6577..10b38f36d 100644 --- a/dependencies.bzl +++ b/dependencies.bzl @@ -1,126 +1,6 @@ load("@bazel_gazelle//:deps.bzl", "go_repository") def go_third_party(): - go_repository( - name = "com_github_davecgh_go_spew", - importpath = "github.com/davecgh/go-spew", - sum = "h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8=", - version = "v1.1.0", - ) - go_repository( - name = "com_github_golang_protobuf", - importpath = "github.com/golang/protobuf", - sum = "h1:+Z5KGCizgyZCbGh1KZqA0fcLLkwbsjIzS4aV2v7wJX0=", - version = "v1.4.2", - ) - go_repository( - name = "com_github_iancoleman_strcase", - importpath = "github.com/iancoleman/strcase", - sum = "h1:ux/56T2xqZO/3cP1I2F86qpeoYPCOzk+KF/UH/Ar+lk=", - version = "v0.0.0-20180726023541-3605ed457bf7", - ) - go_repository( - name = "com_github_lyft_protoc_gen_star", - importpath = "github.com/lyft/protoc-gen-star", - sum = "h1:sImehRT+p7lW9n6R7MQc5hVgzWGEkDVZU4AsBQ4Isu8=", - version = "v0.5.1", - ) - go_repository( - name = "com_github_pmezard_go_difflib", - importpath = "github.com/pmezard/go-difflib", - sum = "h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=", - version = "v1.0.0", - ) - go_repository( - name = "com_github_spf13_afero", - importpath = "github.com/spf13/afero", - sum = "h1:8q6vk3hthlpb2SouZcnBVKboxWQWMDNF38bwholZrJc=", - version = "v1.3.4", - ) - go_repository( - name = "com_github_stretchr_objx", - importpath = "github.com/stretchr/objx", - sum = "h1:4G4v2dO3VZwixGIRoQ5Lfboy6nUhCyYzaqnIAPPhYs4=", - version = "v0.1.0", - ) - go_repository( - name = "com_github_stretchr_testify", - importpath = "github.com/stretchr/testify", - sum = "h1:hDPOHmpOpP40lSULcqw7IrRb/u7w6RpDC9399XyoNd0=", - version = "v1.6.1", - ) - go_repository( - name = "com_github_yuin_goldmark", - importpath = "github.com/yuin/goldmark", - sum = "h1:nqDD4MMMQA0lmWq03Z2/myGPYLQoXtmi0rGVs95ntbo=", - version = "v1.1.27", - ) - go_repository( - name = "in_gopkg_check_v1", - importpath = "gopkg.in/check.v1", - sum = "h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=", - version = "v0.0.0-20161208181325-20d25e280405", - ) - go_repository( - name = "in_gopkg_yaml_v2", - importpath = "gopkg.in/yaml.v2", - sum = "h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw=", - version = "v2.2.2", - ) - go_repository( - name = "org_golang_x_crypto", - importpath = "golang.org/x/crypto", - sum = "h1:ObdrDkeb4kJdCP557AjRjq69pTHfNouLtWZG7j9rPN8=", - version = "v0.0.0-20191011191535-87dc89f01550", - ) - go_repository( - name = "org_golang_x_lint", - importpath = "golang.org/x/lint", - sum = "h1:Wh+f8QHJXR411sJR8/vRBTZ7YapZaRvUcLFFJhusH0k=", - version = "v0.0.0-20200302205851-738671d3881b", - ) - go_repository( - name = "org_golang_x_mod", - importpath = "golang.org/x/mod", - sum = "h1:KU7oHjnv3XNWfa5COkzUifxZmxp1TyI7ImMXqFxLwvQ=", - version = "v0.2.0", - ) - go_repository( - name = "org_golang_x_net", - importpath = "golang.org/x/net", - sum = "h1:0mm1VjtFUOIlE1SbDlwjYaDxZVDP2S5ou6y0gSgXHu8=", - version = "v0.0.0-20200226121028-0de0cce0169b", - ) - go_repository( - name = "org_golang_x_sync", - importpath = "golang.org/x/sync", - sum = "h1:vcxGaoTs7kV8m5Np9uUNQin4BrLOthgV7252N8V+FwY=", - version = "v0.0.0-20190911185100-cd5d95a43a6e", - ) - go_repository( - name = "org_golang_x_sys", - importpath = "golang.org/x/sys", - sum = "h1:+R4KGOnez64A81RvjARKc4UT5/tI9ujCIVX+P5KiHuI=", - version = "v0.0.0-20190412213103-97732733099d", - ) - go_repository( - name = "org_golang_x_text", - importpath = "golang.org/x/text", - sum = "h1:cokOdA+Jmi5PJGXLlLllQSgYigAEfHXJAERHVMaCc2k=", - version = "v0.3.3", - ) - go_repository( - name = "org_golang_x_tools", - importpath = "golang.org/x/tools", - sum = "h1:SjQ2+AKWgZLc1xej6WSzL+Dfs5Uyd5xcZH1mGC411IA=", - version = "v0.0.0-20200522201501-cb1345f3a375", - ) - go_repository( - name = "org_golang_x_xerrors", - importpath = "golang.org/x/xerrors", - sum = "h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4=", - version = "v0.0.0-20191204190536-9bdfabe68543", - ) go_repository( name = "co_honnef_go_tools", importpath = "honnef.co/go/tools", @@ -145,6 +25,12 @@ def go_third_party(): sum = "h1:ta993UF76GwbvJcIo3Y68y/M3WxlpEHPWIGDkJYwzJI=", version = "v0.3.4", ) + go_repository( + name = "com_github_davecgh_go_spew", + importpath = "github.com/davecgh/go-spew", + sum = "h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8=", + version = "v1.1.0", + ) go_repository( name = "com_github_envoyproxy_go_control_plane", importpath = "github.com/envoyproxy/go-control-plane", @@ -163,18 +49,36 @@ def go_third_party(): sum = "h1:G5FRp8JnTd7RQH5kemVNlMeyXQAztQ3mOWV95KxsXH8=", version = "v1.1.1", ) + go_repository( + name = "com_github_golang_protobuf", + importpath = "github.com/golang/protobuf", + sum = "h1:+Z5KGCizgyZCbGh1KZqA0fcLLkwbsjIzS4aV2v7wJX0=", + version = "v1.4.2", + ) go_repository( name = "com_github_google_go_cmp", importpath = "github.com/google/go-cmp", sum = "h1:/QaMHBdZ26BB3SSst0Iwl10Epc+xhTquomWX0oZEB6w=", version = "v0.5.0", ) + go_repository( + name = "com_github_iancoleman_strcase", + importpath = "github.com/iancoleman/strcase", + sum = "h1:ux/56T2xqZO/3cP1I2F86qpeoYPCOzk+KF/UH/Ar+lk=", + version = "v0.0.0-20180726023541-3605ed457bf7", + ) go_repository( name = "com_github_kr_fs", importpath = "github.com/kr/fs", sum = "h1:Jskdu9ieNAYnjxsi0LbQp1ulIKZV1LAFgK1tWhpZgl8=", version = "v0.1.0", ) + go_repository( + name = "com_github_lyft_protoc_gen_star", + importpath = "github.com/lyft/protoc-gen-star", + sum = "h1:sImehRT+p7lW9n6R7MQc5hVgzWGEkDVZU4AsBQ4Isu8=", + version = "v0.5.1", + ) go_repository( name = "com_github_pkg_errors", importpath = "github.com/pkg/errors", @@ -187,18 +91,60 @@ def go_third_party(): sum = "h1:VasscCm72135zRysgrJDKsntdmPN+OuU3+nnHYA9wyc=", version = "v1.10.1", ) + go_repository( + name = "com_github_pmezard_go_difflib", + importpath = "github.com/pmezard/go-difflib", + sum = "h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=", + version = "v1.0.0", + ) go_repository( name = "com_github_prometheus_client_model", importpath = "github.com/prometheus/client_model", sum = "h1:gQz4mCbXsO+nc9n1hCxHcGA3Zx3Eo+UHZoInFGUIXNM=", version = "v0.0.0-20190812154241-14fe0d1b01d4", ) + go_repository( + name = "com_github_spf13_afero", + importpath = "github.com/spf13/afero", + sum = "h1:8q6vk3hthlpb2SouZcnBVKboxWQWMDNF38bwholZrJc=", + version = "v1.3.4", + ) + go_repository( + name = "com_github_stretchr_objx", + importpath = "github.com/stretchr/objx", + sum = "h1:4G4v2dO3VZwixGIRoQ5Lfboy6nUhCyYzaqnIAPPhYs4=", + version = "v0.1.0", + ) + go_repository( + name = "com_github_stretchr_testify", + importpath = "github.com/stretchr/testify", + sum = "h1:hDPOHmpOpP40lSULcqw7IrRb/u7w6RpDC9399XyoNd0=", + version = "v1.6.1", + ) + go_repository( + name = "com_github_yuin_goldmark", + importpath = "github.com/yuin/goldmark", + sum = "h1:nqDD4MMMQA0lmWq03Z2/myGPYLQoXtmi0rGVs95ntbo=", + version = "v1.1.27", + ) go_repository( name = "com_google_cloud_go", importpath = "cloud.google.com/go", sum = "h1:e0WKqKTd5BnrG8aKH3J3h+QvEIQtSUcf2n5UZ5ZgLtQ=", version = "v0.26.0", ) + go_repository( + name = "in_gopkg_check_v1", + importpath = "gopkg.in/check.v1", + sum = "h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=", + version = "v0.0.0-20161208181325-20d25e280405", + ) + go_repository( + name = "in_gopkg_yaml_v2", + importpath = "gopkg.in/yaml.v2", + sum = "h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw=", + version = "v2.2.2", + ) go_repository( name = "in_gopkg_yaml_v3", importpath = "gopkg.in/yaml.v3", @@ -229,15 +175,69 @@ def go_third_party(): sum = "h1:Ejskq+SyPohKW+1uil0JJMtmHCgJPJ/qWTxr8qp+R4c=", version = "v1.25.0", ) + go_repository( + name = "org_golang_x_crypto", + importpath = "golang.org/x/crypto", + sum = "h1:ObdrDkeb4kJdCP557AjRjq69pTHfNouLtWZG7j9rPN8=", + version = "v0.0.0-20191011191535-87dc89f01550", + ) go_repository( name = "org_golang_x_exp", importpath = "golang.org/x/exp", sum = "h1:c2HOrn5iMezYjSlGPncknSEr/8x5LELb/ilJbXi9DEA=", version = "v0.0.0-20190121172915-509febef88a4", ) + go_repository( + name = "org_golang_x_lint", + importpath = "golang.org/x/lint", + sum = "h1:Wh+f8QHJXR411sJR8/vRBTZ7YapZaRvUcLFFJhusH0k=", + version = "v0.0.0-20200302205851-738671d3881b", + ) + go_repository( + name = "org_golang_x_mod", + importpath = "golang.org/x/mod", + sum = "h1:KU7oHjnv3XNWfa5COkzUifxZmxp1TyI7ImMXqFxLwvQ=", + version = "v0.2.0", + ) + go_repository( + name = "org_golang_x_net", + importpath = "golang.org/x/net", + sum = "h1:0mm1VjtFUOIlE1SbDlwjYaDxZVDP2S5ou6y0gSgXHu8=", + version = "v0.0.0-20200226121028-0de0cce0169b", + ) go_repository( name = "org_golang_x_oauth2", importpath = "golang.org/x/oauth2", sum = "h1:vEDujvNQGv4jgYKudGeI/+DAX4Jffq6hpD55MmoEvKs=", version = "v0.0.0-20180821212333-d2e6202438be", ) + go_repository( + name = "org_golang_x_sync", + importpath = "golang.org/x/sync", + sum = "h1:vcxGaoTs7kV8m5Np9uUNQin4BrLOthgV7252N8V+FwY=", + version = "v0.0.0-20190911185100-cd5d95a43a6e", + ) + go_repository( + name = "org_golang_x_sys", + importpath = "golang.org/x/sys", + sum = "h1:+R4KGOnez64A81RvjARKc4UT5/tI9ujCIVX+P5KiHuI=", + version = "v0.0.0-20190412213103-97732733099d", + ) + go_repository( + name = "org_golang_x_text", + importpath = "golang.org/x/text", + sum = "h1:cokOdA+Jmi5PJGXLlLllQSgYigAEfHXJAERHVMaCc2k=", + version = "v0.3.3", + ) + go_repository( + name = "org_golang_x_tools", + importpath = "golang.org/x/tools", + sum = "h1:SjQ2+AKWgZLc1xej6WSzL+Dfs5Uyd5xcZH1mGC411IA=", + version = "v0.0.0-20200522201501-cb1345f3a375", + ) + go_repository( + name = "org_golang_x_xerrors", + importpath = "golang.org/x/xerrors", + sum = "h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4=", + version = "v0.0.0-20191204190536-9bdfabe68543", + ) diff --git a/tests/generation/multi_file_java_test/BUILD b/tests/generation/multi_file_java_test/BUILD index 16e2c46bc..049a9d1ac 100644 --- a/tests/generation/multi_file_java_test/BUILD +++ b/tests/generation/multi_file_java_test/BUILD @@ -5,6 +5,8 @@ load( "pgv_cc_proto_library", ) +# gazelle:go_generate_proto false + proto_library( name = "test_proto", srcs = ["test.proto"], diff --git a/tests/harness/BUILD b/tests/harness/BUILD index 8452c1a9e..18d008c8d 100644 --- a/tests/harness/BUILD +++ b/tests/harness/BUILD @@ -2,9 +2,6 @@ load("@io_bazel_rules_go//go:def.bzl", "go_library") load("@rules_cc//cc:defs.bzl", "cc_proto_library") load("@rules_java//java:defs.bzl", "java_proto_library") load("@rules_proto//proto:defs.bzl", "proto_library") - -# gazelle:exclude harness.pb.go - load("@com_google_protobuf//:protobuf.bzl", "py_proto_library") load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library") diff --git a/tests/harness/cases/BUILD b/tests/harness/cases/BUILD index 40f0d93b0..8ad8fca89 100644 --- a/tests/harness/cases/BUILD +++ b/tests/harness/cases/BUILD @@ -8,6 +8,8 @@ load( "pgv_python_proto_library", ) +# gazelle:go_generate_proto false + proto_library( name = "cases_proto", srcs = [ @@ -44,11 +46,7 @@ pgv_go_proto_library( proto = ":cases_proto", deps = [ "//tests/harness/cases/other_package:go", - "@com_github_golang_protobuf//ptypes:go_default_library", - "@com_github_golang_protobuf//ptypes/any:go_default_library", - "@com_github_golang_protobuf//ptypes/duration:go_default_library", - "@com_github_golang_protobuf//ptypes/timestamp:go_default_library", - "@com_github_golang_protobuf//ptypes/wrappers:go_default_library", + "@com_github_golang_protobuf//ptypes:go_default_library_gen", ], ) diff --git a/tests/harness/cases/other_package/BUILD b/tests/harness/cases/other_package/BUILD index 3a11fbaa2..bd20d55b4 100644 --- a/tests/harness/cases/other_package/BUILD +++ b/tests/harness/cases/other_package/BUILD @@ -1,6 +1,5 @@ load("@rules_java//java:defs.bzl", "java_proto_library") -# gazelle:exclude go load("@io_bazel_rules_go//go:def.bzl", "go_library") load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library") load("@rules_proto//proto:defs.bzl", "proto_library") @@ -26,7 +25,7 @@ pgv_go_proto_library( importpath = "github.com/envoyproxy/protoc-gen-validate/tests/harness/cases/other_package/go", proto = ":embed_proto", deps = [ - "@com_github_golang_protobuf//ptypes:go_default_library", + "@com_github_golang_protobuf//ptypes:go_default_library_gen", ], ) diff --git a/tests/harness/executor/BUILD b/tests/harness/executor/BUILD index ddc3970a7..568aa5e3d 100644 --- a/tests/harness/executor/BUILD +++ b/tests/harness/executor/BUILD @@ -20,10 +20,10 @@ go_library( "//tests/harness/cases:go", "//tests/harness/cases/other_package:go", "@com_github_golang_protobuf//proto:go_default_library", - "@com_github_golang_protobuf//ptypes:go_default_library", - "@com_github_golang_protobuf//ptypes/duration:go_default_library", - "@com_github_golang_protobuf//ptypes/timestamp:go_default_library", + "@com_github_golang_protobuf//ptypes:go_default_library_gen", "@io_bazel_rules_go//proto/wkt:any_go_proto", + "@io_bazel_rules_go//proto/wkt:duration_go_proto", + "@io_bazel_rules_go//proto/wkt:timestamp_go_proto", "@io_bazel_rules_go//proto/wkt:wrappers_go_proto", "@org_golang_x_net//context:go_default_library", ], diff --git a/tests/harness/go/main/BUILD b/tests/harness/go/main/BUILD index d3458786c..b58131e96 100644 --- a/tests/harness/go/main/BUILD +++ b/tests/harness/go/main/BUILD @@ -10,7 +10,7 @@ go_library( "//tests/harness/cases:go", "//tests/harness/cases/other_package:go", "@com_github_golang_protobuf//proto:go_default_library", - "@com_github_golang_protobuf//ptypes:go_default_library", + "@com_github_golang_protobuf//ptypes:go_default_library_gen", ], ) diff --git a/validate/BUILD b/validate/BUILD index 187a58c15..c33605400 100644 --- a/validate/BUILD +++ b/validate/BUILD @@ -1,5 +1,3 @@ -# gazelle:exclude validate.pb.go - load("@com_google_protobuf//:protobuf.bzl", "py_proto_library") load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library") load("@rules_cc//cc:defs.bzl", "cc_library", "cc_proto_library")