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
51f1eb35
Commit
51f1eb35
authored
Oct 09, 2015
by
Ian Fischer
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #82 from iansf/ios_listen
Get iOS devices working on Mac if you specify sky-src-path.
parents
99de0818
ae324109
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
74 additions
and
12 deletions
+74
-12
device.dart
packages/flutter_tools/lib/src/device.dart
+37
-0
listen.dart
packages/flutter_tools/lib/src/listen.dart
+34
-11
listen_test.dart
packages/flutter_tools/test/listen_test.dart
+3
-1
No files found.
packages/flutter_tools/lib/src/device.dart
View file @
51f1eb35
...
...
@@ -92,6 +92,9 @@ class IOSDevice extends _Device {
String
_loggerPath
;
String
get
loggerPath
=>
_loggerPath
;
String
_pusherPath
;
String
get
pusherPath
=>
_pusherPath
;
String
_name
;
String
get
name
=>
_name
;
...
...
@@ -107,6 +110,13 @@ class IOSDevice extends _Device {
_informerPath
=
_checkForCommand
(
'ideviceinfo'
);
_debuggerPath
=
_checkForCommand
(
'idevicedebug'
);
_loggerPath
=
_checkForCommand
(
'idevicesyslog'
);
_pusherPath
=
_checkForCommand
(
'ios-deploy'
,
'To copy files to iOS devices, please install ios-deploy. '
'You can do this using homebrew as follows:
\n
'
'
\$
brew tap flutter/flutter
\n
'
'
\$
brew install ios-deploy'
,
'Copying files to iOS devices is not currently supported on Linux.'
);
}
static
List
<
IOSDevice
>
getAttachedDevices
([
IOSDevice
mockIOS
])
{
...
...
@@ -208,6 +218,33 @@ class IOSDevice extends _Device {
return
false
;
}
Future
<
bool
>
pushFile
(
ApplicationPackage
app
,
String
localFile
,
String
targetFile
)
async
{
if
(
Platform
.
isMacOS
)
{
runSync
([
pusherPath
,
'-t'
,
'1'
,
'--bundle_id'
,
app
.
appPackageID
,
'--upload'
,
localFile
,
'--to'
,
targetFile
]);
return
true
;
}
else
{
// TODO(iansf): It may be possible to make this work on Linux. Since this
// functionality appears to be the only that prevents us from
// supporting iOS on Linux, it may be worth putting some time
// into investigating this.
// See https://bbs.archlinux.org/viewtopic.php?id=192655
return
false
;
}
return
false
;
}
/// Note that clear is not supported on iOS at this time.
Future
<
int
>
logs
({
bool
clear:
false
})
{
return
runCommandAndStreamOutput
([
loggerPath
],
prefix:
'IOS DEV: '
,
filter:
new
RegExp
(
r'.*SkyShell.*'
));
...
...
packages/flutter_tools/lib/src/listen.dart
View file @
51f1eb35
...
...
@@ -19,22 +19,14 @@ class ListenCommand extends Command {
final
name
=
'listen'
;
final
description
=
'Listen for changes to files and reload the running app '
'on all connected devices.'
;
AndroidDevice
android
=
null
;
AndroidDevice
android
;
IOSDevice
ios
;
List
<
String
>
watchCommand
;
/// Only run once. Used for testing.
bool
singleRun
;
ListenCommand
({
this
.
android
,
this
.
singleRun
:
false
})
{
argParser
.
addFlag
(
'checked'
,
negatable:
true
,
defaultsTo:
true
,
help:
'Toggle Dart
\'
s checked mode.'
);
argParser
.
addOption
(
'target'
,
defaultsTo:
'.'
,
abbr:
't'
,
help:
'Target app path or filename to start.'
);
}
ListenCommand
({
this
.
android
,
this
.
ios
,
this
.
singleRun
:
false
})
{}
@override
Future
<
int
>
run
()
async
{
...
...
@@ -42,6 +34,10 @@ class ListenCommand extends Command {
android
=
new
AndroidDevice
();
}
if
(
ios
==
null
)
{
ios
=
new
IOSDevice
();
}
if
(
argResults
.
rest
.
length
>
0
)
{
watchCommand
=
_initWatchCommand
(
argResults
.
rest
);
}
else
{
...
...
@@ -51,10 +47,37 @@ class ListenCommand extends Command {
Map
<
BuildPlatform
,
ApplicationPackage
>
packages
=
ApplicationPackageFactory
.
getAvailableApplicationPackages
();
ApplicationPackage
androidApp
=
packages
[
BuildPlatform
.
android
];
ApplicationPackage
iosApp
=
packages
[
BuildPlatform
.
iOS
];
while
(
true
)
{
_logging
.
info
(
'Updating running Sky apps...'
);
// TODO(iansf): refactor build command so that this doesn't have
// to call out like this.
List
<
String
>
command
=
[
'pub'
,
'run'
,
'sky_tools'
,
'build'
,];
try
{
// In testing, sky-src-path isn't added to the options, and
// the ArgParser module throws an exception, so we have to
// catch and ignore the error in order to test.
if
(
globalResults
.
wasParsed
(
'sky-src-path'
))
{
command
.
addAll
([
// TODO(iansf): Don't rely on sky-src-path for the snapshotter.
'--compiler'
,
'
${globalResults['sky-src-path']}
'
'/out/ios_Debug/clang_x64/sky_snapshot'
]);
}
}
catch
(
e
)
{}
runSync
(
command
);
String
localFLXPath
=
'app.flx'
;
String
remoteFLXPath
=
'Documents/app.flx'
;
if
(
ios
.
isConnected
())
{
await
ios
.
pushFile
(
iosApp
,
localFLXPath
,
remoteFLXPath
);
}
if
(
android
.
isConnected
())
{
await
android
.
startServer
(
argResults
[
'target'
],
true
,
argResults
[
'checked'
],
androidApp
);
...
...
packages/flutter_tools/test/listen_test.dart
View file @
51f1eb35
...
...
@@ -20,8 +20,10 @@ defineTests() {
MockAndroidDevice
android
=
new
MockAndroidDevice
();
when
(
android
.
isConnected
()).
thenReturn
(
false
);
MockIOSDevice
ios
=
new
MockIOSDevice
();
when
(
ios
.
isConnected
()).
thenReturn
(
false
);
ListenCommand
command
=
new
ListenCommand
(
android:
android
,
singleRun:
true
);
new
ListenCommand
(
android:
android
,
ios:
ios
,
singleRun:
true
);
CommandRunner
runner
=
new
CommandRunner
(
'test_flutter'
,
''
)
..
addCommand
(
command
);
...
...
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