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
839a183e
Unverified
Commit
839a183e
authored
Apr 05, 2022
by
Jenn Magder
Committed by
GitHub
Apr 05, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add note to doctor validator if script is running Rosetta (#101309)
parent
d6cc67d5
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
71 additions
and
1 deletion
+71
-1
os.dart
packages/flutter_tools/lib/src/base/os.dart
+7
-1
os_test.dart
packages/flutter_tools/test/general.shard/base/os_test.dart
+64
-0
No files found.
packages/flutter_tools/lib/src/base/os.dart
View file @
839a183e
...
@@ -372,10 +372,16 @@ class _MacOSUtils extends _PosixUtils {
...
@@ -372,10 +372,16 @@ class _MacOSUtils extends _PosixUtils {
_processUtils
.
runSync
(<
String
>[
'sw_vers'
,
'-productName'
]),
_processUtils
.
runSync
(<
String
>[
'sw_vers'
,
'-productName'
]),
_processUtils
.
runSync
(<
String
>[
'sw_vers'
,
'-productVersion'
]),
_processUtils
.
runSync
(<
String
>[
'sw_vers'
,
'-productVersion'
]),
_processUtils
.
runSync
(<
String
>[
'sw_vers'
,
'-buildVersion'
]),
_processUtils
.
runSync
(<
String
>[
'sw_vers'
,
'-buildVersion'
]),
_processUtils
.
runSync
(<
String
>[
'uname'
,
'-m'
]),
];
];
if
(
results
.
every
((
RunResult
result
)
=>
result
.
exitCode
==
0
))
{
if
(
results
.
every
((
RunResult
result
)
=>
result
.
exitCode
==
0
))
{
String
osName
=
getNameForHostPlatform
(
hostPlatform
);
// If the script is running in Rosetta, "uname -m" will return x86_64.
if
(
hostPlatform
==
HostPlatform
.
darwin_arm
&&
results
[
3
].
stdout
.
contains
(
'x86_64'
))
{
osName
=
'
$osName
(Rosetta)'
;
}
_name
=
_name
=
'
${results[0].stdout.trim()}
${results[1].stdout.trim()}
${results[2].stdout.trim()}
$
{getNameForHostPlatform(hostPlatform)}
'
;
'
${results[0].stdout.trim()}
${results[1].stdout.trim()}
${results[2].stdout.trim()}
$
osName
'
;
}
}
_name
??=
super
.
name
;
_name
??=
super
.
name
;
}
}
...
...
packages/flutter_tools/test/general.shard/base/os_test.dart
View file @
839a183e
...
@@ -311,6 +311,13 @@ void main() {
...
@@ -311,6 +311,13 @@ void main() {
],
],
stdout:
'build'
,
stdout:
'build'
,
),
),
const
FakeCommand
(
command:
<
String
>[
'uname'
,
'-m'
,
],
stdout:
'arm64'
,
),
const
FakeCommand
(
const
FakeCommand
(
command:
<
String
>[
command:
<
String
>[
'which'
,
'which'
,
...
@@ -331,6 +338,56 @@ void main() {
...
@@ -331,6 +338,56 @@ void main() {
expect
(
utils
.
name
,
'product version build darwin-arm'
);
expect
(
utils
.
name
,
'product version build darwin-arm'
);
});
});
testWithoutContext
(
'macOS ARM on Rosetta name'
,
()
async
{
fakeProcessManager
.
addCommands
(<
FakeCommand
>[
const
FakeCommand
(
command:
<
String
>[
'sw_vers'
,
'-productName'
,
],
stdout:
'product'
,
),
const
FakeCommand
(
command:
<
String
>[
'sw_vers'
,
'-productVersion'
,
],
stdout:
'version'
,
),
const
FakeCommand
(
command:
<
String
>[
'sw_vers'
,
'-buildVersion'
,
],
stdout:
'build'
,
),
const
FakeCommand
(
command:
<
String
>[
'uname'
,
'-m'
,
],
stdout:
'x86_64'
,
// Running on Rosetta
),
const
FakeCommand
(
command:
<
String
>[
'which'
,
'sysctl'
,
],
),
const
FakeCommand
(
command:
<
String
>[
'sysctl'
,
'hw.optional.arm64'
,
],
stdout:
'hw.optional.arm64: 1'
,
),
]);
final
OperatingSystemUtils
utils
=
createOSUtils
(
FakePlatform
(
operatingSystem:
'macos'
));
expect
(
utils
.
name
,
'product version build darwin-arm (Rosetta)'
);
});
testWithoutContext
(
'macOS x86 name'
,
()
async
{
testWithoutContext
(
'macOS x86 name'
,
()
async
{
fakeProcessManager
.
addCommands
(<
FakeCommand
>[
fakeProcessManager
.
addCommands
(<
FakeCommand
>[
const
FakeCommand
(
const
FakeCommand
(
...
@@ -354,6 +411,13 @@ void main() {
...
@@ -354,6 +411,13 @@ void main() {
],
],
stdout:
'build'
,
stdout:
'build'
,
),
),
const
FakeCommand
(
command:
<
String
>[
'uname'
,
'-m'
,
],
stdout:
'x86_64'
,
),
const
FakeCommand
(
const
FakeCommand
(
command:
<
String
>[
command:
<
String
>[
'which'
,
'which'
,
...
...
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