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

switch to host triplet as the default. #640

Closed
wants to merge 10 commits into from
2 changes: 0 additions & 2 deletions include/vcpkg/triplet.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ namespace vcpkg
};

inline bool operator!=(Triplet left, Triplet right) { return !(left == right); }

}

VCPKG_FORMAT_AS(vcpkg::Triplet, vcpkg::StringView);
Expand All @@ -59,7 +58,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
4 changes: 0 additions & 4 deletions src/vcpkg/commands.build-external.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,6 @@ namespace vcpkg::Commands::BuildExternal
default_triplet_used,
COMMAND_STRUCTURE.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
4 changes: 0 additions & 4 deletions src/vcpkg/commands.build.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -185,10 +185,6 @@ namespace vcpkg::Build
default_triplet_used,
COMMAND_STRUCTURE.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();
Expand Down
5 changes: 0 additions & 5 deletions src/vcpkg/commands.check-support.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -122,11 +122,6 @@ namespace vcpkg::Commands
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(
Expand Down
2 changes: 0 additions & 2 deletions src/vcpkg/commands.ci.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -331,8 +331,6 @@ namespace vcpkg::Commands::CI
{
msg::println_warning(msgInternalCICommand);

print_default_triplet_warning(args, paths.get_triplet_db());

const ParsedArguments options = args.parse_arguments(COMMAND_STRUCTURE);
const auto& settings = options.settings;

Expand Down
5 changes: 0 additions & 5 deletions src/vcpkg/commands.dependinfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -401,11 +401,6 @@ namespace vcpkg::Commands::DependInfo
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(
Expand Down
5 changes: 0 additions & 5 deletions src/vcpkg/commands.export.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -438,11 +438,6 @@ namespace vcpkg::Export
return parse_package_spec(
arg, default_triplet, default_triplet_used, COMMAND_STRUCTURE.get_example_text());
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should the usage of
default_triplet, default_triplet_used
generally be removed?
I kind of let them in since removing then would create a large changeset.

});

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 &&
Expand Down
7 changes: 0 additions & 7 deletions src/vcpkg/commands.install.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1012,8 +1012,6 @@ namespace vcpkg
print_usage(MANIFEST_COMMAND_STRUCTURE);
Checks::exit_fail(VCPKG_LINE_INFO);
}

print_default_triplet_warning(args, paths.get_triplet_db());
}
else
{
Expand Down Expand Up @@ -1218,11 +1216,6 @@ namespace vcpkg
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());
Expand Down
5 changes: 0 additions & 5 deletions src/vcpkg/commands.remove.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -218,11 +218,6 @@ namespace vcpkg::Remove
return parse_package_spec(
arg, default_triplet, default_triplet_used, COMMAND_STRUCTURE.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;
Expand Down
5 changes: 0 additions & 5 deletions src/vcpkg/commands.set-installed.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -277,11 +277,6 @@ namespace vcpkg::Commands::SetInstalled
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
Expand Down
5 changes: 0 additions & 5 deletions src/vcpkg/commands.upgrade.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,11 +99,6 @@ namespace vcpkg::Commands::Upgrade
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;
Expand Down
28 changes: 7 additions & 21 deletions src/vcpkg/triplet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -104,13 +104,12 @@ namespace vcpkg

Triplet default_triplet(const VcpkgCmdArguments& args, const TripletDatabase& database)
{
#if defined(_WIN32)
auto triplet_name = args.triplet.value_or("x86-windows");
#else
auto triplet_name = args.triplet.value_or(system_triplet_canonical_name());
#endif
check_triplet(triplet_name, database);
return Triplet::from_canonical_name(triplet_name);
if (auto triplet_name = args.triplet.get())
{
check_triplet(*triplet_name, database);
return Triplet::from_canonical_name(*triplet_name);
}
return default_host_triplet(args, database);
}

Triplet default_host_triplet(const VcpkgCmdArguments& args, const TripletDatabase& database)
Expand All @@ -120,19 +119,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;
// The triplet is not set by --triplet or VCPKG_DEFAULT_TRIPLET
#if defined(_WIN32)
if (!args.triplet.has_value())
{
msg::println_warning(msgDefaultTriplet, msg::triplet = default_host_triplet(args, database));
}
#endif // ^^^ _WIN32
}

TripletFile::TripletFile(StringView name, StringView location) : name(name.data(), name.size()), location(location)
{
}
Expand All @@ -158,7 +144,7 @@ namespace vcpkg
return is_valid_triplet_canonical_name(Strings::ascii_to_lowercase(name));
}

bool TripletDatabase ::is_valid_triplet_canonical_name(StringView name) const
bool TripletDatabase::is_valid_triplet_canonical_name(StringView name) const
{
return Util::any_of(available_triplets, [=](const TripletFile& tf) { return tf.name == name; });
}
Expand Down