Migrate .packages -> package_config.json (#99677)

This commit is contained in:
Sigurd Meldgaard 2022-03-30 13:56:03 +02:00 committed by GitHub
parent 02b2c2cde6
commit 66ed64be4f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 15 additions and 16 deletions

View File

@ -36,7 +36,7 @@ class BuildInfo {
List<String>? dartExperiments,
required this.treeShakeIcons,
this.performanceMeasurementFile,
this.packagesPath = '.packages', // TODO(zanderso): make this required and remove the default.
this.packagesPath = '.dart_tool/package_config.json', // TODO(zanderso): make this required and remove the default.
this.nullSafetyMode = NullSafetyMode.sound,
this.codeSizeDirectory,
this.androidGradleDaemon = true,
@ -67,10 +67,10 @@ class BuildInfo {
/// Mode-Flavor (e.g. Release-Paid).
final String? flavor;
/// The path to the .packages file to use for compilation.
/// The path to the package configuration file to use for compilation.
///
/// This is used by package:package_config to locate the actual package_config.json
/// file. If not provided, defaults to `.packages`.
/// file. If not provided, defaults to `.dart_tool/packages`.
final String packagesPath;
final List<String> fileSystemRoots;

View File

@ -378,8 +378,7 @@ class TestCommand extends FlutterCommand with DeviceBasedDevelopmentArtifacts {
collector = CoverageCollector(
verbose: !machine,
libraryPredicate: (String libraryName) => libraryName.contains(projectName),
packagesPath: globals.fs.file(buildInfo.packagesPath)
.parent.parent.childFile('.packages').path
packagesPath: buildInfo.packagesPath
);
}

View File

@ -3001,8 +3001,9 @@ Future<void> _ensureFlutterToolsSnapshot() async {
'cache',
'flutter_tools.snapshot',
));
final String dotPackages = globals.fs.path.absolute(globals.fs.path.join(
'.packages',
final String packageConfig = globals.fs.path.absolute(globals.fs.path.join(
'.dart_tool',
'package_config.json'
));
final File snapshotFile = globals.fs.file(flutterToolsSnapshotPath);
@ -3012,7 +3013,7 @@ Future<void> _ensureFlutterToolsSnapshot() async {
final List<String> snapshotArgs = <String>[
'--snapshot=$flutterToolsSnapshotPath',
'--packages=$dotPackages',
'--packages=$packageConfig',
flutterToolsPath,
];
final ProcessResult snapshotResult = await Process.run(

View File

@ -106,8 +106,8 @@ void main() {
);
}
const List<String> pubOutput = <String>[
'.packages',
final List<String> pubOutput = <String>[
globals.fs.path.join('.dart_tool', 'package_config.json'),
'pubspec.lock',
];

View File

@ -117,7 +117,7 @@ void main() {
extraFrontEndOptions: <String>['--enable-experiment=non-nullable', 'bar'],
extraGenSnapshotOptions: <String>['--enable-experiment=non-nullable', 'fizz'],
bundleSkSLPath: 'foo/bar/baz.sksl.json',
packagesPath: 'foo/.packages',
packagesPath: 'foo/.dart_tool/package_config.json',
codeSizeDirectory: 'foo/code-size',
fileSystemRoots: <String>['test5', 'test6'],
fileSystemScheme: 'scheme',
@ -149,7 +149,7 @@ void main() {
extraFrontEndOptions: <String>['--enable-experiment=non-nullable', 'bar'],
extraGenSnapshotOptions: <String>['--enable-experiment=non-nullable', 'fizz'],
bundleSkSLPath: 'foo/bar/baz.sksl.json',
packagesPath: 'foo/.packages',
packagesPath: 'foo/.dart_tool/package_config.json',
codeSizeDirectory: 'foo/code-size',
// These values are ignored by toEnvironmentConfig
androidProjectArgs: <String>['foo=bar', 'fizz=bazz']
@ -164,7 +164,7 @@ void main() {
'EXTRA_FRONT_END_OPTIONS': '--enable-experiment=non-nullable,bar',
'EXTRA_GEN_SNAPSHOT_OPTIONS': '--enable-experiment=non-nullable,fizz',
'BUNDLE_SKSL_PATH': 'foo/bar/baz.sksl.json',
'PACKAGE_CONFIG': 'foo/.packages',
'PACKAGE_CONFIG': 'foo/.dart_tool/package_config.json',
'CODE_SIZE_DIRECTORY': 'foo/code-size',
});
});
@ -179,7 +179,7 @@ void main() {
extraFrontEndOptions: <String>['--enable-experiment=non-nullable', 'bar'],
extraGenSnapshotOptions: <String>['--enable-experiment=non-nullable', 'fizz'],
bundleSkSLPath: 'foo/bar/baz.sksl.json',
packagesPath: 'foo/.packages',
packagesPath: 'foo/.dart_tool/package_config.json',
codeSizeDirectory: 'foo/code-size',
androidProjectArgs: <String>['foo=bar', 'fizz=bazz']
);

View File

@ -286,7 +286,6 @@ class TestFlutterTesterDevice extends FlutterTesterTestDevice {
BuildMode.debug,
'',
treeShakeIcons: false,
packagesPath: '.dart_tool/package_config.json',
),
hostVmServicePort: 1234,
dartEntrypointArgs: dartEntrypointArgs,

View File

@ -147,7 +147,7 @@ void main() {
'--run-forever',
'--non-interactive',
'--enable-dart-profiling',
'--packages=.packages',
'--packages=.dart_tool/package_config.json',
'--flutter-assets-dir=/.tmp_rand0/flutter_tester.rand0',
'/.tmp_rand0/flutter_tester.rand0/flutter-tester-app.dill',
],