default_target_triplet -> default_triplet

This commit is contained in:
Alexander Karatarakis 2017-04-10 13:00:33 -07:00
parent cd0c8e1ca3
commit 410aa5b43a
11 changed files with 28 additions and 28 deletions

View File

@ -7,7 +7,7 @@ namespace vcpkg
{
struct PackageSpec
{
static Expected<PackageSpec> from_string(const std::string& spec_as_string, const Triplet& default_target_triplet);
static Expected<PackageSpec> from_string(const std::string& spec_as_string, const Triplet& default_triplet);
static Expected<PackageSpec> from_name_and_triplet(const std::string& name, const Triplet& target_triplet);

View File

@ -8,7 +8,7 @@
namespace vcpkg::Commands
{
using CommandTypeA = void(*)(const VcpkgCmdArguments& args, const VcpkgPaths& paths, const Triplet& default_target_triplet);
using CommandTypeA = void(*)(const VcpkgCmdArguments& args, const VcpkgPaths& paths, const Triplet& default_triplet);
using CommandTypeB = void(*)(const VcpkgCmdArguments& args, const VcpkgPaths& paths);
using CommandTypeC = void(*)(const VcpkgCmdArguments& args);
@ -33,28 +33,28 @@ namespace vcpkg::Commands
BuildResult build_package(const SourceParagraph& source_paragraph, const PackageSpec& spec, const VcpkgPaths& paths, const fs::path& port_dir, const StatusParagraphs& status_db);
void perform_and_exit(const PackageSpec& spec, const fs::path& port_dir, const std::unordered_set<std::string>& options, const VcpkgPaths& paths);
void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths, const Triplet& default_target_triplet);
void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths, const Triplet& default_triplet);
}
namespace BuildExternal
{
void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths, const Triplet& default_target_triplet);
void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths, const Triplet& default_triplet);
}
namespace Install
{
void install_package(const VcpkgPaths& paths, const BinaryParagraph& binary_paragraph, StatusParagraphs* status_db);
void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths, const Triplet& default_target_triplet);
void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths, const Triplet& default_triplet);
}
namespace CI
{
void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths, const Triplet& default_target_triplet);
void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths, const Triplet& default_triplet);
}
namespace Remove
{
void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths, const Triplet& default_target_triplet);
void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths, const Triplet& default_triplet);
}
namespace Update

View File

