Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Set up placeholder tool in (apple|cxx|swift)_toolchain
Summary: **Context** Supporting fat and non-fat toolchains becomes problematic because a fat toolchain usually combines tools using `command_alias()`. So if we set the platform constraints for the individual tools (which we need, so that the thin toolchain gets the correct platform), we end up producing conflicting constraints. ``` ┌─────────────────┐ ┌───────────────┐ │ linux-toolchain │ │ fat-toolchain │ └─────────────────┘ └───────────────┘ │ │ │ │ │ │ │ │ "tool" = attrs.exec_dep() "tool" = attrs.exec_dep() │ │ │ │ │ │ │ │ │ │ │ │ │ ▼ │ ┌────────────────────────────────┐ │ │command_alias(name = "fat-tool")│ │ └────────────────────────────────┘ │ │ │ platform_exe │ │ │ │ │ ┌─────────────────┴─────────────────────┐ │ │ │ │ │ │ │ │ │ │ │ │ ▼ ▼ ▼ ┌─────────────────────────────────┐ ┌───────────────────────────────────┐ │sh_binary(name="linux-only-tool")│ │sh_binary(name="windows-only-tool")│ └─────────────────────────────────┘ └───────────────────────────────────┘ ``` If we were to set the `target_compatible_with` constraints on `linux-only-tool` and `windows-only-tool`, then `fat-tool` is not resolved to any exec platform, as no exec platform satisfies *both* Windows and Linux. **Solution/Workaround** There are two solutions to the problem: 1. Set up mirrored aliases of all underlying tools 2. Set up an placeholder tool on `(apple|cxx|swift)_toolchain()` for the purposes of setting exec platform constraints We opt for solution #2 as it's much simpler and does not require extensive changes to existing toolchain setup. Since the tools are optional, they can be unused without any downsides. Reviewed By: rmaz Differential Revision: D44090642 fbshipit-source-id: 399cfbfdf4dcbb4b334e22545cfea5e86e31c837
- Loading branch information