aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--toolsrc/include/vcpkg_Commands.h1
-rw-r--r--toolsrc/include/vcpkg_info.h2
-rw-r--r--toolsrc/src/commands_build.cpp2
-rw-r--r--toolsrc/src/commands_update.cpp2
-rw-r--r--toolsrc/src/commands_version.cpp27
-rw-r--r--toolsrc/src/vcpkg.cpp4
-rw-r--r--toolsrc/src/vcpkg_info.cpp24
7 files changed, 30 insertions, 32 deletions
diff --git a/toolsrc/include/vcpkg_Commands.h b/toolsrc/include/vcpkg_Commands.h
index 907190bfc..3c3ae03c6 100644
--- a/toolsrc/include/vcpkg_Commands.h
+++ b/toolsrc/include/vcpkg_Commands.h
@@ -121,6 +121,7 @@ namespace vcpkg::Commands
namespace Version
{
+ const std::string& version();
void perform_and_exit(const vcpkg_cmd_arguments& args);
}
diff --git a/toolsrc/include/vcpkg_info.h b/toolsrc/include/vcpkg_info.h
index 5380e0158..ebd87fd86 100644
--- a/toolsrc/include/vcpkg_info.h
+++ b/toolsrc/include/vcpkg_info.h
@@ -4,7 +4,5 @@
namespace vcpkg::Info
{
- const std::string& version();
-
const std::string& email();
}
diff --git a/toolsrc/src/commands_build.cpp b/toolsrc/src/commands_build.cpp
index eaba531cb..d01d40ef4 100644
--- a/toolsrc/src/commands_build.cpp
+++ b/toolsrc/src/commands_build.cpp
@@ -109,7 +109,7 @@ namespace vcpkg::Commands::Build
" Vcpkg version: %s\n"
"\n"
"Additionally, attach any relevant sections from the log files above."
- , spec.toString(), Info::version());
+ , spec.toString(), Version::version());
}
void perform_and_exit(const package_spec& spec, const fs::path& port_dir, const std::unordered_set<std::string>& options, const vcpkg_paths& paths)
diff --git a/toolsrc/src/commands_update.cpp b/toolsrc/src/commands_update.cpp
index 3aa7a499f..3ac6694b9 100644
--- a/toolsrc/src/commands_update.cpp
+++ b/toolsrc/src/commands_update.cpp
@@ -80,7 +80,7 @@ namespace vcpkg::Commands::Update
auto num1 = sscanf_s(version_contents->c_str(), "\"%d.%d.%d\"", &maj1, &min1, &rev1);
int maj2, min2, rev2;
- auto num2 = sscanf_s(Info::version().c_str(), "%d.%d.%d-", &maj2, &min2, &rev2);
+ auto num2 = sscanf_s(Version::version().c_str(), "%d.%d.%d-", &maj2, &min2, &rev2);
if (num1 == 3 && num2 == 3)
{
diff --git a/toolsrc/src/commands_version.cpp b/toolsrc/src/commands_version.cpp
index 3dd90e630..462c31c90 100644
--- a/toolsrc/src/commands_version.cpp
+++ b/toolsrc/src/commands_version.cpp
@@ -1,10 +1,33 @@
#include "pch.h"
#include "vcpkg_Commands.h"
#include "vcpkg_System.h"
-#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::Commands::Version
{
+ 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;
+ }
+
void perform_and_exit(const vcpkg_cmd_arguments& args)
{
args.check_exact_arg_count(0);
@@ -12,7 +35,7 @@ namespace vcpkg::Commands::Version
System::println("Vcpkg package management program version %s\n"
"\n"
- "See LICENSE.txt for license information.", Info::version()
+ "See LICENSE.txt for license information.", version()
);
exit(EXIT_SUCCESS);
}
diff --git a/toolsrc/src/vcpkg.cpp b/toolsrc/src/vcpkg.cpp
index 153109053..16c9cb077 100644
--- a/toolsrc/src/vcpkg.cpp
+++ b/toolsrc/src/vcpkg.cpp
@@ -192,7 +192,7 @@ int wmain(const int argc, const wchar_t* const* const argv)
Flush();
});
- TrackProperty("version", Info::version());
+ TrackProperty("version", Commands::Version::version());
const std::string trimmed_command_line = trim_path_from_command_line(Strings::utf16_to_utf8(GetCommandLineW()));
TrackProperty("cmdline", trimmed_command_line);
@@ -238,7 +238,7 @@ int wmain(const int argc, const wchar_t* const* const argv)
<< " " << Info::email() << "\n"
<< "containing a brief summary of what you were trying to do and the following data blob:\n"
<< "\n"
- << "Version=" << Info::version() << "\n"
+ << "Version=" << Commands::Version::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
index f8e214998..fa2077177 100644
--- a/toolsrc/src/vcpkg_info.cpp
+++ b/toolsrc/src/vcpkg_info.cpp
@@ -1,32 +1,8 @@
#include "pch.h"
#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::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)";