Skip to content

Commit 7c70e20

Browse files
committed
respect the order the providers are being defined
1 parent bec4296 commit 7c70e20

File tree

3 files changed

+522
-223
lines changed

3 files changed

+522
-223
lines changed

include/vcpkg/binarycaching.h

Lines changed: 47 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
#include <string>
2525
#include <thread>
2626
#include <unordered_map>
27+
#include <variant>
2728
#include <vector>
2829

2930
namespace vcpkg
@@ -131,42 +132,77 @@ namespace vcpkg
131132
std::string feed;
132133
};
133134

134-
struct BinaryConfigParserState
135+
struct FilesBinaryProviderConfig
135136
{
136-
bool nuget_interactive = false;
137-
std::set<StringLiteral> binary_cache_providers;
138-
139-
std::string nugettimeout = "100";
140-
141137
std::vector<Path> archives_to_read;
142138
std::vector<Path> archives_to_write;
139+
};
143140

141+
struct HttpBinaryProviderConfig
142+
{
143+
std::vector<std::string> secrets;
144144
std::vector<UrlTemplate> url_templates_to_get;
145145
std::vector<UrlTemplate> url_templates_to_put;
146+
};
146147

148+
struct GcsBinaryProviderConfig
149+
{
147150
std::vector<std::string> gcs_read_prefixes;
148151
std::vector<std::string> gcs_write_prefixes;
152+
};
149153

154+
struct AwsBinaryProviderConfig
155+
{
150156
std::vector<std::string> aws_read_prefixes;
151157
std::vector<std::string> aws_write_prefixes;
152-
bool aws_no_sign_request = false;
158+
};
153159

160+
struct CosBinaryProviderConfig
161+
{
154162
std::vector<std::string> cos_read_prefixes;
155163
std::vector<std::string> cos_write_prefixes;
164+
};
156165

166+
struct GhaBinaryProviderConfig
167+
{
157168
bool gha_write = false;
158169
bool gha_read = false;
170+
};
159171

160-
std::vector<AzureUpkgSource> upkg_templates_to_get;
161-
std::vector<AzureUpkgSource> upkg_templates_to_put;
162-
172+
struct NugetBinaryProviderConfig
173+
{
163174
std::vector<std::string> sources_to_read;
164175
std::vector<std::string> sources_to_write;
165176

166177
std::vector<Path> configs_to_read;
167178
std::vector<Path> configs_to_write;
179+
};
168180

169-
std::vector<std::string> secrets;
181+
struct AzureUpkgBinaryProviderConfig
182+
{
183+
std::vector<AzureUpkgSource> upkg_templates_to_get;
184+
std::vector<AzureUpkgSource> upkg_templates_to_put;
185+
};
186+
187+
using BinaryProviderConfig = std::variant<FilesBinaryProviderConfig,
188+
HttpBinaryProviderConfig,
189+
GcsBinaryProviderConfig,
190+
AwsBinaryProviderConfig,
191+
CosBinaryProviderConfig,
192+
GhaBinaryProviderConfig,
193+
NugetBinaryProviderConfig,
194+
AzureUpkgBinaryProviderConfig>;
195+
196+
struct BinaryConfigParserState
197+
{
198+
bool nuget_interactive = false;
199+
std::set<StringLiteral> binary_cache_providers;
200+
201+
std::vector<BinaryProviderConfig> binary_providers;
202+
203+
std::string nugettimeout = "100";
204+
205+
bool aws_no_sign_request = false;
170206

171207
// These are filled in after construction by reading from args and environment
172208
std::string nuget_prefix;

0 commit comments

Comments
 (0)