From bbc804f735e1b02eb6b67b5ee4be8b1ba747f13a Mon Sep 17 00:00:00 2001 From: Nicole Mazzuca Date: Thu, 18 Mar 2021 14:32:58 -0700 Subject: [PATCH 1/9] hopefully fix ci issue #16773 --- src/vcpkg/commands.ci.cpp | 179 +++++++++++++++++++------------------- 1 file changed, 89 insertions(+), 90 deletions(-) diff --git a/src/vcpkg/commands.ci.cpp b/src/vcpkg/commands.ci.cpp index c882841036..bb7cc60508 100644 --- a/src/vcpkg/commands.ci.cpp +++ b/src/vcpkg/commands.ci.cpp @@ -105,7 +105,7 @@ namespace vcpkg::Commands::CI const CommandStructure COMMAND_STRUCTURE = { create_example_string("ci x64-windows"), 1, - SIZE_MAX, + 1, {CI_SWITCHES, CI_SETTINGS}, nullptr, }; @@ -429,6 +429,7 @@ namespace vcpkg::Commands::CI Triplet default_triplet, Triplet host_triplet) { + (void)default_triplet; std::unique_ptr binaryproviderStorage; if (args.binary_caching_enabled()) { @@ -451,14 +452,13 @@ namespace vcpkg::Commands::CI const auto is_dry_run = Util::Sets::contains(options.switches, OPTION_DRY_RUN); - std::vector triplets = Util::fmap( - args.command_arguments, [](std::string s) { return Triplet::from_canonical_name(std::move(s)); }); - - if (triplets.empty()) + if (args.command_arguments.size() != 1) { - triplets.push_back(default_triplet); + Checks::unreachable(VCPKG_LINE_INFO); // this should not be possible at this place } + Triplet target_triplet = Triplet::from_canonical_name(std::string(args.command_arguments[0])); + auto& filesystem = paths.get_filesystem(); Optional build_logs_recorder_storage; { @@ -489,110 +489,109 @@ namespace vcpkg::Commands::CI Util::fmap(provider.load_all_control_files(), Paragraphs::get_name_of_control_file); std::vector results; auto timer = Chrono::ElapsedTimer::create_started(); - for (Triplet triplet : triplets) - { - Input::check_triplet(triplet, paths); - - xunitTestResults.push_collection(triplet.canonical_name()); - std::vector specs = PackageSpec::to_package_specs(all_ports, triplet); - // Install the default features for every package - auto all_default_full_specs = Util::fmap(specs, [&](auto& spec) { - std::vector default_features = - provider.get_control_file(spec.name()).get()->source_control_file->core_paragraph->default_features; - default_features.emplace_back("core"); - return FullPackageSpec{spec, std::move(default_features)}; - }); + Input::check_triplet(target_triplet, paths); - Dependencies::CreateInstallPlanOptions serialize_options(host_triplet); + xunitTestResults.push_collection(target_triplet.canonical_name()); - struct RandomizerInstance : Graphs::Randomizer - { - virtual int random(int i) override - { - if (i <= 1) return 0; - std::uniform_int_distribution d(0, i - 1); - return d(e); - } + std::vector specs = PackageSpec::to_package_specs(all_ports, target_triplet); + // Install the default features for every package + auto all_default_full_specs = Util::fmap(specs, [&](auto& spec) { + std::vector default_features = + provider.get_control_file(spec.name()).get()->source_control_file->core_paragraph->default_features; + default_features.emplace_back("core"); + return FullPackageSpec{spec, std::move(default_features)}; + }); - std::random_device e; - } randomizer_instance; + Dependencies::CreateInstallPlanOptions serialize_options(host_triplet); - if (Util::Sets::contains(options.switches, OPTION_RANDOMIZE)) + struct RandomizerInstance : Graphs::Randomizer + { + virtual int random(int i) override { - serialize_options.randomizer = &randomizer_instance; + if (i <= 1) return 0; + std::uniform_int_distribution d(0, i - 1); + return d(e); } - auto split_specs = find_unknown_ports_for_ci(paths, - exclusions_set, - provider, - var_provider, - all_default_full_specs, - binaryprovider, - serialize_options, - host_triplet); + std::random_device e; + } randomizer_instance; - auto& action_plan = split_specs->plan; + if (Util::Sets::contains(options.switches, OPTION_RANDOMIZE)) + { + serialize_options.randomizer = &randomizer_instance; + } - for (auto&& action : action_plan.install_actions) - { - if (Util::Sets::contains(exclusions_set, action.spec.name())) - { - action.plan_type = InstallPlanType::EXCLUDED; - } - else - { - action.build_options = vcpkg::Build::backcompat_prohibiting_package_options; - } - } + auto split_specs = find_unknown_ports_for_ci(paths, + exclusions_set, + provider, + var_provider, + all_default_full_specs, + binaryprovider, + serialize_options, + host_triplet); - if (is_dry_run) + auto& action_plan = split_specs->plan; + + for (auto&& action : action_plan.install_actions) + { + if (action.spec.triplet() == target_triplet && Util::Sets::contains(exclusions_set, action.spec.name())) { - Dependencies::print_plan(action_plan, true, paths.builtin_ports_directory()); + action.plan_type = InstallPlanType::EXCLUDED; } else { - auto collection_timer = Chrono::ElapsedTimer::create_started(); - auto summary = Install::perform(args, - action_plan, - Install::KeepGoing::YES, - paths, - status_db, - binaryprovider, - build_logs_recorder, - var_provider); - auto collection_time_elapsed = collection_timer.elapsed(); - - // Adding results for ports that were built or pulled from an archive - for (auto&& result : summary.results) - { - auto& port_features = split_specs->features.at(result.spec); - split_specs->known.erase(result.spec); - xunitTestResults.add_test_results(result.spec.to_string(), - result.build_result.code, - result.timing, - split_specs->abi_map.at(result.spec), - port_features); - } + action.build_options = vcpkg::Build::backcompat_prohibiting_package_options; + } + } - // Adding results for ports that were not built because they have known states - for (auto&& port : split_specs->known) - { - auto& port_features = split_specs->features.at(port.first); - xunitTestResults.add_test_results(port.first.to_string(), - port.second, - Chrono::ElapsedTime{}, - split_specs->abi_map.at(port.first), - port_features); - } + if (is_dry_run) + { + Dependencies::print_plan(action_plan, true, paths.builtin_ports_directory()); + } + else + { + auto collection_timer = Chrono::ElapsedTimer::create_started(); + auto summary = Install::perform(args, + action_plan, + Install::KeepGoing::YES, + paths, + status_db, + binaryprovider, + build_logs_recorder, + var_provider); + auto collection_time_elapsed = collection_timer.elapsed(); + + // Adding results for ports that were built or pulled from an archive + for (auto&& result : summary.results) + { + auto& port_features = split_specs->features.at(result.spec); + split_specs->known.erase(result.spec); + xunitTestResults.add_test_results(result.spec.to_string(), + result.build_result.code, + result.timing, + split_specs->abi_map.at(result.spec), + port_features); + } - all_known_results.emplace_back(std::move(split_specs->known)); + // Adding results for ports that were not built because they have known states + for (auto&& port : split_specs->known) + { + auto& port_features = split_specs->features.at(port.first); + xunitTestResults.add_test_results(port.first.to_string(), + port.second, + Chrono::ElapsedTime{}, + split_specs->abi_map.at(port.first), + port_features); + } - results.push_back({triplet, std::move(summary)}); + all_known_results.emplace_back(std::move(split_specs->known)); - xunitTestResults.collection_time(collection_time_elapsed); - } + results.push_back({target_triplet, std::move(summary)}); + + xunitTestResults.collection_time(collection_time_elapsed); } + xunitTestResults.assembly_time(timer.elapsed()); for (auto&& result : results) From 34619df3ccafc8cf5dea4712ff3ce1c7292b1b99 Mon Sep 17 00:00:00 2001 From: Nicole Mazzuca Date: Fri, 19 Mar 2021 12:20:31 -0700 Subject: [PATCH 2/9] format & fix build --- src/tls12-download.c | 2 +- src/vcpkg/base/files.cpp | 20 ++++++++++---------- src/vcpkg/base/system.cpp | 6 +++--- src/vcpkg/commands.ci.cpp | 16 ++++++++-------- src/vcpkg/commands.integrate.cpp | 2 +- src/vcpkg/metrics.cpp | 2 +- 6 files changed, 24 insertions(+), 24 deletions(-) diff --git a/src/tls12-download.c b/src/tls12-download.c index 0a3a03fb4c..16edc54484 100644 --- a/src/tls12-download.c +++ b/src/tls12-download.c @@ -148,7 +148,7 @@ static void __declspec(noreturn) abort_api_failure(const HANDLE std_out, const w #ifndef NDEBUG int main() -#else // ^^^ debug // !debug vvv +#else // ^^^ debug // !debug vvv int __stdcall entry() #endif // ^^^ !debug { diff --git a/src/vcpkg/base/files.cpp b/src/vcpkg/base/files.cpp index c7169bf4c7..083e6f6545 100644 --- a/src/vcpkg/base/files.cpp +++ b/src/vcpkg/base/files.cpp @@ -336,7 +336,7 @@ namespace vcpkg::Files return fs::file_status(ft, permissions); -#else // ^^^ defined(_WIN32) // !defined(_WIN32) vvv +#else // ^^^ defined(_WIN32) // !defined(_WIN32) vvv auto result = follow_symlinks ? fs::stdfs::status(p, ec) : fs::stdfs::symlink_status(p, ec); // libstdc++ doesn't correctly not-set ec on nonexistent paths if (ec.value() == ENOENT || ec.value() == ENOTDIR) @@ -410,7 +410,7 @@ namespace vcpkg::Files } ec.clear(); return; -#else // ^^^ defined(_WIN32) && !VCPKG_USE_STD_FILESYSTEM // !defined(_WIN32) || VCPKG_USE_STD_FILESYSTEM vvv +#else // ^^^ defined(_WIN32) && !VCPKG_USE_STD_FILESYSTEM // !defined(_WIN32) || VCPKG_USE_STD_FILESYSTEM vvv return fs::stdfs::copy_symlink(oldpath, newpath, ec); #endif // ^^^ !defined(_WIN32) || VCPKG_USE_STD_FILESYSTEM } @@ -433,7 +433,7 @@ namespace vcpkg::Files { ec.assign(GetLastError(), std::system_category()); } -#else // ^^^ defined(_WIN32) // !defined(_WIN32) vvv +#else // ^^^ defined(_WIN32) // !defined(_WIN32) vvv struct stat s; if (lstat(path.c_str(), &s)) { @@ -912,7 +912,7 @@ namespace vcpkg::Files auto written_bytes = sendfile(o_fd, i_fd, &bytes, info.st_size); #elif defined(__APPLE__) auto written_bytes = fcopyfile(i_fd, o_fd, 0, COPYFILE_ALL); -#else // ^^^ defined(__APPLE__) // !(defined(__APPLE__) || defined(__linux__)) vvv +#else // ^^^ defined(__APPLE__) // !(defined(__APPLE__) || defined(__linux__)) vvv ssize_t written_bytes = 0; { constexpr std::size_t buffer_length = 4096; @@ -1009,7 +1009,7 @@ namespace vcpkg::Files { ec.assign(GetLastError(), std::system_category()); } -#else // ^^^ defined(_WIN32) // !defined(_WIN32) vvv +#else // ^^^ defined(_WIN32) // !defined(_WIN32) vvv if (rmdir(current_path.c_str())) { ec.assign(errno, std::system_category()); @@ -1038,7 +1038,7 @@ namespace vcpkg::Files ec.assign(GetLastError(), std::system_category()); } } -#else // ^^^ defined(_WIN32) // !defined(_WIN32) vvv +#else // ^^^ defined(_WIN32) // !defined(_WIN32) vvv else { if (unlink(current_path.c_str())) @@ -1188,7 +1188,7 @@ namespace vcpkg::Files FILE* f = nullptr; #if defined(_WIN32) auto err = _wfopen_s(&f, file_path.native().c_str(), L"wb"); -#else // ^^^ defined(_WIN32) // !defined(_WIN32) vvv +#else // ^^^ defined(_WIN32) // !defined(_WIN32) vvv f = fopen(file_path.native().c_str(), "wb"); int err = f != nullptr ? 0 : 1; #endif // ^^^ !defined(_WIN32) @@ -1234,7 +1234,7 @@ namespace vcpkg::Files #if defined(_WIN32) // absolute was called system_complete in experimental filesystem return fs::stdfs::system_complete(path, ec); -#else // ^^^ defined(_WIN32) / !defined(_WIN32) vvv +#else // ^^^ defined(_WIN32) / !defined(_WIN32) vvv if (path.is_absolute()) { return path; @@ -1405,7 +1405,7 @@ namespace vcpkg::Files { #if defined(_WIN32) static constexpr wchar_t const* EXTS[] = {L".cmd", L".exe", L".bat"}; -#else // ^^^ defined(_WIN32) // !defined(_WIN32) vvv +#else // ^^^ defined(_WIN32) // !defined(_WIN32) vvv static constexpr char const* EXTS[] = {""}; #endif // ^^^!defined(_WIN32) auto paths = Strings::split_paths(System::get_environment_variable("PATH").value_or_exit(VCPKG_LINE_INFO)); @@ -1467,7 +1467,7 @@ namespace vcpkg::Files { return lhs / rhs; } -#else // ^^^ unix // windows vvv +#else // ^^^ unix // windows vvv auto rhs_root_directory = rhs.root_directory(); auto rhs_root_name = rhs.root_name(); diff --git a/src/vcpkg/base/system.cpp b/src/vcpkg/base/system.cpp index ca065d2558..80bb573610 100644 --- a/src/vcpkg/base/system.cpp +++ b/src/vcpkg/base/system.cpp @@ -133,7 +133,7 @@ namespace vcpkg Checks::check_exit(VCPKG_LINE_INFO, sz2 + 1 == sz); ret.pop_back(); return Strings::to_utf8(ret.c_str()); -#else // ^^^ defined(_WIN32) / !defined(_WIN32) vvv +#else // ^^^ defined(_WIN32) / !defined(_WIN32) vvv auto v = getenv(varname.c_str()); if (!v) return nullopt; return std::string(v); @@ -156,7 +156,7 @@ namespace vcpkg } Checks::check_exit(VCPKG_LINE_INFO, exit_code != 0); -#else // ^^^ defined(_WIN32) / !defined(_WIN32) vvv +#else // ^^^ defined(_WIN32) / !defined(_WIN32) vvv if (auto v = value.get()) { Checks::check_exit(VCPKG_LINE_INFO, setenv(varname.c_str(), v->c_str(), 1) == 0); @@ -282,7 +282,7 @@ namespace vcpkg ret.pop_back(); // remove extra trailing null byte return Strings::to_utf8(ret); } -#else // ^^^ defined(_WIN32) / !defined(_WIN32) vvv +#else // ^^^ defined(_WIN32) / !defined(_WIN32) vvv Optional System::get_registry_string(void*, StringView, StringView) { return nullopt; } #endif // defined(_WIN32) diff --git a/src/vcpkg/commands.ci.cpp b/src/vcpkg/commands.ci.cpp index bb7cc60508..d39c3890d9 100644 --- a/src/vcpkg/commands.ci.cpp +++ b/src/vcpkg/commands.ci.cpp @@ -568,10 +568,10 @@ namespace vcpkg::Commands::CI auto& port_features = split_specs->features.at(result.spec); split_specs->known.erase(result.spec); xunitTestResults.add_test_results(result.spec.to_string(), - result.build_result.code, - result.timing, - split_specs->abi_map.at(result.spec), - port_features); + result.build_result.code, + result.timing, + split_specs->abi_map.at(result.spec), + port_features); } // Adding results for ports that were not built because they have known states @@ -579,10 +579,10 @@ namespace vcpkg::Commands::CI { auto& port_features = split_specs->features.at(port.first); xunitTestResults.add_test_results(port.first.to_string(), - port.second, - Chrono::ElapsedTime{}, - split_specs->abi_map.at(port.first), - port_features); + port.second, + Chrono::ElapsedTime{}, + split_specs->abi_map.at(port.first), + port_features); } all_known_results.emplace_back(std::move(split_specs->known)); diff --git a/src/vcpkg/commands.integrate.cpp b/src/vcpkg/commands.integrate.cpp index 484680be79..8258de1fe7 100644 --- a/src/vcpkg/commands.integrate.cpp +++ b/src/vcpkg/commands.integrate.cpp @@ -519,7 +519,7 @@ With a project open, go to Tools->NuGet Package Manager->Package Manager Console table.format("vcpkg integrate remove", "Remove user-wide integration"); table.format("vcpkg integrate project", "Generate a referencing nuget package for individual VS project use"); table.format("vcpkg integrate powershell", "Enable PowerShell tab-completion"); -#else // ^^^ defined(_WIN32) // !defined(_WIN32) vvv +#else // ^^^ defined(_WIN32) // !defined(_WIN32) vvv table.format("vcpkg integrate install", "Make installed packages available user-wide"); table.format("vcpkg integrate remove", "Remove user-wide integration"); table.format("vcpkg integrate bash", "Enable bash tab-completion"); diff --git a/src/vcpkg/metrics.cpp b/src/vcpkg/metrics.cpp index 932e2c8ec3..a5192b3c29 100644 --- a/src/vcpkg/metrics.cpp +++ b/src/vcpkg/metrics.cpp @@ -432,7 +432,7 @@ namespace vcpkg::Metrics if (request) WinHttpCloseHandle(request); if (connect) WinHttpCloseHandle(connect); if (session) WinHttpCloseHandle(session); -#else // ^^^ _WIN32 // !_WIN32 vvv +#else // ^^^ _WIN32 // !_WIN32 vvv (void)payload; #endif // ^^^ !_WIN32 } From 98f640bc040fb894d93c8bcac854641bb853248c Mon Sep 17 00:00:00 2001 From: Nicole Mazzuca Date: Tue, 30 Mar 2021 09:16:47 -0700 Subject: [PATCH 3/9] ooh, new clang-format version --- src/tls12-download.c | 2 +- src/vcpkg/base/files.cpp | 20 ++++++++++---------- src/vcpkg/base/system.cpp | 6 +++--- src/vcpkg/commands.integrate.cpp | 2 +- src/vcpkg/metrics.cpp | 2 +- 5 files changed, 16 insertions(+), 16 deletions(-) diff --git a/src/tls12-download.c b/src/tls12-download.c index 16edc54484..0a3a03fb4c 100644 --- a/src/tls12-download.c +++ b/src/tls12-download.c @@ -148,7 +148,7 @@ static void __declspec(noreturn) abort_api_failure(const HANDLE std_out, const w #ifndef NDEBUG int main() -#else // ^^^ debug // !debug vvv +#else // ^^^ debug // !debug vvv int __stdcall entry() #endif // ^^^ !debug { diff --git a/src/vcpkg/base/files.cpp b/src/vcpkg/base/files.cpp index 083e6f6545..c7169bf4c7 100644 --- a/src/vcpkg/base/files.cpp +++ b/src/vcpkg/base/files.cpp @@ -336,7 +336,7 @@ namespace vcpkg::Files return fs::file_status(ft, permissions); -#else // ^^^ defined(_WIN32) // !defined(_WIN32) vvv +#else // ^^^ defined(_WIN32) // !defined(_WIN32) vvv auto result = follow_symlinks ? fs::stdfs::status(p, ec) : fs::stdfs::symlink_status(p, ec); // libstdc++ doesn't correctly not-set ec on nonexistent paths if (ec.value() == ENOENT || ec.value() == ENOTDIR) @@ -410,7 +410,7 @@ namespace vcpkg::Files } ec.clear(); return; -#else // ^^^ defined(_WIN32) && !VCPKG_USE_STD_FILESYSTEM // !defined(_WIN32) || VCPKG_USE_STD_FILESYSTEM vvv +#else // ^^^ defined(_WIN32) && !VCPKG_USE_STD_FILESYSTEM // !defined(_WIN32) || VCPKG_USE_STD_FILESYSTEM vvv return fs::stdfs::copy_symlink(oldpath, newpath, ec); #endif // ^^^ !defined(_WIN32) || VCPKG_USE_STD_FILESYSTEM } @@ -433,7 +433,7 @@ namespace vcpkg::Files { ec.assign(GetLastError(), std::system_category()); } -#else // ^^^ defined(_WIN32) // !defined(_WIN32) vvv +#else // ^^^ defined(_WIN32) // !defined(_WIN32) vvv struct stat s; if (lstat(path.c_str(), &s)) { @@ -912,7 +912,7 @@ namespace vcpkg::Files auto written_bytes = sendfile(o_fd, i_fd, &bytes, info.st_size); #elif defined(__APPLE__) auto written_bytes = fcopyfile(i_fd, o_fd, 0, COPYFILE_ALL); -#else // ^^^ defined(__APPLE__) // !(defined(__APPLE__) || defined(__linux__)) vvv +#else // ^^^ defined(__APPLE__) // !(defined(__APPLE__) || defined(__linux__)) vvv ssize_t written_bytes = 0; { constexpr std::size_t buffer_length = 4096; @@ -1009,7 +1009,7 @@ namespace vcpkg::Files { ec.assign(GetLastError(), std::system_category()); } -#else // ^^^ defined(_WIN32) // !defined(_WIN32) vvv +#else // ^^^ defined(_WIN32) // !defined(_WIN32) vvv if (rmdir(current_path.c_str())) { ec.assign(errno, std::system_category()); @@ -1038,7 +1038,7 @@ namespace vcpkg::Files ec.assign(GetLastError(), std::system_category()); } } -#else // ^^^ defined(_WIN32) // !defined(_WIN32) vvv +#else // ^^^ defined(_WIN32) // !defined(_WIN32) vvv else { if (unlink(current_path.c_str())) @@ -1188,7 +1188,7 @@ namespace vcpkg::Files FILE* f = nullptr; #if defined(_WIN32) auto err = _wfopen_s(&f, file_path.native().c_str(), L"wb"); -#else // ^^^ defined(_WIN32) // !defined(_WIN32) vvv +#else // ^^^ defined(_WIN32) // !defined(_WIN32) vvv f = fopen(file_path.native().c_str(), "wb"); int err = f != nullptr ? 0 : 1; #endif // ^^^ !defined(_WIN32) @@ -1234,7 +1234,7 @@ namespace vcpkg::Files #if defined(_WIN32) // absolute was called system_complete in experimental filesystem return fs::stdfs::system_complete(path, ec); -#else // ^^^ defined(_WIN32) / !defined(_WIN32) vvv +#else // ^^^ defined(_WIN32) / !defined(_WIN32) vvv if (path.is_absolute()) { return path; @@ -1405,7 +1405,7 @@ namespace vcpkg::Files { #if defined(_WIN32) static constexpr wchar_t const* EXTS[] = {L".cmd", L".exe", L".bat"}; -#else // ^^^ defined(_WIN32) // !defined(_WIN32) vvv +#else // ^^^ defined(_WIN32) // !defined(_WIN32) vvv static constexpr char const* EXTS[] = {""}; #endif // ^^^!defined(_WIN32) auto paths = Strings::split_paths(System::get_environment_variable("PATH").value_or_exit(VCPKG_LINE_INFO)); @@ -1467,7 +1467,7 @@ namespace vcpkg::Files { return lhs / rhs; } -#else // ^^^ unix // windows vvv +#else // ^^^ unix // windows vvv auto rhs_root_directory = rhs.root_directory(); auto rhs_root_name = rhs.root_name(); diff --git a/src/vcpkg/base/system.cpp b/src/vcpkg/base/system.cpp index 80bb573610..ca065d2558 100644 --- a/src/vcpkg/base/system.cpp +++ b/src/vcpkg/base/system.cpp @@ -133,7 +133,7 @@ namespace vcpkg Checks::check_exit(VCPKG_LINE_INFO, sz2 + 1 == sz); ret.pop_back(); return Strings::to_utf8(ret.c_str()); -#else // ^^^ defined(_WIN32) / !defined(_WIN32) vvv +#else // ^^^ defined(_WIN32) / !defined(_WIN32) vvv auto v = getenv(varname.c_str()); if (!v) return nullopt; return std::string(v); @@ -156,7 +156,7 @@ namespace vcpkg } Checks::check_exit(VCPKG_LINE_INFO, exit_code != 0); -#else // ^^^ defined(_WIN32) / !defined(_WIN32) vvv +#else // ^^^ defined(_WIN32) / !defined(_WIN32) vvv if (auto v = value.get()) { Checks::check_exit(VCPKG_LINE_INFO, setenv(varname.c_str(), v->c_str(), 1) == 0); @@ -282,7 +282,7 @@ namespace vcpkg ret.pop_back(); // remove extra trailing null byte return Strings::to_utf8(ret); } -#else // ^^^ defined(_WIN32) / !defined(_WIN32) vvv +#else // ^^^ defined(_WIN32) / !defined(_WIN32) vvv Optional System::get_registry_string(void*, StringView, StringView) { return nullopt; } #endif // defined(_WIN32) diff --git a/src/vcpkg/commands.integrate.cpp b/src/vcpkg/commands.integrate.cpp index 8258de1fe7..484680be79 100644 --- a/src/vcpkg/commands.integrate.cpp +++ b/src/vcpkg/commands.integrate.cpp @@ -519,7 +519,7 @@ With a project open, go to Tools->NuGet Package Manager->Package Manager Console table.format("vcpkg integrate remove", "Remove user-wide integration"); table.format("vcpkg integrate project", "Generate a referencing nuget package for individual VS project use"); table.format("vcpkg integrate powershell", "Enable PowerShell tab-completion"); -#else // ^^^ defined(_WIN32) // !defined(_WIN32) vvv +#else // ^^^ defined(_WIN32) // !defined(_WIN32) vvv table.format("vcpkg integrate install", "Make installed packages available user-wide"); table.format("vcpkg integrate remove", "Remove user-wide integration"); table.format("vcpkg integrate bash", "Enable bash tab-completion"); diff --git a/src/vcpkg/metrics.cpp b/src/vcpkg/metrics.cpp index a5192b3c29..932e2c8ec3 100644 --- a/src/vcpkg/metrics.cpp +++ b/src/vcpkg/metrics.cpp @@ -432,7 +432,7 @@ namespace vcpkg::Metrics if (request) WinHttpCloseHandle(request); if (connect) WinHttpCloseHandle(connect); if (session) WinHttpCloseHandle(session); -#else // ^^^ _WIN32 // !_WIN32 vvv +#else // ^^^ _WIN32 // !_WIN32 vvv (void)payload; #endif // ^^^ !_WIN32 } From da67049fea80182a2c59ebd6feced4edb5674620 Mon Sep 17 00:00:00 2001 From: Nicole Mazzuca Date: Wed, 31 Mar 2021 09:19:01 -0700 Subject: [PATCH 4/9] add host exclusions --- src/vcpkg/commands.ci.cpp | 69 ++++++++++++++++++++++++--------------- 1 file changed, 42 insertions(+), 27 deletions(-) diff --git a/src/vcpkg/commands.ci.cpp b/src/vcpkg/commands.ci.cpp index d39c3890d9..a03e37a980 100644 --- a/src/vcpkg/commands.ci.cpp +++ b/src/vcpkg/commands.ci.cpp @@ -88,12 +88,14 @@ namespace vcpkg::Commands::CI static constexpr StringLiteral OPTION_DRY_RUN = "dry-run"; static constexpr StringLiteral OPTION_EXCLUDE = "exclude"; + static constexpr StringLiteral OPTION_HOST_EXCLUDE = "host-exclude"; static constexpr StringLiteral OPTION_FAILURE_LOGS = "failure-logs"; static constexpr StringLiteral OPTION_XUNIT = "x-xunit"; static constexpr StringLiteral OPTION_RANDOMIZE = "x-randomize"; - static constexpr std::array CI_SETTINGS = { + static constexpr std::array CI_SETTINGS = { {{OPTION_EXCLUDE, "Comma separated list of ports to skip"}, + {OPTION_HOST_EXCLUDE, "Comma separated list of ports to skip for the host triplet"}, {OPTION_XUNIT, "File to output results in XUnit format (internal)"}, {OPTION_FAILURE_LOGS, "Directory to which failure logs will be copied"}}}; @@ -291,6 +293,7 @@ namespace vcpkg::Commands::CI static std::unique_ptr find_unknown_ports_for_ci( const VcpkgPaths& paths, const std::set& exclusions, + const std::set& host_exclusions, const PortFileProvider::PortFileProvider& provider, const CMakeVars::CMakeVarProvider& var_provider, const std::vector& specs, @@ -300,6 +303,17 @@ namespace vcpkg::Commands::CI { auto ret = std::make_unique(); + auto is_excluded = [&](const PackageSpec& spec) -> bool { + if (spec.triplet() == host_triplet) + { + return Util::Sets::contains(host_exclusions, spec.name()); + } + else + { + return Util::Sets::contains(exclusions, spec.name()); + } + }; + std::set will_fail; std::vector packages_with_qualified_deps; @@ -340,6 +354,8 @@ namespace vcpkg::Commands::CI for (auto&& action : action_plan.install_actions) { + action.build_options = vcpkg::Build::backcompat_prohibiting_package_options; + auto p = &action; ret->abi_map.emplace(action.spec, action.abi_info.value_or_exit(VCPKG_LINE_INFO).package_abi); ret->features.emplace(action.spec, action.feature_list); @@ -349,11 +365,12 @@ namespace vcpkg::Commands::CI std::string state; - if (Util::Sets::contains(exclusions, p->spec.name())) + if (is_excluded(p->spec)) { state = "skip"; ret->known.emplace(p->spec, BuildResult::EXCLUDED); will_fail.emplace(p->spec); + action.plan_type = InstallPlanType::EXCLUDED; } else if (!supported_for_triplet(var_provider, p)) { @@ -424,6 +441,21 @@ namespace vcpkg::Commands::CI return ret; } + static std::set parse_exclusions(const ParsedArguments& options, StringLiteral opt) + { + std::set exclusions_set; + auto it_exclusions = options.settings.find(OPTION_EXCLUDE); + if (it_exclusions != options.settings.end()) + { + auto exclusions = Strings::split(it_exclusions->second, ','); + exclusions_set.insert( + std::make_move_iterator(exclusions.begin()), + std::make_move_iterator(exclusions.end())); + } + + return exclusions_set; + } + void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths, Triplet default_triplet, @@ -439,25 +471,19 @@ namespace vcpkg::Commands::CI IBinaryProvider& binaryprovider = binaryproviderStorage ? *binaryproviderStorage : null_binary_provider(); - const ParsedArguments options = args.parse_arguments(COMMAND_STRUCTURE); - auto& settings = options.settings; - - std::set exclusions_set; - auto it_exclusions = settings.find(OPTION_EXCLUDE); - if (it_exclusions != settings.end()) - { - auto exclusions = Strings::split(it_exclusions->second, ','); - exclusions_set.insert(exclusions.begin(), exclusions.end()); - } - - const auto is_dry_run = Util::Sets::contains(options.switches, OPTION_DRY_RUN); - if (args.command_arguments.size() != 1) { Checks::unreachable(VCPKG_LINE_INFO); // this should not be possible at this place } + const ParsedArguments options = args.parse_arguments(COMMAND_STRUCTURE); + const auto& settings = options.settings; + Triplet target_triplet = Triplet::from_canonical_name(std::string(args.command_arguments[0])); + auto exclusions_set = parse_exclusions(options, OPTION_EXCLUDE); + auto host_exclusions_set = parse_exclusions(options, OPTION_HOST_EXCLUDE); + + const auto is_dry_run = Util::Sets::contains(options.switches, OPTION_DRY_RUN); auto& filesystem = paths.get_filesystem(); Optional build_logs_recorder_storage; @@ -524,6 +550,7 @@ namespace vcpkg::Commands::CI auto split_specs = find_unknown_ports_for_ci(paths, exclusions_set, + host_exclusions_set, provider, var_provider, all_default_full_specs, @@ -533,18 +560,6 @@ namespace vcpkg::Commands::CI auto& action_plan = split_specs->plan; - for (auto&& action : action_plan.install_actions) - { - if (action.spec.triplet() == target_triplet && Util::Sets::contains(exclusions_set, action.spec.name())) - { - action.plan_type = InstallPlanType::EXCLUDED; - } - else - { - action.build_options = vcpkg::Build::backcompat_prohibiting_package_options; - } - } - if (is_dry_run) { Dependencies::print_plan(action_plan, true, paths.builtin_ports_directory()); From 84b6c0c47f627fda8a53f28475cfd3ae3590caeb Mon Sep 17 00:00:00 2001 From: Nicole Mazzuca Date: Wed, 31 Mar 2021 09:41:56 -0700 Subject: [PATCH 5/9] format! --- src/tls12-download.c | 2 +- src/vcpkg/base/files.cpp | 20 ++++++++++---------- src/vcpkg/base/system.cpp | 6 +++--- src/vcpkg/commands.ci.cpp | 5 ++--- src/vcpkg/commands.integrate.cpp | 2 +- src/vcpkg/metrics.cpp | 2 +- 6 files changed, 18 insertions(+), 19 deletions(-) diff --git a/src/tls12-download.c b/src/tls12-download.c index 0a3a03fb4c..16edc54484 100644 --- a/src/tls12-download.c +++ b/src/tls12-download.c @@ -148,7 +148,7 @@ static void __declspec(noreturn) abort_api_failure(const HANDLE std_out, const w #ifndef NDEBUG int main() -#else // ^^^ debug // !debug vvv +#else // ^^^ debug // !debug vvv int __stdcall entry() #endif // ^^^ !debug { diff --git a/src/vcpkg/base/files.cpp b/src/vcpkg/base/files.cpp index c7169bf4c7..083e6f6545 100644 --- a/src/vcpkg/base/files.cpp +++ b/src/vcpkg/base/files.cpp @@ -336,7 +336,7 @@ namespace vcpkg::Files return fs::file_status(ft, permissions); -#else // ^^^ defined(_WIN32) // !defined(_WIN32) vvv +#else // ^^^ defined(_WIN32) // !defined(_WIN32) vvv auto result = follow_symlinks ? fs::stdfs::status(p, ec) : fs::stdfs::symlink_status(p, ec); // libstdc++ doesn't correctly not-set ec on nonexistent paths if (ec.value() == ENOENT || ec.value() == ENOTDIR) @@ -410,7 +410,7 @@ namespace vcpkg::Files } ec.clear(); return; -#else // ^^^ defined(_WIN32) && !VCPKG_USE_STD_FILESYSTEM // !defined(_WIN32) || VCPKG_USE_STD_FILESYSTEM vvv +#else // ^^^ defined(_WIN32) && !VCPKG_USE_STD_FILESYSTEM // !defined(_WIN32) || VCPKG_USE_STD_FILESYSTEM vvv return fs::stdfs::copy_symlink(oldpath, newpath, ec); #endif // ^^^ !defined(_WIN32) || VCPKG_USE_STD_FILESYSTEM } @@ -433,7 +433,7 @@ namespace vcpkg::Files { ec.assign(GetLastError(), std::system_category()); } -#else // ^^^ defined(_WIN32) // !defined(_WIN32) vvv +#else // ^^^ defined(_WIN32) // !defined(_WIN32) vvv struct stat s; if (lstat(path.c_str(), &s)) { @@ -912,7 +912,7 @@ namespace vcpkg::Files auto written_bytes = sendfile(o_fd, i_fd, &bytes, info.st_size); #elif defined(__APPLE__) auto written_bytes = fcopyfile(i_fd, o_fd, 0, COPYFILE_ALL); -#else // ^^^ defined(__APPLE__) // !(defined(__APPLE__) || defined(__linux__)) vvv +#else // ^^^ defined(__APPLE__) // !(defined(__APPLE__) || defined(__linux__)) vvv ssize_t written_bytes = 0; { constexpr std::size_t buffer_length = 4096; @@ -1009,7 +1009,7 @@ namespace vcpkg::Files { ec.assign(GetLastError(), std::system_category()); } -#else // ^^^ defined(_WIN32) // !defined(_WIN32) vvv +#else // ^^^ defined(_WIN32) // !defined(_WIN32) vvv if (rmdir(current_path.c_str())) { ec.assign(errno, std::system_category()); @@ -1038,7 +1038,7 @@ namespace vcpkg::Files ec.assign(GetLastError(), std::system_category()); } } -#else // ^^^ defined(_WIN32) // !defined(_WIN32) vvv +#else // ^^^ defined(_WIN32) // !defined(_WIN32) vvv else { if (unlink(current_path.c_str())) @@ -1188,7 +1188,7 @@ namespace vcpkg::Files FILE* f = nullptr; #if defined(_WIN32) auto err = _wfopen_s(&f, file_path.native().c_str(), L"wb"); -#else // ^^^ defined(_WIN32) // !defined(_WIN32) vvv +#else // ^^^ defined(_WIN32) // !defined(_WIN32) vvv f = fopen(file_path.native().c_str(), "wb"); int err = f != nullptr ? 0 : 1; #endif // ^^^ !defined(_WIN32) @@ -1234,7 +1234,7 @@ namespace vcpkg::Files #if defined(_WIN32) // absolute was called system_complete in experimental filesystem return fs::stdfs::system_complete(path, ec); -#else // ^^^ defined(_WIN32) / !defined(_WIN32) vvv +#else // ^^^ defined(_WIN32) / !defined(_WIN32) vvv if (path.is_absolute()) { return path; @@ -1405,7 +1405,7 @@ namespace vcpkg::Files { #if defined(_WIN32) static constexpr wchar_t const* EXTS[] = {L".cmd", L".exe", L".bat"}; -#else // ^^^ defined(_WIN32) // !defined(_WIN32) vvv +#else // ^^^ defined(_WIN32) // !defined(_WIN32) vvv static constexpr char const* EXTS[] = {""}; #endif // ^^^!defined(_WIN32) auto paths = Strings::split_paths(System::get_environment_variable("PATH").value_or_exit(VCPKG_LINE_INFO)); @@ -1467,7 +1467,7 @@ namespace vcpkg::Files { return lhs / rhs; } -#else // ^^^ unix // windows vvv +#else // ^^^ unix // windows vvv auto rhs_root_directory = rhs.root_directory(); auto rhs_root_name = rhs.root_name(); diff --git a/src/vcpkg/base/system.cpp b/src/vcpkg/base/system.cpp index ca065d2558..80bb573610 100644 --- a/src/vcpkg/base/system.cpp +++ b/src/vcpkg/base/system.cpp @@ -133,7 +133,7 @@ namespace vcpkg Checks::check_exit(VCPKG_LINE_INFO, sz2 + 1 == sz); ret.pop_back(); return Strings::to_utf8(ret.c_str()); -#else // ^^^ defined(_WIN32) / !defined(_WIN32) vvv +#else // ^^^ defined(_WIN32) / !defined(_WIN32) vvv auto v = getenv(varname.c_str()); if (!v) return nullopt; return std::string(v); @@ -156,7 +156,7 @@ namespace vcpkg } Checks::check_exit(VCPKG_LINE_INFO, exit_code != 0); -#else // ^^^ defined(_WIN32) / !defined(_WIN32) vvv +#else // ^^^ defined(_WIN32) / !defined(_WIN32) vvv if (auto v = value.get()) { Checks::check_exit(VCPKG_LINE_INFO, setenv(varname.c_str(), v->c_str(), 1) == 0); @@ -282,7 +282,7 @@ namespace vcpkg ret.pop_back(); // remove extra trailing null byte return Strings::to_utf8(ret); } -#else // ^^^ defined(_WIN32) / !defined(_WIN32) vvv +#else // ^^^ defined(_WIN32) / !defined(_WIN32) vvv Optional System::get_registry_string(void*, StringView, StringView) { return nullopt; } #endif // defined(_WIN32) diff --git a/src/vcpkg/commands.ci.cpp b/src/vcpkg/commands.ci.cpp index a03e37a980..d7613ec039 100644 --- a/src/vcpkg/commands.ci.cpp +++ b/src/vcpkg/commands.ci.cpp @@ -448,9 +448,8 @@ namespace vcpkg::Commands::CI if (it_exclusions != options.settings.end()) { auto exclusions = Strings::split(it_exclusions->second, ','); - exclusions_set.insert( - std::make_move_iterator(exclusions.begin()), - std::make_move_iterator(exclusions.end())); + exclusions_set.insert(std::make_move_iterator(exclusions.begin()), + std::make_move_iterator(exclusions.end())); } return exclusions_set; diff --git a/src/vcpkg/commands.integrate.cpp b/src/vcpkg/commands.integrate.cpp index 484680be79..8258de1fe7 100644 --- a/src/vcpkg/commands.integrate.cpp +++ b/src/vcpkg/commands.integrate.cpp @@ -519,7 +519,7 @@ With a project open, go to Tools->NuGet Package Manager->Package Manager Console table.format("vcpkg integrate remove", "Remove user-wide integration"); table.format("vcpkg integrate project", "Generate a referencing nuget package for individual VS project use"); table.format("vcpkg integrate powershell", "Enable PowerShell tab-completion"); -#else // ^^^ defined(_WIN32) // !defined(_WIN32) vvv +#else // ^^^ defined(_WIN32) // !defined(_WIN32) vvv table.format("vcpkg integrate install", "Make installed packages available user-wide"); table.format("vcpkg integrate remove", "Remove user-wide integration"); table.format("vcpkg integrate bash", "Enable bash tab-completion"); diff --git a/src/vcpkg/metrics.cpp b/src/vcpkg/metrics.cpp index 932e2c8ec3..a5192b3c29 100644 --- a/src/vcpkg/metrics.cpp +++ b/src/vcpkg/metrics.cpp @@ -432,7 +432,7 @@ namespace vcpkg::Metrics if (request) WinHttpCloseHandle(request); if (connect) WinHttpCloseHandle(connect); if (session) WinHttpCloseHandle(session); -#else // ^^^ _WIN32 // !_WIN32 vvv +#else // ^^^ _WIN32 // !_WIN32 vvv (void)payload; #endif // ^^^ !_WIN32 } From 811f74eb364efd597814f96ec35cde3b826c9300 Mon Sep 17 00:00:00 2001 From: Nicole Mazzuca Date: Thu, 1 Apr 2021 09:26:11 -0700 Subject: [PATCH 6/9] oops --- src/vcpkg/commands.ci.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/vcpkg/commands.ci.cpp b/src/vcpkg/commands.ci.cpp index d7613ec039..66881d3696 100644 --- a/src/vcpkg/commands.ci.cpp +++ b/src/vcpkg/commands.ci.cpp @@ -444,7 +444,7 @@ namespace vcpkg::Commands::CI static std::set parse_exclusions(const ParsedArguments& options, StringLiteral opt) { std::set exclusions_set; - auto it_exclusions = options.settings.find(OPTION_EXCLUDE); + auto it_exclusions = options.settings.find(opt); if (it_exclusions != options.settings.end()) { auto exclusions = Strings::split(it_exclusions->second, ','); From 2a2e96af98a5e0838af0b4a23d18d40a07b64d16 Mon Sep 17 00:00:00 2001 From: Nicole Mazzuca Date: Thu, 1 Apr 2021 09:51:25 -0700 Subject: [PATCH 7/9] format with the right clang-format --- src/tls12-download.c | 2 +- src/vcpkg/base/files.cpp | 20 ++++++++++---------- src/vcpkg/base/system.cpp | 6 +++--- src/vcpkg/commands.integrate.cpp | 2 +- src/vcpkg/metrics.cpp | 2 +- 5 files changed, 16 insertions(+), 16 deletions(-) diff --git a/src/tls12-download.c b/src/tls12-download.c index 16edc54484..0a3a03fb4c 100644 --- a/src/tls12-download.c +++ b/src/tls12-download.c @@ -148,7 +148,7 @@ static void __declspec(noreturn) abort_api_failure(const HANDLE std_out, const w #ifndef NDEBUG int main() -#else // ^^^ debug // !debug vvv +#else // ^^^ debug // !debug vvv int __stdcall entry() #endif // ^^^ !debug { diff --git a/src/vcpkg/base/files.cpp b/src/vcpkg/base/files.cpp index 083e6f6545..c7169bf4c7 100644 --- a/src/vcpkg/base/files.cpp +++ b/src/vcpkg/base/files.cpp @@ -336,7 +336,7 @@ namespace vcpkg::Files return fs::file_status(ft, permissions); -#else // ^^^ defined(_WIN32) // !defined(_WIN32) vvv +#else // ^^^ defined(_WIN32) // !defined(_WIN32) vvv auto result = follow_symlinks ? fs::stdfs::status(p, ec) : fs::stdfs::symlink_status(p, ec); // libstdc++ doesn't correctly not-set ec on nonexistent paths if (ec.value() == ENOENT || ec.value() == ENOTDIR) @@ -410,7 +410,7 @@ namespace vcpkg::Files } ec.clear(); return; -#else // ^^^ defined(_WIN32) && !VCPKG_USE_STD_FILESYSTEM // !defined(_WIN32) || VCPKG_USE_STD_FILESYSTEM vvv +#else // ^^^ defined(_WIN32) && !VCPKG_USE_STD_FILESYSTEM // !defined(_WIN32) || VCPKG_USE_STD_FILESYSTEM vvv return fs::stdfs::copy_symlink(oldpath, newpath, ec); #endif // ^^^ !defined(_WIN32) || VCPKG_USE_STD_FILESYSTEM } @@ -433,7 +433,7 @@ namespace vcpkg::Files { ec.assign(GetLastError(), std::system_category()); } -#else // ^^^ defined(_WIN32) // !defined(_WIN32) vvv +#else // ^^^ defined(_WIN32) // !defined(_WIN32) vvv struct stat s; if (lstat(path.c_str(), &s)) { @@ -912,7 +912,7 @@ namespace vcpkg::Files auto written_bytes = sendfile(o_fd, i_fd, &bytes, info.st_size); #elif defined(__APPLE__) auto written_bytes = fcopyfile(i_fd, o_fd, 0, COPYFILE_ALL); -#else // ^^^ defined(__APPLE__) // !(defined(__APPLE__) || defined(__linux__)) vvv +#else // ^^^ defined(__APPLE__) // !(defined(__APPLE__) || defined(__linux__)) vvv ssize_t written_bytes = 0; { constexpr std::size_t buffer_length = 4096; @@ -1009,7 +1009,7 @@ namespace vcpkg::Files { ec.assign(GetLastError(), std::system_category()); } -#else // ^^^ defined(_WIN32) // !defined(_WIN32) vvv +#else // ^^^ defined(_WIN32) // !defined(_WIN32) vvv if (rmdir(current_path.c_str())) { ec.assign(errno, std::system_category()); @@ -1038,7 +1038,7 @@ namespace vcpkg::Files ec.assign(GetLastError(), std::system_category()); } } -#else // ^^^ defined(_WIN32) // !defined(_WIN32) vvv +#else // ^^^ defined(_WIN32) // !defined(_WIN32) vvv else { if (unlink(current_path.c_str())) @@ -1188,7 +1188,7 @@ namespace vcpkg::Files FILE* f = nullptr; #if defined(_WIN32) auto err = _wfopen_s(&f, file_path.native().c_str(), L"wb"); -#else // ^^^ defined(_WIN32) // !defined(_WIN32) vvv +#else // ^^^ defined(_WIN32) // !defined(_WIN32) vvv f = fopen(file_path.native().c_str(), "wb"); int err = f != nullptr ? 0 : 1; #endif // ^^^ !defined(_WIN32) @@ -1234,7 +1234,7 @@ namespace vcpkg::Files #if defined(_WIN32) // absolute was called system_complete in experimental filesystem return fs::stdfs::system_complete(path, ec); -#else // ^^^ defined(_WIN32) / !defined(_WIN32) vvv +#else // ^^^ defined(_WIN32) / !defined(_WIN32) vvv if (path.is_absolute()) { return path; @@ -1405,7 +1405,7 @@ namespace vcpkg::Files { #if defined(_WIN32) static constexpr wchar_t const* EXTS[] = {L".cmd", L".exe", L".bat"}; -#else // ^^^ defined(_WIN32) // !defined(_WIN32) vvv +#else // ^^^ defined(_WIN32) // !defined(_WIN32) vvv static constexpr char const* EXTS[] = {""}; #endif // ^^^!defined(_WIN32) auto paths = Strings::split_paths(System::get_environment_variable("PATH").value_or_exit(VCPKG_LINE_INFO)); @@ -1467,7 +1467,7 @@ namespace vcpkg::Files { return lhs / rhs; } -#else // ^^^ unix // windows vvv +#else // ^^^ unix // windows vvv auto rhs_root_directory = rhs.root_directory(); auto rhs_root_name = rhs.root_name(); diff --git a/src/vcpkg/base/system.cpp b/src/vcpkg/base/system.cpp index 80bb573610..ca065d2558 100644 --- a/src/vcpkg/base/system.cpp +++ b/src/vcpkg/base/system.cpp @@ -133,7 +133,7 @@ namespace vcpkg Checks::check_exit(VCPKG_LINE_INFO, sz2 + 1 == sz); ret.pop_back(); return Strings::to_utf8(ret.c_str()); -#else // ^^^ defined(_WIN32) / !defined(_WIN32) vvv +#else // ^^^ defined(_WIN32) / !defined(_WIN32) vvv auto v = getenv(varname.c_str()); if (!v) return nullopt; return std::string(v); @@ -156,7 +156,7 @@ namespace vcpkg } Checks::check_exit(VCPKG_LINE_INFO, exit_code != 0); -#else // ^^^ defined(_WIN32) / !defined(_WIN32) vvv +#else // ^^^ defined(_WIN32) / !defined(_WIN32) vvv if (auto v = value.get()) { Checks::check_exit(VCPKG_LINE_INFO, setenv(varname.c_str(), v->c_str(), 1) == 0); @@ -282,7 +282,7 @@ namespace vcpkg ret.pop_back(); // remove extra trailing null byte return Strings::to_utf8(ret); } -#else // ^^^ defined(_WIN32) / !defined(_WIN32) vvv +#else // ^^^ defined(_WIN32) / !defined(_WIN32) vvv Optional System::get_registry_string(void*, StringView, StringView) { return nullopt; } #endif // defined(_WIN32) diff --git a/src/vcpkg/commands.integrate.cpp b/src/vcpkg/commands.integrate.cpp index 8258de1fe7..484680be79 100644 --- a/src/vcpkg/commands.integrate.cpp +++ b/src/vcpkg/commands.integrate.cpp @@ -519,7 +519,7 @@ With a project open, go to Tools->NuGet Package Manager->Package Manager Console table.format("vcpkg integrate remove", "Remove user-wide integration"); table.format("vcpkg integrate project", "Generate a referencing nuget package for individual VS project use"); table.format("vcpkg integrate powershell", "Enable PowerShell tab-completion"); -#else // ^^^ defined(_WIN32) // !defined(_WIN32) vvv +#else // ^^^ defined(_WIN32) // !defined(_WIN32) vvv table.format("vcpkg integrate install", "Make installed packages available user-wide"); table.format("vcpkg integrate remove", "Remove user-wide integration"); table.format("vcpkg integrate bash", "Enable bash tab-completion"); diff --git a/src/vcpkg/metrics.cpp b/src/vcpkg/metrics.cpp index a5192b3c29..932e2c8ec3 100644 --- a/src/vcpkg/metrics.cpp +++ b/src/vcpkg/metrics.cpp @@ -432,7 +432,7 @@ namespace vcpkg::Metrics if (request) WinHttpCloseHandle(request); if (connect) WinHttpCloseHandle(connect); if (session) WinHttpCloseHandle(session); -#else // ^^^ _WIN32 // !_WIN32 vvv +#else // ^^^ _WIN32 // !_WIN32 vvv (void)payload; #endif // ^^^ !_WIN32 } From 540569859a7d1bd73194a846ccaea77c24de8914 Mon Sep 17 00:00:00 2001 From: nicole mazzuca Date: Wed, 7 Apr 2021 15:22:50 -0700 Subject: [PATCH 8/9] Apply suggestions from code review Co-authored-by: ras0219 <533828+ras0219@users.noreply.github.com> --- src/vcpkg/commands.ci.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/vcpkg/commands.ci.cpp b/src/vcpkg/commands.ci.cpp index 66881d3696..13d4f54e15 100644 --- a/src/vcpkg/commands.ci.cpp +++ b/src/vcpkg/commands.ci.cpp @@ -457,10 +457,9 @@ namespace vcpkg::Commands::CI void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths, - Triplet default_triplet, + Triplet, Triplet host_triplet) { - (void)default_triplet; std::unique_ptr binaryproviderStorage; if (args.binary_caching_enabled()) { @@ -472,7 +471,7 @@ namespace vcpkg::Commands::CI if (args.command_arguments.size() != 1) { - Checks::unreachable(VCPKG_LINE_INFO); // this should not be possible at this place + Checks::unreachable(VCPKG_LINE_INFO); } const ParsedArguments options = args.parse_arguments(COMMAND_STRUCTURE); From 48f8b3c744b3de552e5d94f94b7055108fbbb9ea Mon Sep 17 00:00:00 2001 From: Nicole Mazzuca Date: Wed, 7 Apr 2021 17:16:58 -0700 Subject: [PATCH 9/9] format --- src/vcpkg/commands.ci.cpp | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/vcpkg/commands.ci.cpp b/src/vcpkg/commands.ci.cpp index 13d4f54e15..05cfea63ea 100644 --- a/src/vcpkg/commands.ci.cpp +++ b/src/vcpkg/commands.ci.cpp @@ -455,10 +455,7 @@ namespace vcpkg::Commands::CI return exclusions_set; } - void perform_and_exit(const VcpkgCmdArguments& args, - const VcpkgPaths& paths, - Triplet, - Triplet host_triplet) + void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths, Triplet, Triplet host_triplet) { std::unique_ptr binaryproviderStorage; if (args.binary_caching_enabled())