Skip to content

Commit eaf2daa

Browse files
authored
Fix generated url for github_proto_repository macro (#331)
1 parent 805e279 commit eaf2daa

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

rules/proto/proto_repository.bzl

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -407,14 +407,15 @@ def patch(ctx):
407407
fail("Error applying patch command %s:\n%s%s" %
408408
(cmd, st.stdout, st.stderr))
409409

410-
def github_proto_repository(name, owner, repo, commit, prefix = "", build_file_expunge = True, build_file_proto_mode = "file", **kwargs):
410+
def github_proto_repository(name, owner, repo, commit, prefix = "", host = "github.com", build_file_expunge = True, build_file_proto_mode = "file", **kwargs):
411411
"""github_proto_repository is a macro for a proto_repository hosted at github.com
412412
413413
Args:
414414
name: the name of the rule
415415
owner: the github owner (e.g. 'protocolbuffers')
416416
repo: the github repo name (e.g. 'protobuf')
417417
prefix: the strip_prefix value for the repo (e.g. 'src')
418+
host: the source host (default 'github.com')
418419
commit: the git commit (required for this macro)
419420
build_file_expunge: defaults to true for this macro.
420421
build_file_proto_mode: defaults to 'file' for this macro.
@@ -427,14 +428,14 @@ def github_proto_repository(name, owner, repo, commit, prefix = "", build_file_e
427428

428429
proto_repository(
429430
name = name,
430-
source_host = "github.com",
431+
source_host = host,
431432
source_owner = owner,
432433
source_repo = repo,
433434
source_commit = commit,
434435
source_prefix = prefix,
435436
strip_prefix = strip_prefix,
436437
build_file_expunge = build_file_expunge,
437438
build_file_proto_mode = build_file_proto_mode,
438-
urls = ["https://%s/%s/archive/%s.tar.gz" % (owner, repo, commit)],
439+
urls = ["https://%s/%s/%s/archive/%s.tar.gz" % (host, owner, repo, commit)],
439440
**kwargs
440441
)

0 commit comments

Comments
 (0)