2022-12-17 10:02:37 +00:00
|
|
|
{ lib
|
2021-04-12 18:23:04 +00:00
|
|
|
, fetchFromGitHub
|
|
|
|
, mono
|
2022-12-17 10:02:37 +00:00
|
|
|
, buildDotnetModule
|
|
|
|
, dotnetCorePackages
|
2021-04-12 18:23:04 +00:00
|
|
|
, unzip
|
|
|
|
}:
|
|
|
|
|
2022-12-17 10:02:37 +00:00
|
|
|
buildDotnetModule rec {
|
2021-04-12 18:23:04 +00:00
|
|
|
pname = "roslyn";
|
2022-12-17 10:02:37 +00:00
|
|
|
version = "4.2.0";
|
2021-04-12 18:23:04 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "dotnet";
|
|
|
|
repo = "roslyn";
|
|
|
|
rev = "v${version}";
|
2022-12-17 10:02:37 +00:00
|
|
|
hash = "sha256-4iXabFp0LqJ8TXOrqeD+oTAocg6ZTIfijfX3s3fMJuI=";
|
2021-04-12 18:23:04 +00:00
|
|
|
};
|
|
|
|
|
2022-12-17 10:02:37 +00:00
|
|
|
dotnet-sdk = dotnetCorePackages.sdk_6_0;
|
|
|
|
|
|
|
|
projectFile = [ "src/NuGet/Microsoft.Net.Compilers.Toolset/Microsoft.Net.Compilers.Toolset.Package.csproj" ];
|
|
|
|
|
2023-07-15 17:15:38 +00:00
|
|
|
nugetDeps = ./deps.nix;
|
2022-12-17 10:02:37 +00:00
|
|
|
|
|
|
|
dontDotnetFixup = true;
|
|
|
|
|
|
|
|
nativeBuildInputs = [ unzip ];
|
|
|
|
|
|
|
|
postPatch = ''
|
|
|
|
sed -i 's/latestPatch/latestFeature/' global.json
|
|
|
|
'';
|
2021-04-12 18:23:04 +00:00
|
|
|
|
|
|
|
buildPhase = ''
|
|
|
|
runHook preBuild
|
|
|
|
|
2022-12-17 10:02:37 +00:00
|
|
|
dotnet msbuild -v:m -t:pack \
|
2021-04-12 18:23:04 +00:00
|
|
|
-p:Configuration=Release \
|
|
|
|
-p:RepositoryUrl="${meta.homepage}" \
|
|
|
|
-p:RepositoryCommit="v${version}" \
|
|
|
|
src/NuGet/Microsoft.Net.Compilers.Toolset/Microsoft.Net.Compilers.Toolset.Package.csproj
|
|
|
|
|
|
|
|
runHook postBuild
|
|
|
|
'';
|
|
|
|
|
|
|
|
installPhase = ''
|
2022-12-17 10:02:37 +00:00
|
|
|
pkg="$out/lib/dotnet/microsoft.net.compilers.toolset/${version}"
|
|
|
|
mkdir -p "$out/bin" "$pkg"
|
|
|
|
|
|
|
|
unzip -q artifacts/packages/Release/Shipping/Microsoft.Net.Compilers.Toolset.${version}-dev.nupkg \
|
|
|
|
-d "$pkg"
|
2021-04-12 18:23:04 +00:00
|
|
|
# nupkg has 0 permissions for a bunch of things
|
2022-12-17 10:02:37 +00:00
|
|
|
chmod -R +rw "$pkg"
|
2021-04-12 18:23:04 +00:00
|
|
|
|
|
|
|
makeWrapper ${mono}/bin/mono $out/bin/csc \
|
|
|
|
--add-flags "$pkg/tasks/net472/csc.exe"
|
2022-12-17 10:02:37 +00:00
|
|
|
makeWrapper ${mono}/bin/mono $out/bin/vbc \
|
|
|
|
--add-flags "$pkg/tasks/net472/vbc.exe"
|
2021-04-12 18:23:04 +00:00
|
|
|
'';
|
|
|
|
|
|
|
|
meta = with lib; {
|
|
|
|
description = ".NET C# and Visual Basic compiler";
|
|
|
|
homepage = "https://github.com/dotnet/roslyn";
|
2022-12-17 10:02:37 +00:00
|
|
|
mainProgram = "csc";
|
2021-04-12 18:23:04 +00:00
|
|
|
license = licenses.mit;
|
|
|
|
maintainers = with maintainers; [ corngood ];
|
|
|
|
};
|
|
|
|
}
|