aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/cpp/startup_options.cc
diff options
context:
space:
mode:
authorGravatar Julio Merino <jmmv@google.com>2016-09-09 15:11:48 +0000
committerGravatar Dmitry Lomov <dslomov@google.com>2016-09-12 08:54:34 +0000
commitdfb2c73eda3d2dd8787ea9b2d0a03b49dfa2acc5 (patch)
treed656e66ff561371151b05032f64dce8851a99f95 /src/main/cpp/startup_options.cc
parentf8e18b7b1cbb82a7dd9569041e08596a56b91109 (diff)
Inject the product name via the per-product main.cc files.
Instead of using a compile-time PRODUCT_NAME constant and complex Build rules to set the correct product name for Blaze and Bazel, use the new main.cc files to inject the appropriate value. -- MOS_MIGRATED_REVID=132675327
Diffstat (limited to 'src/main/cpp/startup_options.cc')
-rw-r--r--src/main/cpp/startup_options.cc13
1 files changed, 3 insertions, 10 deletions
diff --git a/src/main/cpp/startup_options.cc b/src/main/cpp/startup_options.cc
index 156cda916d..d88fa52a6b 100644
--- a/src/main/cpp/startup_options.cc
+++ b/src/main/cpp/startup_options.cc
@@ -28,15 +28,12 @@
#include "src/main/cpp/util/numbers.h"
#include "src/main/cpp/util/strings.h"
-#ifndef PRODUCT_NAME
-#define PRODUCT_NAME "Bazel"
-#endif
-
namespace blaze {
using std::vector;
-StartupOptions::StartupOptions() {
+StartupOptions::StartupOptions(const string& product_name) :
+ product_name(product_name) {
Init();
}
@@ -52,11 +49,7 @@ void StartupOptions::Init() {
output_root = GetOutputRoot();
}
- // TODO(jmmv): Now that we have per-product main.cc files, inject the
- // product_name at construction time instead of using preprocessor
- // definitions.
- product_name = PRODUCT_NAME;
- string product_name_lower = PRODUCT_NAME;
+ string product_name_lower = product_name;
blaze_util::ToLower(&product_name_lower);
output_user_root = blaze_util::JoinPath(
output_root, "_" + product_name_lower + "_" + GetUserName());