omnisharp-roslyn: drop .NET 7 test, refactor (#343690)

This commit is contained in:
David McFarland 2024-10-31 12:07:17 -03:00 committed by GitHub
commit c286340232
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 127 additions and 97 deletions

View File

@ -0,0 +1,125 @@
{
buildDotnetModule,
dotnetCorePackages,
fetchFromGitHub,
lib,
stdenv,
runCommand,
expect,
}:
let
inherit (dotnetCorePackages) sdk_8_0 runtime_6_0;
in
let
finalPackage = buildDotnetModule rec {
pname = "omnisharp-roslyn";
version = "1.39.12";
src = fetchFromGitHub {
owner = "OmniSharp";
repo = "omnisharp-roslyn";
rev = "refs/tags/v${version}";
hash = "sha256-WQIBNqUqvVA0UhSoPdf179X+GYKp4LhPvYeEAet6TnY=";
};
projectFile = "src/OmniSharp.Stdio.Driver/OmniSharp.Stdio.Driver.csproj";
nugetDeps = ./deps.nix;
dotnet-sdk =
with dotnetCorePackages;
combinePackages [
sdk_6_0
sdk_8_0
];
dotnet-runtime = sdk_8_0;
dotnetInstallFlags = [ "--framework net6.0" ];
dotnetBuildFlags = [
"--framework net6.0"
"--no-self-contained"
];
dotnetFlags = [
# These flags are set by the cake build.
"-property:PackageVersion=${version}"
"-property:AssemblyVersion=${version}.0"
"-property:FileVersion=${version}.0"
"-property:InformationalVersion=${version}"
"-property:RuntimeFrameworkVersion=${runtime_6_0.version}"
"-property:RollForward=LatestMajor"
];
postPatch = ''
# Relax the version requirement
rm global.json
# Patch the project files so we can compile them properly
for project in src/OmniSharp.Http.Driver/OmniSharp.Http.Driver.csproj src/OmniSharp.LanguageServerProtocol/OmniSharp.LanguageServerProtocol.csproj src/OmniSharp.Stdio.Driver/OmniSharp.Stdio.Driver.csproj; do
substituteInPlace $project \
--replace '<RuntimeIdentifiers>win7-x64;win7-x86;win10-arm64</RuntimeIdentifiers>' '<RuntimeIdentifiers>linux-x64;linux-arm64;osx-x64;osx-arm64</RuntimeIdentifiers>'
done
'';
useDotnetFromEnv = true;
executables = [ "OmniSharp" ];
passthru.tests =
let
with-sdk =
sdk:
runCommand "with-${if sdk ? version then sdk.version else "no"}-sdk"
{
nativeBuildInputs = [
finalPackage
sdk
expect
];
meta.timeout = 60;
}
''
HOME=$TMPDIR
expect <<"EOF"
spawn OmniSharp
expect_before timeout {
send_error "timeout!\n"
exit 1
}
expect ".NET Core SDK ${if sdk ? version then sdk.version else sdk_8_0.version}"
expect "{\"Event\":\"started\","
send \x03
expect eof
catch wait result
exit [lindex $result 3]
EOF
touch $out
'';
in
{
# Make sure we can run OmniSharp with any supported SDK version, as well as without
with-net6-sdk = with-sdk dotnetCorePackages.sdk_6_0;
with-net8-sdk = with-sdk dotnetCorePackages.sdk_8_0;
no-sdk = with-sdk null;
};
passthru.updateScript = ./update.sh;
meta = {
description = "OmniSharp based on roslyn workspaces";
homepage = "https://github.com/OmniSharp/omnisharp-roslyn";
sourceProvenance = with lib.sourceTypes; [
fromSource
binaryNativeCode # dependencies
];
license = lib.licenses.mit;
maintainers = with lib.maintainers; [
corngood
ericdallo
gepbird
mdarocha
tesq0
];
mainProgram = "OmniSharp";
};
};
in
finalPackage

View File

@ -6,8 +6,8 @@ set -euo pipefail
cd "$(dirname "${BASH_SOURCE[0]}")"
new_version="$(curl -s "https://api.github.com/repos/OmniSharp/omnisharp-roslyn/releases?per_page=1" | jq -r '.[0].name')"
old_version="$(sed -nE 's/\s*version = "(.*)".*/\1/p' ./default.nix)"
new_version="$(curl -s "https://api.github.com/repos/OmniSharp/omnisharp-roslyn/releases/latest" | jq -r '.name')"
old_version="$(sed -nE 's/\s*version = "(.*)".*/\1/p' ./package.nix)"
if [[ "$new_version" == "$old_version" ]]; then
echo "Already up to date!"

View File

@ -1,93 +0,0 @@
{ buildDotnetModule
, dotnetCorePackages
, fetchFromGitHub
, lib
, stdenv
, runCommand
, expect
}:
let
inherit (dotnetCorePackages) sdk_8_0 runtime_6_0;
in
let finalPackage = buildDotnetModule rec {
pname = "omnisharp-roslyn";
version = "1.39.12";
src = fetchFromGitHub {
owner = "OmniSharp";
repo = "omnisharp-roslyn";
rev = "refs/tags/v${version}";
hash = "sha256-WQIBNqUqvVA0UhSoPdf179X+GYKp4LhPvYeEAet6TnY=";
};
projectFile = "src/OmniSharp.Stdio.Driver/OmniSharp.Stdio.Driver.csproj";
nugetDeps = ./deps.nix;
dotnet-sdk = with dotnetCorePackages; combinePackages [ sdk_6_0 sdk_8_0 ];
dotnet-runtime = sdk_8_0;
dotnetInstallFlags = [ "--framework net6.0" ];
dotnetBuildFlags = [ "--framework net6.0" "--no-self-contained" ];
dotnetFlags = [
# These flags are set by the cake build.
"-property:PackageVersion=${version}"
"-property:AssemblyVersion=${version}.0"
"-property:FileVersion=${version}.0"
"-property:InformationalVersion=${version}"
"-property:RuntimeFrameworkVersion=${runtime_6_0.version}"
"-property:RollForward=LatestMajor"
];
postPatch = ''
# Relax the version requirement
rm global.json
# Patch the project files so we can compile them properly
for project in src/OmniSharp.Http.Driver/OmniSharp.Http.Driver.csproj src/OmniSharp.LanguageServerProtocol/OmniSharp.LanguageServerProtocol.csproj src/OmniSharp.Stdio.Driver/OmniSharp.Stdio.Driver.csproj; do
substituteInPlace $project \
--replace '<RuntimeIdentifiers>win7-x64;win7-x86;win10-arm64</RuntimeIdentifiers>' '<RuntimeIdentifiers>linux-x64;linux-arm64;osx-x64;osx-arm64</RuntimeIdentifiers>'
done
'';
useDotnetFromEnv = true;
executables = [ "OmniSharp" ];
passthru.tests = let
with-sdk = sdk: runCommand "with-${if sdk ? version then sdk.version else "no"}-sdk"
{ nativeBuildInputs = [ finalPackage sdk expect ]; meta.timeout = 60; } ''
HOME=$TMPDIR
expect <<"EOF"
spawn OmniSharp
expect_before timeout {
send_error "timeout!\n"
exit 1
}
expect ".NET Core SDK ${if sdk ? version then sdk.version else sdk_8_0.version}"
expect "{\"Event\":\"started\","
send \x03
expect eof
catch wait result
exit [lindex $result 3]
EOF
touch $out
'';
in {
# Make sure we can run OmniSharp with any supported SDK version, as well as without
with-net6-sdk = with-sdk dotnetCorePackages.sdk_6_0;
with-net7-sdk = with-sdk dotnetCorePackages.sdk_7_0;
with-net8-sdk = with-sdk dotnetCorePackages.sdk_8_0;
no-sdk = with-sdk null;
};
meta = {
description = "OmniSharp based on roslyn workspaces";
homepage = "https://github.com/OmniSharp/omnisharp-roslyn";
sourceProvenance = with lib.sourceTypes; [
fromSource
binaryNativeCode # dependencies
];
license = lib.licenses.mit;
maintainers = with lib.maintainers; [ tesq0 ericdallo corngood mdarocha ];
mainProgram = "OmniSharp";
};
}; in finalPackage

View File

@ -38327,8 +38327,6 @@ with pkgs;
nanoizeNewlib = true;
};
omnisharp-roslyn = callPackage ../development/tools/omnisharp-roslyn { };
wasmtime = callPackage ../development/interpreters/wasmtime {
inherit (darwin.apple_sdk.frameworks) Security;
};