summary refs log tree commit diff
diff options
context:
space:
mode:
authoroxalica <oxalicc@pm.me>2020-03-17 17:56:26 +0800
committeroxalica <oxalicc@pm.me>2020-03-17 17:56:26 +0800
commitbde9289415bae0e62e67072e22f5666da4c3a9f5 (patch)
treee869b71b040381d04876c02e677195b13798ec10
parent4f12275a06f6374bb05c1b14d1b8dd66141c7708 (diff)
downloadnixpkgs-bde9289415bae0e62e67072e22f5666da4c3a9f5.tar
nixpkgs-bde9289415bae0e62e67072e22f5666da4c3a9f5.tar.gz
nixpkgs-bde9289415bae0e62e67072e22f5666da4c3a9f5.tar.bz2
nixpkgs-bde9289415bae0e62e67072e22f5666da4c3a9f5.tar.lz
nixpkgs-bde9289415bae0e62e67072e22f5666da4c3a9f5.tar.xz
nixpkgs-bde9289415bae0e62e67072e22f5666da4c3a9f5.tar.zst
nixpkgs-bde9289415bae0e62e67072e22f5666da4c3a9f5.zip
rust-analyzer: check compatibility in update script
-rwxr-xr-xpkgs/development/tools/rust/rust-analyzer/update.sh11
1 files changed, 10 insertions, 1 deletions
diff --git a/pkgs/development/tools/rust/rust-analyzer/update.sh b/pkgs/development/tools/rust/rust-analyzer/update.sh
index 3b4212fd9a0..5406de00ef3 100755
--- a/pkgs/development/tools/rust/rust-analyzer/update.sh
+++ b/pkgs/development/tools/rust/rust-analyzer/update.sh
@@ -27,6 +27,16 @@ sed -e "s/rev = \".*\"/rev = \"$rev\"/" \
     -e "s/sha256 = \".*\"/sha256 = \"$sha256\"/" \
     -e "s/cargoSha256 = \".*\"/cargoSha256 = \"0000000000000000000000000000000000000000000000000000\"/" \
     --in-place ./default.nix
+node_src="$(nix-build "$nixpkgs" -A rust-analyzer.src --no-out-link)/editors/code"
+
+# Check vscode compatibility
+req_vscode_ver="$(jq '.engines.vscode' "$node_src/package.json" --raw-output)"
+req_vscode_ver="${req_vscode_ver#^}"
+cur_vscode_ver="$(nix eval --raw -f "$nixpkgs" vscode.version)"
+if [[ "$(nix eval "(builtins.compareVersions \"$req_vscode_ver\" \"$cur_vscode_ver\")")" != "-1" ]]; then
+    echo "vscode $cur_vscode_ver is incompatible with the extension requiring ^$req_vscode_ver"
+    exit 1
+fi
 
 echo "Prebuilding nix"
 cargo_sha256=$({
@@ -40,7 +50,6 @@ sed "s/cargoSha256 = \".*\"/cargoSha256 = \"$cargo_sha256\"/" \
 # Update vscode extension
 
 echo "Generating node lock"
-node_src="$(nix-build "$nixpkgs" -A rust-analyzer.src --no-out-link)/editors/code"
 pushd "$nixpkgs/pkgs/misc/vscode-extensions/rust-analyzer"
 ext_version=$(jq '.version' "$node_src/package.json" --raw-output)
 ext_publisher=$(jq '.publisher' "$node_src/package.json" --raw-output)