Skip to content
This repository has been archived by the owner on Aug 30, 2022. It is now read-only.

Update rules_go to 0.16.2. #95

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion BUILD
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
load("@io_bazel_rules_go//go:def.bzl", "gazelle")
load("@bazel_gazelle//:def.bzl", "gazelle")

package_group(
name = "internal",
Expand Down
14 changes: 12 additions & 2 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,14 @@ load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")

http_archive(
name = "io_bazel_rules_go",
sha256 = "ba79c532ac400cefd1859cbc8a9829346aa69e3b99482cd5a54432092cbc3933",
urls = ["https://github.com/bazelbuild/rules_go/releases/download/0.13.0/rules_go-0.13.0.tar.gz"],
sha256 = "f87fa87475ea107b3c69196f39c82b7bbf58fe27c62a338684c20ca17d1d8613",
url = "https://github.com/bazelbuild/rules_go/releases/download/0.16.2/rules_go-0.16.2.tar.gz",
)

http_archive(
name = "bazel_gazelle",
sha256 = "6e875ab4b6bf64a38c352887760f21203ab054676d9c1b274963907e0768740d",
urls = ["https://github.com/bazelbuild/bazel-gazelle/releases/download/0.15.0/bazel-gazelle-0.15.0.tar.gz"],
)

load("@io_bazel_rules_go//go:def.bzl", "go_register_toolchains", "go_rules_dependencies")
Expand All @@ -70,6 +76,10 @@ go_rules_dependencies()

go_register_toolchains()

load("@bazel_gazelle//:deps.bzl", "gazelle_dependencies")

gazelle_dependencies()

#### Use remote resources

## java
Expand Down
2 changes: 1 addition & 1 deletion bazel_integration_test.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ load(
)
load(
"//tools:repositories.bzl",
"bazel_binary",
"bazel_binaries",
"bazel_binary",
)
load(
"//tools:bazel_java_integration_test.bzl",
Expand Down
66 changes: 34 additions & 32 deletions go/bazel_integration_test.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -18,38 +18,40 @@ load("//tools:repositories.bzl", "bazel_binaries")
load("@io_bazel_rules_go//go:def.bzl", "go_test")

def _make_compatible_version_list():
toReturn = []
for v in BAZEL_VERSIONS:
major, minor, patch = v.split(".")
if int(major) == 0 and int(minor) >= 7:
toReturn.append("%s.%s.%s" % (major, minor, patch))
return toReturn
toReturn = []
for v in BAZEL_VERSIONS:
major, minor, patch = v.split(".")
if int(major) == 0 and int(minor) >= 7:
toReturn.append("%s.%s.%s" % (major, minor, patch))
return toReturn

RULES_GO_COMPATIBLE_BAZEL_VERSION = _make_compatible_version_list()

def bazel_go_integration_test(name,
srcs,
deps = [],
data = [],
versions = RULES_GO_COMPATIBLE_BAZEL_VERSION,
**kwargs):
"""A wrapper around go_test that create several go tests, one per version
of Bazel.

Args:
versions: list of version of bazel to create a test for. Each test
will be named `<name>/bazel<version>`.
See go_test for the other arguments.
"""
for version in versions:
go_test(
name = "%s/bazel%s" % (name, version),
srcs = srcs,
deps = deps,
data = [
"@build_bazel_bazel_%s//:bazel_binary" % version.replace(".", "_"),
] + data,
x_defs = {
"github.com/bazelbuild/bazel-integration-testing/go.BazelVersion": version,
},
**kwargs)
def bazel_go_integration_test(
name,
srcs,
deps = [],
data = [],
versions = RULES_GO_COMPATIBLE_BAZEL_VERSION,
**kwargs):
"""A wrapper around go_test that create several go tests, one per version
of Bazel.

Args:
versions: list of version of bazel to create a test for. Each test
will be named `<name>/bazel<version>`.
See go_test for the other arguments.
"""
for version in versions:
go_test(
name = "%s/bazel%s" % (name, version),
srcs = srcs,
deps = deps,
data = [
"@build_bazel_bazel_%s//:bazel_binary" % version.replace(".", "_"),
] + data,
x_defs = {
"github.com/bazelbuild/bazel-integration-testing/go.BazelVersion": version,
},
**kwargs
)
86 changes: 45 additions & 41 deletions private/format.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -25,18 +25,19 @@ load(
)

def _com_github_google_yapf_repository_impl(rctx):
rctx.download_and_extract(
url = "https://github.com/google/yapf/archive/v0.21.0.tar.gz",
sha256 = "b930c1bc8233a9944671db7bdd6c9dc9ba2343b08b726a2dd0bff37ce1815baa",
stripPrefix = "yapf-0.21.0")
rctx.file("BUILD", """
rctx.download_and_extract(
url = "https://github.com/google/yapf/archive/v0.21.0.tar.gz",
sha256 = "b930c1bc8233a9944671db7bdd6c9dc9ba2343b08b726a2dd0bff37ce1815baa",
stripPrefix = "yapf-0.21.0",
)
rctx.file("BUILD", """
alias(
name="yapf",
actual="//yapf:yapf",
visibility = ["//visibility:public"],
)
""")
rctx.file("yapf/BUILD", """
rctx.file("yapf/BUILD", """
py_binary(
name="yapf",
srcs=glob(["**/*.py"]),
Expand All @@ -50,42 +51,45 @@ _com_github_google_yapf_repository = repository_rule(
)

def format_repositories():
_com_github_google_yapf_repository(name = "com_github_google_yapf")
_com_github_google_yapf_repository(name = "com_github_google_yapf")

http_archive(
name = "io_bazel",
urls = [
"https://github.com/bazelbuild/bazel/releases/download/0.17.1/bazel-0.17.1-dist.zip"
],
sha256 = (
"23e4281c3628cbd746da3f51330109bbf69780bd64461b63b386efae37203f20"),
)
http_archive(
name = "io_bazel",
urls = [
"https://github.com/bazelbuild/bazel/releases/download/0.17.1/bazel-0.17.1-dist.zip",
],
sha256 = (
"23e4281c3628cbd746da3f51330109bbf69780bd64461b63b386efae37203f20"
),
)

java_import_external(
name = "google_java_format",
licenses = ["notice"], # Apache 2.0
jar_urls = [
"https://github.com/google/google-java-format/releases/download/google-java-format-1.5/google-java-format-1.5-all-deps.jar"
],
jar_sha256 = ("7b839bb7534a173f0ed0cd0e9a583181d20850fcec8cf6e3800e4420a1fad184"),
)
java_import_external(
name = "google_java_format",
licenses = ["notice"], # Apache 2.0
jar_urls = [
"https://github.com/google/google-java-format/releases/download/google-java-format-1.5/google-java-format-1.5-all-deps.jar",
],
jar_sha256 = ("7b839bb7534a173f0ed0cd0e9a583181d20850fcec8cf6e3800e4420a1fad184"),
)

http_file(
name = "io_bazel_buildifier_linux",
urls = [
"https://github.com/bazelbuild/buildtools/releases/download/0.15.0/buildifier"
],
sha256 = (
"0dea01a7a511797878f486e6ed8e549980c0710a0a116c8ee953d4e26de41515"),
executable = True,
)
http_file(
name = "io_bazel_buildifier_linux",
urls = [
"https://github.com/bazelbuild/buildtools/releases/download/0.17.2/buildifier",
],
sha256 = (
"1cf35c463944003ceb3c3716d7fc489d3d70625e34a8127dfd8b272afad7e0fd"
),
executable = True,
)

http_file(
name = "io_bazel_buildifier_darwin",
urls = [
"https://github.com/bazelbuild/buildtools/releases/download/0.15.0/buildifier.osx"
],
sha256 = (
"860378a2badba9517e523e20f152ef1ca16234e0ca462a1d71e5dbee7d506771"),
executable = True,
)
http_file(
name = "io_bazel_buildifier_darwin",
urls = [
"https://github.com/bazelbuild/buildtools/releases/download/0.17.2/buildifier.osx",
],
sha256 = (
"66a569152bf59a527000941758a25f1dd03d6e26302d7982fd8aee25e552a10c"
),
executable = True,
)
Loading