Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
F
Front-End
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
abdullh.alsoleman
Front-End
Commits
6bb63ed0
Unverified
Commit
6bb63ed0
authored
Apr 05, 2022
by
Christopher Fujino
Committed by
GitHub
Apr 05, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[flutter_tools] port bash script to use sysctl not uname on macOS (#101308)
parent
f42f7d19
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
40 additions
and
14 deletions
+40
-14
update_dart_sdk.sh
bin/internal/update_dart_sdk.sh
+40
-14
No files found.
bin/internal/update_dart_sdk.sh
View file @
6bb63ed0
...
...
@@ -20,12 +20,13 @@ DART_SDK_PATH="$FLUTTER_ROOT/bin/cache/dart-sdk"
DART_SDK_PATH_OLD
=
"
$DART_SDK_PATH
.old"
ENGINE_STAMP
=
"
$FLUTTER_ROOT
/bin/cache/engine-dart-sdk.stamp"
ENGINE_VERSION
=
`
cat
"
$FLUTTER_ROOT
/bin/internal/engine.version"
`
OS
=
"
$(
uname
-s
)
"
if
[
!
-f
"
$ENGINE_STAMP
"
]
||
[
"
$ENGINE_VERSION
"
!=
`
cat
"
$ENGINE_STAMP
"
`
]
;
then
command
-v
curl
>
/dev/null 2>&1
||
{
>
&2
echo
>
&2
echo
'Missing "curl" tool. Unable to download Dart SDK.'
case
"
$
(
uname
-s
)
"
in
case
"
$
OS
"
in
Darwin
)
>
&2
echo
'Consider running "brew install curl".'
;;
...
...
@@ -42,7 +43,7 @@ if [ ! -f "$ENGINE_STAMP" ] || [ "$ENGINE_VERSION" != `cat "$ENGINE_STAMP"` ]; t
command
-v
unzip
>
/dev/null 2>&1
||
{
>
&2
echo
>
&2
echo
'Missing "unzip" tool. Unable to extract Dart SDK.'
case
"
$
(
uname
-s
)
"
in
case
"
$
OS
"
in
Darwin
)
echo
'Consider running "brew install unzip".'
;;
...
...
@@ -56,20 +57,43 @@ if [ ! -f "$ENGINE_STAMP" ] || [ "$ENGINE_VERSION" != `cat "$ENGINE_STAMP"` ]; t
echo
exit
1
}
>
&2
echo
"Downloading Dart SDK from Flutter engine
$ENGINE_VERSION
..."
# On x64 stdout is "uname -m: x86_64"
# On arm64 stdout is "uname -m: aarch64, arm64_v8a"
case
"
$(
uname
-m
)
"
in
x86_64
)
ARCH
=
"x64"
;;
*
)
ARCH
=
"arm64"
;;
esac
# `uname -m` may be running in Rosetta mode, instead query sysctl
if
[
"
$OS
"
=
'Darwin'
]
;
then
# Allow non-zero exit so we can do control flow
set
+e
# -n means only print value, not key
QUERY
=
"sysctl -n hw.optional.arm64"
# Do not wrap $QUERY in double quotes, otherwise the args will be treated as
# part of the command
QUERY_RESULT
=
$(
$QUERY
2>/dev/null
)
if
[
$?
-eq
1
]
;
then
# If this command fails, we're certainly not on ARM
ARCH
=
'x64'
elif
[
"
$QUERY_RESULT
"
=
'0'
]
;
then
# If this returns 0, we are also not on ARM
ARCH
=
'x64'
elif
[
"
$QUERY_RESULT
"
=
'1'
]
;
then
ARCH
=
'arm64'
else
>
&2
echo
"'
$QUERY
' returned unexpected output: '
$QUERY_RESULT
'"
exit
1
fi
set
-e
else
# On x64 stdout is "uname -m: x86_64"
# On arm64 stdout is "uname -m: aarch64, arm64_v8a"
case
"
$(
uname
-m
)
"
in
x86_64
)
ARCH
=
"x64"
;;
*
)
ARCH
=
"arm64"
;;
esac
fi
case
"
$
(
uname
-s
)
"
in
case
"
$
OS
"
in
Darwin
)
DART_ZIP_NAME
=
"dart-sdk-darwin-
${
ARCH
}
.zip"
IS_USER_EXECUTABLE
=
"-perm +100"
...
...
@@ -88,6 +112,8 @@ if [ ! -f "$ENGINE_STAMP" ] || [ "$ENGINE_VERSION" != `cat "$ENGINE_STAMP"` ]; t
;;
esac
>
&2
echo
"Downloading
$OS
$ARCH
Dart SDK from Flutter engine
$ENGINE_VERSION
..."
# Use the default find if possible.
if
[
-e
/usr/bin/find
]
;
then
FIND
=
/usr/bin/find
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment