Skip to content

Commit

Permalink
CriticalPathComputer: make self-contained
Browse files Browse the repository at this point in the history
We previously sub-classed this class in non-open source code, and now we
don't do this anymore.

PiperOrigin-RevId: 259706079
  • Loading branch information
ulfjack authored and copybara-github committed Jul 24, 2019
1 parent 0ebf8e2 commit 7963643
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
import java.time.Duration;
import java.util.Comparator;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentMap;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.atomic.AtomicReference;
Expand Down Expand Up @@ -65,7 +66,7 @@ public class CriticalPathComputer {

private final AtomicInteger idGenerator = new AtomicInteger();
// outputArtifactToComponent is accessed from multiple event handlers.
protected final ConcurrentMap<Artifact, CriticalPathComponent> outputArtifactToComponent =
private final ConcurrentMap<Artifact, CriticalPathComponent> outputArtifactToComponent =
Maps.newConcurrentMap();
private final ActionKeyContext actionKeyContext;

Expand All @@ -74,15 +75,15 @@ public class CriticalPathComputer {
private final Clock clock;
private final boolean checkCriticalPathInconsistencies;

protected CriticalPathComputer(
public CriticalPathComputer(
ActionKeyContext actionKeyContext, Clock clock, boolean checkCriticalPathInconsistencies) {
this.actionKeyContext = actionKeyContext;
this.clock = clock;
maxCriticalPath = new AtomicReference<>();
this.checkCriticalPathInconsistencies = checkCriticalPathInconsistencies;
}

protected CriticalPathComputer(ActionKeyContext actionKeyContext, Clock clock) {
public CriticalPathComputer(ActionKeyContext actionKeyContext, Clock clock) {
this(actionKeyContext, clock, /*checkCriticalPathInconsistencies=*/ true);
}

Expand Down Expand Up @@ -164,6 +165,10 @@ public AggregatedCriticalPath aggregate() {
components.build());
}

public Map<Artifact, CriticalPathComponent> getCriticalPathComponentsMap() {
return outputArtifactToComponent;
}

/** Adds spawn metrics to the action stats. */
@Subscribe
@AllowConcurrentEvents
Expand Down
2 changes: 1 addition & 1 deletion third_party/ijar/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ package(

licenses(["notice"]) # Apache 2.0

load("@rules_pkg//:pkg.bzl", "pkg_tar")
load("//tools/build_defs/pkg:pkg.bzl", "pkg_tar")

cc_library(
name = "zip",
Expand Down

0 comments on commit 7963643

Please sign in to comment.