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
604c59e5
Unverified
Commit
604c59e5
authored
Jun 23, 2021
by
Balvinder Singh Gambhir
Committed by
GitHub
Jun 23, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
adds build number of ios device in flutter devices command (#84512)
parent
b9bf5769
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
100 additions
and
6 deletions
+100
-6
devices.dart
packages/flutter_tools/lib/src/ios/devices.dart
+1
-1
xcdevice.dart
packages/flutter_tools/lib/src/macos/xcdevice.dart
+25
-2
devices_test.dart
...es/flutter_tools/test/general.shard/ios/devices_test.dart
+18
-0
xcode_test.dart
...es/flutter_tools/test/general.shard/macos/xcode_test.dart
+56
-3
No files found.
packages/flutter_tools/lib/src/ios/devices.dart
View file @
604c59e5
...
...
@@ -465,7 +465,7 @@ class IOSDevice extends Device {
Future
<
TargetPlatform
>
get
targetPlatform
async
=>
TargetPlatform
.
ios
;
@override
Future
<
String
>
get
sdkNameAndVersion
async
=>
'iOS
$
_sdkVersion
'
;
Future
<
String
>
get
sdkNameAndVersion
async
=>
'iOS
$
{_sdkVersion ?? 'unknown version'}
'
;
@override
DeviceLogReader
getLogReader
({
...
...
packages/flutter_tools/lib/src/macos/xcdevice.dart
View file @
604c59e5
...
...
@@ -301,12 +301,21 @@ class XCDevice {
continue
;
}
String
sdkVersion
=
_sdkVersion
(
device
);
if
(
sdkVersion
!=
null
)
{
final
String
buildVersion
=
_buildVersion
(
device
);
if
(
buildVersion
!=
null
)
{
sdkVersion
=
'
$sdkVersion
$buildVersion
'
;
}
}
devices
.
add
(
IOSDevice
(
device
[
'identifier'
]
as
String
,
name:
device
[
'name'
]
as
String
,
cpuArchitecture:
_cpuArchitecture
(
device
),
interfaceType:
interface
,
sdkVersion
:
_sdkVersion
(
device
)
,
sdkVersion
:
sdkVersion
,
iProxy:
_iProxy
,
fileSystem:
globals
.
fs
,
logger:
_logger
,
...
...
@@ -317,6 +326,7 @@ class XCDevice {
}
}
return
devices
;
}
/// Despite the name, com.apple.platform.iphoneos includes iPhone, iPads, and all iOS devices.
...
...
@@ -363,7 +373,20 @@ class XCDevice {
// "13.3 (17C54)"
final
RegExp
operatingSystemRegex
=
RegExp
(
r'(.*) \(.*\)$'
);
final
String
operatingSystemVersion
=
deviceProperties
[
'operatingSystemVersion'
]
as
String
;
return
operatingSystemRegex
.
firstMatch
(
operatingSystemVersion
.
trim
())?.
group
(
1
);
if
(
operatingSystemRegex
.
hasMatch
(
operatingSystemVersion
.
trim
()))
{
return
operatingSystemRegex
.
firstMatch
(
operatingSystemVersion
.
trim
())?.
group
(
1
);
}
return
operatingSystemVersion
;
}
return
null
;
}
static
String
_buildVersion
(
Map
<
String
,
dynamic
>
deviceProperties
)
{
if
(
deviceProperties
.
containsKey
(
'operatingSystemVersion'
))
{
// Parse out the build version, for example 17C54 from "13.3 (17C54)".
final
RegExp
buildVersionRegex
=
RegExp
(
r'\(.*\)$'
);
final
String
operatingSystemVersion
=
deviceProperties
[
'operatingSystemVersion'
]
as
String
;
return
buildVersionRegex
.
firstMatch
(
operatingSystemVersion
)?.
group
(
0
)?.
replaceAll
(
RegExp
(
'[()]'
),
''
);
}
return
null
;
}
...
...
packages/flutter_tools/test/general.shard/ios/devices_test.dart
View file @
604c59e5
...
...
@@ -148,6 +148,24 @@ void main() {
).
majorSdkVersion
,
0
);
});
testWithoutContext
(
'has build number in sdkNameAndVersion'
,
()
async
{
final
IOSDevice
device
=
IOSDevice
(
'device-123'
,
iProxy:
IProxy
.
test
(
logger:
logger
,
processManager:
FakeProcessManager
.
any
()),
fileSystem:
nullFileSystem
,
logger:
logger
,
platform:
macPlatform
,
iosDeploy:
iosDeploy
,
iMobileDevice:
iMobileDevice
,
name:
'iPhone 1'
,
sdkVersion:
'13.3 17C54'
,
cpuArchitecture:
DarwinArch
.
arm64
,
interfaceType:
IOSDeviceInterface
.
usb
,
);
expect
(
await
device
.
sdkNameAndVersion
,
'iOS 13.3 17C54'
);
});
testWithoutContext
(
'Supports debug, profile, and release modes'
,
()
{
final
IOSDevice
device
=
IOSDevice
(
'device-123'
,
...
...
packages/flutter_tools/test/general.shard/macos/xcode_test.dart
View file @
604c59e5
...
...
@@ -513,15 +513,15 @@ void main() {
expect
(
devices
,
hasLength
(
3
));
expect
(
devices
[
0
].
id
,
'00008027-00192736010F802E'
);
expect
(
devices
[
0
].
name
,
'An iPhone (Space Gray)'
);
expect
(
await
devices
[
0
].
sdkNameAndVersion
,
'iOS 13.3'
);
expect
(
await
devices
[
0
].
sdkNameAndVersion
,
'iOS 13.3
17C54
'
);
expect
(
devices
[
0
].
cpuArchitecture
,
DarwinArch
.
arm64
);
expect
(
devices
[
1
].
id
,
'98206e7a4afd4aedaff06e687594e089dede3c44'
);
expect
(
devices
[
1
].
name
,
'iPad 1'
);
expect
(
await
devices
[
1
].
sdkNameAndVersion
,
'iOS 10.1'
);
expect
(
await
devices
[
1
].
sdkNameAndVersion
,
'iOS 10.1
14C54
'
);
expect
(
devices
[
1
].
cpuArchitecture
,
DarwinArch
.
armv7
);
expect
(
devices
[
2
].
id
,
'f577a7903cc54959be2e34bc4f7f80b7009efcf4'
);
expect
(
devices
[
2
].
name
,
'iPad 2'
);
expect
(
await
devices
[
2
].
sdkNameAndVersion
,
'iOS 10.1'
);
expect
(
await
devices
[
2
].
sdkNameAndVersion
,
'iOS 10.1
14C54
'
);
expect
(
devices
[
2
].
cpuArchitecture
,
DarwinArch
.
arm64
);
// Defaults to arm64 for unknown architecture.
expect
(
fakeProcessManager
.
hasRemainingExpectations
,
isFalse
);
},
overrides:
<
Type
,
Generator
>{
...
...
@@ -627,6 +627,59 @@ void main() {
Platform:
()
=>
macPlatform
,
Artifacts:
()
=>
Artifacts
.
test
(),
});
testUsingContext
(
'Sdk Version is parsed correctly'
,()
async
{
const
String
devicesOutput
=
'''
[
{
"simulator" : false,
"operatingSystemVersion" : "13.3 (17C54)",
"interface" : "usb",
"available" : true,
"platform" : "com.apple.platform.iphoneos",
"modelCode" : "iPhone8,1",
"identifier" : "00008027-00192736010F802E",
"architecture" : "arm64",
"modelName" : "iPhone 6s",
"name" : "An iPhone (Space Gray)"
},
{
"simulator" : false,
"operatingSystemVersion" : "10.1",
"interface" : "usb",
"available" : true,
"platform" : "com.apple.platform.iphoneos",
"modelCode" : "iPad11,4",
"identifier" : "234234234234234234345445687594e089dede3c44",
"architecture" : "arm64",
"modelName" : "iPad Air 3rd Gen",
"name" : "A networked iPad"
},
{
"simulator" : false,
"interface" : "usb",
"available" : true,
"platform" : "com.apple.platform.iphoneos",
"modelCode" : "iPad11,4",
"identifier" : "f577a7903cc54959be2e34bc4f7f80b7009efcf4",
"architecture" : "BOGUS",
"modelName" : "iPad Air 3rd Gen",
"name" : "iPad 2"
}
]
'''
;
fakeProcessManager
.
addCommand
(
const
FakeCommand
(
command:
<
String
>[
'xcrun'
,
'xcdevice'
,
'list'
,
'--timeout'
,
'2'
],
stdout:
devicesOutput
,
));
final
List
<
IOSDevice
>
devices
=
await
xcdevice
.
getAvailableIOSDevices
();
expect
(
await
devices
[
0
].
sdkNameAndVersion
,
'iOS 13.3 17C54'
);
expect
(
await
devices
[
1
].
sdkNameAndVersion
,
'iOS 10.1'
);
expect
(
await
devices
[
2
].
sdkNameAndVersion
,
'iOS unknown version'
);
},
overrides:
<
Type
,
Generator
>{
Platform:
()
=>
macPlatform
,
});
});
group
(
'diagnostics'
,
()
{
...
...
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