Unverified Commit 700020fc authored by Jonah Williams's avatar Jonah Williams Committed by GitHub

per file caching (#38869)

parent bbcfdea1
......@@ -107,5 +107,5 @@ class FileHashStore {
return dirty;
}
File get _cacheFile => environment.rootBuildDir.childFile(_kFileCache);
File get _cacheFile => environment.buildDir.childFile(_kFileCache);
}
......@@ -20,6 +20,7 @@ void main() {
environment = Environment(
projectDir: fs.currentDirectory,
);
environment.buildDir.createSync(recursive: true);
});
});
......@@ -28,9 +29,10 @@ void main() {
fileCache.initialize();
fileCache.persist();
expect(fs.file(fs.path.join('build', '.filecache')).existsSync(), true);
expect(fs.file(fs.path.join(environment.buildDir.path, '.filecache')).existsSync(), true);
final List<int> buffer = fs.file(fs.path.join('build', '.filecache')).readAsBytesSync();
final List<int> buffer = fs.file(fs.path.join(environment.buildDir.path, '.filecache'))
.readAsBytesSync();
final pb.FileStorage fileStorage = pb.FileStorage.fromBuffer(buffer);
expect(fileStorage.files, isEmpty);
......@@ -46,7 +48,8 @@ void main() {
fileCache.hashFiles(<File>[file]);
fileCache.persist();
final String currentHash = fileCache.currentHashes[file.resolveSymbolicLinksSync()];
final List<int> buffer = fs.file(fs.path.join('build', '.filecache')).readAsBytesSync();
final List<int> buffer = fs.file(fs.path.join(environment.buildDir.path, '.filecache'))
.readAsBytesSync();
pb.FileStorage fileStorage = pb.FileStorage.fromBuffer(buffer);
expect(fileStorage.files.single.hash, currentHash);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment