Skip to content

Commit

Permalink
Add a property to disable the bootstrap classpath cache.
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 464921069
Change-Id: Ib0e3f09a1026b253bee1f5fa2f002f2f10986425
  • Loading branch information
alexjski authored and copybara-github committed Aug 2, 2022
1 parent ddfde6c commit fbb68e9
Showing 1 changed file with 11 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
import java.util.Map;
import java.util.Optional;
import java.util.Set;
import javax.annotation.Nullable;
import javax.tools.Diagnostic;
import javax.tools.DiagnosticListener;
import javax.tools.JavaFileObject;
Expand Down Expand Up @@ -320,6 +321,11 @@ private static void setLocations(JavacFileManager fileManager, BlazeJavacArgumen
}
}

private static final boolean BOOT_CLASSPATH_CACHE_ENABLED =
Boolean.parseBoolean(
System.getProperty(
"com.google.devtools.build.buildjar.javac.enable_boot_classpath_cache", "true"));

/**
* Multiple javac file manager instances each specific for a combination of bootClassPaths with
* their digest.
Expand All @@ -331,8 +337,13 @@ private static void setLocations(JavacFileManager fileManager, BlazeJavacArgumen
* Returns a BootClassPathCachingFileManager instance that matches the combination of
* bootClassPaths and their digest in the case of a worker with valid arguments.
*/
@Nullable
private static synchronized BootClassPathCachingFileManager getMatchingBootFileManager(
BlazeJavacArguments arguments) {
if (!BOOT_CLASSPATH_CACHE_ENABLED) {
// Caching disabled by a feature switch.
return null;
}
if (!arguments.requestId().isPresent()) {
// worker mode is not enabled
return null;
Expand Down

0 comments on commit fbb68e9

Please sign in to comment.