fork/rules_rust
git clone https://git.julia.blue/fork/rules_rust
46b7ea5a
patching
1"""Rules for representing Rust toolchain channels""" 2 3_CHANNELS = [ 4"beta" , 5"nightly" , 6"stable" , 7] 8 9RustToolchainChannelInfo = provider ( 10doc = "A provider describing the Rust toolchain channel." , 11fields = { 12"value" : "string: Can be {}" . format ( _CHANNELS ), 13}, 14) 15 16def _rust_toolchain_channel_flag_impl ( ctx ): 17value = ctx . build_setting_value 18if value not in _CHANNELS : 19fail ( str ( ctx . label ) + " build setting allowed to take values {" + 20", " . join ( _CHANNELS ) + "} but was set to unallowed value " + 21value ) 22return RustToolchainChannelInfo ( value = value ) 23 24rust_toolchain_channel_flag = rule ( 25doc = "A build setting which represents the Rust toolchain channel. The allowed values are {}" . format ( _CHANNELS ), 26implementation = _rust_toolchain_channel_flag_impl , 27build_setting = config . string ( 28flag = True , 29), 30)