From 40b611948765a4b55000ca3dc524526f300b60b9 Mon Sep 17 00:00:00 2001 From: Mican Zhang Date: Wed, 8 Jan 2020 14:53:22 +0800 Subject: [PATCH 1/5] build_rules: debug rules_go --- build_rules/init_go.bzl | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/build_rules/init_go.bzl b/build_rules/init_go.bzl index e0183c64..f1da5ded 100644 --- a/build_rules/init_go.bzl +++ b/build_rules/init_go.bzl @@ -6,7 +6,7 @@ def init_go(): # go_prefix, which requires us to rework ALL the repositories. http_archive( name = "io_bazel_rules_go", - url = "https://github.com/lingochamp/rules_go/archive/d8f26fc6e707e951e9069790fc2098420fc9b82d.tar.gz", - sha256 = "b7d50d95a9252c69f850af79caf4adc84a654a8a8e24c281cd8fd61e49fa67dc", - strip_prefix = "rules_go-d8f26fc6e707e951e9069790fc2098420fc9b82d", + url = "https://github.com/lingochamp/rules_go/archive/3b8b931a870ed93477e92e089e358c48deaa3836.tar.gz", + #sha256 = "b7d50d95a9252c69f850af79caf4adc84a654a8a8e24c281cd8fd61e49fa67dc", + #strip_prefix = "rules_go-3b8b931a870ed93477e92e089e358c48deaa3836", ) From 9ce1dd25058bd9af3b7dbe0ac31c6e7e25feb381 Mon Sep 17 00:00:00 2001 From: Yi Sun Date: Tue, 2 Jul 2019 16:57:42 +0800 Subject: [PATCH 2/5] 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 caa220a4..70c4f548 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 = None, tag = None, sha256 = ""): +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 From db70f7b90a6b50e3fa6694228ee6da61beb03a7d Mon Sep 17 00:00:00 2001 From: Yi Sun Date: Tue, 2 Jul 2019 16:55:13 +0800 Subject: [PATCH 3/5] Fix a problem --- build_rules/github.bzl | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/build_rules/github.bzl b/build_rules/github.bzl index 70c4f548..ab2af042 100644 --- a/build_rules/github.bzl +++ b/build_rules/github.bzl @@ -103,9 +103,7 @@ def github_go_repository( return go_repository( name = name, importpath = importpath, - remote = remote, - vcs = "git", - commit = commit, - tag = tag, - sha256 = sha256, + urls = [_github_tar_gz_url(package, commit, tag)] + mirror_urls, + strip_prefix = _tar_gz_prefix(package, commit, tag), + **kwargs ) From 27859a23a844990e1e90c0f4a53994c983234044 Mon Sep 17 00:00:00 2001 From: Yi Sun Date: Tue, 2 Jul 2019 16:52:18 +0800 Subject: [PATCH 4/5] Switch to http archive when downloading go package --- build_rules/github.bzl | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/build_rules/github.bzl b/build_rules/github.bzl index ab2af042..3495c8b8 100644 --- a/build_rules/github.bzl +++ b/build_rules/github.bzl @@ -70,14 +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, - mirror_urls = [], - **kwargs): +def github_go_repository(name, package, importpath = "", commit, tag, sha256 = "", 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 @@ -94,10 +87,9 @@ def github_go_repository( 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( @@ -105,5 +97,6 @@ def github_go_repository( importpath = importpath, urls = [_github_tar_gz_url(package, commit, tag)] + mirror_urls, strip_prefix = _tar_gz_prefix(package, commit, tag), + sha256 = sha256, **kwargs ) From 8d1d984dd2f3f9db34733c66ca0860c1ac9dbddc Mon Sep 17 00:00:00 2001 From: Mican Zhang Date: Wed, 8 Jan 2020 20:45:49 +0800 Subject: [PATCH 5/5] build_rules: debug load go package from github by http achieve --- build_rules/github.bzl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build_rules/github.bzl b/build_rules/github.bzl index 3495c8b8..33afe571 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, tag, sha256 = "", mirror_urls = [], **kwargs): +def github_go_repository(name, package, commit = None , tag = None, importpath = "", sha256 = "", 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