dotnet-sdk-setup-hook: add trailing slashes to NUGET_PACKAGES vars

This commit is contained in:
David McFarland 2024-09-07 22:55:57 -03:00
parent b01ca64670
commit 60eb0db2ab
2 changed files with 11 additions and 7 deletions

View File

@ -15,6 +15,6 @@ genericBuild
depsFile=$(realpath "${1:-@defaultDepsFile@}")
tmpFile="$tmp"/deps.nix
echo -e "# This file was automatically generated by passthru.fetch-deps.\n# Please dont edit it manually, your changes might get overwritten!\n" > "$tmpFile"
@nugetToNix@/bin/nuget-to-nix "$NUGET_PACKAGES" >> "$tmpFile"
@nugetToNix@/bin/nuget-to-nix "${NUGET_PACKAGES%/}" >> "$tmpFile"
mv "$tmpFile" "$depsFile"
echo "Succesfully wrote lockfile to $depsFile"

View File

@ -27,10 +27,14 @@ _linkPackages() {
createNugetDirs() {
nugetTemp=$PWD/.nuget-temp
export NUGET_PACKAGES=$nugetTemp/packages
export NUGET_FALLBACK_PACKAGES=$nugetTemp/fallback
# trailing slash required here:
# Microsoft.Managed.Core.targets(236,5): error : SourceRoot paths are required to end with a slash or backslash: '/build/.nuget-temp/packages'
# also e.g. from avalonia:
# <EmbeddedResource Include="$(NuGetPackageRoot)sourcelink/1.1.0/tools/pdbstr.exe" />
export NUGET_PACKAGES=$nugetTemp/packages/
export NUGET_FALLBACK_PACKAGES=$nugetTemp/fallback/
nugetSource=$nugetTemp/source
mkdir -p "$NUGET_PACKAGES" "$NUGET_FALLBACK_PACKAGES" "$nugetSource"
mkdir -p "${NUGET_PACKAGES%/}" "${NUGET_FALLBACK_PACKAGES%/}" "$nugetSource"
dotnet new nugetconfig
if [[ -z ${keepNugetConfig-} ]]; then
@ -45,7 +49,7 @@ configureNuget() {
for x in "${!_nugetInputs[@]}"; do
if [[ -d $x/share/nuget/packages ]]; then
_linkPackages "$x/share/nuget/packages" "$NUGET_FALLBACK_PACKAGES"
_linkPackages "$x/share/nuget/packages" "${NUGET_FALLBACK_PACKAGES%/}"
fi
if [[ -d $x/share/nuget/source ]]; then
@ -59,7 +63,7 @@ configureNuget() {
|| -f paket.dependencies ]]; then
for x in "${!_nugetInputs[@]}"; do
if [[ -d $x/share/nuget/packages ]]; then
@lndir@/bin/lndir -silent "$x/share/nuget/packages" "$NUGET_PACKAGES"
@lndir@/bin/lndir -silent "$x/share/nuget/packages" "${NUGET_PACKAGES%/}"
fi
done
fi
@ -70,7 +74,7 @@ configureNuget() {
for x in "${!_nugetInputs[@]}"; do
if [[ -d $x/share/nuget/source ]]; then
@lndir@/bin/lndir -silent "$x/share/nuget/source" "$NUGET_PACKAGES"
@lndir@/bin/lndir -silent "$x/share/nuget/source" "${NUGET_PACKAGES%/}"
fi
done
fi