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
ca5411e3
Unverified
Commit
ca5411e3
authored
Aug 12, 2019
by
Jonah Williams
Committed by
GitHub
Aug 12, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix type error hidden by implicit downcasts (#38102)
parent
2003432c
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
29 additions
and
18 deletions
+29
-18
simulators.dart
packages/flutter_tools/lib/src/ios/simulators.dart
+23
-18
simulators_test.dart
...flutter_tools/test/general.shard/ios/simulators_test.dart
+6
-0
No files found.
packages/flutter_tools/lib/src/ios/simulators.dart
View file @
ca5411e3
...
@@ -90,7 +90,12 @@ class SimControl {
...
@@ -90,7 +90,12 @@ class SimControl {
return
<
String
,
Map
<
String
,
dynamic
>>{};
return
<
String
,
Map
<
String
,
dynamic
>>{};
}
}
try
{
try
{
return
json
.
decode
(
results
.
stdout
)[
section
.
name
];
final
Object
decodeResult
=
json
.
decode
(
results
.
stdout
?.
toString
())[
section
.
name
];
if
(
decodeResult
is
Map
<
String
,
dynamic
>)
{
return
decodeResult
;
}
printError
(
'simctl returned unexpected JSON response:
${results.stdout}
'
);
return
<
String
,
dynamic
>{};
}
on
FormatException
{
}
on
FormatException
{
// We failed to parse the simctl output, or it returned junk.
// We failed to parse the simctl output, or it returned junk.
// One known message is "Install Started" isn't valid JSON but is
// One known message is "Install Started" isn't valid JSON but is
...
@@ -107,9 +112,11 @@ class SimControl {
...
@@ -107,9 +112,11 @@ class SimControl {
final
Map
<
String
,
dynamic
>
devicesSection
=
await
_list
(
SimControlListSection
.
devices
);
final
Map
<
String
,
dynamic
>
devicesSection
=
await
_list
(
SimControlListSection
.
devices
);
for
(
String
deviceCategory
in
devicesSection
.
keys
)
{
for
(
String
deviceCategory
in
devicesSection
.
keys
)
{
final
List
<
dynamic
>
devicesData
=
devicesSection
[
deviceCategory
];
final
Object
devicesData
=
devicesSection
[
deviceCategory
];
for
(
Map
<
String
,
dynamic
>
data
in
devicesData
.
map
<
Map
<
String
,
dynamic
>>(
castStringKeyedMap
))
{
if
(
devicesData
!=
null
&&
devicesData
is
List
<
dynamic
>)
{
devices
.
add
(
SimDevice
(
deviceCategory
,
data
));
for
(
Map
<
String
,
dynamic
>
data
in
devicesData
.
map
<
Map
<
String
,
dynamic
>>(
castStringKeyedMap
))
{
devices
.
add
(
SimDevice
(
deviceCategory
,
data
));
}
}
}
}
}
...
@@ -220,10 +227,10 @@ class SimDevice {
...
@@ -220,10 +227,10 @@ class SimDevice {
final
String
category
;
final
String
category
;
final
Map
<
String
,
dynamic
>
data
;
final
Map
<
String
,
dynamic
>
data
;
String
get
state
=>
data
[
'state'
];
String
get
state
=>
data
[
'state'
]
?.
toString
()
;
String
get
availability
=>
data
[
'availability'
];
String
get
availability
=>
data
[
'availability'
]
?.
toString
()
;
String
get
name
=>
data
[
'name'
];
String
get
name
=>
data
[
'name'
]
?.
toString
()
;
String
get
udid
=>
data
[
'udid'
];
String
get
udid
=>
data
[
'udid'
]
?.
toString
()
;
bool
get
isBooted
=>
state
==
'Booted'
;
bool
get
isBooted
=>
state
==
'Booted'
;
}
}
...
@@ -267,7 +274,7 @@ class IOSSimulator extends Device {
...
@@ -267,7 +274,7 @@ class IOSSimulator extends Device {
Future
<
bool
>
isLatestBuildInstalled
(
ApplicationPackage
app
)
async
=>
false
;
Future
<
bool
>
isLatestBuildInstalled
(
ApplicationPackage
app
)
async
=>
false
;
@override
@override
Future
<
bool
>
installApp
(
ApplicationPackage
app
)
async
{
Future
<
bool
>
installApp
(
covariant
IOSApp
app
)
async
{
try
{
try
{
final
IOSApp
iosApp
=
app
;
final
IOSApp
iosApp
=
app
;
await
SimControl
.
instance
.
install
(
id
,
iosApp
.
simulatorBundlePath
);
await
SimControl
.
instance
.
install
(
id
,
iosApp
.
simulatorBundlePath
);
...
@@ -316,7 +323,7 @@ class IOSSimulator extends Device {
...
@@ -316,7 +323,7 @@ class IOSSimulator extends Device {
@override
@override
Future
<
LaunchResult
>
startApp
(
Future
<
LaunchResult
>
startApp
(
ApplicationPackage
package
,
{
covariant
IOSApp
package
,
{
String
mainPath
,
String
mainPath
,
String
route
,
String
route
,
DebuggingOptions
debuggingOptions
,
DebuggingOptions
debuggingOptions
,
...
@@ -325,7 +332,7 @@ class IOSSimulator extends Device {
...
@@ -325,7 +332,7 @@ class IOSSimulator extends Device {
bool
usesTerminalUi
=
true
,
bool
usesTerminalUi
=
true
,
bool
ipv6
=
false
,
bool
ipv6
=
false
,
})
async
{
})
async
{
if
(!
prebuiltApplication
)
{
if
(!
prebuiltApplication
&&
package
is
BuildableIOSApp
)
{
printTrace
(
'Building
${package.name}
for
$id
.'
);
printTrace
(
'Building
${package.name}
for
$id
.'
);
try
{
try
{
...
@@ -371,8 +378,7 @@ class IOSSimulator extends Device {
...
@@ -371,8 +378,7 @@ class IOSSimulator extends Device {
// which should always yield the correct value and does not require
// which should always yield the correct value and does not require
// parsing the xcodeproj or configuration files.
// parsing the xcodeproj or configuration files.
// See https://github.com/flutter/flutter/issues/31037 for more information.
// See https://github.com/flutter/flutter/issues/31037 for more information.
final
IOSApp
iosApp
=
package
;
final
String
plistPath
=
fs
.
path
.
join
(
package
.
simulatorBundlePath
,
'Info.plist'
);
final
String
plistPath
=
fs
.
path
.
join
(
iosApp
.
simulatorBundlePath
,
'Info.plist'
);
final
String
bundleIdentifier
=
iosWorkflow
.
getPlistValueFromFile
(
plistPath
,
kCFBundleIdentifierKey
);
final
String
bundleIdentifier
=
iosWorkflow
.
getPlistValueFromFile
(
plistPath
,
kCFBundleIdentifierKey
);
await
SimControl
.
instance
.
launch
(
id
,
bundleIdentifier
,
args
);
await
SimControl
.
instance
.
launch
(
id
,
bundleIdentifier
,
args
);
...
@@ -400,7 +406,7 @@ class IOSSimulator extends Device {
...
@@ -400,7 +406,7 @@ class IOSSimulator extends Device {
}
}
}
}
Future
<
void
>
_setupUpdatedApplicationBundle
(
ApplicationPackage
app
,
BuildInfo
buildInfo
,
String
mainPath
,
bool
usesTerminalUi
)
async
{
Future
<
void
>
_setupUpdatedApplicationBundle
(
covariant
BuildableIOSApp
app
,
BuildInfo
buildInfo
,
String
mainPath
,
bool
usesTerminalUi
)
async
{
await
_sideloadUpdatedAssetsForInstalledApplicationBundle
(
app
,
buildInfo
,
mainPath
);
await
_sideloadUpdatedAssetsForInstalledApplicationBundle
(
app
,
buildInfo
,
mainPath
);
// Step 1: Build the Xcode project.
// Step 1: Build the Xcode project.
...
@@ -422,8 +428,7 @@ class IOSSimulator extends Device {
...
@@ -422,8 +428,7 @@ class IOSSimulator extends Device {
throwToolExit
(
'Could not build the application for the simulator.'
);
throwToolExit
(
'Could not build the application for the simulator.'
);
// Step 2: Assert that the Xcode project was successfully built.
// Step 2: Assert that the Xcode project was successfully built.
final
IOSApp
iosApp
=
app
;
final
Directory
bundle
=
fs
.
directory
(
app
.
simulatorBundlePath
);
final
Directory
bundle
=
fs
.
directory
(
iosApp
.
simulatorBundlePath
);
final
bool
bundleExists
=
bundle
.
existsSync
();
final
bool
bundleExists
=
bundle
.
existsSync
();
if
(!
bundleExists
)
if
(!
bundleExists
)
throwToolExit
(
'Could not find the built application bundle at
${bundle.path}
.'
);
throwToolExit
(
'Could not find the built application bundle at
${bundle.path}
.'
);
...
@@ -463,11 +468,11 @@ class IOSSimulator extends Device {
...
@@ -463,11 +468,11 @@ class IOSSimulator extends Device {
Future
<
int
>
get
sdkMajorVersion
async
{
Future
<
int
>
get
sdkMajorVersion
async
{
final
Match
sdkMatch
=
_iosSdkRegExp
.
firstMatch
(
await
sdkNameAndVersion
);
final
Match
sdkMatch
=
_iosSdkRegExp
.
firstMatch
(
await
sdkNameAndVersion
);
return
int
.
parse
(
sdkMatch
?.
group
(
2
)
??
11
);
return
int
.
parse
(
sdkMatch
?.
group
(
2
)
??
'11'
);
}
}
@override
@override
DeviceLogReader
getLogReader
({
ApplicationPackage
app
})
{
DeviceLogReader
getLogReader
({
covariant
IOSApp
app
})
{
assert
(
app
is
IOSApp
);
assert
(
app
is
IOSApp
);
_logReaders
??=
<
ApplicationPackage
,
_IOSSimulatorLogReader
>{};
_logReaders
??=
<
ApplicationPackage
,
_IOSSimulatorLogReader
>{};
return
_logReaders
.
putIfAbsent
(
app
,
()
=>
_IOSSimulatorLogReader
(
this
,
app
));
return
_logReaders
.
putIfAbsent
(
app
,
()
=>
_IOSSimulatorLogReader
(
this
,
app
));
...
...
packages/flutter_tools/test/general.shard/ios/simulators_test.dart
View file @
ca5411e3
...
@@ -438,6 +438,12 @@ void main() {
...
@@ -438,6 +438,12 @@ void main() {
ProcessManager:
()
=>
mockProcessManager
,
ProcessManager:
()
=>
mockProcessManager
,
SimControl:
()
=>
simControl
,
SimControl:
()
=>
simControl
,
});
});
testUsingContext
(
'sdkMajorVersion defaults to 11 when sdkNameAndVersion is junk'
,
()
async
{
final
IOSSimulator
iosSimulatorA
=
IOSSimulator
(
'x'
,
name:
'Testo'
,
simulatorCategory:
'NaN'
);
expect
(
await
iosSimulatorA
.
sdkMajorVersion
,
11
);
});
});
});
group
(
'startApp'
,
()
{
group
(
'startApp'
,
()
{
...
...
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