mirror of
https://github.com/microsoft/vcpkg.git
synced 2024-11-29 03:11:38 +08:00
[vcpkg] Reformat and refactor to reduce function size
This commit is contained in:
parent
ddbd57f505
commit
1b71053ad9
@ -178,15 +178,18 @@ namespace vcpkg
|
||||
static constexpr std::array<int, 3> EXPECTED_VERSION = {3, 1, 81};
|
||||
static const std::wstring VERSION_CHECK_ARGUMENTS = L"--framework-version";
|
||||
|
||||
const fs::path downloaded_copy = downloads_folder / "QtInstallerFramework-win-x86" / "bin" / "installerbase.exe";
|
||||
const fs::path downloaded_copy =
|
||||
downloads_folder / "QtInstallerFramework-win-x86" / "bin" / "installerbase.exe";
|
||||
|
||||
std::vector<fs::path> candidate_paths;
|
||||
candidate_paths.push_back(downloaded_copy);
|
||||
// TODO: Uncomment later
|
||||
// const std::vector<fs::path> from_path = Files::find_from_PATH(L"installerbase");
|
||||
// candidate_paths.insert(candidate_paths.end(), from_path.cbegin(), from_path.cend());
|
||||
//candidate_paths.push_back(fs::path(System::get_environment_variable(L"HOMEDRIVE").value_or("C:")) / "Qt" / "Tools" / "QtInstallerFramework" / "3.1" / "bin" / "installerbase.exe");
|
||||
//candidate_paths.push_back(fs::path(System::get_environment_variable(L"HOMEDRIVE").value_or("C:")) / "Qt" / "QtIFW-3.1.0" / "bin" / "installerbase.exe");
|
||||
// candidate_paths.push_back(fs::path(System::get_environment_variable(L"HOMEDRIVE").value_or("C:")) / "Qt" /
|
||||
// "Tools" / "QtInstallerFramework" / "3.1" / "bin" / "installerbase.exe");
|
||||
// candidate_paths.push_back(fs::path(System::get_environment_variable(L"HOMEDRIVE").value_or("C:")) / "Qt" /
|
||||
// "QtIFW-3.1.0" / "bin" / "installerbase.exe");
|
||||
|
||||
const Optional<fs::path> path =
|
||||
find_if_has_equal_or_greater_version(candidate_paths, VERSION_CHECK_ARGUMENTS, EXPECTED_VERSION);
|
||||
@ -283,17 +286,20 @@ namespace vcpkg
|
||||
|
||||
const fs::path& VcpkgPaths::get_ifw_installerbase_exe() const
|
||||
{
|
||||
return this->ifw_installerbase_exe.get_lazy([this]() { return get_ifw_installerbase_path(this->downloads, this->scripts); });
|
||||
return this->ifw_installerbase_exe.get_lazy(
|
||||
[this]() { return get_ifw_installerbase_path(this->downloads, this->scripts); });
|
||||
}
|
||||
|
||||
const fs::path& VcpkgPaths::get_ifw_binarycreator_exe() const
|
||||
{
|
||||
return this->ifw_binarycreator_exe.get_lazy([this]() { return get_ifw_installerbase_exe().parent_path() / "binarycreator.exe"; });
|
||||
return this->ifw_binarycreator_exe.get_lazy(
|
||||
[this]() { return get_ifw_installerbase_exe().parent_path() / "binarycreator.exe"; });
|
||||
}
|
||||
|
||||
const fs::path& VcpkgPaths::get_ifw_repogen_exe() const
|
||||
{
|
||||
return this->ifw_repogen_exe.get_lazy([this]() { return get_ifw_installerbase_exe().parent_path() / "repogen.exe"; });
|
||||
return this->ifw_repogen_exe.get_lazy(
|
||||
[this]() { return get_ifw_installerbase_exe().parent_path() / "repogen.exe"; });
|
||||
}
|
||||
|
||||
static std::vector<std::string> get_vs2017_installation_instances(const VcpkgPaths& paths)
|
||||
|
@ -237,8 +237,27 @@ namespace vcpkg::Commands::Export
|
||||
}
|
||||
}
|
||||
|
||||
void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths, const Triplet& default_triplet)
|
||||
struct ExportArguments
|
||||
{
|
||||
bool dry_run;
|
||||
bool raw;
|
||||
bool nuget;
|
||||
bool ifw;
|
||||
bool zip;
|
||||
bool seven_zip;
|
||||
|
||||
Optional<std::string> maybe_nuget_id;
|
||||
Optional<std::string> maybe_nuget_version;
|
||||
|
||||
IFW::Options ifw_options;
|
||||
std::vector<PackageSpec> specs;
|
||||
};
|
||||
|
||||
static ExportArguments handle_export_command_arguments(const VcpkgCmdArguments& args,
|
||||
const Triplet& default_triplet)
|
||||
{
|
||||
ExportArguments ret;
|
||||
|
||||
static const std::string OPTION_DRY_RUN = "--dry-run";
|
||||
static const std::string OPTION_RAW = "--raw";
|
||||
static const std::string OPTION_NUGET = "--nuget";
|
||||
@ -258,11 +277,9 @@ namespace vcpkg::Commands::Export
|
||||
Commands::Help::create_example_string("export zlib zlib:x64-windows boost --nuget");
|
||||
args.check_min_arg_count(1, EXAMPLE);
|
||||
|
||||
const std::vector<PackageSpec> specs = Util::fmap(args.command_arguments, [&](auto&& arg) {
|
||||
ret.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.triplet(), paths);
|
||||
|
||||
const auto options = args.check_and_get_optional_command_arguments(
|
||||
{
|
||||
@ -280,16 +297,16 @@ namespace vcpkg::Commands::Export
|
||||
OPTION_IFW_PACKAGES_DIR_PATH,
|
||||
OPTION_IFW_REPOSITORY_DIR_PATH,
|
||||
OPTION_IFW_CONFIG_FILE_PATH,
|
||||
OPTION_IFW_INSTALLER_FILE_PATH
|
||||
OPTION_IFW_INSTALLER_FILE_PATH,
|
||||
});
|
||||
const bool dry_run = options.switches.find(OPTION_DRY_RUN) != options.switches.cend();
|
||||
const bool raw = options.switches.find(OPTION_RAW) != options.switches.cend();
|
||||
const bool nuget = options.switches.find(OPTION_NUGET) != options.switches.cend();
|
||||
const bool ifw = options.switches.find(OPTION_IFW) != options.switches.cend();
|
||||
const bool zip = options.switches.find(OPTION_ZIP) != options.switches.cend();
|
||||
const bool seven_zip = options.switches.find(OPTION_SEVEN_ZIP) != options.switches.cend();
|
||||
ret.dry_run = options.switches.find(OPTION_DRY_RUN) != options.switches.cend();
|
||||
ret.raw = options.switches.find(OPTION_RAW) != options.switches.cend();
|
||||
ret.nuget = options.switches.find(OPTION_NUGET) != options.switches.cend();
|
||||
ret.ifw = options.switches.find(OPTION_IFW) != options.switches.cend();
|
||||
ret.zip = options.switches.find(OPTION_ZIP) != options.switches.cend();
|
||||
ret.seven_zip = options.switches.find(OPTION_SEVEN_ZIP) != options.switches.cend();
|
||||
|
||||
if (!raw && !nuget && !ifw && !zip && !seven_zip && !dry_run)
|
||||
if (!ret.raw && !ret.nuget && !ret.ifw && !ret.zip && !ret.seven_zip && !ret.dry_run)
|
||||
{
|
||||
System::println(System::Color::error,
|
||||
"Must provide at least one export type: --raw --nuget --ifw --zip --7zip");
|
||||
@ -297,83 +314,44 @@ namespace vcpkg::Commands::Export
|
||||
Checks::exit_fail(VCPKG_LINE_INFO);
|
||||
}
|
||||
|
||||
auto maybe_nuget_id = maybe_lookup(options.settings, OPTION_NUGET_ID);
|
||||
auto maybe_nuget_version = maybe_lookup(options.settings, OPTION_NUGET_VERSION);
|
||||
ret.maybe_nuget_id = maybe_lookup(options.settings, OPTION_NUGET_ID);
|
||||
ret.maybe_nuget_version = maybe_lookup(options.settings, OPTION_NUGET_VERSION);
|
||||
|
||||
Checks::check_exit(VCPKG_LINE_INFO, !maybe_nuget_id || nuget, "--nuget-id is only valid with --nuget");
|
||||
Checks::check_exit(VCPKG_LINE_INFO, !ret.maybe_nuget_id || ret.nuget, "--nuget-id is only valid with --nuget");
|
||||
Checks::check_exit(
|
||||
VCPKG_LINE_INFO, !maybe_nuget_version || nuget, "--nuget-version is only valid with --nuget");
|
||||
VCPKG_LINE_INFO, !ret.maybe_nuget_version || ret.nuget, "--nuget-version is only valid with --nuget");
|
||||
|
||||
IFW::Options ifw_options;
|
||||
ret.ifw_options.maybe_repository_url = maybe_lookup(options.settings, OPTION_IFW_REPOSITORY_URL);
|
||||
Checks::check_exit(VCPKG_LINE_INFO,
|
||||
!ret.ifw_options.maybe_repository_url || ret.ifw,
|
||||
"--ifw-repository-url is only valid with --ifw");
|
||||
|
||||
ifw_options.maybe_repository_url = maybe_lookup(options.settings, OPTION_IFW_REPOSITORY_URL);
|
||||
Checks::check_exit(
|
||||
VCPKG_LINE_INFO, !ifw_options.maybe_repository_url || ifw, "--ifw-repository-url is only valid with --ifw");
|
||||
ret.ifw_options.maybe_packages_dir_path = maybe_lookup(options.settings, OPTION_IFW_PACKAGES_DIR_PATH);
|
||||
Checks::check_exit(VCPKG_LINE_INFO,
|
||||
!ret.ifw_options.maybe_packages_dir_path || ret.ifw,
|
||||
"--ifw-packages-directory-path is only valid with --ifw");
|
||||
|
||||
ifw_options.maybe_packages_dir_path = maybe_lookup(options.settings, OPTION_IFW_PACKAGES_DIR_PATH);
|
||||
Checks::check_exit(
|
||||
VCPKG_LINE_INFO, !ifw_options.maybe_packages_dir_path || ifw, "--ifw-packages-directory-path is only valid with --ifw");
|
||||
ret.ifw_options.maybe_repository_dir_path = maybe_lookup(options.settings, OPTION_IFW_REPOSITORY_DIR_PATH);
|
||||
Checks::check_exit(VCPKG_LINE_INFO,
|
||||
!ret.ifw_options.maybe_repository_dir_path || ret.ifw,
|
||||
"--ifw-repository-directory-path is only valid with --ifw");
|
||||
|
||||
ifw_options.maybe_repository_dir_path = maybe_lookup(options.settings, OPTION_IFW_REPOSITORY_DIR_PATH);
|
||||
Checks::check_exit(
|
||||
VCPKG_LINE_INFO, !ifw_options.maybe_repository_dir_path || ifw, "--ifw-repository-directory-path is only valid with --ifw");
|
||||
ret.ifw_options.maybe_config_file_path = maybe_lookup(options.settings, OPTION_IFW_CONFIG_FILE_PATH);
|
||||
Checks::check_exit(VCPKG_LINE_INFO,
|
||||
!ret.ifw_options.maybe_config_file_path || ret.ifw,
|
||||
"--ifw-configuration-file-path is only valid with --ifw");
|
||||
|
||||
ifw_options.maybe_config_file_path = maybe_lookup(options.settings, OPTION_IFW_CONFIG_FILE_PATH);
|
||||
Checks::check_exit(
|
||||
VCPKG_LINE_INFO, !ifw_options.maybe_config_file_path || ifw, "--ifw-configuration-file-path is only valid with --ifw");
|
||||
|
||||
ifw_options.maybe_installer_file_path = maybe_lookup(options.settings, OPTION_IFW_INSTALLER_FILE_PATH);
|
||||
Checks::check_exit(
|
||||
VCPKG_LINE_INFO, !ifw_options.maybe_installer_file_path || ifw, "--ifw-installer-file-path is only valid with --ifw");
|
||||
|
||||
// create the plan
|
||||
const StatusParagraphs status_db = database_load_check(paths);
|
||||
std::vector<ExportPlanAction> export_plan = Dependencies::create_export_plan(paths, specs, status_db);
|
||||
Checks::check_exit(VCPKG_LINE_INFO, !export_plan.empty(), "Export plan cannot be empty");
|
||||
|
||||
std::map<ExportPlanType, std::vector<const ExportPlanAction*>> group_by_plan_type;
|
||||
Util::group_by(export_plan, &group_by_plan_type, [](const ExportPlanAction& p) { return p.plan_type; });
|
||||
print_plan(group_by_plan_type);
|
||||
|
||||
const bool has_non_user_requested_packages =
|
||||
Util::find_if(export_plan, [](const ExportPlanAction& package) -> bool {
|
||||
return package.request_type != RequestType::USER_REQUESTED;
|
||||
}) != export_plan.cend();
|
||||
|
||||
if (has_non_user_requested_packages)
|
||||
{
|
||||
System::println(System::Color::warning,
|
||||
"Additional packages (*) need to be exported to complete this operation.");
|
||||
ret.ifw_options.maybe_installer_file_path = maybe_lookup(options.settings, OPTION_IFW_INSTALLER_FILE_PATH);
|
||||
Checks::check_exit(VCPKG_LINE_INFO,
|
||||
!ret.ifw_options.maybe_installer_file_path || ret.ifw,
|
||||
"--ifw-installer-file-path is only valid with --ifw");
|
||||
return ret;
|
||||
}
|
||||
|
||||
const auto it = group_by_plan_type.find(ExportPlanType::PORT_AVAILABLE_BUT_NOT_BUILT);
|
||||
if (it != group_by_plan_type.cend() && !it->second.empty())
|
||||
static void print_next_step_info(const fs::path& prefix)
|
||||
{
|
||||
System::println(System::Color::error, "There are packages that have not been built.");
|
||||
|
||||
// No need to show all of them, just the user-requested ones. Dependency resolution will handle the rest.
|
||||
std::vector<const ExportPlanAction*> unbuilt = it->second;
|
||||
Util::erase_remove_if(
|
||||
unbuilt, [](const ExportPlanAction* a) { return a->request_type != RequestType::USER_REQUESTED; });
|
||||
|
||||
const auto s = Strings::join(" ", unbuilt, [](const ExportPlanAction* a) { return a->spec.to_string(); });
|
||||
System::println("To build them, run:\n"
|
||||
" vcpkg install %s",
|
||||
s);
|
||||
Checks::exit_fail(VCPKG_LINE_INFO);
|
||||
}
|
||||
|
||||
if (dry_run)
|
||||
{
|
||||
Checks::exit_success(VCPKG_LINE_INFO);
|
||||
}
|
||||
|
||||
std::string export_id = create_export_id();
|
||||
|
||||
const auto print_next_step_info = [](const fs::path& prefix) {
|
||||
const fs::path cmake_toolchain = prefix / "scripts" / "buildsystems" / "vcpkg.cmake";
|
||||
const CMakeVariable cmake_variable =
|
||||
CMakeVariable(L"CMAKE_TOOLCHAIN_FILE", cmake_toolchain.generic_string());
|
||||
const CMakeVariable cmake_variable = CMakeVariable(L"CMAKE_TOOLCHAIN_FILE", cmake_toolchain.generic_string());
|
||||
System::println("\n"
|
||||
"To use the exported libraries in CMake projects use:"
|
||||
"\n"
|
||||
@ -382,8 +360,10 @@ namespace vcpkg::Commands::Export
|
||||
Strings::to_utf8(cmake_variable.s));
|
||||
};
|
||||
|
||||
// Main loop
|
||||
if (raw || nuget || zip || seven_zip)
|
||||
static void handle_raw_based_export(Span<const ExportPlanAction> export_plan,
|
||||
const ExportArguments& opts,
|
||||
const std::string& export_id,
|
||||
const VcpkgPaths& paths)
|
||||
{
|
||||
Files::Filesystem& fs = paths.get_filesystem();
|
||||
const fs::path export_to_path = paths.root;
|
||||
@ -418,19 +398,19 @@ namespace vcpkg::Commands::Export
|
||||
// Copy files needed for integration
|
||||
export_integration_files(raw_exported_dir_path, paths);
|
||||
|
||||
if (raw)
|
||||
if (opts.raw)
|
||||
{
|
||||
System::println(
|
||||
System::Color::success, R"(Files exported at: "%s")", raw_exported_dir_path.generic_string());
|
||||
print_next_step_info(export_to_path);
|
||||
}
|
||||
|
||||
if (nuget)
|
||||
if (opts.nuget)
|
||||
{
|
||||
System::println("Creating nuget package... ");
|
||||
|
||||
const std::string nuget_id = maybe_nuget_id.value_or(raw_exported_dir_path.filename().string());
|
||||
const std::string nuget_version = maybe_nuget_version.value_or("1.0.0");
|
||||
const std::string nuget_id = opts.maybe_nuget_id.value_or(raw_exported_dir_path.filename().string());
|
||||
const std::string nuget_version = opts.maybe_nuget_version.value_or("1.0.0");
|
||||
const fs::path output_path =
|
||||
do_nuget_export(paths, nuget_id, nuget_version, raw_exported_dir_path, export_to_path);
|
||||
System::println(System::Color::success, "Creating nuget package... done");
|
||||
@ -445,7 +425,7 @@ With a project open, go to Tools->NuGet Package Manager->Package Manager Console
|
||||
output_path.parent_path().u8string());
|
||||
}
|
||||
|
||||
if (zip)
|
||||
if (opts.zip)
|
||||
{
|
||||
System::println("Creating zip archive... ");
|
||||
const fs::path output_path =
|
||||
@ -455,7 +435,7 @@ With a project open, go to Tools->NuGet Package Manager->Package Manager Console
|
||||
print_next_step_info("[...]");
|
||||
}
|
||||
|
||||
if (seven_zip)
|
||||
if (opts.seven_zip)
|
||||
{
|
||||
System::println("Creating 7zip archive... ");
|
||||
const fs::path output_path =
|
||||
@ -465,16 +445,70 @@ With a project open, go to Tools->NuGet Package Manager->Package Manager Console
|
||||
print_next_step_info("[...]");
|
||||
}
|
||||
|
||||
if (!raw)
|
||||
if (!opts.raw)
|
||||
{
|
||||
fs.remove_all(raw_exported_dir_path, ec);
|
||||
}
|
||||
}
|
||||
|
||||
// IFW loop
|
||||
if (ifw)
|
||||
void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths, const Triplet& default_triplet)
|
||||
{
|
||||
IFW::do_export(export_plan, export_id, ifw_options, paths);
|
||||
const auto opts = handle_export_command_arguments(args, default_triplet);
|
||||
for (auto&& spec : opts.specs)
|
||||
Input::check_triplet(spec.triplet(), paths);
|
||||
|
||||
// create the plan
|
||||
const StatusParagraphs status_db = database_load_check(paths);
|
||||
std::vector<ExportPlanAction> export_plan = Dependencies::create_export_plan(paths, opts.specs, status_db);
|
||||
Checks::check_exit(VCPKG_LINE_INFO, !export_plan.empty(), "Export plan cannot be empty");
|
||||
|
||||
std::map<ExportPlanType, std::vector<const ExportPlanAction*>> group_by_plan_type;
|
||||
Util::group_by(export_plan, &group_by_plan_type, [](const ExportPlanAction& p) { return p.plan_type; });
|
||||
print_plan(group_by_plan_type);
|
||||
|
||||
const bool has_non_user_requested_packages =
|
||||
Util::find_if(export_plan, [](const ExportPlanAction& package) -> bool {
|
||||
return package.request_type != RequestType::USER_REQUESTED;
|
||||
}) != export_plan.cend();
|
||||
|
||||
if (has_non_user_requested_packages)
|
||||
{
|
||||
System::println(System::Color::warning,
|
||||
"Additional packages (*) need to be exported to complete this operation.");
|
||||
}
|
||||
|
||||
const auto it = group_by_plan_type.find(ExportPlanType::PORT_AVAILABLE_BUT_NOT_BUILT);
|
||||
if (it != group_by_plan_type.cend() && !it->second.empty())
|
||||
{
|
||||
System::println(System::Color::error, "There are packages that have not been built.");
|
||||
|
||||
// No need to show all of them, just the user-requested ones. Dependency resolution will handle the rest.
|
||||
std::vector<const ExportPlanAction*> unbuilt = it->second;
|
||||
Util::erase_remove_if(
|
||||
unbuilt, [](const ExportPlanAction* a) { return a->request_type != RequestType::USER_REQUESTED; });
|
||||
|
||||
const auto s = Strings::join(" ", unbuilt, [](const ExportPlanAction* a) { return a->spec.to_string(); });
|
||||
System::println("To build them, run:\n"
|
||||
" vcpkg install %s",
|
||||
s);
|
||||
Checks::exit_fail(VCPKG_LINE_INFO);
|
||||
}
|
||||
|
||||
if (opts.dry_run)
|
||||
{
|
||||
Checks::exit_success(VCPKG_LINE_INFO);
|
||||
}
|
||||
|
||||
std::string export_id = create_export_id();
|
||||
|
||||
if (opts.raw || opts.nuget || opts.zip || opts.seven_zip)
|
||||
{
|
||||
handle_raw_based_export(export_plan, opts, export_id, paths);
|
||||
}
|
||||
|
||||
if (opts.ifw)
|
||||
{
|
||||
IFW::do_export(export_plan, export_id, opts.ifw_options, paths);
|
||||
|
||||
print_next_step_info("@RootDir@/src/vcpkg");
|
||||
}
|
||||
|
@ -28,29 +28,29 @@ namespace vcpkg::Commands::Export::IFW
|
||||
|
||||
fs::path get_packages_dir_path(const std::string& export_id, const Options& ifw_options, const VcpkgPaths& paths)
|
||||
{
|
||||
return ifw_options.maybe_packages_dir_path.has_value() ?
|
||||
fs::path(ifw_options.maybe_packages_dir_path.value_or_exit(VCPKG_LINE_INFO))
|
||||
return ifw_options.maybe_packages_dir_path.has_value()
|
||||
? fs::path(ifw_options.maybe_packages_dir_path.value_or_exit(VCPKG_LINE_INFO))
|
||||
: paths.root / (export_id + "-ifw-packages");
|
||||
}
|
||||
|
||||
fs::path get_repository_dir_path(const std::string& export_id, const Options& ifw_options, const VcpkgPaths& paths)
|
||||
{
|
||||
return ifw_options.maybe_repository_dir_path.has_value() ?
|
||||
fs::path(ifw_options.maybe_repository_dir_path.value_or_exit(VCPKG_LINE_INFO))
|
||||
return ifw_options.maybe_repository_dir_path.has_value()
|
||||
? fs::path(ifw_options.maybe_repository_dir_path.value_or_exit(VCPKG_LINE_INFO))
|
||||
: paths.root / (export_id + "-ifw-repository");
|
||||
}
|
||||
|
||||
fs::path get_config_file_path(const std::string& export_id, const Options& ifw_options, const VcpkgPaths& paths)
|
||||
{
|
||||
return ifw_options.maybe_config_file_path.has_value() ?
|
||||
fs::path(ifw_options.maybe_config_file_path.value_or_exit(VCPKG_LINE_INFO))
|
||||
return ifw_options.maybe_config_file_path.has_value()
|
||||
? fs::path(ifw_options.maybe_config_file_path.value_or_exit(VCPKG_LINE_INFO))
|
||||
: paths.root / (export_id + "-ifw-configuration.xml");
|
||||
}
|
||||
|
||||
fs::path get_installer_file_path(const std::string& export_id, const Options& ifw_options, const VcpkgPaths& paths)
|
||||
{
|
||||
return ifw_options.maybe_installer_file_path.has_value() ?
|
||||
fs::path(ifw_options.maybe_installer_file_path.value_or_exit(VCPKG_LINE_INFO))
|
||||
return ifw_options.maybe_installer_file_path.has_value()
|
||||
? fs::path(ifw_options.maybe_installer_file_path.value_or_exit(VCPKG_LINE_INFO))
|
||||
: paths.root / (export_id + "-ifw-installer.exe");
|
||||
}
|
||||
|
||||
@ -119,7 +119,8 @@ R"###(<?xml version="1.0"?>
|
||||
!ec,
|
||||
"Could not create directory for package file %s",
|
||||
package_xml_file_path.generic_string());
|
||||
fs.write_contents(package_xml_file_path, Strings::format(
|
||||
fs.write_contents(package_xml_file_path,
|
||||
Strings::format(
|
||||
R"###(<?xml version="1.0"?>
|
||||
<Package>
|
||||
<DisplayName>Packages</DisplayName>
|
||||
@ -176,7 +177,8 @@ R"###(<?xml version="1.0"?>
|
||||
!ec,
|
||||
"Could not create directory for package file %s",
|
||||
package_xml_file_path.generic_string());
|
||||
fs.write_contents(package_xml_file_path, Strings::format(
|
||||
fs.write_contents(package_xml_file_path,
|
||||
Strings::format(
|
||||
R"###(<?xml version="1.0"?>
|
||||
<Package>
|
||||
<DisplayName>Triplets</DisplayName>
|
||||
@ -196,7 +198,8 @@ R"###(<?xml version="1.0"?>
|
||||
!ec,
|
||||
"Could not create directory for package file %s",
|
||||
package_xml_file_path.generic_string());
|
||||
fs.write_contents(package_xml_file_path, Strings::format(
|
||||
fs.write_contents(package_xml_file_path,
|
||||
Strings::format(
|
||||
R"###(<?xml version="1.0"?>
|
||||
<Package>
|
||||
<DisplayName>%s</DisplayName>
|
||||
@ -222,7 +225,8 @@ R"###(<?xml version="1.0"?>
|
||||
"Could not create directory for package file %s",
|
||||
package_xml_file_path.generic_string());
|
||||
|
||||
fs.write_contents(package_xml_file_path, Strings::format(
|
||||
fs.write_contents(package_xml_file_path,
|
||||
Strings::format(
|
||||
R"###(<?xml version="1.0"?>
|
||||
<Package>
|
||||
<DisplayName>Integration</DisplayName>
|
||||
@ -260,7 +264,8 @@ R"###(<?xml version="1.0"?>
|
||||
ifw_repo_url);
|
||||
}
|
||||
|
||||
fs.write_contents(config_xml_file_path, Strings::format(
|
||||
fs.write_contents(config_xml_file_path,
|
||||
Strings::format(
|
||||
R"###(<?xml version="1.0"?>
|
||||
<Installer>
|
||||
<Name>vcpkg</Name>
|
||||
@ -283,13 +288,10 @@ R"###(<?xml version="1.0"?>
|
||||
Files::Filesystem& fs = paths.get_filesystem();
|
||||
|
||||
fs.remove_all(repository_dir, ec);
|
||||
Checks::check_exit(VCPKG_LINE_INFO,
|
||||
!ec,
|
||||
"Could not remove outdated repository directory %s",
|
||||
repository_dir.generic_string());
|
||||
Checks::check_exit(
|
||||
VCPKG_LINE_INFO, !ec, "Could not remove outdated repository directory %s", repository_dir.generic_string());
|
||||
|
||||
const std::wstring cmd_line =
|
||||
Strings::wformat(LR"("%s" --packages "%s" "%s" > nul)",
|
||||
const std::wstring cmd_line = Strings::wformat(LR"("%s" --packages "%s" "%s" > nul)",
|
||||
repogen_exe.native(),
|
||||
packages_dir.native(),
|
||||
repository_dir.native());
|
||||
@ -315,8 +317,7 @@ R"###(<?xml version="1.0"?>
|
||||
std::string ifw_repo_url = ifw_options.maybe_repository_url.value_or("");
|
||||
if (!ifw_repo_url.empty())
|
||||
{
|
||||
cmd_line =
|
||||
Strings::wformat(LR"("%s" --online-only --config "%s" --repository "%s" "%s" > nul)",
|
||||
cmd_line = Strings::wformat(LR"("%s" --online-only --config "%s" --repository "%s" "%s" > nul)",
|
||||
binarycreator_exe.native(),
|
||||
config_file.native(),
|
||||
repository_dir.native(),
|
||||
@ -324,8 +325,7 @@ R"###(<?xml version="1.0"?>
|
||||
}
|
||||
else
|
||||
{
|
||||
cmd_line =
|
||||
Strings::wformat(LR"("%s" --config "%s" --packages "%s" "%s" > nul)",
|
||||
cmd_line = Strings::wformat(LR"("%s" --config "%s" --packages "%s" "%s" > nul)",
|
||||
binarycreator_exe.native(),
|
||||
config_file.native(),
|
||||
packages_dir.native(),
|
||||
@ -338,7 +338,10 @@ R"###(<?xml version="1.0"?>
|
||||
System::println(System::Color::success, "Generating installer %s... done.", installer_file.generic_string());
|
||||
}
|
||||
|
||||
void do_export(const std::vector<ExportPlanAction> &export_plan, const std::string &export_id, const Options &ifw_options, const VcpkgPaths& paths)
|
||||
void do_export(const std::vector<ExportPlanAction>& export_plan,
|
||||
const std::string& export_id,
|
||||
const Options& ifw_options,
|
||||
const VcpkgPaths& paths)
|
||||
{
|
||||
const fs::path ifw_packages_dir_path = get_packages_dir_path(export_id, ifw_options, paths);
|
||||
const fs::path config_file = get_config_file_path(export_id, ifw_options, paths);
|
||||
@ -355,10 +358,8 @@ R"###(<?xml version="1.0"?>
|
||||
ifw_packages_dir_path.generic_string());
|
||||
|
||||
fs.create_directory(ifw_packages_dir_path, ec);
|
||||
Checks::check_exit(VCPKG_LINE_INFO,
|
||||
!ec,
|
||||
"Could not create packages directory %s",
|
||||
ifw_packages_dir_path.generic_string());
|
||||
Checks::check_exit(
|
||||
VCPKG_LINE_INFO, !ec, "Could not create packages directory %s", ifw_packages_dir_path.generic_string());
|
||||
|
||||
// execute the plan
|
||||
std::map<std::string, const ExportPlanAction*> unique_packages;
|
||||
|
Loading…
Reference in New Issue
Block a user