|
1 | 1 | "Implementation details for rb_bundle_fetch" |
2 | 2 |
|
3 | 3 | load("@bazel_skylib//lib:versions.bzl", "versions") |
| 4 | +load("@bazel_tools//tools/build_defs/repo:utils.bzl", "get_auth") |
4 | 5 | load("//ruby/private:bundler_checksums.bzl", "BUNDLER_CHECKSUMS") |
5 | 6 | load( |
6 | 7 | "//ruby/private:utils.bzl", |
@@ -63,7 +64,7 @@ def _download_gem(repository_ctx, gem, cache_path, sha256 = None): |
63 | 64 | kwargs = {} |
64 | 65 | if sha256: |
65 | 66 | kwargs["sha256"] = sha256 |
66 | | - download = repository_ctx.download(url = url, output = "%s/%s" % (cache_path, gem.filename), **kwargs) |
| 67 | + download = repository_ctx.download(url = url, output = "%s/%s" % (cache_path, gem.filename), auth = get_auth(repository_ctx, [url]), **kwargs) |
67 | 68 | return download.sha256 |
68 | 69 |
|
69 | 70 | def _get_gem_executables(repository_ctx, gem, cache_path): |
@@ -276,6 +277,12 @@ rb_bundle_fetch = repository_rule( |
276 | 277 | allow_single_file = True, |
277 | 278 | default = "@rules_ruby//:ruby/private/bundle_fetch/bin/BUILD.tpl", |
278 | 279 | ), |
| 280 | + "auth_patterns": attr.string_dict( |
| 281 | + doc = "A list of patterns to match against urls for which the auth object should be used.", |
| 282 | + ), |
| 283 | + "netrc": attr.string( |
| 284 | + doc = "Path to .netrc file to read credentials from", |
| 285 | + ), |
279 | 286 | }, |
280 | 287 | doc = """ |
281 | 288 | Fetches Bundler dependencies to be automatically installed by other targets. |
|
0 commit comments