Represents a configuration transition across a dependency edge. For example, if //package:foo
depends on //package:bar
with a configuration transition, then the configuration of these two targets will differ: //package:bar
's transition will be determined by that of //package:foo
, as subject to the function defined by a transition object.
Members
transition
transition transition(implementation, inputs, outputs)A transition that reads a set of input build settings and writes a set of output build settings.
Example:
def _transition_impl(settings, attr): # This transition just reads the current CPU value as a demonstration. # A real transition could incorporate this into its followup logic. current_cpu = settings["//command_line_option:cpu"] return {"//command_line_option:compilation_mode": "dbg"} build_in_debug_mode = transition( implementation = _transition_impl, inputs = ["//command_line_option:cpu"], outputs = ["//command_line_option:compilation_mode"], )
For more details see here.
Parameters
Parameter | Description |
---|---|
implementation
|
callable;
required The function implementing this transition. This function always has two parameters: settings and attr . The settings param is a dictionary whose set of keys is defined by the inputs parameter. So, for each build setting --//foo=bar , if inputs contains //foo , settings will have an entry settings['//foo']='bar' .The This function must return a |
inputs
|
sequence of strings;
required List of build settings that can be read by this transition. This becomes the key set of the settings parameter of the implementation function parameter. |
outputs
|
sequence of strings;
required List of build settings that can be written by this transition. This must be a superset of the key set of the dictionary returned by this transition. |