mirror of
https://github.com/ilyakooo0/nixpkgs.git
synced 2024-11-20 00:53:12 +03:00
Merge pull request #202765 from mdarocha/roslyn-update
This commit is contained in:
commit
02e6e7a535
@ -26,6 +26,18 @@ dotnetConfigureHook() {
|
|||||||
|
|
||||||
(( "${#projectFile[@]}" == 0 )) && dotnetRestore
|
(( "${#projectFile[@]}" == 0 )) && dotnetRestore
|
||||||
|
|
||||||
|
# Generate a NuGet.config file to make sure everything,
|
||||||
|
# including things like <Sdk /> dependencies, is restored from the proper source
|
||||||
|
cat <<EOF > "./NuGet.config"
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<configuration>
|
||||||
|
<packageSources>
|
||||||
|
<clear />
|
||||||
|
<add key="nugetSource" value="@nugetSource@/lib" />
|
||||||
|
</packageSources>
|
||||||
|
</configuration>
|
||||||
|
EOF
|
||||||
|
|
||||||
for project in ${projectFile[@]} ${testProjectFile[@]-}; do
|
for project in ${projectFile[@]} ${testProjectFile[@]-}; do
|
||||||
dotnetRestore "$project"
|
dotnetRestore "$project"
|
||||||
done
|
done
|
||||||
|
@ -1,65 +0,0 @@
|
|||||||
#!/usr/bin/env nix-shell
|
|
||||||
#!nix-shell -i bash -p dotnet-sdk_5 -p jq -p xmlstarlet -p curl
|
|
||||||
set -euo pipefail
|
|
||||||
|
|
||||||
cat << EOL
|
|
||||||
{ fetchurl }: [
|
|
||||||
EOL
|
|
||||||
|
|
||||||
tmpdir="$(mktemp -d -p "$(pwd)")" # must be under source root
|
|
||||||
trap 'rm -rf "$tmpdir"' EXIT
|
|
||||||
|
|
||||||
HOME="$tmpdir" dotnet msbuild -t:restore -p:Configuration=Release -p:RestorePackagesPath="$tmpdir"/.nuget/packages \
|
|
||||||
-p:RestoreNoCache=true -p:RestoreForce=true \
|
|
||||||
src/NuGet/Microsoft.Net.Compilers.Toolset/Microsoft.Net.Compilers.Toolset.Package.csproj >&2
|
|
||||||
|
|
||||||
mapfile -t repos < <(
|
|
||||||
xmlstarlet sel -t -v 'configuration/packageSources/add/@value' -n NuGet.config "$tmpdir"/.nuget/NuGet/NuGet.Config |
|
|
||||||
while IFS= read index
|
|
||||||
do
|
|
||||||
curl --compressed -fsL "$index" | \
|
|
||||||
jq -r '.resources[] | select(."@type" == "PackageBaseAddress/3.0.0")."@id"'
|
|
||||||
done
|
|
||||||
)
|
|
||||||
|
|
||||||
cd "$tmpdir/.nuget/packages"
|
|
||||||
for package in *
|
|
||||||
do
|
|
||||||
cd "$package"
|
|
||||||
for version in *
|
|
||||||
do
|
|
||||||
found=false
|
|
||||||
for repo in "${repos[@]}"
|
|
||||||
do
|
|
||||||
url="$repo$package/$version/$package.$version.nupkg"
|
|
||||||
if curl -fsL "$url" -o /dev/null
|
|
||||||
then
|
|
||||||
found=true
|
|
||||||
break
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
if ! $found
|
|
||||||
then
|
|
||||||
echo "couldn't find $package $version" >&2
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
sha256=$(nix-prefetch-url "$url" 2>/dev/null)
|
|
||||||
cat << EOL
|
|
||||||
{
|
|
||||||
pname = "$package";
|
|
||||||
version = "$version";
|
|
||||||
src = fetchurl {
|
|
||||||
url = "$url";
|
|
||||||
sha256 = "$sha256";
|
|
||||||
};
|
|
||||||
}
|
|
||||||
EOL
|
|
||||||
done
|
|
||||||
cd ..
|
|
||||||
done
|
|
||||||
|
|
||||||
cat << EOL
|
|
||||||
]
|
|
||||||
EOL
|
|
@ -1,90 +1,40 @@
|
|||||||
{ lib, stdenv
|
{ lib
|
||||||
, fetchFromGitHub
|
, fetchFromGitHub
|
||||||
, fetchurl
|
|
||||||
, mono
|
, mono
|
||||||
, dotnet-sdk_5
|
, buildDotnetModule
|
||||||
, makeWrapper
|
, dotnetCorePackages
|
||||||
, dotnetPackages
|
|
||||||
, unzip
|
, unzip
|
||||||
, writeText
|
|
||||||
, symlinkJoin
|
|
||||||
}:
|
}:
|
||||||
|
|
||||||
let
|
buildDotnetModule rec {
|
||||||
|
|
||||||
deps = map (package: stdenv.mkDerivation (with package; {
|
|
||||||
inherit pname version src;
|
|
||||||
|
|
||||||
buildInputs = [ unzip ];
|
|
||||||
unpackPhase = ''
|
|
||||||
unzip -o $src
|
|
||||||
chmod -R u+r .
|
|
||||||
function traverseRename () {
|
|
||||||
for e in *
|
|
||||||
do
|
|
||||||
t="$(echo "$e" | sed -e "s/%20/\ /g" -e "s/%2B/+/g")"
|
|
||||||
[ "$t" != "$e" ] && mv -vn "$e" "$t"
|
|
||||||
if [ -d "$t" ]
|
|
||||||
then
|
|
||||||
cd "$t"
|
|
||||||
traverseRename
|
|
||||||
cd ..
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
}
|
|
||||||
|
|
||||||
traverseRename
|
|
||||||
'';
|
|
||||||
|
|
||||||
installPhase = ''
|
|
||||||
runHook preInstall
|
|
||||||
|
|
||||||
package=$out/lib/dotnet/${pname}/${version}
|
|
||||||
mkdir -p $package
|
|
||||||
cp -r . $package
|
|
||||||
echo "{}" > $package/.nupkg.metadata
|
|
||||||
|
|
||||||
runHook postInstall
|
|
||||||
'';
|
|
||||||
|
|
||||||
dontFixup = true;
|
|
||||||
}))
|
|
||||||
(import ./deps.nix { inherit fetchurl; });
|
|
||||||
|
|
||||||
nuget-config = writeText "NuGet.Config" ''
|
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<configuration>
|
|
||||||
<packageSources>
|
|
||||||
<clear />
|
|
||||||
</packageSources>
|
|
||||||
</configuration>
|
|
||||||
'';
|
|
||||||
|
|
||||||
packages = symlinkJoin { name = "roslyn-deps"; paths = deps; };
|
|
||||||
|
|
||||||
packageVersion = "3.10.0";
|
|
||||||
|
|
||||||
in stdenv.mkDerivation rec {
|
|
||||||
|
|
||||||
pname = "roslyn";
|
pname = "roslyn";
|
||||||
version = "${packageVersion}-1.21102.26";
|
version = "4.2.0";
|
||||||
|
|
||||||
src = fetchFromGitHub {
|
src = fetchFromGitHub {
|
||||||
owner = "dotnet";
|
owner = "dotnet";
|
||||||
repo = "roslyn";
|
repo = "roslyn";
|
||||||
rev = "v${version}";
|
rev = "v${version}";
|
||||||
sha256 = "0yf4f4vpqn9lixr37lkp29m2mk51xcm3ysv2ag332xn6zm5zpm2b";
|
hash = "sha256-4iXabFp0LqJ8TXOrqeD+oTAocg6ZTIfijfX3s3fMJuI=";
|
||||||
};
|
};
|
||||||
|
|
||||||
nativeBuildInputs = [ makeWrapper dotnet-sdk_5 unzip ];
|
dotnet-sdk = dotnetCorePackages.sdk_6_0;
|
||||||
|
|
||||||
|
projectFile = [ "src/NuGet/Microsoft.Net.Compilers.Toolset/Microsoft.Net.Compilers.Toolset.Package.csproj" ];
|
||||||
|
|
||||||
|
nugetDeps = ./extended-deps.nix;
|
||||||
|
|
||||||
|
dontDotnetFixup = true;
|
||||||
|
|
||||||
|
nativeBuildInputs = [ unzip ];
|
||||||
|
|
||||||
|
postPatch = ''
|
||||||
|
sed -i 's/latestPatch/latestFeature/' global.json
|
||||||
|
'';
|
||||||
|
|
||||||
buildPhase = ''
|
buildPhase = ''
|
||||||
runHook preBuild
|
runHook preBuild
|
||||||
|
|
||||||
rm NuGet.config
|
dotnet msbuild -v:m -t:pack \
|
||||||
install -m644 -D ${nuget-config} fake-home/.nuget/NuGet/NuGet.Config
|
|
||||||
ln -s ${packages}/lib/dotnet fake-home/.nuget/packages
|
|
||||||
HOME=$(pwd)/fake-home dotnet msbuild -r -v:m -t:pack \
|
|
||||||
-p:Configuration=Release \
|
-p:Configuration=Release \
|
||||||
-p:RepositoryUrl="${meta.homepage}" \
|
-p:RepositoryUrl="${meta.homepage}" \
|
||||||
-p:RepositoryCommit="v${version}" \
|
-p:RepositoryCommit="v${version}" \
|
||||||
@ -94,22 +44,24 @@ in stdenv.mkDerivation rec {
|
|||||||
'';
|
'';
|
||||||
|
|
||||||
installPhase = ''
|
installPhase = ''
|
||||||
pkg=$out/lib/dotnet/microsoft.net.compilers.toolset/${packageVersion}
|
pkg="$out/lib/dotnet/microsoft.net.compilers.toolset/${version}"
|
||||||
mkdir -p $out/bin $pkg
|
mkdir -p "$out/bin" "$pkg"
|
||||||
unzip -q artifacts/packages/Release/Shipping/Microsoft.Net.Compilers.Toolset.${packageVersion}-dev.nupkg \
|
|
||||||
-d $pkg
|
unzip -q artifacts/packages/Release/Shipping/Microsoft.Net.Compilers.Toolset.${version}-dev.nupkg \
|
||||||
|
-d "$pkg"
|
||||||
# nupkg has 0 permissions for a bunch of things
|
# nupkg has 0 permissions for a bunch of things
|
||||||
chmod -R +rw $pkg
|
chmod -R +rw "$pkg"
|
||||||
|
|
||||||
makeWrapper ${mono}/bin/mono $out/bin/csc \
|
makeWrapper ${mono}/bin/mono $out/bin/csc \
|
||||||
--add-flags "$pkg/tasks/net472/csc.exe"
|
--add-flags "$pkg/tasks/net472/csc.exe"
|
||||||
makeWrapper ${mono}/bin/mono $out/bin/vbs \
|
makeWrapper ${mono}/bin/mono $out/bin/vbc \
|
||||||
--add-flags "$pkg/tasks/net472/vbs.exe"
|
--add-flags "$pkg/tasks/net472/vbc.exe"
|
||||||
'';
|
'';
|
||||||
|
|
||||||
meta = with lib; {
|
meta = with lib; {
|
||||||
description = ".NET C# and Visual Basic compiler";
|
description = ".NET C# and Visual Basic compiler";
|
||||||
homepage = "https://github.com/dotnet/roslyn";
|
homepage = "https://github.com/dotnet/roslyn";
|
||||||
|
mainProgram = "csc";
|
||||||
platforms = platforms.linux;
|
platforms = platforms.linux;
|
||||||
license = licenses.mit;
|
license = licenses.mit;
|
||||||
maintainers = with maintainers; [ corngood ];
|
maintainers = with maintainers; [ corngood ];
|
||||||
|
1305
pkgs/development/compilers/roslyn/deps.nix
generated
1305
pkgs/development/compilers/roslyn/deps.nix
generated
File diff suppressed because it is too large
Load Diff
11
pkgs/development/compilers/roslyn/extended-deps.nix
Normal file
11
pkgs/development/compilers/roslyn/extended-deps.nix
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
# Some required nuget packages are not picked up by the deps generation script,
|
||||||
|
# since they are referenced as a SDK reference, which unfortunately only gets
|
||||||
|
# downloaded during build time. So we include them manually.
|
||||||
|
{ fetchNuGet }: (import ./deps.nix { inherit fetchNuGet; }) ++ [
|
||||||
|
(fetchNuGet rec {
|
||||||
|
pname = "Microsoft.DotNet.Arcade.Sdk";
|
||||||
|
version = "7.0.0-beta.22171.2";
|
||||||
|
url = "https://pkgs.dev.azure.com/dnceng/9ee6d478-d288-47f7-aacc-f6e6d082ae6d/_packaging/1a5f89f6-d8da-4080-b15f-242650c914a8/nuget/v3/flat2/microsoft.dotnet.arcade.sdk/${version}/microsoft.dotnet.arcade.sdk.${version}.nupkg";
|
||||||
|
sha256 = "15y26skavivkwhnpfa984if3cnpnllbbwbdsjiyfdcalp32fhmjq";
|
||||||
|
})
|
||||||
|
]
|
Loading…
Reference in New Issue
Block a user