aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google/devtools/build/lib/runtime
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/runtime')
-rw-r--r--src/main/java/com/google/devtools/build/lib/runtime/BlazeCommandDispatcher.java5
-rw-r--r--src/main/java/com/google/devtools/build/lib/runtime/BlazeCommandUtils.java15
-rw-r--r--src/main/java/com/google/devtools/build/lib/runtime/BlazeRuntime.java18
-rw-r--r--src/main/java/com/google/devtools/build/lib/runtime/BugReport.java13
-rw-r--r--src/main/java/com/google/devtools/build/lib/runtime/commands/CleanCommand.java7
-rw-r--r--src/main/java/com/google/devtools/build/lib/runtime/commands/DumpCommand.java3
-rw-r--r--src/main/java/com/google/devtools/build/lib/runtime/commands/HelpCommand.java45
-rw-r--r--src/main/java/com/google/devtools/build/lib/runtime/commands/InfoCommand.java5
-rw-r--r--src/main/java/com/google/devtools/build/lib/runtime/commands/InfoItem.java5
-rw-r--r--src/main/java/com/google/devtools/build/lib/runtime/commands/QueryCommand.java3
-rw-r--r--src/main/java/com/google/devtools/build/lib/runtime/commands/RunCommand.java4
11 files changed, 67 insertions, 56 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/runtime/BlazeCommandDispatcher.java b/src/main/java/com/google/devtools/build/lib/runtime/BlazeCommandDispatcher.java
index 3e17b47a38..8094094e52 100644
--- a/src/main/java/com/google/devtools/build/lib/runtime/BlazeCommandDispatcher.java
+++ b/src/main/java/com/google/devtools/build/lib/runtime/BlazeCommandDispatcher.java
@@ -27,7 +27,6 @@ import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Iterables;
import com.google.common.collect.ListMultimap;
import com.google.common.io.Flushables;
-import com.google.devtools.build.lib.Constants;
import com.google.devtools.build.lib.events.Event;
import com.google.devtools.build.lib.events.EventHandler;
import com.google.devtools.build.lib.events.Reporter;
@@ -198,7 +197,7 @@ public class BlazeCommandDispatcher {
Path workspace = env.getWorkspace();
// TODO(kchodorow): Remove this once spaces are supported.
if (workspace.getPathString().contains(" ")) {
- outErr.printErrLn(Constants.PRODUCT_NAME + " does not currently work properly from paths "
+ outErr.printErrLn(runtime.getProductName() + " does not currently work properly from paths "
+ "containing spaces (" + workspace + ").");
return ExitCode.LOCAL_ENVIRONMENTAL_ERROR;
}
@@ -286,7 +285,7 @@ public class BlazeCommandDispatcher {
BlazeCommand command = runtime.getCommandMap().get(commandName);
if (command == null) {
outErr.printErrLn(String.format(
- "Command '%s' not found. Try '%s help'.", commandName, Constants.PRODUCT_NAME));
+ "Command '%s' not found. Try '%s help'.", commandName, runtime.getProductName()));
return ExitCode.COMMAND_LINE_ERROR.getNumericExitCode();
}
diff --git a/src/main/java/com/google/devtools/build/lib/runtime/BlazeCommandUtils.java b/src/main/java/com/google/devtools/build/lib/runtime/BlazeCommandUtils.java
index 3ba6e22ef9..f7bcd1d224 100644
--- a/src/main/java/com/google/devtools/build/lib/runtime/BlazeCommandUtils.java
+++ b/src/main/java/com/google/devtools/build/lib/runtime/BlazeCommandUtils.java
@@ -15,7 +15,6 @@ package com.google.devtools.build.lib.runtime;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.Iterables;
-import com.google.devtools.build.lib.Constants;
import com.google.devtools.build.lib.analysis.ConfiguredRuleClassProvider;
import com.google.devtools.build.lib.util.ResourceFileLoader;
import com.google.devtools.common.options.OptionsBase;
@@ -106,12 +105,14 @@ public class BlazeCommandUtils {
* descriptions, passed to {@link OptionsParser#describeOptions}.
* @param helpVerbosity a tri-state verbosity option selecting between just
* names, names and syntax, and full description.
+ * @param productName the product name
*/
public static final String expandHelpTopic(String topic, String help,
Class<? extends BlazeCommand> commandClass,
Collection<Class<? extends OptionsBase>> options,
Map<String, String> categoryDescriptions,
- OptionsParser.HelpVerbosity helpVerbosity) {
+ OptionsParser.HelpVerbosity helpVerbosity,
+ String productName) {
OptionsParser parser = OptionsParser.newOptionsParser(options);
String template;
@@ -134,9 +135,9 @@ public class BlazeCommandUtils {
String optionStr =
parser
.describeOptions(categoryDescriptions, helpVerbosity)
- .replace("%{product}", Constants.PRODUCT_NAME);
+ .replace("%{product}", productName);
return template
- .replace("%{product}", Constants.PRODUCT_NAME)
+ .replace("%{product}", productName)
.replace("%{command}", topic)
.replace("%{options}", optionStr)
.trim()
@@ -159,7 +160,8 @@ public class BlazeCommandUtils {
Map<String, String> categoryDescriptions,
OptionsParser.HelpVerbosity verbosity,
Iterable<BlazeModule> blazeModules,
- ConfiguredRuleClassProvider ruleClassProvider) {
+ ConfiguredRuleClassProvider ruleClassProvider,
+ String productName) {
Command commandAnnotation = commandClass.getAnnotation(Command.class);
return BlazeCommandUtils.expandHelpTopic(
commandAnnotation.name(),
@@ -167,6 +169,7 @@ public class BlazeCommandUtils {
commandClass,
BlazeCommandUtils.getOptions(commandClass, blazeModules, ruleClassProvider),
categoryDescriptions,
- verbosity);
+ verbosity,
+ productName);
}
}
diff --git a/src/main/java/com/google/devtools/build/lib/runtime/BlazeRuntime.java b/src/main/java/com/google/devtools/build/lib/runtime/BlazeRuntime.java
index c03192c3b7..1b9d821301 100644
--- a/src/main/java/com/google/devtools/build/lib/runtime/BlazeRuntime.java
+++ b/src/main/java/com/google/devtools/build/lib/runtime/BlazeRuntime.java
@@ -302,7 +302,8 @@ public final class BlazeRuntime {
preprocessorFactorySupplier,
skyFunctions.build(),
precomputedValues.build(),
- customDirtinessCheckers.build());
+ customDirtinessCheckers.build(),
+ getProductName());
this.workspace = new BlazeWorkspace(
this, directories, skyframeExecutor, eventBusExceptionHandler, workspaceStatusActionFactory,
binTools);
@@ -379,7 +380,7 @@ public final class BlazeRuntime {
}
if (profiledTasks != ProfiledTaskKinds.NONE) {
Profiler.instance().start(profiledTasks, out,
- Constants.PRODUCT_NAME + " profile for " + env.getOutputBase() + " at " + new Date()
+ getProductName() + " profile for " + env.getOutputBase() + " at " + new Date()
+ ", build ID: " + buildID,
recordFullProfilerData, clock, execStartTimeNanos);
return true;
@@ -1006,7 +1007,7 @@ public final class BlazeRuntime {
}
PathFragment outputPathFragment = BlazeDirectories.outputPathFromOutputBase(
- outputBase, workspaceDirectory, startupOptions.deepExecRoot);
+ outputBase, workspaceDirectory, startupOptions.deepExecRoot, Constants.PRODUCT_NAME);
FileSystem fs = null;
for (BlazeModule module : blazeModules) {
FileSystem moduleFs = module.getFileSystem(options, outputPathFragment);
@@ -1038,7 +1039,8 @@ public final class BlazeRuntime {
BlazeDirectories directories =
new BlazeDirectories(installBasePath, outputBasePath, workspaceDirectoryPath,
- startupOptions.deepExecRoot, startupOptions.installMD5);
+ startupOptions.deepExecRoot, startupOptions.installMD5,
+ Constants.PRODUCT_NAME);
Clock clock = BlazeClock.instance();
@@ -1152,6 +1154,10 @@ public final class BlazeRuntime {
new VersionCommand());
}
+ public String getProductName() {
+ return Constants.PRODUCT_NAME;
+ }
+
/**
* A builder for {@link BlazeRuntime} objects. The only required fields are the {@link
* BlazeDirectories}, and the {@link RuleClassProvider} (except for testing). All other fields
@@ -1298,8 +1304,8 @@ public final class BlazeRuntime {
* parameters.
*/
public Builder setDirectories(Path installBase, Path outputBase,
- Path workspace) {
- this.directories = new BlazeDirectories(installBase, outputBase, workspace);
+ Path workspace, String productName) {
+ this.directories = new BlazeDirectories(installBase, outputBase, workspace, productName);
return this;
}
diff --git a/src/main/java/com/google/devtools/build/lib/runtime/BugReport.java b/src/main/java/com/google/devtools/build/lib/runtime/BugReport.java
index a5d3e106f6..d81a8b7c00 100644
--- a/src/main/java/com/google/devtools/build/lib/runtime/BugReport.java
+++ b/src/main/java/com/google/devtools/build/lib/runtime/BugReport.java
@@ -15,7 +15,6 @@ package com.google.devtools.build.lib.runtime;
import com.google.common.base.Joiner;
import com.google.common.collect.ImmutableList;
-import com.google.devtools.build.lib.Constants;
import com.google.devtools.build.lib.analysis.BlazeVersionInfo;
import com.google.devtools.build.lib.util.ExitCode;
import com.google.devtools.build.lib.util.LoggingUtil;
@@ -72,7 +71,7 @@ public abstract class BugReport {
private static void logCrash(Throwable throwable, String... args) {
BugReport.sendBugReport(throwable, Arrays.asList(args));
BugReport.printBug(OutErr.SYSTEM_OUT_ERR, throwable);
- System.err.println(Constants.PRODUCT_NAME + " crash in async thread:");
+ System.err.println(runtime.getProductName() + " crash in async thread:");
throwable.printStackTrace();
}
@@ -106,9 +105,9 @@ public abstract class BugReport {
} catch (Throwable t) {
System.err.println(
"An crash occurred while "
- + Constants.PRODUCT_NAME
+ + runtime.getProductName()
+ " was trying to handle a crash! Please file a bug against "
- + Constants.PRODUCT_NAME
+ + runtime.getProductName()
+ " and include the information below.");
System.err.println("Original uncaught exception:");
@@ -132,7 +131,7 @@ public abstract class BugReport {
PrintStream err = new PrintStream(outErr.getErrorStream());
e.printStackTrace(err);
err.flush();
- LOG.log(Level.SEVERE, Constants.PRODUCT_NAME + " crashed", e);
+ LOG.log(Level.SEVERE, runtime.getProductName() + " crashed", e);
}
/**
@@ -144,7 +143,7 @@ public abstract class BugReport {
public static void printBug(OutErr outErr, Throwable e) {
if (e instanceof OutOfMemoryError) {
outErr.printErr(
- e.getMessage() + "\n\n" + Constants.PRODUCT_NAME + " ran out of memory and crashed.\n");
+ e.getMessage() + "\n\n" + runtime.getProductName() + " ran out of memory and crashed.\n");
} else {
printThrowableTo(outErr, e);
}
@@ -175,7 +174,7 @@ public abstract class BugReport {
private static void logException(Throwable exception, List<String> args, String... values) {
// The preamble is used in the crash watcher, so don't change it
// unless you know what you're doing.
- String preamble = Constants.PRODUCT_NAME
+ String preamble = runtime.getProductName()
+ (exception instanceof OutOfMemoryError ? " OOMError: " : " crashed with args: ");
LoggingUtil.logToRemote(Level.SEVERE, preamble + Joiner.on(' ').join(args), exception,
diff --git a/src/main/java/com/google/devtools/build/lib/runtime/commands/CleanCommand.java b/src/main/java/com/google/devtools/build/lib/runtime/commands/CleanCommand.java
index 1080c4594b..923f89473e 100644
--- a/src/main/java/com/google/devtools/build/lib/runtime/commands/CleanCommand.java
+++ b/src/main/java/com/google/devtools/build/lib/runtime/commands/CleanCommand.java
@@ -105,8 +105,8 @@ public final class CleanCommand implements BlazeCommand {
env.getReporter().handle(Event.info(null/*location*/, cleanBanner));
try {
- String symlinkPrefix =
- options.getOptions(BuildRequest.BuildRequestOptions.class).getSymlinkPrefix();
+ String symlinkPrefix = options.getOptions(BuildRequest.BuildRequestOptions.class)
+ .getSymlinkPrefix(env.getRuntime().getProductName());
actuallyClean(env, env.getOutputBase(), cleanOptions, symlinkPrefix);
return ExitCode.SUCCESS;
} catch (IOException e) {
@@ -174,7 +174,8 @@ public final class CleanCommand implements BlazeCommand {
}
// remove convenience links
OutputDirectoryLinksUtils.removeOutputDirectoryLinks(
- env.getWorkspaceName(), env.getWorkspace(), env.getReporter(), symlinkPrefix);
+ env.getWorkspaceName(), env.getWorkspace(), env.getReporter(), symlinkPrefix,
+ env.getRuntime().getProductName());
// shutdown on expunge cleans
if (cleanOptions.expunge || cleanOptions.expunge_async) {
throw new ShutdownBlazeServerException(0, ShutdownMethod.EXPUNGE);
diff --git a/src/main/java/com/google/devtools/build/lib/runtime/commands/DumpCommand.java b/src/main/java/com/google/devtools/build/lib/runtime/commands/DumpCommand.java
index b18714e695..03adf0570a 100644
--- a/src/main/java/com/google/devtools/build/lib/runtime/commands/DumpCommand.java
+++ b/src/main/java/com/google/devtools/build/lib/runtime/commands/DumpCommand.java
@@ -135,7 +135,8 @@ public class DumpCommand implements BlazeCommand {
getClass().getAnnotation(Command.class).name(),
getClass().getAnnotation(Command.class).help(),
getClass(),
- optionList, categories, OptionsParser.HelpVerbosity.LONG));
+ optionList, categories, OptionsParser.HelpVerbosity.LONG,
+ runtime.getProductName()));
return ExitCode.ANALYSIS_FAILURE;
}
PrintStream out = new PrintStream(env.getReporter().getOutErr().getOutputStream());
diff --git a/src/main/java/com/google/devtools/build/lib/runtime/commands/HelpCommand.java b/src/main/java/com/google/devtools/build/lib/runtime/commands/HelpCommand.java
index 08ef73eae8..8e11e08cde 100644
--- a/src/main/java/com/google/devtools/build/lib/runtime/commands/HelpCommand.java
+++ b/src/main/java/com/google/devtools/build/lib/runtime/commands/HelpCommand.java
@@ -17,7 +17,6 @@ import com.google.common.base.Joiner;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import com.google.devtools.build.docgen.BlazeRuleHelpPrinter;
-import com.google.devtools.build.lib.Constants;
import com.google.devtools.build.lib.analysis.BlazeVersionInfo;
import com.google.devtools.build.lib.analysis.ConfiguredRuleClassProvider;
import com.google.devtools.build.lib.analysis.NoBuildEvent;
@@ -88,7 +87,7 @@ public final class HelpCommand implements BlazeCommand {
*/
private ImmutableMap<String, String> getOptionCategories(BlazeRuntime runtime) {
ImmutableMap.Builder<String, String> optionCategoriesBuilder = ImmutableMap.builder();
- String name = Constants.PRODUCT_NAME;
+ String name = runtime.getProductName();
optionCategoriesBuilder
.put("checking", String.format(
"Checking options, which control %s's error checking and/or warnings", name))
@@ -141,7 +140,7 @@ public final class HelpCommand implements BlazeCommand {
OutErr outErr = env.getReporter().getOutErr();
Options helpOptions = options.getOptions(Options.class);
if (options.getResidue().isEmpty()) {
- emitBlazeVersionInfo(outErr);
+ emitBlazeVersionInfo(outErr, runtime.getProductName());
emitGenericHelp(runtime, outErr);
return ExitCode.SUCCESS;
}
@@ -151,12 +150,12 @@ public final class HelpCommand implements BlazeCommand {
}
String helpSubject = options.getResidue().get(0);
if (helpSubject.equals("startup_options")) {
- emitBlazeVersionInfo(outErr);
+ emitBlazeVersionInfo(outErr, runtime.getProductName());
emitStartupOptions(outErr, helpOptions.helpVerbosity, runtime, getOptionCategories(runtime));
return ExitCode.SUCCESS;
} else if (helpSubject.equals("target-syntax")) {
- emitBlazeVersionInfo(outErr);
- emitTargetSyntaxHelp(outErr, getOptionCategories(runtime));
+ emitBlazeVersionInfo(outErr, runtime.getProductName());
+ emitTargetSyntaxHelp(outErr, getOptionCategories(runtime), runtime.getProductName());
return ExitCode.SUCCESS;
} else if (helpSubject.equals("info-keys")) {
emitInfoKeysHelp(env, outErr);
@@ -180,19 +179,20 @@ public final class HelpCommand implements BlazeCommand {
return ExitCode.COMMAND_LINE_ERROR;
}
}
- emitBlazeVersionInfo(outErr);
+ emitBlazeVersionInfo(outErr, runtime.getProductName());
outErr.printOut(BlazeCommandUtils.getUsage(
command.getClass(),
getOptionCategories(runtime),
helpOptions.helpVerbosity,
runtime.getBlazeModules(),
- runtime.getRuleClassProvider()));
+ runtime.getRuleClassProvider(),
+ runtime.getProductName()));
return ExitCode.SUCCESS;
}
- private void emitBlazeVersionInfo(OutErr outErr) {
+ private void emitBlazeVersionInfo(OutErr outErr, String productName) {
String releaseInfo = BlazeVersionInfo.instance().getReleaseName();
- String line = String.format("[%s %s]", Constants.PRODUCT_NAME, releaseInfo);
+ String line = String.format("[%s %s]", productName, releaseInfo);
outErr.printOut(String.format("%80s\n", line));
}
@@ -205,7 +205,8 @@ public final class HelpCommand implements BlazeCommand {
getClass(),
BlazeCommandUtils.getStartupOptions(runtime.getBlazeModules()),
optionCategories,
- helpVerbosity));
+ helpVerbosity,
+ runtime.getProductName()));
}
private void emitCompletionHelp(BlazeRuntime runtime, OutErr outErr) {
@@ -218,7 +219,7 @@ public final class HelpCommand implements BlazeCommand {
outErr.printOutLn("BAZEL_COMMAND_LIST=\"" + SPACE_JOINER.join(commands) + "\"");
outErr.printOutLn("BAZEL_INFO_KEYS=\"");
- for (String name : InfoCommand.getHardwiredInfoItemNames(Constants.PRODUCT_NAME)) {
+ for (String name : InfoCommand.getHardwiredInfoItemNames(runtime.getProductName())) {
outErr.printOutLn(name);
}
outErr.printOutLn("\"");
@@ -244,13 +245,15 @@ public final class HelpCommand implements BlazeCommand {
}
}
- private void emitTargetSyntaxHelp(OutErr outErr, ImmutableMap<String, String> optionCategories) {
+ private void emitTargetSyntaxHelp(OutErr outErr, ImmutableMap<String, String> optionCategories,
+ String productName) {
outErr.printOut(BlazeCommandUtils.expandHelpTopic("target-syntax",
"resource:target-syntax.txt",
getClass(),
ImmutableList.<Class<? extends OptionsBase>>of(),
optionCategories,
- OptionsParser.HelpVerbosity.MEDIUM));
+ OptionsParser.HelpVerbosity.MEDIUM,
+ productName));
}
private void emitInfoKeysHelp(CommandEnvironment env, OutErr outErr) {
@@ -263,7 +266,7 @@ public final class HelpCommand implements BlazeCommand {
private void emitGenericHelp(BlazeRuntime runtime, OutErr outErr) {
outErr.printOut(String.format("Usage: %s <command> <options> ...\n\n",
- Constants.PRODUCT_NAME));
+ runtime.getProductName()));
outErr.printOut("Available commands:\n");
@@ -279,20 +282,20 @@ public final class HelpCommand implements BlazeCommand {
}
String shortDescription = annotation.shortDescription().
- replace("%{product}", Constants.PRODUCT_NAME);
+ replace("%{product}", runtime.getProductName());
outErr.printOut(String.format(" %-19s %s\n", name, shortDescription));
}
outErr.printOut("\n");
outErr.printOut("Getting more help:\n");
- outErr.printOut(String.format(" %s help <command>\n", Constants.PRODUCT_NAME));
+ outErr.printOut(String.format(" %s help <command>\n", runtime.getProductName()));
outErr.printOut(" Prints help and options for <command>.\n");
- outErr.printOut(String.format(" %s help startup_options\n", Constants.PRODUCT_NAME));
+ outErr.printOut(String.format(" %s help startup_options\n", runtime.getProductName()));
outErr.printOut(String.format(" Options for the JVM hosting %s.\n",
- Constants.PRODUCT_NAME));
- outErr.printOut(String.format(" %s help target-syntax\n", Constants.PRODUCT_NAME));
+ runtime.getProductName()));
+ outErr.printOut(String.format(" %s help target-syntax\n", runtime.getProductName()));
outErr.printOut(" Explains the syntax for specifying targets.\n");
- outErr.printOut(String.format(" %s help info-keys\n", Constants.PRODUCT_NAME));
+ outErr.printOut(String.format(" %s help info-keys\n", runtime.getProductName()));
outErr.printOut(" Displays a list of keys used by the info command.\n");
}
}
diff --git a/src/main/java/com/google/devtools/build/lib/runtime/commands/InfoCommand.java b/src/main/java/com/google/devtools/build/lib/runtime/commands/InfoCommand.java
index a2badf3c31..7ba1e2daaf 100644
--- a/src/main/java/com/google/devtools/build/lib/runtime/commands/InfoCommand.java
+++ b/src/main/java/com/google/devtools/build/lib/runtime/commands/InfoCommand.java
@@ -17,7 +17,6 @@ import com.google.common.base.Supplier;
import com.google.common.base.Verify;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
-import com.google.devtools.build.lib.Constants;
import com.google.devtools.build.lib.analysis.NoBuildEvent;
import com.google.devtools.build.lib.analysis.config.BuildConfiguration;
import com.google.devtools.build.lib.analysis.config.InvalidConfigurationException;
@@ -198,7 +197,7 @@ public class InfoCommand implements BlazeCommand {
List<InfoItem> hardwiredInfoItems = ImmutableList.<InfoItem>of(
new InfoItem.WorkspaceInfoItem(),
new InfoItem.InstallBaseInfoItem(),
- new InfoItem.OutputBaseInfoItem(),
+ new InfoItem.OutputBaseInfoItem(productName),
new InfoItem.ExecutionRootInfoItem(),
new InfoItem.OutputPathInfoItem(),
new InfoItem.BlazeBinInfoItem(productName),
@@ -242,7 +241,7 @@ public class InfoCommand implements BlazeCommand {
result.put(item.getName(), item);
}
}
- result.putAll(getHardwiredInfoItemMap(commandOptions, Constants.PRODUCT_NAME));
+ result.putAll(getHardwiredInfoItemMap(commandOptions, env.getRuntime().getProductName()));
return result;
}
}
diff --git a/src/main/java/com/google/devtools/build/lib/runtime/commands/InfoItem.java b/src/main/java/com/google/devtools/build/lib/runtime/commands/InfoItem.java
index 923f29ce0c..8237317cfb 100644
--- a/src/main/java/com/google/devtools/build/lib/runtime/commands/InfoItem.java
+++ b/src/main/java/com/google/devtools/build/lib/runtime/commands/InfoItem.java
@@ -20,7 +20,6 @@ import com.google.common.base.Predicate;
import com.google.common.base.Predicates;
import com.google.common.base.Supplier;
import com.google.common.collect.Iterables;
-import com.google.devtools.build.lib.Constants;
import com.google.devtools.build.lib.analysis.BlazeVersionInfo;
import com.google.devtools.build.lib.analysis.config.BuildConfiguration;
import com.google.devtools.build.lib.packages.Attribute;
@@ -149,9 +148,9 @@ public abstract class InfoItem {
* Info item for the output_base directory.
*/
public static final class OutputBaseInfoItem extends InfoItem {
- public OutputBaseInfoItem() {
+ public OutputBaseInfoItem(String productName) {
super("output_base",
- "A directory for shared " + Constants.PRODUCT_NAME
+ "A directory for shared " + productName
+ " state as well as tool and strategy specific subdirectories.",
false);
}
diff --git a/src/main/java/com/google/devtools/build/lib/runtime/commands/QueryCommand.java b/src/main/java/com/google/devtools/build/lib/runtime/commands/QueryCommand.java
index cf857fd810..9af780e5eb 100644
--- a/src/main/java/com/google/devtools/build/lib/runtime/commands/QueryCommand.java
+++ b/src/main/java/com/google/devtools/build/lib/runtime/commands/QueryCommand.java
@@ -19,7 +19,6 @@ import com.google.common.annotations.VisibleForTesting;
import com.google.common.base.Joiner;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.Iterables;
-import com.google.devtools.build.lib.Constants;
import com.google.devtools.build.lib.analysis.NoBuildEvent;
import com.google.devtools.build.lib.collect.CompactHashSet;
import com.google.devtools.build.lib.events.Event;
@@ -118,7 +117,7 @@ public final class QueryCommand implements BlazeCommand {
} else {
env.getReporter().handle(Event.error(String.format(
"missing query expression. Type '%s help query' for syntax and help",
- Constants.PRODUCT_NAME)));
+ runtime.getProductName())));
return ExitCode.COMMAND_LINE_ERROR;
}
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 be47fc1a7d..729bace0ef 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
@@ -233,6 +233,7 @@ public class RunCommand implements BlazeCommand {
}
}
+ String productName = env.getRuntime().getProductName();
//
// We now have a unique executable ready to be run.
//
@@ -242,7 +243,8 @@ public class RunCommand implements BlazeCommand {
PathFragment prettyExecutablePath =
OutputDirectoryLinksUtils.getPrettyPath(executablePath,
env.getWorkspaceName(), env.getWorkspace(),
- options.getOptions(BuildRequestOptions.class).getSymlinkPrefix());
+ options.getOptions(BuildRequestOptions.class).getSymlinkPrefix(productName),
+ productName);
List<String> cmdLine = new ArrayList<>();
if (runOptions.scriptPath == null) {
PathFragment processWrapperPath =