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
de5bf09e
Unverified
Commit
de5bf09e
authored
Oct 30, 2020
by
Jenn Magder
Committed by
GitHub
Oct 30, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Show macOS arm64 architecture in doctor and devices list (#69245)
parent
bd121ecd
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
52 additions
and
1 deletion
+52
-1
device.dart
packages/flutter_tools/lib/src/device.dart
+5
-1
macos_device.dart
packages/flutter_tools/lib/src/macos/macos_device.dart
+13
-0
attach_test.dart
...utter_tools/test/commands.shard/hermetic/attach_test.dart
+3
-0
doctor_test.dart
...utter_tools/test/commands.shard/hermetic/doctor_test.dart
+1
-0
run_test.dart
.../flutter_tools/test/commands.shard/hermetic/run_test.dart
+2
-0
macos_device_test.dart
...ter_tools/test/general.shard/macos/macos_device_test.dart
+28
-0
No files found.
packages/flutter_tools/lib/src/device.dart
View file @
de5bf09e
...
@@ -621,6 +621,10 @@ abstract class Device {
...
@@ -621,6 +621,10 @@ abstract class Device {
/// The device's platform.
/// The device's platform.
Future
<
TargetPlatform
>
get
targetPlatform
;
Future
<
TargetPlatform
>
get
targetPlatform
;
/// Platform name for display only.
Future
<
String
>
get
targetPlatformDisplayName
async
=>
getNameForTargetPlatform
(
await
targetPlatform
);
Future
<
String
>
get
sdkNameAndVersion
;
Future
<
String
>
get
sdkNameAndVersion
;
/// Create a platform-specific [DevFSWriter] for the given [app], or
/// Create a platform-specific [DevFSWriter] for the given [app], or
...
@@ -749,7 +753,7 @@ abstract class Device {
...
@@ -749,7 +753,7 @@ abstract class Device {
table
.
add
(<
String
>[
table
.
add
(<
String
>[
'
${device.name}
(
${device.category}
)'
,
'
${device.name}
(
${device.category}
)'
,
device
.
id
,
device
.
id
,
getNameForTargetPlatform
(
targetPlatform
)
,
await
device
.
targetPlatformDisplayName
,
'
${await device.sdkNameAndVersion}$supportIndicator
'
,
'
${await device.sdkNameAndVersion}$supportIndicator
'
,
]);
]);
}
}
...
...
packages/flutter_tools/lib/src/macos/macos_device.dart
View file @
de5bf09e
...
@@ -27,6 +27,7 @@ class MacOSDevice extends DesktopDevice {
...
@@ -27,6 +27,7 @@ class MacOSDevice extends DesktopDevice {
@required
OperatingSystemUtils
operatingSystemUtils
,
@required
OperatingSystemUtils
operatingSystemUtils
,
})
:
_processManager
=
processManager
,
})
:
_processManager
=
processManager
,
_logger
=
logger
,
_logger
=
logger
,
_operatingSystemUtils
=
operatingSystemUtils
,
super
(
super
(
'macos'
,
'macos'
,
platformType:
PlatformType
.
macos
,
platformType:
PlatformType
.
macos
,
...
@@ -39,6 +40,7 @@ class MacOSDevice extends DesktopDevice {
...
@@ -39,6 +40,7 @@ class MacOSDevice extends DesktopDevice {
final
ProcessManager
_processManager
;
final
ProcessManager
_processManager
;
final
Logger
_logger
;
final
Logger
_logger
;
final
OperatingSystemUtils
_operatingSystemUtils
;
@override
@override
bool
isSupported
()
=>
true
;
bool
isSupported
()
=>
true
;
...
@@ -46,9 +48,20 @@ class MacOSDevice extends DesktopDevice {
...
@@ -46,9 +48,20 @@ class MacOSDevice extends DesktopDevice {
@override
@override
String
get
name
=>
'macOS'
;
String
get
name
=>
'macOS'
;
/// Returns [TargetPlatform.darwin_x64] even on macOS ARM devices.
///
/// Build system, artifacts rely on Rosetta to translate to x86_64 on ARM.
@override
@override
Future
<
TargetPlatform
>
get
targetPlatform
async
=>
TargetPlatform
.
darwin_x64
;
Future
<
TargetPlatform
>
get
targetPlatform
async
=>
TargetPlatform
.
darwin_x64
;
@override
Future
<
String
>
get
targetPlatformDisplayName
async
{
if
(
_operatingSystemUtils
.
hostPlatform
==
HostPlatform
.
darwin_arm
)
{
return
'darwin-arm64'
;
}
return
super
.
targetPlatformDisplayName
;
}
@override
@override
bool
isSupportedForProject
(
FlutterProject
flutterProject
)
{
bool
isSupportedForProject
(
FlutterProject
flutterProject
)
{
return
flutterProject
.
macos
.
existsSync
();
return
flutterProject
.
macos
.
existsSync
();
...
...
packages/flutter_tools/test/commands.shard/hermetic/attach_test.dart
View file @
de5bf09e
...
@@ -604,6 +604,9 @@ void main() {
...
@@ -604,6 +604,9 @@ void main() {
when
(
device
.
id
).
thenReturn
(
id
);
when
(
device
.
id
).
thenReturn
(
id
);
when
(
device
.
isLocalEmulator
).
thenAnswer
((
_
)
async
=>
false
);
when
(
device
.
isLocalEmulator
).
thenAnswer
((
_
)
async
=>
false
);
when
(
device
.
sdkNameAndVersion
).
thenAnswer
((
_
)
async
=>
'Android 46'
);
when
(
device
.
sdkNameAndVersion
).
thenAnswer
((
_
)
async
=>
'Android 46'
);
when
(
device
.
targetPlatformDisplayName
)
.
thenAnswer
((
_
)
async
=>
'android'
);
return
device
;
return
device
;
}
}
...
...
packages/flutter_tools/test/commands.shard/hermetic/doctor_test.dart
View file @
de5bf09e
...
@@ -1059,5 +1059,6 @@ class MockDevice extends Mock implements Device {
...
@@ -1059,5 +1059,6 @@ class MockDevice extends Mock implements Device {
when
(
id
).
thenReturn
(
'device-id'
);
when
(
id
).
thenReturn
(
'device-id'
);
when
(
isLocalEmulator
).
thenAnswer
((
_
)
=>
Future
<
bool
>.
value
(
false
));
when
(
isLocalEmulator
).
thenAnswer
((
_
)
=>
Future
<
bool
>.
value
(
false
));
when
(
targetPlatform
).
thenAnswer
((
_
)
=>
Future
<
TargetPlatform
>.
value
(
TargetPlatform
.
android
));
when
(
targetPlatform
).
thenAnswer
((
_
)
=>
Future
<
TargetPlatform
>.
value
(
TargetPlatform
.
android
));
when
(
targetPlatformDisplayName
).
thenAnswer
((
_
)
async
=>
'android'
);
}
}
}
}
packages/flutter_tools/test/commands.shard/hermetic/run_test.dart
View file @
de5bf09e
...
@@ -238,6 +238,8 @@ void main() {
...
@@ -238,6 +238,8 @@ void main() {
when
(
mockDevice
.
id
).
thenReturn
(
'mock-id'
);
when
(
mockDevice
.
id
).
thenReturn
(
'mock-id'
);
when
(
mockDevice
.
name
).
thenReturn
(
'mock-name'
);
when
(
mockDevice
.
name
).
thenReturn
(
'mock-name'
);
when
(
mockDevice
.
platformType
).
thenReturn
(
PlatformType
.
android
);
when
(
mockDevice
.
platformType
).
thenReturn
(
PlatformType
.
android
);
when
(
mockDevice
.
targetPlatformDisplayName
)
.
thenAnswer
((
Invocation
invocation
)
async
=>
'mock-platform'
);
when
(
mockDevice
.
sdkNameAndVersion
).
thenAnswer
((
Invocation
invocation
)
=>
Future
<
String
>.
value
(
'api-14'
));
when
(
mockDevice
.
sdkNameAndVersion
).
thenAnswer
((
Invocation
invocation
)
=>
Future
<
String
>.
value
(
'api-14'
));
when
(
mockDeviceManager
.
getDevices
()).
thenAnswer
((
Invocation
invocation
)
{
when
(
mockDeviceManager
.
getDevices
()).
thenAnswer
((
Invocation
invocation
)
{
...
...
packages/flutter_tools/test/general.shard/macos/macos_device_test.dart
View file @
de5bf09e
...
@@ -166,6 +166,34 @@ void main() {
...
@@ -166,6 +166,34 @@ void main() {
expect
(
device
.
isSupportedForProject
(
flutterProject
),
true
);
expect
(
device
.
isSupportedForProject
(
flutterProject
),
true
);
});
});
testWithoutContext
(
'target platform display name on x86_64'
,
()
async
{
final
FakeOperatingSystemUtils
fakeOperatingSystemUtils
=
FakeOperatingSystemUtils
();
fakeOperatingSystemUtils
.
hostPlatform
=
HostPlatform
.
darwin_x64
;
final
MacOSDevice
device
=
MacOSDevice
(
fileSystem:
MemoryFileSystem
.
test
(),
logger:
BufferLogger
.
test
(),
processManager:
FakeProcessManager
.
any
(),
operatingSystemUtils:
fakeOperatingSystemUtils
,
);
expect
(
await
device
.
targetPlatformDisplayName
,
'darwin-x64'
);
});
testWithoutContext
(
'target platform display name on ARM'
,
()
async
{
final
FakeOperatingSystemUtils
fakeOperatingSystemUtils
=
FakeOperatingSystemUtils
();
fakeOperatingSystemUtils
.
hostPlatform
=
HostPlatform
.
darwin_arm
;
final
MacOSDevice
device
=
MacOSDevice
(
fileSystem:
MemoryFileSystem
.
test
(),
logger:
BufferLogger
.
test
(),
processManager:
FakeProcessManager
.
any
(),
operatingSystemUtils:
fakeOperatingSystemUtils
,
);
expect
(
await
device
.
targetPlatformDisplayName
,
'darwin-arm64'
);
});
testUsingContext
(
'isSupportedForProject is false with no host app'
,
()
async
{
testUsingContext
(
'isSupportedForProject is false with no host app'
,
()
async
{
final
FileSystem
fileSystem
=
MemoryFileSystem
.
test
();
final
FileSystem
fileSystem
=
MemoryFileSystem
.
test
();
final
MacOSDevice
device
=
MacOSDevice
(
final
MacOSDevice
device
=
MacOSDevice
(
...
...
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