diff options
author | mstaib <mstaib@google.com> | 2018-06-12 14:14:35 -0700 |
---|---|---|
committer | Copybara-Service <copybara-piper@google.com> | 2018-06-12 14:16:19 -0700 |
commit | dba36c8bec353943fa91d60b5819642deaa53ead (patch) | |
tree | 0e939e1fb7d38f6db8b2fe445da3e85b55e903d7 /src/main/java/com/google/devtools/build/lib/runtime/commands | |
parent | 048405374ad2dd3e0b5deedeb4fdee897fa9ad88 (diff) |
Add --print_workspace_in_output_paths_if_needed flag.
When this flag is turned on, and the user's working directory is beneath the
workspace (but is not the workspace itself), the workspace's absolute path is
printed as a prefix to the convenience symlink.
With this flag off, the displayed convenience symlink path is always relative
to the user's workspace, even if that isn't the current working directory.
(This is the current behavior.)
The new (flag-on) behavior will become default soon, and then this flag will
be removed.
RELNOTES: None.
PiperOrigin-RevId: 200278355
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/runtime/commands')
-rw-r--r-- | src/main/java/com/google/devtools/build/lib/runtime/commands/RunCommand.java | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/runtime/commands/RunCommand.java b/src/main/java/com/google/devtools/build/lib/runtime/commands/RunCommand.java index 25fd5f2432..7acf1c7304 100644 --- a/src/main/java/com/google/devtools/build/lib/runtime/commands/RunCommand.java +++ b/src/main/java/com/google/devtools/build/lib/runtime/commands/RunCommand.java @@ -186,13 +186,19 @@ public class RunCommand implements BlazeCommand { String productName = env.getRuntime().getProductName(); Artifact executable = targetToRun.getProvider(FilesToRunProvider.class).getExecutable(); + BuildRequestOptions requestOptions = env.getOptions().getOptions(BuildRequestOptions.class); + PathFragment executablePath = executable.getPath().asFragment(); - PathFragment prettyExecutablePath = OutputDirectoryLinksUtils.getPrettyPath( - executable.getPath(), - env.getWorkspaceName(), - env.getWorkspace(), - env.getOptions().getOptions(BuildRequestOptions.class).getSymlinkPrefix(productName), - productName); + PathFragment prettyExecutablePath = + OutputDirectoryLinksUtils.getPrettyPath( + executable.getPath(), + env.getWorkspaceName(), + env.getWorkspace(), + requestOptions.printWorkspaceInOutputPathsIfNeeded + ? env.getWorkingDirectory() + : env.getWorkspace(), + requestOptions.getSymlinkPrefix(productName), + productName); RunUnder runUnder = env.getOptions().getOptions(BuildConfiguration.Options.class).runUnder; // Insert the command prefix specified by the "--run_under=<command-prefix>" option |