Skip to content

Commit

Permalink
[vcpkg] Refactor Commands: Part 1 (#12585)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
strega-nil authored Jul 31, 2020
1 parent 37f7d69 commit 56fffbe
Show file tree
Hide file tree
Showing 59 changed files with 513 additions and 284 deletions.
8 changes: 8 additions & 0 deletions toolsrc/include/vcpkg/commands.autocomplete.h
Original file line number Diff line number Diff line change
@@ -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);
}
8 changes: 8 additions & 0 deletions toolsrc/include/vcpkg/commands.buildexternal.h
Original file line number Diff line number Diff line change
@@ -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);
}
8 changes: 8 additions & 0 deletions toolsrc/include/vcpkg/commands.cache.h
Original file line number Diff line number Diff line change
@@ -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);
}
9 changes: 9 additions & 0 deletions toolsrc/include/vcpkg/commands.ci.h
Original file line number Diff line number Diff line change
@@ -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);
}
8 changes: 8 additions & 0 deletions toolsrc/include/vcpkg/commands.ciclean.h
Original file line number Diff line number Diff line change
@@ -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);
}
10 changes: 10 additions & 0 deletions toolsrc/include/vcpkg/commands.contact.h
Original file line number Diff line number Diff line change
@@ -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);
}
10 changes: 10 additions & 0 deletions toolsrc/include/vcpkg/commands.create.h
Original file line number Diff line number Diff line change
@@ -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);
}
9 changes: 9 additions & 0 deletions toolsrc/include/vcpkg/commands.dependinfo.h
Original file line number Diff line number Diff line change
@@ -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);
}
9 changes: 9 additions & 0 deletions toolsrc/include/vcpkg/commands.edit.h
Original file line number Diff line number Diff line change
@@ -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);
}
9 changes: 9 additions & 0 deletions toolsrc/include/vcpkg/commands.env.h
Original file line number Diff line number Diff line change
@@ -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);
}
8 changes: 8 additions & 0 deletions toolsrc/include/vcpkg/commands.fetch.h
Original file line number Diff line number Diff line change
@@ -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);
}
9 changes: 9 additions & 0 deletions toolsrc/include/vcpkg/commands.format-manifest.h
Original file line number Diff line number Diff line change
@@ -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);
}
155 changes: 1 addition & 154 deletions toolsrc/include/vcpkg/commands.h
Original file line number Diff line number Diff line change
@@ -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>
Expand All @@ -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
{
Expand Down
8 changes: 8 additions & 0 deletions toolsrc/include/vcpkg/commands.hash.h
Original file line number Diff line number Diff line change
@@ -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);
}
12 changes: 12 additions & 0 deletions toolsrc/include/vcpkg/commands.integrate.h
Original file line number Diff line number Diff line change
@@ -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();
}
13 changes: 13 additions & 0 deletions toolsrc/include/vcpkg/commands.interface.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#pragma once

#include <vcpkg/vcpkgcmdarguments.h>
#include <vcpkg/vcpkgpaths.h>

namespace vcpkg::Commands
{
enum class DryRun : bool
{
No,
Yes,
};
}
9 changes: 9 additions & 0 deletions toolsrc/include/vcpkg/commands.list.h
Original file line number Diff line number Diff line change
@@ -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);
}
9 changes: 9 additions & 0 deletions toolsrc/include/vcpkg/commands.owns.h
Original file line number Diff line number Diff line change
@@ -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);
}
8 changes: 8 additions & 0 deletions toolsrc/include/vcpkg/commands.porthistory.h
Original file line number Diff line number Diff line change
@@ -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);
}
8 changes: 8 additions & 0 deletions toolsrc/include/vcpkg/commands.portsdiff.h
Original file line number Diff line number Diff line change
@@ -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);
}
9 changes: 9 additions & 0 deletions toolsrc/include/vcpkg/commands.search.h
Original file line number Diff line number Diff line change
@@ -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);
}
20 changes: 20 additions & 0 deletions toolsrc/include/vcpkg/commands.setinstalled.h
Original file line number Diff line number Diff line change
@@ -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);
}
Loading

0 comments on commit 56fffbe

Please sign in to comment.