mirror of
https://github.com/microsoft/vcpkg.git
synced 2024-11-25 07:51:38 +08:00
[vcpkg_Build.cpp] USe const. Misc fixes
This commit is contained in:
parent
265fb7e0b5
commit
f3156ae3e4
@ -64,8 +64,8 @@ namespace vcpkg::Build
|
||||
tonull = L"";
|
||||
}
|
||||
|
||||
auto arch = to_vcvarsall_toolchain(pre_build_info.target_architecture, toolset);
|
||||
auto target = to_vcvarsall_target(pre_build_info.cmake_system_name);
|
||||
const auto arch = to_vcvarsall_toolchain(pre_build_info.target_architecture, toolset);
|
||||
const auto target = to_vcvarsall_target(pre_build_info.cmake_system_name);
|
||||
|
||||
return Strings::wformat(LR"("%s" %s %s %s 2>&1)", toolset.vcvarsall.native(), arch, target, tonull);
|
||||
}
|
||||
@ -85,7 +85,7 @@ namespace vcpkg::Build
|
||||
BinaryControlFile& bcf)
|
||||
{
|
||||
BinaryParagraph bpgh(source_paragraph, triplet);
|
||||
if (auto p_ver = build_info.version.get())
|
||||
if (const auto p_ver = build_info.version.get())
|
||||
{
|
||||
bpgh.version = *p_ver;
|
||||
}
|
||||
@ -132,7 +132,7 @@ namespace vcpkg::Build
|
||||
const fs::path& git_exe_path = paths.get_git_exe();
|
||||
|
||||
const fs::path ports_cmake_script_path = paths.ports_cmake;
|
||||
auto pre_build_info = PreBuildInfo::from_triplet_file(paths, triplet);
|
||||
const auto pre_build_info = PreBuildInfo::from_triplet_file(paths, triplet);
|
||||
const Toolset& toolset = paths.get_toolset(pre_build_info.platform_toolset);
|
||||
const auto cmd_set_environment = make_build_env_cmd(pre_build_info, toolset);
|
||||
|
||||
@ -171,8 +171,8 @@ namespace vcpkg::Build
|
||||
|
||||
const ElapsedTime timer = ElapsedTime::create_started();
|
||||
|
||||
int return_code = System::cmd_execute_clean(command);
|
||||
auto buildtimeus = timer.microseconds();
|
||||
const int return_code = System::cmd_execute_clean(command);
|
||||
const auto buildtimeus = timer.microseconds();
|
||||
const auto spec_string = spec.to_string();
|
||||
|
||||
{
|
||||
@ -186,7 +186,7 @@ namespace vcpkg::Build
|
||||
}
|
||||
}
|
||||
|
||||
auto build_info = read_build_info(paths.get_filesystem(), paths.build_info_file_path(spec));
|
||||
const BuildInfo build_info = read_build_info(paths.get_filesystem(), paths.build_info_file_path(spec));
|
||||
const size_t error_count = PostBuildLint::perform_all_checks(spec, paths, pre_build_info, build_info);
|
||||
|
||||
BinaryControlFile bcf;
|
||||
@ -269,7 +269,7 @@ namespace vcpkg::Build
|
||||
parser.required_field(BuildInfoRequiredField::CRT_LINKAGE, crt_linkage_as_string);
|
||||
|
||||
auto crtlinkage = to_linkage_type(crt_linkage_as_string);
|
||||
if (auto p = crtlinkage.get())
|
||||
if (const auto p = crtlinkage.get())
|
||||
build_info.crt_linkage = *p;
|
||||
else
|
||||
Checks::exit_with_message(VCPKG_LINE_INFO, "Invalid crt linkage type: [%s]", crt_linkage_as_string);
|
||||
@ -279,7 +279,7 @@ namespace vcpkg::Build
|
||||
std::string library_linkage_as_string;
|
||||
parser.required_field(BuildInfoRequiredField::LIBRARY_LINKAGE, library_linkage_as_string);
|
||||
auto liblinkage = to_linkage_type(library_linkage_as_string);
|
||||
if (auto p = liblinkage.get())
|
||||
if (const auto p = liblinkage.get())
|
||||
build_info.library_linkage = *p;
|
||||
else
|
||||
Checks::exit_with_message(
|
||||
@ -292,9 +292,8 @@ namespace vcpkg::Build
|
||||
for (auto policy : g_all_policies)
|
||||
{
|
||||
const auto setting = parser.optional_field(to_string(policy));
|
||||
if (setting.empty())
|
||||
continue;
|
||||
else if (setting == "enabled")
|
||||
if (setting.empty()) continue;
|
||||
if (setting == "enabled")
|
||||
policies.emplace(policy, true);
|
||||
else if (setting == "disabled")
|
||||
policies.emplace(policy, false);
|
||||
@ -303,7 +302,7 @@ namespace vcpkg::Build
|
||||
VCPKG_LINE_INFO, "Unknown setting for policy '%s': %s", to_string(policy), setting);
|
||||
}
|
||||
|
||||
if (auto err = parser.error_info("PostBuildInformation"))
|
||||
if (const auto err = parser.error_info("PostBuildInformation"))
|
||||
{
|
||||
print_error_message(err);
|
||||
Checks::exit_fail(VCPKG_LINE_INFO);
|
||||
@ -337,14 +336,14 @@ namespace vcpkg::Build
|
||||
});
|
||||
|
||||
const std::wstring command = Strings::wformat(LR"(%s)", cmd_launch_cmake);
|
||||
auto ec_data = System::cmd_execute_and_capture_output(command);
|
||||
const auto ec_data = System::cmd_execute_and_capture_output(command);
|
||||
Checks::check_exit(VCPKG_LINE_INFO, ec_data.exit_code == 0);
|
||||
|
||||
const std::vector<std::string> lines = Strings::split(ec_data.output, "\n");
|
||||
|
||||
PreBuildInfo pre_build_info;
|
||||
|
||||
auto e = lines.cend();
|
||||
const auto e = lines.cend();
|
||||
auto cur = std::find(lines.cbegin(), e, FLAG_GUID);
|
||||
if (cur != e) ++cur;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user