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
e8ec8a0d
Unverified
Commit
e8ec8a0d
authored
Nov 12, 2021
by
Christopher Fujino
Committed by
GitHub
Nov 12, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[flutter_tools] Catch lack of flutter tools source missing (#93168)
parent
d21bb197
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
148 additions
and
8 deletions
+148
-8
executable.dart
packages/flutter_tools/lib/executable.dart
+2
-0
globals.dart
packages/flutter_tools/lib/src/globals.dart
+3
-0
pre_run_validator.dart
packages/flutter_tools/lib/src/pre_run_validator.dart
+51
-0
flutter_command.dart
packages/flutter_tools/lib/src/runner/flutter_command.dart
+1
-0
shell_completion_test.dart
...s/test/commands.shard/hermetic/shell_completion_test.dart
+4
-0
packages_test.dart
...er_tools/test/commands.shard/permeable/packages_test.dart
+1
-0
flutter_command_test.dart
...tools/test/general.shard/runner/flutter_command_test.dart
+85
-8
common.dart
packages/flutter_tools/test/src/common.dart
+1
-0
No files found.
packages/flutter_tools/lib/executable.dart
View file @
e8ec8a0d
...
@@ -54,6 +54,7 @@ import 'src/globals.dart' as globals;
...
@@ -54,6 +54,7 @@ import 'src/globals.dart' as globals;
// Files in `isolated` are intentionally excluded from google3 tooling.
// Files in `isolated` are intentionally excluded from google3 tooling.
import
'src/isolated/mustache_template.dart'
;
import
'src/isolated/mustache_template.dart'
;
import
'src/isolated/resident_web_runner.dart'
;
import
'src/isolated/resident_web_runner.dart'
;
import
'src/pre_run_validator.dart'
;
import
'src/resident_runner.dart'
;
import
'src/resident_runner.dart'
;
import
'src/runner/flutter_command.dart'
;
import
'src/runner/flutter_command.dart'
;
import
'src/web/web_runner.dart'
;
import
'src/web/web_runner.dart'
;
...
@@ -126,6 +127,7 @@ Future<void> main(List<String> args) async {
...
@@ -126,6 +127,7 @@ Future<void> main(List<String> args) async {
windows:
globals
.
platform
.
isWindows
,
windows:
globals
.
platform
.
isWindows
,
);
);
},
},
PreRunValidator:
()
=>
PreRunValidator
(
fileSystem:
globals
.
fs
),
},
},
);
);
}
}
...
...
packages/flutter_tools/lib/src/globals.dart
View file @
e8ec8a0d
...
@@ -39,6 +39,7 @@ import 'macos/cocoapods_validator.dart';
...
@@ -39,6 +39,7 @@ import 'macos/cocoapods_validator.dart';
import
'macos/xcdevice.dart'
;
import
'macos/xcdevice.dart'
;
import
'macos/xcode.dart'
;
import
'macos/xcode.dart'
;
import
'persistent_tool_state.dart'
;
import
'persistent_tool_state.dart'
;
import
'pre_run_validator.dart'
;
import
'project.dart'
;
import
'project.dart'
;
import
'reporting/crash_reporting.dart'
;
import
'reporting/crash_reporting.dart'
;
import
'reporting/reporting.dart'
;
import
'reporting/reporting.dart'
;
...
@@ -257,3 +258,5 @@ FlutterProjectFactory get projectFactory {
...
@@ -257,3 +258,5 @@ FlutterProjectFactory get projectFactory {
}
}
CustomDevicesConfig
get
customDevicesConfig
=>
context
.
get
<
CustomDevicesConfig
>()!;
CustomDevicesConfig
get
customDevicesConfig
=>
context
.
get
<
CustomDevicesConfig
>()!;
PreRunValidator
get
preRunValidator
=>
context
.
get
<
PreRunValidator
>()
??
const
NoOpPreRunValidator
();
packages/flutter_tools/lib/src/pre_run_validator.dart
0 → 100644
View file @
e8ec8a0d
// Copyright 2014 The Flutter 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
'base/common.dart'
;
import
'base/file_system.dart'
;
import
'cache.dart'
;
/// A validator that runs before the tool runs any command.
abstract
class
PreRunValidator
{
factory
PreRunValidator
({
required
FileSystem
fileSystem
,
})
=>
_DefaultPreRunValidator
(
fileSystem:
fileSystem
);
void
validate
();
}
class
_DefaultPreRunValidator
implements
PreRunValidator
{
_DefaultPreRunValidator
({
required
this
.
fileSystem
,
});
final
FileSystem
fileSystem
;
late
final
Directory
_toolsDir
=
fileSystem
.
directory
(
fileSystem
.
path
.
join
(
Cache
.
flutterRoot
!,
'packages'
,
'flutter_tools'
),
);
@override
void
validate
()
{
// If a user downloads the Flutter SDK via a pre-built archive and there is
// an error during extraction, the user could have a valid Dart snapshot of
// the tool but not the source directory. We still need the source, so
// validate the source directory exists and toolExit if not.
if
(!
_toolsDir
.
existsSync
())
{
throwToolExit
(
'Flutter SDK installation appears corrupted: expected to find the '
'directory
${_toolsDir.path}
but it does not exist! Please go to '
'https://flutter.dev/setup for instructions on how to re-install '
'Flutter.'
,
);
}
}
}
class
NoOpPreRunValidator
implements
PreRunValidator
{
const
NoOpPreRunValidator
();
@override
void
validate
()
{}
}
packages/flutter_tools/lib/src/runner/flutter_command.dart
View file @
e8ec8a0d
...
@@ -1251,6 +1251,7 @@ abstract class FlutterCommand extends Command<void> {
...
@@ -1251,6 +1251,7 @@ abstract class FlutterCommand extends Command<void> {
/// rather than calling [runCommand] directly.
/// rather than calling [runCommand] directly.
@mustCallSuper
@mustCallSuper
Future
<
FlutterCommandResult
>
verifyThenRunCommand
(
String
?
commandPath
)
async
{
Future
<
FlutterCommandResult
>
verifyThenRunCommand
(
String
?
commandPath
)
async
{
globals
.
preRunValidator
.
validate
();
// Populate the cache. We call this before pub get below so that the
// Populate the cache. We call this before pub get below so that the
// sky_engine package is available in the flutter cache for pub to find.
// sky_engine package is available in the flutter cache for pub to find.
if
(
shouldUpdateCache
)
{
if
(
shouldUpdateCache
)
{
...
...
packages/flutter_tools/test/commands.shard/hermetic/shell_completion_test.dart
View file @
e8ec8a0d
...
@@ -31,6 +31,8 @@ void main() {
...
@@ -31,6 +31,8 @@ void main() {
expect
(
fakeStdio
.
writtenToStdout
.
length
,
equals
(
1
));
expect
(
fakeStdio
.
writtenToStdout
.
length
,
equals
(
1
));
expect
(
fakeStdio
.
writtenToStdout
.
first
,
contains
(
'__flutter_completion'
));
expect
(
fakeStdio
.
writtenToStdout
.
first
,
contains
(
'__flutter_completion'
));
},
overrides:
<
Type
,
Generator
>{
},
overrides:
<
Type
,
Generator
>{
FileSystem:
()
=>
MemoryFileSystem
.
test
(),
ProcessManager:
()
=>
FakeProcessManager
.
any
(),
Stdio:
()
=>
fakeStdio
,
Stdio:
()
=>
fakeStdio
,
});
});
...
@@ -40,6 +42,8 @@ void main() {
...
@@ -40,6 +42,8 @@ void main() {
expect
(
fakeStdio
.
writtenToStdout
.
length
,
equals
(
1
));
expect
(
fakeStdio
.
writtenToStdout
.
length
,
equals
(
1
));
expect
(
fakeStdio
.
writtenToStdout
.
first
,
contains
(
'__flutter_completion'
));
expect
(
fakeStdio
.
writtenToStdout
.
first
,
contains
(
'__flutter_completion'
));
},
overrides:
<
Type
,
Generator
>{
},
overrides:
<
Type
,
Generator
>{
FileSystem:
()
=>
MemoryFileSystem
.
test
(),
ProcessManager:
()
=>
FakeProcessManager
.
any
(),
Stdio:
()
=>
fakeStdio
,
Stdio:
()
=>
fakeStdio
,
});
});
...
...
packages/flutter_tools/test/commands.shard/permeable/packages_test.dart
View file @
e8ec8a0d
...
@@ -449,6 +449,7 @@ void main() {
...
@@ -449,6 +449,7 @@ void main() {
testUsingContext
(
'test without bot'
,
()
async
{
testUsingContext
(
'test without bot'
,
()
async
{
Cache
.
flutterRoot
=
''
;
Cache
.
flutterRoot
=
''
;
globals
.
fs
.
directory
(
'/packages/flutter_tools'
).
createSync
(
recursive:
true
);
globals
.
fs
.
file
(
'pubspec.yaml'
).
createSync
();
globals
.
fs
.
file
(
'pubspec.yaml'
).
createSync
();
processManager
.
addCommand
(
processManager
.
addCommand
(
const
FakeCommand
(
command:
<
String
>[
'/bin/cache/dart-sdk/bin/dart'
,
'__deprecated_pub'
,
'run'
,
'test'
]),
const
FakeCommand
(
command:
<
String
>[
'/bin/cache/dart-sdk/bin/dart'
,
'__deprecated_pub'
,
'run'
,
'test'
]),
...
...
packages/flutter_tools/test/general.shard/runner/flutter_command_test.dart
View file @
e8ec8a0d
...
@@ -19,6 +19,7 @@ import 'package:flutter_tools/src/build_info.dart';
...
@@ -19,6 +19,7 @@ import 'package:flutter_tools/src/build_info.dart';
import
'package:flutter_tools/src/cache.dart'
;
import
'package:flutter_tools/src/cache.dart'
;
import
'package:flutter_tools/src/dart/pub.dart'
;
import
'package:flutter_tools/src/dart/pub.dart'
;
import
'package:flutter_tools/src/globals.dart'
as
globals
;
import
'package:flutter_tools/src/globals.dart'
as
globals
;
import
'package:flutter_tools/src/pre_run_validator.dart'
;
import
'package:flutter_tools/src/reporting/reporting.dart'
;
import
'package:flutter_tools/src/reporting/reporting.dart'
;
import
'package:flutter_tools/src/runner/flutter_command.dart'
;
import
'package:flutter_tools/src/runner/flutter_command.dart'
;
import
'package:test/fake.dart'
;
import
'package:test/fake.dart'
;
...
@@ -34,6 +35,13 @@ void main() {
...
@@ -34,6 +35,13 @@ void main() {
TestUsage
usage
;
TestUsage
usage
;
FakeClock
clock
;
FakeClock
clock
;
FakeProcessInfo
processInfo
;
FakeProcessInfo
processInfo
;
MemoryFileSystem
fileSystem
;
FakeProcessManager
processManager
;
PreRunValidator
preRunValidator
;
setUpAll
(()
{
Cache
.
flutterRoot
=
'/path/to/sdk/flutter'
;
});
setUp
(()
{
setUp
(()
{
Cache
.
disableLocking
();
Cache
.
disableLocking
();
...
@@ -42,6 +50,9 @@ void main() {
...
@@ -42,6 +50,9 @@ void main() {
clock
=
FakeClock
();
clock
=
FakeClock
();
processInfo
=
FakeProcessInfo
();
processInfo
=
FakeProcessInfo
();
processInfo
.
maxRss
=
10
;
processInfo
.
maxRss
=
10
;
fileSystem
=
MemoryFileSystem
.
test
();
processManager
=
FakeProcessManager
.
empty
();
preRunValidator
=
PreRunValidator
(
fileSystem:
fileSystem
);
});
});
tearDown
(()
{
tearDown
(()
{
...
@@ -63,6 +74,8 @@ void main() {
...
@@ -63,6 +74,8 @@ void main() {
expect
(
flutterCommand
.
hidden
,
isFalse
);
expect
(
flutterCommand
.
hidden
,
isFalse
);
},
},
overrides:
<
Type
,
Generator
>{
overrides:
<
Type
,
Generator
>{
FileSystem:
()
=>
fileSystem
,
ProcessManager:
()
=>
processManager
,
Cache:
()
=>
cache
,
Cache:
()
=>
cache
,
});
});
...
@@ -78,8 +91,24 @@ void main() {
...
@@ -78,8 +91,24 @@ void main() {
],
],
);
);
},
},
overrides:
<
Type
,
Generator
>{
FileSystem:
()
=>
fileSystem
,
ProcessManager:
()
=>
processManager
,
Cache:
()
=>
cache
,
});
testUsingContext
(
"throws toolExit if flutter_tools source dir doesn't exist"
,
()
async
{
final
DummyFlutterCommand
flutterCommand
=
DummyFlutterCommand
();
await
expectToolExitLater
(
flutterCommand
.
run
(),
contains
(
'Flutter SDK installation appears corrupted'
),
);
},
overrides:
<
Type
,
Generator
>{
overrides:
<
Type
,
Generator
>{
Cache:
()
=>
cache
,
Cache:
()
=>
cache
,
FileSystem:
()
=>
fileSystem
,
PreRunValidator:
()
=>
preRunValidator
,
ProcessManager:
()
=>
processManager
,
});
});
testUsingContext
(
'deprecated command should warn'
,
()
async
{
testUsingContext
(
'deprecated command should warn'
,
()
async
{
...
@@ -95,6 +124,9 @@ void main() {
...
@@ -95,6 +124,9 @@ void main() {
'of Flutter.'
));
'of Flutter.'
));
expect
(
flutterCommand
.
deprecated
,
isTrue
);
expect
(
flutterCommand
.
deprecated
,
isTrue
);
expect
(
flutterCommand
.
hidden
,
isTrue
);
expect
(
flutterCommand
.
hidden
,
isTrue
);
},
overrides:
<
Type
,
Generator
>{
FileSystem:
()
=>
fileSystem
,
ProcessManager:
()
=>
processManager
,
});
});
testUsingContext
(
'uses the error handling file system'
,
()
async
{
testUsingContext
(
'uses the error handling file system'
,
()
async
{
...
@@ -105,6 +137,9 @@ void main() {
...
@@ -105,6 +137,9 @@ void main() {
}
}
);
);
await
flutterCommand
.
run
();
await
flutterCommand
.
run
();
},
overrides:
<
Type
,
Generator
>{
FileSystem:
()
=>
fileSystem
,
ProcessManager:
()
=>
processManager
,
});
});
testUsingContext
(
'finds the target file with default values'
,
()
async
{
testUsingContext
(
'finds the target file with default values'
,
()
async
{
...
@@ -115,8 +150,8 @@ void main() {
...
@@ -115,8 +150,8 @@ void main() {
expect
(
fakeTargetCommand
.
cachedTargetFile
,
'lib/main.dart'
);
expect
(
fakeTargetCommand
.
cachedTargetFile
,
'lib/main.dart'
);
},
overrides:
<
Type
,
Generator
>{
},
overrides:
<
Type
,
Generator
>{
FileSystem:
()
=>
MemoryFileSystem
.
test
()
,
FileSystem:
()
=>
fileSystem
,
ProcessManager:
()
=>
FakeProcessManager
.
any
()
,
ProcessManager:
()
=>
processManager
,
});
});
testUsingContext
(
'finds the target file with specified value'
,
()
async
{
testUsingContext
(
'finds the target file with specified value'
,
()
async
{
...
@@ -127,8 +162,8 @@ void main() {
...
@@ -127,8 +162,8 @@ void main() {
expect
(
fakeTargetCommand
.
cachedTargetFile
,
'lib/foo.dart'
);
expect
(
fakeTargetCommand
.
cachedTargetFile
,
'lib/foo.dart'
);
},
overrides:
<
Type
,
Generator
>{
},
overrides:
<
Type
,
Generator
>{
FileSystem:
()
=>
MemoryFileSystem
.
test
()
,
FileSystem:
()
=>
fileSystem
,
ProcessManager:
()
=>
FakeProcessManager
.
any
()
,
ProcessManager:
()
=>
processManager
,
});
});
testUsingContext
(
'throws tool exit if specified file does not exist'
,
()
async
{
testUsingContext
(
'throws tool exit if specified file does not exist'
,
()
async
{
...
@@ -137,13 +172,15 @@ void main() {
...
@@ -137,13 +172,15 @@ void main() {
expect
(()
async
=>
runner
.
run
(<
String
>[
'test'
,
'-t'
,
'lib/foo.dart'
]),
throwsToolExit
());
expect
(()
async
=>
runner
.
run
(<
String
>[
'test'
,
'-t'
,
'lib/foo.dart'
]),
throwsToolExit
());
},
overrides:
<
Type
,
Generator
>{
},
overrides:
<
Type
,
Generator
>{
FileSystem:
()
=>
MemoryFileSystem
.
test
()
,
FileSystem:
()
=>
fileSystem
,
ProcessManager:
()
=>
FakeProcessManager
.
any
()
,
ProcessManager:
()
=>
processManager
,
});
});
void
testUsingCommandContext
(
String
testName
,
dynamic
Function
()
testBody
)
{
void
testUsingCommandContext
(
String
testName
,
dynamic
Function
()
testBody
)
{
testUsingContext
(
testName
,
testBody
,
overrides:
<
Type
,
Generator
>{
testUsingContext
(
testName
,
testBody
,
overrides:
<
Type
,
Generator
>{
FileSystem:
()
=>
fileSystem
,
ProcessInfo:
()
=>
processInfo
,
ProcessInfo:
()
=>
processInfo
,
ProcessManager:
()
=>
processManager
,
SystemClock:
()
=>
clock
,
SystemClock:
()
=>
clock
,
Usage:
()
=>
usage
,
Usage:
()
=>
usage
,
});
});
...
@@ -245,6 +282,9 @@ void main() {
...
@@ -245,6 +282,9 @@ void main() {
'http://127.0.0.1:9105'
,
'http://127.0.0.1:9105'
,
]);
]);
expect
(
command
.
devToolsServerAddress
.
toString
(),
equals
(
'http://127.0.0.1:9105'
));
expect
(
command
.
devToolsServerAddress
.
toString
(),
equals
(
'http://127.0.0.1:9105'
));
},
overrides:
<
Type
,
Generator
>{
FileSystem:
()
=>
fileSystem
,
ProcessManager:
()
=>
processManager
,
});
});
testUsingContext
(
'devToolsServerAddress returns null for bad input'
,
()
async
{
testUsingContext
(
'devToolsServerAddress returns null for bad input'
,
()
async
{
...
@@ -277,6 +317,9 @@ void main() {
...
@@ -277,6 +317,9 @@ void main() {
'127.0.0.1:9101'
,
'127.0.0.1:9101'
,
]);
]);
expect
(
command
.
devToolsServerAddress
,
isNull
);
expect
(
command
.
devToolsServerAddress
,
isNull
);
},
overrides:
<
Type
,
Generator
>{
FileSystem:
()
=>
fileSystem
,
ProcessManager:
()
=>
processManager
,
});
});
group
(
'signals tests'
,
()
{
group
(
'signals tests'
,
()
{
...
@@ -328,6 +371,8 @@ void main() {
...
@@ -328,6 +371,8 @@ void main() {
),
),
]);
]);
},
overrides:
<
Type
,
Generator
>{
},
overrides:
<
Type
,
Generator
>{
FileSystem:
()
=>
fileSystem
,
ProcessManager:
()
=>
processManager
,
ProcessInfo:
()
=>
processInfo
,
ProcessInfo:
()
=>
processInfo
,
Signals:
()
=>
FakeSignals
(
Signals:
()
=>
FakeSignals
(
subForSigTerm:
signalUnderTest
,
subForSigTerm:
signalUnderTest
,
...
@@ -363,6 +408,8 @@ void main() {
...
@@ -363,6 +408,8 @@ void main() {
signalController
.
add
(
mockSignal
);
signalController
.
add
(
mockSignal
);
await
completer
.
future
;
await
completer
.
future
;
},
overrides:
<
Type
,
Generator
>{
},
overrides:
<
Type
,
Generator
>{
FileSystem:
()
=>
fileSystem
,
ProcessManager:
()
=>
processManager
,
ProcessInfo:
()
=>
processInfo
,
ProcessInfo:
()
=>
processInfo
,
Signals:
()
=>
FakeSignals
(
Signals:
()
=>
FakeSignals
(
subForSigTerm:
signalUnderTest
,
subForSigTerm:
signalUnderTest
,
...
@@ -499,26 +546,35 @@ void main() {
...
@@ -499,26 +546,35 @@ void main() {
},
overrides:
<
Type
,
Generator
>{
},
overrides:
<
Type
,
Generator
>{
Pub:
()
=>
FakePub
(),
Pub:
()
=>
FakePub
(),
Usage:
()
=>
usage
,
Usage:
()
=>
usage
,
FileSystem:
()
=>
MemoryFileSystem
.
test
()
,
FileSystem:
()
=>
fileSystem
,
ProcessManager:
()
=>
FakeProcessManager
.
any
()
,
ProcessManager:
()
=>
processManager
,
});
});
testUsingContext
(
'use packagesPath to generate BuildInfo'
,
()
async
{
testUsingContext
(
'use packagesPath to generate BuildInfo'
,
()
async
{
final
DummyFlutterCommand
flutterCommand
=
DummyFlutterCommand
(
packagesPath:
'foo'
);
final
DummyFlutterCommand
flutterCommand
=
DummyFlutterCommand
(
packagesPath:
'foo'
);
final
BuildInfo
buildInfo
=
await
flutterCommand
.
getBuildInfo
(
forcedBuildMode:
BuildMode
.
debug
);
final
BuildInfo
buildInfo
=
await
flutterCommand
.
getBuildInfo
(
forcedBuildMode:
BuildMode
.
debug
);
expect
(
buildInfo
.
packagesPath
,
'foo'
);
expect
(
buildInfo
.
packagesPath
,
'foo'
);
},
overrides:
<
Type
,
Generator
>{
FileSystem:
()
=>
fileSystem
,
ProcessManager:
()
=>
processManager
,
});
});
testUsingContext
(
'use fileSystemScheme to generate BuildInfo'
,
()
async
{
testUsingContext
(
'use fileSystemScheme to generate BuildInfo'
,
()
async
{
final
DummyFlutterCommand
flutterCommand
=
DummyFlutterCommand
(
fileSystemScheme:
'foo'
);
final
DummyFlutterCommand
flutterCommand
=
DummyFlutterCommand
(
fileSystemScheme:
'foo'
);
final
BuildInfo
buildInfo
=
await
flutterCommand
.
getBuildInfo
(
forcedBuildMode:
BuildMode
.
debug
);
final
BuildInfo
buildInfo
=
await
flutterCommand
.
getBuildInfo
(
forcedBuildMode:
BuildMode
.
debug
);
expect
(
buildInfo
.
fileSystemScheme
,
'foo'
);
expect
(
buildInfo
.
fileSystemScheme
,
'foo'
);
},
overrides:
<
Type
,
Generator
>{
FileSystem:
()
=>
fileSystem
,
ProcessManager:
()
=>
processManager
,
});
});
testUsingContext
(
'use fileSystemRoots to generate BuildInfo'
,
()
async
{
testUsingContext
(
'use fileSystemRoots to generate BuildInfo'
,
()
async
{
final
DummyFlutterCommand
flutterCommand
=
DummyFlutterCommand
(
fileSystemRoots:
<
String
>[
'foo'
,
'bar'
]);
final
DummyFlutterCommand
flutterCommand
=
DummyFlutterCommand
(
fileSystemRoots:
<
String
>[
'foo'
,
'bar'
]);
final
BuildInfo
buildInfo
=
await
flutterCommand
.
getBuildInfo
(
forcedBuildMode:
BuildMode
.
debug
);
final
BuildInfo
buildInfo
=
await
flutterCommand
.
getBuildInfo
(
forcedBuildMode:
BuildMode
.
debug
);
expect
(
buildInfo
.
fileSystemRoots
,
<
String
>[
'foo'
,
'bar'
]);
expect
(
buildInfo
.
fileSystemRoots
,
<
String
>[
'foo'
,
'bar'
]);
},
overrides:
<
Type
,
Generator
>{
FileSystem:
()
=>
fileSystem
,
ProcessManager:
()
=>
processManager
,
});
});
testUsingContext
(
'includes initializeFromDill in BuildInfo'
,
()
async
{
testUsingContext
(
'includes initializeFromDill in BuildInfo'
,
()
async
{
...
@@ -527,6 +583,9 @@ void main() {
...
@@ -527,6 +583,9 @@ void main() {
await
runner
.
run
(<
String
>[
'dummy'
,
'--initialize-from-dill=/foo/bar.dill'
]);
await
runner
.
run
(<
String
>[
'dummy'
,
'--initialize-from-dill=/foo/bar.dill'
]);
final
BuildInfo
buildInfo
=
await
flutterCommand
.
getBuildInfo
(
forcedBuildMode:
BuildMode
.
debug
);
final
BuildInfo
buildInfo
=
await
flutterCommand
.
getBuildInfo
(
forcedBuildMode:
BuildMode
.
debug
);
expect
(
buildInfo
.
initializeFromDill
,
'/foo/bar.dill'
);
expect
(
buildInfo
.
initializeFromDill
,
'/foo/bar.dill'
);
},
overrides:
<
Type
,
Generator
>{
FileSystem:
()
=>
fileSystem
,
ProcessManager:
()
=>
processManager
,
});
});
testUsingContext
(
'dds options'
,
()
async
{
testUsingContext
(
'dds options'
,
()
async
{
...
@@ -535,6 +594,9 @@ void main() {
...
@@ -535,6 +594,9 @@ void main() {
await
runner
.
run
(<
String
>[
'test'
,
'--dds-port=1'
]);
await
runner
.
run
(<
String
>[
'test'
,
'--dds-port=1'
]);
expect
(
ddsCommand
.
enableDds
,
isTrue
);
expect
(
ddsCommand
.
enableDds
,
isTrue
);
expect
(
ddsCommand
.
ddsPort
,
1
);
expect
(
ddsCommand
.
ddsPort
,
1
);
},
overrides:
<
Type
,
Generator
>{
FileSystem:
()
=>
fileSystem
,
ProcessManager:
()
=>
processManager
,
});
});
testUsingContext
(
'dds options --dds'
,
()
async
{
testUsingContext
(
'dds options --dds'
,
()
async
{
...
@@ -542,6 +604,9 @@ void main() {
...
@@ -542,6 +604,9 @@ void main() {
final
CommandRunner
<
void
>
runner
=
createTestCommandRunner
(
ddsCommand
);
final
CommandRunner
<
void
>
runner
=
createTestCommandRunner
(
ddsCommand
);
await
runner
.
run
(<
String
>[
'test'
,
'--dds'
]);
await
runner
.
run
(<
String
>[
'test'
,
'--dds'
]);
expect
(
ddsCommand
.
enableDds
,
isTrue
);
expect
(
ddsCommand
.
enableDds
,
isTrue
);
},
overrides:
<
Type
,
Generator
>{
FileSystem:
()
=>
fileSystem
,
ProcessManager:
()
=>
processManager
,
});
});
testUsingContext
(
'dds options --no-dds'
,
()
async
{
testUsingContext
(
'dds options --no-dds'
,
()
async
{
...
@@ -549,6 +614,9 @@ void main() {
...
@@ -549,6 +614,9 @@ void main() {
final
CommandRunner
<
void
>
runner
=
createTestCommandRunner
(
ddsCommand
);
final
CommandRunner
<
void
>
runner
=
createTestCommandRunner
(
ddsCommand
);
await
runner
.
run
(<
String
>[
'test'
,
'--no-dds'
]);
await
runner
.
run
(<
String
>[
'test'
,
'--no-dds'
]);
expect
(
ddsCommand
.
enableDds
,
isFalse
);
expect
(
ddsCommand
.
enableDds
,
isFalse
);
},
overrides:
<
Type
,
Generator
>{
FileSystem:
()
=>
fileSystem
,
ProcessManager:
()
=>
processManager
,
});
});
testUsingContext
(
'dds options --disable-dds'
,
()
async
{
testUsingContext
(
'dds options --disable-dds'
,
()
async
{
...
@@ -556,6 +624,9 @@ void main() {
...
@@ -556,6 +624,9 @@ void main() {
final
CommandRunner
<
void
>
runner
=
createTestCommandRunner
(
ddsCommand
);
final
CommandRunner
<
void
>
runner
=
createTestCommandRunner
(
ddsCommand
);
await
runner
.
run
(<
String
>[
'test'
,
'--disable-dds'
]);
await
runner
.
run
(<
String
>[
'test'
,
'--disable-dds'
]);
expect
(
ddsCommand
.
enableDds
,
isFalse
);
expect
(
ddsCommand
.
enableDds
,
isFalse
);
},
overrides:
<
Type
,
Generator
>{
FileSystem:
()
=>
fileSystem
,
ProcessManager:
()
=>
processManager
,
});
});
testUsingContext
(
'dds options --no-disable-dds'
,
()
async
{
testUsingContext
(
'dds options --no-disable-dds'
,
()
async
{
...
@@ -563,6 +634,9 @@ void main() {
...
@@ -563,6 +634,9 @@ void main() {
final
CommandRunner
<
void
>
runner
=
createTestCommandRunner
(
ddsCommand
);
final
CommandRunner
<
void
>
runner
=
createTestCommandRunner
(
ddsCommand
);
await
runner
.
run
(<
String
>[
'test'
,
'--no-disable-dds'
]);
await
runner
.
run
(<
String
>[
'test'
,
'--no-disable-dds'
]);
expect
(
ddsCommand
.
enableDds
,
isTrue
);
expect
(
ddsCommand
.
enableDds
,
isTrue
);
},
overrides:
<
Type
,
Generator
>{
FileSystem:
()
=>
fileSystem
,
ProcessManager:
()
=>
processManager
,
});
});
testUsingContext
(
'dds options --dds --disable-dds'
,
()
async
{
testUsingContext
(
'dds options --dds --disable-dds'
,
()
async
{
...
@@ -570,6 +644,9 @@ void main() {
...
@@ -570,6 +644,9 @@ void main() {
final
CommandRunner
<
void
>
runner
=
createTestCommandRunner
(
ddsCommand
);
final
CommandRunner
<
void
>
runner
=
createTestCommandRunner
(
ddsCommand
);
await
runner
.
run
(<
String
>[
'test'
,
'--dds'
,
'--disable-dds'
]);
await
runner
.
run
(<
String
>[
'test'
,
'--dds'
,
'--disable-dds'
]);
expect
(()
=>
ddsCommand
.
enableDds
,
throwsToolExit
());
expect
(()
=>
ddsCommand
.
enableDds
,
throwsToolExit
());
},
overrides:
<
Type
,
Generator
>{
FileSystem:
()
=>
fileSystem
,
ProcessManager:
()
=>
processManager
,
});
});
});
});
}
}
...
...
packages/flutter_tools/test/src/common.dart
View file @
e8ec8a0d
...
@@ -162,6 +162,7 @@ void test(String description, FutureOr<void> Function() body, {
...
@@ -162,6 +162,7 @@ void test(String description, FutureOr<void> Function() body, {
addTearDown
(()
async
{
addTearDown
(()
async
{
await
globals
.
localFileSystem
.
dispose
();
await
globals
.
localFileSystem
.
dispose
();
});
});
return
body
();
return
body
();
},
},
skip:
skip
,
skip:
skip
,
...
...
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