[vcpkg] Refactor Commands: Part 1 (#12585)

* Rename commands.exportifw.cpp -> export.ifw.cpp

* move DryRun from commands.h -> commands.interface.h

* move vcpkgcmdarguments and vcpkgpaths over to commands.interface.h

* move vcpkg::Commands::BuildExternal -> commands.buildexternal.h

* add commands.*.h for the commands.*.cpp

* move vcpkg::Commands::* to commands.*.h

* move vcpkg::Commands::{Hash,Fetch} to their own files

* change include commands.h -> commands.*.h in commands.*.cpp

* remove commands.*.h from commands.h

* join vcpkg::Commands::* into one namespace line

* fix vcxproj build
This commit is contained in:
nicole mazzuca 2020-07-31 11:53:42 -07:00 committed by GitHub
parent 37f7d69757
commit 56fffbe49d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
59 changed files with 513 additions and 284 deletions

View File

@ -0,0 +1,8 @@
#pragma once
#include <vcpkg/commands.interface.h>
namespace vcpkg::Commands::Autocomplete
{
void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths);
}

View File

@ -0,0 +1,8 @@
#pragma once
#include <vcpkg/commands.interface.h>
namespace vcpkg::Commands::BuildExternal
{
void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths, Triplet default_triplet);
}

View File

@ -0,0 +1,8 @@
#pragma once
#include <vcpkg/commands.interface.h>
namespace vcpkg::Commands::Cache
{
void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths);
}

View File

@ -0,0 +1,9 @@
#pragma once
#include <vcpkg/commands.interface.h>
namespace vcpkg::Commands::CI
{
extern const CommandStructure COMMAND_STRUCTURE;
void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths, Triplet default_triplet);
}

View File

@ -0,0 +1,8 @@
#pragma once
#include <vcpkg/commands.interface.h>
namespace vcpkg::Commands::CIClean
{
void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths);
}

View File

@ -0,0 +1,10 @@
#pragma once
#include <vcpkg/commands.interface.h>
namespace vcpkg::Commands::Contact
{
extern const CommandStructure COMMAND_STRUCTURE;
const std::string& email();
void perform_and_exit(const VcpkgCmdArguments& args, Files::Filesystem& fs);
}

View File

@ -0,0 +1,10 @@
#pragma once
#include <vcpkg/commands.interface.h>
namespace vcpkg::Commands::Create
{
extern const CommandStructure COMMAND_STRUCTURE;
int perform(const VcpkgCmdArguments& args, const VcpkgPaths& paths);
void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths);
}

View File

@ -0,0 +1,9 @@
#pragma once
#include <vcpkg/commands.interface.h>
namespace vcpkg::Commands::DependInfo
{
extern const CommandStructure COMMAND_STRUCTURE;
void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths, Triplet default_triplet);
}

View File

@ -0,0 +1,9 @@
#pragma once
#include <vcpkg/commands.interface.h>
namespace vcpkg::Commands::Edit
{
extern const CommandStructure COMMAND_STRUCTURE;
void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths);
}

View File

@ -0,0 +1,9 @@
#pragma once
#include <vcpkg/commands.interface.h>
namespace vcpkg::Commands::Env
{
extern const CommandStructure COMMAND_STRUCTURE;
void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths, Triplet default_triplet);
}

View File

@ -0,0 +1,8 @@
#pragma once
#include <vcpkg/commands.interface.h>
namespace vcpkg::Commands::Fetch
{
void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths);
}

View File

@ -0,0 +1,9 @@
#pragma once
#include <vcpkg/commands.interface.h>
namespace vcpkg::Commands::FormatManifest
{
extern const CommandStructure COMMAND_STRUCTURE;
void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths);
}

View File

