Change Info::version() to Version::version()
MODIFY
include/vcpkg_Commands.h
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);
}

MODIFY
include/vcpkg_info.h
include/vcpkg_info.h
namespace vcpkg::Info
{
- const std::string& version();
-
const std::string& email();
}

MODIFY
src/commands_build.cpp
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)

MODIFY
src/commands_update.cpp
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)
{

MODIFY
src/commands_version.cpp
src/commands_version.cpp
#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);
}

MODIFY
src/vcpkg.cpp
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)

MODIFY
src/vcpkg_info.cpp
src/vcpkg_info.cpp
#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)";

Change Info::version() to Version::version()