aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google/devtools/build/lib/runtime
diff options
context:
space:
mode:
authorGravatar Shmuel H <shmuelhazan0@gmail.com>2018-04-11 04:02:34 -0700
committerGravatar Copybara-Service <copybara-piper@google.com>2018-04-11 04:04:25 -0700
commit8a2cd73e1dc6284ba2580f0d1f4c7276e8c1de1b (patch)
tree8fdd8177cdc3b04c81ef7b8046da41cf26281965 /src/main/java/com/google/devtools/build/lib/runtime
parent92dd54be26f1dfa6c472ff0df2562f33db801b01 (diff)
analyze-profile: prevent bazel from crashing outside a workspace
This commit closes #3256. Closes #4971. PiperOrigin-RevId: 192429422
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/runtime')
-rw-r--r--src/main/java/com/google/devtools/build/lib/runtime/commands/ProfileCommand.java7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/runtime/commands/ProfileCommand.java b/src/main/java/com/google/devtools/build/lib/runtime/commands/ProfileCommand.java
index f39f0054b3..6756788755 100644
--- a/src/main/java/com/google/devtools/build/lib/runtime/commands/ProfileCommand.java
+++ b/src/main/java/com/google/devtools/build/lib/runtime/commands/ProfileCommand.java
@@ -281,11 +281,16 @@ public final class ProfileCommand implements BlazeCommand {
PhaseSummaryStatistics phaseSummaryStatistics = new PhaseSummaryStatistics(info);
EnumMap<ProfilePhase, PhaseStatistics> phaseStatistics =
new EnumMap<>(ProfilePhase.class);
+
+ Path workspace = env.getWorkspace();
for (ProfilePhase phase : ProfilePhase.values()) {
phaseStatistics.put(
phase,
new PhaseStatistics(
- phase, info, env.getWorkspace().getBaseName(), opts.vfsStatsLimit > 0));
+ phase,
+ info,
+ (workspace == null ? "<workspace>" : workspace.getBaseName()),
+ opts.vfsStatsLimit > 0));
}
CriticalPathStatistics critPathStats = new CriticalPathStatistics(info);