A large portion of compile.bzl is dedicated to passing input/output files that are feature or toolchain-specific; while this is not necessarily a problem, adding them one-by-one is a bit tedious (see #772); ideally the toolchain should be able to define output files without editing rules_cc itself.
A generic implementation will need to be able to do the following:
- be defined in a toolchain
- be conditional on some aspect of the feature configuration
- declare one or more files, potentially in relation to other files
- add files to output groups
Discussion of PR/772 seems to lean towards callbacks; I propose the following interface for something that would get called (based on feature configuration) in _create_compile_source_action (e.g. how _maybe_declare_trace_file is called in #772)
def callback(
ctx, # rule context object. requires committing to keeping ctx in the cc_common.compile API
feature_configuration,
cc_internal, # an object allowing access to file declaration api. Not a good name for it
) -> {"output_group_name":[files]}
When defining a toolchain, add a map or set of these callbacks to CcToolchainInfo (I'm insufficiently familiar with the rules-based-toolchain API to have a proposal for how this should look).
@keith @13steinj @trybka thoughts?
A large portion of compile.bzl is dedicated to passing input/output files that are feature or toolchain-specific; while this is not necessarily a problem, adding them one-by-one is a bit tedious (see #772); ideally the toolchain should be able to define output files without editing rules_cc itself.
A generic implementation will need to be able to do the following:
Discussion of PR/772 seems to lean towards callbacks; I propose the following interface for something that would get called (based on feature configuration) in _create_compile_source_action (e.g. how _maybe_declare_trace_file is called in #772)
When defining a toolchain, add a map or set of these callbacks to CcToolchainInfo (I'm insufficiently familiar with the rules-based-toolchain API to have a proposal for how this should look).
@keith @13steinj @trybka thoughts?