From 3c9ef6e814f5028817a3fc77d016edeee06d3642 Mon Sep 17 00:00:00 2001 From: janakr Date: Thu, 12 Oct 2017 03:42:16 +0200 Subject: Expose ActionLogBufferPathGenerator in SkyframeExecutor. PiperOrigin-RevId: 171906076 --- .../build/lib/skyframe/SkyframeExecutor.java | 36 +++++++++++++--------- 1 file changed, 22 insertions(+), 14 deletions(-) diff --git a/src/main/java/com/google/devtools/build/lib/skyframe/SkyframeExecutor.java b/src/main/java/com/google/devtools/build/lib/skyframe/SkyframeExecutor.java index 145999342a..c6afa32ca0 100644 --- a/src/main/java/com/google/devtools/build/lib/skyframe/SkyframeExecutor.java +++ b/src/main/java/com/google/devtools/build/lib/skyframe/SkyframeExecutor.java @@ -183,7 +183,7 @@ public abstract class SkyframeExecutor implements WalkableGraphFactory { private final MemoizingEvaluator.EmittedEventState emittedEventState = new MemoizingEvaluator.EmittedEventState(); private final PackageFactory pkgFactory; - private final WorkspaceStatusAction.Factory workspaceStatusActionFactory; + private final Factory workspaceStatusActionFactory; private final BlazeDirectories directories; protected final ExternalFilesHelper externalFilesHelper; @Nullable protected OutputService outputService; @@ -205,8 +205,8 @@ public abstract class SkyframeExecutor implements WalkableGraphFactory { // package twice (first time loading to find subincludes and declare value dependencies). // TODO(bazel-team): remove this cache once we have skyframe-native package loading // [skyframe-loading] - private final Cache> - packageFunctionCache = newPkgFunctionCache(); + private final Cache> packageFunctionCache = + newPkgFunctionCache(); private final Cache> astCache = newAstCache(); @@ -215,6 +215,9 @@ public abstract class SkyframeExecutor implements WalkableGraphFactory { protected SkyframeBuildView skyframeBuildView; private ActionLogBufferPathGenerator actionLogBufferPathGenerator; + private final java.util.function.Supplier + actionLogBufferPathGeneratorSupplier = + () -> Preconditions.checkNotNull(actionLogBufferPathGenerator); protected BuildDriver buildDriver; @@ -721,8 +724,7 @@ public abstract class SkyframeExecutor implements WalkableGraphFactory { } } - protected Cache> - newPkgFunctionCache() { + protected Cache> newPkgFunctionCache() { return CacheBuilder.newBuilder().build(); } @@ -835,6 +837,11 @@ public abstract class SkyframeExecutor implements WalkableGraphFactory { return skyframeActionExecutor; } + public java.util.function.Supplier + getActionLogBufferPathGeneratorSupplier() { + return actionLogBufferPathGeneratorSupplier; + } + @VisibleForTesting ImmutableList getPathEntries() { return pkgLocator.get().getPathEntries(); @@ -881,7 +888,7 @@ public abstract class SkyframeExecutor implements WalkableGraphFactory { Set valuesToInvalidate = new HashSet<>(); Map valuesToInject = new HashMap<>(); - for (Map.Entry entry : diff.changedKeysWithNewAndOldValues().entrySet()) { + for (Entry entry : diff.changedKeysWithNewAndOldValues().entrySet()) { SkyKey key = entry.getKey(); Preconditions.checkState(key.functionName().equals(SkyFunctions.FILE_STATE), key); RootedPath rootedPath = (RootedPath) key.argument(); @@ -1059,10 +1066,11 @@ public abstract class SkyframeExecutor implements WalkableGraphFactory { Attribute.Transition dataTransition = ((ConfiguredRuleClassProvider) ruleClassProvider) .getDynamicTransitionMapper() - .map(Attribute.ConfigurationTransition.DATA); - BuildOptions dataOptions = dataTransition != Attribute.ConfigurationTransition.NONE - ? ((PatchTransition) dataTransition).apply(firstTargetConfig.getOptions()) - : firstTargetConfig.getOptions(); + .map(ConfigurationTransition.DATA); + BuildOptions dataOptions = + dataTransition != ConfigurationTransition.NONE + ? ((PatchTransition) dataTransition).apply(firstTargetConfig.getOptions()) + : firstTargetConfig.getOptions(); BuildOptions hostOptions = dataOptions.get(BuildConfiguration.Options.class).useDistinctHostConfiguration @@ -1257,7 +1265,7 @@ public abstract class SkyframeExecutor implements WalkableGraphFactory { } EvaluationResult result = evaluateSkyKeys(eventHandler, skyKeys); - for (Map.Entry entry : result.errorMap().entrySet()) { + for (Entry entry : result.errorMap().entrySet()) { reportCycles(eventHandler, entry.getValue().getCycleInfo(), entry.getKey()); } @@ -1343,7 +1351,7 @@ public abstract class SkyframeExecutor implements WalkableGraphFactory { EvaluationResult evalResult = evaluateSkyKeys(eventHandler, configSkyKeys, keepGoing); if (evalResult.hasError()) { - Map.Entry firstError = Iterables.get(evalResult.errorMap().entrySet(), 0); + Entry firstError = Iterables.get(evalResult.errorMap().entrySet(), 0); ErrorInfo error = firstError.getValue(); Throwable e = error.getException(); // Wrap loading failed exceptions @@ -1402,7 +1410,7 @@ public abstract class SkyframeExecutor implements WalkableGraphFactory { } EvaluationResult fragmentsResult = evaluateSkyKeys( eventHandler, transitiveFragmentSkyKeys, /*keepGoing=*/true); - for (Map.Entry entry : fragmentsResult.errorMap().entrySet()) { + for (Entry entry : fragmentsResult.errorMap().entrySet()) { reportCycles(eventHandler, entry.getValue().getCycleInfo(), entry.getKey()); } for (Dependency key : keys) { @@ -1800,7 +1808,7 @@ public abstract class SkyframeExecutor implements WalkableGraphFactory { } @VisibleForTesting - public Package.Builder.Helper getPackageBuilderHelperForTesting() { + public Builder.Helper getPackageBuilderHelperForTesting() { return pkgFactory.getPackageBuilderHelperForTesting(); } -- cgit v1.2.3