Merge pull request #295098 from GGG-KILLER/update/ms-dotnettools.csharp-2.22.2

vscode-extensions.ms-dotnettools.csharp: 1.25.4 -> 2.22.3
This commit is contained in:
Sandro 2024-03-14 20:25:55 +01:00 committed by GitHub
commit 6ad10aa4ed
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1,72 +1,63 @@
{ lib { lib
, fetchurl
, vscode-utils , vscode-utils
, patchelf , patchelf
, icu , icu
, stdenv , stdenv
, openssl , openssl
, coreutils , coreutils
,
}: }:
let let
inherit (stdenv.hostPlatform) system; inherit (stdenv.hostPlatform) system;
inherit (vscode-utils) buildVscodeMarketplaceExtension;
version = "1.25.4"; extInfo =
vsixInfo =
let let
linuxDebuggerBins = [ baseBins = [
".roslyn/Microsoft.CodeAnalysis.LanguageServer"
".razor/rzls"
];
linuxBins = baseBins ++ [
".debugger/vsdbg-ui" ".debugger/vsdbg-ui"
".debugger/vsdbg" ".debugger/vsdbg"
]; ];
darwinX86DebuggerBins = [ darwinBins = baseBins ++ [
".debugger/x86_64/vsdbg-ui" ".debugger/x86_64/vsdbg-ui"
".debugger/x86_64/vsdbg" ".debugger/x86_64/vsdbg"
]; ];
darwinAarch64DebuggerBins = [
".debugger/arm64/vsdbg-ui"
".debugger/arm64/vsdbg"
];
omniSharpBins = [
".omnisharp/1.39.4-net6.0/OmniSharp"
];
razorBins = [
".razor/createdump"
".razor/rzls"
];
in in
{ {
x86_64-linux = { x86_64-linux = {
url = "https://github.com/OmniSharp/omnisharp-vscode/releases/download/v${version}/csharp-${version}-linux-x64.vsix"; arch = "linux-x64";
sha256 = "08k0wxyj8wz8npw1yqrkdpbvwbnrdnsngdkrd2p5ayn3v608ifc2"; sha256 = "sha256-si4HKGVIHu44QNlNI2WEnMff9+QZOMWiBfWQaaFGyQE=";
binaries = linuxDebuggerBins ++ omniSharpBins ++ razorBins; binaries = linuxBins;
}; };
aarch64-linux = { aarch64-linux = {
url = "https://github.com/OmniSharp/omnisharp-vscode/releases/download/v${version}/csharp-${version}-linux-arm64.vsix"; arch = "linux-arm64";
sha256 = "09r2d463dk35905f2c3msqzxa7ylcf0ynhbp3n6d12y3x1200pr2"; sha256 = "sha256-1IXkSRgCHOLD4VeCdqyy54MXCBUX5RDDb3pf7GQH5jA=";
binaries = linuxDebuggerBins ++ omniSharpBins ++ razorBins; binaries = linuxBins;
}; };
x86_64-darwin = { x86_64-darwin = {
url = "https://github.com/OmniSharp/omnisharp-vscode/releases/download/v${version}/csharp-${version}-darwin-x64.vsix"; arch = "darwin-x64";
sha256 = "0mp550kq33zwmlvrhymwnixl4has62imw3ia5z7a01q7mp0w9wpn"; sha256 = "sha256-AAbYjZ+YYyGEXSLkiFfluLf7P4OzPhmHzK44N5XT9UI=";
binaries = darwinX86DebuggerBins ++ omniSharpBins ++ razorBins; binaries = darwinBins;
}; };
aarch64-darwin = { aarch64-darwin = {
url = "https://github.com/OmniSharp/omnisharp-vscode/releases/download/v${version}/csharp-${version}-darwin-arm64.vsix"; arch = "darwin-arm64";
sha256 = "08406xz2raal8f10bmnkz1mwdfprsbkjxzc01v0i4sax1hr2a2yl"; sha256 = "sha256-1m47kX0Jo+UvthNfgdoPdBBOcDyCA8DfP+zRk3SicR0=";
binaries = darwinAarch64DebuggerBins ++ darwinX86DebuggerBins ++ omniSharpBins ++ razorBins; binaries = darwinBins ++ [
".debugger/arm64/vsdbg-ui"
".debugger/arm64/vsdbg"
];
}; };
}.${system} or (throw "Unsupported system: ${system}"); }.${system} or (throw "Unsupported system: ${system}");
in in
vscode-utils.buildVscodeMarketplaceExtension rec { buildVscodeMarketplaceExtension {
mktplcRef = { mktplcRef = {
name = "csharp"; name = "csharp";
publisher = "ms-dotnettools"; publisher = "ms-dotnettools";
inherit version; version = "2.22.3";
}; inherit (extInfo) sha256 arch;
vsix = fetchurl {
name = "${mktplcRef.publisher}-${mktplcRef.name}.zip";
inherit (vsixInfo) url sha256;
}; };
nativeBuildInputs = [ nativeBuildInputs = [
@ -74,63 +65,47 @@ vscode-utils.buildVscodeMarketplaceExtension rec {
]; ];
postPatch = '' postPatch = ''
declare ext_unique_id patchelf_add_icu_as_needed() {
# See below as to why we cannot take the whole basename. declare elf="''${1?}"
ext_unique_id="$(basename "$out" | head -c 32)" declare icu_major_v="${
lib.head (lib.splitVersion (lib.getVersion icu.name))
}"
# Fix 'Unable to connect to debuggerEventsPipeName .. exceeds the maximum length 107.' when for icu_lib in icui18n icuuc icudata; do
# attempting to launch a specific test in debug mode. The extension attemps to open patchelf --add-needed "lib''${icu_lib}.so.$icu_major_v" "$elf"
# a pipe in extension dir which would fail anyway. We change to target file path done
# to a path in tmp dir with a short name based on the unique part of the nix store path. }
# This is however a brittle patch as we're working on minified code.
# Hence the attempt to only hold on stable names.
# However, this really would better be fixed upstream.
sed -i \
-E -e 's/(this\._pipePath=[a-zA-Z0-9_]+\.join\()([a-zA-Z0-9_]+\.getExtensionPath\(\)[^,]*,)/\1require("os").tmpdir(), "'"$ext_unique_id"'"\+/g' \
"$PWD/dist/extension.js"
# Fix reference to uname patchelf_common() {
sed -i \ declare elf="''${1?}"
-E -e 's_uname -m_${coreutils}/bin/uname -m_g' \
"$PWD/dist/extension.js"
patchelf_add_icu_as_needed() { patchelf_add_icu_as_needed "$elf"
declare elf="''${1?}" patchelf --add-needed "libssl.so" "$elf"
declare icu_major_v="${ patchelf --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \
lib.head (lib.splitVersion (lib.getVersion icu.name)) --set-rpath "${lib.makeLibraryPath [stdenv.cc.cc openssl icu.out]}:\$ORIGIN" \
}" "$elf"
}
for icu_lib in icui18n icuuc icudata; do substituteInPlace dist/extension.js \
patchelf --add-needed "lib''${icu_lib}.so.$icu_major_v" "$elf" --replace 'uname -m' '${lib.getExe' coreutils "uname"} -m'
done
}
patchelf_common() { ''
declare elf="''${1?}" + (lib.concatStringsSep "\n" (map
(bin: ''
patchelf_add_icu_as_needed "$elf" chmod +x "${bin}"
patchelf --add-needed "libssl.so" "$elf" '')
patchelf --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \ extInfo.binaries))
--set-rpath "${lib.makeLibraryPath [ stdenv.cc.cc openssl icu.out ]}:\$ORIGIN" \ + lib.optionalString stdenv.isLinux (lib.concatStringsSep "\n" (map
"$elf" (bin: ''
} patchelf_common "${bin}"
'')
'' + (lib.concatStringsSep "\n" (map extInfo.binaries));
(bin: ''
chmod +x "${bin}"
'')
vsixInfo.binaries))
+ lib.optionalString stdenv.isLinux (lib.concatStringsSep "\n" (map
(bin: ''
patchelf_common "${bin}"
'')
vsixInfo.binaries));
meta = { meta = {
description = "C# for Visual Studio Code (powered by OmniSharp)"; description = "Official C# support for Visual Studio Code";
homepage = "https://github.com/OmniSharp/omnisharp-vscode"; homepage = "https://github.com/dotnet/vscode-csharp";
license = lib.licenses.mit; license = lib.licenses.mit;
maintainers = [ lib.maintainers.jraygauthier ]; maintainers = with lib.maintainers; [ ggg ];
platforms = [ "x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin" ]; platforms = [ "x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin" ];
}; };
} }