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
a0665aba
Unverified
Commit
a0665aba
authored
Feb 06, 2020
by
Jenn Magder
Committed by
GitHub
Feb 06, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Reland Replace ideviceinfo and idevice_id with xcdevice (#50252)
parent
fbb3d281
Changes
6
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
951 additions
and
282 deletions
+951
-282
context_runner.dart
packages/flutter_tools/lib/src/context_runner.dart
+5
-0
globals.dart
packages/flutter_tools/lib/src/globals.dart
+2
-0
devices.dart
packages/flutter_tools/lib/src/ios/devices.dart
+24
-38
xcode.dart
packages/flutter_tools/lib/src/macos/xcode.dart
+328
-0
devices_test.dart
...es/flutter_tools/test/general.shard/ios/devices_test.dart
+65
-111
xcode_test.dart
...es/flutter_tools/test/general.shard/macos/xcode_test.dart
+527
-133
No files found.
packages/flutter_tools/lib/src/context_runner.dart
View file @
a0665aba
...
...
@@ -166,6 +166,11 @@ Future<T> runInContext<T>(
fileSystem:
globals
.
fs
,
xcodeProjectInterpreter:
xcodeProjectInterpreter
,
),
XCDevice:
()
=>
XCDevice
(
processManager:
globals
.
processManager
,
logger:
globals
.
logger
,
xcode:
globals
.
xcode
,
),
XcodeProjectInterpreter:
()
=>
XcodeProjectInterpreter
(
logger:
globals
.
logger
,
processManager:
globals
.
processManager
,
...
...
packages/flutter_tools/lib/src/globals.dart
View file @
a0665aba
...
...
@@ -57,6 +57,8 @@ Xcode get xcode => context.get<Xcode>();
FlutterVersion
get
flutterVersion
=>
context
.
get
<
FlutterVersion
>();
IMobileDevice
get
iMobileDevice
=>
context
.
get
<
IMobileDevice
>();
XCDevice
get
xcdevice
=>
context
.
get
<
XCDevice
>();
/// Display an error level message to the user. Commands should use this if they
/// fail in some way.
///
...
...
packages/flutter_tools/lib/src/ios/devices.dart
View file @
a0665aba
...
...
@@ -5,6 +5,7 @@
import
'dart:async'
;
import
'package:meta/meta.dart'
;
import
'package:platform/platform.dart'
;
import
'../application_package.dart'
;
import
'../artifacts.dart'
;
...
...
@@ -18,6 +19,7 @@ import '../build_info.dart';
import
'../convert.dart'
;
import
'../device.dart'
;
import
'../globals.dart'
as
globals
;
import
'../macos/xcode.dart'
;
import
'../mdns_discovery.dart'
;
import
'../project.dart'
;
import
'../protocol_discovery.dart'
;
...
...
@@ -111,11 +113,18 @@ class IOSDevices extends PollingDeviceDiscovery {
bool
get
canListAnything
=>
iosWorkflow
.
canListDevices
;
@override
Future
<
List
<
Device
>>
pollingGetDevices
()
=>
IOSDevice
.
getAttachedDevices
();
Future
<
List
<
Device
>>
pollingGetDevices
()
=>
IOSDevice
.
getAttachedDevices
(
globals
.
platform
,
globals
.
xcdevice
);
@override
Future
<
List
<
String
>>
getDiagnostics
()
=>
IOSDevice
.
getDiagnostics
(
globals
.
platform
,
globals
.
xcdevice
);
}
class
IOSDevice
extends
Device
{
IOSDevice
(
String
id
,
{
this
.
name
,
String
sdkVersion
})
IOSDevice
(
String
id
,
{
@required
this
.
name
,
@required
this
.
cpuArchitecture
,
@required
String
sdkVersion
,
})
:
_sdkVersion
=
sdkVersion
,
super
(
id
,
...
...
@@ -157,6 +166,8 @@ class IOSDevice extends Device {
@override
final
String
name
;
final
DarwinArch
cpuArchitecture
;
Map
<
IOSApp
,
DeviceLogReader
>
_logReaders
;
DevicePortForwarder
_portForwarder
;
...
...
@@ -170,34 +181,20 @@ class IOSDevice extends Device {
@override
bool
get
supportsStartPaused
=>
false
;
static
Future
<
List
<
IOSDevice
>>
getAttachedDevices
()
async
{
if
(!
globals
.
platform
.
isMacOS
)
{
throw
UnsupportedError
(
'Control of iOS devices or simulators only supported on Mac OS.'
);
}
if
(!
globals
.
iMobileDevice
.
isInstalled
)
{
return
<
IOSDevice
>[];
static
Future
<
List
<
IOSDevice
>>
getAttachedDevices
(
Platform
platform
,
XCDevice
xcdevice
)
async
{
if
(!
platform
.
isMacOS
)
{
throw
UnsupportedError
(
'Control of iOS devices or simulators only supported on macOS.'
);
}
final
List
<
IOSDevice
>
devices
=
<
IOSDevice
>[];
for
(
String
id
in
(
await
globals
.
iMobileDevice
.
getAvailableDeviceIDs
()).
split
(
'
\n
'
))
{
id
=
id
.
trim
();
if
(
id
.
isEmpty
)
{
continue
;
}
return
await
xcdevice
.
getAvailableTetheredIOSDevices
();
}
try
{
final
String
deviceName
=
await
globals
.
iMobileDevice
.
getInfoForDevice
(
id
,
'DeviceName'
);
final
String
sdkVersion
=
await
globals
.
iMobileDevice
.
getInfoForDevice
(
id
,
'ProductVersion'
);
devices
.
add
(
IOSDevice
(
id
,
name:
deviceName
,
sdkVersion:
sdkVersion
));
}
on
IOSDeviceNotFoundError
catch
(
error
)
{
// Unable to find device with given udid. Possibly a network device.
globals
.
printTrace
(
'Error getting attached iOS device:
$error
'
);
}
on
IOSDeviceNotTrustedError
catch
(
error
)
{
globals
.
printTrace
(
'Error getting attached iOS device information:
$error
'
);
UsageEvent
(
'device'
,
'ios-trust-failure'
).
send
();
}
static
Future
<
List
<
String
>>
getDiagnostics
(
Platform
platform
,
XCDevice
xcdevice
)
async
{
if
(!
platform
.
isMacOS
)
{
return
const
<
String
>[
'Control of iOS devices or simulators only supported on macOS.'
];
}
return
devices
;
return
await
xcdevice
.
getDiagnostics
();
}
@override
...
...
@@ -280,24 +277,13 @@ class IOSDevice extends Device {
// TODO(chinmaygarde): Use mainPath, route.
globals
.
printTrace
(
'Building
${package.name}
for
$id
'
);
String
cpuArchitecture
;
try
{
cpuArchitecture
=
await
globals
.
iMobileDevice
.
getInfoForDevice
(
id
,
'CPUArchitecture'
);
}
on
IOSDeviceNotFoundError
catch
(
e
)
{
globals
.
printError
(
e
.
message
);
return
LaunchResult
.
failed
();
}
final
DarwinArch
iosArch
=
getIOSArchForName
(
cpuArchitecture
);
// Step 1: Build the precompiled/DBC application if necessary.
final
XcodeBuildResult
buildResult
=
await
buildXcodeProject
(
app:
package
as
BuildableIOSApp
,
buildInfo:
debuggingOptions
.
buildInfo
,
targetOverride:
mainPath
,
buildForDevice:
true
,
activeArch:
iosArch
,
activeArch:
cpuArchitecture
,
);
if
(!
buildResult
.
success
)
{
globals
.
printError
(
'Could not build the precompiled application for the device.'
);
...
...
packages/flutter_tools/lib/src/macos/xcode.dart
View file @
a0665aba
This diff is collapsed.
Click to expand it.
packages/flutter_tools/test/general.shard/ios/devices_test.dart
View file @
a0665aba
This diff is collapsed.
Click to expand it.
packages/flutter_tools/test/general.shard/macos/xcode_test.dart
View file @
a0665aba
This diff is collapsed.
Click to expand it.
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