Skip to content

Commit 857c316

Browse files
Merge pull request #313 from panticmilos/vmpantic/update-version-package-json
Update package lock version
2 parents fd4e15f + bba8299 commit 857c316

File tree

2 files changed

+47
-5
lines changed

2 files changed

+47
-5
lines changed

externals/install-dotnet.sh

+45-3
Original file line numberDiff line numberDiff line change
@@ -353,6 +353,48 @@ get_normalized_architecture_from_architecture() {
353353
return 1
354354
}
355355

356+
# args:
357+
# version - $1
358+
# channel - $2
359+
# architecture - $3
360+
get_normalized_architecture_for_specific_sdk_version() {
361+
eval $invocation
362+
363+
local is_version_support_arm64="$(is_arm64_supported "$1")"
364+
local is_channel_support_arm64="$(is_arm64_supported "$2")"
365+
local architecture="$3";
366+
local osname="$(get_current_os_name)"
367+
368+
if [ "$osname" == "osx" ] && [ "$architecture" == "arm64" ] && { [ "$is_version_support_arm64" = false ] || [ "$is_channel_support_arm64" = false ]; }; then
369+
#check if rosetta is installed
370+
if [ "$(/usr/bin/pgrep oahd >/dev/null 2>&1;echo $?)" -eq 0 ]; then
371+
say_verbose "Changing user architecture from '$architecture' to 'x64' because .NET SDKs prior to version 6.0 do not support arm64."
372+
echo "x64"
373+
return 0;
374+
else
375+
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"
376+
return 1
377+
fi
378+
fi
379+
380+
echo "$architecture"
381+
return 0
382+
}
383+
384+
# args:
385+
# version or channel - $1
386+
is_arm64_supported() {
387+
#any channel or version that starts with the specified versions
388+
case "$1" in
389+
( "1"* | "2"* | "3"* | "4"* | "5"*)
390+
echo false
391+
return 0
392+
esac
393+
394+
echo true
395+
return 0
396+
}
397+
356398
# args:
357399
# user_defined_os - $1
358400
get_normalized_os() {
@@ -523,7 +565,7 @@ parse_globaljson_file_for_version() {
523565
return 1
524566
fi
525567

526-
sdk_section=$(cat $json_file | awk '/"sdk"/,/}/')
568+
sdk_section=$(cat $json_file | tr -d "\r" | awk '/"sdk"/,/}/')
527569
if [ -z "$sdk_section" ]; then
528570
say_err "Unable to parse the SDK node in \`$json_file\`"
529571
return 1
@@ -988,8 +1030,6 @@ download() {
9881030
sleep $((attempts*10))
9891031
done
9901032
991-
992-
9931033
if [ "$failed" = true ]; then
9941034
say_verbose "Download failed: $remote_path"
9951035
return 1
@@ -1346,6 +1386,8 @@ calculate_vars() {
13461386
install_root="$(resolve_installation_path "$install_dir")"
13471387
say_verbose "InstallRoot: '$install_root'."
13481388
1389+
normalized_architecture="$(get_normalized_architecture_for_specific_sdk_version "$version" "$normalized_channel" "$normalized_architecture")"
1390+
13491391
if [[ "$runtime" == "dotnet" ]]; then
13501392
asset_relative_path="shared/Microsoft.NETCore.App"
13511393
asset_name=".NET Core Runtime"

package-lock.json

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)