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
587687ee
Unverified
Commit
587687ee
authored
Jun 08, 2019
by
Jonah Williams
Committed by
GitHub
Jun 08, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Revert "Added --dart-flags option to flutter run (#33924)" (#34092)
parent
67a529b8
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
3 additions
and
193 deletions
+3
-193
android_device.dart
packages/flutter_tools/lib/src/android/android_device.dart
+0
-2
run.dart
packages/flutter_tools/lib/src/commands/run.dart
+0
-18
device.dart
packages/flutter_tools/lib/src/device.dart
+0
-3
devices.dart
packages/flutter_tools/lib/src/ios/devices.dart
+0
-5
run_test.dart
packages/flutter_tools/test/commands/run_test.dart
+2
-148
context.dart
packages/flutter_tools/test/src/context.dart
+1
-5
mocks.dart
packages/flutter_tools/test/src/mocks.dart
+0
-12
No files found.
packages/flutter_tools/lib/src/android/android_device.dart
View file @
587687ee
...
@@ -474,8 +474,6 @@ class AndroidDevice extends Device {
...
@@ -474,8 +474,6 @@ class AndroidDevice extends Device {
cmd
.
addAll
(<
String
>[
'--ez'
,
'start-paused'
,
'true'
]);
cmd
.
addAll
(<
String
>[
'--ez'
,
'start-paused'
,
'true'
]);
if
(
debuggingOptions
.
disableServiceAuthCodes
)
if
(
debuggingOptions
.
disableServiceAuthCodes
)
cmd
.
addAll
(<
String
>[
'--ez'
,
'disable-service-auth-codes'
,
'true'
]);
cmd
.
addAll
(<
String
>[
'--ez'
,
'disable-service-auth-codes'
,
'true'
]);
if
(
debuggingOptions
.
dartFlags
.
isNotEmpty
)
cmd
.
addAll
(<
String
>[
'--es'
,
'dart-flags'
,
debuggingOptions
.
dartFlags
]);
if
(
debuggingOptions
.
useTestFonts
)
if
(
debuggingOptions
.
useTestFonts
)
cmd
.
addAll
(<
String
>[
'--ez'
,
'use-test-fonts'
,
'true'
]);
cmd
.
addAll
(<
String
>[
'--ez'
,
'use-test-fonts'
,
'true'
]);
if
(
debuggingOptions
.
verboseSystemLogs
)
{
if
(
debuggingOptions
.
verboseSystemLogs
)
{
...
...
packages/flutter_tools/lib/src/commands/run.dart
View file @
587687ee
...
@@ -4,8 +4,6 @@
...
@@ -4,8 +4,6 @@
import
'dart:async'
;
import
'dart:async'
;
import
'package:args/command_runner.dart'
;
import
'../base/common.dart'
;
import
'../base/common.dart'
;
import
'../base/file_system.dart'
;
import
'../base/file_system.dart'
;
import
'../base/time.dart'
;
import
'../base/time.dart'
;
...
@@ -132,16 +130,6 @@ class RunCommand extends RunCommandBase {
...
@@ -132,16 +130,6 @@ class RunCommand extends RunCommandBase {
defaultsTo:
true
,
defaultsTo:
true
,
help:
'If necessary, build the app before running.'
,
help:
'If necessary, build the app before running.'
,
)
)
..
addOption
(
'dart-flags'
,
hide:
!
verboseHelp
,
help:
'Pass a list of comma separated flags to the Dart instance at '
'application startup. Flags passed through this option must be '
'present on the whitelist defined within the Flutter engine. If '
'a non-whitelisted flag is encountered, the process will be '
'terminated immediately.
\n\n
'
'This flag is not available on the stable channel and is only '
'applied in debug and profile modes. This option should only '
'be used for experiments and should not be used by typical users.'
)
..
addOption
(
'use-application-binary'
,
..
addOption
(
'use-application-binary'
,
hide:
!
verboseHelp
,
hide:
!
verboseHelp
,
help:
'Specify a pre-built application binary to use when running.'
,
help:
'Specify a pre-built application binary to use when running.'
,
...
@@ -306,7 +294,6 @@ class RunCommand extends RunCommandBase {
...
@@ -306,7 +294,6 @@ class RunCommand extends RunCommandBase {
buildInfo
,
buildInfo
,
startPaused:
argResults
[
'start-paused'
],
startPaused:
argResults
[
'start-paused'
],
disableServiceAuthCodes:
argResults
[
'disable-service-auth-codes'
],
disableServiceAuthCodes:
argResults
[
'disable-service-auth-codes'
],
dartFlags:
argResults
[
'dart-flags'
],
useTestFonts:
argResults
[
'use-test-fonts'
],
useTestFonts:
argResults
[
'use-test-fonts'
],
enableSoftwareRendering:
argResults
[
'enable-software-rendering'
],
enableSoftwareRendering:
argResults
[
'enable-software-rendering'
],
skiaDeterministicRendering:
argResults
[
'skia-deterministic-rendering'
],
skiaDeterministicRendering:
argResults
[
'skia-deterministic-rendering'
],
...
@@ -363,11 +350,6 @@ class RunCommand extends RunCommandBase {
...
@@ -363,11 +350,6 @@ class RunCommand extends RunCommandBase {
);
);
}
}
if
(
argResults
[
'dart-flags'
]
!=
null
&&
FlutterVersion
.
instance
.
isStable
)
{
throw
UsageException
(
'--dart-flags is not available on the stable '
'channel.'
,
null
);
}
for
(
Device
device
in
devices
)
{
for
(
Device
device
in
devices
)
{
if
(
await
device
.
isLocalEmulator
)
{
if
(
await
device
.
isLocalEmulator
)
{
if
(
await
device
.
supportsHardwareRendering
)
{
if
(
await
device
.
supportsHardwareRendering
)
{
...
...
packages/flutter_tools/lib/src/device.dart
View file @
587687ee
...
@@ -377,7 +377,6 @@ class DebuggingOptions {
...
@@ -377,7 +377,6 @@ class DebuggingOptions {
this
.
buildInfo
,
{
this
.
buildInfo
,
{
this
.
startPaused
=
false
,
this
.
startPaused
=
false
,
this
.
disableServiceAuthCodes
=
false
,
this
.
disableServiceAuthCodes
=
false
,
this
.
dartFlags
=
''
,
this
.
enableSoftwareRendering
=
false
,
this
.
enableSoftwareRendering
=
false
,
this
.
skiaDeterministicRendering
=
false
,
this
.
skiaDeterministicRendering
=
false
,
this
.
traceSkia
=
false
,
this
.
traceSkia
=
false
,
...
@@ -392,7 +391,6 @@ class DebuggingOptions {
...
@@ -392,7 +391,6 @@ class DebuggingOptions {
:
debuggingEnabled
=
false
,
:
debuggingEnabled
=
false
,
useTestFonts
=
false
,
useTestFonts
=
false
,
startPaused
=
false
,
startPaused
=
false
,
dartFlags
=
''
,
disableServiceAuthCodes
=
false
,
disableServiceAuthCodes
=
false
,
enableSoftwareRendering
=
false
,
enableSoftwareRendering
=
false
,
skiaDeterministicRendering
=
false
,
skiaDeterministicRendering
=
false
,
...
@@ -406,7 +404,6 @@ class DebuggingOptions {
...
@@ -406,7 +404,6 @@ class DebuggingOptions {
final
BuildInfo
buildInfo
;
final
BuildInfo
buildInfo
;
final
bool
startPaused
;
final
bool
startPaused
;
final
String
dartFlags
;
final
bool
disableServiceAuthCodes
;
final
bool
disableServiceAuthCodes
;
final
bool
enableSoftwareRendering
;
final
bool
enableSoftwareRendering
;
final
bool
skiaDeterministicRendering
;
final
bool
skiaDeterministicRendering
;
...
...
packages/flutter_tools/lib/src/ios/devices.dart
View file @
587687ee
...
@@ -283,11 +283,6 @@ class IOSDevice extends Device {
...
@@ -283,11 +283,6 @@ class IOSDevice extends Device {
if
(
debuggingOptions
.
disableServiceAuthCodes
)
if
(
debuggingOptions
.
disableServiceAuthCodes
)
launchArguments
.
add
(
'--disable-service-auth-codes'
);
launchArguments
.
add
(
'--disable-service-auth-codes'
);
if
(
debuggingOptions
.
dartFlags
.
isNotEmpty
)
{
final
String
dartFlags
=
debuggingOptions
.
dartFlags
;
launchArguments
.
add
(
'--dart-flags="
$dartFlags
"'
);
}
if
(
debuggingOptions
.
useTestFonts
)
if
(
debuggingOptions
.
useTestFonts
)
launchArguments
.
add
(
'--use-test-fonts'
);
launchArguments
.
add
(
'--use-test-fonts'
);
...
...
packages/flutter_tools/test/commands/run_test.dart
View file @
587687ee
...
@@ -2,15 +2,11 @@
...
@@ -2,15 +2,11 @@
// Use of this source code is governed by a BSD-style license that can be
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// found in the LICENSE file.
import
'package:args/command_runner.dart'
;
import
'package:flutter_tools/src/application_package.dart'
;
import
'package:flutter_tools/src/base/common.dart'
;
import
'package:flutter_tools/src/base/common.dart'
;
import
'package:flutter_tools/src/build_info.dart'
;
import
'package:flutter_tools/src/build_info.dart'
;
import
'package:flutter_tools/src/cache.dart'
;
import
'package:flutter_tools/src/commands/run.dart'
;
import
'package:flutter_tools/src/commands/run.dart'
;
import
'package:flutter_tools/src/device.dart'
;
import
'package:flutter_tools/src/device.dart'
;
import
'package:flutter_tools/src/runner/flutter_command.dart'
;
import
'package:flutter_tools/src/runner/flutter_command.dart'
;
import
'package:flutter_tools/src/version.dart'
;
import
'package:mockito/mockito.dart'
;
import
'package:mockito/mockito.dart'
;
import
'../src/common.dart'
;
import
'../src/common.dart'
;
...
@@ -18,20 +14,9 @@ import '../src/context.dart';
...
@@ -18,20 +14,9 @@ import '../src/context.dart';
import
'../src/mocks.dart'
;
import
'../src/mocks.dart'
;
void
main
(
)
{
void
main
(
)
{
group
(
'run'
,
()
{
final
MockDeviceManager
mockDeviceManager
=
MockDeviceManager
();
MockApplicationPackageFactory
mockApplicationPackageFactory
;
MockDeviceManager
mockDeviceManager
;
MockFlutterVersion
mockStableFlutterVersion
;
MockFlutterVersion
mockUnstableFlutterVersion
;
setUpAll
(()
{
Cache
.
disableLocking
();
mockApplicationPackageFactory
=
MockApplicationPackageFactory
();
mockDeviceManager
=
MockDeviceManager
();
mockStableFlutterVersion
=
MockFlutterVersion
(
isStable:
true
);
mockUnstableFlutterVersion
=
MockFlutterVersion
(
isStable:
false
);
});
group
(
'run'
,
()
{
testUsingContext
(
'fails when target not found'
,
()
async
{
testUsingContext
(
'fails when target not found'
,
()
async
{
final
RunCommand
command
=
RunCommand
();
final
RunCommand
command
=
RunCommand
();
applyMocksToCommand
(
command
);
applyMocksToCommand
(
command
);
...
@@ -43,75 +28,6 @@ void main() {
...
@@ -43,75 +28,6 @@ void main() {
}
}
});
});
testUsingContext
(
'dart-flags option is not available on stable channel'
,
()
async
{
when
(
mockDeviceManager
.
getDevices
()).
thenAnswer
((
Invocation
invocation
)
{
return
Stream
<
Device
>.
fromIterable
(<
Device
>[
FakeDevice
(),
]);
});
final
RunCommand
command
=
TestRunCommand
();
final
List
<
String
>
args
=
<
String
>
[
'run'
,
'--dart-flags'
,
'"--observe"'
,
'--no-hot'
,
];
// Stable branch.
try
{
await
createTestCommandRunner
(
command
).
run
(
args
);
fail
(
'Expect exception'
);
// ignore: unused_catch_clause
}
on
UsageException
catch
(
e
)
{
// Not available while on stable branch.
}
},
overrides:
<
Type
,
Generator
>{
DeviceManager:
()
=>
mockDeviceManager
,
FlutterVersion:
()
=>
mockStableFlutterVersion
,
});
testUsingContext
(
'dart-flags option is only populated for debug and profile modes'
,
()
async
{
when
(
mockDeviceManager
.
getDevices
()).
thenAnswer
((
Invocation
invocation
)
{
return
Stream
<
Device
>.
fromIterable
(<
Device
>[
FakeDevice
(),
]);
});
final
RunCommand
command
=
TestRunCommand
();
final
List
<
String
>
args
=
<
String
>
[
'run'
,
'--dart-flags'
,
'"--observe"'
,
'--no-hot'
,
];
// Debug mode
try
{
await
createTestCommandRunner
(
command
).
run
(
args
);
fail
(
'Expect exception'
);
}
on
ToolExit
catch
(
e
)
{
expect
(
e
.
exitCode
??
1
,
1
);
}
// Profile mode
try
{
await
createTestCommandRunner
(
command
).
run
(<
String
>[...
args
,
'--profile'
]);
fail
(
'Expect exception'
);
}
on
ToolExit
catch
(
e
)
{
expect
(
e
.
exitCode
??
1
,
1
);
}
// Release mode
try
{
await
createTestCommandRunner
(
command
).
run
(<
String
>[...
args
,
'--release'
]);
fail
(
'Expect exception'
);
}
on
ToolExit
catch
(
e
)
{
expect
(
e
.
exitCode
??
1
,
1
);
}
},
overrides:
<
Type
,
Generator
>{
ApplicationPackageFactory:
()
=>
mockApplicationPackageFactory
,
DeviceManager:
()
=>
mockDeviceManager
,
FlutterVersion:
()
=>
mockUnstableFlutterVersion
,
});
testUsingContext
(
'should only request artifacts corresponding to connected devices'
,
()
async
{
testUsingContext
(
'should only request artifacts corresponding to connected devices'
,
()
async
{
when
(
mockDeviceManager
.
getDevices
()).
thenAnswer
((
Invocation
invocation
)
{
when
(
mockDeviceManager
.
getDevices
()).
thenAnswer
((
Invocation
invocation
)
{
return
Stream
<
Device
>.
fromIterable
(<
Device
>[
return
Stream
<
Device
>.
fromIterable
(<
Device
>[
...
@@ -173,65 +89,3 @@ class MockDevice extends Mock implements Device {
...
@@ -173,65 +89,3 @@ class MockDevice extends Mock implements Device {
@override
@override
Future
<
TargetPlatform
>
get
targetPlatform
async
=>
_targetPlatform
;
Future
<
TargetPlatform
>
get
targetPlatform
async
=>
_targetPlatform
;
}
}
class
TestRunCommand
extends
RunCommand
{
@override
// ignore: must_call_super
Future
<
void
>
validateCommand
()
async
{
devices
=
await
deviceManager
.
getDevices
().
toList
();
}
}
class
MockStableFlutterVersion
extends
MockFlutterVersion
{
@override
bool
get
isStable
=>
true
;
}
class
FakeDevice
extends
Fake
implements
Device
{
final
TargetPlatform
_targetPlatform
=
TargetPlatform
.
ios
;
void
_throwToolExit
(
int
code
)
=>
throwToolExit
(
null
,
exitCode:
code
);
@override
Future
<
bool
>
get
isLocalEmulator
=>
Future
<
bool
>.
value
(
false
);
@override
bool
get
supportsHotReload
=>
false
;
@override
DeviceLogReader
getLogReader
({
ApplicationPackage
app
})
{
return
MockDeviceLogReader
();
}
@override
String
get
name
=>
'FakeDevice'
;
@override
Future
<
TargetPlatform
>
get
targetPlatform
async
=>
_targetPlatform
;
@override
Future
<
LaunchResult
>
startApp
(
ApplicationPackage
package
,
{
String
mainPath
,
String
route
,
DebuggingOptions
debuggingOptions
,
Map
<
String
,
dynamic
>
platformArgs
,
bool
prebuiltApplication
=
false
,
bool
usesTerminalUi
=
true
,
bool
ipv6
=
false
,
})
async
{
final
String
dartFlags
=
debuggingOptions
.
dartFlags
;
if
(
debuggingOptions
.
buildInfo
.
isRelease
)
{
if
(
dartFlags
.
isNotEmpty
)
{
_throwToolExit
(-
1
);
}
_throwToolExit
(
1
);
}
else
{
if
(
dartFlags
.
isEmpty
)
{
_throwToolExit
(-
1
);
}
_throwToolExit
(
1
);
}
return
null
;
}
}
packages/flutter_tools/test/src/context.dart
View file @
587687ee
...
@@ -332,12 +332,8 @@ class MockXcodeProjectInterpreter implements XcodeProjectInterpreter {
...
@@ -332,12 +332,8 @@ class MockXcodeProjectInterpreter implements XcodeProjectInterpreter {
}
}
class
MockFlutterVersion
extends
Mock
implements
FlutterVersion
{
class
MockFlutterVersion
extends
Mock
implements
FlutterVersion
{
MockFlutterVersion
({
bool
isStable
=
false
})
:
_isStable
=
isStable
;
final
bool
_isStable
;
@override
@override
bool
get
isStable
=>
_isStabl
e
;
bool
get
isStable
=>
fals
e
;
}
}
class
MockClock
extends
Mock
implements
SystemClock
{}
class
MockClock
extends
Mock
implements
SystemClock
{}
...
...
packages/flutter_tools/test/src/mocks.dart
View file @
587687ee
...
@@ -37,18 +37,6 @@ class MockApplicationPackageStore extends ApplicationPackageStore {
...
@@ -37,18 +37,6 @@ class MockApplicationPackageStore extends ApplicationPackageStore {
);
);
}
}
class
MockApplicationPackageFactory
extends
Mock
implements
ApplicationPackageFactory
{
final
MockApplicationPackageStore
_store
=
MockApplicationPackageStore
();
@override
Future
<
ApplicationPackage
>
getPackageForPlatform
(
TargetPlatform
platform
,
{
File
applicationBinary
,
})
async
{
return
_store
.
getPackageForPlatform
(
platform
);
}
}
/// An SDK installation with several SDK levels (19, 22, 23).
/// An SDK installation with several SDK levels (19, 22, 23).
class
MockAndroidSdk
extends
Mock
implements
AndroidSdk
{
class
MockAndroidSdk
extends
Mock
implements
AndroidSdk
{
static
Directory
createSdkDirectory
({
static
Directory
createSdkDirectory
({
...
...
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