rules_foreign_cc/toolchains_examples
irengrig 4d73887da8
Improve outputs handling: wrapper script in shell-abstract manner (#223)
* Improve outputs handling: wrapper script in shell-abstract manner

- extract wrapper script creation into a separate function,
- simplify the script and log names, also output the wrapper script text,
- introduce more shell primitives

related to #204

* Correct review comments
2019-02-14 10:00:19 +01:00
..
.bazelrc Register shell toolchain implementations in the correct order and allow customization (#214) 2019-01-31 15:11:28 +01:00
BUILD Register shell toolchain implementations in the correct order and allow customization (#214) 2019-01-31 15:11:28 +01:00
README.md Register shell toolchain implementations in the correct order and allow customization (#214) 2019-01-31 15:11:28 +01:00
WORKSPACE Register shell toolchain implementations in the correct order and allow customization (#214) 2019-01-31 15:11:28 +01:00
additional_toolchains.bzl Register shell toolchain implementations in the correct order and allow customization (#214) 2019-01-31 15:11:28 +01:00
fancy_platform_commands.bzl Improve outputs handling: wrapper script in shell-abstract manner (#223) 2019-02-14 10:00:19 +01:00
test_platform_name_rule.bzl Register shell toolchain implementations in the correct order and allow customization (#214) 2019-01-31 15:11:28 +01:00

README.md

###How to add a shell toolchain implementation for a custom platform: (to modify the fragments of generated shell script)

  • 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

Please look how it is done in this example.