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
a40ee8a3
Unverified
Commit
a40ee8a3
authored
Nov 11, 2020
by
Jonah Williams
Committed by
GitHub
Nov 11, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[flutter_tools] migrate .packages to package_config, partial (#70200)
parent
5b19328f
Changes
26
Hide whitespace changes
Inline
Side-by-side
Showing
26 changed files
with
95 additions
and
91 deletions
+95
-91
fuchsia_tester.dart
packages/flutter_tools/bin/fuchsia_tester.dart
+7
-5
build_info.dart
packages/flutter_tools/lib/src/build_info.dart
+1
-1
bundle.dart
packages/flutter_tools/lib/src/bundle.dart
+0
-3
cache.dart
packages/flutter_tools/lib/src/cache.dart
+1
-1
build_bundle.dart
packages/flutter_tools/lib/src/commands/build_bundle.dart
+0
-1
test.dart
packages/flutter_tools/lib/src/commands/test.dart
+3
-1
package_map.dart
packages/flutter_tools/lib/src/dart/package_map.dart
+1
-14
devfs_web.dart
packages/flutter_tools/lib/src/isolated/devfs_web.dart
+1
-1
resident_runner.dart
packages/flutter_tools/lib/src/resident_runner.dart
+2
-3
run_hot.dart
packages/flutter_tools/lib/src/run_hot.dart
+0
-1
flutter_command.dart
packages/flutter_tools/lib/src/runner/flutter_command.dart
+3
-3
flutter_command_runner.dart
.../flutter_tools/lib/src/runner/flutter_command_runner.dart
+4
-18
local_engine.dart
packages/flutter_tools/lib/src/runner/local_engine.dart
+5
-2
template.dart
packages/flutter_tools/lib/src/template.dart
+1
-1
coverage_collector.dart
packages/flutter_tools/lib/src/test/coverage_collector.dart
+7
-5
flutter_platform.dart
packages/flutter_tools/lib/src/test/flutter_platform.dart
+2
-2
flutter_web_platform.dart
...ages/flutter_tools/lib/src/test/flutter_web_platform.dart
+2
-2
runner.dart
packages/flutter_tools/lib/src/test/runner.dart
+0
-6
test_compiler.dart
packages/flutter_tools/lib/src/test/test_compiler.dart
+2
-2
create_usage_test.dart
...tools/test/commands.shard/hermetic/create_usage_test.dart
+13
-2
build_bundle_test.dart
...ools/test/commands.shard/permeable/build_bundle_test.dart
+0
-2
gradle_test.dart
...flutter_tools/test/general.shard/android/gradle_test.dart
+1
-1
flutter_platform_test.dart
...utter_tools/test/general.shard/flutter_platform_test.dart
+7
-4
project_test.dart
packages/flutter_tools/test/general.shard/project_test.dart
+27
-5
resident_runner_test.dart
...lutter_tools/test/general.shard/resident_runner_test.dart
+1
-1
local_engine_test.dart
...er_tools/test/general.shard/runner/local_engine_test.dart
+4
-4
No files found.
packages/flutter_tools/bin/fuchsia_tester.dart
View file @
a40ee8a3
...
...
@@ -14,7 +14,6 @@ import 'package:flutter_tools/src/base/io.dart';
import
'package:flutter_tools/src/build_info.dart'
;
import
'package:flutter_tools/src/cache.dart'
;
import
'package:flutter_tools/src/context_runner.dart'
;
import
'package:flutter_tools/src/dart/package_map.dart'
;
import
'package:flutter_tools/src/artifacts.dart'
;
import
'package:flutter_tools/src/globals.dart'
as
globals
;
import
'package:flutter_tools/src/project.dart'
;
...
...
@@ -108,13 +107,11 @@ Future<void> run(List<String> args) async {
// TODO(tvolkert): Remove once flutter_tester no longer looks for this.
globals
.
fs
.
link
(
sdkRootDest
.
childFile
(
'platform.dill'
).
path
).
createSync
(
'platform_strong.dill'
);
globalPackagesPath
=
globals
.
fs
.
path
.
normalize
(
globals
.
fs
.
path
.
absolute
(
argResults
[
_kOptionPackages
]
as
String
));
Directory
testDirectory
;
CoverageCollector
collector
;
if
(
argResults
[
'coverage'
]
as
bool
)
{
collector
=
CoverageCollector
(
packagesPath:
globals
.
fs
.
path
.
normalize
(
globals
.
fs
.
path
.
absolute
(
argResults
[
_kOptionPackages
]
as
String
)),
libraryPredicate:
(
String
libraryName
)
{
// If we have a specified coverage directory then accept all libraries.
if
(
coverageDirectory
!=
null
)
{
...
...
@@ -147,7 +144,12 @@ Future<void> run(List<String> args) async {
watcher:
collector
,
ipv6:
false
,
enableObservatory:
collector
!=
null
,
buildInfo:
BuildInfo
.
debug
,
buildInfo:
BuildInfo
(
BuildMode
.
debug
,
''
,
treeShakeIcons:
false
,
packagesPath:
globals
.
fs
.
path
.
normalize
(
globals
.
fs
.
path
.
absolute
(
argResults
[
_kOptionPackages
]
as
String
),
)),
precompiledDillFiles:
tests
,
concurrency:
math
.
max
(
1
,
globals
.
platform
.
numberOfProcessors
-
2
),
icudtlPath:
globals
.
fs
.
path
.
absolute
(
argResults
[
_kOptionIcudtl
]
as
String
),
...
...
packages/flutter_tools/lib/src/build_info.dart
View file @
a40ee8a3
...
...
@@ -32,7 +32,7 @@ class BuildInfo {
this
.
dartExperiments
=
const
<
String
>[],
@required
this
.
treeShakeIcons
,
this
.
performanceMeasurementFile
,
this
.
packagesPath
=
'.packages'
,
this
.
packagesPath
=
'.packages'
,
// TODO(jonahwilliams): make this required and remove the default.
this
.
nullSafetyMode
=
NullSafetyMode
.
autodetect
,
this
.
codeSizeDirectory
,
this
.
androidGradleDaemon
=
true
,
...
...
packages/flutter_tools/lib/src/bundle.dart
View file @
a40ee8a3
...
...
@@ -81,9 +81,7 @@ class BundleBuilder {
String
manifestPath
=
defaultManifestPath
,
String
applicationKernelFilePath
,
String
depfilePath
,
String
privateKeyPath
=
defaultPrivateKeyPath
,
String
assetDirPath
,
String
packagesPath
,
bool
precompiledSnapshot
=
false
,
bool
reportLicensedPackages
=
false
,
bool
trackWidgetCreation
=
false
,
...
...
@@ -96,7 +94,6 @@ class BundleBuilder {
mainPath
??=
defaultMainPath
;
depfilePath
??=
defaultDepfilePath
;
assetDirPath
??=
getAssetBuildDirectory
();
packagesPath
??=
globals
.
fs
.
path
.
absolute
(
'.packages'
);
final
FlutterProject
flutterProject
=
FlutterProject
.
current
();
await
buildWithAssemble
(
buildMode:
buildInfo
.
mode
,
...
...
packages/flutter_tools/lib/src/cache.dart
View file @
a40ee8a3
...
...
@@ -741,7 +741,7 @@ class PubDependencies extends ArtifactSet {
FileSystem
fileSystem
,
)
async
{
final
File
toolPackageConfig
=
fileSystem
.
file
(
fileSystem
.
path
.
join
(
_flutterRoot
(),
'packages'
,
'flutter_tools'
,
kPackagesFileName
),
fileSystem
.
path
.
join
(
_flutterRoot
(),
'packages'
,
'flutter_tools'
,
'.dart_tool'
,
'package_config.json'
),
);
if
(!
toolPackageConfig
.
existsSync
())
{
return
false
;
...
...
packages/flutter_tools/lib/src/commands/build_bundle.dart
View file @
a40ee8a3
...
...
@@ -121,7 +121,6 @@ class BuildBundleCommand extends BuildSubCommand {
mainPath:
targetFile
,
manifestPath:
stringArg
(
'manifest'
),
depfilePath:
stringArg
(
'depfile'
),
privateKeyPath:
stringArg
(
'private-key'
),
assetDirPath:
stringArg
(
'asset-dir'
),
precompiledSnapshot:
boolArg
(
'precompiled'
),
reportLicensedPackages:
boolArg
(
'report-licensed-packages'
),
...
...
packages/flutter_tools/lib/src/commands/test.dart
View file @
a40ee8a3
...
...
@@ -171,6 +171,7 @@ class TestCommand extends FlutterCommand {
final
List
<
String
>
plainNames
=
stringsArg
(
'plain-name'
);
final
String
tags
=
stringArg
(
'tags'
);
final
String
excludeTags
=
stringArg
(
'exclude-tags'
);
final
BuildInfo
buildInfo
=
getBuildInfo
(
forcedBuildMode:
BuildMode
.
debug
);
if
(
buildTestAssets
&&
flutterProject
.
manifest
.
assets
.
isNotEmpty
)
{
await
_buildTestAsset
();
...
...
@@ -225,6 +226,8 @@ class TestCommand extends FlutterCommand {
collector
=
CoverageCollector
(
verbose:
!
machine
,
libraryPredicate:
(
String
libraryName
)
=>
libraryName
.
contains
(
projectName
),
// TODO(jonahwilliams): file bug for incorrect URI handling on windws
packagesPath:
globals
.
fs
.
path
.
absolute
(
'.packages'
),
);
}
...
...
@@ -236,7 +239,6 @@ class TestCommand extends FlutterCommand {
}
final
bool
disableServiceAuthCodes
=
boolArg
(
'disable-service-auth-codes'
);
final
BuildInfo
buildInfo
=
getBuildInfo
(
forcedBuildMode:
BuildMode
.
debug
);
final
int
result
=
await
testRunner
.
runTests
(
testWrapper
,
...
...
packages/flutter_tools/lib/src/dart/package_map.dart
View file @
a40ee8a3
...
...
@@ -11,23 +11,10 @@ import '../base/common.dart';
import
'../base/file_system.dart'
;
import
'../base/logger.dart'
;
const
String
kPackagesFileName
=
'.packages'
;
// No touching!
String
get
globalPackagesPath
=>
_globalPackagesPath
??
kPackagesFileName
;
set
globalPackagesPath
(
String
value
)
{
_globalPackagesPath
=
value
;
}
bool
get
isUsingCustomPackagesPath
=>
_globalPackagesPath
!=
null
;
String
_globalPackagesPath
;
/// Load the package configuration from [file] or throws a [ToolExit]
/// if the operation would fail.
///
/// If [
nonFatal] is tru
e, in the event of an error an empty package
/// If [
throwOnError] is fals
e, in the event of an error an empty package
/// config is returned.
Future
<
PackageConfig
>
loadPackageConfigWithLogging
(
File
file
,
{
@required
Logger
logger
,
...
...
packages/flutter_tools/lib/src/isolated/devfs_web.dart
View file @
a40ee8a3
...
...
@@ -1092,7 +1092,7 @@ Future<Directory> _loadDwdsDirectory(
final
String
toolPackagePath
=
fileSystem
.
path
.
join
(
Cache
.
flutterRoot
,
'packages'
,
'flutter_tools'
);
final
String
packageFilePath
=
fileSystem
.
path
.
join
(
toolPackagePath
,
kPackagesFileName
);
fileSystem
.
path
.
join
(
toolPackagePath
,
'.dart_tool'
,
'package_config.json'
);
final
PackageConfig
packageConfig
=
await
loadPackageConfigWithLogging
(
fileSystem
.
file
(
packageFilePath
),
logger:
logger
,
...
...
packages/flutter_tools/lib/src/resident_runner.dart
View file @
a40ee8a3
...
...
@@ -369,9 +369,8 @@ class FlutterDevice {
Future
<
Uri
>
setupDevFS
(
String
fsName
,
Directory
rootDirectory
,
{
String
packagesFilePath
,
})
{
Directory
rootDirectory
,
)
{
// One devFS per device. Shared by all running instances.
devFS
=
DevFS
(
vmService
,
...
...
packages/flutter_tools/lib/src/run_hot.dart
View file @
a40ee8a3
...
...
@@ -366,7 +366,6 @@ class HotRunner extends ResidentRunner {
await
device
.
setupDevFS
(
fsName
,
globals
.
fs
.
directory
(
projectRootPath
),
packagesFilePath:
packagesFilePath
,
),
];
}
...
...
packages/flutter_tools/lib/src/runner/flutter_command.dart
View file @
a40ee8a3
...
...
@@ -21,7 +21,6 @@ import '../build_system/targets/icon_tree_shaker.dart' show kIconTreeShakerEnabl
import
'../bundle.dart'
as
bundle
;
import
'../cache.dart'
;
import
'../dart/generate_synthetic_packages.dart'
;
import
'../dart/package_map.dart'
;
import
'../dart/pub.dart'
;
import
'../device.dart'
;
import
'../features.dart'
;
...
...
@@ -882,7 +881,8 @@ abstract class FlutterCommand extends Command<void> {
bundleSkSLPath:
bundleSkSLPath
,
dartExperiments:
experiments
,
performanceMeasurementFile:
performanceMeasurementFile
,
packagesPath:
globalResults
[
'packages'
]
as
String
??
'.packages'
,
packagesPath:
globalResults
[
'packages'
]
as
String
??
globals
.
fs
.
path
.
absolute
(
'.dart_tool'
,
'package_config.json'
),
nullSafetyMode:
nullSafetyMode
,
codeSizeDirectory:
codeSizeDirectory
,
androidGradleDaemon:
androidGradleDaemon
,
...
...
@@ -1174,7 +1174,7 @@ abstract class FlutterCommand extends Command<void> {
@protected
@mustCallSuper
Future
<
void
>
validateCommand
()
async
{
if
(
_requiresPubspecYaml
&&
!
isUsingCustomPackagesPath
)
{
if
(
_requiresPubspecYaml
&&
!
globalResults
.
wasParsed
(
'packages'
)
)
{
// Don't expect a pubspec.yaml file if the user passed in an explicit .packages file path.
// If there is no pubspec in the current directory, look in the parent
...
...
packages/flutter_tools/lib/src/runner/flutter_command_runner.dart
View file @
a40ee8a3
...
...
@@ -16,7 +16,6 @@ import '../base/user_messages.dart';
import
'../base/utils.dart'
;
import
'../cache.dart'
;
import
'../convert.dart'
;
import
'../dart/package_map.dart'
;
import
'../globals.dart'
as
globals
;
import
'../tester/flutter_tester.dart'
;
...
...
@@ -82,19 +81,9 @@ class FlutterCommandRunner extends CommandRunner<void> {
argParser
.
addFlag
(
'suppress-analytics'
,
negatable:
false
,
help:
'Suppress analytics reporting when this command runs.'
);
String
packagesHelp
;
bool
showPackagesCommand
;
if
(
globals
.
fs
.
isFileSync
(
kPackagesFileName
))
{
packagesHelp
=
'(defaults to "
$kPackagesFileName
")'
;
showPackagesCommand
=
verboseHelp
;
}
else
{
packagesHelp
=
'(required, since the current directory does not contain a "
$kPackagesFileName
" file)'
;
showPackagesCommand
=
true
;
}
argParser
.
addOption
(
'packages'
,
hide:
!
showPackagesCommand
,
help:
'Path to your "
.packages" file.
\n
$packagesHelp
'
);
hide:
!
verboseHelp
,
help:
'Path to your "
package_config.json" file.
'
);
if
(
verboseHelp
)
{
argParser
.
addSeparator
(
'Local build selection options (not normally required):'
);
}
...
...
@@ -219,7 +208,8 @@ class FlutterCommandRunner extends CommandRunner<void> {
// Set up the tooling configuration.
final
EngineBuildPaths
engineBuildPaths
=
await
globals
.
localEngineLocator
.
findEnginePath
(
topLevelResults
[
'local-engine-src-path'
]
as
String
,
topLevelResults
[
'local-engine'
]
as
String
topLevelResults
[
'local-engine'
]
as
String
,
topLevelResults
[
'packages'
]
as
String
,
);
if
(
engineBuildPaths
!=
null
)
{
contextOverrides
.
addAll
(<
Type
,
dynamic
>{
...
...
@@ -254,10 +244,6 @@ class FlutterCommandRunner extends CommandRunner<void> {
await
globals
.
flutterVersion
.
checkFlutterVersionFreshness
();
}
if
(
topLevelResults
.
wasParsed
(
'packages'
))
{
globalPackagesPath
=
globals
.
fs
.
path
.
normalize
(
globals
.
fs
.
path
.
absolute
(
topLevelResults
[
'packages'
]
as
String
));
}
// See if the user specified a specific device.
globals
.
deviceManager
.
specifiedDeviceId
=
topLevelResults
[
'device-id'
]
as
String
;
...
...
packages/flutter_tools/lib/src/runner/local_engine.dart
View file @
a40ee8a3
...
...
@@ -47,13 +47,16 @@ class LocalEngineLocator {
final
UserMessages
_userMessages
;
/// Returns the engine build path of a local engine if one is located, otherwise `null`.
Future
<
EngineBuildPaths
>
findEnginePath
(
String
engineSourcePath
,
String
localEngine
)
async
{
Future
<
EngineBuildPaths
>
findEnginePath
(
String
engineSourcePath
,
String
localEngine
,
String
packagePath
)
async
{
engineSourcePath
??=
_platform
.
environment
[
kFlutterEngineEnvironmentVariableName
];
if
(
engineSourcePath
==
null
&&
localEngine
!=
null
)
{
try
{
final
PackageConfig
packageConfig
=
await
loadPackageConfigWithLogging
(
_fileSystem
.
file
(
globalPackagesPath
),
_fileSystem
.
file
(
// TODO(jonahwilliams): update to package_config
packagePath
??
_fileSystem
.
path
.
join
(
'.packages'
),
),
logger:
_logger
,
throwOnError:
false
,
);
...
...
packages/flutter_tools/lib/src/template.dart
View file @
a40ee8a3
...
...
@@ -281,7 +281,7 @@ Directory _templateDirectoryInPackage(String name, FileSystem fileSystem) {
Future
<
Directory
>
_templateImageDirectory
(
String
name
,
FileSystem
fileSystem
,
Logger
logger
)
async
{
final
String
toolPackagePath
=
fileSystem
.
path
.
join
(
Cache
.
flutterRoot
,
'packages'
,
'flutter_tools'
);
final
String
packageFilePath
=
fileSystem
.
path
.
join
(
toolPackagePath
,
kPackagesFileName
);
final
String
packageFilePath
=
fileSystem
.
path
.
join
(
toolPackagePath
,
'.dart_tool'
,
'package_config.json'
);
final
PackageConfig
packageConfig
=
await
loadPackageConfigWithLogging
(
fileSystem
.
file
(
packageFilePath
),
logger:
logger
,
...
...
packages/flutter_tools/lib/src/test/coverage_collector.dart
View file @
a40ee8a3
...
...
@@ -3,13 +3,13 @@
// found in the LICENSE file.
import
'package:coverage/coverage.dart'
as
coverage
;
import
'package:meta/meta.dart'
;
import
'package:vm_service/vm_service.dart'
as
vm_service
;
import
'../base/file_system.dart'
;
import
'../base/io.dart'
;
import
'../base/process.dart'
;
import
'../base/utils.dart'
;
import
'../dart/package_map.dart'
;
import
'../globals.dart'
as
globals
;
import
'../vmservice.dart'
;
...
...
@@ -17,9 +17,10 @@ import 'watcher.dart';
/// A class that's used to collect coverage data during tests.
class
CoverageCollector
extends
TestWatcher
{
CoverageCollector
({
this
.
libraryPredicate
,
this
.
verbose
=
true
});
CoverageCollector
({
this
.
libraryPredicate
,
this
.
verbose
=
true
,
@required
this
.
packagesPath
});
final
bool
verbose
;
final
String
packagesPath
;
Map
<
String
,
Map
<
int
,
int
>>
_globalHitmap
;
bool
Function
(
String
)
libraryPredicate
;
...
...
@@ -66,7 +67,7 @@ class CoverageCollector extends TestWatcher {
_logMessage
(
'(
$observatoryUri
): collected coverage data; merging...'
);
_addHitmap
(
await
coverage
.
createHitmap
(
data
[
'coverage'
]
as
List
<
Map
<
String
,
dynamic
>>,
packagesPath:
globalP
ackagesPath
,
packagesPath:
p
ackagesPath
,
checkIgnoredLines:
true
,
));
_logMessage
(
'(
$observatoryUri
): done merging coverage data into global coverage map.'
);
...
...
@@ -102,7 +103,7 @@ class CoverageCollector extends TestWatcher {
_logMessage
(
'pid
$pid
(
$observatoryUri
): collected coverage data; merging...'
);
_addHitmap
(
await
coverage
.
createHitmap
(
data
[
'coverage'
]
as
List
<
Map
<
String
,
dynamic
>>,
packagesPath:
globalP
ackagesPath
,
packagesPath:
p
ackagesPath
,
checkIgnoredLines:
true
,
));
_logMessage
(
'pid
$pid
(
$observatoryUri
): done merging coverage data into global coverage map.'
);
...
...
@@ -116,12 +117,13 @@ class CoverageCollector extends TestWatcher {
Future
<
String
>
finalizeCoverage
({
coverage
.
Formatter
formatter
,
Directory
coverageDirectory
,
String
packagesPath
,
})
async
{
if
(
_globalHitmap
==
null
)
{
return
null
;
}
if
(
formatter
==
null
)
{
final
coverage
.
Resolver
resolver
=
coverage
.
Resolver
(
packagesPath:
globalP
ackagesPath
);
final
coverage
.
Resolver
resolver
=
coverage
.
Resolver
(
packagesPath:
p
ackagesPath
);
final
String
packagePath
=
globals
.
fs
.
currentDirectory
.
path
;
final
List
<
String
>
reportOn
=
coverageDirectory
==
null
?
<
String
>[
globals
.
fs
.
path
.
join
(
packagePath
,
'lib'
)]
...
...
packages/flutter_tools/lib/src/test/flutter_platform.dart
View file @
a40ee8a3
...
...
@@ -377,7 +377,7 @@ class FlutterPlatform extends PlatformPlugin {
int
ourTestCount
,
)
async
{
_packageConfig
??=
await
loadPackageConfigWithLogging
(
globals
.
fs
.
file
(
globalP
ackagesPath
),
globals
.
fs
.
file
(
buildInfo
.
p
ackagesPath
),
logger:
globals
.
logger
,
);
globals
.
printTrace
(
'test
$ourTestCount
: starting test
$testPath
'
);
...
...
@@ -446,7 +446,7 @@ class FlutterPlatform extends PlatformPlugin {
final
Process
process
=
await
_startProcess
(
shellPath
,
mainDart
,
packages:
globalP
ackagesPath
,
packages:
buildInfo
.
p
ackagesPath
,
enableObservatory:
enableObservatory
,
startPaused:
startPaused
,
disableServiceAuthCodes:
disableServiceAuthCodes
,
...
...
packages/flutter_tools/lib/src/test/flutter_web_platform.dart
View file @
a40ee8a3
...
...
@@ -90,7 +90,7 @@ class FlutterWebPlatform extends PlatformPlugin {
}
final
Future
<
PackageConfig
>
_packagesFuture
=
loadPackageConfigWithLogging
(
globals
.
fs
.
file
(
global
PackagesPath
),
globals
.
fs
.
file
(
global
s
.
fs
.
path
.
join
(
'.dart_tool'
,
'package_config.json'
)
),
logger:
globals
.
logger
,
);
...
...
@@ -864,7 +864,7 @@ class TestGoldenComparator {
shellPath
,
'--disable-observatory'
,
'--non-interactive'
,
'--packages=
$
globalPackagesPath
'
,
'--packages=
$
{globals.fs.path.join('.dart_tool', 'package_config.json')}
'
,
output
,
];
...
...
packages/flutter_tools/lib/src/test/runner.dart
View file @
a40ee8a3
...
...
@@ -9,7 +9,6 @@ import '../base/common.dart';
import
'../base/file_system.dart'
;
import
'../base/io.dart'
;
import
'../build_info.dart'
;
import
'../dart/package_map.dart'
;
import
'../globals.dart'
as
globals
;
import
'../project.dart'
;
import
'../web/compile.dart'
;
...
...
@@ -178,11 +177,6 @@ class _FlutterTestRunnerImpl implements FlutterTestRunner {
buildInfo:
buildInfo
,
);
// Make the global packages path absolute.
// (Makes sure it still works after we change the current directory.)
globalPackagesPath
=
globals
.
fs
.
path
.
normalize
(
globals
.
fs
.
path
.
absolute
(
globalPackagesPath
));
// Call package:test's main method in the appropriate directory.
final
Directory
saved
=
globals
.
fs
.
currentDirectory
;
try
{
...
...
packages/flutter_tools/lib/src/test/test_compiler.dart
View file @
a40ee8a3
...
...
@@ -107,7 +107,7 @@ class TestCompiler {
initializeFromDill:
testFilePath
,
unsafePackageSerialization:
false
,
dartDefines:
buildInfo
.
dartDefines
,
packagesPath:
globalP
ackagesPath
,
packagesPath:
buildInfo
.
p
ackagesPath
,
extraFrontEndOptions:
buildInfo
.
extraFrontEndOptions
,
platform:
globals
.
platform
,
testCompilation:
true
,
...
...
@@ -129,7 +129,7 @@ class TestCompiler {
}
if
(
_packageConfig
==
null
)
{
_packageConfig
??=
await
loadPackageConfigWithLogging
(
globals
.
fs
.
file
(
globalP
ackagesPath
),
globals
.
fs
.
file
(
buildInfo
.
p
ackagesPath
),
logger:
globals
.
logger
,
);
// Compilation will fail if there is no flutter_test dependency, since
...
...
packages/flutter_tools/test/commands.shard/hermetic/create_usage_test.dart
View file @
a40ee8a3
...
...
@@ -6,6 +6,7 @@ import 'package:args/command_runner.dart';
import
'package:flutter_tools/src/base/file_system.dart'
;
import
'package:flutter_tools/src/cache.dart'
;
import
'package:flutter_tools/src/commands/create.dart'
;
import
'package:flutter_tools/src/convert.dart'
;
import
'package:flutter_tools/src/doctor.dart'
;
import
'package:flutter_tools/src/reporting/reporting.dart'
;
import
'package:flutter_tools/src/globals.dart'
as
globals
;
...
...
@@ -39,14 +40,24 @@ void main() {
}
// Set up enough of the packages to satisfy the templating code.
final
File
packagesFile
=
globals
.
fs
.
file
(
globals
.
fs
.
path
.
join
(
'flutter'
,
'packages'
,
'flutter_tools'
,
'.
packages
'
));
globals
.
fs
.
path
.
join
(
'flutter'
,
'packages'
,
'flutter_tools'
,
'.
dart_tool'
,
'package_config.json
'
));
final
File
flutterManifest
=
globals
.
fs
.
file
(
globals
.
fs
.
path
.
join
(
'flutter'
,
'packages'
,
'flutter_tools'
,
'templates'
,
'template_manifest.json'
))
..
createSync
(
recursive:
true
);
final
Directory
templateImagesDirectory
=
globals
.
fs
.
directory
(
'flutter_template_images'
);
templateImagesDirectory
.
createSync
(
recursive:
true
);
packagesFile
.
createSync
(
recursive:
true
);
packagesFile
.
writeAsStringSync
(
'flutter_template_images:file:///
${templateImagesDirectory.uri}
'
);
packagesFile
.
writeAsStringSync
(
json
.
encode
(<
String
,
Object
>{
'configVersion'
:
2
,
'packages'
:
<
Object
>[
<
String
,
Object
>{
'name'
:
'flutter_template_images'
,
'languageVersion'
:
'2.8'
,
'rootUri'
:
templateImagesDirectory
.
uri
.
toString
(),
'packageUri'
:
'lib/'
,
},
],
}));
flutterManifest
.
writeAsStringSync
(
'{"files":[]}'
);
},
overrides:
<
Type
,
Generator
>{
DoctorValidatorsProvider:
()
=>
FakeDoctorValidatorsProvider
(),
...
...
packages/flutter_tools/test/commands.shard/permeable/build_bundle_test.dart
View file @
a40ee8a3
...
...
@@ -38,9 +38,7 @@ void main() {
manifestPath:
anyNamed
(
'manifestPath'
),
applicationKernelFilePath:
anyNamed
(
'applicationKernelFilePath'
),
depfilePath:
anyNamed
(
'depfilePath'
),
privateKeyPath:
anyNamed
(
'privateKeyPath'
),
assetDirPath:
anyNamed
(
'assetDirPath'
),
packagesPath:
anyNamed
(
'packagesPath'
),
precompiledSnapshot:
anyNamed
(
'precompiledSnapshot'
),
reportLicensedPackages:
anyNamed
(
'reportLicensedPackages'
),
trackWidgetCreation:
anyNamed
(
'trackWidgetCreation'
),
...
...
packages/flutter_tools/test/general.shard/android/gradle_test.dart
View file @
a40ee8a3
...
...
@@ -2701,7 +2701,7 @@ plugin1=${plugin1.path}
legacySettingsDotGradleFiles
.
readAsStringSync
().
split
(
';EOF'
).
map
<
String
>((
String
body
)
=>
body
.
trim
()),
contains
(
templateSettingsDotGradle
.
readAsStringSync
().
trim
()),
);
}
);
}
,
skip:
true
);
// TODO(jonahwilliams): This is an integration test and should be moved to the integration shard.
}
/// Generates a fake app bundle at the location [directoryName]/[fileName].
...
...
packages/flutter_tools/test/general.shard/flutter_platform_test.dart
View file @
a40ee8a3
...
...
@@ -23,7 +23,10 @@ void main() {
setUp
(()
{
fileSystem
=
MemoryFileSystem
.
test
();
fileSystem
.
file
(
'.packages'
).
writeAsStringSync
(
'
\n
'
);
fileSystem
.
file
(
'.dart_tool/package_config.json'
)
..
createSync
(
recursive:
true
)
..
writeAsStringSync
(
'{"configVersion":2,"packages":[]}'
);
});
group
(
'FlutterPlatform'
,
()
{
...
...
@@ -82,7 +85,7 @@ void main() {
'--enable-dart-profiling'
,
'--non-interactive'
,
'--use-test-fonts'
,
'--packages=.
packages
'
,
'--packages=.
dart_tool/package_config.json
'
,
'example.dill'
],
stdout:
'success'
,
...
...
@@ -237,7 +240,7 @@ class MockHttpServer extends Mock implements HttpServer {}
// Uses a mock HttpServer. We don't want to bind random ports in our CI hosts.
class
TestFlutterPlatform
extends
FlutterPlatform
{
TestFlutterPlatform
()
:
super
(
buildInfo:
BuildInfo
.
debug
,
buildInfo:
const
BuildInfo
(
BuildMode
.
debug
,
''
,
treeShakeIcons:
false
,
packagesPath:
'.dart_tool/package_config.json'
)
,
shellPath:
'/'
,
precompiledDillPath:
'example.dill'
,
host:
InternetAddress
.
loopbackIPv6
,
...
...
@@ -259,7 +262,7 @@ class TestFlutterPlatform extends FlutterPlatform {
// Uses a mock HttpServer. We don't want to bind random ports in our CI hosts.
class
TestObservatoryFlutterPlatform
extends
FlutterPlatform
{
TestObservatoryFlutterPlatform
()
:
super
(
buildInfo:
BuildInfo
.
debug
,
buildInfo:
const
BuildInfo
(
BuildMode
.
debug
,
''
,
treeShakeIcons:
false
,
packagesPath:
'.dart_tool/package_config.json'
)
,
shellPath:
'/'
,
precompiledDillPath:
'example.dill'
,
host:
InternetAddress
.
loopbackIPv6
,
...
...
packages/flutter_tools/test/general.shard/project_test.dart
View file @
a40ee8a3
...
...
@@ -699,7 +699,10 @@ apply plugin: 'kotlin-android'
Future
<
FlutterProject
>
someProject
()
async
{
final
Directory
directory
=
globals
.
fs
.
directory
(
'some_project'
);
directory
.
childFile
(
'.packages'
).
createSync
(
recursive:
true
);
directory
.
childDirectory
(
'.dart_tool'
)
.
childFile
(
'package_config.json'
)
..
createSync
(
recursive:
true
)
..
writeAsStringSync
(
'{"configVersion":2,"packages":[]}'
);
directory
.
childDirectory
(
'ios'
).
createSync
(
recursive:
true
);
final
Directory
androidDirectory
=
directory
.
childDirectory
(
'android'
)
...
...
@@ -750,7 +753,11 @@ flutter:
Future
<
FlutterProject
>
aModuleProject
()
async
{
final
Directory
directory
=
globals
.
fs
.
directory
(
'module_project'
);
directory
.
childFile
(
'.packages'
).
createSync
(
recursive:
true
);
directory
.
childDirectory
(
'.dart_tool'
)
.
childFile
(
'package_config.json'
)
..
createSync
(
recursive:
true
)
..
writeAsStringSync
(
'{"configVersion":2,"packages":[]}'
);
directory
.
childFile
(
'pubspec.yaml'
).
writeAsStringSync
(
'''
name: my_module
flutter:
...
...
@@ -768,7 +775,11 @@ void _testInMemory(String description, Future<void> testMethod()) {
final
FileSystem
testFileSystem
=
MemoryFileSystem
(
style:
globals
.
platform
.
isWindows
?
FileSystemStyle
.
windows
:
FileSystemStyle
.
posix
,
);
testFileSystem
.
file
(
'.packages'
).
writeAsStringSync
(
'
\n
'
);
testFileSystem
.
directory
(
'.dart_tool'
)
.
childFile
(
'package_config.json'
)
..
createSync
(
recursive:
true
)
..
writeAsStringSync
(
'{"configVersion":2,"packages":[]}'
);
// Transfer needed parts of the Flutter installation folder
// to the in-memory file system used during testing.
transfer
(
Cache
(
...
...
@@ -789,11 +800,22 @@ void _testInMemory(String description, Future<void> testMethod()) {
final
File
packagesFile
=
testFileSystem
.
directory
(
Cache
.
flutterRoot
)
.
childDirectory
(
'packages'
)
.
childDirectory
(
'flutter_tools'
)
.
childFile
(
'.packages'
);
.
childDirectory
(
'.dart_tool'
)
.
childFile
(
'package_config.json'
);
final
Directory
dummyTemplateImagesDirectory
=
testFileSystem
.
directory
(
Cache
.
flutterRoot
).
parent
;
dummyTemplateImagesDirectory
.
createSync
(
recursive:
true
);
packagesFile
.
createSync
(
recursive:
true
);
packagesFile
.
writeAsStringSync
(
'flutter_template_images:
${dummyTemplateImagesDirectory.uri}
'
);
packagesFile
.
writeAsStringSync
(
json
.
encode
(<
String
,
Object
>{
'configVersion'
:
2
,
'packages'
:
<
Object
>[
<
String
,
Object
>{
'name'
:
'flutter_template_images'
,
'rootUri'
:
dummyTemplateImagesDirectory
.
uri
.
toString
(),
'packageUri'
:
'lib/'
,
'languageVersion'
:
'2.6'
},
],
}));
final
FlutterProjectFactory
flutterProjectFactory
=
FlutterProjectFactory
(
fileSystem:
testFileSystem
,
...
...
packages/flutter_tools/test/general.shard/resident_runner_test.dart
View file @
a40ee8a3
...
...
@@ -194,7 +194,7 @@ void main() {
compileExpression:
anyNamed
(
'compileExpression'
),
getSkSLMethod:
anyNamed
(
'getSkSLMethod'
),
)).
thenAnswer
((
Invocation
invocation
)
async
{
});
when
(
mockFlutterDevice
.
setupDevFS
(
any
,
any
,
packagesFilePath:
anyNamed
(
'packagesFilePath'
)
))
when
(
mockFlutterDevice
.
setupDevFS
(
any
,
any
))
.
thenAnswer
((
Invocation
invocation
)
async
{
return
testUri
;
});
...
...
packages/flutter_tools/test/general.shard/runner/local_engine_test.dart
View file @
a40ee8a3
...
...
@@ -43,7 +43,7 @@ void main() {
);
expect
(
await
localEngineLocator
.
findEnginePath
(
null
,
'ios_debug'
),
await
localEngineLocator
.
findEnginePath
(
null
,
'ios_debug'
,
null
),
matchesEngineBuildPaths
(
hostEngine:
'/arbitrary/engine/src/out/host_debug'
,
targetEngine:
'/arbitrary/engine/src/out/ios_debug'
,
...
...
@@ -57,7 +57,7 @@ void main() {
.
writeAsStringSync
(
'sky_engine:file:///symlink/src/out/ios_debug/gen/dart-pkg/sky_engine/lib/'
);
expect
(
await
localEngineLocator
.
findEnginePath
(
null
,
'ios_debug'
),
await
localEngineLocator
.
findEnginePath
(
null
,
'ios_debug'
,
null
),
matchesEngineBuildPaths
(
hostEngine:
'/symlink/src/out/host_debug'
,
targetEngine:
'/symlink/src/out/ios_debug'
,
...
...
@@ -81,7 +81,7 @@ void main() {
);
expect
(
await
localEngineLocator
.
findEnginePath
(
'
$kArbitraryEngineRoot
/src'
,
'ios_debug'
),
await
localEngineLocator
.
findEnginePath
(
'
$kArbitraryEngineRoot
/src'
,
'ios_debug'
,
null
),
matchesEngineBuildPaths
(
hostEngine:
'/arbitrary/engine/src/out/host_debug'
,
targetEngine:
'/arbitrary/engine/src/out/ios_debug'
,
...
...
@@ -112,7 +112,7 @@ void main() {
);
expect
(
await
localEngineLocator
.
findEnginePath
(
null
,
'ios_debug'
),
await
localEngineLocator
.
findEnginePath
(
null
,
'ios_debug'
,
null
),
matchesEngineBuildPaths
(
hostEngine:
'flutter/engine/src/out/host_debug'
,
targetEngine:
'flutter/engine/src/out/ios_debug'
,
...
...
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