diff --git a/.gitignore b/.gitignore index d35929858..4801e53ca 100644 --- a/.gitignore +++ b/.gitignore @@ -6,6 +6,5 @@ .settings/ /build/ packages -/.packages pubspec.lock /bin/pub.dart.snapshot diff --git a/lib/src/entrypoint.dart b/lib/src/entrypoint.dart index 6853d428a..8d6dd67c2 100644 --- a/lib/src/entrypoint.dart +++ b/lib/src/entrypoint.dart @@ -194,13 +194,6 @@ class Entrypoint { /// store these in the global cache. String? get _configRoot => isCached ? globalDir : rootDir; - /// The path to the entrypoint's ".packages" file. - /// - /// This file is being slowly deprecated in favor of - /// `.dart_tool/package_config.json`. Pub will still create it, but will - /// not require it or make use of it within pub. - String get packagesFile => p.normalize(p.join(_configRoot!, '.packages')); - /// The path to the entrypoint's ".dart_tool/package_config.json" file /// relative to the current working directory . late String packageConfigPath = p.relative( @@ -295,7 +288,7 @@ class Entrypoint { Entrypoint? _example; - /// Writes .packages and .dart_tool/package_config.json + /// Writes the .dart_tool/package_config.json file Future writePackageConfigFile() async { final entrypointName = isGlobal ? null : root.name; ensureDir(p.dirname(packageConfigPath)); @@ -664,8 +657,8 @@ To update `$lockFilePath` run `$topLevelProgram pub get`$suffix without /// Whether `.dart_tool/package_config.json` file exists and if it's /// up-to-date relative to the lockfile and the pubspec. /// - /// A `.packages` file is not required. But if it exists it is checked for - /// consistency with the pubspec.lock. + /// A `.dart_tool/package_config.json` file is not required. + /// But if it exists it is checked for consistency with the `pubspec.lock`. bool _isUpToDate({bool checkForSdkUpdate = false}) { if (isCached) return true; final pubspecStat = tryStatFile(pubspecPath); diff --git a/lib/src/lock_file.dart b/lib/src/lock_file.dart index c055b2fd3..ebf04730e 100644 --- a/lib/src/lock_file.dart +++ b/lib/src/lock_file.dart @@ -356,8 +356,6 @@ class LockFile { /// Returns the contents of the `.dart_tool/package_config` file generated /// from this lockfile. /// - /// This file will replace the `.packages` file. - /// /// If [entrypoint] is passed, an accompanying [entrypointSdkConstraint] /// should be given, these identify the current package in which this file is /// written. Passing `null` as [entrypointSdkConstraint] is correct if the diff --git a/test/add/common/add_test.dart b/test/add/common/add_test.dart index 09fccb001..4bca49925 100644 --- a/test/add/common/add_test.dart +++ b/test/add/common/add_test.dart @@ -29,7 +29,6 @@ void main() { await d.dir(appPath, [ d.nothing('.dart_tool/package_config.json'), d.nothing('pubspec.lock'), - d.nothing('.packages'), ]).validate(); }); @@ -142,7 +141,6 @@ void main() { await d.dir(appPath, [ d.nothing('.dart_tool/package_config.json'), d.nothing('pubspec.lock'), - d.nothing('.packages'), ]).validate(); }); @@ -455,7 +453,6 @@ environment: d.pubspec({'name': 'myapp', 'dependencies': {}}), d.nothing('.dart_tool/package_config.json'), d.nothing('pubspec.lock'), - d.nothing('.packages'), ]).validate(); }); @@ -488,7 +485,6 @@ environment: }), d.nothing('.dart_tool/package_config.json'), d.nothing('pubspec.lock'), - d.nothing('.packages'), ]).validate(); }); @@ -529,7 +525,6 @@ environment: }), d.nothing('.dart_tool/package_config.json'), d.nothing('pubspec.lock'), - d.nothing('.packages'), ]).validate(); }); @@ -570,7 +565,6 @@ environment: }), d.nothing('.dart_tool/package_config.json'), d.nothing('pubspec.lock'), - d.nothing('.packages'), ]).validate(); }); }); @@ -892,7 +886,6 @@ environment: }), d.nothing('.dart_tool/package_config.json'), d.nothing('pubspec.lock'), - d.nothing('.packages'), ]).validate(); }); @@ -933,7 +926,6 @@ environment: }), d.nothing('.dart_tool/package_config.json'), d.nothing('pubspec.lock'), - d.nothing('.packages'), ]).validate(); }); @@ -975,7 +967,6 @@ environment: }), d.nothing('.dart_tool/package_config.json'), d.nothing('pubspec.lock'), - d.nothing('.packages'), ]).validate(); }); }); @@ -1011,7 +1002,6 @@ environment: }), d.nothing('.dart_tool/package_config.json'), d.nothing('pubspec.lock'), - d.nothing('.packages'), ]).validate(); }); }); diff --git a/test/add/common/invalid_options.dart b/test/add/common/invalid_options.dart index 784b842de..b97044c46 100644 --- a/test/add/common/invalid_options.dart +++ b/test/add/common/invalid_options.dart @@ -35,7 +35,6 @@ void main() { await d.dir(appPath, [ d.nothing('.dart_tool/package_config.json'), d.nothing('pubspec.lock'), - d.nothing('.packages'), ]).validate(); }); @@ -71,7 +70,6 @@ void main() { await d.dir(appPath, [ d.nothing('.dart_tool/package_config.json'), d.nothing('pubspec.lock'), - d.nothing('.packages'), ]).validate(); }); @@ -111,7 +109,6 @@ void main() { await d.dir(appPath, [ d.nothing('.dart_tool/package_config.json'), d.nothing('pubspec.lock'), - d.nothing('.packages'), ]).validate(); }); } diff --git a/test/add/common/version_constraint_test.dart b/test/add/common/version_constraint_test.dart index b0bc2d425..6441a703d 100644 --- a/test/add/common/version_constraint_test.dart +++ b/test/add/common/version_constraint_test.dart @@ -131,10 +131,8 @@ void main() { await d.appDir(dependencies: {}).validate(); await d.dir(appPath, [ - // The lockfile should not be created. d.nothing('pubspec.lock'), - // The ".packages" file should not have been created. - d.nothing('.packages'), + d.nothing('.dart_tool/package_config.json'), ]).validate(); }); @@ -156,10 +154,8 @@ void main() { await d.appDir(dependencies: {'bar': '2.0.3'}).validate(); await d.dir(appPath, [ - // The lockfile should not be created. d.nothing('pubspec.lock'), - // The ".packages" file should not have been created. - d.nothing('.packages'), + d.nothing('.dart_tool/package_config.json'), ]).validate(); }); }); diff --git a/test/add/git/git_test.dart b/test/add/git/git_test.dart index fc1f9a0a6..833dd0f24 100644 --- a/test/add/git/git_test.dart +++ b/test/add/git/git_test.dart @@ -130,7 +130,6 @@ void main() { await d.dir(appPath, [ d.nothing('.dart_tool/package_config.json'), d.nothing('pubspec.lock'), - d.nothing('.packages'), ]).validate(); }); @@ -150,7 +149,6 @@ void main() { await d.dir(appPath, [ d.nothing('.dart_tool/package_config.json'), d.nothing('pubspec.lock'), - d.nothing('.packages'), ]).validate(); }); @@ -169,7 +167,6 @@ void main() { await d.dir(appPath, [ d.nothing('.dart_tool/package_config.json'), d.nothing('pubspec.lock'), - d.nothing('.packages'), ]).validate(); }); diff --git a/test/add/git/ref_test.dart b/test/add/git/ref_test.dart index e0ba11ff3..2e182fd37 100644 --- a/test/add/git/ref_test.dart +++ b/test/add/git/ref_test.dart @@ -76,7 +76,6 @@ void main() { await d.dir(appPath, [ d.nothing('.dart_tool/package_config.json'), d.nothing('pubspec.lock'), - d.nothing('.packages'), ]).validate(); }); } diff --git a/test/add/hosted/non_default_pub_server_test.dart b/test/add/hosted/non_default_pub_server_test.dart index b31552f2f..e58ea3d99 100644 --- a/test/add/hosted/non_default_pub_server_test.dart +++ b/test/add/hosted/non_default_pub_server_test.dart @@ -134,7 +134,6 @@ void main() { await d.dir(appPath, [ d.nothing('.dart_tool/package_config.json'), d.nothing('pubspec.lock'), - d.nothing('.packages'), ]).validate(); }); diff --git a/test/add/path/absolute_path_test.dart b/test/add/path/absolute_path_test.dart index adb44c85e..23cfa0258 100644 --- a/test/add/path/absolute_path_test.dart +++ b/test/add/path/absolute_path_test.dart @@ -68,7 +68,6 @@ void main() { await d.dir(appPath, [ d.nothing('.dart_tool/package_config.json'), d.nothing('pubspec.lock'), - d.nothing('.packages'), ]).validate(); }); @@ -96,7 +95,6 @@ void main() { await d.dir(appPath, [ d.nothing('.dart_tool/package_config.json'), d.nothing('pubspec.lock'), - d.nothing('.packages'), ]).validate(); }); @@ -118,7 +116,6 @@ void main() { await d.dir(appPath, [ d.nothing('.dart_tool/package_config.json'), d.nothing('pubspec.lock'), - d.nothing('.packages'), ]).validate(); }); diff --git a/test/add/path/relative_path_test.dart b/test/add/path/relative_path_test.dart index e7c4a8eb4..5a3dcaa6c 100644 --- a/test/add/path/relative_path_test.dart +++ b/test/add/path/relative_path_test.dart @@ -89,7 +89,6 @@ void main() { await d.dir(appPath, [ d.nothing('.dart_tool/package_config.json'), d.nothing('pubspec.lock'), - d.nothing('.packages'), ]).validate(); }); @@ -131,7 +130,6 @@ void main() { await d.dir(appPath, [ d.nothing('.dart_tool/package_config.json'), d.nothing('pubspec.lock'), - d.nothing('.packages'), ]).validate(); }); diff --git a/test/add/sdk/sdk_test.dart b/test/add/sdk/sdk_test.dart index c70471f06..0372f1535 100644 --- a/test/add/sdk/sdk_test.dart +++ b/test/add/sdk/sdk_test.dart @@ -113,7 +113,6 @@ void main() { await d.dir(appPath, [ d.nothing('.dart_tool/package_config.json'), d.nothing('pubspec.lock'), - d.nothing('.packages'), ]).validate(); }); } diff --git a/test/descriptor/package_config.dart b/test/descriptor/package_config.dart index 2b644c28c..99b687fc8 100644 --- a/test/descriptor/package_config.dart +++ b/test/descriptor/package_config.dart @@ -29,10 +29,9 @@ class PackageConfigFileDescriptor extends Descriptor { ); } - /// Describes a `.packages` file with the given dependencies. - /// - /// [dependencies] maps package names to strings describing where the packages - /// are located on disk. + /// Describes a `.dart_tools/package_config.json` file + /// with the given list of package configurations and + /// generated with specified version. PackageConfigFileDescriptor(this._packages, this._generatorVersion) : super('.dart_tool/package_config.json'); diff --git a/test/get/dry_run_does_not_apply_changes_test.dart b/test/get/dry_run_does_not_apply_changes_test.dart index a223335b7..1571e8b32 100644 --- a/test/get/dry_run_does_not_apply_changes_test.dart +++ b/test/get/dry_run_does_not_apply_changes_test.dart @@ -22,12 +22,8 @@ void main() { ); await d.dir(appPath, [ - // The lockfile should not be created. d.nothing('pubspec.lock'), - // The "packages" directory should not have been generated. - d.nothing('packages'), - // The ".packages" file should not have been created. - d.nothing('.packages'), + d.nothing('.dart_tool/package_config.json'), ]).validate(); }); } diff --git a/test/get/package_name_test.dart b/test/get/package_name_test.dart index a56a3f28a..967221412 100644 --- a/test/get/package_name_test.dart +++ b/test/get/package_name_test.dart @@ -20,12 +20,8 @@ void main() { ); await d.dir(appPath, [ - // The lockfile should not be created. d.nothing('pubspec.lock'), - // The "packages" directory should not have been generated. - d.nothing('packages'), - // The ".packages" file should not have been created. - d.nothing('.packages'), + d.nothing('.dart_tool/package_config.json'), ]).validate(); }); @@ -40,12 +36,8 @@ void main() { ); await d.dir(appPath, [ - // The lockfile should not be created. d.nothing('pubspec.lock'), - // The "packages" directory should not have been generated. - d.nothing('packages'), - // The ".packages" file should not have been created. - d.nothing('.packages'), + d.nothing('.dart_tool/package_config.json'), ]).validate(); }); diff --git a/test/pub_get_and_upgrade_test.dart b/test/pub_get_and_upgrade_test.dart index 0d2602b52..5000cac1f 100644 --- a/test/pub_get_and_upgrade_test.dart +++ b/test/pub_get_and_upgrade_test.dart @@ -38,7 +38,7 @@ void main() { }); }); - test('adds itself to the .packages file', () async { + test('adds itself to the .dart_tool/package_config.json file', () async { // The package should use the name in the pubspec, not the name of the // directory. await d.dir(appPath, [