Skip to content

Commit befa233

Browse files
authored
support --incompatible_use_plus_in_repo_names (#2)
1 parent 8a5148b commit befa233

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

cpan/extensions.bzl

+1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ def _cpan_impl(module_ctx):
66
install(
77
name = attr.name,
88
lock = attr.lock,
9+
main_target_name = attr.name,
910
)
1011

1112
cpan = module_extension(

cpan/install.bzl

+3-2
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ load("@rules_perl//perl:perl.bzl", "perl_library")
1818
exports_files(["**/*"])
1919
2020
perl_library(
21-
name = "{repo}",
21+
name = "{main_target_name}",
2222
deps = {deps},
2323
visibility = ["//visibility:public"],
2424
)
@@ -37,14 +37,15 @@ def _install_impl(rctx):
3737
rctx.file(distribution + "/BUILD", _MODULE_BUILD_TEMPLATE.format(distribution = distribution), executable = False)
3838

3939
rctx.file("BUILD", _REPO_BUILD_TEMPLATE.format(
40-
repo = rctx.name.split("~")[-1],
40+
main_target_name = rctx.attr.main_target_name,
4141
deps = ["//" + dep for dep in lockfile.keys()],
4242
), executable = False)
4343
rctx.file("WORKSPACE", "", executable = False)
4444

4545
install = repository_rule(
4646
attrs = {
4747
"lock": attr.label(allow_single_file = True, doc = "cpanfile snapshot lock file"),
48+
"main_target_name": attr.string(mandatory = True, doc = "The name of the top-level perl_library target. Ideally the same as the repo name."),
4849
},
4950
implementation = _install_impl,
5051
)

0 commit comments

Comments
 (0)