Commit Graph

19 Commits

Author SHA1 Message Date
Googler f364500ba8 Create a concept of a tool capability.
This should make the concept of "sentinel features" work correctly with known_features and enabled_features, rather than enabling them directly in features.

PiperOrigin-RevId: 681688437
Change-Id: I29184a2079ccfd0eb3a275439508a66ca61109af
2024-10-02 19:56:22 -07:00
Googler 66613ac5d9 Add support for implicit include directories to rule-based toolchains
BEGIN_PUBLIC

Add support for implicit include directories to rule-based toolchains

Reorients the `cc_toolchain.cxx_builtin_include_directories` attribute so it is expressed as an attribute on `cc_args` and `cc_tool` to signify that the tools or arguments imply include directories that Bazel's include path checker should allowlist. This moves the allowlist to the source of truth that implies these directories.

END_PUBLIC

PiperOrigin-RevId: 671393376
Change-Id: Ide8cae548783726835168adcd3f705028a1f4308
2024-09-05 09:06:15 -07:00
Googler f5eb3c0c4a Integrate cc_tool_map into rule-based toolchains
BEGIN_PUBLIC

Integrate cc_tool_map into rule-based toolchains

Integrates cc_tool_map as a new attribute of cc_toolchain, completely replacing cc_action_type_config.

END_PUBLIC

PiperOrigin-RevId: 666365739
Change-Id: Iac74a31736dad66ac3dc75b4478ab4d4d2412181
2024-08-22 08:46:18 -07:00
Googler af926372c5 Replace toolchain_features with known_features and enabled_features.
BEGIN_PUBLIC
Replace toolchain_features with known_features and enabled_features.

This should allow for the deprecation of action_type_config, as `implies` there is no longer required.
END_PUBLIC

PiperOrigin-RevId: 658620044
Change-Id: Idda9bd77edad1be1fd26d5a655e3b9084d38bca8
2024-08-01 19:14:33 -07:00
Googler dcf1dc1680 Create a new cc_tool_config rule which will, in the future, replace cc_action_type_config.
PiperOrigin-RevId: 658426046
Change-Id: Ie90cec7049b3bddf7f022d188a0765ffeb1dcf1d
2024-08-01 09:20:43 -07:00
Googler f97190f039 Remove feature requirements from tools.
BEGIN_PUBLIC
Remove feature requirements from tools.

It's such a niche use case, adds a fair amount of complexity, and there are multiple alternatives available:
* Now that we're using rule based things, you should just be able to add a bazel flag and select on it in your tool definition.
* If you really want precisely that behaviour, you can make your feature add "--use-foo-tool" to the args, and make your tool a wrapper tool that reads the command-line argument, and if provided, invokes a different tool.
END_PUBLIC

PiperOrigin-RevId: 657383729
Change-Id: Idb4f3ad66dc92d48ef81a1e8875bf6d3ba215aa4
2024-07-29 17:37:10 -07:00
Googler ac3f19bac7 Remove support for args from action_type_config.
BEGIN_PUBLIC
Remove support for args from action_type_config.

Args in individual action type configs result in redundant configuration, where both the cc_args and the cc_action_type_config control which actions they're enabled for. Instead of:
```
cc_args(name = "compile_args", action_types = [":c_compile", ":cpp_compile])
cc_action_type_config(name = "c_compile_config", actions = [":c_compile"], args = [":compile_args"])
cc_action_type_config(name = "cpp_compile_config", actions = [":cpp_compile"], args = [":compile_args"])
cc_toolchain(action_type_configs = [":c_compile_config", ":cpp_compile_config"])
```

We should force users to write the following:
```
cc_args(name = "compile_args", action_types = [":c_compile", ":cpp_compile])
cc_action_type_config(name = "c_compile_config", actions = [":c_compile"])
cc_action_type_config(name = "cpp_compile_config", actions = [":cpp_compile"])
cc_toolchain(action_type_configs = [":c_compile_config", ":cpp_compile_config"], args = [":compile_args"])
```
END_PUBLIC

PiperOrigin-RevId: 642432029
Change-Id: I1aa7c1752f4d915d8c84c17a06314ae9ad2c69f0
2024-06-11 16:35:03 -07:00
Googler 1361256a68 Gather variable metadata for the new rule-based toolchain.
BEGIN_PUBLIC
Gather variable metadata for the new rule-based toolchain.
END_PUBLIC

