aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google/devtools/build/lib/rules
diff options
context:
space:
mode:
authorGravatar Kristina Chodorow <kchodorow@google.com>2016-06-16 14:55:33 +0000
committerGravatar Yue Gan <yueg@google.com>2016-06-17 09:25:05 +0000
commit91a7a34fb46fa04165ac90ca095d1272f2a39327 (patch)
treeec2cb39c908640932cdc13eb8db5889c092fad66 /src/main/java/com/google/devtools/build/lib/rules
parent9b1fb68ea8882aaaacac1d9ee854f50f85eeefa5 (diff)
Create mark file for local repositories, too
Local repositories were not marked, so if a WS file switched from remote->local->remote, on the first run the remote rule would create a mark file, on the second run the local rule would ignore it, and then on the third run the remote rule would look at the mark file and see, "I'm already up-to-date," leaving the repository as a local repo. Fixes #977. -- MOS_MIGRATED_REVID=125060180
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/rules')
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/repository/RepositoryDelegatorFunction.java20
1 files changed, 12 insertions, 8 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 cede852c67..8f15451230 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
@@ -113,26 +113,30 @@ public final class RepositoryDelegatorFunction implements SkyFunction {
Path repoRoot =
RepositoryFunction.getExternalRepositoryDirectory(directories).getRelative(rule.getName());
+ byte[] ruleSpecificData = handler.getRuleSpecificMarkerData(rule, env);
+ if (ruleSpecificData == null) {
+ return null;
+ }
+ byte[] ruleKey = computeRuleKey(rule, ruleSpecificData);
+ Path markerPath = getMarkerPath(directories, rule);
handler.setClientEnvironment(clientEnvironment);
if (handler.isLocal(rule)) {
// Local repositories are always fetched because the operation is generally fast and they do
- // not depend on non-local data, so it does not make much sense to try to catch from across
+ // not depend on non-local data, so it does not make much sense to try to cache from across
// server instances.
setupRepositoryRoot(repoRoot);
- return handler.fetch(rule, repoRoot, directories, env);
+ SkyValue localRepo = handler.fetch(rule, repoRoot, directories, env);
+ if (localRepo != null) {
+ writeMarkerFile(markerPath, ruleKey);
+ }
+ return localRepo;
}
// We check the repository root for existence here, but we can't depend on the FileValue,
// because it's possible that we eventually create that directory in which case the FileValue
// and the state of the file system would be inconsistent.
- byte[] ruleSpecificData = handler.getRuleSpecificMarkerData(rule, env);
- if (ruleSpecificData == null) {
- return null;
- }
- byte[] ruleKey = computeRuleKey(rule, ruleSpecificData);
- Path markerPath = getMarkerPath(directories, rule);
boolean markerUpToDate = isFilesystemUpToDate(markerPath, ruleKey);
if (markerUpToDate && repoRoot.exists()) {
// Now that we know that it exists, we can declare a Skyframe dependency on the repository