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
913315bc
Commit
913315bc
authored
Mar 07, 2016
by
Steve Messick
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improve the error message when a target is specified but not found.
https://github.com/flutter/flutter/issues/2368
parent
8cc53120
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
3 deletions
+9
-3
flutter_command.dart
packages/flutter_tools/lib/src/runner/flutter_command.dart
+8
-2
run_test.dart
packages/flutter_tools/test/run_test.dart
+1
-1
No files found.
packages/flutter_tools/lib/src/runner/flutter_command.dart
View file @
913315bc
...
...
@@ -21,7 +21,7 @@ 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
=>
!
_targetSpecified
;
bool
get
requiresProjectRoot
=>
true
;
/// Whether this command requires a (single) Flutter target device to be connected.
bool
get
requiresDevice
=>
false
;
...
...
@@ -29,6 +29,10 @@ abstract class FlutterCommand extends Command {
/// Whether this command only applies to Android devices.
bool
get
androidOnly
=>
false
;
/// Whether this command allows usage of the 'target' option.
bool
get
allowsTarget
=>
_targetOptionSpecified
;
bool
_targetOptionSpecified
=
false
;
List
<
BuildConfiguration
>
get
buildConfigurations
=>
runner
.
buildConfigurations
;
Future
downloadToolchain
()
async
{
...
...
@@ -59,7 +63,8 @@ abstract class FlutterCommand extends Command {
}
Future
<
int
>
_run
()
async
{
if
(
requiresProjectRoot
&&
!
projectRootValidator
())
bool
_checkRoot
=
requiresProjectRoot
&&
allowsTarget
&&
!
_targetSpecified
;
if
(
_checkRoot
&&
!
projectRootValidator
())
return
1
;
// Ensure at least one toolchain is installed.
...
...
@@ -152,5 +157,6 @@ abstract class FlutterCommand extends Command {
callback:
(
val
)
=>
_targetSpecified
=
true
,
defaultsTo:
flx
.
defaultMainPath
,
help:
'Target app path / main entry-point file.'
);
_targetOptionSpecified
=
true
;
}
}
packages/flutter_tools/test/run_test.dart
View file @
913315bc
...
...
@@ -13,7 +13,7 @@ main() => defineTests();
defineTests
()
{
group
(
'run'
,
()
{
testUsingContext
(
'fail when target not found'
,
()
{
testUsingContext
(
'fail
s
when target not found'
,
()
{
RunCommand
command
=
new
RunCommand
();
applyMocksToCommand
(
command
);
return
createTestCommandRunner
(
command
).
run
(<
String
>[
'run'
,
'-t'
,
'abc123'
]).
then
((
int
code
)
{
...
...
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