Skip to content

Commit

Permalink
Workaround issue with .editorconfigs when NUGET_PACKAGES does not have a
Browse files Browse the repository at this point in the history
trailing slash
  • Loading branch information
dibarbet committed Mar 22, 2024
1 parent f042b6f commit 6f32eea
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 0 deletions.
1 change: 1 addition & 0 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,5 @@ while [[ -h $source ]]; do
done

scriptroot="$( cd -P "$( dirname "$source" )" && pwd )"
. "$scriptroot/eng/nuget-workaround.sh" $@
"$scriptroot/eng/common/build.sh" --restore --build --pack $@
1 change: 1 addition & 0 deletions eng/cibuild.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,5 @@ while [[ -h $source ]]; do
done
scriptroot="$( cd -P "$( dirname "$source" )" && pwd )"

. "$scriptroot/nuget-workaround.sh" $@
. "$scriptroot/common/build.sh" --ci $@
30 changes: 30 additions & 0 deletions eng/nuget-workaround.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/usr/bin/env bash

# This works around an issue where .editorconfigs in nuget packages are not respected if the NUGET_PACKAGES
# environment variable does not end with a slash. We copy the logic for setting the NUGET_PACKAGES variable from the eng/common/tools.sh
# script as we cannot modify the script itself (its arcade managed).
# This workaround is only required for non-windows builds as the powershell versions of the arcade scripts already ensure a trailing slash is present.
# Tracking https://github.com/dotnet/roslyn/issues/72657
ci=false
while [[ $# > 0 ]]; do
opt="$(echo "${1/#--/-}" | tr "[:upper:]" "[:lower:]")"
case "$opt" in
-ci)
ci=true
break
;;
*)
shift
;;
esac
done
if [[ "$ci" == true ]]; then
if [[ -z ${NUGET_PACKAGES:-} ]]; then
if [[ "$ci" == true ]]; then
export NUGET_PACKAGES="$HOME/.nuget/packages/"
else
export NUGET_PACKAGES="$repo_root/.packages/"
export RESTORENOCACHE=true
fi
fi
fi

0 comments on commit 6f32eea

Please sign in to comment.