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
41167c95
Unverified
Commit
41167c95
authored
Oct 29, 2021
by
嘟囔
Committed by
GitHub
Oct 29, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: migrate macos/macos_device.dart to null safety (#92633)
parent
c3ad4f0f
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
21 additions
and
21 deletions
+21
-21
desktop_device.dart
packages/flutter_tools/lib/src/desktop_device.dart
+1
-1
macos_device.dart
packages/flutter_tools/lib/src/macos/macos_device.dart
+20
-18
macos_device_test.dart
...ter_tools/test/general.shard/macos/macos_device_test.dart
+0
-2
No files found.
packages/flutter_tools/lib/src/desktop_device.dart
View file @
41167c95
...
...
@@ -203,8 +203,8 @@ abstract class DesktopDevice extends Device {
/// Builds the current project for this device, with the given options.
Future
<
void
>
buildForDevice
(
ApplicationPackage
package
,
{
required
BuildInfo
buildInfo
,
String
?
mainPath
,
BuildInfo
buildInfo
,
});
/// Returns the path to the executable to run for [package] on this device for
...
...
packages/flutter_tools/lib/src/macos/macos_device.dart
View file @
41167c95
...
...
@@ -2,9 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// @dart = 2.8
import
'package:meta/meta.dart'
;
import
'package:process/process.dart'
;
import
'../base/file_system.dart'
;
...
...
@@ -23,10 +20,10 @@ import 'macos_workflow.dart';
/// A device that represents a desktop MacOS target.
class
MacOSDevice
extends
DesktopDevice
{
MacOSDevice
({
@
required
ProcessManager
processManager
,
@
required
Logger
logger
,
@
required
FileSystem
fileSystem
,
@
required
OperatingSystemUtils
operatingSystemUtils
,
required
ProcessManager
processManager
,
required
Logger
logger
,
required
FileSystem
fileSystem
,
required
OperatingSystemUtils
operatingSystemUtils
,
})
:
_processManager
=
processManager
,
_logger
=
logger
,
_operatingSystemUtils
=
operatingSystemUtils
,
...
...
@@ -70,8 +67,8 @@ class MacOSDevice extends DesktopDevice {
@override
Future
<
void
>
buildForDevice
(
covariant
MacOSApp
package
,
{
String
mainPath
,
BuildInfo
buildInfo
,
required
BuildInfo
buildInfo
,
String
?
mainPath
,
})
async
{
await
buildMacOS
(
flutterProject:
FlutterProject
.
current
(),
...
...
@@ -82,7 +79,7 @@ class MacOSDevice extends DesktopDevice {
}
@override
String
executablePathForDevice
(
covariant
MacOSApp
package
,
BuildMode
buildMode
)
{
String
?
executablePathForDevice
(
covariant
MacOSApp
package
,
BuildMode
buildMode
)
{
return
package
.
executable
(
buildMode
);
}
...
...
@@ -92,8 +89,13 @@ class MacOSDevice extends DesktopDevice {
// than post-attach, since this won't run for release builds, but there's
// no general-purpose way of knowing when a process is far enough along in
// the launch process for 'open' to foreground it.
final
String
?
applicationBundle
=
package
.
applicationBundle
(
buildMode
);
if
(
applicationBundle
==
null
)
{
_logger
.
printError
(
'Failed to foreground app; application bundle not found'
);
return
;
}
_processManager
.
run
(<
String
>[
'open'
,
package
.
applicationBundle
(
buildMode
)
,
'open'
,
applicationBundle
,
]).
then
((
ProcessResult
result
)
{
if
(
result
.
exitCode
!=
0
)
{
_logger
.
printError
(
'Failed to foreground app; open returned
${result.exitCode}
'
);
...
...
@@ -104,12 +106,12 @@ class MacOSDevice extends DesktopDevice {
class
MacOSDevices
extends
PollingDeviceDiscovery
{
MacOSDevices
({
@
required
Platform
platform
,
@
required
MacOSWorkflow
macOSWorkflow
,
@
required
ProcessManager
processManager
,
@
required
Logger
logger
,
@
required
FileSystem
fileSystem
,
@
required
OperatingSystemUtils
operatingSystemUtils
,
required
Platform
platform
,
required
MacOSWorkflow
macOSWorkflow
,
required
ProcessManager
processManager
,
required
Logger
logger
,
required
FileSystem
fileSystem
,
required
OperatingSystemUtils
operatingSystemUtils
,
})
:
_logger
=
logger
,
_platform
=
platform
,
_macOSWorkflow
=
macOSWorkflow
,
...
...
@@ -132,7 +134,7 @@ class MacOSDevices extends PollingDeviceDiscovery {
bool
get
canListAnything
=>
_macOSWorkflow
.
canListDevices
;
@override
Future
<
List
<
Device
>>
pollingGetDevices
({
Duration
timeout
})
async
{
Future
<
List
<
Device
>>
pollingGetDevices
({
Duration
?
timeout
})
async
{
if
(!
canListAnything
)
{
return
const
<
Device
>[];
}
...
...
packages/flutter_tools/test/general.shard/macos/macos_device_test.dart
View file @
41167c95
...
...
@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// @dart = 2.8
import
'dart:async'
;
import
'package:file/memory.dart'
;
...
...
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