Skip to content

Commit

Permalink
Add getMaxTransitiveSourceVersionToInjectForNonHermeticFunction to …
Browse files Browse the repository at this point in the history
…`SkyFunction`, which returns the max transitive source version (mtsv) that could be injected via `SkyFunctionEnvironment#injectVersionForNonHermeticFunction` if `#compute` were invoked for a `SkyKey`/`SkyValue` pair, or null if no call for version injection is made.

PiperOrigin-RevId: 526996521
Change-Id: Ie99c41a452e3c67ae9a60546164cafaaac54cc7f
  • Loading branch information
Googler authored and fweikert committed May 25, 2023
1 parent 2f93bd2 commit a85b30c
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/main/java/com/google/devtools/build/skyframe/SkyFunction.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
// limitations under the License.
package com.google.devtools.build.skyframe;

import static com.google.common.base.Preconditions.checkState;

import com.google.common.base.Preconditions;
import com.google.common.graph.GraphBuilder;
import com.google.common.graph.ImmutableGraph;
Expand All @@ -21,6 +23,7 @@
import com.google.devtools.build.lib.events.ExtendedEventHandler;
import com.google.devtools.build.lib.events.Reportable;
import com.google.errorprone.annotations.CanIgnoreReturnValue;
import java.io.IOException;
import java.util.concurrent.ConcurrentHashMap;
import java.util.function.Supplier;
import javax.annotation.Nullable;
Expand Down Expand Up @@ -84,6 +87,19 @@ default String extractTag(SkyKey skyKey) {
return null;
}

/**
* Returns the max transitive source version that would be injected via {@link
* SkyFunctionEnvironment#injectVersionForNonHermeticFunction} if {@link #compute(SkyKey,
* Environment)} were invoked for the given {@link SkyKey}/{@link SkyValue} pair, or null if no
* call for version injection would be made.
*/
@Nullable
default Version getMaxTransitiveSourceVersionToInjectForNonHermeticFunction(
SkyKey skyKey, SkyValue skyValue) throws IOException {
checkState(skyKey.functionName().getHermeticity() == FunctionHermeticity.HERMETIC);
return null;
}

/**
* Sentinel {@link SkyValue} type for {@link #compute} to return, indicating that something went
* wrong, and that the evaluation returning this value must be restarted, and the nodes associated
Expand Down

0 comments on commit a85b30c

Please sign in to comment.