From 92067b5d8501291b5b23bd28a3683f3d663b3e94 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Motiejus=20Jak=C5=A1tys?= Date: Mon, 24 Apr 2023 10:18:34 +0300 Subject: [PATCH] remove @bazel_skylib dependency (again) This was accidentally included in d61aab183e434d48783dbaa2fdb9e39714217637 --- rules/platform.bzl | 12 +++++++++--- toolchain/defs.bzl | 2 +- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/rules/platform.bzl b/rules/platform.bzl index 6ec08c7..5469c0e 100644 --- a/rules/platform.bzl +++ b/rules/platform.bzl @@ -1,8 +1,6 @@ # Copyright 2023 Uber Technologies, Inc. # Licensed under the MIT License -load("@bazel_skylib//lib:paths.bzl", "paths") - def _platform_transition_impl(settings, attr): _ignore = settings return { @@ -19,7 +17,11 @@ _platform_transition = transition( def _platform_binary_impl(ctx): platform_sanitized = ctx.attr.platform.replace("/", "_").replace(":", "_") - dst = ctx.actions.declare_file("{}-{}".format(paths.basename(ctx.file.src.path), platform_sanitized)) + dstname = "{}-{}".format( + _paths_basename(ctx.file.src.path), + platform_sanitized, + ) + dst = ctx.actions.declare_file(dstname) src = ctx.file.src ctx.actions.run( outputs = [dst], @@ -61,3 +63,7 @@ platform_test = rule( attrs = _attrs, test = True, ) + +## Copied from https://github.com/bazelbuild/bazel-skylib/blob/1.4.1/lib/paths.bzl#L22 +def _paths_basename(p): + return p.rpartition("/")[-1] diff --git a/toolchain/defs.bzl b/toolchain/defs.bzl index 3ffe347..c41298e 100644 --- a/toolchain/defs.bzl +++ b/toolchain/defs.bzl @@ -218,7 +218,7 @@ def _zig_repository_impl(repository_ctx): print("Launcher compilation failed. Clearing %s/{%s} and retrying" % (cache_prefix, ",".join(zig_cache_dirs))) for d in zig_cache_dirs: - repository_ctx.delete(paths.join(cache_prefix, d)) + repository_ctx.delete(_paths_join(cache_prefix, d)) ret = repository_ctx.execute( compile_cmd,