@ -1,10 +1,9 @@
#pragma once
#include <vcpkg/build.h>
#include <vcpkg/commands.interface.h>
#include <vcpkg/dependencies.h>
#include <vcpkg/statusparagraphs.h>
#include <vcpkg/vcpkgcmdarguments.h>
#include <vcpkg/vcpkgpaths.h>
#include <array>
#include <map>
@ -16,158 +15,6 @@ namespace vcpkg::Commands
using CommandTypeB = void (*)(const VcpkgCmdArguments& args, const VcpkgPaths& paths);
using CommandTypeC = void (*)(const VcpkgCmdArguments& args, Files::Filesystem& fs);
enum class DryRun : bool
{
No,
Yes,
};
namespace BuildExternal
{
void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths, Triplet default_triplet);
}
namespace CI
{
extern const CommandStructure COMMAND_STRUCTURE;
void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths, Triplet default_triplet);
}
namespace CIClean
{
void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths);
}
namespace Env
{
extern const CommandStructure COMMAND_STRUCTURE;
void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths, Triplet default_triplet);
}
namespace Create
{
extern const CommandStructure COMMAND_STRUCTURE;
int perform(const VcpkgCmdArguments& args, const VcpkgPaths& paths);
void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths);
}
namespace Upgrade
{
extern const CommandStructure COMMAND_STRUCTURE;
void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths, Triplet default_triplet);
}
namespace Edit
{
extern const CommandStructure COMMAND_STRUCTURE;
void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths);
}
namespace DependInfo
{
extern const CommandStructure COMMAND_STRUCTURE;
void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths, Triplet default_triplet);
}
namespace Search
{
extern const CommandStructure COMMAND_STRUCTURE;
void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths);
}
namespace List
{
extern const CommandStructure COMMAND_STRUCTURE;
void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths);
}
namespace Owns
{
extern const CommandStructure COMMAND_STRUCTURE;
void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths);
}
namespace Cache
{
void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths);
}
namespace Integrate
{
extern const CommandStructure COMMAND_STRUCTURE;
void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths);
void append_helpstring(HelpTableFormatter& table);
std::string get_helpstring();
}
namespace PortsDiff
{
void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths);
}
namespace PortHistory
{
void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths);
}
namespace Autocomplete
{
void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths);
}
namespace Version
{
const char* base_version();
const std::string& version();
void warn_if_vcpkg_version_mismatch(const VcpkgPaths& paths);
void perform_and_exit(const VcpkgCmdArguments& args, Files::Filesystem& fs);
}
namespace Contact
{
extern const CommandStructure COMMAND_STRUCTURE;
const std::string& email();
void perform_and_exit(const VcpkgCmdArguments& args, Files::Filesystem& fs);
}
namespace X_VSInstances
{
extern const CommandStructure COMMAND_STRUCTURE;
void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths);
}
namespace Hash
{
void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths);
}
namespace Fetch
{
void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths);
}
namespace FormatManifest
{
extern const CommandStructure COMMAND_STRUCTURE;
void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths);
}
namespace SetInstalled
{
extern const CommandStructure COMMAND_STRUCTURE;
void perform_and_exit_ex(const VcpkgCmdArguments& args,
const VcpkgPaths& paths,
const PortFileProvider::PathsPortFileProvider& provider,
IBinaryProvider& binary_provider,
const CMakeVars::CMakeVarProvider& cmake_vars,
const std::vector<FullPackageSpec>& specs,
const Build::BuildPackageOptions& install_plan_options,
DryRun dry_run,
const Optional<fs::path>& pkgsconfig_path);
void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths, Triplet default_triplet);
}
template<class T>
struct PackageNameAndFunction
{

View File

@ -0,0 +1,8 @@
#pragma once
#include <vcpkg/commands.interface.h>
namespace vcpkg::Commands::Hash
{
void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths);
}

View File

@ -0,0 +1,12 @@
#pragma once
#include <vcpkg/commands.interface.h>
namespace vcpkg::Commands::Integrate
{
extern const CommandStructure COMMAND_STRUCTURE;
void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths);
void append_helpstring(HelpTableFormatter& table);
std::string get_helpstring();
}

View File

@ -0,0 +1,13 @@
#pragma once
#include <vcpkg/vcpkgcmdarguments.h>
#include <vcpkg/vcpkgpaths.h>
namespace vcpkg::Commands
{
enum class DryRun : bool
{
No,
Yes,
};
}

View File

@ -0,0 +1,9 @@
#pragma once
#include <vcpkg/commands.interface.h>
namespace vcpkg::Commands::List
{
extern const CommandStructure COMMAND_STRUCTURE;
void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths);
}

View File

@ -0,0 +1,9 @@
#pragma once
#include <vcpkg/commands.interface.h>
namespace vcpkg::Commands::Owns
{
extern const CommandStructure COMMAND_STRUCTURE;
void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths);
}

View File

@ -0,0 +1,8 @@
#pragma once
#include <vcpkg/commands.interface.h>
namespace vcpkg::Commands::PortHistory
{
void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths);
}

View File

@ -0,0 +1,8 @@
#pragma once
#include <vcpkg/commands.interface.h>
namespace vcpkg::Commands::PortsDiff
{
void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths);
}

View File

@ -0,0 +1,9 @@
#pragma once
#include <vcpkg/commands.interface.h>
namespace vcpkg::Commands::Search
{
extern const CommandStructure COMMAND_STRUCTURE;
void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths);
}

View File

@ -0,0 +1,20 @@
#pragma once
#include <vcpkg/cmakevars.h>
#include <vcpkg/commands.interface.h>
#include <vcpkg/portfileprovider.h>
namespace vcpkg::Commands::SetInstalled
{
extern const CommandStructure COMMAND_STRUCTURE;
void perform_and_exit_ex(const VcpkgCmdArguments& args,
const VcpkgPaths& paths,
const PortFileProvider::PathsPortFileProvider& provider,
IBinaryProvider& binary_provider,
const CMakeVars::CMakeVarProvider& cmake_vars,
const std::vector<FullPackageSpec>& specs,
const Build::BuildPackageOptions& install_plan_options,
DryRun dry_run,
const Optional<fs::path>& pkgsconfig_path);
void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths, Triplet default_triplet);
}

