Skip to content

Commit 70bfc02

Browse files
authored
Remove support for .pub package-local cache (#3823)
1 parent 4cd7a0a commit 70bfc02

File tree

2 files changed

+1
-37
lines changed

2 files changed

+1
-37
lines changed

lib/src/entrypoint.dart

+1-35
Original file line numberDiff line numberDiff line change
@@ -206,22 +206,10 @@ class Entrypoint {
206206

207207
/// The path to the entrypoint package's `.dart_tool/pub` cache directory.
208208
///
209-
/// If the old-style `.pub` directory is being used, this returns that
210-
/// instead.
211-
///
212209
/// For globally activated packages from path, this is not the same as
213210
/// [configRoot], because the snapshots should be stored in the global cache,
214211
/// but the configuration is stored at the package itself.
215-
String get cachePath {
216-
if (isGlobal) {
217-
return globalDir!;
218-
} else {
219-
var newPath = root.path('.dart_tool/pub');
220-
var oldPath = root.path('.pub');
221-
if (!dirExists(newPath) && dirExists(oldPath)) return oldPath;
222-
return newPath;
223-
}
224-
}
212+
String get cachePath => globalDir ?? root.path('.dart_tool/pub');
225213

226214
/// The path to the directory containing dependency executable snapshots.
227215
String get _snapshotPath => p.join(cachePath, 'bin');
@@ -444,8 +432,6 @@ To update `$lockFilePath` run `$topLevelProgram pub get`$suffix without
444432

445433
/// Precompiles all [_builtExecutables].
446434
Future<void> precompileExecutables() async {
447-
migrateCache();
448-
449435
final executables = _builtExecutables;
450436

451437
if (executables.isEmpty) return;
@@ -914,26 +900,6 @@ To update `$lockFilePath` run `$topLevelProgram pub get`$suffix without
914900
}
915901
}
916902

917-
/// If the entrypoint uses the old-style `.pub` cache directory, migrates it
918-
/// to the new-style `.dart_tool/pub` directory.
919-
void migrateCache() {
920-
// Cached packages don't have these.
921-
if (isCached) return;
922-
923-
var oldPath = p.join(_configRoot!, '.pub');
924-
if (!dirExists(oldPath)) return;
925-
926-
var newPath = root.path('.dart_tool/pub');
927-
928-
// If both the old and new directories exist, something weird is going on.
929-
// Do nothing to avoid making things worse. Pub will prefer the new
930-
// directory anyway.
931-
if (dirExists(newPath)) return;
932-
933-
ensureDir(p.dirname(newPath));
934-
renameDir(oldPath, newPath);
935-
}
936-
937903
/// We require an SDK constraint lower-bound as of Dart 2.12.0
938904
///
939905
/// We don't allow unknown sdks.

lib/src/executable.dart

-2
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,6 @@ Future<int> runExecutable(
6767
}
6868
}
6969

70-
entrypoint.migrateCache();
71-
7270
var snapshotPath = entrypoint.pathOfExecutable(executable);
7371

7472
// Don't compile snapshots for mutable packages, since their code may

0 commit comments

Comments
 (0)