msbuild: 16.3 -> 16.8

This commit is contained in:
David McFarland 2020-12-24 15:18:49 -04:00
parent d386cb4000
commit 3898c9a357
4 changed files with 1631 additions and 1355 deletions

View file

@ -1,29 +1,54 @@
#!/usr/bin/env nix-shell
#!nix-shell -i bash -p msbuild
#!nix-shell -i bash -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
mapfile -t repos < <(
xmlstarlet sel -t -v 'configuration/packageSources/add/@value' -n NuGet.config |
while IFS= read index
do
curl --compressed -fsL "$index" | \
jq -r '.resources[] | select(."@type" == "PackageBaseAddress/3.0.0")."@id"'
done
)
find .packages fake-home/.nuget/packages -name \*.nupkg -printf '%P\n' | sort -u |
while IFS= read file
do
packagedir=$(dirname $file)
version=$(basename $packagedir)
package=$(dirname $packagedir)
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
(
ulimit -n 8192 # https://github.com/NuGet/Home/issues/8571
export HOME="$tmpdir"
msbuild -noAutoRsp -t:restore -p:RestoreNoCache=true MSBuild.sln
msbuild -noAutoRsp -t:restore -p:RestoreNoCache=true "$tmpdir"/.nuget/packages/microsoft.dotnet.arcade.sdk/*/tools/Tools.proj
) | \
sed -nr 's/^ *OK *(.*\.nupkg).*$/\1/p' | \
sort -u | \
while read url; do
sha256=$(nix-prefetch-url "$url" 2>/dev/null)
cat << EOL
(fetchurl {
url = "$url";
sha256 = "$sha256";
})
{
name = "$package";
version = "$version";
src = fetchurl {
url = "$url";
sha256 = "$sha256";
};
}
EOL
done

View file

@ -1,23 +1,33 @@
{ lib, stdenv, fetchurl, makeWrapper, glibcLocales, mono, dotnetPackages, unzip, dotnet-sdk }:
{ lib, stdenv, fetchurl, fetchpatch, makeWrapper, glibcLocales, mono, dotnetPackages, unzip, dotnet-sdk, writeText }:
let
xplat = fetchurl {
url = "https://github.com/mono/msbuild/releases/download/0.07/mono_msbuild_xplat-master-8f608e49.zip";
sha256 = "1jxq3fk9a6q2a8i9zacxaz3fkvc22i9qvzlpa7wbb95h42g0ffhq";
url = "https://github.com/mono/msbuild/releases/download/0.08/mono_msbuild_6.4.0.208.zip";
sha256 = "05k7qmnhfvrdgyjn6vp81jb97y21m261jnwdyqpjqpcmzz18j93g";
};
deps = import ./nuget.nix { inherit fetchurl; };
deps = map (package: package.src)
(import ./deps.nix { inherit fetchurl; });
nuget-config = writeText "NuGet.config" ''
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<clear />
</packageSources>
</configuration>
'';
in
stdenv.mkDerivation rec {
pname = "msbuild";
version = "16.3+xamarinxplat.2019.07.26.14.57";
version = "16.8+xamarinxplat.2020.07.30.15.02";
src = fetchurl {
url = "https://download.mono-project.com/sources/msbuild/msbuild-${version}.tar.xz";
sha256 = "1zcdfx4xsh62wj3g1jc2an0lppsfs691lz4dv05xbgi01aq1hk6a";
sha256 = "10amyca78b6pjfsy54b1rgwz2c1bx0sfky9zhldvzy4divckp25g";
};
nativeBuildInputs = [
@ -37,17 +47,24 @@ stdenv.mkDerivation rec {
LOCALE_ARCHIVE = lib.optionalString stdenv.isLinux
"${glibcLocales}/lib/locale/locale-archive";
patches = [
(fetchpatch {
url = "https://github.com/mono/msbuild/commit/cad85cefabdaa001fb4bdbea2f5bf1d1cdb83c9b.patch";
sha256 = "1s8agc7nxxs69b3fl1v1air0c4dpig3hy4sk11l1560jrlx06dhh";
})
];
buildPhase = ''
# nuget would otherwise try to base itself in /homeless-shelter
export HOME=$(pwd)/fake-home
cp ${nuget-config} NuGet.config
nuget sources Add -Name nixos -Source $(pwd)/nixos
for package in ${toString deps}; do
nuget add $package -Source nixos
done
nuget sources Disable -Name "nuget.org"
nuget sources Add -Name nixos -Source $(pwd)/nixos
# license check is case sensitive
mv LICENSE license.bak && mv license.bak license
@ -61,19 +78,17 @@ stdenv.mkDerivation rec {
# overwrite the file
echo "#!${stdenv.shell}" > eng/common/dotnet-install.sh
# msbuild response files to use only the nixos source
echo "/p:RestoreSources=nixos" > artifacts/mono-msbuild/MSBuild.rsp
# not patchShebangs, there is /bin/bash in the body of the script as well
substituteInPlace ./eng/cibuild_bootstrapped_msbuild.sh --replace /bin/bash ${stdenv.shell}
# DisableNerdbankVersioning https://gitter.im/Microsoft/msbuild/archives/2018/06/27?at=5b33dbc4ce3b0f268d489bfa
# TODO there are some (many?) failing tests
./eng/cibuild_bootstrapped_msbuild.sh --host_type mono --configuration Release --skip_tests /p:DisableNerdbankVersioning=true
patchShebangs stage1/mono-msbuild/msbuild
'';
installPhase = ''
mono artifacts/mono-msbuild/MSBuild.dll mono/build/install.proj /p:MonoInstallPrefix="$out" /p:Configuration=Release-MONO
stage1/mono-msbuild/msbuild mono/build/install.proj /p:MonoInstallPrefix="$out" /p:Configuration=Release-MONO
ln -s ${mono}/lib/mono/msbuild/Current/bin/Roslyn $out/lib/mono/msbuild/Current/bin/Roslyn

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff