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
bb1da703
Commit
bb1da703
authored
Oct 17, 2015
by
Devon Carew
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
return exit codes on failures
parent
3c9c3133
Changes
13
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
55 additions
and
43 deletions
+55
-43
sky_server.dart
packages/flutter_tools/bin/sky_server.dart
+2
-2
sky_test.dart
packages/flutter_tools/bin/sky_test.dart
+1
-1
executable.dart
packages/flutter_tools/lib/executable.dart
+15
-8
build.dart
packages/flutter_tools/lib/src/commands/build.dart
+14
-13
flutter_command_runner.dart
...lutter_tools/lib/src/commands/flutter_command_runner.dart
+1
-1
list.dart
packages/flutter_tools/lib/src/commands/list.dart
+1
-1
logs.dart
packages/flutter_tools/lib/src/commands/logs.dart
+1
-1
run_mojo.dart
packages/flutter_tools/lib/src/commands/run_mojo.dart
+7
-7
start.dart
packages/flutter_tools/lib/src/commands/start.dart
+8
-0
trace.dart
packages/flutter_tools/lib/src/commands/trace.dart
+1
-1
device.dart
packages/flutter_tools/lib/src/device.dart
+4
-4
stop_test.dart
packages/flutter_tools/test/stop_test.dart
+0
-2
trace_test.dart
packages/flutter_tools/test/trace_test.dart
+0
-2
No files found.
packages/flutter_tools/bin/sky_server.dart
View file @
bb1da703
...
...
@@ -5,10 +5,10 @@
import
'dart:io'
;
import
'package:args/args.dart'
;
import
'package:shelf_static/shelf_static.dart'
;
import
'package:shelf/shelf_io.dart'
as
io
;
import
'package:shelf/shelf.dart'
;
import
'package:shelf/shelf_io.dart'
as
io
;
import
'package:shelf_route/shelf_route.dart'
as
shelf_route
;
import
'package:shelf_static/shelf_static.dart'
;
void
printUsage
(
parser
)
{
print
(
'Usage: sky_server [-v] PORT'
);
...
...
packages/flutter_tools/bin/sky_test.dart
View file @
bb1da703
...
...
@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import
'package:test/src/executable.dart'
as
executable
;
import
'package:sky_tools/src/test/loader.dart'
as
loader
;
import
'package:test/src/executable.dart'
as
executable
;
main
(
List
<
String
>
args
)
{
loader
.
installHook
();
...
...
packages/flutter_tools/lib/executable.dart
View file @
bb1da703
...
...
@@ -8,9 +8,9 @@ import 'dart:io';
import
'package:args/command_runner.dart'
;
import
'package:logging/logging.dart'
;
import
'src/commands/flutter_command_runner.dart'
;
import
'src/commands/build.dart'
;
import
'src/commands/cache.dart'
;
import
'src/commands/flutter_command_runner.dart'
;
import
'src/commands/init.dart'
;
import
'src/commands/install.dart'
;
import
'src/commands/list.dart'
;
...
...
@@ -25,13 +25,18 @@ import 'src/commands/trace.dart';
///
/// This function is intended to be used from the [flutter] command line tool.
Future
main
(
List
<
String
>
args
)
async
{
Logger
.
root
.
level
=
Level
.
WARNING
;
// This level can be adjusted by users through the `--verbose` option.
Logger
.
root
.
level
=
Level
.
SEVERE
;
Logger
.
root
.
onRecord
.
listen
((
LogRecord
record
)
{
print
(
'
${record.level.name}
:
${record.message}
'
);
if
(
record
.
level
>=
Level
.
WARNING
)
{
stderr
.
writeln
(
record
.
message
);
}
else
{
print
(
record
.
message
);
}
if
(
record
.
error
!=
null
)
print
(
record
.
error
);
stderr
.
writeln
(
record
.
error
);
if
(
record
.
stackTrace
!=
null
)
print
(
record
.
stackTrace
);
stderr
.
writeln
(
record
.
stackTrace
);
});
FlutterCommandRunner
runner
=
new
FlutterCommandRunner
()
...
...
@@ -48,9 +53,11 @@ Future main(List<String> args) async {
..
addCommand
(
new
TraceCommand
());
try
{
await
runner
.
run
(
args
);
dynamic
result
=
await
runner
.
run
(
args
);
if
(
result
is
int
)
exit
(
result
);
}
on
UsageException
catch
(
e
)
{
print
(
e
);
exit
(
1
);
stderr
.
writeln
(
e
);
exit
(
4
);
}
}
packages/flutter_tools/lib/src/commands/build.dart
View file @
bb1da703
...
...
@@ -81,24 +81,24 @@ Iterable<_MaterialAsset> _parseMaterialAssets(Map manifestDescriptor) sync* {
}
}
Future
_loadManifest
(
String
manifestPath
)
async
{
dynamic
_loadManifest
(
String
manifestPath
)
{
if
(
manifestPath
==
null
)
return
null
;
String
manifestDescriptor
=
await
new
File
(
manifestPath
).
readAsString
();
String
manifestDescriptor
=
new
File
(
manifestPath
).
readAsStringSync
();
return
loadYaml
(
manifestDescriptor
);
}
Future
<
ArchiveFile
>
_createFile
(
String
key
,
String
assetBase
)
async
{
ArchiveFile
_createFile
(
String
key
,
String
assetBase
)
{
File
file
=
new
File
(
'
${assetBase}
/
${key}
'
);
if
(!
await
file
.
exists
())
if
(!
file
.
existsSync
())
return
null
;
List
<
int
>
content
=
await
file
.
readAsBytes
();
List
<
int
>
content
=
file
.
readAsBytesSync
();
return
new
ArchiveFile
.
noCompress
(
key
,
content
.
length
,
content
);
}
Future
<
ArchiveFile
>
_createSnapshotFile
(
String
snapshotPath
)
async
{
ArchiveFile
_createSnapshotFile
(
String
snapshotPath
)
{
File
file
=
new
File
(
snapshotPath
);
List
<
int
>
content
=
await
file
.
readAsBytes
();
List
<
int
>
content
=
file
.
readAsBytesSync
();
return
new
ArchiveFile
(
_kSnapshotKey
,
content
.
length
,
content
);
}
...
...
@@ -145,7 +145,7 @@ class BuildCommand extends FlutterCommand {
String
outputPath:
_kDefaultOutputPath
,
String
snapshotPath:
_kDefaultSnapshotPath
})
async
{
Map
manifestDescriptor
=
await
_loadManifest
(
manifestPath
);
Map
manifestDescriptor
=
_loadManifest
(
manifestPath
);
Iterable
<
_Asset
>
assets
=
_parseAssets
(
manifestDescriptor
,
manifestPath
);
Iterable
<
_MaterialAsset
>
materialAssets
=
_parseMaterialAssets
(
manifestDescriptor
);
...
...
@@ -156,20 +156,21 @@ class BuildCommand extends FlutterCommand {
if
(
result
!=
0
)
return
result
;
archive
.
addFile
(
await
_createSnapshotFile
(
snapshotPath
));
archive
.
addFile
(
_createSnapshotFile
(
snapshotPath
));
for
(
_Asset
asset
in
assets
)
archive
.
addFile
(
await
_createFile
(
asset
.
key
,
asset
.
base
));
archive
.
addFile
(
_createFile
(
asset
.
key
,
asset
.
base
));
for
(
_MaterialAsset
asset
in
materialAssets
)
{
ArchiveFile
file
=
await
_createFile
(
asset
.
key
,
assetBase
);
ArchiveFile
file
=
_createFile
(
asset
.
key
,
assetBase
);
if
(
file
!=
null
)
archive
.
addFile
(
file
);
}
File
outputFile
=
new
File
(
outputPath
);
await
outputFile
.
writeAsString
(
'#!mojo mojo:sky_viewer
\n
'
);
await
outputFile
.
writeAsBytes
(
new
ZipEncoder
().
encode
(
archive
),
mode:
FileMode
.
APPEND
,
flush:
true
);
outputFile
.
writeAsStringSync
(
'#!mojo mojo:sky_viewer
\n
'
);
outputFile
.
writeAsBytesSync
(
new
ZipEncoder
().
encode
(
archive
),
mode:
FileMode
.
APPEND
,
flush:
true
);
return
0
;
}
}
packages/flutter_tools/lib/src/commands/flutter_command_runner.dart
View file @
bb1da703
...
...
@@ -94,7 +94,7 @@ class FlutterCommandRunner extends CommandRunner {
ArgResults
_globalResults
;
Future
<
int
>
runCommand
(
ArgResults
globalResults
)
async
{
Future
<
int
>
runCommand
(
ArgResults
globalResults
)
{
if
(
globalResults
[
'verbose'
])
Logger
.
root
.
level
=
Level
.
INFO
;
...
...
packages/flutter_tools/lib/src/commands/list.dart
View file @
bb1da703
...
...
@@ -6,8 +6,8 @@ import 'dart:async';
import
'package:logging/logging.dart'
;
import
'flutter_command.dart'
;
import
'../device.dart'
;
import
'flutter_command.dart'
;
final
Logger
_logging
=
new
Logger
(
'sky_tools.list'
);
...
...
packages/flutter_tools/lib/src/commands/logs.dart
View file @
bb1da703
...
...
@@ -6,8 +6,8 @@ import 'dart:async';
import
'package:logging/logging.dart'
;
import
'flutter_command.dart'
;
import
'../device.dart'
;
import
'flutter_command.dart'
;
final
Logger
_logging
=
new
Logger
(
'sky_tools.logs'
);
...
...
packages/flutter_tools/lib/src/commands/run_mojo.dart
View file @
bb1da703
...
...
@@ -31,17 +31,17 @@ class RunMojoCommand extends Command {
}
// TODO(abarth): Why not use path.absolute?
Future
<
String
>
_makePathAbsolute
(
String
relativePath
)
async
{
String
_makePathAbsolute
(
String
relativePath
)
{
File
file
=
new
File
(
relativePath
);
if
(!
await
file
.
exists
())
{
if
(!
file
.
existsSync
())
{
throw
new
Exception
(
"Path
\"
${relativePath}
\"
does not exist"
);
}
return
file
.
absolute
.
path
;
}
Future
<
int
>
_runAndroid
(
String
mojoPath
,
_MojoConfig
mojoConfig
,
String
appPath
,
List
<
String
>
additionalArgs
)
async
{
Future
<
int
>
_runAndroid
(
String
mojoPath
,
_MojoConfig
mojoConfig
,
String
appPath
,
List
<
String
>
additionalArgs
)
{
String
skyViewerUrl
=
ArtifactStore
.
googleStorageUrl
(
'viewer'
,
'android-arm'
);
String
command
=
await
_makePathAbsolute
(
path
.
join
(
mojoPath
,
'mojo'
,
'devtools'
,
'common'
,
'mojo_run'
));
String
command
=
_makePathAbsolute
(
path
.
join
(
mojoPath
,
'mojo'
,
'devtools'
,
'common'
,
'mojo_run'
));
String
appName
=
path
.
basename
(
appPath
);
String
appDir
=
path
.
dirname
(
appPath
);
String
buildFlag
=
mojoConfig
==
_MojoConfig
.
Debug
?
'--debug'
:
'--release'
;
...
...
@@ -65,9 +65,9 @@ class RunMojoCommand extends Command {
}
Future
<
int
>
_runLinux
(
String
mojoPath
,
_MojoConfig
mojoConfig
,
String
appPath
,
List
<
String
>
additionalArgs
)
async
{
String
viewerPath
=
await
_makePathAbsolute
(
await
ArtifactStore
.
getPath
(
Artifact
.
skyViewerMojo
));
String
viewerPath
=
_makePathAbsolute
(
await
ArtifactStore
.
getPath
(
Artifact
.
skyViewerMojo
));
String
mojoBuildType
=
mojoConfig
==
_MojoConfig
.
Debug
?
'Debug'
:
'Release'
;
String
mojoShellPath
=
await
_makePathAbsolute
(
path
.
join
(
mojoPath
,
'out'
,
mojoBuildType
,
'mojo_shell'
));
String
mojoShellPath
=
_makePathAbsolute
(
path
.
join
(
mojoPath
,
'out'
,
mojoBuildType
,
'mojo_shell'
));
List
<
String
>
cmd
=
[
mojoShellPath
,
'file://
${appPath}
'
,
...
...
@@ -93,7 +93,7 @@ class RunMojoCommand extends Command {
}
String
mojoPath
=
argResults
[
'mojo-path'
];
_MojoConfig
mojoConfig
=
argResults
[
'mojo-debug'
]
?
_MojoConfig
.
Debug
:
_MojoConfig
.
Release
;
String
appPath
=
await
_makePathAbsolute
(
argResults
[
'app'
]);
String
appPath
=
_makePathAbsolute
(
argResults
[
'app'
]);
args
.
addAll
(
argResults
.
rest
);
if
(
argResults
[
'android'
])
{
...
...
packages/flutter_tools/lib/src/commands/start.dart
View file @
bb1da703
...
...
@@ -67,6 +67,14 @@ class StartCommand extends FlutterCommand {
}
}
if
(!
startedSomething
)
{
if
(!
devices
.
all
.
any
((
device
)
=>
device
.
isConnected
()))
{
_logging
.
severe
(
'Unable to run application - no connected devices.'
);
}
else
{
_logging
.
severe
(
'Unable to run application.'
);
}
}
return
startedSomething
?
0
:
2
;
}
}
packages/flutter_tools/lib/src/commands/trace.dart
View file @
bb1da703
...
...
@@ -6,9 +6,9 @@ import 'dart:async';
import
'package:logging/logging.dart'
;
import
'flutter_command.dart'
;
import
'../application_package.dart'
;
import
'../device.dart'
;
import
'flutter_command.dart'
;
final
Logger
_logging
=
new
Logger
(
'sky_tools.trace'
);
...
...
packages/flutter_tools/lib/src/device.dart
View file @
bb1da703
...
...
@@ -277,7 +277,7 @@ class IOSDevice extends Device {
return
2
;
}
return
runCommandAndStreamOutput
([
loggerPath
],
prefix:
'
IOS DEV
: '
,
filter:
new
RegExp
(
r'.*SkyShell.*'
));
prefix:
'
iOS dev
: '
,
filter:
new
RegExp
(
r'.*SkyShell.*'
));
}
}
...
...
@@ -499,7 +499,7 @@ class IOSSimulator extends Device {
runSync
([
'rm'
,
logFilePath
]);
}
return
runCommandAndStreamOutput
([
'tail'
,
'-f'
,
logFilePath
],
prefix:
'
IOS SIM
: '
,
filter:
new
RegExp
(
r'.*SkyShell.*'
));
prefix:
'
iOS sim
: '
,
filter:
new
RegExp
(
r'.*SkyShell.*'
));
}
}
...
...
@@ -575,7 +575,7 @@ class AndroidDevice extends Device {
_hasValidAndroid
=
_checkForLollipopOrLater
();
if
(!
_hasAdb
||
!
_hasValidAndroid
)
{
_logging
.
severe
(
'Unable to run on Android.'
);
_logging
.
warning
(
'Unable to run on Android.'
);
}
}
...
...
@@ -855,7 +855,7 @@ class AndroidDevice extends Device {
'-s'
,
'sky'
,
'chromium'
,
],
prefix:
'
ANDROID
: '
);
],
prefix:
'
android
: '
);
}
void
startTracing
(
AndroidApk
apk
)
{
...
...
packages/flutter_tools/test/stop_test.dart
View file @
bb1da703
...
...
@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
library
stop_test
;
import
'package:args/command_runner.dart'
;
import
'package:mockito/mockito.dart'
;
import
'package:sky_tools/src/commands/stop.dart'
;
...
...
packages/flutter_tools/test/trace_test.dart
View file @
bb1da703
...
...
@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
library
trace_test
;
import
'package:args/command_runner.dart'
;
import
'package:mockito/mockito.dart'
;
import
'package:sky_tools/src/commands/trace.dart'
;
...
...
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