Skip to content
GitLab
Menu
Projects
Groups
Snippets
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
mirror
flutter
Commits
03f51ed9
Commit
03f51ed9
authored
2 years ago
by
Zachary Anderson
Committed by
GitHub
2 years ago
Browse files
Options
Download
Email Patches
Plain Diff
Revert "Show output from `pub get` in `flutter pub get` (#106300)"
This reverts commit
3802eb62
.
parent
5848306e
No related merge requests found
Changes
27
Hide whitespace changes
Inline
Side-by-side
Showing
20 changed files
dev/bots/analyze_snippet_code.dart
+1
-8
dev/bots/analyze_snippet_code.dart
packages/flutter_tools/lib/src/commands/create.dart
+42
-52
packages/flutter_tools/lib/src/commands/create.dart
packages/flutter_tools/lib/src/commands/create_base.dart
+19
-0
packages/flutter_tools/lib/src/commands/create_base.dart
packages/flutter_tools/lib/src/commands/daemon.dart
+1
-1
packages/flutter_tools/lib/src/commands/daemon.dart
packages/flutter_tools/lib/src/commands/packages.dart
+6
-6
packages/flutter_tools/lib/src/commands/packages.dart
packages/flutter_tools/lib/src/commands/update_packages.dart
+3
-3
packages/flutter_tools/lib/src/commands/update_packages.dart
packages/flutter_tools/lib/src/commands/upgrade.dart
+1
-2
packages/flutter_tools/lib/src/commands/upgrade.dart
packages/flutter_tools/lib/src/context_runner.dart
+0
-2
packages/flutter_tools/lib/src/context_runner.dart
packages/flutter_tools/lib/src/dart/pub.dart
+78
-178
packages/flutter_tools/lib/src/dart/pub.dart
packages/flutter_tools/lib/src/flutter_cache.dart
+1
-9
packages/flutter_tools/lib/src/flutter_cache.dart
packages/flutter_tools/lib/src/runner/flutter_command.dart
+1
-1
packages/flutter_tools/lib/src/runner/flutter_command.dart
packages/flutter_tools/test/commands.shard/hermetic/analyze_continuously_test.dart
+4
-8
...st/commands.shard/hermetic/analyze_continuously_test.dart
packages/flutter_tools/test/commands.shard/hermetic/create_usage_test.dart
+2
-4
...tools/test/commands.shard/hermetic/create_usage_test.dart
packages/flutter_tools/test/commands.shard/hermetic/drive_test.dart
+1
-2
...lutter_tools/test/commands.shard/hermetic/drive_test.dart
packages/flutter_tools/test/commands.shard/hermetic/pub_get_test.dart
+2
-3
...tter_tools/test/commands.shard/hermetic/pub_get_test.dart
packages/flutter_tools/test/commands.shard/hermetic/update_packages_test.dart
+7
-5
...ls/test/commands.shard/hermetic/update_packages_test.dart
packages/flutter_tools/test/commands.shard/permeable/build_aar_test.dart
+1
-1
...r_tools/test/commands.shard/permeable/build_aar_test.dart
packages/flutter_tools/test/commands.shard/permeable/create_test.dart
+1
-26
...tter_tools/test/commands.shard/permeable/create_test.dart
packages/flutter_tools/test/commands.shard/permeable/format_test.dart
+0
-6
...tter_tools/test/commands.shard/permeable/format_test.dart
packages/flutter_tools/test/commands.shard/permeable/packages_test.dart
+4
-43
...er_tools/test/commands.shard/permeable/packages_test.dart
with
175 additions
and
360 deletions
+175
-360
dev/bots/analyze_snippet_code.dart
+
1
-
8
View file @
03f51ed9
...
...
@@ -980,13 +980,6 @@ class _SnippetChecker {
/// Invokes the analyzer on the given [directory] and returns the stdout (with some lines filtered).
List
<
String
>
_runAnalyzer
()
{
_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
(
_flutter
,
<
String
>[
'--no-wrap'
,
'analyze'
,
'--no-preamble'
,
'--no-congratulate'
,
'.'
],
...
...
@@ -1013,7 +1006,7 @@ class _SnippetChecker {
if
(
stdout
.
isNotEmpty
&&
stdout
.
first
==
'Building flutter tool...'
)
{
stdout
.
removeAt
(
0
);
}
if
(
stdout
.
isNotEmpty
&&
stdout
.
first
.
isEmpty
)
{
if
(
stdout
.
isNotEmpty
&&
stdout
.
first
.
startsWith
(
'Running "flutter pub get" in '
)
)
{
stdout
.
removeAt
(
0
);
}
return
stdout
;
...
...
This diff is collapsed.
Click to expand it.
packages/flutter_tools/lib/src/commands/create.dart
+
42
-
52
View file @
03f51ed9
...
...
@@ -192,6 +192,7 @@ class CreateCommand extends CreateBase {
}
validateOutputDirectoryArg
();
String
?
sampleCode
;
final
String
?
sampleArgument
=
stringArg
(
'sample'
);
if
(
sampleArgument
!=
null
)
{
...
...
@@ -254,29 +255,7 @@ class CreateCommand extends CreateBase {
}
final
String
dartSdk
=
globals
.
cache
.
dartSdkBuild
;
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'
);
}
final
bool
includeIos
=
featureFlags
.
isIOSEnabled
&&
platforms
.
contains
(
'ios'
);
String
?
developmentTeam
;
if
(
includeIos
)
{
developmentTeam
=
await
getCodeSigningIdentityDevelopmentTeam
(
...
...
@@ -303,11 +282,11 @@ class CreateCommand extends CreateBase {
iosLanguage:
stringArgDeprecated
(
'ios-language'
),
iosDevelopmentTeam:
developmentTeam
,
ios:
includeIos
,
android:
includeA
ndroid
,
web:
includeWeb
,
linux:
includeL
inux
,
macos:
includeM
acos
,
windows:
includeW
indows
,
android:
featureFlags
.
isAndroidEnabled
&&
platforms
.
contains
(
'a
ndroid
'
)
,
web:
featureFlags
.
isWebEnabled
&&
platforms
.
contains
(
'web'
)
,
linux:
featureFlags
.
isLinuxEnabled
&&
platforms
.
contains
(
'l
inux
'
)
,
macos:
featureFlags
.
isMacOSEnabled
&&
platforms
.
contains
(
'm
acos
'
)
,
windows:
featureFlags
.
isWindowsEnabled
&&
platforms
.
contains
(
'w
indows
'
)
,
// Enable null safety everywhere.
dartSdkVersionBounds:
"'>=
$dartSdk
<3.0.0'"
,
implementationTests:
boolArgDeprecated
(
'implementation-tests'
),
...
...
@@ -330,7 +309,6 @@ class CreateCommand extends CreateBase {
final
Directory
relativeDir
=
globals
.
fs
.
directory
(
projectDirPath
);
int
generatedFileCount
=
0
;
final
PubContext
pubContext
;
switch
(
template
)
{
case
FlutterProjectType
.
app
:
generatedFileCount
+=
await
generateApp
(
...
...
@@ -341,7 +319,6 @@ class CreateCommand extends CreateBase {
printStatusWhenWriting:
!
creatingNewProject
,
projectType:
template
,
);
pubContext
=
PubContext
.
create
;
break
;
case
FlutterProjectType
.
skeleton
:
generatedFileCount
+=
await
generateApp
(
...
...
@@ -352,7 +329,6 @@ class CreateCommand extends CreateBase {
printStatusWhenWriting:
!
creatingNewProject
,
generateMetadata:
false
,
);
pubContext
=
PubContext
.
create
;
break
;
case
FlutterProjectType
.
module
:
generatedFileCount
+=
await
_generateModule
(
...
...
@@ -361,7 +337,6 @@ class CreateCommand extends CreateBase {
overwrite:
overwrite
,
printStatusWhenWriting:
!
creatingNewProject
,
);
pubContext
=
PubContext
.
create
;
break
;
case
FlutterProjectType
.
package
:
generatedFileCount
+=
await
_generatePackage
(
...
...
@@ -370,7 +345,6 @@ class CreateCommand extends CreateBase {
overwrite:
overwrite
,
printStatusWhenWriting:
!
creatingNewProject
,
);
pubContext
=
PubContext
.
createPackage
;
break
;
case
FlutterProjectType
.
plugin
:
generatedFileCount
+=
await
_generateMethodChannelPlugin
(
...
...
@@ -380,7 +354,6 @@ class CreateCommand extends CreateBase {
printStatusWhenWriting:
!
creatingNewProject
,
projectType:
template
,
);
pubContext
=
PubContext
.
createPlugin
;
break
;
case
FlutterProjectType
.
ffiPlugin
:
generatedFileCount
+=
await
_generateFfiPlugin
(
...
...
@@ -390,26 +363,8 @@ class CreateCommand extends CreateBase {
printStatusWhenWriting:
!
creatingNewProject
,
projectType:
template
,
);
pubContext
=
PubContext
.
createPlugin
;
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
)
{
generatedFileCount
+=
_applySample
(
relativeDir
,
sampleCode
);
}
...
...
@@ -492,6 +447,18 @@ Your $application code is in $relativeAppMain.
overwrite:
overwrite
,
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
;
}
...
...
@@ -513,6 +480,13 @@ Your $application code is in $relativeAppMain.
overwrite:
overwrite
,
printStatusWhenWriting:
printStatusWhenWriting
,
);
if
(
boolArgDeprecated
(
'pub'
))
{
await
pub
.
get
(
context:
PubContext
.
createPackage
,
directory:
directory
.
path
,
offline:
boolArgDeprecated
(
'offline'
),
);
}
return
generatedCount
;
}
...
...
@@ -552,6 +526,14 @@ Your $application code is in $relativeAppMain.
printStatusWhenWriting:
printStatusWhenWriting
,
);
if
(
boolArgDeprecated
(
'pub'
))
{
await
pub
.
get
(
context:
PubContext
.
createPlugin
,
directory:
directory
.
path
,
offline:
boolArgDeprecated
(
'offline'
),
);
}
final
FlutterProject
project
=
FlutterProject
.
fromDirectory
(
directory
);
final
bool
generateAndroid
=
templateContext
[
'android'
]
==
true
;
if
(
generateAndroid
)
{
...
...
@@ -622,6 +604,14 @@ Your $application code is in $relativeAppMain.
printStatusWhenWriting:
printStatusWhenWriting
,
);
if
(
boolArgDeprecated
(
'pub'
))
{
await
pub
.
get
(
context:
PubContext
.
createPlugin
,
directory:
directory
.
path
,
offline:
boolArgDeprecated
(
'offline'
),
);
}
final
FlutterProject
project
=
FlutterProject
.
fromDirectory
(
directory
);
final
bool
generateAndroid
=
templateContext
[
'android'
]
==
true
;
if
(
generateAndroid
)
{
...
...
This diff is collapsed.
Click to expand it.
packages/flutter_tools/lib/src/commands/create_base.dart
+
19
-
0
View file @
03f51ed9
...
...
@@ -17,6 +17,7 @@ import '../build_system/build_system.dart';
import
'../cache.dart'
;
import
'../convert.dart'
;
import
'../dart/generate_synthetic_packages.dart'
;
import
'../dart/pub.dart'
;
import
'../flutter_project_metadata.dart'
;
import
'../globals.dart'
as
globals
;
import
'../project.dart'
;
...
...
@@ -548,6 +549,24 @@ abstract class CreateBase extends FlutterCommand {
environment:
environment
,
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
];
if
(
androidPlatform
)
{
...
...
This diff is collapsed.
Click to expand it.
packages/flutter_tools/lib/src/commands/daemon.dart
+
1
-
1
View file @
03f51ed9
...
...
@@ -1541,7 +1541,7 @@ class AppRunLogger extends DelegatingLogger {
}
@override
bool
get
supportsColor
=
>
false
;
bool
get
supportsColor
=
>
throw
UnimplementedError
()
;
@override
bool
get
hasTerminal
=
>
false
;
...
...
This diff is collapsed.
Click to expand it.
packages/flutter_tools/lib/src/commands/packages.dart
+
6
-
6
View file @
03f51ed9
...
...
@@ -139,10 +139,11 @@ class PackagesGetCommand extends FlutterCommand {
try
{
await
pub
.
get
(
context:
PubContext
.
pubGet
,
project:
flutterProject
,
directory:
directory
,
upgrade:
upgrade
,
shouldSkipThirdPartyGenerator:
false
,
offline:
boolArgDeprecated
(
'offline'
),
generateSyntheticPackage:
flutterProject
.
manifest
.
generateSyntheticPackage
,
);
pubGetTimer
.
stop
();
globals
.
flutterUsage
.
sendTiming
(
'pub'
,
'get'
,
pubGetTimer
.
elapsed
,
label:
'success'
);
...
...
@@ -171,14 +172,13 @@ class PackagesGetCommand extends FlutterCommand {
}
final
FlutterProject
rootProject
=
FlutterProject
.
fromDirectory
(
globals
.
fs
.
directory
(
target
));
// This will also resolve dependencies for the example folder,
await
_runPubGet
(
target
,
rootProject
);
// We need to regenerate the platform specific tooling for both the project
// itself and example (if present).
await
rootProject
.
regeneratePlatformSpecificTooling
();
// Get/upgrade packages in example app as well
if
(
rootProject
.
hasExampleApp
&&
rootProject
.
example
.
pubspecFile
.
existsSync
())
{
final
FlutterProject
exampleProject
=
rootProject
.
example
;
await
_runPubGet
(
exampleProject
.
directory
.
path
,
exampleProject
);
await
exampleProject
.
regeneratePlatformSpecificTooling
();
}
...
...
@@ -211,7 +211,7 @@ class PackagesTestCommand extends FlutterCommand {
@override
Future
<
FlutterCommandResult
>
runCommand
()
async
{
await
pub
.
batch
(<
String
>[
'run'
,
'test'
,
..
.
argResults
!.
rest
],
context:
PubContext
.
runTest
);
await
pub
.
batch
(<
String
>[
'run'
,
'test'
,
..
.
argResults
!.
rest
],
context:
PubContext
.
runTest
,
retry:
false
);
return
FlutterCommandResult
.
success
();
}
}
...
...
This diff is collapsed.
Click to expand it.
packages/flutter_tools/lib/src/commands/update_packages.dart
+
3
-
3
View file @
03f51ed9
...
...
@@ -16,7 +16,6 @@ import '../base/task_queue.dart';
import
'../cache.dart'
;
import
'../dart/pub.dart'
;
import
'../globals.dart'
as
globals
;
import
'../project.dart'
;
import
'../runner/flutter_command.dart'
;
/// Map from package name to package version, used to artificially pin a pub
...
...
@@ -400,7 +399,7 @@ class UpdatePackagesCommand extends FlutterCommand {
// needed packages to the pub cache, upgrading if requested.
await
pub
.
get
(
context:
PubContext
.
updatePackages
,
project:
FlutterProject
.
fromD
irectory
(
tempDir
)
,
d
irectory
:
tempDir
.
path
,
upgrade:
doUpgrade
,
offline:
boolArgDeprecated
(
'offline'
),
flutterRootOverride:
temporaryFlutterSdk
?.
path
,
...
...
@@ -423,6 +422,7 @@ class UpdatePackagesCommand extends FlutterCommand {
context:
PubContext
.
updatePackages
,
directory:
tempDir
.
path
,
filter:
tree
.
fill
,
retry:
false
,
// errors here are usually fatal since we're not hitting the network
);
}
}
finally
{
...
...
@@ -502,7 +502,7 @@ class UpdatePackagesCommand extends FlutterCommand {
stopwatch
.
start
();
await
pub
.
get
(
context:
PubContext
.
updatePackages
,
project:
FlutterProject
.
fromD
irectory
(
dir
)
,
d
irectory
:
dir
.
path
,
// All dependencies should already have been downloaded by the fake
// package, so the concurrent checks can all happen offline.
offline:
true
,
...
...
This diff is collapsed.
Click to expand it.
packages/flutter_tools/lib/src/commands/upgrade.dart
+
1
-
2
View file @
03f51ed9
...
...
@@ -12,7 +12,6 @@ import '../cache.dart';
import
'../dart/pub.dart'
;
import
'../globals.dart'
as
globals
;
import
'../persistent_tool_state.dart'
;
import
'../project.dart'
;
import
'../runner/flutter_command.dart'
;
import
'../version.dart'
;
import
'channel.dart'
;
...
...
@@ -331,7 +330,7 @@ class UpgradeCommandRunner {
globals
.
printStatus
(
''
);
await
pub
.
get
(
context:
PubContext
.
pubUpgrade
,
project:
FlutterProject
.
fromDirectory
(
globals
.
fs
.
directory
(
projectRoot
))
,
directory
:
projectRoot
,
upgrade:
true
,
);
}
...
...
This diff is collapsed.
Click to expand it.
packages/flutter_tools/lib/src/context_runner.dart
+
0
-
2
View file @
03f51ed9
...
...
@@ -152,7 +152,6 @@ Future<T> runInContext<T>(
logger:
globals
.
logger
,
platform:
globals
.
platform
,
osUtils:
globals
.
os
,
projectFactory:
globals
.
projectFactory
,
),
CocoaPods:
()
=
>
CocoaPods
(
fileSystem:
globals
.
fs
,
...
...
@@ -313,7 +312,6 @@ Future<T> runInContext<T>(
botDetector:
globals
.
botDetector
,
platform:
globals
.
platform
,
usage:
globals
.
flutterUsage
,
stdio:
globals
.
stdio
,
),
ShutdownHooks:
()
=
>
ShutdownHooks
(
logger:
globals
.
logger
),
Stdio:
()
=
>
Stdio
(),
...
...
This diff is collapsed.
Click to expand it.
packages/flutter_tools/lib/src/dart/pub.dart
+
78
-
178
View file @
03f51ed9
...
...
@@ -12,14 +12,12 @@ import '../base/common.dart';
import
'../base/context.dart'
;
import
'../base/file_system.dart'
;
import
'../base/io.dart'
as
io
;
import
'../base/io.dart'
;
import
'../base/logger.dart'
;
import
'../base/platform.dart'
;
import
'../base/process.dart'
;
import
'../cache.dart'
;
import
'../convert.dart'
;
import
'../dart/package_map.dart'
;
import
'../project.dart'
;
import
'../reporting/reporting.dart'
;
/// The [Pub] instance.
...
...
@@ -150,10 +148,9 @@ abstract class Pub {
required
Platform
platform
,
required
BotDetector
botDetector
,
required
Usage
usage
,
required
Stdio
stdio
,
})
=
_DefaultPub
;
/// Runs `pub get`
or `pub upgrade` for [project]
.
/// Runs `pub get`.
///
/// [context] provides extra information to package server requests to
/// understand usage.
...
...
@@ -161,13 +158,13 @@ abstract class Pub {
/// If [shouldSkipThirdPartyGenerator] is true, the overall pub get will be
/// skipped if the package config file has a "generator" other than "pub".
/// Defaults to true.
/// Will also resolve dependencies in the example folder if present.
Future
<
void
>
get
({
required
PubContext
context
,
required
FlutterProject
project
,
String
?
directory
,
bool
skipIfAbsent
=
false
,
bool
upgrade
=
false
,
bool
offline
=
false
,
bool
generateSyntheticPackage
=
false
,
String
?
flutterRootOverride
,
bool
checkUpToDate
=
false
,
bool
shouldSkipThirdPartyGenerator
=
true
,
...
...
@@ -180,8 +177,9 @@ abstract class Pub {
/// the corresponding stream of this process, optionally applying filtering.
/// The pub process will not receive anything on its stdin stream.
///
/// The `--trace` argument is passed to `pub` when `showTraceForErrors`
/// `isRunningOnBot` is true.
/// The `--trace` argument is passed to `pub` (by mutating the provided
/// `arguments` list) when `showTraceForErrors` is true, and when `showTraceForErrors`
/// is null/unset, and `isRunningOnBot` is true.
///
/// [context] provides extra information to package server requests to
/// understand usage.
...
...
@@ -191,6 +189,8 @@ abstract class Pub {
String
?
directory
,
MessageFilter
?
filter
,
String
failureMessage
=
'pub failed'
,
required
bool
retry
,
bool
?
showTraceForErrors
,
});
/// Runs pub in 'interactive' mode.
...
...
@@ -214,7 +214,6 @@ class _DefaultPub implements Pub {
required
Platform
platform
,
required
BotDetector
botDetector
,
required
Usage
usage
,
required
Stdio
stdio
,
})
:
_fileSystem
=
fileSystem
,
_logger
=
logger
,
_platform
=
platform
,
...
...
@@ -224,8 +223,7 @@ class _DefaultPub implements Pub {
logger:
logger
,
processManager:
processManager
,
),
_processManager
=
processManager
,
_stdio
=
stdio
;
_processManager
=
processManager
;
final
FileSystem
_fileSystem
;
final
Logger
_logger
;
...
...
@@ -234,40 +232,40 @@ class _DefaultPub implements Pub {
final
BotDetector
_botDetector
;
final
Usage
_usage
;
final
ProcessManager
_processManager
;
final
Stdio
_stdio
;
@override
Future
<
void
>
get
({
required
PubContext
context
,
required
FlutterProject
project
,
String
?
directory
,
bool
skipIfAbsent
=
false
,
bool
upgrade
=
false
,
bool
offline
=
false
,
bool
generateSyntheticPackage
=
false
,
bool
generateSyntheticPackageForExample
=
false
,
String
?
flutterRootOverride
,
bool
checkUpToDate
=
false
,
bool
shouldSkipThirdPartyGenerator
=
true
,
bool
printProgress
=
true
,
})
async
{
final
String
directory
=
project
.
directory
.
path
;
final
File
packageConfigFile
=
project
.
packageConfigFile
;
directory
??=
_fileSystem
.
currentDirectory
.
path
;
final
File
packageConfigFile
=
_fileSystem
.
file
(
_fileSystem
.
path
.
join
(
directory
,
'.dart_tool'
,
'package_config.json'
));
final
Directory
generatedDirectory
=
_fileSystem
.
directory
(
_fileSystem
.
path
.
join
(
directory
,
'.dart_tool'
,
'flutter_gen'
));
final
File
lastVersion
=
_fileSystem
.
file
(
_fileSystem
.
path
.
join
(
directory
,
'.dart_tool'
,
'version'
));
final
File
currentVersion
=
_fileSystem
.
file
(
_fileSystem
.
path
.
join
(
Cache
.
flutterRoot
!
,
'version'
));
final
File
pubspecYaml
=
project
.
pubspecFile
;
final
File
pubspecYaml
=
_fileSystem
.
file
(
_fileSystem
.
path
.
join
(
directory
,
'pubspec.yaml'
));
final
File
pubLockFile
=
_fileSystem
.
file
(
_fileSystem
.
path
.
join
(
directory
,
'pubspec.lock'
)
);
if
(
shouldSkipThirdPartyGenerator
&&
project
.
packageConfigFile
.
existsSync
())
{
if
(
shouldSkipThirdPartyGenerator
&&
packageConfigFile
.
existsSync
())
{
Map
<
String
,
Object
?
>
packageConfigMap
;
try
{
packageConfigMap
=
jsonDecode
(
project
.
packageConfigFile
.
readAsStringSync
(),
packageConfigFile
.
readAsStringSync
(),
)
as
Map
<
String
,
Object
?
>;
}
on
FormatException
{
packageConfigMap
=
<
String
,
Object
?
>{};
...
...
@@ -300,118 +298,31 @@ class _DefaultPub implements Pub {
}
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
List
<
String
>
args
=
<
String
>[
if
(
_logger
.
supportsColor
)
'--color'
,
if
(
verbose
)
'--verbose'
,
'--directory'
,
_fileSystem
.
path
.
relative
(
directory
)
,
'--verbose'
else
'--verbosity=warning'
,
...<
String
>[
command
,
'--no-precompile'
,
],
if
(
offline
)
'--offline'
,
'--example'
,
];
await
_runWithRetries
(
args
,
command:
command
,
context:
context
,
directory:
directory
,
failureMessage:
'pub
$command
failed'
,
retry:
!
offline
,
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
);
await
batch
(
args
,
context:
context
,
directory:
directory
,
failureMessage:
'pub
$command
failed'
,
retry:
!
offline
,
flutterRootOverride:
flutterRootOverride
,
);
status
?.
stop
();
// The exception is rethrown, so don't catch only Exceptions.
}
catch
(
exception
)
{
// ignore: avoid_catches_without_on_clauses
...
...
@@ -431,45 +342,15 @@ class _DefaultPub implements Pub {
rethrow
;
}
if
(
printProgress
)
{
// 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
;
}
}
}
final
int
code
=
exitCode
;
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
,
);
if
(
!
packageConfigFile
.
existsSync
())
{
throwToolExit
(
'
$directory
: pub did not create .dart_tools/package_config.json file.'
);
}
lastVersion
.
writeAsStringSync
(
currentVersion
.
readAsStringSync
());
await
_updatePackageConfig
(
packageConfigFile
,
generatedDirectory
,
generateSyntheticPackage
,
);
}
// For surfacing pub env in crash reporting
...
...
@@ -493,13 +374,19 @@ class _DefaultPub implements Pub {
String
?
directory
,
MessageFilter
?
filter
,
String
failureMessage
=
'pub failed'
,
required
bool
retry
,
bool
?
showTraceForErrors
,
String
?
flutterRootOverride
,
})
async
{
final
bool
showTraceForErrors
=
await
_botDetector
.
isRunningOnBot
;
showTraceForErrors
??
=
await
_botDetector
.
isRunningOnBot
;
String
lastPubMessage
=
'no message'
;
bool
versionSolvingFailed
=
false
;
String
?
filterWrapper
(
String
line
)
{
lastPubMessage
=
line
;
if
(
line
.
contains
(
'version solving failed'
))
{
versionSolvingFailed
=
true
;
}
if
(
filter
==
null
)
{
return
line
;
}
...
...
@@ -509,17 +396,44 @@ class _DefaultPub implements Pub {
if
(
showTraceForErrors
)
{
arguments
.
insert
(
0
,
'--trace'
);
}
final
Map
<
String
,
String
>
pubEnvironment
=
await
_createPubEnvironment
(
context
,
flutterRootOverride
);
int
attempts
=
0
;
int
duration
=
1
;
int
code
;
final
List
<
String
>
pubCommand
=
_pubCommand
(
arguments
);
final
int
code
=
await
_processUtils
.
stream
(
final
Map
<
String
,
String
>
pubEnvironment
=
await
_createPubEnvironment
(
context
,
flutterRootOverride
);
while
(
true
)
{
attempts
+=
1
;
code
=
await
_processUtils
.
stream
(
pubCommand
,
workingDirectory:
directory
,
mapFunction:
filterWrapper
,
// may set versionSolvingFailed, lastPubMessage
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'
;
if
(
code
!=
0
)
{
if
(
versionSolvingFailed
)
{
result
=
'version-solving-failed'
;
}
else
if
(
code
!=
0
)
{
result
=
'failure'
;
}
PubResultEvent
(
...
...
@@ -551,10 +465,7 @@ class _DefaultPub implements Pub {
})
async
{
// Fully resolved pub or pub.bat is calculated based on current platform.
final
io
.
Process
process
=
await
_processUtils
.
start
(
_pubCommand
(<
String
>[
if
(
_logger
.
supportsColor
)
'--color'
,
..
.
arguments
,
]),
_pubCommand
(
arguments
),
workingDirectory:
directory
,
environment:
await
_createPubEnvironment
(
PubContext
.
interactive
),
);
...
...
@@ -810,14 +721,3 @@ class _DefaultPub implements Pub {
return
buffer
.
toString
();
}
}
class
_OutputLine
{
_OutputLine
(
this
.
line
,
this
.
stream
);
final
String
line
;
final
_OutputStream
stream
;
}
enum
_OutputStream
{
stdout
,
stderr
,
}
This diff is collapsed.
Click to expand it.
packages/flutter_tools/lib/src/flutter_cache.dart
+
1
-
9
View file @
03f51ed9
...
...
@@ -19,7 +19,6 @@ import 'cache.dart';
import
'dart/package_map.dart'
;
import
'dart/pub.dart'
;
import
'globals.dart'
as
globals
;
import
'project.dart'
;
/// An implementation of the [Cache] which provides all of Flutter's default artifacts.
class
FlutterCache
extends
Cache
{
...
...
@@ -30,7 +29,6 @@ class FlutterCache extends Cache {
required
super
.
fileSystem
,
required
Platform
platform
,
required
super
.
osUtils
,
required
FlutterProjectFactory
projectFactory
,
})
:
super
(
logger:
logger
,
platform:
platform
,
artifacts:
<
ArtifactSet
>[])
{
registerArtifact
(
MaterialFonts
(
this
));
registerArtifact
(
GradleWrapper
(
this
));
...
...
@@ -56,7 +54,6 @@ class FlutterCache extends Cache {
// before the version is determined.
flutterRoot:
()
=
>
Cache
.
flutterRoot
!
,
pub:
()
=
>
pub
,
projectFactory:
projectFactory
,
));
}
}
...
...
@@ -73,17 +70,14 @@ class PubDependencies extends ArtifactSet {
required
String
Function
()
flutterRoot
,
required
Logger
logger
,
required
Pub
Function
()
pub
,
required
FlutterProjectFactory
projectFactory
,
})
:
_logger
=
logger
,
_flutterRoot
=
flutterRoot
,
_pub
=
pub
,
_projectFactory
=
projectFactory
,
super
(
DevelopmentArtifact
.
universal
);
final
String
Function
()
_flutterRoot
;
final
Logger
_logger
;
final
Pub
Function
()
_pub
;
final
FlutterProjectFactory
_projectFactory
;
@override
Future
<
bool
>
isUpToDate
(
...
...
@@ -124,9 +118,7 @@ class PubDependencies extends ArtifactSet {
)
async
{
await
_pub
()
.
get
(
context:
PubContext
.
pubGet
,
project:
_projectFactory
.
fromDirectory
(
fileSystem
.
directory
(
fileSystem
.
path
.
join
(
_flutterRoot
(),
'packages'
,
'flutter_tools'
))
),
directory:
fileSystem
.
path
.
join
(
_flutterRoot
(),
'packages'
,
'flutter_tools'
),
offline:
offline
);
}
...
...
This diff is collapsed.
Click to expand it.
packages/flutter_tools/lib/src/runner/flutter_command.dart
+
1
-
1
View file @
03f51ed9
...
...
@@ -1355,7 +1355,7 @@ abstract class FlutterCommand extends Command<void> {
await
pub
.
get
(
context:
PubContext
.
getVerifyContext
(
name
),
project:
project
,
generateSyntheticPackage:
project
.
manifest
.
generateSyntheticPackage
,
checkUpToDate:
cachePubGet
,
);
await
project
.
regeneratePlatformSpecificTooling
();
...
...
This diff is collapsed.
Click to expand it.
packages/flutter_tools/test/commands.shard/hermetic/analyze_continuously_test.dart
+
4
-
8
View file @
03f51ed9
...
...
@@ -19,14 +19,12 @@ import 'package:flutter_tools/src/commands/analyze.dart';
import
'package:flutter_tools/src/dart/analysis.dart'
;
import
'package:flutter_tools/src/dart/pub.dart'
;
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:process/process.dart'
;
import
'../../src/common.dart'
;
import
'../../src/context.dart'
;
import
'../../src/fake_process_manager.dart'
;
import
'../../src/fakes.dart'
;
import
'../../src/test_flutter_command_runner.dart'
;
void
main
()
{
...
...
@@ -41,7 +39,6 @@ void main() {
ProcessManager
processManager
;
AnsiTerminal
terminal
;
Logger
logger
;
FakeStdio
mockStdio
;
setUp
(()
{
fileSystem
=
globals
.
localFileSystem
;
...
...
@@ -50,7 +47,6 @@ void main() {
terminal
=
AnsiTerminal
(
platform:
platform
,
stdio:
Stdio
());
logger
=
BufferLogger
(
outputPreferences:
OutputPreferences
.
test
(),
terminal:
terminal
);
tempDir
=
fileSystem
.
systemTempDirectory
.
createTempSync
(
'flutter_analysis_test.'
);
mockStdio
=
FakeStdio
();
});
tearDown
(()
{
...
...
@@ -88,11 +84,11 @@ void main() {
platform:
const
LocalPlatform
(),
botDetector:
globals
.
botDetector
,
usage:
globals
.
flutterUsage
,
stdio:
mockStdio
,
);
await
pub
.
get
(
context:
PubContext
.
flutterTests
,
project:
FlutterProject
.
fromDirectoryTest
(
tempDir
),
directory:
tempDir
.
path
,
generateSyntheticPackage:
false
,
);
server
=
AnalysisServer
(
...
...
@@ -126,11 +122,11 @@ void main() {
platform:
const
LocalPlatform
(),
usage:
globals
.
flutterUsage
,
botDetector:
globals
.
botDetector
,
stdio:
mockStdio
,
);
await
pub
.
get
(
context:
PubContext
.
flutterTests
,
project:
FlutterProject
.
fromDirectoryTest
(
tempDir
),
directory:
tempDir
.
path
,
generateSyntheticPackage:
false
,
);
server
=
AnalysisServer
(
...
...
This diff is collapsed.
Click to expand it.
packages/flutter_tools/test/commands.shard/hermetic/create_usage_test.dart
+
2
-
4
View file @
03f51ed9
...
...
@@ -13,7 +13,6 @@ import 'package:flutter_tools/src/dart/pub.dart';
import
'package:flutter_tools/src/doctor.dart'
;
import
'package:flutter_tools/src/doctor_validator.dart'
;
import
'package:flutter_tools/src/globals.dart'
as
globals
;
import
'package:flutter_tools/src/project.dart'
;
import
'package:test/fake.dart'
;
import
'../../src/context.dart'
;
...
...
@@ -30,18 +29,17 @@ class FakePub extends Fake implements Pub {
@override
Future
<
void
>
get
({
PubContext
context
,
FlutterProject
project
,
String
directory
,
bool
skipIfAbsent
=
false
,
bool
upgrade
=
false
,
bool
offline
=
false
,
bool
generateSyntheticPackage
=
false
,
bool
generateSyntheticPackageForExample
=
false
,
String
flutterRootOverride
,
bool
checkUpToDate
=
false
,
bool
shouldSkipThirdPartyGenerator
=
true
,
bool
printProgress
=
true
,
})
async
{
project
.
directory
.
childFile
(
'.packages'
)
.
createSync
();
fs
.
directory
(
directory
)
.
childFile
(
'.packages'
)
.
createSync
();
if
(
offline
==
true
)
{
calledGetOffline
+=
1
;
}
else
{
...
...
This diff is collapsed.
Click to expand it.
packages/flutter_tools/test/commands.shard/hermetic/drive_test.dart
+
1
-
2
View file @
03f51ed9
...
...
@@ -308,12 +308,11 @@ class FakePub extends Fake implements Pub {
@override
Future
<
void
>
get
({
PubContext
context
,
FlutterProject
project
,
String
directory
,
bool
skipIfAbsent
=
false
,
bool
upgrade
=
false
,
bool
offline
=
false
,
bool
generateSyntheticPackage
=
false
,
bool
generateSyntheticPackageForExample
=
false
,
String
flutterRootOverride
,
bool
checkUpToDate
=
false
,
bool
shouldSkipThirdPartyGenerator
=
true
,
...
...
This diff is collapsed.
Click to expand it.
packages/flutter_tools/test/commands.shard/hermetic/pub_get_test.dart
+
2
-
3
View file @
03f51ed9
...
...
@@ -169,18 +169,17 @@ class FakePub extends Fake implements Pub {
@override
Future
<
void
>
get
({
required
PubContext
context
,
required
FlutterProject
project
,
String
?
directory
,
bool
skipIfAbsent
=
false
,
bool
upgrade
=
false
,
bool
offline
=
false
,
bool
generateSyntheticPackage
=
false
,
bool
generateSyntheticPackageForExample
=
false
,
String
?
flutterRootOverride
,
bool
checkUpToDate
=
false
,
bool
shouldSkipThirdPartyGenerator
=
true
,
bool
printProgress
=
true
,
})
async
{
fileSystem
.
directory
(
project
.
directory
)
fileSystem
.
directory
(
directory
)
.
childDirectory
(
'.dart_tool'
)
.
childFile
(
'package_config.json'
)
.
.
createSync
(
recursive:
true
)
...
...
This diff is collapsed.
Click to expand it.
packages/flutter_tools/test/commands.shard/hermetic/update_packages_test.dart
+
7
-
5
View file @
03f51ed9
...
...
@@ -8,7 +8,6 @@ import 'package:flutter_tools/src/base/file_system.dart';
import
'package:flutter_tools/src/cache.dart'
;
import
'package:flutter_tools/src/commands/update_packages.dart'
;
import
'package:flutter_tools/src/dart/pub.dart'
;
import
'package:flutter_tools/src/project.dart'
;
import
'package:test/fake.dart'
;
import
'package:yaml/yaml.dart'
;
...
...
@@ -224,19 +223,20 @@ class FakePub extends Fake implements Pub {
@override
Future
<
void
>
get
({
required
PubContext
context
,
required
FlutterProject
project
,
String
?
directory
,
bool
skipIfAbsent
=
false
,
bool
upgrade
=
false
,
bool
offline
=
false
,
bool
generateSyntheticPackage
=
false
,
bool
generateSyntheticPackageForExample
=
false
,
String
?
flutterRootOverride
,
bool
checkUpToDate
=
false
,
bool
shouldSkipThirdPartyGenerator
=
true
,
bool
printProgress
=
true
,
})
async
{
pubGetDirectories
.
add
(
project
.
directory
.
path
);
project
.
directory
.
childFile
(
'pubspec.lock'
)
if
(
directory
!=
null
)
{
pubGetDirectories
.
add
(
directory
);
}
fileSystem
.
directory
(
directory
)
.
childFile
(
'pubspec.lock'
)
.
.
createSync
(
recursive:
true
)
.
.
writeAsStringSync
(
'''
# Generated by pub
...
...
@@ -266,6 +266,8 @@ sdks:
String
?
directory
,
MessageFilter
?
filter
,
String
failureMessage
=
'pub failed'
,
required
bool
retry
,
bool
?
showTraceForErrors
,
})
async
{
if
(
directory
!=
null
)
{
pubBatchDirectories
.
add
(
directory
);
...
...
This diff is collapsed.
Click to expand it.
packages/flutter_tools/test/commands.shard/permeable/build_aar_test.dart
+
1
-
1
View file @
03f51ed9
...
...
@@ -23,7 +23,7 @@ import '../../src/android_common.dart';
import
'../../src/common.dart'
;
import
'../../src/context.dart'
;
import
'../../src/fake_process_manager.dart'
;
import
'../../src/fakes.dart'
hide
FakeFlutterProjectFactory
;
import
'../../src/fakes.dart'
;
import
'../../src/test_flutter_command_runner.dart'
;
void
main
()
{
...
...
This diff is collapsed.
Click to expand it.
packages/flutter_tools/test/commands.shard/permeable/create_test.dart
+
1
-
26
View file @
03f51ed9
...
...
@@ -66,7 +66,6 @@ void main() {
LoggingProcessManager
loggingProcessManager
;
FakeProcessManager
fakeProcessManager
;
BufferLogger
logger
;
FakeStdio
mockStdio
;
setUpAll
(()
async
{
Cache
.
disableLocking
();
...
...
@@ -83,7 +82,6 @@ void main() {
channel:
frameworkChannel
,
);
fakeProcessManager
=
FakeProcessManager
.
empty
();
mockStdio
=
FakeStdio
();
});
tearDown
(()
{
...
...
@@ -175,7 +173,6 @@ void main() {
usage:
globals
.
flutterUsage
,
botDetector:
globals
.
botDetector
,
platform:
globals
.
platform
,
stdio:
mockStdio
,
),
});
...
...
@@ -223,7 +220,6 @@ void main() {
usage:
globals
.
flutterUsage
,
botDetector:
globals
.
botDetector
,
platform:
globals
.
platform
,
stdio:
mockStdio
,
),
});
...
...
@@ -250,7 +246,6 @@ void main() {
usage:
globals
.
flutterUsage
,
botDetector:
globals
.
botDetector
,
platform:
globals
.
platform
,
stdio:
mockStdio
,
),
});
...
...
@@ -280,7 +275,6 @@ void main() {
usage:
globals
.
flutterUsage
,
botDetector:
globals
.
botDetector
,
platform:
globals
.
platform
,
stdio:
mockStdio
,
),
});
...
...
@@ -306,7 +300,6 @@ void main() {
usage:
globals
.
flutterUsage
,
botDetector:
globals
.
botDetector
,
platform:
globals
.
platform
,
stdio:
mockStdio
,
),
..
.
noColorTerminalOverride
,
});
...
...
@@ -332,7 +325,6 @@ void main() {
usage:
globals
.
flutterUsage
,
botDetector:
globals
.
botDetector
,
platform:
globals
.
platform
,
stdio:
mockStdio
,
),
..
.
noColorTerminalOverride
,
});
...
...
@@ -366,7 +358,6 @@ void main() {
usage:
globals
.
flutterUsage
,
botDetector:
globals
.
botDetector
,
platform:
globals
.
platform
,
stdio:
mockStdio
,
),
});
...
...
@@ -399,7 +390,6 @@ void main() {
usage:
globals
.
flutterUsage
,
botDetector:
globals
.
botDetector
,
platform:
globals
.
platform
,
stdio:
mockStdio
,
),
});
...
...
@@ -427,7 +417,6 @@ void main() {
usage:
globals
.
flutterUsage
,
botDetector:
globals
.
botDetector
,
platform:
globals
.
platform
,
stdio:
mockStdio
,
),
});
...
...
@@ -466,7 +455,6 @@ void main() {
usage:
globals
.
flutterUsage
,
botDetector:
globals
.
botDetector
,
platform:
globals
.
platform
,
stdio:
mockStdio
,
),
});
...
...
@@ -496,7 +484,6 @@ void main() {
usage:
globals
.
flutterUsage
,
botDetector:
globals
.
botDetector
,
platform:
globals
.
platform
,
stdio:
mockStdio
,
),
});
...
...
@@ -535,7 +522,6 @@ void main() {
usage:
globals
.
flutterUsage
,
botDetector:
globals
.
botDetector
,
platform:
globals
.
platform
,
stdio:
mockStdio
,
),
});
...
...
@@ -566,7 +552,6 @@ void main() {
usage:
globals
.
flutterUsage
,
botDetector:
globals
.
botDetector
,
platform:
globals
.
platform
,
stdio:
mockStdio
,
),
});
...
...
@@ -597,7 +582,6 @@ void main() {
usage:
globals
.
flutterUsage
,
botDetector:
globals
.
botDetector
,
platform:
globals
.
platform
,
stdio:
mockStdio
,
),
Logger:
()
=
>
logger
,
});
...
...
@@ -625,7 +609,6 @@ void main() {
usage:
globals
.
flutterUsage
,
botDetector:
globals
.
botDetector
,
platform:
globals
.
platform
,
stdio:
mockStdio
,
),
});
...
...
@@ -747,7 +730,6 @@ void main() {
usage:
globals
.
flutterUsage
,
botDetector:
globals
.
botDetector
,
platform:
globals
.
platform
,
stdio:
mockStdio
,
),
});
...
...
@@ -1446,7 +1428,6 @@ void main() {
usage:
globals
.
flutterUsage
,
botDetector:
globals
.
botDetector
,
platform:
globals
.
platform
,
stdio:
mockStdio
,
),
});
...
...
@@ -1475,7 +1456,6 @@ void main() {
usage:
globals
.
flutterUsage
,
botDetector:
globals
.
botDetector
,
platform:
globals
.
platform
,
stdio:
mockStdio
,
),
});
...
...
@@ -1733,7 +1713,6 @@ void main() {
usage:
globals
.
flutterUsage
,
botDetector:
globals
.
botDetector
,
platform:
globals
.
platform
,
stdio:
mockStdio
,
),
});
...
...
@@ -1758,7 +1737,6 @@ void main() {
usage:
globals
.
flutterUsage
,
botDetector:
globals
.
botDetector
,
platform:
globals
.
platform
,
stdio:
mockStdio
,
),
});
...
...
@@ -1909,7 +1887,6 @@ void main() {
usage:
globals
.
flutterUsage
,
botDetector:
globals
.
botDetector
,
platform:
globals
.
platform
,
stdio:
mockStdio
,
),
});
...
...
@@ -1934,14 +1911,13 @@ void main() {
},
overrides:
<
Type
,
Generator
>{
ProcessManager:
()
=
>
loggingProcessManager
,
Pub:
()
=
>
Pub
(
Pub:
()
=
>
Pub
(
fileSystem:
globals
.
fs
,
logger:
globals
.
logger
,
processManager:
globals
.
processManager
,
usage:
globals
.
flutterUsage
,
botDetector:
globals
.
botDetector
,
platform:
globals
.
platform
,
stdio:
mockStdio
,
),
},
);
...
...
@@ -2895,7 +2871,6 @@ void main() {
usage:
globals
.
flutterUsage
,
botDetector:
globals
.
botDetector
,
platform:
globals
.
platform
,
stdio:
mockStdio
,
),
});
...
...
This diff is collapsed.
Click to expand it.
packages/flutter_tools/test/commands.shard/permeable/format_test.dart
+
0
-
6
View file @
03f51ed9
...
...
@@ -6,25 +6,21 @@
import
'package:args/command_runner.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/commands/format.dart'
;
import
'package:flutter_tools/src/globals.dart'
as
globals
;
import
'../../src/common.dart'
;
import
'../../src/context.dart'
;
import
'../../src/fakes.dart'
;
import
'../../src/test_flutter_command_runner.dart'
;
void
main
()
{
group
(
'format'
,
()
{
Directory
tempDir
;
FakeStdio
mockStdio
;
setUp
(()
{
Cache
.
disableLocking
();
tempDir
=
globals
.
fs
.
systemTempDirectory
.
createTempSync
(
'flutter_tools_format_test.'
);
mockStdio
=
FakeStdio
();
});
tearDown
(()
{
...
...
@@ -44,8 +40,6 @@ void main() {
final
String
formatted
=
srcFile
.
readAsStringSync
();
expect
(
formatted
,
original
);
},
overrides:
<
Type
,
Generator
>{
Stdio:
()
=
>
mockStdio
,
});
testUsingContext
(
'dry-run'
,
()
async
{
...
...
This diff is collapsed.
Click to expand it.
packages/flutter_tools/test/commands.shard/permeable/packages_test.dart
+
4
-
43
View file @
03f51ed9
...
...
@@ -32,12 +32,6 @@ import '../../src/fakes.dart';
import
'../../src/test_flutter_command_runner.dart'
;
void
main
()
{
FakeStdio
mockStdio
;
setUp
(()
{
mockStdio
=
FakeStdio
().
.
stdout
.
terminalColumns
=
80
;
});
Cache
.
disableLocking
();
group
(
'packages get/upgrade'
,
()
{
Directory
tempDir
;
...
...
@@ -203,25 +197,16 @@ void main() {
}
}
testUsingContext
(
'get fetches packages
and has output from pub
'
,
()
async
{
testUsingContext
(
'get fetches packages'
,
()
async
{
final
String
projectPath
=
await
createProject
(
tempDir
,
arguments:
<
String
>[
'--no-pub'
,
'--template=module'
]);
removeGeneratedFiles
(
projectPath
);
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
);
expectZeroPluginsInjected
(
projectPath
);
},
overrides:
<
Type
,
Generator
>{
Stdio:
()
=
>
mockStdio
,
Pub:
()
=
>
Pub
(
fileSystem:
globals
.
fs
,
logger:
globals
.
logger
,
...
...
@@ -229,7 +214,6 @@ void main() {
usage:
globals
.
flutterUsage
,
botDetector:
globals
.
botDetector
,
platform:
globals
.
platform
,
stdio:
mockStdio
,
),
});
...
...
@@ -243,7 +227,6 @@ void main() {
expectDependenciesResolved
(
projectPath
);
expectZeroPluginsInjected
(
projectPath
);
},
overrides:
<
Type
,
Generator
>{
Stdio:
()
=
>
mockStdio
,
Pub:
()
=
>
Pub
(
fileSystem:
globals
.
fs
,
logger:
globals
.
logger
,
...
...
@@ -251,7 +234,6 @@ void main() {
usage:
globals
.
flutterUsage
,
botDetector:
globals
.
botDetector
,
platform:
globals
.
platform
,
stdio:
mockStdio
,
),
});
...
...
@@ -265,7 +247,6 @@ void main() {
expect
((
await
getCommand
.
usageValues
)
.
commandPackagesNumberPlugins
,
0
);
},
overrides:
<
Type
,
Generator
>{
Stdio:
()
=
>
mockStdio
,
Pub:
()
=
>
Pub
(
fileSystem:
globals
.
fs
,
logger:
globals
.
logger
,
...
...
@@ -273,7 +254,6 @@ void main() {
usage:
globals
.
flutterUsage
,
botDetector:
globals
.
botDetector
,
platform:
globals
.
platform
,
stdio:
mockStdio
,
),
});
...
...
@@ -289,7 +269,6 @@ void main() {
expect
((
await
getCommand
.
usageValues
)
.
commandPackagesNumberPlugins
,
1
);
},
overrides:
<
Type
,
Generator
>{
Stdio:
()
=
>
mockStdio
,
Pub:
()
=
>
Pub
(
fileSystem:
globals
.
fs
,
logger:
globals
.
logger
,
...
...
@@ -297,7 +276,6 @@ void main() {
usage:
globals
.
flutterUsage
,
botDetector:
globals
.
botDetector
,
platform:
globals
.
platform
,
stdio:
mockStdio
,
),
});
...
...
@@ -311,7 +289,6 @@ void main() {
expect
((
await
getCommand
.
usageValues
)
.
commandPackagesProjectModule
,
false
);
},
overrides:
<
Type
,
Generator
>{
Stdio:
()
=
>
mockStdio
,
Pub:
()
=
>
Pub
(
fileSystem:
globals
.
fs
,
logger:
globals
.
logger
,
...
...
@@ -319,7 +296,6 @@ void main() {
usage:
globals
.
flutterUsage
,
botDetector:
globals
.
botDetector
,
platform:
globals
.
platform
,
stdio:
mockStdio
,
),
});
...
...
@@ -333,7 +309,6 @@ void main() {
expect
((
await
getCommand
.
usageValues
)
.
commandPackagesProjectModule
,
true
);
},
overrides:
<
Type
,
Generator
>{
Stdio:
()
=
>
mockStdio
,
Pub:
()
=
>
Pub
(
fileSystem:
globals
.
fs
,
logger:
globals
.
logger
,
...
...
@@ -341,7 +316,6 @@ void main() {
usage:
globals
.
flutterUsage
,
botDetector:
globals
.
botDetector
,
platform:
globals
.
platform
,
stdio:
mockStdio
,
),
});
...
...
@@ -364,7 +338,6 @@ void main() {
expect
((
await
getCommand
.
usageValues
)
.
commandPackagesAndroidEmbeddingVersion
,
'v1'
);
},
overrides:
<
Type
,
Generator
>{
Stdio:
()
=
>
mockStdio
,
Pub:
()
=
>
Pub
(
fileSystem:
globals
.
fs
,
logger:
globals
.
logger
,
...
...
@@ -372,7 +345,6 @@ void main() {
usage:
globals
.
flutterUsage
,
botDetector:
globals
.
botDetector
,
platform:
globals
.
platform
,
stdio:
mockStdio
,
),
});
...
...
@@ -386,7 +358,6 @@ void main() {
expect
((
await
getCommand
.
usageValues
)
.
commandPackagesAndroidEmbeddingVersion
,
'v2'
);
},
overrides:
<
Type
,
Generator
>{
Stdio:
()
=
>
mockStdio
,
Pub:
()
=
>
Pub
(
fileSystem:
globals
.
fs
,
logger:
globals
.
logger
,
...
...
@@ -394,7 +365,6 @@ void main() {
usage:
globals
.
flutterUsage
,
botDetector:
globals
.
botDetector
,
platform:
globals
.
platform
,
stdio:
mockStdio
,
),
});
...
...
@@ -408,7 +378,7 @@ void main() {
expectDependenciesResolved
(
projectPath
);
expectZeroPluginsInjected
(
projectPath
);
},
overrides:
<
Type
,
Generator
>{
Stdio:
()
=
>
mock
Stdio
,
Stdio:
()
=
>
Fake
Stdio
().
.
stdout
.
terminalColumns
=
80
,
Pub:
()
=
>
Pub
(
fileSystem:
globals
.
fs
,
logger:
globals
.
logger
,
...
...
@@ -416,7 +386,6 @@ void main() {
usage:
globals
.
flutterUsage
,
botDetector:
globals
.
botDetector
,
platform:
globals
.
platform
,
stdio:
mockStdio
,
),
});
...
...
@@ -430,7 +399,6 @@ void main() {
expectDependenciesResolved
(
projectPath
);
expectModulePluginInjected
(
projectPath
);
},
overrides:
<
Type
,
Generator
>{
Stdio:
()
=
>
mockStdio
,
Pub:
()
=
>
Pub
(
fileSystem:
globals
.
fs
,
logger:
globals
.
logger
,
...
...
@@ -438,7 +406,6 @@ void main() {
usage:
globals
.
flutterUsage
,
botDetector:
globals
.
botDetector
,
platform:
globals
.
platform
,
stdio:
mockStdio
,
),
});
...
...
@@ -460,7 +427,6 @@ void main() {
expectDependenciesResolved
(
exampleProjectPath
);
expectPluginInjected
(
exampleProjectPath
);
},
overrides:
<
Type
,
Generator
>{
Stdio:
()
=
>
mockStdio
,
Pub:
()
=
>
Pub
(
fileSystem:
globals
.
fs
,
logger:
globals
.
logger
,
...
...
@@ -468,17 +434,17 @@ void main() {
usage:
globals
.
flutterUsage
,
botDetector:
globals
.
botDetector
,
platform:
globals
.
platform
,
stdio:
mockStdio
,
),
});
});
group
(
'packages test/pub'
,
()
{
FakeProcessManager
processManager
;
FakeStdio
mockStdio
;
setUp
(()
{
processManager
=
FakeProcessManager
.
empty
();
mockStdio
=
FakeStdio
().
.
stdout
.
terminalColumns
=
80
;
});
testUsingContext
(
'test without bot'
,
()
async
{
...
...
@@ -504,7 +470,6 @@ void main() {
usage:
globals
.
flutterUsage
,
botDetector:
globals
.
botDetector
,
platform:
globals
.
platform
,
stdio:
mockStdio
,
),
});
...
...
@@ -530,7 +495,6 @@ void main() {
usage:
globals
.
flutterUsage
,
botDetector:
globals
.
botDetector
,
platform:
globals
.
platform
,
stdio:
mockStdio
,
),
});
...
...
@@ -561,7 +525,6 @@ void main() {
usage:
globals
.
flutterUsage
,
botDetector:
globals
.
botDetector
,
platform:
globals
.
platform
,
stdio:
mockStdio
,
),
});
...
...
@@ -592,7 +555,6 @@ void main() {
usage:
globals
.
flutterUsage
,
botDetector:
globals
.
botDetector
,
platform:
globals
.
platform
,
stdio:
mockStdio
,
),
});
...
...
@@ -621,7 +583,6 @@ void main() {
usage:
globals
.
flutterUsage
,
botDetector:
globals
.
botDetector
,
platform:
globals
.
platform
,
stdio:
mockStdio
,
),
});
});
...
...
This diff is collapsed.
Click to expand it.
Prev
1
2
Next
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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
Menu
Projects
Groups
Snippets