New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[vcpkg] Add vcpkg_minimum_required as a replacement for VERSION.txt. #15638
Conversation
|
||
string(REGEX MATCH "[12][0-9][0-9][0-9]-[01][0-9]-[0-2][0-9]" _vcpkg_matched_test_version "${_vcpkg_VERSION}") | ||
if (NOT _vcpkg_matched_test_version STREQUAL _vcpkg_VERSION) | ||
message(FATAL_ERROR "VERSION parameter to vcpkg_minimum_required was not a valid date.") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be good to print the current vcpkg tool's _vcpkg_matched_base_version
in this error case as well.
toolsrc/CMakeLists.txt
Outdated
endif() | ||
|
||
set(VCPKG_BASE_VERSION "2020-01-13") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
set(VCPKG_BASE_VERSION "2020-01-13") | |
set(VCPKG_BASE_VERSION "2021-01-13") |
😄
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
At least I was consistent about it I guess 😂
scripts/ports.cmake
Outdated
endif() | ||
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}/cmake) | ||
include(vcpkg_minimum_required) | ||
vcpkg_minimum_required(VERSION 2020-01-13) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
vcpkg_minimum_required(VERSION 2020-01-13) | |
vcpkg_minimum_required(VERSION 2021-01-13) |
@@ -0,0 +1,2 @@ | |||
vcpkg_minimum_required(VERSION 2020-01-12) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
vcpkg_minimum_required(VERSION 2020-01-12) | |
vcpkg_minimum_required(VERSION 2021-01-12) |
## Usage | ||
```cmake | ||
vcpkg_check_linkage( | ||
VERSION 2020-01-13 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
VERSION 2020-01-13 | |
VERSION 2021-01-13 |
scripts/bootstrap.ps1
Outdated
@@ -369,7 +369,8 @@ else | |||
} | |||
|
|||
$arguments = ( | |||
"`"/p:VCPKG_VERSION=-unknownhash`"", | |||
"`"/p:VCPKG_VERSION=unknownhash`"", | |||
"`"/p:VCPKG_BASE_VERSION=2020-01-13`"", # Note: This duplicate date version will be short lived. See https://github.com/microsoft/vcpkg/pull/15474 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"`"/p:VCPKG_BASE_VERSION=2020-01-13`"", # Note: This duplicate date version will be short lived. See https://github.com/microsoft/vcpkg/pull/15474 | |
"`"/p:VCPKG_BASE_VERSION=2021-01-13`"", # Note: This duplicate date version will be short lived. See https://github.com/microsoft/vcpkg/pull/15474 |
|
||
## Usage | ||
```cmake | ||
vcpkg_check_linkage( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
vcpkg_check_linkage( | |
vcpkg_minimum_required( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor changes requested, then I'm an approve.
) | ||
endif() | ||
|
||
string(REGEX MATCH "[12][0-9][0-9][0-9]-[01][0-9]-[0-2][0-9]" _vcpkg_matched_base_version "${VCPKG_BASE_VERSION}") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
string(REGEX MATCH "[12][0-9][0-9][0-9]-[01][0-9]-[0-2][0-9]" _vcpkg_matched_base_version "${VCPKG_BASE_VERSION}") | |
string(REGEX MATCH "^[12][0-9][0-9][0-9]-(0[0-9]|1[0-2])-([0-2][0-9]|3[01])$" _vcpkg_matched_base_version "${VCPKG_BASE_VERSION}") |
this doesn't match "2020-01-31" as it is right now, and it also matches "foobar2423-13-12"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Alternatively,
string(REGEX MATCH "[12][0-9][0-9][0-9]-[01][0-9]-[0-2][0-9]" _vcpkg_matched_base_version "${VCPKG_BASE_VERSION}") | |
string(REGEX MATCH "^\d{4}-\d{2}-\d{2}$" _vcpkg_matched_base_version "${VCPKG_BASE_VERSION}") |
|
||
string(REPLACE "-" "." _VCPKG_BASE_VERSION_as_dotted "${_vcpkg_matched_base_version}") | ||
|
||
string(REGEX MATCH "[12][0-9][0-9][0-9]-[01][0-9]-[0-2][0-9]" _vcpkg_matched_test_version "${_vcpkg_VERSION}") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you should either split out the matcher, or use a simpler matcher.
{"PORT_PATH", fs::generic_u8string(paths.builtin_ports_directory() / fs::u8path(port_name))}, | ||
{"VCPKG_BASE_VERSION", Commands::Version::base_version()}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a minor nit, but
{"PORT_PATH", fs::generic_u8string(paths.builtin_ports_directory() / fs::u8path(port_name))}, | |
{"VCPKG_BASE_VERSION", Commands::Version::base_version()}, | |
{"VCPKG_BASE_VERSION", Commands::Version::base_version()}, | |
{"PORT_PATH", fs::generic_u8string(paths.builtin_ports_directory() / fs::u8path(port_name))}, |
… related machinery.
…s of that type in checks.cpp.
4910555
to
6f9c3b1
Compare
New-Item -Path $WorkingRoot -ItemType Directory | ||
} | ||
|
||
$WorkingRoot = (Get-Item $WorkingRoot).FullName |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Duplicate of below
message(FATAL_ERROR | ||
"Your vcpkg executable is from ${VCPKG_BASE_VERSION} which is older than required by the caller " | ||
"of vcpkg_minimum_required (${_vcpkg_VERSION}). " | ||
"Please re-acquire vcpkg by running bootstrap-vcpkg." |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This message might need to additionally suggest git pull
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that would be harmful given the status quo that the only way the user can have this happen if they've already changed branches. I agree it makes sense when most of our users are using externally acquired vcpkg / registries, but when that happens the right fix won't be bootstrap-vcpkg either.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(That is, that message might change the versions of bits users are using)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some minor comments and questions but approved :)
constexpr LineInfo() noexcept : m_line_number(0), m_file_name("") { } | ||
constexpr LineInfo(const int lineno, const char* filename) : m_line_number(lineno), m_file_name(filename) { } | ||
|
||
std::string to_string() const; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
were these just never defined?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The ctors are defined inline there, to_string
was defined in checks.cpp.
@@ -49,7 +34,7 @@ namespace vcpkg | |||
std::string to_string() const; | |||
void to_string(std::string& out) const; | |||
|
|||
StringView substr(size_t pos, size_t count = std::numeric_limits<size_t>::max()) const noexcept; | |||
StringView substr(size_t pos, size_t count = static_cast<size_t>(-1)) const noexcept; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't like this change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Without this change we need to add #include <limits>
and we were trying to make this header very small?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Given that we're using PCHs, I don't have a huge issue with using standard headers, even if they're pretty large. However, I won't block this change if you feel strongly about it.
toolsrc/src/vcpkg/base/files.cpp
Outdated
|
||
file_stream.close(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why aren't we just letting the RAII do its thing? (not a change from your PR, but while you're editing anyways)
toolsrc/src/vcpkg/base/system.cpp
Outdated
@@ -39,7 +39,7 @@ namespace vcpkg | |||
case CPUArchitecture::ARM: return "arm"; | |||
case CPUArchitecture::ARM64: return "arm64"; | |||
case CPUArchitecture::S390X: return "s390x"; | |||
default: Checks::exit_with_message(VCPKG_LINE_INFO, "unexpected vcpkg::System::CPUArchitecture"); | |||
default: Checks::exit_maybe_upgrade(VCPKG_LINE_INFO, "unexpected vcpkg::System::CPUArchitecture"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
default: Checks::exit_maybe_upgrade(VCPKG_LINE_INFO, "unexpected vcpkg::System::CPUArchitecture"); | |
default: Checks::unexpected(VCPKG_LINE_INFO); |
This is an enumeration, if a value is not in the list then that's a coding error.
…ing related to fstream sets errno.
utilities.cmake: Disable warnings that are firing on Azure Pipelines CI machines due to different Clang version. expected.h: Fix a bug I introduced in microsoft#15638 because I was under the impression expected worked like optional (in that value_or_exit for it should be treated as a program bug) build.cpp: Add (void)s to silence warnings. binarycaching.cpp: Repair assumption that the current directory is C: which isn't true on the Hosted Azure Pipelines agents. others: Make unit tests respect %VCPKG_ROOT%, as necessary in the vcpkg_tool repo. Note that this required splitting vcpkgcmdarguments::ImbueFromEnvironment into the once-only process modifying part and the just imbue from environment part.
utilities.cmake: Disable warnings that are firing on Azure Pipelines CI machines due to different Clang version. expected.h: Fix a bug I introduced in microsoft/vcpkg#15638 because I was under the impression expected worked like optional (in that value_or_exit for it should be treated as a program bug) build.cpp: Add (void)s to silence warnings. binarycaching.cpp: Repair assumption that the current directory is C: which isn't true on the Hosted Azure Pipelines agents. others: Make unit tests respect %VCPKG_ROOT%, as necessary in the vcpkg_tool repo. Note that this required splitting vcpkgcmdarguments::ImbueFromEnvironment into the once-only process modifying part and the just imbue from environment part.
utilities.cmake: Disable warnings that are firing on Azure Pipelines CI machines due to different Clang version. expected.h: Fix a bug I introduced in #15638 because I was under the impression expected worked like optional (in that value_or_exit for it should be treated as a program bug) build.cpp: Add (void)s to silence warnings. binarycaching.cpp: Repair assumption that the current directory is C: which isn't true on the Hosted Azure Pipelines agents. others: Make unit tests respect %VCPKG_ROOT%, as necessary in the vcpkg_tool repo. Note that this required splitting vcpkgcmdarguments::ImbueFromEnvironment into the once-only process modifying part and the just imbue from environment part.
utilities.cmake: Disable warnings that are firing on Azure Pipelines CI machines due to different Clang version. expected.h: Fix a bug I introduced in microsoft/vcpkg#15638 because I was under the impression expected worked like optional (in that value_or_exit for it should be treated as a program bug) build.cpp: Add (void)s to silence warnings. binarycaching.cpp: Repair assumption that the current directory is C: which isn't true on the Hosted Azure Pipelines agents. others: Make unit tests respect %VCPKG_ROOT%, as necessary in the vcpkg_tool repo. Note that this required splitting vcpkgcmdarguments::ImbueFromEnvironment into the once-only process modifying part and the just imbue from environment part.
utilities.cmake: Disable warnings that are firing on Azure Pipelines CI machines due to different Clang version. expected.h: Fix a bug I introduced in microsoft/vcpkg#15638 because I was under the impression expected worked like optional (in that value_or_exit for it should be treated as a program bug) build.cpp: Add (void)s to silence warnings. binarycaching.cpp: Repair assumption that the current directory is C: which isn't true on the Hosted Azure Pipelines agents. others: Make unit tests respect %VCPKG_ROOT%, as necessary in the vcpkg_tool repo. Note that this required splitting vcpkgcmdarguments::ImbueFromEnvironment into the once-only process modifying part and the just imbue from environment part.
No description provided.