Fix build failure and Robert code review feedback.
MODIFY
CMakeLists.txt
CMakeLists.txt
@@ -98,7 +98,8 @@ if(NOT DEFINED VCPKG_BASE_VERSION OR VCPKG_BASE_VERSION STREQUAL "")
message(FATAL_ERROR "VCPKG_BASE_VERSION must be set for official builds.")
endif()
- set(VCPKG_BASE_VERSION "9999-99-99")
+ # The first digit is 2 to work with vcpkg_minimum_required in scripts.
+ set(VCPKG_BASE_VERSION "2999-12-31")
endif()
set(CMAKE_CXX_EXTENSIONS OFF)

MODIFY
azure-pipelines/arch-independent-signing.signproj
azure-pipelines/arch-independent-signing.signproj
<FilesToSign Include="$(IntermediateOutputPath)\vcpkg-ce\**\*.js" Exclude="$(IntermediateOutputPath)\vcpkg-ce\**\node_modules\**\*.js">
<Authenticode>Microsoft400</Authenticode>
</FilesToSign>
- <FilesToSign Include="$(IntermediateOutputPath)\vcpkg-ce\**\ce.ps1">
+ <FilesToSign Include="$(IntermediateOutputPath)\vcpkg-ce\scripts\ce.ps1">
<Authenticode>Microsoft400</Authenticode>
</FilesToSign>
<FilesToSign Include="$(IntermediateOutputPath)\vcpkg-ce\**\node_modules\**\*.js">

MODIFY
azure-pipelines/pipelines.yml
azure-pipelines/pipelines.yml
@@ -9,7 +9,7 @@ jobs:
steps:
- bash: |
git clone https://github.com/microsoft/vcpkg "$VCPKG_ROOT" -n
- git -C "$VCPKG_ROOT" checkout `cat azure-pipelines/vcpkg-scripts-sha.txt`
+ git -C "$VCPKG_ROOT" checkout `cat install-vcpkg/vcpkg-scripts-sha.txt`
displayName: "Clone vcpkg repo to serve as root"
- bash: |
export CXXFLAGS="-fprofile-arcs -ftest-coverage -fPIC -O0"
@@ -57,7 +57,7 @@ jobs:
steps:
- bash: |
git clone https://github.com/microsoft/vcpkg "$VCPKG_ROOT" -n
- git -C "$VCPKG_ROOT" checkout `cat azure-pipelines/vcpkg-scripts-sha.txt`
+ git -C "$VCPKG_ROOT" checkout `cat install-vcpkg/vcpkg-scripts-sha.txt`
displayName: "Clone vcpkg repo to serve as root"
- bash: |
cmake -DCMAKE_BUILD_TYPE=Debug -DBUILD_TESTING=ON -DVCPKG_DEVELOPMENT_WARNINGS=ON -DVCPKG_WARNINGS_AS_ERRORS=ON -DVCPKG_BUILD_FUZZING=ON -DCMAKE_OSX_DEPLOYMENT_TARGET=10.13 -B build.amd64.debug
@@ -106,7 +106,7 @@ jobs:
pwsh: true
targetType: inline
script: |
- $sha = (Get-Content azure-pipelines/vcpkg-scripts-sha.txt -Raw).Trim()
+ $sha = (Get-Content install-vcpkg/vcpkg-scripts-sha.txt -Raw).Trim()
git clone https://github.com/microsoft/vcpkg $env:VCPKG_ROOT -n
git -C "$env:VCPKG_ROOT" checkout $sha
- task: CmdLine@2

MODIFY
include/vcpkg/registries.h
include/vcpkg/registries.h
@@ -123,8 +123,6 @@ namespace vcpkg
// for checking against the registry feature flag.
bool has_modifications() const;
- bool contains_artifact_registries() const;
-
private:
std::unique_ptr<RegistryImplementation> default_registry_;
std::vector<Registry> registries_;

MODIFY
src/vcpkg-test/commands.cpp
src/vcpkg-test/commands.cpp
@@ -74,8 +74,13 @@ TEST_CASE ("list of commands is correct", "[commands]")
"export",
"depend-info",
"activate",
+ "find",
+ "use",
+ "add",
+ "z-ce",
"x-check-support",
"z-print-config",
+ "z-bootstrap-readonly",
#if defined(_WIN32)
"x-upload-metrics",
#endif // defined(_WIN32)

