From d8f33ae3f3e52b1391a5a20dab2fc6ee040053db Mon Sep 17 00:00:00 2001 From: "Piotr (ptab) Tabor" <132376425+sfc-gh-ptabor@users.noreply.github.com> Date: Thu, 30 Nov 2023 22:49:38 +0100 Subject: [PATCH] Bugfix: call to rules_apko target from another repository was failing (#39) --- apko/private/BUILD.bazel | 5 ++++- apko/private/apko_image.bzl | 3 ++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/apko/private/BUILD.bazel b/apko/private/BUILD.bazel index 189da86..b6baf8e 100644 --- a/apko/private/BUILD.bazel +++ b/apko/private/BUILD.bazel @@ -14,7 +14,10 @@ bzl_library( name = "apko_image", srcs = ["apko_image.bzl"], visibility = ["//apko:__subpackages__"], - deps = ["apko_run"], + deps = [ + "apko_run", + "@bazel_skylib//:lib", + ], ) bzl_library( diff --git a/apko/private/apko_image.bzl b/apko/private/apko_image.bzl index 23642ae..0591919 100644 --- a/apko/private/apko_image.bzl +++ b/apko/private/apko_image.bzl @@ -1,6 +1,7 @@ "A rule for running apko with prepopulated cache" load("//apko/private:apko_run.bzl", "apko_run") +load("@bazel_skylib//lib:paths.bzl", "paths") _ATTRS = { "contents": attr.label(doc = "Label to the contents repository generated by translate_lock. See [apko-cache](./apko-cache.md) documentation.", mandatory = True), @@ -31,7 +32,7 @@ def _impl(ctx): args.add_all(ctx.attr.args) - args.add("--cache-dir={}/{}/{}".format(ctx.bin_dir.path, ctx.label.package, cache_name)) + args.add("--cache-dir={}".format(paths.join(ctx.bin_dir.path, ctx.label.workspace_root, ctx.label.package, cache_name))) args.add("--offline") if ctx.attr.architecture: