diff options
Diffstat (limited to 'pkgs/development/compilers/dotnet/packages.nix')
-rw-r--r-- | pkgs/development/compilers/dotnet/packages.nix | 57 |
1 files changed, 52 insertions, 5 deletions
diff --git a/pkgs/development/compilers/dotnet/packages.nix b/pkgs/development/compilers/dotnet/packages.nix index 4ce789e00b912..db9b5e68bdbf2 100644 --- a/pkgs/development/compilers/dotnet/packages.nix +++ b/pkgs/development/compilers/dotnet/packages.nix @@ -1,6 +1,9 @@ { stdenv , callPackage , vmr +, xmlstarlet +, strip-nondeterminism +, zip }: let @@ -16,6 +19,12 @@ in { src = vmr; dontUnpack = true; + nativeBuildInputs = [ + xmlstarlet + strip-nondeterminism + zip + ]; + outputs = [ "out" "packages" "artifacts" ]; installPhase = '' @@ -26,17 +35,55 @@ in { mkdir "$out"/bin ln -s "$out"/dotnet "$out"/bin/dotnet - mkdir "$packages" - # this roughly corresponds to the {sdk,aspnetcore}_packages in ../update.sh - cp -r "$src"/Private.SourceBuilt.Artifacts.*.${targetRid}/*Microsoft.{NET.ILLink.Tasks,NETCore,DotNet,AspNetCore}.*.nupkg "$packages" - - cp -r "$src"/Private.SourceBuilt.Artifacts.*.${targetRid} "$artifacts" + mkdir -p "$packages" "$artifacts" + cp -r "$src"/Private.SourceBuilt.Artifacts.*.${targetRid}/* "$artifacts"/ + chmod +w -R "$artifacts" + + local package + + for package in "$artifacts"/*.nupkg; do + local copy + case "$(basename "$package")" in + *Microsoft.NET.* | \ + *Microsoft.ILLink.* | \ + *Microsoft.Tasks.* | \ + *Microsoft.NETCore.* | \ + *Microsoft.DotNet.* | \ + *Microsoft.AspNetCore.*) copy=1 ;; + *) copy= ;; + esac + if [[ -n $copy ]]; then + echo copying "$package" to packages + xmlstarlet \ + sel -t \ + -m /_:package/_:metadata \ + -v _:id -nl \ + -v _:version -nl \ + "$package"/*.nuspec \ + | tr A-Z a-z | ( + read id + read version + mkdir -p "$packages"/share/nuget/packages/"$id" + cp -r "$package" "$packages"/share/nuget/packages/"$id"/"$version" + ) + fi + done + + for package in "$artifacts"/{,SourceBuildReferencePackages/}*.nupkg; do + echo packing "$package" to artifacts + (cd "$package" && zip -rq0 "$package.tmp" .) + strip-nondeterminism --type zip "$package.tmp" + rm -r "$package" + mv "$package.tmp" "$package" + done runHook postInstall ''; passthru = { inherit (vmr) icu targetRid; + # ilcompiler is currently broken: https://github.com/dotnet/source-build/issues/1215 + hasILCompiler = false; }; meta = vmr.meta // { |