Skip to content

Commit

Permalink
Delete BuildDriver in favor of managing versions from `MemoizingEva…
Browse files Browse the repository at this point in the history
…luator`.

PiperOrigin-RevId: 418826862
  • Loading branch information
justinhorvitz authored and copybara-github committed Dec 29, 2021
1 parent fe72dbb commit 9ad8918
Show file tree
Hide file tree
Showing 98 changed files with 540 additions and 890 deletions.
1 change: 0 additions & 1 deletion src/main/java/com/google/devtools/build/lib/actions/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,6 @@ java_library(
srcs = ["FilesetOutputSymlink.java"],
deps = [
":has_digest",
"//src/main/java/com/google/devtools/build/lib/util",
"//src/main/java/com/google/devtools/build/lib/vfs:pathfragment",
"//third_party:auto_value",
"//third_party:guava",
Expand Down
2 changes: 0 additions & 2 deletions src/main/java/com/google/devtools/build/lib/analysis/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -902,7 +902,6 @@ java_library(
name = "package_specification_provider",
srcs = ["PackageSpecificationProvider.java"],
deps = [
":transitive_info_provider",
"//src/main/java/com/google/devtools/build/lib/collect/nestedset",
"//src/main/java/com/google/devtools/build/lib/packages",
],
Expand Down Expand Up @@ -1234,7 +1233,6 @@ java_library(
":actions/file_write_action_context",
"//src/main/java/com/google/devtools/build/lib/actions",
"//src/main/java/com/google/devtools/build/lib/actions:artifacts",
"//src/main/java/com/google/devtools/build/lib/cmdline",
"//src/main/java/com/google/devtools/build/lib/collect/nestedset",
"//third_party:guava",
"//third_party:jsr305",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ java_library(
"//src/main/java/com/google/devtools/build/skyframe:skyframe-objects",
"//src/main/java/com/google/devtools/common/options",
"//src/main/java/net/starlark/java/eval",
"//src/main/java/net/starlark/java/syntax",
"//src/main/protobuf:failure_details_java_proto",
"//third_party:guava",
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ java_library(
"//src/main/java/com/google/devtools/build/lib/events",
"//src/main/java/com/google/devtools/build/lib/util:abrupt_exit_exception",
"//src/main/java/com/google/devtools/build/lib/util:detailed_exit_code",
"//src/main/java/com/google/devtools/build/lib/util:exit_code",
"//src/main/java/com/google/devtools/build/lib/util/io",
"//src/main/java/com/google/devtools/build/lib/vfs:pathfragment",
"//src/main/java/com/google/devtools/common/options",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ java_library(
deps = [
"//src/main/java/com/google/devtools/build/lib/bazel/rules/ninja/file",
"//src/main/java/com/google/devtools/build/lib/util",
"//src/main/java/com/google/devtools/build/lib/vfs:pathfragment",
"//third_party:guava",
"//third_party:jsr305",
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ java_library(
"//src/main/java/com/google/devtools/build/lib/bazel/rules/ninja/file",
"//src/main/java/com/google/devtools/build/lib/bazel/rules/ninja/lexer",
"//src/main/java/com/google/devtools/build/lib/collect",
"//src/main/java/com/google/devtools/build/lib/concurrent",
"//src/main/java/com/google/devtools/build/lib/util",
"//src/main/java/com/google/devtools/build/lib/vfs:pathfragment",
"//third_party:error_prone_annotations",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ java_library(
"//src/main/java/com/google/devtools/build/lib/buildeventstream/proto:build_event_stream_java_proto",
"//src/main/java/com/google/devtools/build/lib/util:abrupt_exit_exception",
"//src/main/java/com/google/devtools/build/lib/util:detailed_exit_code",
"//src/main/java/com/google/devtools/build/lib/util:exit_code",
"//src/main/java/com/google/devtools/common/options",
"//src/main/protobuf:failure_details_java_proto",
"//third_party:flogger",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ java_library(
"//src/main/java/com/google/devtools/build/lib:runtime",
"//src/main/java/com/google/devtools/build/lib/cmdline",
"//src/main/java/com/google/devtools/build/lib/events",
"//src/main/java/com/google/devtools/build/lib/packages",
"//src/main/java/com/google/devtools/build/lib/pkgcache",
"//src/main/java/com/google/devtools/common/options",
"//third_party:guava",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
import com.google.devtools.build.lib.events.ExtendedEventHandler;
import com.google.devtools.build.lib.skyframe.TransitiveTargetKey;
import com.google.devtools.build.lib.skyframe.TransitiveTargetValue;
import com.google.devtools.build.skyframe.BuildDriver;
import com.google.devtools.build.skyframe.EvaluationContext;
import com.google.devtools.build.skyframe.MemoizingEvaluator;
import com.google.devtools.build.skyframe.SkyKey;
import java.util.ArrayList;
import java.util.List;
Expand All @@ -30,13 +30,13 @@
* that benefits from loading parallelism.
*/
public class QueryTransitivePackagePreloader {
private final Supplier<BuildDriver> buildDriverSupplier;
private final Supplier<MemoizingEvaluator> memoizingEvaluatorSupplier;
private final Supplier<EvaluationContext.Builder> evaluationContextBuilderSupplier;

public QueryTransitivePackagePreloader(
Supplier<BuildDriver> buildDriverSupplier,
Supplier<MemoizingEvaluator> memoizingEvaluatorSupplier,
Supplier<EvaluationContext.Builder> evaluationContextBuilderSupplier) {
this.buildDriverSupplier = buildDriverSupplier;
this.memoizingEvaluatorSupplier = memoizingEvaluatorSupplier;
this.evaluationContextBuilderSupplier = evaluationContextBuilderSupplier;
}

Expand All @@ -59,6 +59,6 @@ public void preloadTransitiveTargets(
.setEventHandler(eventHandler)
.setUseForkJoinPool(true)
.build();
buildDriverSupplier.get().evaluate(valueNames, evaluationContext);
memoizingEvaluatorSupplier.get().evaluate(valueNames, evaluationContext);
}
}
1 change: 0 additions & 1 deletion src/main/java/com/google/devtools/build/lib/platform/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ java_library(
"//src/main/java/com/google/devtools/build/lib:runtime",
"//src/main/java/com/google/devtools/build/lib/events",
"//src/main/java/com/google/devtools/build/lib/jni",
"//src/main/java/com/google/devtools/build/lib/util:os",
"//third_party:flogger",
"//third_party:jsr305",
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ java_library(
":callcounts",
"//src/main/java/com/google/devtools/build/lib:runtime",
"//src/main/java/com/google/devtools/build/lib/events",
"//src/main/java/com/google/devtools/build/lib/util",
"//src/main/java/com/google/devtools/common/options",
"//third_party:guava",
],
Expand Down
3 changes: 0 additions & 3 deletions src/main/java/com/google/devtools/build/lib/rules/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -279,9 +279,6 @@ java_library(
"//src/main/java/com/google/devtools/build/lib/actions",
"//src/main/java/com/google/devtools/build/lib/analysis:analysis_cluster",
"//src/main/java/com/google/devtools/build/lib/analysis:configured_target",
"//src/main/java/com/google/devtools/build/lib/analysis:transitive_info_provider",
"//src/main/java/com/google/devtools/build/lib/analysis:visibility_provider",
"//src/main/java/com/google/devtools/build/lib/analysis:visibility_provider_impl",
"//src/main/java/com/google/devtools/build/lib/collect/nestedset",
"//src/main/java/com/google/devtools/build/lib/packages",
"//third_party:guava",
Expand Down
2 changes: 0 additions & 2 deletions src/main/java/com/google/devtools/build/lib/rules/apple/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@ java_library(
"//src/main/java/com/google/devtools/build/lib/analysis:configured_target",
"//src/main/java/com/google/devtools/build/lib/analysis:rule_definition_environment",
"//src/main/java/com/google/devtools/build/lib/analysis:transitive_info_provider",
"//src/main/java/com/google/devtools/build/lib/analysis:visibility_provider",
"//src/main/java/com/google/devtools/build/lib/analysis:visibility_provider_impl",
"//src/main/java/com/google/devtools/build/lib/analysis:xcode_config_event",
"//src/main/java/com/google/devtools/build/lib/analysis/starlark/annotations",
"//src/main/java/com/google/devtools/build/lib/cmdline",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ java_library(
"//src/main/java/com/google/devtools/build/lib/analysis:template_variable_info",
"//src/main/java/com/google/devtools/build/lib/analysis:test/instrumented_files_info",
"//src/main/java/com/google/devtools/build/lib/analysis:transitive_info_collection",
"//src/main/java/com/google/devtools/build/lib/analysis:transitive_info_provider",
"//src/main/java/com/google/devtools/build/lib/analysis/platform",
"//src/main/java/com/google/devtools/build/lib/analysis/starlark/annotations",
"//src/main/java/com/google/devtools/build/lib/bazel/rules/cpp:bazel_cpp_semantics",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,7 @@ public BlazeCommandResult exec(CommandEnvironment env, OptionsParsingResult opti
findConfigurations(CommandEnvironment env) {
InMemoryMemoizingEvaluator evaluator =
(InMemoryMemoizingEvaluator)
env.getRuntime().getWorkspace().getSkyframeExecutor().getEvaluatorForTesting();
env.getRuntime().getWorkspace().getSkyframeExecutor().getEvaluator();
return evaluator.getDoneValues().entrySet().stream()
.filter(e -> SkyFunctions.BUILD_CONFIGURATION.equals(e.getKey().functionName()))
.collect(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ java_library(
"//src/main/java/com/google/devtools/build/lib/skyframe:skyframe_cluster",
"//src/main/java/com/google/devtools/build/lib/util:abrupt_exit_exception",
"//src/main/java/com/google/devtools/build/lib/util:debug-logger-configurator",
"//src/main/java/com/google/devtools/build/lib/util:process",
"//src/main/java/com/google/devtools/build/lib/util:string",
"//src/main/java/com/google/devtools/build/lib/vfs",
"//src/main/java/com/google/devtools/common/options",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ java_library(
"//src/main/java/com/google/devtools/build/lib/shell",
"//src/main/java/com/google/devtools/build/lib/util:command",
"//src/main/java/com/google/devtools/build/lib/util:detailed_exit_code",
"//src/main/java/com/google/devtools/build/lib/util:interrupted_failure_details",
"//src/main/java/com/google/devtools/build/lib/util/io:out-err",
"//src/main/java/com/google/devtools/build/lib/vfs",
"//src/main/java/com/google/devtools/common/options",
Expand Down
14 changes: 0 additions & 14 deletions src/main/java/com/google/devtools/build/lib/skyframe/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -416,7 +416,6 @@ java_library(
":output_store",
":tree_artifact_value",
"//src/main/java/com/google/devtools/build/lib/actions",
"//src/main/java/com/google/devtools/build/lib/actions:action_lookup_data",
"//src/main/java/com/google/devtools/build/lib/actions:artifacts",
"//src/main/java/com/google/devtools/build/lib/actions:file_metadata",
"//src/main/java/com/google/devtools/build/lib/actions:fileset_output_symlink",
Expand Down Expand Up @@ -525,7 +524,6 @@ java_library(
"//src/main/java/com/google/devtools/build/lib/actions:artifacts",
"//src/main/java/com/google/devtools/build/lib/bugreport",
"//src/main/java/com/google/devtools/build/lib/events",
"//src/main/java/com/google/devtools/build/lib/vfs:pathfragment",
"//src/main/java/com/google/devtools/build/skyframe",
"//src/main/java/com/google/devtools/build/skyframe:skyframe-objects",
"//third_party:guava",
Expand Down Expand Up @@ -830,7 +828,6 @@ java_library(
"//src/main/java/com/google/devtools/build/lib/concurrent",
"//src/main/java/com/google/devtools/build/lib/events",
"//src/main/java/com/google/devtools/build/lib/packages",
"//src/main/java/com/google/devtools/build/lib/packages/semantics",
"//src/main/java/com/google/devtools/build/lib/skyframe/serialization/autocodec",
"//src/main/java/com/google/devtools/build/lib/skyframe/serialization/autocodec:serialization-constant",
"//src/main/java/com/google/devtools/build/lib/vfs",
Expand Down Expand Up @@ -1093,7 +1090,6 @@ java_library(
"//src/main/java/com/google/devtools/build/lib/packages",
"//src/main/java/com/google/devtools/build/skyframe",
"//src/main/java/com/google/devtools/build/skyframe:skyframe-objects",
"//third_party:flogger",
"//third_party:guava",
"//third_party:jsr305",
],
Expand Down Expand Up @@ -1188,7 +1184,6 @@ java_library(
"//src/main/java/com/google/devtools/build/lib/vfs:pathfragment",
"//src/main/java/com/google/devtools/build/skyframe",
"//src/main/java/com/google/devtools/build/skyframe:skyframe-objects",
"//third_party:jsr305",
],
)

Expand Down Expand Up @@ -1275,7 +1270,6 @@ java_library(
"//src/main/java/com/google/devtools/build/lib/vfs",
"//src/main/java/com/google/devtools/build/skyframe",
"//src/main/java/com/google/devtools/build/skyframe:skyframe-objects",
"//third_party:jsr305",
],
)

Expand Down Expand Up @@ -1775,7 +1769,6 @@ java_library(
"//src/main/java/com/google/devtools/build/skyframe",
"//src/main/java/com/google/devtools/build/skyframe:skyframe-objects",
"//third_party:guava",
"//third_party:jsr305",
],
)

Expand Down Expand Up @@ -2380,7 +2373,6 @@ java_library(
"//src/main/java/com/google/devtools/build/lib/events",
"//src/main/java/com/google/devtools/build/lib/packages",
"//src/main/java/com/google/devtools/build/lib/pkgcache",
"//src/main/java/com/google/devtools/build/lib/skyframe/serialization/autocodec",
"//src/main/java/com/google/devtools/build/lib/vfs:pathfragment",
"//src/main/java/com/google/devtools/build/skyframe:skyframe-objects",
"//third_party:guava",
Expand All @@ -2395,7 +2387,6 @@ java_library(
":target_pattern_value",
"//src/main/java/com/google/devtools/build/lib/cmdline",
"//src/main/java/com/google/devtools/build/lib/pkgcache",
"//src/main/java/com/google/devtools/build/lib/vfs:pathfragment",
"//src/main/java/com/google/devtools/build/skyframe",
"//src/main/java/com/google/devtools/build/skyframe:skyframe-objects",
"//third_party:guava",
Expand Down Expand Up @@ -2457,7 +2448,6 @@ java_library(
"//src/main/java/com/google/devtools/build/skyframe",
"//src/main/java/com/google/devtools/build/skyframe:skyframe-objects",
"//third_party:guava",
"//third_party:jsr305",
],
)

Expand All @@ -2469,7 +2459,6 @@ java_library(
"//src/main/java/com/google/devtools/build/lib/cmdline",
"//src/main/java/com/google/devtools/build/lib/concurrent",
"//src/main/java/com/google/devtools/build/lib/packages",
"//src/main/java/com/google/devtools/build/lib/skyframe/serialization/autocodec",
"//src/main/java/com/google/devtools/build/skyframe:skyframe-objects",
"//third_party:guava",
],
Expand All @@ -2487,7 +2476,6 @@ java_library(
"//src/main/java/com/google/devtools/build/skyframe",
"//src/main/java/com/google/devtools/build/skyframe:skyframe-objects",
"//third_party:guava",
"//third_party:jsr305",
],
)

Expand All @@ -2498,7 +2486,6 @@ java_library(
":sky_functions",
"//src/main/java/com/google/devtools/build/lib/cmdline",
"//src/main/java/com/google/devtools/build/lib/concurrent",
"//src/main/java/com/google/devtools/build/lib/skyframe/serialization/autocodec",
"//src/main/java/com/google/devtools/build/skyframe:skyframe-objects",
"//third_party:guava",
],
Expand Down Expand Up @@ -2587,7 +2574,6 @@ java_library(
name = "transitive_target_value",
srcs = ["TransitiveTargetValue.java"],
deps = [
"//src/main/java/com/google/devtools/build/lib/analysis:config/fragment",
"//src/main/java/com/google/devtools/build/lib/cmdline",
"//src/main/java/com/google/devtools/build/lib/collect/nestedset",
"//src/main/java/com/google/devtools/build/lib/concurrent",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,6 @@
import com.google.devtools.build.lib.vfs.ModifiedFileSet;
import com.google.devtools.build.lib.vfs.Root;
import com.google.devtools.build.lib.vfs.RootedPath;
import com.google.devtools.build.skyframe.BuildDriver;
import com.google.devtools.build.skyframe.Differencer;
import com.google.devtools.build.skyframe.EvaluationContext;
import com.google.devtools.build.skyframe.GraphInconsistencyReceiver;
Expand All @@ -96,7 +95,6 @@
import com.google.devtools.build.skyframe.MemoizingEvaluator.EvaluatorSupplier;
import com.google.devtools.build.skyframe.RecordingDifferencer;
import com.google.devtools.build.skyframe.SequencedRecordingDifferencer;
import com.google.devtools.build.skyframe.SequentialBuildDriver;
import com.google.devtools.build.skyframe.SkyFunction;
import com.google.devtools.build.skyframe.SkyFunctionName;
import com.google.devtools.build.skyframe.SkyKey;
Expand Down Expand Up @@ -203,11 +201,6 @@ private SequencedSkyframeExecutor(
this.workspaceInfoFromDiffReceiver = workspaceInfoFromDiffReceiver;
}

@Override
protected BuildDriver createBuildDriver() {
return new SequentialBuildDriver(memoizingEvaluator);
}

@Override
public void resetEvaluator() {
super.resetEvaluator();
Expand Down Expand Up @@ -498,7 +491,7 @@ private void handleDiffsWithMissingDiffInformation(
.setNumThreads(DEFAULT_THREAD_COUNT)
.setEventHandler(eventHandler)
.build();
getDriver().evaluate(ImmutableList.of(), evaluationContext);
memoizingEvaluator.evaluate(ImmutableList.of(), evaluationContext);

FilesystemValueChecker fsvc =
new FilesystemValueChecker(tsgm, /* lastExecutionTimeRange= */ null, fsvcThreads);
Expand Down Expand Up @@ -571,7 +564,7 @@ private void handleDiffsWithMissingDiffInformation(
tmpExternalFilesHelper, EnumSet.of(FileType.EXTERNAL)));
}
handleChangedFiles(
ImmutableList.<Root>of(),
ImmutableList.of(),
batchDirtyResult,
batchDirtyResult.getNumKeysChecked(),
/*managedDirectoriesChanged=*/ false);
Expand Down Expand Up @@ -890,7 +883,7 @@ protected void dropConfiguredTargetsNow(final ExtendedEventHandler eventHandler)
.setNumThreads(ResourceUsage.getAvailableProcessors())
.setEventHandler(eventHandler)
.build();
getDriver().evaluate(ImmutableList.of(), evaluationContext);
memoizingEvaluator.evaluate(ImmutableList.of(), evaluationContext);
return null;
});
} catch (Exception e) {
Expand Down Expand Up @@ -1017,7 +1010,7 @@ private SkyValue evaluateSingleValue(SkyKey key, ExtendedEventHandler eventHandl
.setNumThreads(DEFAULT_THREAD_COUNT)
.setEventHandler(eventHandler)
.build();
return getDriver().evaluate(ImmutableSet.of(key), evaluationContext).get(key);
return memoizingEvaluator.evaluate(ImmutableSet.of(key), evaluationContext).get(key);
}

public static Builder builder() {
Expand Down
Loading

0 comments on commit 9ad8918

Please sign in to comment.