aboutsummaryrefslogtreecommitdiff
path: root/toolsrc/include
diff options
context:
space:
mode:
authorRobert Schumacher <roschuma@microsoft.com>2017-11-16 19:29:32 -0800
committerRobert Schumacher <roschuma@microsoft.com>2017-11-16 19:29:32 -0800
commit468e9e70e644eb26258434c9e27e34935eb3e06d (patch)
tree9990517883eb5512205b2ebcef382f5e61f97cbb /toolsrc/include
parent34b4db1fb45df541b8a2c7592a57ac6a8fd0b900 (diff)
downloadvcpkg-468e9e70e644eb26258434c9e27e34935eb3e06d.tar.gz
vcpkg-468e9e70e644eb26258434c9e27e34935eb3e06d.zip
[vcpkg] Refactor to remove Build::BuildResults -- too similar to ExtendedBuildResult
Diffstat (limited to 'toolsrc/include')
-rw-r--r--toolsrc/include/vcpkg/base/util.h15
-rw-r--r--toolsrc/include/vcpkg/build.h28
-rw-r--r--toolsrc/include/vcpkg/install.h20
3 files changed, 29 insertions, 34 deletions
diff --git a/toolsrc/include/vcpkg/base/util.h b/toolsrc/include/vcpkg/base/util.h
index 8d78fd6cc..6c05a3a9e 100644
--- a/toolsrc/include/vcpkg/base/util.h
+++ b/toolsrc/include/vcpkg/base/util.h
@@ -190,4 +190,19 @@ namespace vcpkg::Util
std::unique_lock<std::mutex> m_lock;
T& m_ptr;
};
+
+ namespace Enum
+ {
+ template<class E>
+ E to_enum(bool b)
+ {
+ return b ? E::YES : E::NO;
+ }
+
+ template<class E>
+ bool to_bool(E e)
+ {
+ return e == E::YES;
+ }
+ }
}
diff --git a/toolsrc/include/vcpkg/build.h b/toolsrc/include/vcpkg/build.h
index cbd34c730..1f6782ccf 100644
--- a/toolsrc/include/vcpkg/build.h
+++ b/toolsrc/include/vcpkg/build.h
@@ -32,30 +32,23 @@ namespace vcpkg::Build
YES
};
- inline UseHeadVersion to_use_head_version(const bool value)
- {
- return value ? UseHeadVersion::YES : UseHeadVersion::NO;
- }
-
- inline bool to_bool(const UseHeadVersion value) { return value == UseHeadVersion::YES; }
-
enum class AllowDownloads
{
NO = 0,
YES
};
- inline AllowDownloads to_allow_downloads(const bool value)
+ enum class CleanBuildtrees
{
- return value ? AllowDownloads::YES : AllowDownloads::NO;
- }
-
- inline bool to_bool(const AllowDownloads value) { return value == AllowDownloads::YES; }
+ NO = 0,
+ YES
+ };
struct BuildPackageOptions
{
UseHeadVersion use_head_version;
AllowDownloads allow_downloads;
+ CleanBuildtrees clean_buildtrees;
};
enum class BuildResult
@@ -69,12 +62,6 @@ namespace vcpkg::Build
EXCLUDED,
};
- struct BuildResults
- {
- BuildResult result_code;
- std::unique_ptr<BinaryControlFile> binary_control_file;
- };
-
static constexpr std::array<BuildResult, 6> BUILD_RESULT_VALUES = {
BuildResult::SUCCEEDED,
BuildResult::BUILD_FAILED,
@@ -108,8 +95,13 @@ namespace vcpkg::Build
struct ExtendedBuildResult
{
+ ExtendedBuildResult(BuildResult code);
+ ExtendedBuildResult(BuildResult code, std::vector<PackageSpec>&& unmet_deps);
+ ExtendedBuildResult(BuildResult code, std::unique_ptr<BinaryControlFile>&& bcf);
+
BuildResult code;
std::vector<PackageSpec> unmet_dependencies;
+ std::unique_ptr<BinaryControlFile> binary_control_file;
};
struct BuildPackageConfig
diff --git a/toolsrc/include/vcpkg/install.h b/toolsrc/include/vcpkg/install.h
index e436e2238..28896adee 100644
--- a/toolsrc/include/vcpkg/install.h
+++ b/toolsrc/include/vcpkg/install.h
@@ -17,17 +17,6 @@ namespace vcpkg::Install
inline KeepGoing to_keep_going(const bool value) { return value ? KeepGoing::YES : KeepGoing::NO; }
- enum class CleanBuildtrees
- {
- NO = 0,
- YES
- };
-
- inline CleanBuildtrees to_clean_buildtrees(const bool value)
- {
- return value ? CleanBuildtrees::YES : CleanBuildtrees::NO;
- }
-
struct SpecSummary
{
SpecSummary(const PackageSpec& spec, const Dependencies::AnyAction* action);
@@ -35,7 +24,7 @@ namespace vcpkg::Install
const BinaryParagraph* get_binary_paragraph() const;
PackageSpec spec;
- Build::BuildResults build_result;
+ Build::ExtendedBuildResult build_result;
std::string timing;
const Dependencies::AnyAction* action;
@@ -66,9 +55,9 @@ namespace vcpkg::Install
const fs::path& listfile() const;
};
- Build::BuildResults perform_install_plan_action(const VcpkgPaths& paths,
- const Dependencies::InstallPlanAction& action,
- StatusParagraphs& status_db);
+ Build::ExtendedBuildResult perform_install_plan_action(const VcpkgPaths& paths,
+ const Dependencies::InstallPlanAction& action,
+ StatusParagraphs& status_db);
enum class InstallResult
{
@@ -85,7 +74,6 @@ namespace vcpkg::Install
InstallSummary perform(const std::vector<Dependencies::AnyAction>& action_plan,
const KeepGoing keep_going,
- const CleanBuildtrees clean_buildtrees,
const VcpkgPaths& paths,
StatusParagraphs& status_db);