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
494d1e01
Commit
494d1e01
authored
Oct 29, 2015
by
Devon Carew
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
verify that we're running from the root of a project
remove an unused import review comments rename st --> stack
parent
678af9c0
Changes
14
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
55 additions
and
17 deletions
+55
-17
executable.dart
packages/flutter_tools/lib/executable.dart
+12
-1
build.dart
packages/flutter_tools/lib/src/commands/build.dart
+1
-1
flutter_command.dart
packages/flutter_tools/lib/src/commands/flutter_command.dart
+18
-0
flutter_command_runner.dart
...lutter_tools/lib/src/commands/flutter_command_runner.dart
+8
-5
init.dart
packages/flutter_tools/lib/src/commands/init.dart
+1
-2
install.dart
packages/flutter_tools/lib/src/commands/install.dart
+1
-1
list.dart
packages/flutter_tools/lib/src/commands/list.dart
+1
-1
listen.dart
packages/flutter_tools/lib/src/commands/listen.dart
+1
-1
logs.dart
packages/flutter_tools/lib/src/commands/logs.dart
+1
-1
start.dart
packages/flutter_tools/lib/src/commands/start.dart
+1
-1
stop.dart
packages/flutter_tools/lib/src/commands/stop.dart
+1
-1
trace.dart
packages/flutter_tools/lib/src/commands/trace.dart
+1
-1
process.dart
packages/flutter_tools/lib/src/process.dart
+7
-0
pubspec.yaml
packages/flutter_tools/pubspec.yaml
+1
-1
No files found.
packages/flutter_tools/lib/executable.dart
View file @
494d1e01
...
...
@@ -20,6 +20,7 @@ import 'src/commands/run_mojo.dart';
import
'src/commands/start.dart'
;
import
'src/commands/stop.dart'
;
import
'src/commands/trace.dart'
;
import
'src/process.dart'
;
/// Main entry point for commands.
///
...
...
@@ -58,6 +59,16 @@ Future main(List<String> args) async {
exit
(
result
);
}
on
UsageException
catch
(
e
)
{
stderr
.
writeln
(
e
);
exit
(
4
);
// Args error exit code.
exit
(
64
);
}
catch
(
e
,
stack
)
{
if
(
e
is
ProcessExit
)
{
// We've caught an exit code.
exit
(
e
.
exitCode
);
}
stderr
.
writeln
(
e
);
Logger
.
root
.
log
(
Level
.
SEVERE
,
'
\n
Exception:'
,
null
,
stack
);
exit
(
1
);
}
}
packages/flutter_tools/lib/src/commands/build.dart
View file @
494d1e01
...
...
@@ -127,7 +127,7 @@ class BuildCommand extends FlutterCommand {
}
@override
Future
<
int
>
run
()
async
{
Future
<
int
>
run
InProject
()
async
{
String
compilerPath
=
argResults
[
'compiler'
];
if
(
compilerPath
==
null
)
...
...
packages/flutter_tools/lib/src/commands/flutter_command.dart
View file @
494d1e01
...
...
@@ -3,6 +3,7 @@
// found in the LICENSE file.
import
'dart:async'
;
import
'dart:io'
;
import
'package:args/command_runner.dart'
;
...
...
@@ -14,6 +15,9 @@ import 'flutter_command_runner.dart';
abstract
class
FlutterCommand
extends
Command
{
FlutterCommandRunner
get
runner
=>
super
.
runner
;
/// Whether this command needs to be run from the root of a project.
bool
get
requiresProjectRoot
=>
true
;
Future
downloadApplicationPackages
()
async
{
if
(
applicationPackages
==
null
)
applicationPackages
=
await
ApplicationPackageStore
.
forConfigs
(
runner
.
buildConfigurations
);
...
...
@@ -40,6 +44,20 @@ abstract class FlutterCommand extends Command {
devices
=
other
.
devices
;
}
Future
<
int
>
run
()
async
{
if
(
requiresProjectRoot
)
{
if
(!
FileSystemEntity
.
isFileSync
(
'pubspec.yaml'
))
{
stderr
.
writeln
(
'No pubspec.yaml file found. '
'This command should be run from the root of a project.'
);
return
1
;
}
}
return
runInProject
();
}
Future
<
int
>
runInProject
();
ApplicationPackageStore
applicationPackages
;
Toolchain
toolchain
;
DeviceStore
devices
;
...
...
packages/flutter_tools/lib/src/commands/flutter_command_runner.dart
View file @
494d1e01
...
...
@@ -12,6 +12,7 @@ import 'package:path/path.dart' as path;
import
'../artifacts.dart'
;
import
'../build_configuration.dart'
;
import
'../process.dart'
;
final
Logger
_logging
=
new
Logger
(
'sky_tools.flutter_command_runner'
);
...
...
@@ -116,8 +117,8 @@ class FlutterCommandRunner extends CommandRunner {
else
message
+=
'
\n
Did you run this command from the same directory as your pubspec.yaml file?'
;
}
_logging
.
severe
(
message
);
e
xit
(
2
);
stderr
.
writeln
(
message
);
throw
new
ProcessE
xit
(
2
);
}
String
enginePath
=
globalResults
[
'engine-src-path'
];
...
...
@@ -129,9 +130,11 @@ class FlutterCommandRunner extends CommandRunner {
String
realFlutterPath
=
flutterDir
.
resolveSymbolicLinksSync
();
enginePath
=
path
.
dirname
(
path
.
dirname
(
path
.
dirname
(
path
.
dirname
(
realFlutterPath
))));
if
(
enginePath
==
'/'
||
enginePath
.
isEmpty
||
!
FileSystemEntity
.
isDirectorySync
(
path
.
join
(
enginePath
,
'out'
)))
{
_logging
.
severe
(
'Unable to detect local build in
$enginePath
.
\n
Do you have a dependency override for the flutter package?'
);
exit
(
2
);
bool
dirExists
=
FileSystemEntity
.
isDirectorySync
(
path
.
join
(
enginePath
,
'out'
));
if
(
enginePath
==
'/'
||
enginePath
.
isEmpty
||
!
dirExists
)
{
stderr
.
writeln
(
'Unable to detect local build in
$enginePath
.
\n
'
'Do you have a dependency override for the flutter package?'
);
throw
new
ProcessExit
(
2
);
}
}
...
...
packages/flutter_tools/lib/src/commands/init.dart
View file @
494d1e01
...
...
@@ -160,8 +160,7 @@ class FlutterDemo extends StatelessComponent {
),
floatingActionButton: new FloatingActionButton(
child: new Icon(
type: '
content
/
add
',
size: 24
type: '
content
/
add
'
)
)
);
...
...
packages/flutter_tools/lib/src/commands/install.dart
View file @
494d1e01
...
...
@@ -18,7 +18,7 @@ class InstallCommand extends FlutterCommand {
}
@override
Future
<
int
>
run
()
async
{
Future
<
int
>
run
InProject
()
async
{
await
downloadApplicationPackagesAndConnectToDevices
();
return
install
(
boot:
argResults
[
'boot'
])
?
0
:
2
;
}
...
...
packages/flutter_tools/lib/src/commands/list.dart
View file @
494d1e01
...
...
@@ -23,7 +23,7 @@ class ListCommand extends FlutterCommand {
}
@override
Future
<
int
>
run
()
async
{
Future
<
int
>
run
InProject
()
async
{
connectToDevices
();
bool
details
=
argResults
[
'details'
];
...
...
packages/flutter_tools/lib/src/commands/listen.dart
View file @
494d1e01
...
...
@@ -38,7 +38,7 @@ class ListenCommand extends FlutterCommand {
static
const
String
_remoteFlutterBundle
=
'Documents/app.flx'
;
@override
Future
<
int
>
run
()
async
{
Future
<
int
>
run
InProject
()
async
{
await
downloadApplicationPackagesAndConnectToDevices
();
await
downloadToolchain
();
...
...
packages/flutter_tools/lib/src/commands/logs.dart
View file @
494d1e01
...
...
@@ -22,7 +22,7 @@ class LogsCommand extends FlutterCommand {
}
@override
Future
<
int
>
run
()
async
{
Future
<
int
>
run
InProject
()
async
{
connectToDevices
();
bool
clear
=
argResults
[
'clear'
];
...
...
packages/flutter_tools/lib/src/commands/start.dart
View file @
494d1e01
...
...
@@ -36,7 +36,7 @@ class StartCommand extends FlutterCommand {
}
@override
Future
<
int
>
run
()
async
{
Future
<
int
>
run
InProject
()
async
{
await
downloadApplicationPackagesAndConnectToDevices
();
bool
poke
=
argResults
[
'poke'
];
...
...
packages/flutter_tools/lib/src/commands/stop.dart
View file @
494d1e01
...
...
@@ -17,7 +17,7 @@ class StopCommand extends FlutterCommand {
final
String
description
=
'Stop your Flutter app on all attached devices.'
;
@override
Future
<
int
>
run
()
async
{
Future
<
int
>
run
InProject
()
async
{
await
downloadApplicationPackagesAndConnectToDevices
();
return
await
stop
()
?
0
:
2
;
}
...
...
packages/flutter_tools/lib/src/commands/trace.dart
View file @
494d1e01
...
...
@@ -28,7 +28,7 @@ class TraceCommand extends FlutterCommand {
}
@override
Future
<
int
>
run
()
async
{
Future
<
int
>
run
InProject
()
async
{
await
downloadApplicationPackagesAndConnectToDevices
();
if
(!
devices
.
android
.
isConnected
())
{
...
...
packages/flutter_tools/lib/src/process.dart
View file @
494d1e01
...
...
@@ -89,3 +89,10 @@ String _runWithLoggingSync(List<String> cmd, {bool checked: false}) {
_logging
.
fine
(
results
.
stdout
.
trim
());
return
results
.
stdout
;
}
class
ProcessExit
implements
Exception
{
final
int
exitCode
;
ProcessExit
(
this
.
exitCode
);
String
get
message
=>
'ProcessExit:
${exitCode}
'
;
String
toString
()
=>
message
;
}
packages/flutter_tools/pubspec.yaml
View file @
494d1e01
...
...
@@ -19,7 +19,7 @@ dependencies:
shelf_route
:
^0.13.4
shelf_static
:
^0.2.3
shelf
:
^0.6.2
test
:
^0.12.5
test
:
0.12.4+9
yaml
:
^2.1.3
dev_dependencies
:
...
...
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