diff options
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/rules/cpp')
6 files changed, 35 insertions, 14 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/rules/cpp/CreateIncSymlinkAction.java b/src/main/java/com/google/devtools/build/lib/rules/cpp/CreateIncSymlinkAction.java index bcad6786a7..8e37da5bba 100644 --- a/src/main/java/com/google/devtools/build/lib/rules/cpp/CreateIncSymlinkAction.java +++ b/src/main/java/com/google/devtools/build/lib/rules/cpp/CreateIncSymlinkAction.java @@ -68,8 +68,8 @@ public final class CreateIncSymlinkAction extends AbstractAction { throws ActionExecutionException { try { for (Map.Entry<Artifact, Artifact> entry : symlinks.entrySet()) { - Path symlink = entry.getKey().getPath(); - symlink.createSymbolicLink(entry.getValue().getPath()); + Path symlink = actionExecutionContext.getInputPath(entry.getKey()); + symlink.createSymbolicLink(actionExecutionContext.getInputPath(entry.getValue())); } } catch (IOException e) { String message = "IO Error while creating symlink"; diff --git a/src/main/java/com/google/devtools/build/lib/rules/cpp/FakeCppCompileAction.java b/src/main/java/com/google/devtools/build/lib/rules/cpp/FakeCppCompileAction.java index 25b22678ea..7906362a3d 100644 --- a/src/main/java/com/google/devtools/build/lib/rules/cpp/FakeCppCompileAction.java +++ b/src/main/java/com/google/devtools/build/lib/rules/cpp/FakeCppCompileAction.java @@ -237,10 +237,19 @@ public class FakeCppCompileAction extends CppCompileAction { // both. Preconditions.checkState(outputFile.getExecPath().getParentDirectory().equals( getDotdFile().getSafeExecPath().getParentDirectory())); - FileSystemUtils.writeContent(outputFile.getPath(), ISO_8859_1, - outputFile.getPath().getBaseName() + ": " - + "mkdir -p " + outputPrefix + "$(dirname " + outputFile.getExecPath() + ")" - + " && " + argv + "\n"); + FileSystemUtils.writeContent( + actionExecutionContext.getInputPath(outputFile), + ISO_8859_1, + actionExecutionContext.getInputPath(outputFile).getBaseName() + + ": " + + "mkdir -p " + + outputPrefix + + "$(dirname " + + outputFile.getExecPath() + + ")" + + " && " + + argv + + "\n"); } catch (IOException e) { throw new ActionExecutionException("failed to create fake compile command for rule '" + getOwner().getLabel() + ": " + e.getMessage(), this, false); diff --git a/src/main/java/com/google/devtools/build/lib/rules/cpp/IncludeScanner.java b/src/main/java/com/google/devtools/build/lib/rules/cpp/IncludeScanner.java index 1335470856..782028712a 100644 --- a/src/main/java/com/google/devtools/build/lib/rules/cpp/IncludeScanner.java +++ b/src/main/java/com/google/devtools/build/lib/rules/cpp/IncludeScanner.java @@ -158,12 +158,14 @@ public interface IncludeScanner { // the root path for such includes if (included.getRoot().getRoot().isAbsolute()) { if (FileSystemUtils.startsWithAny( - included.getPath().asFragment(), absoluteBuiltInIncludeDirs)) { + actionExecutionContext.getInputPath(included).asFragment(), + absoluteBuiltInIncludeDirs)) { // Skip include files found in absolute include directories. continue; } throw new UserExecException( - "illegal absolute path to include file: " + included.getPath()); + "illegal absolute path to include file: " + + actionExecutionContext.getInputPath(included)); } inputs.add(included); } diff --git a/src/main/java/com/google/devtools/build/lib/rules/cpp/LtoBackendAction.java b/src/main/java/com/google/devtools/build/lib/rules/cpp/LtoBackendAction.java index 2e992fefac..ce171002b6 100644 --- a/src/main/java/com/google/devtools/build/lib/rules/cpp/LtoBackendAction.java +++ b/src/main/java/com/google/devtools/build/lib/rules/cpp/LtoBackendAction.java @@ -121,12 +121,16 @@ public final class LtoBackendAction extends SpawnAction { // Build set of files this LTO backend artifact will import from. HashSet<PathFragment> importSet = new HashSet<>(); try { - for (String line : FileSystemUtils.iterateLinesAsLatin1(imports.getPath())) { + for (String line : + FileSystemUtils.iterateLinesAsLatin1(actionExecutionContext.getInputPath(imports))) { if (!line.isEmpty()) { PathFragment execPath = PathFragment.create(line); if (execPath.isAbsolute()) { throw new ActionExecutionException( - "Absolute paths not allowed in imports file " + imports.getPath() + ": " + execPath, + "Absolute paths not allowed in imports file " + + actionExecutionContext.getInputPath(imports) + + ": " + + execPath, this, false); } @@ -135,14 +139,20 @@ public final class LtoBackendAction extends SpawnAction { } } catch (IOException e) { throw new ActionExecutionException( - "error iterating imports file " + imports.getPath(), e, this, false); + "error iterating imports file " + actionExecutionContext.getInputPath(imports), + e, + this, + false); } // Convert the import set of paths to the set of bitcode file artifacts. Set<Artifact> bitcodeInputSet = computeBitcodeInputs(importSet); if (bitcodeInputSet.size() != importSet.size()) { throw new ActionExecutionException( - "error computing inputs from imports file " + imports.getPath(), this, false); + "error computing inputs from imports file " + + actionExecutionContext.getInputPath(imports), + this, + false); } updateInputs(createInputs(bitcodeInputSet, getMandatoryInputs())); return bitcodeInputSet; diff --git a/src/main/java/com/google/devtools/build/lib/rules/cpp/SolibSymlinkAction.java b/src/main/java/com/google/devtools/build/lib/rules/cpp/SolibSymlinkAction.java index c0c5e3a657..ea9d03758e 100644 --- a/src/main/java/com/google/devtools/build/lib/rules/cpp/SolibSymlinkAction.java +++ b/src/main/java/com/google/devtools/build/lib/rules/cpp/SolibSymlinkAction.java @@ -62,7 +62,7 @@ public final class SolibSymlinkAction extends AbstractAction { @Override public ActionResult execute(ActionExecutionContext actionExecutionContext) throws ActionExecutionException { - Path mangledPath = symlink.getPath(); + Path mangledPath = actionExecutionContext.getInputPath(symlink); try { mangledPath.createSymbolicLink(target); } catch (IOException e) { diff --git a/src/main/java/com/google/devtools/build/lib/rules/cpp/WriteBuildInfoHeaderAction.java b/src/main/java/com/google/devtools/build/lib/rules/cpp/WriteBuildInfoHeaderAction.java index 93e40f95e1..5d977a1dff 100644 --- a/src/main/java/com/google/devtools/build/lib/rules/cpp/WriteBuildInfoHeaderAction.java +++ b/src/main/java/com/google/devtools/build/lib/rules/cpp/WriteBuildInfoHeaderAction.java @@ -98,7 +98,7 @@ public final class WriteBuildInfoHeaderAction extends AbstractFileWriteAction { final Map<String, String> values = new LinkedHashMap<>(); for (Artifact valueFile : getInputs()) { - values.putAll(WorkspaceStatusAction.parseValues(valueFile.getPath())); + values.putAll(WorkspaceStatusAction.parseValues(ctx.getInputPath(valueFile))); } final boolean redacted = Iterables.isEmpty(getInputs()); |