fork/rules_rust
git clone https://git.julia.blue/fork/rules_rust
86d47a1b
0.11.0
1# buildifier: disable=module-docstring 2load ( "//rust:defs.bzl" , "rust_common" ) 3 4def _wasm_bindgen_transition ( _settings , _attr ): 5"""The implementation of the `wasm_bindgen_transition` transition 6 7Args: 8_settings (dict): A dict {String:Object} of all settings declared 9in the inputs parameter to `transition()` 10_attr (dict): A dict of attributes and values of the rule to which 11the transition is attached 12 13Returns: 14dict: A dict of new build settings values to apply 15""" 16return { "//command_line_option:platforms" : str ( Label ( "//rust/platform:wasm" ))} 17 18wasm_bindgen_transition = transition ( 19implementation = _wasm_bindgen_transition , 20inputs = [], 21outputs = [ "//command_line_option:platforms" ], 22) 23 24def _import_macro_dep_bootstrap_transition ( _settings , _attr ): 25"""The implementation of the `import_macro_dep_bootstrap_transition` transition. 26 27This transition modifies the config to start using the fake macro 28implementation, so that the macro itself can be bootstrapped without 29creating a dependency cycle, even while every Rust target has an implicit 30dependency on the "import" macro (either real or fake). 31 32Args: 33_settings (dict): a dict {String:Object} of all settings declared in the 34inputs parameter to `transition()`. 35_attr (dict): A dict of attributes and values of the rule to which the 36transition is attached. 37 38Returns: 39dict: A dict of new build settings values to apply. 40""" 41return { "@rules_rust//rust/settings:use_real_import_macro" : False } 42 43import_macro_dep_bootstrap_transition = transition ( 44implementation = _import_macro_dep_bootstrap_transition , 45inputs = [], 46outputs = [ "@rules_rust//rust/settings:use_real_import_macro" ], 47) 48 49def _alias_with_import_macro_bootstrapping_mode_impl ( ctx ): 50actual = ctx . attr . actual [ 0 ] 51return [ actual [ rust_common . crate_info ], actual [ rust_common . dep_info ]] 52 53alias_with_import_macro_bootstrapping_mode = rule ( 54implementation = _alias_with_import_macro_bootstrapping_mode_impl , 55doc = "Alias-like rule to build the `actual` with `use_real_import_macro` setting disabled. Not to be used outside of the import macro bootstrap." , 56attrs = { 57# Using `actual` so tooling such as rust analyzer aspect traverses the target. 58"actual" : attr . label ( 59doc = "The target this alias refers to." , 60cfg = import_macro_dep_bootstrap_transition , 61mandatory = True , 62), 63"_allowlist_function_transition" : attr . label ( 64default = Label ( "//tools/allowlists/function_transition_allowlist" ), 65), 66}, 67)