View File

@ -0,0 +1,9 @@
#pragma once
#include <vcpkg/commands.interface.h>
namespace vcpkg::Commands::Upgrade
{
extern const CommandStructure COMMAND_STRUCTURE;
void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths, Triplet default_triplet);
}

View File

@ -0,0 +1,11 @@
#pragma once
#include <vcpkg/commands.interface.h>
namespace vcpkg::Commands::Version
{
const char* base_version();
const std::string& version();
void warn_if_vcpkg_version_mismatch(const VcpkgPaths& paths);
void perform_and_exit(const VcpkgCmdArguments& args, Files::Filesystem& fs);
}

View File

@ -0,0 +1,12 @@
#pragma once
#include <vcpkg/commands.interface.h>
namespace vcpkg::Commands
{
namespace X_VSInstances
{
extern const CommandStructure COMMAND_STRUCTURE;
void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths);
}
}

View File

@ -2,7 +2,7 @@
#include <vcpkg/base/files.h>
#include <vcpkg/commands.h>
#include <vcpkg/commands.create.h>
#include <vcpkg/vcpkgcmdarguments.h>
#include <vcpkg/vcpkgpaths.h>

View File

@ -8,7 +8,9 @@
#include <vcpkg/base/system.print.h>
#include <vcpkg/base/system.process.h>
#include <vcpkg/commands.contact.h>
#include <vcpkg/commands.h>
#include <vcpkg/commands.version.h>
#include <vcpkg/globalstate.h>
#include <vcpkg/help.h>
#include <vcpkg/input.h>

View File

@ -16,6 +16,7 @@
#include <vcpkg/build.h>
#include <vcpkg/buildenvironment.h>
#include <vcpkg/commands.h>
#include <vcpkg/commands.version.h>
#include <vcpkg/dependencies.h>
#include <vcpkg/globalstate.h>
#include <vcpkg/help.h>

View File

@ -2,7 +2,10 @@
#include <vcpkg/base/system.print.h>
#include <vcpkg/commands.h>
#include <vcpkg/commands.autocomplete.h>
#include <vcpkg/commands.edit.h>
#include <vcpkg/commands.integrate.h>
#include <vcpkg/commands.upgrade.h>
#include <vcpkg/install.h>
#include <vcpkg/metrics.h>
#include <vcpkg/paragraphs.h>

View File

@ -3,7 +3,7 @@
#include <vcpkg/binarycaching.h>
#include <vcpkg/build.h>
#include <vcpkg/cmakevars.h>
#include <vcpkg/commands.h>
#include <vcpkg/commands.buildexternal.h>
#include <vcpkg/help.h>
#include <vcpkg/input.h>

View File

@ -4,7 +4,7 @@
#include <vcpkg/base/system.print.h>
#include <vcpkg/binaryparagraph.h>
#include <vcpkg/commands.h>
#include <vcpkg/commands.cache.h>
#include <vcpkg/help.h>
#include <vcpkg/paragraphs.h>

View File

@ -9,7 +9,7 @@
#include <vcpkg/binarycaching.h>
#include <vcpkg/build.h>
#include <vcpkg/commands.h>
#include <vcpkg/commands.ci.h>
#include <vcpkg/dependencies.h>
#include <vcpkg/globalstate.h>
#include <vcpkg/help.h>

View File

@ -4,7 +4,7 @@
#include <vcpkg/base/files.h>
#include <vcpkg/base/system.print.h>
#include <vcpkg/commands.h>
#include <vcpkg/commands.ciclean.h>
#include <vcpkg/vcpkgcmdarguments.h>
using namespace vcpkg;

View File

@ -4,7 +4,7 @@
#include <vcpkg/base/system.print.h>
#include <vcpkg/base/system.process.h>
#include <vcpkg/commands.h>
#include <vcpkg/commands.contact.h>
#include <vcpkg/help.h>
#include <vcpkg/userconfig.h>

View File

