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
d80e994a
Unverified
Commit
d80e994a
authored
Sep 08, 2022
by
Sigurd Meldgaard
Committed by
GitHub
Sep 08, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Reland: Show output from pub get in flutter pub get (#110851)
parent
1ed23124
Changes
28
Show whitespace changes
Inline
Side-by-side
Showing
28 changed files
with
558 additions
and
250 deletions
+558
-250
analyze_snippet_code.dart
dev/bots/analyze_snippet_code.dart
+8
-1
web_dev_mode_tests.dart
dev/devicelab/lib/tasks/web_dev_mode_tests.dart
+1
-2
create.dart
packages/flutter_tools/lib/src/commands/create.dart
+52
-42
create_base.dart
packages/flutter_tools/lib/src/commands/create_base.dart
+0
-19
daemon.dart
packages/flutter_tools/lib/src/commands/daemon.dart
+1
-1
packages.dart
packages/flutter_tools/lib/src/commands/packages.dart
+6
-6
update_packages.dart
packages/flutter_tools/lib/src/commands/update_packages.dart
+3
-3
upgrade.dart
packages/flutter_tools/lib/src/commands/upgrade.dart
+2
-1
context_runner.dart
packages/flutter_tools/lib/src/context_runner.dart
+2
-0
pub.dart
packages/flutter_tools/lib/src/dart/pub.dart
+178
-78
flutter_cache.dart
packages/flutter_tools/lib/src/flutter_cache.dart
+9
-1
flutter_command.dart
packages/flutter_tools/lib/src/runner/flutter_command.dart
+1
-1
analyze_continuously_test.dart
...st/commands.shard/hermetic/analyze_continuously_test.dart
+8
-2
create_usage_test.dart
...tools/test/commands.shard/hermetic/create_usage_test.dart
+4
-2
drive_test.dart
...lutter_tools/test/commands.shard/hermetic/drive_test.dart
+1
-1
pub_get_test.dart
...tter_tools/test/commands.shard/hermetic/pub_get_test.dart
+3
-2
update_packages_test.dart
...ls/test/commands.shard/hermetic/update_packages_test.dart
+5
-7
build_aar_test.dart
...r_tools/test/commands.shard/permeable/build_aar_test.dart
+1
-1
create_test.dart
...tter_tools/test/commands.shard/permeable/create_test.dart
+26
-1
format_test.dart
...tter_tools/test/commands.shard/permeable/format_test.dart
+6
-0
packages_test.dart
...er_tools/test/commands.shard/permeable/packages_test.dart
+42
-2
cache_test.dart
packages/flutter_tools/test/general.shard/cache_test.dart
+4
-1
pub_get_test.dart
...s/flutter_tools/test/general.shard/dart/pub_get_test.dart
+172
-71
flutter_command_test.dart
...tools/test/general.shard/runner/flutter_command_test.dart
+3
-1
web_plugin_registrant_test.dart
...ls/test/integration.shard/web_plugin_registrant_test.dart
+5
-0
fakes.dart
packages/flutter_tools/test/src/fakes.dart
+11
-0
test_flutter_command_runner.dart
...s/flutter_tools/test/src/test_flutter_command_runner.dart
+1
-1
throwing_pub.dart
packages/flutter_tools/test/src/throwing_pub.dart
+3
-3
No files found.
dev/bots/analyze_snippet_code.dart
View file @
d80e994a
...
@@ -980,6 +980,13 @@ class _SnippetChecker {
...
@@ -980,6 +980,13 @@ class _SnippetChecker {
/// Invokes the analyzer on the given [directory] and returns the stdout (with some lines filtered).
/// Invokes the analyzer on the given [directory] and returns the stdout (with some lines filtered).
List
<
String
>
_runAnalyzer
()
{
List
<
String
>
_runAnalyzer
()
{
_createConfigurationFiles
();
_createConfigurationFiles
();
// Run pub get to avoid output from getting dependencies in the analyzer
// output.
Process
.
runSync
(
_flutter
,
<
String
>[
'pub'
,
'get'
],
workingDirectory:
_tempDirectory
.
absolute
.
path
,
);
final
ProcessResult
result
=
Process
.
runSync
(
final
ProcessResult
result
=
Process
.
runSync
(
_flutter
,
_flutter
,
<
String
>[
'--no-wrap'
,
'analyze'
,
'--no-preamble'
,
'--no-congratulate'
,
'.'
],
<
String
>[
'--no-wrap'
,
'analyze'
,
'--no-preamble'
,
'--no-congratulate'
,
'.'
],
...
@@ -1006,7 +1013,7 @@ class _SnippetChecker {
...
@@ -1006,7 +1013,7 @@ class _SnippetChecker {
if
(
stdout
.
isNotEmpty
&&
stdout
.
first
==
'Building flutter tool...'
)
{
if
(
stdout
.
isNotEmpty
&&
stdout
.
first
==
'Building flutter tool...'
)
{
stdout
.
removeAt
(
0
);
stdout
.
removeAt
(
0
);
}
}
if
(
stdout
.
isNotEmpty
&&
stdout
.
first
.
startsWith
(
'Running "flutter pub get" in '
)
)
{
if
(
stdout
.
isNotEmpty
&&
stdout
.
first
.
isEmpty
)
{
stdout
.
removeAt
(
0
);
stdout
.
removeAt
(
0
);
}
}
return
stdout
;
return
stdout
;
...
...
dev/devicelab/lib/tasks/web_dev_mode_tests.dart
View file @
d80e994a
...
@@ -42,11 +42,10 @@ TaskFunction createWebDevModeTest(String webDevice, bool enableIncrementalCompil
...
@@ -42,11 +42,10 @@ TaskFunction createWebDevModeTest(String webDevice, bool enableIncrementalCompil
recursiveCopy
(
flutterGalleryDir
,
_editedFlutterGalleryDir
);
recursiveCopy
(
flutterGalleryDir
,
_editedFlutterGalleryDir
);
await
inDirectory
<
void
>(
_editedFlutterGalleryDir
,
()
async
{
await
inDirectory
<
void
>(
_editedFlutterGalleryDir
,
()
async
{
{
{
final
Process
packagesGet
=
await
startProcess
(
await
exec
(
path
.
join
(
flutterDirectory
.
path
,
'bin'
,
'flutter'
),
path
.
join
(
flutterDirectory
.
path
,
'bin'
,
'flutter'
),
<
String
>[
'packages'
,
'get'
],
<
String
>[
'packages'
,
'get'
],
);
);
await
packagesGet
.
exitCode
;
final
Process
process
=
await
startProcess
(
final
Process
process
=
await
startProcess
(
path
.
join
(
flutterDirectory
.
path
,
'bin'
,
'flutter'
),
path
.
join
(
flutterDirectory
.
path
,
'bin'
,
'flutter'
),
flutterCommandArgs
(
'run'
,
options
),
flutterCommandArgs
(
'run'
,
options
),
...
...
packages/flutter_tools/lib/src/commands/create.dart
View file @
d80e994a
...
@@ -192,7 +192,6 @@ class CreateCommand extends CreateBase {
...
@@ -192,7 +192,6 @@ class CreateCommand extends CreateBase {
}
}
validateOutputDirectoryArg
();
validateOutputDirectoryArg
();
String
?
sampleCode
;
String
?
sampleCode
;
final
String
?
sampleArgument
=
stringArg
(
'sample'
);
final
String
?
sampleArgument
=
stringArg
(
'sample'
);
if
(
sampleArgument
!=
null
)
{
if
(
sampleArgument
!=
null
)
{
...
@@ -255,7 +254,29 @@ class CreateCommand extends CreateBase {
...
@@ -255,7 +254,29 @@ class CreateCommand extends CreateBase {
}
}
final
String
dartSdk
=
globals
.
cache
.
dartSdkBuild
;
final
String
dartSdk
=
globals
.
cache
.
dartSdkBuild
;
final
bool
includeIos
=
featureFlags
.
isIOSEnabled
&&
platforms
.
contains
(
'ios'
);
final
bool
includeIos
;
final
bool
includeAndroid
;
final
bool
includeWeb
;
final
bool
includeLinux
;
final
bool
includeMacos
;
final
bool
includeWindows
;
if
(
template
==
FlutterProjectType
.
module
)
{
// The module template only supports iOS and Android.
includeIos
=
true
;
includeAndroid
=
true
;
includeWeb
=
false
;
includeLinux
=
false
;
includeMacos
=
false
;
includeWindows
=
false
;
}
else
{
includeIos
=
featureFlags
.
isIOSEnabled
&&
platforms
.
contains
(
'ios'
);
includeAndroid
=
featureFlags
.
isAndroidEnabled
&&
platforms
.
contains
(
'android'
);
includeWeb
=
featureFlags
.
isWebEnabled
&&
platforms
.
contains
(
'web'
);
includeLinux
=
featureFlags
.
isLinuxEnabled
&&
platforms
.
contains
(
'linux'
);
includeMacos
=
featureFlags
.
isMacOSEnabled
&&
platforms
.
contains
(
'macos'
);
includeWindows
=
featureFlags
.
isWindowsEnabled
&&
platforms
.
contains
(
'windows'
);
}
String
?
developmentTeam
;
String
?
developmentTeam
;
if
(
includeIos
)
{
if
(
includeIos
)
{
developmentTeam
=
await
getCodeSigningIdentityDevelopmentTeam
(
developmentTeam
=
await
getCodeSigningIdentityDevelopmentTeam
(
...
@@ -282,11 +303,11 @@ class CreateCommand extends CreateBase {
...
@@ -282,11 +303,11 @@ class CreateCommand extends CreateBase {
iosLanguage:
stringArgDeprecated
(
'ios-language'
),
iosLanguage:
stringArgDeprecated
(
'ios-language'
),
iosDevelopmentTeam:
developmentTeam
,
iosDevelopmentTeam:
developmentTeam
,
ios:
includeIos
,
ios:
includeIos
,
android:
featureFlags
.
isAndroidEnabled
&&
platforms
.
contains
(
'android'
)
,
android:
includeAndroid
,
web:
featureFlags
.
isWebEnabled
&&
platforms
.
contains
(
'web'
)
,
web:
includeWeb
,
linux:
featureFlags
.
isLinuxEnabled
&&
platforms
.
contains
(
'linux'
)
,
linux:
includeLinux
,
macos:
featureFlags
.
isMacOSEnabled
&&
platforms
.
contains
(
'macos'
)
,
macos:
includeMacos
,
windows:
featureFlags
.
isWindowsEnabled
&&
platforms
.
contains
(
'windows'
)
,
windows:
includeWindows
,
// Enable null safety everywhere.
// Enable null safety everywhere.
dartSdkVersionBounds:
"'>=
$dartSdk
<3.0.0'"
,
dartSdkVersionBounds:
"'>=
$dartSdk
<3.0.0'"
,
implementationTests:
boolArgDeprecated
(
'implementation-tests'
),
implementationTests:
boolArgDeprecated
(
'implementation-tests'
),
...
@@ -309,6 +330,7 @@ class CreateCommand extends CreateBase {
...
@@ -309,6 +330,7 @@ class CreateCommand extends CreateBase {
final
Directory
relativeDir
=
globals
.
fs
.
directory
(
projectDirPath
);
final
Directory
relativeDir
=
globals
.
fs
.
directory
(
projectDirPath
);
int
generatedFileCount
=
0
;
int
generatedFileCount
=
0
;
final
PubContext
pubContext
;
switch
(
template
)
{
switch
(
template
)
{
case
FlutterProjectType
.
app
:
case
FlutterProjectType
.
app
:
generatedFileCount
+=
await
generateApp
(
generatedFileCount
+=
await
generateApp
(
...
@@ -319,6 +341,7 @@ class CreateCommand extends CreateBase {
...
@@ -319,6 +341,7 @@ class CreateCommand extends CreateBase {
printStatusWhenWriting:
!
creatingNewProject
,
printStatusWhenWriting:
!
creatingNewProject
,
projectType:
template
,
projectType:
template
,
);
);
pubContext
=
PubContext
.
create
;
break
;
break
;
case
FlutterProjectType
.
skeleton
:
case
FlutterProjectType
.
skeleton
:
generatedFileCount
+=
await
generateApp
(
generatedFileCount
+=
await
generateApp
(
...
@@ -329,6 +352,7 @@ class CreateCommand extends CreateBase {
...
@@ -329,6 +352,7 @@ class CreateCommand extends CreateBase {
printStatusWhenWriting:
!
creatingNewProject
,
printStatusWhenWriting:
!
creatingNewProject
,
generateMetadata:
false
,
generateMetadata:
false
,
);
);
pubContext
=
PubContext
.
create
;
break
;
break
;
case
FlutterProjectType
.
module
:
case
FlutterProjectType
.
module
:
generatedFileCount
+=
await
_generateModule
(
generatedFileCount
+=
await
_generateModule
(
...
@@ -337,6 +361,7 @@ class CreateCommand extends CreateBase {
...
@@ -337,6 +361,7 @@ class CreateCommand extends CreateBase {
overwrite:
overwrite
,
overwrite:
overwrite
,
printStatusWhenWriting:
!
creatingNewProject
,
printStatusWhenWriting:
!
creatingNewProject
,
);
);
pubContext
=
PubContext
.
create
;
break
;
break
;
case
FlutterProjectType
.
package
:
case
FlutterProjectType
.
package
:
generatedFileCount
+=
await
_generatePackage
(
generatedFileCount
+=
await
_generatePackage
(
...
@@ -345,6 +370,7 @@ class CreateCommand extends CreateBase {
...
@@ -345,6 +370,7 @@ class CreateCommand extends CreateBase {
overwrite:
overwrite
,
overwrite:
overwrite
,
printStatusWhenWriting:
!
creatingNewProject
,
printStatusWhenWriting:
!
creatingNewProject
,
);
);
pubContext
=
PubContext
.
createPackage
;
break
;
break
;
case
FlutterProjectType
.
plugin
:
case
FlutterProjectType
.
plugin
:
generatedFileCount
+=
await
_generateMethodChannelPlugin
(
generatedFileCount
+=
await
_generateMethodChannelPlugin
(
...
@@ -354,6 +380,7 @@ class CreateCommand extends CreateBase {
...
@@ -354,6 +380,7 @@ class CreateCommand extends CreateBase {
printStatusWhenWriting:
!
creatingNewProject
,
printStatusWhenWriting:
!
creatingNewProject
,
projectType:
template
,
projectType:
template
,
);
);
pubContext
=
PubContext
.
createPlugin
;
break
;
break
;
case
FlutterProjectType
.
ffiPlugin
:
case
FlutterProjectType
.
ffiPlugin
:
generatedFileCount
+=
await
_generateFfiPlugin
(
generatedFileCount
+=
await
_generateFfiPlugin
(
...
@@ -363,8 +390,26 @@ class CreateCommand extends CreateBase {
...
@@ -363,8 +390,26 @@ class CreateCommand extends CreateBase {
printStatusWhenWriting:
!
creatingNewProject
,
printStatusWhenWriting:
!
creatingNewProject
,
projectType:
template
,
projectType:
template
,
);
);
pubContext
=
PubContext
.
createPlugin
;
break
;
break
;
}
}
if
(
boolArgDeprecated
(
'pub'
))
{
final
FlutterProject
project
=
FlutterProject
.
fromDirectory
(
relativeDir
);
await
pub
.
get
(
context:
pubContext
,
project:
project
,
offline:
boolArgDeprecated
(
'offline'
),
);
await
project
.
ensureReadyForPlatformSpecificTooling
(
androidPlatform:
includeAndroid
,
iosPlatform:
includeIos
,
linuxPlatform:
includeLinux
,
macOSPlatform:
includeMacos
,
windowsPlatform:
includeWindows
,
webPlatform:
includeWeb
,
);
}
if
(
sampleCode
!=
null
)
{
if
(
sampleCode
!=
null
)
{
generatedFileCount
+=
_applySample
(
relativeDir
,
sampleCode
);
generatedFileCount
+=
_applySample
(
relativeDir
,
sampleCode
);
}
}
...
@@ -447,18 +492,6 @@ Your $application code is in $relativeAppMain.
...
@@ -447,18 +492,6 @@ Your $application code is in $relativeAppMain.
overwrite:
overwrite
,
overwrite:
overwrite
,
printStatusWhenWriting:
printStatusWhenWriting
,
printStatusWhenWriting:
printStatusWhenWriting
,
);
);
if
(
boolArgDeprecated
(
'pub'
))
{
await
pub
.
get
(
context:
PubContext
.
create
,
directory:
directory
.
path
,
offline:
boolArgDeprecated
(
'offline'
),
);
final
FlutterProject
project
=
FlutterProject
.
fromDirectory
(
directory
);
await
project
.
ensureReadyForPlatformSpecificTooling
(
androidPlatform:
true
,
iosPlatform:
true
,
);
}
return
generatedCount
;
return
generatedCount
;
}
}
...
@@ -480,13 +513,6 @@ Your $application code is in $relativeAppMain.
...
@@ -480,13 +513,6 @@ Your $application code is in $relativeAppMain.
overwrite:
overwrite
,
overwrite:
overwrite
,
printStatusWhenWriting:
printStatusWhenWriting
,
printStatusWhenWriting:
printStatusWhenWriting
,
);
);
if
(
boolArgDeprecated
(
'pub'
))
{
await
pub
.
get
(
context:
PubContext
.
createPackage
,
directory:
directory
.
path
,
offline:
boolArgDeprecated
(
'offline'
),
);
}
return
generatedCount
;
return
generatedCount
;
}
}
...
@@ -526,14 +552,6 @@ Your $application code is in $relativeAppMain.
...
@@ -526,14 +552,6 @@ Your $application code is in $relativeAppMain.
printStatusWhenWriting:
printStatusWhenWriting
,
printStatusWhenWriting:
printStatusWhenWriting
,
);
);
if
(
boolArgDeprecated
(
'pub'
))
{
await
pub
.
get
(
context:
PubContext
.
createPlugin
,
directory:
directory
.
path
,
offline:
boolArgDeprecated
(
'offline'
),
);
}
final
FlutterProject
project
=
FlutterProject
.
fromDirectory
(
directory
);
final
FlutterProject
project
=
FlutterProject
.
fromDirectory
(
directory
);
final
bool
generateAndroid
=
templateContext
[
'android'
]
==
true
;
final
bool
generateAndroid
=
templateContext
[
'android'
]
==
true
;
if
(
generateAndroid
)
{
if
(
generateAndroid
)
{
...
@@ -604,14 +622,6 @@ Your $application code is in $relativeAppMain.
...
@@ -604,14 +622,6 @@ Your $application code is in $relativeAppMain.
printStatusWhenWriting:
printStatusWhenWriting
,
printStatusWhenWriting:
printStatusWhenWriting
,
);
);
if
(
boolArgDeprecated
(
'pub'
))
{
await
pub
.
get
(
context:
PubContext
.
createPlugin
,
directory:
directory
.
path
,
offline:
boolArgDeprecated
(
'offline'
),
);
}
final
FlutterProject
project
=
FlutterProject
.
fromDirectory
(
directory
);
final
FlutterProject
project
=
FlutterProject
.
fromDirectory
(
directory
);
final
bool
generateAndroid
=
templateContext
[
'android'
]
==
true
;
final
bool
generateAndroid
=
templateContext
[
'android'
]
==
true
;
if
(
generateAndroid
)
{
if
(
generateAndroid
)
{
...
...
packages/flutter_tools/lib/src/commands/create_base.dart
View file @
d80e994a
...
@@ -17,7 +17,6 @@ import '../build_system/build_system.dart';
...
@@ -17,7 +17,6 @@ import '../build_system/build_system.dart';
import
'../cache.dart'
;
import
'../cache.dart'
;
import
'../convert.dart'
;
import
'../convert.dart'
;
import
'../dart/generate_synthetic_packages.dart'
;
import
'../dart/generate_synthetic_packages.dart'
;
import
'../dart/pub.dart'
;
import
'../flutter_project_metadata.dart'
;
import
'../flutter_project_metadata.dart'
;
import
'../globals.dart'
as
globals
;
import
'../globals.dart'
as
globals
;
import
'../project.dart'
;
import
'../project.dart'
;
...
@@ -549,24 +548,6 @@ abstract class CreateBase extends FlutterCommand {
...
@@ -549,24 +548,6 @@ abstract class CreateBase extends FlutterCommand {
environment:
environment
,
environment:
environment
,
buildSystem:
globals
.
buildSystem
,
buildSystem:
globals
.
buildSystem
,
);
);
await
pub
.
get
(
context:
PubContext
.
create
,
directory:
directory
.
path
,
offline:
boolArgDeprecated
(
'offline'
),
// For templates that use the l10n localization tooling, make sure
// importing the generated package works right after `flutter create`.
generateSyntheticPackage:
true
,
);
await
project
.
ensureReadyForPlatformSpecificTooling
(
androidPlatform:
androidPlatform
,
iosPlatform:
iosPlatform
,
linuxPlatform:
linuxPlatform
,
macOSPlatform:
macOSPlatform
,
windowsPlatform:
windowsPlatform
,
webPlatform:
webPlatform
,
);
}
}
final
List
<
SupportedPlatform
>
platformsForMigrateConfig
=
<
SupportedPlatform
>[
SupportedPlatform
.
root
];
final
List
<
SupportedPlatform
>
platformsForMigrateConfig
=
<
SupportedPlatform
>[
SupportedPlatform
.
root
];
if
(
androidPlatform
)
{
if
(
androidPlatform
)
{
...
...
packages/flutter_tools/lib/src/commands/daemon.dart
View file @
d80e994a
...
@@ -1541,7 +1541,7 @@ class AppRunLogger extends DelegatingLogger {
...
@@ -1541,7 +1541,7 @@ class AppRunLogger extends DelegatingLogger {
}
}
@override
@override
bool
get
supportsColor
=>
throw
UnimplementedError
()
;
bool
get
supportsColor
=>
false
;
@override
@override
bool
get
hasTerminal
=>
false
;
bool
get
hasTerminal
=>
false
;
...
...
packages/flutter_tools/lib/src/commands/packages.dart
View file @
d80e994a
...
@@ -139,11 +139,10 @@ class PackagesGetCommand extends FlutterCommand {
...
@@ -139,11 +139,10 @@ class PackagesGetCommand extends FlutterCommand {
try
{
try
{
await
pub
.
get
(
await
pub
.
get
(
context:
PubContext
.
pubGet
,
context:
PubContext
.
pubGet
,
directory:
directory
,
project:
flutterProject
,
upgrade:
upgrade
,
upgrade:
upgrade
,
shouldSkipThirdPartyGenerator:
false
,
shouldSkipThirdPartyGenerator:
false
,
offline:
boolArgDeprecated
(
'offline'
),
offline:
boolArgDeprecated
(
'offline'
),
generateSyntheticPackage:
flutterProject
.
manifest
.
generateSyntheticPackage
,
);
);
pubGetTimer
.
stop
();
pubGetTimer
.
stop
();
globals
.
flutterUsage
.
sendTiming
(
'pub'
,
'get'
,
pubGetTimer
.
elapsed
,
label:
'success'
);
globals
.
flutterUsage
.
sendTiming
(
'pub'
,
'get'
,
pubGetTimer
.
elapsed
,
label:
'success'
);
...
@@ -172,13 +171,14 @@ class PackagesGetCommand extends FlutterCommand {
...
@@ -172,13 +171,14 @@ class PackagesGetCommand extends FlutterCommand {
}
}
final
FlutterProject
rootProject
=
FlutterProject
.
fromDirectory
(
globals
.
fs
.
directory
(
target
));
final
FlutterProject
rootProject
=
FlutterProject
.
fromDirectory
(
globals
.
fs
.
directory
(
target
));
// This will also resolve dependencies for the example folder,
await
_runPubGet
(
target
,
rootProject
);
await
_runPubGet
(
target
,
rootProject
);
await
rootProject
.
regeneratePlatformSpecificTooling
();
// Get/upgrade packages in example app as well
// We need to regenerate the platform specific tooling for both the project
// itself and example (if present).
await
rootProject
.
regeneratePlatformSpecificTooling
();
if
(
rootProject
.
hasExampleApp
&&
rootProject
.
example
.
pubspecFile
.
existsSync
())
{
if
(
rootProject
.
hasExampleApp
&&
rootProject
.
example
.
pubspecFile
.
existsSync
())
{
final
FlutterProject
exampleProject
=
rootProject
.
example
;
final
FlutterProject
exampleProject
=
rootProject
.
example
;
await
_runPubGet
(
exampleProject
.
directory
.
path
,
exampleProject
);
await
exampleProject
.
regeneratePlatformSpecificTooling
();
await
exampleProject
.
regeneratePlatformSpecificTooling
();
}
}
...
@@ -211,7 +211,7 @@ class PackagesTestCommand extends FlutterCommand {
...
@@ -211,7 +211,7 @@ class PackagesTestCommand extends FlutterCommand {
@override
@override
Future
<
FlutterCommandResult
>
runCommand
()
async
{
Future
<
FlutterCommandResult
>
runCommand
()
async
{
await
pub
.
batch
(<
String
>[
'run'
,
'test'
,
...
argResults
!.
rest
],
context:
PubContext
.
runTest
,
retry:
false
);
await
pub
.
batch
(<
String
>[
'run'
,
'test'
,
...
argResults
!.
rest
],
context:
PubContext
.
runTest
);
return
FlutterCommandResult
.
success
();
return
FlutterCommandResult
.
success
();
}
}
}
}
...
...
packages/flutter_tools/lib/src/commands/update_packages.dart
View file @
d80e994a
...
@@ -16,6 +16,7 @@ import '../base/task_queue.dart';
...
@@ -16,6 +16,7 @@ import '../base/task_queue.dart';
import
'../cache.dart'
;
import
'../cache.dart'
;
import
'../dart/pub.dart'
;
import
'../dart/pub.dart'
;
import
'../globals.dart'
as
globals
;
import
'../globals.dart'
as
globals
;
import
'../project.dart'
;
import
'../runner/flutter_command.dart'
;
import
'../runner/flutter_command.dart'
;
/// Map from package name to package version, used to artificially pin a pub
/// Map from package name to package version, used to artificially pin a pub
...
@@ -399,7 +400,7 @@ class UpdatePackagesCommand extends FlutterCommand {
...
@@ -399,7 +400,7 @@ class UpdatePackagesCommand extends FlutterCommand {
// needed packages to the pub cache, upgrading if requested.
// needed packages to the pub cache, upgrading if requested.
await
pub
.
get
(
await
pub
.
get
(
context:
PubContext
.
updatePackages
,
context:
PubContext
.
updatePackages
,
directory:
tempDir
.
path
,
project:
FlutterProject
.
fromDirectory
(
tempDir
)
,
upgrade:
doUpgrade
,
upgrade:
doUpgrade
,
offline:
boolArgDeprecated
(
'offline'
),
offline:
boolArgDeprecated
(
'offline'
),
flutterRootOverride:
temporaryFlutterSdk
?.
path
,
flutterRootOverride:
temporaryFlutterSdk
?.
path
,
...
@@ -422,7 +423,6 @@ class UpdatePackagesCommand extends FlutterCommand {
...
@@ -422,7 +423,6 @@ class UpdatePackagesCommand extends FlutterCommand {
context:
PubContext
.
updatePackages
,
context:
PubContext
.
updatePackages
,
directory:
tempDir
.
path
,
directory:
tempDir
.
path
,
filter:
tree
.
fill
,
filter:
tree
.
fill
,
retry:
false
,
// errors here are usually fatal since we're not hitting the network
);
);
}
}
}
finally
{
}
finally
{
...
@@ -502,7 +502,7 @@ class UpdatePackagesCommand extends FlutterCommand {
...
@@ -502,7 +502,7 @@ class UpdatePackagesCommand extends FlutterCommand {
stopwatch
.
start
();
stopwatch
.
start
();
await
pub
.
get
(
await
pub
.
get
(
context:
PubContext
.
updatePackages
,
context:
PubContext
.
updatePackages
,
directory:
dir
.
path
,
project:
FlutterProject
.
fromDirectory
(
dir
)
,
// All dependencies should already have been downloaded by the fake
// All dependencies should already have been downloaded by the fake
// package, so the concurrent checks can all happen offline.
// package, so the concurrent checks can all happen offline.
offline:
true
,
offline:
true
,
...
...
packages/flutter_tools/lib/src/commands/upgrade.dart
View file @
d80e994a
...
@@ -12,6 +12,7 @@ import '../cache.dart';
...
@@ -12,6 +12,7 @@ import '../cache.dart';
import
'../dart/pub.dart'
;
import
'../dart/pub.dart'
;
import
'../globals.dart'
as
globals
;
import
'../globals.dart'
as
globals
;
import
'../persistent_tool_state.dart'
;
import
'../persistent_tool_state.dart'
;
import
'../project.dart'
;
import
'../runner/flutter_command.dart'
;
import
'../runner/flutter_command.dart'
;
import
'../version.dart'
;
import
'../version.dart'
;
import
'channel.dart'
;
import
'channel.dart'
;
...
@@ -330,7 +331,7 @@ class UpgradeCommandRunner {
...
@@ -330,7 +331,7 @@ class UpgradeCommandRunner {
globals
.
printStatus
(
''
);
globals
.
printStatus
(
''
);
await
pub
.
get
(
await
pub
.
get
(
context:
PubContext
.
pubUpgrade
,
context:
PubContext
.
pubUpgrade
,
directory:
projectRoot
,
project:
FlutterProject
.
fromDirectory
(
globals
.
fs
.
directory
(
projectRoot
))
,
upgrade:
true
,
upgrade:
true
,
);
);
}
}
...
...
packages/flutter_tools/lib/src/context_runner.dart
View file @
d80e994a
...
@@ -152,6 +152,7 @@ Future<T> runInContext<T>(
...
@@ -152,6 +152,7 @@ Future<T> runInContext<T>(
logger:
globals
.
logger
,
logger:
globals
.
logger
,
platform:
globals
.
platform
,
platform:
globals
.
platform
,
osUtils:
globals
.
os
,
osUtils:
globals
.
os
,
projectFactory:
globals
.
projectFactory
,
),
),
CocoaPods:
()
=>
CocoaPods
(
CocoaPods:
()
=>
CocoaPods
(
fileSystem:
globals
.
fs
,
fileSystem:
globals
.
fs
,
...
@@ -312,6 +313,7 @@ Future<T> runInContext<T>(
...
@@ -312,6 +313,7 @@ Future<T> runInContext<T>(
botDetector:
globals
.
botDetector
,
botDetector:
globals
.
botDetector
,
platform:
globals
.
platform
,
platform:
globals
.
platform
,
usage:
globals
.
flutterUsage
,
usage:
globals
.
flutterUsage
,
stdio:
globals
.
stdio
,
),
),
Stdio:
()
=>
Stdio
(),
Stdio:
()
=>
Stdio
(),
SystemClock:
()
=>
const
SystemClock
(),
SystemClock:
()
=>
const
SystemClock
(),
...
...
packages/flutter_tools/lib/src/dart/pub.dart
View file @
d80e994a
...
@@ -12,12 +12,14 @@ import '../base/common.dart';
...
@@ -12,12 +12,14 @@ import '../base/common.dart';
import
'../base/context.dart'
;
import
'../base/context.dart'
;
import
'../base/file_system.dart'
;
import
'../base/file_system.dart'
;
import
'../base/io.dart'
as
io
;
import
'../base/io.dart'
as
io
;
import
'../base/io.dart'
;
import
'../base/logger.dart'
;
import
'../base/logger.dart'
;
import
'../base/platform.dart'
;
import
'../base/platform.dart'
;
import
'../base/process.dart'
;
import
'../base/process.dart'
;
import
'../cache.dart'
;
import
'../cache.dart'
;
import
'../convert.dart'
;
import
'../convert.dart'
;
import
'../dart/package_map.dart'
;
import
'../dart/package_map.dart'
;
import
'../project.dart'
;
import
'../reporting/reporting.dart'
;
import
'../reporting/reporting.dart'
;
/// The [Pub] instance.
/// The [Pub] instance.
...
@@ -148,9 +150,10 @@ abstract class Pub {
...
@@ -148,9 +150,10 @@ abstract class Pub {
required
Platform
platform
,
required
Platform
platform
,
required
BotDetector
botDetector
,
required
BotDetector
botDetector
,
required
Usage
usage
,
required
Usage
usage
,
required
Stdio
stdio
,
})
=
_DefaultPub
;
})
=
_DefaultPub
;
/// Runs `pub get`.
/// Runs `pub get`
or `pub upgrade` for [project]
.
///
///
/// [context] provides extra information to package server requests to
/// [context] provides extra information to package server requests to
/// understand usage.
/// understand usage.
...
@@ -158,13 +161,13 @@ abstract class Pub {
...
@@ -158,13 +161,13 @@ abstract class Pub {
/// If [shouldSkipThirdPartyGenerator] is true, the overall pub get will be
/// If [shouldSkipThirdPartyGenerator] is true, the overall pub get will be
/// skipped if the package config file has a "generator" other than "pub".
/// skipped if the package config file has a "generator" other than "pub".
/// Defaults to true.
/// Defaults to true.
/// Will also resolve dependencies in the example folder if present.
Future
<
void
>
get
({
Future
<
void
>
get
({
required
PubContext
context
,
required
PubContext
context
,
String
?
directory
,
required
FlutterProject
project
,
bool
skipIfAbsent
=
false
,
bool
skipIfAbsent
=
false
,
bool
upgrade
=
false
,
bool
upgrade
=
false
,
bool
offline
=
false
,
bool
offline
=
false
,
bool
generateSyntheticPackage
=
false
,
String
?
flutterRootOverride
,
String
?
flutterRootOverride
,
bool
checkUpToDate
=
false
,
bool
checkUpToDate
=
false
,
bool
shouldSkipThirdPartyGenerator
=
true
,
bool
shouldSkipThirdPartyGenerator
=
true
,
...
@@ -177,9 +180,8 @@ abstract class Pub {
...
@@ -177,9 +180,8 @@ abstract class Pub {
/// the corresponding stream of this process, optionally applying filtering.
/// the corresponding stream of this process, optionally applying filtering.
/// The pub process will not receive anything on its stdin stream.
/// The pub process will not receive anything on its stdin stream.
///
///
/// The `--trace` argument is passed to `pub` (by mutating the provided
/// The `--trace` argument is passed to `pub` when `showTraceForErrors`
/// `arguments` list) when `showTraceForErrors` is true, and when `showTraceForErrors`
/// `isRunningOnBot` is true.
/// is null/unset, and `isRunningOnBot` is true.
///
///
/// [context] provides extra information to package server requests to
/// [context] provides extra information to package server requests to
/// understand usage.
/// understand usage.
...
@@ -189,8 +191,6 @@ abstract class Pub {
...
@@ -189,8 +191,6 @@ abstract class Pub {
String
?
directory
,
String
?
directory
,
MessageFilter
?
filter
,
MessageFilter
?
filter
,
String
failureMessage
=
'pub failed'
,
String
failureMessage
=
'pub failed'
,
required
bool
retry
,
bool
?
showTraceForErrors
,
});
});
/// Runs pub in 'interactive' mode.
/// Runs pub in 'interactive' mode.
...
@@ -214,6 +214,7 @@ class _DefaultPub implements Pub {
...
@@ -214,6 +214,7 @@ class _DefaultPub implements Pub {
required
Platform
platform
,
required
Platform
platform
,
required
BotDetector
botDetector
,
required
BotDetector
botDetector
,
required
Usage
usage
,
required
Usage
usage
,
required
Stdio
stdio
,
})
:
_fileSystem
=
fileSystem
,
})
:
_fileSystem
=
fileSystem
,
_logger
=
logger
,
_logger
=
logger
,
_platform
=
platform
,
_platform
=
platform
,
...
@@ -223,7 +224,8 @@ class _DefaultPub implements Pub {
...
@@ -223,7 +224,8 @@ class _DefaultPub implements Pub {
logger:
logger
,
logger:
logger
,
processManager:
processManager
,
processManager:
processManager
,
),
),
_processManager
=
processManager
;
_processManager
=
processManager
,
_stdio
=
stdio
;
final
FileSystem
_fileSystem
;
final
FileSystem
_fileSystem
;
final
Logger
_logger
;
final
Logger
_logger
;
...
@@ -232,40 +234,40 @@ class _DefaultPub implements Pub {
...
@@ -232,40 +234,40 @@ class _DefaultPub implements Pub {
final
BotDetector
_botDetector
;
final
BotDetector
_botDetector
;
final
Usage
_usage
;
final
Usage
_usage
;
final
ProcessManager
_processManager
;
final
ProcessManager
_processManager
;
final
Stdio
_stdio
;
@override
@override
Future
<
void
>
get
({
Future
<
void
>
get
({
required
PubContext
context
,
required
PubContext
context
,
String
?
directory
,
required
FlutterProject
project
,
bool
skipIfAbsent
=
false
,
bool
skipIfAbsent
=
false
,
bool
upgrade
=
false
,
bool
upgrade
=
false
,
bool
offline
=
false
,
bool
offline
=
false
,
bool
generateSyntheticPackage
=
false
,
bool
generateSyntheticPackage
=
false
,
bool
generateSyntheticPackageForExample
=
false
,
String
?
flutterRootOverride
,
String
?
flutterRootOverride
,
bool
checkUpToDate
=
false
,
bool
checkUpToDate
=
false
,
bool
shouldSkipThirdPartyGenerator
=
true
,
bool
shouldSkipThirdPartyGenerator
=
true
,
bool
printProgress
=
true
,
bool
printProgress
=
true
,
})
async
{
})
async
{
directory
??=
_fileSystem
.
currentDirectory
.
path
;
final
String
directory
=
project
.
directory
.
path
;
final
File
packageConfigFile
=
_fileSystem
.
file
(
final
File
packageConfigFile
=
project
.
packageConfigFile
;
_fileSystem
.
path
.
join
(
directory
,
'.dart_tool'
,
'package_config.json'
));
final
Directory
generatedDirectory
=
_fileSystem
.
directory
(
final
Directory
generatedDirectory
=
_fileSystem
.
directory
(
_fileSystem
.
path
.
join
(
directory
,
'.dart_tool'
,
'flutter_gen'
));
_fileSystem
.
path
.
join
(
directory
,
'.dart_tool'
,
'flutter_gen'
));
final
File
lastVersion
=
_fileSystem
.
file
(
final
File
lastVersion
=
_fileSystem
.
file
(
_fileSystem
.
path
.
join
(
directory
,
'.dart_tool'
,
'version'
));
_fileSystem
.
path
.
join
(
directory
,
'.dart_tool'
,
'version'
));
final
File
currentVersion
=
_fileSystem
.
file
(
final
File
currentVersion
=
_fileSystem
.
file
(
_fileSystem
.
path
.
join
(
Cache
.
flutterRoot
!,
'version'
));
_fileSystem
.
path
.
join
(
Cache
.
flutterRoot
!,
'version'
));
final
File
pubspecYaml
=
_fileSystem
.
file
(
final
File
pubspecYaml
=
project
.
pubspecFile
;
_fileSystem
.
path
.
join
(
directory
,
'pubspec.yaml'
));
final
File
pubLockFile
=
_fileSystem
.
file
(
final
File
pubLockFile
=
_fileSystem
.
file
(
_fileSystem
.
path
.
join
(
directory
,
'pubspec.lock'
)
_fileSystem
.
path
.
join
(
directory
,
'pubspec.lock'
)
);
);
if
(
shouldSkipThirdPartyGenerator
&&
packageConfigFile
.
existsSync
())
{
if
(
shouldSkipThirdPartyGenerator
&&
p
roject
.
p
ackageConfigFile
.
existsSync
())
{
Map
<
String
,
Object
?>
packageConfigMap
;
Map
<
String
,
Object
?>
packageConfigMap
;
try
{
try
{
packageConfigMap
=
jsonDecode
(
packageConfigMap
=
jsonDecode
(
packageConfigFile
.
readAsStringSync
(),
p
roject
.
p
ackageConfigFile
.
readAsStringSync
(),
)
as
Map
<
String
,
Object
?>;
)
as
Map
<
String
,
Object
?>;
}
on
FormatException
{
}
on
FormatException
{
packageConfigMap
=
<
String
,
Object
?>{};
packageConfigMap
=
<
String
,
Object
?>{};
...
@@ -298,31 +300,118 @@ class _DefaultPub implements Pub {
...
@@ -298,31 +300,118 @@ class _DefaultPub implements Pub {
}
}
final
String
command
=
upgrade
?
'upgrade'
:
'get'
;
final
String
command
=
upgrade
?
'upgrade'
:
'get'
;
final
Status
?
status
=
printProgress
?
_logger
.
startProgress
(
'Running "flutter pub
$command
" in
${_fileSystem.path.basename(directory)}
...'
,
)
:
null
;
final
bool
verbose
=
_logger
.
isVerbose
;
final
bool
verbose
=
_logger
.
isVerbose
;
final
List
<
String
>
args
=
<
String
>[
final
List
<
String
>
args
=
<
String
>[
if
(
_logger
.
supportsColor
)
'--color'
,
if
(
verbose
)
if
(
verbose
)
'--verbose'
'--verbose'
,
else
'--directory'
,
'--verbosity=warning'
,
_fileSystem
.
path
.
relative
(
directory
)
,
...<
String
>[
...<
String
>[
command
,
command
,
'--no-precompile'
,
],
],
if
(
offline
)
if
(
offline
)
'--offline'
,
'--offline'
,
'--example'
,
];
];
try
{
await
_runWithRetries
(
await
batch
(
args
,
args
,
command:
command
,
context:
context
,
context:
context
,
directory:
directory
,
directory:
directory
,
failureMessage:
'pub
$command
failed'
,
failureMessage:
'pub
$command
failed'
,
retry:
!
offline
,
retry:
!
offline
,
flutterRootOverride:
flutterRootOverride
,
flutterRootOverride:
flutterRootOverride
,
printProgress:
printProgress
);
if
(!
packageConfigFile
.
existsSync
())
{
throwToolExit
(
'
$directory
: pub did not create .dart_tools/package_config.json file.'
);
}
lastVersion
.
writeAsStringSync
(
currentVersion
.
readAsStringSync
());
await
_updatePackageConfig
(
packageConfigFile
,
generatedDirectory
,
project
.
manifest
.
generateSyntheticPackage
,
);
if
(
project
.
hasExampleApp
&&
project
.
example
.
pubspecFile
.
existsSync
())
{
final
Directory
exampleGeneratedDirectory
=
_fileSystem
.
directory
(
_fileSystem
.
path
.
join
(
project
.
example
.
directory
.
path
,
'.dart_tool'
,
'flutter_gen'
));
await
_updatePackageConfig
(
project
.
example
.
packageConfigFile
,
exampleGeneratedDirectory
,
project
.
example
.
manifest
.
generateSyntheticPackage
,
);
}
}
/// Runs pub with [arguments].
///
/// Retries the command as long as the exit code is
/// `_kPubExitCodeUnavailable`.
///
/// Prints the stderr and stdout of the last run.
///
/// Sends an analytics event
Future
<
void
>
_runWithRetries
(
List
<
String
>
arguments
,
{
required
String
command
,
required
bool
printProgress
,
required
PubContext
context
,
required
bool
retry
,
required
String
directory
,
String
failureMessage
=
'pub failed'
,
String
?
flutterRootOverride
,
})
async
{
int
exitCode
;
int
attempts
=
0
;
int
duration
=
1
;
List
<
_OutputLine
>?
output
;
StreamSubscription
<
String
>
recordLines
(
Stream
<
List
<
int
>>
stream
,
_OutputStream
streamName
)
{
return
stream
.
transform
<
String
>(
utf8
.
decoder
)
.
transform
<
String
>(
const
LineSplitter
())
.
listen
((
String
line
)
=>
output
!.
add
(
_OutputLine
(
line
,
streamName
)));
}
final
Status
?
status
=
printProgress
?
_logger
.
startProgress
(
'Running "flutter pub
$command
" in
${_fileSystem.path.basename(directory)}
...'
,)
:
null
;
final
List
<
String
>
pubCommand
=
_pubCommand
(
arguments
);
final
Map
<
String
,
String
>
pubEnvironment
=
await
_createPubEnvironment
(
context
,
flutterRootOverride
);
try
{
do
{
output
=
<
_OutputLine
>[];
attempts
+=
1
;
final
io
.
Process
process
=
await
_processUtils
.
start
(
pubCommand
,
workingDirectory:
_fileSystem
.
path
.
current
,
environment:
pubEnvironment
,
);
);
final
StreamSubscription
<
String
>
stdoutSubscription
=
recordLines
(
process
.
stdout
,
_OutputStream
.
stdout
);
final
StreamSubscription
<
String
>
stderrSubscription
=
recordLines
(
process
.
stderr
,
_OutputStream
.
stderr
);
exitCode
=
await
process
.
exitCode
;
unawaited
(
stdoutSubscription
.
cancel
());
unawaited
(
stderrSubscription
.
cancel
());
if
(
retry
&&
exitCode
==
_kPubExitCodeUnavailable
)
{
_logger
.
printStatus
(
'
$failureMessage
(server unavailable) -- attempting retry
$attempts
in
$duration
'
'second
${ duration == 1 ? "" : "s"}
...'
,
);
await
Future
<
void
>.
delayed
(
Duration
(
seconds:
duration
));
if
(
duration
<
64
)
{
duration
*=
2
;
}
// This will cause a retry.
output
=
null
;
}
}
while
(
output
==
null
);
status
?.
stop
();
status
?.
stop
();
// The exception is rethrown, so don't catch only Exceptions.
// The exception is rethrown, so don't catch only Exceptions.
}
catch
(
exception
)
{
// ignore: avoid_catches_without_on_clauses
}
catch
(
exception
)
{
// ignore: avoid_catches_without_on_clauses
...
@@ -342,16 +431,46 @@ class _DefaultPub implements Pub {
...
@@ -342,16 +431,46 @@ class _DefaultPub implements Pub {
rethrow
;
rethrow
;
}
}
if
(!
packageConfigFile
.
existsSync
())
{
if
(
printProgress
)
{
throwToolExit
(
'
$directory
: pub did not create .dart_tools/package_config.json file.'
);
// Show the output of the last run.
for
(
final
_OutputLine
line
in
output
)
{
switch
(
line
.
stream
)
{
case
_OutputStream
.
stdout
:
_stdio
.
stdoutWrite
(
'
${line.line}
\n
'
);
break
;
case
_OutputStream
.
stderr
:
_stdio
.
stderrWrite
(
'
${line.line}
\n
'
);
break
;
}
}
lastVersion
.
writeAsStringSync
(
currentVersion
.
readAsStringSync
());
}
await
_updatePackageConfig
(
}
packageConfigFile
,
generatedDirectory
,
final
int
code
=
exitCode
;
generateSyntheticPackage
,
String
result
=
'success'
;
if
(
output
.
any
((
_OutputLine
line
)
=>
line
.
line
.
contains
(
'version solving failed'
)))
{
result
=
'version-solving-failed'
;
}
else
if
(
code
!=
0
)
{
result
=
'failure'
;
}
PubResultEvent
(
context:
context
.
toAnalyticsString
(),
result:
result
,
usage:
_usage
,
).
send
();
final
String
lastPubMessage
=
output
.
isEmpty
?
'no message'
:
output
.
last
.
line
;
if
(
code
!=
0
)
{
final
StringBuffer
buffer
=
StringBuffer
(
'
$failureMessage
\n
'
);
buffer
.
writeln
(
'command: "
${pubCommand.join(' ')}
"'
);
buffer
.
write
(
_stringifyPubEnv
(
pubEnvironment
));
buffer
.
writeln
(
'exit code:
$code
'
);
buffer
.
writeln
(
'last line of pub output: "
${lastPubMessage.trim()}
"'
);
throwToolExit
(
buffer
.
toString
(),
exitCode:
code
,
);
);
}
}
}
// For surfacing pub env in crash reporting
// For surfacing pub env in crash reporting
String
_stringifyPubEnv
(
Map
<
String
,
String
>
map
,
{
String
prefix
=
'pub env'
})
{
String
_stringifyPubEnv
(
Map
<
String
,
String
>
map
,
{
String
prefix
=
'pub env'
})
{
...
@@ -374,19 +493,13 @@ class _DefaultPub implements Pub {
...
@@ -374,19 +493,13 @@ class _DefaultPub implements Pub {
String
?
directory
,
String
?
directory
,
MessageFilter
?
filter
,
MessageFilter
?
filter
,
String
failureMessage
=
'pub failed'
,
String
failureMessage
=
'pub failed'
,
required
bool
retry
,
bool
?
showTraceForErrors
,
String
?
flutterRootOverride
,
String
?
flutterRootOverride
,
})
async
{
})
async
{
showTraceForErrors
??
=
await
_botDetector
.
isRunningOnBot
;
final
bool
showTraceForErrors
=
await
_botDetector
.
isRunningOnBot
;
String
lastPubMessage
=
'no message'
;
String
lastPubMessage
=
'no message'
;
bool
versionSolvingFailed
=
false
;
String
?
filterWrapper
(
String
line
)
{
String
?
filterWrapper
(
String
line
)
{
lastPubMessage
=
line
;
lastPubMessage
=
line
;
if
(
line
.
contains
(
'version solving failed'
))
{
versionSolvingFailed
=
true
;
}
if
(
filter
==
null
)
{
if
(
filter
==
null
)
{
return
line
;
return
line
;
}
}
...
@@ -396,44 +509,17 @@ class _DefaultPub implements Pub {
...
@@ -396,44 +509,17 @@ class _DefaultPub implements Pub {
if
(
showTraceForErrors
)
{
if
(
showTraceForErrors
)
{
arguments
.
insert
(
0
,
'--trace'
);
arguments
.
insert
(
0
,
'--trace'
);
}
}
int
attempts
=
0
;
int
duration
=
1
;
int
code
;
final
List
<
String
>
pubCommand
=
_pubCommand
(
arguments
);
final
Map
<
String
,
String
>
pubEnvironment
=
await
_createPubEnvironment
(
context
,
flutterRootOverride
);
final
Map
<
String
,
String
>
pubEnvironment
=
await
_createPubEnvironment
(
context
,
flutterRootOverride
);
while
(
true
)
{
final
List
<
String
>
pubCommand
=
_pubCommand
(
arguments
);
attempts
+=
1
;
final
int
code
=
await
_processUtils
.
stream
(
code
=
await
_processUtils
.
stream
(
pubCommand
,
pubCommand
,
workingDirectory:
directory
,
workingDirectory:
directory
,
mapFunction:
filterWrapper
,
// may set versionSolvingFailed, lastPubMessage
mapFunction:
filterWrapper
,
// may set versionSolvingFailed, lastPubMessage
environment:
pubEnvironment
,
environment:
pubEnvironment
,
);
);
String
?
message
;
if
(
retry
)
{
if
(
code
==
_kPubExitCodeUnavailable
)
{
message
=
'server unavailable'
;
}
}
if
(
message
==
null
)
{
break
;
}
versionSolvingFailed
=
false
;
_logger
.
printStatus
(
'
$failureMessage
(
$message
) -- attempting retry
$attempts
in
$duration
'
'second
${ duration == 1 ? "" : "s"}
...'
,
);
await
Future
<
void
>.
delayed
(
Duration
(
seconds:
duration
));
if
(
duration
<
64
)
{
duration
*=
2
;
}
}
assert
(
code
!=
null
);
String
result
=
'success'
;
String
result
=
'success'
;
if
(
versionSolvingFailed
)
{
if
(
code
!=
0
)
{
result
=
'version-solving-failed'
;
}
else
if
(
code
!=
0
)
{
result
=
'failure'
;
result
=
'failure'
;
}
}
PubResultEvent
(
PubResultEvent
(
...
@@ -465,7 +551,10 @@ class _DefaultPub implements Pub {
...
@@ -465,7 +551,10 @@ class _DefaultPub implements Pub {
})
async
{
})
async
{
// Fully resolved pub or pub.bat is calculated based on current platform.
// Fully resolved pub or pub.bat is calculated based on current platform.
final
io
.
Process
process
=
await
_processUtils
.
start
(
final
io
.
Process
process
=
await
_processUtils
.
start
(
_pubCommand
(
arguments
),
_pubCommand
(<
String
>[
if
(
_logger
.
supportsColor
)
'--color'
,
...
arguments
,
]),
workingDirectory:
directory
,
workingDirectory:
directory
,
environment:
await
_createPubEnvironment
(
PubContext
.
interactive
),
environment:
await
_createPubEnvironment
(
PubContext
.
interactive
),
);
);
...
@@ -721,3 +810,14 @@ class _DefaultPub implements Pub {
...
@@ -721,3 +810,14 @@ class _DefaultPub implements Pub {
return
buffer
.
toString
();
return
buffer
.
toString
();
}
}
}
}
class
_OutputLine
{
_OutputLine
(
this
.
line
,
this
.
stream
);
final
String
line
;
final
_OutputStream
stream
;
}
enum
_OutputStream
{
stdout
,
stderr
,
}
packages/flutter_tools/lib/src/flutter_cache.dart
View file @
d80e994a
...
@@ -19,6 +19,7 @@ import 'cache.dart';
...
@@ -19,6 +19,7 @@ import 'cache.dart';
import
'dart/package_map.dart'
;
import
'dart/package_map.dart'
;
import
'dart/pub.dart'
;
import
'dart/pub.dart'
;
import
'globals.dart'
as
globals
;
import
'globals.dart'
as
globals
;
import
'project.dart'
;
/// An implementation of the [Cache] which provides all of Flutter's default artifacts.
/// An implementation of the [Cache] which provides all of Flutter's default artifacts.
class
FlutterCache
extends
Cache
{
class
FlutterCache
extends
Cache
{
...
@@ -29,6 +30,7 @@ class FlutterCache extends Cache {
...
@@ -29,6 +30,7 @@ class FlutterCache extends Cache {
required
super
.
fileSystem
,
required
super
.
fileSystem
,
required
Platform
platform
,
required
Platform
platform
,
required
super
.
osUtils
,
required
super
.
osUtils
,
required
FlutterProjectFactory
projectFactory
,
})
:
super
(
logger:
logger
,
platform:
platform
,
artifacts:
<
ArtifactSet
>[])
{
})
:
super
(
logger:
logger
,
platform:
platform
,
artifacts:
<
ArtifactSet
>[])
{
registerArtifact
(
MaterialFonts
(
this
));
registerArtifact
(
MaterialFonts
(
this
));
registerArtifact
(
GradleWrapper
(
this
));
registerArtifact
(
GradleWrapper
(
this
));
...
@@ -54,6 +56,7 @@ class FlutterCache extends Cache {
...
@@ -54,6 +56,7 @@ class FlutterCache extends Cache {
// before the version is determined.
// before the version is determined.
flutterRoot:
()
=>
Cache
.
flutterRoot
!,
flutterRoot:
()
=>
Cache
.
flutterRoot
!,
pub:
()
=>
pub
,
pub:
()
=>
pub
,
projectFactory:
projectFactory
,
));
));
}
}
}
}
...
@@ -70,14 +73,17 @@ class PubDependencies extends ArtifactSet {
...
@@ -70,14 +73,17 @@ class PubDependencies extends ArtifactSet {
required
String
Function
()
flutterRoot
,
required
String
Function
()
flutterRoot
,
required
Logger
logger
,
required
Logger
logger
,
required
Pub
Function
()
pub
,
required
Pub
Function
()
pub
,
required
FlutterProjectFactory
projectFactory
,
})
:
_logger
=
logger
,
})
:
_logger
=
logger
,
_flutterRoot
=
flutterRoot
,
_flutterRoot
=
flutterRoot
,
_pub
=
pub
,
_pub
=
pub
,
_projectFactory
=
projectFactory
,
super
(
DevelopmentArtifact
.
universal
);
super
(
DevelopmentArtifact
.
universal
);
final
String
Function
()
_flutterRoot
;
final
String
Function
()
_flutterRoot
;
final
Logger
_logger
;
final
Logger
_logger
;
final
Pub
Function
()
_pub
;
final
Pub
Function
()
_pub
;
final
FlutterProjectFactory
_projectFactory
;
@override
@override
Future
<
bool
>
isUpToDate
(
Future
<
bool
>
isUpToDate
(
...
@@ -118,7 +124,9 @@ class PubDependencies extends ArtifactSet {
...
@@ -118,7 +124,9 @@ class PubDependencies extends ArtifactSet {
)
async
{
)
async
{
await
_pub
().
get
(
await
_pub
().
get
(
context:
PubContext
.
pubGet
,
context:
PubContext
.
pubGet
,
directory:
fileSystem
.
path
.
join
(
_flutterRoot
(),
'packages'
,
'flutter_tools'
),
project:
_projectFactory
.
fromDirectory
(
fileSystem
.
directory
(
fileSystem
.
path
.
join
(
_flutterRoot
(),
'packages'
,
'flutter_tools'
))
),
offline:
offline
offline:
offline
);
);
}
}
...
...
packages/flutter_tools/lib/src/runner/flutter_command.dart
View file @
d80e994a
...
@@ -1355,7 +1355,7 @@ abstract class FlutterCommand extends Command<void> {
...
@@ -1355,7 +1355,7 @@ abstract class FlutterCommand extends Command<void> {
await
pub
.
get
(
await
pub
.
get
(
context:
PubContext
.
getVerifyContext
(
name
),
context:
PubContext
.
getVerifyContext
(
name
),
generateSyntheticPackage:
project
.
manifest
.
generateSyntheticPackage
,
project:
project
,
checkUpToDate:
cachePubGet
,
checkUpToDate:
cachePubGet
,
);
);
await
project
.
regeneratePlatformSpecificTooling
();
await
project
.
regeneratePlatformSpecificTooling
();
...
...
packages/flutter_tools/test/commands.shard/hermetic/analyze_continuously_test.dart
View file @
d80e994a
...
@@ -17,12 +17,14 @@ import 'package:flutter_tools/src/commands/analyze.dart';
...
@@ -17,12 +17,14 @@ import 'package:flutter_tools/src/commands/analyze.dart';
import
'package:flutter_tools/src/dart/analysis.dart'
;
import
'package:flutter_tools/src/dart/analysis.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/project.dart'
;
import
'package:flutter_tools/src/project_validator.dart'
;
import
'package:flutter_tools/src/project_validator.dart'
;
import
'package:process/process.dart'
;
import
'package:process/process.dart'
;
import
'../../src/common.dart'
;
import
'../../src/common.dart'
;
import
'../../src/context.dart'
;
import
'../../src/context.dart'
;
import
'../../src/fake_process_manager.dart'
;
import
'../../src/fake_process_manager.dart'
;
import
'../../src/fakes.dart'
;
import
'../../src/test_flutter_command_runner.dart'
;
import
'../../src/test_flutter_command_runner.dart'
;
void
main
(
)
{
void
main
(
)
{
...
@@ -36,6 +38,7 @@ void main() {
...
@@ -36,6 +38,7 @@ void main() {
late
ProcessManager
processManager
;
late
ProcessManager
processManager
;
late
AnsiTerminal
terminal
;
late
AnsiTerminal
terminal
;
late
Logger
logger
;
late
Logger
logger
;
late
FakeStdio
mockStdio
;
setUp
(()
{
setUp
(()
{
fileSystem
=
globals
.
localFileSystem
;
fileSystem
=
globals
.
localFileSystem
;
...
@@ -44,6 +47,7 @@ void main() {
...
@@ -44,6 +47,7 @@ void main() {
terminal
=
AnsiTerminal
(
platform:
platform
,
stdio:
Stdio
());
terminal
=
AnsiTerminal
(
platform:
platform
,
stdio:
Stdio
());
logger
=
BufferLogger
(
outputPreferences:
OutputPreferences
.
test
(),
terminal:
terminal
);
logger
=
BufferLogger
(
outputPreferences:
OutputPreferences
.
test
(),
terminal:
terminal
);
tempDir
=
fileSystem
.
systemTempDirectory
.
createTempSync
(
'flutter_analysis_test.'
);
tempDir
=
fileSystem
.
systemTempDirectory
.
createTempSync
(
'flutter_analysis_test.'
);
mockStdio
=
FakeStdio
();
});
});
tearDown
(()
{
tearDown
(()
{
...
@@ -80,10 +84,11 @@ void main() {
...
@@ -80,10 +84,11 @@ void main() {
platform:
const
LocalPlatform
(),
platform:
const
LocalPlatform
(),
botDetector:
globals
.
botDetector
,
botDetector:
globals
.
botDetector
,
usage:
globals
.
flutterUsage
,
usage:
globals
.
flutterUsage
,
stdio:
mockStdio
,
);
);
await
pub
.
get
(
await
pub
.
get
(
context:
PubContext
.
flutterTests
,
context:
PubContext
.
flutterTests
,
directory:
tempDir
.
path
,
project:
FlutterProject
.
fromDirectoryTest
(
tempDir
)
,
);
);
final
AnalysisServer
server
=
AnalysisServer
(
final
AnalysisServer
server
=
AnalysisServer
(
...
@@ -119,10 +124,11 @@ void main() {
...
@@ -119,10 +124,11 @@ void main() {
platform:
const
LocalPlatform
(),
platform:
const
LocalPlatform
(),
usage:
globals
.
flutterUsage
,
usage:
globals
.
flutterUsage
,
botDetector:
globals
.
botDetector
,
botDetector:
globals
.
botDetector
,
stdio:
mockStdio
,
);
);
await
pub
.
get
(
await
pub
.
get
(
context:
PubContext
.
flutterTests
,
context:
PubContext
.
flutterTests
,
directory:
tempDir
.
path
,
project:
FlutterProject
.
fromDirectoryTest
(
tempDir
)
,
);
);
final
AnalysisServer
server
=
AnalysisServer
(
final
AnalysisServer
server
=
AnalysisServer
(
...
...
packages/flutter_tools/test/commands.shard/hermetic/create_usage_test.dart
View file @
d80e994a
...
@@ -11,6 +11,7 @@ import 'package:flutter_tools/src/dart/pub.dart';
...
@@ -11,6 +11,7 @@ import 'package:flutter_tools/src/dart/pub.dart';
import
'package:flutter_tools/src/doctor.dart'
;
import
'package:flutter_tools/src/doctor.dart'
;
import
'package:flutter_tools/src/doctor_validator.dart'
;
import
'package:flutter_tools/src/doctor_validator.dart'
;
import
'package:flutter_tools/src/globals.dart'
as
globals
;
import
'package:flutter_tools/src/globals.dart'
as
globals
;
import
'package:flutter_tools/src/project.dart'
;
import
'package:test/fake.dart'
;
import
'package:test/fake.dart'
;
import
'../../src/context.dart'
;
import
'../../src/context.dart'
;
...
@@ -27,17 +28,18 @@ class FakePub extends Fake implements Pub {
...
@@ -27,17 +28,18 @@ class FakePub extends Fake implements Pub {
@override
@override
Future
<
void
>
get
({
Future
<
void
>
get
({
PubContext
?
context
,
PubContext
?
context
,
String
?
directory
,
required
FlutterProject
project
,
bool
skipIfAbsent
=
false
,
bool
skipIfAbsent
=
false
,
bool
upgrade
=
false
,
bool
upgrade
=
false
,
bool
offline
=
false
,
bool
offline
=
false
,
bool
generateSyntheticPackage
=
false
,
bool
generateSyntheticPackage
=
false
,
bool
generateSyntheticPackageForExample
=
false
,
String
?
flutterRootOverride
,
String
?
flutterRootOverride
,
bool
checkUpToDate
=
false
,
bool
checkUpToDate
=
false
,
bool
shouldSkipThirdPartyGenerator
=
true
,
bool
shouldSkipThirdPartyGenerator
=
true
,
bool
printProgress
=
true
,
bool
printProgress
=
true
,
})
async
{
})
async
{
fs
.
directory
(
directory
)
.
childFile
(
'.packages'
).
createSync
();
project
.
directory
.
childFile
(
'.packages'
).
createSync
();
if
(
offline
==
true
)
{
if
(
offline
==
true
)
{
calledGetOffline
+=
1
;
calledGetOffline
+=
1
;
}
else
{
}
else
{
...
...
packages/flutter_tools/test/commands.shard/hermetic/drive_test.dart
View file @
d80e994a
...
@@ -306,7 +306,7 @@ class FakePub extends Fake implements Pub {
...
@@ -306,7 +306,7 @@ class FakePub extends Fake implements Pub {
@override
@override
Future
<
void
>
get
({
Future
<
void
>
get
({
PubContext
?
context
,
PubContext
?
context
,
String
?
directory
,
required
FlutterProject
project
,
bool
skipIfAbsent
=
false
,
bool
skipIfAbsent
=
false
,
bool
upgrade
=
false
,
bool
upgrade
=
false
,
bool
offline
=
false
,
bool
offline
=
false
,
...
...
packages/flutter_tools/test/commands.shard/hermetic/pub_get_test.dart
View file @
d80e994a
...
@@ -169,17 +169,18 @@ class FakePub extends Fake implements Pub {
...
@@ -169,17 +169,18 @@ class FakePub extends Fake implements Pub {
@override
@override
Future
<
void
>
get
({
Future
<
void
>
get
({
required
PubContext
context
,
required
PubContext
context
,
String
?
directory
,
required
FlutterProject
project
,
bool
skipIfAbsent
=
false
,
bool
skipIfAbsent
=
false
,
bool
upgrade
=
false
,
bool
upgrade
=
false
,
bool
offline
=
false
,
bool
offline
=
false
,
bool
generateSyntheticPackage
=
false
,
bool
generateSyntheticPackage
=
false
,
bool
generateSyntheticPackageForExample
=
false
,
String
?
flutterRootOverride
,
String
?
flutterRootOverride
,
bool
checkUpToDate
=
false
,
bool
checkUpToDate
=
false
,
bool
shouldSkipThirdPartyGenerator
=
true
,
bool
shouldSkipThirdPartyGenerator
=
true
,
bool
printProgress
=
true
,
bool
printProgress
=
true
,
})
async
{
})
async
{
fileSystem
.
directory
(
directory
)
fileSystem
.
directory
(
project
.
directory
)
.
childDirectory
(
'.dart_tool'
)
.
childDirectory
(
'.dart_tool'
)
.
childFile
(
'package_config.json'
)
.
childFile
(
'package_config.json'
)
..
createSync
(
recursive:
true
)
..
createSync
(
recursive:
true
)
...
...
packages/flutter_tools/test/commands.shard/hermetic/update_packages_test.dart
View file @
d80e994a
...
@@ -8,6 +8,7 @@ import 'package:flutter_tools/src/base/file_system.dart';
...
@@ -8,6 +8,7 @@ import 'package:flutter_tools/src/base/file_system.dart';
import
'package:flutter_tools/src/cache.dart'
;
import
'package:flutter_tools/src/cache.dart'
;
import
'package:flutter_tools/src/commands/update_packages.dart'
;
import
'package:flutter_tools/src/commands/update_packages.dart'
;
import
'package:flutter_tools/src/dart/pub.dart'
;
import
'package:flutter_tools/src/dart/pub.dart'
;
import
'package:flutter_tools/src/project.dart'
;
import
'package:test/fake.dart'
;
import
'package:test/fake.dart'
;
import
'package:yaml/yaml.dart'
;
import
'package:yaml/yaml.dart'
;
...
@@ -223,20 +224,19 @@ class FakePub extends Fake implements Pub {
...
@@ -223,20 +224,19 @@ class FakePub extends Fake implements Pub {
@override
@override
Future
<
void
>
get
({
Future
<
void
>
get
({
required
PubContext
context
,
required
PubContext
context
,
String
?
directory
,
required
FlutterProject
project
,
bool
skipIfAbsent
=
false
,
bool
skipIfAbsent
=
false
,
bool
upgrade
=
false
,
bool
upgrade
=
false
,
bool
offline
=
false
,
bool
offline
=
false
,
bool
generateSyntheticPackage
=
false
,
bool
generateSyntheticPackage
=
false
,
bool
generateSyntheticPackageForExample
=
false
,
String
?
flutterRootOverride
,
String
?
flutterRootOverride
,
bool
checkUpToDate
=
false
,
bool
checkUpToDate
=
false
,
bool
shouldSkipThirdPartyGenerator
=
true
,
bool
shouldSkipThirdPartyGenerator
=
true
,
bool
printProgress
=
true
,
bool
printProgress
=
true
,
})
async
{
})
async
{
if
(
directory
!=
null
)
{
pubGetDirectories
.
add
(
project
.
directory
.
path
);
pubGetDirectories
.
add
(
directory
);
project
.
directory
.
childFile
(
'pubspec.lock'
)
}
fileSystem
.
directory
(
directory
).
childFile
(
'pubspec.lock'
)
..
createSync
(
recursive:
true
)
..
createSync
(
recursive:
true
)
..
writeAsStringSync
(
'''
..
writeAsStringSync
(
'''
# Generated by pub
# Generated by pub
...
@@ -266,8 +266,6 @@ sdks:
...
@@ -266,8 +266,6 @@ sdks:
String
?
directory
,
String
?
directory
,
MessageFilter
?
filter
,
MessageFilter
?
filter
,
String
failureMessage
=
'pub failed'
,
String
failureMessage
=
'pub failed'
,
required
bool
retry
,
bool
?
showTraceForErrors
,
})
async
{
})
async
{
if
(
directory
!=
null
)
{
if
(
directory
!=
null
)
{
pubBatchDirectories
.
add
(
directory
);
pubBatchDirectories
.
add
(
directory
);
...
...
packages/flutter_tools/test/commands.shard/permeable/build_aar_test.dart
View file @
d80e994a
...
@@ -20,7 +20,7 @@ import '../../src/android_common.dart';
...
@@ -20,7 +20,7 @@ import '../../src/android_common.dart';
import
'../../src/common.dart'
;
import
'../../src/common.dart'
;
import
'../../src/context.dart'
;
import
'../../src/context.dart'
;
import
'../../src/fake_process_manager.dart'
;
import
'../../src/fake_process_manager.dart'
;
import
'../../src/fakes.dart'
;
import
'../../src/fakes.dart'
hide
FakeFlutterProjectFactory
;
import
'../../src/test_flutter_command_runner.dart'
;
import
'../../src/test_flutter_command_runner.dart'
;
void
main
(
)
{
void
main
(
)
{
...
...
packages/flutter_tools/test/commands.shard/permeable/create_test.dart
View file @
d80e994a
...
@@ -64,6 +64,7 @@ void main() {
...
@@ -64,6 +64,7 @@ void main() {
late
LoggingProcessManager
loggingProcessManager
;
late
LoggingProcessManager
loggingProcessManager
;
late
FakeProcessManager
fakeProcessManager
;
late
FakeProcessManager
fakeProcessManager
;
late
BufferLogger
logger
;
late
BufferLogger
logger
;
late
FakeStdio
mockStdio
;
setUpAll
(()
async
{
setUpAll
(()
async
{
Cache
.
disableLocking
();
Cache
.
disableLocking
();
...
@@ -80,6 +81,7 @@ void main() {
...
@@ -80,6 +81,7 @@ void main() {
channel:
frameworkChannel
,
channel:
frameworkChannel
,
);
);
fakeProcessManager
=
FakeProcessManager
.
empty
();
fakeProcessManager
=
FakeProcessManager
.
empty
();
mockStdio
=
FakeStdio
();
});
});
tearDown
(()
{
tearDown
(()
{
...
@@ -171,6 +173,7 @@ void main() {
...
@@ -171,6 +173,7 @@ void main() {
usage:
globals
.
flutterUsage
,
usage:
globals
.
flutterUsage
,
botDetector:
globals
.
botDetector
,
botDetector:
globals
.
botDetector
,
platform:
globals
.
platform
,
platform:
globals
.
platform
,
stdio:
mockStdio
,
),
),
});
});
...
@@ -218,6 +221,7 @@ void main() {
...
@@ -218,6 +221,7 @@ void main() {
usage:
globals
.
flutterUsage
,
usage:
globals
.
flutterUsage
,
botDetector:
globals
.
botDetector
,
botDetector:
globals
.
botDetector
,
platform:
globals
.
platform
,
platform:
globals
.
platform
,
stdio:
mockStdio
,
),
),
});
});
...
@@ -244,6 +248,7 @@ void main() {
...
@@ -244,6 +248,7 @@ void main() {
usage:
globals
.
flutterUsage
,
usage:
globals
.
flutterUsage
,
botDetector:
globals
.
botDetector
,
botDetector:
globals
.
botDetector
,
platform:
globals
.
platform
,
platform:
globals
.
platform
,
stdio:
mockStdio
,
),
),
});
});
...
@@ -273,6 +278,7 @@ void main() {
...
@@ -273,6 +278,7 @@ void main() {
usage:
globals
.
flutterUsage
,
usage:
globals
.
flutterUsage
,
botDetector:
globals
.
botDetector
,
botDetector:
globals
.
botDetector
,
platform:
globals
.
platform
,
platform:
globals
.
platform
,
stdio:
mockStdio
,
),
),
});
});
...
@@ -298,6 +304,7 @@ void main() {
...
@@ -298,6 +304,7 @@ void main() {
usage:
globals
.
flutterUsage
,
usage:
globals
.
flutterUsage
,
botDetector:
globals
.
botDetector
,
botDetector:
globals
.
botDetector
,
platform:
globals
.
platform
,
platform:
globals
.
platform
,
stdio:
mockStdio
,
),
),
...
noColorTerminalOverride
,
...
noColorTerminalOverride
,
});
});
...
@@ -323,6 +330,7 @@ void main() {
...
@@ -323,6 +330,7 @@ void main() {
usage:
globals
.
flutterUsage
,
usage:
globals
.
flutterUsage
,
botDetector:
globals
.
botDetector
,
botDetector:
globals
.
botDetector
,
platform:
globals
.
platform
,
platform:
globals
.
platform
,
stdio:
mockStdio
,
),
),
...
noColorTerminalOverride
,
...
noColorTerminalOverride
,
});
});
...
@@ -356,6 +364,7 @@ void main() {
...
@@ -356,6 +364,7 @@ void main() {
usage:
globals
.
flutterUsage
,
usage:
globals
.
flutterUsage
,
botDetector:
globals
.
botDetector
,
botDetector:
globals
.
botDetector
,
platform:
globals
.
platform
,
platform:
globals
.
platform
,
stdio:
mockStdio
,
),
),
});
});
...
@@ -388,6 +397,7 @@ void main() {
...
@@ -388,6 +397,7 @@ void main() {
usage:
globals
.
flutterUsage
,
usage:
globals
.
flutterUsage
,
botDetector:
globals
.
botDetector
,
botDetector:
globals
.
botDetector
,
platform:
globals
.
platform
,
platform:
globals
.
platform
,
stdio:
mockStdio
,
),
),
});
});
...
@@ -415,6 +425,7 @@ void main() {
...
@@ -415,6 +425,7 @@ void main() {
usage:
globals
.
flutterUsage
,
usage:
globals
.
flutterUsage
,
botDetector:
globals
.
botDetector
,
botDetector:
globals
.
botDetector
,
platform:
globals
.
platform
,
platform:
globals
.
platform
,
stdio:
mockStdio
,
),
),
});
});
...
@@ -453,6 +464,7 @@ void main() {
...
@@ -453,6 +464,7 @@ void main() {
usage:
globals
.
flutterUsage
,
usage:
globals
.
flutterUsage
,
botDetector:
globals
.
botDetector
,
botDetector:
globals
.
botDetector
,
platform:
globals
.
platform
,
platform:
globals
.
platform
,
stdio:
mockStdio
,
),
),
});
});
...
@@ -482,6 +494,7 @@ void main() {
...
@@ -482,6 +494,7 @@ void main() {
usage:
globals
.
flutterUsage
,
usage:
globals
.
flutterUsage
,
botDetector:
globals
.
botDetector
,
botDetector:
globals
.
botDetector
,
platform:
globals
.
platform
,
platform:
globals
.
platform
,
stdio:
mockStdio
,
),
),
});
});
...
@@ -520,6 +533,7 @@ void main() {
...
@@ -520,6 +533,7 @@ void main() {
usage:
globals
.
flutterUsage
,
usage:
globals
.
flutterUsage
,
botDetector:
globals
.
botDetector
,
botDetector:
globals
.
botDetector
,
platform:
globals
.
platform
,
platform:
globals
.
platform
,
stdio:
mockStdio
,
),
),
});
});
...
@@ -550,6 +564,7 @@ void main() {
...
@@ -550,6 +564,7 @@ void main() {
usage:
globals
.
flutterUsage
,
usage:
globals
.
flutterUsage
,
botDetector:
globals
.
botDetector
,
botDetector:
globals
.
botDetector
,
platform:
globals
.
platform
,
platform:
globals
.
platform
,
stdio:
mockStdio
,
),
),
});
});
...
@@ -580,6 +595,7 @@ void main() {
...
@@ -580,6 +595,7 @@ void main() {
usage:
globals
.
flutterUsage
,
usage:
globals
.
flutterUsage
,
botDetector:
globals
.
botDetector
,
botDetector:
globals
.
botDetector
,
platform:
globals
.
platform
,
platform:
globals
.
platform
,
stdio:
mockStdio
,
),
),
Logger:
()=>
logger
,
Logger:
()=>
logger
,
});
});
...
@@ -607,6 +623,7 @@ void main() {
...
@@ -607,6 +623,7 @@ void main() {
usage:
globals
.
flutterUsage
,
usage:
globals
.
flutterUsage
,
botDetector:
globals
.
botDetector
,
botDetector:
globals
.
botDetector
,
platform:
globals
.
platform
,
platform:
globals
.
platform
,
stdio:
mockStdio
,
),
),
});
});
...
@@ -728,6 +745,7 @@ void main() {
...
@@ -728,6 +745,7 @@ void main() {
usage:
globals
.
flutterUsage
,
usage:
globals
.
flutterUsage
,
botDetector:
globals
.
botDetector
,
botDetector:
globals
.
botDetector
,
platform:
globals
.
platform
,
platform:
globals
.
platform
,
stdio:
mockStdio
,
),
),
});
});
...
@@ -1426,6 +1444,7 @@ void main() {
...
@@ -1426,6 +1444,7 @@ void main() {
usage:
globals
.
flutterUsage
,
usage:
globals
.
flutterUsage
,
botDetector:
globals
.
botDetector
,
botDetector:
globals
.
botDetector
,
platform:
globals
.
platform
,
platform:
globals
.
platform
,
stdio:
mockStdio
,
),
),
});
});
...
@@ -1454,6 +1473,7 @@ void main() {
...
@@ -1454,6 +1473,7 @@ void main() {
usage:
globals
.
flutterUsage
,
usage:
globals
.
flutterUsage
,
botDetector:
globals
.
botDetector
,
botDetector:
globals
.
botDetector
,
platform:
globals
.
platform
,
platform:
globals
.
platform
,
stdio:
mockStdio
,
),
),
});
});
...
@@ -1711,6 +1731,7 @@ void main() {
...
@@ -1711,6 +1731,7 @@ void main() {
usage:
globals
.
flutterUsage
,
usage:
globals
.
flutterUsage
,
botDetector:
globals
.
botDetector
,
botDetector:
globals
.
botDetector
,
platform:
globals
.
platform
,
platform:
globals
.
platform
,
stdio:
mockStdio
,
),
),
});
});
...
@@ -1735,6 +1756,7 @@ void main() {
...
@@ -1735,6 +1756,7 @@ void main() {
usage:
globals
.
flutterUsage
,
usage:
globals
.
flutterUsage
,
botDetector:
globals
.
botDetector
,
botDetector:
globals
.
botDetector
,
platform:
globals
.
platform
,
platform:
globals
.
platform
,
stdio:
mockStdio
,
),
),
});
});
...
@@ -1885,6 +1907,7 @@ void main() {
...
@@ -1885,6 +1907,7 @@ void main() {
usage:
globals
.
flutterUsage
,
usage:
globals
.
flutterUsage
,
botDetector:
globals
.
botDetector
,
botDetector:
globals
.
botDetector
,
platform:
globals
.
platform
,
platform:
globals
.
platform
,
stdio:
mockStdio
,
),
),
});
});
...
@@ -1916,6 +1939,7 @@ void main() {
...
@@ -1916,6 +1939,7 @@ void main() {
usage:
globals
.
flutterUsage
,
usage:
globals
.
flutterUsage
,
botDetector:
globals
.
botDetector
,
botDetector:
globals
.
botDetector
,
platform:
globals
.
platform
,
platform:
globals
.
platform
,
stdio:
mockStdio
,
),
),
},
},
);
);
...
@@ -2869,6 +2893,7 @@ void main() {
...
@@ -2869,6 +2893,7 @@ void main() {
usage:
globals
.
flutterUsage
,
usage:
globals
.
flutterUsage
,
botDetector:
globals
.
botDetector
,
botDetector:
globals
.
botDetector
,
platform:
globals
.
platform
,
platform:
globals
.
platform
,
stdio:
mockStdio
,
),
),
});
});
...
...
packages/flutter_tools/test/commands.shard/permeable/format_test.dart
View file @
d80e994a
...
@@ -4,21 +4,25 @@
...
@@ -4,21 +4,25 @@
import
'package:args/command_runner.dart'
;
import
'package:args/command_runner.dart'
;
import
'package:flutter_tools/src/base/file_system.dart'
;
import
'package:flutter_tools/src/base/file_system.dart'
;
import
'package:flutter_tools/src/base/io.dart'
;
import
'package:flutter_tools/src/cache.dart'
;
import
'package:flutter_tools/src/cache.dart'
;
import
'package:flutter_tools/src/commands/format.dart'
;
import
'package:flutter_tools/src/commands/format.dart'
;
import
'package:flutter_tools/src/globals.dart'
as
globals
;
import
'package:flutter_tools/src/globals.dart'
as
globals
;
import
'../../src/common.dart'
;
import
'../../src/common.dart'
;
import
'../../src/context.dart'
;
import
'../../src/context.dart'
;
import
'../../src/fakes.dart'
;
import
'../../src/test_flutter_command_runner.dart'
;
import
'../../src/test_flutter_command_runner.dart'
;
void
main
(
)
{
void
main
(
)
{
group
(
'format'
,
()
{
group
(
'format'
,
()
{
late
Directory
tempDir
;
late
Directory
tempDir
;
late
FakeStdio
mockStdio
;
setUp
(()
{
setUp
(()
{
Cache
.
disableLocking
();
Cache
.
disableLocking
();
tempDir
=
globals
.
fs
.
systemTempDirectory
.
createTempSync
(
'flutter_tools_format_test.'
);
tempDir
=
globals
.
fs
.
systemTempDirectory
.
createTempSync
(
'flutter_tools_format_test.'
);
mockStdio
=
FakeStdio
();
});
});
tearDown
(()
{
tearDown
(()
{
...
@@ -38,6 +42,8 @@ void main() {
...
@@ -38,6 +42,8 @@ void main() {
final
String
formatted
=
srcFile
.
readAsStringSync
();
final
String
formatted
=
srcFile
.
readAsStringSync
();
expect
(
formatted
,
original
);
expect
(
formatted
,
original
);
},
overrides:
<
Type
,
Generator
>{
Stdio:
()
=>
mockStdio
,
});
});
testUsingContext
(
'dry-run'
,
()
async
{
testUsingContext
(
'dry-run'
,
()
async
{
...
...
packages/flutter_tools/test/commands.shard/permeable/packages_test.dart
View file @
d80e994a
...
@@ -30,6 +30,12 @@ import '../../src/fakes.dart';
...
@@ -30,6 +30,12 @@ import '../../src/fakes.dart';
import
'../../src/test_flutter_command_runner.dart'
;
import
'../../src/test_flutter_command_runner.dart'
;
void
main
(
)
{
void
main
(
)
{
late
FakeStdio
mockStdio
;
setUp
(()
{
mockStdio
=
FakeStdio
()..
stdout
.
terminalColumns
=
80
;
});
Cache
.
disableLocking
();
Cache
.
disableLocking
();
group
(
'packages get/upgrade'
,
()
{
group
(
'packages get/upgrade'
,
()
{
late
Directory
tempDir
;
late
Directory
tempDir
;
...
@@ -195,16 +201,25 @@ void main() {
...
@@ -195,16 +201,25 @@ void main() {
}
}
}
}
testUsingContext
(
'get fetches packages'
,
()
async
{
testUsingContext
(
'get fetches packages
and has output from pub
'
,
()
async
{
final
String
projectPath
=
await
createProject
(
tempDir
,
final
String
projectPath
=
await
createProject
(
tempDir
,
arguments:
<
String
>[
'--no-pub'
,
'--template=module'
]);
arguments:
<
String
>[
'--no-pub'
,
'--template=module'
]);
removeGeneratedFiles
(
projectPath
);
removeGeneratedFiles
(
projectPath
);
await
runCommandIn
(
projectPath
,
'get'
);
await
runCommandIn
(
projectPath
,
'get'
);
expect
(
mockStdio
.
stdout
.
writes
.
map
(
utf8
.
decode
),
allOf
(
contains
(
matches
(
RegExp
(
r'Resolving dependencies in .+flutter_project\.\.\.'
))),
contains
(
'+ flutter 0.0.0 from sdk flutter
\n
'
),
contains
(
matches
(
RegExp
(
r'Changed \d+ dependencies in .+flutter_project!'
))),
),
);
expectDependenciesResolved
(
projectPath
);
expectDependenciesResolved
(
projectPath
);
expectZeroPluginsInjected
(
projectPath
);
expectZeroPluginsInjected
(
projectPath
);
},
overrides:
<
Type
,
Generator
>{
},
overrides:
<
Type
,
Generator
>{
Stdio:
()
=>
mockStdio
,
Pub:
()
=>
Pub
(
Pub:
()
=>
Pub
(
fileSystem:
globals
.
fs
,
fileSystem:
globals
.
fs
,
logger:
globals
.
logger
,
logger:
globals
.
logger
,
...
@@ -212,6 +227,7 @@ void main() {
...
@@ -212,6 +227,7 @@ void main() {
usage:
globals
.
flutterUsage
,
usage:
globals
.
flutterUsage
,
botDetector:
globals
.
botDetector
,
botDetector:
globals
.
botDetector
,
platform:
globals
.
platform
,
platform:
globals
.
platform
,
stdio:
mockStdio
,
),
),
});
});
...
@@ -225,6 +241,7 @@ void main() {
...
@@ -225,6 +241,7 @@ void main() {
expectDependenciesResolved
(
projectPath
);
expectDependenciesResolved
(
projectPath
);
expectZeroPluginsInjected
(
projectPath
);
expectZeroPluginsInjected
(
projectPath
);
},
overrides:
<
Type
,
Generator
>{
},
overrides:
<
Type
,
Generator
>{
Stdio:
()
=>
mockStdio
,
Pub:
()
=>
Pub
(
Pub:
()
=>
Pub
(
fileSystem:
globals
.
fs
,
fileSystem:
globals
.
fs
,
logger:
globals
.
logger
,
logger:
globals
.
logger
,
...
@@ -232,6 +249,7 @@ void main() {
...
@@ -232,6 +249,7 @@ void main() {
usage:
globals
.
flutterUsage
,
usage:
globals
.
flutterUsage
,
botDetector:
globals
.
botDetector
,
botDetector:
globals
.
botDetector
,
platform:
globals
.
platform
,
platform:
globals
.
platform
,
stdio:
mockStdio
,
),
),
});
});
...
@@ -245,6 +263,7 @@ void main() {
...
@@ -245,6 +263,7 @@ void main() {
expect
((
await
getCommand
.
usageValues
).
commandPackagesNumberPlugins
,
0
);
expect
((
await
getCommand
.
usageValues
).
commandPackagesNumberPlugins
,
0
);
},
overrides:
<
Type
,
Generator
>{
},
overrides:
<
Type
,
Generator
>{
Stdio:
()
=>
mockStdio
,
Pub:
()
=>
Pub
(
Pub:
()
=>
Pub
(
fileSystem:
globals
.
fs
,
fileSystem:
globals
.
fs
,
logger:
globals
.
logger
,
logger:
globals
.
logger
,
...
@@ -252,6 +271,7 @@ void main() {
...
@@ -252,6 +271,7 @@ void main() {
usage:
globals
.
flutterUsage
,
usage:
globals
.
flutterUsage
,
botDetector:
globals
.
botDetector
,
botDetector:
globals
.
botDetector
,
platform:
globals
.
platform
,
platform:
globals
.
platform
,
stdio:
mockStdio
,
),
),
});
});
...
@@ -267,6 +287,7 @@ void main() {
...
@@ -267,6 +287,7 @@ void main() {
expect
((
await
getCommand
.
usageValues
).
commandPackagesNumberPlugins
,
1
);
expect
((
await
getCommand
.
usageValues
).
commandPackagesNumberPlugins
,
1
);
},
overrides:
<
Type
,
Generator
>{
},
overrides:
<
Type
,
Generator
>{
Stdio:
()
=>
mockStdio
,
Pub:
()
=>
Pub
(
Pub:
()
=>
Pub
(
fileSystem:
globals
.
fs
,
fileSystem:
globals
.
fs
,
logger:
globals
.
logger
,
logger:
globals
.
logger
,
...
@@ -274,6 +295,7 @@ void main() {
...
@@ -274,6 +295,7 @@ void main() {
usage:
globals
.
flutterUsage
,
usage:
globals
.
flutterUsage
,
botDetector:
globals
.
botDetector
,
botDetector:
globals
.
botDetector
,
platform:
globals
.
platform
,
platform:
globals
.
platform
,
stdio:
mockStdio
,
),
),
});
});
...
@@ -287,6 +309,7 @@ void main() {
...
@@ -287,6 +309,7 @@ void main() {
expect
((
await
getCommand
.
usageValues
).
commandPackagesProjectModule
,
false
);
expect
((
await
getCommand
.
usageValues
).
commandPackagesProjectModule
,
false
);
},
overrides:
<
Type
,
Generator
>{
},
overrides:
<
Type
,
Generator
>{
Stdio:
()
=>
mockStdio
,
Pub:
()
=>
Pub
(
Pub:
()
=>
Pub
(
fileSystem:
globals
.
fs
,
fileSystem:
globals
.
fs
,
logger:
globals
.
logger
,
logger:
globals
.
logger
,
...
@@ -294,6 +317,7 @@ void main() {
...
@@ -294,6 +317,7 @@ void main() {
usage:
globals
.
flutterUsage
,
usage:
globals
.
flutterUsage
,
botDetector:
globals
.
botDetector
,
botDetector:
globals
.
botDetector
,
platform:
globals
.
platform
,
platform:
globals
.
platform
,
stdio:
mockStdio
,
),
),
});
});
...
@@ -307,6 +331,7 @@ void main() {
...
@@ -307,6 +331,7 @@ void main() {
expect
((
await
getCommand
.
usageValues
).
commandPackagesProjectModule
,
true
);
expect
((
await
getCommand
.
usageValues
).
commandPackagesProjectModule
,
true
);
},
overrides:
<
Type
,
Generator
>{
},
overrides:
<
Type
,
Generator
>{
Stdio:
()
=>
mockStdio
,
Pub:
()
=>
Pub
(
Pub:
()
=>
Pub
(
fileSystem:
globals
.
fs
,
fileSystem:
globals
.
fs
,
logger:
globals
.
logger
,
logger:
globals
.
logger
,
...
@@ -314,6 +339,7 @@ void main() {
...
@@ -314,6 +339,7 @@ void main() {
usage:
globals
.
flutterUsage
,
usage:
globals
.
flutterUsage
,
botDetector:
globals
.
botDetector
,
botDetector:
globals
.
botDetector
,
platform:
globals
.
platform
,
platform:
globals
.
platform
,
stdio:
mockStdio
,
),
),
});
});
...
@@ -336,6 +362,7 @@ void main() {
...
@@ -336,6 +362,7 @@ void main() {
expect
((
await
getCommand
.
usageValues
).
commandPackagesAndroidEmbeddingVersion
,
'v1'
);
expect
((
await
getCommand
.
usageValues
).
commandPackagesAndroidEmbeddingVersion
,
'v1'
);
},
overrides:
<
Type
,
Generator
>{
},
overrides:
<
Type
,
Generator
>{
Stdio:
()
=>
mockStdio
,
Pub:
()
=>
Pub
(
Pub:
()
=>
Pub
(
fileSystem:
globals
.
fs
,
fileSystem:
globals
.
fs
,
logger:
globals
.
logger
,
logger:
globals
.
logger
,
...
@@ -343,6 +370,7 @@ void main() {
...
@@ -343,6 +370,7 @@ void main() {
usage:
globals
.
flutterUsage
,
usage:
globals
.
flutterUsage
,
botDetector:
globals
.
botDetector
,
botDetector:
globals
.
botDetector
,
platform:
globals
.
platform
,
platform:
globals
.
platform
,
stdio:
mockStdio
,
),
),
});
});
...
@@ -356,6 +384,7 @@ void main() {
...
@@ -356,6 +384,7 @@ void main() {
expect
((
await
getCommand
.
usageValues
).
commandPackagesAndroidEmbeddingVersion
,
'v2'
);
expect
((
await
getCommand
.
usageValues
).
commandPackagesAndroidEmbeddingVersion
,
'v2'
);
},
overrides:
<
Type
,
Generator
>{
},
overrides:
<
Type
,
Generator
>{
Stdio:
()
=>
mockStdio
,
Pub:
()
=>
Pub
(
Pub:
()
=>
Pub
(
fileSystem:
globals
.
fs
,
fileSystem:
globals
.
fs
,
logger:
globals
.
logger
,
logger:
globals
.
logger
,
...
@@ -363,6 +392,7 @@ void main() {
...
@@ -363,6 +392,7 @@ void main() {
usage:
globals
.
flutterUsage
,
usage:
globals
.
flutterUsage
,
botDetector:
globals
.
botDetector
,
botDetector:
globals
.
botDetector
,
platform:
globals
.
platform
,
platform:
globals
.
platform
,
stdio:
mockStdio
,
),
),
});
});
...
@@ -376,7 +406,7 @@ void main() {
...
@@ -376,7 +406,7 @@ void main() {
expectDependenciesResolved
(
projectPath
);
expectDependenciesResolved
(
projectPath
);
expectZeroPluginsInjected
(
projectPath
);
expectZeroPluginsInjected
(
projectPath
);
},
overrides:
<
Type
,
Generator
>{
},
overrides:
<
Type
,
Generator
>{
Stdio:
()
=>
FakeStdio
()..
stdout
.
terminalColumns
=
80
,
Stdio:
()
=>
mockStdio
,
Pub:
()
=>
Pub
(
Pub:
()
=>
Pub
(
fileSystem:
globals
.
fs
,
fileSystem:
globals
.
fs
,
logger:
globals
.
logger
,
logger:
globals
.
logger
,
...
@@ -384,6 +414,7 @@ void main() {
...
@@ -384,6 +414,7 @@ void main() {
usage:
globals
.
flutterUsage
,
usage:
globals
.
flutterUsage
,
botDetector:
globals
.
botDetector
,
botDetector:
globals
.
botDetector
,
platform:
globals
.
platform
,
platform:
globals
.
platform
,
stdio:
mockStdio
,
),
),
});
});
...
@@ -397,6 +428,7 @@ void main() {
...
@@ -397,6 +428,7 @@ void main() {
expectDependenciesResolved
(
projectPath
);
expectDependenciesResolved
(
projectPath
);
expectModulePluginInjected
(
projectPath
);
expectModulePluginInjected
(
projectPath
);
},
overrides:
<
Type
,
Generator
>{
},
overrides:
<
Type
,
Generator
>{
Stdio:
()
=>
mockStdio
,
Pub:
()
=>
Pub
(
Pub:
()
=>
Pub
(
fileSystem:
globals
.
fs
,
fileSystem:
globals
.
fs
,
logger:
globals
.
logger
,
logger:
globals
.
logger
,
...
@@ -404,6 +436,7 @@ void main() {
...
@@ -404,6 +436,7 @@ void main() {
usage:
globals
.
flutterUsage
,
usage:
globals
.
flutterUsage
,
botDetector:
globals
.
botDetector
,
botDetector:
globals
.
botDetector
,
platform:
globals
.
platform
,
platform:
globals
.
platform
,
stdio:
mockStdio
,
),
),
});
});
...
@@ -425,6 +458,7 @@ void main() {
...
@@ -425,6 +458,7 @@ void main() {
expectDependenciesResolved
(
exampleProjectPath
);
expectDependenciesResolved
(
exampleProjectPath
);
expectPluginInjected
(
exampleProjectPath
);
expectPluginInjected
(
exampleProjectPath
);
},
overrides:
<
Type
,
Generator
>{
},
overrides:
<
Type
,
Generator
>{
Stdio:
()
=>
mockStdio
,
Pub:
()
=>
Pub
(
Pub:
()
=>
Pub
(
fileSystem:
globals
.
fs
,
fileSystem:
globals
.
fs
,
logger:
globals
.
logger
,
logger:
globals
.
logger
,
...
@@ -432,6 +466,7 @@ void main() {
...
@@ -432,6 +466,7 @@ void main() {
usage:
globals
.
flutterUsage
,
usage:
globals
.
flutterUsage
,
botDetector:
globals
.
botDetector
,
botDetector:
globals
.
botDetector
,
platform:
globals
.
platform
,
platform:
globals
.
platform
,
stdio:
mockStdio
,
),
),
});
});
});
});
...
@@ -468,6 +503,7 @@ void main() {
...
@@ -468,6 +503,7 @@ void main() {
usage:
globals
.
flutterUsage
,
usage:
globals
.
flutterUsage
,
botDetector:
globals
.
botDetector
,
botDetector:
globals
.
botDetector
,
platform:
globals
.
platform
,
platform:
globals
.
platform
,
stdio:
mockStdio
,
),
),
});
});
...
@@ -493,6 +529,7 @@ void main() {
...
@@ -493,6 +529,7 @@ void main() {
usage:
globals
.
flutterUsage
,
usage:
globals
.
flutterUsage
,
botDetector:
globals
.
botDetector
,
botDetector:
globals
.
botDetector
,
platform:
globals
.
platform
,
platform:
globals
.
platform
,
stdio:
mockStdio
,
),
),
});
});
...
@@ -523,6 +560,7 @@ void main() {
...
@@ -523,6 +560,7 @@ void main() {
usage:
globals
.
flutterUsage
,
usage:
globals
.
flutterUsage
,
botDetector:
globals
.
botDetector
,
botDetector:
globals
.
botDetector
,
platform:
globals
.
platform
,
platform:
globals
.
platform
,
stdio:
mockStdio
,
),
),
});
});
...
@@ -553,6 +591,7 @@ void main() {
...
@@ -553,6 +591,7 @@ void main() {
usage:
globals
.
flutterUsage
,
usage:
globals
.
flutterUsage
,
botDetector:
globals
.
botDetector
,
botDetector:
globals
.
botDetector
,
platform:
globals
.
platform
,
platform:
globals
.
platform
,
stdio:
mockStdio
,
),
),
});
});
...
@@ -581,6 +620,7 @@ void main() {
...
@@ -581,6 +620,7 @@ void main() {
usage:
globals
.
flutterUsage
,
usage:
globals
.
flutterUsage
,
botDetector:
globals
.
botDetector
,
botDetector:
globals
.
botDetector
,
platform:
globals
.
platform
,
platform:
globals
.
platform
,
stdio:
mockStdio
,
),
),
});
});
});
});
...
...
packages/flutter_tools/test/general.shard/cache_test.dart
View file @
d80e994a
...
@@ -16,6 +16,7 @@ import 'package:flutter_tools/src/cache.dart';
...
@@ -16,6 +16,7 @@ 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/flutter_cache.dart'
;
import
'package:flutter_tools/src/flutter_cache.dart'
;
import
'package:flutter_tools/src/globals.dart'
as
globals
;
import
'package:flutter_tools/src/globals.dart'
as
globals
;
import
'package:flutter_tools/src/project.dart'
;
import
'package:test/fake.dart'
;
import
'package:test/fake.dart'
;
import
'../src/common.dart'
;
import
'../src/common.dart'
;
...
@@ -908,6 +909,7 @@ void main() {
...
@@ -908,6 +909,7 @@ void main() {
flutterRoot:
()
=>
''
,
flutterRoot:
()
=>
''
,
logger:
logger
,
logger:
logger
,
pub:
()
=>
FakePub
(),
pub:
()
=>
FakePub
(),
projectFactory:
FakeFlutterProjectFactory
(),
);
);
expect
(
await
pubDependencies
.
isUpToDate
(
fileSystem
),
false
);
// no package config
expect
(
await
pubDependencies
.
isUpToDate
(
fileSystem
),
false
);
// no package config
...
@@ -950,6 +952,7 @@ void main() {
...
@@ -950,6 +952,7 @@ void main() {
flutterRoot:
()
=>
''
,
flutterRoot:
()
=>
''
,
logger:
logger
,
logger:
logger
,
pub:
()
=>
pub
,
pub:
()
=>
pub
,
projectFactory:
FakeFlutterProjectFactory
()
);
);
await
pubDependencies
.
update
(
FakeArtifactUpdater
(),
logger
,
fileSystem
,
FakeOperatingSystemUtils
());
await
pubDependencies
.
update
(
FakeArtifactUpdater
(),
logger
,
fileSystem
,
FakeOperatingSystemUtils
());
...
@@ -1155,7 +1158,7 @@ class FakePub extends Fake implements Pub {
...
@@ -1155,7 +1158,7 @@ class FakePub extends Fake implements Pub {
@override
@override
Future
<
void
>
get
({
Future
<
void
>
get
({
PubContext
?
context
,
PubContext
?
context
,
String
?
directory
,
required
FlutterProject
project
,
bool
skipIfAbsent
=
false
,
bool
skipIfAbsent
=
false
,
bool
upgrade
=
false
,
bool
upgrade
=
false
,
bool
offline
=
false
,
bool
offline
=
false
,
...
...
packages/flutter_tools/test/general.shard/dart/pub_get_test.dart
View file @
d80e994a
...
@@ -12,11 +12,14 @@ import 'package:flutter_tools/src/base/io.dart' show ProcessException;
...
@@ -12,11 +12,14 @@ import 'package:flutter_tools/src/base/io.dart' show ProcessException;
import
'package:flutter_tools/src/base/logger.dart'
;
import
'package:flutter_tools/src/base/logger.dart'
;
import
'package:flutter_tools/src/base/platform.dart'
;
import
'package:flutter_tools/src/base/platform.dart'
;
import
'package:flutter_tools/src/cache.dart'
;
import
'package:flutter_tools/src/cache.dart'
;
import
'package:flutter_tools/src/convert.dart'
;
import
'package:flutter_tools/src/dart/pub.dart'
;
import
'package:flutter_tools/src/dart/pub.dart'
;
import
'package:flutter_tools/src/project.dart'
;
import
'package:flutter_tools/src/reporting/reporting.dart'
;
import
'package:flutter_tools/src/reporting/reporting.dart'
;
import
'../../src/common.dart'
;
import
'../../src/common.dart'
;
import
'../../src/fake_process_manager.dart'
;
import
'../../src/fake_process_manager.dart'
;
import
'../../src/fakes.dart'
;
void
main
(
)
{
void
main
(
)
{
setUpAll
(()
{
setUpAll
(()
{
...
@@ -38,9 +41,11 @@ void main() {
...
@@ -38,9 +41,11 @@ void main() {
usage:
TestUsage
(),
usage:
TestUsage
(),
platform:
FakePlatform
(),
platform:
FakePlatform
(),
botDetector:
const
BotDetectorAlwaysNo
(),
botDetector:
const
BotDetectorAlwaysNo
(),
stdio:
FakeStdio
(),
);
);
await
expectLater
(()
=>
pub
.
get
(
await
expectLater
(()
=>
pub
.
get
(
project:
FlutterProject
.
fromDirectoryTest
(
fileSystem
.
currentDirectory
),
context:
PubContext
.
pubGet
,
context:
PubContext
.
pubGet
,
checkUpToDate:
true
,
checkUpToDate:
true
,
),
throwsToolExit
(
message:
'Your Flutter SDK download may be corrupt or missing permissions to run'
));
),
throwsToolExit
(
message:
'Your Flutter SDK download may be corrupt or missing permissions to run'
));
...
@@ -52,9 +57,10 @@ void main() {
...
@@ -52,9 +57,10 @@ void main() {
const
FakeCommand
(
command:
<
String
>[
const
FakeCommand
(
command:
<
String
>[
'bin/cache/dart-sdk/bin/dart'
,
'bin/cache/dart-sdk/bin/dart'
,
'__deprecated_pub'
,
'__deprecated_pub'
,
'--verbosity=warning'
,
'--directory'
,
'.'
,
'get'
,
'get'
,
'--
no-precompi
le'
,
'--
examp
le'
,
]),
]),
]);
]);
final
BufferLogger
logger
=
BufferLogger
.
test
();
final
BufferLogger
logger
=
BufferLogger
.
test
();
...
@@ -82,9 +88,11 @@ void main() {
...
@@ -82,9 +88,11 @@ void main() {
usage:
TestUsage
(),
usage:
TestUsage
(),
platform:
FakePlatform
(),
platform:
FakePlatform
(),
botDetector:
const
BotDetectorAlwaysNo
(),
botDetector:
const
BotDetectorAlwaysNo
(),
stdio:
FakeStdio
(),
);
);
await
pub
.
get
(
await
pub
.
get
(
project:
FlutterProject
.
fromDirectoryTest
(
fileSystem
.
currentDirectory
),
context:
PubContext
.
pubGet
,
context:
PubContext
.
pubGet
,
checkUpToDate:
true
,
checkUpToDate:
true
,
shouldSkipThirdPartyGenerator:
false
,
shouldSkipThirdPartyGenerator:
false
,
...
@@ -99,9 +107,10 @@ void main() {
...
@@ -99,9 +107,10 @@ void main() {
const
FakeCommand
(
command:
<
String
>[
const
FakeCommand
(
command:
<
String
>[
'bin/cache/dart-sdk/bin/dart'
,
'bin/cache/dart-sdk/bin/dart'
,
'__deprecated_pub'
,
'__deprecated_pub'
,
'--verbosity=warning'
,
'--directory'
,
'.'
,
'get'
,
'get'
,
'--
no-precompi
le'
,
'--
examp
le'
,
]),
]),
]);
]);
final
BufferLogger
logger
=
BufferLogger
.
test
();
final
BufferLogger
logger
=
BufferLogger
.
test
();
...
@@ -130,9 +139,11 @@ void main() {
...
@@ -130,9 +139,11 @@ void main() {
usage:
TestUsage
(),
usage:
TestUsage
(),
platform:
FakePlatform
(),
platform:
FakePlatform
(),
botDetector:
const
BotDetectorAlwaysNo
(),
botDetector:
const
BotDetectorAlwaysNo
(),
stdio:
FakeStdio
(),
);
);
await
pub
.
get
(
await
pub
.
get
(
project:
FlutterProject
.
fromDirectoryTest
(
fileSystem
.
currentDirectory
),
context:
PubContext
.
pubGet
,
context:
PubContext
.
pubGet
,
checkUpToDate:
true
,
checkUpToDate:
true
,
);
);
...
@@ -146,9 +157,10 @@ void main() {
...
@@ -146,9 +157,10 @@ void main() {
const
FakeCommand
(
command:
<
String
>[
const
FakeCommand
(
command:
<
String
>[
'bin/cache/dart-sdk/bin/dart'
,
'bin/cache/dart-sdk/bin/dart'
,
'__deprecated_pub'
,
'__deprecated_pub'
,
'--verbosity=warning'
,
'--directory'
,
'.'
,
'get'
,
'get'
,
'--
no-precompi
le'
,
'--
examp
le'
,
]),
]),
]);
]);
final
BufferLogger
logger
=
BufferLogger
.
test
();
final
BufferLogger
logger
=
BufferLogger
.
test
();
...
@@ -177,9 +189,11 @@ void main() {
...
@@ -177,9 +189,11 @@ void main() {
usage:
TestUsage
(),
usage:
TestUsage
(),
platform:
FakePlatform
(),
platform:
FakePlatform
(),
botDetector:
const
BotDetectorAlwaysNo
(),
botDetector:
const
BotDetectorAlwaysNo
(),
stdio:
FakeStdio
(),
);
);
await
pub
.
get
(
await
pub
.
get
(
project:
FlutterProject
.
fromDirectoryTest
(
fileSystem
.
currentDirectory
),
context:
PubContext
.
pubGet
,
context:
PubContext
.
pubGet
,
checkUpToDate:
true
,
checkUpToDate:
true
,
);
);
...
@@ -207,9 +221,11 @@ void main() {
...
@@ -207,9 +221,11 @@ void main() {
usage:
TestUsage
(),
usage:
TestUsage
(),
platform:
FakePlatform
(),
platform:
FakePlatform
(),
botDetector:
const
BotDetectorAlwaysNo
(),
botDetector:
const
BotDetectorAlwaysNo
(),
stdio:
FakeStdio
(),
);
);
await
pub
.
get
(
await
pub
.
get
(
project:
FlutterProject
.
fromDirectoryTest
(
fileSystem
.
currentDirectory
),
context:
PubContext
.
pubGet
,
context:
PubContext
.
pubGet
,
checkUpToDate:
true
,
checkUpToDate:
true
,
);
);
...
@@ -240,9 +256,11 @@ void main() {
...
@@ -240,9 +256,11 @@ void main() {
usage:
TestUsage
(),
usage:
TestUsage
(),
platform:
FakePlatform
(),
platform:
FakePlatform
(),
botDetector:
const
BotDetectorAlwaysNo
(),
botDetector:
const
BotDetectorAlwaysNo
(),
stdio:
FakeStdio
(),
);
);
await
pub
.
get
(
await
pub
.
get
(
project:
FlutterProject
.
fromDirectoryTest
(
fileSystem
.
currentDirectory
),
context:
PubContext
.
pubGet
,
context:
PubContext
.
pubGet
,
checkUpToDate:
true
,
checkUpToDate:
true
,
);
);
...
@@ -256,9 +274,10 @@ void main() {
...
@@ -256,9 +274,10 @@ void main() {
const
FakeCommand
(
command:
<
String
>[
const
FakeCommand
(
command:
<
String
>[
'bin/cache/dart-sdk/bin/dart'
,
'bin/cache/dart-sdk/bin/dart'
,
'__deprecated_pub'
,
'__deprecated_pub'
,
'--verbosity=warning'
,
'--directory'
,
'.'
,
'get'
,
'get'
,
'--
no-precompi
le'
,
'--
examp
le'
,
]),
]),
]);
]);
final
BufferLogger
logger
=
BufferLogger
.
test
();
final
BufferLogger
logger
=
BufferLogger
.
test
();
...
@@ -277,9 +296,11 @@ void main() {
...
@@ -277,9 +296,11 @@ void main() {
usage:
TestUsage
(),
usage:
TestUsage
(),
platform:
FakePlatform
(),
platform:
FakePlatform
(),
botDetector:
const
BotDetectorAlwaysNo
(),
botDetector:
const
BotDetectorAlwaysNo
(),
stdio:
FakeStdio
(),
);
);
await
pub
.
get
(
await
pub
.
get
(
project:
FlutterProject
.
fromDirectoryTest
(
fileSystem
.
currentDirectory
),
context:
PubContext
.
pubGet
,
context:
PubContext
.
pubGet
,
checkUpToDate:
true
,
checkUpToDate:
true
,
);
);
...
@@ -294,9 +315,10 @@ void main() {
...
@@ -294,9 +315,10 @@ void main() {
const
FakeCommand
(
command:
<
String
>[
const
FakeCommand
(
command:
<
String
>[
'bin/cache/dart-sdk/bin/dart'
,
'bin/cache/dart-sdk/bin/dart'
,
'__deprecated_pub'
,
'__deprecated_pub'
,
'--verbosity=warning'
,
'--directory'
,
'.'
,
'get'
,
'get'
,
'--
no-precompi
le'
,
'--
examp
le'
,
]),
]),
]);
]);
final
BufferLogger
logger
=
BufferLogger
.
test
();
final
BufferLogger
logger
=
BufferLogger
.
test
();
...
@@ -314,9 +336,11 @@ void main() {
...
@@ -314,9 +336,11 @@ void main() {
usage:
TestUsage
(),
usage:
TestUsage
(),
platform:
FakePlatform
(),
platform:
FakePlatform
(),
botDetector:
const
BotDetectorAlwaysNo
(),
botDetector:
const
BotDetectorAlwaysNo
(),
stdio:
FakeStdio
(),
);
);
await
pub
.
get
(
await
pub
.
get
(
project:
FlutterProject
.
fromDirectoryTest
(
fileSystem
.
currentDirectory
),
context:
PubContext
.
pubGet
,
context:
PubContext
.
pubGet
,
checkUpToDate:
true
,
checkUpToDate:
true
,
);
);
...
@@ -331,9 +355,10 @@ void main() {
...
@@ -331,9 +355,10 @@ void main() {
FakeCommand
(
command:
const
<
String
>[
FakeCommand
(
command:
const
<
String
>[
'bin/cache/dart-sdk/bin/dart'
,
'bin/cache/dart-sdk/bin/dart'
,
'__deprecated_pub'
,
'__deprecated_pub'
,
'--verbosity=warning'
,
'--directory'
,
'.'
,
'get'
,
'get'
,
'--
no-precompi
le'
,
'--
examp
le'
,
],
onRun:
()
{
],
onRun:
()
{
fileSystem
.
file
(
'.dart_tool/package_config.json'
).
createSync
(
recursive:
true
);
fileSystem
.
file
(
'.dart_tool/package_config.json'
).
createSync
(
recursive:
true
);
}),
}),
...
@@ -351,9 +376,11 @@ void main() {
...
@@ -351,9 +376,11 @@ void main() {
usage:
TestUsage
(),
usage:
TestUsage
(),
platform:
FakePlatform
(),
platform:
FakePlatform
(),
botDetector:
const
BotDetectorAlwaysNo
(),
botDetector:
const
BotDetectorAlwaysNo
(),
stdio:
FakeStdio
(),
);
);
await
pub
.
get
(
await
pub
.
get
(
project:
FlutterProject
.
fromDirectoryTest
(
fileSystem
.
currentDirectory
),
context:
PubContext
.
pubGet
,
context:
PubContext
.
pubGet
,
checkUpToDate:
true
,
checkUpToDate:
true
,
);
);
...
@@ -368,9 +395,10 @@ void main() {
...
@@ -368,9 +395,10 @@ void main() {
const
FakeCommand
(
command:
<
String
>[
const
FakeCommand
(
command:
<
String
>[
'bin/cache/dart-sdk/bin/dart'
,
'bin/cache/dart-sdk/bin/dart'
,
'__deprecated_pub'
,
'__deprecated_pub'
,
'--verbosity=warning'
,
'--directory'
,
'.'
,
'get'
,
'get'
,
'--
no-precompi
le'
,
'--
examp
le'
,
]),
]),
]);
]);
final
BufferLogger
logger
=
BufferLogger
.
test
();
final
BufferLogger
logger
=
BufferLogger
.
test
();
...
@@ -387,9 +415,11 @@ void main() {
...
@@ -387,9 +415,11 @@ void main() {
usage:
TestUsage
(),
usage:
TestUsage
(),
platform:
FakePlatform
(),
platform:
FakePlatform
(),
botDetector:
const
BotDetectorAlwaysNo
(),
botDetector:
const
BotDetectorAlwaysNo
(),
stdio:
FakeStdio
(),
);
);
await
pub
.
get
(
await
pub
.
get
(
project:
FlutterProject
.
fromDirectoryTest
(
fileSystem
.
currentDirectory
),
context:
PubContext
.
pubGet
,
context:
PubContext
.
pubGet
,
checkUpToDate:
true
,
checkUpToDate:
true
,
);
);
...
@@ -403,9 +433,10 @@ void main() {
...
@@ -403,9 +433,10 @@ void main() {
const
FakeCommand
(
command:
<
String
>[
const
FakeCommand
(
command:
<
String
>[
'bin/cache/dart-sdk/bin/dart'
,
'bin/cache/dart-sdk/bin/dart'
,
'__deprecated_pub'
,
'__deprecated_pub'
,
'--verbosity=warning'
,
'--directory'
,
'.'
,
'get'
,
'get'
,
'--
no-precompi
le'
,
'--
examp
le'
,
]),
]),
]);
]);
final
BufferLogger
logger
=
BufferLogger
.
test
();
final
BufferLogger
logger
=
BufferLogger
.
test
();
...
@@ -425,9 +456,11 @@ void main() {
...
@@ -425,9 +456,11 @@ void main() {
usage:
TestUsage
(),
usage:
TestUsage
(),
platform:
FakePlatform
(),
platform:
FakePlatform
(),
botDetector:
const
BotDetectorAlwaysNo
(),
botDetector:
const
BotDetectorAlwaysNo
(),
stdio:
FakeStdio
(),
);
);
await
pub
.
get
(
await
pub
.
get
(
project:
FlutterProject
.
fromDirectoryTest
(
fileSystem
.
currentDirectory
),
context:
PubContext
.
pubGet
,
context:
PubContext
.
pubGet
,
checkUpToDate:
true
,
checkUpToDate:
true
,
);
);
...
@@ -441,9 +474,10 @@ void main() {
...
@@ -441,9 +474,10 @@ void main() {
const
FakeCommand
(
command:
<
String
>[
const
FakeCommand
(
command:
<
String
>[
'bin/cache/dart-sdk/bin/dart'
,
'bin/cache/dart-sdk/bin/dart'
,
'__deprecated_pub'
,
'__deprecated_pub'
,
'--verbosity=warning'
,
'--directory'
,
'.'
,
'get'
,
'get'
,
'--
no-precompi
le'
,
'--
examp
le'
,
]),
]),
]);
]);
final
BufferLogger
logger
=
BufferLogger
.
test
();
final
BufferLogger
logger
=
BufferLogger
.
test
();
...
@@ -465,9 +499,11 @@ void main() {
...
@@ -465,9 +499,11 @@ void main() {
usage:
TestUsage
(),
usage:
TestUsage
(),
platform:
FakePlatform
(),
platform:
FakePlatform
(),
botDetector:
const
BotDetectorAlwaysNo
(),
botDetector:
const
BotDetectorAlwaysNo
(),
stdio:
FakeStdio
(),
);
);
await
pub
.
get
(
await
pub
.
get
(
project:
FlutterProject
.
fromDirectoryTest
(
fileSystem
.
currentDirectory
),
context:
PubContext
.
pubGet
,
context:
PubContext
.
pubGet
,
checkUpToDate:
true
,
checkUpToDate:
true
,
);
);
...
@@ -483,9 +519,10 @@ void main() {
...
@@ -483,9 +519,10 @@ void main() {
command:
<
String
>[
command:
<
String
>[
'bin/cache/dart-sdk/bin/dart'
,
'bin/cache/dart-sdk/bin/dart'
,
'__deprecated_pub'
,
'__deprecated_pub'
,
'--verbosity=warning'
,
'--directory'
,
'.'
,
'get'
,
'get'
,
'--
no-precompi
le'
,
'--
examp
le'
,
],
],
exitCode:
69
,
exitCode:
69
,
environment:
<
String
,
String
>{
'FLUTTER_ROOT'
:
''
,
'PUB_ENVIRONMENT'
:
'flutter_cli:flutter_tests'
},
environment:
<
String
,
String
>{
'FLUTTER_ROOT'
:
''
,
'PUB_ENVIRONMENT'
:
'flutter_cli:flutter_tests'
},
...
@@ -511,11 +548,15 @@ void main() {
...
@@ -511,11 +548,15 @@ void main() {
usage:
TestUsage
(),
usage:
TestUsage
(),
platform:
FakePlatform
(),
platform:
FakePlatform
(),
botDetector:
const
BotDetectorAlwaysNo
(),
botDetector:
const
BotDetectorAlwaysNo
(),
stdio:
FakeStdio
(),
);
);
FakeAsync
().
run
((
FakeAsync
time
)
{
FakeAsync
().
run
((
FakeAsync
time
)
{
expect
(
logger
.
statusText
,
''
);
expect
(
logger
.
statusText
,
''
);
pub
.
get
(
context:
PubContext
.
flutterTests
).
then
((
void
value
)
{
pub
.
get
(
project:
FlutterProject
.
fromDirectoryTest
(
fileSystem
.
currentDirectory
),
context:
PubContext
.
flutterTests
,
).
then
((
void
value
)
{
error
=
'test completed unexpectedly'
;
error
=
'test completed unexpectedly'
;
},
onError:
(
dynamic
thrownError
)
{
},
onError:
(
dynamic
thrownError
)
{
error
=
'test failed unexpectedly:
$thrownError
'
;
error
=
'test failed unexpectedly:
$thrownError
'
;
...
@@ -576,10 +617,11 @@ void main() {
...
@@ -576,10 +617,11 @@ void main() {
command:
<
String
>[
command:
<
String
>[
'bin/cache/dart-sdk/bin/dart'
,
'bin/cache/dart-sdk/bin/dart'
,
'__deprecated_pub'
,
'__deprecated_pub'
,
'--verbosity=warning'
,
'--directory'
,
'.'
,
'get'
,
'get'
,
'--no-precompile'
,
'--offline'
,
'--offline'
,
'--example'
,
],
],
exitCode:
69
,
exitCode:
69
,
environment:
<
String
,
String
>{
'FLUTTER_ROOT'
:
''
,
'PUB_ENVIRONMENT'
:
'flutter_cli:flutter_tests'
},
environment:
<
String
,
String
>{
'FLUTTER_ROOT'
:
''
,
'PUB_ENVIRONMENT'
:
'flutter_cli:flutter_tests'
},
...
@@ -596,11 +638,16 @@ void main() {
...
@@ -596,11 +638,16 @@ void main() {
usage:
TestUsage
(),
usage:
TestUsage
(),
platform:
FakePlatform
(),
platform:
FakePlatform
(),
botDetector:
const
BotDetectorAlwaysNo
(),
botDetector:
const
BotDetectorAlwaysNo
(),
stdio:
FakeStdio
(),
);
);
FakeAsync
().
run
((
FakeAsync
time
)
{
FakeAsync
().
run
((
FakeAsync
time
)
{
expect
(
logger
.
statusText
,
''
);
expect
(
logger
.
statusText
,
''
);
pub
.
get
(
context:
PubContext
.
flutterTests
,
offline:
true
).
then
((
void
value
)
{
pub
.
get
(
project:
FlutterProject
.
fromDirectoryTest
(
fileSystem
.
currentDirectory
),
context:
PubContext
.
flutterTests
,
offline:
true
).
then
((
void
value
)
{
error
=
'test completed unexpectedly'
;
error
=
'test completed unexpectedly'
;
},
onError:
(
dynamic
thrownError
)
{
},
onError:
(
dynamic
thrownError
)
{
error
=
'test failed unexpectedly:
$thrownError
'
;
error
=
'test failed unexpectedly:
$thrownError
'
;
...
@@ -624,9 +671,10 @@ void main() {
...
@@ -624,9 +671,10 @@ void main() {
command:
<
String
>[
command:
<
String
>[
'bin/cache/dart-sdk/bin/dart'
,
'bin/cache/dart-sdk/bin/dart'
,
'__deprecated_pub'
,
'__deprecated_pub'
,
'--verbosity=warning'
,
'--directory'
,
'.'
,
'get'
,
'get'
,
'--
no-precompi
le'
,
'--
examp
le'
,
],
],
exitCode:
66
,
exitCode:
66
,
stderr:
'err1
\n
err2
\n
err3
\n
'
,
stderr:
'err1
\n
err2
\n
err3
\n
'
,
...
@@ -634,18 +682,19 @@ void main() {
...
@@ -634,18 +682,19 @@ void main() {
environment:
<
String
,
String
>{
'FLUTTER_ROOT'
:
''
,
'PUB_ENVIRONMENT'
:
'flutter_cli:flutter_tests'
},
environment:
<
String
,
String
>{
'FLUTTER_ROOT'
:
''
,
'PUB_ENVIRONMENT'
:
'flutter_cli:flutter_tests'
},
),
),
]);
]);
final
FakeStdio
mockStdio
=
FakeStdio
();
final
Pub
pub
=
Pub
(
final
Pub
pub
=
Pub
(
platform:
FakePlatform
(),
platform:
FakePlatform
(),
fileSystem:
fileSystem
,
fileSystem:
fileSystem
,
logger:
logger
,
logger:
logger
,
usage:
TestUsage
(),
usage:
TestUsage
(),
botDetector:
const
BotDetectorAlwaysNo
(),
botDetector:
const
BotDetectorAlwaysNo
(),
stdio:
mockStdio
,
processManager:
processManager
,
processManager:
processManager
,
);
);
const
String
toolExitMessage
=
'''
const
String
toolExitMessage
=
'''
pub get failed
pub get failed
command: "bin/cache/dart-sdk/bin/dart __deprecated_pub --
verbosity=warning get --no-precompi
le"
command: "bin/cache/dart-sdk/bin/dart __deprecated_pub --
directory . get --examp
le"
pub env: {
pub env: {
"FLUTTER_ROOT": "",
"FLUTTER_ROOT": "",
"PUB_ENVIRONMENT": "flutter_cli:flutter_tests",
"PUB_ENVIRONMENT": "flutter_cli:flutter_tests",
...
@@ -654,19 +703,28 @@ exit code: 66
...
@@ -654,19 +703,28 @@ exit code: 66
last line of pub output: "err3"
last line of pub output: "err3"
'''
;
'''
;
await
expectLater
(
await
expectLater
(
()
=>
pub
.
get
(
context:
PubContext
.
flutterTests
),
()
=>
pub
.
get
(
project:
FlutterProject
.
fromDirectoryTest
(
fileSystem
.
currentDirectory
),
context:
PubContext
.
flutterTests
,
),
throwsA
(
isA
<
ToolExit
>().
having
((
ToolExit
error
)
=>
error
.
message
,
'message'
,
toolExitMessage
)),
throwsA
(
isA
<
ToolExit
>().
having
((
ToolExit
error
)
=>
error
.
message
,
'message'
,
toolExitMessage
)),
);
);
expect
(
logger
.
statusText
,
expect
(
logger
.
statusText
,
'Running "flutter pub get" in /...
\n
'
);
'Running "flutter pub get" in /...
\n
'
expect
(
'out1
\n
'
mockStdio
.
stdout
.
writes
.
map
(
utf8
.
decode
),
'out2
\n
'
<
String
>[
'out3
\n
'
'out1
\n
'
,
'out2
\n
'
,
'out3
\n
'
,
]
);
);
expect
(
logger
.
errorText
,
expect
(
'err1
\n
'
mockStdio
.
stderr
.
writes
.
map
(
utf8
.
decode
),
'err2
\n
'
<
String
>[
'err3
\n
'
'err1
\n
'
,
'err2
\n
'
,
'err3
\n
'
,
]
);
);
expect
(
processManager
,
hasNoRemainingExpectations
);
expect
(
processManager
,
hasNoRemainingExpectations
);
});
});
...
@@ -680,18 +738,20 @@ last line of pub output: "err3"
...
@@ -680,18 +738,20 @@ last line of pub output: "err3"
command:
const
<
String
>[
command:
const
<
String
>[
'bin/cache/dart-sdk/bin/dart'
,
'bin/cache/dart-sdk/bin/dart'
,
'__deprecated_pub'
,
'__deprecated_pub'
,
'--verbosity=warning'
,
'--directory'
,
'.'
,
'get'
,
'get'
,
'--
no-precompi
le'
,
'--
examp
le'
,
],
],
onRun:
()
{
onRun:
()
{
throw
const
ProcessException
(
throw
const
ProcessException
(
'bin/cache/dart-sdk/bin/dart'
,
'bin/cache/dart-sdk/bin/dart'
,
<
String
>[
<
String
>[
'__deprecated_pub'
,
'__deprecated_pub'
,
'--verbosity=warning'
,
'--directory'
,
'.'
,
'get'
,
'get'
,
'--
no-precompi
le'
,
'--
examp
le'
,
],
],
'message'
,
'message'
,
1
,
1
,
...
@@ -710,10 +770,14 @@ last line of pub output: "err3"
...
@@ -710,10 +770,14 @@ last line of pub output: "err3"
logger:
logger
,
logger:
logger
,
usage:
TestUsage
(),
usage:
TestUsage
(),
botDetector:
const
BotDetectorAlwaysNo
(),
botDetector:
const
BotDetectorAlwaysNo
(),
stdio:
FakeStdio
(),
processManager:
processManager
,
processManager:
processManager
,
);
);
await
expectLater
(
await
expectLater
(
()
=>
pub
.
get
(
context:
PubContext
.
flutterTests
),
()
=>
pub
.
get
(
project:
FlutterProject
.
fromDirectoryTest
(
fileSystem
.
currentDirectory
),
context:
PubContext
.
flutterTests
,
),
throwsA
(
throwsA
(
isA
<
ProcessException
>().
having
(
isA
<
ProcessException
>().
having
(
(
ProcessException
error
)
=>
error
.
message
,
(
ProcessException
error
)
=>
error
.
message
,
...
@@ -741,9 +805,10 @@ last line of pub output: "err3"
...
@@ -741,9 +805,10 @@ last line of pub output: "err3"
command:
<
String
>[
command:
<
String
>[
'bin/cache/dart-sdk/bin/dart'
,
'bin/cache/dart-sdk/bin/dart'
,
'__deprecated_pub'
,
'__deprecated_pub'
,
'--verbosity=warning'
,
'--directory'
,
'.'
,
'get'
,
'get'
,
'--
no-precompi
le'
,
'--
examp
le'
,
],
],
exitCode:
69
,
exitCode:
69
,
environment:
<
String
,
String
>{
environment:
<
String
,
String
>{
...
@@ -760,10 +825,14 @@ last line of pub output: "err3"
...
@@ -760,10 +825,14 @@ last line of pub output: "err3"
logger:
BufferLogger
.
test
(),
logger:
BufferLogger
.
test
(),
processManager:
processManager
,
processManager:
processManager
,
botDetector:
const
BotDetectorAlwaysNo
(),
botDetector:
const
BotDetectorAlwaysNo
(),
stdio:
FakeStdio
(),
);
);
FakeAsync
().
run
((
FakeAsync
time
)
{
FakeAsync
().
run
((
FakeAsync
time
)
{
pub
.
get
(
context:
PubContext
.
flutterTests
).
then
((
void
value
)
{
pub
.
get
(
project:
FlutterProject
.
fromDirectoryTest
(
fileSystem
.
currentDirectory
),
context:
PubContext
.
flutterTests
).
then
((
void
value
)
{
error
=
'test completed unexpectedly'
;
error
=
'test completed unexpectedly'
;
},
onError:
(
dynamic
thrownError
)
{
},
onError:
(
dynamic
thrownError
)
{
error
=
'test failed unexpectedly:
$thrownError
'
;
error
=
'test failed unexpectedly:
$thrownError
'
;
...
@@ -802,9 +871,10 @@ last line of pub output: "err3"
...
@@ -802,9 +871,10 @@ last line of pub output: "err3"
command:
<
String
>[
command:
<
String
>[
'bin/cache/dart-sdk/bin/dart'
,
'bin/cache/dart-sdk/bin/dart'
,
'__deprecated_pub'
,
'__deprecated_pub'
,
'--verbosity=warning'
,
'--directory'
,
'.'
,
'get'
,
'get'
,
'--
no-precompi
le'
,
'--
examp
le'
,
],
],
exitCode:
69
,
exitCode:
69
,
environment:
<
String
,
String
>{
environment:
<
String
,
String
>{
...
@@ -825,10 +895,14 @@ last line of pub output: "err3"
...
@@ -825,10 +895,14 @@ last line of pub output: "err3"
logger:
BufferLogger
.
test
(),
logger:
BufferLogger
.
test
(),
processManager:
processManager
,
processManager:
processManager
,
botDetector:
const
BotDetectorAlwaysNo
(),
botDetector:
const
BotDetectorAlwaysNo
(),
stdio:
FakeStdio
(),
);
);
FakeAsync
().
run
((
FakeAsync
time
)
{
FakeAsync
().
run
((
FakeAsync
time
)
{
pub
.
get
(
context:
PubContext
.
flutterTests
).
then
((
void
value
)
{
pub
.
get
(
project:
FlutterProject
.
fromDirectoryTest
(
fileSystem
.
currentDirectory
),
context:
PubContext
.
flutterTests
,
).
then
((
void
value
)
{
error
=
'test completed unexpectedly'
;
error
=
'test completed unexpectedly'
;
},
onError:
(
dynamic
thrownError
)
{
},
onError:
(
dynamic
thrownError
)
{
error
=
thrownError
.
toString
();
error
=
thrownError
.
toString
();
...
@@ -853,9 +927,10 @@ last line of pub output: "err3"
...
@@ -853,9 +927,10 @@ last line of pub output: "err3"
command:
<
String
>[
command:
<
String
>[
'bin/cache/dart-sdk/bin/dart'
,
'bin/cache/dart-sdk/bin/dart'
,
'__deprecated_pub'
,
'__deprecated_pub'
,
'--verbosity=warning'
,
'--directory'
,
'.'
,
'get'
,
'get'
,
'--
no-precompi
le'
,
'--
examp
le'
,
],
],
exitCode:
69
,
exitCode:
69
,
environment:
<
String
,
String
>{
environment:
<
String
,
String
>{
...
@@ -871,6 +946,7 @@ last line of pub output: "err3"
...
@@ -871,6 +946,7 @@ last line of pub output: "err3"
processManager:
processManager
,
processManager:
processManager
,
usage:
TestUsage
(),
usage:
TestUsage
(),
botDetector:
const
BotDetectorAlwaysNo
(),
botDetector:
const
BotDetectorAlwaysNo
(),
stdio:
FakeStdio
(),
platform:
FakePlatform
(
platform:
FakePlatform
(
environment:
const
<
String
,
String
>{
environment:
const
<
String
,
String
>{
'PUB_CACHE'
:
'custom/pub-cache/path'
,
'PUB_CACHE'
:
'custom/pub-cache/path'
,
...
@@ -880,7 +956,9 @@ last line of pub output: "err3"
...
@@ -880,7 +956,9 @@ last line of pub output: "err3"
FakeAsync
().
run
((
FakeAsync
time
)
{
FakeAsync
().
run
((
FakeAsync
time
)
{
String
?
error
;
String
?
error
;
pub
.
get
(
context:
PubContext
.
flutterTests
).
then
((
void
value
)
{
pub
.
get
(
project:
FlutterProject
.
fromDirectoryTest
(
fileSystem
.
currentDirectory
),
context:
PubContext
.
flutterTests
).
then
((
void
value
)
{
error
=
'test completed unexpectedly'
;
error
=
'test completed unexpectedly'
;
},
onError:
(
dynamic
thrownError
)
{
},
onError:
(
dynamic
thrownError
)
{
error
=
'test failed unexpectedly:
$thrownError
'
;
error
=
'test failed unexpectedly:
$thrownError
'
;
...
@@ -899,6 +977,7 @@ last line of pub output: "err3"
...
@@ -899,6 +977,7 @@ last line of pub output: "err3"
logger:
BufferLogger
.
test
(),
logger:
BufferLogger
.
test
(),
processManager:
FakeProcessManager
.
any
(),
processManager:
FakeProcessManager
.
any
(),
botDetector:
const
BotDetectorAlwaysNo
(),
botDetector:
const
BotDetectorAlwaysNo
(),
stdio:
FakeStdio
(),
usage:
usage
,
usage:
usage
,
platform:
FakePlatform
(
platform:
FakePlatform
(
environment:
const
<
String
,
String
>{
environment:
const
<
String
,
String
>{
...
@@ -913,8 +992,8 @@ last line of pub output: "err3"
...
@@ -913,8 +992,8 @@ last line of pub output: "err3"
..
writeAsStringSync
(
'{"configVersion": 2,"packages": []}'
);
..
writeAsStringSync
(
'{"configVersion": 2,"packages": []}'
);
await
pub
.
get
(
await
pub
.
get
(
project:
FlutterProject
.
fromDirectoryTest
(
fileSystem
.
currentDirectory
),
context:
PubContext
.
flutterTests
,
context:
PubContext
.
flutterTests
,
generateSyntheticPackage:
true
,
);
);
expect
(
usage
.
events
,
contains
(
expect
(
usage
.
events
,
contains
(
const
TestUsageEvent
(
'pub-result'
,
'flutter-tests'
,
label:
'success'
),
const
TestUsageEvent
(
'pub-result'
,
'flutter-tests'
,
label:
'success'
),
...
@@ -929,6 +1008,7 @@ last line of pub output: "err3"
...
@@ -929,6 +1008,7 @@ last line of pub output: "err3"
logger:
BufferLogger
.
test
(),
logger:
BufferLogger
.
test
(),
processManager:
FakeProcessManager
.
any
(),
processManager:
FakeProcessManager
.
any
(),
botDetector:
const
BotDetectorAlwaysNo
(),
botDetector:
const
BotDetectorAlwaysNo
(),
stdio:
FakeStdio
(),
usage:
usage
,
usage:
usage
,
platform:
FakePlatform
(
platform:
FakePlatform
(
environment:
const
<
String
,
String
>{
environment:
const
<
String
,
String
>{
...
@@ -952,8 +1032,8 @@ last line of pub output: "err3"
...
@@ -952,8 +1032,8 @@ last line of pub output: "err3"
'''
);
'''
);
await
pub
.
get
(
await
pub
.
get
(
project:
FlutterProject
.
fromDirectoryTest
(
fileSystem
.
currentDirectory
),
context:
PubContext
.
flutterTests
,
context:
PubContext
.
flutterTests
,
generateSyntheticPackage:
true
,
);
);
expect
(
expect
(
...
@@ -976,9 +1056,10 @@ last line of pub output: "err3"
...
@@ -976,9 +1056,10 @@ last line of pub output: "err3"
command:
<
String
>[
command:
<
String
>[
'bin/cache/dart-sdk/bin/dart'
,
'bin/cache/dart-sdk/bin/dart'
,
'__deprecated_pub'
,
'__deprecated_pub'
,
'--verbosity=warning'
,
'--directory'
,
'.'
,
'get'
,
'get'
,
'--
no-precompi
le'
,
'--
examp
le'
,
],
],
exitCode:
1
,
exitCode:
1
,
),
),
...
@@ -990,6 +1071,7 @@ last line of pub output: "err3"
...
@@ -990,6 +1071,7 @@ last line of pub output: "err3"
logger:
BufferLogger
.
test
(),
logger:
BufferLogger
.
test
(),
processManager:
processManager
,
processManager:
processManager
,
botDetector:
const
BotDetectorAlwaysNo
(),
botDetector:
const
BotDetectorAlwaysNo
(),
stdio:
FakeStdio
(),
platform:
FakePlatform
(
platform:
FakePlatform
(
environment:
const
<
String
,
String
>{
environment:
const
<
String
,
String
>{
'PUB_CACHE'
:
'custom/pub-cache/path'
,
'PUB_CACHE'
:
'custom/pub-cache/path'
,
...
@@ -997,7 +1079,10 @@ last line of pub output: "err3"
...
@@ -997,7 +1079,10 @@ last line of pub output: "err3"
),
),
);
);
try
{
try
{
await
pub
.
get
(
context:
PubContext
.
flutterTests
);
await
pub
.
get
(
project:
FlutterProject
.
fromDirectoryTest
(
fileSystem
.
currentDirectory
),
context:
PubContext
.
flutterTests
,
);
}
on
ToolExit
{
}
on
ToolExit
{
// Ignore.
// Ignore.
}
}
...
@@ -1018,9 +1103,10 @@ last line of pub output: "err3"
...
@@ -1018,9 +1103,10 @@ last line of pub output: "err3"
command:
<
String
>[
command:
<
String
>[
'bin/cache/dart-sdk/bin/dart'
,
'bin/cache/dart-sdk/bin/dart'
,
'__deprecated_pub'
,
'__deprecated_pub'
,
'--verbosity=warning'
,
'--directory'
,
'.'
,
'get'
,
'get'
,
'--
no-precompi
le'
,
'--
examp
le'
,
],
],
exitCode:
1
,
exitCode:
1
,
stderr:
'version solving failed'
,
stderr:
'version solving failed'
,
...
@@ -1038,11 +1124,15 @@ last line of pub output: "err3"
...
@@ -1038,11 +1124,15 @@ last line of pub output: "err3"
),
),
usage:
usage
,
usage:
usage
,
botDetector:
const
BotDetectorAlwaysNo
(),
botDetector:
const
BotDetectorAlwaysNo
(),
stdio:
FakeStdio
(),
);
);
fileSystem
.
file
(
'pubspec.yaml'
).
writeAsStringSync
(
'name: foo'
);
fileSystem
.
file
(
'pubspec.yaml'
).
writeAsStringSync
(
'name: foo'
);
try
{
try
{
await
pub
.
get
(
context:
PubContext
.
flutterTests
);
await
pub
.
get
(
project:
FlutterProject
.
fromDirectoryTest
(
fileSystem
.
currentDirectory
),
context:
PubContext
.
flutterTests
);
}
on
ToolExit
{
}
on
ToolExit
{
// Ignore.
// Ignore.
}
}
...
@@ -1061,9 +1151,10 @@ last line of pub output: "err3"
...
@@ -1061,9 +1151,10 @@ last line of pub output: "err3"
command:
const
<
String
>[
command:
const
<
String
>[
'bin/cache/dart-sdk/bin/dart'
,
'bin/cache/dart-sdk/bin/dart'
,
'__deprecated_pub'
,
'__deprecated_pub'
,
'--verbosity=warning'
,
'--directory'
,
'.'
,
'get'
,
'get'
,
'--
no-precompi
le'
,
'--
examp
le'
,
],
],
onRun:
()
{
onRun:
()
{
fileSystem
.
file
(
'.dart_tool/package_config.json'
)
fileSystem
.
file
(
'.dart_tool/package_config.json'
)
...
@@ -1074,18 +1165,20 @@ last line of pub output: "err3"
...
@@ -1074,18 +1165,20 @@ last line of pub output: "err3"
command:
<
String
>[
command:
<
String
>[
'bin/cache/dart-sdk/bin/dart'
,
'bin/cache/dart-sdk/bin/dart'
,
'__deprecated_pub'
,
'__deprecated_pub'
,
'--verbosity=warning'
,
'--directory'
,
'.'
,
'get'
,
'get'
,
'--
no-precompi
le'
,
'--
examp
le'
,
],
],
),
),
FakeCommand
(
FakeCommand
(
command:
const
<
String
>[
command:
const
<
String
>[
'bin/cache/dart-sdk/bin/dart'
,
'bin/cache/dart-sdk/bin/dart'
,
'__deprecated_pub'
,
'__deprecated_pub'
,
'--verbosity=warning'
,
'--directory'
,
'.'
,
'get'
,
'get'
,
'--
no-precompi
le'
,
'--
examp
le'
,
],
],
onRun:
()
{
onRun:
()
{
fileSystem
.
file
(
'pubspec.yaml'
)
fileSystem
.
file
(
'pubspec.yaml'
)
...
@@ -1096,9 +1189,10 @@ last line of pub output: "err3"
...
@@ -1096,9 +1189,10 @@ last line of pub output: "err3"
command:
<
String
>[
command:
<
String
>[
'bin/cache/dart-sdk/bin/dart'
,
'bin/cache/dart-sdk/bin/dart'
,
'__deprecated_pub'
,
'__deprecated_pub'
,
'--verbosity=warning'
,
'--directory'
,
'.'
,
'get'
,
'get'
,
'--
no-precompi
le'
,
'--
examp
le'
,
],
],
),
),
]);
]);
...
@@ -1110,7 +1204,8 @@ last line of pub output: "err3"
...
@@ -1110,7 +1204,8 @@ last line of pub output: "err3"
platform:
FakePlatform
(
platform:
FakePlatform
(
environment:
<
String
,
String
>{},
environment:
<
String
,
String
>{},
),
),
botDetector:
const
BotDetectorAlwaysNo
()
botDetector:
const
BotDetectorAlwaysNo
(),
stdio:
FakeStdio
()
);
);
fileSystem
.
file
(
'version'
).
createSync
();
fileSystem
.
file
(
'version'
).
createSync
();
...
@@ -1121,7 +1216,10 @@ last line of pub output: "err3"
...
@@ -1121,7 +1216,10 @@ last line of pub output: "err3"
fileSystem
.
file
(
'pubspec.yaml'
)
fileSystem
.
file
(
'pubspec.yaml'
)
..
createSync
()
..
createSync
()
..
setLastModifiedSync
(
DateTime
(
2001
));
..
setLastModifiedSync
(
DateTime
(
2001
));
await
pub
.
get
(
context:
PubContext
.
flutterTests
);
// pub sets date of .packages to 2002
await
pub
.
get
(
project:
FlutterProject
.
fromDirectoryTest
(
fileSystem
.
currentDirectory
),
context:
PubContext
.
flutterTests
,
);
// pub sets date of .packages to 2002
expect
(
logger
.
statusText
,
'Running "flutter pub get" in /...
\n
'
);
expect
(
logger
.
statusText
,
'Running "flutter pub get" in /...
\n
'
);
expect
(
logger
.
errorText
,
isEmpty
);
expect
(
logger
.
errorText
,
isEmpty
);
...
@@ -1133,7 +1231,10 @@ last line of pub output: "err3"
...
@@ -1133,7 +1231,10 @@ last line of pub output: "err3"
.
setLastModifiedSync
(
DateTime
(
2000
));
.
setLastModifiedSync
(
DateTime
(
2000
));
fileSystem
.
file
(
'pubspec.yaml'
)
fileSystem
.
file
(
'pubspec.yaml'
)
.
setLastModifiedSync
(
DateTime
(
2001
));
.
setLastModifiedSync
(
DateTime
(
2001
));
await
pub
.
get
(
context:
PubContext
.
flutterTests
);
// pub does nothing
await
pub
.
get
(
project:
FlutterProject
.
fromDirectoryTest
(
fileSystem
.
currentDirectory
),
context:
PubContext
.
flutterTests
,
);
// pub does nothing
expect
(
logger
.
statusText
,
'Running "flutter pub get" in /...
\n
'
);
expect
(
logger
.
statusText
,
'Running "flutter pub get" in /...
\n
'
);
expect
(
logger
.
errorText
,
isEmpty
);
expect
(
logger
.
errorText
,
isEmpty
);
...
...
packages/flutter_tools/test/general.shard/runner/flutter_command_test.dart
View file @
d80e994a
...
@@ -20,6 +20,7 @@ import 'package:flutter_tools/src/cache.dart';
...
@@ -20,6 +20,7 @@ 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/pre_run_validator.dart'
;
import
'package:flutter_tools/src/project.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'
;
...
@@ -814,11 +815,12 @@ class FakePub extends Fake implements Pub {
...
@@ -814,11 +815,12 @@ class FakePub extends Fake implements Pub {
@override
@override
Future
<
void
>
get
({
Future
<
void
>
get
({
PubContext
context
,
PubContext
context
,
String
directory
,
FlutterProject
project
,
bool
skipIfAbsent
=
false
,
bool
skipIfAbsent
=
false
,
bool
upgrade
=
false
,
bool
upgrade
=
false
,
bool
offline
=
false
,
bool
offline
=
false
,
bool
generateSyntheticPackage
=
false
,
bool
generateSyntheticPackage
=
false
,
bool
generateSyntheticPackageForExample
=
false
,
String
flutterRootOverride
,
String
flutterRootOverride
,
bool
checkUpToDate
=
false
,
bool
checkUpToDate
=
false
,
bool
shouldSkipThirdPartyGenerator
=
true
,
bool
shouldSkipThirdPartyGenerator
=
true
,
...
...
packages/flutter_tools/test/integration.shard/web_plugin_registrant_test.dart
View file @
d80e994a
...
@@ -75,6 +75,7 @@ void main() {
...
@@ -75,6 +75,7 @@ void main() {
usage:
globals
.
flutterUsage
,
usage:
globals
.
flutterUsage
,
botDetector:
globals
.
botDetector
,
botDetector:
globals
.
botDetector
,
platform:
globals
.
platform
,
platform:
globals
.
platform
,
stdio:
globals
.
stdio
,
),
),
});
});
...
@@ -122,6 +123,7 @@ void main() {
...
@@ -122,6 +123,7 @@ void main() {
usage:
globals
.
flutterUsage
,
usage:
globals
.
flutterUsage
,
botDetector:
globals
.
botDetector
,
botDetector:
globals
.
botDetector
,
platform:
globals
.
platform
,
platform:
globals
.
platform
,
stdio:
globals
.
stdio
,
),
),
});
});
...
@@ -153,6 +155,7 @@ void main() {
...
@@ -153,6 +155,7 @@ void main() {
usage:
globals
.
flutterUsage
,
usage:
globals
.
flutterUsage
,
botDetector:
globals
.
botDetector
,
botDetector:
globals
.
botDetector
,
platform:
globals
.
platform
,
platform:
globals
.
platform
,
stdio:
globals
.
stdio
,
),
),
});
});
...
@@ -183,6 +186,7 @@ void main() {
...
@@ -183,6 +186,7 @@ void main() {
usage:
globals
.
flutterUsage
,
usage:
globals
.
flutterUsage
,
botDetector:
globals
.
botDetector
,
botDetector:
globals
.
botDetector
,
platform:
globals
.
platform
,
platform:
globals
.
platform
,
stdio:
globals
.
stdio
,
),
),
});
});
...
@@ -232,6 +236,7 @@ void main() {
...
@@ -232,6 +236,7 @@ void main() {
usage:
globals
.
flutterUsage
,
usage:
globals
.
flutterUsage
,
botDetector:
globals
.
botDetector
,
botDetector:
globals
.
botDetector
,
platform:
globals
.
platform
,
platform:
globals
.
platform
,
stdio:
globals
.
stdio
,
),
),
});
});
}
}
...
...
packages/flutter_tools/test/src/fakes.dart
View file @
d80e994a
...
@@ -14,6 +14,7 @@ import 'package:flutter_tools/src/cache.dart';
...
@@ -14,6 +14,7 @@ import 'package:flutter_tools/src/cache.dart';
import
'package:flutter_tools/src/convert.dart'
;
import
'package:flutter_tools/src/convert.dart'
;
import
'package:flutter_tools/src/features.dart'
;
import
'package:flutter_tools/src/features.dart'
;
import
'package:flutter_tools/src/ios/plist_parser.dart'
;
import
'package:flutter_tools/src/ios/plist_parser.dart'
;
import
'package:flutter_tools/src/project.dart'
;
import
'package:flutter_tools/src/version.dart'
;
import
'package:flutter_tools/src/version.dart'
;
import
'package:test/fake.dart'
;
import
'package:test/fake.dart'
;
...
@@ -561,3 +562,13 @@ class FakeStopwatchFactory implements StopwatchFactory {
...
@@ -561,3 +562,13 @@ class FakeStopwatchFactory implements StopwatchFactory {
return
stopwatches
[
name
]
??
FakeStopwatch
();
return
stopwatches
[
name
]
??
FakeStopwatch
();
}
}
}
}
class
FakeFlutterProjectFactory
implements
FlutterProjectFactory
{
@override
FlutterProject
fromDirectory
(
Directory
directory
)
{
return
FlutterProject
.
fromDirectoryTest
(
directory
);
}
@override
Map
<
String
,
FlutterProject
>
get
projects
=>
throw
UnimplementedError
();
}
packages/flutter_tools/test/src/test_flutter_command_runner.dart
View file @
d80e994a
...
@@ -35,7 +35,7 @@ Future<String> createProject(Directory temp, { List<String>? arguments }) async
...
@@ -35,7 +35,7 @@ Future<String> createProject(Directory temp, { List<String>? arguments }) async
final
CreateCommand
command
=
CreateCommand
();
final
CreateCommand
command
=
CreateCommand
();
final
CommandRunner
<
void
>
runner
=
createTestCommandRunner
(
command
);
final
CommandRunner
<
void
>
runner
=
createTestCommandRunner
(
command
);
await
runner
.
run
(<
String
>[
'create'
,
...
arguments
,
projectPath
]);
await
runner
.
run
(<
String
>[
'create'
,
...
arguments
,
projectPath
]);
// Create
d
`.packages` since it's not created when the flag `--no-pub` is passed.
// Create `.packages` since it's not created when the flag `--no-pub` is passed.
globals
.
fs
.
file
(
globals
.
fs
.
path
.
join
(
projectPath
,
'.packages'
)).
createSync
();
globals
.
fs
.
file
(
globals
.
fs
.
path
.
join
(
projectPath
,
'.packages'
)).
createSync
();
return
projectPath
;
return
projectPath
;
}
}
...
...
packages/flutter_tools/test/src/throwing_pub.dart
View file @
d80e994a
...
@@ -4,6 +4,7 @@
...
@@ -4,6 +4,7 @@
import
'package:flutter_tools/src/base/io.dart'
;
import
'package:flutter_tools/src/base/io.dart'
;
import
'package:flutter_tools/src/dart/pub.dart'
;
import
'package:flutter_tools/src/dart/pub.dart'
;
import
'package:flutter_tools/src/project.dart'
;
class
ThrowingPub
implements
Pub
{
class
ThrowingPub
implements
Pub
{
@override
@override
...
@@ -12,8 +13,6 @@ class ThrowingPub implements Pub {
...
@@ -12,8 +13,6 @@ class ThrowingPub implements Pub {
String
?
directory
,
String
?
directory
,
MessageFilter
?
filter
,
MessageFilter
?
filter
,
String
?
failureMessage
=
'pub failed'
,
String
?
failureMessage
=
'pub failed'
,
bool
?
retry
,
bool
?
showTraceForErrors
,
})
{
})
{
throw
UnsupportedError
(
'Attempted to invoke pub during test.'
);
throw
UnsupportedError
(
'Attempted to invoke pub during test.'
);
}
}
...
@@ -21,13 +20,14 @@ class ThrowingPub implements Pub {
...
@@ -21,13 +20,14 @@ class ThrowingPub implements Pub {
@override
@override
Future
<
void
>
get
({
Future
<
void
>
get
({
PubContext
?
context
,
PubContext
?
context
,
String
?
directory
,
required
FlutterProject
project
,
bool
skipIfAbsent
=
false
,
bool
skipIfAbsent
=
false
,
bool
upgrade
=
false
,
bool
upgrade
=
false
,
bool
offline
=
false
,
bool
offline
=
false
,
bool
checkLastModified
=
true
,
bool
checkLastModified
=
true
,
bool
skipPubspecYamlCheck
=
false
,
bool
skipPubspecYamlCheck
=
false
,
bool
generateSyntheticPackage
=
false
,
bool
generateSyntheticPackage
=
false
,
bool
generateSyntheticPackageForExample
=
false
,
String
?
flutterRootOverride
,
String
?
flutterRootOverride
,
bool
checkUpToDate
=
false
,
bool
checkUpToDate
=
false
,
bool
shouldSkipThirdPartyGenerator
=
true
,
bool
shouldSkipThirdPartyGenerator
=
true
,
...
...
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