Skip to content

Commit

Permalink
Remove TargetMarkerFunction
Browse files Browse the repository at this point in the history
It was only used by TransitiveBaseTraversalFunction, to which I moved
the error handling code that was previously in TargetMarkerFunction.

We see significantly faster deps() queries in some cases (~20%).

PiperOrigin-RevId: 247399011
  • Loading branch information
ulfjack authored and copybara-github committed May 9, 2019
1 parent 597e289 commit 731451f
Show file tree
Hide file tree
Showing 11 changed files with 123 additions and 512 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,6 @@ public final class SkyFunctions {
static final SkyFunctionName PACKAGE_ERROR = SkyFunctionName.createHermetic("PACKAGE_ERROR");
public static final SkyFunctionName PACKAGE_ERROR_MESSAGE =
SkyFunctionName.createHermetic("PACKAGE_ERROR_MESSAGE");
public static final SkyFunctionName TARGET_MARKER =
SkyFunctionName.createHermetic("TARGET_MARKER");
// Semi-hermetic because accesses package locator
public static final SkyFunctionName TARGET_PATTERN =
SkyFunctionName.createSemiHermetic("TARGET_PATTERN");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -536,7 +536,6 @@ private ImmutableMap<SkyFunctionName, SkyFunction> skyFunctions(PackageFactory p
: IncrementalityIntent.NON_INCREMENTAL));
map.put(SkyFunctions.PACKAGE_ERROR, new PackageErrorFunction());
map.put(SkyFunctions.PACKAGE_ERROR_MESSAGE, new PackageErrorMessageFunction());
map.put(SkyFunctions.TARGET_MARKER, new TargetMarkerFunction());
map.put(SkyFunctions.TARGET_PATTERN_ERROR, new TargetPatternErrorFunction());
map.put(SkyFunctions.TRANSITIVE_TARGET, new TransitiveTargetFunction(ruleClassProvider));
map.put(Label.TRANSITIVE_TRAVERSAL, new TransitiveTraversalFunction());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,20 +84,36 @@ public boolean sync(
if (!keepGoing) {
// We may have multiple errors, but in non keep_going builds, we're obligated to print only
// one of them.
Preconditions.checkState(!errors.isEmpty(), result);
Map.Entry<SkyKey, ErrorInfo> error = errors.iterator().next();
ErrorInfo errorInfo = error.getValue();
SkyKey topLevel = error.getKey();
Label topLevelLabel = ((TransitiveTargetKey) topLevel).getLabel();
if (!Iterables.isEmpty(errorInfo.getCycleInfo())) {
skyframeCyclesReporter.get().reportCycles(errorInfo.getCycleInfo(), topLevel, eventHandler);
errorAboutLoadingFailure(topLevelLabel, null, eventHandler);
} else if (isDirectErrorFromTopLevelLabel(topLevelLabel, labelsToVisit, errorInfo)) {
// An error caused by a non-top-level label has already been reported during error
// bubbling but an error caused by the top-level non-target label itself hasn't been
// reported yet. Note that errors from top-level targets have already been reported
// during target parsing.
errorAboutLoadingFailure(topLevelLabel, errorInfo.getException(), eventHandler);
if (!errors.isEmpty()) {
Map.Entry<SkyKey, ErrorInfo> error = errors.iterator().next();
ErrorInfo errorInfo = error.getValue();
SkyKey topLevel = error.getKey();
Label topLevelLabel = ((TransitiveTargetKey) topLevel).getLabel();
if (!errorInfo.getCycleInfo().isEmpty()) {
skyframeCyclesReporter
.get()
.reportCycles(errorInfo.getCycleInfo(), topLevel, eventHandler);
errorAboutLoadingFailure(topLevelLabel, null, eventHandler);
} else if (isDirectErrorFromTopLevelLabel(topLevelLabel, labelsToVisit, errorInfo)) {
// An error caused by a non-top-level label has already been reported during error
// bubbling but an error caused by the top-level non-target label itself hasn't been
// reported yet. Note that errors from top-level targets have already been reported
// during target parsing.
errorAboutLoadingFailure(topLevelLabel, errorInfo.getException(), eventHandler);
}
} else {
for (TransitiveTargetKey topLevelTransitiveTargetKey :
result.<TransitiveTargetKey>keyNames()) {
TransitiveTargetValue topLevelTransitiveTargetValue =
result.get(topLevelTransitiveTargetKey);
if (topLevelTransitiveTargetValue.getTransitiveRootCauses() != null) {
errorAboutLoadingFailure(
topLevelTransitiveTargetKey.getLabel(),
topLevelTransitiveTargetValue.getErrorLoadingTarget(),
eventHandler);
break;
}
}
}
return false;
}
Expand Down

This file was deleted.

This file was deleted.

Loading

0 comments on commit 731451f

Please sign in to comment.