Skip to content

Commit f63df49

Browse files
committed
Fix: extension pkl reported incorrect imports of repositories
Fixes the following `WARNING`: ``` (10:58:19) WARNING: /home/ubuntu/project/MODULE.bazel:35:20: The module extension pkl defined in @rules_pkl//pkl/extensions:pkl.bzl reported incorrect imports of repositories via use_repo(): Imported, but reported as indirect dependencies by the extension: pkl-cli-linux-aarch64, pkl-cli-linux-amd64, pkl-cli-macos-aarch64, pkl-cli-macos-amd64 Fix the use_repo calls by running 'bazel mod tidy'. ```
1 parent ff94f8c commit f63df49

File tree

6 files changed

+51
-9
lines changed

6 files changed

+51
-9
lines changed

pkl/extensions/pkl.bzl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,11 +49,11 @@ pkl_project = tag_class(
4949
)
5050

5151
def _toolchain_extension(module_ctx):
52-
pkl_cli_binaries()
52+
cli_binaries = pkl_cli_binaries()
5353

5454
workspaces = []
5555
seen_packages = []
56-
direct_deps = []
56+
direct_deps = cli_binaries
5757
direct_dev_deps = []
5858
for mod in module_ctx.modules:
5959
for proj in mod.tags.project:

pkl/repositories.bzl

Lines changed: 28 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,23 +24,45 @@ load("//pkl/private:repositories.bzl", _project_cache_path_and_dependencies = "r
2424

2525
DEFAULT_PKL_VERSION = "0.28.2"
2626

27-
def pkl_cli_binaries():
28-
version = DEFAULT_PKL_VERSION
27+
def pkl_cli_binaries(version = DEFAULT_PKL_VERSION):
28+
"""
29+
Sets up the `http_file` repositories for the Pkl binaries.
30+
31+
Args:
32+
version: the Pkl version you want to use
33+
34+
Returns:
35+
A list of the binary names.
36+
"""
37+
binary_names = []
38+
2939
for arch, sha256 in VERSIONS[version].items():
40+
cli_name = "pkl-cli-{arch}".format(arch = arch)
41+
binary_names.append(cli_name)
42+
3043
maybe(
3144
http_file,
32-
name = "pkl-cli-{arch}".format(arch = arch),
45+
name = cli_name,
3346
url = "https://github.com/apple/pkl/releases/download/{version}/pkl-{arch}".format(version = version, arch = arch),
3447
sha256 = sha256,
3548
executable = True,
3649
)
3750

38-
def pkl_setup():
39-
pkl_cli_binaries()
51+
return binary_names
52+
53+
def pkl_setup(version = DEFAULT_PKL_VERSION):
54+
"""
55+
Setup all repositories for Pkl.
56+
57+
Args:
58+
version: the Pkl version you want to use
59+
"""
60+
61+
pkl_cli_binaries(version)
4062

4163
maven_install(
4264
name = "rules_pkl_deps",
43-
artifacts = PKL_DEPS[DEFAULT_PKL_VERSION],
65+
artifacts = PKL_DEPS[version],
4466
repositories = [
4567
"https://repo1.maven.org/maven2/",
4668
],

tests/integration_tests/example_workspaces/multiple_pkl_projects/MODULE.bazel

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,12 @@ pkl.project(
2929
pkl_project = "@//project2:PklProject",
3030
pkl_project_deps = "@//project2:PklProject.deps.json",
3131
)
32-
use_repo(pkl, "alsopkl", "mypkl")
32+
use_repo(
33+
pkl,
34+
"alsopkl",
35+
"mypkl",
36+
"pkl-cli-linux-aarch64",
37+
"pkl-cli-linux-amd64",
38+
"pkl-cli-macos-aarch64",
39+
"pkl-cli-macos-amd64",
40+
)

tests/integration_tests/example_workspaces/pkl_cache/MODULE.bazel

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,10 @@ pkl.project(
3131
use_repo(
3232
pkl,
3333
"mypkl",
34+
"pkl-cli-linux-aarch64",
35+
"pkl-cli-linux-amd64",
36+
"pkl-cli-macos-aarch64",
37+
"pkl-cli-macos-amd64",
3438
)
3539

3640
python = use_extension(

tests/integration_tests/example_workspaces/pkl_project/MODULE.bazel

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,10 @@ pkl.project(
4343
use_repo(
4444
pkl,
4545
"mypkl",
46+
"pkl-cli-linux-aarch64",
47+
"pkl-cli-linux-amd64",
48+
"pkl-cli-macos-aarch64",
49+
"pkl-cli-macos-amd64",
4650
)
4751

4852
python = use_extension(

tests/integration_tests/example_workspaces/simple/MODULE.bazel

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,10 @@ pkl.project(
3131
use_repo(
3232
pkl,
3333
"mypkl",
34+
"pkl-cli-linux-aarch64",
35+
"pkl-cli-linux-amd64",
36+
"pkl-cli-macos-aarch64",
37+
"pkl-cli-macos-amd64",
3438
)
3539

3640
python = use_extension(

0 commit comments

Comments
 (0)