From 6dbdf723bc50a81007b97d2a8fe439e8f216bb63 Mon Sep 17 00:00:00 2001 From: Yi Sun Date: Tue, 2 Jul 2019 16:52:18 +0800 Subject: [PATCH 1/3] Switch to http archive when downloading go package --- build_rules/github.bzl | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/build_rules/github.bzl b/build_rules/github.bzl index caa220a4..4a79ace5 100644 --- a/build_rules/github.bzl +++ b/build_rules/github.bzl @@ -70,7 +70,7 @@ def github_new_http_archive(name, package, build_file = None, build_file_content build_file_content = build_file_content, ) -def github_go_repository(name, package, importpath = "", commit = None, tag = None, sha256 = ""): +def github_go_repository(name, package, importpath = "", commit, tag, mirror_urls = [], **kwargs): """Adding go repository from github and convert it to bazel repository. Note that for now the dependencies will not be pulled in automatically. You @@ -87,18 +87,16 @@ def github_go_repository(name, package, importpath = "", commit = None, tag = No github.com/Shopify/sarama. commit: (string) Commit number. tag: (string) Commit tag. Exactly one of commit or tag is required. - importpath: (string) Optionally override the import path. - sha256: (string) Optional checksum. + mirror_urls: (list of string) Optional list of mirror URLs. This does not + have to include the github URL. """ - remote = "https://github.com/" + package if importpath == "": importpath = "github.com/" + package return go_repository( name = name, importpath = importpath, - remote = remote, - vcs = "git", - commit = commit, - tag = tag, + urls = [_github_tar_gz_url(package, commit, tag)] + mirror_urls, + strip_prefix = _tar_gz_prefix(package, commit, tag), sha256 = sha256, + **kwargs ) From a67133cdfe99494e6aedcd4733841f0b66e25d46 Mon Sep 17 00:00:00 2001 From: Yi Sun Date: Tue, 2 Jul 2019 16:55:13 +0800 Subject: [PATCH 2/3] Fix a problem --- build_rules/github.bzl | 1 - 1 file changed, 1 deletion(-) diff --git a/build_rules/github.bzl b/build_rules/github.bzl index 4a79ace5..accee2cd 100644 --- a/build_rules/github.bzl +++ b/build_rules/github.bzl @@ -97,6 +97,5 @@ def github_go_repository(name, package, importpath = "", commit, tag, mirror_url importpath = importpath, urls = [_github_tar_gz_url(package, commit, tag)] + mirror_urls, strip_prefix = _tar_gz_prefix(package, commit, tag), - sha256 = sha256, **kwargs ) From 5aa6fa35b4e1475bc946d4174ad91615f28c68f7 Mon Sep 17 00:00:00 2001 From: Yi Sun Date: Tue, 2 Jul 2019 16:57:42 +0800 Subject: [PATCH 3/3] Fix a typo --- build_rules/github.bzl | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/build_rules/github.bzl b/build_rules/github.bzl index accee2cd..989941f8 100644 --- a/build_rules/github.bzl +++ b/build_rules/github.bzl @@ -70,7 +70,14 @@ def github_new_http_archive(name, package, build_file = None, build_file_content build_file_content = build_file_content, ) -def github_go_repository(name, package, importpath = "", commit, tag, mirror_urls = [], **kwargs): +def github_go_repository( + name, + package, + importpath = "", + commit = None, + tag = None, + mirror_urls = [], + **kwargs): """Adding go repository from github and convert it to bazel repository. Note that for now the dependencies will not be pulled in automatically. You