Skip to content

Commit 0388c64

Browse files
authored
Do not make a copy of PUB_CACHE, just create an empty one instead. (#4032)
Copying my 11GB `PUB_CACHE` crashed `createThrowawayPubCache`, something about `Link`. But fundamentally, it's probably almost as fast to just download the packages again. And if we really want to avoid downloading the `PUB_CACHE` we could avoid `global activate`, or create a `PUB_CACHE` we can clone inside `.dart_tool/`. But creating a copy of the default `PUB_CACHE` is not likely to be faster, and probably harder to do, since you can have entire git checkouts, and legacy packages that were extracted with system `tar` which might have symlinks inside them 🙈 (You could also argue I should clean up my 11GB `PUB_CACHE`, 🤣)
1 parent 1788710 commit 0388c64

File tree

1 file changed

+1
-10
lines changed

1 file changed

+1
-10
lines changed

tool/task.dart

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ import 'package:analyzer/file_system/physical_file_system.dart';
99
import 'package:args/args.dart';
1010
import 'package:collection/collection.dart';
1111
import 'package:crypto/crypto.dart' as crypto;
12-
import 'package:dartdoc/src/io_utils.dart';
1312
import 'package:dartdoc/src/package_meta.dart';
1413
import 'package:path/path.dart' as path;
1514
import 'package:sass/sass.dart' as sass;
@@ -497,12 +496,7 @@ Future<void> docSdk({bool withStats = false}) async => _docSdk(
497496
Map<String, String> createThrowawayPubCache() {
498497
var pubCache = Directory.systemTemp.createTempSync('pubcache');
499498
var pubCacheBin = Directory(path.join(pubCache.path, 'bin'));
500-
var defaultCache = Directory(_defaultPubCache);
501-
if (defaultCache.existsSync()) {
502-
io_utils.copy(defaultCache, pubCache);
503-
} else {
504-
pubCacheBin.createSync();
505-
}
499+
pubCacheBin.createSync();
506500
return Map.fromIterables([
507501
'PUB_CACHE',
508502
'PATH',
@@ -512,9 +506,6 @@ Map<String, String> createThrowawayPubCache() {
512506
]);
513507
}
514508

515-
final String _defaultPubCache = Platform.environment['PUB_CACHE'] ??
516-
path.context.resolveTildePath('~/.pub-cache');
517-
518509
Future<String> docTestingPackage({
519510
bool withStats = false,
520511
}) async {

0 commit comments

Comments
 (0)