1 #!/usr/bin/env nix-shell
2 #!nix-shell -i bash -p dotnet-sdk_5 -p jq -p xmlstarlet -p curl
9 tmpdir
="$(mktemp -d -p "$
(pwd)")" # must be under source root
10 trap 'rm -rf "$tmpdir"' EXIT
12 HOME
="$tmpdir" dotnet msbuild
-t:restore
-p:Configuration
=Release
-p:RestorePackagesPath
="$tmpdir"/.nuget
/packages \
13 -p:RestoreNoCache
=true
-p:RestoreForce
=true \
14 src
/NuGet
/Microsoft.Net.Compilers.Toolset
/Microsoft.Net.Compilers.Toolset.Package.csproj
>&2
17 xmlstarlet sel
-t -v 'configuration/packageSources/add/@value' -n NuGet.config
"$tmpdir"/.nuget
/NuGet
/NuGet.Config |
20 curl
--compressed -fsL "$index" | \
21 jq
-r '.resources[] | select(."@type" == "PackageBaseAddress/3.0.0")."@id"'
25 cd "$tmpdir/.nuget/packages"
32 for repo
in "${repos[@]}"
34 url
="$repo$package/$version/$package.$version.nupkg"
35 if curl
-fsL "$url" -o /dev
/null
44 echo "couldn't find $package $version" >&2
48 sha256
=$
(nix-prefetch-url
"$url" 2>/dev
/null
)