aboutsummaryrefslogtreecommitdiff
path: root/toolsrc/src
diff options
context:
space:
mode:
authorAlexander Karatarakis <alkarata@microsoft.com>2016-11-07 17:31:41 -0800
committerAlexander Karatarakis <alkarata@microsoft.com>2016-11-07 17:31:41 -0800
commitc91d8e41b60653b652b11c641f7a5b3d3eab7f6b (patch)
tree6e81f76a7f1067bab8efdbb38e7b25338499f87f /toolsrc/src
parent7a1bc07142577cce32ee88c8d8ef60b386d19b6a (diff)
downloadvcpkg-c91d8e41b60653b652b11c641f7a5b3d3eab7f6b.tar.gz
vcpkg-c91d8e41b60653b652b11c641f7a5b3d3eab7f6b.zip
Introduce vcpkg_info.h/cpp
Diffstat (limited to 'toolsrc/src')
-rw-r--r--toolsrc/src/commands_help.cpp6
-rw-r--r--toolsrc/src/commands_installation.cpp3
-rw-r--r--toolsrc/src/commands_update.cpp3
-rw-r--r--toolsrc/src/main.cpp7
-rw-r--r--toolsrc/src/vcpkg_info.cpp34
-rw-r--r--toolsrc/src/vcpkg_version.cpp25
6 files changed, 45 insertions, 33 deletions
diff --git a/toolsrc/src/commands_help.cpp b/toolsrc/src/commands_help.cpp
index 194e809b1..fd02d948e 100644
--- a/toolsrc/src/commands_help.cpp
+++ b/toolsrc/src/commands_help.cpp
@@ -1,6 +1,6 @@
#include "vcpkg_Commands.h"
-#include "vcpkg.h"
#include "vcpkg_System.h"
+#include "vcpkg_info.h"
namespace vcpkg
{
@@ -9,7 +9,7 @@ namespace vcpkg
args.check_exact_arg_count(0);
System::println("Vcpkg package management program version %s\n"
"\n"
- "See LICENSE.txt for license information.", vcpkg::version()
+ "See LICENSE.txt for license information.", Info::version()
);
exit(EXIT_SUCCESS);
}
@@ -39,7 +39,7 @@ namespace vcpkg
void contact_command(const vcpkg_cmd_arguments& args)
{
args.check_exact_arg_count(0);
- System::println("Send an email to vcpkg@microsoft.com with any feedback.");
+ System::println("Send an email to %s with any feedback.", Info::email());
exit(EXIT_SUCCESS);
}
diff --git a/toolsrc/src/commands_installation.cpp b/toolsrc/src/commands_installation.cpp
index 3f40ba023..460fa1818 100644
--- a/toolsrc/src/commands_installation.cpp
+++ b/toolsrc/src/commands_installation.cpp
@@ -10,6 +10,7 @@
#include "vcpkg_Input.h"
#include "vcpkg_Maps.h"
#include "Paragraphs.h"
+#include "vcpkg_info.h"
namespace vcpkg
{
@@ -50,7 +51,7 @@ namespace vcpkg
" Vcpkg version: %s\n"
"\n"
"Additionally, attach any relevant sections from the log files above."
- , to_string(spec), version());
+ , to_string(spec), Info::version());
TrackProperty("error", "build failed");
TrackProperty("build_error", to_string(spec));
exit(EXIT_FAILURE);
diff --git a/toolsrc/src/commands_update.cpp b/toolsrc/src/commands_update.cpp
index b448091f7..2d7444392 100644
--- a/toolsrc/src/commands_update.cpp
+++ b/toolsrc/src/commands_update.cpp
@@ -3,6 +3,7 @@
#include "vcpkg_System.h"
#include "vcpkg_Files.h"
#include "Paragraphs.h"
+#include "vcpkg_info.h"
namespace vcpkg
{
@@ -77,7 +78,7 @@ namespace vcpkg
auto num1 = sscanf_s(version_contents->c_str(), "\"%d.%d.%d\"", &maj1, &min1, &rev1);
int maj2, min2, rev2;
- auto num2 = sscanf_s(version().c_str(), "%d.%d.%d-", &maj2, &min2, &rev2);
+ auto num2 = sscanf_s(Info::version().c_str(), "%d.%d.%d-", &maj2, &min2, &rev2);
if (num1 == 3 && num2 == 3)
{
diff --git a/toolsrc/src/main.cpp b/toolsrc/src/main.cpp
index 22c45e5ab..70527ca1d 100644
--- a/toolsrc/src/main.cpp
+++ b/toolsrc/src/main.cpp
@@ -13,6 +13,7 @@
#include "vcpkg_System.h"
#include "vcpkg_Input.h"
#include "Paragraphs.h"
+#include "vcpkg_info.h"
using namespace vcpkg;
@@ -192,7 +193,7 @@ int wmain(const int argc, const wchar_t* const* const argv)
Flush();
});
- TrackProperty("version", version());
+ TrackProperty("version", Info::version());
const std::string trimmed_command_line = trim_path_from_command_line(Strings::utf16_to_utf8(GetCommandLineW()));
TrackProperty("cmdline", trimmed_command_line);
@@ -234,10 +235,10 @@ int wmain(const int argc, const wchar_t* const* const argv)
std::cerr
<< "vcpkg.exe has crashed.\n"
<< "Please send an email to:\n"
- << " vcpkg@microsoft.com\n"
+ << " " << Info::email() << "\n"
<< "containing a brief summary of what you were trying to do and the following data blob:\n"
<< "\n"
- << "Version=" << version() << "\n"
+ << "Version=" << Info::version() << "\n"
<< "EXCEPTION='" << exc_msg << "'\n"
<< "CMD=\n";
for (int x = 0; x < argc; ++x)
diff --git a/toolsrc/src/vcpkg_info.cpp b/toolsrc/src/vcpkg_info.cpp
new file mode 100644
index 000000000..25c09d6da
--- /dev/null
+++ b/toolsrc/src/vcpkg_info.cpp
@@ -0,0 +1,34 @@
+#include "vcpkg_info.h"
+#include "metrics.h"
+
+#define STRINGIFY(X) #X
+#define MACRO_TO_STRING(X) STRINGIFY(X)
+
+#define VCPKG_VERSION_AS_STRING MACRO_TO_STRING(VCPKG_VERSION)"" // Double quotes needed at the end to prevent blank token
+
+namespace vcpkg { namespace Info
+{
+ const std::string& version()
+ {
+ static const std::string s_version =
+#include "../VERSION.txt"
+
+
+#pragma warning( push )
+#pragma warning( disable : 4003)
+ // VCPKG_VERSION can be defined but have no value, which yields C4003.
+ + std::string(VCPKG_VERSION_AS_STRING)
+#pragma warning( pop )
+#ifndef NDEBUG
+ + std::string("-debug")
+#endif
+ + std::string(GetCompiledMetricsEnabled() ? "" : "-external");
+ return s_version;
+ }
+
+ const std::string& email()
+ {
+ static const std::string s_email = R"(vcpkg@microsoft.com)";
+ return s_email;
+ }
+}}
diff --git a/toolsrc/src/vcpkg_version.cpp b/toolsrc/src/vcpkg_version.cpp
deleted file mode 100644
index da52b7cab..000000000
--- a/toolsrc/src/vcpkg_version.cpp
+++ /dev/null
@@ -1,25 +0,0 @@
-#include "vcpkg.h"
-#include "metrics.h"
-
-#define STRINGIFY(X) #X
-#define MACRO_TO_STRING(X) STRINGIFY(X)
-
-#define VCPKG_VERSION_AS_STRING MACRO_TO_STRING(VCPKG_VERSION)"" // Double quotes needed at the end to prevent blank token
-
-const std::string& vcpkg::version()
-{
- static const std::string s_version =
-#include "../VERSION.txt"
-
-
-#pragma warning( push )
-#pragma warning( disable : 4003)
- // VCPKG_VERSION can be defined but have no value, which yields C4003.
- + std::string(VCPKG_VERSION_AS_STRING)
-#pragma warning( pop )
-#ifndef NDEBUG
- + std::string("-debug")
-#endif
- + std::string(GetCompiledMetricsEnabled() ? "" : "-external");
- return s_version;
-}