Skip to content

Commit

Permalink
Remove remaining remnants of old packages folder and .packages file
Browse files Browse the repository at this point in the history
  • Loading branch information
parlough committed Aug 15, 2023
1 parent d619b37 commit 161a5a2
Show file tree
Hide file tree
Showing 16 changed files with 12 additions and 63 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,5 @@
.settings/
/build/
packages
/.packages
pubspec.lock
/bin/pub.dart.snapshot
13 changes: 3 additions & 10 deletions lib/src/entrypoint.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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<void> writePackageConfigFile() async {
final entrypointName = isGlobal ? null : root.name;
ensureDir(p.dirname(packageConfigPath));
Expand Down Expand Up @@ -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);
Expand Down
2 changes: 0 additions & 2 deletions lib/src/lock_file.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 0 additions & 10 deletions test/add/common/add_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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();
});

Expand Down Expand Up @@ -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();
});

Expand Down Expand Up @@ -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();
});

Expand Down Expand Up @@ -488,7 +485,6 @@ environment:
}),
d.nothing('.dart_tool/package_config.json'),
d.nothing('pubspec.lock'),
d.nothing('.packages'),
]).validate();
});

Expand Down Expand Up @@ -529,7 +525,6 @@ environment:
}),
d.nothing('.dart_tool/package_config.json'),
d.nothing('pubspec.lock'),
d.nothing('.packages'),
]).validate();
});

Expand Down Expand Up @@ -570,7 +565,6 @@ environment:
}),
d.nothing('.dart_tool/package_config.json'),
d.nothing('pubspec.lock'),
d.nothing('.packages'),
]).validate();
});
});
Expand Down Expand Up @@ -892,7 +886,6 @@ environment:
}),
d.nothing('.dart_tool/package_config.json'),
d.nothing('pubspec.lock'),
d.nothing('.packages'),
]).validate();
});

Expand Down Expand Up @@ -933,7 +926,6 @@ environment:
}),
d.nothing('.dart_tool/package_config.json'),
d.nothing('pubspec.lock'),
d.nothing('.packages'),
]).validate();
});

Expand Down Expand Up @@ -975,7 +967,6 @@ environment:
}),
d.nothing('.dart_tool/package_config.json'),
d.nothing('pubspec.lock'),
d.nothing('.packages'),
]).validate();
});
});
Expand Down Expand Up @@ -1011,7 +1002,6 @@ environment:
}),
d.nothing('.dart_tool/package_config.json'),
d.nothing('pubspec.lock'),
d.nothing('.packages'),
]).validate();
});
});
Expand Down
3 changes: 0 additions & 3 deletions test/add/common/invalid_options.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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();
});

Expand Down Expand Up @@ -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();
});

Expand Down Expand Up @@ -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();
});
}
8 changes: 2 additions & 6 deletions test/add/common/version_constraint_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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();
});

Expand All @@ -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();
});
});
Expand Down
3 changes: 0 additions & 3 deletions test/add/git/git_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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();
});

Expand All @@ -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();
});

Expand All @@ -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();
});

Expand Down
1 change: 0 additions & 1 deletion test/add/git/ref_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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();
});
}
1 change: 0 additions & 1 deletion test/add/hosted/non_default_pub_server_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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();
});

Expand Down
3 changes: 0 additions & 3 deletions test/add/path/absolute_path_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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();
});

Expand Down Expand Up @@ -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();
});

Expand All @@ -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();
});

Expand Down
2 changes: 0 additions & 2 deletions test/add/path/relative_path_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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();
});

Expand Down Expand Up @@ -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();
});

Expand Down
1 change: 0 additions & 1 deletion test/add/sdk/sdk_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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();
});
}
7 changes: 3 additions & 4 deletions test/descriptor/package_config.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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');

Expand Down
6 changes: 1 addition & 5 deletions test/get/dry_run_does_not_apply_changes_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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();
});
}
12 changes: 2 additions & 10 deletions test/get/package_name_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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();
});

Expand All @@ -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();
});

Expand Down
2 changes: 1 addition & 1 deletion test/pub_get_and_upgrade_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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, [
Expand Down

0 comments on commit 161a5a2

Please sign in to comment.