From ab790f3c84931976a5600e7f298cd7939d4bf646 Mon Sep 17 00:00:00 2001 From: Rado Kirov Date: Wed, 28 Feb 2018 22:52:31 -0800 Subject: [PATCH] build: Add support for bazelOptions.maxCacheSizeMb in ngc-wrapped. (#22511) PR Close #22511 --- packages/bazel/src/ngc-wrapped/index.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/packages/bazel/src/ngc-wrapped/index.ts b/packages/bazel/src/ngc-wrapped/index.ts index 2c066ef22f..99b3e1ef12 100644 --- a/packages/bazel/src/ngc-wrapped/index.ts +++ b/packages/bazel/src/ngc-wrapped/index.ts @@ -95,6 +95,13 @@ export function compile({allowNonHermeticReads, allDepsCompiledWithBazel = true, }): {diagnostics: ng.Diagnostics, program: ng.Program} { let fileLoader: FileLoader; + if (bazelOpts.maxCacheSizeMb !== undefined) { + const maxCacheSizeBytes = bazelOpts.maxCacheSizeMb * (1 << 20); + fileCache.setMaxCacheSize(maxCacheSizeBytes); + } else { + fileCache.resetMaxCacheSize(); + } + if (inputs) { fileLoader = new CachedFileLoader(fileCache, allowNonHermeticReads); // Resolve the inputs to absolute paths to match TypeScript internals