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
855af290
Unverified
Commit
855af290
authored
Sep 10, 2021
by
Jenn Magder
Committed by
GitHub
Sep 10, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Migrate ios_deploy to null safety (#88851)
parent
ecd046e9
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
43 additions
and
47 deletions
+43
-47
ios_deploy.dart
packages/flutter_tools/lib/src/ios/ios_deploy.dart
+38
-40
ios_deploy_test.dart
...flutter_tools/test/general.shard/ios/ios_deploy_test.dart
+5
-7
No files found.
packages/flutter_tools/lib/src/ios/ios_deploy.dart
View file @
855af290
...
...
@@ -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:meta/meta.dart'
;
...
...
@@ -29,11 +27,11 @@ const String unknownAppLaunchError = 'Error 0xe8000022';
class
IOSDeploy
{
IOSDeploy
({
@
required
Artifacts
artifacts
,
@
required
Cache
cache
,
@
required
Logger
logger
,
@
required
Platform
platform
,
@
required
ProcessManager
processManager
,
required
Artifacts
artifacts
,
required
Cache
cache
,
required
Logger
logger
,
required
Platform
platform
,
required
ProcessManager
processManager
,
})
:
_platform
=
platform
,
_cache
=
cache
,
_processUtils
=
ProcessUtils
(
processManager:
processManager
,
logger:
logger
),
...
...
@@ -63,8 +61,8 @@ class IOSDeploy {
///
/// Uses ios-deploy and returns the exit code.
Future
<
int
>
uninstallApp
({
@
required
String
deviceId
,
@
required
String
bundleId
,
required
String
deviceId
,
required
String
bundleId
,
})
async
{
final
List
<
String
>
launchCommand
=
<
String
>[
_binaryPath
,
...
...
@@ -87,11 +85,11 @@ class IOSDeploy {
///
/// Uses ios-deploy and returns the exit code.
Future
<
int
>
installApp
({
@
required
String
deviceId
,
@
required
String
bundlePath
,
@required
Directory
appDeltaDirectory
,
@required
List
<
String
>
launchArguments
,
@required
IOSDeviceConnectionInterface
interfaceType
,
required
String
deviceId
,
required
String
bundlePath
,
required
List
<
String
>
launchArguments
,
required
IOSDeviceConnectionInterface
interfaceType
,
Directory
?
appDeltaDirectory
,
})
async
{
appDeltaDirectory
?.
createSync
(
recursive:
true
);
final
List
<
String
>
launchCommand
=
<
String
>[
...
...
@@ -125,11 +123,11 @@ class IOSDeploy {
/// This method does not install the app. Call [IOSDeployDebugger.launchAndAttach()]
/// to install and attach the debugger to the specified app bundle.
IOSDeployDebugger
prepareDebuggerForLaunch
({
@
required
String
deviceId
,
@
required
String
bundlePath
,
@required
Directory
appDeltaDirectory
,
@required
List
<
String
>
launchArguments
,
@required
IOSDeviceConnectionInterface
interfaceType
,
required
String
deviceId
,
required
String
bundlePath
,
required
List
<
String
>
launchArguments
,
required
IOSDeviceConnectionInterface
interfaceType
,
Directory
?
appDeltaDirectory
,
})
{
appDeltaDirectory
?.
createSync
(
recursive:
true
);
// Interactive debug session to support sending the lldb detach command.
...
...
@@ -167,11 +165,11 @@ class IOSDeploy {
///
/// Uses ios-deploy and returns the exit code.
Future
<
int
>
launchApp
({
@
required
String
deviceId
,
@
required
String
bundlePath
,
@required
Directory
appDeltaDirectory
,
@required
List
<
String
>
launchArguments
,
@required
IOSDeviceConnectionInterface
interfaceType
,
required
String
deviceId
,
required
String
bundlePath
,
required
List
<
String
>
launchArguments
,
required
IOSDeviceConnectionInterface
interfaceType
,
Directory
?
appDeltaDirectory
,
})
async
{
appDeltaDirectory
?.
createSync
(
recursive:
true
);
final
List
<
String
>
launchCommand
=
<
String
>[
...
...
@@ -202,8 +200,8 @@ class IOSDeploy {
}
Future
<
bool
>
isAppInstalled
({
@
required
String
bundleId
,
@
required
String
deviceId
,
required
String
bundleId
,
required
String
deviceId
,
})
async
{
final
List
<
String
>
launchCommand
=
<
String
>[
_binaryPath
,
...
...
@@ -244,10 +242,10 @@ enum _IOSDeployDebuggerState {
/// Wrapper to launch app and attach the debugger with ios-deploy.
class
IOSDeployDebugger
{
IOSDeployDebugger
({
@
required
Logger
logger
,
@
required
ProcessUtils
processUtils
,
@
required
List
<
String
>
launchCommand
,
@
required
Map
<
String
,
String
>
iosDeployEnv
,
required
Logger
logger
,
required
ProcessUtils
processUtils
,
required
List
<
String
>
launchCommand
,
required
Map
<
String
,
String
>
iosDeployEnv
,
})
:
_processUtils
=
processUtils
,
_logger
=
logger
,
_launchCommand
=
launchCommand
,
...
...
@@ -259,8 +257,8 @@ class IOSDeployDebugger {
/// Sets the command to "ios-deploy" and environment to an empty map.
@visibleForTesting
factory
IOSDeployDebugger
.
test
({
@
required
ProcessManager
processManager
,
Logger
logger
,
required
ProcessManager
processManager
,
Logger
?
logger
,
})
{
final
Logger
debugLogger
=
logger
??
BufferLogger
.
test
();
return
IOSDeployDebugger
(
...
...
@@ -276,7 +274,7 @@ class IOSDeployDebugger {
final
List
<
String
>
_launchCommand
;
final
Map
<
String
,
String
>
_iosDeployEnv
;
Process
_iosDeployProcess
;
Process
?
_iosDeployProcess
;
Stream
<
String
>
get
logLines
=>
_debuggerOutput
.
stream
;
final
StreamController
<
String
>
_debuggerOutput
=
StreamController
<
String
>.
broadcast
();
...
...
@@ -306,8 +304,8 @@ class IOSDeployDebugger {
_launchCommand
,
environment:
_iosDeployEnv
,
);
String
lastLineFromDebugger
;
final
StreamSubscription
<
String
>
stdoutSubscription
=
_iosDeployProcess
.
stdout
String
?
lastLineFromDebugger
;
final
StreamSubscription
<
String
>
stdoutSubscription
=
_iosDeployProcess
!
.
stdout
.
transform
<
String
>(
utf8
.
decoder
)
.
transform
<
String
>(
const
LineSplitter
())
.
listen
((
String
line
)
{
...
...
@@ -346,7 +344,7 @@ class IOSDeployDebugger {
_logger
.
printTrace
(
line
);
return
;
}
if
(
lastLineFromDebugger
!=
null
&&
lastLineFromDebugger
.
isNotEmpty
&&
line
.
isEmpty
)
{
if
(
lastLineFromDebugger
!=
null
&&
lastLineFromDebugger
!
.
isNotEmpty
&&
line
.
isEmpty
)
{
// The lldb console stream from ios-deploy is separated lines by an extra \r\n.
// To avoid all lines being double spaced, if the last line from the
// debugger was not an empty line, skip this empty line.
...
...
@@ -356,14 +354,14 @@ class IOSDeployDebugger {
}
lastLineFromDebugger
=
line
;
});
final
StreamSubscription
<
String
>
stderrSubscription
=
_iosDeployProcess
.
stderr
final
StreamSubscription
<
String
>
stderrSubscription
=
_iosDeployProcess
!
.
stderr
.
transform
<
String
>(
utf8
.
decoder
)
.
transform
<
String
>(
const
LineSplitter
())
.
listen
((
String
line
)
{
_monitorIOSDeployFailure
(
line
,
_logger
);
_logger
.
printTrace
(
line
);
});
unawaited
(
_iosDeployProcess
.
exitCode
.
then
((
int
status
)
{
unawaited
(
_iosDeployProcess
!
.
exitCode
.
then
((
int
status
)
{
_logger
.
printTrace
(
'ios-deploy exited with code
$exitCode
'
);
_debuggerState
=
_IOSDeployDebuggerState
.
detached
;
unawaited
(
stdoutSubscription
.
cancel
());
...
...
@@ -392,7 +390,7 @@ class IOSDeployDebugger {
}
bool
exit
()
{
final
bool
success
=
(
_iosDeployProcess
==
null
)
||
_iosDeployProcess
.
kill
();
final
bool
success
=
(
_iosDeployProcess
==
null
)
||
_iosDeployProcess
!
.
kill
();
_iosDeployProcess
=
null
;
return
success
;
}
...
...
@@ -404,7 +402,7 @@ class IOSDeployDebugger {
try
{
// Detach lldb from the app process.
_iosDeployProcess
?.
stdin
?
.
writeln
(
'process detach'
);
_iosDeployProcess
?.
stdin
.
writeln
(
'process detach'
);
_debuggerState
=
_IOSDeployDebuggerState
.
detached
;
}
on
SocketException
catch
(
error
)
{
// Best effort, try to detach, but maybe the app already exited or already detached.
...
...
packages/flutter_tools/test/general.shard/ios/ios_deploy_test.dart
View file @
855af290
...
...
@@ -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
'dart:convert'
;
...
...
@@ -22,9 +20,9 @@ import '../../src/fake_process_manager.dart';
import
'../../src/fakes.dart'
;
void
main
(
)
{
Artifacts
artifacts
;
String
iosDeployPath
;
FileSystem
fileSystem
;
late
Artifacts
artifacts
;
late
String
iosDeployPath
;
late
FileSystem
fileSystem
;
setUp
(()
{
artifacts
=
Artifacts
.
test
();
...
...
@@ -86,7 +84,7 @@ void main () {
group
(
'IOSDeployDebugger'
,
()
{
group
(
'launch'
,
()
{
BufferLogger
logger
;
late
BufferLogger
logger
;
setUp
(()
{
logger
=
BufferLogger
.
test
();
...
...
@@ -322,7 +320,7 @@ void main () {
}
IOSDeploy
setUpIOSDeploy
(
ProcessManager
processManager
,
{
Artifacts
artifacts
,
Artifacts
?
artifacts
,
})
{
final
FakePlatform
macPlatform
=
FakePlatform
(
operatingSystem:
'macos'
,
...
...
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