buildRustCrate: editorconfig fixes

zowoq 1439eaf0 debf9a3f

+13 -13
+1 -1
pkgs/build-support/rust/build-rust-crate/build-crate.nix
··· 38 build_bin = if buildTests then "build_bin_test" else "build_bin"; 39 in '' 40 runHook preBuild 41 - 42 # configure & source common build functions 43 LIB_RUSTC_OPTS="${libRustcOpts}" 44 BIN_RUSTC_OPTS="${binRustcOpts}"
··· 38 build_bin = if buildTests then "build_bin_test" else "build_bin"; 39 in '' 40 runHook preBuild 41 + 42 # configure & source common build functions 43 LIB_RUSTC_OPTS="${libRustcOpts}" 44 BIN_RUSTC_OPTS="${binRustcOpts}"
+2 -2
pkgs/build-support/rust/build-rust-crate/configure-crate.nix
··· 43 noisily cd "${workspace_member}" 44 ''} 45 ${lib.optionalString (workspace_member == null) '' 46 - echo_colored "Searching for matching Cargo.toml (${crateName})" 47 local cargo_toml_dir=$(matching_cargo_toml_dir "${crateName}") 48 if [ -z "$cargo_toml_dir" ]; then 49 echo_error "ERROR configuring ${crateName}: No matching Cargo.toml in $(pwd) found." >&2 ··· 53 ''} 54 55 runHook preConfigure 56 - 57 symlink_dependency() { 58 # $1 is the nix-store path of a dependency 59 # $2 is the target path
··· 43 noisily cd "${workspace_member}" 44 ''} 45 ${lib.optionalString (workspace_member == null) '' 46 + echo_colored "Searching for matching Cargo.toml (${crateName})" 47 local cargo_toml_dir=$(matching_cargo_toml_dir "${crateName}") 48 if [ -z "$cargo_toml_dir" ]; then 49 echo_error "ERROR configuring ${crateName}: No matching Cargo.toml in $(pwd) found." >&2 ··· 53 ''} 54 55 runHook preConfigure 56 + 57 symlink_dependency() { 58 # $1 is the nix-store path of a dependency 59 # $2 is the target path
+3 -3
pkgs/build-support/rust/build-rust-crate/lib.sh
··· 153 # is referenced there. 154 cargo metadata --no-deps --format-version 1 \ 155 --manifest-path "$manifest_path" \ 156 - | jq -r '.packages[] 157 - | select( .name == "'$expected_crate_name'") 158 | .manifest_path' 159 } 160 ··· 171 break 172 fi 173 done 174 - }
··· 153 # is referenced there. 154 cargo metadata --no-deps --format-version 1 \ 155 --manifest-path "$manifest_path" \ 156 + | jq -r '.packages[] 157 + | select( .name == "'$expected_crate_name'") 158 | .manifest_path' 159 } 160 ··· 171 break 172 fi 173 done 174 + }
+7 -7
pkgs/build-support/rust/build-rust-crate/log.nix
··· 1 { lib }: 2 3 let echo_colored_body = start_escape: 4 - # Body of a function that behaves like "echo" but 5 # has the output colored by the given start_escape 6 # sequence. E.g. 7 # 8 # * echo_x "Building ..." 9 # * echo_x -n "Running " 10 # 11 - # This is more complicated than apparent at first sight 12 # because: 13 # * The color markers and the text must be print 14 # in the same echo statement. Otherise, other 15 - # intermingled text from concurrent builds will 16 # be colored as well. 17 # * We need to preserve the trailing newline of the 18 # echo if and only if it is present. Bash likes 19 # to strip those if we capture the output of echo 20 - # in a variable. 21 # * Leading "-" will be interpreted by test as an 22 # option for itself. Therefore, we prefix it with 23 # an x in `[[ "x$1" =~ ^x- ]]`. ··· 27 echo_args+=" $1" 28 shift 29 done 30 - 31 local start_escape="$(printf '${start_escape}')" 32 local reset="$(printf '\033[0m')" 33 echo $echo_args $start_escape"$@"$reset 34 ''; 35 echo_conditional_colored_body = colors: start_escape: 36 - if colors == "always" 37 then (echo_colored_body start_escape) 38 else ''echo "$@"''; 39 in { ··· 50 noisily = colors: verbose: '' 51 noisily() { 52 ${lib.optionalString verbose '' 53 - echo_colored -n "Running " 54 echo $@ 55 ''} 56 $@
··· 1 { lib }: 2 3 let echo_colored_body = start_escape: 4 + # Body of a function that behaves like "echo" but 5 # has the output colored by the given start_escape 6 # sequence. E.g. 7 # 8 # * echo_x "Building ..." 9 # * echo_x -n "Running " 10 # 11 + # This is more complicated than apparent at first sight 12 # because: 13 # * The color markers and the text must be print 14 # in the same echo statement. Otherise, other 15 + # intermingled text from concurrent builds will 16 # be colored as well. 17 # * We need to preserve the trailing newline of the 18 # echo if and only if it is present. Bash likes 19 # to strip those if we capture the output of echo 20 + # in a variable. 21 # * Leading "-" will be interpreted by test as an 22 # option for itself. Therefore, we prefix it with 23 # an x in `[[ "x$1" =~ ^x- ]]`. ··· 27 echo_args+=" $1" 28 shift 29 done 30 + 31 local start_escape="$(printf '${start_escape}')" 32 local reset="$(printf '\033[0m')" 33 echo $echo_args $start_escape"$@"$reset 34 ''; 35 echo_conditional_colored_body = colors: start_escape: 36 + if colors == "always" 37 then (echo_colored_body start_escape) 38 else ''echo "$@"''; 39 in { ··· 50 noisily = colors: verbose: '' 51 noisily() { 52 ${lib.optionalString verbose '' 53 + echo_colored -n "Running " 54 echo $@ 55 ''} 56 $@