MODIFY
src/vcpkg/archives.cpp
src/vcpkg/archives.cpp
@@ -126,7 +126,8 @@ namespace
win32_extract_msi(archive, to_path);
}
else if (Strings::case_insensitive_ascii_equals(ext, ".zip") ||
- Strings::case_insensitive_ascii_equals(ext, ".7z"))
+ Strings::case_insensitive_ascii_equals(ext, ".7z") ||
+ Strings::case_insensitive_ascii_equals(ext, ".exe"))
{
win32_extract_with_seven_zip(paths, archive, to_path);
}
@@ -147,16 +148,6 @@ namespace
Checks::exit_maybe_upgrade(VCPKG_LINE_INFO, "Unexpected archive extension: %s", ext);
}
}
-}
-
-namespace vcpkg
-{
- void extract_tar(const Path& tar_tool, const Path& archive, const Path& to_path)
- {
- const auto code =
- cmd_execute(Command{tar_tool}.string_arg("xzf").path_arg(archive), InWorkingDirectory{to_path});
- Checks::check_exit(VCPKG_LINE_INFO, code == 0, "tar failed while extracting %s", archive);
- }
Path extract_archive_to_temp_subdirectory(const VcpkgPaths& paths, const Path& archive, const Path& to_path)
{
@@ -172,6 +163,16 @@ namespace vcpkg
extract_archive_to_empty(paths, archive, to_path_partial);
return to_path_partial;
}
+}
+
+namespace vcpkg
+{
+ void extract_tar(const Path& tar_tool, const Path& archive, const Path& to_path)
+ {
+ const auto code =
+ cmd_execute(Command{tar_tool}.string_arg("xzf").path_arg(archive), InWorkingDirectory{to_path});
+ Checks::check_exit(VCPKG_LINE_INFO, code == 0, "tar failed while extracting %s", archive);
+ }
void extract_archive(const VcpkgPaths& paths, const Path& archive, const Path& to_path)
{

MODIFY
src/vcpkg/base/system.process.cpp
src/vcpkg/base/system.process.cpp
@@ -252,21 +252,25 @@ namespace vcpkg
Environment get_modified_clean_environment(const std::unordered_map<std::string, std::string>& extra_env,
StringView prepend_to_path)
{
- auto prepend_path_component = prepend_to_path.to_string();
- if (!prepend_path_component.empty())
- {
- prepend_path_component.push_back(';');
- }
-
static const std::string system_root_env =
get_environment_variable("SystemRoot").value_or_exit(VCPKG_LINE_INFO);
static const std::string system32_env = system_root_env + R"(\system32)";
- std::string new_path = Strings::format(R"(PATH=%s%s;%s;%s\Wbem;%s\WindowsPowerShell\v1.0\)",
- prepend_path_component,
+ std::string new_path = "PATH=";
+ Strings::append(new_path, prepend_to_path);
+ if (new_path.back() != '=' && new_path.back() != ';')
+ {
+ new_path.push_back(';');
+ }
+
+ Strings::append(new_path,
system32_env,
+ ';',
system_root_env,
+ ';',
+ system32_env,
+ "\\Wbem;",
system32_env,
- system32_env);
+ "\\WindowsPowerShell\\v1.0\\");
std::vector<std::wstring> env_wstrings = {
L"ALLUSERSPROFILE",

MODIFY
src/vcpkg/configuration.cpp
src/vcpkg/configuration.cpp
@@ -571,9 +571,26 @@ namespace vcpkg
}
}
+ static bool registry_config_requests_configure_environment(const Optional<RegistryConfig>& target) noexcept
+ {
+ if (auto* reg = target.get())
+ {
+ if (auto* kind = reg->kind.get())
+ {
+ if (*kind == "artifact")
+ {
+ return true;
+ }
+ }
+ }
+
+ return false;
+ }
+
bool Configuration::requests_configure_environment() const
{
- return registry_set.contains_artifact_registries() || !ce_metadata.is_empty();
+ return !ce_metadata.is_empty() || registry_config_requests_configure_environment(default_reg) ||
+ std::any_of(registries.begin(), registries.end(), registry_config_requests_configure_environment);
}
Json::IDeserializer<Configuration>& get_configuration_deserializer() { return ConfigurationDeserializer::instance; }

MODIFY
src/vcpkg/registries.cpp
src/vcpkg/registries.cpp
@@ -1202,19 +1202,6 @@ namespace vcpkg
}
bool RegistrySet::has_modifications() const { return !registries_.empty() || !is_default_builtin_registry(); }
- bool RegistrySet::contains_artifact_registries() const
- {
- for (auto&& registry : registries_)
- {
- if (registry.implementation_->kind() == "artifact")
- {
- return true;
- }
- }
-
- return false;
- }
-
ExpectedS<std::vector<std::pair<SchemedVersion, std::string>>> get_builtin_versions(const VcpkgPaths& paths,
StringView port_name)
{

Fix build failure and Robert code review feedback.