fork/rules_rust
git clone https://git.julia.blue/fork/rules_rust
c75ea6f9
rust-analyzer
1"""Utilities for the `@rules_rust//tools/runfiles` library""" 2 3_RULES_RUST_RUNFILES_WORKSPACE_NAME = "RULES_RUST_RUNFILES_WORKSPACE_NAME" 4 5def _workspace_name_impl ( ctx ): 6output = ctx . actions . declare_file ( ctx . label . name ) 7 8ctx . actions . write ( 9output = output , 10content = "{}={}\n ". format ( 11_RULES_RUST_RUNFILES_WORKSPACE_NAME , 12ctx . workspace_name , 13), 14) 15 16return [ DefaultInfo ( 17files = depset ([ output ]), 18)] 19 20workspace_name = rule ( 21implementation = _workspace_name_impl , 22doc = """\ 23A rule for detecting the current workspace name and writing it to a file for 24for use with `rustc_env_files` attributes on `rust_*` rules. The workspace 25name is exposed by the variable `{}`.""" . format ( _RULES_RUST_RUNFILES_WORKSPACE_NAME ), 26)