aboutsummaryrefslogtreecommitdiff
path: root/toolsrc/src/commands_integrate.cpp
diff options
context:
space:
mode:
authorAlexander Karatarakis <alkarata@microsoft.com>2017-04-27 18:08:52 -0700
committerAlexander Karatarakis <alkarata@microsoft.com>2017-04-27 18:59:57 -0700
commit1e9471a1489156720362ef12e1ec6849ea9b45b6 (patch)
tree46f0f35093ecd18034c9f9463d6f8b7aa590ade0 /toolsrc/src/commands_integrate.cpp
parent75e8752cb90eb8bc7717518d9d6a5c68f27f2b0f (diff)
downloadvcpkg-1e9471a1489156720362ef12e1ec6849ea9b45b6.tar.gz
vcpkg-1e9471a1489156720362ef12e1ec6849ea9b45b6.zip
Run clang-format over the cpp files
Diffstat (limited to 'toolsrc/src/commands_integrate.cpp')
-rw-r--r--toolsrc/src/commands_integrate.cpp84
1 files changed, 54 insertions, 30 deletions
diff --git a/toolsrc/src/commands_integrate.cpp b/toolsrc/src/commands_integrate.cpp
index 9b036b928..7d5e55d22 100644
--- a/toolsrc/src/commands_integrate.cpp
+++ b/toolsrc/src/commands_integrate.cpp
@@ -1,8 +1,9 @@
#include "pch.h"
-#include "vcpkg_Commands.h"
+
#include "vcpkg_Checks.h"
-#include "vcpkg_System.h"
+#include "vcpkg_Commands.h"
#include "vcpkg_Files.h"
+#include "vcpkg_System.h"
#include "vcpkg_Util.h"
namespace vcpkg::Commands::Integrate
@@ -11,7 +12,8 @@ namespace vcpkg::Commands::Integrate
System::get_ProgramFiles_32_bit() / "MSBuild/14.0/Microsoft.Common.Targets/ImportBefore/vcpkg.nuget.targets",
System::get_ProgramFiles_32_bit() / "MSBuild/14.0/Microsoft.Common.Targets/ImportBefore/vcpkg.system.targets"
};
- static const fs::path system_wide_targets_file = System::get_ProgramFiles_32_bit() / "MSBuild/Microsoft.Cpp/v4.0/V140/ImportBefore/Default/vcpkg.system.props";
+ static const fs::path system_wide_targets_file =
+ System::get_ProgramFiles_32_bit() / "MSBuild/Microsoft.Cpp/v4.0/V140/ImportBefore/Default/vcpkg.system.props";
static std::string create_appdata_targets_shortcut(const std::string& target_path) noexcept
{
@@ -19,7 +21,9 @@ namespace vcpkg::Commands::Integrate
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Condition="Exists('%s') and '$(VCPkgLocalAppDataDisabled)' == ''" Project="%s" />
</Project>
-)###", target_path, target_path);
+)###",
+ target_path,
+ target_path);
}
static std::string create_system_targets_shortcut() noexcept
@@ -46,7 +50,9 @@ namespace vcpkg::Commands::Integrate
<Error Text="Unsupported architecture combination. Remove the 'vcpkg' nuget package." Condition="'$(VCPkgEnabled)' != 'true' and '$(VCPkgDisableError)' == ''"/>
</Target>
</Project>
-)###", as_string, as_string);
+)###",
+ as_string,
+ as_string);
}
static std::string create_nuget_props_file_contents() noexcept
@@ -73,7 +79,9 @@ namespace vcpkg::Commands::Integrate
return nuget_id;
}
- static std::string create_nuspec_file_contents(const fs::path& vcpkg_root_dir, const std::string& nuget_id, const std::string& nupkg_version)
+ static std::string create_nuspec_file_contents(const fs::path& vcpkg_root_dir,
+ const std::string& nuget_id,
+ const std::string& nupkg_version)
{
static constexpr auto content_template = R"(
<package>
@@ -133,7 +141,8 @@ namespace vcpkg::Commands::Integrate
static fs::path get_appdata_targets_path()
{
- static const fs::path local_app_data = fs::path(System::get_environmental_variable(L"LOCALAPPDATA").value_or_exit(VCPKG_LINE_INFO));
+ static const fs::path local_app_data =
+ fs::path(System::get_environmental_variable(L"LOCALAPPDATA").value_or_exit(VCPKG_LINE_INFO));
return local_app_data / "vcpkg" / "vcpkg.user.targets";
}
@@ -146,17 +155,16 @@ namespace vcpkg::Commands::Integrate
{
if (fs.exists(old_system_wide_targets_file))
{
- const std::string param = Strings::format(R"(/c DEL "%s" /Q > nul)", old_system_wide_targets_file.string());
+ const std::string param =
+ Strings::format(R"(/c DEL "%s" /Q > nul)", old_system_wide_targets_file.string());
ElevationPromptChoice user_choice = elevated_cmd_execute(param);
switch (user_choice)
{
- case ElevationPromptChoice::YES:
- break;
+ case ElevationPromptChoice::YES: break;
case ElevationPromptChoice::NO:
System::println(System::Color::warning, "Warning: Previous integration file was not removed");
Checks::exit_fail(VCPKG_LINE_INFO);
- default:
- Checks::unreachable(VCPKG_LINE_INFO);
+ default: Checks::unreachable(VCPKG_LINE_INFO);
}
}
}
@@ -176,8 +184,7 @@ namespace vcpkg::Commands::Integrate
if (found)
{
int ver = atoi(match[1].str().c_str());
- if (ver >= 1)
- should_install_system = false;
+ if (ver >= 1) should_install_system = false;
}
}
@@ -186,31 +193,39 @@ namespace vcpkg::Commands::Integrate
const fs::path sys_src_path = tmp_dir / "vcpkg.system.targets";
fs.write_contents(sys_src_path, create_system_targets_shortcut());
- const std::string param = Strings::format(R"(/c mkdir "%s" & copy "%s" "%s" /Y > nul)", system_wide_targets_file.parent_path().string(), sys_src_path.string(), system_wide_targets_file.string());
+ const std::string param = Strings::format(R"(/c mkdir "%s" & copy "%s" "%s" /Y > nul)",
+ system_wide_targets_file.parent_path().string(),
+ sys_src_path.string(),
+ system_wide_targets_file.string());
ElevationPromptChoice user_choice = elevated_cmd_execute(param);
switch (user_choice)
{
- case ElevationPromptChoice::YES:
- break;
+ case ElevationPromptChoice::YES: break;
case ElevationPromptChoice::NO:
System::println(System::Color::warning, "Warning: integration was not applied");
Checks::exit_fail(VCPKG_LINE_INFO);
- default:
- Checks::unreachable(VCPKG_LINE_INFO);
+ default: Checks::unreachable(VCPKG_LINE_INFO);
}
- Checks::check_exit(VCPKG_LINE_INFO, fs.exists(system_wide_targets_file), "Error: failed to copy targets file to %s", system_wide_targets_file.string());
+ Checks::check_exit(VCPKG_LINE_INFO,
+ fs.exists(system_wide_targets_file),
+ "Error: failed to copy targets file to %s",
+ system_wide_targets_file.string());
}
const fs::path appdata_src_path = tmp_dir / "vcpkg.user.targets";
- fs.write_contents(appdata_src_path, create_appdata_targets_shortcut(paths.buildsystems_msbuild_targets.string()));
+ fs.write_contents(appdata_src_path,
+ create_appdata_targets_shortcut(paths.buildsystems_msbuild_targets.string()));
auto appdata_dst_path = get_appdata_targets_path();
auto rc = fs.copy_file(appdata_src_path, appdata_dst_path, fs::copy_options::overwrite_existing, ec);
if (!rc || ec)
{
- System::println(System::Color::error, "Error: Failed to copy file: %s -> %s", appdata_src_path.string(), appdata_dst_path.string());
+ System::println(System::Color::error,
+ "Error: Failed to copy file: %s -> %s",
+ appdata_src_path.string(),
+ appdata_dst_path.string());
Checks::exit_fail(VCPKG_LINE_INFO);
}
System::println(System::Color::success, "Applied user-wide integration for this vcpkg root.");
@@ -220,7 +235,8 @@ namespace vcpkg::Commands::Integrate
"Linking will be handled automatically.\n"
"Installing new libraries will make them instantly available.\n"
"\n"
- "CMake projects should use -DCMAKE_TOOLCHAIN_FILE=%s", cmake_toolchain.generic_string());
+ "CMake projects should use -DCMAKE_TOOLCHAIN_FILE=%s",
+ cmake_toolchain.generic_string());
Checks::exit_success(VCPKG_LINE_INFO);
}
@@ -269,12 +285,16 @@ namespace vcpkg::Commands::Integrate
fs.write_contents(nuspec_file_path, create_nuspec_file_contents(paths.root, nuget_id, nupkg_version));
// Using all forward slashes for the command line
- const std::wstring cmd_line = Strings::wformat(LR"("%s" pack -OutputDirectory "%s" "%s" > nul)", nuget_exe.native(), buildsystems_dir.native(), nuspec_file_path.native());
+ const std::wstring cmd_line = Strings::wformat(LR"("%s" pack -OutputDirectory "%s" "%s" > nul)",
+ nuget_exe.native(),
+ buildsystems_dir.native(),
+ nuspec_file_path.native());
const int exit_code = System::cmd_execute_clean(cmd_line);
const fs::path nuget_package = buildsystems_dir / Strings::format("%s.%s.nupkg", nuget_id, nupkg_version);
- Checks::check_exit(VCPKG_LINE_INFO, exit_code == 0 && fs.exists(nuget_package), "Error: NuGet package creation failed");
+ Checks::check_exit(
+ VCPKG_LINE_INFO, exit_code == 0 && fs.exists(nuget_package), "Error: NuGet package creation failed");
System::println(System::Color::success, "Created nupkg: %s", nuget_package.string());
auto source_path = buildsystems_dir.u8string();
@@ -283,20 +303,24 @@ namespace vcpkg::Commands::Integrate
System::println(R"(
With a project open, go to Tools->NuGet Package Manager->Package Manager Console and paste:
Install-Package %s -Source "%s"
-)", nuget_id, source_path);
+)",
+ nuget_id,
+ source_path);
Checks::exit_success(VCPKG_LINE_INFO);
}
const char* const INTEGRATE_COMMAND_HELPSTRING =
- " vcpkg integrate install Make installed packages available user-wide. Requires admin privileges on first use\n"
- " vcpkg integrate remove Remove user-wide integration\n"
- " vcpkg integrate project Generate a referencing nuget package for individual VS project use\n";
+ " vcpkg integrate install Make installed packages available user-wide. Requires admin privileges on "
+ "first use\n"
+ " vcpkg integrate remove Remove user-wide integration\n"
+ " vcpkg integrate project Generate a referencing nuget package for individual VS project use\n";
void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths)
{
static const std::string example = Strings::format("Commands:\n"
- "%s", INTEGRATE_COMMAND_HELPSTRING);
+ "%s",
+ INTEGRATE_COMMAND_HELPSTRING);
args.check_exact_arg_count(1, example);
args.check_and_get_optional_command_arguments({});