Skip to content

Commit

Permalink
Merge pull request #313 from panticmilos/vmpantic/update-version-pack…
Browse files Browse the repository at this point in the history
…age-json

Update package lock version
  • Loading branch information
marko-zivic-93 committed Sep 20, 2022
2 parents fd4e15f + bba8299 commit 857c316
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 5 deletions.
48 changes: 45 additions & 3 deletions externals/install-dotnet.sh
Expand Up @@ -353,6 +353,48 @@ get_normalized_architecture_from_architecture() {
return 1
}

# args:
# version - $1
# channel - $2
# architecture - $3
get_normalized_architecture_for_specific_sdk_version() {
eval $invocation

local is_version_support_arm64="$(is_arm64_supported "$1")"
local is_channel_support_arm64="$(is_arm64_supported "$2")"
local architecture="$3";
local osname="$(get_current_os_name)"

if [ "$osname" == "osx" ] && [ "$architecture" == "arm64" ] && { [ "$is_version_support_arm64" = false ] || [ "$is_channel_support_arm64" = false ]; }; then
#check if rosetta is installed
if [ "$(/usr/bin/pgrep oahd >/dev/null 2>&1;echo $?)" -eq 0 ]; then
say_verbose "Changing user architecture from '$architecture' to 'x64' because .NET SDKs prior to version 6.0 do not support arm64."
echo "x64"
return 0;
else
say_err "Architecture \`$architecture\` is not supported for .NET SDK version \`$version\`. Please install Rosetta to allow emulation of the \`$architecture\` .NET SDK on this platform"
return 1
fi
fi

echo "$architecture"
return 0
}

# args:
# version or channel - $1
is_arm64_supported() {
#any channel or version that starts with the specified versions
case "$1" in
( "1"* | "2"* | "3"* | "4"* | "5"*)
echo false
return 0
esac

echo true
return 0
}

# args:
# user_defined_os - $1
get_normalized_os() {
Expand Down Expand Up @@ -523,7 +565,7 @@ parse_globaljson_file_for_version() {
return 1
fi

sdk_section=$(cat $json_file | awk '/"sdk"/,/}/')
sdk_section=$(cat $json_file | tr -d "\r" | awk '/"sdk"/,/}/')
if [ -z "$sdk_section" ]; then
say_err "Unable to parse the SDK node in \`$json_file\`"
return 1
Expand Down Expand Up @@ -988,8 +1030,6 @@ download() {
sleep $((attempts*10))
done
if [ "$failed" = true ]; then
say_verbose "Download failed: $remote_path"
return 1
Expand Down Expand Up @@ -1346,6 +1386,8 @@ calculate_vars() {
install_root="$(resolve_installation_path "$install_dir")"
say_verbose "InstallRoot: '$install_root'."
normalized_architecture="$(get_normalized_architecture_for_specific_sdk_version "$version" "$normalized_channel" "$normalized_architecture")"
if [[ "$runtime" == "dotnet" ]]; then
asset_relative_path="shared/Microsoft.NETCore.App"
asset_name=".NET Core Runtime"
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 857c316

Please sign in to comment.