@@ -93,14 +93,17 @@ namespace vcpkg::Commands::CI
93
93
static constexpr StringLiteral OPTION_XUNIT = " x-xunit" ;
94
94
static constexpr StringLiteral OPTION_RANDOMIZE = " x-randomize" ;
95
95
static constexpr StringLiteral OPTION_OUTPUT_HASHES = " output-hashes" ;
96
+ static constexpr StringLiteral OPTION_PARENT_HASHES = " parent-hashes" ;
96
97
static constexpr StringLiteral OPTION_SKIPPED_CASCADE_COUNT = " x-skipped-cascade-count" ;
97
98
98
- static constexpr std::array<CommandSetting, 6 > CI_SETTINGS = {
99
+ static constexpr std::array<CommandSetting, 7 > CI_SETTINGS = {
99
100
{{OPTION_EXCLUDE, " Comma separated list of ports to skip" },
100
101
{OPTION_HOST_EXCLUDE, " Comma separated list of ports to skip for the host triplet" },
101
102
{OPTION_XUNIT, " File to output results in XUnit format (internal)" },
102
103
{OPTION_FAILURE_LOGS, " Directory to which failure logs will be copied" },
103
104
{OPTION_OUTPUT_HASHES, " File to output all determined package hashes" },
105
+ {OPTION_PARENT_HASHES,
106
+ " File to read package hashes for a parent CI state, to reduce the set of changed packages" },
104
107
{OPTION_SKIPPED_CASCADE_COUNT,
105
108
" Asserts that the number of --exclude and supports skips exactly equal this number" }}};
106
109
@@ -404,13 +407,16 @@ namespace vcpkg::Commands::CI
404
407
405
408
// This algorithm reduces an action plan to only unknown actions and their dependencies
406
409
static void reduce_action_plan (Dependencies::ActionPlan& action_plan,
407
- const std::map<PackageSpec, Build::BuildResult>& known)
410
+ const std::map<PackageSpec, Build::BuildResult>& known,
411
+ View<std::string> parent_hashes)
408
412
{
409
413
std::set<PackageSpec> to_keep;
410
414
for (auto it = action_plan.install_actions .rbegin (); it != action_plan.install_actions .rend (); ++it)
411
415
{
412
416
auto it_known = known.find (it->spec );
413
- if (it_known == known.end ())
417
+ const auto & abi = it->abi_info .value_or_exit (VCPKG_LINE_INFO).package_abi ;
418
+ auto it_parent = std::find (parent_hashes.begin (), parent_hashes.end (), abi);
419
+ if (it_known == known.end () && it_parent == parent_hashes.end ())
414
420
{
415
421
to_keep.insert (it->spec );
416
422
}
@@ -421,8 +427,11 @@ namespace vcpkg::Commands::CI
421
427
{
422
428
it->plan_type = InstallPlanType::EXCLUDED;
423
429
}
424
- it->build_options = vcpkg::Build::backcompat_prohibiting_package_options;
425
- to_keep.insert (it->package_dependencies .begin (), it->package_dependencies .end ());
430
+ else
431
+ {
432
+ it->build_options = vcpkg::Build::backcompat_prohibiting_package_options;
433
+ to_keep.insert (it->package_dependencies .begin (), it->package_dependencies .end ());
434
+ }
426
435
}
427
436
}
428
437
@@ -580,7 +589,24 @@ namespace vcpkg::Commands::CI
580
589
}
581
590
}
582
591
583
- reduce_action_plan (action_plan, split_specs->known );
592
+ std::vector<std::string> parent_hashes;
593
+
594
+ auto it_parent_hashes = settings.find (OPTION_PARENT_HASHES);
595
+ if (it_parent_hashes != settings.end ())
596
+ {
597
+ const Path parent_hashes_path = paths.original_cwd / it_parent_hashes->second ;
598
+ auto parsed_json = Json::parse_file (VCPKG_LINE_INFO, filesystem, parent_hashes_path);
599
+ parent_hashes = Util::fmap (parsed_json.first .array (), [](const auto & json_object) {
600
+ auto abi = json_object.object ().get (" abi" );
601
+ Checks::check_exit (VCPKG_LINE_INFO, abi);
602
+ #ifdef _MSC_VER
603
+ _Analysis_assume_ (abi);
604
+ #endif
605
+ return abi->string ().to_string ();
606
+ });
607
+ }
608
+
609
+ reduce_action_plan (action_plan, split_specs->known , parent_hashes);
584
610
585
611
vcpkg::printf (" Time to determine pass/fail: %s\n " , timer.elapsed ());
586
612
0 commit comments