Commit Graph

14 Commits

Author SHA1 Message Date
Googler 324612d107 Add documentation for `cc_toolchain`
BEGIN_PUBLIC

Add documentation for `cc_toolchain`

Updates and includes documentation for the `cc_toolchain` rule, fixing some minor typos along the way.

END_PUBLIC

PiperOrigin-RevId: 684051451
Change-Id: I5bb62f22b3fb68e2d233fb85255d1a86bb45a47d
2024-10-09 08:44:04 -07:00
Googler b06d2f7d53 Add cc_action_type and cc_tool documentation
BEGIN_PUBLIC

Add cc_action_type and cc_tool documentation

Extends the toolchain API documentation to include docs for cc_action_type, cc_action_type_set, cc_variable, and cc_tool.

Also improves cross-reference links and copybara behavior for docs.

END_PUBLIC

PiperOrigin-RevId: 680601617
Change-Id: Idbbdfbcb2c5a1c3598b6a7e7ba985ed14f871099
2024-09-30 09:15:19 -07:00
Googler de86823dde Document args-related toolchain rules
BEGIN_PUBLIC

Document args-related toolchain rules

Adds comprehensive documentation for cc_args, cc_nested_args, and cc_args_list.

END_PUBLIC

PiperOrigin-RevId: 673921558
Change-Id: I1c9c0731925a03dedec983083072f52c6d4c270f
2024-09-12 11:09:02 -07:00
Googler 8b63556334 Fix buildifier finding in rules_cc
BEGIN_PUBLIC

Fix buildifier finding in rules_cc

Fixes an out-of-order dictionary entry identified by the rules_cc Bazel CI.

END_PUBLIC

PiperOrigin-RevId: 671626223
Change-Id: Ib33fa36db879a5cd89cb2d01bb5b671e706de77b
2024-09-05 22:08:07 -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 e1c7ebb858 Add support for select'ing on cc_args(args=...).
This CL is an alternative to unknown commit. I left the other CL seperately, because I wasn't 100% sure that we'd agree to this, since this is an API change.
I did it this way because I believe it's much less hacky, and it also allows us to format things that aren't variables.

BEGIN_PUBLIC
Add support for select'ing on cc_args(args=...).

This is quite tricky because the one parameter was being split into two in a macro, one of type label and the other of type string.

For example, `args = ["--foo", format_arg("--bar=%s", "//path/to:bar")]` was rewritten by the macro to `args = [json.encode(struct(format_type="raw", format="foo")), json.encode(struct(format_type="format_arg", format="--bar=%s", value=0))], variables = ["//path/to:bar"]`.
To allow it to work with selects, we need to ensure that we don't perform post-processing on the inside of the select. To solve this, we:
* Ensure that args only take strings
* Provide a seperate parameter for substitutions.

This new mechanism also has the useful property that we can now format things that are not variables. For example, I can do the following:

```
directory(name = "sysroot", ...)
cc_args(
    name = "sysroot_arg",
    args = ["--sysroot={sysroot}"],
    format = {
        ":sysroot": "sysroot"
    }
)
```

END_PUBLIC

PiperOrigin-RevId: 656211278
Change-Id: If83f1ea5a99090c18f2a561c51ec6d39ce9fe419
2024-07-25 20:13:42 -07:00
Googler 6e490f79ee Implement flag_group in the new rule-based toolchain.
BEGIN_PUBLIC
Implement flag_group in the new rule-based toolchain.
END_PUBLIC

PiperOrigin-RevId: 622107179
Change-Id: I9e1971e279f313ce85537c899bcf80860616f8b7
2024-04-05 01:47:45 -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 59cf8ff109 Rename additional_files to data.
BEGIN_PUBLIC
Rename additional_files to data.

This is more consistent with other rules.
END_PUBLIC

PiperOrigin-RevId: 615364332
Change-Id: Ic27ec8c8e72d290e72074034f85a34b38401599b
2024-03-13 04:22:40 -07:00
Googler e658433e23 No public description
PiperOrigin-RevId: 613579953
Change-Id: I4aea8af1b3db8eb532c7c9296fc4dfa0c2ff9481
2024-03-07 07:40:02 -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 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 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