msbuild: use addNuGetDeps
This commit is contained in:
parent
521b7b5e5f
commit
346e862689
@ -1,57 +0,0 @@
|
|||||||
#!/usr/bin/env nix-shell
|
|
||||||
#!nix-shell -i bash -p jq -p xmlstarlet -p curl
|
|
||||||
set -euo pipefail
|
|
||||||
|
|
||||||
cat << EOL
|
|
||||||
{ fetchurl }: [
|
|
||||||
EOL
|
|
||||||
|
|
||||||
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
|
|
||||||
|
|
||||||
sha256=$(nix-prefetch-url "$url" 2>/dev/null)
|
|
||||||
cat << EOL
|
|
||||||
{
|
|
||||||
name = "$package";
|
|
||||||
version = "$version";
|
|
||||||
src = fetchurl {
|
|
||||||
url = "$url";
|
|
||||||
sha256 = "$sha256";
|
|
||||||
};
|
|
||||||
}
|
|
||||||
EOL
|
|
||||||
done
|
|
||||||
|
|
||||||
cat << EOL
|
|
||||||
]
|
|
||||||
EOL
|
|
@ -1,4 +1,4 @@
|
|||||||
{ lib, stdenv, fetchurl, makeWrapper, glibcLocales, mono, nuget, unzip, dotnetCorePackages, writeText, roslyn }:
|
{ lib, stdenv, fetchurl, makeWrapper, glibcLocales, mono, unzip, dotnetCorePackages, roslyn }:
|
||||||
|
|
||||||
let
|
let
|
||||||
|
|
||||||
@ -9,23 +9,21 @@ let
|
|||||||
sha256 = "1wnzbdpk4s9bmawlh359ak2b8zi0sgx1qvcjnvfncr1wsck53v7q";
|
sha256 = "1wnzbdpk4s9bmawlh359ak2b8zi0sgx1qvcjnvfncr1wsck53v7q";
|
||||||
};
|
};
|
||||||
|
|
||||||
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>
|
|
||||||
'';
|
|
||||||
|
|
||||||
inherit (stdenv.hostPlatform.extensions) sharedLibrary;
|
inherit (stdenv.hostPlatform.extensions) sharedLibrary;
|
||||||
|
|
||||||
|
mkPackage = attrs: stdenv.mkDerivation (finalAttrs:
|
||||||
|
dotnetCorePackages.addNuGetDeps
|
||||||
|
{
|
||||||
|
nugetDeps = ./deps.nix;
|
||||||
|
overrideFetchAttrs = a: {
|
||||||
|
dontBuild = false;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
attrs finalAttrs);
|
||||||
|
|
||||||
in
|
in
|
||||||
|
|
||||||
stdenv.mkDerivation rec {
|
mkPackage rec {
|
||||||
pname = "msbuild";
|
pname = "msbuild";
|
||||||
version = "16.10.1+xamarinxplat.2021.05.26.14.00";
|
version = "16.10.1+xamarinxplat.2021.05.26.14.00";
|
||||||
|
|
||||||
@ -42,7 +40,6 @@ stdenv.mkDerivation rec {
|
|||||||
];
|
];
|
||||||
|
|
||||||
buildInputs = [
|
buildInputs = [
|
||||||
nuget
|
|
||||||
glibcLocales
|
glibcLocales
|
||||||
];
|
];
|
||||||
|
|
||||||
@ -52,6 +49,10 @@ stdenv.mkDerivation rec {
|
|||||||
"${glibcLocales}/lib/locale/locale-archive";
|
"${glibcLocales}/lib/locale/locale-archive";
|
||||||
|
|
||||||
postPatch = ''
|
postPatch = ''
|
||||||
|
# this is not a valid name for the dotnet build hooks, but it's referenced
|
||||||
|
# by internal scripts, so we need both
|
||||||
|
ln -s NuGet.config nuget.config
|
||||||
|
|
||||||
# not patchShebangs, there is /bin/bash in the body of the script as well
|
# 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}
|
substituteInPlace ./eng/cibuild_bootstrapped_msbuild.sh --replace /bin/bash ${stdenv.shell}
|
||||||
|
|
||||||
@ -64,18 +65,9 @@ stdenv.mkDerivation rec {
|
|||||||
mv LICENSE license.bak && mv license.bak license
|
mv LICENSE license.bak && mv license.bak license
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
linkNugetPackages = true;
|
||||||
|
|
||||||
buildPhase = ''
|
buildPhase = ''
|
||||||
unset NUGET_PACKAGES
|
|
||||||
# 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
|
|
||||||
|
|
||||||
mkdir -p artifacts
|
mkdir -p artifacts
|
||||||
unzip ${xplat} -d artifacts
|
unzip ${xplat} -d artifacts
|
||||||
mv artifacts/msbuild artifacts/mono-msbuild
|
mv artifacts/msbuild artifacts/mono-msbuild
|
||||||
@ -98,7 +90,7 @@ stdenv.mkDerivation rec {
|
|||||||
|
|
||||||
# DisableNerdbankVersioning https://gitter.im/Microsoft/msbuild/archives/2018/06/27?at=5b33dbc4ce3b0f268d489bfa
|
# DisableNerdbankVersioning https://gitter.im/Microsoft/msbuild/archives/2018/06/27?at=5b33dbc4ce3b0f268d489bfa
|
||||||
# TODO there are some (many?) failing tests
|
# TODO there are some (many?) failing tests
|
||||||
./eng/cibuild_bootstrapped_msbuild.sh --host_type mono --configuration Release --skip_tests /p:DisableNerdbankVersioning=true
|
NuGetPackageRoot="$NUGET_PACKAGES" ./eng/cibuild_bootstrapped_msbuild.sh --host_type mono --configuration Release --skip_tests /p:DisableNerdbankVersioning=true
|
||||||
patchShebangs stage1/mono-msbuild/msbuild
|
patchShebangs stage1/mono-msbuild/msbuild
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
2075
pkgs/development/tools/build-managers/msbuild/deps.nix
generated
2075
pkgs/development/tools/build-managers/msbuild/deps.nix
generated
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user