Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

select-xamarin-sdk-v2 #3290

Merged
merged 5 commits into from
May 4, 2021
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 40 additions & 0 deletions images/macos/provision/assets/select-xamarin-sdk-v2.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
#!/bin/bash -e -o pipefail

get_framework_path() {
case $1 in
--mono) echo '/Library/Frameworks/Mono.framework/Versions' ;;
--ios) echo '/Library/Frameworks/Xamarin.iOS.framework/Versions' ;;
--android) echo '/Library/Frameworks/Xamarin.Android.framework/Versions' ;;
--mac) echo '/Library/Frameworks/Xamarin.Mac.framework/Versions' ;;
*) ;;
esac
}

change_framework_version() {
local framework=$1
local version=$2

echo "Select $framework $version"

local countDigit=$(echo "${version}" | grep -o "\." | grep -c "\.")
if [[ countDigit -gt 1 ]]; then
echo "[WARNING] It is not recommended to specify version in "a.b.c.d" format because your pipeline can be broken suddenly in future. Use "a.b" format."
mikhailshaganov marked this conversation as resolved.
Show resolved Hide resolved
mikhailshaganov marked this conversation as resolved.
Show resolved Hide resolved
fi

local framework_path=$(get_framework_path "$framework")
sudo rm -f "${framework_path}/Current"
sudo ln -s "${framework_path}/${version}" "${framework_path}/Current"
}

for arg in "$@"; do
key=$(echo $arg | cut -f1 -d=)
value=$(echo $arg | cut -f2 -d=)

case $key in
--mono | --ios | --android | --mac) change_framework_version $key $value ;;
*)
echo "Invalid parameter <${key}>"
exit 1
;;
esac
done