@@ -226,8 +226,7 @@ namespace
226226
227227 if (Util::Sets::contains (to_keep, it->spec ))
228228 {
229- if (it_known != known.end () &&
230- (it_known->second == BuildResult::Excluded || it_known->second == BuildResult::Unsupported))
229+ if (it_known->second == BuildResult::Excluded || it_known->second == BuildResult::Unsupported)
231230 {
232231 it->plan_type = InstallPlanType::EXCLUDED;
233232 }
@@ -282,7 +281,7 @@ namespace
282281 return has_error;
283282 }
284283
285- std::vector<PackageSpec> calculate_packages_with_qualified_deps (
284+ std::vector<PackageSpec> calculate_packages_with_qualifiers (
286285 const std::vector<const SourceControlFileAndLocation*>& all_control_files, const Triplet& target_triplet)
287286 {
288287 std::vector<PackageSpec> ret;
@@ -309,29 +308,24 @@ namespace
309308 // it is too late as we have already calculated an action plan with feature dependencies from
310309 // the skipped ports.
311310 CiSpecsResult result;
312- const TripletExclusions* target_triplet_exclusions = nullptr ;
313- for (auto && te : exclusions_map.triplets )
314- {
315- if (te.triplet == target_triplet)
316- {
317- target_triplet_exclusions = &te;
318- break ;
319- }
320- }
321-
311+ auto it = Util::find_if (exclusions_map.triplets , [&](const TripletExclusions& exclusions) {
312+ return exclusions.triplet == target_triplet;
313+ });
314+ const SortedVector<std::string>* const target_triplet_exclusions =
315+ it == exclusions_map.triplets .end () ? nullptr : &it->exclusions ;
322316 auto all_control_files = provider.load_all_control_files ();
323317
324318 // populate `var_provider` to evaluate supports expressions for all ports:
325319 std::vector<PackageSpec> packages_with_qualified_deps =
326- calculate_packages_with_qualified_deps (all_control_files, target_triplet);
320+ calculate_packages_with_qualifiers (all_control_files, target_triplet);
327321 var_provider.load_dep_info_vars (packages_with_qualified_deps, serialize_options.host_triplet );
328322
329323 for (auto scfl : all_control_files)
330324 {
331325 auto full_package_spec =
332326 FullPackageSpec{PackageSpec{scfl->to_name (), target_triplet},
333327 InternalFeatureSet{FeatureNameCore.to_string (), FeatureNameDefault.to_string ()}};
334- if (target_triplet_exclusions && target_triplet_exclusions->exclusions . contains (scfl->to_name ()))
328+ if (target_triplet_exclusions && target_triplet_exclusions->contains (scfl->to_name ()))
335329 {
336330 result.excluded .insert_or_assign (std::move (full_package_spec.package_spec ), ExcludeReason::Baseline);
337331 continue ;
@@ -367,6 +361,30 @@ namespace
367361
368362 std::random_device e;
369363 };
364+
365+ std::unordered_set<std::string> parse_parent_hashes (
366+ const std::map<vcpkg::StringLiteral, std::string, std::less<void >>& settings, const VcpkgPaths& paths)
367+ {
368+ std::unordered_set<std::string> parent_hashes;
369+ const auto & fs = paths.get_filesystem ();
370+ auto it_parent_hashes = settings.find (SwitchParentHashes);
371+ if (it_parent_hashes != settings.end ())
372+ {
373+ const Path parent_hashes_path = paths.original_cwd / it_parent_hashes->second ;
374+ auto parent_hashes_text = fs.try_read_contents (parent_hashes_path).value_or_exit (VCPKG_LINE_INFO);
375+ const auto parsed_object =
376+ Json::parse (parent_hashes_text.content , parent_hashes_text.origin ).value_or_exit (VCPKG_LINE_INFO);
377+ const auto & parent_hashes_array = parsed_object.value .array (VCPKG_LINE_INFO);
378+ for (const Json::Value& array_value : parent_hashes_array)
379+ {
380+ auto abi = array_value.object (VCPKG_LINE_INFO).get (JsonIdAbi);
381+ Checks::check_exit (VCPKG_LINE_INFO, abi);
382+ parent_hashes.insert (abi->string (VCPKG_LINE_INFO).to_string ());
383+ }
384+ }
385+
386+ return parent_hashes;
387+ }
370388} // unnamed namespace
371389
372390namespace vcpkg
@@ -439,25 +457,8 @@ namespace vcpkg
439457 known_failure_abis.insert (std::make_move_iterator (lines.begin ()), std::make_move_iterator (lines.end ()));
440458 }
441459
442- std::unordered_set<std::string> parent_hashes;
443- auto it_parent_hashes = settings.find (SwitchParentHashes);
444- if (it_parent_hashes != settings.end ())
445- {
446- const Path parent_hashes_path = paths.original_cwd / it_parent_hashes->second ;
447- auto parent_hashes_text = fs.try_read_contents (parent_hashes_path).value_or_exit (VCPKG_LINE_INFO);
448- const auto parsed_object =
449- Json::parse (parent_hashes_text.content , parent_hashes_text.origin ).value_or_exit (VCPKG_LINE_INFO);
450- const auto & parent_hashes_array = parsed_object.value .array (VCPKG_LINE_INFO);
451- for (const Json::Value& array_value : parent_hashes_array)
452- {
453- auto abi = array_value.object (VCPKG_LINE_INFO).get (JsonIdAbi);
454- Checks::check_exit (VCPKG_LINE_INFO, abi);
455- parent_hashes.insert (abi->string (VCPKG_LINE_INFO).to_string ());
456- }
457- }
458-
460+ const std::unordered_set<std::string> parent_hashes = parse_parent_hashes (settings, paths);
459461 const auto is_dry_run = Util::Sets::contains (options.switches , SwitchDryRun);
460-
461462 const IBuildLogsRecorder* build_logs_recorder = &null_build_logs_recorder;
462463 Optional<CiBuildLogsRecorder> build_logs_recorder_storage;
463464 {
@@ -569,11 +570,10 @@ namespace vcpkg
569570 ci_full_results.insert_or_assign (result.get_spec (), std::move (ci_result));
570571 }
571572 }
572-
573- binary_cache.wait_for_async_complete_and_join ();
574- msg::println ();
575573 }
576574
575+ binary_cache.wait_for_async_complete_and_join ();
576+ msg::println ();
577577 std::map<Triplet, BuildResultCounts> summary_counts;
578578 auto summary_report = msg::format (msgTripletLabel).data ();
579579 summary_report.push_back (' ' );
0 commit comments