Remove the default triplet warning. (#1351)

This commit is contained in:
Billy O'Neal 2024-02-27 13:34:48 -08:00 коммит произвёл GitHub
Родитель 8e0de0cfcd
Коммит 0fcbb7d9ff
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: B5690EEEBB952194
21 изменённых файлов: 42 добавлений и 333 удалений

Просмотреть файл

@ -45,152 +45,3 @@ if (-Not ($out.StartsWith('error: unexpected switch: --not-a-switch')))
{
throw 'Bad install --not-a-switch output'
}
if ($IsWindows) {
$warningText = 'In the September 2023 release'
# build-external not tested
# ci not tested
# export not tested
# depend-info
[string]$output = Run-VcpkgAndCaptureStdErr -TestArgs ($directoryArgs + @('depend-info', 'vcpkg-hello-world-1'))
Throw-IfFailed
if (-Not $output.Contains($warningText)) {
throw 'depend-info with unqualified spec should emit the triplet warning'
}
$output = Run-VcpkgAndCaptureStdErr -TestArgs ($directoryArgs + @('depend-info', 'vcpkg-hello-world-1:x64-windows'))
Throw-IfFailed
if ($output.Contains($warningText)) {
throw 'depend-info with qualified parameters should not emit the triplet warning'
}
$output = Run-VcpkgAndCaptureStdErr -TestArgs ($directoryArgs + @('depend-info', 'vcpkg-hello-world-1', '--triplet', 'x86-windows'))
Throw-IfFailed
if ($output.Contains($warningText)) {
throw 'depend-info with arg should not emit the triplet warning'
}
$output = Run-VcpkgAndCaptureStdErr -TestArgs ($directoryArgs + @('depend-info', 'vcpkg-hello-world-1', '--triplet', 'x64-windows'))
Throw-IfFailed
if ($output.Contains($warningText)) {
throw 'depend-info with new default arg should not emit the triplet warning'
}
# set-installed
$output = Run-VcpkgAndCaptureOutput -TestArgs ($directoryArgs + @('x-set-installed'))
Throw-IfFailed
if ($output.Contains($warningText)) {
throw 'x-set-installed with no parameters should not emit the triplet warning'
}
$output = Run-VcpkgAndCaptureOutput -TestArgs ($directoryArgs + @('x-set-installed', 'vcpkg-hello-world-1'))
Throw-IfFailed
if (-Not $output.Contains($warningText)) {
throw 'x-set-installed with unqualified spec should emit the triplet warning'
}
$output = Run-VcpkgAndCaptureOutput -TestArgs ($directoryArgs + @('x-set-installed', 'vcpkg-hello-world-1:x64-windows'))
Throw-IfFailed
if ($output.Contains($warningText)) {
throw 'x-set-installed with qualified parameters should not emit the triplet warning'
}
$output = Run-VcpkgAndCaptureOutput -TestArgs ($directoryArgs + @('x-set-installed', 'vcpkg-hello-world-1', '--triplet', 'x86-windows'))
Throw-IfFailed
if ($output.Contains($warningText)) {
throw 'x-set-installed with arg should not emit the triplet warning'
}
# install
Refresh-TestRoot
$sub = Join-Path $TestingRoot 'manifest-warn'
New-Item -ItemType Directory -Force $sub | Out-Null
Push-Location $sub
try {
Run-Vcpkg -TestArgs ($directoryArgs + @('new', '--application'))
Throw-IfFailed
$output = Run-VcpkgAndCaptureOutput -TestArgs ($directoryArgs + @('install'))
Throw-IfFailed
if (-Not $output.Contains($warningText)) {
throw 'manifest install should emit the triplet warning'
}
} finally {
Pop-Location
}
Refresh-TestRoot
$output =Run-VcpkgAndCaptureOutput -TestArgs ($directoryArgs + @('install', 'vcpkg-hello-world-1'))
Throw-IfFailed
if (-Not $output.Contains($warningText)) {
throw 'install with unqualified spec should emit the triplet warning'
}
$output = Run-VcpkgAndCaptureOutput -TestArgs ($directoryArgs + @('install', 'vcpkg-hello-world-1:x64-windows'))
Throw-IfFailed
if ($output.Contains($warningText)) {
throw 'install with qualified parameters should not emit the triplet warning'
}
$output = Run-VcpkgAndCaptureOutput -TestArgs ($directoryArgs + @('install', 'vcpkg-hello-world-1', '--triplet', 'x86-windows'))
Throw-IfFailed
if ($output.Contains($warningText)) {
throw 'install with arg should not emit the triplet warning'
}
# upgrade
$output = Run-VcpkgAndCaptureOutput -TestArgs ($directoryArgs + @('upgrade'))
Throw-IfFailed
if ($output.Contains($warningText)) {
throw 'upgrade with no parameters should not emit the triplet warning'
}
$output = Run-VcpkgAndCaptureOutput -TestArgs ($directoryArgs + @('upgrade', 'vcpkg-hello-world-1'))
Throw-IfFailed
if (-Not $output.Contains($warningText)) {
throw 'upgrade with unqualified spec should emit the triplet warning'
}
$output = Run-VcpkgAndCaptureOutput -TestArgs ($directoryArgs + @('upgrade', 'vcpkg-hello-world-1:x64-windows'))
Throw-IfFailed
if ($output.Contains($warningText)) {
throw 'upgrade with qualified parameters should not emit the triplet warning'
}
$output = Run-VcpkgAndCaptureOutput -TestArgs ($directoryArgs + @('upgrade', 'vcpkg-hello-world-1', '--triplet', 'x86-windows'))
Throw-IfFailed
if ($output.Contains($warningText)) {
throw 'upgrade with arg should not emit the triplet warning'
}
# remove
$output = Run-VcpkgAndCaptureOutput -TestArgs ($directoryArgs + @('remove', 'vcpkg-hello-world-1'))
Throw-IfFailed
if (-Not $output.Contains($warningText)) {
throw 'remove with unqualified spec should emit the triplet warning'
}
$output = Run-VcpkgAndCaptureOutput -TestArgs ($directoryArgs + @('remove', 'vcpkg-hello-world-1:x64-windows'))
Throw-IfFailed
if ($output.Contains($warningText)) {
throw 'remove with qualified parameters should not emit the triplet warning'
}
$output = Run-VcpkgAndCaptureOutput -TestArgs ($directoryArgs + @('remove', 'vcpkg-hello-world-1', '--triplet', 'x86-windows'))
Throw-IfFailed
if ($output.Contains($warningText)) {
throw 'remove with arg should not emit the triplet warning'
}
$env:VCPKG_DEFAULT_TRIPLET = 'x86-windows'
Refresh-TestRoot
$output = Run-VcpkgAndCaptureOutput -TestArgs ($directoryArgs + @('install', 'vcpkg-hello-world-1'))
Throw-IfFailed
if ($output.Contains($warningText)) {
throw 'install with environment variable set should not emit the triplet warning'
}
Remove-Item env:VCPKG_DEFAULT_TRIPLET
}

Просмотреть файл

@ -980,14 +980,6 @@ DECLARE_MESSAGE(
DECLARE_MESSAGE(DefaultFeatureIdentifier, (), "", "the names of default features must be identifiers")
DECLARE_MESSAGE(DefaultFlag, (msg::option), "", "Defaulting to --{option} being on.")
DECLARE_MESSAGE(DefaultRegistryIsArtifact, (), "", "The default registry cannot be an artifact registry.")
DECLARE_MESSAGE(
DefaultTripletChanged,
(msg::triplet),
"The parts naming --triplet are command line switches that should be unlocalized. The space after the last "
"'triplet' and the period is intended to avoid the period looking like it's part of the command line switch",
"In the September 2023 release, the default triplet for vcpkg libraries changed from x86-windows to "
"the detected host triplet ({triplet}). For the old behavior, add --triplet x86-windows . To "
"suppress this message, add --triplet {triplet} .")
DECLARE_MESSAGE(DeleteVcpkgConfigFromManifest,
(msg::path),
"",

Просмотреть файл

@ -17,13 +17,11 @@ namespace vcpkg
// triplet or similar which is no longer active.
PackageSpec parse_package_spec(StringView spec_string,
Triplet default_triplet,
bool& default_triplet_used,
const LocalizedString& example_text);
// Same as the above but checks the validity of the triplet.
PackageSpec check_and_get_package_spec(StringView spec_string,
Triplet default_triplet,
bool& default_triplet_used,
const LocalizedString& example_text,
const TripletDatabase& database);
@ -33,7 +31,6 @@ namespace vcpkg
// Asserts that the package spec has a valid triplet.
FullPackageSpec check_and_get_full_package_spec(StringView spec_string,
Triplet default_triplet,
bool& default_triplet_used,
const LocalizedString& example_text,
const TripletDatabase& database);

Просмотреть файл

@ -140,11 +140,9 @@ namespace vcpkg
/// @param id add "default" if "core" is not present
/// @return nullopt on success. On failure, caller should supplement returned string with more context.
ExpectedL<FullPackageSpec> to_full_spec(Triplet default_triplet,
bool& default_triplet_used,
ImplicitDefault id) const;
ExpectedL<FullPackageSpec> to_full_spec(Triplet default_triplet, ImplicitDefault id) const;
ExpectedL<PackageSpec> to_package_spec(Triplet default_triplet, bool& default_triplet_used) const;
ExpectedL<PackageSpec> to_package_spec(Triplet default_triplet) const;
};
Optional<std::string> parse_feature_name(ParserBase& parser);

Просмотреть файл

@ -59,7 +59,6 @@ namespace vcpkg
{
Triplet default_triplet(const VcpkgCmdArguments& args, const TripletDatabase& database);
Triplet default_host_triplet(const VcpkgCmdArguments& args, const TripletDatabase& database);
void print_default_triplet_warning(const VcpkgCmdArguments& arg, const TripletDatabase& database);
struct TripletFile
{

Просмотреть файл

@ -580,8 +580,6 @@
"DefaultFlag": "Defaulting to --{option} being on.",
"_DefaultFlag.comment": "An example of {option} is editable.",
"DefaultRegistryIsArtifact": "The default registry cannot be an artifact registry.",
"DefaultTripletChanged": "In the September 2023 release, the default triplet for vcpkg libraries changed from x86-windows to the detected host triplet ({triplet}). For the old behavior, add --triplet x86-windows . To suppress this message, add --triplet {triplet} .",
"_DefaultTripletChanged.comment": "The parts naming --triplet are command line switches that should be unlocalized. The space after the last 'triplet' and the period is intended to avoid the period looking like it's part of the command line switch An example of {triplet} is x64-windows.",
"DeleteVcpkgConfigFromManifest": "-- Or remove \"vcpkg-configuration\" from the manifest file {path}.",
"_DeleteVcpkgConfigFromManifest.comment": "An example of {path} is /foo/bar.",
"DependencyFeatureCore": "the feature \"core\" cannot be in a dependency's feature list. To turn off default features, add \"default-features\": false instead.",

Просмотреть файл

@ -42,26 +42,19 @@ TEST_CASE ("specifier parsing", "[specifier]")
REQUIRE(!spec.triplet);
REQUIRE(!spec.platform);
bool default_triplet_used = false;
auto full_spec_implicit = spec.to_full_spec(Test::X86_WINDOWS, default_triplet_used, ImplicitDefault::YES)
.value_or_exit(VCPKG_LINE_INFO);
REQUIRE(default_triplet_used);
default_triplet_used = false;
auto full_spec_implicit =
spec.to_full_spec(Test::X86_WINDOWS, ImplicitDefault::YES).value_or_exit(VCPKG_LINE_INFO);
REQUIRE(full_spec_implicit.package_spec.name() == "zlib");
REQUIRE(full_spec_implicit.package_spec.triplet() == Test::X86_WINDOWS);
REQUIRE(full_spec_implicit.features == std::vector<std::string>{"core", "default"});
auto full_spec_explicit = spec.to_full_spec(Test::X86_WINDOWS, default_triplet_used, ImplicitDefault::NO)
.value_or_exit(VCPKG_LINE_INFO);
REQUIRE(default_triplet_used);
default_triplet_used = false;
auto full_spec_explicit =
spec.to_full_spec(Test::X86_WINDOWS, ImplicitDefault::NO).value_or_exit(VCPKG_LINE_INFO);
REQUIRE(full_spec_explicit.package_spec.name() == "zlib");
REQUIRE(full_spec_explicit.package_spec.triplet() == Test::X86_WINDOWS);
REQUIRE(full_spec_explicit.features == std::vector<std::string>{"core"});
auto package_spec =
spec.to_package_spec(Test::X86_WINDOWS, default_triplet_used).value_or_exit(VCPKG_LINE_INFO);
REQUIRE(default_triplet_used);
auto package_spec = spec.to_package_spec(Test::X86_WINDOWS).value_or_exit(VCPKG_LINE_INFO);
REQUIRE(package_spec.name() == "zlib");
REQUIRE(package_spec.triplet() == Test::X86_WINDOWS);
}
@ -74,24 +67,19 @@ TEST_CASE ("specifier parsing", "[specifier]")
REQUIRE(spec.triplet.value_or_exit(VCPKG_LINE_INFO) == "x64-uwp");
REQUIRE(!spec.platform);
bool default_triplet_used = false;
auto full_spec_implicit = spec.to_full_spec(Test::X86_WINDOWS, default_triplet_used, ImplicitDefault::YES)
.value_or_exit(VCPKG_LINE_INFO);
REQUIRE(!default_triplet_used);
auto full_spec_implicit =
spec.to_full_spec(Test::X86_WINDOWS, ImplicitDefault::YES).value_or_exit(VCPKG_LINE_INFO);
REQUIRE(full_spec_implicit.package_spec.name() == "zlib");
REQUIRE(full_spec_implicit.package_spec.triplet() == Test::X64_UWP);
REQUIRE(full_spec_implicit.features == std::vector<std::string>{"core", "default"});
auto full_spec_explicit = spec.to_full_spec(Test::X86_WINDOWS, default_triplet_used, ImplicitDefault::NO)
.value_or_exit(VCPKG_LINE_INFO);
REQUIRE(!default_triplet_used);
auto full_spec_explicit =
spec.to_full_spec(Test::X86_WINDOWS, ImplicitDefault::NO).value_or_exit(VCPKG_LINE_INFO);
REQUIRE(full_spec_explicit.package_spec.name() == "zlib");
REQUIRE(full_spec_explicit.package_spec.triplet() == Test::X64_UWP);
REQUIRE(full_spec_explicit.features == std::vector<std::string>{"core"});
auto package_spec =
spec.to_package_spec(Test::X86_WINDOWS, default_triplet_used).value_or_exit(VCPKG_LINE_INFO);
REQUIRE(!default_triplet_used);
auto package_spec = spec.to_package_spec(Test::X86_WINDOWS).value_or_exit(VCPKG_LINE_INFO);
REQUIRE(package_spec.name() == "zlib");
REQUIRE(package_spec.triplet() == Test::X64_UWP);
}
@ -110,23 +98,19 @@ TEST_CASE ("specifier parsing", "[specifier]")
REQUIRE(spec.triplet.value_or("") == "x64-uwp");
REQUIRE(!spec.platform);
bool default_triplet_used = false;
auto full_spec_implicit = spec.to_full_spec(Test::X86_WINDOWS, default_triplet_used, ImplicitDefault::YES)
.value_or_exit(VCPKG_LINE_INFO);
REQUIRE(!default_triplet_used);
auto full_spec_implicit =
spec.to_full_spec(Test::X86_WINDOWS, ImplicitDefault::YES).value_or_exit(VCPKG_LINE_INFO);
REQUIRE(full_spec_implicit.package_spec.name() == "zlib");
REQUIRE(full_spec_implicit.package_spec.triplet() == Test::X64_UWP);
REQUIRE(full_spec_implicit.features == std::vector<std::string>{"feature", "core", "default"});
auto full_spec_explicit = spec.to_full_spec(Test::X86_WINDOWS, default_triplet_used, ImplicitDefault::NO)
.value_or_exit(VCPKG_LINE_INFO);
REQUIRE(!default_triplet_used);
auto full_spec_explicit =
spec.to_full_spec(Test::X86_WINDOWS, ImplicitDefault::NO).value_or_exit(VCPKG_LINE_INFO);
REQUIRE(full_spec_explicit.package_spec.name() == "zlib");
REQUIRE(full_spec_explicit.package_spec.triplet() == Test::X64_UWP);
REQUIRE(full_spec_explicit.features == std::vector<std::string>{"feature", "core"});
auto maybe_package_spec = spec.to_package_spec(Test::X86_WINDOWS, default_triplet_used);
REQUIRE(!default_triplet_used);
auto maybe_package_spec = spec.to_package_spec(Test::X86_WINDOWS);
REQUIRE(!maybe_package_spec.has_value());
REQUIRE(maybe_package_spec.error() ==
LocalizedString::from_raw("error: List of features is not allowed in this context"));
@ -182,22 +166,17 @@ TEST_CASE ("specifier parsing", "[specifier]")
REQUIRE(!spec.triplet);
REQUIRE(to_string(spec.platform.value_or_exit(VCPKG_LINE_INFO)) == "windows");
bool default_triplet_used = false;
auto maybe_full_spec_implicit =
spec.to_full_spec(Test::X86_WINDOWS, default_triplet_used, ImplicitDefault::YES);
REQUIRE(!default_triplet_used);
auto maybe_full_spec_implicit = spec.to_full_spec(Test::X86_WINDOWS, ImplicitDefault::YES);
REQUIRE(!maybe_full_spec_implicit.has_value());
REQUIRE(maybe_full_spec_implicit.error() ==
LocalizedString::from_raw("error: Platform qualifier is not allowed in this context"));
auto maybe_full_spec_explicit = spec.to_full_spec(Test::X86_WINDOWS, default_triplet_used, ImplicitDefault::NO);
REQUIRE(!default_triplet_used);
auto maybe_full_spec_explicit = spec.to_full_spec(Test::X86_WINDOWS, ImplicitDefault::NO);
REQUIRE(!maybe_full_spec_explicit.has_value());
REQUIRE(maybe_full_spec_explicit.error() ==
LocalizedString::from_raw("error: Platform qualifier is not allowed in this context"));
auto maybe_package_spec = spec.to_package_spec(Test::X86_WINDOWS, default_triplet_used);
REQUIRE(!default_triplet_used);
auto maybe_package_spec = spec.to_package_spec(Test::X86_WINDOWS);
REQUIRE(!maybe_package_spec.has_value());
REQUIRE(maybe_package_spec.error() ==
LocalizedString::from_raw("error: Platform qualifier is not allowed in this context"));

Просмотреть файл

@ -133,9 +133,7 @@ namespace vcpkg::Test
{
auto opt = parse_qualified_specifier(parser);
REQUIRE(opt.has_value());
bool unused = false;
ret.push_back(
opt.get()->to_full_spec(X86_WINDOWS, unused, ImplicitDefault::YES).value_or_exit(VCPKG_LINE_INFO));
ret.push_back(opt.get()->to_full_spec(X86_WINDOWS, ImplicitDefault::YES).value_or_exit(VCPKG_LINE_INFO));
}
return ret;

Просмотреть файл

@ -27,16 +27,10 @@ namespace vcpkg
{
const ParsedArguments options = args.parse_arguments(CommandBuildExternalMetadata);
bool default_triplet_used = false;
const FullPackageSpec spec = check_and_get_full_package_spec(options.command_arguments[0],
default_triplet,
default_triplet_used,
CommandBuildExternalMetadata.get_example_text(),
paths.get_triplet_db());
if (default_triplet_used)
{
print_default_triplet_warning(args, paths.get_triplet_db());
}
auto overlays = paths.overlay_ports;
overlays.insert(overlays.begin(), options.command_arguments[1]);

Просмотреть файл

@ -84,16 +84,10 @@ namespace vcpkg
{
// Build only takes a single package and all dependencies must already be installed
const ParsedArguments options = args.parse_arguments(CommandBuildMetadata);
bool default_triplet_used = false;
const FullPackageSpec spec = check_and_get_full_package_spec(options.command_arguments[0],
default_triplet,
default_triplet_used,
CommandBuildMetadata.get_example_text(),
paths.get_triplet_db());
if (default_triplet_used)
{
print_default_triplet_warning(args, paths.get_triplet_db());
}
auto& fs = paths.get_filesystem();
auto registry_set = paths.make_registry_set();

Просмотреть файл

@ -121,20 +121,11 @@ namespace vcpkg
Json::Array json_to_print; // only used when `use_json`
bool default_triplet_used = false;
const std::vector<FullPackageSpec> specs = Util::fmap(options.command_arguments, [&](auto&& arg) {
return check_and_get_full_package_spec(arg,
default_triplet,
default_triplet_used,
CommandCheckSupportMetadata.get_example_text(),
paths.get_triplet_db());
return check_and_get_full_package_spec(
arg, default_triplet, CommandCheckSupportMetadata.get_example_text(), paths.get_triplet_db());
});
if (default_triplet_used)
{
print_default_triplet_warning(args, paths.get_triplet_db());
}
auto& fs = paths.get_filesystem();
auto registry_set = paths.make_registry_set();
PathsPortFileProvider provider(

Просмотреть файл

@ -328,9 +328,6 @@ namespace vcpkg
Triplet host_triplet)
{
msg::println_warning(msgInternalCICommand);
print_default_triplet_warning(args, paths.get_triplet_db());
const ParsedArguments options = args.parse_arguments(CommandCiMetadata);
const auto& settings = options.settings;

Просмотреть файл

@ -396,20 +396,11 @@ namespace vcpkg
const ParsedArguments options = args.parse_arguments(CommandDependInfoMetadata);
const auto strategy = determine_depend_info_mode(options).value_or_exit(VCPKG_LINE_INFO);
bool default_triplet_used = false;
const std::vector<FullPackageSpec> specs = Util::fmap(options.command_arguments, [&](auto&& arg) {
return check_and_get_full_package_spec(arg,
default_triplet,
default_triplet_used,
CommandDependInfoMetadata.get_example_text(),
paths.get_triplet_db());
return check_and_get_full_package_spec(
arg, default_triplet, CommandDependInfoMetadata.get_example_text(), paths.get_triplet_db());
});
if (default_triplet_used)
{
print_default_triplet_warning(args, paths.get_triplet_db());
}
auto& fs = paths.get_filesystem();
auto registry_set = paths.make_registry_set();
PathsPortFileProvider provider(

Просмотреть файл

@ -396,16 +396,9 @@ namespace
else
{
// input sanitization
bool default_triplet_used = false;
ret.specs = Util::fmap(options.command_arguments, [&](auto&& arg) {
return parse_package_spec(
arg, default_triplet, default_triplet_used, CommandExportMetadata.get_example_text());
return parse_package_spec(arg, default_triplet, CommandExportMetadata.get_example_text());
});
if (default_triplet_used)
{
print_default_triplet_warning(args, paths.get_triplet_db());
}
}
if (!ret.raw && !ret.nuget && !ret.ifw && !ret.zip && !ret.seven_zip && !ret.dry_run && !ret.chocolatey &&

Просмотреть файл

@ -1088,8 +1088,6 @@ namespace vcpkg
msg::print(usage_for_command(CommandInstallMetadataManifest));
Checks::exit_fail(VCPKG_LINE_INFO);
}
print_default_triplet_warning(args, paths.get_triplet_db());
}
else
{
@ -1286,20 +1284,11 @@ namespace vcpkg
PathsPortFileProvider provider(
fs, *registry_set, make_overlay_provider(fs, paths.original_cwd, paths.overlay_ports));
bool default_triplet_used = false;
const std::vector<FullPackageSpec> specs = Util::fmap(options.command_arguments, [&](auto&& arg) {
return check_and_get_full_package_spec(arg,
default_triplet,
default_triplet_used,
CommandInstallMetadataClassic.get_example_text(),
paths.get_triplet_db());
return check_and_get_full_package_spec(
arg, default_triplet, CommandInstallMetadataClassic.get_example_text(), paths.get_triplet_db());
});
if (default_triplet_used)
{
print_default_triplet_warning(args, paths.get_triplet_db());
}
// create the plan
msg::println(msgComputingInstallPlan);
StatusParagraphs status_db = database_load_check(fs, paths.installed());

Просмотреть файл

@ -219,16 +219,9 @@ namespace vcpkg
Checks::exit_fail(VCPKG_LINE_INFO);
}
bool default_triplet_used = false;
specs = Util::fmap(options.command_arguments, [&](auto&& arg) {
return parse_package_spec(
arg, default_triplet, default_triplet_used, CommandRemoveMetadata.get_example_text());
return parse_package_spec(arg, default_triplet, CommandRemoveMetadata.get_example_text());
});
if (default_triplet_used)
{
print_default_triplet_warning(args, paths.get_triplet_db());
}
}
const Purge purge = Util::Sets::contains(options.switches, OPTION_PURGE) ? Purge::YES : Purge::NO;

Просмотреть файл

@ -281,20 +281,11 @@ namespace vcpkg
{
// input sanitization
const ParsedArguments options = args.parse_arguments(CommandSetInstalledMetadata);
bool default_triplet_used = false;
const std::vector<FullPackageSpec> specs = Util::fmap(options.command_arguments, [&](auto&& arg) {
return check_and_get_full_package_spec(arg,
default_triplet,
default_triplet_used,
CommandSetInstalledMetadata.get_example_text(),
paths.get_triplet_db());
return check_and_get_full_package_spec(
arg, default_triplet, CommandSetInstalledMetadata.get_example_text(), paths.get_triplet_db());
});
if (default_triplet_used)
{
print_default_triplet_warning(args, paths.get_triplet_db());
}
const bool dry_run = Util::Sets::contains(options.switches, OPTION_DRY_RUN);
const bool only_downloads = Util::Sets::contains(options.switches, OPTION_ONLY_DOWNLOADS);
const KeepGoing keep_going = Util::Sets::contains(options.switches, OPTION_KEEP_GOING) || only_downloads

Просмотреть файл

@ -95,20 +95,11 @@ namespace vcpkg
else
{
// input sanitization
bool default_triplet_used = false;
const std::vector<PackageSpec> specs = Util::fmap(options.command_arguments, [&](auto&& arg) {
return check_and_get_package_spec(arg,
default_triplet,
default_triplet_used,
CommandUpgradeMetadata.get_example_text(),
paths.get_triplet_db());
return check_and_get_package_spec(
arg, default_triplet, CommandUpgradeMetadata.get_example_text(), paths.get_triplet_db());
});
if (default_triplet_used)
{
print_default_triplet_warning(args, paths.get_triplet_db());
}
std::vector<PackageSpec> not_installed;
std::vector<PackageSpec> no_control_file;
std::vector<PackageSpec> to_upgrade;

Просмотреть файл

@ -11,15 +11,12 @@
namespace vcpkg
{
PackageSpec parse_package_spec(StringView spec_string,
Triplet default_triplet,
bool& default_triplet_used,
const LocalizedString& example_text)
PackageSpec parse_package_spec(StringView spec_string, Triplet default_triplet, const LocalizedString& example_text)
{
auto maybe_qualified_specifier = parse_qualified_specifier(Strings::ascii_to_lowercase(spec_string));
if (auto qualified_specifier = maybe_qualified_specifier.get())
{
auto expected_spec = qualified_specifier->to_package_spec(default_triplet, default_triplet_used);
auto expected_spec = qualified_specifier->to_package_spec(default_triplet);
if (auto spec = expected_spec.get())
{
return std::move(*spec);
@ -50,7 +47,6 @@ namespace vcpkg
PackageSpec check_and_get_package_spec(StringView spec_string,
Triplet default_triplet,
bool& default_triplet_used,
const LocalizedString& example_text,
const TripletDatabase& database)
{
@ -62,7 +58,7 @@ namespace vcpkg
check_triplet(*specified_triplet, database);
}
auto expected_spec = qualified_specifier->to_package_spec(default_triplet, default_triplet_used);
auto expected_spec = qualified_specifier->to_package_spec(default_triplet);
if (auto spec = expected_spec.get())
{
return std::move(*spec);
@ -81,7 +77,6 @@ namespace vcpkg
FullPackageSpec check_and_get_full_package_spec(StringView spec_string,
Triplet default_triplet,
bool& default_triplet_used,
const LocalizedString& example_text,
const TripletDatabase& database)
{
@ -93,8 +88,7 @@ namespace vcpkg
check_triplet(*specified_triplet, database);
}
auto expected_spec =
qualified_specifier->to_full_spec(default_triplet, default_triplet_used, ImplicitDefault::YES);
auto expected_spec = qualified_specifier->to_full_spec(default_triplet, ImplicitDefault::YES);
if (auto spec = expected_spec.get())
{
return std::move(*spec);

Просмотреть файл

@ -7,16 +7,13 @@
namespace
{
using namespace vcpkg;
Triplet resolve_triplet(const Optional<std::string>& specified_triplet,
Triplet default_triplet,
bool& default_triplet_used)
Triplet resolve_triplet(const Optional<std::string>& specified_triplet, Triplet default_triplet)
{
if (auto pspecified = specified_triplet.get())
{
return Triplet::from_canonical_name(*pspecified);
}
default_triplet_used = true;
return default_triplet;
}
} // unnamed namespace
@ -91,9 +88,7 @@ namespace vcpkg
return left.name() == right.name() && left.triplet() == right.triplet();
}
ExpectedL<FullPackageSpec> ParsedQualifiedSpecifier::to_full_spec(Triplet default_triplet,
bool& default_triplet_used,
ImplicitDefault id) const
ExpectedL<FullPackageSpec> ParsedQualifiedSpecifier::to_full_spec(Triplet default_triplet, ImplicitDefault id) const
{
if (platform)
{
@ -106,12 +101,10 @@ namespace vcpkg
fs = *pfeatures;
}
return FullPackageSpec{{name, resolve_triplet(triplet, default_triplet, default_triplet_used)},
internalize_feature_list(fs, id)};
return FullPackageSpec{{name, resolve_triplet(triplet, default_triplet)}, internalize_feature_list(fs, id)};
}
ExpectedL<PackageSpec> ParsedQualifiedSpecifier::to_package_spec(Triplet default_triplet,
bool& default_triplet_used) const
ExpectedL<PackageSpec> ParsedQualifiedSpecifier::to_package_spec(Triplet default_triplet) const
{
if (platform)
{
@ -123,7 +116,7 @@ namespace vcpkg
return msg::format_error(msgIllegalFeatures);
}
return PackageSpec{name, resolve_triplet(triplet, default_triplet, default_triplet_used)};
return PackageSpec{name, resolve_triplet(triplet, default_triplet)};
}
ExpectedL<ParsedQualifiedSpecifier> parse_qualified_specifier(StringView input)

Просмотреть файл

@ -123,20 +123,6 @@ namespace vcpkg
return Triplet::from_canonical_name(host_triplet_name);
}
void print_default_triplet_warning(const VcpkgCmdArguments& args, const TripletDatabase& database)
{
(void)args;
(void)database;
#if defined(_WIN32)
if (!args.triplet.has_value())
{
// Remove this warning in March 2024
// The triplet is not set by --triplet or VCPKG_DEFAULT_TRIPLET
msg::println_warning(msgDefaultTripletChanged, msg::triplet = default_host_triplet(args, database));
}
#endif // ^^^ _WIN32
}
TripletFile::TripletFile(StringView name, StringView location) : name(name.data(), name.size()), location(location)
{
}