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
2e878746
Commit
2e878746
authored
Mar 04, 2016
by
Steve Messick
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improve message when target not found
parent
3cb49849
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
40 additions
and
21 deletions
+40
-21
apk.dart
packages/flutter_tools/lib/src/commands/apk.dart
+1
-4
build.dart
packages/flutter_tools/lib/src/commands/build.dart
+1
-5
refresh.dart
packages/flutter_tools/lib/src/commands/refresh.dart
+1
-6
run.dart
packages/flutter_tools/lib/src/commands/run.dart
+1
-5
flutter_command.dart
packages/flutter_tools/lib/src/runner/flutter_command.dart
+12
-1
run_test.dart
packages/flutter_tools/test/run_test.dart
+24
-0
No files found.
packages/flutter_tools/lib/src/commands/apk.dart
View file @
2e878746
...
...
@@ -152,10 +152,6 @@ class ApkCommand extends FlutterCommand {
abbr:
'o'
,
defaultsTo:
_kDefaultOutputPath
,
help:
'Output APK file.'
);
argParser
.
addOption
(
'target'
,
abbr:
't'
,
defaultsTo:
flx
.
defaultMainPath
,
help:
'Target app path / main entry-point file.'
);
argParser
.
addOption
(
'flx'
,
abbr:
'f'
,
defaultsTo:
''
,
...
...
@@ -172,6 +168,7 @@ class ApkCommand extends FlutterCommand {
argParser
.
addOption
(
'keystore-key-password'
,
defaultsTo:
''
,
help:
'Password for the entry within the keystore.'
);
addTargetOption
();
}
@override
...
...
packages/flutter_tools/lib/src/commands/build.dart
View file @
2e878746
...
...
@@ -19,17 +19,13 @@ class BuildCommand extends FlutterCommand {
// remove it once we've updated those build scripts.
argParser
.
addOption
(
'asset-base'
,
help:
'Ignored. Will be removed.'
,
hide:
true
);
argParser
.
addOption
(
'compiler'
);
argParser
.
addOption
(
'target'
,
abbr:
't'
,
defaultsTo:
defaultMainPath
,
help:
'Target app path / main entry-point file.'
);
// TODO(devoncarew): Remove this once the xcode project is switched over.
argParser
.
addOption
(
'main'
,
hide:
true
);
argParser
.
addOption
(
'manifest'
,
defaultsTo:
defaultManifestPath
);
argParser
.
addOption
(
'private-key'
,
defaultsTo:
defaultPrivateKeyPath
);
argParser
.
addOption
(
'output-file'
,
abbr:
'o'
,
defaultsTo:
defaultFlxOutputPath
);
argParser
.
addOption
(
'snapshot'
,
defaultsTo:
defaultSnapshotPath
);
addTargetOption
();
}
Future
<
int
>
runInProject
()
async
{
...
...
packages/flutter_tools/lib/src/commands/refresh.dart
View file @
2e878746
...
...
@@ -7,7 +7,6 @@ import 'dart:io';
import
'package:path/path.dart'
as
path
;
import
'../flx.dart'
;
import
'../globals.dart'
;
import
'../runner/flutter_command.dart'
;
...
...
@@ -16,11 +15,7 @@ class RefreshCommand extends FlutterCommand {
final
String
description
=
'Build and deploy the Dart code in a Flutter app (Android only).'
;
RefreshCommand
()
{
argParser
.
addOption
(
'target'
,
abbr:
't'
,
defaultsTo:
defaultMainPath
,
help:
'Target app path / main entry-point file.'
);
addTargetOption
();
}
bool
get
androidOnly
=>
true
;
...
...
packages/flutter_tools/lib/src/commands/run.dart
View file @
2e878746
...
...
@@ -13,7 +13,6 @@ import '../base/utils.dart';
import
'../build_configuration.dart'
;
import
'../dart/pub.dart'
;
import
'../device.dart'
;
import
'../flx.dart'
;
import
'../globals.dart'
;
import
'../runner/flutter_command.dart'
;
import
'../toolchain.dart'
;
...
...
@@ -43,12 +42,9 @@ abstract class RunCommandBase extends FlutterCommand {
negatable:
true
,
defaultsTo:
false
,
help:
'Start tracing during startup.'
);
argParser
.
addOption
(
'target'
,
abbr:
't'
,
defaultsTo:
defaultMainPath
,
help:
'Target app path / main entry-point file.'
);
argParser
.
addOption
(
'route'
,
help:
'Which route to load when starting the app.'
);
addTargetOption
();
}
bool
get
checked
=>
argResults
[
'checked'
];
...
...
packages/flutter_tools/lib/src/runner/flutter_command.dart
View file @
2e878746
...
...
@@ -12,6 +12,7 @@ import '../build_configuration.dart';
import
'../device.dart'
;
import
'../globals.dart'
;
import
'../toolchain.dart'
;
import
'../flx.dart'
as
flx
;
import
'flutter_command_runner.dart'
;
typedef
bool
Validator
(
);
...
...
@@ -20,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
=>
true
;
bool
get
requiresProjectRoot
=>
!
_targetSpecified
;
/// Whether this command requires a (single) Flutter target device to be connected.
bool
get
requiresDevice
=>
false
;
...
...
@@ -142,4 +143,14 @@ abstract class FlutterCommand extends Command {
return
devices
;
}
bool
_targetSpecified
=
false
;
void
addTargetOption
()
{
argParser
.
addOption
(
'target'
,
abbr:
't'
,
callback:
(
val
)
=>
_targetSpecified
=
true
,
defaultsTo:
flx
.
defaultMainPath
,
help:
'Target app path / main entry-point file.'
);
}
}
packages/flutter_tools/test/run_test.dart
0 → 100644
View file @
2e878746
// Copyright 2016 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import
'package:flutter_tools/src/commands/run.dart'
;
import
'package:test/test.dart'
;
import
'src/common.dart'
;
import
'src/context.dart'
;
import
'src/mocks.dart'
;
main
()
=>
defineTests
();
defineTests
()
{
group
(
'run'
,
()
{
testUsingContext
(
'fail when target not found'
,
()
{
RunCommand
command
=
new
RunCommand
();
applyMocksToCommand
(
command
);
return
createTestCommandRunner
(
command
).
run
(<
String
>[
'run'
,
'-t'
,
'abc123'
]).
then
((
int
code
)
{
expect
(
code
,
equals
(
1
));
});
});
});
}
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