@ -7,7 +7,7 @@ namespace vcpkg::Input
{
PackageSpec check_and_get_package_spec(
const std::string& package_spec_as_string,
const Triplet& default_target_triplet,
const Triplet& default_triplet,
CStringView example_text);
void check_triplet(const Triplet& t, const VcpkgPaths& paths);

View File

@ -8,12 +8,12 @@ namespace vcpkg
return (c == '-') || isdigit(c) || (isalpha(c) && islower(c));
}
Expected<PackageSpec> PackageSpec::from_string(const std::string& spec_as_string, const Triplet& default_target_triplet)
Expected<PackageSpec> PackageSpec::from_string(const std::string& spec_as_string, const Triplet& default_triplet)
{
auto pos = spec_as_string.find(':');
if (pos == std::string::npos)
{
return from_name_and_triplet(spec_as_string, default_target_triplet);
return from_name_and_triplet(spec_as_string, default_triplet);
}
auto pos2 = spec_as_string.find(':', pos + 1);

View File

@ -178,11 +178,11 @@ namespace vcpkg::Commands::Build
Checks::exit_success(VCPKG_LINE_INFO);
}
void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths, const Triplet& default_target_triplet)
void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths, const Triplet& default_triplet)
{
static const std::string example = Commands::Help::create_example_string("build zlib:x64-windows");
args.check_exact_arg_count(1, example); // Build only takes a single package and all dependencies must already be installed
const PackageSpec spec = Input::check_and_get_package_spec(args.command_arguments.at(0), default_target_triplet, example);
const PackageSpec spec = Input::check_and_get_package_spec(args.command_arguments.at(0), default_triplet, example);
Input::check_triplet(spec.target_triplet(), paths);
const std::unordered_set<std::string> options = args.check_and_get_optional_command_arguments({ OPTION_CHECKS_ONLY });
perform_and_exit(spec, paths.port_dir(spec), options, paths);

View File

@ -5,11 +5,11 @@
namespace vcpkg::Commands::BuildExternal
{
void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths, const Triplet& default_target_triplet)
void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths, const Triplet& default_triplet)
{
static const std::string example = Commands::Help::create_example_string(R"(build_external zlib2 C:\path\to\dir\with\controlfile\)");
args.check_exact_arg_count(2, example);
const PackageSpec spec = Input::check_and_get_package_spec(args.command_arguments.at(0), default_target_triplet, example);
const PackageSpec spec = Input::check_and_get_package_spec(args.command_arguments.at(0), default_triplet, example);
Input::check_triplet(spec.target_triplet(), paths);
const std::unordered_set<std::string> options = args.check_and_get_optional_command_arguments({});

View File

@ -26,11 +26,11 @@ namespace vcpkg::Commands::CI
return specs;
}
void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths, const Triplet& default_target_triplet)
void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths, const Triplet& default_triplet)
{
static const std::string example = Commands::Help::create_example_string("ci x64-windows");
args.check_max_arg_count(1, example);
const Triplet target_triplet = args.command_arguments.size() == 1 ? Triplet::from_canonical_name(args.command_arguments.at(0)) : default_target_triplet;
const Triplet target_triplet = args.command_arguments.size() == 1 ? Triplet::from_canonical_name(args.command_arguments.at(0)) : default_triplet;
Input::check_triplet(target_triplet, paths);
args.check_and_get_optional_command_arguments({});
const std::vector<PackageSpec> specs = load_all_package_specs(paths.ports, target_triplet);

View File

@ -230,7 +230,7 @@ namespace vcpkg::Commands::Install
status_db->insert(std::make_unique<StatusParagraph>(spgh));
}
void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths, const Triplet& default_target_triplet)
void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths, const Triplet& default_triplet)
{
static const std::string OPTION_DRY_RUN = "--dry-run";
@ -240,7 +240,7 @@ namespace vcpkg::Commands::Install
const std::vector<PackageSpec> specs = Util::fmap(args.command_arguments, [&](auto&& arg)
{
return Input::check_and_get_package_spec(arg, default_target_triplet, example);
return Input::check_and_get_package_spec(arg, default_triplet, example);
});
for (auto&& spec : specs)
Input::check_triplet(spec.target_triplet(), paths);

View File

@ -136,7 +136,7 @@ namespace vcpkg::Commands::Remove
}
}
void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths, const Triplet& default_target_triplet)
void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths, const Triplet& default_triplet)
{
static const std::string OPTION_PURGE = "--purge";
static const std::string OPTION_NO_PURGE = "--no-purge";
@ -156,7 +156,7 @@ namespace vcpkg::Commands::Remove
else
{
args.check_min_arg_count(1, example);
specs = Util::fmap(args.command_arguments, [&](auto&& arg) { return Input::check_and_get_package_spec(arg, default_target_triplet, example); });
specs = Util::fmap(args.command_arguments, [&](auto&& arg) { return Input::check_and_get_package_spec(arg, default_triplet, example); });
for (auto&& spec : specs)
Input::check_triplet(spec.target_triplet(), paths);
}

View File

@ -69,29 +69,29 @@ static void inner(const VcpkgCmdArguments& args)
return command_function(args, paths);
}
Triplet default_target_triplet;
Triplet default_triplet;
if (args.target_triplet != nullptr)
{
default_target_triplet = Triplet::from_canonical_name(*args.target_triplet);
default_triplet = Triplet::from_canonical_name(*args.target_triplet);
}
else
{
const Optional<std::wstring> vcpkg_default_triplet_env = System::get_environmental_variable(L"VCPKG_DEFAULT_TRIPLET");
if (auto v = vcpkg_default_triplet_env.get())
{
default_target_triplet = Triplet::from_canonical_name(Strings::utf16_to_utf8(*v));
default_triplet = Triplet::from_canonical_name(Strings::utf16_to_utf8(*v));
}
else
{
default_target_triplet = Triplet::X86_WINDOWS;
default_triplet = Triplet::X86_WINDOWS;
}
}
Input::check_triplet(default_target_triplet, paths);
Input::check_triplet(default_triplet, paths);
if (auto command_function = Commands::find(args.command, Commands::get_available_commands_type_a()))
{
return command_function(args, paths, default_target_triplet);
return command_function(args, paths, default_triplet);
}
return invalid_command(args.command);

View File

@ -6,10 +6,10 @@
namespace vcpkg::Input
{
PackageSpec check_and_get_package_spec(const std::string& package_spec_as_string, const Triplet& default_target_triplet, CStringView example_text)
PackageSpec check_and_get_package_spec(const std::string& package_spec_as_string, const Triplet& default_triplet, CStringView example_text)
{
const std::string as_lowercase = Strings::ascii_to_lowercase(package_spec_as_string);
Expected<PackageSpec> expected_spec = PackageSpec::from_string(as_lowercase, default_target_triplet);
Expected<PackageSpec> expected_spec = PackageSpec::from_string(as_lowercase, default_triplet);
if (auto spec = expected_spec.get())
{
return *spec;