Skip to content

Switch to the new C++ toolchains API #444

Open
@AustinSchuh

Description

@AustinSchuh

The new BUILD file based C++ toolchains promise to be much easier to maintain.

https://github.com/bazelbuild/rules_cc/tree/main/examples/rule_based_toolchain

What do you all think about switching over to using those? I'm happy to help.

The example makes it look like we can reuse pieces from rules_cc.

cc_toolchain(                                                                                                                           
    name = "host_clang",                                                                                                           
    args = select({                                                                                                                              
        "@platforms//os:linux": [                                                                                                                            
            "//toolchain/args:linux_sysroot",                                                                             
        ],                                                                                                                                         
        "//conditions:default": [],    
    }) + [                                                                                                                                                       
        "//toolchain/args:no_canonical_prefixes",                                                                                                   
        "//toolchain/args:warnings",                                                                                  
    ],                                                                    
    enabled_features = ["@rules_cc//cc/toolchains/args:experimental_replace_legacy_action_config_features"],                                                                                                  
    known_features = ["@rules_cc//cc/toolchains/args:experimental_replace_legacy_action_config_features"],    
    tool_map = "//toolchain/tools:all_tools",                                                                       
)                                                                                                                                                            
                                                                                                                 
toolchain(                                                                                                                         
    name = "host_cc_toolchain",                                                                                                   
    toolchain = ":host_clang",                                                                                                                                    
    toolchain_type = "@bazel_tools//tools/cpp:toolchain_type",                                                                                
)  

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions