Correct dependency on Ninja: do not depend on ninja if it is local (#84)

Also, provide a variable to put into dependencies, empty in case local ninja is installed, or containing the reference to ninja target
This commit is contained in:
irengrig 2018-09-10 11:54:59 +02:00 committed by GitHub
parent b467afc40f
commit 3547a24075
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 9 additions and 6 deletions

View File

@ -1,5 +1,5 @@
load("//tools/build_defs:cmake.bzl", "cmake_external")
load("@foreign_cc_platform_utils//:tools.bzl", "NINJA_COMMAND")
load("@foreign_cc_platform_utils//:tools.bzl", "NINJA_COMMAND", "NINJA_DEP")
cmake_external(
name = "cares",
@ -14,7 +14,7 @@ cmake_external(
NINJA_COMMAND + " install",
],
static_libraries = ["libcares.a"],
tools_deps = ["@foreign_cc_platform_utils//:ninja"],
tools_deps = NINJA_DEP,
)
cc_test(

View File

@ -1,5 +1,5 @@
load("//tools/build_defs:cmake.bzl", "cmake_external")
load("@foreign_cc_platform_utils//:tools.bzl", "NINJA_COMMAND")
load("@foreign_cc_platform_utils//:tools.bzl", "NINJA_COMMAND", "NINJA_DEP")
cmake_external(
name = "nghttp2",
@ -14,7 +14,7 @@ cmake_external(
NINJA_COMMAND + " install",
],
static_libraries = ["libnghttp2.a"],
tools_deps = ["@foreign_cc_platform_utils//:ninja"],
tools_deps = NINJA_DEP,
)
cc_test(

View File

@ -1,9 +1,9 @@
load("@foreign_cc_platform_utils//:tools.bzl", "NINJA_USE_BUILT")
load("@foreign_cc_platform_utils//:tools.bzl", "NINJA_USE_BUILT", "NINJA_DEP")
sh_test(
name = "test_ninja_version",
srcs = ["test_ninja_version.sh"],
args = ["true" if NINJA_USE_BUILT else "false"],
visibility = ["//:__pkg__"],
deps = ["@foreign_cc_platform_utils//:ninja"],
deps = NINJA_DEP,
)

View File

@ -99,10 +99,13 @@ sh_library(
value = tool
to_build_tool = descriptor.should_be_built(existing, rctx, host_os)
tool_deps = "[]"
if to_build_tool:
value = "$EXT_BUILD_DEPS/bin/{}/{}".format(tool, descriptor.bin_path)
tool_deps = "[\"@foreign_cc_platform_utils//:{}\"]".format(tool)
tools_text += ["{}_USE_BUILT={}".format(tool.upper(), to_build_tool)]
tools_text += ["{}_COMMAND=\"{}\"".format(tool.upper(), value)]
tools_text += ["{}_DEP={}".format(tool.upper(), tool_deps)]
rctx.file("tools.bzl", "\n".join(tools_text))
return "\n".join(build_text)