@@ -2376,140 +2376,166 @@ namespace vcpkg
23762376
23772377 ZipTool zip_tool;
23782378 zip_tool.setup (tools, out_sink);
2379- for (auto & config : s.binary_providers ) {
2380- auto ok = std::visit ([&](auto && c) {
2381- using T = std::decay_t <decltype (c)>;
2382- if constexpr (std::is_same_v<T, FilesBinaryProviderConfig>) {
2383- for (auto && dir : c.archives_to_read )
2384- {
2385- m_config.read .push_back (std::make_unique<FilesReadBinaryProvider>(zip_tool, fs, std::move (dir)));
2386- }
2387- if (!c.archives_to_write .empty ())
2388- {
2389- m_config.write .push_back (std::make_unique<FilesWriteBinaryProvider>(fs, std::move (c.archives_to_write )));
2390- }
2391- } else if constexpr (std::is_same_v<T, HttpBinaryProviderConfig>) {
2392- for (auto && url : c.url_templates_to_get )
2379+ for (auto & config : s.binary_providers )
2380+ {
2381+ auto ok = std::visit (
2382+ [&](auto && c) {
2383+ using T = std::decay_t <decltype (c)>;
2384+ if constexpr (std::is_same_v<T, FilesBinaryProviderConfig>)
23932385 {
2394- m_config.read .push_back (
2395- std::make_unique<HttpGetBinaryProvider>(zip_tool, fs, buildtrees, std::move (url), c.secrets ));
2386+ for (auto && dir : c.archives_to_read )
2387+ {
2388+ m_config.read .push_back (
2389+ std::make_unique<FilesReadBinaryProvider>(zip_tool, fs, std::move (dir)));
2390+ }
2391+ if (!c.archives_to_write .empty ())
2392+ {
2393+ m_config.write .push_back (
2394+ std::make_unique<FilesWriteBinaryProvider>(fs, std::move (c.archives_to_write )));
2395+ }
23962396 }
2397- if (!c. url_templates_to_put . empty () )
2397+ else if constexpr (std::is_same_v<T, HttpBinaryProviderConfig> )
23982398 {
2399- m_config.write .push_back (
2400- std::make_unique<HTTPPutBinaryProvider>(std::move (c.url_templates_to_put ), c.secrets ));
2399+ for (auto && url : c.url_templates_to_get )
2400+ {
2401+ m_config.read .push_back (std::make_unique<HttpGetBinaryProvider>(
2402+ zip_tool, fs, buildtrees, std::move (url), c.secrets ));
2403+ }
2404+ if (!c.url_templates_to_put .empty ())
2405+ {
2406+ m_config.write .push_back (std::make_unique<HTTPPutBinaryProvider>(
2407+ std::move (c.url_templates_to_put ), c.secrets ));
2408+ }
24012409 }
2402- } else if constexpr (std::is_same_v<T, GcsBinaryProviderConfig>) {
2403- if (!gcs_tool)
2410+ else if constexpr (std::is_same_v<T, GcsBinaryProviderConfig>)
24042411 {
2405- gcs_tool = std::make_shared<GcsStorageTool>(tools, out_sink);
2406- }
2412+ if (!gcs_tool)
2413+ {
2414+ gcs_tool = std::make_shared<GcsStorageTool>(tools, out_sink);
2415+ }
24072416
2408- for (auto && prefix : c.gcs_read_prefixes )
2409- {
2410- m_config.read .push_back (
2411- std::make_unique<ObjectStorageProvider>(zip_tool, fs, buildtrees, std::move (prefix), gcs_tool));
2412- }
2413- if (!c.gcs_write_prefixes .empty ())
2414- {
2415- m_config.write .push_back (
2416- std::make_unique<ObjectStoragePushProvider>(std::move (c.gcs_write_prefixes ), gcs_tool));
2417+ for (auto && prefix : c.gcs_read_prefixes )
2418+ {
2419+ m_config.read .push_back (std::make_unique<ObjectStorageProvider>(
2420+ zip_tool, fs, buildtrees, std::move (prefix), gcs_tool));
2421+ }
2422+ if (!c.gcs_write_prefixes .empty ())
2423+ {
2424+ m_config.write .push_back (std::make_unique<ObjectStoragePushProvider>(
2425+ std::move (c.gcs_write_prefixes ), gcs_tool));
2426+ }
24172427 }
2418- } else if constexpr (std::is_same_v<T, AwsBinaryProviderConfig>) {
2419- if (!aws_tool)
2428+ else if constexpr (std::is_same_v<T, AwsBinaryProviderConfig>)
24202429 {
2421- aws_tool = std::make_shared<AwsStorageTool>(tools, out_sink, s.aws_no_sign_request );
2422- }
2430+ if (!aws_tool)
2431+ {
2432+ aws_tool = std::make_shared<AwsStorageTool>(tools, out_sink, s.aws_no_sign_request );
2433+ }
24232434
2424- for (auto && prefix : c.aws_read_prefixes )
2425- {
2426- m_config.read .push_back (
2427- std::make_unique<ObjectStorageProvider>( zip_tool, fs, buildtrees, std::move (prefix), aws_tool));
2428- }
2435+ for (auto && prefix : c.aws_read_prefixes )
2436+ {
2437+ m_config.read .push_back (std::make_unique<ObjectStorageProvider> (
2438+ zip_tool, fs, buildtrees, std::move (prefix), aws_tool));
2439+ }
24292440
2430- if (!c.aws_write_prefixes .empty ())
2431- {
2432- m_config.write .push_back (
2433- std::make_unique<ObjectStoragePushProvider>(std::move (c.aws_write_prefixes ), aws_tool));
2441+ if (!c.aws_write_prefixes .empty ())
2442+ {
2443+ m_config.write .push_back (std::make_unique<ObjectStoragePushProvider>(
2444+ std::move (c.aws_write_prefixes ), aws_tool));
2445+ }
24342446 }
2435- } else if constexpr (std::is_same_v<T, CosBinaryProviderConfig>) {
2436- if (!cos_tool)
2447+ else if constexpr (std::is_same_v<T, CosBinaryProviderConfig>)
24372448 {
2438- cos_tool = std::make_shared<CosStorageTool>(tools, out_sink);
2439- }
2449+ if (!cos_tool)
2450+ {
2451+ cos_tool = std::make_shared<CosStorageTool>(tools, out_sink);
2452+ }
24402453
2441- for (auto && prefix : c.cos_read_prefixes )
2442- {
2443- m_config.read .push_back (
2444- std::make_unique<ObjectStorageProvider>( zip_tool, fs, buildtrees, std::move (prefix), cos_tool));
2445- }
2454+ for (auto && prefix : c.cos_read_prefixes )
2455+ {
2456+ m_config.read .push_back (std::make_unique<ObjectStorageProvider> (
2457+ zip_tool, fs, buildtrees, std::move (prefix), cos_tool));
2458+ }
24462459
2447- if (!c.cos_write_prefixes .empty ())
2448- {
2449- m_config.write .push_back (
2450- std::make_unique<ObjectStoragePushProvider>(std::move (c.cos_write_prefixes ), cos_tool));
2460+ if (!c.cos_write_prefixes .empty ())
2461+ {
2462+ m_config.write .push_back (std::make_unique<ObjectStoragePushProvider>(
2463+ std::move (c.cos_write_prefixes ), cos_tool));
2464+ }
24512465 }
2452- } else if constexpr (std::is_same_v<T, GhaBinaryProviderConfig>) {
2453- if (c.gha_read || c.gha_write )
2466+ else if constexpr (std::is_same_v<T, GhaBinaryProviderConfig>)
24542467 {
2455- if (!args. actions_cache_url . has_value () || !args. actions_runtime_token . has_value () )
2468+ if (c. gha_read || c. gha_write )
24562469 {
2457- status_sink.println (
2458- Color::error,
2459- msg::format_error (msgGHAParametersMissing, msg::url = docs::binarycaching_gha_url));
2460- return false ;
2470+ if (!args.actions_cache_url .has_value () || !args.actions_runtime_token .has_value ())
2471+ {
2472+ status_sink.println (Color::error,
2473+ msg::format_error (msgGHAParametersMissing,
2474+ msg::url = docs::binarycaching_gha_url));
2475+ return false ;
2476+ }
24612477 }
2462- }
24632478
2464- if (c.gha_read )
2465- {
2466- const auto & url = *args.actions_cache_url .get ();
2467- const auto & token = *args.actions_runtime_token .get ();
2468- m_config.read .push_back (std::make_unique<GHABinaryProvider>(zip_tool, fs, buildtrees, url, token));
2469- }
2470- if (c.gha_write )
2471- {
2472- const auto & url = *args.actions_cache_url .get ();
2473- const auto & token = *args.actions_runtime_token .get ();
2474- m_config.write .push_back (std::make_unique<GHABinaryPushProvider>(fs, url, token));
2475- }
2476- } else if constexpr (std::is_same_v<T, NugetBinaryProviderConfig>) {
2477- if (!c.sources_to_read .empty () || !c.configs_to_read .empty () || !c.sources_to_write .empty () || !c.configs_to_write .empty ())
2478- {
2479- NugetBaseBinaryProvider nuget_base (
2480- fs, NuGetTool (tools, out_sink, s), paths.packages (), buildtrees, s.nuget_prefix );
2481- if (!c.sources_to_read .empty ())
2482- m_config.read .push_back (
2483- std::make_unique<NugetReadBinaryProvider>(nuget_base, nuget_sources_arg (c.sources_to_read )));
2484- for (auto && config : c.configs_to_read )
2479+ if (c.gha_read )
2480+ {
2481+ const auto & url = *args.actions_cache_url .get ();
2482+ const auto & token = *args.actions_runtime_token .get ();
24852483 m_config.read .push_back (
2486- std::make_unique<NugetReadBinaryProvider>(nuget_base, nuget_configfile_arg (config)));
2487- if (!c.sources_to_write .empty () || !c.configs_to_write .empty ())
2484+ std::make_unique<GHABinaryProvider>(zip_tool, fs, buildtrees, url, token));
2485+ }
2486+ if (c.gha_write )
24882487 {
2489- m_config.write .push_back (std::make_unique<NugetBinaryPushProvider>(
2490- nuget_base, std::move (c.sources_to_write ), std::move (c.configs_to_write )));
2488+ const auto & url = *args.actions_cache_url .get ();
2489+ const auto & token = *args.actions_runtime_token .get ();
2490+ m_config.write .push_back (std::make_unique<GHABinaryPushProvider>(fs, url, token));
24912491 }
24922492 }
2493- } else if constexpr (std::is_same_v<T, AzureUpkgBinaryProviderConfig>) {
2494- if (!c.upkg_templates_to_get .empty ())
2493+ else if constexpr (std::is_same_v<T, NugetBinaryProviderConfig>)
24952494 {
2496- for (auto && src : c.upkg_templates_to_get )
2495+ if (!c.sources_to_read .empty () || !c.configs_to_read .empty () ||
2496+ !c.sources_to_write .empty () || !c.configs_to_write .empty ())
24972497 {
2498- m_config.read .push_back (
2499- std::make_unique<AzureUpkgGetBinaryProvider>(tools, out_sink, std::move (src)));
2498+ NugetBaseBinaryProvider nuget_base (fs,
2499+ NuGetTool (tools, out_sink, s),
2500+ paths.packages (),
2501+ buildtrees,
2502+ s.nuget_prefix );
2503+ if (!c.sources_to_read .empty ())
2504+ m_config.read .push_back (std::make_unique<NugetReadBinaryProvider>(
2505+ nuget_base, nuget_sources_arg (c.sources_to_read )));
2506+ for (auto && config : c.configs_to_read )
2507+ m_config.read .push_back (std::make_unique<NugetReadBinaryProvider>(
2508+ nuget_base, nuget_configfile_arg (config)));
2509+ if (!c.sources_to_write .empty () || !c.configs_to_write .empty ())
2510+ {
2511+ m_config.write .push_back (std::make_unique<NugetBinaryPushProvider>(
2512+ nuget_base, std::move (c.sources_to_write ), std::move (c.configs_to_write )));
2513+ }
25002514 }
25012515 }
2502- if (!c. upkg_templates_to_put . empty () )
2516+ else if constexpr (std::is_same_v<T, AzureUpkgBinaryProviderConfig> )
25032517 {
2504- m_config.write .push_back (
2505- std::make_unique<AzureUpkgPutBinaryProvider>(tools, out_sink, std::move (c.upkg_templates_to_put )));
2518+ if (!c.upkg_templates_to_get .empty ())
2519+ {
2520+ for (auto && src : c.upkg_templates_to_get )
2521+ {
2522+ m_config.read .push_back (std::make_unique<AzureUpkgGetBinaryProvider>(
2523+ tools, out_sink, std::move (src)));
2524+ }
2525+ }
2526+ if (!c.upkg_templates_to_put .empty ())
2527+ {
2528+ m_config.write .push_back (std::make_unique<AzureUpkgPutBinaryProvider>(
2529+ tools, out_sink, std::move (c.upkg_templates_to_put )));
2530+ }
25062531 }
2507- }
25082532
2509- return true ;
2510- }, config);
2533+ return true ;
2534+ },
2535+ config);
25112536
2512- if (!ok) {
2537+ if (!ok)
2538+ {
25132539 return false ;
25142540 }
25152541 }
0 commit comments