aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google/devtools/build/lib/rules/repository
diff options
context:
space:
mode:
authorGravatar Klaus Aehlig <aehlig@google.com>2018-06-14 05:48:46 -0700
committerGravatar Copybara-Service <copybara-piper@google.com>2018-06-14 05:50:01 -0700
commit93fe20ce350e813caa53049a97f04014e0169df3 (patch)
tree5bc7f88fb1e86b1ba48f326a414fef796c1fba98 /src/main/java/com/google/devtools/build/lib/rules/repository
parent1615da781db78b7a910daf89720189c2b2e73dbe (diff)
Support unconditional fetching of repositories
Make all external repositories depend on an additional SkyValue controllable via commands, so support unconditional fetching of all external repositories, as it is needed by the the `sync` command. Improves on #5175, provides a work around for #4907. Change-Id: I30033614c1a2fad3f1363b85ff69cf92f697c255 PiperOrigin-RevId: 200543985
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/rules/repository')
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/repository/RepositoryDelegatorFunction.java18
1 files changed, 15 insertions, 3 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/rules/repository/RepositoryDelegatorFunction.java b/src/main/java/com/google/devtools/build/lib/rules/repository/RepositoryDelegatorFunction.java
index db74f31652..a590c0bfb6 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/repository/RepositoryDelegatorFunction.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/repository/RepositoryDelegatorFunction.java
@@ -56,6 +56,12 @@ public final class RepositoryDelegatorFunction implements SkyFunction {
public static final Precomputed<Map<RepositoryName, PathFragment>> REPOSITORY_OVERRIDES =
new Precomputed<>(PrecomputedValue.Key.create("repository_overrides"));
+ public static final Precomputed<String> DEPENDENCY_FOR_UNCONDITIONAL_FETCHING =
+ new Precomputed<>(
+ PrecomputedValue.Key.create("dependency_for_unconditional_repository_fetching"));
+
+ public static final String DONT_FETCH_UNCONDITIONALLY = "";
+
// The marker file version is inject in the rule key digest so the rule key is always different
// when we decide to update the format.
private static final int MARKER_FILE_VERSION = 3;
@@ -107,6 +113,10 @@ public final class RepositoryDelegatorFunction implements SkyFunction {
if (env.valuesMissing()) {
return null;
}
+ String fetchUnconditionally = DEPENDENCY_FOR_UNCONDITIONAL_FETCHING.get(env);
+ if (env.valuesMissing()) {
+ return null;
+ }
Path repoRoot = RepositoryFunction.getExternalRepositoryDirectory(directories)
.getRelative(repositoryName.strippedName());
@@ -170,9 +180,11 @@ public final class RepositoryDelegatorFunction implements SkyFunction {
if (env.valuesMissing()) {
return null;
}
- if (markerHash != null && repoRoot.exists()) {
- // Now that we know that it exists, we can declare a Skyframe dependency on the repository
- // root.
+ if (DONT_FETCH_UNCONDITIONALLY.equals(fetchUnconditionally)
+ && markerHash != null
+ && repoRoot.exists()) {
+ // Now that we know that it exists and that we should not fetch unconditionally, we can
+ // declare a Skyframe dependency on the repository root.
RepositoryFunction.getRepositoryDirectory(repoRoot, env);
if (env.valuesMissing()) {
return null;