1

quote strings properly

This commit is contained in:
Motiejus Jakštys 2021-07-12 09:45:23 +03:00
parent d67a5e8514
commit 1fa90818cb
2 changed files with 6 additions and 14 deletions

View File

@ -6,6 +6,6 @@ package(
# TODO(motiejus) use json.encode() and unquote these variables with bazel 4+. # TODO(motiejus) use json.encode() and unquote these variables with bazel 4+.
zig_build_macro( zig_build_macro(
absolute_path = "{absolute_path}", absolute_path = {absolute_path},
zig_include_root = "{zig_include_root}", zig_include_root = {zig_include_root},
) )

View File

@ -1,3 +1,4 @@
load("@bazel_skylib//lib:shell.bzl", "shell")
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
load(":zig_toolchain.bzl", "zig_cc_toolchain_config") load(":zig_toolchain.bzl", "zig_cc_toolchain_config")
@ -162,8 +163,8 @@ def _zig_repository_impl(repository_ctx):
Label("//toolchain:BUILD.sdk.bazel"), Label("//toolchain:BUILD.sdk.bazel"),
executable = False, executable = False,
substitutions = { substitutions = {
"{absolute_path}": str(repository_ctx.path("")), "{absolute_path}": shell.quote(str(repository_ctx.path(""))),
"{zig_include_root}": zig_include_root, "{zig_include_root}": shell.quote(zig_include_root),
}, },
) )
@ -215,7 +216,6 @@ def zig_build_macro(absolute_path, zig_include_root):
absolute_tool_paths[name] = "%s/%s" % (absolute_path, tool_path) absolute_tool_paths[name] = "%s/%s" % (absolute_path, tool_path)
tool_srcs[name].append(tool_path) tool_srcs[name].append(tool_path)
zig_cc_toolchain_config( zig_cc_toolchain_config(
name = target + "_cc_toolchain_config", name = target + "_cc_toolchain_config",
target = target, target = target,
@ -225,7 +225,7 @@ def zig_build_macro(absolute_path, zig_include_root):
copts = target_config.copts, copts = target_config.copts,
linkopts = target_config.linkopts, linkopts = target_config.linkopts,
target_system_name = "unknown", target_system_name = "unknown",
target_cpu = target_config.bazel_target_cpu, target_cpu = getattr(target_config, "bazel_target_cpu", None),
target_libc = "unknown", target_libc = "unknown",
compiler = "clang", compiler = "clang",
abi_version = "unknown", abi_version = "unknown",
@ -246,14 +246,6 @@ def zig_build_macro(absolute_path, zig_include_root):
supports_param_files = 0, supports_param_files = 0,
) )
native.cc_toolchain_suite(
name = target + "_cc_toolchain_suite",
toolchains = {
target_config.bazel_target_cpu: ":%s_cc_toolchain" % target,
},
tags = ["manual"],
)
native.toolchain( native.toolchain(
name = target + "_toolchain", name = target + "_toolchain",
exec_compatible_with = None, exec_compatible_with = None,