From 4ea7fa325a33340c557010ec6fac5eb1532c6503 Mon Sep 17 00:00:00 2001 From: ulfjack Date: Fri, 26 Jan 2018 05:46:02 -0800 Subject: Make experimental_inmemory_dotd_files not fail with local execution If actions are executed locally, silently fall back to reading the on-disk .d file. PiperOrigin-RevId: 183376432 --- .../com/google/devtools/build/lib/rules/cpp/CppCompileAction.java | 8 +++++++- .../com/google/devtools/build/lib/rules/cpp/SpawnGccStrategy.java | 5 ----- 2 files changed, 7 insertions(+), 6 deletions(-) (limited to 'src/main/java/com/google/devtools/build/lib') diff --git a/src/main/java/com/google/devtools/build/lib/rules/cpp/CppCompileAction.java b/src/main/java/com/google/devtools/build/lib/rules/cpp/CppCompileAction.java index 7f520dcaaa..70446b2809 100644 --- a/src/main/java/com/google/devtools/build/lib/rules/cpp/CppCompileAction.java +++ b/src/main/java/com/google/devtools/build/lib/rules/cpp/CppCompileAction.java @@ -1216,7 +1216,13 @@ public class CppCompileAction extends AbstractAction // case where we expected an in-memory .d file, but we did not get an appropriate response. // Perhaps we produced the file locally. if (dotdFile.artifact() != null || reply == null) { - return depSet.read(dotdFile.getPath()); + Path dotdPath; + if (dotdFile.artifact() != null) { + dotdPath = dotdFile.getPath(); + } else { + dotdPath = execRoot.getRelative(dotdFile.getSafeExecPath()); + } + return depSet.read(dotdPath); } else { // This is an in-memory .d file. return depSet.process(reply.getContents()); diff --git a/src/main/java/com/google/devtools/build/lib/rules/cpp/SpawnGccStrategy.java b/src/main/java/com/google/devtools/build/lib/rules/cpp/SpawnGccStrategy.java index 4b64e2b7ad..77966e0f88 100644 --- a/src/main/java/com/google/devtools/build/lib/rules/cpp/SpawnGccStrategy.java +++ b/src/main/java/com/google/devtools/build/lib/rules/cpp/SpawnGccStrategy.java @@ -26,7 +26,6 @@ import com.google.devtools.build.lib.actions.SimpleSpawn; import com.google.devtools.build.lib.actions.Spawn; import com.google.devtools.build.lib.actions.SpawnActionContext; import com.google.devtools.build.lib.actions.SpawnResult; -import com.google.devtools.build.lib.actions.UserExecException; import java.util.List; /** @@ -50,10 +49,6 @@ public class SpawnGccStrategy implements CppCompileActionContext { public CppCompileActionResult execWithReply( CppCompileAction action, ActionExecutionContext actionExecutionContext) throws ExecException, InterruptedException { - if (action.getDotdFile() != null && action.getDotdFile().artifact() == null) { - throw new UserExecException("cannot execute remotely or locally: " - + action.getPrimaryInput().getExecPathString()); - } Iterable inputs = Iterables.concat(action.getInputs(), action.getAdditionalInputs()); Spawn spawn = new SimpleSpawn( action, -- cgit v1.2.3