Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove the default triplet warning. #1351

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
149 changes: 0 additions & 149 deletions azure-pipelines/end-to-end-tests-dir/cli.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
8 changes: 0 additions & 8 deletions include/vcpkg/base/message-data.inc.h
Original file line number Diff line number Diff line change
Expand Up @@ -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),
"",
Expand Down
3 changes: 0 additions & 3 deletions include/vcpkg/input.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand All @@ -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);

Expand Down
6 changes: 2 additions & 4 deletions include/vcpkg/packagespec.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
1 change: 0 additions & 1 deletion include/vcpkg/triplet.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down
2 changes: 0 additions & 2 deletions locales/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -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.",
Expand Down
57 changes: 18 additions & 39 deletions src/vcpkg-test/specifier.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand All @@ -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);
}
Expand All @@ -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"));
Expand Down Expand Up @@ -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"));
Expand Down
4 changes: 1 addition & 3 deletions src/vcpkg-test/util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
6 changes: 0 additions & 6 deletions src/vcpkg/commands.build-external.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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]);
Expand Down
Loading
Loading