Remove baseline warning
* remove warning
we don't want people to use `baseline` necessarily
* only change baseline if it isn't set
* Robert CRs
* format
* robert CRs
* format!
* format for realz
MODIFY
include/vcpkg/registries.h
include/vcpkg/registries.h
@@ -87,8 +87,7 @@ namespace vcpkg
void set_default_registry(std::unique_ptr<RegistryImplementation>&& r);
void set_default_registry(std::nullptr_t r);
- // this exists in order to allow versioning and registries to be developed and tested separately
- void experimental_set_builtin_registry_baseline(StringView baseline) const;
+ void set_default_builtin_registry_baseline(StringView baseline) const;
// returns whether the registry set has any modifications to the default
// (i.e., whether `default_registry` was set, or `registries` had any entries)

MODIFY
src/vcpkg/install.cpp
src/vcpkg/install.cpp
@@ -901,7 +901,7 @@ namespace vcpkg::Install
paths.get_current_git_sha_message());
}
- paths.get_configuration().registry_set.experimental_set_builtin_registry_baseline(*p_baseline);
+ paths.get_configuration().registry_set.set_default_builtin_registry_baseline(*p_baseline);
}
auto verprovider = PortFileProvider::make_versioned_portfile_provider(paths);

MODIFY
src/vcpkg/registries.cpp
src/vcpkg/registries.cpp
@@ -1148,30 +1148,34 @@ namespace vcpkg
}
void RegistrySet::set_default_registry(std::nullptr_t) { default_registry_.reset(); }
- void RegistrySet::experimental_set_builtin_registry_baseline(StringView baseline) const
+ void RegistrySet::set_default_builtin_registry_baseline(StringView baseline) const
{
- // to check if we should warn
- bool default_registry_is_builtin = false;
- if (auto builtin_registry = dynamic_cast<BuiltinRegistry*>(default_registry_.get()))
+ if (auto default_builtin_registry = dynamic_cast<BuiltinRegistry*>(default_registry_.get()))
{
- default_registry_is_builtin = true;
- builtin_registry->m_baseline_identifier.assign(baseline.begin(), baseline.end());
- }
-
- if (!default_registry_is_builtin || registries_.size() != 0)
+ if (default_builtin_registry->m_baseline_identifier.empty())
{
- System::print2(System::Color::warning,
- "Warning: when using the registries feature, one should not use `\"builtin-baseline\"` "
- "to set the baseline.\n",
- " Instead, use the \"baseline\" field of the registry.\n");
+ default_builtin_registry->m_baseline_identifier.assign(baseline.begin(), baseline.end());
}
-
- for (auto& reg : registries_)
+ else
{
- if (auto builtin_registry = dynamic_cast<BuiltinRegistry*>(reg.implementation_.get()))
+ System::print2(
+ System::Color::warning,
+ R"(warning: attempting to set builtin baseline in both vcpkg.json and vcpkg-configuration.json
+ (only one of these should be used; the baseline from vcpkg-configuration.json will be used))");
+ }
+ }
+ else if (auto default_registry = default_registry_.get())
{
- builtin_registry->m_baseline_identifier.assign(baseline.begin(), baseline.end());
+ System::printf(System::Color::warning,
+ "warning: the default registry has been replaced with a %s registry, but `builtin-baseline` "
+ "is specified in vcpkg.json. This field will have no effect.",
+ default_registry->kind());
}
+ else
+ {
+ System::print2(System::Color::warning,
+ "warning: the default registry has been disabled, but `builtin-baseline` is specified in "
+ "vcpkg.json. This field will have no effect.");
}
}

Remove baseline warning (#27)

* remove warning

we don't want people to use `baseline` necessarily

* only change baseline if it isn't set

* Robert CRs

* format

* robert CRs

* format!

* format for realz