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 {
...
@@ -203,8 +203,8 @@ abstract class DesktopDevice extends Device {
/// Builds the current project for this device, with the given options.
/// Builds the current project for this device, with the given options.
Future
<
void
>
buildForDevice
(
Future
<
void
>
buildForDevice
(
ApplicationPackage
package
,
{
ApplicationPackage
package
,
{
required
BuildInfo
buildInfo
,
String
?
mainPath
,
String
?
mainPath
,
BuildInfo
buildInfo
,
});
});
/// Returns the path to the executable to run for [package] on this device for
/// 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 @@
...
@@ -2,9 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// found in the LICENSE file.
// @dart = 2.8
import
'package:meta/meta.dart'
;
import
'package:process/process.dart'
;
import
'package:process/process.dart'
;
import
'../base/file_system.dart'
;
import
'../base/file_system.dart'
;
...
@@ -23,10 +20,10 @@ import 'macos_workflow.dart';
...
@@ -23,10 +20,10 @@ import 'macos_workflow.dart';
/// A device that represents a desktop MacOS target.
/// A device that represents a desktop MacOS target.
class
MacOSDevice
extends
DesktopDevice
{
class
MacOSDevice
extends
DesktopDevice
{
MacOSDevice
({
MacOSDevice
({
@
required
ProcessManager
processManager
,
required
ProcessManager
processManager
,
@
required
Logger
logger
,
required
Logger
logger
,
@
required
FileSystem
fileSystem
,
required
FileSystem
fileSystem
,
@
required
OperatingSystemUtils
operatingSystemUtils
,
required
OperatingSystemUtils
operatingSystemUtils
,
})
:
_processManager
=
processManager
,
})
:
_processManager
=
processManager
,
_logger
=
logger
,
_logger
=
logger
,
_operatingSystemUtils
=
operatingSystemUtils
,
_operatingSystemUtils
=
operatingSystemUtils
,
...
@@ -70,8 +67,8 @@ class MacOSDevice extends DesktopDevice {
...
@@ -70,8 +67,8 @@ class MacOSDevice extends DesktopDevice {
@override
@override
Future
<
void
>
buildForDevice
(
Future
<
void
>
buildForDevice
(
covariant
MacOSApp
package
,
{
covariant
MacOSApp
package
,
{
String
mainPath
,
required
BuildInfo
buildInfo
,
BuildInfo
buildInfo
,
String
?
mainPath
,
})
async
{
})
async
{
await
buildMacOS
(
await
buildMacOS
(
flutterProject:
FlutterProject
.
current
(),
flutterProject:
FlutterProject
.
current
(),
...
@@ -82,7 +79,7 @@ class MacOSDevice extends DesktopDevice {
...
@@ -82,7 +79,7 @@ class MacOSDevice extends DesktopDevice {
}
}
@override
@override
String
executablePathForDevice
(
covariant
MacOSApp
package
,
BuildMode
buildMode
)
{
String
?
executablePathForDevice
(
covariant
MacOSApp
package
,
BuildMode
buildMode
)
{
return
package
.
executable
(
buildMode
);
return
package
.
executable
(
buildMode
);
}
}
...
@@ -92,8 +89,13 @@ class MacOSDevice extends DesktopDevice {
...
@@ -92,8 +89,13 @@ class MacOSDevice extends DesktopDevice {
// than post-attach, since this won't run for release builds, but there's
// 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
// no general-purpose way of knowing when a process is far enough along in
// the launch process for 'open' to foreground it.
// 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
>[
_processManager
.
run
(<
String
>[
'open'
,
package
.
applicationBundle
(
buildMode
)
,
'open'
,
applicationBundle
,
]).
then
((
ProcessResult
result
)
{
]).
then
((
ProcessResult
result
)
{
if
(
result
.
exitCode
!=
0
)
{
if
(
result
.
exitCode
!=
0
)
{
_logger
.
printError
(
'Failed to foreground app; open returned
${result.exitCode}
'
);
_logger
.
printError
(
'Failed to foreground app; open returned
${result.exitCode}
'
);
...
@@ -104,12 +106,12 @@ class MacOSDevice extends DesktopDevice {
...
@@ -104,12 +106,12 @@ class MacOSDevice extends DesktopDevice {
class
MacOSDevices
extends
PollingDeviceDiscovery
{
class
MacOSDevices
extends
PollingDeviceDiscovery
{
MacOSDevices
({
MacOSDevices
({
@
required
Platform
platform
,
required
Platform
platform
,
@
required
MacOSWorkflow
macOSWorkflow
,
required
MacOSWorkflow
macOSWorkflow
,
@
required
ProcessManager
processManager
,
required
ProcessManager
processManager
,
@
required
Logger
logger
,
required
Logger
logger
,
@
required
FileSystem
fileSystem
,
required
FileSystem
fileSystem
,
@
required
OperatingSystemUtils
operatingSystemUtils
,
required
OperatingSystemUtils
operatingSystemUtils
,
})
:
_logger
=
logger
,
})
:
_logger
=
logger
,
_platform
=
platform
,
_platform
=
platform
,
_macOSWorkflow
=
macOSWorkflow
,
_macOSWorkflow
=
macOSWorkflow
,
...
@@ -132,7 +134,7 @@ class MacOSDevices extends PollingDeviceDiscovery {
...
@@ -132,7 +134,7 @@ class MacOSDevices extends PollingDeviceDiscovery {
bool
get
canListAnything
=>
_macOSWorkflow
.
canListDevices
;
bool
get
canListAnything
=>
_macOSWorkflow
.
canListDevices
;
@override
@override
Future
<
List
<
Device
>>
pollingGetDevices
({
Duration
timeout
})
async
{
Future
<
List
<
Device
>>
pollingGetDevices
({
Duration
?
timeout
})
async
{
if
(!
canListAnything
)
{
if
(!
canListAnything
)
{
return
const
<
Device
>[];
return
const
<
Device
>[];
}
}
...
...
packages/flutter_tools/test/general.shard/macos/macos_device_test.dart
View file @
41167c95
...
@@ -2,8 +2,6 @@
...
@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// found in the LICENSE file.
// @dart = 2.8
import
'dart:async'
;
import
'dart:async'
;
import
'package:file/memory.dart'
;
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