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
e70036f1
Commit
e70036f1
authored
Mar 07, 2016
by
Devon Carew
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2433 from stevemessick/targetmessage
Improve message when target not found
parents
8a2865ce
913315bc
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
46 additions
and
21 deletions
+46
-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
+18
-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 @
e70036f1
...
...
@@ -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 @
e70036f1
...
...
@@ -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 @
e70036f1
...
...
@@ -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 @
e70036f1
...
...
@@ -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 @
e70036f1
...
...
@@ -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
(
);
...
...
@@ -28,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
{
...
...
@@ -58,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.
...
...
@@ -142,4 +148,15 @@ 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.'
);
_targetOptionSpecified
=
true
;
}
}
packages/flutter_tools/test/run_test.dart
0 → 100644
View file @
e70036f1
// 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
(
'fails 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