aboutsummaryrefslogtreecommitdiff
path: root/toolsrc/src
diff options
context:
space:
mode:
authorAlexander Neumann <30894796+Neumann-A@users.noreply.github.com>2019-08-19 21:40:43 +0200
committerGitHub <noreply@github.com>2019-08-19 21:40:43 +0200
commit70f4aabbe8bf5273e11a03f804d4361354cf0a11 (patch)
treec2d553869f70b8fce7b2539bcaa8ffb8bb8aa0cc /toolsrc/src
parent173642528e2cf7a3f18b41d903b5ff5a758d34ae (diff)
parent8e7ce6d91a060bba5f9e252a5d9aad92f5bd4a56 (diff)
downloadvcpkg-70f4aabbe8bf5273e11a03f804d4361354cf0a11.tar.gz
vcpkg-70f4aabbe8bf5273e11a03f804d4361354cf0a11.zip
Merge branch 'master' into path_separator
Diffstat (limited to 'toolsrc/src')
-rw-r--r--toolsrc/src/vcpkg-test/arguments.cpp2
-rw-r--r--toolsrc/src/vcpkg-test/catch.cpp2
-rw-r--r--toolsrc/src/vcpkg-test/chrono.cpp2
-rw-r--r--toolsrc/src/vcpkg-test/dependencies.cpp2
-rw-r--r--toolsrc/src/vcpkg-test/files.cpp4
-rw-r--r--toolsrc/src/vcpkg-test/paragraph.cpp2
-rw-r--r--toolsrc/src/vcpkg-test/plan.cpp2
-rw-r--r--toolsrc/src/vcpkg-test/specifier.cpp4
-rw-r--r--toolsrc/src/vcpkg-test/statusparagraphs.cpp2
-rw-r--r--toolsrc/src/vcpkg-test/strings.cpp2
-rw-r--r--toolsrc/src/vcpkg-test/supports.cpp2
-rw-r--r--toolsrc/src/vcpkg-test/update.cpp2
-rw-r--r--toolsrc/src/vcpkg-test/util.cpp7
-rw-r--r--toolsrc/src/vcpkg.cpp4
-rw-r--r--toolsrc/src/vcpkg/base/checks.cpp3
-rw-r--r--toolsrc/src/vcpkg/base/hash.cpp2
-rw-r--r--toolsrc/src/vcpkg/base/system.cpp8
-rw-r--r--toolsrc/src/vcpkg/base/system.print.cpp4
-rw-r--r--toolsrc/src/vcpkg/build.cpp186
-rw-r--r--toolsrc/src/vcpkg/commands.autocomplete.cpp4
-rw-r--r--toolsrc/src/vcpkg/commands.cpp2
-rw-r--r--toolsrc/src/vcpkg/commands.dependinfo.cpp428
-rw-r--r--toolsrc/src/vcpkg/commands.edit.cpp4
-rw-r--r--toolsrc/src/vcpkg/commands.exportifw.cpp564
-rw-r--r--toolsrc/src/vcpkg/commands.xvsinstances.cpp1
-rw-r--r--toolsrc/src/vcpkg/dependencies.cpp78
-rw-r--r--toolsrc/src/vcpkg/export.cpp9
-rw-r--r--toolsrc/src/vcpkg/install.cpp8
-rw-r--r--toolsrc/src/vcpkg/logicexpression.cpp28
-rw-r--r--toolsrc/src/vcpkg/metrics.cpp4
-rw-r--r--toolsrc/src/vcpkg/paragraphs.cpp2
-rw-r--r--toolsrc/src/vcpkg/postbuildlint.cpp4
-rw-r--r--toolsrc/src/vcpkg/sourceparagraph.cpp2
-rw-r--r--toolsrc/src/vcpkg/statusparagraphs.cpp5
-rw-r--r--toolsrc/src/vcpkg/tools.cpp6
-rw-r--r--toolsrc/src/vcpkg/vcpkgpaths.cpp4
-rw-r--r--toolsrc/src/vcpkg/versiont.cpp1
37 files changed, 766 insertions, 630 deletions
diff --git a/toolsrc/src/vcpkg-test/arguments.cpp b/toolsrc/src/vcpkg-test/arguments.cpp
index 3fe5fa420..326b07579 100644
--- a/toolsrc/src/vcpkg-test/arguments.cpp
+++ b/toolsrc/src/vcpkg-test/arguments.cpp
@@ -1,4 +1,4 @@
-#include <vcpkg-test/catch.h>
+#include <catch2/catch.hpp>
#include <vcpkg/vcpkgcmdarguments.h>
diff --git a/toolsrc/src/vcpkg-test/catch.cpp b/toolsrc/src/vcpkg-test/catch.cpp
index 8b5d1aa15..50331c644 100644
--- a/toolsrc/src/vcpkg-test/catch.cpp
+++ b/toolsrc/src/vcpkg-test/catch.cpp
@@ -1,5 +1,5 @@
#define CATCH_CONFIG_RUNNER
-#include <vcpkg-test/catch.h>
+#include <catch2/catch.hpp>
#include <vcpkg/base/system.debug.h>
diff --git a/toolsrc/src/vcpkg-test/chrono.cpp b/toolsrc/src/vcpkg-test/chrono.cpp
index 306217ad0..fb8a0dee9 100644
--- a/toolsrc/src/vcpkg-test/chrono.cpp
+++ b/toolsrc/src/vcpkg-test/chrono.cpp
@@ -1,4 +1,4 @@
-#include <vcpkg-test/catch.h>
+#include <catch2/catch.hpp>
#include <vcpkg/base/chrono.h>
diff --git a/toolsrc/src/vcpkg-test/dependencies.cpp b/toolsrc/src/vcpkg-test/dependencies.cpp
index 5ed05cc07..2344bb990 100644
--- a/toolsrc/src/vcpkg-test/dependencies.cpp
+++ b/toolsrc/src/vcpkg-test/dependencies.cpp
@@ -1,4 +1,4 @@
-#include <vcpkg-test/catch.h>
+#include <catch2/catch.hpp>
#include <vcpkg/sourceparagraph.h>
diff --git a/toolsrc/src/vcpkg-test/files.cpp b/toolsrc/src/vcpkg-test/files.cpp
index d40edb3bd..d8bc5ba74 100644
--- a/toolsrc/src/vcpkg-test/files.cpp
+++ b/toolsrc/src/vcpkg-test/files.cpp
@@ -1,4 +1,4 @@
-#include <vcpkg-test/catch.h>
+#include <catch2/catch.hpp>
#include <vcpkg-test/util.h>
#include <vcpkg/base/files.h>
@@ -107,7 +107,7 @@ namespace
CHECK_EC_ON_FILE(base, ec);
}
- for (int i = 0; i < width; ++i)
+ for (std::uint64_t i = 0; i < width; ++i)
{
create_directory_tree(urbg,
fs,
diff --git a/toolsrc/src/vcpkg-test/paragraph.cpp b/toolsrc/src/vcpkg-test/paragraph.cpp
index a95879cfa..85c37851d 100644
--- a/toolsrc/src/vcpkg-test/paragraph.cpp
+++ b/toolsrc/src/vcpkg-test/paragraph.cpp
@@ -1,4 +1,4 @@
-#include <vcpkg-test/catch.h>
+#include <catch2/catch.hpp>
#include <vcpkg-test/util.h>
#include <vcpkg/base/strings.h>
diff --git a/toolsrc/src/vcpkg-test/plan.cpp b/toolsrc/src/vcpkg-test/plan.cpp
index 049ef2066..e354b7551 100644
--- a/toolsrc/src/vcpkg-test/plan.cpp
+++ b/toolsrc/src/vcpkg-test/plan.cpp
@@ -1,4 +1,4 @@
-#include <vcpkg-test/catch.h>
+#include <catch2/catch.hpp>
#include <vcpkg-test/util.h>
#include <vcpkg/dependencies.h>
diff --git a/toolsrc/src/vcpkg-test/specifier.cpp b/toolsrc/src/vcpkg-test/specifier.cpp
index 330a96d78..33df8ba83 100644
--- a/toolsrc/src/vcpkg-test/specifier.cpp
+++ b/toolsrc/src/vcpkg-test/specifier.cpp
@@ -1,4 +1,4 @@
-#include <vcpkg-test/catch.h>
+#include <catch2/catch.hpp>
#include <vcpkg/base/util.h>
#include <vcpkg/packagespec.h>
@@ -131,4 +131,4 @@ TEST_CASE ("specifier parsing", "[specifier]")
REQUIRE(str == L"abc -x86-windows");
}
#endif
-};
+}
diff --git a/toolsrc/src/vcpkg-test/statusparagraphs.cpp b/toolsrc/src/vcpkg-test/statusparagraphs.cpp
index c0833e8ba..88b499118 100644
--- a/toolsrc/src/vcpkg-test/statusparagraphs.cpp
+++ b/toolsrc/src/vcpkg-test/statusparagraphs.cpp
@@ -1,4 +1,4 @@
-#include <vcpkg-test/catch.h>
+#include <catch2/catch.hpp>
#include <vcpkg-test/util.h>
#include <vcpkg/base/util.h>
diff --git a/toolsrc/src/vcpkg-test/strings.cpp b/toolsrc/src/vcpkg-test/strings.cpp
index 6b744eee6..d58d1b172 100644
--- a/toolsrc/src/vcpkg-test/strings.cpp
+++ b/toolsrc/src/vcpkg-test/strings.cpp
@@ -1,4 +1,4 @@
-#include <vcpkg-test/catch.h>
+#include <catch2/catch.hpp>
#include <vcpkg/base/strings.h>
diff --git a/toolsrc/src/vcpkg-test/supports.cpp b/toolsrc/src/vcpkg-test/supports.cpp
index 8bd386da0..f4d8dc65a 100644
--- a/toolsrc/src/vcpkg-test/supports.cpp
+++ b/toolsrc/src/vcpkg-test/supports.cpp
@@ -1,4 +1,4 @@
-#include <vcpkg-test/catch.h>
+#include <catch2/catch.hpp>
#include <vcpkg/sourceparagraph.h>
diff --git a/toolsrc/src/vcpkg-test/update.cpp b/toolsrc/src/vcpkg-test/update.cpp
index 70b2f04c1..6f1a87d23 100644
--- a/toolsrc/src/vcpkg-test/update.cpp
+++ b/toolsrc/src/vcpkg-test/update.cpp
@@ -1,4 +1,4 @@
-#include <vcpkg-test/catch.h>
+#include <catch2/catch.hpp>
#include <vcpkg-test/util.h>
#include <vcpkg/base/sortedvector.h>
diff --git a/toolsrc/src/vcpkg-test/util.cpp b/toolsrc/src/vcpkg-test/util.cpp
index a2343c21b..daa21567d 100644
--- a/toolsrc/src/vcpkg-test/util.cpp
+++ b/toolsrc/src/vcpkg-test/util.cpp
@@ -1,8 +1,9 @@
-#include <vcpkg-test/catch.h>
+#include <catch2/catch.hpp>
#include <vcpkg-test/util.h>
#include <vcpkg/base/checks.h>
#include <vcpkg/base/files.h>
+#include <vcpkg/base/util.h>
#include <vcpkg/statusparagraph.h>
// used to get the implementation specific compiler flags (i.e., __cpp_lib_filesystem)
@@ -153,7 +154,7 @@ namespace vcpkg::Test
ec.assign(errno, std::system_category());
}
#else
- static_cast<void>(ec);
+ Util::unused(target, file, ec);
vcpkg::Checks::exit_with_message(VCPKG_LINE_INFO, no_filesystem_message);
#endif
}
@@ -175,7 +176,7 @@ namespace vcpkg::Test
#elif FILESYSTEM_SYMLINK == FILESYSTEM_SYMLINK_UNIX
::vcpkg::Test::create_symlink(target, file, ec);
#else
- static_cast<void>(ec);
+ Util::unused(target, file, ec);
vcpkg::Checks::exit_with_message(VCPKG_LINE_INFO, no_filesystem_message);
#endif
}
diff --git a/toolsrc/src/vcpkg.cpp b/toolsrc/src/vcpkg.cpp
index 3fdbd0d3e..9cd0ddf19 100644
--- a/toolsrc/src/vcpkg.cpp
+++ b/toolsrc/src/vcpkg.cpp
@@ -53,7 +53,7 @@ static constexpr int SURVEY_INTERVAL_IN_HOURS = 24 * 30 * 6;
// Initial survey appears after 10 days. Therefore, subtract 24 hours/day * 10 days
static constexpr int SURVEY_INITIAL_OFFSET_IN_HOURS = SURVEY_INTERVAL_IN_HOURS - 24 * 10;
-void invalid_command(const std::string& cmd)
+static void invalid_command(const std::string& cmd)
{
System::print2(System::Color::error, "invalid command: ", cmd, '\n');
Help::print_usage();
@@ -285,6 +285,8 @@ static std::string trim_path_from_command_line(const std::string& full_command_l
#endif
#if defined(_WIN32)
+// note: this prevents a false positive for -Wmissing-prototypes on clang-cl
+int wmain(int, const wchar_t* const*);
int wmain(const int argc, const wchar_t* const* const argv)
#else
int main(const int argc, const char* const* const argv)
diff --git a/toolsrc/src/vcpkg/base/checks.cpp b/toolsrc/src/vcpkg/base/checks.cpp
index 0266ad683..c7584258a 100644
--- a/toolsrc/src/vcpkg/base/checks.cpp
+++ b/toolsrc/src/vcpkg/base/checks.cpp
@@ -27,9 +27,8 @@ namespace vcpkg
#if defined(_WIN32)
::TerminateProcess(::GetCurrentProcess(), exit_code);
-#else
- std::exit(exit_code);
#endif
+ std::exit(exit_code);
}
void Checks::unreachable(const LineInfo& line_info)
diff --git a/toolsrc/src/vcpkg/base/hash.cpp b/toolsrc/src/vcpkg/base/hash.cpp
index e9a7fa2ef..62a01ed17 100644
--- a/toolsrc/src/vcpkg/base/hash.cpp
+++ b/toolsrc/src/vcpkg/base/hash.cpp
@@ -1,5 +1,7 @@
#include "pch.h"
+#include <vcpkg/base/hash.h>
+
#include <vcpkg/base/checks.h>
#include <vcpkg/base/strings.h>
#include <vcpkg/base/system.process.h>
diff --git a/toolsrc/src/vcpkg/base/system.cpp b/toolsrc/src/vcpkg/base/system.cpp
index 3d5c60088..d9c6349be 100644
--- a/toolsrc/src/vcpkg/base/system.cpp
+++ b/toolsrc/src/vcpkg/base/system.cpp
@@ -5,6 +5,7 @@
#include <vcpkg/base/system.debug.h>
#include <vcpkg/base/system.h>
#include <vcpkg/base/system.process.h>
+#include <vcpkg/base/util.h>
#include <ctime>
@@ -381,6 +382,8 @@ namespace vcpkg
"CreateProcessW() returned ", exit_code, " after ", static_cast<int>(timer.microseconds()), " us\n");
return static_cast<int>(exit_code);
#else
+ // TODO: this should create a clean environment on Linux/macOS
+ Util::unused(extra_env, prepend_to_path);
Debug::print("system(", cmd_line, ")\n");
fflush(nullptr);
int rc = system(cmd_line.c_str());
@@ -549,10 +552,7 @@ namespace vcpkg
return Strings::to_utf8(ret);
}
#else
- Optional<std::string> System::get_registry_string(void* base_hkey, StringView sub_key, StringView valuename)
- {
- return nullopt;
- }
+ Optional<std::string> System::get_registry_string(void*, StringView, StringView) { return nullopt; }
#endif
static const Optional<fs::path>& get_program_files()
diff --git a/toolsrc/src/vcpkg/base/system.print.cpp b/toolsrc/src/vcpkg/base/system.print.cpp
index c7c9981a7..fc8e4184c 100644
--- a/toolsrc/src/vcpkg/base/system.print.cpp
+++ b/toolsrc/src/vcpkg/base/system.print.cpp
@@ -1,6 +1,7 @@
#include "pch.h"
#include <vcpkg/base/system.print.h>
+#include <vcpkg/base/util.h>
namespace vcpkg::System
{
@@ -21,6 +22,9 @@ namespace vcpkg::System
System::print2(message);
SetConsoleTextAttribute(console_handle, original_color);
#else
+ // TODO: add color handling code
+ // it should probably use VT-220 codes
+ Util::unused(c);
System::print2(message);
#endif
}
diff --git a/toolsrc/src/vcpkg/build.cpp b/toolsrc/src/vcpkg/build.cpp
index b809db0bc..2114b7415 100644
--- a/toolsrc/src/vcpkg/build.cpp
+++ b/toolsrc/src/vcpkg/build.cpp
@@ -9,6 +9,7 @@
#include <vcpkg/base/system.debug.h>
#include <vcpkg/base/system.print.h>
#include <vcpkg/base/system.process.h>
+#include <vcpkg/base/util.h>
#include <vcpkg/build.h>
#include <vcpkg/commands.h>
@@ -183,7 +184,7 @@ namespace vcpkg::Build
static const std::string LIBRARY_LINKAGE = "LibraryLinkage";
}
- CStringView to_vcvarsall_target(const std::string& cmake_system_name)
+ static CStringView to_vcvarsall_target(const std::string& cmake_system_name)
{
if (cmake_system_name.empty()) return "";
if (cmake_system_name == "Windows") return "";
@@ -192,7 +193,7 @@ namespace vcpkg::Build
Checks::exit_with_message(VCPKG_LINE_INFO, "Unsupported vcvarsall target %s", cmake_system_name);
}
- CStringView to_vcvarsall_toolchain(const std::string& target_architecture, const Toolset& toolset)
+ static CStringView to_vcvarsall_toolchain(const std::string& target_architecture, const Toolset& toolset)
{
auto maybe_target_arch = System::to_cpu_architecture(target_architecture);
Checks::check_exit(
@@ -216,7 +217,7 @@ namespace vcpkg::Build
}));
}
- std::unordered_map<std::string, std::string> make_env_passthrough(const PreBuildInfo& pre_build_info)
+ static auto make_env_passthrough(const PreBuildInfo& pre_build_info) -> std::unordered_map<std::string, std::string>
{
std::unordered_map<std::string, std::string> env;
@@ -273,6 +274,7 @@ namespace vcpkg::Build
{
bpgh.version = *p_ver;
}
+
bcf->core_paragraph = std::move(bpgh);
return bcf;
}
@@ -549,7 +551,8 @@ namespace vcpkg::Build
const size_t error_count =
PostBuildLint::perform_all_checks(spec, paths, pre_build_info, build_info, config.port_dir);
- auto bcf = create_binary_control_file(*config.scf.core_paragraph, triplet, build_info, abi_tag);
+ std::unique_ptr<BinaryControlFile> bcf =
+ create_binary_control_file(*config.scf.core_paragraph, triplet, build_info, abi_tag);
if (error_count != 0)
{
@@ -601,18 +604,15 @@ namespace vcpkg::Build
const PreBuildInfo& pre_build_info,
Span<const AbiEntry> dependency_abis)
{
- if (config.build_package_options.binary_caching == BinaryCaching::NO) return nullopt;
-
auto& fs = paths.get_filesystem();
const Triplet& triplet = config.triplet;
const std::string& name = config.scf.core_paragraph->name;
std::vector<AbiEntry> abi_tag_entries(dependency_abis.begin(), dependency_abis.end());
-#if defined(_WIN32)
- abi_tag_entries.emplace_back(AbiEntry{"powershell", paths.get_tool_version("powershell-core")});
-#endif
- abi_tag_entries.emplace_back(AbiEntry{"cmake", paths.get_tool_version(Tools::CMAKE)});
+ // Sorted here as the order of dependency_abis is the only
+ // non-deterministicly ordered set of AbiEntries
+ Util::sort(abi_tag_entries);
// If there is an unusually large number of files in the port then
// something suspicious is going on. Rather than hash all of them
@@ -620,13 +620,15 @@ namespace vcpkg::Build
const int max_port_file_count = 100;
// the order of recursive_directory_iterator is undefined so save the names to sort
- std::vector<fs::path> port_files;
+ std::vector<std::pair<std::string, std::string>> hashes_files;
for (auto& port_file : fs::stdfs::recursive_directory_iterator(config.port_dir))
{
if (fs::is_regular_file(fs.status(VCPKG_LINE_INFO, port_file)))
{
- port_files.push_back(port_file);
- if (port_files.size() > max_port_file_count)
+ hashes_files.emplace_back(vcpkg::Hash::get_file_hash(fs, port_file, "SHA1"),
+ port_file.path().filename().u8string());
+
+ if (hashes_files.size() > max_port_file_count)
{
abi_tag_entries.emplace_back(AbiEntry{"no_hash_max_portfile", ""});
break;
@@ -634,25 +636,24 @@ namespace vcpkg::Build
}
}
- if (port_files.size() <= max_port_file_count)
+ if (hashes_files.size() <= max_port_file_count)
{
- std::sort(port_files.begin(), port_files.end());
+ Util::sort(hashes_files);
- int counter = 0;
- for (auto& port_file : port_files)
+ for (auto& hash_file : hashes_files)
{
- // When vcpkg takes a dependency on C++17 it can use fs::relative,
- // which will give a stable ordering and better names in the key entry.
- // this is not available in the filesystem TS so instead number the files for the key.
- std::string key = Strings::format("file_%03d", counter++);
- if (Debug::g_debugging)
- {
- System::print2("[DEBUG] mapping ", key, " from ", port_file.u8string(), "\n");
- }
- abi_tag_entries.emplace_back(AbiEntry{key, vcpkg::Hash::get_file_hash(fs, port_file, "SHA1")});
+ // We've already sorted by hash so it's safe to write down the
+ // filename, which will be consistent across machines.
+ abi_tag_entries.emplace_back(AbiEntry{std::move(hash_file.second), std::move(hash_file.first)});
}
}
+ abi_tag_entries.emplace_back(AbiEntry{"cmake", paths.get_tool_version(Tools::CMAKE)});
+
+#if defined(_WIN32)
+ abi_tag_entries.emplace_back(AbiEntry{"powershell", paths.get_tool_version("powershell-core")});
+#endif
+
abi_tag_entries.emplace_back(AbiEntry{
"vcpkg_fixup_cmake_targets",
vcpkg::Hash::get_file_hash(fs, paths.scripts / "cmake" / "vcpkg_fixup_cmake_targets.cmake", "SHA1")});
@@ -662,11 +663,16 @@ namespace vcpkg::Build
const std::string features = Strings::join(";", config.feature_list);
abi_tag_entries.emplace_back(AbiEntry{"features", features});
+ if (pre_build_info.public_abi_override)
+ {
+ abi_tag_entries.emplace_back(AbiEntry{
+ "public_abi_override",
+ Hash::get_string_hash(pre_build_info.public_abi_override.value_or_exit(VCPKG_LINE_INFO), "SHA1")});
+ }
+
if (config.build_package_options.use_head_version == UseHeadVersion::YES)
abi_tag_entries.emplace_back(AbiEntry{"head", ""});
- Util::sort(abi_tag_entries);
-
const std::string full_abi_info =
Strings::join("", abi_tag_entries, [](const AbiEntry& p) { return p.key + " " + p.value + "\n"; });
@@ -694,7 +700,7 @@ namespace vcpkg::Build
}
System::print2(
- "Warning: binary caching disabled because abi keys are missing values:\n",
+ "Warning: abi keys are missing values:\n",
Strings::join("", abi_tag_entries_missing, [](const AbiEntry& e) { return " " + e.key + "\n"; }),
"\n");
@@ -792,17 +798,24 @@ namespace vcpkg::Build
const auto pre_build_info = PreBuildInfo::from_triplet_file(paths, triplet, config.scfl);
auto maybe_abi_tag_and_file = compute_abi_tag(paths, config, pre_build_info, dependency_abis);
+ if (!maybe_abi_tag_and_file)
+ {
+ return do_build_package_and_clean_buildtrees(
+ paths, pre_build_info, spec, pre_build_info.public_abi_override.value_or(AbiTagAndFile{}.tag), config);
+ }
+ std::error_code ec;
const auto abi_tag_and_file = maybe_abi_tag_and_file.get();
-
- if (config.build_package_options.binary_caching == BinaryCaching::YES && abi_tag_and_file)
+ const fs::path archives_root_dir = paths.root / "archives";
+ const std::string archive_name = abi_tag_and_file->tag + ".zip";
+ const fs::path archive_subpath = fs::u8path(abi_tag_and_file->tag.substr(0, 2)) / archive_name;
+ const fs::path archive_path = archives_root_dir / archive_subpath;
+ const fs::path archive_tombstone_path = archives_root_dir / "fail" / archive_subpath;
+ const fs::path abi_package_dir = paths.package_dir(spec) / "share" / spec.name();
+ const fs::path abi_file_in_package = paths.package_dir(spec) / "share" / spec.name() / "vcpkg_abi_info.txt";
+
+ if (config.build_package_options.binary_caching == BinaryCaching::YES)
{
- const fs::path archives_root_dir = paths.root / "archives";
- const std::string archive_name = abi_tag_and_file->tag + ".zip";
- const fs::path archive_subpath = fs::u8path(abi_tag_and_file->tag.substr(0, 2)) / archive_name;
- const fs::path archive_path = archives_root_dir / archive_subpath;
- const fs::path archive_tombstone_path = archives_root_dir / "fail" / archive_subpath;
-
if (fs.exists(archive_path))
{
System::print2("Using cached binary package: ", archive_path.u8string(), "\n");
@@ -835,70 +848,67 @@ namespace vcpkg::Build
}
System::printf("Could not locate cached archive: %s\n", archive_path.u8string());
+ }
- ExtendedBuildResult result = do_build_package_and_clean_buildtrees(
- paths, pre_build_info, spec, maybe_abi_tag_and_file.value_or(AbiTagAndFile{}).tag, config);
+ fs.create_directories(abi_package_dir, ec);
+ Checks::check_exit(VCPKG_LINE_INFO, !ec, "Coud not create directory %s", abi_package_dir.u8string());
+ fs.copy_file(abi_tag_and_file->tag_file, abi_file_in_package, fs::stdfs::copy_options::none, ec);
+ Checks::check_exit(VCPKG_LINE_INFO, !ec, "Could not copy into file: %s", abi_file_in_package.u8string());
- std::error_code ec;
- fs.create_directories(paths.package_dir(spec) / "share" / spec.name(), ec);
- auto abi_file_in_package = paths.package_dir(spec) / "share" / spec.name() / "vcpkg_abi_info.txt";
- fs.copy_file(abi_tag_and_file->tag_file, abi_file_in_package, fs::stdfs::copy_options::none, ec);
- Checks::check_exit(VCPKG_LINE_INFO, !ec, "Could not copy into file: %s", abi_file_in_package.u8string());
+ ExtendedBuildResult result = do_build_package_and_clean_buildtrees(
+ paths, pre_build_info, spec, pre_build_info.public_abi_override.value_or(abi_tag_and_file->tag), config);
- if (result.code == BuildResult::SUCCEEDED)
- {
- const auto tmp_archive_path = paths.buildtrees / spec.name() / (spec.triplet().to_string() + ".zip");
+ if (config.build_package_options.binary_caching == BinaryCaching::YES && result.code == BuildResult::SUCCEEDED)
+ {
+ const auto tmp_archive_path = paths.buildtrees / spec.name() / (spec.triplet().to_string() + ".zip");
- compress_archive(paths, spec, tmp_archive_path);
+ compress_archive(paths, spec, tmp_archive_path);
- fs.create_directories(archive_path.parent_path(), ec);
- fs.rename_or_copy(tmp_archive_path, archive_path, ".tmp", ec);
- if (ec)
- {
- System::printf(System::Color::warning,
- "Failed to store binary cache %s: %s\n",
- archive_path.u8string(),
- ec.message());
- }
- else
- System::printf("Stored binary cache: %s\n", archive_path.u8string());
+ fs.create_directories(archive_path.parent_path(), ec);
+ fs.rename_or_copy(tmp_archive_path, archive_path, ".tmp", ec);
+ if (ec)
+ {
+ System::printf(System::Color::warning,
+ "Failed to store binary cache %s: %s\n",
+ archive_path.u8string(),
+ ec.message());
}
- else if (result.code == BuildResult::BUILD_FAILED || result.code == BuildResult::POST_BUILD_CHECKS_FAILED)
+ else
+ System::printf("Stored binary cache: %s\n", archive_path.u8string());
+ }
+ else if (config.build_package_options.binary_caching == BinaryCaching::YES &&
+ (result.code == BuildResult::BUILD_FAILED || result.code == BuildResult::POST_BUILD_CHECKS_FAILED))
+ {
+ if (!fs.exists(archive_tombstone_path))
{
- if (!fs.exists(archive_tombstone_path))
- {
- // Build failed, store all failure logs in the tombstone.
- const auto tmp_log_path = paths.buildtrees / spec.name() / "tmp_failure_logs";
- const auto tmp_log_path_destination = tmp_log_path / spec.name();
- const auto tmp_failure_zip = paths.buildtrees / spec.name() / "failure_logs.zip";
- fs.create_directories(tmp_log_path_destination, ec);
+ // Build failed, store all failure logs in the tombstone.
+ const auto tmp_log_path = paths.buildtrees / spec.name() / "tmp_failure_logs";
+ const auto tmp_log_path_destination = tmp_log_path / spec.name();
+ const auto tmp_failure_zip = paths.buildtrees / spec.name() / "failure_logs.zip";
+ fs.create_directories(tmp_log_path_destination, ec);
- for (auto& log_file : fs::stdfs::directory_iterator(paths.buildtrees / spec.name()))
+ for (auto& log_file : fs::stdfs::directory_iterator(paths.buildtrees / spec.name()))
+ {
+ if (log_file.path().extension() == ".log")
{
- if (log_file.path().extension() == ".log")
- {
- fs.copy_file(log_file.path(),
- tmp_log_path_destination / log_file.path().filename(),
- fs::stdfs::copy_options::none,
- ec);
- }
+ fs.copy_file(log_file.path(),
+ tmp_log_path_destination / log_file.path().filename(),
+ fs::stdfs::copy_options::none,
+ ec);
}
+ }
- compress_directory(paths, tmp_log_path, paths.buildtrees / spec.name() / "failure_logs.zip");
+ compress_directory(paths, tmp_log_path, paths.buildtrees / spec.name() / "failure_logs.zip");
- fs.create_directories(archive_tombstone_path.parent_path(), ec);
- fs.rename_or_copy(tmp_failure_zip, archive_tombstone_path, ".tmp", ec);
+ fs.create_directories(archive_tombstone_path.parent_path(), ec);
+ fs.rename_or_copy(tmp_failure_zip, archive_tombstone_path, ".tmp", ec);
- // clean up temporary directory
- fs.remove_all(tmp_log_path, VCPKG_LINE_INFO);
- }
+ // clean up temporary directory
+ fs.remove_all(tmp_log_path, VCPKG_LINE_INFO);
}
-
- return result;
}
- return do_build_package_and_clean_buildtrees(
- paths, pre_build_info, spec, maybe_abi_tag_and_file.value_or(AbiTagAndFile{}).tag, config);
+ return result;
}
const std::string& to_string(const BuildResult build_result)
@@ -1030,6 +1040,8 @@ namespace vcpkg::Build
PreBuildInfo pre_build_info;
+ pre_build_info.port = port;
+
const auto e = lines.cend();
auto cur = std::find(lines.cbegin(), e, FLAG_GUID);
if (cur != e) ++cur;
@@ -1086,6 +1098,10 @@ namespace vcpkg::Build
case VcpkgTripletVar::ENV_PASSTHROUGH:
pre_build_info.passthrough_env_vars = Strings::split(variable_value, ";");
break;
+ case VcpkgTripletVar::PUBLIC_ABI_OVERRIDE:
+ pre_build_info.public_abi_override =
+ variable_value.empty() ? nullopt : Optional<std::string>{variable_value};
+ break;
}
}
else
diff --git a/toolsrc/src/vcpkg/commands.autocomplete.cpp b/toolsrc/src/vcpkg/commands.autocomplete.cpp
index 3cf4dd98f..8449b7096 100644
--- a/toolsrc/src/vcpkg/commands.autocomplete.cpp
+++ b/toolsrc/src/vcpkg/commands.autocomplete.cpp
@@ -19,8 +19,8 @@ namespace vcpkg::Commands::Autocomplete
Checks::exit_success(line_info);
}
- std::vector<std::string> combine_port_with_triplets(const std::string& port,
- const std::vector<std::string>& triplets)
+ static std::vector<std::string> combine_port_with_triplets(const std::string& port,
+ const std::vector<std::string>& triplets)
{
return Util::fmap(triplets,
[&](const std::string& triplet) { return Strings::format("%s:%s", port, triplet); });
diff --git a/toolsrc/src/vcpkg/commands.cpp b/toolsrc/src/vcpkg/commands.cpp
index 54e9346ba..3ac568979 100644
--- a/toolsrc/src/vcpkg/commands.cpp
+++ b/toolsrc/src/vcpkg/commands.cpp
@@ -24,6 +24,7 @@ namespace vcpkg::Commands
{"env", &Env::perform_and_exit},
{"build-external", &BuildExternal::perform_and_exit},
{"export", &Export::perform_and_exit},
+ {"depend-info", &DependInfo::perform_and_exit},
};
return t;
}
@@ -38,7 +39,6 @@ namespace vcpkg::Commands
{"integrate", &Integrate::perform_and_exit},
{"owns", &Owns::perform_and_exit},
{"update", &Update::perform_and_exit},
- {"depend-info", &DependInfo::perform_and_exit},
{"edit", &Edit::perform_and_exit},
{"create", &Create::perform_and_exit},
{"import", &Import::perform_and_exit},
diff --git a/toolsrc/src/vcpkg/commands.dependinfo.cpp b/toolsrc/src/vcpkg/commands.dependinfo.cpp
index 7c04a5a2f..faf207980 100644
--- a/toolsrc/src/vcpkg/commands.dependinfo.cpp
+++ b/toolsrc/src/vcpkg/commands.dependinfo.cpp
@@ -4,248 +4,326 @@
#include <vcpkg/base/system.print.h>
#include <vcpkg/base/util.h>
#include <vcpkg/commands.h>
+#include <vcpkg/dependencies.h>
#include <vcpkg/help.h>
+#include <vcpkg/input.h>
+#include <vcpkg/install.h>
#include <vcpkg/packagespec.h>
-#include <vcpkg/paragraphs.h>
-
-#include <memory>
-#include <vcpkg/dependencies.h>
#include <vector>
+using vcpkg::Dependencies::AnyAction;
+using vcpkg::Dependencies::create_feature_install_plan;
+using vcpkg::Dependencies::InstallPlanAction;
using vcpkg::Dependencies::PathsPortFileProvider;
namespace vcpkg::Commands::DependInfo
{
- constexpr StringLiteral OPTION_DOT = "--dot";
- constexpr StringLiteral OPTION_DGML = "--dgml";
- constexpr StringLiteral OPTION_NO_RECURSE = "--no-recurse";
-
- constexpr std::array<CommandSwitch, 3> DEPEND_SWITCHES = {{
- {OPTION_DOT, "Creates graph on basis of dot"},
- {OPTION_DGML, "Creates graph on basis of dgml"},
- {OPTION_NO_RECURSE,
- "Computes only immediate dependencies of packages explicitly specified on the command-line"},
- }};
-
- const CommandStructure COMMAND_STRUCTURE = {
- Help::create_example_string(R"###(depend-info [pat])###"),
- 0,
- SIZE_MAX,
- {DEPEND_SWITCHES, {}},
- nullptr,
- };
-
- std::string replace_dashes_with_underscore(const std::string& input)
+ namespace
{
- std::string output = input;
- std::replace(output.begin(), output.end(), '-', '_');
- return output;
- }
-
- std::string create_dot_as_string(const std::vector<const SourceControlFile*>& source_control_files)
- {
- int empty_node_count = 0;
+ constexpr StringLiteral OPTION_DOT = "--dot";
+ constexpr StringLiteral OPTION_DGML = "--dgml";
+ constexpr StringLiteral OPTION_SHOW_DEPTH = "--show-depth";
+ constexpr StringLiteral OPTION_MAX_RECURSE = "--max-recurse";
+ constexpr StringLiteral OPTION_SORT = "--sort";
+
+ constexpr int NO_RECURSE_LIMIT_VALUE = -1;
+
+ constexpr std::array<CommandSwitch, 3> DEPEND_SWITCHES = {
+ {{OPTION_DOT, "Creates graph on basis of dot"},
+ {OPTION_DGML, "Creates graph on basis of dgml"},
+ {OPTION_SHOW_DEPTH, "Show recursion depth in output"}}};
+
+ constexpr std::array<CommandSetting, 2> DEPEND_SETTINGS = {
+ {{OPTION_MAX_RECURSE, "Set max recursion depth, a value of -1 indicates no limit"},
+ {OPTION_SORT,
+ "Set sort order for the list of dependencies, accepted values are: lexicographical, topological "
+ "(default), "
+ "reverse"}}};
+
+ struct PackageDependInfo
+ {
+ std::string package;
+ int depth;
+ std::set<std::string> features;
+ std::vector<std::string> dependencies;
+ };
- std::string s;
- s.append("digraph G{ rankdir=LR; edge [minlen=3]; overlap=false;");
+ enum SortMode
+ {
+ Lexicographical = 0,
+ Topological,
+ ReverseTopological,
+ Default = Topological
+ };
- for (const auto& source_control_file : source_control_files)
+ int get_max_depth(const ParsedArguments& options)
{
- const SourceParagraph& source_paragraph = *source_control_file->core_paragraph;
- if (source_paragraph.depends.empty())
+ auto iter = options.settings.find(OPTION_MAX_RECURSE);
+ if (iter != options.settings.end())
{
- empty_node_count++;
- continue;
+ std::string value = iter->second;
+ try
+ {
+ return std::stoi(value);
+ }
+ catch (std::exception&)
+ {
+ Checks::exit_with_message(VCPKG_LINE_INFO, "Value of --max-depth must be an integer");
+ }
}
+ // No --max-depth set, default to no limit.
+ return NO_RECURSE_LIMIT_VALUE;
+ }
+
+ SortMode get_sort_mode(const ParsedArguments& options)
+ {
+ constexpr StringLiteral OPTION_SORT_LEXICOGRAPHICAL = "lexicographical";
+ constexpr StringLiteral OPTION_SORT_TOPOLOGICAL = "topological";
+ constexpr StringLiteral OPTION_SORT_REVERSE = "reverse";
+
+ static const std::map<std::string, SortMode> sortModesMap{{OPTION_SORT_LEXICOGRAPHICAL, Lexicographical},
+ {OPTION_SORT_TOPOLOGICAL, Topological},
+ {OPTION_SORT_REVERSE, ReverseTopological}};
- const std::string name = replace_dashes_with_underscore(source_paragraph.name);
- s.append(Strings::format("%s;", name));
- for (const Dependency& d : source_paragraph.depends)
+ auto iter = options.settings.find(OPTION_SORT);
+ if (iter != options.settings.end())
{
- const std::string dependency_name = replace_dashes_with_underscore(d.depend.name);
- s.append(Strings::format("%s -> %s;", name, dependency_name));
+ const std::string value = Strings::ascii_to_lowercase(std::string{iter->second});
+ auto it = sortModesMap.find(value);
+ if (it != sortModesMap.end())
+ {
+ return it->second;
+ }
+ Checks::exit_with_message(VCPKG_LINE_INFO,
+ "Value of --sort must be one of `%s`, `%s`, or `%s`",
+ OPTION_SORT_LEXICOGRAPHICAL,
+ OPTION_SORT_TOPOLOGICAL,
+ OPTION_SORT_REVERSE);
}
+ return Default;
}
- s.append(Strings::format("empty [label=\"%d singletons...\"]; }", empty_node_count));
- return s;
- }
-
- std::string create_dgml_as_string(const std::vector<const SourceControlFile*>& source_control_files)
- {
- std::string s;
- s.append("<?xml version=\"1.0\" encoding=\"utf-8\"?>");
- s.append("<DirectedGraph xmlns=\"http://schemas.microsoft.com/vs/2009/dgml\">");
-
- std::string nodes, links;
- for (const auto& source_control_file : source_control_files)
+ std::string create_dot_as_string(const std::vector<PackageDependInfo>& depend_info)
{
- const SourceParagraph& source_paragraph = *source_control_file->core_paragraph;
- const std::string name = source_paragraph.name;
- nodes.append(Strings::format("<Node Id=\"%s\" />", name));
+ int empty_node_count = 0;
- // Iterate over dependencies.
- for (const Dependency& d : source_paragraph.depends)
- {
- if (d.qualifier.empty())
- links.append(Strings::format("<Link Source=\"%s\" Target=\"%s\" />", name, d.depend.name));
- else
- links.append(Strings::format(
- "<Link Source=\"%s\" Target=\"%s\" StrokeDashArray=\"4\" />", name, d.depend.name));
- }
+ std::string s;
+ s.append("digraph G{ rankdir=LR; edge [minlen=3]; overlap=false;");
- // Iterate over feature dependencies.
- const std::vector<std::unique_ptr<FeatureParagraph>>& feature_paragraphs =
- source_control_file->feature_paragraphs;
- for (const auto& feature_paragraph : feature_paragraphs)
+ for (const auto& package : depend_info)
{
- for (const Dependency& d : feature_paragraph->depends)
+ if (package.dependencies.empty())
+ {
+ empty_node_count++;
+ continue;
+ }
+
+ const std::string name = Strings::replace_all(std::string{package.package}, "-", "_");
+ s.append(Strings::format("%s;", name));
+ for (const auto& d : package.dependencies)
{
- links.append(Strings::format(
- "<Link Source=\"%s\" Target=\"%s\" StrokeDashArray=\"4\" />", name, d.depend.name));
+ const std::string dependency_name = Strings::replace_all(std::string{d}, "-", "_");
+ s.append(Strings::format("%s -> %s;", name, dependency_name));
}
}
+
+ s.append(Strings::format("empty [label=\"%d singletons...\"]; }", empty_node_count));
+ return s;
}
- s.append(Strings::format("<Nodes>%s</Nodes>", nodes));
+ std::string create_dgml_as_string(const std::vector<PackageDependInfo>& depend_info)
+ {
+ std::string s;
+ s.append("<?xml version=\"1.0\" encoding=\"utf-8\"?>");
+ s.append("<DirectedGraph xmlns=\"http://schemas.microsoft.com/vs/2009/dgml\">");
+
+ std::string nodes, links;
+ for (const auto& package : depend_info)
+ {
+ const std::string name = package.package;
+ nodes.append(Strings::format("<Node Id=\"%s\" />", name));
- s.append(Strings::format("<Links>%s</Links>", links));
+ // Iterate over dependencies.
+ for (const auto& d : package.dependencies)
+ {
+ links.append(Strings::format("<Link Source=\"%s\" Target=\"%s\" />", name, d));
+ }
+ }
- s.append("</DirectedGraph>");
- return s;
- }
+ s.append(Strings::format("<Nodes>%s</Nodes>", nodes));
- std::string create_graph_as_string(const std::unordered_set<std::string>& switches,
- const std::vector<const SourceControlFile*>& source_control_files)
- {
- if (Util::Sets::contains(switches, OPTION_DOT))
- {
- return create_dot_as_string(source_control_files);
- }
- else if (Util::Sets::contains(switches, OPTION_DGML))
- {
- return create_dgml_as_string(source_control_files);
+ s.append(Strings::format("<Links>%s</Links>", links));
+
+ s.append("</DirectedGraph>");
+ return s;
}
- return "";
- }
- void build_dependencies_list(std::set<std::string>& packages_to_keep,
- const std::string& requested_package,
- const std::vector<const SourceControlFile*>& source_control_files,
- const std::unordered_set<std::string>& switches)
- {
- auto maybe_requested_spec = ParsedSpecifier::from_string(requested_package);
- // TODO: move this check to the top-level invocation of this function since
- // argument `requested_package` shall always be valid in inner-level invocation.
- if (!maybe_requested_spec.has_value())
+ std::string create_graph_as_string(const std::unordered_set<std::string>& switches,
+ const std::vector<PackageDependInfo>& depend_info)
{
- System::print2(System::Color::warning,
- "'",
- requested_package,
- "' is not a valid package specifier: ",
- vcpkg::to_string(maybe_requested_spec.error()),
- "\n");
- return;
+ if (Util::Sets::contains(switches, OPTION_DOT))
+ {
+ return create_dot_as_string(depend_info);
+ }
+ else if (Util::Sets::contains(switches, OPTION_DGML))
+ {
+ return create_dgml_as_string(depend_info);
+ }
+ return "";
}
- auto requested_spec = maybe_requested_spec.get();
-
- const auto source_control_file =
- Util::find_if(source_control_files, [&requested_spec](const auto& source_control_file) {
- return source_control_file->core_paragraph->name == requested_spec->name;
- });
- if (source_control_file != source_control_files.end())
+ void assign_depth_to_dependencies(const std::string& package,
+ const int depth,
+ const int max_depth,
+ std::map<std::string, PackageDependInfo>& dependencies_map)
{
- const auto new_package = packages_to_keep.insert(requested_spec->name).second;
+ auto iter = dependencies_map.find(package);
+ Checks::check_exit(
+ VCPKG_LINE_INFO, iter != dependencies_map.end(), "Package not found in dependency graph");
- if (new_package && !Util::Sets::contains(switches, OPTION_NO_RECURSE))
- {
- for (const auto& dependency : (*source_control_file)->core_paragraph->depends)
- {
- build_dependencies_list(packages_to_keep, dependency.depend.name, source_control_files, switches);
- }
+ PackageDependInfo& info = iter->second;
- // Collect features with `*` considered
- std::set<const FeatureParagraph*> collected_features;
- for (const auto& requested_feature_name : requested_spec->features)
- {
- if (requested_feature_name == "*")
- {
- for (auto&& feature_paragraph : (*source_control_file)->feature_paragraphs)
- {
- collected_features.insert(std::addressof(Util::as_const(*feature_paragraph)));
- }
- continue;
- }
- auto maybe_feature = (*source_control_file)->find_feature(requested_feature_name);
- if (auto&& feature_paragraph = maybe_feature.get())
- {
- collected_features.insert(std::addressof(Util::as_const(*feature_paragraph)));
- }
- else
- {
- System::print2(System::Color::warning,
- "dependency '",
- requested_feature_name,
- "' of package '",
- requested_spec->name,
- "' does not exist\n");
- continue;
- }
- }
- for (auto feature_paragraph : collected_features)
+ if (depth > info.depth)
+ {
+ info.depth = depth;
+ if (depth < max_depth || max_depth == NO_RECURSE_LIMIT_VALUE)
{
- for (const auto& dependency : feature_paragraph->depends)
+ for (auto&& dependency : info.dependencies)
{
- build_dependencies_list(
- packages_to_keep, dependency.depend.name, source_control_files, switches);
+ assign_depth_to_dependencies(dependency, depth + 1, max_depth, dependencies_map);
}
}
}
}
- else
+
+ std::vector<PackageDependInfo> extract_depend_info(const std::vector<const InstallPlanAction*>& install_actions,
+ const int max_depth)
{
- System::print2(System::Color::warning, "package '", requested_package, "' does not exist\n");
+ std::map<std::string, PackageDependInfo> package_dependencies;
+ for (const InstallPlanAction* pia : install_actions)
+ {
+ const InstallPlanAction& install_action = *pia;
+
+ const std::vector<std::string> dependencies = Util::fmap(
+ install_action.computed_dependencies, [](const PackageSpec& spec) { return spec.name(); });
+
+ std::set<std::string> features{install_action.feature_list};
+ features.erase("core");
+
+ std::string port_name = install_action.spec.name();
+
+ PackageDependInfo info{port_name, -1, features, dependencies};
+ package_dependencies.emplace(port_name, std::move(info));
+ }
+
+ const InstallPlanAction& init = *install_actions.back();
+ assign_depth_to_dependencies(init.spec.name(), 0, max_depth, package_dependencies);
+
+ std::vector<PackageDependInfo> out =
+ Util::fmap(package_dependencies, [](auto&& kvpair) -> PackageDependInfo { return kvpair.second; });
+ Util::erase_remove_if(out, [](auto&& info) { return info.depth < 0; });
+ return out;
}
}
- void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths)
+ const CommandStructure COMMAND_STRUCTURE = {
+ Help::create_example_string("depend-info sqlite3"),
+ 0,
+ SIZE_MAX,
+ {DEPEND_SWITCHES, DEPEND_SETTINGS},
+ nullptr,
+ };
+
+ void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths, const Triplet& default_triplet)
{
const ParsedArguments options = args.parse_arguments(COMMAND_STRUCTURE);
+ const int max_depth = get_max_depth(options);
+ const SortMode sort_mode = get_sort_mode(options);
+ const bool show_depth = Util::Sets::contains(options.switches, OPTION_SHOW_DEPTH);
- // TODO: Optimize implementation, current implementation needs to load all ports from disk which is too slow.
- PathsPortFileProvider provider(paths, args.overlay_ports.get());
- auto source_control_files =
- Util::fmap(provider.load_all_control_files(),
- [](auto&& scfl) -> const SourceControlFile* { return scfl->source_control_file.get(); });
+ const std::vector<FullPackageSpec> specs = Util::fmap(args.command_arguments, [&](auto&& arg) {
+ return Input::check_and_get_full_package_spec(
+ std::string{arg}, default_triplet, COMMAND_STRUCTURE.example_text);
+ });
- if (args.command_arguments.size() >= 1)
+ for (auto&& spec : specs)
{
- std::set<std::string> packages_to_keep;
- for (const auto& requested_package : args.command_arguments)
+ Input::check_triplet(spec.package_spec.triplet(), paths);
+ }
+
+ PathsPortFileProvider provider(paths, args.overlay_ports.get());
+
+ // By passing an empty status_db, we should get a plan containing all dependencies.
+ // All actions in the plan should be install actions, as there's no installed packages to remove.
+ StatusParagraphs status_db;
+ std::vector<AnyAction> action_plan =
+ create_feature_install_plan(provider, FullPackageSpec::to_feature_specs(specs), status_db);
+ std::vector<const InstallPlanAction*> install_actions = Util::fmap(action_plan, [&](const AnyAction& action) {
+ if (auto install_action = action.install_action.get())
{
- build_dependencies_list(packages_to_keep, requested_package, source_control_files, options.switches);
+ return install_action;
}
+ Checks::exit_with_message(VCPKG_LINE_INFO, "Only install actions should exist in the plan");
+ });
- Util::erase_remove_if(source_control_files, [&packages_to_keep](const auto& source_control_file) {
- return !Util::Sets::contains(packages_to_keep, source_control_file->core_paragraph->name);
- });
- }
+ std::vector<PackageDependInfo> depend_info = extract_depend_info(install_actions, max_depth);
if (Util::Sets::contains(options.switches, OPTION_DOT) || Util::Sets::contains(options.switches, OPTION_DGML))
{
- const std::string graph_as_string = create_graph_as_string(options.switches, source_control_files);
+ const std::vector<const SourceControlFile*> source_control_files =
+ Util::fmap(install_actions, [](const InstallPlanAction* install_action) {
+ const SourceControlFileLocation& scfl =
+ install_action->source_control_file_location.value_or_exit(VCPKG_LINE_INFO);
+ return const_cast<const SourceControlFile*>(scfl.source_control_file.get());
+ });
+
+ const std::string graph_as_string = create_graph_as_string(options.switches, depend_info);
System::print2(graph_as_string, '\n');
Checks::exit_success(VCPKG_LINE_INFO);
}
- for (auto&& source_control_file : source_control_files)
+ // TODO: Improve this code
+ auto lex = [](const PackageDependInfo& lhs, const PackageDependInfo& rhs) -> bool {
+ return lhs.package < rhs.package;
+ };
+ auto topo = [](const PackageDependInfo& lhs, const PackageDependInfo& rhs) -> bool {
+ return lhs.depth > rhs.depth;
+ };
+ auto reverse = [](const PackageDependInfo& lhs, const PackageDependInfo& rhs) -> bool {
+ return lhs.depth < rhs.depth;
+ };
+
+ switch (sort_mode)
{
- const SourceParagraph& source_paragraph = *source_control_file->core_paragraph.get();
- const auto s = Strings::join(", ", source_paragraph.depends, [](const Dependency& d) { return d.name(); });
- System::print2(source_paragraph.name, ": ", s, "\n");
+ case SortMode::Lexicographical: std::sort(std::begin(depend_info), std::end(depend_info), lex); break;
+ case SortMode::ReverseTopological:
+ std::sort(std::begin(depend_info), std::end(depend_info), reverse);
+ break;
+ case SortMode::Topological: std::sort(std::begin(depend_info), std::end(depend_info), topo); break;
+ default: Checks::unreachable(VCPKG_LINE_INFO);
}
+ for (auto&& info : depend_info)
+ {
+ if (info.depth >= 0)
+ {
+ std::string features = Strings::join(", ", info.features);
+ const std::string dependencies = Strings::join(", ", info.dependencies);
+
+ if (show_depth)
+ {
+ System::print2(System::Color::error, "(", info.depth, ") ");
+ }
+ System::print2(System::Color::success, info.package);
+ if (!features.empty())
+ {
+ System::print2("[");
+ System::print2(System::Color::warning, features);
+ System::print2("]");
+ }
+ System::print2(": ", dependencies, "\n");
+ }
+ }
Checks::exit_success(VCPKG_LINE_INFO);
}
}
diff --git a/toolsrc/src/vcpkg/commands.edit.cpp b/toolsrc/src/vcpkg/commands.edit.cpp
index f2f0b1569..6e98f5818 100644
--- a/toolsrc/src/vcpkg/commands.edit.cpp
+++ b/toolsrc/src/vcpkg/commands.edit.cpp
@@ -9,11 +9,11 @@
namespace vcpkg::Commands::Edit
{
+#if defined(_WIN32)
static std::vector<fs::path> find_from_registry()
{
std::vector<fs::path> output;
-#if defined(_WIN32)
struct RegKey
{
HKEY root;
@@ -42,9 +42,9 @@ namespace vcpkg::Commands::Edit
output.push_back(install_path / "Code.exe");
}
}
-#endif
return output;
}
+#endif
static constexpr StringLiteral OPTION_BUILDTREES = "--buildtrees";
diff --git a/toolsrc/src/vcpkg/commands.exportifw.cpp b/toolsrc/src/vcpkg/commands.exportifw.cpp
index 3d963a297..bc75069cd 100644
--- a/toolsrc/src/vcpkg/commands.exportifw.cpp
+++ b/toolsrc/src/vcpkg/commands.exportifw.cpp
@@ -13,86 +13,94 @@ namespace vcpkg::Export::IFW
using Dependencies::ExportPlanType;
using Install::InstallDir;
- static std::string create_release_date()
+ namespace
{
- const tm date_time = Chrono::get_current_date_time_local();
+ std::string create_release_date()
+ {
+ const tm date_time = Chrono::get_current_date_time_local();
- // Format is: YYYY-mm-dd
- // 10 characters + 1 null terminating character will be written for a total of 11 chars
- char mbstr[11];
- const size_t bytes_written = std::strftime(mbstr, sizeof(mbstr), "%Y-%m-%d", &date_time);
- Checks::check_exit(VCPKG_LINE_INFO,
- bytes_written == 10,
- "Expected 10 bytes to be written, but %u were written",
- bytes_written);
- const std::string date_time_as_string(mbstr);
- return date_time_as_string;
- }
+ // Format is: YYYY-mm-dd
+ // 10 characters + 1 null terminating character will be written for a total of 11 chars
+ char mbstr[11];
+ const size_t bytes_written = std::strftime(mbstr, sizeof(mbstr), "%Y-%m-%d", &date_time);
+ Checks::check_exit(VCPKG_LINE_INFO,
+ bytes_written == 10,
+ "Expected 10 bytes to be written, but %u were written",
+ bytes_written);
+ const std::string date_time_as_string(mbstr);
+ return date_time_as_string;
+ }
- std::string safe_rich_from_plain_text(const std::string& text)
- {
- // match standalone ampersand, no HTML number or name
- std::regex standalone_ampersand(R"###(&(?!(#[0-9]+|\w+);))###");
+ std::string safe_rich_from_plain_text(const std::string& text)
+ {
+ // match standalone ampersand, no HTML number or name
+ std::regex standalone_ampersand(R"###(&(?!(#[0-9]+|\w+);))###");
- return std::regex_replace(text, standalone_ampersand, "&amp;");
- }
+ return std::regex_replace(text, standalone_ampersand, "&amp;");
+ }
- fs::path get_packages_dir_path(const std::string& export_id, const Options& ifw_options, const VcpkgPaths& paths)
- {
- return ifw_options.maybe_packages_dir_path.has_value()
- ? fs::path(ifw_options.maybe_packages_dir_path.value_or_exit(VCPKG_LINE_INFO))
- : paths.root / (export_id + "-ifw-packages");
- }
+ fs::path get_packages_dir_path(const std::string& export_id,
+ const Options& ifw_options,
+ const VcpkgPaths& paths)
+ {
+ return ifw_options.maybe_packages_dir_path.has_value()
+ ? fs::path(ifw_options.maybe_packages_dir_path.value_or_exit(VCPKG_LINE_INFO))
+ : paths.root / (export_id + "-ifw-packages");
+ }
- fs::path get_repository_dir_path(const std::string& export_id, const Options& ifw_options, const VcpkgPaths& paths)
- {
- return ifw_options.maybe_repository_dir_path.has_value()
- ? fs::path(ifw_options.maybe_repository_dir_path.value_or_exit(VCPKG_LINE_INFO))
- : paths.root / (export_id + "-ifw-repository");
- }
+ fs::path get_repository_dir_path(const std::string& export_id,
+ const Options& ifw_options,
+ const VcpkgPaths& paths)
+ {
+ return ifw_options.maybe_repository_dir_path.has_value()
+ ? fs::path(ifw_options.maybe_repository_dir_path.value_or_exit(VCPKG_LINE_INFO))
+ : paths.root / (export_id + "-ifw-repository");
+ }
- fs::path get_config_file_path(const std::string& export_id, const Options& ifw_options, const VcpkgPaths& paths)
- {
- return ifw_options.maybe_config_file_path.has_value()
- ? fs::path(ifw_options.maybe_config_file_path.value_or_exit(VCPKG_LINE_INFO))
- : paths.root / (export_id + "-ifw-configuration.xml");
- }
+ fs::path get_config_file_path(const std::string& export_id, const Options& ifw_options, const VcpkgPaths& paths)
+ {
+ return ifw_options.maybe_config_file_path.has_value()
+ ? fs::path(ifw_options.maybe_config_file_path.value_or_exit(VCPKG_LINE_INFO))
+ : paths.root / (export_id + "-ifw-configuration.xml");
+ }
- fs::path get_installer_file_path(const std::string& export_id, const Options& ifw_options, const VcpkgPaths& paths)
- {
- return ifw_options.maybe_installer_file_path.has_value()
- ? fs::path(ifw_options.maybe_installer_file_path.value_or_exit(VCPKG_LINE_INFO))
- : paths.root / (export_id + "-ifw-installer.exe");
- }
+ fs::path get_installer_file_path(const std::string& export_id,
+ const Options& ifw_options,
+ const VcpkgPaths& paths)
+ {
+ return ifw_options.maybe_installer_file_path.has_value()
+ ? fs::path(ifw_options.maybe_installer_file_path.value_or_exit(VCPKG_LINE_INFO))
+ : paths.root / (export_id + "-ifw-installer.exe");
+ }
- fs::path export_real_package(const fs::path& ifw_packages_dir_path,
- const ExportPlanAction& action,
- Files::Filesystem& fs)
- {
- std::error_code ec;
+ fs::path export_real_package(const fs::path& ifw_packages_dir_path,
+ const ExportPlanAction& action,
+ Files::Filesystem& fs)
+ {
+ std::error_code ec;
- const BinaryParagraph& binary_paragraph = action.core_paragraph().value_or_exit(VCPKG_LINE_INFO);
+ const BinaryParagraph& binary_paragraph = action.core_paragraph().value_or_exit(VCPKG_LINE_INFO);
- // Prepare meta dir
- const fs::path package_xml_file_path =
- ifw_packages_dir_path /
- Strings::format("packages.%s.%s", action.spec.name(), action.spec.triplet().canonical_name()) / "meta" /
- "package.xml";
- const fs::path package_xml_dir_path = package_xml_file_path.parent_path();
- fs.create_directories(package_xml_dir_path, ec);
- Checks::check_exit(VCPKG_LINE_INFO,
- !ec,
- "Could not create directory for package file %s",
- package_xml_file_path.generic_u8string());
+ // Prepare meta dir
+ const fs::path package_xml_file_path =
+ ifw_packages_dir_path /
+ Strings::format("packages.%s.%s", action.spec.name(), action.spec.triplet().canonical_name()) / "meta" /
+ "package.xml";
+ const fs::path package_xml_dir_path = package_xml_file_path.parent_path();
+ fs.create_directories(package_xml_dir_path, ec);
+ Checks::check_exit(VCPKG_LINE_INFO,
+ !ec,
+ "Could not create directory for package file %s",
+ package_xml_file_path.generic_u8string());
- auto deps = Strings::join(
- ",", binary_paragraph.depends, [](const std::string& dep) { return "packages." + dep + ":"; });
+ auto deps = Strings::join(
+ ",", binary_paragraph.depends, [](const std::string& dep) { return "packages." + dep + ":"; });
- if (!deps.empty()) deps = "\n <Dependencies>" + deps + "</Dependencies>";
+ if (!deps.empty()) deps = "\n <Dependencies>" + deps + "</Dependencies>";
- fs.write_contents(package_xml_file_path,
- Strings::format(
- R"###(<?xml version="1.0"?>
+ fs.write_contents(package_xml_file_path,
+ Strings::format(
+ R"###(<?xml version="1.0"?>
<Package>
<DisplayName>%s</DisplayName>
<Version>%s</Version>
@@ -101,111 +109,89 @@ namespace vcpkg::Export::IFW
<Virtual>true</Virtual>
</Package>
)###",
- action.spec.to_string(),
- binary_paragraph.version,
- create_release_date(),
- action.spec.name(),
- action.spec.triplet().canonical_name(),
- deps),
- VCPKG_LINE_INFO);
-
- // Return dir path for export package data
- return ifw_packages_dir_path /
- Strings::format("packages.%s.%s", action.spec.name(), action.spec.triplet().canonical_name()) / "data" /
- "installed";
- }
-
- void export_unique_packages(const fs::path& raw_exported_dir_path,
- std::map<std::string, const ExportPlanAction*> unique_packages,
- Files::Filesystem& fs)
- {
- std::error_code ec;
-
- // packages
+ action.spec.to_string(),
+ binary_paragraph.version,
+ create_release_date(),
+ action.spec.name(),
+ action.spec.triplet().canonical_name(),
+ deps),
+ VCPKG_LINE_INFO);
- fs::path package_xml_file_path = raw_exported_dir_path / "packages" / "meta" / "package.xml";
- fs::path package_xml_dir_path = package_xml_file_path.parent_path();
- fs.create_directories(package_xml_dir_path, ec);
- Checks::check_exit(VCPKG_LINE_INFO,
- !ec,
- "Could not create directory for package file %s",
- package_xml_file_path.generic_u8string());
- fs.write_contents(package_xml_file_path,
- Strings::format(
- R"###(<?xml version="1.0"?>
-<Package>
- <DisplayName>Packages</DisplayName>
- <Version>1.0.0</Version>
- <ReleaseDate>%s</ReleaseDate>
-</Package>
-)###",
- create_release_date()),
- VCPKG_LINE_INFO);
+ // Return dir path for export package data
+ return ifw_packages_dir_path /
+ Strings::format("packages.%s.%s", action.spec.name(), action.spec.triplet().canonical_name()) /
+ "data" / "installed";
+ }
- for (const auto& unique_package : unique_packages)
+ void export_unique_packages(const fs::path& raw_exported_dir_path,
+ std::map<std::string, const ExportPlanAction*> unique_packages,
+ Files::Filesystem& fs)
{
- const ExportPlanAction& action = *(unique_package.second);
- const BinaryParagraph& binary_paragraph = action.core_paragraph().value_or_exit(VCPKG_LINE_INFO);
+ std::error_code ec;
+
+ // packages
- package_xml_file_path =
- raw_exported_dir_path / Strings::format("packages.%s", unique_package.first) / "meta" / "package.xml";
- package_xml_dir_path = package_xml_file_path.parent_path();
+ fs::path package_xml_file_path = raw_exported_dir_path / "packages" / "meta" / "package.xml";
+ fs::path package_xml_dir_path = package_xml_file_path.parent_path();
fs.create_directories(package_xml_dir_path, ec);
Checks::check_exit(VCPKG_LINE_INFO,
!ec,
"Could not create directory for package file %s",
package_xml_file_path.generic_u8string());
-
fs.write_contents(package_xml_file_path,
Strings::format(
R"###(<?xml version="1.0"?>
<Package>
- <DisplayName>%s</DisplayName>
- <Description>%s</Description>
- <Version>%s</Version>
+ <DisplayName>Packages</DisplayName>
+ <Version>1.0.0</Version>
<ReleaseDate>%s</ReleaseDate>
</Package>
)###",
- action.spec.name(),
- safe_rich_from_plain_text(binary_paragraph.description),
- binary_paragraph.version,
create_release_date()),
VCPKG_LINE_INFO);
- }
- }
-
- void export_unique_triplets(const fs::path& raw_exported_dir_path,
- std::set<std::string> unique_triplets,
- Files::Filesystem& fs)
- {
- std::error_code ec;
-
- // triplets
- fs::path package_xml_file_path = raw_exported_dir_path / "triplets" / "meta" / "package.xml";
- fs::path package_xml_dir_path = package_xml_file_path.parent_path();
- fs.create_directories(package_xml_dir_path, ec);
- Checks::check_exit(VCPKG_LINE_INFO,
- !ec,
- "Could not create directory for package file %s",
- package_xml_file_path.generic_u8string());
- fs.write_contents(package_xml_file_path,
- Strings::format(
- R"###(<?xml version="1.0"?>
+ for (const auto& unique_package : unique_packages)
+ {
+ const ExportPlanAction& action = *(unique_package.second);
+ const BinaryParagraph& binary_paragraph = action.core_paragraph().value_or_exit(VCPKG_LINE_INFO);
+
+ package_xml_file_path = raw_exported_dir_path / Strings::format("packages.%s", unique_package.first) /
+ "meta" / "package.xml";
+ package_xml_dir_path = package_xml_file_path.parent_path();
+ fs.create_directories(package_xml_dir_path, ec);
+ Checks::check_exit(VCPKG_LINE_INFO,
+ !ec,
+ "Could not create directory for package file %s",
+ package_xml_file_path.generic_u8string());
+
+ fs.write_contents(package_xml_file_path,
+ Strings::format(
+ R"###(<?xml version="1.0"?>
<Package>
- <DisplayName>Triplets</DisplayName>
- <Version>1.0.0</Version>
+ <DisplayName>%s</DisplayName>
+ <Description>%s</Description>
+ <Version>%s</Version>
<ReleaseDate>%s</ReleaseDate>
</Package>
)###",
- create_release_date()),
- VCPKG_LINE_INFO);
+ action.spec.name(),
+ safe_rich_from_plain_text(binary_paragraph.description),
+ binary_paragraph.version,
+ create_release_date()),
+ VCPKG_LINE_INFO);
+ }
+ }
- for (const std::string& triplet : unique_triplets)
+ void export_unique_triplets(const fs::path& raw_exported_dir_path,
+ std::set<std::string> unique_triplets,
+ Files::Filesystem& fs)
{
- package_xml_file_path =
- raw_exported_dir_path / Strings::format("triplets.%s", triplet) / "meta" / "package.xml";
- package_xml_dir_path = package_xml_file_path.parent_path();
+ std::error_code ec;
+
+ // triplets
+
+ fs::path package_xml_file_path = raw_exported_dir_path / "triplets" / "meta" / "package.xml";
+ fs::path package_xml_dir_path = package_xml_file_path.parent_path();
fs.create_directories(package_xml_dir_path, ec);
Checks::check_exit(VCPKG_LINE_INFO,
!ec,
@@ -215,73 +201,95 @@ namespace vcpkg::Export::IFW
Strings::format(
R"###(<?xml version="1.0"?>
<Package>
- <DisplayName>%s</DisplayName>
+ <DisplayName>Triplets</DisplayName>
<Version>1.0.0</Version>
<ReleaseDate>%s</ReleaseDate>
</Package>
)###",
- triplet,
create_release_date()),
VCPKG_LINE_INFO);
+
+ for (const std::string& triplet : unique_triplets)
+ {
+ package_xml_file_path =
+ raw_exported_dir_path / Strings::format("triplets.%s", triplet) / "meta" / "package.xml";
+ package_xml_dir_path = package_xml_file_path.parent_path();
+ fs.create_directories(package_xml_dir_path, ec);
+ Checks::check_exit(VCPKG_LINE_INFO,
+ !ec,
+ "Could not create directory for package file %s",
+ package_xml_file_path.generic_u8string());
+ fs.write_contents(package_xml_file_path,
+ Strings::format(
+ R"###(<?xml version="1.0"?>
+<Package>
+ <DisplayName>%s</DisplayName>
+ <Version>1.0.0</Version>
+ <ReleaseDate>%s</ReleaseDate>
+</Package>
+)###",
+ triplet,
+ create_release_date()),
+ VCPKG_LINE_INFO);
+ }
}
- }
- void export_integration(const fs::path& raw_exported_dir_path, Files::Filesystem& fs)
- {
- std::error_code ec;
+ void export_integration(const fs::path& raw_exported_dir_path, Files::Filesystem& fs)
+ {
+ std::error_code ec;
- // integration
- fs::path package_xml_file_path = raw_exported_dir_path / "integration" / "meta" / "package.xml";
- fs::path package_xml_dir_path = package_xml_file_path.parent_path();
- fs.create_directories(package_xml_dir_path, ec);
- Checks::check_exit(VCPKG_LINE_INFO,
- !ec,
- "Could not create directory for package file %s",
- package_xml_file_path.generic_u8string());
+ // integration
+ fs::path package_xml_file_path = raw_exported_dir_path / "integration" / "meta" / "package.xml";
+ fs::path package_xml_dir_path = package_xml_file_path.parent_path();
+ fs.create_directories(package_xml_dir_path, ec);
+ Checks::check_exit(VCPKG_LINE_INFO,
+ !ec,
+ "Could not create directory for package file %s",
+ package_xml_file_path.generic_u8string());
- fs.write_contents(package_xml_file_path,
- Strings::format(
- R"###(<?xml version="1.0"?>
+ fs.write_contents(package_xml_file_path,
+ Strings::format(
+ R"###(<?xml version="1.0"?>
<Package>
<DisplayName>Integration</DisplayName>
<Version>1.0.0</Version>
<ReleaseDate>%s</ReleaseDate>
</Package>
)###",
- create_release_date()),
- VCPKG_LINE_INFO);
- }
+ create_release_date()),
+ VCPKG_LINE_INFO);
+ }
- void export_config(const std::string& export_id, const Options& ifw_options, const VcpkgPaths& paths)
- {
- std::error_code ec;
- Files::Filesystem& fs = paths.get_filesystem();
+ void export_config(const std::string& export_id, const Options& ifw_options, const VcpkgPaths& paths)
+ {
+ std::error_code ec;
+ Files::Filesystem& fs = paths.get_filesystem();
- const fs::path config_xml_file_path = get_config_file_path(export_id, ifw_options, paths);
+ const fs::path config_xml_file_path = get_config_file_path(export_id, ifw_options, paths);
- fs::path config_xml_dir_path = config_xml_file_path.parent_path();
- fs.create_directories(config_xml_dir_path, ec);
- Checks::check_exit(VCPKG_LINE_INFO,
- !ec,
- "Could not create directory for configuration file %s",
- config_xml_file_path.generic_u8string());
+ fs::path config_xml_dir_path = config_xml_file_path.parent_path();
+ fs.create_directories(config_xml_dir_path, ec);
+ Checks::check_exit(VCPKG_LINE_INFO,
+ !ec,
+ "Could not create directory for configuration file %s",
+ config_xml_file_path.generic_u8string());
- std::string formatted_repo_url;
- std::string ifw_repo_url = ifw_options.maybe_repository_url.value_or("");
- if (!ifw_repo_url.empty())
- {
- formatted_repo_url = Strings::format(R"###(
+ std::string formatted_repo_url;
+ std::string ifw_repo_url = ifw_options.maybe_repository_url.value_or("");
+ if (!ifw_repo_url.empty())
+ {
+ formatted_repo_url = Strings::format(R"###(
<RemoteRepositories>
<Repository>
<Url>%s</Url>
</Repository>
</RemoteRepositories>)###",
- ifw_repo_url);
- }
+ ifw_repo_url);
+ }
- fs.write_contents(config_xml_file_path,
- Strings::format(
- R"###(<?xml version="1.0"?>
+ fs.write_contents(config_xml_file_path,
+ Strings::format(
+ R"###(<?xml version="1.0"?>
<Installer>
<Name>vcpkg</Name>
<Version>1.0.0</Version>
@@ -289,38 +297,38 @@ namespace vcpkg::Export::IFW
<TargetDir>@RootDir@/src/vcpkg</TargetDir>%s
</Installer>
)###",
- formatted_repo_url),
- VCPKG_LINE_INFO);
- }
+ formatted_repo_url),
+ VCPKG_LINE_INFO);
+ }
- void export_maintenance_tool(const fs::path& ifw_packages_dir_path, const VcpkgPaths& paths)
- {
- System::print2("Exporting maintenance tool...\n");
+ void export_maintenance_tool(const fs::path& ifw_packages_dir_path, const VcpkgPaths& paths)
+ {
+ System::print2("Exporting maintenance tool...\n");
- std::error_code ec;
- Files::Filesystem& fs = paths.get_filesystem();
+ std::error_code ec;
+ Files::Filesystem& fs = paths.get_filesystem();
- const fs::path& installerbase_exe = paths.get_tool_exe(Tools::IFW_INSTALLER_BASE);
- fs::path tempmaintenancetool = ifw_packages_dir_path / "maintenance" / "data" / "tempmaintenancetool.exe";
- fs.create_directories(tempmaintenancetool.parent_path(), ec);
- Checks::check_exit(VCPKG_LINE_INFO,
- !ec,
- "Could not create directory for package file %s",
- tempmaintenancetool.generic_u8string());
- fs.copy_file(installerbase_exe, tempmaintenancetool, fs::copy_options::overwrite_existing, ec);
- Checks::check_exit(
- VCPKG_LINE_INFO, !ec, "Could not write package file %s", tempmaintenancetool.generic_u8string());
+ const fs::path& installerbase_exe = paths.get_tool_exe(Tools::IFW_INSTALLER_BASE);
+ fs::path tempmaintenancetool = ifw_packages_dir_path / "maintenance" / "data" / "tempmaintenancetool.exe";
+ fs.create_directories(tempmaintenancetool.parent_path(), ec);
+ Checks::check_exit(VCPKG_LINE_INFO,
+ !ec,
+ "Could not create directory for package file %s",
+ tempmaintenancetool.generic_u8string());
+ fs.copy_file(installerbase_exe, tempmaintenancetool, fs::copy_options::overwrite_existing, ec);
+ Checks::check_exit(
+ VCPKG_LINE_INFO, !ec, "Could not write package file %s", tempmaintenancetool.generic_u8string());
- fs::path package_xml_file_path = ifw_packages_dir_path / "maintenance" / "meta" / "package.xml";
- fs::path package_xml_dir_path = package_xml_file_path.parent_path();
- fs.create_directories(package_xml_dir_path, ec);
- Checks::check_exit(VCPKG_LINE_INFO,
- !ec,
- "Could not create directory for package file %s",
- package_xml_file_path.generic_u8string());
- fs.write_contents(package_xml_file_path,
- Strings::format(
- R"###(<?xml version="1.0"?>
+ fs::path package_xml_file_path = ifw_packages_dir_path / "maintenance" / "meta" / "package.xml";
+ fs::path package_xml_dir_path = package_xml_file_path.parent_path();
+ fs.create_directories(package_xml_dir_path, ec);
+ Checks::check_exit(VCPKG_LINE_INFO,
+ !ec,
+ "Could not create directory for package file %s",
+ package_xml_file_path.generic_u8string());
+ fs.write_contents(package_xml_file_path,
+ Strings::format(
+ R"###(<?xml version="1.0"?>
<Package>
<DisplayName>Maintenance Tool</DisplayName>
<Description>Maintenance Tool</Description>
@@ -332,82 +340,84 @@ namespace vcpkg::Export::IFW
<ForcedInstallation>true</ForcedInstallation>
</Package>
)###",
- create_release_date()),
- VCPKG_LINE_INFO);
- const fs::path script_source = paths.root / "scripts" / "ifw" / "maintenance.qs";
- const fs::path script_destination = ifw_packages_dir_path / "maintenance" / "meta" / "maintenance.qs";
- fs.copy_file(script_source, script_destination, fs::copy_options::overwrite_existing, ec);
- Checks::check_exit(
- VCPKG_LINE_INFO, !ec, "Could not write package file %s", script_destination.generic_u8string());
+ create_release_date()),
+ VCPKG_LINE_INFO);
+ const fs::path script_source = paths.root / "scripts" / "ifw" / "maintenance.qs";
+ const fs::path script_destination = ifw_packages_dir_path / "maintenance" / "meta" / "maintenance.qs";
+ fs.copy_file(script_source, script_destination, fs::copy_options::overwrite_existing, ec);
+ Checks::check_exit(
+ VCPKG_LINE_INFO, !ec, "Could not write package file %s", script_destination.generic_u8string());
- System::print2("Exporting maintenance tool... done\n");
- }
+ System::print2("Exporting maintenance tool... done\n");
+ }
- void do_repository(const std::string& export_id, const Options& ifw_options, const VcpkgPaths& paths)
- {
- const fs::path& repogen_exe = paths.get_tool_exe(Tools::IFW_REPOGEN);
- const fs::path packages_dir = get_packages_dir_path(export_id, ifw_options, paths);
- const fs::path repository_dir = get_repository_dir_path(export_id, ifw_options, paths);
+ void do_repository(const std::string& export_id, const Options& ifw_options, const VcpkgPaths& paths)
+ {
+ const fs::path& repogen_exe = paths.get_tool_exe(Tools::IFW_REPOGEN);
+ const fs::path packages_dir = get_packages_dir_path(export_id, ifw_options, paths);
+ const fs::path repository_dir = get_repository_dir_path(export_id, ifw_options, paths);
- System::print2("Generating repository ", repository_dir.generic_u8string(), "...\n");
+ System::print2("Generating repository ", repository_dir.generic_u8string(), "...\n");
- std::error_code ec;
- fs::path failure_point;
- Files::Filesystem& fs = paths.get_filesystem();
+ std::error_code ec;
+ fs::path failure_point;
+ Files::Filesystem& fs = paths.get_filesystem();
- fs.remove_all(repository_dir, ec, failure_point);
- Checks::check_exit(VCPKG_LINE_INFO,
- !ec,
- "Could not remove outdated repository directory %s due to file %s",
- repository_dir.generic_u8string(),
- failure_point.string());
+ fs.remove_all(repository_dir, ec, failure_point);
+ Checks::check_exit(VCPKG_LINE_INFO,
+ !ec,
+ "Could not remove outdated repository directory %s due to file %s",
+ repository_dir.generic_u8string(),
+ failure_point.string());
- const auto cmd_line = Strings::format(R"("%s" --packages "%s" "%s" > nul)",
- repogen_exe.u8string(),
- packages_dir.u8string(),
- repository_dir.u8string());
+ const auto cmd_line = Strings::format(R"("%s" --packages "%s" "%s" > nul)",
+ repogen_exe.u8string(),
+ packages_dir.u8string(),
+ repository_dir.u8string());
- const int exit_code = System::cmd_execute_clean(cmd_line);
- Checks::check_exit(VCPKG_LINE_INFO, exit_code == 0, "Error: IFW repository generating failed");
+ const int exit_code = System::cmd_execute_clean(cmd_line);
+ Checks::check_exit(VCPKG_LINE_INFO, exit_code == 0, "Error: IFW repository generating failed");
- System::printf(
- System::Color::success, "Generating repository %s... done.\n", repository_dir.generic_u8string());
- }
+ System::printf(
+ System::Color::success, "Generating repository %s... done.\n", repository_dir.generic_u8string());
+ }
- void do_installer(const std::string& export_id, const Options& ifw_options, const VcpkgPaths& paths)
- {
- const fs::path& binarycreator_exe = paths.get_tool_exe(Tools::IFW_BINARYCREATOR);
- const fs::path config_file = get_config_file_path(export_id, ifw_options, paths);
- const fs::path packages_dir = get_packages_dir_path(export_id, ifw_options, paths);
- const fs::path repository_dir = get_repository_dir_path(export_id, ifw_options, paths);
- const fs::path installer_file = get_installer_file_path(export_id, ifw_options, paths);
+ void do_installer(const std::string& export_id, const Options& ifw_options, const VcpkgPaths& paths)
+ {
+ const fs::path& binarycreator_exe = paths.get_tool_exe(Tools::IFW_BINARYCREATOR);
+ const fs::path config_file = get_config_file_path(export_id, ifw_options, paths);
+ const fs::path packages_dir = get_packages_dir_path(export_id, ifw_options, paths);
+ const fs::path repository_dir = get_repository_dir_path(export_id, ifw_options, paths);
+ const fs::path installer_file = get_installer_file_path(export_id, ifw_options, paths);
- System::printf("Generating installer %s...\n", installer_file.generic_u8string());
+ System::printf("Generating installer %s...\n", installer_file.generic_u8string());
- std::string cmd_line;
+ std::string cmd_line;
- std::string ifw_repo_url = ifw_options.maybe_repository_url.value_or("");
- if (!ifw_repo_url.empty())
- {
- cmd_line = Strings::format(R"("%s" --online-only --config "%s" --repository "%s" "%s" > nul)",
- binarycreator_exe.u8string(),
- config_file.u8string(),
- repository_dir.u8string(),
- installer_file.u8string());
- }
- else
- {
- cmd_line = Strings::format(R"("%s" --config "%s" --packages "%s" "%s" > nul)",
- binarycreator_exe.u8string(),
- config_file.u8string(),
- packages_dir.u8string(),
- installer_file.u8string());
- }
+ std::string ifw_repo_url = ifw_options.maybe_repository_url.value_or("");
+ if (!ifw_repo_url.empty())
+ {
+ cmd_line = Strings::format(R"("%s" --online-only --config "%s" --repository "%s" "%s" > nul)",
+ binarycreator_exe.u8string(),
+ config_file.u8string(),
+ repository_dir.u8string(),
+ installer_file.u8string());
+ }
+ else
+ {
+ cmd_line = Strings::format(R"("%s" --config "%s" --packages "%s" "%s" > nul)",
+ binarycreator_exe.u8string(),
+ config_file.u8string(),
+ packages_dir.u8string(),
+ installer_file.u8string());
+ }
- const int exit_code = System::cmd_execute_clean(cmd_line);
- Checks::check_exit(VCPKG_LINE_INFO, exit_code == 0, "Error: IFW installer generating failed");
+ const int exit_code = System::cmd_execute_clean(cmd_line);
+ Checks::check_exit(VCPKG_LINE_INFO, exit_code == 0, "Error: IFW installer generating failed");
- System::printf(System::Color::success, "Generating installer %s... done.\n", installer_file.generic_u8string());
+ System::printf(
+ System::Color::success, "Generating installer %s... done.\n", installer_file.generic_u8string());
+ }
}
void do_export(const std::vector<ExportPlanAction>& export_plan,
diff --git a/toolsrc/src/vcpkg/commands.xvsinstances.cpp b/toolsrc/src/vcpkg/commands.xvsinstances.cpp
index 542ebd56c..a110bbb18 100644
--- a/toolsrc/src/vcpkg/commands.xvsinstances.cpp
+++ b/toolsrc/src/vcpkg/commands.xvsinstances.cpp
@@ -28,6 +28,7 @@ namespace vcpkg::Commands::X_VSInstances
Checks::exit_success(VCPKG_LINE_INFO);
#else
+ Util::unused(args, paths);
Checks::exit_with_message(VCPKG_LINE_INFO, "This command is not supported on non-windows platforms.");
#endif
}
diff --git a/toolsrc/src/vcpkg/dependencies.cpp b/toolsrc/src/vcpkg/dependencies.cpp
index 9fccf950e..ab14934a2 100644
--- a/toolsrc/src/vcpkg/dependencies.cpp
+++ b/toolsrc/src/vcpkg/dependencies.cpp
@@ -13,45 +13,48 @@
namespace vcpkg::Dependencies
{
- struct ClusterInstalled
+ namespace
{
- InstalledPackageView ipv;
- std::set<PackageSpec> remove_edges;
- std::set<std::string> original_features;
- };
+ struct ClusterInstalled
+ {
+ InstalledPackageView ipv;
+ std::set<PackageSpec> remove_edges;
+ std::set<std::string> original_features;
+ };
- struct ClusterSource
- {
- const SourceControlFileLocation* scfl = nullptr;
- std::unordered_map<std::string, std::vector<FeatureSpec>> build_edges;
- };
+ struct ClusterSource
+ {
+ const SourceControlFileLocation* scfl = nullptr;
+ std::unordered_map<std::string, std::vector<FeatureSpec>> build_edges;
+ };
- /// <summary>
- /// Representation of a package and its features in a ClusterGraph.
- /// </summary>
- struct Cluster : Util::MoveOnlyBase
- {
- PackageSpec spec;
+ /// <summary>
+ /// Representation of a package and its features in a ClusterGraph.
+ /// </summary>
+ struct Cluster : Util::MoveOnlyBase
+ {
+ PackageSpec spec;
- Optional<ClusterInstalled> installed;
- Optional<ClusterSource> source;
+ Optional<ClusterInstalled> installed;
+ Optional<ClusterSource> source;
- // Note: this map can contain "special" strings such as "" and "*"
- std::unordered_map<std::string, bool> plus;
- std::set<std::string> to_install_features;
- bool minus = false;
- bool transient_uninstalled = true;
- RequestType request_type = RequestType::AUTO_SELECTED;
- };
+ // Note: this map can contain "special" strings such as "" and "*"
+ std::unordered_map<std::string, bool> plus;
+ std::set<std::string> to_install_features;
+ bool minus = false;
+ bool transient_uninstalled = true;
+ RequestType request_type = RequestType::AUTO_SELECTED;
+ };
- struct ClusterPtr
- {
- Cluster* ptr;
+ struct ClusterPtr
+ {
+ Cluster* ptr;
- Cluster* operator->() const { return ptr; }
- };
+ Cluster* operator->() const { return ptr; }
+ };
- bool operator==(const ClusterPtr& l, const ClusterPtr& r) { return l.ptr == r.ptr; }
+ bool operator==(const ClusterPtr& l, const ClusterPtr& r) { return l.ptr == r.ptr; }
+ }
}
namespace std
@@ -122,11 +125,11 @@ namespace vcpkg::Dependencies
const PortFileProvider& m_provider;
};
- std::string to_output_string(RequestType request_type,
- const CStringView s,
- const Build::BuildPackageOptions& options,
- const fs::path& install_port_path,
- const fs::path& default_port_path)
+ static std::string to_output_string(RequestType request_type,
+ const CStringView s,
+ const Build::BuildPackageOptions& options,
+ const fs::path& install_port_path,
+ const fs::path& default_port_path)
{
if (!default_port_path.empty() &&
!Strings::case_insensitive_ascii_starts_with(install_port_path.u8string(), default_port_path.u8string()))
@@ -670,7 +673,8 @@ namespace vcpkg::Dependencies
}
}
- // This feature was or will be uninstalled, therefore we need to rebuild
+ // The feature was not previously installed. Mark the cluster
+ //(aka the entire port) to be removed before re-adding it.
mark_minus(cluster, graph, graph_plan, prevent_default_features);
return follow_plus_dependencies(feature, cluster, graph, graph_plan, prevent_default_features);
diff --git a/toolsrc/src/vcpkg/export.cpp b/toolsrc/src/vcpkg/export.cpp
index f306bf4e6..8f5034eee 100644
--- a/toolsrc/src/vcpkg/export.cpp
+++ b/toolsrc/src/vcpkg/export.cpp
@@ -360,6 +360,12 @@ namespace vcpkg::Export
}
};
+#if defined(_MSC_VER) && _MSC_VER <= 1900
+// there's a bug in VS 2015 that causes a bunch of "unreferenced local variable" warnings
+#pragma warning(push)
+#pragma warning(disable : 4189)
+#endif
+
options_implies(OPTION_NUGET,
ret.nuget,
{
@@ -376,6 +382,9 @@ namespace vcpkg::Export
{OPTION_IFW_CONFIG_FILE_PATH, ret.ifw_options.maybe_config_file_path},
{OPTION_IFW_INSTALLER_FILE_PATH, ret.ifw_options.maybe_installer_file_path},
});
+#if defined(_MSC_VER) && _MSC_VER <= 1900
+#pragma warning(pop)
+#endif
return ret;
}
diff --git a/toolsrc/src/vcpkg/install.cpp b/toolsrc/src/vcpkg/install.cpp
index 165f13126..1812f1624 100644
--- a/toolsrc/src/vcpkg/install.cpp
+++ b/toolsrc/src/vcpkg/install.cpp
@@ -174,7 +174,7 @@ namespace vcpkg::Install
const std::vector<fs::path> package_file_paths = fs.get_files_recursive(package_dir);
const size_t package_remove_char_count = package_dir.generic_string().size() + 1; // +1 for the slash
auto package_files = Util::fmap(package_file_paths, [package_remove_char_count](const fs::path& path) {
- return std::move(std::string(path.generic_string(), package_remove_char_count));
+ return std::string(path.generic_string(), package_remove_char_count);
});
return SortedVector<std::string>(std::move(package_files));
@@ -202,6 +202,12 @@ namespace vcpkg::Install
struct intersection_compare
{
+ // The VS2015 standard library requires comparison operators of T and U
+ // to also support comparison of T and T, and of U and U, due to debug checks.
+#if _MSC_VER < 1910
+ bool operator()(const std::string& lhs, const std::string& rhs) { return lhs < rhs; }
+ bool operator()(const file_pack& lhs, const file_pack& rhs) { return lhs.first < rhs.first; }
+#endif
bool operator()(const std::string& lhs, const file_pack& rhs) { return lhs < rhs.first; }
bool operator()(const file_pack& lhs, const std::string& rhs) { return lhs.first < rhs; }
};
diff --git a/toolsrc/src/vcpkg/logicexpression.cpp b/toolsrc/src/vcpkg/logicexpression.cpp
index 0cf08ee03..ccb8b00c4 100644
--- a/toolsrc/src/vcpkg/logicexpression.cpp
+++ b/toolsrc/src/vcpkg/logicexpression.cpp
@@ -54,9 +54,12 @@ namespace vcpkg
{
public:
ExpressionParser(const std::string& str, const std::string& evaluation_context)
- : raw_text(str), evaluation_context(evaluation_context)
+ : raw_text(str)
+ , evaluation_context(evaluation_context)
+ , current_iter(raw_text.begin())
+ , current_char(get_current_char())
{
- go_to_begin();
+ skip_whitespace();
final_result = logic_expression();
@@ -77,16 +80,17 @@ namespace vcpkg
bool has_error() const { return err == nullptr; }
private:
- bool final_result;
-
- std::string::const_iterator current_iter;
const std::string& raw_text;
+ const std::string& evaluation_context;
+ std::string::const_iterator current_iter;
char current_char;
- const std::string& evaluation_context;
+ bool final_result;
std::unique_ptr<ParseError> err;
+ char get_current_char() const { return (current_iter != raw_text.end() ? *current_iter : '\0'); }
+
void add_error(std::string message, int column = -1)
{
// avoid castcading errors by only saving the first
@@ -105,16 +109,6 @@ namespace vcpkg
int current_column() const { return static_cast<int>(current_iter - raw_text.begin()); }
- void go_to_begin()
- {
- current_iter = raw_text.begin();
- current_char = (current_iter != raw_text.end() ? *current_iter : current_char);
-
- if (current_char == ' ' || current_char == '\t')
- {
- next_skip_whitespace();
- }
- }
void skip_to_end()
{
current_iter = raw_text.end();
@@ -126,7 +120,7 @@ namespace vcpkg
if (current_char != '\0')
{
current_iter++;
- current_char = (current_iter != raw_text.end() ? *current_iter : '\0');
+ current_char = get_current_char();
}
return current();
}
diff --git a/toolsrc/src/vcpkg/metrics.cpp b/toolsrc/src/vcpkg/metrics.cpp
index 9dd520ed6..11f613830 100644
--- a/toolsrc/src/vcpkg/metrics.cpp
+++ b/toolsrc/src/vcpkg/metrics.cpp
@@ -307,7 +307,9 @@ namespace vcpkg::Metrics
void Metrics::upload(const std::string& payload)
{
-#if defined(_WIN32)
+#if !defined(_WIN32)
+ Util::unused(payload);
+#else
HINTERNET connect = nullptr, request = nullptr;
BOOL results = FALSE;
diff --git a/toolsrc/src/vcpkg/paragraphs.cpp b/toolsrc/src/vcpkg/paragraphs.cpp
index 1232b940a..9cb7caff1 100644
--- a/toolsrc/src/vcpkg/paragraphs.cpp
+++ b/toolsrc/src/vcpkg/paragraphs.cpp
@@ -164,7 +164,7 @@ namespace vcpkg::Paragraphs
}
};
- Expected<RawParagraph> parse_single_paragraph(const std::string& str)
+ static Expected<RawParagraph> parse_single_paragraph(const std::string& str)
{
const std::vector<RawParagraph> p = Parser(str.c_str(), str.c_str() + str.size()).get_paragraphs();
diff --git a/toolsrc/src/vcpkg/postbuildlint.cpp b/toolsrc/src/vcpkg/postbuildlint.cpp
index c760a034f..a85d879fe 100644
--- a/toolsrc/src/vcpkg/postbuildlint.cpp
+++ b/toolsrc/src/vcpkg/postbuildlint.cpp
@@ -39,7 +39,7 @@ namespace vcpkg::PostBuildLint
}
};
- Span<const OutdatedDynamicCrt> get_outdated_dynamic_crts(const Optional<std::string>& toolset_version)
+ static Span<const OutdatedDynamicCrt> get_outdated_dynamic_crts(const Optional<std::string>& toolset_version)
{
static const std::vector<OutdatedDynamicCrt> V_NO_120 = {
{"msvcp100.dll", R"(msvcp100\.dll)"},
@@ -462,7 +462,7 @@ namespace vcpkg::PostBuildLint
return LintStatus::ERROR_DETECTED;
}
#endif
-
+ Util::unused(expected_architecture, files);
return LintStatus::SUCCESS;
}
diff --git a/toolsrc/src/vcpkg/sourceparagraph.cpp b/toolsrc/src/vcpkg/sourceparagraph.cpp
index 298095df6..ebb9cd4f4 100644
--- a/toolsrc/src/vcpkg/sourceparagraph.cpp
+++ b/toolsrc/src/vcpkg/sourceparagraph.cpp
@@ -26,6 +26,7 @@ namespace vcpkg
static const std::string SUPPORTS = "Supports";
static const std::string VERSION = "Version";
static const std::string HOMEPAGE = "Homepage";
+ static const std::string TYPE = "Type";
}
static Span<const std::string> get_list_of_valid_fields()
@@ -37,6 +38,7 @@ namespace vcpkg
SourceParagraphFields::MAINTAINER,
SourceParagraphFields::BUILD_DEPENDS,
SourceParagraphFields::HOMEPAGE,
+ SourceParagraphFields::TYPE,
};
return valid_fields;
diff --git a/toolsrc/src/vcpkg/statusparagraphs.cpp b/toolsrc/src/vcpkg/statusparagraphs.cpp
index c642af59b..3c81728bb 100644
--- a/toolsrc/src/vcpkg/statusparagraphs.cpp
+++ b/toolsrc/src/vcpkg/statusparagraphs.cpp
@@ -7,8 +7,9 @@ namespace vcpkg
{
StatusParagraphs::StatusParagraphs() = default;
- StatusParagraphs::StatusParagraphs(std::vector<std::unique_ptr<StatusParagraph>>&& ps)
- : paragraphs(std::move(ps)){};
+ StatusParagraphs::StatusParagraphs(std::vector<std::unique_ptr<StatusParagraph>>&& ps) : paragraphs(std::move(ps))
+ {
+ }
std::vector<std::unique_ptr<StatusParagraph>*> StatusParagraphs::find_all(const std::string& name,
const Triplet& triplet)
diff --git a/toolsrc/src/vcpkg/tools.cpp b/toolsrc/src/vcpkg/tools.cpp
index 7d56854c6..9354493bd 100644
--- a/toolsrc/src/vcpkg/tools.cpp
+++ b/toolsrc/src/vcpkg/tools.cpp
@@ -274,6 +274,9 @@ namespace vcpkg
const auto& program_files_32_bit = System::get_program_files_32_bit();
if (const auto pf = program_files_32_bit.get())
out_candidate_paths.push_back(*pf / "CMake" / "bin" / "cmake.exe");
+#else
+ // TODO: figure out if this should do anything on non-Windows
+ Util::unused(out_candidate_paths);
#endif
}
virtual Optional<std::string> get_version(const fs::path& path_to_exe) const override
@@ -362,6 +365,9 @@ Type 'NuGet help <command>' for help on a specific command.
const auto& program_files_32_bit = System::get_program_files_32_bit();
if (const auto pf = program_files_32_bit.get())
out_candidate_paths.push_back(*pf / "git" / "cmd" / "git.exe");
+#else
+ // TODO: figure out if this should do anything on non-windows
+ Util::unused(out_candidate_paths);
#endif
}
diff --git a/toolsrc/src/vcpkg/vcpkgpaths.cpp b/toolsrc/src/vcpkg/vcpkgpaths.cpp
index bc46d2cfc..4f01ed03b 100644
--- a/toolsrc/src/vcpkg/vcpkgpaths.cpp
+++ b/toolsrc/src/vcpkg/vcpkgpaths.cpp
@@ -155,9 +155,9 @@ namespace vcpkg
{
return m_triplets_cache.get_lazy(
triplet, [&]() -> auto {
- for (auto&& triplet_dir : triplets_dirs)
+ for (const auto& triplet_dir : triplets_dirs)
{
- auto&& path = triplet_dir / (triplet.canonical_name() + ".cmake");
+ auto path = triplet_dir / (triplet.canonical_name() + ".cmake");
if (this->get_filesystem().exists(path))
{
return path;
diff --git a/toolsrc/src/vcpkg/versiont.cpp b/toolsrc/src/vcpkg/versiont.cpp
index d20e6b577..2c025fa1d 100644
--- a/toolsrc/src/vcpkg/versiont.cpp
+++ b/toolsrc/src/vcpkg/versiont.cpp
@@ -11,7 +11,6 @@ namespace vcpkg
const std::string& VersionT::to_string() const { return value; }
bool operator==(const VersionT& left, const VersionT& right) { return left.to_string() == right.to_string(); }
bool operator!=(const VersionT& left, const VersionT& right) { return left.to_string() != right.to_string(); }
- std::string to_printf_arg(const VersionT& version) { return version.to_string(); }
VersionDiff::VersionDiff() noexcept : left(), right() {}
VersionDiff::VersionDiff(const VersionT& left, const VersionT& right) : left(left), right(right) {}