@ -1,10 +1,32 @@
#include "pch.h"
#include <vcpkg/base/hash.h>
#include <vcpkg/base/system.print.h>
#include <vcpkg/build.h>
#include <vcpkg/commands.autocomplete.h>
#include <vcpkg/commands.buildexternal.h>
#include <vcpkg/commands.cache.h>
#include <vcpkg/commands.ci.h>
#include <vcpkg/commands.ciclean.h>
#include <vcpkg/commands.contact.h>
#include <vcpkg/commands.create.h>
#include <vcpkg/commands.dependinfo.h>
#include <vcpkg/commands.edit.h>
#include <vcpkg/commands.env.h>
#include <vcpkg/commands.fetch.h>
#include <vcpkg/commands.format-manifest.h>
#include <vcpkg/commands.h>
#include <vcpkg/commands.hash.h>
#include <vcpkg/commands.integrate.h>
#include <vcpkg/commands.list.h>
#include <vcpkg/commands.owns.h>
#include <vcpkg/commands.porthistory.h>
#include <vcpkg/commands.portsdiff.h>
#include <vcpkg/commands.search.h>
#include <vcpkg/commands.setinstalled.h>
#include <vcpkg/commands.upgrade.h>
#include <vcpkg/commands.version.h>
#include <vcpkg/commands.xvsinstances.h>
#include <vcpkg/export.h>
#include <vcpkg/help.h>
#include <vcpkg/install.h>
@ -64,53 +86,3 @@ namespace vcpkg::Commands
return t;
}
}
namespace vcpkg::Commands::Fetch
{
const CommandStructure COMMAND_STRUCTURE = {
Strings::format("The argument should be tool name\n%s", create_example_string("fetch cmake")),
1,
1,
{},
nullptr,
};
void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths)
{
Util::unused(args.parse_arguments(COMMAND_STRUCTURE));
const std::string tool = args.command_arguments[0];
const fs::path tool_path = paths.get_tool_exe(tool);
System::print2(tool_path.u8string(), '\n');
Checks::exit_success(VCPKG_LINE_INFO);
}
}
namespace vcpkg::Commands::Hash
{
const CommandStructure COMMAND_STRUCTURE = {
Strings::format("The argument should be a file path\n%s", create_example_string("hash boost_1_62_0.tar.bz2")),
1,
2,
{},
nullptr,
};
void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths)
{
Util::unused(args.parse_arguments(COMMAND_STRUCTURE));
const fs::path file_to_hash = args.command_arguments[0];
auto algorithm = vcpkg::Hash::Algorithm::Sha512;
if (args.command_arguments.size() == 2)
{
algorithm = vcpkg::Hash::algorithm_from_string(args.command_arguments[1]).value_or_exit(VCPKG_LINE_INFO);
}
const std::string hash =
vcpkg::Hash::get_file_hash(VCPKG_LINE_INFO, paths.get_filesystem(), file_to_hash, algorithm);
System::print2(hash, '\n');
Checks::exit_success(VCPKG_LINE_INFO);
}
}

View File

@ -4,7 +4,7 @@
#include <vcpkg/base/files.h>
#include <vcpkg/buildenvironment.h>
#include <vcpkg/commands.h>
#include <vcpkg/commands.create.h>
#include <vcpkg/help.h>
namespace vcpkg::Commands::Create

View File

@ -4,7 +4,7 @@
#include <vcpkg/base/system.print.h>
#include <vcpkg/base/util.h>
#include <vcpkg/commands.h>
#include <vcpkg/commands.dependinfo.h>
#include <vcpkg/dependencies.h>
#include <vcpkg/help.h>
#include <vcpkg/input.h>

View File

@ -4,7 +4,7 @@
#include <vcpkg/base/system.print.h>
#include <vcpkg/base/system.process.h>
#include <vcpkg/commands.h>
#include <vcpkg/commands.edit.h>
#include <vcpkg/help.h>
#include <vcpkg/paragraphs.h>

View File

@ -5,7 +5,7 @@
#include <vcpkg/build.h>
#include <vcpkg/cmakevars.h>
#include <vcpkg/commands.h>
#include <vcpkg/commands.env.h>
#include <vcpkg/help.h>
namespace vcpkg::Commands::Env

View File

@ -0,0 +1,24 @@
#include "pch.h"
#include <vcpkg/commands.fetch.h>
namespace vcpkg::Commands::Fetch
{
const CommandStructure COMMAND_STRUCTURE = {
Strings::format("The argument should be tool name\n%s", create_example_string("fetch cmake")),
1,
1,
{},
nullptr,
};
void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths)
{
Util::unused(args.parse_arguments(COMMAND_STRUCTURE));
const std::string tool = args.command_arguments[0];
const fs::path tool_path = paths.get_tool_exe(tool);
System::print2(tool_path.u8string(), '\n');
Checks::exit_success(VCPKG_LINE_INFO);
}
}

View File

@ -5,7 +5,7 @@
#include <vcpkg/base/json.h>
#include <vcpkg/base/system.debug.h>
#include <vcpkg/commands.h>
#include <vcpkg/commands.format-manifest.h>
#include <vcpkg/portfileprovider.h>
namespace vcpkg::Commands::FormatManifest

View File

@ -0,0 +1,34 @@
#include "pch.h"
#include <vcpkg/base/hash.h>
#include <vcpkg/commands.hash.h>
namespace vcpkg::Commands::Hash
{
const CommandStructure COMMAND_STRUCTURE = {
Strings::format("The argument should be a file path\n%s", create_example_string("hash boost_1_62_0.tar.bz2")),
1,
2,
{},
nullptr,
};
void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths)
{
Util::unused(args.parse_arguments(COMMAND_STRUCTURE));
const fs::path file_to_hash = args.command_arguments[0];
auto algorithm = vcpkg::Hash::Algorithm::Sha512;
if (args.command_arguments.size() == 2)
{
algorithm = vcpkg::Hash::algorithm_from_string(args.command_arguments[1]).value_or_exit(VCPKG_LINE_INFO);
}
const std::string hash =
vcpkg::Hash::get_file_hash(VCPKG_LINE_INFO, paths.get_filesystem(), file_to_hash, algorithm);
System::print2(hash, '\n');
Checks::exit_success(VCPKG_LINE_INFO);
}
}

