mirror of
https://github.com/microsoft/vcpkg.git
synced 2024-12-27 10:21:07 +08:00
[vcpkg] Turn on tests and PREfast in CI, and fix tests to pass. (#11239)
Co-authored-by: nicole mazzuca <mazzucan@outlook.com>
This commit is contained in:
parent
4727bc86a4
commit
5504dfa7da
@ -6,6 +6,10 @@ variables:
|
||||
linux-pool: 'PrLin-2020-05-07'
|
||||
|
||||
jobs:
|
||||
- template: windows/run-tests.yml
|
||||
parameters:
|
||||
poolName: $(windows-pool)
|
||||
|
||||
- template: windows/azure-pipelines.yml
|
||||
parameters:
|
||||
triplet: x86-windows
|
||||
|
@ -24,6 +24,9 @@ jobs:
|
||||
displayName: 'Build vcpkg'
|
||||
inputs:
|
||||
filePath: bootstrap-vcpkg.sh
|
||||
arguments: "-buildTests"
|
||||
- bash: toolsrc/build.rel/vcpkg-test
|
||||
displayName: 'Run vcpkg tests'
|
||||
- powershell: |
|
||||
$skipList = ./scripts/azure-pipelines/generate-skip-list.ps1 -Triplet "x64-linux" -BaselineFile "$(System.DefaultWorkingDirectory)/scripts/ci.baseline.txt"
|
||||
mkdir $(System.ArtifactsDirectory)/xml-results
|
||||
|
@ -30,7 +30,9 @@ jobs:
|
||||
displayName: 'Build vcpkg'
|
||||
inputs:
|
||||
filePath: bootstrap-vcpkg.sh
|
||||
arguments: '-allowAppleClang'
|
||||
arguments: '-buildTests'
|
||||
- bash: toolsrc/build.rel/vcpkg-test
|
||||
displayName: 'Run vcpkg tests'
|
||||
- powershell: |
|
||||
$skip_list = ./scripts/azure-pipelines/generate-skip-list.ps1 -Triplet "x64-osx" -BaselineFile "$(System.DefaultWorkingDirectory)/scripts/ci.baseline.txt"
|
||||
mkdir $(System.ArtifactsDirectory)/xml-results
|
||||
|
25
scripts/azure-pipelines/windows/run-tests.yml
Normal file
25
scripts/azure-pipelines/windows/run-tests.yml
Normal file
@ -0,0 +1,25 @@
|
||||
# Copyright (c) Microsoft Corporation.
|
||||
# SPDX-License-Identifier: MIT
|
||||
#
|
||||
# Builds and runs vcpkg-test.exe for PRs and CIs.
|
||||
|
||||
jobs:
|
||||
- job: windows_tests
|
||||
pool:
|
||||
name: ${{ parameters.poolName }}
|
||||
steps:
|
||||
- task: CmdLine@2
|
||||
displayName: "Build and Test vcpkg"
|
||||
inputs:
|
||||
script: |
|
||||
:: TRANSITION, get these tools on the VMs next time we roll them
|
||||
call .\bootstrap-vcpkg.bat
|
||||
.\vcpkg.exe fetch cmake
|
||||
.\vcpkg.exe fetch ninja
|
||||
set PATH=downloads\tools\cmake-3.14.0-windows\cmake-3.14.0-win32-x86\bin;downloads\tools\ninja-1.10.0-windows;%PATH%
|
||||
call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\Common7\Tools\VsDevCmd.bat" -arch=x86 -host_arch=x86
|
||||
rmdir /s /q build.x86.debug > nul 2> nul
|
||||
cmake.exe -G Ninja -DCMAKE_BUILD_TYPE=Debug -DBUILD_TESTING=ON -DVCPKG_DEVELOPMENT_WARNINGS=ON -DVCPKG_WARNINGS_AS_ERRORS=ON -DVCPKG_BUILD_FUZZING=ON -B build.x86.debug -S toolsrc
|
||||
ninja.exe -C build.x86.debug
|
||||
build.x86.debug\vcpkg-test.exe
|
||||
failOnStderr: true
|
@ -18,6 +18,7 @@ fi
|
||||
vcpkgDisableMetrics="OFF"
|
||||
vcpkgUseSystem=false
|
||||
vcpkgAllowAppleClang=false
|
||||
vcpkgBuildTests="OFF"
|
||||
for var in "$@"
|
||||
do
|
||||
if [ "$var" = "-disableMetrics" -o "$var" = "--disableMetrics" ]; then
|
||||
@ -26,6 +27,8 @@ do
|
||||
vcpkgUseSystem=true
|
||||
elif [ "$var" = "-allowAppleClang" -o "$var" = "--allowAppleClang" ]; then
|
||||
vcpkgAllowAppleClang=true
|
||||
elif [ "$var" = "-buildTests" ]; then
|
||||
vcpkgBuildTests="ON"
|
||||
elif [ "$var" = "-help" -o "$var" = "--help" ]; then
|
||||
echo "Usage: ./bootstrap-vcpkg.sh [options]"
|
||||
echo
|
||||
@ -240,7 +243,7 @@ buildDir="$vcpkgRootDir/toolsrc/build.rel"
|
||||
rm -rf "$buildDir"
|
||||
mkdir -p "$buildDir"
|
||||
|
||||
(cd "$buildDir" && CXX="$CXX" "$cmakeExe" .. -DCMAKE_BUILD_TYPE=Release -G "Ninja" "-DCMAKE_MAKE_PROGRAM=$ninjaExe" "-DBUILD_TESTING=OFF" "-DVCPKG_DEVELOPMENT_WARNINGS=OFF" "-DVCPKG_DISABLE_METRICS=$vcpkgDisableMetrics" "-DVCPKG_ALLOW_APPLE_CLANG=$vcpkgAllowAppleClang") || exit 1
|
||||
(cd "$buildDir" && CXX="$CXX" "$cmakeExe" .. -DCMAKE_BUILD_TYPE=Release -G "Ninja" "-DCMAKE_MAKE_PROGRAM=$ninjaExe" "-DBUILD_TESTING=$vcpkgBuildTests" "-DVCPKG_DEVELOPMENT_WARNINGS=OFF" "-DVCPKG_DISABLE_METRICS=$vcpkgDisableMetrics" "-DVCPKG_ALLOW_APPLE_CLANG=$vcpkgAllowAppleClang") || exit 1
|
||||
(cd "$buildDir" && "$cmakeExe" --build .) || exit 1
|
||||
|
||||
rm -rf "$vcpkgRootDir/vcpkg"
|
||||
|
@ -51,7 +51,7 @@ if(MSVC)
|
||||
if(VCPKG_DEVELOPMENT_WARNINGS)
|
||||
string(REGEX REPLACE "[-/]W[0-4]" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
|
||||
|
||||
add_compile_options(-W4)
|
||||
add_compile_options(-W4 -analyze)
|
||||
if(VCPKG_COMPILER STREQUAL "clang")
|
||||
add_compile_options(-Wmissing-prototypes -Wno-missing-field-initializers)
|
||||
endif()
|
||||
|
@ -11282,10 +11282,10 @@ namespace Catch {
|
||||
|
||||
Capturer::Capturer( StringRef macroName, SourceLineInfo const& lineInfo, ResultWas::OfType resultType, StringRef names ) {
|
||||
auto trimmed = [&] (size_t start, size_t end) {
|
||||
while (names[start] == ',' || isspace(names[start])) {
|
||||
while (names[start] == ',' || isspace(static_cast<unsigned char>(names[start]))) {
|
||||
++start;
|
||||
}
|
||||
while (names[end] == ',' || isspace(names[end])) {
|
||||
while (names[end] == ',' || isspace(static_cast<unsigned char>(names[end]))) {
|
||||
--end;
|
||||
}
|
||||
return names.substr(start, end - start + 1);
|
||||
|
@ -1,6 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include <vcpkg/pragmas.h>
|
||||
#include <vcpkg/base/pragmas.h>
|
||||
|
||||
#if defined(_WIN32)
|
||||
#define NOMINMAX
|
||||
|
@ -1,5 +1,5 @@
|
||||
#include <catch2/catch.hpp>
|
||||
#include <vcpkg/pragmas.h>
|
||||
#include <vcpkg/base/pragmas.h>
|
||||
|
||||
#include <vcpkg/base/files.h>
|
||||
#include <vcpkg/statusparagraph.h>
|
||||
|
@ -5,9 +5,9 @@
|
||||
#include <vcpkg/base/parse.h>
|
||||
#include <vcpkg/base/stringview.h>
|
||||
|
||||
#include <functional>
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
@ -148,11 +148,6 @@ namespace vcpkg::Json
|
||||
return this->underlying_[idx];
|
||||
}
|
||||
|
||||
void sort(const std::function<bool(const Value&, const Value&)>& lt)
|
||||
{
|
||||
std::sort(this->begin(), this->end(), std::ref(lt));
|
||||
}
|
||||
|
||||
Array clone() const noexcept;
|
||||
|
||||
iterator begin() { return underlying_.begin(); }
|
||||
@ -205,8 +200,6 @@ namespace vcpkg::Json
|
||||
|
||||
std::size_t size() const noexcept { return this->underlying_.size(); }
|
||||
|
||||
void sort_keys(const std::function<bool(StringView, StringView)>& lt) noexcept;
|
||||
|
||||
Object clone() const noexcept;
|
||||
|
||||
struct const_iterator
|
||||
|
@ -1,5 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <vcpkg/base/pragmas.h>
|
||||
|
||||
#include <vcpkg/base/lineinfo.h>
|
||||
|
||||
#include <type_traits>
|
||||
@ -19,9 +21,7 @@ namespace vcpkg
|
||||
template<class T, bool B = std::is_copy_constructible<T>::value>
|
||||
struct OptionalStorage
|
||||
{
|
||||
#if defined(_WIN32)
|
||||
#pragma warning(suppress : 26495)
|
||||
#endif
|
||||
VCPKG_MSVC_WARNING(suppress : 26495)
|
||||
constexpr OptionalStorage() noexcept : m_is_present(false), m_inactive() {}
|
||||
constexpr OptionalStorage(const T& t) : m_is_present(true), m_t(t) {}
|
||||
constexpr OptionalStorage(T&& t) : m_is_present(true), m_t(std::move(t)) {}
|
||||
@ -31,17 +31,13 @@ namespace vcpkg
|
||||
if (m_is_present) m_t.~T();
|
||||
}
|
||||
|
||||
#if defined(_WIN32)
|
||||
#pragma warning(suppress : 26495)
|
||||
#endif
|
||||
VCPKG_MSVC_WARNING(suppress : 26495)
|
||||
OptionalStorage(const OptionalStorage& o) : m_is_present(o.m_is_present), m_inactive()
|
||||
{
|
||||
if (m_is_present) new (&m_t) T(o.m_t);
|
||||
}
|
||||
|
||||
#if defined(_WIN32)
|
||||
#pragma warning(suppress : 26495)
|
||||
#endif
|
||||
VCPKG_MSVC_WARNING(suppress : 26495)
|
||||
OptionalStorage(OptionalStorage&& o) noexcept : m_is_present(o.m_is_present), m_inactive()
|
||||
{
|
||||
if (m_is_present)
|
||||
@ -109,9 +105,7 @@ namespace vcpkg
|
||||
template<class T>
|
||||
struct OptionalStorage<T, false>
|
||||
{
|
||||
#if defined(_WIN32)
|
||||
#pragma warning(suppress : 26495)
|
||||
#endif
|
||||
VCPKG_MSVC_WARNING(suppress : 26495)
|
||||
constexpr OptionalStorage() noexcept : m_is_present(false), m_inactive() {}
|
||||
constexpr OptionalStorage(T&& t) : m_is_present(true), m_t(std::move(t)) {}
|
||||
|
||||
@ -120,9 +114,7 @@ namespace vcpkg
|
||||
if (m_is_present) m_t.~T();
|
||||
}
|
||||
|
||||
#if defined(_WIN32)
|
||||
#pragma warning(suppress : 26495)
|
||||
#endif
|
||||
VCPKG_MSVC_WARNING(suppress : 26495)
|
||||
OptionalStorage(OptionalStorage&& o) noexcept : m_is_present(o.m_is_present), m_inactive()
|
||||
{
|
||||
if (m_is_present)
|
||||
|
@ -14,3 +14,19 @@
|
||||
// [[nodiscard]] is not recognized before GCC version 7
|
||||
#pragma GCC diagnostic ignored "-Wattributes"
|
||||
#endif
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
#include <sal.h>
|
||||
#endif
|
||||
|
||||
#ifndef _Analysis_assume_
|
||||
#define _Analysis_assume_(...)
|
||||
#endif
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#define VCPKG_MSVC_WARNING(...) __pragma(warning(__VA_ARGS__))
|
||||
#define GCC_DIAGNOSTIC(...)
|
||||
#else
|
||||
#define VCPKG_MSVC_WARNING(...)
|
||||
#define GCC_DIAGNOSTIC(...) _Pragma("diagnostic " #__VA_ARGS__)
|
||||
#endif
|
@ -1,11 +1,12 @@
|
||||
#pragma once
|
||||
|
||||
#include <vcpkg/base/pragmas.h>
|
||||
|
||||
#include <vcpkg/base/cstringview.h>
|
||||
#include <vcpkg/base/optional.h>
|
||||
#include <vcpkg/base/stringliteral.h>
|
||||
#include <vcpkg/base/stringview.h>
|
||||
#include <vcpkg/base/view.h>
|
||||
#include <vcpkg/pragmas.h>
|
||||
|
||||
#include <vector>
|
||||
|
||||
|
@ -10,6 +10,7 @@
|
||||
#include <vcpkg/vcpkgpaths.h>
|
||||
|
||||
#include <functional>
|
||||
#include <map>
|
||||
#include <vector>
|
||||
|
||||
namespace vcpkg::Graphs
|
||||
@ -50,7 +51,7 @@ namespace vcpkg::Dependencies
|
||||
InstallPlanAction(const PackageSpec& spec,
|
||||
const SourceControlFileLocation& scfl,
|
||||
const RequestType& request_type,
|
||||
std::unordered_map<std::string, std::vector<FeatureSpec>>&& dependencies);
|
||||
std::map<std::string, std::vector<FeatureSpec>>&& dependencies);
|
||||
|
||||
std::string displayname() const;
|
||||
const std::string& public_abi() const;
|
||||
@ -64,7 +65,7 @@ namespace vcpkg::Dependencies
|
||||
RequestType request_type;
|
||||
Build::BuildPackageOptions build_options;
|
||||
|
||||
std::unordered_map<std::string, std::vector<FeatureSpec>> feature_dependencies;
|
||||
std::map<std::string, std::vector<FeatureSpec>> feature_dependencies;
|
||||
std::vector<PackageSpec> package_dependencies;
|
||||
std::vector<std::string> feature_list;
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
#include <vcpkg/binaryparagraph.h>
|
||||
|
||||
#include <unordered_map>
|
||||
#include <map>
|
||||
|
||||
namespace vcpkg
|
||||
{
|
||||
@ -56,7 +56,7 @@ namespace vcpkg
|
||||
|
||||
const PackageSpec& spec() const { return core->package.spec; }
|
||||
std::vector<PackageSpec> dependencies() const;
|
||||
std::unordered_map<std::string, std::vector<FeatureSpec>> feature_dependencies() const;
|
||||
std::map<std::string, std::vector<FeatureSpec>> feature_dependencies() const;
|
||||
|
||||
const StatusParagraph* core;
|
||||
std::vector<const StatusParagraph*> features;
|
||||
|
@ -369,9 +369,8 @@ TEST_CASE ("basic feature test 7", "[plan]")
|
||||
remove_plan_check(plan.remove_actions.at(0), "x");
|
||||
remove_plan_check(plan.remove_actions.at(1), "b");
|
||||
|
||||
// TODO: order here may change but A < X, and B anywhere
|
||||
features_check(plan.install_actions.at(0), "b", {"core", "b1"});
|
||||
features_check(plan.install_actions.at(1), "a", {"core"});
|
||||
features_check(plan.install_actions.at(0), "a", {"core"});
|
||||
features_check(plan.install_actions.at(1), "b", {"core", "b1"});
|
||||
features_check(plan.install_actions.at(2), "x", {"core"});
|
||||
}
|
||||
|
||||
|
@ -1,3 +1,4 @@
|
||||
#define _POSIX_C_SOURCE 200112L
|
||||
#include <catch2/catch.hpp>
|
||||
|
||||
#include <string>
|
||||
@ -27,7 +28,7 @@ using vcpkg::System::CPUArchitecture;
|
||||
|
||||
namespace
|
||||
{
|
||||
void set_environment_variable(StringView varname, Optional<std::string> value)
|
||||
void set_environment_variable(ZStringView varname, Optional<std::string> value)
|
||||
{
|
||||
#if defined(_WIN32)
|
||||
const auto w_varname = vcpkg::Strings::to_utf16(varname);
|
||||
@ -45,19 +46,14 @@ namespace
|
||||
|
||||
check_exit(VCPKG_LINE_INFO, exit_code != 0);
|
||||
#else // ^^^ defined(_WIN32) / !defined(_WIN32) vvv
|
||||
std::string tmp;
|
||||
tmp.append(varname.data(), varname.size());
|
||||
tmp.push_back('=');
|
||||
if (auto v = value.get())
|
||||
{
|
||||
tmp.append(*v);
|
||||
check_exit(VCPKG_LINE_INFO, setenv(varname.c_str(), v->c_str(), 1) == 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
check_exit(VCPKG_LINE_INFO, unsetenv(varname.c_str()) == 0);
|
||||
}
|
||||
|
||||
// putenv expects the string to never go out of scope
|
||||
char* env_string = new char[tmp.size() + 1]; // overflow checked by tmp's null allocation
|
||||
memcpy(env_string, tmp.data(), tmp.size());
|
||||
const int exit_code = putenv(env_string);
|
||||
check_exit(VCPKG_LINE_INFO, exit_code == 0);
|
||||
#endif // defined(_WIN32)
|
||||
}
|
||||
|
||||
|
@ -126,7 +126,7 @@ namespace vcpkg::Test
|
||||
if (status == ERROR_SUCCESS && data == 1) {
|
||||
return AllowSymlinks::Yes;
|
||||
} else {
|
||||
std::clog << "Symlinks are not allowed on this system\n";
|
||||
std::cout << "Symlinks are not allowed on this system\n";
|
||||
return AllowSymlinks::No;
|
||||
}
|
||||
#endif
|
||||
|
@ -1,14 +1,7 @@
|
||||
#if defined(_MSC_VER) && _MSC_VER < 1911
|
||||
// [[nodiscard]] is not recognized before VS 2017 version 15.3
|
||||
#pragma warning(disable : 5030)
|
||||
#endif
|
||||
|
||||
#if defined(__GNUC__) && __GNUC__ < 7
|
||||
// [[nodiscard]] is not recognized before GCC version 7
|
||||
#pragma GCC diagnostic ignored "-Wattributes"
|
||||
#endif
|
||||
#include <vcpkg/base/pragmas.h>
|
||||
|
||||
#if defined(_WIN32)
|
||||
#define NOMINMAX
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#include <Windows.h>
|
||||
|
||||
|
@ -33,6 +33,7 @@ namespace vcpkg::Downloads
|
||||
url_path,
|
||||
target_file_path,
|
||||
std::to_string(err));
|
||||
_Analysis_assume_(f != nullptr);
|
||||
|
||||
auto hSession = WinHttpOpen(L"vcpkg/1.0",
|
||||
IsWindows8Point1OrGreater() ? WINHTTP_ACCESS_TYPE_AUTOMATIC_PROXY
|
||||
|
@ -73,7 +73,7 @@ namespace vcpkg::Files
|
||||
constexpr auto all_write = perms::group_write | perms::owner_write | perms::others_write;
|
||||
permissions = perms::all & ~all_write;
|
||||
}
|
||||
else if (ft != file_type::none && ft != file_type::none)
|
||||
else if (ft != file_type::none)
|
||||
{
|
||||
permissions = perms::all;
|
||||
}
|
||||
|
@ -7,7 +7,7 @@
|
||||
namespace vcpkg::Strings::details
|
||||
{
|
||||
// To disambiguate between two overloads
|
||||
static bool is_space(const char c) { return std::isspace(c) != 0; }
|
||||
static bool is_space(const char c) { return std::isspace(static_cast<unsigned char>(c)) != 0; }
|
||||
|
||||
// Avoids C4244 warnings because of char<->int conversion that occur when using std::tolower()
|
||||
static char tolower_char(const char c) { return (c < 'A' || c > 'Z') ? c : c - 'A' + 'a'; }
|
||||
|
@ -30,7 +30,7 @@ namespace vcpkg
|
||||
{
|
||||
struct CtrlCStateMachine
|
||||
{
|
||||
CtrlCStateMachine() : m_number_of_external_processes(0), m_global_job(NULL), m_in_interactive(0) {}
|
||||
CtrlCStateMachine() : m_number_of_external_processes(0), m_global_job(NULL), m_in_interactive(0) { }
|
||||
|
||||
void transition_to_spawn_process() noexcept
|
||||
{
|
||||
@ -327,27 +327,45 @@ namespace vcpkg
|
||||
#if defined(_WIN32)
|
||||
struct ProcessInfo
|
||||
{
|
||||
constexpr ProcessInfo() : proc_info{} {}
|
||||
|
||||
unsigned int wait_and_close_handles()
|
||||
constexpr ProcessInfo() noexcept : proc_info{} { }
|
||||
ProcessInfo(ProcessInfo&& other) noexcept : proc_info(other.proc_info)
|
||||
{
|
||||
CloseHandle(proc_info.hThread);
|
||||
|
||||
const DWORD result = WaitForSingleObject(proc_info.hProcess, INFINITE);
|
||||
Checks::check_exit(VCPKG_LINE_INFO, result != WAIT_FAILED, "WaitForSingleObject failed");
|
||||
|
||||
DWORD exit_code = 0;
|
||||
GetExitCodeProcess(proc_info.hProcess, &exit_code);
|
||||
|
||||
CloseHandle(proc_info.hProcess);
|
||||
|
||||
return exit_code;
|
||||
other.proc_info.hProcess = nullptr;
|
||||
other.proc_info.hThread = nullptr;
|
||||
}
|
||||
~ProcessInfo()
|
||||
{
|
||||
if (proc_info.hThread)
|
||||
{
|
||||
CloseHandle(proc_info.hThread);
|
||||
}
|
||||
if (proc_info.hProcess)
|
||||
{
|
||||
CloseHandle(proc_info.hProcess);
|
||||
}
|
||||
}
|
||||
|
||||
void close_handles()
|
||||
ProcessInfo& operator=(ProcessInfo&& other) noexcept
|
||||
{
|
||||
CloseHandle(proc_info.hThread);
|
||||
CloseHandle(proc_info.hProcess);
|
||||
ProcessInfo{std::move(other)}.swap(*this);
|
||||
return *this;
|
||||
}
|
||||
|
||||
void swap(ProcessInfo& other) noexcept
|
||||
{
|
||||
std::swap(proc_info.hProcess, other.proc_info.hProcess);
|
||||
std::swap(proc_info.hThread, other.proc_info.hThread);
|
||||
}
|
||||
|
||||
friend void swap(ProcessInfo& lhs, ProcessInfo& rhs) noexcept { lhs.swap(rhs); }
|
||||
|
||||
unsigned int wait()
|
||||
{
|
||||
const DWORD result = WaitForSingleObject(proc_info.hProcess, INFINITE);
|
||||
Checks::check_exit(VCPKG_LINE_INFO, result != WAIT_FAILED, "WaitForSingleObject failed");
|
||||
DWORD exit_code = 0;
|
||||
GetExitCodeProcess(proc_info.hProcess, &exit_code);
|
||||
return exit_code;
|
||||
}
|
||||
|
||||
PROCESS_INFORMATION proc_info;
|
||||
@ -365,16 +383,23 @@ namespace vcpkg
|
||||
|
||||
// Flush stdout before launching external process
|
||||
fflush(nullptr);
|
||||
bool succeeded = TRUE == CreateProcessW(nullptr,
|
||||
Strings::to_utf16(cmd_line).data(),
|
||||
nullptr,
|
||||
nullptr,
|
||||
TRUE,
|
||||
IDLE_PRIORITY_CLASS | CREATE_UNICODE_ENVIRONMENT | dwCreationFlags,
|
||||
(void*)(env.m_env_data.empty() ? nullptr : env.m_env_data.data()),
|
||||
nullptr,
|
||||
&startup_info,
|
||||
&process_info.proc_info);
|
||||
|
||||
VCPKG_MSVC_WARNING(suppress : 6335) // Leaking process information handle 'process_info.proc_info.hProcess'
|
||||
// /analyze can't tell that we transferred ownership here
|
||||
bool succeeded =
|
||||
TRUE == CreateProcessW(nullptr,
|
||||
Strings::to_utf16(cmd_line).data(),
|
||||
nullptr,
|
||||
nullptr,
|
||||
TRUE,
|
||||
IDLE_PRIORITY_CLASS | CREATE_UNICODE_ENVIRONMENT | dwCreationFlags,
|
||||
env.m_env_data.empty()
|
||||
? nullptr
|
||||
: const_cast<void*>(static_cast<const void*>(env.m_env_data.data())),
|
||||
nullptr,
|
||||
&startup_info,
|
||||
&process_info.proc_info);
|
||||
|
||||
if (succeeded)
|
||||
return process_info;
|
||||
else
|
||||
@ -413,7 +438,7 @@ namespace vcpkg
|
||||
|
||||
CloseHandle(child_stdout);
|
||||
|
||||
return proc_info.wait_and_close_handles();
|
||||
return proc_info.wait();
|
||||
}
|
||||
};
|
||||
|
||||
@ -467,11 +492,7 @@ namespace vcpkg
|
||||
auto timer = Chrono::ElapsedTimer::create_started();
|
||||
|
||||
auto process_info = windows_create_process(cmd_line, {}, DETACHED_PROCESS | CREATE_BREAKAWAY_FROM_JOB);
|
||||
if (auto p = process_info.get())
|
||||
{
|
||||
p->close_handles();
|
||||
}
|
||||
else
|
||||
if (!process_info.get())
|
||||
{
|
||||
Debug::print("cmd_execute_no_wait() failed with error code ", process_info.error(), "\n");
|
||||
}
|
||||
@ -523,7 +544,7 @@ namespace vcpkg
|
||||
auto proc_info = windows_create_process(cmd_line, env, NULL);
|
||||
auto long_exit_code = [&]() -> unsigned long {
|
||||
if (auto p = proc_info.get())
|
||||
return p->wait_and_close_handles();
|
||||
return p->wait();
|
||||
else
|
||||
return proc_info.error();
|
||||
}();
|
||||
@ -646,6 +667,6 @@ namespace vcpkg
|
||||
SetConsoleCtrlHandler(reinterpret_cast<PHANDLER_ROUTINE>(ctrl_handler), TRUE);
|
||||
}
|
||||
#else
|
||||
void System::register_console_ctrl_handler() {}
|
||||
void System::register_console_ctrl_handler() { }
|
||||
#endif
|
||||
}
|
||||
|
@ -288,12 +288,12 @@ ExpectedS<std::unique_ptr<IBinaryProvider>> vcpkg::create_binary_provider_from_c
|
||||
auto n = match_until([](char32_t ch) { return ch == ',' || ch == '`' || ch == ';'; });
|
||||
Strings::append(segment, n);
|
||||
auto ch = cur();
|
||||
if (ch == '\0' || ch == ',' || ch == ';')
|
||||
if (ch == Unicode::end_of_file || ch == ',' || ch == ';')
|
||||
break;
|
||||
else if (ch == '`')
|
||||
{
|
||||
ch = next();
|
||||
if (ch == '\0')
|
||||
if (ch == Unicode::end_of_file)
|
||||
add_error("unexpected eof: trailing unescaped backticks (`) are not allowed");
|
||||
else
|
||||
Unicode::utf8_append_code_point(segment, ch);
|
||||
@ -305,7 +305,7 @@ ExpectedS<std::unique_ptr<IBinaryProvider>> vcpkg::create_binary_provider_from_c
|
||||
segments.emplace_back(std::move(loc), std::move(segment));
|
||||
|
||||
auto ch = cur();
|
||||
if (ch == '\0' || ch == ';')
|
||||
if (ch == Unicode::end_of_file || ch == ';')
|
||||
break;
|
||||
else if (ch == ',')
|
||||
{
|
||||
|
@ -89,9 +89,11 @@ namespace vcpkg
|
||||
, version(spgh.version)
|
||||
, description(spgh.description)
|
||||
, maintainer(spgh.maintainer)
|
||||
, feature()
|
||||
, default_features(spgh.default_features)
|
||||
, depends()
|
||||
, abi(abi_tag)
|
||||
, type(spgh.type)
|
||||
, default_features(spgh.default_features)
|
||||
{
|
||||
this->depends = Util::fmap(deps, [](const FeatureSpec& spec) { return spec.spec().name(); });
|
||||
Util::sort_unique_erase(this->depends);
|
||||
@ -106,8 +108,10 @@ namespace vcpkg
|
||||
, description(fpgh.description)
|
||||
, maintainer()
|
||||
, feature(fpgh.name)
|
||||
, type(spgh.type)
|
||||
, default_features()
|
||||
, depends()
|
||||
, abi()
|
||||
, type(spgh.type)
|
||||
{
|
||||
this->depends = Util::fmap(deps, [](const FeatureSpec& spec) { return spec.spec().name(); });
|
||||
Util::sort_unique_erase(this->depends);
|
||||
|
@ -90,6 +90,7 @@ namespace vcpkg::Build::Command
|
||||
}
|
||||
|
||||
Checks::check_exit(VCPKG_LINE_INFO, action != nullptr);
|
||||
_Analysis_assume_(action != nullptr);
|
||||
|
||||
action->build_options = build_package_options;
|
||||
|
||||
@ -149,6 +150,7 @@ namespace vcpkg::Build::Command
|
||||
const auto* scfl = provider.get_control_file(port_name).get();
|
||||
|
||||
Checks::check_exit(VCPKG_LINE_INFO, scfl != nullptr, "Error: Couldn't find port '%s'", port_name);
|
||||
_Analysis_assume_(scfl != nullptr);
|
||||
|
||||
perform_and_exit_ex(spec, *scfl, provider, *binaryprovider, paths);
|
||||
}
|
||||
|
@ -79,7 +79,7 @@ namespace vcpkg::Commands::Integrate
|
||||
dir_id.erase(1, 1); // Erasing the ":"
|
||||
|
||||
// NuGet id cannot have invalid characters. We will only use alphanumeric and dot.
|
||||
Util::erase_remove_if(dir_id, [](char c) { return !isalnum(c) && (c != '.'); });
|
||||
Util::erase_remove_if(dir_id, [](char c) { return !isalnum(static_cast<unsigned char>(c)) && (c != '.'); });
|
||||
|
||||
const std::string nuget_id = "vcpkg." + dir_id;
|
||||
return nuget_id;
|
||||
|
@ -39,7 +39,7 @@ namespace vcpkg::Dependencies
|
||||
|
||||
struct ClusterInstallInfo
|
||||
{
|
||||
std::unordered_map<std::string, std::vector<FeatureSpec>> build_edges;
|
||||
std::map<std::string, std::vector<FeatureSpec>> build_edges;
|
||||
bool defaults_requested = false;
|
||||
};
|
||||
|
||||
@ -294,7 +294,7 @@ namespace vcpkg::Dependencies
|
||||
auto end() const { return m_graph.end(); }
|
||||
|
||||
private:
|
||||
std::unordered_map<PackageSpec, Cluster> m_graph;
|
||||
std::map<PackageSpec, Cluster> m_graph;
|
||||
const PortFileProvider::PortFileProvider& m_port_provider;
|
||||
};
|
||||
|
||||
@ -352,7 +352,7 @@ namespace vcpkg::Dependencies
|
||||
InstallPlanAction::InstallPlanAction(const PackageSpec& spec,
|
||||
const SourceControlFileLocation& scfl,
|
||||
const RequestType& request_type,
|
||||
std::unordered_map<std::string, std::vector<FeatureSpec>>&& dependencies)
|
||||
std::map<std::string, std::vector<FeatureSpec>>&& dependencies)
|
||||
: spec(spec)
|
||||
, source_control_file_location(scfl)
|
||||
, plan_type(InstallPlanType::BUILD_AND_INSTALL)
|
||||
@ -857,7 +857,7 @@ namespace vcpkg::Dependencies
|
||||
{
|
||||
auto&& scfl = p_cluster->m_scfl;
|
||||
|
||||
std::unordered_map<std::string, std::vector<FeatureSpec>> computed_edges;
|
||||
std::map<std::string, std::vector<FeatureSpec>> computed_edges;
|
||||
for (auto&& kv : info_ptr->build_edges)
|
||||
{
|
||||
std::set<FeatureSpec> fspecs;
|
||||
|
@ -248,7 +248,7 @@ namespace vcpkg::Metrics
|
||||
;
|
||||
static bool g_should_print_metrics = false;
|
||||
|
||||
bool get_compiled_metrics_enabled() { return VCPKG_DISABLE_METRICS == 0; }
|
||||
bool get_compiled_metrics_enabled() { return !VCPKG_DISABLE_METRICS; }
|
||||
|
||||
std::string get_MAC_user()
|
||||
{
|
||||
|
@ -86,11 +86,11 @@ namespace vcpkg
|
||||
}
|
||||
}
|
||||
|
||||
std::unordered_map<std::string, std::vector<FeatureSpec>> InstalledPackageView::feature_dependencies() const
|
||||
std::map<std::string, std::vector<FeatureSpec>> InstalledPackageView::feature_dependencies() const
|
||||
{
|
||||
auto extract_deps = [&](const std::string& name) { return FeatureSpec{{name, spec().triplet()}, "core"}; };
|
||||
|
||||
std::unordered_map<std::string, std::vector<FeatureSpec>> deps;
|
||||
std::map<std::string, std::vector<FeatureSpec>> deps;
|
||||
|
||||
deps.emplace("core", Util::fmap(core->package.depends, extract_deps));
|
||||
|
||||
|
@ -158,6 +158,7 @@
|
||||
<ClInclude Include="..\include\vcpkg\base\lineinfo.h" />
|
||||
<ClInclude Include="..\include\vcpkg\base\machinetype.h" />
|
||||
<ClInclude Include="..\include\vcpkg\base\parse.h" />
|
||||
<ClInclude Include="..\include\vcpkg\base\pragmas.h" />
|
||||
<ClInclude Include="..\include\vcpkg\base\optional.h" />
|
||||
<ClInclude Include="..\include\vcpkg\base\sortedvector.h" />
|
||||
<ClInclude Include="..\include\vcpkg\base\span.h" />
|
||||
@ -196,7 +197,6 @@
|
||||
<ClInclude Include="..\include\vcpkg\portfileprovider.h" />
|
||||
<ClInclude Include="..\include\vcpkg\postbuildlint.h" />
|
||||
<ClInclude Include="..\include\vcpkg\postbuildlint.buildtype.h" />
|
||||
<ClInclude Include="..\include\vcpkg\pragmas.h" />
|
||||
<ClInclude Include="..\include\vcpkg\remove.h" />
|
||||
<ClInclude Include="..\include\vcpkg\sourceparagraph.h" />
|
||||
<ClInclude Include="..\include\vcpkg\statusparagraph.h" />
|
||||
|
@ -422,6 +422,9 @@
|
||||
<ClInclude Include="..\include\vcpkg\base\view.h">
|
||||
<Filter>Header Files\vcpkg\base</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\include\vcpkg\base\pragmas.h">
|
||||
<Filter>Header Files\vcpkg\base</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\include\vcpkg\base\zstringview.h">
|
||||
<Filter>Header Files\vcpkg\base</Filter>
|
||||
</ClInclude>
|
||||
@ -440,9 +443,6 @@
|
||||
<ClInclude Include="..\include\vcpkg\portfileprovider.h">
|
||||
<Filter>Header Files\vcpkg</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\include\vcpkg\pragmas.h">
|
||||
<Filter>Header Files\vcpkg</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\include\vcpkg\textrowcol.h">
|
||||
<Filter>Header Files\vcpkg</Filter>
|
||||
</ClInclude>
|
||||
|
Loading…
x
Reference in New Issue
Block a user