diff options
| author | martin-s <webmaster@macside.net> | 2017-10-15 02:00:19 +0200 |
|---|---|---|
| committer | martin-s <webmaster@macside.net> | 2017-10-15 02:00:19 +0200 |
| commit | 9c2fa042ee451f5ec1e5781c8daccd9fd6875de0 (patch) | |
| tree | 250b18fea62d58e2138de12f78e25d0ed8c69678 /toolsrc | |
| parent | 630bcd84b8325217c440def11681e375f5ef4652 (diff) | |
| parent | 561cfe89e653aef903488f7af7d4d17cfb11a26c (diff) | |
| download | vcpkg-9c2fa042ee451f5ec1e5781c8daccd9fd6875de0.tar.gz vcpkg-9c2fa042ee451f5ec1e5781c8daccd9fd6875de0.zip | |
Merge branch 'master' of https://github.com/Microsoft/vcpkg into patch-vs2013
# Conflicts:
# toolsrc/include/vcpkg/vcpkgpaths.h
# toolsrc/src/vcpkg/vcpkgpaths.cpp
Diffstat (limited to 'toolsrc')
| -rw-r--r-- | toolsrc/VERSION.txt | 2 | ||||
| -rw-r--r-- | toolsrc/include/Span.h | 50 | ||||
| -rw-r--r-- | toolsrc/include/filesystem_fs.h | 16 | ||||
| -rw-r--r-- | toolsrc/include/pch.h | 8 | ||||
| -rw-r--r-- | toolsrc/include/vcpkg/base/checks.h (renamed from toolsrc/include/vcpkg_Checks.h) | 5 | ||||
| -rw-r--r-- | toolsrc/include/vcpkg/base/chrono.h (renamed from toolsrc/include/vcpkg_Chrono.h) | 2 | ||||
| -rw-r--r-- | toolsrc/include/vcpkg/base/cofffilereader.h (renamed from toolsrc/include/coff_file_reader.h) | 6 | ||||
| -rw-r--r-- | toolsrc/include/vcpkg/base/cstringview.h (renamed from toolsrc/include/CStringView.h) | 1 | ||||
| -rw-r--r-- | toolsrc/include/vcpkg/base/enums.h (renamed from toolsrc/include/vcpkg_Enums.h) | 4 | ||||
| -rw-r--r-- | toolsrc/include/vcpkg/base/expected.h (renamed from toolsrc/include/vcpkg_expected.h) | 7 | ||||
| -rw-r--r-- | toolsrc/include/vcpkg/base/files.h (renamed from toolsrc/include/vcpkg_Files.h) | 18 | ||||
| -rw-r--r-- | toolsrc/include/vcpkg/base/graphs.h (renamed from toolsrc/include/vcpkg_Graphs.h) | 2 | ||||
| -rw-r--r-- | toolsrc/include/vcpkg/base/lazy.h (renamed from toolsrc/include/lazy.h) | 0 | ||||
| -rw-r--r-- | toolsrc/include/vcpkg/base/lineinfo.h (renamed from toolsrc/include/LineInfo.h) | 0 | ||||
| -rw-r--r-- | toolsrc/include/vcpkg/base/machinetype.h (renamed from toolsrc/include/MachineType.h) | 1 | ||||
| -rw-r--r-- | toolsrc/include/vcpkg/base/optional.h (renamed from toolsrc/include/vcpkg_optional.h) | 7 | ||||
| -rw-r--r-- | toolsrc/include/vcpkg/base/sortedvector.h (renamed from toolsrc/include/SortedVector.h) | 0 | ||||
| -rw-r--r-- | toolsrc/include/vcpkg/base/span.h | 60 | ||||
| -rw-r--r-- | toolsrc/include/vcpkg/base/strings.h (renamed from toolsrc/include/vcpkg_Strings.h) | 5 | ||||
| -rw-r--r-- | toolsrc/include/vcpkg/base/system.h (renamed from toolsrc/include/vcpkg_System.h) | 7 | ||||
| -rw-r--r-- | toolsrc/include/vcpkg/base/util.h (renamed from toolsrc/include/vcpkg_Util.h) | 41 | ||||
| -rw-r--r-- | toolsrc/include/vcpkg/binaryparagraph.h (renamed from toolsrc/include/BinaryParagraph.h) | 5 | ||||
| -rw-r--r-- | toolsrc/include/vcpkg/build.h (renamed from toolsrc/include/vcpkg_Build.h) | 28 | ||||
| -rw-r--r-- | toolsrc/include/vcpkg/commands.h | 135 | ||||
| -rw-r--r-- | toolsrc/include/vcpkg/dependencies.h (renamed from toolsrc/include/vcpkg_Dependencies.h) | 14 | ||||
| -rw-r--r-- | toolsrc/include/vcpkg/export.h | 10 | ||||
| -rw-r--r-- | toolsrc/include/vcpkg/export.ifw.h | 26 | ||||
| -rw-r--r-- | toolsrc/include/vcpkg/globalstate.h (renamed from toolsrc/include/vcpkg_GlobalState.h) | 8 | ||||
| -rw-r--r-- | toolsrc/include/vcpkg/help.h | 19 | ||||
| -rw-r--r-- | toolsrc/include/vcpkg/input.h (renamed from toolsrc/include/vcpkg_Input.h) | 3 | ||||
| -rw-r--r-- | toolsrc/include/vcpkg/install.h | 71 | ||||
| -rw-r--r-- | toolsrc/include/vcpkg/metrics.h (renamed from toolsrc/include/metrics.h) | 4 | ||||
| -rw-r--r-- | toolsrc/include/vcpkg/packagespec.h (renamed from toolsrc/include/PackageSpec.h) | 6 | ||||
| -rw-r--r-- | toolsrc/include/vcpkg/packagespecparseresult.h (renamed from toolsrc/include/PackageSpecParseResult.h) | 3 | ||||
| -rw-r--r-- | toolsrc/include/vcpkg/paragraphparseresult.h (renamed from toolsrc/include/ParagraphParseResult.h) | 1 | ||||
| -rw-r--r-- | toolsrc/include/vcpkg/paragraphs.h (renamed from toolsrc/include/Paragraphs.h) | 14 | ||||
| -rw-r--r-- | toolsrc/include/vcpkg/parse.h (renamed from toolsrc/include/vcpkg_Parse.h) | 6 | ||||
| -rw-r--r-- | toolsrc/include/vcpkg/postbuildlint.buildtype.h (renamed from toolsrc/include/PostBuildLint_BuildType.h) | 6 | ||||
| -rw-r--r-- | toolsrc/include/vcpkg/postbuildlint.h (renamed from toolsrc/include/PostBuildLint.h) | 7 | ||||
| -rw-r--r-- | toolsrc/include/vcpkg/remove.h | 26 | ||||
| -rw-r--r-- | toolsrc/include/vcpkg/sourceparagraph.h (renamed from toolsrc/include/SourceParagraph.h) | 11 | ||||
| -rw-r--r-- | toolsrc/include/vcpkg/statusparagraph.h (renamed from toolsrc/include/StatusParagraph.h) | 3 | ||||
| -rw-r--r-- | toolsrc/include/vcpkg/statusparagraphs.h (renamed from toolsrc/include/StatusParagraphs.h) | 3 | ||||
| -rw-r--r-- | toolsrc/include/vcpkg/triplet.h (renamed from toolsrc/include/triplet.h) | 0 | ||||
| -rw-r--r-- | toolsrc/include/vcpkg/update.h | 21 | ||||
| -rw-r--r-- | toolsrc/include/vcpkg/vcpkgcmdarguments.h (renamed from toolsrc/include/VcpkgCmdArguments.h) | 20 | ||||
| -rw-r--r-- | toolsrc/include/vcpkg/vcpkglib.h (renamed from toolsrc/include/vcpkglib.h) | 6 | ||||
| -rw-r--r-- | toolsrc/include/vcpkg/vcpkgpaths.h (renamed from toolsrc/include/VcpkgPaths.h) | 24 | ||||
| -rw-r--r-- | toolsrc/include/vcpkg/versiont.h (renamed from toolsrc/include/VersionT.h) | 0 | ||||
| -rw-r--r-- | toolsrc/include/vcpkg_Commands.h | 253 | ||||
| -rw-r--r-- | toolsrc/include/vcpkg_Maps.h | 30 | ||||
| -rw-r--r-- | toolsrc/src/commands_build.cpp | 102 | ||||
| -rw-r--r-- | toolsrc/src/tests.arguments.cpp (renamed from toolsrc/src/tests_arguments.cpp) | 4 | ||||
| -rw-r--r-- | toolsrc/src/tests.dependencies.cpp (renamed from toolsrc/src/tests_dependencies.cpp) | 6 | ||||
| -rw-r--r-- | toolsrc/src/tests.installplan.cpp (renamed from toolsrc/src/test_install_plan.cpp) | 7 | ||||
| -rw-r--r-- | toolsrc/src/tests.packagespec.cpp (renamed from toolsrc/src/tests_package_spec.cpp) | 9 | ||||
| -rw-r--r-- | toolsrc/src/tests.paragraph.cpp (renamed from toolsrc/src/tests_paragraph.cpp) | 9 | ||||
| -rw-r--r-- | toolsrc/src/vcpkg.cpp | 67 | ||||
| -rw-r--r-- | toolsrc/src/vcpkg/base/checks.cpp (renamed from toolsrc/src/vcpkg_Checks.cpp) | 10 | ||||
| -rw-r--r-- | toolsrc/src/vcpkg/base/chrono.cpp (renamed from toolsrc/src/vcpkg_Chrono.cpp) | 6 | ||||
| -rw-r--r-- | toolsrc/src/vcpkg/base/cofffilereader.cpp (renamed from toolsrc/src/coff_file_reader.cpp) | 4 | ||||
| -rw-r--r-- | toolsrc/src/vcpkg/base/enums.cpp (renamed from toolsrc/src/vcpkg_Enums.cpp) | 4 | ||||
| -rw-r--r-- | toolsrc/src/vcpkg/base/files.cpp (renamed from toolsrc/src/vcpkg_Files.cpp) | 7 | ||||
| -rw-r--r-- | toolsrc/src/vcpkg/base/lineinfo.cpp (renamed from toolsrc/src/LineInfo.cpp) | 4 | ||||
| -rw-r--r-- | toolsrc/src/vcpkg/base/machinetype.cpp (renamed from toolsrc/src/MachineType.cpp) | 4 | ||||
| -rw-r--r-- | toolsrc/src/vcpkg/base/strings.cpp (renamed from toolsrc/src/vcpkg_Strings.cpp) | 14 | ||||
| -rw-r--r-- | toolsrc/src/vcpkg/base/system.cpp (renamed from toolsrc/src/vcpkg_System.cpp) | 27 | ||||
| -rw-r--r-- | toolsrc/src/vcpkg/binaryparagraph.cpp (renamed from toolsrc/src/BinaryParagraph.cpp) | 6 | ||||
| -rw-r--r-- | toolsrc/src/vcpkg/build.cpp (renamed from toolsrc/src/vcpkg_Build.cpp) | 165 | ||||
| -rw-r--r-- | toolsrc/src/vcpkg/commands.autocomplete.cpp | 129 | ||||
| -rw-r--r-- | toolsrc/src/vcpkg/commands.buildexternal.cpp (renamed from toolsrc/src/commands_build_external.cpp) | 10 | ||||
| -rw-r--r-- | toolsrc/src/vcpkg/commands.cache.cpp (renamed from toolsrc/src/commands_cache.cpp) | 13 | ||||
| -rw-r--r-- | toolsrc/src/vcpkg/commands.ci.cpp (renamed from toolsrc/src/commands_ci.cpp) | 26 | ||||
| -rw-r--r-- | toolsrc/src/vcpkg/commands.contact.cpp (renamed from toolsrc/src/commands_contact.cpp) | 4 | ||||
| -rw-r--r-- | toolsrc/src/vcpkg/commands.cpp (renamed from toolsrc/src/commands_available_commands.cpp) | 18 | ||||
| -rw-r--r-- | toolsrc/src/vcpkg/commands.create.cpp (renamed from toolsrc/src/commands_create.cpp) | 11 | ||||
| -rw-r--r-- | toolsrc/src/vcpkg/commands.dependinfo.cpp (renamed from toolsrc/src/commands_depends.cpp) | 13 | ||||
| -rw-r--r-- | toolsrc/src/vcpkg/commands.edit.cpp (renamed from toolsrc/src/commands_edit.cpp) | 36 | ||||
| -rw-r--r-- | toolsrc/src/vcpkg/commands.env.cpp (renamed from toolsrc/src/commands_env.cpp) | 13 | ||||
| -rw-r--r-- | toolsrc/src/vcpkg/commands.exportifw.cpp | 490 | ||||
| -rw-r--r-- | toolsrc/src/vcpkg/commands.hash.cpp (renamed from toolsrc/src/commands_hash.cpp) | 12 | ||||
| -rw-r--r-- | toolsrc/src/vcpkg/commands.import.cpp (renamed from toolsrc/src/commands_import.cpp) | 11 | ||||
| -rw-r--r-- | toolsrc/src/vcpkg/commands.integrate.cpp (renamed from toolsrc/src/commands_integrate.cpp) | 25 | ||||
| -rw-r--r-- | toolsrc/src/vcpkg/commands.list.cpp (renamed from toolsrc/src/commands_list.cpp) | 9 | ||||
| -rw-r--r-- | toolsrc/src/vcpkg/commands.owns.cpp (renamed from toolsrc/src/commands_owns.cpp) | 9 | ||||
| -rw-r--r-- | toolsrc/src/vcpkg/commands.portsdiff.cpp (renamed from toolsrc/src/commands_portsdiff.cpp) | 21 | ||||
| -rw-r--r-- | toolsrc/src/vcpkg/commands.search.cpp (renamed from toolsrc/src/commands_search.cpp) | 15 | ||||
| -rw-r--r-- | toolsrc/src/vcpkg/commands.version.cpp (renamed from toolsrc/src/commands_version.cpp) | 6 | ||||
| -rw-r--r-- | toolsrc/src/vcpkg/dependencies.cpp (renamed from toolsrc/src/vcpkg_Dependencies.cpp) | 20 | ||||
| -rw-r--r-- | toolsrc/src/vcpkg/export.cpp (renamed from toolsrc/src/commands_export.cpp) | 319 | ||||
| -rw-r--r-- | toolsrc/src/vcpkg/globalstate.cpp (renamed from toolsrc/src/vcpkg_GlobalState.cpp) | 4 | ||||
| -rw-r--r-- | toolsrc/src/vcpkg/help.cpp (renamed from toolsrc/src/commands_help.cpp) | 10 | ||||
| -rw-r--r-- | toolsrc/src/vcpkg/input.cpp (renamed from toolsrc/src/vcpkg_Input.cpp) | 11 | ||||
| -rw-r--r-- | toolsrc/src/vcpkg/install.cpp (renamed from toolsrc/src/commands_install.cpp) | 93 | ||||
| -rw-r--r-- | toolsrc/src/vcpkg/metrics.cpp (renamed from toolsrc/src/metrics.cpp) | 13 | ||||
| -rw-r--r-- | toolsrc/src/vcpkg/packagespec.cpp (renamed from toolsrc/src/PackageSpec.cpp) | 6 | ||||
| -rw-r--r-- | toolsrc/src/vcpkg/packagespecparseresult.cpp (renamed from toolsrc/src/PackageSpecParseResult.cpp) | 5 | ||||
| -rw-r--r-- | toolsrc/src/vcpkg/paragraphparseresult.cpp (renamed from toolsrc/src/ParagraphParseResult.cpp) | 4 | ||||
| -rw-r--r-- | toolsrc/src/vcpkg/paragraphs.cpp (renamed from toolsrc/src/Paragraphs.cpp) | 10 | ||||
| -rw-r--r-- | toolsrc/src/vcpkg/parse.cpp (renamed from toolsrc/src/vcpkg_Parse.cpp) | 9 | ||||
| -rw-r--r-- | toolsrc/src/vcpkg/postbuildlint.buildtype.cpp (renamed from toolsrc/src/PostBuildLint_BuildType.cpp) | 4 | ||||
| -rw-r--r-- | toolsrc/src/vcpkg/postbuildlint.cpp (renamed from toolsrc/src/PostBuildLint.cpp) | 39 | ||||
| -rw-r--r-- | toolsrc/src/vcpkg/remove.cpp (renamed from toolsrc/src/commands_remove.cpp) | 59 | ||||
| -rw-r--r-- | toolsrc/src/vcpkg/sourceparagraph.cpp (renamed from toolsrc/src/SourceParagraph.cpp) | 50 | ||||
| -rw-r--r-- | toolsrc/src/vcpkg/statusparagraph.cpp (renamed from toolsrc/src/StatusParagraph.cpp) | 2 | ||||
| -rw-r--r-- | toolsrc/src/vcpkg/statusparagraphs.cpp (renamed from toolsrc/src/StatusParagraphs.cpp) | 5 | ||||
| -rw-r--r-- | toolsrc/src/vcpkg/triplet.cpp (renamed from toolsrc/src/triplet.cpp) | 6 | ||||
| -rw-r--r-- | toolsrc/src/vcpkg/update.cpp (renamed from toolsrc/src/commands_update.cpp) | 12 | ||||
| -rw-r--r-- | toolsrc/src/vcpkg/vcpkgcmdarguments.cpp (renamed from toolsrc/src/VcpkgCmdArguments.cpp) | 17 | ||||
| -rw-r--r-- | toolsrc/src/vcpkg/vcpkglib.cpp (renamed from toolsrc/src/vcpkglib.cpp) | 12 | ||||
| -rw-r--r-- | toolsrc/src/vcpkg/vcpkgpaths.cpp (renamed from toolsrc/src/VcpkgPaths.cpp) | 400 | ||||
| -rw-r--r-- | toolsrc/src/vcpkg/versiont.cpp (renamed from toolsrc/src/VersionT.cpp) | 4 | ||||
| -rw-r--r-- | toolsrc/src/vcpkg_Build_BuildPolicy.cpp | 40 | ||||
| -rw-r--r-- | toolsrc/src/vcpkgmetricsuploader.cpp (renamed from toolsrc/src/vcpkg_metrics_uploader.cpp) | 8 | ||||
| -rw-r--r-- | toolsrc/vcpkglib/vcpkglib.vcxproj | 194 | ||||
| -rw-r--r-- | toolsrc/vcpkglib/vcpkglib.vcxproj.filters | 408 | ||||
| -rw-r--r-- | toolsrc/vcpkgmetricsuploader/vcpkgmetricsuploader.vcxproj | 2 | ||||
| -rw-r--r-- | toolsrc/vcpkgmetricsuploader/vcpkgmetricsuploader.vcxproj.filters | 2 | ||||
| -rw-r--r-- | toolsrc/vcpkgtest/vcpkgtest.vcxproj | 10 | ||||
| -rw-r--r-- | toolsrc/vcpkgtest/vcpkgtest.vcxproj.filters | 10 |
120 files changed, 2566 insertions, 1553 deletions
diff --git a/toolsrc/VERSION.txt b/toolsrc/VERSION.txt index c47961221..04ab0d2c9 100644 --- a/toolsrc/VERSION.txt +++ b/toolsrc/VERSION.txt @@ -1 +1 @@ -"0.0.90"
\ No newline at end of file +"0.0.91"
\ No newline at end of file diff --git a/toolsrc/include/Span.h b/toolsrc/include/Span.h deleted file mode 100644 index b2c9acdbc..000000000 --- a/toolsrc/include/Span.h +++ /dev/null @@ -1,50 +0,0 @@ -#pragma once
-
-#include <array>
-#include <cstddef>
-#include <vector>
-
-template<class T>
-struct Span
-{
-public:
- using element_type = T;
- using pointer = T*;
- using reference = T&;
- using iterator = T*;
-
- constexpr Span() noexcept : m_ptr(nullptr), m_count(0) {}
- constexpr Span(std::nullptr_t) noexcept : Span() {}
- constexpr Span(T* ptr, size_t count) noexcept : m_ptr(ptr), m_count(count) {}
- constexpr Span(T* ptr_begin, T* ptr_end) noexcept : m_ptr(ptr_begin), m_count(ptr_end - ptr_begin) {}
-
- template<size_t N>
- constexpr Span(T (&arr)[N]) noexcept : Span(arr, N)
- {
- }
-
- Span(std::vector<T>& v) noexcept : Span(v.data(), v.size()) {}
- Span(const std::vector<std::remove_const_t<T>>& v) noexcept : Span(v.data(), v.size()) {}
-
- constexpr iterator begin() const { return m_ptr; }
- constexpr iterator end() const { return m_ptr + m_count; }
-
- constexpr reference operator[](size_t i) const { return m_ptr[i]; }
- constexpr size_t size() const { return m_count; }
-
-private:
- pointer m_ptr;
- size_t m_count;
-};
-
-template<class T>
-Span<T> make_span(std::vector<T>& v)
-{
- return {v.data(), v.size()};
-}
-
-template<class T>
-Span<const T> make_span(const std::vector<T>& v)
-{
- return {v.data(), v.size()};
-}
diff --git a/toolsrc/include/filesystem_fs.h b/toolsrc/include/filesystem_fs.h deleted file mode 100644 index 0651ebf25..000000000 --- a/toolsrc/include/filesystem_fs.h +++ /dev/null @@ -1,16 +0,0 @@ -#pragma once - -#include <filesystem> - -namespace fs -{ - namespace stdfs = std::experimental::filesystem; - - using stdfs::path; - using stdfs::copy_options; - using stdfs::file_status; - - inline bool is_regular_file(file_status s) { return stdfs::is_regular_file(s); } - inline bool is_directory(file_status s) { return stdfs::is_directory(s); } - inline bool status_known(file_status s) { return stdfs::status_known(s); } -}
\ No newline at end of file diff --git a/toolsrc/include/pch.h b/toolsrc/include/pch.h index 0f34063f8..8333eb927 100644 --- a/toolsrc/include/pch.h +++ b/toolsrc/include/pch.h @@ -2,9 +2,13 @@ #define NOMINMAX #define WIN32_LEAN_AND_MEAN + #pragma warning(suppress : 4768) #include <windows.h> +#pragma warning(suppress : 4768) +#include <Shlobj.h> + #include <algorithm> #include <array> #include <atomic> @@ -28,10 +32,6 @@ #include <regex> #include <set> #include <shellapi.h> -#pragma warning(push) -#pragma warning(disable : 4768) -#include <Shlobj.h> -#pragma warning(pop) #include <stdexcept> #include <string> #include <sys/timeb.h> diff --git a/toolsrc/include/vcpkg_Checks.h b/toolsrc/include/vcpkg/base/checks.h index ce486ac19..fb162c897 100644 --- a/toolsrc/include/vcpkg_Checks.h +++ b/toolsrc/include/vcpkg/base/checks.h @@ -1,7 +1,8 @@ #pragma once -#include "LineInfo.h" -#include "vcpkg_Strings.h" +#include <vcpkg/base/cstringview.h> +#include <vcpkg/base/lineinfo.h> +#include <vcpkg/base/strings.h> namespace vcpkg::Checks { diff --git a/toolsrc/include/vcpkg_Chrono.h b/toolsrc/include/vcpkg/base/chrono.h index c14019ff9..b525852f2 100644 --- a/toolsrc/include/vcpkg_Chrono.h +++ b/toolsrc/include/vcpkg/base/chrono.h @@ -3,7 +3,7 @@ #include <chrono> #include <string> -namespace vcpkg +namespace vcpkg::Chrono { class ElapsedTime { diff --git a/toolsrc/include/coff_file_reader.h b/toolsrc/include/vcpkg/base/cofffilereader.h index 7287211a1..ad2cc7b12 100644 --- a/toolsrc/include/coff_file_reader.h +++ b/toolsrc/include/vcpkg/base/cofffilereader.h @@ -1,6 +1,8 @@ #pragma once -#include "MachineType.h" -#include "filesystem_fs.h" + +#include <vcpkg/base/files.h> +#include <vcpkg/base/machinetype.h> + #include <vector> namespace vcpkg::CoffFileReader diff --git a/toolsrc/include/CStringView.h b/toolsrc/include/vcpkg/base/cstringview.h index c1810b4f1..341830f05 100644 --- a/toolsrc/include/CStringView.h +++ b/toolsrc/include/vcpkg/base/cstringview.h @@ -1,4 +1,5 @@ #pragma once + #include <string> namespace vcpkg diff --git a/toolsrc/include/vcpkg_Enums.h b/toolsrc/include/vcpkg/base/enums.h index c75feaa1f..6eca2cfe1 100644 --- a/toolsrc/include/vcpkg_Enums.h +++ b/toolsrc/include/vcpkg/base/enums.h @@ -1,5 +1,7 @@ #pragma once -#include "LineInfo.h" + +#include <vcpkg/base/lineinfo.h> + #include <string> namespace vcpkg::Enums diff --git a/toolsrc/include/vcpkg_expected.h b/toolsrc/include/vcpkg/base/expected.h index 9637ec087..a946c442e 100644 --- a/toolsrc/include/vcpkg_expected.h +++ b/toolsrc/include/vcpkg/base/expected.h @@ -1,6 +1,7 @@ #pragma once -#include "vcpkg_Checks.h" +#include <vcpkg/base/checks.h> + #include <system_error> namespace vcpkg @@ -71,13 +72,13 @@ namespace vcpkg return std::move(this->m_t); } - const T& value_or_exit(const LineInfo& line_info) const & + const T& value_or_exit(const LineInfo& line_info) const& { exit_if_error(line_info); return this->m_t; } - const S& error() const & { return this->m_s.error(); } + const S& error() const& { return this->m_s.error(); } S&& error() && { return std::move(this->m_s.error()); } diff --git a/toolsrc/include/vcpkg_Files.h b/toolsrc/include/vcpkg/base/files.h index 855e8ea45..f4bcf742c 100644 --- a/toolsrc/include/vcpkg_Files.h +++ b/toolsrc/include/vcpkg/base/files.h @@ -1,7 +1,21 @@ #pragma once -#include "filesystem_fs.h" -#include "vcpkg_expected.h" +#include <vcpkg/base/expected.h> + +#include <filesystem> + +namespace fs +{ + namespace stdfs = std::experimental::filesystem; + + using stdfs::copy_options; + using stdfs::file_status; + using stdfs::path; + + inline bool is_regular_file(file_status s) { return stdfs::is_regular_file(s); } + inline bool is_directory(file_status s) { return stdfs::is_directory(s); } + inline bool status_known(file_status s) { return stdfs::status_known(s); } +} namespace vcpkg::Files { diff --git a/toolsrc/include/vcpkg_Graphs.h b/toolsrc/include/vcpkg/base/graphs.h index 13c0a7136..ff56cb298 100644 --- a/toolsrc/include/vcpkg_Graphs.h +++ b/toolsrc/include/vcpkg/base/graphs.h @@ -3,6 +3,8 @@ #include <unordered_map> #include <unordered_set> +#include <vcpkg/base/checks.h> + namespace vcpkg::Graphs { enum class ExplorationStatus diff --git a/toolsrc/include/lazy.h b/toolsrc/include/vcpkg/base/lazy.h index 58c11c002..58c11c002 100644 --- a/toolsrc/include/lazy.h +++ b/toolsrc/include/vcpkg/base/lazy.h diff --git a/toolsrc/include/LineInfo.h b/toolsrc/include/vcpkg/base/lineinfo.h index 62973462a..62973462a 100644 --- a/toolsrc/include/LineInfo.h +++ b/toolsrc/include/vcpkg/base/lineinfo.h diff --git a/toolsrc/include/MachineType.h b/toolsrc/include/vcpkg/base/machinetype.h index 6f61bbd53..b85cdbb0b 100644 --- a/toolsrc/include/MachineType.h +++ b/toolsrc/include/vcpkg/base/machinetype.h @@ -1,4 +1,5 @@ #pragma once + #include <cstdint> namespace vcpkg diff --git a/toolsrc/include/vcpkg_optional.h b/toolsrc/include/vcpkg/base/optional.h index 31a2d3e88..ff7a210c7 100644 --- a/toolsrc/include/vcpkg_optional.h +++ b/toolsrc/include/vcpkg/base/optional.h @@ -1,5 +1,6 @@ #pragma once -#include "vcpkg_Checks.h" + +#include <vcpkg/base/checks.h> namespace vcpkg { @@ -29,7 +30,7 @@ namespace vcpkg return std::move(this->m_t); } - const T& value_or_exit(const LineInfo& line_info) const & + const T& value_or_exit(const LineInfo& line_info) const& { this->exit_if_null(line_info); return this->m_t; @@ -40,7 +41,7 @@ namespace vcpkg constexpr bool has_value() const { return m_is_present; } template<class U> - T value_or(U&& default_value) const & + T value_or(U&& default_value) const& { return bool(*this) ? this->m_t : static_cast<T>(std::forward<U>(default_value)); } diff --git a/toolsrc/include/SortedVector.h b/toolsrc/include/vcpkg/base/sortedvector.h index 62808cc2f..62808cc2f 100644 --- a/toolsrc/include/SortedVector.h +++ b/toolsrc/include/vcpkg/base/sortedvector.h diff --git a/toolsrc/include/vcpkg/base/span.h b/toolsrc/include/vcpkg/base/span.h new file mode 100644 index 000000000..6be546351 --- /dev/null +++ b/toolsrc/include/vcpkg/base/span.h @@ -0,0 +1,60 @@ +#pragma once
+
+#include <array>
+#include <cstddef>
+#include <initializer_list>
+#include <vector>
+
+namespace vcpkg
+{
+ template<class T>
+ struct Span
+ {
+ public:
+ using element_type = T;
+ using pointer = T*;
+ using reference = T&;
+ using iterator = T*;
+
+ constexpr Span() noexcept : m_ptr(nullptr), m_count(0) {}
+ constexpr Span(std::nullptr_t) noexcept : Span() {}
+ constexpr Span(T* ptr, size_t count) noexcept : m_ptr(ptr), m_count(count) {}
+ constexpr Span(T* ptr_begin, T* ptr_end) noexcept : m_ptr(ptr_begin), m_count(ptr_end - ptr_begin) {}
+ constexpr Span(std::initializer_list<T> l) noexcept : m_ptr(l.begin()), m_count(l.size()) {}
+
+ template<size_t N>
+ constexpr Span(T (&arr)[N]) noexcept : Span(arr, N)
+ {
+ }
+
+ template<size_t N>
+ constexpr Span(const std::array<std::remove_const_t<T>, N>& arr) noexcept : Span(arr.data(), arr.size())
+ {
+ }
+
+ Span(std::vector<T>& v) noexcept : Span(v.data(), v.size()) {}
+ Span(const std::vector<std::remove_const_t<T>>& v) noexcept : Span(v.data(), v.size()) {}
+
+ constexpr iterator begin() const { return m_ptr; }
+ constexpr iterator end() const { return m_ptr + m_count; }
+
+ constexpr reference operator[](size_t i) const { return m_ptr[i]; }
+ constexpr size_t size() const { return m_count; }
+
+ private:
+ pointer m_ptr;
+ size_t m_count;
+ };
+
+ template<class T>
+ Span<T> make_span(std::vector<T>& v)
+ {
+ return {v.data(), v.size()};
+ }
+
+ template<class T>
+ Span<const T> make_span(const std::vector<T>& v)
+ {
+ return {v.data(), v.size()};
+ }
+}
\ No newline at end of file diff --git a/toolsrc/include/vcpkg_Strings.h b/toolsrc/include/vcpkg/base/strings.h index c44ce2b99..59823deb8 100644 --- a/toolsrc/include/vcpkg_Strings.h +++ b/toolsrc/include/vcpkg/base/strings.h @@ -1,6 +1,7 @@ #pragma once -#include "CStringView.h" +#include <vcpkg/base/cstringview.h> + #include <vector> namespace vcpkg::Strings::details @@ -61,7 +62,7 @@ namespace vcpkg::Strings bool case_insensitive_ascii_contains(const std::string& s, const std::string& pattern); - int case_insensitive_ascii_compare(const CStringView left, const CStringView right); + bool case_insensitive_ascii_compare(const CStringView left, const CStringView right); std::string ascii_to_lowercase(const std::string& input); diff --git a/toolsrc/include/vcpkg_System.h b/toolsrc/include/vcpkg/base/system.h index 65f80ae6d..a2e8f3f45 100644 --- a/toolsrc/include/vcpkg_System.h +++ b/toolsrc/include/vcpkg/base/system.h @@ -1,8 +1,9 @@ #pragma once -#include "filesystem_fs.h" -#include "vcpkg_Strings.h" -#include "vcpkg_optional.h" +#include <vcpkg/base/files.h> +#include <vcpkg/base/optional.h> +#include <vcpkg/base/strings.h> + #include <Windows.h> namespace vcpkg::System diff --git a/toolsrc/include/vcpkg_Util.h b/toolsrc/include/vcpkg/base/util.h index c76ca01ac..3834580b6 100644 --- a/toolsrc/include/vcpkg_Util.h +++ b/toolsrc/include/vcpkg/base/util.h @@ -38,6 +38,12 @@ namespace vcpkg::Util } template<class Container, class Pred> + void stable_keep_if(Container& cont, Pred pred) + { + cont.erase(std::stable_partition(cont.begin(), cont.end(), pred), cont.end()); + } + + template<class Container, class Pred> void unstable_keep_if(Container& cont, Pred pred) { cont.erase(std::partition(cont.begin(), cont.end(), pred), cont.end()); @@ -50,25 +56,40 @@ namespace vcpkg::Util } template<class Container, class V> - auto find(const Container& cont, V&& v) + auto find(Container&& cont, V&& v) { - return std::find(cont.cbegin(), cont.cend(), v); + using std::begin; + using std::end; + return std::find(begin(cont), end(cont), v); } template<class Container, class Pred> - auto find_if(const Container& cont, Pred pred) + auto find_if(Container&& cont, Pred pred) { - return std::find_if(cont.cbegin(), cont.cend(), pred); + using std::begin; + using std::end; + return std::find_if(begin(cont), end(cont), pred); + } + + template<class Container> + using ElementT = std::remove_reference_t<decltype(*begin(std::declval<Container>()))>; + + template<class Container, class T = ElementT<Container>> + std::vector<T*> element_pointers(Container&& cont) + { + return fmap(cont, [](auto&& x) { return &x; }); } template<class Container, class Pred> - auto find_if_not(const Container& cont, Pred pred) + auto find_if_not(Container&& cont, Pred pred) { - return std::find_if_not(cont.cbegin(), cont.cend(), pred); + using std::begin; + using std::end; + return std::find_if_not(begin(cont), end(cont), pred); } template<class K, class V, class Container, class Func> - void group_by(const Container& cont, std::map<K, std::vector<const V*>>* output, Func f) + void group_by(const Container& cont, _Inout_ std::map<K, std::vector<const V*>>* output, Func&& f) { for (const V& element : cont) { @@ -77,6 +98,12 @@ namespace vcpkg::Util } } + template<class AssocContainer, class K = std::decay_t<decltype(begin(std::declval<AssocContainer>())->first)>> + std::vector<K> extract_keys(AssocContainer&& input_map) + { + return fmap(input_map, [](auto&& p) { return p.first; }); + } + struct MoveOnlyBase { MoveOnlyBase() = default; diff --git a/toolsrc/include/BinaryParagraph.h b/toolsrc/include/vcpkg/binaryparagraph.h index 61e03343a..7eb50a6d7 100644 --- a/toolsrc/include/BinaryParagraph.h +++ b/toolsrc/include/vcpkg/binaryparagraph.h @@ -1,7 +1,8 @@ #pragma once -#include "PackageSpec.h" -#include "SourceParagraph.h" +#include <vcpkg/packagespec.h> +#include <vcpkg/sourceparagraph.h> + #include <unordered_map> namespace vcpkg diff --git a/toolsrc/include/vcpkg_Build.h b/toolsrc/include/vcpkg/build.h index 78e89d4de..f146e9951 100644 --- a/toolsrc/include/vcpkg_Build.h +++ b/toolsrc/include/vcpkg/build.h @@ -1,11 +1,14 @@ #pragma once -#include "CStringView.h" -#include "PackageSpec.h" -#include "StatusParagraphs.h" -#include "VcpkgPaths.h" -#include "vcpkg_Files.h" -#include "vcpkg_optional.h" +#include <vcpkg/packagespec.h> +#include <vcpkg/statusparagraphs.h> +#include <vcpkg/triplet.h> +#include <vcpkg/vcpkgcmdarguments.h> +#include <vcpkg/vcpkgpaths.h> + +#include <vcpkg/base/cstringview.h> +#include <vcpkg/base/files.h> +#include <vcpkg/base/optional.h> #include <array> #include <map> @@ -13,6 +16,16 @@ namespace vcpkg::Build { + namespace Command + { + void perform_and_exit(const FullPackageSpec& full_spec, + const fs::path& port_dir, + const std::unordered_set<std::string>& options, + const VcpkgPaths& paths); + + void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths, const Triplet& default_triplet); + } + enum class UseHeadVersion { NO = 0, @@ -79,7 +92,8 @@ namespace vcpkg::Build std::string target_architecture; std::string cmake_system_name; std::string cmake_system_version; - std::string platform_toolset; + Optional<std::string> platform_toolset; + Optional<fs::path> visual_studio_path; }; std::wstring make_build_env_cmd(const PreBuildInfo& pre_build_info, const Toolset& toolset); diff --git a/toolsrc/include/vcpkg/commands.h b/toolsrc/include/vcpkg/commands.h new file mode 100644 index 000000000..e00812c98 --- /dev/null +++ b/toolsrc/include/vcpkg/commands.h @@ -0,0 +1,135 @@ +#pragma once + +#include <vcpkg/build.h> +#include <vcpkg/dependencies.h> +#include <vcpkg/statusparagraphs.h> +#include <vcpkg/vcpkgcmdarguments.h> +#include <vcpkg/vcpkgpaths.h> + +#include <array> + +namespace vcpkg::Commands +{ + using CommandTypeA = void (*)(const VcpkgCmdArguments& args, + const VcpkgPaths& paths, + const Triplet& default_triplet); + using CommandTypeB = void (*)(const VcpkgCmdArguments& args, const VcpkgPaths& paths); + using CommandTypeC = void (*)(const VcpkgCmdArguments& args); + + namespace BuildExternal + { + void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths, const Triplet& default_triplet); + } + + namespace CI + { + void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths, const Triplet& default_triplet); + } + + namespace Env + { + void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths, const Triplet& default_triplet); + } + + namespace Create + { + void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths); + } + + namespace Edit + { + extern const CommandStructure COMMAND_STRUCTURE; + void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths); + } + + namespace DependInfo + { + void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths); + } + + namespace Search + { + void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths); + } + + namespace List + { + void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths); + } + + namespace Owns + { + void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths); + } + + namespace Cache + { + void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths); + } + + namespace Import + { + void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths); + } + + namespace Integrate + { + extern const char* const INTEGRATE_COMMAND_HELPSTRING; + + void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths); + } + + namespace PortsDiff + { + 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 std::string& version(); + void warn_if_vcpkg_version_mismatch(const VcpkgPaths& paths); + void perform_and_exit(const VcpkgCmdArguments& args); + } + + namespace Contact + { + const std::string& email(); + void perform_and_exit(const VcpkgCmdArguments& args); + } + + namespace Hash + { + void perform_and_exit(const VcpkgCmdArguments& args); + } + + template<class T> + struct PackageNameAndFunction + { + std::string name; + T function; + }; + + Span<const PackageNameAndFunction<CommandTypeA>> get_available_commands_type_a(); + Span<const PackageNameAndFunction<CommandTypeB>> get_available_commands_type_b(); + Span<const PackageNameAndFunction<CommandTypeC>> get_available_commands_type_c(); + + template<typename T> + T find(const std::string& command_name, const std::vector<PackageNameAndFunction<T>> available_commands) + { + for (const PackageNameAndFunction<T>& cmd : available_commands) + { + if (cmd.name == command_name) + { + return cmd.function; + } + } + + // not found + return nullptr; + } +} diff --git a/toolsrc/include/vcpkg_Dependencies.h b/toolsrc/include/vcpkg/dependencies.h index d67122e48..2301dbc36 100644 --- a/toolsrc/include/vcpkg_Dependencies.h +++ b/toolsrc/include/vcpkg/dependencies.h @@ -1,10 +1,12 @@ #pragma once -#include "PackageSpec.h" -#include "StatusParagraphs.h" -#include "VcpkgPaths.h" -#include "vcpkg_Graphs.h" -#include "vcpkg_Util.h" -#include "vcpkg_optional.h" + +#include <vcpkg/base/graphs.h> +#include <vcpkg/base/optional.h> +#include <vcpkg/base/util.h> +#include <vcpkg/packagespec.h> +#include <vcpkg/statusparagraphs.h> +#include <vcpkg/vcpkgpaths.h> + #include <vector> namespace vcpkg::Dependencies diff --git a/toolsrc/include/vcpkg/export.h b/toolsrc/include/vcpkg/export.h new file mode 100644 index 000000000..f3285e187 --- /dev/null +++ b/toolsrc/include/vcpkg/export.h @@ -0,0 +1,10 @@ +#pragma once + +#include <vcpkg/vcpkgpaths.h> + +namespace vcpkg::Export +{ + void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths, const Triplet& default_triplet); + + void export_integration_files(const fs::path& raw_exported_dir_path, const VcpkgPaths& paths); +} diff --git a/toolsrc/include/vcpkg/export.ifw.h b/toolsrc/include/vcpkg/export.ifw.h new file mode 100644 index 000000000..d28a4436d --- /dev/null +++ b/toolsrc/include/vcpkg/export.ifw.h @@ -0,0 +1,26 @@ +#pragma once + +#include <vcpkg/dependencies.h> +#include <vcpkg/vcpkgpaths.h> + +#include <vcpkg/base/files.h> + +#include <string> +#include <vector> + +namespace vcpkg::Export::IFW +{ + struct Options + { + Optional<std::string> maybe_repository_url; + Optional<std::string> maybe_packages_dir_path; + Optional<std::string> maybe_repository_dir_path; + Optional<std::string> maybe_config_file_path; + Optional<std::string> maybe_installer_file_path; + }; + + void do_export(const std::vector<Dependencies::ExportPlanAction>& export_plan, + const std::string& export_id, + const Options& ifw_options, + const VcpkgPaths& paths); +} diff --git a/toolsrc/include/vcpkg_GlobalState.h b/toolsrc/include/vcpkg/globalstate.h index 6522a25bf..7cea361cf 100644 --- a/toolsrc/include/vcpkg_GlobalState.h +++ b/toolsrc/include/vcpkg/globalstate.h @@ -1,15 +1,15 @@ #pragma once -#include <atomic> +#include <vcpkg/base/chrono.h> +#include <vcpkg/base/util.h> -#include "vcpkg_Chrono.h" -#include "vcpkg_Util.h" +#include <atomic> namespace vcpkg { struct GlobalState { - static Util::LockGuarded<ElapsedTime> timer; + static Util::LockGuarded<Chrono::ElapsedTime> timer; static std::atomic<bool> debugging; static std::atomic<bool> feature_packages; diff --git a/toolsrc/include/vcpkg/help.h b/toolsrc/include/vcpkg/help.h new file mode 100644 index 000000000..39ad6912d --- /dev/null +++ b/toolsrc/include/vcpkg/help.h @@ -0,0 +1,19 @@ +#pragma once + +#include <vcpkg/vcpkgcmdarguments.h> +#include <vcpkg/vcpkgpaths.h> + +#include <string> + +namespace vcpkg::Help +{ + void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths); + + void help_topic_valid_triplet(const VcpkgPaths& paths); + + void print_usage(); + + void print_example(const std::string& command_and_arguments); + + std::string create_example_string(const std::string& command_and_arguments); +} diff --git a/toolsrc/include/vcpkg_Input.h b/toolsrc/include/vcpkg/input.h index fa568207a..621139427 100644 --- a/toolsrc/include/vcpkg_Input.h +++ b/toolsrc/include/vcpkg/input.h @@ -1,5 +1,6 @@ #pragma once -#include "PackageSpec.h" + +#include <vcpkg/packagespec.h> namespace vcpkg::Input { diff --git a/toolsrc/include/vcpkg/install.h b/toolsrc/include/vcpkg/install.h new file mode 100644 index 000000000..db6055f4f --- /dev/null +++ b/toolsrc/include/vcpkg/install.h @@ -0,0 +1,71 @@ +#pragma once + +#include <vcpkg/build.h> +#include <vcpkg/dependencies.h> +#include <vcpkg/vcpkgcmdarguments.h> +#include <vcpkg/vcpkgpaths.h> + +#include <vector> + +namespace vcpkg::Install +{ + enum class KeepGoing + { + NO = 0, + YES + }; + + inline KeepGoing to_keep_going(const bool value) { return value ? KeepGoing::YES : KeepGoing::NO; } + + enum class PrintSummary + { + NO = 0, + YES + }; + + inline PrintSummary to_print_summary(const bool value) { return value ? PrintSummary::YES : PrintSummary::NO; } + + struct InstallDir + { + static InstallDir from_destination_root(const fs::path& destination_root, + const std::string& destination_subdirectory, + const fs::path& listfile); + + private: + fs::path m_destination; + std::string m_destination_subdirectory; + fs::path m_listfile; + + public: + const fs::path& destination() const; + const std::string& destination_subdirectory() const; + const fs::path& listfile() const; + }; + + Build::BuildResult perform_install_plan_action(const VcpkgPaths& paths, + const Dependencies::InstallPlanAction& action, + const Build::BuildPackageOptions& install_plan_options, + StatusParagraphs& status_db); + + enum class InstallResult + { + FILE_CONFLICTS, + SUCCESS, + }; + + void install_files_and_write_listfile(Files::Filesystem& fs, const fs::path& source_dir, const InstallDir& dirs); + InstallResult install_package(const VcpkgPaths& paths, + const BinaryControlFile& binary_paragraph, + StatusParagraphs* status_db); + + void perform_and_exit_ex(const std::vector<Dependencies::AnyAction>& action_plan, + const Build::BuildPackageOptions& install_plan_options, + const KeepGoing keep_going, + const PrintSummary print_summary, + const VcpkgPaths& paths, + StatusParagraphs& status_db); + + extern const CommandStructure COMMAND_STRUCTURE; + + void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths, const Triplet& default_triplet); +} diff --git a/toolsrc/include/metrics.h b/toolsrc/include/vcpkg/metrics.h index 8eae426de..41be5002d 100644 --- a/toolsrc/include/metrics.h +++ b/toolsrc/include/vcpkg/metrics.h @@ -1,8 +1,8 @@ #pragma once -#include <string> +#include <vcpkg/base/util.h> -#include "vcpkg_Util.h" +#include <string> namespace vcpkg::Metrics { diff --git a/toolsrc/include/PackageSpec.h b/toolsrc/include/vcpkg/packagespec.h index c5ce767f9..ee34f14a3 100644 --- a/toolsrc/include/PackageSpec.h +++ b/toolsrc/include/vcpkg/packagespec.h @@ -1,8 +1,8 @@ #pragma once -#include "PackageSpecParseResult.h" -#include "Triplet.h" -#include "vcpkg_expected.h" +#include <vcpkg/base/expected.h> +#include <vcpkg/packagespecparseresult.h> +#include <vcpkg/triplet.h> namespace vcpkg { diff --git a/toolsrc/include/PackageSpecParseResult.h b/toolsrc/include/vcpkg/packagespecparseresult.h index 1462b8073..8a56574fd 100644 --- a/toolsrc/include/PackageSpecParseResult.h +++ b/toolsrc/include/vcpkg/packagespecparseresult.h @@ -1,6 +1,7 @@ #pragma once -#include "vcpkg_expected.h" +#include <vcpkg/base/cstringview.h> +#include <vcpkg/base/expected.h> namespace vcpkg { diff --git a/toolsrc/include/ParagraphParseResult.h b/toolsrc/include/vcpkg/paragraphparseresult.h index eaa7e6327..abdd9eecd 100644 --- a/toolsrc/include/ParagraphParseResult.h +++ b/toolsrc/include/vcpkg/paragraphparseresult.h @@ -1,4 +1,5 @@ #pragma once + #include <system_error> namespace vcpkg diff --git a/toolsrc/include/Paragraphs.h b/toolsrc/include/vcpkg/paragraphs.h index aae46f7da..c8dbea646 100644 --- a/toolsrc/include/Paragraphs.h +++ b/toolsrc/include/vcpkg/paragraphs.h @@ -1,13 +1,13 @@ #pragma once -#include <map> +#include <vcpkg/binaryparagraph.h> +#include <vcpkg/parse.h> +#include <vcpkg/vcpkgpaths.h> +#include <vcpkg/versiont.h> + +#include <vcpkg/base/expected.h> -#include "BinaryParagraph.h" -#include "VcpkgPaths.h" -#include "VersionT.h" -#include "filesystem_fs.h" -#include "vcpkg_Parse.h" -#include "vcpkg_expected.h" +#include <map> namespace vcpkg::Paragraphs { diff --git a/toolsrc/include/vcpkg_Parse.h b/toolsrc/include/vcpkg/parse.h index 2dda033b3..4b33e302e 100644 --- a/toolsrc/include/vcpkg_Parse.h +++ b/toolsrc/include/vcpkg/parse.h @@ -1,11 +1,11 @@ #pragma once +#include <vcpkg/base/expected.h> +#include <vcpkg/base/optional.h> + #include <memory> #include <unordered_map> -#include "vcpkg_expected.h" -#include "vcpkg_optional.h" - namespace vcpkg::Parse { struct ParseControlErrorInfo diff --git a/toolsrc/include/PostBuildLint_BuildType.h b/toolsrc/include/vcpkg/postbuildlint.buildtype.h index 38ad3084e..ff651fd7a 100644 --- a/toolsrc/include/PostBuildLint_BuildType.h +++ b/toolsrc/include/vcpkg/postbuildlint.buildtype.h @@ -1,6 +1,8 @@ #pragma once -#include "CStringView.h" -#include "vcpkg_Build.h" + +#include <vcpkg/base/cstringview.h> +#include <vcpkg/build.h> + #include <array> #include <regex> diff --git a/toolsrc/include/PostBuildLint.h b/toolsrc/include/vcpkg/postbuildlint.h index 69fafc9f7..5dcfeb8df 100644 --- a/toolsrc/include/PostBuildLint.h +++ b/toolsrc/include/vcpkg/postbuildlint.h @@ -1,7 +1,8 @@ #pragma once -#include "PackageSpec.h" -#include "VcpkgPaths.h" -#include "vcpkg_Build.h" + +#include <vcpkg/build.h> +#include <vcpkg/packagespec.h> +#include <vcpkg/vcpkgpaths.h> namespace vcpkg::PostBuildLint { diff --git a/toolsrc/include/vcpkg/remove.h b/toolsrc/include/vcpkg/remove.h new file mode 100644 index 000000000..6d8a3ebe9 --- /dev/null +++ b/toolsrc/include/vcpkg/remove.h @@ -0,0 +1,26 @@ +#pragma once + +#include <vcpkg/dependencies.h> +#include <vcpkg/vcpkgcmdarguments.h> +#include <vcpkg/vcpkgpaths.h> + +namespace vcpkg::Remove +{ + enum class Purge + { + NO = 0, + YES + }; + + inline Purge to_purge(const bool value) { return value ? Purge::YES : Purge::NO; } + + void perform_remove_plan_action(const VcpkgPaths& paths, + const Dependencies::RemovePlanAction& action, + const Purge purge, + StatusParagraphs& status_db); + + extern const CommandStructure COMMAND_STRUCTURE; + + void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths, const Triplet& default_triplet); + void remove_package(const VcpkgPaths& paths, const PackageSpec& spec, StatusParagraphs* status_db); +} diff --git a/toolsrc/include/SourceParagraph.h b/toolsrc/include/vcpkg/sourceparagraph.h index ccf9faf4f..0a02e4cda 100644 --- a/toolsrc/include/SourceParagraph.h +++ b/toolsrc/include/vcpkg/sourceparagraph.h @@ -1,10 +1,11 @@ #pragma once -#include "PackageSpec.h" -#include "Span.h" -#include "vcpkg_Parse.h" -#include "vcpkg_System.h" -#include "vcpkg_expected.h" +#include <vcpkg/packagespec.h> +#include <vcpkg/parse.h> + +#include <vcpkg/base/Span.h> +#include <vcpkg/base/expected.h> +#include <vcpkg/base/system.h> #include <string> #include <vector> diff --git a/toolsrc/include/StatusParagraph.h b/toolsrc/include/vcpkg/statusparagraph.h index b56533d65..ca84b1bb7 100644 --- a/toolsrc/include/StatusParagraph.h +++ b/toolsrc/include/vcpkg/statusparagraph.h @@ -1,6 +1,7 @@ #pragma once -#include "BinaryParagraph.h" +#include <vcpkg/binaryparagraph.h> + #include <unordered_map> namespace vcpkg diff --git a/toolsrc/include/StatusParagraphs.h b/toolsrc/include/vcpkg/statusparagraphs.h index 1a9ee6a03..c2f3b7b8e 100644 --- a/toolsrc/include/StatusParagraphs.h +++ b/toolsrc/include/vcpkg/statusparagraphs.h @@ -1,5 +1,6 @@ #pragma once -#include "StatusParagraph.h" +#include <vcpkg/statusparagraph.h> + #include <iterator> #include <memory> diff --git a/toolsrc/include/triplet.h b/toolsrc/include/vcpkg/triplet.h index 46a52f8e6..46a52f8e6 100644 --- a/toolsrc/include/triplet.h +++ b/toolsrc/include/vcpkg/triplet.h diff --git a/toolsrc/include/vcpkg/update.h b/toolsrc/include/vcpkg/update.h new file mode 100644 index 000000000..e7303d1b0 --- /dev/null +++ b/toolsrc/include/vcpkg/update.h @@ -0,0 +1,21 @@ +#pragma once + +#include <vcpkg/packagespec.h> +#include <vcpkg/statusparagraphs.h> +#include <vcpkg/vcpkgcmdarguments.h> +#include <vcpkg/vcpkgpaths.h> +#include <vcpkg/versiont.h> + +namespace vcpkg::Update +{ + struct OutdatedPackage + { + static bool compare_by_name(const OutdatedPackage& left, const OutdatedPackage& right); + + PackageSpec spec; + VersionDiff version_diff; + }; + + std::vector<OutdatedPackage> find_outdated_packages(const VcpkgPaths& paths, const StatusParagraphs& status_db); + void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths); +}
\ No newline at end of file diff --git a/toolsrc/include/VcpkgCmdArguments.h b/toolsrc/include/vcpkg/vcpkgcmdarguments.h index 0de5747b1..8b1d766b6 100644 --- a/toolsrc/include/VcpkgCmdArguments.h +++ b/toolsrc/include/vcpkg/vcpkgcmdarguments.h @@ -1,6 +1,9 @@ #pragma once -#include "vcpkg_optional.h" +#include <vcpkg/base/cstringview.h> +#include <vcpkg/base/optional.h> +#include <vcpkg/base/span.h> + #include <memory> #include <unordered_map> #include <unordered_set> @@ -46,4 +49,19 @@ namespace vcpkg private: std::unordered_map<std::string, Optional<std::string>> optional_command_arguments; }; + + struct VcpkgPaths; + + struct CommandStructure + { + CStringView example_text; + + size_t minimum_arity; + size_t maximum_arity; + + Span<const std::string> switches; + Span<const std::string> settings; + + std::vector<std::string> (*valid_arguments)(const VcpkgPaths& paths); + }; } diff --git a/toolsrc/include/vcpkglib.h b/toolsrc/include/vcpkg/vcpkglib.h index 0bb75f9b5..b2aad8d7b 100644 --- a/toolsrc/include/vcpkglib.h +++ b/toolsrc/include/vcpkg/vcpkglib.h @@ -1,8 +1,8 @@ #pragma once -#include "SortedVector.h" -#include "StatusParagraphs.h" -#include "VcpkgPaths.h" +#include <vcpkg/base/sortedvector.h> +#include <vcpkg/statusparagraphs.h> +#include <vcpkg/vcpkgpaths.h> namespace vcpkg { diff --git a/toolsrc/include/VcpkgPaths.h b/toolsrc/include/vcpkg/vcpkgpaths.h index 9f55dc5ac..01c6e30cd 100644 --- a/toolsrc/include/VcpkgPaths.h +++ b/toolsrc/include/vcpkg/vcpkgpaths.h @@ -1,10 +1,11 @@ #pragma once -#include "BinaryParagraph.h" -#include "Lazy.h" -#include "PackageSpec.h" -#include "filesystem_fs.h" -#include "vcpkg_Files.h" -#include "vcpkg_expected.h" + +#include <vcpkg/binaryparagraph.h> +#include <vcpkg/packagespec.h> + +#include <vcpkg/base/Lazy.h> +#include <vcpkg/base/expected.h> +#include <vcpkg/base/files.h> namespace vcpkg { @@ -17,6 +18,7 @@ namespace vcpkg struct Toolset { + fs::path visual_studio_root_path; fs::path dumpbin; fs::path vcvarsall; std::vector<std::wstring> vcvarsall_options; @@ -58,12 +60,16 @@ namespace vcpkg const fs::path& get_cmake_exe() const; const fs::path& get_git_exe() const; const fs::path& get_nuget_exe() const; + const fs::path& get_ifw_installerbase_exe() const; + const fs::path& get_ifw_binarycreator_exe() const; + const fs::path& get_ifw_repogen_exe() const; /// <summary>Retrieve a toolset matching a VS version</summary> /// <remarks> /// Valid version strings are "v120", "v140", "v141", and "". Empty string gets the latest. /// </remarks> - const Toolset& get_toolset(const std::string& toolset_version) const; + const Toolset& get_toolset(const Optional<std::string>& toolset_version, + const Optional<fs::path>& visual_studio_path) const; Files::Filesystem& get_filesystem() const; @@ -71,8 +77,10 @@ namespace vcpkg Lazy<fs::path> cmake_exe; Lazy<fs::path> git_exe; Lazy<fs::path> nuget_exe; + Lazy<fs::path> ifw_installerbase_exe; + Lazy<fs::path> ifw_binarycreator_exe; + Lazy<fs::path> ifw_repogen_exe; Lazy<std::vector<Toolset>> toolsets; - Lazy<std::vector<Toolset>> toolsets_vs2017_v140; Lazy<std::vector<Toolset>> toolsets_vs2013; }; } diff --git a/toolsrc/include/VersionT.h b/toolsrc/include/vcpkg/versiont.h index 67efd8da3..67efd8da3 100644 --- a/toolsrc/include/VersionT.h +++ b/toolsrc/include/vcpkg/versiont.h diff --git a/toolsrc/include/vcpkg_Commands.h b/toolsrc/include/vcpkg_Commands.h deleted file mode 100644 index 590f0208c..000000000 --- a/toolsrc/include/vcpkg_Commands.h +++ /dev/null @@ -1,253 +0,0 @@ -#pragma once - -#include "StatusParagraphs.h" -#include "VcpkgCmdArguments.h" -#include "VcpkgPaths.h" -#include "VersionT.h" -#include "vcpkg_Build.h" -#include "vcpkg_Dependencies.h" -#include <array> - -namespace vcpkg::Commands -{ - using CommandTypeA = void (*)(const VcpkgCmdArguments& args, - const VcpkgPaths& paths, - const Triplet& default_triplet); - using CommandTypeB = void (*)(const VcpkgCmdArguments& args, const VcpkgPaths& paths); - using CommandTypeC = void (*)(const VcpkgCmdArguments& args); - - namespace BuildCommand - { - void perform_and_exit(const FullPackageSpec& full_spec, - const fs::path& port_dir, - const std::unordered_set<std::string>& options, - const VcpkgPaths& paths); - - void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths, const Triplet& default_triplet); - } - - namespace BuildExternal - { - void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths, const Triplet& default_triplet); - } - - namespace Install - { - enum class KeepGoing - { - NO = 0, - YES - }; - - inline KeepGoing to_keep_going(const bool value) { return value ? KeepGoing::YES : KeepGoing::NO; } - - enum class PrintSummary - { - NO = 0, - YES - }; - - inline PrintSummary to_print_summary(const bool value) { return value ? PrintSummary::YES : PrintSummary::NO; } - - struct InstallDir - { - static InstallDir from_destination_root(const fs::path& destination_root, - const std::string& destination_subdirectory, - const fs::path& listfile); - - private: - fs::path m_destination; - std::string m_destination_subdirectory; - fs::path m_listfile; - - public: - const fs::path& destination() const; - const std::string& destination_subdirectory() const; - const fs::path& listfile() const; - }; - - Build::BuildResult perform_install_plan_action(const VcpkgPaths& paths, - const Dependencies::InstallPlanAction& action, - const Build::BuildPackageOptions& install_plan_options, - StatusParagraphs& status_db); - - enum class InstallResult - { - FILE_CONFLICTS, - SUCCESS, - }; - - void install_files_and_write_listfile(Files::Filesystem& fs, - const fs::path& source_dir, - const InstallDir& dirs); - InstallResult install_package(const VcpkgPaths& paths, - const BinaryControlFile& binary_paragraph, - StatusParagraphs* status_db); - - void perform_and_exit(const std::vector<Dependencies::AnyAction>& action_plan, - const Build::BuildPackageOptions& install_plan_options, - const KeepGoing keep_going, - const PrintSummary print_summary, - const VcpkgPaths& paths, - StatusParagraphs& status_db); - - void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths, const Triplet& default_triplet); - } - - namespace Export - { - void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths, const Triplet& default_triplet); - } - - namespace CI - { - void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths, const Triplet& default_triplet); - } - - namespace Remove - { - enum class Purge - { - NO = 0, - YES - }; - - inline Purge to_purge(const bool value) { return value ? Purge::YES : Purge::NO; } - - void perform_remove_plan_action(const VcpkgPaths& paths, - const Dependencies::RemovePlanAction& action, - const Purge purge, - StatusParagraphs& status_db); - - void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths, const Triplet& default_triplet); - void remove_package(const VcpkgPaths& paths, const PackageSpec& spec, StatusParagraphs* status_db); - } - - namespace Update - { - struct OutdatedPackage - { - static bool compare_by_name(const OutdatedPackage& left, const OutdatedPackage& right); - - PackageSpec spec; - VersionDiff version_diff; - }; - - std::vector<OutdatedPackage> find_outdated_packages(const VcpkgPaths& paths, const StatusParagraphs& status_db); - void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths); - } - - namespace Env - { - void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths, const Triplet& default_triplet); - } - - namespace Create - { - void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths); - } - - namespace Edit - { - void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths); - } - - namespace DependInfo - { - void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths); - } - - namespace Search - { - void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths); - } - - namespace List - { - void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths); - } - - namespace Owns - { - void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths); - } - - namespace Cache - { - void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths); - } - - namespace Import - { - void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths); - } - - namespace Integrate - { - extern const char* const INTEGRATE_COMMAND_HELPSTRING; - - void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths); - } - - namespace PortsDiff - { - void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths); - } - - namespace Help - { - void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths); - - void help_topic_valid_triplet(const VcpkgPaths& paths); - - void print_usage(); - - void print_example(const std::string& command_and_arguments); - - std::string create_example_string(const std::string& command_and_arguments); - } - - namespace Version - { - const std::string& version(); - void warn_if_vcpkg_version_mismatch(const VcpkgPaths& paths); - void perform_and_exit(const VcpkgCmdArguments& args); - } - - namespace Contact - { - const std::string& email(); - void perform_and_exit(const VcpkgCmdArguments& args); - } - - namespace Hash - { - void perform_and_exit(const VcpkgCmdArguments& args); - } - - template<class T> - struct PackageNameAndFunction - { - std::string name; - T function; - }; - - const std::vector<PackageNameAndFunction<CommandTypeA>>& get_available_commands_type_a(); - const std::vector<PackageNameAndFunction<CommandTypeB>>& get_available_commands_type_b(); - const std::vector<PackageNameAndFunction<CommandTypeC>>& get_available_commands_type_c(); - - template<typename T> - T find(const std::string& command_name, const std::vector<PackageNameAndFunction<T>> available_commands) - { - for (const PackageNameAndFunction<T>& cmd : available_commands) - { - if (cmd.name == command_name) - { - return cmd.function; - } - } - - // not found - return nullptr; - } -} diff --git a/toolsrc/include/vcpkg_Maps.h b/toolsrc/include/vcpkg_Maps.h deleted file mode 100644 index aadd81c2b..000000000 --- a/toolsrc/include/vcpkg_Maps.h +++ /dev/null @@ -1,30 +0,0 @@ -#pragma once - -#include <map> -#include <unordered_map> -#include <unordered_set> - -namespace vcpkg::Maps -{ - template<typename K, typename V> - std::vector<K> extract_keys(const std::unordered_map<K, V>& input_map) - { - std::vector<K> key_set; - for (auto const& element : input_map) - { - key_set.push_back(element.first); - } - return key_set; - } - - template<typename K, typename V> - std::vector<K> extract_keys(const std::map<K, V>& input_map) - { - std::vector<K> key_set; - for (auto const& element : input_map) - { - key_set.push_back(element.first); - } - return key_set; - } -} diff --git a/toolsrc/src/commands_build.cpp b/toolsrc/src/commands_build.cpp deleted file mode 100644 index a69958058..000000000 --- a/toolsrc/src/commands_build.cpp +++ /dev/null @@ -1,102 +0,0 @@ -#include "pch.h" - -#include "Paragraphs.h" -#include "PostBuildLint.h" -#include "StatusParagraphs.h" -#include "vcpkg_Commands.h" -#include "vcpkg_Dependencies.h" -#include "vcpkg_Enums.h" -#include "vcpkg_Input.h" -#include "vcpkg_System.h" -#include "vcpkglib.h" - -using vcpkg::Build::BuildResult; -using vcpkg::Parse::ParseControlErrorInfo; -using vcpkg::Parse::ParseExpected; - -namespace vcpkg::Commands::BuildCommand -{ - using Dependencies::InstallPlanAction; - using Dependencies::InstallPlanType; - - static const std::string OPTION_CHECKS_ONLY = "--checks-only"; - - void perform_and_exit(const FullPackageSpec& full_spec, - const fs::path& port_dir, - const std::unordered_set<std::string>& options, - const VcpkgPaths& paths) - { - const PackageSpec& spec = full_spec.package_spec; - if (options.find(OPTION_CHECKS_ONLY) != options.end()) - { - const auto pre_build_info = Build::PreBuildInfo::from_triplet_file(paths, spec.triplet()); - const auto build_info = Build::read_build_info(paths.get_filesystem(), paths.build_info_file_path(spec)); - const size_t error_count = PostBuildLint::perform_all_checks(spec, paths, pre_build_info, build_info); - Checks::check_exit(VCPKG_LINE_INFO, error_count == 0); - Checks::exit_success(VCPKG_LINE_INFO); - } - - const ParseExpected<SourceControlFile> source_control_file = - Paragraphs::try_load_port(paths.get_filesystem(), port_dir); - - if (!source_control_file.has_value()) - { - print_error_message(source_control_file.error()); - Checks::exit_fail(VCPKG_LINE_INFO); - } - - for (const std::string& str : full_spec.features) - { - System::println("%s \n", str); - } - const auto& scf = source_control_file.value_or_exit(VCPKG_LINE_INFO); - Checks::check_exit(VCPKG_LINE_INFO, - spec.name() == scf->core_paragraph->name, - "The Name: field inside the CONTROL does not match the port directory: '%s' != '%s'", - scf->core_paragraph->name, - spec.name()); - - const StatusParagraphs status_db = database_load_check(paths); - const Build::BuildPackageOptions build_package_options{Build::UseHeadVersion::NO, Build::AllowDownloads::YES}; - - const Build::BuildPackageConfig build_config{ - *scf->core_paragraph, spec.triplet(), paths.port_dir(spec), build_package_options}; - - const auto result = Build::build_package(paths, build_config, status_db); - if (result.code == BuildResult::CASCADED_DUE_TO_MISSING_DEPENDENCIES) - { - System::println(System::Color::error, - "The build command requires all dependencies to be already installed."); - System::println("The following dependencies are missing:"); - System::println(); - for (const auto& p : result.unmet_dependencies) - { - System::println(" %s", p); - } - System::println(); - Checks::exit_fail(VCPKG_LINE_INFO); - } - - if (result.code != BuildResult::SUCCEEDED) - { - System::println(System::Color::error, Build::create_error_message(result.code, spec)); - System::println(Build::create_user_troubleshooting_message(spec)); - Checks::exit_fail(VCPKG_LINE_INFO); - } - - Checks::exit_success(VCPKG_LINE_INFO); - } - - void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths, const Triplet& default_triplet) - { - static const std::string EXAMPLE = Commands::Help::create_example_string("build zlib:x64-windows"); - // Build only takes a single package and all dependencies must already be installed - args.check_exact_arg_count(1, EXAMPLE); - const std::string command_argument = args.command_arguments.at(0); - const FullPackageSpec spec = Input::check_and_get_full_package_spec(command_argument, default_triplet, EXAMPLE); - Input::check_triplet(spec.package_spec.triplet(), paths); - const std::unordered_set<std::string> options = - args.check_and_get_optional_command_arguments({OPTION_CHECKS_ONLY}); - perform_and_exit(spec, paths.port_dir(spec.package_spec), options, paths); - } -} diff --git a/toolsrc/src/tests_arguments.cpp b/toolsrc/src/tests.arguments.cpp index 14b3c3d4f..25bf0f085 100644 --- a/toolsrc/src/tests_arguments.cpp +++ b/toolsrc/src/tests.arguments.cpp @@ -1,5 +1,5 @@ -#include "CppUnitTest.h"
-#include "VcpkgCmdArguments.h"
+#include <CppUnitTest.h>
+#include <vcpkg/vcpkgcmdarguments.h>
#pragma comment(lib, "version")
#pragma comment(lib, "winhttp")
diff --git a/toolsrc/src/tests_dependencies.cpp b/toolsrc/src/tests.dependencies.cpp index 6a6981d73..3f6e0dd10 100644 --- a/toolsrc/src/tests_dependencies.cpp +++ b/toolsrc/src/tests.dependencies.cpp @@ -1,6 +1,6 @@ -#include "CppUnitTest.h" -#include "SourceParagraph.h" -#include "Triplet.h" +#include <CppUnitTest.h> +#include <vcpkg/sourceparagraph.h> +#include <vcpkg/triplet.h> #pragma comment(lib, "version") #pragma comment(lib, "winhttp") diff --git a/toolsrc/src/test_install_plan.cpp b/toolsrc/src/tests.installplan.cpp index 6c9311264..120009db5 100644 --- a/toolsrc/src/test_install_plan.cpp +++ b/toolsrc/src/tests.installplan.cpp @@ -1,6 +1,7 @@ -#include "CppUnitTest.h" -#include "vcpkg_Dependencies.h" -#include "vcpkg_Util.h" +#include <CppUnitTest.h> +#include <vcpkg/dependencies.h> + +#include <vcpkg/base/util.h> using namespace Microsoft::VisualStudio::CppUnitTestFramework; diff --git a/toolsrc/src/tests_package_spec.cpp b/toolsrc/src/tests.packagespec.cpp index a6b9d5b13..cb5c41af0 100644 --- a/toolsrc/src/tests_package_spec.cpp +++ b/toolsrc/src/tests.packagespec.cpp @@ -1,7 +1,8 @@ -#include "BinaryParagraph.h" -#include "CppUnitTest.h" -#include "Paragraphs.h" -#include "vcpkg_Strings.h" +#include <CppUnitTest.h> +#include <vcpkg/binaryparagraph.h> +#include <vcpkg/paragraphs.h> + +#include <vcpkg/base/strings.h> #pragma comment(lib, "version") #pragma comment(lib, "winhttp") diff --git a/toolsrc/src/tests_paragraph.cpp b/toolsrc/src/tests.paragraph.cpp index 47a07e12d..d9301abd0 100644 --- a/toolsrc/src/tests_paragraph.cpp +++ b/toolsrc/src/tests.paragraph.cpp @@ -1,7 +1,8 @@ -#include "BinaryParagraph.h" -#include "CppUnitTest.h" -#include "Paragraphs.h" -#include "vcpkg_Strings.h" +#include <CppUnitTest.h> +#include <vcpkg/binaryparagraph.h> +#include <vcpkg/paragraphs.h> + +#include <vcpkg/base/strings.h> #pragma comment(lib, "version") #pragma comment(lib, "winhttp") diff --git a/toolsrc/src/vcpkg.cpp b/toolsrc/src/vcpkg.cpp index 706c641fb..f1a86ae22 100644 --- a/toolsrc/src/vcpkg.cpp +++ b/toolsrc/src/vcpkg.cpp @@ -1,16 +1,18 @@ #define WIN32_LEAN_AND_MEAN #include <Windows.h> -#include "Paragraphs.h" -#include "metrics.h" -#include "vcpkg_Chrono.h" -#include "vcpkg_Commands.h" -#include "vcpkg_Files.h" -#include "vcpkg_GlobalState.h" -#include "vcpkg_Input.h" -#include "vcpkg_Strings.h" -#include "vcpkg_System.h" -#include "vcpkglib.h" +#include <vcpkg/base/chrono.h> +#include <vcpkg/base/files.h> +#include <vcpkg/base/strings.h> +#include <vcpkg/base/system.h> +#include <vcpkg/commands.h> +#include <vcpkg/globalstate.h> +#include <vcpkg/help.h> +#include <vcpkg/input.h> +#include <vcpkg/metrics.h> +#include <vcpkg/paragraphs.h> +#include <vcpkg/vcpkglib.h> + #pragma warning(push) #pragma warning(disable : 4768) #include <Shlobj.h> @@ -19,12 +21,15 @@ #include <fstream> #include <memory> +#pragma comment(lib, "ole32") +#pragma comment(lib, "shell32") + using namespace vcpkg; void invalid_command(const std::string& cmd) { System::println(System::Color::error, "invalid command: %s", cmd); - Commands::Help::print_usage(); + Help::print_usage(); Checks::exit_fail(VCPKG_LINE_INFO); } @@ -33,13 +38,26 @@ static void inner(const VcpkgCmdArguments& args) Metrics::g_metrics.lock()->track_property("command", args.command); if (args.command.empty()) { - Commands::Help::print_usage(); + Help::print_usage(); Checks::exit_fail(VCPKG_LINE_INFO); } - if (const auto command_function = Commands::find(args.command, Commands::get_available_commands_type_c())) + static const auto find_command = [&](auto&& commands) { + auto it = Util::find_if(commands, [&](auto&& commandc) { + return Strings::case_insensitive_ascii_compare(commandc.name, args.command); + }); + using std::end; + if (it != end(commands)) + { + return &*it; + } + else + return static_cast<decltype(&*it)>(nullptr); + }; + + if (const auto command_function = find_command(Commands::get_available_commands_type_c())) { - return command_function(args); + return command_function->function(args); } fs::path vcpkg_root_dir; @@ -56,8 +74,14 @@ static void inner(const VcpkgCmdArguments& args) } else { - vcpkg_root_dir = Files::get_real_filesystem().find_file_recursively_up( - fs::stdfs::absolute(System::get_exe_path_of_current_process()), ".vcpkg-root"); + const fs::path current_path = fs::stdfs::current_path(); + vcpkg_root_dir = Files::get_real_filesystem().find_file_recursively_up(current_path, ".vcpkg-root"); + + if (vcpkg_root_dir.empty()) + { + vcpkg_root_dir = Files::get_real_filesystem().find_file_recursively_up( + fs::stdfs::absolute(System::get_exe_path_of_current_process()), ".vcpkg-root"); + } } } @@ -70,13 +94,14 @@ static void inner(const VcpkgCmdArguments& args) vcpkg_root_dir.string(), expected_paths.error().message()); const VcpkgPaths paths = expected_paths.value_or_exit(VCPKG_LINE_INFO); + const int exit_code = _wchdir(paths.root.c_str()); Checks::check_exit(VCPKG_LINE_INFO, exit_code == 0, "Changing the working dir failed"); Commands::Version::warn_if_vcpkg_version_mismatch(paths); - if (const auto command_function = Commands::find(args.command, Commands::get_available_commands_type_b())) + if (const auto command_function = find_command(Commands::get_available_commands_type_b())) { - return command_function(args, paths); + return command_function->function(args, paths); } Triplet default_triplet; @@ -100,9 +125,9 @@ static void inner(const VcpkgCmdArguments& args) Input::check_triplet(default_triplet, paths); - if (const auto command_function = Commands::find(args.command, Commands::get_available_commands_type_a())) + if (const auto command_function = find_command(Commands::get_available_commands_type_a())) { - return command_function(args, paths, default_triplet); + return command_function->function(args, paths, default_triplet); } return invalid_command(args.command); @@ -202,7 +227,7 @@ int wmain(const int argc, const wchar_t* const* const argv) SetConsoleCP(65001); SetConsoleOutputCP(65001); - *GlobalState::timer.lock() = ElapsedTime::create_started(); + *GlobalState::timer.lock() = Chrono::ElapsedTime::create_started(); const std::string trimmed_command_line = trim_path_from_command_line(Strings::to_utf8(GetCommandLineW())); diff --git a/toolsrc/src/vcpkg_Checks.cpp b/toolsrc/src/vcpkg/base/checks.cpp index e7c9046a4..73c7b9b1a 100644 --- a/toolsrc/src/vcpkg_Checks.cpp +++ b/toolsrc/src/vcpkg/base/checks.cpp @@ -1,10 +1,10 @@ #include "pch.h" -#include "metrics.h" -#include "vcpkg_Checks.h" -#include "vcpkg_GlobalState.h" -#include "vcpkg_System.h" -#include "vcpkglib.h" +#include <vcpkg/globalstate.h> +#include <vcpkg/metrics.h> + +#include <vcpkg/base/checks.h> +#include <vcpkg/base/system.h> namespace vcpkg::Checks { diff --git a/toolsrc/src/vcpkg_Chrono.cpp b/toolsrc/src/vcpkg/base/chrono.cpp index d96f30987..5d28909fc 100644 --- a/toolsrc/src/vcpkg_Chrono.cpp +++ b/toolsrc/src/vcpkg/base/chrono.cpp @@ -1,9 +1,9 @@ #include "pch.h" -#include "vcpkg_Checks.h" -#include "vcpkg_Chrono.h" +#include <vcpkg/base/checks.h> +#include <vcpkg/base/chrono.h> -namespace vcpkg +namespace vcpkg::Chrono { static std::string format_time_userfriendly(const std::chrono::nanoseconds& nanos) { diff --git a/toolsrc/src/coff_file_reader.cpp b/toolsrc/src/vcpkg/base/cofffilereader.cpp index bb3a6cefd..5e9c86998 100644 --- a/toolsrc/src/coff_file_reader.cpp +++ b/toolsrc/src/vcpkg/base/cofffilereader.cpp @@ -1,7 +1,7 @@ #include "pch.h" -#include "coff_file_reader.h" -#include "vcpkg_Checks.h" +#include <vcpkg/base/checks.h> +#include <vcpkg/base/cofffilereader.h> using namespace std; diff --git a/toolsrc/src/vcpkg_Enums.cpp b/toolsrc/src/vcpkg/base/enums.cpp index 51ba9d5dc..aa124f3aa 100644 --- a/toolsrc/src/vcpkg_Enums.cpp +++ b/toolsrc/src/vcpkg/base/enums.cpp @@ -1,7 +1,7 @@ #include "pch.h" -#include "vcpkg_Checks.h" -#include "vcpkg_Enums.h" +#include <vcpkg/base/checks.h> +#include <vcpkg/base/enums.h> namespace vcpkg::Enums { diff --git a/toolsrc/src/vcpkg_Files.cpp b/toolsrc/src/vcpkg/base/files.cpp index ad1fcebc6..f8b239eaa 100644 --- a/toolsrc/src/vcpkg_Files.cpp +++ b/toolsrc/src/vcpkg/base/files.cpp @@ -1,9 +1,8 @@ #include "pch.h" -#include "vcpkg_Files.h" -#include "vcpkg_System.h" -#include "vcpkg_Util.h" -#include <thread> +#include <vcpkg/base/files.h> +#include <vcpkg/base/system.h> +#include <vcpkg/base/util.h> namespace vcpkg::Files { diff --git a/toolsrc/src/LineInfo.cpp b/toolsrc/src/vcpkg/base/lineinfo.cpp index d1bf9a4b1..7435ed666 100644 --- a/toolsrc/src/LineInfo.cpp +++ b/toolsrc/src/vcpkg/base/lineinfo.cpp @@ -1,7 +1,7 @@ #include "pch.h" -#include "LineInfo.h" -#include "vcpkg_Strings.h" +#include <vcpkg/base/lineinfo.h> +#include <vcpkg/base/strings.h> namespace vcpkg { diff --git a/toolsrc/src/MachineType.cpp b/toolsrc/src/vcpkg/base/machinetype.cpp index af6378c88..2b7bd5e3a 100644 --- a/toolsrc/src/MachineType.cpp +++ b/toolsrc/src/vcpkg/base/machinetype.cpp @@ -1,7 +1,7 @@ #include "pch.h" -#include "MachineType.h" -#include "vcpkg_Checks.h" +#include <vcpkg/base/checks.h> +#include <vcpkg/base/machinetype.h> namespace vcpkg { diff --git a/toolsrc/src/vcpkg_Strings.cpp b/toolsrc/src/vcpkg/base/strings.cpp index 21df2c309..2a6d3dff2 100644 --- a/toolsrc/src/vcpkg_Strings.cpp +++ b/toolsrc/src/vcpkg/base/strings.cpp @@ -1,8 +1,8 @@ #include "pch.h" -#include "vcpkg_Checks.h" -#include "vcpkg_Strings.h" -#include "vcpkg_Util.h" +#include <vcpkg/base/checks.h> +#include <vcpkg/base/strings.h> +#include <vcpkg/base/util.h> namespace vcpkg::Strings::details { @@ -104,9 +104,9 @@ namespace vcpkg::Strings return case_insensitive_ascii_find(s, pattern) != s.end(); } - int case_insensitive_ascii_compare(const CStringView left, const CStringView right) + bool case_insensitive_ascii_compare(const CStringView left, const CStringView right) { - return _stricmp(left.c_str(), right.c_str()); + return _stricmp(left.c_str(), right.c_str()) == 0; } std::string ascii_to_lowercase(const std::string& input) @@ -154,11 +154,13 @@ namespace vcpkg::Strings return output; } + const size_t delimiter_length = delimiter.length(); size_t i = 0; for (size_t pos = s.find(delimiter); pos != std::string::npos; pos = s.find(delimiter, pos)) { output.push_back(s.substr(i, pos - i)); - i = ++pos; + pos += delimiter_length; + i = pos; } // Add the rest of the string after the last delimiter, unless there is nothing after it diff --git a/toolsrc/src/vcpkg_System.cpp b/toolsrc/src/vcpkg/base/system.cpp index 4d2e88b73..d5d39461c 100644 --- a/toolsrc/src/vcpkg_System.cpp +++ b/toolsrc/src/vcpkg/base/system.cpp @@ -1,9 +1,10 @@ #include "pch.h" -#include "vcpkg_Checks.h" -#include "vcpkg_GlobalState.h" -#include "vcpkg_System.h" -#include "vcpkglib.h" +#include <vcpkg/base/checks.h> +#include <vcpkg/base/system.h> +#include <vcpkg/globalstate.h> + +#pragma comment(lib, "Advapi32") namespace vcpkg::System { @@ -26,11 +27,11 @@ namespace vcpkg::System Optional<CPUArchitecture> to_cpu_architecture(CStringView arch) { - if (Strings::case_insensitive_ascii_compare(arch, "x86") == 0) return CPUArchitecture::X86; - if (Strings::case_insensitive_ascii_compare(arch, "x64") == 0) return CPUArchitecture::X64; - if (Strings::case_insensitive_ascii_compare(arch, "amd64") == 0) return CPUArchitecture::X64; - if (Strings::case_insensitive_ascii_compare(arch, "arm") == 0) return CPUArchitecture::ARM; - if (Strings::case_insensitive_ascii_compare(arch, "arm64") == 0) return CPUArchitecture::ARM64; + if (Strings::case_insensitive_ascii_compare(arch, "x86")) return CPUArchitecture::X86; + if (Strings::case_insensitive_ascii_compare(arch, "x64")) return CPUArchitecture::X64; + if (Strings::case_insensitive_ascii_compare(arch, "amd64")) return CPUArchitecture::X64; + if (Strings::case_insensitive_ascii_compare(arch, "arm")) return CPUArchitecture::ARM; + if (Strings::case_insensitive_ascii_compare(arch, "arm64")) return CPUArchitecture::ARM64; return nullopt; } @@ -106,6 +107,8 @@ namespace vcpkg::System L"HTTPS_PROXY", // Enables find_package(CUDA) in CMake L"CUDA_PATH", + // Environmental variable generated automatically by CUDA after installation + L"NVCUDASAMPLES_ROOT", }; // Flush stdout before launching external process @@ -177,11 +180,11 @@ namespace vcpkg::System } // On Win7, output from powershell calls contain a byte order mark, so we strip it out if it is present - static void remove_byte_order_mark(std::wstring* s) + static void remove_byte_order_marks(std::wstring* s) { const wchar_t* a = s->c_str(); // This is the UTF-8 byte-order mark - if (a[0] == 0xEF && a[1] == 0xBB && a[2] == 0xBF) + while (s->size() >= 3 && a[0] == 0xEF && a[1] == 0xBB && a[2] == 0xBF) { s->erase(0, 3); } @@ -213,7 +216,7 @@ namespace vcpkg::System const auto ec = _pclose(pipe); Debug::println("_pclose() returned %d", ec); - remove_byte_order_mark(&output); + remove_byte_order_marks(&output); return {ec, Strings::to_utf8(output)}; } diff --git a/toolsrc/src/BinaryParagraph.cpp b/toolsrc/src/vcpkg/binaryparagraph.cpp index 1504912ab..ef943011f 100644 --- a/toolsrc/src/BinaryParagraph.cpp +++ b/toolsrc/src/vcpkg/binaryparagraph.cpp @@ -1,8 +1,8 @@ #include "pch.h" -#include "BinaryParagraph.h" -#include "vcpkg_Checks.h" -#include "vcpkg_Parse.h" +#include <vcpkg/base/checks.h> +#include <vcpkg/binaryparagraph.h> +#include <vcpkg/parse.h> namespace vcpkg { diff --git a/toolsrc/src/vcpkg_Build.cpp b/toolsrc/src/vcpkg/build.cpp index 853f84998..99ec541c1 100644 --- a/toolsrc/src/vcpkg_Build.cpp +++ b/toolsrc/src/vcpkg/build.cpp @@ -1,20 +1,147 @@ #include "pch.h" -#include "Paragraphs.h" -#include "PostBuildLint.h" -#include "metrics.h" -#include "vcpkg_Build.h" -#include "vcpkg_Checks.h" -#include "vcpkg_Chrono.h" -#include "vcpkg_Commands.h" -#include "vcpkg_Enums.h" -#include "vcpkg_GlobalState.h" -#include "vcpkg_System.h" -#include "vcpkg_optional.h" -#include "vcpkglib.h" +#include <vcpkg/base/checks.h> +#include <vcpkg/base/chrono.h> +#include <vcpkg/base/enums.h> +#include <vcpkg/base/optional.h> +#include <vcpkg/base/system.h> +#include <vcpkg/build.h> +#include <vcpkg/commands.h> +#include <vcpkg/dependencies.h> +#include <vcpkg/globalstate.h> +#include <vcpkg/help.h> +#include <vcpkg/input.h> +#include <vcpkg/metrics.h> +#include <vcpkg/paragraphs.h> +#include <vcpkg/postbuildlint.h> +#include <vcpkg/statusparagraphs.h> +#include <vcpkg/vcpkglib.h> + +using vcpkg::Build::BuildResult; +using vcpkg::Parse::ParseControlErrorInfo; +using vcpkg::Parse::ParseExpected; + +namespace vcpkg::Build::Command +{ + using Dependencies::InstallPlanAction; + using Dependencies::InstallPlanType; + + static const std::string OPTION_CHECKS_ONLY = "--checks-only"; + + void perform_and_exit(const FullPackageSpec& full_spec, + const fs::path& port_dir, + const std::unordered_set<std::string>& options, + const VcpkgPaths& paths) + { + const PackageSpec& spec = full_spec.package_spec; + if (options.find(OPTION_CHECKS_ONLY) != options.end()) + { + const auto pre_build_info = Build::PreBuildInfo::from_triplet_file(paths, spec.triplet()); + const auto build_info = Build::read_build_info(paths.get_filesystem(), paths.build_info_file_path(spec)); + const size_t error_count = PostBuildLint::perform_all_checks(spec, paths, pre_build_info, build_info); + Checks::check_exit(VCPKG_LINE_INFO, error_count == 0); + Checks::exit_success(VCPKG_LINE_INFO); + } + + const ParseExpected<SourceControlFile> source_control_file = + Paragraphs::try_load_port(paths.get_filesystem(), port_dir); + + if (!source_control_file.has_value()) + { + print_error_message(source_control_file.error()); + Checks::exit_fail(VCPKG_LINE_INFO); + } + + for (const std::string& str : full_spec.features) + { + System::println("%s \n", str); + } + const auto& scf = source_control_file.value_or_exit(VCPKG_LINE_INFO); + Checks::check_exit(VCPKG_LINE_INFO, + spec.name() == scf->core_paragraph->name, + "The Name: field inside the CONTROL does not match the port directory: '%s' != '%s'", + scf->core_paragraph->name, + spec.name()); + + const StatusParagraphs status_db = database_load_check(paths); + const Build::BuildPackageOptions build_package_options{Build::UseHeadVersion::NO, Build::AllowDownloads::YES}; + + const Build::BuildPackageConfig build_config{ + *scf->core_paragraph, spec.triplet(), paths.port_dir(spec), build_package_options}; + + const auto result = Build::build_package(paths, build_config, status_db); + if (result.code == BuildResult::CASCADED_DUE_TO_MISSING_DEPENDENCIES) + { + System::println(System::Color::error, + "The build command requires all dependencies to be already installed."); + System::println("The following dependencies are missing:"); + System::println(); + for (const auto& p : result.unmet_dependencies) + { + System::println(" %s", p); + } + System::println(); + Checks::exit_fail(VCPKG_LINE_INFO); + } + + if (result.code != BuildResult::SUCCEEDED) + { + System::println(System::Color::error, Build::create_error_message(result.code, spec)); + System::println(Build::create_user_troubleshooting_message(spec)); + Checks::exit_fail(VCPKG_LINE_INFO); + } + + Checks::exit_success(VCPKG_LINE_INFO); + } + + void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths, const Triplet& default_triplet) + { + static const std::string EXAMPLE = Help::create_example_string("build zlib:x64-windows"); + // Build only takes a single package and all dependencies must already be installed + args.check_exact_arg_count(1, EXAMPLE); + const std::string command_argument = args.command_arguments.at(0); + const FullPackageSpec spec = Input::check_and_get_full_package_spec(command_argument, default_triplet, EXAMPLE); + Input::check_triplet(spec.package_spec.triplet(), paths); + const std::unordered_set<std::string> options = + args.check_and_get_optional_command_arguments({OPTION_CHECKS_ONLY}); + perform_and_exit(spec, paths.port_dir(spec.package_spec), options, paths); + } +} namespace vcpkg::Build { + static const std::string NAME_EMPTY_PACKAGE = "PolicyEmptyPackage"; + static const std::string NAME_DLLS_WITHOUT_LIBS = "PolicyDLLsWithoutLIBs"; + static const std::string NAME_ONLY_RELEASE_CRT = "PolicyOnlyReleaseCRT"; + static const std::string NAME_EMPTY_INCLUDE_FOLDER = "PolicyEmptyIncludeFolder"; + static const std::string NAME_ALLOW_OBSOLETE_MSVCRT = "PolicyAllowObsoleteMsvcrt"; + + const std::string& to_string(BuildPolicy policy) + { + switch (policy) + { + case BuildPolicy::EMPTY_PACKAGE: return NAME_EMPTY_PACKAGE; + case BuildPolicy::DLLS_WITHOUT_LIBS: return NAME_DLLS_WITHOUT_LIBS; + case BuildPolicy::ONLY_RELEASE_CRT: return NAME_ONLY_RELEASE_CRT; + case BuildPolicy::EMPTY_INCLUDE_FOLDER: return NAME_EMPTY_INCLUDE_FOLDER; + case BuildPolicy::ALLOW_OBSOLETE_MSVCRT: return NAME_ALLOW_OBSOLETE_MSVCRT; + default: Checks::unreachable(VCPKG_LINE_INFO); + } + } + + CStringView to_cmake_variable(BuildPolicy policy) + { + switch (policy) + { + case BuildPolicy::EMPTY_PACKAGE: return "VCPKG_POLICY_EMPTY_PACKAGE"; + case BuildPolicy::DLLS_WITHOUT_LIBS: return "VCPKG_POLICY_DLLS_WITHOUT_LIBS"; + case BuildPolicy::ONLY_RELEASE_CRT: return "VCPKG_POLICY_ONLY_RELEASE_CRT"; + case BuildPolicy::EMPTY_INCLUDE_FOLDER: return "VCPKG_POLICY_EMPTY_INCLUDE_FOLDER"; + case BuildPolicy::ALLOW_OBSOLETE_MSVCRT: return "VCPKG_POLICY_ALLOW_OBSOLETE_MSVCRT"; + default: Checks::unreachable(VCPKG_LINE_INFO); + } + } + Optional<LinkageType> to_linkage_type(const std::string& str) { if (str == "dynamic") return LinkageType::DYNAMIC; @@ -138,7 +265,7 @@ namespace vcpkg::Build const fs::path ports_cmake_script_path = paths.ports_cmake; const auto pre_build_info = PreBuildInfo::from_triplet_file(paths, triplet); - const Toolset& toolset = paths.get_toolset(pre_build_info.platform_toolset); + const Toolset& toolset = paths.get_toolset(pre_build_info.platform_toolset, pre_build_info.visual_studio_path); const auto cmd_set_environment = make_build_env_cmd(pre_build_info, toolset); std::string features; @@ -174,7 +301,7 @@ namespace vcpkg::Build const std::wstring command = Strings::wformat(LR"(%s && %s)", cmd_set_environment, cmd_launch_cmake); - const ElapsedTime timer = ElapsedTime::create_started(); + const auto timer = Chrono::ElapsedTime::create_started(); const int return_code = System::cmd_execute_clean(command); const auto buildtimeus = timer.microseconds(); @@ -386,7 +513,15 @@ namespace vcpkg::Build if (variable_name == "VCPKG_PLATFORM_TOOLSET") { - pre_build_info.platform_toolset = variable_value; + pre_build_info.platform_toolset = + variable_value.empty() ? nullopt : Optional<std::string>{variable_value}; + continue; + } + + if (variable_name == "VCPKG_VISUAL_STUDIO_PATH") + { + pre_build_info.visual_studio_path = + variable_value.empty() ? nullopt : Optional<fs::path>{variable_value}; continue; } diff --git a/toolsrc/src/vcpkg/commands.autocomplete.cpp b/toolsrc/src/vcpkg/commands.autocomplete.cpp new file mode 100644 index 000000000..23c2c2f7e --- /dev/null +++ b/toolsrc/src/vcpkg/commands.autocomplete.cpp @@ -0,0 +1,129 @@ +#include "pch.h" + +#include <vcpkg/base/system.h> +#include <vcpkg/commands.h> +#include <vcpkg/install.h> +#include <vcpkg/metrics.h> +#include <vcpkg/paragraphs.h> +#include <vcpkg/remove.h> +#include <vcpkg/vcpkglib.h> + +namespace vcpkg::Commands::Autocomplete +{ + std::vector<std::string> autocomplete_install( + const std::vector<std::unique_ptr<SourceControlFile>>& source_paragraphs, const std::string& start_with) + { + std::vector<std::string> results; + + for (const auto& source_control_file : source_paragraphs) + { + auto&& sp = *source_control_file->core_paragraph; + + if (Strings::case_insensitive_ascii_starts_with(sp.name, start_with)) + { + results.push_back(sp.name); + } + } + return results; + } + + std::vector<std::string> autocomplete_remove(std::vector<StatusParagraph*> installed_packages, + const std::string& start_with) + { + std::vector<std::string> results; + + for (const auto& installed_package : installed_packages) + { + const auto sp = installed_package->package.displayname(); + + if (Strings::case_insensitive_ascii_starts_with(sp, start_with)) + { + results.push_back(sp); + } + } + return results; + } + + [[noreturn]] static void output_sorted_results_and_exit(const LineInfo& line_info, + std::vector<std::string>&& results) + { + const SortedVector<std::string> sorted_results(results); + System::println(Strings::join("\n", sorted_results)); + + Checks::exit_success(line_info); + } + + void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths) + { + Metrics::g_metrics.lock()->set_send_metrics(false); + const std::string to_autocomplete = Strings::join(" ", args.command_arguments); + const std::vector<std::string> tokens = Strings::split(to_autocomplete, " "); + + std::smatch match; + + // Handles vcpkg <command> + if (std::regex_match(to_autocomplete, match, std::regex{R"###(^(\S*)$)###"})) + { + const std::string requested_command = match[1].str(); + + std::vector<std::string> valid_commands = { + "install", + "search", + "remove", + "list", + "update", + "hash", + "help", + "integrate", + "export", + "edit", + "create", + "owns", + "cache", + "version", + "contact", + }; + + Util::unstable_keep_if(valid_commands, [&](const std::string& s) { + return Strings::case_insensitive_ascii_starts_with(s, requested_command); + }); + + output_sorted_results_and_exit(VCPKG_LINE_INFO, std::move(valid_commands)); + } + + struct CommandEntry + { + CStringView regex; + const CommandStructure& structure; + }; + static constexpr CommandEntry commands[] = { + {R"###(^install\s(.*\s|)(\S*)$)###", Install::COMMAND_STRUCTURE}, + {R"###(^edit\s(.*\s|)(\S*)$)###", Edit::COMMAND_STRUCTURE}, + {R"###(^remove\s(.*\s|)(\S*)$)###", Remove::COMMAND_STRUCTURE}, + }; + + for (auto&& command : commands) + { + if (std::regex_match(to_autocomplete, match, std::regex{command.regex.c_str()})) + { + auto prefix = match[2].str(); + std::vector<std::string> v; + if (Strings::case_insensitive_ascii_starts_with(prefix, "-")) + { + v = Util::fmap(command.structure.switches, [](auto&& s) -> std::string { return s; }); + } + else + { + v = command.structure.valid_arguments(paths); + } + + Util::unstable_keep_if( + v, [&](const std::string& s) { return Strings::case_insensitive_ascii_starts_with(s, prefix); }); + + output_sorted_results_and_exit(VCPKG_LINE_INFO, std::move(v)); + } + } + + Checks::exit_success(VCPKG_LINE_INFO); + } +} diff --git a/toolsrc/src/commands_build_external.cpp b/toolsrc/src/vcpkg/commands.buildexternal.cpp index 7e85f2250..3991beb62 100644 --- a/toolsrc/src/commands_build_external.cpp +++ b/toolsrc/src/vcpkg/commands.buildexternal.cpp @@ -1,14 +1,16 @@ #include "pch.h" -#include "vcpkg_Commands.h" -#include "vcpkg_Input.h" +#include <vcpkg/build.h> +#include <vcpkg/commands.h> +#include <vcpkg/help.h> +#include <vcpkg/input.h> namespace vcpkg::Commands::BuildExternal { void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths, const Triplet& default_triplet) { static const std::string EXAMPLE = - Commands::Help::create_example_string(R"(build_external zlib2 C:\path\to\dir\with\controlfile\)"); + Help::create_example_string(R"(build_external zlib2 C:\path\to\dir\with\controlfile\)"); args.check_exact_arg_count(2, EXAMPLE); const FullPackageSpec spec = Input::check_and_get_full_package_spec(args.command_arguments.at(0), default_triplet, EXAMPLE); @@ -16,6 +18,6 @@ namespace vcpkg::Commands::BuildExternal const std::unordered_set<std::string> options = args.check_and_get_optional_command_arguments({}); const fs::path port_dir = args.command_arguments.at(1); - BuildCommand::perform_and_exit(spec, port_dir, options, paths); + Build::Command::perform_and_exit(spec, port_dir, options, paths); } } diff --git a/toolsrc/src/commands_cache.cpp b/toolsrc/src/vcpkg/commands.cache.cpp index 5b65b197f..77f0a20f6 100644 --- a/toolsrc/src/commands_cache.cpp +++ b/toolsrc/src/vcpkg/commands.cache.cpp @@ -1,10 +1,11 @@ #include "pch.h" -#include "BinaryParagraph.h" -#include "Paragraphs.h" -#include "vcpkg_Commands.h" -#include "vcpkg_Files.h" -#include "vcpkg_System.h" +#include <vcpkg/base/files.h> +#include <vcpkg/base/system.h> +#include <vcpkg/binaryparagraph.h> +#include <vcpkg/commands.h> +#include <vcpkg/help.h> +#include <vcpkg/paragraphs.h> namespace vcpkg::Commands::Cache { @@ -29,7 +30,7 @@ namespace vcpkg::Commands::Cache { static const std::string EXAMPLE = Strings::format( "The argument should be a substring to search for, or no argument to display all cached libraries.\n%s", - Commands::Help::create_example_string("cache png")); + Help::create_example_string("cache png")); args.check_max_arg_count(1, EXAMPLE); args.check_and_get_optional_command_arguments({}); diff --git a/toolsrc/src/commands_ci.cpp b/toolsrc/src/vcpkg/commands.ci.cpp index 75ff65556..1c98d1d83 100644 --- a/toolsrc/src/commands_ci.cpp +++ b/toolsrc/src/vcpkg/commands.ci.cpp @@ -1,15 +1,17 @@ #include "pch.h" -#include "Paragraphs.h" -#include "vcpkg_Build.h" -#include "vcpkg_Chrono.h" -#include "vcpkg_Commands.h" -#include "vcpkg_Dependencies.h" -#include "vcpkg_Files.h" -#include "vcpkg_Input.h" -#include "vcpkg_System.h" -#include "vcpkg_Util.h" -#include "vcpkglib.h" +#include <vcpkg/base/chrono.h> +#include <vcpkg/base/files.h> +#include <vcpkg/base/system.h> +#include <vcpkg/base/util.h> +#include <vcpkg/build.h> +#include <vcpkg/commands.h> +#include <vcpkg/dependencies.h> +#include <vcpkg/help.h> +#include <vcpkg/input.h> +#include <vcpkg/install.h> +#include <vcpkg/paragraphs.h> +#include <vcpkg/vcpkglib.h> namespace vcpkg::Commands::CI { @@ -30,7 +32,7 @@ namespace vcpkg::Commands::CI void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths, const Triplet& default_triplet) { - static const std::string EXAMPLE = Commands::Help::create_example_string("ci x64-windows"); + static const std::string EXAMPLE = Help::create_example_string("ci x64-windows"); args.check_max_arg_count(1, EXAMPLE); const Triplet triplet = args.command_arguments.size() == 1 ? Triplet::from_canonical_name(args.command_arguments.at(0)) @@ -52,7 +54,7 @@ namespace vcpkg::Commands::CI return Dependencies::AnyAction(std::move(install_action)); }); - Install::perform_and_exit( + Install::perform_and_exit_ex( action_plan, install_plan_options, Install::KeepGoing::YES, Install::PrintSummary::YES, paths, status_db); Checks::exit_success(VCPKG_LINE_INFO); diff --git a/toolsrc/src/commands_contact.cpp b/toolsrc/src/vcpkg/commands.contact.cpp index 8374350ee..421b8a230 100644 --- a/toolsrc/src/commands_contact.cpp +++ b/toolsrc/src/vcpkg/commands.contact.cpp @@ -1,7 +1,7 @@ #include "pch.h" -#include "vcpkg_Commands.h" -#include "vcpkg_System.h" +#include <vcpkg/base/system.h> +#include <vcpkg/commands.h> namespace vcpkg::Commands::Contact { diff --git a/toolsrc/src/commands_available_commands.cpp b/toolsrc/src/vcpkg/commands.cpp index 87cc43dca..9d969ea28 100644 --- a/toolsrc/src/commands_available_commands.cpp +++ b/toolsrc/src/vcpkg/commands.cpp @@ -1,16 +1,22 @@ #include "pch.h" -#include "vcpkg_Commands.h" +#include <vcpkg/build.h> +#include <vcpkg/commands.h> +#include <vcpkg/export.h> +#include <vcpkg/help.h> +#include <vcpkg/install.h> +#include <vcpkg/remove.h> +#include <vcpkg/update.h> namespace vcpkg::Commands { - const std::vector<PackageNameAndFunction<CommandTypeA>>& get_available_commands_type_a() + Span<const PackageNameAndFunction<CommandTypeA>> get_available_commands_type_a() { static std::vector<PackageNameAndFunction<CommandTypeA>> t = { {"install", &Install::perform_and_exit}, {"ci", &CI::perform_and_exit}, {"remove", &Remove::perform_and_exit}, - {"build", &BuildCommand::perform_and_exit}, + {"build", &Build::Command::perform_and_exit}, {"env", &Env::perform_and_exit}, {"build-external", &BuildExternal::perform_and_exit}, {"export", &Export::perform_and_exit}, @@ -18,7 +24,7 @@ namespace vcpkg::Commands return t; } - const std::vector<PackageNameAndFunction<CommandTypeB>>& get_available_commands_type_b() + Span<const PackageNameAndFunction<CommandTypeB>> get_available_commands_type_b() { static std::vector<PackageNameAndFunction<CommandTypeB>> t = { {"/?", &Help::perform_and_exit}, @@ -34,11 +40,11 @@ namespace vcpkg::Commands {"import", &Import::perform_and_exit}, {"cache", &Cache::perform_and_exit}, {"portsdiff", &PortsDiff::perform_and_exit}, - }; + {"autocomplete", &Autocomplete::perform_and_exit}}; return t; } - const std::vector<PackageNameAndFunction<CommandTypeC>>& get_available_commands_type_c() + Span<const PackageNameAndFunction<CommandTypeC>> get_available_commands_type_c() { static std::vector<PackageNameAndFunction<CommandTypeC>> t = { {"version", &Version::perform_and_exit}, diff --git a/toolsrc/src/commands_create.cpp b/toolsrc/src/vcpkg/commands.create.cpp index 6898f7399..d923cf555 100644 --- a/toolsrc/src/commands_create.cpp +++ b/toolsrc/src/vcpkg/commands.create.cpp @@ -1,15 +1,16 @@ #include "pch.h" -#include "vcpkg_Commands.h" -#include "vcpkg_Files.h" -#include "vcpkg_System.h" -#include "vcpkglib.h" +#include <vcpkg/base/files.h> +#include <vcpkg/base/system.h> +#include <vcpkg/commands.h> +#include <vcpkg/help.h> +#include <vcpkg/vcpkglib.h> namespace vcpkg::Commands::Create { void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths) { - static const std::string EXAMPLE = Commands::Help::create_example_string( + static const std::string EXAMPLE = Help::create_example_string( R"###(create zlib2 http://zlib.net/zlib1211.zip "zlib1211-2.zip")###"); args.check_max_arg_count(3, EXAMPLE); args.check_min_arg_count(2, EXAMPLE); diff --git a/toolsrc/src/commands_depends.cpp b/toolsrc/src/vcpkg/commands.dependinfo.cpp index 17cd9c881..89c7e0c7f 100644 --- a/toolsrc/src/commands_depends.cpp +++ b/toolsrc/src/vcpkg/commands.dependinfo.cpp @@ -1,16 +1,17 @@ #include "pch.h" -#include "Paragraphs.h" -#include "vcpkg_Commands.h" -#include "vcpkg_Strings.h" -#include "vcpkg_System.h" -#include "vcpkg_Util.h" +#include <vcpkg/base/strings.h> +#include <vcpkg/base/system.h> +#include <vcpkg/base/util.h> +#include <vcpkg/commands.h> +#include <vcpkg/help.h> +#include <vcpkg/paragraphs.h> namespace vcpkg::Commands::DependInfo { void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths) { - static const std::string EXAMPLE = Commands::Help::create_example_string(R"###(depend-info [pat])###"); + static const std::string EXAMPLE = Help::create_example_string(R"###(depend-info [pat])###"); args.check_max_arg_count(1, EXAMPLE); args.check_and_get_optional_command_arguments({}); diff --git a/toolsrc/src/commands_edit.cpp b/toolsrc/src/vcpkg/commands.edit.cpp index 823c87534..a90ae1bc3 100644 --- a/toolsrc/src/commands_edit.cpp +++ b/toolsrc/src/vcpkg/commands.edit.cpp @@ -1,8 +1,10 @@ #include "pch.h" -#include "vcpkg_Commands.h" -#include "vcpkg_Input.h" -#include "vcpkg_System.h" +#include <vcpkg/base/system.h> +#include <vcpkg/commands.h> +#include <vcpkg/help.h> +#include <vcpkg/input.h> +#include <vcpkg/paragraphs.h> namespace vcpkg::Commands::Edit { @@ -29,16 +31,38 @@ namespace vcpkg::Commands::Edit return output; } - void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths) + static const std::string OPTION_BUILDTREES = "--buildtrees"; + + static const std::array<std::string, 1> SWITCHES = { + OPTION_BUILDTREES, + }; + static const std::array<std::string, 0> SETTINGS; + + static std::vector<std::string> valid_arguments(const VcpkgPaths& paths) { - static const std::string OPTION_BUILDTREES = "--buildtrees"; + auto sources_and_errors = Paragraphs::try_load_all_ports(paths.get_filesystem(), paths.ports); + + return Util::fmap(sources_and_errors.paragraphs, + [](auto&& pgh) -> std::string { return pgh->core_paragraph->name; }); + } + + const CommandStructure COMMAND_STRUCTURE = { + "edit zlib", + 1, + 1, + SWITCHES, + SETTINGS, + &valid_arguments, + }; + void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths) + { static const fs::path VS_CODE_INSIDERS = fs::path{"Microsoft VS Code Insiders"} / "Code - Insiders.exe"; static const fs::path VS_CODE = fs::path{"Microsoft VS Code"} / "Code.exe"; auto& fs = paths.get_filesystem(); - static const std::string EXAMPLE = Commands::Help::create_example_string("edit zlib"); + static const std::string EXAMPLE = Help::create_example_string("edit zlib"); args.check_exact_arg_count(1, EXAMPLE); const std::unordered_set<std::string> options = args.check_and_get_optional_command_arguments({OPTION_BUILDTREES}); diff --git a/toolsrc/src/commands_env.cpp b/toolsrc/src/vcpkg/commands.env.cpp index 073c501f5..089881588 100644 --- a/toolsrc/src/commands_env.cpp +++ b/toolsrc/src/vcpkg/commands.env.cpp @@ -1,20 +1,21 @@ #include "pch.h" -#include "vcpkg_Build.h" -#include "vcpkg_Commands.h" -#include "vcpkg_System.h" +#include <vcpkg/base/system.h> +#include <vcpkg/build.h> +#include <vcpkg/commands.h> +#include <vcpkg/help.h> namespace vcpkg::Commands::Env { void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths, const Triplet& default_triplet) { - static const std::string EXAMPLE = Commands::Help::create_example_string(R"(env --Triplet x64-windows)"); + static const std::string EXAMPLE = Help::create_example_string(R"(env --triplet x64-windows)"); args.check_exact_arg_count(0, EXAMPLE); args.check_and_get_optional_command_arguments({}); const auto pre_build_info = Build::PreBuildInfo::from_triplet_file(paths, default_triplet); - System::cmd_execute_clean( - Build::make_build_env_cmd(pre_build_info, paths.get_toolset(pre_build_info.platform_toolset)) + L" && cmd"); + const Toolset& toolset = paths.get_toolset(pre_build_info.platform_toolset, pre_build_info.visual_studio_path); + System::cmd_execute_clean(Build::make_build_env_cmd(pre_build_info, toolset) + L" && cmd"); Checks::exit_success(VCPKG_LINE_INFO); } diff --git a/toolsrc/src/vcpkg/commands.exportifw.cpp b/toolsrc/src/vcpkg/commands.exportifw.cpp new file mode 100644 index 000000000..fbf3beb8c --- /dev/null +++ b/toolsrc/src/vcpkg/commands.exportifw.cpp @@ -0,0 +1,490 @@ +#include "pch.h" + +#include <vcpkg/commands.h> +#include <vcpkg/export.h> +#include <vcpkg/export.ifw.h> +#include <vcpkg/install.h> + +namespace vcpkg::Export::IFW +{ + using Dependencies::ExportPlanAction; + using Dependencies::ExportPlanType; + using Install::InstallDir; + + static std::string create_release_date() + { + const tm date_time = System::get_current_date_time(); + + // Format is: YYYY-mm-dd + // 10 characters + 1 null terminating character will be written for a total of 11 chars + char mbstr[11]; + const size_t bytes_written = std::strftime(mbstr, sizeof(mbstr), "%Y-%m-%d", &date_time); + Checks::check_exit(VCPKG_LINE_INFO, + bytes_written == 10, + "Expected 10 bytes to be written, but %u were written", + bytes_written); + const std::string date_time_as_string(mbstr); + return date_time_as_string; + } + + std::string safe_rich_from_plain_text(const std::string& text) + { + // match standalone ampersand, no HTML number or name
+ std::regex standalone_ampersand(R"###(&(?!(#[0-9]+|\w+);))###"); + + return std::regex_replace(text, standalone_ampersand, "&"); + } + + fs::path get_packages_dir_path(const std::string& export_id, const Options& ifw_options, const VcpkgPaths& paths) + { + return ifw_options.maybe_packages_dir_path.has_value() + ? fs::path(ifw_options.maybe_packages_dir_path.value_or_exit(VCPKG_LINE_INFO)) + : paths.root / (export_id + "-ifw-packages"); + } + + fs::path get_repository_dir_path(const std::string& export_id, const Options& ifw_options, const VcpkgPaths& paths) + { + return ifw_options.maybe_repository_dir_path.has_value() + ? fs::path(ifw_options.maybe_repository_dir_path.value_or_exit(VCPKG_LINE_INFO)) + : paths.root / (export_id + "-ifw-repository"); + } + + fs::path get_config_file_path(const std::string& export_id, const Options& ifw_options, const VcpkgPaths& paths) + { + return ifw_options.maybe_config_file_path.has_value() + ? fs::path(ifw_options.maybe_config_file_path.value_or_exit(VCPKG_LINE_INFO)) + : paths.root / (export_id + "-ifw-configuration.xml"); + } + + fs::path get_installer_file_path(const std::string& export_id, const Options& ifw_options, const VcpkgPaths& paths) + { + return ifw_options.maybe_installer_file_path.has_value() + ? fs::path(ifw_options.maybe_installer_file_path.value_or_exit(VCPKG_LINE_INFO)) + : paths.root / (export_id + "-ifw-installer.exe"); + } + + fs::path export_real_package(const fs::path& ifw_packages_dir_path, + const ExportPlanAction& action, + Files::Filesystem& fs) + { + std::error_code ec; + + const BinaryParagraph& binary_paragraph = + action.any_paragraph.binary_control_file.value_or_exit(VCPKG_LINE_INFO).core_paragraph; + + // Prepare meta dir + const fs::path package_xml_file_path = + ifw_packages_dir_path / + Strings::format("packages.%s.%s", action.spec.name(), action.spec.triplet().canonical_name()) / "meta" / + "package.xml"; + const fs::path package_xml_dir_path = package_xml_file_path.parent_path(); + fs.create_directories(package_xml_dir_path, ec); + Checks::check_exit(VCPKG_LINE_INFO, + !ec, + "Could not create directory for package file %s", + package_xml_file_path.generic_string()); + + auto deps = Strings::join( + ",", binary_paragraph.depends, [](const std::string& dep) { return "packages." + dep + ":"; }); + + if (!deps.empty()) deps = "\n <Dependencies>" + deps + "</Dependencies>"; + + fs.write_contents(package_xml_file_path, + Strings::format( + R"###(<?xml version="1.0"?> +<Package> + <DisplayName>%s</DisplayName> + <Version>%s</Version> + <ReleaseDate>%s</ReleaseDate> + <AutoDependOn>packages.%s:,triplets.%s:</AutoDependOn>%s + <Virtual>true</Virtual> +</Package> +)###", + action.spec.to_string(), + binary_paragraph.version, + create_release_date(), + action.spec.name(), + action.spec.triplet().canonical_name(), + deps)); + + // Return dir path for export package data + return ifw_packages_dir_path / + Strings::format("packages.%s.%s", action.spec.name(), action.spec.triplet().canonical_name()) / "data" / + "installed"; + } + + void export_unique_packages(const fs::path& raw_exported_dir_path, + std::map<std::string, const ExportPlanAction*> unique_packages, + Files::Filesystem& fs) + { + std::error_code ec; + + // packages + + fs::path package_xml_file_path = raw_exported_dir_path / "packages" / "meta" / "package.xml"; + fs::path package_xml_dir_path = package_xml_file_path.parent_path(); + fs.create_directories(package_xml_dir_path, ec); + Checks::check_exit(VCPKG_LINE_INFO, + !ec, + "Could not create directory for package file %s", + package_xml_file_path.generic_string()); + fs.write_contents(package_xml_file_path, + Strings::format( + R"###(<?xml version="1.0"?> +<Package> + <DisplayName>Packages</DisplayName> + <Version>1.0.0</Version> + <ReleaseDate>%s</ReleaseDate> +</Package> +)###", + create_release_date())); + + for (auto package = unique_packages.begin(); package != unique_packages.end(); ++package) + { + const ExportPlanAction& action = *(package->second); + const BinaryParagraph& binary_paragraph = + action.any_paragraph.binary_control_file.value_or_exit(VCPKG_LINE_INFO).core_paragraph; + + package_xml_file_path = + raw_exported_dir_path / Strings::format("packages.%s", package->first) / "meta" / "package.xml"; + package_xml_dir_path = package_xml_file_path.parent_path(); + fs.create_directories(package_xml_dir_path, ec); + Checks::check_exit(VCPKG_LINE_INFO, + !ec, + "Could not create directory for package file %s", + package_xml_file_path.generic_string()); + + fs.write_contents(package_xml_file_path, + Strings::format( + R"###(<?xml version="1.0"?> +<Package> + <DisplayName>%s</DisplayName> + <Description>%s</Description> + <Version>%s</Version> + <ReleaseDate>%s</ReleaseDate> +</Package> +)###", + action.spec.name(), + safe_rich_from_plain_text(binary_paragraph.description), + binary_paragraph.version, + create_release_date())); + } + } + + void export_unique_triplets(const fs::path& raw_exported_dir_path, + std::set<std::string> unique_triplets, + Files::Filesystem& fs) + { + std::error_code ec; + + // triplets + + fs::path package_xml_file_path = raw_exported_dir_path / "triplets" / "meta" / "package.xml"; + fs::path package_xml_dir_path = package_xml_file_path.parent_path(); + fs.create_directories(package_xml_dir_path, ec); + Checks::check_exit(VCPKG_LINE_INFO, + !ec, + "Could not create directory for package file %s", + package_xml_file_path.generic_string()); + fs.write_contents(package_xml_file_path, + Strings::format( + R"###(<?xml version="1.0"?> +<Package> + <DisplayName>Triplets</DisplayName> + <Version>1.0.0</Version> + <ReleaseDate>%s</ReleaseDate> +</Package> +)###", + create_release_date())); + + for (const std::string& triplet : unique_triplets) + { + package_xml_file_path = + raw_exported_dir_path / Strings::format("triplets.%s", triplet) / "meta" / "package.xml"; + package_xml_dir_path = package_xml_file_path.parent_path(); + fs.create_directories(package_xml_dir_path, ec); + Checks::check_exit(VCPKG_LINE_INFO, + !ec, + "Could not create directory for package file %s", + package_xml_file_path.generic_string()); + fs.write_contents(package_xml_file_path, + Strings::format( + R"###(<?xml version="1.0"?> +<Package> + <DisplayName>%s</DisplayName> + <Version>1.0.0</Version> + <ReleaseDate>%s</ReleaseDate> +</Package> +)###", + triplet, + create_release_date())); + } + } + + void export_integration(const fs::path& raw_exported_dir_path, Files::Filesystem& fs) + { + std::error_code ec; + + // integration + fs::path package_xml_file_path = raw_exported_dir_path / "integration" / "meta" / "package.xml"; + fs::path package_xml_dir_path = package_xml_file_path.parent_path(); + fs.create_directories(package_xml_dir_path, ec); + Checks::check_exit(VCPKG_LINE_INFO, + !ec, + "Could not create directory for package file %s", + package_xml_file_path.generic_string()); + + fs.write_contents(package_xml_file_path, + Strings::format( + R"###(<?xml version="1.0"?> +<Package> + <DisplayName>Integration</DisplayName> + <Version>1.0.0</Version> + <ReleaseDate>%s</ReleaseDate> +</Package> +)###", + create_release_date())); + } + + void export_config(const std::string& export_id, const Options& ifw_options, const VcpkgPaths& paths) + { + std::error_code ec; + Files::Filesystem& fs = paths.get_filesystem(); + + const fs::path config_xml_file_path = get_config_file_path(export_id, ifw_options, paths); + + fs::path config_xml_dir_path = config_xml_file_path.parent_path(); + fs.create_directories(config_xml_dir_path, ec); + Checks::check_exit(VCPKG_LINE_INFO, + !ec, + "Could not create directory for configuration file %s", + config_xml_file_path.generic_string()); + + std::string formatted_repo_url; + std::string ifw_repo_url = ifw_options.maybe_repository_url.value_or(""); + if (!ifw_repo_url.empty()) + { + formatted_repo_url = Strings::format(R"###( + <RemoteRepositories> + <Repository> + <Url>%s</Url> + </Repository> + </RemoteRepositories>)###", + ifw_repo_url); + } + + fs.write_contents(config_xml_file_path, + Strings::format( + R"###(<?xml version="1.0"?> +<Installer> + <Name>vcpkg</Name> + <Version>1.0.0</Version> + <StartMenuDir>vcpkg</StartMenuDir> + <TargetDir>@RootDir@/src/vcpkg</TargetDir>%s +</Installer> +)###", + formatted_repo_url)); + } + + void export_maintenance_tool(const fs::path& ifw_packages_dir_path, const VcpkgPaths& paths) + { + System::println("Exporting maintenance tool... "); + + std::error_code ec; + Files::Filesystem& fs = paths.get_filesystem(); + + const fs::path& installerbase_exe = paths.get_ifw_installerbase_exe(); + fs::path tempmaintenancetool = ifw_packages_dir_path / "maintenance" / "data" / "tempmaintenancetool.exe"; + fs.create_directories(tempmaintenancetool.parent_path(), ec); + Checks::check_exit(VCPKG_LINE_INFO, + !ec, + "Could not create directory for package file %s", + tempmaintenancetool.generic_string()); + fs.copy_file(installerbase_exe, tempmaintenancetool, fs::copy_options::overwrite_existing, ec); + Checks::check_exit( + VCPKG_LINE_INFO, !ec, "Could not write package file %s", tempmaintenancetool.generic_string()); + + fs::path package_xml_file_path = ifw_packages_dir_path / "maintenance" / "meta" / "package.xml"; + fs::path package_xml_dir_path = package_xml_file_path.parent_path(); + fs.create_directories(package_xml_dir_path, ec); + Checks::check_exit(VCPKG_LINE_INFO, + !ec, + "Could not create directory for package file %s", + package_xml_file_path.generic_string()); + fs.write_contents(package_xml_file_path, + Strings::format( + R"###(<?xml version="1.0"?> +<Package> + <DisplayName>Maintenance Tool</DisplayName> + <Description>Maintenance Tool</Description> + <Version>1.0.0</Version> + <ReleaseDate>%s</ReleaseDate> + <Script>maintenance.qs</Script> + <Essential>true</Essential> + <Virtual>true</Virtual> + <ForcedInstallation>true</ForcedInstallation> +</Package> +)###", + create_release_date())); + const fs::path script_source = paths.root / "scripts" / "ifw" / "maintenance.qs"; + const fs::path script_destination = ifw_packages_dir_path / "maintenance" / "meta" / "maintenance.qs"; + fs.copy_file(script_source, script_destination, fs::copy_options::overwrite_existing, ec); + Checks::check_exit( + VCPKG_LINE_INFO, !ec, "Could not write package file %s", script_destination.generic_string()); + + System::println("Exporting maintenance tool... done"); + } + + void do_repository(const std::string& export_id, const Options& ifw_options, const VcpkgPaths& paths) + { + const fs::path& repogen_exe = paths.get_ifw_repogen_exe(); + const fs::path packages_dir = get_packages_dir_path(export_id, ifw_options, paths); + const fs::path repository_dir = get_repository_dir_path(export_id, ifw_options, paths); + + System::println("Generating repository %s...", repository_dir.generic_string()); + + std::error_code ec; + Files::Filesystem& fs = paths.get_filesystem(); + + fs.remove_all(repository_dir, ec); + Checks::check_exit( + VCPKG_LINE_INFO, !ec, "Could not remove outdated repository directory %s", repository_dir.generic_string()); + + const std::wstring cmd_line = Strings::wformat(LR"("%s" --packages "%s" "%s" > nul)", + repogen_exe.native(), + packages_dir.native(), + repository_dir.native()); + + const int exit_code = System::cmd_execute_clean(cmd_line); + Checks::check_exit(VCPKG_LINE_INFO, exit_code == 0, "Error: IFW repository generating failed"); + + System::println(System::Color::success, "Generating repository %s... done.", repository_dir.generic_string()); + } + + void do_installer(const std::string& export_id, const Options& ifw_options, const VcpkgPaths& paths) + { + const fs::path& binarycreator_exe = paths.get_ifw_binarycreator_exe(); + const fs::path config_file = get_config_file_path(export_id, ifw_options, paths); + const fs::path packages_dir = get_packages_dir_path(export_id, ifw_options, paths); + const fs::path repository_dir = get_repository_dir_path(export_id, ifw_options, paths); + const fs::path installer_file = get_installer_file_path(export_id, ifw_options, paths); + + System::println("Generating installer %s...", installer_file.generic_string()); + + std::wstring cmd_line; + + std::string ifw_repo_url = ifw_options.maybe_repository_url.value_or(""); + if (!ifw_repo_url.empty()) + { + cmd_line = Strings::wformat(LR"("%s" --online-only --config "%s" --repository "%s" "%s" > nul)", + binarycreator_exe.native(), + config_file.native(), + repository_dir.native(), + installer_file.native()); + } + else + { + cmd_line = Strings::wformat(LR"("%s" --config "%s" --packages "%s" "%s" > nul)", + binarycreator_exe.native(), + config_file.native(), + packages_dir.native(), + installer_file.native()); + } + + const int exit_code = System::cmd_execute_clean(cmd_line); + Checks::check_exit(VCPKG_LINE_INFO, exit_code == 0, "Error: IFW installer generating failed"); + + System::println(System::Color::success, "Generating installer %s... done.", installer_file.generic_string()); + } + + void do_export(const std::vector<ExportPlanAction>& export_plan, + const std::string& export_id, + const Options& ifw_options, + const VcpkgPaths& paths) + { + std::error_code ec; + Files::Filesystem& fs = paths.get_filesystem(); + + // Prepare packages directory + const fs::path ifw_packages_dir_path = get_packages_dir_path(export_id, ifw_options, paths); + + fs.remove_all(ifw_packages_dir_path, ec); + Checks::check_exit(VCPKG_LINE_INFO, + !ec, + "Could not remove outdated packages directory %s", + ifw_packages_dir_path.generic_string()); + + fs.create_directory(ifw_packages_dir_path, ec); + Checks::check_exit( + VCPKG_LINE_INFO, !ec, "Could not create packages directory %s", ifw_packages_dir_path.generic_string()); + + // Export maintenance tool + export_maintenance_tool(ifw_packages_dir_path, paths); + + System::println("Exporting packages %s... ", ifw_packages_dir_path.generic_string()); + + // execute the plan + std::map<std::string, const ExportPlanAction*> unique_packages; + std::set<std::string> unique_triplets; + for (const ExportPlanAction& action : export_plan) + { + if (action.plan_type != ExportPlanType::ALREADY_BUILT) + { + Checks::unreachable(VCPKG_LINE_INFO); + } + + const std::string display_name = action.spec.to_string(); + System::println("Exporting package %s... ", display_name); + + const BinaryParagraph& binary_paragraph = + action.any_paragraph.binary_control_file.value_or_exit(VCPKG_LINE_INFO).core_paragraph; + + unique_packages[action.spec.name()] = &action; + unique_triplets.insert(action.spec.triplet().canonical_name()); + + // Export real package and return data dir for installation + fs::path ifw_package_dir_path = export_real_package(ifw_packages_dir_path, action, fs); + + // Copy package data + const InstallDir dirs = InstallDir::from_destination_root(ifw_package_dir_path, + action.spec.triplet().to_string(), + ifw_package_dir_path / "vcpkg" / "info" / + (binary_paragraph.fullstem() + ".list")); + + Install::install_files_and_write_listfile(paths.get_filesystem(), paths.package_dir(action.spec), dirs); + System::println("Exporting package %s... done", display_name); + } + + System::println("Exporting packages %s... done", ifw_packages_dir_path.generic_string()); + + const fs::path config_file = get_config_file_path(export_id, ifw_options, paths); + + System::println("Generating configuration %s...", config_file.generic_string()); + + // Unique packages + export_unique_packages(ifw_packages_dir_path, unique_packages, fs); + + // Unique triplets + export_unique_triplets(ifw_packages_dir_path, unique_triplets, fs); + + // Copy files needed for integration + export_integration_files(ifw_packages_dir_path / "integration" / "data", paths); + // Integration + export_integration(ifw_packages_dir_path, fs); + + // Configuration + export_config(export_id, ifw_options, paths); + + System::println("Generating configuration %s... done.", config_file.generic_string()); + + // Do repository (optional) + std::string ifw_repo_url = ifw_options.maybe_repository_url.value_or(""); + if (!ifw_repo_url.empty()) + { + do_repository(export_id, ifw_options, paths); + } + + // Do installer + do_installer(export_id, ifw_options, paths); + } +} diff --git a/toolsrc/src/commands_hash.cpp b/toolsrc/src/vcpkg/commands.hash.cpp index b3211b9f8..394a02e23 100644 --- a/toolsrc/src/commands_hash.cpp +++ b/toolsrc/src/vcpkg/commands.hash.cpp @@ -1,8 +1,9 @@ #include "pch.h" -#include "vcpkg_Commands.h" -#include "vcpkg_System.h" -#include "vcpkg_Util.h" +#include <vcpkg/base/system.h> +#include <vcpkg/base/util.h> +#include <vcpkg/commands.h> +#include <vcpkg/help.h> namespace vcpkg::Commands::Hash { @@ -34,9 +35,8 @@ namespace vcpkg::Commands::Hash void perform_and_exit(const VcpkgCmdArguments& args) { - static const std::string EXAMPLE = - Strings::format("The argument should be a file path\n%s", - Commands::Help::create_example_string("hash boost_1_62_0.tar.bz2")); + static const std::string EXAMPLE = Strings::format("The argument should be a file path\n%s", + Help::create_example_string("hash boost_1_62_0.tar.bz2")); args.check_min_arg_count(1, EXAMPLE); args.check_max_arg_count(2, EXAMPLE); args.check_and_get_optional_command_arguments({}); diff --git a/toolsrc/src/commands_import.cpp b/toolsrc/src/vcpkg/commands.import.cpp index 412a03d7f..119aee022 100644 --- a/toolsrc/src/commands_import.cpp +++ b/toolsrc/src/vcpkg/commands.import.cpp @@ -1,9 +1,10 @@ #include "pch.h" -#include "Paragraphs.h" -#include "StatusParagraph.h" -#include "vcpkg_Commands.h" -#include "vcpkg_Files.h" +#include <vcpkg/base/files.h> +#include <vcpkg/commands.h> +#include <vcpkg/help.h> +#include <vcpkg/paragraphs.h> +#include <vcpkg/statusparagraph.h> namespace vcpkg::Commands::Import { @@ -93,7 +94,7 @@ namespace vcpkg::Commands::Import void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths) { - static const std::string EXAMPLE = Commands::Help::create_example_string( + static const std::string EXAMPLE = Help::create_example_string( R"(import C:\path\to\CONTROLfile C:\path\to\includedir C:\path\to\projectdir)"); args.check_exact_arg_count(3, EXAMPLE); args.check_and_get_optional_command_arguments({}); diff --git a/toolsrc/src/commands_integrate.cpp b/toolsrc/src/vcpkg/commands.integrate.cpp index fd2f11294..85b567adb 100644 --- a/toolsrc/src/commands_integrate.cpp +++ b/toolsrc/src/vcpkg/commands.integrate.cpp @@ -1,10 +1,10 @@ #include "pch.h" -#include "vcpkg_Checks.h" -#include "vcpkg_Commands.h" -#include "vcpkg_Files.h" -#include "vcpkg_System.h" -#include "vcpkg_Util.h" +#include <vcpkg/base/checks.h> +#include <vcpkg/base/files.h> +#include <vcpkg/base/system.h> +#include <vcpkg/base/util.h> +#include <vcpkg/commands.h> namespace vcpkg::Commands::Integrate { @@ -230,13 +230,14 @@ namespace vcpkg::Commands::Integrate } System::println(System::Color::success, "Applied user-wide integration for this vcpkg root."); const fs::path cmake_toolchain = paths.buildsystems / "vcpkg.cmake"; - System::println("\n" - "All MSBuild C++ projects can now #include any installed libraries.\n" - "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()); + System::println( + 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_string()); Checks::exit_success(VCPKG_LINE_INFO); } diff --git a/toolsrc/src/commands_list.cpp b/toolsrc/src/vcpkg/commands.list.cpp index 640885860..d0e8e00b4 100644 --- a/toolsrc/src/commands_list.cpp +++ b/toolsrc/src/vcpkg/commands.list.cpp @@ -1,8 +1,9 @@ #include "pch.h" -#include "vcpkg_Commands.h" -#include "vcpkg_System.h" -#include "vcpkglib.h" +#include <vcpkg/base/system.h> +#include <vcpkg/commands.h> +#include <vcpkg/help.h> +#include <vcpkg/vcpkglib.h> namespace vcpkg::Commands::List { @@ -27,7 +28,7 @@ namespace vcpkg::Commands::List { static const std::string EXAMPLE = Strings::format( "The argument should be a substring to search for, or no argument to display all installed libraries.\n%s", - Commands::Help::create_example_string("list png")); + Help::create_example_string("list png")); args.check_max_arg_count(1, EXAMPLE); const std::unordered_set<std::string> options = args.check_and_get_optional_command_arguments({OPTION_FULLDESC}); diff --git a/toolsrc/src/commands_owns.cpp b/toolsrc/src/vcpkg/commands.owns.cpp index 718a0277f..69079e829 100644 --- a/toolsrc/src/commands_owns.cpp +++ b/toolsrc/src/vcpkg/commands.owns.cpp @@ -1,8 +1,9 @@ #include "pch.h" -#include "vcpkg_Commands.h" -#include "vcpkg_System.h" -#include "vcpkglib.h" +#include <vcpkg/base/system.h> +#include <vcpkg/commands.h> +#include <vcpkg/help.h> +#include <vcpkg/vcpkglib.h> namespace vcpkg::Commands::Owns { @@ -26,7 +27,7 @@ namespace vcpkg::Commands::Owns void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths) { static const std::string EXAMPLE = Strings::format("The argument should be a pattern to search for. %s", - Commands::Help::create_example_string("owns zlib.dll")); + Help::create_example_string("owns zlib.dll")); args.check_exact_arg_count(1, EXAMPLE); args.check_and_get_optional_command_arguments({}); diff --git a/toolsrc/src/commands_portsdiff.cpp b/toolsrc/src/vcpkg/commands.portsdiff.cpp index 2334b2270..b70ad2b80 100644 --- a/toolsrc/src/commands_portsdiff.cpp +++ b/toolsrc/src/vcpkg/commands.portsdiff.cpp @@ -1,10 +1,12 @@ #include "pch.h" -#include "Paragraphs.h" -#include "SortedVector.h" -#include "vcpkg_Commands.h" -#include "vcpkg_Maps.h" -#include "vcpkg_System.h" +#include <vcpkg/commands.h> +#include <vcpkg/help.h> +#include <vcpkg/paragraphs.h> + +#include <vcpkg/base/sortedvector.h> +#include <vcpkg/base/system.h> +#include <vcpkg/base/util.h> namespace vcpkg::Commands::PortsDiff { @@ -116,9 +118,8 @@ namespace vcpkg::Commands::PortsDiff void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths) { - static const std::string EXAMPLE = - Strings::format("The argument should be a branch/tag/hash to checkout.\n%s", - Commands::Help::create_example_string("portsdiff mybranchname")); + static const std::string EXAMPLE = Strings::format("The argument should be a branch/tag/hash to checkout.\n%s", + Help::create_example_string("portsdiff mybranchname")); args.check_min_arg_count(1, EXAMPLE); args.check_max_arg_count(2, EXAMPLE); args.check_and_get_optional_command_arguments({}); @@ -138,8 +139,8 @@ namespace vcpkg::Commands::PortsDiff read_ports_from_commit(paths, git_commit_id_for_previous_snapshot); // Already sorted, so set_difference can work on std::vector too - const std::vector<std::string> current_ports = Maps::extract_keys(current_names_and_versions); - const std::vector<std::string> previous_ports = Maps::extract_keys(previous_names_and_versions); + const std::vector<std::string> current_ports = Util::extract_keys(current_names_and_versions); + const std::vector<std::string> previous_ports = Util::extract_keys(previous_names_and_versions); const SetElementPresence<std::string> setp = SetElementPresence<std::string>::create(current_ports, previous_ports); diff --git a/toolsrc/src/commands_search.cpp b/toolsrc/src/vcpkg/commands.search.cpp index d35a546c4..3ba8707de 100644 --- a/toolsrc/src/commands_search.cpp +++ b/toolsrc/src/vcpkg/commands.search.cpp @@ -1,11 +1,12 @@ #include "pch.h" -#include "Paragraphs.h" -#include "SourceParagraph.h" -#include "vcpkg_Commands.h" -#include "vcpkg_GlobalState.h" -#include "vcpkg_System.h" -#include "vcpkglib.h" +#include <vcpkg/base/system.h> +#include <vcpkg/commands.h> +#include <vcpkg/globalstate.h> +#include <vcpkg/help.h> +#include <vcpkg/paragraphs.h> +#include <vcpkg/sourceparagraph.h> +#include <vcpkg/vcpkglib.h> namespace vcpkg::Commands::Search { @@ -82,7 +83,7 @@ namespace vcpkg::Commands::Search { static const std::string EXAMPLE = Strings::format( "The argument should be a substring to search for, or no argument to display all libraries.\n%s", - Commands::Help::create_example_string("search png")); + Help::create_example_string("search png")); args.check_max_arg_count(1, EXAMPLE); const std::unordered_set<std::string> options = args.check_and_get_optional_command_arguments({OPTION_GRAPH, OPTION_FULLDESC}); diff --git a/toolsrc/src/commands_version.cpp b/toolsrc/src/vcpkg/commands.version.cpp index 5744ea9ef..c6cc82d1f 100644 --- a/toolsrc/src/commands_version.cpp +++ b/toolsrc/src/vcpkg/commands.version.cpp @@ -1,8 +1,8 @@ #include "pch.h" -#include "metrics.h" -#include "vcpkg_Commands.h" -#include "vcpkg_System.h" +#include <vcpkg/base/system.h> +#include <vcpkg/commands.h> +#include <vcpkg/metrics.h> #define STRINGIFY(...) #__VA_ARGS__ #define MACRO_TO_STRING(X) STRINGIFY(X) diff --git a/toolsrc/src/vcpkg_Dependencies.cpp b/toolsrc/src/vcpkg/dependencies.cpp index 8dd60a2eb..da8f1e178 100644 --- a/toolsrc/src/vcpkg_Dependencies.cpp +++ b/toolsrc/src/vcpkg/dependencies.cpp @@ -1,15 +1,15 @@ #include "pch.h" -#include "PackageSpec.h" -#include "Paragraphs.h" -#include "StatusParagraphs.h" -#include "VcpkgPaths.h" -#include "vcpkg_Dependencies.h" -#include "vcpkg_Files.h" -#include "vcpkg_Graphs.h" -#include "vcpkg_Strings.h" -#include "vcpkg_Util.h" -#include "vcpkglib.h" +#include <vcpkg/base/files.h> +#include <vcpkg/base/graphs.h> +#include <vcpkg/base/strings.h> +#include <vcpkg/base/util.h> +#include <vcpkg/dependencies.h> +#include <vcpkg/packagespec.h> +#include <vcpkg/paragraphs.h> +#include <vcpkg/statusparagraphs.h> +#include <vcpkg/vcpkglib.h> +#include <vcpkg/vcpkgpaths.h> namespace vcpkg::Dependencies { diff --git a/toolsrc/src/commands_export.cpp b/toolsrc/src/vcpkg/export.cpp index b416a6f3c..de6464c87 100644 --- a/toolsrc/src/commands_export.cpp +++ b/toolsrc/src/vcpkg/export.cpp @@ -1,15 +1,19 @@ #include "pch.h" -#include "Paragraphs.h" -#include "vcpkg_Commands.h" -#include "vcpkg_Dependencies.h" -#include "vcpkg_Input.h" -#include "vcpkg_System.h" -#include "vcpkg_Util.h" -#include "vcpkglib.h" +#include <vcpkg/base/system.h> +#include <vcpkg/base/util.h> +#include <vcpkg/commands.h> +#include <vcpkg/dependencies.h> +#include <vcpkg/export.ifw.h> +#include <vcpkg/help.h> +#include <vcpkg/input.h> +#include <vcpkg/install.h> +#include <vcpkg/paragraphs.h> +#include <vcpkg/vcpkglib.h> + #include <regex> -namespace vcpkg::Commands::Export +namespace vcpkg::Export { using Dependencies::ExportPlanAction; using Dependencies::ExportPlanType; @@ -210,103 +214,167 @@ namespace vcpkg::Commands::Export return nullopt; } - void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths, const Triplet& default_triplet) + void export_integration_files(const fs::path& raw_exported_dir_path, const VcpkgPaths& paths) + { + const std::vector<fs::path> integration_files_relative_to_root = { + {".vcpkg-root"}, + {fs::path{"scripts"} / "buildsystems" / "msbuild" / "applocal.ps1"}, + {fs::path{"scripts"} / "buildsystems" / "msbuild" / "vcpkg.targets"}, + {fs::path{"scripts"} / "buildsystems" / "vcpkg.cmake"}, + {fs::path{"scripts"} / "cmake" / "vcpkg_get_windows_sdk.cmake"}, + {fs::path{"scripts"} / "getWindowsSDK.ps1"}, + {fs::path{"scripts"} / "getProgramFilesPlatformBitness.ps1"}, + {fs::path{"scripts"} / "getProgramFiles32bit.ps1"}, + }; + + for (const fs::path& file : integration_files_relative_to_root) + { + const fs::path source = paths.root / file; + fs::path destination = raw_exported_dir_path / file; + Files::Filesystem& fs = paths.get_filesystem(); + std::error_code ec; + fs.create_directories(destination.parent_path(), ec); + Checks::check_exit(VCPKG_LINE_INFO, !ec); + fs.copy_file(source, destination, fs::copy_options::overwrite_existing, ec); + Checks::check_exit(VCPKG_LINE_INFO, !ec); + } + } + + struct ExportArguments { + bool dry_run; + bool raw; + bool nuget; + bool ifw; + bool zip; + bool seven_zip; + + Optional<std::string> maybe_nuget_id; + Optional<std::string> maybe_nuget_version; + + IFW::Options ifw_options; + std::vector<PackageSpec> specs; + }; + + static ExportArguments handle_export_command_arguments(const VcpkgCmdArguments& args, + const Triplet& default_triplet) + { + ExportArguments ret; + static const std::string OPTION_DRY_RUN = "--dry-run"; static const std::string OPTION_RAW = "--raw"; static const std::string OPTION_NUGET = "--nuget"; + static const std::string OPTION_IFW = "--ifw"; static const std::string OPTION_ZIP = "--zip"; static const std::string OPTION_SEVEN_ZIP = "--7zip"; static const std::string OPTION_NUGET_ID = "--nuget-id"; static const std::string OPTION_NUGET_VERSION = "--nuget-version"; + static const std::string OPTION_IFW_REPOSITORY_URL = "--ifw-repository-url"; + static const std::string OPTION_IFW_PACKAGES_DIR_PATH = "--ifw-packages-directory-path"; + static const std::string OPTION_IFW_REPOSITORY_DIR_PATH = "--ifw-repository-directory-path"; + static const std::string OPTION_IFW_CONFIG_FILE_PATH = "--ifw-configuration-file-path"; + static const std::string OPTION_IFW_INSTALLER_FILE_PATH = "--ifw-installer-file-path"; // input sanitization - static const std::string EXAMPLE = - Commands::Help::create_example_string("export zlib zlib:x64-windows boost --nuget"); + static const std::string EXAMPLE = Help::create_example_string("export zlib zlib:x64-windows boost --nuget"); args.check_min_arg_count(1, EXAMPLE); - const std::vector<PackageSpec> specs = Util::fmap(args.command_arguments, [&](auto&& arg) { + ret.specs = Util::fmap(args.command_arguments, [&](auto&& arg) { return Input::check_and_get_package_spec(arg, default_triplet, EXAMPLE); }); - for (auto&& spec : specs) - Input::check_triplet(spec.triplet(), paths); const auto options = args.check_and_get_optional_command_arguments( { OPTION_DRY_RUN, OPTION_RAW, OPTION_NUGET, + OPTION_IFW, OPTION_ZIP, OPTION_SEVEN_ZIP, }, { OPTION_NUGET_ID, OPTION_NUGET_VERSION, + OPTION_IFW_REPOSITORY_URL, + OPTION_IFW_PACKAGES_DIR_PATH, + OPTION_IFW_REPOSITORY_DIR_PATH, + OPTION_IFW_CONFIG_FILE_PATH, + OPTION_IFW_INSTALLER_FILE_PATH, }); - const bool dry_run = options.switches.find(OPTION_DRY_RUN) != options.switches.cend(); - const bool raw = options.switches.find(OPTION_RAW) != options.switches.cend(); - const bool nuget = options.switches.find(OPTION_NUGET) != options.switches.cend(); - const bool zip = options.switches.find(OPTION_ZIP) != options.switches.cend(); - const bool seven_zip = options.switches.find(OPTION_SEVEN_ZIP) != options.switches.cend(); - - if (!raw && !nuget && !zip && !seven_zip && !dry_run) + ret.dry_run = options.switches.find(OPTION_DRY_RUN) != options.switches.cend(); + ret.raw = options.switches.find(OPTION_RAW) != options.switches.cend(); + ret.nuget = options.switches.find(OPTION_NUGET) != options.switches.cend(); + ret.ifw = options.switches.find(OPTION_IFW) != options.switches.cend(); + ret.zip = options.switches.find(OPTION_ZIP) != options.switches.cend(); + ret.seven_zip = options.switches.find(OPTION_SEVEN_ZIP) != options.switches.cend(); + + if (!ret.raw && !ret.nuget && !ret.ifw && !ret.zip && !ret.seven_zip && !ret.dry_run) { - System::println(System::Color::error, "Must provide at least one export type: --raw --nuget --zip --7zip"); + System::println(System::Color::error, + "Must provide at least one export type: --raw --nuget --ifw --zip --7zip"); System::print(EXAMPLE); Checks::exit_fail(VCPKG_LINE_INFO); } - auto maybe_nuget_id = maybe_lookup(options.settings, OPTION_NUGET_ID); - auto maybe_nuget_version = maybe_lookup(options.settings, OPTION_NUGET_VERSION); - - Checks::check_exit(VCPKG_LINE_INFO, !maybe_nuget_id || nuget, "--nuget-id is only valid with --nuget"); - Checks::check_exit( - VCPKG_LINE_INFO, !maybe_nuget_version || nuget, "--nuget-version is only valid with --nuget"); - - // create the plan - const StatusParagraphs status_db = database_load_check(paths); - std::vector<ExportPlanAction> export_plan = Dependencies::create_export_plan(paths, specs, status_db); - Checks::check_exit(VCPKG_LINE_INFO, !export_plan.empty(), "Export plan cannot be empty"); - - std::map<ExportPlanType, std::vector<const ExportPlanAction*>> group_by_plan_type; - Util::group_by(export_plan, &group_by_plan_type, [](const ExportPlanAction& p) { return p.plan_type; }); - print_plan(group_by_plan_type); - - const bool has_non_user_requested_packages = - Util::find_if(export_plan, [](const ExportPlanAction& package) -> bool { - return package.request_type != RequestType::USER_REQUESTED; - }) != export_plan.cend(); - - if (has_non_user_requested_packages) - { - System::println(System::Color::warning, - "Additional packages (*) need to be exported to complete this operation."); - } - - const auto it = group_by_plan_type.find(ExportPlanType::PORT_AVAILABLE_BUT_NOT_BUILT); - if (it != group_by_plan_type.cend() && !it->second.empty()) - { - System::println(System::Color::error, "There are packages that have not been built."); - - // No need to show all of them, just the user-requested ones. Dependency resolution will handle the rest. - std::vector<const ExportPlanAction*> unbuilt = it->second; - Util::erase_remove_if( - unbuilt, [](const ExportPlanAction* a) { return a->request_type != RequestType::USER_REQUESTED; }); - - const auto s = Strings::join(" ", unbuilt, [](const ExportPlanAction* a) { return a->spec.to_string(); }); - System::println("To build them, run:\n" - " vcpkg install %s", - s); - Checks::exit_fail(VCPKG_LINE_INFO); - } - - if (dry_run) + struct OptionPair { - Checks::exit_success(VCPKG_LINE_INFO); - } + const std::string& name; + Optional<std::string>& out_opt; + }; + const auto options_implies = + [&](const std::string& main_opt_name, bool main_opt, Span<const OptionPair> implying_opts) { + if (main_opt) + { + for (auto&& opt : implying_opts) + opt.out_opt = maybe_lookup(options.settings, opt.name); + } + else + { + for (auto&& opt : implying_opts) + Checks::check_exit(VCPKG_LINE_INFO, + !maybe_lookup(options.settings, opt.name), + "%s is only valid with %s", + opt.name, + main_opt_name); + } + }; + + options_implies(OPTION_NUGET, + ret.nuget, + { + {OPTION_NUGET_ID, ret.maybe_nuget_id}, + {OPTION_NUGET_VERSION, ret.maybe_nuget_version}, + }); + + options_implies(OPTION_IFW, + ret.ifw, + { + {OPTION_IFW_REPOSITORY_URL, ret.ifw_options.maybe_repository_url}, + {OPTION_IFW_PACKAGES_DIR_PATH, ret.ifw_options.maybe_packages_dir_path}, + {OPTION_IFW_REPOSITORY_DIR_PATH, ret.ifw_options.maybe_repository_dir_path}, + {OPTION_IFW_CONFIG_FILE_PATH, ret.ifw_options.maybe_config_file_path}, + {OPTION_IFW_INSTALLER_FILE_PATH, ret.ifw_options.maybe_installer_file_path}, + }); + return ret; + } - const std::string export_id = create_export_id(); + static void print_next_step_info(const fs::path& prefix) + { + const fs::path cmake_toolchain = prefix / "scripts" / "buildsystems" / "vcpkg.cmake"; + const CMakeVariable cmake_variable = CMakeVariable(L"CMAKE_TOOLCHAIN_FILE", cmake_toolchain.generic_string()); + System::println("\n" + "To use the exported libraries in CMake projects use:" + "\n" + " %s" + "\n", + Strings::to_utf8(cmake_variable.s)); + }; + static void handle_raw_based_export(Span<const ExportPlanAction> export_plan, + const ExportArguments& opts, + const std::string& export_id, + const VcpkgPaths& paths) + { Files::Filesystem& fs = paths.get_filesystem(); const fs::path export_to_path = paths.root; const fs::path raw_exported_dir_path = export_to_path / export_id; @@ -327,6 +395,7 @@ namespace vcpkg::Commands::Export const BinaryParagraph& binary_paragraph = action.any_paragraph.binary_control_file.value_or_exit(VCPKG_LINE_INFO).core_paragraph; + const InstallDir dirs = InstallDir::from_destination_root( raw_exported_dir_path / "installed", action.spec.triplet().to_string(), @@ -337,52 +406,21 @@ namespace vcpkg::Commands::Export } // Copy files needed for integration - const std::vector<fs::path> integration_files_relative_to_root = { - {".vcpkg-root"}, - {fs::path{"scripts"} / "buildsystems" / "msbuild" / "applocal.ps1"}, - {fs::path{"scripts"} / "buildsystems" / "msbuild" / "vcpkg.targets"}, - {fs::path{"scripts"} / "buildsystems" / "vcpkg.cmake"}, - {fs::path{"scripts"} / "cmake" / "vcpkg_get_windows_sdk.cmake"}, - {fs::path{"scripts"} / "getWindowsSDK.ps1"}, - {fs::path{"scripts"} / "getProgramFilesPlatformBitness.ps1"}, - {fs::path{"scripts"} / "getProgramFiles32bit.ps1"}, - }; - - for (const fs::path& file : integration_files_relative_to_root) - { - const fs::path source = paths.root / file; - const fs::path destination = raw_exported_dir_path / file; - fs.create_directories(destination.parent_path(), ec); - Checks::check_exit(VCPKG_LINE_INFO, !ec); - fs.copy_file(source, destination, fs::copy_options::overwrite_existing, ec); - Checks::check_exit(VCPKG_LINE_INFO, !ec); - } + export_integration_files(raw_exported_dir_path, paths); - const auto print_next_step_info = [](const fs::path& prefix) { - const fs::path cmake_toolchain = prefix / "scripts" / "buildsystems" / "vcpkg.cmake"; - const CMakeVariable cmake_variable = - CMakeVariable(L"CMAKE_TOOLCHAIN_FILE", cmake_toolchain.generic_string()); - System::println("\n" - "To use the exported libraries in CMake projects use:" - "\n" - " %s" - "\n", - Strings::to_utf8(cmake_variable.s)); - }; - - if (raw) + if (opts.raw) { System::println( System::Color::success, R"(Files exported at: "%s")", raw_exported_dir_path.generic_string()); print_next_step_info(export_to_path); } - if (nuget) + if (opts.nuget) { System::println("Creating nuget package... "); - const std::string nuget_id = maybe_nuget_id.value_or(raw_exported_dir_path.filename().string()); - const std::string nuget_version = maybe_nuget_version.value_or("1.0.0"); + const std::string nuget_id = opts.maybe_nuget_id.value_or(raw_exported_dir_path.filename().string()); + const std::string nuget_version = opts.maybe_nuget_version.value_or("1.0.0"); const fs::path output_path = do_nuget_export(paths, nuget_id, nuget_version, raw_exported_dir_path, export_to_path); System::println(System::Color::success, "Creating nuget package... done"); @@ -397,7 +435,7 @@ With a project open, go to Tools->NuGet Package Manager->Package Manager Console output_path.parent_path().u8string()); } - if (zip) + if (opts.zip) { System::println("Creating zip archive... "); const fs::path output_path = @@ -407,7 +445,7 @@ With a project open, go to Tools->NuGet Package Manager->Package Manager Console print_next_step_info("[...]"); } - if (seven_zip) + if (opts.seven_zip) { System::println("Creating 7zip archive... "); const fs::path output_path = @@ -417,10 +455,73 @@ With a project open, go to Tools->NuGet Package Manager->Package Manager Console print_next_step_info("[...]"); } - if (!raw) + if (!opts.raw) { fs.remove_all(raw_exported_dir_path, ec); } + } + + void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths, const Triplet& default_triplet) + { + const auto opts = handle_export_command_arguments(args, default_triplet); + for (auto&& spec : opts.specs) + Input::check_triplet(spec.triplet(), paths); + + // create the plan + const StatusParagraphs status_db = database_load_check(paths); + std::vector<ExportPlanAction> export_plan = Dependencies::create_export_plan(paths, opts.specs, status_db); + Checks::check_exit(VCPKG_LINE_INFO, !export_plan.empty(), "Export plan cannot be empty"); + + std::map<ExportPlanType, std::vector<const ExportPlanAction*>> group_by_plan_type; + Util::group_by(export_plan, &group_by_plan_type, [](const ExportPlanAction& p) { return p.plan_type; }); + print_plan(group_by_plan_type); + + const bool has_non_user_requested_packages = + Util::find_if(export_plan, [](const ExportPlanAction& package) -> bool { + return package.request_type != RequestType::USER_REQUESTED; + }) != export_plan.cend(); + + if (has_non_user_requested_packages) + { + System::println(System::Color::warning, + "Additional packages (*) need to be exported to complete this operation."); + } + + const auto it = group_by_plan_type.find(ExportPlanType::PORT_AVAILABLE_BUT_NOT_BUILT); + if (it != group_by_plan_type.cend() && !it->second.empty()) + { + System::println(System::Color::error, "There are packages that have not been built."); + + // No need to show all of them, just the user-requested ones. Dependency resolution will handle the rest. + std::vector<const ExportPlanAction*> unbuilt = it->second; + Util::erase_remove_if( + unbuilt, [](const ExportPlanAction* a) { return a->request_type != RequestType::USER_REQUESTED; }); + + const auto s = Strings::join(" ", unbuilt, [](const ExportPlanAction* a) { return a->spec.to_string(); }); + System::println("To build them, run:\n" + " vcpkg install %s", + s); + Checks::exit_fail(VCPKG_LINE_INFO); + } + + if (opts.dry_run) + { + Checks::exit_success(VCPKG_LINE_INFO); + } + + std::string export_id = create_export_id(); + + if (opts.raw || opts.nuget || opts.zip || opts.seven_zip) + { + handle_raw_based_export(export_plan, opts, export_id, paths); + } + + if (opts.ifw) + { + IFW::do_export(export_plan, export_id, opts.ifw_options, paths); + + print_next_step_info("@RootDir@/src/vcpkg"); + } Checks::exit_success(VCPKG_LINE_INFO); } diff --git a/toolsrc/src/vcpkg_GlobalState.cpp b/toolsrc/src/vcpkg/globalstate.cpp index 2221222c0..de564d357 100644 --- a/toolsrc/src/vcpkg_GlobalState.cpp +++ b/toolsrc/src/vcpkg/globalstate.cpp @@ -1,10 +1,10 @@ #include "pch.h" -#include "vcpkg_GlobalState.h" +#include <vcpkg/globalstate.h> namespace vcpkg { - Util::LockGuarded<ElapsedTime> GlobalState::timer; + Util::LockGuarded<Chrono::ElapsedTime> GlobalState::timer; std::atomic<bool> GlobalState::debugging = false; std::atomic<bool> GlobalState::feature_packages = false; diff --git a/toolsrc/src/commands_help.cpp b/toolsrc/src/vcpkg/help.cpp index a12f9003d..7867f71d2 100644 --- a/toolsrc/src/commands_help.cpp +++ b/toolsrc/src/vcpkg/help.cpp @@ -1,9 +1,9 @@ #include "pch.h" -#include "vcpkg_Commands.h" -#include "vcpkg_System.h" +#include <vcpkg/base/system.h> +#include <vcpkg/commands.h> -namespace vcpkg::Commands::Help +namespace vcpkg::Help { void help_topics() { @@ -75,7 +75,7 @@ namespace vcpkg::Commands::Help " (default: %%VCPKG_ROOT%%)\n" "\n" "For more help (including examples) see the accompanying README.md.", - Integrate::INTEGRATE_COMMAND_HELPSTRING); + Commands::Integrate::INTEGRATE_COMMAND_HELPSTRING); } std::string create_example_string(const std::string& command_and_arguments) @@ -114,7 +114,7 @@ namespace vcpkg::Commands::Help { System::print("Commands:\n" "%s", - Integrate::INTEGRATE_COMMAND_HELPSTRING); + Commands::Integrate::INTEGRATE_COMMAND_HELPSTRING); } else if (topic == "topics") { diff --git a/toolsrc/src/vcpkg_Input.cpp b/toolsrc/src/vcpkg/input.cpp index f1cac9632..aee0fac7f 100644 --- a/toolsrc/src/vcpkg_Input.cpp +++ b/toolsrc/src/vcpkg/input.cpp @@ -1,9 +1,10 @@ #include "pch.h" -#include "metrics.h" -#include "vcpkg_Commands.h" -#include "vcpkg_Input.h" -#include "vcpkg_System.h" +#include <vcpkg/base/system.h> +#include <vcpkg/commands.h> +#include <vcpkg/help.h> +#include <vcpkg/input.h> +#include <vcpkg/metrics.h> namespace vcpkg::Input { @@ -30,7 +31,7 @@ namespace vcpkg::Input { System::println(System::Color::error, "Error: invalid triplet: %s", t); Metrics::g_metrics.lock()->track_property("error", "invalid triplet: " + t.to_string()); - Commands::Help::help_topic_valid_triplet(paths); + Help::help_topic_valid_triplet(paths); Checks::exit_fail(VCPKG_LINE_INFO); } } diff --git a/toolsrc/src/commands_install.cpp b/toolsrc/src/vcpkg/install.cpp index d815332fe..26f729a57 100644 --- a/toolsrc/src/commands_install.cpp +++ b/toolsrc/src/vcpkg/install.cpp @@ -1,18 +1,21 @@ #include "pch.h" -#include "Paragraphs.h" -#include "metrics.h" -#include "vcpkg_Build.h" -#include "vcpkg_Commands.h" -#include "vcpkg_Dependencies.h" -#include "vcpkg_Files.h" -#include "vcpkg_GlobalState.h" -#include "vcpkg_Input.h" -#include "vcpkg_System.h" -#include "vcpkg_Util.h" -#include "vcpkglib.h" - -namespace vcpkg::Commands::Install +#include <vcpkg/base/files.h> +#include <vcpkg/base/system.h> +#include <vcpkg/base/util.h> +#include <vcpkg/build.h> +#include <vcpkg/commands.h> +#include <vcpkg/dependencies.h> +#include <vcpkg/globalstate.h> +#include <vcpkg/help.h> +#include <vcpkg/input.h> +#include <vcpkg/install.h> +#include <vcpkg/metrics.h> +#include <vcpkg/paragraphs.h> +#include <vcpkg/remove.h> +#include <vcpkg/vcpkglib.h> + +namespace vcpkg::Install { using namespace Dependencies; @@ -68,8 +71,8 @@ namespace vcpkg::Commands::Install const std::string filename = file.filename().generic_string(); if (fs::is_regular_file(status) && - (Strings::case_insensitive_ascii_compare(filename.c_str(), "CONTROL") == 0 || - Strings::case_insensitive_ascii_compare(filename.c_str(), "BUILD_INFO") == 0)) + (Strings::case_insensitive_ascii_compare(filename.c_str(), "CONTROL") || + Strings::case_insensitive_ascii_compare(filename.c_str(), "BUILD_INFO"))) { // Do not copy the control file continue; @@ -442,22 +445,22 @@ namespace vcpkg::Commands::Install } } - void perform_and_exit(const std::vector<AnyAction>& action_plan, - const Build::BuildPackageOptions& install_plan_options, - const KeepGoing keep_going, - const PrintSummary print_summary, - const VcpkgPaths& paths, - StatusParagraphs& status_db) + void perform_and_exit_ex(const std::vector<AnyAction>& action_plan, + const Build::BuildPackageOptions& install_plan_options, + const KeepGoing keep_going, + const PrintSummary print_summary, + const VcpkgPaths& paths, + StatusParagraphs& status_db) { std::vector<BuildResult> results; std::vector<std::string> timing; - const ElapsedTime timer = ElapsedTime::create_started(); + const auto timer = Chrono::ElapsedTime::create_started(); size_t counter = 0; const size_t package_count = action_plan.size(); for (const auto& action : action_plan) { - const ElapsedTime build_timer = ElapsedTime::create_started(); + const auto build_timer = Chrono::ElapsedTime::create_started(); counter++; const std::string display_name = action.spec().to_string(); @@ -522,17 +525,42 @@ namespace vcpkg::Commands::Install Checks::exit_success(VCPKG_LINE_INFO); } - void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths, const Triplet& default_triplet) + static const std::string OPTION_DRY_RUN = "--dry-run"; + static const std::string OPTION_USE_HEAD_VERSION = "--head"; + static const std::string OPTION_NO_DOWNLOADS = "--no-downloads"; + static const std::string OPTION_RECURSE = "--recurse"; + static const std::string OPTION_KEEP_GOING = "--keep-going"; + + static const std::array<std::string, 5> INSTALL_SWITCHES = { + OPTION_DRY_RUN, + OPTION_USE_HEAD_VERSION, + OPTION_NO_DOWNLOADS, + OPTION_RECURSE, + OPTION_KEEP_GOING, + }; + static const std::array<std::string, 0> INSTALL_SETTINGS; + + static std::vector<std::string> valid_arguments(const VcpkgPaths& paths) { - static const std::string OPTION_DRY_RUN = "--dry-run"; - static const std::string OPTION_USE_HEAD_VERSION = "--head"; - static const std::string OPTION_NO_DOWNLOADS = "--no-downloads"; - static const std::string OPTION_RECURSE = "--recurse"; - static const std::string OPTION_KEEP_GOING = "--keep-going"; + auto sources_and_errors = Paragraphs::try_load_all_ports(paths.get_filesystem(), paths.ports); + + return Util::fmap(sources_and_errors.paragraphs, + [](auto&& pgh) -> std::string { return pgh->core_paragraph->name; }); + } + const CommandStructure COMMAND_STRUCTURE = { + "install zlib zlib:x64-windows curl boost", + 1, + SIZE_MAX, + INSTALL_SWITCHES, + INSTALL_SETTINGS, + &valid_arguments, + }; + + void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths, const Triplet& default_triplet) + { // input sanitization - static const std::string EXAMPLE = - Commands::Help::create_example_string("install zlib zlib:x64-windows curl boost"); + static const std::string EXAMPLE = Help::create_example_string("install zlib zlib:x64-windows curl boost"); args.check_min_arg_count(1, EXAMPLE); const std::vector<FullPackageSpec> specs = Util::fmap(args.command_arguments, [&](auto&& arg) { @@ -556,6 +584,7 @@ namespace vcpkg::Commands::Install const bool no_downloads = options.find(OPTION_NO_DOWNLOADS) != options.cend(); const bool is_recursive = options.find(OPTION_RECURSE) != options.cend(); const KeepGoing keep_going = to_keep_going(options.find(OPTION_KEEP_GOING) != options.cend()); + const PrintSummary print_summary = to_print_summary(keep_going == KeepGoing::YES); // create the plan StatusParagraphs status_db = database_load_check(paths); @@ -606,7 +635,7 @@ namespace vcpkg::Commands::Install Checks::exit_success(VCPKG_LINE_INFO); } - perform_and_exit(action_plan, install_plan_options, keep_going, PrintSummary::NO, paths, status_db); + perform_and_exit_ex(action_plan, install_plan_options, keep_going, print_summary, paths, status_db); Checks::exit_success(VCPKG_LINE_INFO); } diff --git a/toolsrc/src/metrics.cpp b/toolsrc/src/vcpkg/metrics.cpp index 8a0050bfc..84c1ee208 100644 --- a/toolsrc/src/metrics.cpp +++ b/toolsrc/src/vcpkg/metrics.cpp @@ -1,10 +1,13 @@ #include "pch.h" -#include "filesystem_fs.h" -#include "metrics.h" -#include "vcpkg_Files.h" -#include "vcpkg_Strings.h" -#include "vcpkg_System.h" +#include <vcpkg/metrics.h> + +#include <vcpkg/base/files.h> +#include <vcpkg/base/strings.h> +#include <vcpkg/base/system.h> + +#pragma comment(lib, "version") +#pragma comment(lib, "winhttp") namespace vcpkg::Metrics { diff --git a/toolsrc/src/PackageSpec.cpp b/toolsrc/src/vcpkg/packagespec.cpp index 890de8899..01a09618d 100644 --- a/toolsrc/src/PackageSpec.cpp +++ b/toolsrc/src/vcpkg/packagespec.cpp @@ -1,8 +1,8 @@ #include "pch.h" -#include "PackageSpec.h" -#include "vcpkg_Parse.h" -#include "vcpkg_Util.h" +#include <vcpkg/base/util.h> +#include <vcpkg/packagespec.h> +#include <vcpkg/parse.h> using vcpkg::Parse::parse_comma_list; diff --git a/toolsrc/src/PackageSpecParseResult.cpp b/toolsrc/src/vcpkg/packagespecparseresult.cpp index 838c788ba..b12bd12d0 100644 --- a/toolsrc/src/PackageSpecParseResult.cpp +++ b/toolsrc/src/vcpkg/packagespecparseresult.cpp @@ -1,7 +1,8 @@ #include "pch.h" -#include "PackageSpecParseResult.h" -#include "vcpkg_Checks.h" +#include <vcpkg/packagespecparseresult.h> + +#include <vcpkg/base/checks.h> namespace vcpkg { diff --git a/toolsrc/src/ParagraphParseResult.cpp b/toolsrc/src/vcpkg/paragraphparseresult.cpp index 5c8c1d59d..920a4b16b 100644 --- a/toolsrc/src/ParagraphParseResult.cpp +++ b/toolsrc/src/vcpkg/paragraphparseresult.cpp @@ -1,7 +1,7 @@ #include "pch.h" -#include "ParagraphParseResult.h" -#include "vcpkg_Checks.h" +#include <vcpkg/base/checks.h> +#include <vcpkg/paragraphparseresult.h> namespace vcpkg { diff --git a/toolsrc/src/Paragraphs.cpp b/toolsrc/src/vcpkg/paragraphs.cpp index 6a6f191df..b93de190c 100644 --- a/toolsrc/src/Paragraphs.cpp +++ b/toolsrc/src/vcpkg/paragraphs.cpp @@ -1,10 +1,10 @@ #include "pch.h" -#include "ParagraphParseResult.h" -#include "Paragraphs.h" -#include "vcpkg_Files.h" -#include "vcpkg_GlobalState.h" -#include "vcpkg_Util.h" +#include <vcpkg/base/files.h> +#include <vcpkg/base/util.h> +#include <vcpkg/globalstate.h> +#include <vcpkg/paragraphparseresult.h> +#include <vcpkg/paragraphs.h> using namespace vcpkg::Parse; diff --git a/toolsrc/src/vcpkg_Parse.cpp b/toolsrc/src/vcpkg/parse.cpp index e671a1a05..116a7f5c8 100644 --- a/toolsrc/src/vcpkg_Parse.cpp +++ b/toolsrc/src/vcpkg/parse.cpp @@ -1,8 +1,9 @@ #include "pch.h" -#include "vcpkg_Checks.h" -#include "vcpkg_Maps.h" -#include "vcpkg_Parse.h" +#include <vcpkg/parse.h> + +#include <vcpkg/base/checks.h> +#include <vcpkg/base/util.h> namespace vcpkg::Parse { @@ -38,7 +39,7 @@ namespace vcpkg::Parse { auto err = std::make_unique<ParseControlErrorInfo>(); err->name = name; - err->extra_fields = Maps::extract_keys(fields); + err->extra_fields = Util::extract_keys(fields); err->missing_fields = std::move(missing_fields); return err; } diff --git a/toolsrc/src/PostBuildLint_BuildType.cpp b/toolsrc/src/vcpkg/postbuildlint.buildtype.cpp index 649f0ccca..2baaddb5e 100644 --- a/toolsrc/src/PostBuildLint_BuildType.cpp +++ b/toolsrc/src/vcpkg/postbuildlint.buildtype.cpp @@ -1,7 +1,7 @@ #include "pch.h" -#include "PostBuildLint_BuildType.h" -#include "vcpkg_Checks.h" +#include <vcpkg/base/checks.h> +#include <vcpkg/postbuildlint.buildtype.h> namespace vcpkg::PostBuildLint { diff --git a/toolsrc/src/PostBuildLint.cpp b/toolsrc/src/vcpkg/postbuildlint.cpp index 5de1078cd..b2422b4b2 100644 --- a/toolsrc/src/PostBuildLint.cpp +++ b/toolsrc/src/vcpkg/postbuildlint.cpp @@ -1,14 +1,14 @@ #include "pch.h" -#include "PackageSpec.h" -#include "PostBuildLint.h" -#include "PostBuildLint_BuildType.h" -#include "VcpkgPaths.h" -#include "coff_file_reader.h" -#include "vcpkg_Build.h" -#include "vcpkg_Files.h" -#include "vcpkg_System.h" -#include "vcpkg_Util.h" +#include <vcpkg/base/cofffilereader.h> +#include <vcpkg/base/files.h> +#include <vcpkg/base/system.h> +#include <vcpkg/base/util.h> +#include <vcpkg/build.h> +#include <vcpkg/packagespec.h> +#include <vcpkg/postbuildlint.buildtype.h> +#include <vcpkg/postbuildlint.h> +#include <vcpkg/vcpkgpaths.h> using vcpkg::Build::BuildInfo; using vcpkg::Build::BuildPolicy; @@ -38,7 +38,7 @@ namespace vcpkg::PostBuildLint } }; - Span<const OutdatedDynamicCrt> get_outdated_dynamic_crts(CStringView toolset) + Span<const OutdatedDynamicCrt> get_outdated_dynamic_crts(const Optional<std::string>& toolset_version) { static const std::vector<OutdatedDynamicCrt> V_NO_120 = { {"msvcp100.dll", R"(msvcp100\.dll)"}, @@ -66,10 +66,14 @@ namespace vcpkg::PostBuildLint return ret; }(); - if (toolset == "v120") - return V_NO_120; - else - return V_NO_MSVCRT; + const auto tsv = toolset_version.get(); + if (tsv && (*tsv) == "v120") + { + return V_NO_120; + } + + // Default case for all version >= VS 2015. + return V_NO_MSVCRT; } static LintStatus check_for_files_in_include_directory(const Files::Filesystem& fs, @@ -371,6 +375,7 @@ namespace vcpkg::PostBuildLint case MachineType::I386: return "x86"; case MachineType::ARM: case MachineType::ARMNT: return "arm"; + case MachineType::ARM64: return "arm64"; default: return "Machine Type Code = " + std::to_string(static_cast<uint16_t>(machine_type)); } } @@ -706,8 +711,8 @@ namespace vcpkg::PostBuildLint std::vector<fs::path> misplaced_files = fs.get_files_non_recursive(dir); Util::unstable_keep_if(misplaced_files, [&fs](const fs::path& path) { const std::string filename = path.filename().generic_string(); - if (Strings::case_insensitive_ascii_compare(filename.c_str(), "CONTROL") == 0 || - Strings::case_insensitive_ascii_compare(filename.c_str(), "BUILD_INFO") == 0) + if (Strings::case_insensitive_ascii_compare(filename.c_str(), "CONTROL") || + Strings::case_insensitive_ascii_compare(filename.c_str(), "BUILD_INFO")) return false; return !fs.is_directory(path); }); @@ -733,7 +738,7 @@ namespace vcpkg::PostBuildLint const auto& fs = paths.get_filesystem(); // for dumpbin - const Toolset& toolset = paths.get_toolset(pre_build_info.platform_toolset); + const Toolset& toolset = paths.get_toolset(pre_build_info.platform_toolset, pre_build_info.visual_studio_path); const fs::path package_dir = paths.package_dir(spec); size_t error_count = 0; diff --git a/toolsrc/src/commands_remove.cpp b/toolsrc/src/vcpkg/remove.cpp index a9f1b2564..04ddba1e4 100644 --- a/toolsrc/src/commands_remove.cpp +++ b/toolsrc/src/vcpkg/remove.cpp @@ -1,13 +1,16 @@ #include "pch.h" -#include "vcpkg_Commands.h" -#include "vcpkg_Dependencies.h" -#include "vcpkg_Input.h" -#include "vcpkg_System.h" -#include "vcpkg_Util.h" -#include "vcpkglib.h" - -namespace vcpkg::Commands::Remove +#include <vcpkg/base/system.h> +#include <vcpkg/base/util.h> +#include <vcpkg/commands.h> +#include <vcpkg/dependencies.h> +#include <vcpkg/help.h> +#include <vcpkg/input.h> +#include <vcpkg/remove.h> +#include <vcpkg/update.h> +#include <vcpkg/vcpkglib.h> + +namespace vcpkg::Remove { using Dependencies::RemovePlanAction; using Dependencies::RemovePlanType; @@ -160,15 +163,41 @@ namespace vcpkg::Commands::Remove } } + static const std::string OPTION_PURGE = "--purge"; + static const std::string OPTION_NO_PURGE = "--no-purge"; + static const std::string OPTION_RECURSE = "--recurse"; + static const std::string OPTION_DRY_RUN = "--dry-run"; + static const std::string OPTION_OUTDATED = "--outdated"; + + static const std::array<std::string, 5> REMOVE_SWITCHES = { + OPTION_PURGE, + OPTION_NO_PURGE, + OPTION_RECURSE, + OPTION_DRY_RUN, + OPTION_OUTDATED, + }; + static const std::array<std::string, 0> REMOVE_SETTINGS; + + static std::vector<std::string> valid_arguments(const VcpkgPaths& paths) + { + const StatusParagraphs status_db = database_load_check(paths); + const std::vector<StatusParagraph*> installed_packages = get_installed_ports(status_db); + + return Util::fmap(installed_packages, [](auto&& pgh) -> std::string { return pgh->package.spec.to_string(); }); + } + + const CommandStructure COMMAND_STRUCTURE = { + "remove zlib zlib:x64-windows curl boost", + 1, + SIZE_MAX, + REMOVE_SWITCHES, + REMOVE_SETTINGS, + &valid_arguments, + }; + void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths, const Triplet& default_triplet) { - static const std::string OPTION_PURGE = "--purge"; - static const std::string OPTION_NO_PURGE = "--no-purge"; - static const std::string OPTION_RECURSE = "--recurse"; - static const std::string OPTION_DRY_RUN = "--dry-run"; - static const std::string OPTION_OUTDATED = "--outdated"; - static const std::string EXAMPLE = - Commands::Help::create_example_string("remove zlib zlib:x64-windows curl boost"); + static const std::string EXAMPLE = Help::create_example_string("remove zlib zlib:x64-windows curl boost"); const std::unordered_set<std::string> options = args.check_and_get_optional_command_arguments( {OPTION_PURGE, OPTION_NO_PURGE, OPTION_RECURSE, OPTION_DRY_RUN, OPTION_OUTDATED}); diff --git a/toolsrc/src/SourceParagraph.cpp b/toolsrc/src/vcpkg/sourceparagraph.cpp index 0f1a38d19..d766dcb72 100644 --- a/toolsrc/src/SourceParagraph.cpp +++ b/toolsrc/src/vcpkg/sourceparagraph.cpp @@ -1,19 +1,19 @@ #include "pch.h" -#include "PackageSpec.h" -#include "SourceParagraph.h" -#include "Triplet.h" -#include "vcpkg_Checks.h" -#include "vcpkg_Maps.h" -#include "vcpkg_System.h" -#include "vcpkg_Util.h" -#include "vcpkg_expected.h" +#include <vcpkg/packagespec.h> +#include <vcpkg/sourceparagraph.h> +#include <vcpkg/triplet.h> + +#include <vcpkg/base/checks.h> +#include <vcpkg/base/expected.h> +#include <vcpkg/base/system.h> +#include <vcpkg/base/util.h> namespace vcpkg { using namespace vcpkg::Parse; - namespace Fields + namespace SourceParagraphFields { static const std::string BUILD_DEPENDS = "Build-Depends"; static const std::string DEFAULTFEATURES = "Default-Features"; @@ -28,11 +28,11 @@ namespace vcpkg static Span<const std::string> get_list_of_valid_fields() { static const std::string valid_fields[] = { - Fields::SOURCE, - Fields::VERSION, - Fields::DESCRIPTION, - Fields::MAINTAINER, - Fields::BUILD_DEPENDS, + SourceParagraphFields::SOURCE, + SourceParagraphFields::VERSION, + SourceParagraphFields::DESCRIPTION, + SourceParagraphFields::MAINTAINER, + SourceParagraphFields::BUILD_DEPENDS, }; return valid_fields; @@ -92,14 +92,15 @@ namespace vcpkg auto spgh = std::make_unique<SourceParagraph>(); - parser.required_field(Fields::SOURCE, spgh->name); - parser.required_field(Fields::VERSION, spgh->version); + parser.required_field(SourceParagraphFields::SOURCE, spgh->name); + parser.required_field(SourceParagraphFields::VERSION, spgh->version); - spgh->description = parser.optional_field(Fields::DESCRIPTION); - spgh->maintainer = parser.optional_field(Fields::MAINTAINER); - spgh->depends = expand_qualified_dependencies(parse_comma_list(parser.optional_field(Fields::BUILD_DEPENDS))); - spgh->supports = parse_comma_list(parser.optional_field(Fields::SUPPORTS)); - spgh->default_features = parse_comma_list(parser.optional_field(Fields::DEFAULTFEATURES)); + spgh->description = parser.optional_field(SourceParagraphFields::DESCRIPTION); + spgh->maintainer = parser.optional_field(SourceParagraphFields::MAINTAINER); + spgh->depends = expand_qualified_dependencies( + parse_comma_list(parser.optional_field(SourceParagraphFields::BUILD_DEPENDS))); + spgh->supports = parse_comma_list(parser.optional_field(SourceParagraphFields::SUPPORTS)); + spgh->default_features = parse_comma_list(parser.optional_field(SourceParagraphFields::DEFAULTFEATURES)); auto err = parser.error_info(spgh->name); if (err) @@ -114,10 +115,11 @@ namespace vcpkg auto fpgh = std::make_unique<FeatureParagraph>(); - parser.required_field(Fields::FEATURE, fpgh->name); - parser.required_field(Fields::DESCRIPTION, fpgh->description); + parser.required_field(SourceParagraphFields::FEATURE, fpgh->name); + parser.required_field(SourceParagraphFields::DESCRIPTION, fpgh->description); - fpgh->depends = expand_qualified_dependencies(parse_comma_list(parser.optional_field(Fields::BUILD_DEPENDS))); + fpgh->depends = expand_qualified_dependencies( + parse_comma_list(parser.optional_field(SourceParagraphFields::BUILD_DEPENDS))); auto err = parser.error_info(fpgh->name); if (err) diff --git a/toolsrc/src/StatusParagraph.cpp b/toolsrc/src/vcpkg/statusparagraph.cpp index f8ae293c2..5f00825e1 100644 --- a/toolsrc/src/StatusParagraph.cpp +++ b/toolsrc/src/vcpkg/statusparagraph.cpp @@ -1,6 +1,6 @@ #include "pch.h" -#include "StatusParagraph.h" +#include <vcpkg/statusparagraph.h> using namespace vcpkg::Parse; diff --git a/toolsrc/src/StatusParagraphs.cpp b/toolsrc/src/vcpkg/statusparagraphs.cpp index aaba95eb9..647ed6d3f 100644 --- a/toolsrc/src/StatusParagraphs.cpp +++ b/toolsrc/src/vcpkg/statusparagraphs.cpp @@ -1,8 +1,7 @@ #include "pch.h" -#include "StatusParagraphs.h" -#include "vcpkg_Checks.h" -#include <algorithm> +#include <vcpkg/base/checks.h> +#include <vcpkg/statusparagraphs.h> namespace vcpkg { diff --git a/toolsrc/src/triplet.cpp b/toolsrc/src/vcpkg/triplet.cpp index 3b56da02a..8a84ee2b2 100644 --- a/toolsrc/src/triplet.cpp +++ b/toolsrc/src/vcpkg/triplet.cpp @@ -1,8 +1,8 @@ #include "pch.h" -#include "Triplet.h" -#include "vcpkg_Checks.h" -#include "vcpkg_Strings.h" +#include <vcpkg/base/checks.h> +#include <vcpkg/base/strings.h> +#include <vcpkg/triplet.h> namespace vcpkg { diff --git a/toolsrc/src/commands_update.cpp b/toolsrc/src/vcpkg/update.cpp index 71ea4b063..168949bc1 100644 --- a/toolsrc/src/commands_update.cpp +++ b/toolsrc/src/vcpkg/update.cpp @@ -1,11 +1,13 @@ #include "pch.h" -#include "Paragraphs.h" -#include "vcpkg_Commands.h" -#include "vcpkg_System.h" -#include "vcpkglib.h" +#include <vcpkg/base/system.h> +#include <vcpkg/commands.h> +#include <vcpkg/help.h> +#include <vcpkg/paragraphs.h> +#include <vcpkg/update.h> +#include <vcpkg/vcpkglib.h> -namespace vcpkg::Commands::Update +namespace vcpkg::Update { bool OutdatedPackage::compare_by_name(const OutdatedPackage& left, const OutdatedPackage& right) { diff --git a/toolsrc/src/VcpkgCmdArguments.cpp b/toolsrc/src/vcpkg/vcpkgcmdarguments.cpp index cb261930e..522961693 100644 --- a/toolsrc/src/VcpkgCmdArguments.cpp +++ b/toolsrc/src/vcpkg/vcpkgcmdarguments.cpp @@ -1,10 +1,11 @@ #include "pch.h" -#include "VcpkgCmdArguments.h" -#include "metrics.h" -#include "vcpkg_Commands.h" -#include "vcpkg_GlobalState.h" -#include "vcpkg_System.h" +#include <vcpkg/base/system.h> +#include <vcpkg/commands.h> +#include <vcpkg/globalstate.h> +#include <vcpkg/help.h> +#include <vcpkg/metrics.h> +#include <vcpkg/vcpkgcmdarguments.h> namespace vcpkg { @@ -17,7 +18,7 @@ namespace vcpkg { System::println(System::Color::error, "Error: expected value after %s", option_name); Metrics::g_metrics.lock()->track_property("error", "error option name"); - Commands::Help::print_usage(); + Help::print_usage(); Checks::exit_fail(VCPKG_LINE_INFO); } @@ -25,7 +26,7 @@ namespace vcpkg { System::println(System::Color::error, "Error: %s specified multiple times", option_name); Metrics::g_metrics.lock()->track_property("error", "error option specified multiple times"); - Commands::Help::print_usage(); + Help::print_usage(); Checks::exit_fail(VCPKG_LINE_INFO); } @@ -38,7 +39,7 @@ namespace vcpkg { System::println(System::Color::error, "Error: conflicting values specified for --%s", option_name); Metrics::g_metrics.lock()->track_property("error", "error conflicting switches"); - Commands::Help::print_usage(); + Help::print_usage(); Checks::exit_fail(VCPKG_LINE_INFO); } option_field = new_setting; diff --git a/toolsrc/src/vcpkglib.cpp b/toolsrc/src/vcpkg/vcpkglib.cpp index 5cdafdbc8..23c774210 100644 --- a/toolsrc/src/vcpkglib.cpp +++ b/toolsrc/src/vcpkg/vcpkglib.cpp @@ -1,11 +1,11 @@ #include "pch.h" -#include "Paragraphs.h" -#include "metrics.h" -#include "vcpkg_Files.h" -#include "vcpkg_Strings.h" -#include "vcpkg_Util.h" -#include "vcpkglib.h" +#include <vcpkg/base/files.h> +#include <vcpkg/base/strings.h> +#include <vcpkg/base/util.h> +#include <vcpkg/metrics.h> +#include <vcpkg/paragraphs.h> +#include <vcpkg/vcpkglib.h> namespace vcpkg { diff --git a/toolsrc/src/VcpkgPaths.cpp b/toolsrc/src/vcpkg/vcpkgpaths.cpp index e8eb4f01c..f0e02db8a 100644 --- a/toolsrc/src/VcpkgPaths.cpp +++ b/toolsrc/src/vcpkg/vcpkgpaths.cpp @@ -1,12 +1,12 @@ #include "pch.h" -#include "PackageSpec.h" -#include "VcpkgPaths.h" -#include "metrics.h" -#include "vcpkg_Files.h" -#include "vcpkg_System.h" -#include "vcpkg_Util.h" -#include "vcpkg_expected.h" +#include <vcpkg/base/expected.h> +#include <vcpkg/base/files.h> +#include <vcpkg/base/system.h> +#include <vcpkg/base/util.h> +#include <vcpkg/metrics.h> +#include <vcpkg/packagespec.h> +#include <vcpkg/vcpkgpaths.h> namespace vcpkg { @@ -130,10 +130,10 @@ namespace vcpkg fs::path get_nuget_path(const fs::path& downloads_folder, const fs::path& scripts_folder) { - static constexpr std::array<int, 3> EXPECTED_VERSION = {4, 1, 0}; + static constexpr std::array<int, 3> EXPECTED_VERSION = {4, 3, 0}; static const std::wstring VERSION_CHECK_ARGUMENTS = Strings::WEMPTY; - const fs::path downloaded_copy = downloads_folder / "nuget-4.1.0" / "nuget.exe"; + const fs::path downloaded_copy = downloads_folder / "nuget-4.3.0" / "nuget.exe"; const std::vector<fs::path> from_path = Files::find_from_PATH(L"nuget"); std::vector<fs::path> candidate_paths; @@ -173,6 +173,34 @@ namespace vcpkg return fetch_dependency(scripts_folder, L"git", downloaded_copy, EXPECTED_VERSION); } + static fs::path get_ifw_installerbase_path(const fs::path& downloads_folder, const fs::path& scripts_folder) + { + static constexpr std::array<int, 3> EXPECTED_VERSION = {3, 1, 81}; + static const std::wstring VERSION_CHECK_ARGUMENTS = L"--framework-version"; + + const fs::path downloaded_copy = + downloads_folder / "QtInstallerFramework-win-x86" / "bin" / "installerbase.exe"; + + std::vector<fs::path> candidate_paths; + candidate_paths.push_back(downloaded_copy); + // TODO: Uncomment later + // const std::vector<fs::path> from_path = Files::find_from_PATH(L"installerbase"); + // candidate_paths.insert(candidate_paths.end(), from_path.cbegin(), from_path.cend()); + // candidate_paths.push_back(fs::path(System::get_environment_variable(L"HOMEDRIVE").value_or("C:")) / "Qt" / + // "Tools" / "QtInstallerFramework" / "3.1" / "bin" / "installerbase.exe"); + // candidate_paths.push_back(fs::path(System::get_environment_variable(L"HOMEDRIVE").value_or("C:")) / "Qt" / + // "QtIFW-3.1.0" / "bin" / "installerbase.exe"); + + const Optional<fs::path> path = + find_if_has_equal_or_greater_version(candidate_paths, VERSION_CHECK_ARGUMENTS, EXPECTED_VERSION); + if (const auto p = path.get()) + { + return *p; + } + + return fetch_dependency(scripts_folder, L"installerbase", downloaded_copy, EXPECTED_VERSION); + } + Expected<VcpkgPaths> VcpkgPaths::create(const fs::path& vcpkg_root_dir) { std::error_code ec; @@ -256,89 +284,51 @@ namespace vcpkg return this->nuget_exe.get_lazy([this]() { return get_nuget_path(this->downloads, this->scripts); }); } - static std::vector<std::string> get_vs2017_installation_instances(const VcpkgPaths& paths) + const fs::path& VcpkgPaths::get_ifw_installerbase_exe() const { - const fs::path script = paths.scripts / "findVisualStudioInstallationInstances.ps1"; - const std::wstring cmd = System::create_powershell_script_cmd(script); - const System::ExitCodeAndOutput ec_data = System::cmd_execute_and_capture_output(cmd); - Checks::check_exit(VCPKG_LINE_INFO, ec_data.exit_code == 0, "Could not run script to detect VS 2017 instances"); - return Strings::split(ec_data.output, "\n"); + return this->ifw_installerbase_exe.get_lazy( + [this]() { return get_ifw_installerbase_path(this->downloads, this->scripts); }); } - static Optional<fs::path> get_vs2015_installation_instance() + const fs::path& VcpkgPaths::get_ifw_binarycreator_exe() const { - const Optional<std::wstring> vs2015_cmntools_optional = System::get_environment_variable(L"VS140COMNTOOLS"); - if (const auto v = vs2015_cmntools_optional.get()) - { - const fs::path vs2015_cmntools = fs::path(*v).parent_path(); // The call to parent_path() is needed because - // the env variable has a trailing backslash - return vs2015_cmntools.parent_path().parent_path(); - } - - return nullopt; + return this->ifw_binarycreator_exe.get_lazy( + [this]() { return get_ifw_installerbase_exe().parent_path() / "binarycreator.exe"; }); } - static std::vector<Toolset> find_v120_toolset_instances(const Files::Filesystem& fs) + const fs::path& VcpkgPaths::get_ifw_repogen_exe() const { - using CPU = System::CPUArchitecture; - - // Note: this will contain a mix of vcvarsall.bat locations and dumpbin.exe locations. - std::vector<fs::path> paths_examined; - - std::vector<Toolset> found_toolsets; - - // VS2013 - const Optional<std::wstring> vs2013_cmntools_optional = System::get_environment_variable(L"VS120COMNTOOLS"); - if (const auto vs120comntools = vs2013_cmntools_optional.get()) - { - const fs::path vs2013_cmntools = - fs::path(*vs120comntools).parent_path(); // The call to parent_path() is needed because - // the env variable has a trailing backslash - auto v = vs2013_cmntools.parent_path().parent_path(); + return this->ifw_repogen_exe.get_lazy( + [this]() { return get_ifw_installerbase_exe().parent_path() / "repogen.exe"; }); + } - const fs::path vs2013_vcvarsall_bat = v / "VC" / "vcvarsall.bat"; + struct VisualStudioInstance + { + fs::path root_path; + std::string version; + std::string release_type; + std::string preference_weight; // Mostly unused, just for verification that order is as intended - paths_examined.push_back(vs2013_vcvarsall_bat); - if (fs.exists(vs2013_vcvarsall_bat)) - { - const fs::path vs2013_dumpbin_exe = v / "VC" / "bin" / "dumpbin.exe"; - paths_examined.push_back(vs2013_dumpbin_exe); + std::string major_version() const { return version.substr(0, 2); } + }; - const fs::path vs2013_bin_dir = vs2013_vcvarsall_bat.parent_path() / "bin"; - std::vector<ToolsetArchOption> supported_architectures; - if (fs.exists(vs2013_bin_dir / "vcvars32.bat")) - supported_architectures.push_back({L"x86", CPU::X86, CPU::X86}); - if (fs.exists(vs2013_bin_dir / "amd64\\vcvars64.bat")) - supported_architectures.push_back({L"x64", CPU::X64, CPU::X64}); - if (fs.exists(vs2013_bin_dir / "x86_amd64\\vcvarsx86_amd64.bat")) - supported_architectures.push_back({L"x86_amd64", CPU::X86, CPU::X64}); - if (fs.exists(vs2013_bin_dir / "x86_arm\\vcvarsx86_arm.bat")) - supported_architectures.push_back({L"x86_arm", CPU::X86, CPU::ARM}); - if (fs.exists(vs2013_bin_dir / "amd64_x86\\vcvarsamd64_x86.bat")) - supported_architectures.push_back({L"amd64_x86", CPU::X64, CPU::X86}); - if (fs.exists(vs2013_bin_dir / "amd64_arm\\vcvarsamd64_arm.bat")) - supported_architectures.push_back({L"amd64_arm", CPU::X64, CPU::ARM}); - - if (fs.exists(vs2013_dumpbin_exe)) - { - found_toolsets.push_back( - {vs2013_dumpbin_exe, vs2013_vcvarsall_bat, {}, V_120, supported_architectures}); - } - } - } + static std::vector<VisualStudioInstance> get_visual_studio_instances(const VcpkgPaths& paths) + { + const fs::path script = paths.scripts / "findVisualStudioInstallationInstances.ps1"; + const std::wstring cmd = System::create_powershell_script_cmd(script); + const System::ExitCodeAndOutput ec_data = System::cmd_execute_and_capture_output(cmd); + Checks::check_exit( + VCPKG_LINE_INFO, ec_data.exit_code == 0, "Could not run script to detect Visual Studio instances"); - if (found_toolsets.empty()) + const std::vector<std::string> instances_as_strings = Strings::split(ec_data.output, "\n"); + std::vector<VisualStudioInstance> output; + for (const std::string& instance_as_string : instances_as_strings) { - System::println(System::Color::error, "Could not locate a complete toolset."); - System::println("The following paths were examined:"); - for (const fs::path& path : paths_examined) - { - System::println(" %s", path.u8string()); - } - Checks::exit_fail(VCPKG_LINE_INFO); + const std::vector<std::string> split = Strings::split(instance_as_string, "::"); + output.push_back({split.at(3), split.at(2), split.at(1), split.at(0)}); } - return found_toolsets; + return output; } static std::vector<Toolset> find_toolset_instances(const VcpkgPaths& paths) @@ -352,93 +342,117 @@ namespace vcpkg std::vector<Toolset> found_toolsets; - // VS2015 - const Optional<fs::path> vs_2015_installation_instance = get_vs2015_installation_instance(); - if (const auto v = vs_2015_installation_instance.get()) - { - const fs::path vs2015_vcvarsall_bat = *v / "VC" / "vcvarsall.bat"; + const std::vector<VisualStudioInstance> vs_instances = get_visual_studio_instances(paths); + const bool v140_is_available = Util::find_if(vs_instances, [&](const VisualStudioInstance& vs_instance) { + return vs_instance.major_version() == "14"; + }) != vs_instances.cend(); - paths_examined.push_back(vs2015_vcvarsall_bat); - if (fs.exists(vs2015_vcvarsall_bat)) + for (const VisualStudioInstance& vs_instance : vs_instances) + { + const std::string major_version = vs_instance.major_version(); + if (major_version == "15") { - const fs::path vs2015_dumpbin_exe = *v / "VC" / "bin" / "dumpbin.exe"; - paths_examined.push_back(vs2015_dumpbin_exe); + const fs::path vc_dir = vs_instance.root_path / "VC"; + + // Skip any instances that do not have vcvarsall. + const fs::path vcvarsall_dir = vc_dir / "Auxiliary" / "Build"; + const fs::path vcvarsall_bat = vcvarsall_dir / "vcvarsall.bat"; + paths_examined.push_back(vcvarsall_bat); + if (!fs.exists(vcvarsall_bat)) continue; - const fs::path vs2015_bin_dir = vs2015_vcvarsall_bat.parent_path() / "bin"; + // Get all supported architectures std::vector<ToolsetArchOption> supported_architectures; - if (fs.exists(vs2015_bin_dir / "vcvars32.bat")) + if (fs.exists(vcvarsall_dir / "vcvars32.bat")) supported_architectures.push_back({L"x86", CPU::X86, CPU::X86}); - if (fs.exists(vs2015_bin_dir / "amd64\\vcvars64.bat")) - supported_architectures.push_back({L"x64", CPU::X64, CPU::X64}); - if (fs.exists(vs2015_bin_dir / "x86_amd64\\vcvarsx86_amd64.bat")) + if (fs.exists(vcvarsall_dir / "vcvars64.bat")) + supported_architectures.push_back({L"amd64", CPU::X64, CPU::X64}); + if (fs.exists(vcvarsall_dir / "vcvarsx86_amd64.bat")) supported_architectures.push_back({L"x86_amd64", CPU::X86, CPU::X64}); - if (fs.exists(vs2015_bin_dir / "x86_arm\\vcvarsx86_arm.bat")) + if (fs.exists(vcvarsall_dir / "vcvarsx86_arm.bat")) supported_architectures.push_back({L"x86_arm", CPU::X86, CPU::ARM}); - if (fs.exists(vs2015_bin_dir / "amd64_x86\\vcvarsamd64_x86.bat")) + if (fs.exists(vcvarsall_dir / "vcvarsx86_arm64.bat")) + supported_architectures.push_back({L"x86_arm64", CPU::X86, CPU::ARM64}); + if (fs.exists(vcvarsall_dir / "vcvarsamd64_x86.bat")) supported_architectures.push_back({L"amd64_x86", CPU::X64, CPU::X86}); - if (fs.exists(vs2015_bin_dir / "amd64_arm\\vcvarsamd64_arm.bat")) + if (fs.exists(vcvarsall_dir / "vcvarsamd64_arm.bat")) supported_architectures.push_back({L"amd64_arm", CPU::X64, CPU::ARM}); - - if (fs.exists(vs2015_dumpbin_exe)) + if (fs.exists(vcvarsall_dir / "vcvarsamd64_arm64.bat")) + supported_architectures.push_back({L"amd64_arm64", CPU::X64, CPU::ARM64}); + + // Locate the "best" MSVC toolchain version + const fs::path msvc_path = vc_dir / "Tools" / "MSVC"; + std::vector<fs::path> msvc_subdirectories = fs.get_files_non_recursive(msvc_path); + Util::unstable_keep_if(msvc_subdirectories, + [&fs](const fs::path& path) { return fs.is_directory(path); }); + + // Sort them so that latest comes first + std::sort( + msvc_subdirectories.begin(), + msvc_subdirectories.end(), + [](const fs::path& left, const fs::path& right) { return left.filename() > right.filename(); }); + + for (const fs::path& subdir : msvc_subdirectories) { - found_toolsets.push_back( - {vs2015_dumpbin_exe, vs2015_vcvarsall_bat, {}, V_140, supported_architectures}); + const fs::path dumpbin_path = subdir / "bin" / "HostX86" / "x86" / "dumpbin.exe"; + paths_examined.push_back(dumpbin_path); + if (fs.exists(dumpbin_path)) + { + found_toolsets.push_back(Toolset{ + vs_instance.root_path, dumpbin_path, vcvarsall_bat, {}, V_141, supported_architectures}); + + if (v140_is_available) + { + found_toolsets.push_back(Toolset{vs_instance.root_path, + dumpbin_path, + vcvarsall_bat, + {L"-vcvars_ver=14.0"}, + V_140, + supported_architectures}); + } + + break; + } } + + continue; } - } - // VS2017 - Optional<Toolset> vs2017_toolset; - const std::vector<std::string> vs2017_installation_instances = get_vs2017_installation_instances(paths); - for (const std::string& instance : vs2017_installation_instances) - { - const fs::path vc_dir = fs::path{instance} / "VC"; - - // Skip any instances that do not have vcvarsall. - const fs::path vcvarsall_dir = vc_dir / "Auxiliary" / "Build"; - const fs::path vcvarsall_bat = vcvarsall_dir / "vcvarsall.bat"; - paths_examined.push_back(vcvarsall_bat); - if (!fs.exists(vcvarsall_bat)) continue; - - // Get all supported architectures - std::vector<ToolsetArchOption> supported_architectures; - if (fs.exists(vcvarsall_dir / "vcvars32.bat")) - supported_architectures.push_back({L"x86", CPU::X86, CPU::X86}); - if (fs.exists(vcvarsall_dir / "vcvars64.bat")) - supported_architectures.push_back({L"amd64", CPU::X64, CPU::X64}); - if (fs.exists(vcvarsall_dir / "vcvarsx86_amd64.bat")) - supported_architectures.push_back({L"x86_amd64", CPU::X86, CPU::X64}); - if (fs.exists(vcvarsall_dir / "vcvarsx86_arm.bat")) - supported_architectures.push_back({L"x86_arm", CPU::X86, CPU::ARM}); - if (fs.exists(vcvarsall_dir / "vcvarsamd64_x86.bat")) - supported_architectures.push_back({L"amd64_x86", CPU::X64, CPU::X86}); - if (fs.exists(vcvarsall_dir / "vcvarsamd64_arm.bat")) - supported_architectures.push_back({L"amd64_arm", CPU::X64, CPU::ARM}); - - // Locate the "best" MSVC toolchain version - const fs::path msvc_path = vc_dir / "Tools" / "MSVC"; - std::vector<fs::path> msvc_subdirectories = fs.get_files_non_recursive(msvc_path); - Util::unstable_keep_if(msvc_subdirectories, [&fs](const fs::path& path) { return fs.is_directory(path); }); - - // Sort them so that latest comes first - std::sort(msvc_subdirectories.begin(), - msvc_subdirectories.end(), - [](const fs::path& left, const fs::path& right) { return left.filename() > right.filename(); }); - - for (const fs::path& subdir : msvc_subdirectories) + if (major_version == "14" || major_version == "12") { - const fs::path dumpbin_path = subdir / "bin" / "HostX86" / "x86" / "dumpbin.exe"; - paths_examined.push_back(dumpbin_path); - if (fs.exists(dumpbin_path)) + const fs::path vcvarsall_bat = vs_instance.root_path / "VC" / "vcvarsall.bat"; + + paths_examined.push_back(vcvarsall_bat); + if (fs.exists(vcvarsall_bat)) { - vs2017_toolset = Toolset{dumpbin_path, vcvarsall_bat, {}, V_141, supported_architectures}; - break; + const fs::path vs_dumpbin_exe = vs_instance.root_path / "VC" / "bin" / "dumpbin.exe"; + paths_examined.push_back(vs_dumpbin_exe); + + const fs::path vs_bin_dir = vcvarsall_bat.parent_path() / "bin"; + std::vector<ToolsetArchOption> supported_architectures; + if (fs.exists(vs_bin_dir / "vcvars32.bat")) + supported_architectures.push_back({L"x86", CPU::X86, CPU::X86}); + if (fs.exists(vs_bin_dir / "amd64\\vcvars64.bat")) + supported_architectures.push_back({L"x64", CPU::X64, CPU::X64}); + if (fs.exists(vs_bin_dir / "x86_amd64\\vcvarsx86_amd64.bat")) + supported_architectures.push_back({L"x86_amd64", CPU::X86, CPU::X64}); + if (fs.exists(vs_bin_dir / "x86_arm\\vcvarsx86_arm.bat")) + supported_architectures.push_back({L"x86_arm", CPU::X86, CPU::ARM}); + if (fs.exists(vs_bin_dir / "amd64_x86\\vcvarsamd64_x86.bat")) + supported_architectures.push_back({L"amd64_x86", CPU::X64, CPU::X86}); + if (fs.exists(vs_bin_dir / "amd64_arm\\vcvarsamd64_arm.bat")) + supported_architectures.push_back({L"amd64_arm", CPU::X64, CPU::ARM}); + + if (fs.exists(vs_dumpbin_exe)) + { + found_toolsets.push_back({vs_instance.root_path, + vs_dumpbin_exe, + vcvarsall_bat, + {}, + major_version == "14" ? V_140 : V_120, + supported_architectures}); + } } } - if (const auto value = vs2017_toolset.get()) - { - found_toolsets.push_back(*value); - } } if (found_toolsets.empty()) @@ -455,72 +469,54 @@ namespace vcpkg return found_toolsets; } - static std::vector<Toolset> create_vs2017_v140_toolset_instances(const std::vector<Toolset>& vs_toolsets) + const Toolset& VcpkgPaths::get_toolset(const Optional<std::string>& toolset_version, + const Optional<fs::path>& visual_studio_path) const { - std::vector<Toolset> vs2017_v140_toolsets; - - // In constrast to v141 and above, there can only be a single instance of v140 (VS2017 vs VS2015). - const auto it = Util::find_if(vs_toolsets, [&](const Toolset& t) { return t.version == V_140; }); - - // If v140 is not available, then VS2017 cant use them. Return empty. - if (it == vs_toolsets.cend()) - { - return vs2017_v140_toolsets; - } - - // If it does exist, then create a matching v140 toolset for each v141 toolset - const Toolset v140_toolset = *it; - for (const Toolset& toolset : vs_toolsets) - { - if (toolset.version != V_141) - { - continue; - } - - Toolset t = Toolset{ - toolset.dumpbin, toolset.vcvarsall, {L"-vcvars_ver=14.0"}, V_140, toolset.supported_architectures}; - vs2017_v140_toolsets.push_back(std::move(t)); - } - - return vs2017_v140_toolsets; - } - - const Toolset& VcpkgPaths::get_toolset(const std::string& toolset_version) const - { - const std::wstring& w_toolset_version = Strings::to_utf16(toolset_version); - - if (w_toolset_version == V_120) - { - const auto& v120_toolsets = this->toolsets_vs2013.get_lazy( - [this]() { return find_v120_toolset_instances(this->get_filesystem()); }); - Checks::check_exit(VCPKG_LINE_INFO, v120_toolsets.size() > 0); - return v120_toolsets.back(); - } - // Invariant: toolsets are non-empty and sorted with newest at back() const std::vector<Toolset>& vs_toolsets = this->toolsets.get_lazy([this]() { return find_toolset_instances(*this); }); - if (w_toolset_version.empty()) + std::vector<const Toolset*> candidates = Util::element_pointers(vs_toolsets); + const auto tsv = toolset_version.get(); + const auto vsp = visual_studio_path.get(); + + if (tsv && vsp) { - return vs_toolsets.back(); + const std::wstring w_toolset_version = Strings::to_utf16(*tsv); + const fs::path vs_root_path = *vsp; + Util::stable_keep_if(candidates, [&](const Toolset* t) { + return w_toolset_version == t->version && vs_root_path == t->visual_studio_root_path; + }); + Checks::check_exit(VCPKG_LINE_INFO, + !candidates.empty(), + "Could not find Visual Studio instace at %s with %s toolset.", + vs_root_path.generic_string(), + *tsv); + + Checks::check_exit(VCPKG_LINE_INFO, candidates.size() == 1); + return *candidates.back(); } - const auto toolset = - Util::find_if(vs_toolsets, [&](const Toolset& t) { return w_toolset_version == t.version; }); - Checks::check_exit( - VCPKG_LINE_INFO, toolset != vs_toolsets.end(), "Could not find toolset '%s'", toolset_version); + if (tsv) + { + const std::wstring w_toolset_version = Strings::to_utf16(*tsv); + Util::stable_keep_if(candidates, [&](const Toolset* t) { return w_toolset_version == t->version; }); + Checks::check_exit( + VCPKG_LINE_INFO, !candidates.empty(), "Could not find Visual Studio instace with %s toolset.", *tsv); + } - // If v140 is the selected toolset and VS2017 is available, then use VS2017's vcvarsall with the - // -vcvars_ver=14.0 option - const std::vector<Toolset>& vs2017_v140_toolsets = this->toolsets_vs2017_v140.get_lazy( - [&vs_toolsets]() { return create_vs2017_v140_toolset_instances(vs_toolsets); }); - if (w_toolset_version == V_140 && !vs2017_v140_toolsets.empty()) + if (vsp) { - return vs2017_v140_toolsets.back(); + const fs::path vs_root_path = *vsp; + Util::stable_keep_if(candidates, + [&](const Toolset* t) { return vs_root_path == t->visual_studio_root_path; }); + Checks::check_exit(VCPKG_LINE_INFO, + !candidates.empty(), + "Could not find Visual Studio instace at %s.", + vs_root_path.generic_string()); } - return *toolset; + return *candidates.front(); } Files::Filesystem& VcpkgPaths::get_filesystem() const { return Files::get_real_filesystem(); } diff --git a/toolsrc/src/VersionT.cpp b/toolsrc/src/vcpkg/versiont.cpp index 738d2ce88..1c52d674a 100644 --- a/toolsrc/src/VersionT.cpp +++ b/toolsrc/src/vcpkg/versiont.cpp @@ -1,7 +1,7 @@ #include "pch.h" -#include "VersionT.h" -#include "vcpkg_Strings.h" +#include <vcpkg/base/strings.h> +#include <vcpkg/versiont.h> namespace vcpkg { diff --git a/toolsrc/src/vcpkg_Build_BuildPolicy.cpp b/toolsrc/src/vcpkg_Build_BuildPolicy.cpp deleted file mode 100644 index b3bb778dc..000000000 --- a/toolsrc/src/vcpkg_Build_BuildPolicy.cpp +++ /dev/null @@ -1,40 +0,0 @@ -#include "pch.h" - -#include "vcpkg_Build.h" -#include "vcpkg_Checks.h" -#include "vcpkg_Enums.h" - -namespace vcpkg::Build -{ - static const std::string NAME_EMPTY_PACKAGE = "PolicyEmptyPackage"; - static const std::string NAME_DLLS_WITHOUT_LIBS = "PolicyDLLsWithoutLIBs"; - static const std::string NAME_ONLY_RELEASE_CRT = "PolicyOnlyReleaseCRT"; - static const std::string NAME_EMPTY_INCLUDE_FOLDER = "PolicyEmptyIncludeFolder"; - static const std::string NAME_ALLOW_OBSOLETE_MSVCRT = "PolicyAllowObsoleteMsvcrt"; - - const std::string& to_string(BuildPolicy policy) - { - switch (policy) - { - case BuildPolicy::EMPTY_PACKAGE: return NAME_EMPTY_PACKAGE; - case BuildPolicy::DLLS_WITHOUT_LIBS: return NAME_DLLS_WITHOUT_LIBS; - case BuildPolicy::ONLY_RELEASE_CRT: return NAME_ONLY_RELEASE_CRT; - case BuildPolicy::EMPTY_INCLUDE_FOLDER: return NAME_EMPTY_INCLUDE_FOLDER; - case BuildPolicy::ALLOW_OBSOLETE_MSVCRT: return NAME_ALLOW_OBSOLETE_MSVCRT; - default: Checks::unreachable(VCPKG_LINE_INFO); - } - } - - CStringView to_cmake_variable(BuildPolicy policy) - { - switch (policy) - { - case BuildPolicy::EMPTY_PACKAGE: return "VCPKG_POLICY_EMPTY_PACKAGE"; - case BuildPolicy::DLLS_WITHOUT_LIBS: return "VCPKG_POLICY_DLLS_WITHOUT_LIBS"; - case BuildPolicy::ONLY_RELEASE_CRT: return "VCPKG_POLICY_ONLY_RELEASE_CRT"; - case BuildPolicy::EMPTY_INCLUDE_FOLDER: return "VCPKG_POLICY_EMPTY_INCLUDE_FOLDER"; - case BuildPolicy::ALLOW_OBSOLETE_MSVCRT: return "VCPKG_POLICY_ALLOW_OBSOLETE_MSVCRT"; - default: Checks::unreachable(VCPKG_LINE_INFO); - } - } -} diff --git a/toolsrc/src/vcpkg_metrics_uploader.cpp b/toolsrc/src/vcpkgmetricsuploader.cpp index cef4f4756..2239fe750 100644 --- a/toolsrc/src/vcpkg_metrics_uploader.cpp +++ b/toolsrc/src/vcpkgmetricsuploader.cpp @@ -1,6 +1,8 @@ -#include "metrics.h" -#include "vcpkg_Checks.h" -#include "vcpkg_Files.h" +#include <vcpkg/metrics.h> + +#include <vcpkg/base/checks.h> +#include <vcpkg/base/files.h> + #include <Windows.h> using namespace vcpkg; diff --git a/toolsrc/vcpkglib/vcpkglib.vcxproj b/toolsrc/vcpkglib/vcpkglib.vcxproj index edecd7720..ae332e015 100644 --- a/toolsrc/vcpkglib/vcpkglib.vcxproj +++ b/toolsrc/vcpkglib/vcpkglib.vcxproj @@ -136,110 +136,114 @@ </Link> </ItemDefinitionGroup> <ItemGroup> - <ClInclude Include="..\include\BinaryParagraph.h" /> - <ClInclude Include="..\include\CStringView.h" /> - <ClInclude Include="..\include\lazy.h" /> - <ClInclude Include="..\include\LineInfo.h" /> - <ClInclude Include="..\include\ParagraphParseResult.h" /> - <ClInclude Include="..\include\PostBuildLint_BuildType.h" /> - <ClInclude Include="..\include\Span.h" /> - <ClInclude Include="..\include\vcpkg_Build.h" /> - <ClInclude Include="..\include\coff_file_reader.h" /> - <ClInclude Include="..\include\vcpkg_expected.h" /> - <ClInclude Include="..\include\filesystem_fs.h" /> - <ClInclude Include="..\include\SortedVector.h" /> - <ClInclude Include="..\include\MachineType.h" /> - <ClInclude Include="..\include\metrics.h" /> - <ClInclude Include="..\include\PackageSpec.h" /> - <ClInclude Include="..\include\PackageSpecParseResult.h" /> - <ClInclude Include="..\include\Paragraphs.h" /> <ClInclude Include="..\include\pch.h" /> - <ClInclude Include="..\include\PostBuildLint.h" /> - <ClInclude Include="..\include\SourceParagraph.h" /> - <ClInclude Include="..\include\StatusParagraph.h" /> - <ClInclude Include="..\include\StatusParagraphs.h" /> - <ClInclude Include="..\include\vcpkg_Chrono.h" /> - <ClInclude Include="..\include\triplet.h" /> - <ClInclude Include="..\include\vcpkglib.h" /> - <ClInclude Include="..\include\vcpkg_GlobalState.h" /> - <ClInclude Include="..\include\vcpkg_Parse.h" /> - <ClInclude Include="..\include\vcpkg_Checks.h" /> - <ClInclude Include="..\include\VcpkgCmdArguments.h" /> - <ClInclude Include="..\include\vcpkg_Commands.h" /> - <ClInclude Include="..\include\vcpkg_Dependencies.h" /> - <ClInclude Include="..\include\vcpkg_Enums.h" /> - <ClInclude Include="..\include\vcpkg_Files.h" /> - <ClInclude Include="..\include\vcpkg_Graphs.h" /> - <ClInclude Include="..\include\vcpkg_Input.h" /> - <ClInclude Include="..\include\vcpkg_Maps.h" /> - <ClInclude Include="..\include\vcpkg_optional.h" /> - <ClInclude Include="..\include\VcpkgPaths.h" /> - <ClInclude Include="..\include\vcpkg_Strings.h" /> - <ClInclude Include="..\include\vcpkg_System.h" /> - <ClInclude Include="..\include\vcpkg_Util.h" /> - <ClInclude Include="..\include\VersionT.h" /> + <ClInclude Include="..\include\vcpkg\base\checks.h" /> + <ClInclude Include="..\include\vcpkg\base\chrono.h" /> + <ClInclude Include="..\include\vcpkg\base\cofffilereader.h" /> + <ClInclude Include="..\include\vcpkg\base\cstringview.h" /> + <ClInclude Include="..\include\vcpkg\base\enums.h" /> + <ClInclude Include="..\include\vcpkg\base\expected.h" /> + <ClInclude Include="..\include\vcpkg\base\files.h" /> + <ClInclude Include="..\include\vcpkg\base\graphs.h" /> + <ClInclude Include="..\include\vcpkg\base\lazy.h" /> + <ClInclude Include="..\include\vcpkg\base\lineinfo.h" /> + <ClInclude Include="..\include\vcpkg\base\machinetype.h" /> + <ClInclude Include="..\include\vcpkg\base\optional.h" /> + <ClInclude Include="..\include\vcpkg\base\sortedvector.h" /> + <ClInclude Include="..\include\vcpkg\base\span.h" /> + <ClInclude Include="..\include\vcpkg\base\strings.h" /> + <ClInclude Include="..\include\vcpkg\base\system.h" /> + <ClInclude Include="..\include\vcpkg\base\util.h" /> + <ClInclude Include="..\include\vcpkg\binaryparagraph.h" /> + <ClInclude Include="..\include\vcpkg\build.h" /> + <ClInclude Include="..\include\vcpkg\commands.h" /> + <ClInclude Include="..\include\vcpkg\dependencies.h" /> + <ClInclude Include="..\include\vcpkg\export.h" /> + <ClInclude Include="..\include\vcpkg\export.ifw.h" /> + <ClInclude Include="..\include\vcpkg\globalstate.h" /> + <ClInclude Include="..\include\vcpkg\help.h" /> + <ClInclude Include="..\include\vcpkg\input.h" /> + <ClInclude Include="..\include\vcpkg\install.h" /> + <ClInclude Include="..\include\vcpkg\metrics.h" /> + <ClInclude Include="..\include\vcpkg\packagespec.h" /> + <ClInclude Include="..\include\vcpkg\packagespecparseresult.h" /> + <ClInclude Include="..\include\vcpkg\paragraphparseresult.h" /> + <ClInclude Include="..\include\vcpkg\paragraphs.h" /> + <ClInclude Include="..\include\vcpkg\parse.h" /> + <ClInclude Include="..\include\vcpkg\postbuildlint.h" /> + <ClInclude Include="..\include\vcpkg\postbuildlint.buildtype.h" /> + <ClInclude Include="..\include\vcpkg\remove.h" /> + <ClInclude Include="..\include\vcpkg\sourceparagraph.h" /> + <ClInclude Include="..\include\vcpkg\statusparagraph.h" /> + <ClInclude Include="..\include\vcpkg\statusparagraphs.h" /> + <ClInclude Include="..\include\vcpkg\triplet.h" /> + <ClInclude Include="..\include\vcpkg\update.h" /> + <ClInclude Include="..\include\vcpkg\vcpkgcmdarguments.h" /> + <ClInclude Include="..\include\vcpkg\vcpkglib.h" /> + <ClInclude Include="..\include\vcpkg\vcpkgpaths.h" /> + <ClInclude Include="..\include\vcpkg\versiont.h" /> </ItemGroup> <ItemGroup> - <ClCompile Include="..\src\BinaryParagraph.cpp" /> - <ClCompile Include="..\src\commands_ci.cpp" /> - <ClCompile Include="..\src\commands_depends.cpp" /> - <ClCompile Include="..\src\commands_env.cpp" /> - <ClCompile Include="..\src\commands_export.cpp" /> - <ClCompile Include="..\src\LineInfo.cpp" /> - <ClCompile Include="..\src\ParagraphParseResult.cpp" /> - <ClCompile Include="..\src\vcpkg_Build.cpp" /> - <ClCompile Include="..\src\vcpkg_Build_BuildPolicy.cpp" /> - <ClCompile Include="..\src\coff_file_reader.cpp" /> - <ClCompile Include="..\src\commands_available_commands.cpp" /> - <ClCompile Include="..\src\commands_build.cpp" /> - <ClCompile Include="..\src\commands_build_external.cpp" /> - <ClCompile Include="..\src\commands_cache.cpp" /> - <ClCompile Include="..\src\commands_contact.cpp" /> - <ClCompile Include="..\src\commands_create.cpp" /> - <ClCompile Include="..\src\commands_edit.cpp" /> - <ClCompile Include="..\src\commands_hash.cpp" /> - <ClCompile Include="..\src\commands_help.cpp" /> - <ClCompile Include="..\src\commands_import.cpp" /> - <ClCompile Include="..\src\commands_install.cpp" /> - <ClCompile Include="..\src\commands_integrate.cpp" /> - <ClCompile Include="..\src\commands_list.cpp" /> - <ClCompile Include="..\src\commands_owns.cpp" /> - <ClCompile Include="..\src\commands_portsdiff.cpp" /> - <ClCompile Include="..\src\commands_remove.cpp" /> - <ClCompile Include="..\src\commands_search.cpp" /> - <ClCompile Include="..\src\commands_update.cpp" /> - <ClCompile Include="..\src\commands_version.cpp" /> - <ClCompile Include="..\src\MachineType.cpp" /> - <ClCompile Include="..\src\metrics.cpp" /> <ClCompile Include="..\src\pch.cpp"> <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader> <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader> <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</PrecompiledHeader> <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Create</PrecompiledHeader> </ClCompile> - <ClCompile Include="..\src\PostBuildLint.cpp" /> - <ClCompile Include="..\src\PostBuildLint_BuildType.cpp" /> - <ClCompile Include="..\src\vcpkg_Chrono.cpp" /> - <ClCompile Include="..\src\vcpkglib.cpp" /> - <ClCompile Include="..\src\PackageSpec.cpp" /> - <ClCompile Include="..\src\PackageSpecParseResult.cpp" /> - <ClCompile Include="..\src\Paragraphs.cpp" /> - <ClCompile Include="..\src\SourceParagraph.cpp" /> - <ClCompile Include="..\src\StatusParagraph.cpp" /> - <ClCompile Include="..\src\StatusParagraphs.cpp" /> - <ClCompile Include="..\src\triplet.cpp" /> - <ClCompile Include="..\src\vcpkg_GlobalState.cpp" /> - <ClCompile Include="..\src\vcpkg_Parse.cpp" /> - <ClCompile Include="..\src\vcpkg_Checks.cpp" /> - <ClCompile Include="..\src\VcpkgCmdArguments.cpp" /> - <ClCompile Include="..\src\vcpkg_Dependencies.cpp" /> - <ClCompile Include="..\src\vcpkg_Enums.cpp" /> - <ClCompile Include="..\src\vcpkg_Files.cpp" /> - <ClCompile Include="..\src\vcpkg_Input.cpp" /> - <ClCompile Include="..\src\VcpkgPaths.cpp" /> - <ClCompile Include="..\src\vcpkg_Strings.cpp" /> - <ClCompile Include="..\src\vcpkg_System.cpp" /> - <ClCompile Include="..\src\VersionT.cpp" /> + <ClCompile Include="..\src\vcpkg\base\checks.cpp" /> + <ClCompile Include="..\src\vcpkg\base\chrono.cpp" /> + <ClCompile Include="..\src\vcpkg\base\cofffilereader.cpp" /> + <ClCompile Include="..\src\vcpkg\base\enums.cpp" /> + <ClCompile Include="..\src\vcpkg\base\files.cpp" /> + <ClCompile Include="..\src\vcpkg\base\lineinfo.cpp" /> + <ClCompile Include="..\src\vcpkg\base\machinetype.cpp" /> + <ClCompile Include="..\src\vcpkg\base\strings.cpp" /> + <ClCompile Include="..\src\vcpkg\base\system.cpp" /> + <ClCompile Include="..\src\vcpkg\binaryparagraph.cpp" /> + <ClCompile Include="..\src\vcpkg\build.cpp" /> + <ClCompile Include="..\src\vcpkg\commands.autocomplete.cpp" /> + <ClCompile Include="..\src\vcpkg\commands.buildexternal.cpp" /> + <ClCompile Include="..\src\vcpkg\commands.cache.cpp" /> + <ClCompile Include="..\src\vcpkg\commands.ci.cpp" /> + <ClCompile Include="..\src\vcpkg\commands.contact.cpp" /> + <ClCompile Include="..\src\vcpkg\commands.cpp" /> + <ClCompile Include="..\src\vcpkg\commands.create.cpp" /> + <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.hash.cpp" /> + <ClCompile Include="..\src\vcpkg\commands.import.cpp" /> + <ClCompile Include="..\src\vcpkg\commands.integrate.cpp" /> + <ClCompile Include="..\src\vcpkg\commands.list.cpp" /> + <ClCompile Include="..\src\vcpkg\commands.owns.cpp" /> + <ClCompile Include="..\src\vcpkg\commands.portsdiff.cpp" /> + <ClCompile Include="..\src\vcpkg\commands.search.cpp" /> + <ClCompile Include="..\src\vcpkg\commands.version.cpp" /> + <ClCompile Include="..\src\vcpkg\dependencies.cpp" /> + <ClCompile Include="..\src\vcpkg\export.cpp" /> + <ClCompile Include="..\src\vcpkg\globalstate.cpp" /> + <ClCompile Include="..\src\vcpkg\help.cpp" /> + <ClCompile Include="..\src\vcpkg\input.cpp" /> + <ClCompile Include="..\src\vcpkg\install.cpp" /> + <ClCompile Include="..\src\vcpkg\metrics.cpp" /> + <ClCompile Include="..\src\vcpkg\packagespec.cpp" /> + <ClCompile Include="..\src\vcpkg\packagespecparseresult.cpp" /> + <ClCompile Include="..\src\vcpkg\paragraphparseresult.cpp" /> + <ClCompile Include="..\src\vcpkg\paragraphs.cpp" /> + <ClCompile Include="..\src\vcpkg\parse.cpp" /> + <ClCompile Include="..\src\vcpkg\postbuildlint.buildtype.cpp" /> + <ClCompile Include="..\src\vcpkg\postbuildlint.cpp" /> + <ClCompile Include="..\src\vcpkg\remove.cpp" /> + <ClCompile Include="..\src\vcpkg\sourceparagraph.cpp" /> + <ClCompile Include="..\src\vcpkg\statusparagraph.cpp" /> + <ClCompile Include="..\src\vcpkg\statusparagraphs.cpp" /> + <ClCompile Include="..\src\vcpkg\triplet.cpp" /> + <ClCompile Include="..\src\vcpkg\update.cpp" /> + <ClCompile Include="..\src\vcpkg\vcpkgcmdarguments.cpp" /> + <ClCompile Include="..\src\vcpkg\vcpkglib.cpp" /> + <ClCompile Include="..\src\vcpkg\vcpkgpaths.cpp" /> + <ClCompile Include="..\src\vcpkg\versiont.cpp" /> </ItemGroup> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> <ImportGroup Label="ExtensionTargets"> diff --git a/toolsrc/vcpkglib/vcpkglib.vcxproj.filters b/toolsrc/vcpkglib/vcpkglib.vcxproj.filters index 2fbf3d929..e902bffbb 100644 --- a/toolsrc/vcpkglib/vcpkglib.vcxproj.filters +++ b/toolsrc/vcpkglib/vcpkglib.vcxproj.filters @@ -13,300 +13,324 @@ <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier> <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions> </Filter> + <Filter Include="Header Files\vcpkg"> + <UniqueIdentifier>{69f6b6e6-5ac4-4419-a256-b8a6b0392720}</UniqueIdentifier> + </Filter> + <Filter Include="Header Files\vcpkg\base"> + <UniqueIdentifier>{4a229410-0d09-4dab-953b-f434d6483f96}</UniqueIdentifier> + </Filter> + <Filter Include="Source Files\vcpkg"> + <UniqueIdentifier>{75592043-ab63-4905-beee-568a6ab8bf93}</UniqueIdentifier> + </Filter> + <Filter Include="Source Files\vcpkg\base"> + <UniqueIdentifier>{fa1f10e7-58d2-4f7c-ac26-a979baa70061}</UniqueIdentifier> + </Filter> </ItemGroup> <ItemGroup> - <ClCompile Include="..\src\SourceParagraph.cpp"> + <ClCompile Include="..\src\pch.cpp"> <Filter>Source Files</Filter> </ClCompile> - <ClCompile Include="..\src\BinaryParagraph.cpp"> - <Filter>Source Files</Filter> + <ClCompile Include="..\src\vcpkg\binaryparagraph.cpp"> + <Filter>Source Files\vcpkg</Filter> </ClCompile> - <ClCompile Include="..\src\StatusParagraph.cpp"> - <Filter>Source Files</Filter> + <ClCompile Include="..\src\vcpkg\build.cpp"> + <Filter>Source Files\vcpkg</Filter> </ClCompile> - <ClCompile Include="..\src\StatusParagraphs.cpp"> - <Filter>Source Files</Filter> + <ClCompile Include="..\src\vcpkg\commands.autocomplete.cpp"> + <Filter>Source Files\vcpkg</Filter> </ClCompile> - <ClCompile Include="..\src\triplet.cpp"> - <Filter>Source Files</Filter> + <ClCompile Include="..\src\vcpkg\commands.buildexternal.cpp"> + <Filter>Source Files\vcpkg</Filter> </ClCompile> - <ClCompile Include="..\src\Paragraphs.cpp"> - <Filter>Source Files</Filter> + <ClCompile Include="..\src\vcpkg\commands.cache.cpp"> + <Filter>Source Files\vcpkg</Filter> </ClCompile> - <ClCompile Include="..\src\metrics.cpp"> - <Filter>Source Files</Filter> + <ClCompile Include="..\src\vcpkg\commands.ci.cpp"> + <Filter>Source Files\vcpkg</Filter> </ClCompile> - <ClCompile Include="..\src\vcpkg_Input.cpp"> - <Filter>Source Files</Filter> + <ClCompile Include="..\src\vcpkg\commands.contact.cpp"> + <Filter>Source Files\vcpkg</Filter> </ClCompile> - <ClCompile Include="..\src\coff_file_reader.cpp"> - <Filter>Source Files</Filter> + <ClCompile Include="..\src\vcpkg\commands.cpp"> + <Filter>Source Files\vcpkg</Filter> </ClCompile> - <ClCompile Include="..\src\commands_available_commands.cpp"> - <Filter>Source Files</Filter> + <ClCompile Include="..\src\vcpkg\commands.create.cpp"> + <Filter>Source Files\vcpkg</Filter> </ClCompile> - <ClCompile Include="..\src\commands_build.cpp"> - <Filter>Source Files</Filter> + <ClCompile Include="..\src\vcpkg\commands.dependinfo.cpp"> + <Filter>Source Files\vcpkg</Filter> </ClCompile> - <ClCompile Include="..\src\commands_build_external.cpp"> - <Filter>Source Files</Filter> + <ClCompile Include="..\src\vcpkg\commands.edit.cpp"> + <Filter>Source Files\vcpkg</Filter> </ClCompile> - <ClCompile Include="..\src\commands_cache.cpp"> - <Filter>Source Files</Filter> + <ClCompile Include="..\src\vcpkg\commands.env.cpp"> + <Filter>Source Files\vcpkg</Filter> </ClCompile> - <ClCompile Include="..\src\commands_contact.cpp"> - <Filter>Source Files</Filter> + <ClCompile Include="..\src\vcpkg\commands.exportifw.cpp"> + <Filter>Source Files\vcpkg</Filter> </ClCompile> - <ClCompile Include="..\src\commands_create.cpp"> - <Filter>Source Files</Filter> + <ClCompile Include="..\src\vcpkg\commands.hash.cpp"> + <Filter>Source Files\vcpkg</Filter> </ClCompile> - <ClCompile Include="..\src\commands_edit.cpp"> - <Filter>Source Files</Filter> + <ClCompile Include="..\src\vcpkg\commands.import.cpp"> + <Filter>Source Files\vcpkg</Filter> </ClCompile> - <ClCompile Include="..\src\commands_hash.cpp"> - <Filter>Source Files</Filter> + <ClCompile Include="..\src\vcpkg\commands.integrate.cpp"> + <Filter>Source Files\vcpkg</Filter> </ClCompile> - <ClCompile Include="..\src\commands_help.cpp"> - <Filter>Source Files</Filter> + <ClCompile Include="..\src\vcpkg\commands.list.cpp"> + <Filter>Source Files\vcpkg</Filter> </ClCompile> - <ClCompile Include="..\src\commands_import.cpp"> - <Filter>Source Files</Filter> + <ClCompile Include="..\src\vcpkg\commands.owns.cpp"> + <Filter>Source Files\vcpkg</Filter> </ClCompile> - <ClCompile Include="..\src\commands_install.cpp"> - <Filter>Source Files</Filter> + <ClCompile Include="..\src\vcpkg\commands.portsdiff.cpp"> + <Filter>Source Files\vcpkg</Filter> </ClCompile> - <ClCompile Include="..\src\commands_integrate.cpp"> - <Filter>Source Files</Filter> + <ClCompile Include="..\src\vcpkg\commands.search.cpp"> + <Filter>Source Files\vcpkg</Filter> </ClCompile> - <ClCompile Include="..\src\commands_list.cpp"> - <Filter>Source Files</Filter> + <ClCompile Include="..\src\vcpkg\commands.version.cpp"> + <Filter>Source Files\vcpkg</Filter> </ClCompile> - <ClCompile Include="..\src\commands_owns.cpp"> - <Filter>Source Files</Filter> + <ClCompile Include="..\src\vcpkg\dependencies.cpp"> + <Filter>Source Files\vcpkg</Filter> </ClCompile> - <ClCompile Include="..\src\commands_portsdiff.cpp"> - <Filter>Source Files</Filter> + <ClCompile Include="..\src\vcpkg\export.cpp"> + <Filter>Source Files\vcpkg</Filter> </ClCompile> - <ClCompile Include="..\src\commands_remove.cpp"> - <Filter>Source Files</Filter> + <ClCompile Include="..\src\vcpkg\globalstate.cpp"> + <Filter>Source Files\vcpkg</Filter> </ClCompile> - <ClCompile Include="..\src\commands_search.cpp"> - <Filter>Source Files</Filter> + <ClCompile Include="..\src\vcpkg\help.cpp"> + <Filter>Source Files\vcpkg</Filter> </ClCompile> - <ClCompile Include="..\src\commands_update.cpp"> - <Filter>Source Files</Filter> + <ClCompile Include="..\src\vcpkg\input.cpp"> + <Filter>Source Files\vcpkg</Filter> </ClCompile> - <ClCompile Include="..\src\commands_version.cpp"> - <Filter>Source Files</Filter> + <ClCompile Include="..\src\vcpkg\install.cpp"> + <Filter>Source Files\vcpkg</Filter> </ClCompile> - <ClCompile Include="..\src\MachineType.cpp"> - <Filter>Source Files</Filter> + <ClCompile Include="..\src\vcpkg\metrics.cpp"> + <Filter>Source Files\vcpkg</Filter> </ClCompile> - <ClCompile Include="..\src\vcpkg_Dependencies.cpp"> - <Filter>Source Files</Filter> + <ClCompile Include="..\src\vcpkg\packagespec.cpp"> + <Filter>Source Files\vcpkg</Filter> </ClCompile> - <ClCompile Include="..\src\vcpkglib.cpp"> - <Filter>Source Files</Filter> + <ClCompile Include="..\src\vcpkg\packagespecparseresult.cpp"> + <Filter>Source Files\vcpkg</Filter> </ClCompile> - <ClCompile Include="..\src\vcpkg_System.cpp"> - <Filter>Source Files</Filter> + <ClCompile Include="..\src\vcpkg\paragraphparseresult.cpp"> + <Filter>Source Files\vcpkg</Filter> </ClCompile> - <ClCompile Include="..\src\vcpkg_Checks.cpp"> - <Filter>Source Files</Filter> + <ClCompile Include="..\src\vcpkg\paragraphs.cpp"> + <Filter>Source Files\vcpkg</Filter> </ClCompile> - <ClCompile Include="..\src\vcpkg_Files.cpp"> - <Filter>Source Files</Filter> + <ClCompile Include="..\src\vcpkg\parse.cpp"> + <Filter>Source Files\vcpkg</Filter> </ClCompile> - <ClCompile Include="..\src\vcpkg_Strings.cpp"> - <Filter>Source Files</Filter> + <ClCompile Include="..\src\vcpkg\postbuildlint.buildtype.cpp"> + <Filter>Source Files\vcpkg</Filter> </ClCompile> - <ClCompile Include="..\src\pch.cpp"> - <Filter>Source Files</Filter> + <ClCompile Include="..\src\vcpkg\postbuildlint.cpp"> + <Filter>Source Files\vcpkg</Filter> </ClCompile> - <ClCompile Include="..\src\PostBuildLint.cpp"> - <Filter>Source Files</Filter> + <ClCompile Include="..\src\vcpkg\remove.cpp"> + <Filter>Source Files\vcpkg</Filter> </ClCompile> - <ClCompile Include="..\src\PostBuildLint_BuildType.cpp"> - <Filter>Source Files</Filter> + <ClCompile Include="..\src\vcpkg\sourceparagraph.cpp"> + <Filter>Source Files\vcpkg</Filter> </ClCompile> - <ClCompile Include="..\src\vcpkg_Enums.cpp"> - <Filter>Source Files</Filter> + <ClCompile Include="..\src\vcpkg\statusparagraph.cpp"> + <Filter>Source Files\vcpkg</Filter> </ClCompile> - <ClCompile Include="..\src\commands_ci.cpp"> - <Filter>Source Files</Filter> + <ClCompile Include="..\src\vcpkg\statusparagraphs.cpp"> + <Filter>Source Files\vcpkg</Filter> </ClCompile> - <ClCompile Include="..\src\vcpkg_Chrono.cpp"> - <Filter>Source Files</Filter> + <ClCompile Include="..\src\vcpkg\triplet.cpp"> + <Filter>Source Files\vcpkg</Filter> </ClCompile> - <ClCompile Include="..\src\LineInfo.cpp"> - <Filter>Source Files</Filter> + <ClCompile Include="..\src\vcpkg\update.cpp"> + <Filter>Source Files\vcpkg</Filter> </ClCompile> - <ClCompile Include="..\src\commands_env.cpp"> - <Filter>Source Files</Filter> + <ClCompile Include="..\src\vcpkg\vcpkgcmdarguments.cpp"> + <Filter>Source Files\vcpkg</Filter> </ClCompile> - <ClCompile Include="..\src\PackageSpec.cpp"> - <Filter>Source Files</Filter> + <ClCompile Include="..\src\vcpkg\vcpkglib.cpp"> + <Filter>Source Files\vcpkg</Filter> </ClCompile> - <ClCompile Include="..\src\PackageSpecParseResult.cpp"> - <Filter>Source Files</Filter> + <ClCompile Include="..\src\vcpkg\vcpkgpaths.cpp"> + <Filter>Source Files\vcpkg</Filter> </ClCompile> - <ClCompile Include="..\src\ParagraphParseResult.cpp"> - <Filter>Source Files</Filter> + <ClCompile Include="..\src\vcpkg\versiont.cpp"> + <Filter>Source Files\vcpkg</Filter> </ClCompile> - <ClCompile Include="..\src\VcpkgCmdArguments.cpp"> - <Filter>Source Files</Filter> + <ClCompile Include="..\src\vcpkg\base\checks.cpp"> + <Filter>Source Files\vcpkg\base</Filter> </ClCompile> - <ClCompile Include="..\src\VcpkgPaths.cpp"> - <Filter>Source Files</Filter> + <ClCompile Include="..\src\vcpkg\base\chrono.cpp"> + <Filter>Source Files\vcpkg\base</Filter> </ClCompile> - <ClCompile Include="..\src\commands_depends.cpp"> - <Filter>Source Files</Filter> + <ClCompile Include="..\src\vcpkg\base\cofffilereader.cpp"> + <Filter>Source Files\vcpkg\base</Filter> </ClCompile> - <ClCompile Include="..\src\commands_export.cpp"> - <Filter>Source Files</Filter> + <ClCompile Include="..\src\vcpkg\base\enums.cpp"> + <Filter>Source Files\vcpkg\base</Filter> </ClCompile> - <ClCompile Include="..\src\VersionT.cpp"> - <Filter>Source Files</Filter> + <ClCompile Include="..\src\vcpkg\base\files.cpp"> + <Filter>Source Files\vcpkg\base</Filter> </ClCompile> - <ClCompile Include="..\src\vcpkg_Build.cpp"> - <Filter>Source Files</Filter> + <ClCompile Include="..\src\vcpkg\base\lineinfo.cpp"> + <Filter>Source Files\vcpkg\base</Filter> </ClCompile> - <ClCompile Include="..\src\vcpkg_Build_BuildPolicy.cpp"> - <Filter>Source Files</Filter> + <ClCompile Include="..\src\vcpkg\base\machinetype.cpp"> + <Filter>Source Files\vcpkg\base</Filter> </ClCompile> - <ClCompile Include="..\src\vcpkg_Parse.cpp"> - <Filter>Source Files</Filter> + <ClCompile Include="..\src\vcpkg\base\strings.cpp"> + <Filter>Source Files\vcpkg\base</Filter> </ClCompile> - <ClCompile Include="..\src\vcpkg_GlobalState.cpp"> - <Filter>Source Files</Filter> + <ClCompile Include="..\src\vcpkg\base\system.cpp"> + <Filter>Source Files\vcpkg\base</Filter> </ClCompile> </ItemGroup> <ItemGroup> - <ClInclude Include="..\include\SourceParagraph.h"> + <ClInclude Include="..\include\pch.h"> <Filter>Header Files</Filter> </ClInclude> - <ClInclude Include="..\include\BinaryParagraph.h"> - <Filter>Header Files</Filter> + <ClInclude Include="..\include\vcpkg\base\files.h"> + <Filter>Header Files\vcpkg\base</Filter> </ClInclude> - <ClInclude Include="..\include\StatusParagraph.h"> - <Filter>Header Files</Filter> + <ClInclude Include="..\include\vcpkg\base\checks.h"> + <Filter>Header Files\vcpkg\base</Filter> </ClInclude> - <ClInclude Include="..\include\StatusParagraphs.h"> - <Filter>Header Files</Filter> + <ClInclude Include="..\include\vcpkg\base\chrono.h"> + <Filter>Header Files\vcpkg\base</Filter> </ClInclude> - <ClInclude Include="..\include\triplet.h"> - <Filter>Header Files</Filter> + <ClInclude Include="..\include\vcpkg\base\cofffilereader.h"> + <Filter>Header Files\vcpkg\base</Filter> </ClInclude> - <ClInclude Include="..\include\Paragraphs.h"> - <Filter>Header Files</Filter> + <ClInclude Include="..\include\vcpkg\base\cstringview.h"> + <Filter>Header Files\vcpkg\base</Filter> </ClInclude> - <ClInclude Include="..\include\metrics.h"> - <Filter>Header Files</Filter> + <ClInclude Include="..\include\vcpkg\base\enums.h"> + <Filter>Header Files\vcpkg\base</Filter> </ClInclude> - <ClInclude Include="..\include\vcpkg_Input.h"> - <Filter>Header Files</Filter> + <ClInclude Include="..\include\vcpkg\base\expected.h"> + <Filter>Header Files\vcpkg\base</Filter> </ClInclude> - <ClInclude Include="..\include\coff_file_reader.h"> - <Filter>Header Files</Filter> + <ClInclude Include="..\include\vcpkg\base\graphs.h"> + <Filter>Header Files\vcpkg\base</Filter> </ClInclude> - <ClInclude Include="..\include\filesystem_fs.h"> - <Filter>Header Files</Filter> + <ClInclude Include="..\include\vcpkg\base\lazy.h"> + <Filter>Header Files\vcpkg\base</Filter> </ClInclude> - <ClInclude Include="..\include\MachineType.h"> - <Filter>Header Files</Filter> + <ClInclude Include="..\include\vcpkg\base\lineinfo.h"> + <Filter>Header Files\vcpkg\base</Filter> </ClInclude> - <ClInclude Include="..\include\vcpkg_Commands.h"> - <Filter>Header Files</Filter> + <ClInclude Include="..\include\vcpkg\base\machinetype.h"> + <Filter>Header Files\vcpkg\base</Filter> </ClInclude> - <ClInclude Include="..\include\vcpkg_Dependencies.h"> - <Filter>Header Files</Filter> + <ClInclude Include="..\include\vcpkg\base\optional.h"> + <Filter>Header Files\vcpkg\base</Filter> </ClInclude> - <ClInclude Include="..\include\vcpkglib.h"> - <Filter>Header Files</Filter> + <ClInclude Include="..\include\vcpkg\base\sortedvector.h"> + <Filter>Header Files\vcpkg\base</Filter> </ClInclude> - <ClInclude Include="..\include\vcpkg_Checks.h"> - <Filter>Header Files</Filter> + <ClInclude Include="..\include\vcpkg\base\span.h"> + <Filter>Header Files\vcpkg\base</Filter> </ClInclude> - <ClInclude Include="..\include\vcpkg_Files.h"> - <Filter>Header Files</Filter> + <ClInclude Include="..\include\vcpkg\base\strings.h"> + <Filter>Header Files\vcpkg\base</Filter> </ClInclude> - <ClInclude Include="..\include\vcpkg_Graphs.h"> - <Filter>Header Files</Filter> + <ClInclude Include="..\include\vcpkg\base\system.h"> + <Filter>Header Files\vcpkg\base</Filter> </ClInclude> - <ClInclude Include="..\include\vcpkg_Maps.h"> - <Filter>Header Files</Filter> + <ClInclude Include="..\include\vcpkg\base\util.h"> + <Filter>Header Files\vcpkg\base</Filter> </ClInclude> - <ClInclude Include="..\include\vcpkg_Strings.h"> - <Filter>Header Files</Filter> + <ClInclude Include="..\include\vcpkg\binaryparagraph.h"> + <Filter>Header Files\vcpkg</Filter> </ClInclude> - <ClInclude Include="..\include\vcpkg_System.h"> - <Filter>Header Files</Filter> + <ClInclude Include="..\include\vcpkg\build.h"> + <Filter>Header Files\vcpkg</Filter> </ClInclude> - <ClInclude Include="..\include\pch.h"> - <Filter>Header Files</Filter> + <ClInclude Include="..\include\vcpkg\commands.h"> + <Filter>Header Files\vcpkg</Filter> </ClInclude> - <ClInclude Include="..\include\vcpkg_optional.h"> - <Filter>Header Files</Filter> + <ClInclude Include="..\include\vcpkg\dependencies.h"> + <Filter>Header Files\vcpkg</Filter> </ClInclude> - <ClInclude Include="..\include\PostBuildLint.h"> - <Filter>Header Files</Filter> + <ClInclude Include="..\include\vcpkg\export.h"> + <Filter>Header Files\vcpkg</Filter> </ClInclude> - <ClInclude Include="..\include\vcpkg_Enums.h"> - <Filter>Header Files</Filter> + <ClInclude Include="..\include\vcpkg\globalstate.h"> + <Filter>Header Files\vcpkg</Filter> </ClInclude> - <ClInclude Include="..\include\vcpkg_Chrono.h"> - <Filter>Header Files</Filter> + <ClInclude Include="..\include\vcpkg\help.h"> + <Filter>Header Files\vcpkg</Filter> </ClInclude> - <ClInclude Include="..\include\lazy.h"> - <Filter>Header Files</Filter> + <ClInclude Include="..\include\vcpkg\input.h"> + <Filter>Header Files\vcpkg</Filter> </ClInclude> - <ClInclude Include="..\include\LineInfo.h"> - <Filter>Header Files</Filter> + <ClInclude Include="..\include\vcpkg\install.h"> + <Filter>Header Files\vcpkg</Filter> </ClInclude> - <ClInclude Include="..\include\vcpkg_expected.h"> - <Filter>Header Files</Filter> + <ClInclude Include="..\include\vcpkg\metrics.h"> + <Filter>Header Files\vcpkg</Filter> </ClInclude> - <ClInclude Include="..\include\vcpkg_Util.h"> - <Filter>Header Files</Filter> + <ClInclude Include="..\include\vcpkg\packagespec.h"> + <Filter>Header Files\vcpkg</Filter> </ClInclude> - <ClInclude Include="..\include\SortedVector.h"> - <Filter>Header Files</Filter> + <ClInclude Include="..\include\vcpkg\packagespecparseresult.h"> + <Filter>Header Files\vcpkg</Filter> </ClInclude> - <ClInclude Include="..\include\CStringView.h"> - <Filter>Header Files</Filter> + <ClInclude Include="..\include\vcpkg\paragraphparseresult.h"> + <Filter>Header Files\vcpkg</Filter> </ClInclude> - <ClInclude Include="..\include\PackageSpec.h"> - <Filter>Header Files</Filter> + <ClInclude Include="..\include\vcpkg\paragraphs.h"> + <Filter>Header Files\vcpkg</Filter> </ClInclude> - <ClInclude Include="..\include\PackageSpecParseResult.h"> - <Filter>Header Files</Filter> + <ClInclude Include="..\include\vcpkg\parse.h"> + <Filter>Header Files\vcpkg</Filter> </ClInclude> - <ClInclude Include="..\include\ParagraphParseResult.h"> - <Filter>Header Files</Filter> + <ClInclude Include="..\include\vcpkg\postbuildlint.h"> + <Filter>Header Files\vcpkg</Filter> </ClInclude> - <ClInclude Include="..\include\VcpkgCmdArguments.h"> - <Filter>Header Files</Filter> + <ClInclude Include="..\include\vcpkg\remove.h"> + <Filter>Header Files\vcpkg</Filter> </ClInclude> - <ClInclude Include="..\include\VersionT.h"> - <Filter>Header Files</Filter> + <ClInclude Include="..\include\vcpkg\sourceparagraph.h"> + <Filter>Header Files\vcpkg</Filter> </ClInclude> - <ClInclude Include="..\include\VcpkgPaths.h"> - <Filter>Header Files</Filter> + <ClInclude Include="..\include\vcpkg\statusparagraph.h"> + <Filter>Header Files\vcpkg</Filter> </ClInclude> - <ClInclude Include="..\include\vcpkg_Build.h"> - <Filter>Header Files</Filter> + <ClInclude Include="..\include\vcpkg\statusparagraphs.h"> + <Filter>Header Files\vcpkg</Filter> </ClInclude> - <ClInclude Include="..\include\PostBuildLint_BuildType.h"> - <Filter>Header Files</Filter> + <ClInclude Include="..\include\vcpkg\triplet.h"> + <Filter>Header Files\vcpkg</Filter> </ClInclude> - <ClInclude Include="..\include\Span.h"> - <Filter>Header Files</Filter> + <ClInclude Include="..\include\vcpkg\update.h"> + <Filter>Header Files\vcpkg</Filter> </ClInclude> - <ClInclude Include="..\include\vcpkg_Parse.h"> - <Filter>Header Files</Filter> + <ClInclude Include="..\include\vcpkg\vcpkgcmdarguments.h"> + <Filter>Header Files\vcpkg</Filter> </ClInclude> - <ClInclude Include="..\include\vcpkg_GlobalState.h"> - <Filter>Header Files</Filter> + <ClInclude Include="..\include\vcpkg\vcpkglib.h"> + <Filter>Header Files\vcpkg</Filter> + </ClInclude> + <ClInclude Include="..\include\vcpkg\vcpkgpaths.h"> + <Filter>Header Files\vcpkg</Filter> + </ClInclude> + <ClInclude Include="..\include\vcpkg\versiont.h"> + <Filter>Header Files\vcpkg</Filter> + </ClInclude> + <ClInclude Include="..\include\vcpkg\postbuildlint.buildtype.h"> + <Filter>Header Files\vcpkg</Filter> + </ClInclude> + <ClInclude Include="..\include\vcpkg\export.ifw.h"> + <Filter>Header Files\vcpkg</Filter> </ClInclude> </ItemGroup> </Project>
\ No newline at end of file diff --git a/toolsrc/vcpkgmetricsuploader/vcpkgmetricsuploader.vcxproj b/toolsrc/vcpkgmetricsuploader/vcpkgmetricsuploader.vcxproj index 472d74e30..4b59c5ace 100644 --- a/toolsrc/vcpkgmetricsuploader/vcpkgmetricsuploader.vcxproj +++ b/toolsrc/vcpkgmetricsuploader/vcpkgmetricsuploader.vcxproj @@ -131,7 +131,7 @@ </Link> </ItemDefinitionGroup> <ItemGroup> - <ClCompile Include="..\src\vcpkg_metrics_uploader.cpp" /> + <ClCompile Include="..\src\vcpkgmetricsuploader.cpp" /> </ItemGroup> <ItemGroup> <ProjectReference Include="..\vcpkglib\vcpkglib.vcxproj"> diff --git a/toolsrc/vcpkgmetricsuploader/vcpkgmetricsuploader.vcxproj.filters b/toolsrc/vcpkgmetricsuploader/vcpkgmetricsuploader.vcxproj.filters index a50df7250..847921000 100644 --- a/toolsrc/vcpkgmetricsuploader/vcpkgmetricsuploader.vcxproj.filters +++ b/toolsrc/vcpkgmetricsuploader/vcpkgmetricsuploader.vcxproj.filters @@ -15,7 +15,7 @@ </Filter> </ItemGroup> <ItemGroup> - <ClCompile Include="..\src\vcpkg_metrics_uploader.cpp"> + <ClCompile Include="..\src\vcpkgmetricsuploader.cpp"> <Filter>Source Files</Filter> </ClCompile> </ItemGroup> diff --git a/toolsrc/vcpkgtest/vcpkgtest.vcxproj b/toolsrc/vcpkgtest/vcpkgtest.vcxproj index 041e74d31..d25748124 100644 --- a/toolsrc/vcpkgtest/vcpkgtest.vcxproj +++ b/toolsrc/vcpkgtest/vcpkgtest.vcxproj @@ -19,11 +19,11 @@ </ProjectConfiguration> </ItemGroup> <ItemGroup> - <ClCompile Include="..\src\tests_arguments.cpp" /> - <ClCompile Include="..\src\tests_dependencies.cpp" /> - <ClCompile Include="..\src\tests_package_spec.cpp" /> - <ClCompile Include="..\src\tests_paragraph.cpp" /> - <ClCompile Include="..\src\test_install_plan.cpp" /> + <ClCompile Include="..\src\tests.arguments.cpp" /> + <ClCompile Include="..\src\tests.dependencies.cpp" /> + <ClCompile Include="..\src\tests.packagespec.cpp" /> + <ClCompile Include="..\src\tests.paragraph.cpp" /> + <ClCompile Include="..\src\tests.installplan.cpp" /> </ItemGroup> <ItemGroup> <ProjectReference Include="..\vcpkglib\vcpkglib.vcxproj"> diff --git a/toolsrc/vcpkgtest/vcpkgtest.vcxproj.filters b/toolsrc/vcpkgtest/vcpkgtest.vcxproj.filters index b31dbd951..42691c614 100644 --- a/toolsrc/vcpkgtest/vcpkgtest.vcxproj.filters +++ b/toolsrc/vcpkgtest/vcpkgtest.vcxproj.filters @@ -15,19 +15,19 @@ </Filter> </ItemGroup> <ItemGroup> - <ClCompile Include="..\src\tests_paragraph.cpp"> + <ClCompile Include="..\src\tests.installplan.cpp"> <Filter>Source Files</Filter> </ClCompile> - <ClCompile Include="..\src\tests_dependencies.cpp"> + <ClCompile Include="..\src\tests.arguments.cpp"> <Filter>Source Files</Filter> </ClCompile> - <ClCompile Include="..\src\tests_arguments.cpp"> + <ClCompile Include="..\src\tests.dependencies.cpp"> <Filter>Source Files</Filter> </ClCompile> - <ClCompile Include="..\src\test_install_plan.cpp"> + <ClCompile Include="..\src\tests.packagespec.cpp"> <Filter>Source Files</Filter> </ClCompile> - <ClCompile Include="..\src\tests_package_spec.cpp"> + <ClCompile Include="..\src\tests.paragraph.cpp"> <Filter>Source Files</Filter> </ClCompile> </ItemGroup> |
