diff --git a/packages/aws-cdk/test/integ/run-against-dist.bash b/packages/aws-cdk/test/integ/run-against-dist.bash index 71b954fa56d86..3a247ab58ea69 100644 --- a/packages/aws-cdk/test/integ/run-against-dist.bash +++ b/packages/aws-cdk/test/integ/run-against-dist.bash @@ -155,16 +155,43 @@ function prepare_java_packages() { function prepare_nuget_packages() { # For NuGet, we wrap the "dotnet" CLI command to use local packages. - log "Hijacking 'dotnet build' command..." + log "Writing new NuGet configuration..." - ORIGINAL_DOTNET=$(type -p dotnet) || { echo "No 'dotnet' found" >&2; exit 1; } - export ORIGINAL_DOTNET - export NUGET_SOURCE=$dist_root/dotnet + local NUGET_SOURCE=$dist_root/dotnet if [ ! -d "$NUGET_SOURCE" ]; then echo "NuGet packages missing at $NUGET_SOURCE" >&2 exit 1 fi + + mkdir -p $HOME/.nuget/NuGet + if [ -f $HOME/.nuget/NuGet/NuGet.Config ]; then + echo "⚠️ Saving previous NuGet.Config to $HOME/.nuget/NuGet/NuGet.Config.bak" + mv $HOME/.nuget/NuGet/NuGet.Config $HOME/.nuget/NuGet/NuGet.Config.bak + fi + + trap clean_up_nuget_config EXIT + + cat > $HOME/.nuget/NuGet/NuGet.Config < + + + + + + +EOF +} + +function clean_up_nuget_config() { + log "Restoring NuGet configuration" + if [ -f $HOME/.nuget/NuGet/NuGet.Config.bak ]; then + log "-> Restoring $HOME/.nuget/NuGet/NuGet.Config from $HOME/.nuget/NuGet/NuGet.Config.bak" + mv -f $HOME/.nuget/NuGet/NuGet.Config.bak $HOME/.nuget/NuGet/NuGet.Config + else + log "-> Removing $HOME/.nuget/NuGet/NuGet.Config" + rm -f $HOME/.nuget/NuGet/NuGet.Config + fi } # pip_install REQUIREMENTS_FILE diff --git a/packages/aws-cdk/test/integ/run-wrappers/dist/dotnet b/packages/aws-cdk/test/integ/run-wrappers/dist/dotnet deleted file mode 100755 index 7603e7e6057e0..0000000000000 --- a/packages/aws-cdk/test/integ/run-wrappers/dist/dotnet +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/bash -set -eu -if [[ "${1:-}" == "build" ]]; then - shift - exec $ORIGINAL_DOTNET build \ - --source $NUGET_SOURCE \ - "$@" -fi - -exec $ORIGINAL_DOTNET "$@"