diff options
author | felly <felly@google.com> | 2018-06-06 19:31:23 -0700 |
---|---|---|
committer | Copybara-Service <copybara-piper@google.com> | 2018-06-06 19:32:38 -0700 |
commit | 89d85ea3c515cb288a388d89673e773f6806d7fa (patch) | |
tree | 2cff8b9d8f912f7a70f180be9310e7d8a6831bbb /src/main/java/com/google/devtools/build/lib/skyframe/ActionExecutionFunction.java | |
parent | ccaccb2b277a82f7264567563a02ab133a0f6e6f (diff) |
Allow for Path and Root resolution when extracting action metadata.
RELNOTES: None
PiperOrigin-RevId: 199572597
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/skyframe/ActionExecutionFunction.java')
-rw-r--r-- | src/main/java/com/google/devtools/build/lib/skyframe/ActionExecutionFunction.java | 26 |
1 files changed, 23 insertions, 3 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/skyframe/ActionExecutionFunction.java b/src/main/java/com/google/devtools/build/lib/skyframe/ActionExecutionFunction.java index 64e9b29681..fa22da4584 100644 --- a/src/main/java/com/google/devtools/build/lib/skyframe/ActionExecutionFunction.java +++ b/src/main/java/com/google/devtools/build/lib/skyframe/ActionExecutionFunction.java @@ -45,6 +45,7 @@ import com.google.devtools.build.lib.rules.cpp.IncludeScannable; import com.google.devtools.build.lib.skyframe.InputArtifactData.MutableInputArtifactData; import com.google.devtools.build.lib.util.Pair; import com.google.devtools.build.lib.util.io.TimestampGranularityMonitor; +import com.google.devtools.build.lib.vfs.Path; import com.google.devtools.build.lib.vfs.PathFragment; import com.google.devtools.build.lib.vfs.Root; import com.google.devtools.build.skyframe.SkyFunction; @@ -385,7 +386,7 @@ public class ActionExecutionFunction implements SkyFunction, CompletionReceiver } // This may be recreated if we discover inputs. ActionMetadataHandler metadataHandler = new ActionMetadataHandler(state.inputArtifactData, - action.getOutputs(), tsgm.get()); + action.getOutputs(), tsgm.get(), pathResolver(state.actionFileSystem)); long actionStartTime = BlazeClock.nanoTime(); // We only need to check the action cache if we haven't done it on a previous run. if (!state.hasCheckedActionCache()) { @@ -462,7 +463,8 @@ public class ActionExecutionFunction implements SkyFunction, CompletionReceiver new PerActionFileCache(state.inputArtifactData, /*missingArtifactsAllowed=*/ false); } metadataHandler = - new ActionMetadataHandler(state.inputArtifactData, action.getOutputs(), tsgm.get()); + new ActionMetadataHandler(state.inputArtifactData, action.getOutputs(), tsgm.get(), + pathResolver(state.actionFileSystem)); // Set the MetadataHandler to accept output information. metadataHandler.discardOutputMetadata(); } @@ -535,7 +537,8 @@ public class ActionExecutionFunction implements SkyFunction, CompletionReceiver // markOmitted is only called for remote execution, and this code only gets executed for // local execution. metadataHandler = - new ActionMetadataHandler(state.inputArtifactData, action.getOutputs(), tsgm.get()); + new ActionMetadataHandler(state.inputArtifactData, action.getOutputs(), tsgm.get(), + pathResolver(state.actionFileSystem)); } } Preconditions.checkState(!env.valuesMissing(), action); @@ -544,6 +547,23 @@ public class ActionExecutionFunction implements SkyFunction, CompletionReceiver return state.value; } + private ArtifactPathResolver pathResolver(ActionFileSystem actionFileSystem) { + if (actionFileSystem != null) { + return new ArtifactPathResolver() { + @Override + public Path toPath(Artifact artifact) { + return actionFileSystem.getPath(artifact.getPath().getPathString()); + } + + @Override + public Root transformRoot(Root root) { + return Root.toFileSystem(root, actionFileSystem); + } + }; + } + return ArtifactPathResolver.IDENTITY; + } + private static final Function<Artifact, SkyKey> TO_NONMANDATORY_SKYKEY = new Function<Artifact, SkyKey>() { @Nullable |