-
Notifications
You must be signed in to change notification settings - Fork 196
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Workaround issue with .editorconfigs when NUGET_PACKAGES does not have a
trailing slash
- Loading branch information
Showing
3 changed files
with
32 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |