aboutsummaryrefslogtreecommitdiff
path: root/toolsrc/include
diff options
context:
space:
mode:
authorRobert Schumacher <roschuma@microsoft.com>2017-02-21 13:39:36 -0800
committerGitHub <noreply@github.com>2017-02-21 13:39:36 -0800
commit7d4df89c1dfff0b2bad0165ac4579f6352935a94 (patch)
tree8b87d29fb74fb24984d5aff9b021f14d95afb5ab /toolsrc/include
parentd9462fdf490d3396cac58b1a935b1b8a982b3a72 (diff)
parentb921dce5fc17bd4c1c206b79eb0a7b8758dcf5bf (diff)
downloadvcpkg-7d4df89c1dfff0b2bad0165ac4579f6352935a94.tar.gz
vcpkg-7d4df89c1dfff0b2bad0165ac4579f6352935a94.zip
Merge branch 'master' into master
Diffstat (limited to 'toolsrc/include')
-rw-r--r--toolsrc/include/PostBuildLint.h2
-rw-r--r--toolsrc/include/PostBuildLint_BuildInfo.h5
-rw-r--r--toolsrc/include/PostBuildLint_BuildPolicies.h13
-rw-r--r--toolsrc/include/PostBuildLint_BuildType.h58
-rw-r--r--toolsrc/include/PostBuildLint_ConfigurationType.h25
-rw-r--r--toolsrc/include/PostBuildLint_LinkageType.h30
-rw-r--r--toolsrc/include/StatusParagraphs.h2
-rw-r--r--toolsrc/include/vcpkg_Checks.h2
-rw-r--r--toolsrc/include/vcpkg_Chrono.h (renamed from toolsrc/include/Stopwatch.h)19
-rw-r--r--toolsrc/include/vcpkg_Commands.h34
-rw-r--r--toolsrc/include/vcpkg_Dependencies.h2
-rw-r--r--toolsrc/include/vcpkg_Enums.h11
-rw-r--r--toolsrc/include/vcpkg_Environment.h4
-rw-r--r--toolsrc/include/vcpkg_System.h5
-rw-r--r--toolsrc/include/vcpkg_info.h10
-rw-r--r--toolsrc/include/vcpkglib.h5
16 files changed, 159 insertions, 68 deletions
diff --git a/toolsrc/include/PostBuildLint.h b/toolsrc/include/PostBuildLint.h
index 215a237aa..73c8ec54b 100644
--- a/toolsrc/include/PostBuildLint.h
+++ b/toolsrc/include/PostBuildLint.h
@@ -4,5 +4,5 @@
namespace vcpkg::PostBuildLint
{
- void perform_all_checks(const package_spec& spec, const vcpkg_paths& paths);
+ size_t perform_all_checks(const package_spec& spec, const vcpkg_paths& paths);
}
diff --git a/toolsrc/include/PostBuildLint_BuildInfo.h b/toolsrc/include/PostBuildLint_BuildInfo.h
index ff996b2b6..7dbadb147 100644
--- a/toolsrc/include/PostBuildLint_BuildInfo.h
+++ b/toolsrc/include/PostBuildLint_BuildInfo.h
@@ -4,6 +4,7 @@
#include "Paragraphs.h"
#include "PostBuildLint_BuildPolicies.h"
#include "opt_bool.h"
+#include "PostBuildLint_LinkageType.h"
namespace vcpkg::PostBuildLint
{
@@ -11,8 +12,8 @@ namespace vcpkg::PostBuildLint
{
static BuildInfo create(std::unordered_map<std::string, std::string> pgh);
- std::string crt_linkage;
- std::string library_linkage;
+ LinkageType::type crt_linkage;
+ LinkageType::type library_linkage;
std::map<BuildPolicies::type, opt_bool_t> policies;
};
diff --git a/toolsrc/include/PostBuildLint_BuildPolicies.h b/toolsrc/include/PostBuildLint_BuildPolicies.h
index 187ba6d64..082de31d0 100644
--- a/toolsrc/include/PostBuildLint_BuildPolicies.h
+++ b/toolsrc/include/PostBuildLint_BuildPolicies.h
@@ -1,17 +1,19 @@
#pragma once
#include <string>
+#include <array>
namespace vcpkg::PostBuildLint::BuildPolicies
{
enum class backing_enum_t
{
- UNKNOWN = 0,
+ NULLVALUE = 0,
EMPTY_PACKAGE,
DLLS_WITHOUT_LIBS
};
struct type
{
+ constexpr type() : backing_enum(backing_enum_t::NULLVALUE) {}
constexpr explicit type(backing_enum_t backing_enum) : backing_enum(backing_enum) { }
constexpr operator backing_enum_t() const { return backing_enum; }
@@ -19,17 +21,16 @@ namespace vcpkg::PostBuildLint::BuildPolicies
const std::string& cmake_variable() const;
private:
- type();
backing_enum_t backing_enum;
};
- static constexpr int value_count = 3;
- const std::vector<type>& values();
+ static const std::string ENUM_NAME = "vcpkg::PostBuildLint::BuildPolicies";
-
- static constexpr type UNKNOWN(backing_enum_t::UNKNOWN);
+ static constexpr type NULLVALUE(backing_enum_t::NULLVALUE);
static constexpr type EMPTY_PACKAGE(backing_enum_t::EMPTY_PACKAGE);
static constexpr type DLLS_WITHOUT_LIBS(backing_enum_t::DLLS_WITHOUT_LIBS);
+ static constexpr std::array<type, 2> values = { EMPTY_PACKAGE, DLLS_WITHOUT_LIBS };
+
type parse(const std::string& s);
}
diff --git a/toolsrc/include/PostBuildLint_BuildType.h b/toolsrc/include/PostBuildLint_BuildType.h
index a5cb24f49..31fbb11c9 100644
--- a/toolsrc/include/PostBuildLint_BuildType.h
+++ b/toolsrc/include/PostBuildLint_BuildType.h
@@ -1,45 +1,47 @@
#pragma once
#include "PostBuildLint_ConfigurationType.h"
#include "PostBuildLint_LinkageType.h"
-#include <vector>
+#include <array>
#include <regex>
-namespace vcpkg::PostBuildLint
+namespace vcpkg::PostBuildLint::BuildType
{
- struct BuildType
+ enum class backing_enum_t
{
- static BuildType value_of(const ConfigurationType& config, const LinkageType& linkage);
+ DEBUG_STATIC = 1,
+ DEBUG_DYNAMIC,
+ RELEASE_STATIC,
+ RELEASE_DYNAMIC
+ };
- static const BuildType DEBUG_STATIC;
- static const BuildType DEBUG_DYNAMIC;
- static const BuildType RELEASE_STATIC;
- static const BuildType RELEASE_DYNAMIC;
+ struct type
+ {
+ type() = delete;
- static const std::vector<BuildType>& values()
- {
- static const std::vector<BuildType> v = { DEBUG_STATIC, DEBUG_DYNAMIC, RELEASE_STATIC, RELEASE_DYNAMIC };
- return v;
- }
+ constexpr explicit type(const backing_enum_t backing_enum, const ConfigurationType::type config, const LinkageType::type linkage) :
+ backing_enum(backing_enum), m_config(config), m_linkage(linkage) { }
- BuildType() = delete;
+ constexpr operator backing_enum_t() const { return backing_enum; }
- const ConfigurationType& config() const;
- const LinkageType& linkage() const;
- std::regex crt_regex() const;
- std::string toString() const;
+ const ConfigurationType::type& config() const;
+ const LinkageType::type& linkage() const;
+ const std::regex& crt_regex() const;
+ const std::string& toString() const;
private:
- BuildType(const ConfigurationType& config, const LinkageType& linkage, const std::string& crt_regex_as_string)
- : m_config(config), m_linkage(linkage), m_crt_regex_as_string(crt_regex_as_string)
- {
- }
-
- ConfigurationType m_config;
- LinkageType m_linkage;
- std::string m_crt_regex_as_string;
+ backing_enum_t backing_enum;
+ ConfigurationType::type m_config;
+ LinkageType::type m_linkage;
};
- bool operator ==(const BuildType& lhs, const BuildType& rhs);
+ static const std::string ENUM_NAME = "vcpkg::PostBuildLint::BuildType";
+
+ static constexpr type DEBUG_STATIC = type(backing_enum_t::DEBUG_STATIC, ConfigurationType::DEBUG, LinkageType::STATIC);
+ static constexpr type DEBUG_DYNAMIC = type(backing_enum_t::DEBUG_DYNAMIC, ConfigurationType::DEBUG, LinkageType::DYNAMIC);
+ static constexpr type RELEASE_STATIC = type(backing_enum_t::RELEASE_STATIC, ConfigurationType::RELEASE, LinkageType::STATIC);
+ static constexpr type RELEASE_DYNAMIC = type(backing_enum_t::RELEASE_DYNAMIC, ConfigurationType::RELEASE, LinkageType::DYNAMIC);
+
+ static constexpr std::array<type, 4> values = { DEBUG_STATIC, DEBUG_DYNAMIC, RELEASE_STATIC, RELEASE_DYNAMIC };
- bool operator !=(const BuildType& lhs, const BuildType& rhs);
+ type value_of(const ConfigurationType::type& config, const LinkageType::type& linkage);
}
diff --git a/toolsrc/include/PostBuildLint_ConfigurationType.h b/toolsrc/include/PostBuildLint_ConfigurationType.h
index 55dede921..7245d2932 100644
--- a/toolsrc/include/PostBuildLint_ConfigurationType.h
+++ b/toolsrc/include/PostBuildLint_ConfigurationType.h
@@ -2,13 +2,32 @@
#pragma once
#include <string>
-namespace vcpkg::PostBuildLint
+namespace vcpkg::PostBuildLint::ConfigurationType
{
- enum class ConfigurationType
+ enum class backing_enum_t
{
+ NULLVALUE = 0,
DEBUG = 1,
RELEASE = 2
};
- std::string to_string(const ConfigurationType& conf);
+ struct type
+ {
+ constexpr type() : backing_enum(backing_enum_t::NULLVALUE) {}
+ constexpr explicit type(backing_enum_t backing_enum) : backing_enum(backing_enum) { }
+ constexpr operator backing_enum_t() const { return backing_enum; }
+
+ const std::string& toString() const;
+
+ private:
+ backing_enum_t backing_enum;
+ };
+
+ static const std::string ENUM_NAME = "vcpkg::PostBuildLint::ConfigurationType";
+
+ static constexpr type NULLVALUE(backing_enum_t::NULLVALUE);
+ static constexpr type DEBUG(backing_enum_t::DEBUG);
+ static constexpr type RELEASE(backing_enum_t::RELEASE);
+
+ static constexpr std::array<type, 2> values = { DEBUG, RELEASE };
}
diff --git a/toolsrc/include/PostBuildLint_LinkageType.h b/toolsrc/include/PostBuildLint_LinkageType.h
index 7cca97639..0cecc8c9f 100644
--- a/toolsrc/include/PostBuildLint_LinkageType.h
+++ b/toolsrc/include/PostBuildLint_LinkageType.h
@@ -1,16 +1,34 @@
#pragma once
#include <string>
-namespace vcpkg::PostBuildLint
+namespace vcpkg::PostBuildLint::LinkageType
{
- enum class LinkageType
+ enum class backing_enum_t
{
+ NULLVALUE = 0,
DYNAMIC,
- STATIC,
- UNKNOWN
+ STATIC
};
- LinkageType linkage_type_value_of(const std::string& as_string);
+ struct type
+ {
+ constexpr type() : backing_enum(backing_enum_t::NULLVALUE) {}
+ constexpr explicit type(backing_enum_t backing_enum) : backing_enum(backing_enum) { }
+ constexpr operator backing_enum_t() const { return backing_enum; }
+
+ const std::string& toString() const;
+
+ private:
+ backing_enum_t backing_enum;
+ };
+
+ static const std::string ENUM_NAME = "vcpkg::PostBuildLint::LinkageType";
+
+ static constexpr type NULLVALUE(backing_enum_t::NULLVALUE);
+ static constexpr type DYNAMIC(backing_enum_t::DYNAMIC);
+ static constexpr type STATIC(backing_enum_t::STATIC);
+
+ static constexpr std::array<type, 2> values = { DYNAMIC, STATIC };
- std::string to_string(const LinkageType& build_info);
+ type value_of(const std::string& as_string);
}
diff --git a/toolsrc/include/StatusParagraphs.h b/toolsrc/include/StatusParagraphs.h
index 11491cf4e..3c5d35183 100644
--- a/toolsrc/include/StatusParagraphs.h
+++ b/toolsrc/include/StatusParagraphs.h
@@ -20,7 +20,7 @@ namespace vcpkg
}
const_iterator find(const std::string& name, const triplet& target_triplet) const;
iterator find(const std::string& name, const triplet& target_triplet);
- iterator find_installed(const std::string& name, const triplet& target_triplet);
+ const_iterator find_installed(const std::string& name, const triplet& target_triplet) const;
iterator insert(std::unique_ptr<StatusParagraph>);
diff --git a/toolsrc/include/vcpkg_Checks.h b/toolsrc/include/vcpkg_Checks.h
index a58b38ac0..23869f35f 100644
--- a/toolsrc/include/vcpkg_Checks.h
+++ b/toolsrc/include/vcpkg_Checks.h
@@ -35,6 +35,8 @@ namespace vcpkg::Checks
}
}
+ void check_exit(bool expression);
+
void check_exit(bool expression, const char* errorMessage);
template <class...Args>
diff --git a/toolsrc/include/Stopwatch.h b/toolsrc/include/vcpkg_Chrono.h
index 105a4b1ee..e4ae121b3 100644
--- a/toolsrc/include/Stopwatch.h
+++ b/toolsrc/include/vcpkg_Chrono.h
@@ -5,6 +5,25 @@
namespace vcpkg
{
+ class ElapsedTime
+ {
+ public:
+ static ElapsedTime createStarted();
+
+ constexpr ElapsedTime() :m_startTick() {}
+
+ template <class TimeUnit>
+ TimeUnit elapsed() const
+ {
+ return std::chrono::duration_cast<TimeUnit>(std::chrono::high_resolution_clock::now() - this->m_startTick);
+ }
+
+ std::string toString() const;
+
+ private:
+ std::chrono::steady_clock::time_point m_startTick;
+ };
+
class Stopwatch
{
public:
diff --git a/toolsrc/include/vcpkg_Commands.h b/toolsrc/include/vcpkg_Commands.h
index 8d772b255..544dffe72 100644
--- a/toolsrc/include/vcpkg_Commands.h
+++ b/toolsrc/include/vcpkg_Commands.h
@@ -2,6 +2,8 @@
#include "vcpkg_cmd_arguments.h"
#include "vcpkg_paths.h"
+#include "StatusParagraphs.h"
+#include <array>
namespace vcpkg::Commands
{
@@ -11,7 +13,23 @@ namespace vcpkg::Commands
namespace Build
{
- void build_package(const SourceParagraph& source_paragraph, const package_spec& spec, const vcpkg_paths& paths, const fs::path& port_dir);
+ enum class BuildResult
+ {
+ NULLVALUE = 0,
+ SUCCEEDED,
+ BUILD_FAILED,
+ POST_BUILD_CHECKS_FAILED,
+ CASCADED_DUE_TO_MISSING_DEPENDENCIES
+ };
+
+ static constexpr std::array<BuildResult, 4> BuildResult_values = { BuildResult::SUCCEEDED, BuildResult::BUILD_FAILED, BuildResult::POST_BUILD_CHECKS_FAILED, BuildResult::CASCADED_DUE_TO_MISSING_DEPENDENCIES };
+
+ const std::string& to_string(const BuildResult build_result);
+ std::string create_error_message(const BuildResult build_result, const package_spec& spec);
+ std::string create_user_troubleshooting_message(const package_spec& spec);
+
+ BuildResult build_package(const SourceParagraph& source_paragraph, const package_spec& spec, const vcpkg_paths& paths, const fs::path& port_dir, const StatusParagraphs& status_db);
+ void perform_and_exit(const package_spec& spec, const fs::path& port_dir, const std::unordered_set<std::string>& options, const vcpkg_paths& paths);
void perform_and_exit(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths, const triplet& default_target_triplet);
}
@@ -22,6 +40,12 @@ namespace vcpkg::Commands
namespace Install
{
+ void install_package(const vcpkg_paths& paths, const BinaryParagraph& binary_paragraph, StatusParagraphs* status_db);
+ void perform_and_exit(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths, const triplet& default_target_triplet);
+ }
+
+ namespace CI
+ {
void perform_and_exit(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths, const triplet& default_target_triplet);
}
@@ -55,17 +79,17 @@ namespace vcpkg::Commands
void perform_and_exit(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths);
}
- namespace Import
+ namespace Owns
{
void perform_and_exit(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths);
}
- namespace Owns
+ namespace Cache
{
void perform_and_exit(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths);
}
- namespace Cache
+ namespace Import
{
void perform_and_exit(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths);
}
@@ -97,11 +121,13 @@ namespace vcpkg::Commands
namespace Version
{
+ const std::string& version();
void perform_and_exit(const vcpkg_cmd_arguments& args);
}
namespace Contact
{
+ const std::string& email();
void perform_and_exit(const vcpkg_cmd_arguments& args);
}
diff --git a/toolsrc/include/vcpkg_Dependencies.h b/toolsrc/include/vcpkg_Dependencies.h
index b63816089..dca824ee9 100644
--- a/toolsrc/include/vcpkg_Dependencies.h
+++ b/toolsrc/include/vcpkg_Dependencies.h
@@ -75,5 +75,5 @@ namespace vcpkg::Dependencies
std::vector<package_spec_with_install_plan> create_install_plan(const vcpkg_paths& paths, const std::vector<package_spec>& specs, const StatusParagraphs& status_db);
- std::vector<package_spec_with_remove_plan> create_remove_plan(const vcpkg_paths& paths, const std::vector<package_spec>& specs, const StatusParagraphs& status_db);
+ std::vector<package_spec_with_remove_plan> create_remove_plan(const std::vector<package_spec>& specs, const StatusParagraphs& status_db);
}
diff --git a/toolsrc/include/vcpkg_Enums.h b/toolsrc/include/vcpkg_Enums.h
new file mode 100644
index 000000000..5c4dc8b06
--- /dev/null
+++ b/toolsrc/include/vcpkg_Enums.h
@@ -0,0 +1,11 @@
+#pragma once
+#include <string>
+
+namespace vcpkg::Enums
+{
+ std::string nullvalue_toString(const std::string& enum_name);
+
+ __declspec(noreturn) void nullvalue_used(const std::string& enum_name);
+
+ __declspec(noreturn) void unreachable(const std::string& enum_name);
+}
diff --git a/toolsrc/include/vcpkg_Environment.h b/toolsrc/include/vcpkg_Environment.h
index e4dd47472..c2d2ed7ae 100644
--- a/toolsrc/include/vcpkg_Environment.h
+++ b/toolsrc/include/vcpkg_Environment.h
@@ -24,4 +24,8 @@ namespace vcpkg::Environment
};
const vcvarsall_and_platform_toolset& get_vcvarsall_bat(const vcpkg_paths& paths);
+
+ const fs::path& get_ProgramFiles_32_bit();
+
+ const fs::path& get_ProgramFiles_platform_bitness();
}
diff --git a/toolsrc/include/vcpkg_System.h b/toolsrc/include/vcpkg_System.h
index c9195163c..7634034ab 100644
--- a/toolsrc/include/vcpkg_System.h
+++ b/toolsrc/include/vcpkg_System.h
@@ -2,6 +2,7 @@
#include "vcpkg_Strings.h"
#include "filesystem_fs.h"
+#include "vcpkg_optional.h"
namespace vcpkg::System
{
@@ -92,5 +93,7 @@ namespace vcpkg::System
double microseconds() const;
};
- std::wstring wdupenv_str(const wchar_t* varname) noexcept;
+ optional<std::wstring> get_environmental_variable(const wchar_t* varname) noexcept;
+
+ void set_environmental_variable(const wchar_t* varname, const wchar_t* varvalue) noexcept;
}
diff --git a/toolsrc/include/vcpkg_info.h b/toolsrc/include/vcpkg_info.h
deleted file mode 100644
index 5380e0158..000000000
--- a/toolsrc/include/vcpkg_info.h
+++ /dev/null
@@ -1,10 +0,0 @@
-#pragma once
-
-#include <string>
-
-namespace vcpkg::Info
-{
- const std::string& version();
-
- const std::string& email();
-}
diff --git a/toolsrc/include/vcpkglib.h b/toolsrc/include/vcpkglib.h
index b1653d197..50635589a 100644
--- a/toolsrc/include/vcpkglib.h
+++ b/toolsrc/include/vcpkglib.h
@@ -22,10 +22,5 @@ namespace vcpkg
expected<SourceParagraph> try_load_port(const fs::path& control_path);
- inline expected<SourceParagraph> try_load_port(const vcpkg_paths& paths, const std::string& name)
- {
- return try_load_port(paths.ports / name);
- }
-
expected<BinaryParagraph> try_load_cached_package(const vcpkg_paths& paths, const package_spec& spec);
} // namespace vcpkg