Merge pull request #64429 from eadwu/vscode-extensions.ms-vscode.cpptools/0.24.0

vscode-extensions.ms-vscode.cpptools: 0.23.1 -> 0.24.0
This commit is contained in:
worldofpeace 2019-07-08 20:40:24 -04:00 committed by GitHub
commit bf7ab595dc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,4 +1,7 @@
{ stdenv, fetchzip, vscode-utils, jq, mono, clang-tools, writeScript, runtimeShell
{ stdenv, vscode-utils
, fetchurl, unzip
, mono, writeScript, runtimeShell
, jq, clang-tools
, gdbUseFixed ? true, gdb # The gdb default setting will be fixed to specified. Use version from `PATH` otherwise.
}:
@ -30,25 +33,37 @@ assert gdbUseFixed -> null != gdb;
let
gdbDefaultsTo = if gdbUseFixed then "${gdb}/bin/gdb" else "gdb";
langComponentBinaries = stdenv.mkDerivation {
langComponentBinaries = stdenv.mkDerivation rec {
name = "cpptools-language-component-binaries";
src = fetchzip {
src = fetchurl {
# Follow https://go.microsoft.com/fwlink/?linkid=2037608
url = "https://download.visualstudio.microsoft.com/download/pr/97ed3eeb-b31e-421c-92dc-4f3a98af301e/069a1e6ab1b4b017853a7e9e08067744/bin_linux.zip";
sha256 = "19flm4vcrg89x0b20bd0g45apabzfqgvcpjddnmyk312jc242gmb";
url = "https://download.visualstudio.microsoft.com/download/pr/fd05d7fd-b771-4746-9c54-b5b30afcd82e/1f443716d6156a265bf50cb6e53fa999/bin_linux.zip";
sha256 = "198xnq709clibjmd8rrv0haniy2m3qvhn89hg9hpj6lvg9lsr7a4";
};
patchPhase = ''
elfInterpreter="${stdenv.glibc.out}/lib/ld-linux-x86-64.so.2"
patchelf --set-interpreter "$elfInterpreter" ./Microsoft.VSCode.CPP.Extension.linux
patchelf --set-interpreter "$elfInterpreter" ./Microsoft.VSCode.CPP.IntelliSense.Msvc.linux
chmod a+x ./Microsoft.VSCode.CPP.Extension.linux ./Microsoft.VSCode.CPP.IntelliSense.Msvc.linux
sourceRoot = name;
nativeBuildInputs = [ unzip ];
unpackPhase = ''
runHook preUnpack
unzip -d $name $src || true
runHook postUnpack
'';
installPhase = ''
runHook preInstall
mkdir -p "$out/bin"
find . -mindepth 1 -maxdepth 1 | xargs cp -a -t "$out/bin"
cp -a -t "$out/bin" ./bin/*
runHook postInstall
'';
postFixup = ''
elfInterpreter="$(cat $NIX_CC/nix-support/dynamic-linker)"
patchelf --set-interpreter "$elfInterpreter" $out/bin/Microsoft.VSCode.CPP.Extension.linux
patchelf --set-interpreter "$elfInterpreter" $out/bin/Microsoft.VSCode.CPP.IntelliSense.Msvc.linux
chmod a+x $out/bin/Microsoft.VSCode.CPP.Extension.linux $out/bin/Microsoft.VSCode.CPP.IntelliSense.Msvc.linux
'';
};
@ -68,8 +83,8 @@ vscode-utils.buildVscodeMarketplaceExtension {
mktplcRef = {
name = "cpptools";
publisher = "ms-vscode";
version = "0.23.1";
sha256 = "08kfzvyl8vgjmhqzpp7pxw0gd87jr5g7z15ag4cpcil4inq4c8k3";
version = "0.24.0";
sha256 = "0b0rwj3aadd4kf561zpzv95r96dqvhkn7db8d7rz3naaqydz0z8i";
};
buildInputs = [
@ -80,16 +95,12 @@ vscode-utils.buildVscodeMarketplaceExtension {
mv ./package.json ./package_ori.json
# 1. Add activation events so that the extension is functional. This listing is empty when unpacking the extension but is filled at runtime.
# 2. Patch `packages.json` so that nix's *gdb* is used as default value for `miDebuggerPath`.
# 2. Patch `package.json` so that nix's *gdb* is used as default value for `miDebuggerPath`.
cat ./package_ori.json | \
jq --slurpfile actEvts ${./package-activation-events.json} '(.activationEvents) = $actEvts[0]' | \
jq '(.contributes.debuggers[].configurationAttributes | .attach , .launch | .properties.miDebuggerPath | select(. != null) | select(.default == "/usr/bin/gdb") | .default) = "${gdbDefaultsTo}"' > \
./package.json
# Patch `packages.json` so that nix's *gdb* is used as default value for `miDebuggerPath`.
substituteInPlace "./package.json" \
--replace "\"default\": \"/usr/bin/gdb\"" "\"default\": \"${gdbDefaultsTo}\""
# Prevent download/install of extensions
touch "./install.lock"