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
13fbafda
Commit
13fbafda
authored
Nov 25, 2015
by
Devon Carew
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #591 from devoncarew/log_time
print logging timestamps to profile app launch
parents
27f3a3a7
e36b07f7
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
38 additions
and
11 deletions
+38
-11
executable.dart
packages/flutter_tools/lib/executable.dart
+9
-2
build.dart
packages/flutter_tools/lib/src/commands/build.dart
+5
-0
daemon.dart
packages/flutter_tools/lib/src/commands/daemon.dart
+0
-2
start.dart
packages/flutter_tools/lib/src/commands/start.dart
+15
-0
device.dart
packages/flutter_tools/lib/src/device.dart
+4
-0
process.dart
packages/flutter_tools/lib/src/process.dart
+5
-7
No files found.
packages/flutter_tools/lib/executable.dart
View file @
13fbafda
...
@@ -32,14 +32,21 @@ import 'src/process.dart';
...
@@ -32,14 +32,21 @@ import 'src/process.dart';
///
///
/// This function is intended to be used from the [flutter] command line tool.
/// This function is intended to be used from the [flutter] command line tool.
Future
main
(
List
<
String
>
args
)
async
{
Future
main
(
List
<
String
>
args
)
async
{
DateTime
startTime
=
new
DateTime
.
now
();
// This level can be adjusted by users through the `--verbose` option.
// This level can be adjusted by users through the `--verbose` option.
Logger
.
root
.
level
=
Level
.
WARNING
;
Logger
.
root
.
level
=
Level
.
WARNING
;
Logger
.
root
.
onRecord
.
listen
((
LogRecord
record
)
{
Logger
.
root
.
onRecord
.
listen
((
LogRecord
record
)
{
String
prefix
=
''
;
if
(
Logger
.
root
.
level
<=
Level
.
FINE
)
{
Duration
elapsed
=
record
.
time
.
difference
(
startTime
);
prefix
=
'[
${elapsed.inMilliseconds.toString().padLeft(4)}
ms] '
;
}
String
level
=
record
.
level
.
name
.
toLowerCase
();
String
level
=
record
.
level
.
name
.
toLowerCase
();
if
(
record
.
level
>=
Level
.
WARNING
)
{
if
(
record
.
level
>=
Level
.
WARNING
)
{
stderr
.
writeln
(
'
$level
:
${record.message}
'
);
stderr
.
writeln
(
'
$
prefix$
level
:
${record.message}
'
);
}
else
{
}
else
{
print
(
'
$level
:
${record.message}
'
);
print
(
'
$
prefix$
level
:
${record.message}
'
);
}
}
if
(
record
.
error
!=
null
)
if
(
record
.
error
!=
null
)
stderr
.
writeln
(
record
.
error
);
stderr
.
writeln
(
record
.
error
);
...
...
packages/flutter_tools/lib/src/commands/build.dart
View file @
13fbafda
...
@@ -9,6 +9,7 @@ import 'dart:typed_data';
...
@@ -9,6 +9,7 @@ import 'dart:typed_data';
import
'package:archive/archive.dart'
;
import
'package:archive/archive.dart'
;
import
'package:flx/bundle.dart'
;
import
'package:flx/bundle.dart'
;
import
'package:flx/signing.dart'
;
import
'package:flx/signing.dart'
;
import
'package:logging/logging.dart'
;
import
'package:path/path.dart'
as
path
;
import
'package:path/path.dart'
as
path
;
import
'package:yaml/yaml.dart'
;
import
'package:yaml/yaml.dart'
;
...
@@ -21,6 +22,8 @@ const List<String> _kDensities = const ['drawable-xxhdpi'];
...
@@ -21,6 +22,8 @@ const List<String> _kDensities = const ['drawable-xxhdpi'];
const
List
<
String
>
_kThemes
=
const
[
'white'
,
'black'
];
const
List
<
String
>
_kThemes
=
const
[
'white'
,
'black'
];
const
List
<
int
>
_kSizes
=
const
[
18
,
24
,
36
,
48
];
const
List
<
int
>
_kSizes
=
const
[
18
,
24
,
36
,
48
];
final
Logger
_logging
=
new
Logger
(
'flutter_tools.build'
);
class
_Asset
{
class
_Asset
{
final
String
base
;
final
String
base
;
final
String
key
;
final
String
key
;
...
@@ -179,6 +182,8 @@ class BuildCommand extends FlutterCommand {
...
@@ -179,6 +182,8 @@ class BuildCommand extends FlutterCommand {
String
privateKeyPath:
_kDefaultPrivateKeyPath
,
String
privateKeyPath:
_kDefaultPrivateKeyPath
,
bool
precompiledSnapshot:
false
bool
precompiledSnapshot:
false
})
async
{
})
async
{
_logging
.
fine
(
'Building
$outputPath
'
);
Map
manifestDescriptor
=
_loadManifest
(
manifestPath
);
Map
manifestDescriptor
=
_loadManifest
(
manifestPath
);
Iterable
<
_Asset
>
assets
=
_parseAssets
(
manifestDescriptor
,
manifestPath
);
Iterable
<
_Asset
>
assets
=
_parseAssets
(
manifestDescriptor
,
manifestPath
);
...
...
packages/flutter_tools/lib/src/commands/daemon.dart
View file @
13fbafda
...
@@ -25,8 +25,6 @@ final Logger _logging = new Logger('flutter_tools.daemon');
...
@@ -25,8 +25,6 @@ final Logger _logging = new Logger('flutter_tools.daemon');
// TODO: Create a `device` domain in order to list devices and fire events when
// TODO: Create a `device` domain in order to list devices and fire events when
// devices are added or removed.
// devices are added or removed.
// TODO: Is this the best name? Server? Daemon?
/// A server process command. This command will start up a long-lived server.
/// A server process command. This command will start up a long-lived server.
/// It reads JSON-RPC based commands from stdin, executes them, and returns
/// It reads JSON-RPC based commands from stdin, executes them, and returns
/// JSON-RPC based responses and events to stdout.
/// JSON-RPC based responses and events to stdout.
...
...
packages/flutter_tools/lib/src/commands/start.dart
View file @
13fbafda
...
@@ -51,6 +51,8 @@ class StartCommand extends FlutterCommand {
...
@@ -51,6 +51,8 @@ class StartCommand extends FlutterCommand {
@override
@override
Future
<
int
>
runInProject
()
async
{
Future
<
int
>
runInProject
()
async
{
_logging
.
fine
(
'downloading toolchain'
);
await
Future
.
wait
([
await
Future
.
wait
([
downloadToolchain
(),
downloadToolchain
(),
downloadApplicationPackagesAndConnectToDevices
(),
downloadApplicationPackagesAndConnectToDevices
(),
...
@@ -58,10 +60,14 @@ class StartCommand extends FlutterCommand {
...
@@ -58,10 +60,14 @@ class StartCommand extends FlutterCommand {
bool
poke
=
argResults
[
'poke'
];
bool
poke
=
argResults
[
'poke'
];
if
(!
poke
)
{
if
(!
poke
)
{
_logging
.
fine
(
'running stop command'
);
StopCommand
stopper
=
new
StopCommand
();
StopCommand
stopper
=
new
StopCommand
();
stopper
.
inheritFromParent
(
this
);
stopper
.
inheritFromParent
(
this
);
stopper
.
stop
();
stopper
.
stop
();
_logging
.
fine
(
'running install command'
);
// Only install if the user did not specify a poke
// Only install if the user did not specify a poke
InstallCommand
installer
=
new
InstallCommand
();
InstallCommand
installer
=
new
InstallCommand
();
installer
.
inheritFromParent
(
this
);
installer
.
inheritFromParent
(
this
);
...
@@ -74,6 +80,7 @@ class StartCommand extends FlutterCommand {
...
@@ -74,6 +80,7 @@ class StartCommand extends FlutterCommand {
ApplicationPackage
package
=
applicationPackages
.
getPackageForPlatform
(
device
.
platform
);
ApplicationPackage
package
=
applicationPackages
.
getPackageForPlatform
(
device
.
platform
);
if
(
package
==
null
||
!
device
.
isConnected
())
if
(
package
==
null
||
!
device
.
isConnected
())
continue
;
continue
;
if
(
device
is
AndroidDevice
)
{
if
(
device
is
AndroidDevice
)
{
String
mainPath
=
findMainDartFile
(
argResults
[
'target'
]);
String
mainPath
=
findMainDartFile
(
argResults
[
'target'
]);
if
(!
FileSystemEntity
.
isFileSync
(
mainPath
))
{
if
(!
FileSystemEntity
.
isFileSync
(
mainPath
))
{
...
@@ -84,11 +91,15 @@ class StartCommand extends FlutterCommand {
...
@@ -84,11 +91,15 @@ class StartCommand extends FlutterCommand {
continue
;
continue
;
}
}
_logging
.
fine
(
'running build command for
$device
'
);
BuildCommand
builder
=
new
BuildCommand
();
BuildCommand
builder
=
new
BuildCommand
();
builder
.
inheritFromParent
(
this
);
builder
.
inheritFromParent
(
this
);
await
builder
.
buildInTempDir
(
await
builder
.
buildInTempDir
(
mainPath:
mainPath
,
mainPath:
mainPath
,
onBundleAvailable:
(
String
localBundlePath
)
{
onBundleAvailable:
(
String
localBundlePath
)
{
_logging
.
fine
(
'running start bundle for
$device
'
);
if
(
device
.
startBundle
(
package
,
localBundlePath
,
if
(
device
.
startBundle
(
package
,
localBundlePath
,
poke:
poke
,
poke:
poke
,
checked:
argResults
[
'checked'
],
checked:
argResults
[
'checked'
],
...
@@ -97,6 +108,8 @@ class StartCommand extends FlutterCommand {
...
@@ -97,6 +108,8 @@ class StartCommand extends FlutterCommand {
}
}
);
);
}
else
{
}
else
{
_logging
.
fine
(
'running start command for
$device
'
);
if
(
await
device
.
startApp
(
package
))
if
(
await
device
.
startApp
(
package
))
startedSomething
=
true
;
startedSomething
=
true
;
}
}
...
@@ -110,6 +123,8 @@ class StartCommand extends FlutterCommand {
...
@@ -110,6 +123,8 @@ class StartCommand extends FlutterCommand {
}
}
}
}
_logging
.
fine
(
'finished start command'
);
return
startedSomething
?
0
:
2
;
return
startedSomething
?
0
:
2
;
}
}
}
}
packages/flutter_tools/lib/src/device.dart
View file @
13fbafda
...
@@ -43,6 +43,8 @@ abstract class Device {
...
@@ -43,6 +43,8 @@ abstract class Device {
/// Stop an app package on the current device
/// Stop an app package on the current device
Future
<
bool
>
stopApp
(
ApplicationPackage
app
);
Future
<
bool
>
stopApp
(
ApplicationPackage
app
);
String
toString
()
=>
'
$runtimeType
$id
'
;
}
}
class
IOSDevice
extends
Device
{
class
IOSDevice
extends
Device
{
...
@@ -773,6 +775,8 @@ class AndroidDevice extends Device {
...
@@ -773,6 +775,8 @@ class AndroidDevice extends Device {
bool
checked
,
bool
checked
,
String
route
String
route
})
{
})
{
_logging
.
fine
(
'
$this
startBundle'
);
if
(!
FileSystemEntity
.
isFileSync
(
bundlePath
))
{
if
(!
FileSystemEntity
.
isFileSync
(
bundlePath
))
{
_logging
.
severe
(
'Cannot find
$bundlePath
'
);
_logging
.
severe
(
'Cannot find
$bundlePath
'
);
return
false
;
return
false
;
...
...
packages/flutter_tools/lib/src/process.dart
View file @
13fbafda
...
@@ -87,15 +87,13 @@ String _runWithLoggingSync(List<String> cmd, {
...
@@ -87,15 +87,13 @@ String _runWithLoggingSync(List<String> cmd, {
if
(
results
.
exitCode
!=
0
)
{
if
(
results
.
exitCode
!=
0
)
{
String
errorDescription
=
'Error code
${results.exitCode}
'
String
errorDescription
=
'Error code
${results.exitCode}
'
'returned when attempting to run command:
${cmd.join(' ')}
'
;
'returned when attempting to run command:
${cmd.join(' ')}
'
;
_logging
.
fine
(
errorDescription
);
_logging
.
info
(
errorDescription
);
if
(
results
.
stderr
.
length
>
0
)
{
if
(
results
.
stderr
.
length
>
0
)
_logging
.
info
(
'Errors logged:
${results.stderr.trim()}
'
);
_logging
.
info
(
'Errors logged:
${results.stderr.trim()}
'
);
}
if
(
checked
)
if
(
checked
)
{
throw
errorDescription
;
throw
errorDescription
;
}
}
}
if
(
results
.
stdout
.
trim
().
isNotEmpty
)
_logging
.
fine
(
results
.
stdout
.
trim
());
_logging
.
fine
(
results
.
stdout
.
trim
());
return
results
.
stdout
;
return
results
.
stdout
;
}
}
...
...
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