View File

@ -7,7 +7,7 @@
#include <vcpkg/base/system.process.h>
#include <vcpkg/base/util.h>
#include <vcpkg/commands.h>
#include <vcpkg/commands.integrate.h>
#include <vcpkg/metrics.h>
#include <vcpkg/userconfig.h>
@ -16,10 +16,10 @@ namespace vcpkg::Commands::Integrate
#if defined(_WIN32)
static std::string create_appdata_shortcut(const std::string& target_path) noexcept
{
return Strings::format(R"###(
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Condition="Exists('%s') and '$(VCPkgLocalAppDataDisabled)' == ''" Project="%s" />
</Project>
return Strings::format(R"###(
<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);
@ -29,15 +29,15 @@ namespace vcpkg::Commands::Integrate
#if defined(_WIN32)
static std::string create_system_targets_shortcut() noexcept
{
return R"###(
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<!-- version 1 -->
<PropertyGroup>
<VCLibPackagePath Condition="'$(VCLibPackagePath)' == ''">$(LOCALAPPDATA)\vcpkg\vcpkg.user</VCLibPackagePath>
</PropertyGroup>
<Import Condition="'$(VCLibPackagePath)' != '' and Exists('$(VCLibPackagePath).props')" Project="$(VCLibPackagePath).props" />
<Import Condition="'$(VCLibPackagePath)' != '' and Exists('$(VCLibPackagePath).targets')" Project="$(VCLibPackagePath).targets" />
</Project>
return R"###(
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<!-- version 1 -->
<PropertyGroup>
<VCLibPackagePath Condition="'$(VCLibPackagePath)' == ''">$(LOCALAPPDATA)\vcpkg\vcpkg.user</VCLibPackagePath>
</PropertyGroup>
<Import Condition="'$(VCLibPackagePath)' != '' and Exists('$(VCLibPackagePath).props')" Project="$(VCLibPackagePath).props" />
<Import Condition="'$(VCLibPackagePath)' != '' and Exists('$(VCLibPackagePath).targets')" Project="$(VCLibPackagePath).targets" />
</Project>
)###";
}
#endif
@ -47,13 +47,13 @@ namespace vcpkg::Commands::Integrate
{
const std::string as_string = msbuild_vcpkg_targets_file.string();
return Strings::format(R"###(
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="%s" Condition="Exists('%s')" />
<Target Name="CheckValidPlatform" BeforeTargets="Build">
<Error Text="Unsupported architecture combination. Remove the 'vcpkg' nuget package." Condition="'$(VCPkgEnabled)' != 'true' and '$(VCPkgDisableError)' == ''"/>
</Target>
</Project>
return Strings::format(R"###(
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="%s" Condition="Exists('%s')" />
<Target Name="CheckValidPlatform" BeforeTargets="Build">
<Error Text="Unsupported architecture combination. Remove the 'vcpkg' nuget package." Condition="'$(VCPkgEnabled)' != 'true' and '$(VCPkgDisableError)' == ''"/>
</Target>
</Project>
)###",
as_string,
as_string);
@ -63,12 +63,12 @@ namespace vcpkg::Commands::Integrate
#if defined(_WIN32)
static std::string create_nuget_props_file_contents() noexcept
{
return R"###(
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<VCPkgLocalAppDataDisabled>true</VCPkgLocalAppDataDisabled>
</PropertyGroup>
</Project>
return R"###(
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<VCPkgLocalAppDataDisabled>true</VCPkgLocalAppDataDisabled>
</PropertyGroup>
</Project>
)###";
}
#endif
@ -93,21 +93,21 @@ namespace vcpkg::Commands::Integrate
const std::string& nuget_id,
const std::string& nupkg_version)
{
static constexpr auto CONTENT_TEMPLATE = R"(
<package>
<metadata>
<id>@NUGET_ID@</id>
<version>@VERSION@</version>
<authors>vcpkg</authors>
<description>
This package imports all libraries currently installed in @VCPKG_DIR@. This package does not contain any libraries and instead refers to the folder directly (like a symlink).
</description>
</metadata>
<files>
<file src="vcpkg.nuget.props" target="build\native\@NUGET_ID@.props" />
<file src="vcpkg.nuget.targets" target="build\native\@NUGET_ID@.targets" />
</files>
</package>
static constexpr auto CONTENT_TEMPLATE = R"(
<package>
<metadata>
<id>@NUGET_ID@</id>
<version>@VERSION@</version>
<authors>vcpkg</authors>
<description>
This package imports all libraries currently installed in @VCPKG_DIR@. This package does not contain any libraries and instead refers to the folder directly (like a symlink).
</description>
</metadata>
<files>
<file src="vcpkg.nuget.props" target="build\native\@NUGET_ID@.props" />
<file src="vcpkg.nuget.targets" target="build\native\@NUGET_ID@.targets" />
</files>
</package>
)";
std::string content = Strings::replace_all(CONTENT_TEMPLATE, "@NUGET_ID@", nuget_id);
@ -301,18 +301,18 @@ namespace vcpkg::Commands::Integrate
const fs::path cmake_toolchain = paths.buildsystems / "vcpkg.cmake";
#if defined(_WIN32)
System::printf(
R"(
All MSBuild C++ projects can now #include any installed libraries.
Linking will be handled automatically.
Installing new libraries will make them instantly available.
CMake projects should use: "-DCMAKE_TOOLCHAIN_FILE=%s"
R"(
All MSBuild C++ projects can now #include any installed libraries.
Linking will be handled automatically.
Installing new libraries will make them instantly available.
CMake projects should use: "-DCMAKE_TOOLCHAIN_FILE=%s"
)",
cmake_toolchain.generic_u8string());
#else
System::printf(
R"(
CMake projects should use: "-DCMAKE_TOOLCHAIN_FILE=%s"
R"(
CMake projects should use: "-DCMAKE_TOOLCHAIN_FILE=%s"
)",
cmake_toolchain.generic_u8string());
#endif
@ -394,10 +394,10 @@ CMake projects should use: "-DCMAKE_TOOLCHAIN_FILE=%s"
auto source_path = buildsystems_dir.u8string();
source_path = Strings::replace_all(std::move(source_path), "`", "``");
System::printf(R"(
With a project open, go to Tools->NuGet Package Manager->Package Manager Console and paste:
Install-Package %s -Source "%s"
System::printf(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);

View File

@ -2,7 +2,7 @@
#include <vcpkg/base/system.print.h>
#include <vcpkg/commands.h>
#include <vcpkg/commands.list.h>
#include <vcpkg/help.h>
#include <vcpkg/vcpkglib.h>
#include <vcpkg/versiont.h>

View File

@ -2,7 +2,7 @@
#include <vcpkg/base/system.print.h>
#include <vcpkg/commands.h>
#include <vcpkg/commands.owns.h>
#include <vcpkg/help.h>
#include <vcpkg/vcpkglib.h>

View File

@ -4,7 +4,7 @@
#include <vcpkg/base/system.process.h>
#include <vcpkg/base/util.h>
#include <vcpkg/commands.h>
#include <vcpkg/commands.porthistory.h>
#include <vcpkg/help.h>
namespace vcpkg::Commands::PortHistory

View File

@ -5,7 +5,7 @@
#include <vcpkg/base/system.process.h>
#include <vcpkg/base/util.h>
#include <vcpkg/commands.h>
#include <vcpkg/commands.portsdiff.h>
#include <vcpkg/help.h>
#include <vcpkg/paragraphs.h>
#include <vcpkg/versiont.h>

View File

@ -2,7 +2,7 @@
#include <vcpkg/base/system.print.h>
#include <vcpkg/commands.h>
#include <vcpkg/commands.search.h>
#include <vcpkg/dependencies.h>
#include <vcpkg/globalstate.h>
#include <vcpkg/help.h>

View File

@ -3,7 +3,7 @@
#include <vcpkg/base/system.print.h>
#include <vcpkg/binarycaching.h>
#include <vcpkg/commands.h>
#include <vcpkg/commands.setinstalled.h>
#include <vcpkg/globalstate.h>
#include <vcpkg/help.h>
#include <vcpkg/input.h>

View File

@ -4,7 +4,7 @@
#include <vcpkg/base/util.h>
#include <vcpkg/binarycaching.h>
#include <vcpkg/commands.h>
#include <vcpkg/commands.upgrade.h>
#include <vcpkg/dependencies.h>
#include <vcpkg/globalstate.h>
#include <vcpkg/help.h>

View File

@ -2,7 +2,7 @@
#include <vcpkg/base/system.print.h>
#include <vcpkg/commands.h>
#include <vcpkg/commands.version.h>
#include <vcpkg/help.h>
#include <vcpkg/metrics.h>

View File

@ -2,7 +2,7 @@
#include <vcpkg/base/system.print.h>
#include <vcpkg/commands.h>
#include <vcpkg/commands.xvsinstances.h>
#include <vcpkg/help.h>
#include <vcpkg/visualstudio.h>

View File

@ -3,7 +3,14 @@
#include <vcpkg/base/system.print.h>
#include <vcpkg/binarycaching.h>
#include <vcpkg/commands.h>
#include <vcpkg/commands.create.h>
#include <vcpkg/commands.dependinfo.h>
#include <vcpkg/commands.edit.h>
#include <vcpkg/commands.env.h>
#include <vcpkg/commands.integrate.h>
#include <vcpkg/commands.list.h>
#include <vcpkg/commands.owns.h>
#include <vcpkg/commands.search.h>
#include <vcpkg/export.h>
#include <vcpkg/help.h>
#include <vcpkg/install.h>

View File

@ -8,7 +8,7 @@
#include <vcpkg/binarycaching.h>
#include <vcpkg/build.h>
#include <vcpkg/cmakevars.h>
#include <vcpkg/commands.h>
#include <vcpkg/commands.setinstalled.h>
#include <vcpkg/dependencies.h>
#include <vcpkg/globalstate.h>
#include <vcpkg/help.h>

View File

@ -8,6 +8,7 @@
#include <vcpkg/base/system.process.h>
#include <vcpkg/commands.h>
#include <vcpkg/commands.version.h>
#include <vcpkg/metrics.h>
#if defined(_WIN32)

View File

@ -4,6 +4,7 @@
#include <vcpkg/base/system.print.h>
#include <vcpkg/commands.h>
#include <vcpkg/commands.integrate.h>
#include <vcpkg/globalstate.h>
#include <vcpkg/metrics.h>
#include <vcpkg/vcpkgcmdarguments.h>

View File

@ -180,6 +180,30 @@
<ClInclude Include="..\include\vcpkg\buildenvironment.h" />
<ClInclude Include="..\include\vcpkg\cmakevars.h" />
<ClInclude Include="..\include\vcpkg\commands.h" />
<ClInclude Include="..\include\vcpkg\commands.autocomplete.h" />
<ClInclude Include="..\include\vcpkg\commands.buildexternal.h" />
<ClInclude Include="..\include\vcpkg\commands.cache.h" />
<ClInclude Include="..\include\vcpkg\commands.ci.h" />
<ClInclude Include="..\include\vcpkg\commands.ciclean.h" />
<ClInclude Include="..\include\vcpkg\commands.contact.h" />
<ClInclude Include="..\include\vcpkg\commands.create.h" />
<ClInclude Include="..\include\vcpkg\commands.dependinfo.h" />
<ClInclude Include="..\include\vcpkg\commands.edit.h" />
<ClInclude Include="..\include\vcpkg\commands.env.h" />
<ClInclude Include="..\include\vcpkg\commands.fetch.h" />
<ClInclude Include="..\include\vcpkg\commands.format-manifest.h" />
<ClInclude Include="..\include\vcpkg\commands.hash.h" />
<ClInclude Include="..\include\vcpkg\commands.integrate.h" />
<ClInclude Include="..\include\vcpkg\commands.interface.h" />
<ClInclude Include="..\include\vcpkg\commands.list.h" />
<ClInclude Include="..\include\vcpkg\commands.owns.h" />
<ClInclude Include="..\include\vcpkg\commands.porthistory.h" />
<ClInclude Include="..\include\vcpkg\commands.portsdiff.h" />
<ClInclude Include="..\include\vcpkg\commands.search.h" />
<ClInclude Include="..\include\vcpkg\commands.setinstalled.h" />
<ClInclude Include="..\include\vcpkg\commands.upgrade.h" />
<ClInclude Include="..\include\vcpkg\commands.version.h" />
<ClInclude Include="..\include\vcpkg\commands.xvsinstances.h" />
<ClInclude Include="..\include\vcpkg\dependencies.h" />
<ClInclude Include="..\include\vcpkg\export.chocolatey.h" />
<ClInclude Include="..\include\vcpkg\export.h" />
@ -253,8 +277,9 @@
<ClCompile Include="..\src\vcpkg\commands.dependinfo.cpp" />
<ClCompile Include="..\src\vcpkg\commands.edit.cpp" />
<ClCompile Include="..\src\vcpkg\commands.env.cpp" />
<ClCompile Include="..\src\vcpkg\commands.exportifw.cpp" />
<ClCompile Include="..\src\vcpkg\commands.fetch.cpp" />
<ClCompile Include="..\src\vcpkg\commands.format-manifest.cpp" />
<ClCompile Include="..\src\vcpkg\commands.hash.cpp" />
<ClCompile Include="..\src\vcpkg\commands.integrate.cpp" />
<ClCompile Include="..\src\vcpkg\commands.list.cpp" />
<ClCompile Include="..\src\vcpkg\commands.owns.cpp" />
@ -268,6 +293,7 @@
<ClCompile Include="..\src\vcpkg\dependencies.cpp" />
<ClCompile Include="..\src\vcpkg\export.cpp" />
<ClCompile Include="..\src\vcpkg\export.chocolatey.cpp" />
<ClCompile Include="..\src\vcpkg\export.ifw.cpp" />
<ClCompile Include="..\src\vcpkg\export.prefab.cpp" />
<ClCompile Include="..\src\vcpkg\globalstate.cpp" />
<ClCompile Include="..\src\vcpkg\help.cpp" />

View File

@ -69,12 +69,15 @@
<ClCompile Include="..\src\vcpkg\commands.env.cpp">
<Filter>Source Files\vcpkg</Filter>
</ClCompile>
<ClCompile Include="..\src\vcpkg\commands.exportifw.cpp">
<ClCompile Include="..\src\vcpkg\commands.fetch.cpp">
<Filter>Source Files\vcpkg</Filter>
</ClCompile>
<ClCompile Include="..\src\vcpkg\commands.format-manifest.cpp">
<Filter>Source Files\vcpkg</Filter>
</ClCompile>
<ClCompile Include="..\src\vcpkg\commands.hash.cpp">
<Filter>Source Files\vcpkg</Filter>
</ClCompile>
<ClCompile Include="..\src\vcpkg\commands.integrate.cpp">
<Filter>Source Files\vcpkg</Filter>
</ClCompile>
@ -105,6 +108,9 @@
<ClCompile Include="..\src\vcpkg\export.chocolatey.cpp">
<Filter>Source Files\vcpkg</Filter>
</ClCompile>
<ClCompile Include="..\src\vcpkg\export.ifw.cpp">
<Filter>Source Files\vcpkg</Filter>
</ClCompile>
<ClCompile Include="..\src\vcpkg\globalstate.cpp">
<Filter>Source Files\vcpkg</Filter>
</ClCompile>
@ -311,6 +317,78 @@
<ClInclude Include="..\include\vcpkg\commands.h">
<Filter>Header Files\vcpkg</Filter>
</ClInclude>
<ClInclude Include="..\include\vcpkg\commands.autocomplete.h">
<Filter>Header Files\vcpkg</Filter>
</ClInclude>
<ClInclude Include="..\include\vcpkg\commands.buildexternal.h">
<Filter>Header Files\vcpkg</Filter>
</ClInclude>
<ClInclude Include="..\include\vcpkg\commands.cache.h">
<Filter>Header Files\vcpkg</Filter>
</ClInclude>
<ClInclude Include="..\include\vcpkg\commands.ci.h">
<Filter>Header Files\vcpkg</Filter>
</ClInclude>
<ClInclude Include="..\include\vcpkg\commands.ciclean.h">
<Filter>Header Files\vcpkg</Filter>
</ClInclude>
<ClInclude Include="..\include\vcpkg\commands.contact.h">
<Filter>Header Files\vcpkg</Filter>
</ClInclude>
<ClInclude Include="..\include\vcpkg\commands.create.h">
<Filter>Header Files\vcpkg</Filter>
</ClInclude>
<ClInclude Include="..\include\vcpkg\commands.dependinfo.h">
<Filter>Header Files\vcpkg</Filter>
</ClInclude>
<ClInclude Include="..\include\vcpkg\commands.edit.h">
<Filter>Header Files\vcpkg</Filter>
</ClInclude>
<ClInclude Include="..\include\vcpkg\commands.env.h">
<Filter>Header Files\vcpkg</Filter>
</ClInclude>
<ClInclude Include="..\include\vcpkg\commands.fetch.h">
<Filter>Header Files\vcpkg</Filter>
</ClInclude>
<ClInclude Include="..\include\vcpkg\commands.format-manifest.h">
<Filter>Header Files\vcpkg</Filter>
</ClInclude>
<ClInclude Include="..\include\vcpkg\commands.hash.h">
<Filter>Header Files\vcpkg</Filter>
</ClInclude>
<ClInclude Include="..\include\vcpkg\commands.integrate.h">
<Filter>Header Files\vcpkg</Filter>
</ClInclude>
<ClInclude Include="..\include\vcpkg\commands.interface.h">
<Filter>Header Files\vcpkg</Filter>
</ClInclude>
<ClInclude Include="..\include\vcpkg\commands.list.h">
<Filter>Header Files\vcpkg</Filter>
</ClInclude>
<ClInclude Include="..\include\vcpkg\commands.owns.h">
<Filter>Header Files\vcpkg</Filter>
</ClInclude>
<ClInclude Include="..\include\vcpkg\commands.porthistory.h">
<Filter>Header Files\vcpkg</Filter>
</ClInclude>
<ClInclude Include="..\include\vcpkg\commands.portsdiff.h">
<Filter>Header Files\vcpkg</Filter>
</ClInclude>
<ClInclude Include="..\include\vcpkg\commands.search.h">
<Filter>Header Files\vcpkg</Filter>
</ClInclude>
<ClInclude Include="..\include\vcpkg\commands.setinstalled.h">
<Filter>Header Files\vcpkg</Filter>
</ClInclude>
<ClInclude Include="..\include\vcpkg\commands.upgrade.h">
<Filter>Header Files\vcpkg</Filter>
</ClInclude>
<ClInclude Include="..\include\vcpkg\commands.version.h">
<Filter>Header Files\vcpkg</Filter>
</ClInclude>
<ClInclude Include="..\include\vcpkg\commands.xvsinstances.h">
<Filter>Header Files\vcpkg</Filter>
</ClInclude>
<ClInclude Include="..\include\vcpkg\dependencies.h">
<Filter>Header Files\vcpkg</Filter>
</ClInclude>