PiperOrigin-RevId: 622000877
Change-Id: I5b2ea6c363fc43fd44e60ffc8fa7ae041545337e
2024-04-04 16:13:02 -07:00
Googler aa19278bbd Rename ExpandArgs to NestedArgs
After discussion with @amontanez in unknown commit, we decided that NestedArgs was a more appropriate name.

BEGIN_PUBLIC
Rename ExpandArgs to NestedArgs
END_PUBLIC

PiperOrigin-RevId: 617085672
Change-Id: I1d7190cac79f8fa953d23be7d0db3b028a84cf30
2024-03-19 01:09:56 -07:00
Googler bbb0615a87 Refactor AddArgsInfo into ExpandArgsInfo
BEGIN_PUBLIC
Refactor AddArgsInfo into ExpandArgsInfo

This allows us to create a similar mechanism to the current toolchain, while maintaining type safety.
END_PUBLIC

PiperOrigin-RevId: 615939056
Change-Id: I9b6763150194f8a76dfd8da730a3e2d45accbe20
2024-03-14 16:28:07 -07:00
Googler 7250ef4352 BEGIN_PUBLIC
Implement ToolchainConfigInfo.

Add support to create the toolchain from feature, action config, and args targets, and validate it to ensure correctness.
END_PUBLIC

PiperOrigin-RevId: 612985448
Change-Id: I7d9086dd1dde07eb0c2484414c9c28c1b8bfb427
2024-03-05 15:15:39 -08:00
Googler db087578f7 BEGIN_PUBLIC
Implement cc_feature_set and cc_feature_constraint.
END_PUBLIC

PiperOrigin-RevId: 610713183
Change-Id: Ia009ac536b71cd9aa44578f823f13361c1580e37
2024-02-27 04:49:36 -08:00
Googler 2b6cdcfe88 BEGIN_PUBLIC
Implement cc_feature for the rule based toolchain.
END_PUBLIC

PiperOrigin-RevId: 610712498
Change-Id: I2539825f0f4cf7f234a2310de6af0662aeb0ea2c
2024-02-27 04:45:26 -08:00
Googler c5493f9b2c BEGIN_PUBLIC
Implement cc_action_type_config.

Rename it from cc_action_config, to make it clear that we are not configuring an action, but rather configuring a type of action.
END_PUBLIC

PiperOrigin-RevId: 610518142
Change-Id: Ic10755952ee786d30a3a5564aa09a8dc16499f3a
2024-02-26 13:58:42 -08:00
Googler 837caeca75 BEGIN_PUBLIC
Pull more info into ArgsListInfo.

This allows us to make queries such as "get me all the flags / files required for this specific action". This will allow us to implement cc_action_config more easily and efficiently.
END_PUBLIC

PiperOrigin-RevId: 609828504
Change-Id: Ie3978674c5027f892d2e5e4c8d937a52c59fde5d
2024-02-23 13:54:41 -08:00
Googler 916074ec32 BEGIN_PUBLIC
Implement cc_tool
END_PUBLIC

PiperOrigin-RevId: 609307150
Change-Id: I2e135a59e06a56ca8ec071254d340ac4b984b234
2024-02-22 03:06:06 -08:00
Googler 9eb790fe47 BEGIN_PUBLIC
Add support for testing against more complex subject types.

We can now use subjects such as subjects.result(subjects.str) for something that may return a string, or fail.
END_PUBLIC

PiperOrigin-RevId: 608971309
Change-Id: I9ae61c988a597189b84fb6ccef75c96697c6e364
2024-02-21 06:24:34 -08:00
Googler 35fe45e91b BEGIN_PUBLIC
Implement cc_args.

Also change cc_flag_set / cc_flag_group to cc_args / cc_arg_group. This is to lean into the idea that this is roughly equivalent to ctx.actions.args()
END_PUBLIC

PiperOrigin-RevId: 608804069
Change-Id: I74ea883b14219f904aaafc4eab902b96a1fb3e3d
2024-02-20 17:58:39 -08:00
Googler 2e780ceda9 BEGIN_PUBLIC
Add support for testing rules_cc's new toolchains with rules_testing.
END_PUBLIC

PiperOrigin-RevId: 608769646
Change-Id: I1a698355e5e977cc86eedc7cf6e8e0f888593cb8
2024-02-20 15:54:10 -08:00