Skip to content

Commit fbb68e9

Browse files
alexjskicopybara-github
authored andcommitted
Add a property to disable the bootstrap classpath cache.
PiperOrigin-RevId: 464921069 Change-Id: Ib0e3f09a1026b253bee1f5fa2f002f2f10986425
1 parent ddfde6c commit fbb68e9

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

src/java_tools/buildjar/java/com/google/devtools/build/buildjar/javac/BlazeJavacMain.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@
5454
import java.util.Map;
5555
import java.util.Optional;
5656
import java.util.Set;
57+
import javax.annotation.Nullable;
5758
import javax.tools.Diagnostic;
5859
import javax.tools.DiagnosticListener;
5960
import javax.tools.JavaFileObject;
@@ -320,6 +321,11 @@ private static void setLocations(JavacFileManager fileManager, BlazeJavacArgumen
320321
}
321322
}
322323

324+
private static final boolean BOOT_CLASSPATH_CACHE_ENABLED =
325+
Boolean.parseBoolean(
326+
System.getProperty(
327+
"com.google.devtools.build.buildjar.javac.enable_boot_classpath_cache", "true"));
328+
323329
/**
324330
* Multiple javac file manager instances each specific for a combination of bootClassPaths with
325331
* their digest.
@@ -331,8 +337,13 @@ private static void setLocations(JavacFileManager fileManager, BlazeJavacArgumen
331337
* Returns a BootClassPathCachingFileManager instance that matches the combination of
332338
* bootClassPaths and their digest in the case of a worker with valid arguments.
333339
*/
340+
@Nullable
334341
private static synchronized BootClassPathCachingFileManager getMatchingBootFileManager(
335342
BlazeJavacArguments arguments) {
343+
if (!BOOT_CLASSPATH_CACHE_ENABLED) {
344+
// Caching disabled by a feature switch.
345+
return null;
346+
}
336347
if (!arguments.requestId().isPresent()) {
337348
// worker mode is not enabled
338349
return null;

0 commit comments

Comments
 (0)