build: Add support for bazelOptions.maxCacheSizeMb in ngc-wrapped. (#22511)

PR Close #22511
This commit is contained in:
Rado Kirov 2018-02-28 22:52:31 -08:00 committed by Alex Eagle
parent dd534471ec
commit ab790f3c84
1 changed files with 7 additions and 0 deletions

View File

@ -95,6 +95,13 @@ export function compile({allowNonHermeticReads, allDepsCompiledWithBazel = true,
}): {diagnostics: ng.Diagnostics, program: ng.Program} { }): {diagnostics: ng.Diagnostics, program: ng.Program} {
let fileLoader: FileLoader; let fileLoader: FileLoader;
if (bazelOpts.maxCacheSizeMb !== undefined) {
const maxCacheSizeBytes = bazelOpts.maxCacheSizeMb * (1 << 20);
fileCache.setMaxCacheSize(maxCacheSizeBytes);
} else {
fileCache.resetMaxCacheSize();
}
if (inputs) { if (inputs) {
fileLoader = new CachedFileLoader(fileCache, allowNonHermeticReads); fileLoader = new CachedFileLoader(fileCache, allowNonHermeticReads);
// Resolve the inputs to absolute paths to match TypeScript internals // Resolve the inputs to absolute paths to match TypeScript internals