1
Fork 0

remove `@bazel_skylib` dependency

We are using only a single trivial function `paths`, which can be
bundled. Makes things like test-zigcc[1] easier: less dependencies to
worry about.

[1]: https://git.jakstys.lt/motiejus/test-zig-cc/
main
Motiejus Jakštys 2023-04-17 12:37:03 +03:00 committed by Motiejus Jakštys
parent 62f6b80479
commit 97a4846b58
1 changed files with 16 additions and 2 deletions

View File

@ -1,4 +1,3 @@
load("@bazel_skylib//lib:paths.bzl", "paths")
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
load("@bazel_tools//tools/build_defs/repo:utils.bzl", "read_user_netrc", "use_netrc")
load("@hermetic_cc_toolchain//toolchain/private:defs.bzl", "target_structs", "zig_tool_path")
@ -194,7 +193,7 @@ def _zig_repository_impl(repository_ctx):
"ZIG_GLOBAL_CACHE_DIR": cache_prefix,
}
compile_cmd = [
paths.join("..", "zig"),
_paths_join("..", "zig"),
"build-exe",
"-OReleaseSafe",
"launcher.zig",
@ -331,3 +330,18 @@ def _flatten(iterable):
for element in iterable:
result += element
return result
## Copied from https://github.com/bazelbuild/bazel-skylib/blob/1.4.1/lib/paths.bzl#L59-L98
def _paths_is_absolute(path):
return path.startswith("/") or (len(path) > 2 and path[1] == ":")
def _paths_join(path, *others):
result = path
for p in others:
if _paths_is_absolute(p):
result = p
elif not result or result.endswith("/"):
result += p
else:
result += "/" + p
return result