2
0
Fork 0
mirror of https://github.com/bazel-contrib/rules_foreign_cc synced 2024-11-29 12:33:51 +00:00
rules_foreign_cc/toolchains_examples/WORKSPACE
irengrig 91ba4441d2
Register shell toolchain implementations in the correct order and allow customization (#214)
* Register shell toolchain implementations in the correct order

so that the default implementation is the last

* Refactor shell toolchain to allow users register custom shell toolchains.

- define your own shell toolchain file(s) by copying @rules_foreign_cc//tools/build_defs/shell_toolchain/toolchains/impl:linux_commands.bzl,
and modifying the methods.
- create a mapping: a list of ToolchainMapping with the mappings between created file(s) and execution or/and target platform constraints.
- in the BUILD file of some package, call "register_mappings" macro from "@rules_foreign_cc//tools/build_defs/shell_toolchain/toolchains:defs.bzl", passing the mappings and toolchain_type_ = "@rules_foreign_cc//tools/build_defs/shell_toolchain/toolchains:shell_commands"
- in the WORKSPACE file of your main repository, when you initialize rules_foreign_cc, pass the mappings and the package, in which BUILD file you called "register_mappings" macro

* Correct typo
2019-01-31 15:11:28 +01:00

20 lines
777 B
Python

workspace(name = "rules_foreign_cc_toolchains_examples")
local_repository(
name = "rules_foreign_cc",
path = "..",
)
load("@rules_foreign_cc//:workspace_definitions.bzl", "rules_foreign_cc_dependencies")
load(":additional_toolchains.bzl", "ADD_TOOLCHAIN_MAPPINGS")
# We are registering additional shell toolchain implementation for fancy_platform.
# The target of the type "toolchain" will be created in the root package of the current workspace,
# so we are passing this value as additonal_shell_toolchain_package.
rules_foreign_cc_dependencies(
additonal_shell_toolchain_mappings = ADD_TOOLCHAIN_MAPPINGS,
additonal_shell_toolchain_package = "@rules_foreign_cc_toolchains_examples//",
native_tools_toolchains = [],
register_default_tools = True,
)