Remove support for .pub package-local cache (#3823)
diff --git a/lib/src/entrypoint.dart b/lib/src/entrypoint.dart index d18f6e2..1b98da6 100644 --- a/lib/src/entrypoint.dart +++ b/lib/src/entrypoint.dart
@@ -206,22 +206,10 @@ /// The path to the entrypoint package's `.dart_tool/pub` cache directory. /// - /// If the old-style `.pub` directory is being used, this returns that - /// instead. - /// /// For globally activated packages from path, this is not the same as /// [configRoot], because the snapshots should be stored in the global cache, /// but the configuration is stored at the package itself. - String get cachePath { - if (isGlobal) { - return globalDir!; - } else { - var newPath = root.path('.dart_tool/pub'); - var oldPath = root.path('.pub'); - if (!dirExists(newPath) && dirExists(oldPath)) return oldPath; - return newPath; - } - } + String get cachePath => globalDir ?? root.path('.dart_tool/pub'); /// The path to the directory containing dependency executable snapshots. String get _snapshotPath => p.join(cachePath, 'bin'); @@ -444,8 +432,6 @@ /// Precompiles all [_builtExecutables]. Future<void> precompileExecutables() async { - migrateCache(); - final executables = _builtExecutables; if (executables.isEmpty) return; @@ -914,26 +900,6 @@ } } - /// If the entrypoint uses the old-style `.pub` cache directory, migrates it - /// to the new-style `.dart_tool/pub` directory. - void migrateCache() { - // Cached packages don't have these. - if (isCached) return; - - var oldPath = p.join(_configRoot!, '.pub'); - if (!dirExists(oldPath)) return; - - var newPath = root.path('.dart_tool/pub'); - - // If both the old and new directories exist, something weird is going on. - // Do nothing to avoid making things worse. Pub will prefer the new - // directory anyway. - if (dirExists(newPath)) return; - - ensureDir(p.dirname(newPath)); - renameDir(oldPath, newPath); - } - /// We require an SDK constraint lower-bound as of Dart 2.12.0 /// /// We don't allow unknown sdks.
diff --git a/lib/src/executable.dart b/lib/src/executable.dart index a80437a..accde6e 100644 --- a/lib/src/executable.dart +++ b/lib/src/executable.dart
@@ -67,8 +67,6 @@ } } - entrypoint.migrateCache(); - var snapshotPath = entrypoint.pathOfExecutable(executable); // Don't compile snapshots for mutable packages, since their code may