Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switch to http archive when downloading go package #4

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
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
22 changes: 13 additions & 9 deletions build_rules/github.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -87,18 +94,15 @@ 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,
sha256 = sha256,
urls = [_github_tar_gz_url(package, commit, tag)] + mirror_urls,
strip_prefix = _tar_gz_prefix(package, commit, tag),
**kwargs
)