[vcpkg] Format the C++ in CI (#11655)

* [vcpkg] Format the C++ in the CI

* format the C++

* CR
This commit is contained in:
nicole mazzuca 2020-07-06 16:45:34 -07:00 committed by GitHub
parent ae4968fad4
commit 6a41626eaf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
119 changed files with 634 additions and 513 deletions

View File

@ -20,6 +20,12 @@ jobs:
condition: always() condition: always()
inputs: inputs:
filePath: 'scripts/azure-pipelines/windows/disk-space.ps1' filePath: 'scripts/azure-pipelines/windows/disk-space.ps1'
- task: Powershell@2
displayName: 'Check C++ Formatting'
condition: eq('${{ parameters.triplet }}', 'x86-windows')
inputs:
filePath: 'scripts/azure-pipelines/windows/check-formatting.ps1'
arguments: '-Toolsrc ./toolsrc'
# Note: D: is the Azure machines' temporary disk. # Note: D: is the Azure machines' temporary disk.
- task: CmdLine@2 - task: CmdLine@2
displayName: 'Build vcpkg' displayName: 'Build vcpkg'

View File

@ -0,0 +1,54 @@
[CmdletBinding()]
Param(
[Parameter(Mandatory=$True)]
[string]$Toolsrc,
[Parameter()]
[switch]$IgnoreErrors # allows one to just format
)
$clangFormat = 'C:\Program Files\LLVM\bin\clang-format.exe'
if (-not (Test-Path $clangFormat))
{
Write-Error "clang-format not found; is it installed in the CI machines?"
throw
}
$Toolsrc = Get-Item $Toolsrc
Push-Location $Toolsrc
try
{
$files = Get-ChildItem -Recurse -LiteralPath "$Toolsrc/src" -Filter '*.cpp'
$files += Get-ChildItem -Recurse -LiteralPath "$Toolsrc/include/vcpkg" -Filter '*.h'
$files += Get-ChildItem -Recurse -LiteralPath "$Toolsrc/include/vcpkg-test" -Filter '*.h'
$files += Get-Item "$Toolsrc/include/pch.h"
$fileNames = $files.FullName
& $clangFormat -style=file -i @fileNames
$changedFiles = git status --porcelain $Toolsrc | ForEach-Object {
(-split $_)[1]
}
if (-not $IgnoreErrors -and $null -ne $changedFiles)
{
$msg = @(
"",
"The formatting of the C++ files didn't match our expectation.",
"If your build fails here, you need to format the following files with:"
)
$msg += " $(& $clangFormat -version)"
$msg += " $changedFiles"
$msg += ""
$msg += "clang-format should produce the following diff:"
$msg += git diff $Toolsrc
Write-Error ($msg -join "`n")
throw
}
}
finally
{
Pop-Location
}

View File

@ -391,6 +391,30 @@ Function InstallLLVM {
} }
} }
<#
.SYNOPSIS
Installs LLVM.
.DESCRIPTION
InstallLLVM installs LLVM from the supplied URL.
.PARAMETER Url
The URL of the LLVM installer.
#>
Function InstallLLVM {
try {
Write-Host 'Downloading LLVM...'
[string]$installerPath = Get-TempFilePath -Extension 'exe'
curl.exe -L -o $installerPath -s -S $Url
Write-Host 'Installing LLVM...'
$proc = Start-Process -FilePath $installerPath -ArgumentList @('/S') -NoNewWindow -Wait -PassThru
PrintMsiExitCodeMessage $proc.ExitCode
}
catch {
Write-Error "Failed to install LLVM! $($_.Exception.Message)"
}
}
<# <#
.SYNOPSIS .SYNOPSIS
Installs MPI Installs MPI

View File

@ -1,4 +1,3 @@
---
BasedOnStyle: WebKit BasedOnStyle: WebKit
Language: Cpp Language: Cpp
Standard: Cpp11 Standard: Cpp11
@ -32,6 +31,19 @@ ForEachMacros: [TEST_CASE, SECTION]
PenaltyReturnTypeOnItsOwnLine: 1000 PenaltyReturnTypeOnItsOwnLine: 1000
SpaceAfterTemplateKeyword: false SpaceAfterTemplateKeyword: false
SpaceBeforeCpp11BracedList: false SpaceBeforeCpp11BracedList: false
UseCRLF: false
IncludeBlocks: Preserve IncludeBlocks: Regroup
SortIncludes: false IncludeCategories:
- Regex: '^(<vcpkg/base/system_headers\.h>|"pch\.h")$'
Priority: -1
- Regex: '^<catch2/catch\.hpp>$'
Priority: 1
- Regex: '^<vcpkg/base/*\.h>$'
Priority: 2
- Regex: '^<vcpkg/*\.h>$'
Priority: 3
- Regex: '^<[a-z0-9_]*\.h>$'
Priority: 4
- Regex: '^<[a-z0-9_]*>$' # C++ standard library
Priority: 5

View File

@ -1,8 +1,9 @@
#pragma once #pragma once
#include <vcpkg/base/pragmas.h>
#include <vcpkg/base/system_headers.h> #include <vcpkg/base/system_headers.h>
#include <vcpkg/base/pragmas.h>
#if defined(_WIN32) #if defined(_WIN32)
#include <process.h> #include <process.h>
#include <shellapi.h> #include <shellapi.h>
@ -49,9 +50,10 @@
#include <sys/time.h> #include <sys/time.h>
#endif #endif
#include <time.h>
#include <system_error> #include <system_error>
#include <thread> #include <thread>
#include <time.h>
#include <type_traits> #include <type_traits>
#include <unordered_map> #include <unordered_map>
#include <unordered_set> #include <unordered_set>

View File

@ -1,13 +1,13 @@
#include <vcpkg/base/system_headers.h> #include <vcpkg/base/system_headers.h>
#include <catch2/catch.hpp> #include <catch2/catch.hpp>
#include <vcpkg/base/pragmas.h>
#include <vcpkg/base/files.h>
#include <vcpkg/statusparagraph.h>
#include <memory> #include <memory>
#include <vcpkg/base/files.h>
#include <vcpkg/base/pragmas.h>
#include <vcpkg/statusparagraph.h>
#define CHECK_EC(ec) \ #define CHECK_EC(ec) \
do \ do \
{ \ { \

View File

@ -1,11 +1,11 @@
#pragma once #pragma once
#include <vcpkg/base/cstringview.h>
#include <vcpkg/base/optional.h>
#include <chrono> #include <chrono>
#include <string> #include <string>
#include <vcpkg/base/cstringview.h>
#include <vcpkg/base/optional.h>
namespace vcpkg::Chrono namespace vcpkg::Chrono
{ {
class ElapsedTime class ElapsedTime

View File

@ -1,10 +1,10 @@
#pragma once #pragma once
#include <vector>
#include <vcpkg/base/files.h> #include <vcpkg/base/files.h>
#include <vcpkg/base/machinetype.h> #include <vcpkg/base/machinetype.h>
#include <vector>
namespace vcpkg::CoffFileReader namespace vcpkg::CoffFileReader
{ {
struct DllInfo struct DllInfo

View File

@ -1,9 +1,9 @@
#pragma once #pragma once
#include <vcpkg/base/lineinfo.h>
#include <string> #include <string>
#include <vcpkg/base/lineinfo.h>
namespace vcpkg::Enums namespace vcpkg::Enums
{ {
std::string nullvalue_to_string(const CStringView enum_name); std::string nullvalue_to_string(const CStringView enum_name);

View File

@ -1,10 +1,10 @@
#pragma once #pragma once
#include <system_error>
#include <vcpkg/base/checks.h> #include <vcpkg/base/checks.h>
#include <vcpkg/base/stringliteral.h> #include <vcpkg/base/stringliteral.h>
#include <system_error>
namespace vcpkg namespace vcpkg
{ {
template<class Err> template<class Err>

View File

@ -1,9 +1,9 @@
#pragma once #pragma once
#include <vcpkg/base/files.h>
#include <string> #include <string>
#include <vcpkg/base/files.h>
namespace vcpkg::Hash namespace vcpkg::Hash
{ {
enum class Algorithm enum class Algorithm

View File

@ -1,17 +1,18 @@
#pragma once #pragma once
#include <stddef.h>
#include <stdint.h>
#include <memory>
#include <string>
#include <utility>
#include <vector>
#include <vcpkg/base/expected.h> #include <vcpkg/base/expected.h>
#include <vcpkg/base/files.h> #include <vcpkg/base/files.h>
#include <vcpkg/base/parse.h> #include <vcpkg/base/parse.h>
#include <vcpkg/base/stringview.h> #include <vcpkg/base/stringview.h>
#include <stddef.h>
#include <stdint.h>
#include <memory>
#include <string>
#include <utility>
#include <vector>
namespace vcpkg::Json namespace vcpkg::Json
{ {
struct JsonStyle struct JsonStyle

View File

@ -1,12 +1,11 @@
#pragma once #pragma once
#include <vcpkg/base/pragmas.h>
#include <vcpkg/base/lineinfo.h>
#include <type_traits> #include <type_traits>
#include <utility> #include <utility>
#include <vcpkg/base/lineinfo.h>
#include <vcpkg/base/pragmas.h>
namespace vcpkg namespace vcpkg
{ {
struct NullOpt struct NullOpt
@ -96,7 +95,8 @@ namespace vcpkg
} }
bool m_is_present; bool m_is_present;
union { union
{
char m_inactive; char m_inactive;
T m_t; T m_t;
}; };
@ -155,7 +155,8 @@ namespace vcpkg
} }
bool m_is_present; bool m_is_present;
union { union
{
char m_inactive; char m_inactive;
T m_t; T m_t;
}; };

View File

@ -1,14 +1,14 @@
#pragma once #pragma once
#include <memory>
#include <string>
#include <vcpkg/base/cstringview.h> #include <vcpkg/base/cstringview.h>
#include <vcpkg/base/optional.h> #include <vcpkg/base/optional.h>
#include <vcpkg/base/stringview.h> #include <vcpkg/base/stringview.h>
#include <vcpkg/base/unicode.h> #include <vcpkg/base/unicode.h>
#include <vcpkg/textrowcol.h> #include <vcpkg/textrowcol.h>
#include <memory>
#include <string>
namespace vcpkg::Parse namespace vcpkg::Parse
{ {
struct IParseError struct IParseError

View File

@ -1,6 +1,7 @@
#pragma once #pragma once
#include <string> #include <string>
#include <vcpkg/base/zstringview.h> #include <vcpkg/base/zstringview.h>
namespace vcpkg namespace vcpkg

View File

@ -1,19 +1,18 @@
#pragma once #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 <errno.h> #include <errno.h>
#include <inttypes.h> #include <inttypes.h>
#include <limits.h> #include <limits.h>
#include <vector> #include <vector>
#include <vcpkg/base/cstringview.h>
#include <vcpkg/base/optional.h>
#include <vcpkg/base/pragmas.h>
#include <vcpkg/base/stringliteral.h>
#include <vcpkg/base/stringview.h>
#include <vcpkg/base/view.h>
namespace vcpkg::Strings::details namespace vcpkg::Strings::details
{ {
template<class T> template<class T>

View File

@ -1,11 +1,11 @@
#pragma once #pragma once
#include <vcpkg/base/optional.h>
#include <limits> #include <limits>
#include <string> #include <string>
#include <vector> #include <vector>
#include <vcpkg/base/optional.h>
namespace vcpkg namespace vcpkg
{ {
struct StringView struct StringView

View File

@ -1,10 +1,10 @@
#pragma once #pragma once
#include <atomic>
#include <vcpkg/base/chrono.h> #include <vcpkg/base/chrono.h>
#include <vcpkg/base/system.print.h> #include <vcpkg/base/system.print.h>
#include <atomic>
namespace vcpkg::Debug namespace vcpkg::Debug
{ {
extern std::atomic<bool> g_debugging; extern std::atomic<bool> g_debugging;

View File

@ -1,13 +1,13 @@
#pragma once #pragma once
#include <vcpkg/base/files.h>
#include <vcpkg/base/zstringview.h>
#include <functional> #include <functional>
#include <string> #include <string>
#include <unordered_map> #include <unordered_map>
#include <vector> #include <vector>
#include <vcpkg/base/files.h>
#include <vcpkg/base/zstringview.h>
namespace vcpkg::System namespace vcpkg::System
{ {
struct CMakeVariable struct CMakeVariable

View File

@ -17,7 +17,8 @@
// ctermid is not behind an `extern "C"` barrier, so it's linked incorrectly. // ctermid is not behind an `extern "C"` barrier, so it's linked incorrectly.
// This has been reported; remove it after 2023-05-19 // This has been reported; remove it after 2023-05-19
#if __APPLE__ #if __APPLE__
extern "C" { extern "C"
{
#endif #endif
#include <unistd.h> #include <unistd.h>
@ -32,4 +33,3 @@ extern "C" {
// glibc defines major and minor in sys/types.h, and should not // glibc defines major and minor in sys/types.h, and should not
#undef major #undef major
#undef minor #undef minor

View File

@ -2,9 +2,10 @@
#include <stdint.h> #include <stdint.h>
namespace vcpkg { namespace vcpkg
{
struct UInt128 { struct UInt128
{
UInt128() = default; UInt128() = default;
UInt128(uint64_t value) : bottom(value), top(0) { } UInt128(uint64_t value) : bottom(value), top(0) { }
@ -12,12 +13,9 @@ struct UInt128 {
UInt128& operator>>=(int by) noexcept; UInt128& operator>>=(int by) noexcept;
UInt128& operator+=(uint64_t lhs) noexcept; UInt128& operator+=(uint64_t lhs) noexcept;
uint64_t bottom_64_bits() const noexcept { uint64_t bottom_64_bits() const noexcept { return bottom; }
return bottom; uint64_t top_64_bits() const noexcept { return top; }
}
uint64_t top_64_bits() const noexcept {
return top;
}
private: private:
uint64_t bottom; uint64_t bottom;
uint64_t top; uint64_t top;

View File

@ -1,11 +1,11 @@
#pragma once #pragma once
#include <vcpkg/base/checks.h>
#include <condition_variable> #include <condition_variable>
#include <memory> #include <memory>
#include <vector> #include <vector>
#include <vcpkg/base/checks.h>
namespace vcpkg namespace vcpkg
{ {
template<class Action> template<class Action>

View File

@ -1,6 +1,7 @@
#pragma once #pragma once
#include <string> #include <string>
#include <vcpkg/dependencies.h> #include <vcpkg/dependencies.h>
#include <vcpkg/packagespec.h> #include <vcpkg/packagespec.h>
#include <vcpkg/vcpkgpaths.h> #include <vcpkg/vcpkgpaths.h>

View File

@ -1,5 +1,14 @@
#pragma once #pragma once
#include <array>
#include <map>
#include <set>
#include <vector>
#include <vcpkg/base/cstringview.h>
#include <vcpkg/base/files.h>
#include <vcpkg/base/optional.h>
#include <vcpkg/base/system.process.h>
#include <vcpkg/cmakevars.h> #include <vcpkg/cmakevars.h>
#include <vcpkg/packagespec.h> #include <vcpkg/packagespec.h>
#include <vcpkg/statusparagraphs.h> #include <vcpkg/statusparagraphs.h>
@ -7,16 +16,6 @@
#include <vcpkg/vcpkgcmdarguments.h> #include <vcpkg/vcpkgcmdarguments.h>
#include <vcpkg/vcpkgpaths.h> #include <vcpkg/vcpkgpaths.h>
#include <vcpkg/base/cstringview.h>
#include <vcpkg/base/files.h>
#include <vcpkg/base/optional.h>
#include <vcpkg/base/system.process.h>
#include <array>
#include <map>
#include <set>
#include <vector>
namespace vcpkg namespace vcpkg
{ {
struct IBinaryProvider; struct IBinaryProvider;

View File

@ -1,9 +1,9 @@
#include <vcpkg/base/system.process.h>
#include <vcpkg/vcpkgpaths.h>
#include <string> #include <string>
#include <vector> #include <vector>
#include <vcpkg/base/system.process.h>
#include <vcpkg/vcpkgpaths.h>
namespace vcpkg namespace vcpkg
{ {
std::string make_cmake_cmd(const VcpkgPaths& paths, std::string make_cmake_cmd(const VcpkgPaths& paths,

View File

@ -1,7 +1,6 @@
#pragma once #pragma once
#include <vcpkg/base/optional.h> #include <vcpkg/base/optional.h>
#include <vcpkg/portfileprovider.h> #include <vcpkg/portfileprovider.h>
#include <vcpkg/vcpkgpaths.h> #include <vcpkg/vcpkgpaths.h>

View File

@ -1,15 +1,15 @@
#pragma once #pragma once
#include <array>
#include <map>
#include <vector>
#include <vcpkg/build.h> #include <vcpkg/build.h>
#include <vcpkg/dependencies.h> #include <vcpkg/dependencies.h>
#include <vcpkg/statusparagraphs.h> #include <vcpkg/statusparagraphs.h>
#include <vcpkg/vcpkgcmdarguments.h> #include <vcpkg/vcpkgcmdarguments.h>
#include <vcpkg/vcpkgpaths.h> #include <vcpkg/vcpkgpaths.h>
#include <array>
#include <map>
#include <vector>
namespace vcpkg::Commands namespace vcpkg::Commands
{ {
using CommandTypeA = void (*)(const VcpkgCmdArguments& args, const VcpkgPaths& paths, Triplet default_triplet); using CommandTypeA = void (*)(const VcpkgCmdArguments& args, const VcpkgPaths& paths, Triplet default_triplet);

View File

@ -1,5 +1,9 @@
#pragma once #pragma once
#include <functional>
#include <map>
#include <vector>
#include <vcpkg/base/optional.h> #include <vcpkg/base/optional.h>
#include <vcpkg/base/util.h> #include <vcpkg/base/util.h>
#include <vcpkg/build.h> #include <vcpkg/build.h>
@ -9,10 +13,6 @@
#include <vcpkg/statusparagraphs.h> #include <vcpkg/statusparagraphs.h>
#include <vcpkg/vcpkgpaths.h> #include <vcpkg/vcpkgpaths.h>
#include <functional>
#include <map>
#include <vector>
namespace vcpkg::Graphs namespace vcpkg::Graphs
{ {
struct Randomizer; struct Randomizer;

View File

@ -1,10 +1,10 @@
#pragma once #pragma once
#include <vector>
#include <vcpkg/dependencies.h> #include <vcpkg/dependencies.h>
#include <vcpkg/vcpkgpaths.h> #include <vcpkg/vcpkgpaths.h>
#include <vector>
namespace vcpkg::Export::Chocolatey namespace vcpkg::Export::Chocolatey
{ {
struct Options struct Options

View File

@ -1,11 +1,11 @@
#pragma once #pragma once
#include <vcpkg/dependencies.h>
#include <vcpkg/vcpkgpaths.h>
#include <string> #include <string>
#include <vector> #include <vector>
#include <vcpkg/dependencies.h>
#include <vcpkg/vcpkgpaths.h>
namespace vcpkg::Export::IFW namespace vcpkg::Export::IFW
{ {
struct Options struct Options

View File

@ -1,12 +1,11 @@
#pragma once #pragma once
#include <vector>
#include <vcpkg/base/system.h> #include <vcpkg/base/system.h>
#include <vcpkg/dependencies.h> #include <vcpkg/dependencies.h>
#include <vcpkg/vcpkgpaths.h> #include <vcpkg/vcpkgpaths.h>
#include <vector>
namespace vcpkg::Export::Prefab namespace vcpkg::Export::Prefab
{ {
constexpr int kFragmentSize = 3; constexpr int kFragmentSize = 3;
@ -23,10 +22,7 @@ namespace vcpkg::Export::Prefab
}; };
struct NdkVersion struct NdkVersion
{ {
NdkVersion(int _major, int _minor, int _patch) : m_major{_major}, NdkVersion(int _major, int _minor, int _patch) : m_major{_major}, m_minor{_minor}, m_patch{_patch} { }
m_minor{_minor},
m_patch{_patch}{
}
int major() { return this->m_major; } int major() { return this->m_major; }
int minor() { return this->m_minor; } int minor() { return this->m_minor; }
int patch() { return this->m_patch; } int patch() { return this->m_patch; }
@ -72,11 +68,10 @@ namespace vcpkg::Export::Prefab
std::string to_json(); std::string to_json();
}; };
void do_export(const std::vector<Dependencies::ExportPlanAction>& export_plan, void do_export(const std::vector<Dependencies::ExportPlanAction>& export_plan,
const VcpkgPaths& paths, const VcpkgPaths& paths,
const Options& prefab_options, const Triplet& triplet); const Options& prefab_options,
const Triplet& triplet);
Optional<std::string> find_ndk_version(const std::string& content); Optional<std::string> find_ndk_version(const std::string& content);
Optional<NdkVersion> to_version(const std::string& version); Optional<NdkVersion> to_version(const std::string& version);
} }

View File

@ -1,11 +1,11 @@
#pragma once #pragma once
#include <vcpkg/base/chrono.h>
#include <vcpkg/base/util.h>
#include <atomic> #include <atomic>
#include <string> #include <string>
#include <vcpkg/base/chrono.h>
#include <vcpkg/base/util.h>
namespace vcpkg namespace vcpkg
{ {
struct GlobalState struct GlobalState

View File

@ -1,10 +1,10 @@
#pragma once #pragma once
#include <string>
#include <vcpkg/vcpkgcmdarguments.h> #include <vcpkg/vcpkgcmdarguments.h>
#include <vcpkg/vcpkgpaths.h> #include <vcpkg/vcpkgpaths.h>
#include <string>
namespace vcpkg::Help namespace vcpkg::Help
{ {
extern const CommandStructure COMMAND_STRUCTURE; extern const CommandStructure COMMAND_STRUCTURE;

View File

@ -1,13 +1,13 @@
#pragma once #pragma once
#include <vector>
#include <vcpkg/base/chrono.h> #include <vcpkg/base/chrono.h>
#include <vcpkg/build.h> #include <vcpkg/build.h>
#include <vcpkg/dependencies.h> #include <vcpkg/dependencies.h>
#include <vcpkg/vcpkgcmdarguments.h> #include <vcpkg/vcpkgcmdarguments.h>
#include <vcpkg/vcpkgpaths.h> #include <vcpkg/vcpkgpaths.h>
#include <vector>
namespace vcpkg::Install namespace vcpkg::Install
{ {
enum class KeepGoing enum class KeepGoing

View File

@ -1,10 +1,10 @@
#pragma once #pragma once
#include <vcpkg/base/util.h>
#include <vcpkg/base/files.h>
#include <string> #include <string>
#include <vcpkg/base/files.h>
#include <vcpkg/base/util.h>
namespace vcpkg::Metrics namespace vcpkg::Metrics
{ {
struct Metrics : Util::ResourceBase struct Metrics : Util::ResourceBase

View File

@ -1,15 +1,15 @@
#pragma once #pragma once
#include <vcpkg/base/expected.h>
#include <vcpkg/packagespec.h>
#include <vcpkg/textrowcol.h>
#include <map> #include <map>
#include <memory> #include <memory>
#include <string> #include <string>
#include <unordered_map> #include <unordered_map>
#include <vector> #include <vector>
#include <vcpkg/base/expected.h>
#include <vcpkg/packagespec.h>
#include <vcpkg/textrowcol.h>
namespace vcpkg::Parse namespace vcpkg::Parse
{ {
struct ParseControlErrorInfo struct ParseControlErrorInfo

View File

@ -1,11 +1,10 @@
#pragma once #pragma once
#include <vcpkg/base/expected.h>
#include <vcpkg/binaryparagraph.h> #include <vcpkg/binaryparagraph.h>
#include <vcpkg/paragraphparser.h> #include <vcpkg/paragraphparser.h>
#include <vcpkg/vcpkgpaths.h> #include <vcpkg/vcpkgpaths.h>
#include <vcpkg/base/expected.h>
namespace vcpkg::Paragraphs namespace vcpkg::Paragraphs
{ {
using Paragraph = Parse::Paragraph; using Paragraph = Parse::Paragraph;
@ -17,7 +16,10 @@ namespace vcpkg::Paragraphs
bool is_port_directory(const Files::Filesystem& fs, const fs::path& path); bool is_port_directory(const Files::Filesystem& fs, const fs::path& path);
Parse::ParseExpected<SourceControlFile> try_load_manifest(const Files::Filesystem& fs, const std::string& port_name, const fs::path& path_to_manifest, std::error_code& ec); Parse::ParseExpected<SourceControlFile> try_load_manifest(const Files::Filesystem& fs,
const std::string& port_name,
const fs::path& path_to_manifest,
std::error_code& ec);
Parse::ParseExpected<SourceControlFile> try_load_port(const Files::Filesystem& fs, const fs::path& path); Parse::ParseExpected<SourceControlFile> try_load_port(const Files::Filesystem& fs, const fs::path& path);

View File

@ -2,6 +2,7 @@
#include <string> #include <string>
#include <unordered_map> #include <unordered_map>
#include <vcpkg/base/expected.h> #include <vcpkg/base/expected.h>
#include <vcpkg/base/stringview.h> #include <vcpkg/base/stringview.h>

View File

@ -1,11 +1,11 @@
#pragma once #pragma once
#include <vcpkg/base/cstringview.h>
#include <vcpkg/build.h>
#include <array> #include <array>
#include <regex> #include <regex>
#include <vcpkg/base/cstringview.h>
#include <vcpkg/build.h>
namespace vcpkg::PostBuildLint namespace vcpkg::PostBuildLint
{ {
struct BuildType struct BuildType

View File

@ -5,9 +5,9 @@
#include <vcpkg/base/span.h> #include <vcpkg/base/span.h>
#include <vcpkg/base/system.h> #include <vcpkg/base/system.h>
#include <vcpkg/base/system.print.h> #include <vcpkg/base/system.print.h>
#include <vcpkg/platform-expression.h>
#include <vcpkg/packagespec.h> #include <vcpkg/packagespec.h>
#include <vcpkg/paragraphparser.h> #include <vcpkg/paragraphparser.h>
#include <vcpkg/platform-expression.h>
namespace vcpkg namespace vcpkg
{ {

View File

@ -1,9 +1,9 @@
#pragma once #pragma once
#include <vcpkg/binaryparagraph.h>
#include <map> #include <map>
#include <vcpkg/binaryparagraph.h>
namespace vcpkg namespace vcpkg
{ {
enum class InstallState enum class InstallState

View File

@ -1,9 +1,9 @@
#pragma once #pragma once
#include <vcpkg/statusparagraph.h>
#include <iterator> #include <iterator>
#include <memory> #include <memory>
#include <vcpkg/statusparagraph.h>
namespace vcpkg namespace vcpkg
{ {
/// <summary>Status paragraphs</summary> /// <summary>Status paragraphs</summary>

View File

@ -1,10 +1,10 @@
#pragma once #pragma once
#include <vcpkg/base/files.h>
#include <string> #include <string>
#include <utility> #include <utility>
#include <vcpkg/base/files.h>
namespace vcpkg namespace vcpkg
{ {
struct VcpkgPaths; struct VcpkgPaths;

View File

@ -1,9 +1,9 @@
#pragma once #pragma once
#include <string> #include <string>
#include <vcpkg/base/system.h>
#include <vcpkg/base/optional.h>
#include <vcpkg/base/optional.h>
#include <vcpkg/base/system.h>
#include <vcpkg/vcpkgcmdarguments.h> #include <vcpkg/vcpkgcmdarguments.h>
namespace vcpkg namespace vcpkg

View File

@ -1,6 +1,7 @@
#pragma once #pragma once
#include <string> #include <string>
#include <vcpkg/base/files.h> #include <vcpkg/base/files.h>
namespace vcpkg namespace vcpkg

View File

@ -1,15 +1,15 @@
#pragma once #pragma once
#include <vcpkg/base/optional.h>
#include <vcpkg/base/span.h>
#include <vcpkg/base/stringliteral.h>
#include <vcpkg/base/files.h>
#include <memory> #include <memory>
#include <unordered_map> #include <unordered_map>
#include <unordered_set> #include <unordered_set>
#include <vector> #include <vector>
#include <vcpkg/base/files.h>
#include <vcpkg/base/optional.h>
#include <vcpkg/base/span.h>
#include <vcpkg/base/stringliteral.h>
namespace vcpkg namespace vcpkg
{ {
struct ParsedArguments struct ParsedArguments

View File

@ -1,15 +1,14 @@
#pragma once #pragma once
#include <vcpkg/binaryparagraph.h>
#include <vcpkg/packagespec.h>
#include <vcpkg/tools.h>
#include <vcpkg/vcpkgcmdarguments.h>
#include <vcpkg/base/cache.h> #include <vcpkg/base/cache.h>
#include <vcpkg/base/files.h> #include <vcpkg/base/files.h>
#include <vcpkg/base/lazy.h> #include <vcpkg/base/lazy.h>
#include <vcpkg/base/optional.h> #include <vcpkg/base/optional.h>
#include <vcpkg/base/util.h> #include <vcpkg/base/util.h>
#include <vcpkg/binaryparagraph.h>
#include <vcpkg/packagespec.h>
#include <vcpkg/tools.h>
#include <vcpkg/vcpkgcmdarguments.h>
namespace vcpkg namespace vcpkg
{ {

View File

@ -1,16 +1,16 @@
#include <string.h>
#include <iostream>
#include <sstream>
#include <utility>
#include <vcpkg/base/checks.h> #include <vcpkg/base/checks.h>
#include <vcpkg/base/json.h> #include <vcpkg/base/json.h>
#include <vcpkg/base/stringview.h> #include <vcpkg/base/stringview.h>
#include <vcpkg/base/system.print.h> #include <vcpkg/base/system.print.h>
#include <vcpkg/base/unicode.h> #include <vcpkg/base/unicode.h>
#include <vcpkg/platform-expression.h> #include <vcpkg/platform-expression.h>
#include <iostream>
#include <sstream>
#include <string.h>
#include <utility>
using namespace vcpkg; using namespace vcpkg;
namespace namespace
@ -86,9 +86,12 @@ namespace
{ {
auto first = std::find_if(arg.begin(), arg.end(), [](char c) { return c != '-'; }); auto first = std::find_if(arg.begin(), arg.end(), [](char c) { return c != '-'; });
auto division = std::find(first, arg.end(), '='); auto division = std::find(first, arg.end(), '=');
if (division == arg.end()) { if (division == arg.end())
{
return {StringView(first, arg.end()), StringView(arg.end(), arg.end())}; return {StringView(first, arg.end()), StringView(arg.end(), arg.end())};
} else { }
else
{
return {StringView(first, division), StringView(division + 1, arg.end())}; return {StringView(first, division), StringView(division + 1, arg.end())};
} }
} }
@ -152,8 +155,10 @@ Options:
[[noreturn]] void fuzz_platform_expr_and_exit(StringView text) [[noreturn]] void fuzz_platform_expr_and_exit(StringView text)
{ {
auto res1 = PlatformExpression::parse_platform_expression(text, PlatformExpression::MultipleBinaryOperators::Deny); auto res1 =
auto res2 = PlatformExpression::parse_platform_expression(text, PlatformExpression::MultipleBinaryOperators::Allow); PlatformExpression::parse_platform_expression(text, PlatformExpression::MultipleBinaryOperators::Deny);
auto res2 =
PlatformExpression::parse_platform_expression(text, PlatformExpression::MultipleBinaryOperators::Allow);
if (!res1) if (!res1)
{ {

View File

@ -1,9 +1,9 @@
#include <catch2/catch.hpp> #include <catch2/catch.hpp>
#include <vcpkg/vcpkgcmdarguments.h>
#include <vector> #include <vector>
#include <vcpkg/vcpkgcmdarguments.h>
using vcpkg::CommandSetting; using vcpkg::CommandSetting;
using vcpkg::CommandStructure; using vcpkg::CommandStructure;
using vcpkg::CommandSwitch; using vcpkg::CommandSwitch;

View File

@ -1,13 +1,15 @@
#include <catch2/catch.hpp> #include <catch2/catch.hpp>
#include <vcpkg/binarycaching.private.h>
#include <vcpkg/binarycaching.h>
#include <vcpkg/base/files.h>
#include <vcpkg/dependencies.h>
#include <vcpkg/vcpkgcmdarguments.h>
#include <vcpkg/sourceparagraph.h>
#include <vcpkg/paragraphs.h>
#include <string> #include <string>
#include <vcpkg/base/files.h>
#include <vcpkg/binarycaching.h>
#include <vcpkg/binarycaching.private.h>
#include <vcpkg/dependencies.h>
#include <vcpkg/paragraphs.h>
#include <vcpkg/sourceparagraph.h>
#include <vcpkg/vcpkgcmdarguments.h>
using namespace vcpkg; using namespace vcpkg;
TEST_CASE ("reformat_version semver-ish", "[reformat_version]") TEST_CASE ("reformat_version semver-ish", "[reformat_version]")

View File

@ -1,4 +1,5 @@
#include <catch2/catch.hpp> #include <catch2/catch.hpp>
#include <vcpkg/binarycaching.h> #include <vcpkg/binarycaching.h>
using namespace vcpkg; using namespace vcpkg;

View File

@ -1,12 +1,13 @@
#include <catch2/catch.hpp> #include <catch2/catch.hpp>
#include <string>
#include <iterator> #include <iterator>
#include <string>
#include <vcpkg-test/util.h>
#include <vcpkg/base/files.h> #include <vcpkg/base/files.h>
#include <vcpkg/commands.h> #include <vcpkg/commands.h>
#include <vcpkg/vcpkgcmdarguments.h> #include <vcpkg/vcpkgcmdarguments.h>
#include <vcpkg/vcpkgpaths.h> #include <vcpkg/vcpkgpaths.h>
#include <vcpkg-test/util.h>
using namespace vcpkg; using namespace vcpkg;

View File

@ -1,7 +1,8 @@
#include <catch2/catch.hpp> #include <catch2/catch.hpp>
#include <string>
#include <iterator> #include <iterator>
#include <string>
#include <vcpkg/base/files.h> #include <vcpkg/base/files.h>
#include <vcpkg/commands.h> #include <vcpkg/commands.h>
#include <vcpkg/vcpkgcmdarguments.h> #include <vcpkg/vcpkgcmdarguments.h>

View File

@ -1,4 +1,5 @@
#include <catch2/catch.hpp> #include <catch2/catch.hpp>
#include <vcpkg-test/mockcmakevarprovider.h> #include <vcpkg-test/mockcmakevarprovider.h>
#include <vcpkg-test/util.h> #include <vcpkg-test/util.h>
#include <vcpkg/dependencies.h> #include <vcpkg/dependencies.h>

View File

@ -1,14 +1,13 @@
#include <catch2/catch.hpp> #include <catch2/catch.hpp>
#include <vcpkg-test/util.h>
#include <vcpkg/base/files.h>
#include <vcpkg/base/strings.h>
#include <iostream> #include <iostream>
#include <random> #include <random>
#include <vector> #include <vector>
#include <vcpkg-test/util.h>
#include <vcpkg/base/files.h>
#include <vcpkg/base/strings.h>
using vcpkg::Test::AllowSymlinks; using vcpkg::Test::AllowSymlinks;
using vcpkg::Test::base_temporary_directory; using vcpkg::Test::base_temporary_directory;
using vcpkg::Test::can_create_symlinks; using vcpkg::Test::can_create_symlinks;

View File

@ -1,12 +1,12 @@
#include <catch2/catch.hpp> #include <catch2/catch.hpp>
#include <vcpkg/base/hash.h>
#include <algorithm> #include <algorithm>
#include <iostream> #include <iostream>
#include <iterator> #include <iterator>
#include <map> #include <map>
#include <vcpkg/base/hash.h>
namespace Hash = vcpkg::Hash; namespace Hash = vcpkg::Hash;
using vcpkg::StringView; using vcpkg::StringView;

View File

@ -1,10 +1,10 @@
#include <catch2/catch.hpp> #include <catch2/catch.hpp>
#include <iostream> #include <iostream>
#include <vcpkg/base/json.h>
#include <vcpkg/base/unicode.h>
#include "math.h" #include "math.h"
#include <vcpkg/base/json.h>
#include <vcpkg/base/unicode.h>
// TODO: remove this once we switch to C++20 completely // TODO: remove this once we switch to C++20 completely
// This is the worst, but we also can't really deal with it any other way. // This is the worst, but we also can't really deal with it any other way.
@ -178,7 +178,8 @@ TEST_CASE ("JSON parse full file", "[json]")
; ;
auto res = Json::parse(json); auto res = Json::parse(json);
if (!res) { if (!res)
{
std::cerr << res.error()->format() << '\n'; std::cerr << res.error()->format() << '\n';
} }
REQUIRE(res); REQUIRE(res);

View File

@ -1,6 +1,6 @@
#include <catch2/catch.hpp> #include <catch2/catch.hpp>
#include <vcpkg-test/util.h>
#include <vcpkg-test/util.h>
#include <vcpkg/base/json.h> #include <vcpkg/base/json.h>
#include <vcpkg/base/util.h> #include <vcpkg/base/util.h>
#include <vcpkg/paragraphs.h> #include <vcpkg/paragraphs.h>
@ -108,9 +108,12 @@ TEST_CASE ("manifest construct maximum", "[manifests]")
REQUIRE(pgh.feature_paragraphs[0]->dependencies[2].name == "order.white-lotus"); REQUIRE(pgh.feature_paragraphs[0]->dependencies[2].name == "order.white-lotus");
REQUIRE(pgh.feature_paragraphs[0]->dependencies[2].features.size() == 1); REQUIRE(pgh.feature_paragraphs[0]->dependencies[2].features.size() == 1);
REQUIRE(pgh.feature_paragraphs[0]->dependencies[2].features[0] == "the-ancient-ways"); REQUIRE(pgh.feature_paragraphs[0]->dependencies[2].features[0] == "the-ancient-ways");
REQUIRE_FALSE(pgh.feature_paragraphs[0]->dependencies[2].platform.evaluate({{"VCPKG_CMAKE_SYSTEM_NAME", ""}, {"VCPKG_TARGET_ARCHITECTURE", "arm"}})); REQUIRE_FALSE(pgh.feature_paragraphs[0]->dependencies[2].platform.evaluate(
REQUIRE(pgh.feature_paragraphs[0]->dependencies[2].platform.evaluate({{"VCPKG_CMAKE_SYSTEM_NAME", ""}, {"VCPKG_TARGET_ARCHITECTURE", "x86"}})); {{"VCPKG_CMAKE_SYSTEM_NAME", ""}, {"VCPKG_TARGET_ARCHITECTURE", "arm"}}));
REQUIRE(pgh.feature_paragraphs[0]->dependencies[2].platform.evaluate({{"VCPKG_CMAKE_SYSTEM_NAME", "Linux"}, {"VCPKG_TARGET_ARCHITECTURE", "x86"}})); REQUIRE(pgh.feature_paragraphs[0]->dependencies[2].platform.evaluate(
{{"VCPKG_CMAKE_SYSTEM_NAME", ""}, {"VCPKG_TARGET_ARCHITECTURE", "x86"}}));
REQUIRE(pgh.feature_paragraphs[0]->dependencies[2].platform.evaluate(
{{"VCPKG_CMAKE_SYSTEM_NAME", "Linux"}, {"VCPKG_TARGET_ARCHITECTURE", "x86"}}));
REQUIRE(pgh.feature_paragraphs[1]->name == "zuko"); REQUIRE(pgh.feature_paragraphs[1]->name == "zuko");
REQUIRE(pgh.feature_paragraphs[1]->description.size() == 2); REQUIRE(pgh.feature_paragraphs[1]->description.size() == 2);
@ -230,6 +233,7 @@ TEST_CASE ("SourceParagraph manifest empty supports", "[manifests]")
"name": "a", "name": "a",
"version-string": "1.0", "version-string": "1.0",
"supports": "" "supports": ""
})json", true); })json",
true);
REQUIRE_FALSE(m_pgh.has_value()); REQUIRE_FALSE(m_pgh.has_value());
} }

View File

@ -1,7 +1,9 @@
#include <catch2/catch.hpp> #include <catch2/catch.hpp>
#include <vcpkg/base/optional.h>
#include <vector> #include <vector>
#include <vcpkg/base/optional.h>
namespace namespace
{ {
struct identity_projection struct identity_projection

View File

@ -1,8 +1,7 @@
#include <catch2/catch.hpp> #include <catch2/catch.hpp>
#include <vcpkg-test/util.h> #include <vcpkg-test/util.h>
#include <vcpkg/base/strings.h> #include <vcpkg/base/strings.h>
#include <vcpkg/paragraphs.h> #include <vcpkg/paragraphs.h>
namespace Strings = vcpkg::Strings; namespace Strings = vcpkg::Strings;

View File

@ -1,17 +1,17 @@
#include <catch2/catch.hpp> #include <catch2/catch.hpp>
#include <memory>
#include <unordered_map>
#include <vector>
#include <vcpkg-test/mockcmakevarprovider.h> #include <vcpkg-test/mockcmakevarprovider.h>
#include <vcpkg-test/util.h> #include <vcpkg-test/util.h>
#include <vcpkg/base/graphs.h> #include <vcpkg/base/graphs.h>
#include <vcpkg/dependencies.h> #include <vcpkg/dependencies.h>
#include <vcpkg/portfileprovider.h> #include <vcpkg/portfileprovider.h>
#include <vcpkg/sourceparagraph.h> #include <vcpkg/sourceparagraph.h>
#include <vcpkg/triplet.h> #include <vcpkg/triplet.h>
#include <memory>
#include <unordered_map>
#include <vector>
using namespace vcpkg; using namespace vcpkg;
using Test::make_control_file; using Test::make_control_file;

View File

@ -1,6 +1,6 @@
#include <catch2/catch.hpp> #include <catch2/catch.hpp>
#include <vcpkg-test/util.h>
#include <vcpkg-test/util.h>
#include <vcpkg/base/util.h> #include <vcpkg/base/util.h>
#include <vcpkg/paragraphs.h> #include <vcpkg/paragraphs.h>
#include <vcpkg/statusparagraphs.h> #include <vcpkg/statusparagraphs.h>

View File

@ -1,11 +1,12 @@
#include <catch2/catch.hpp> #include <catch2/catch.hpp>
#include <vcpkg/base/strings.h>
#include <stdint.h> #include <stdint.h>
#include <string>
#include <utility> #include <utility>
#include <vector> #include <vector>
#include <string>
#include <vcpkg/base/strings.h>
TEST_CASE ("b32 encoding", "[strings]") TEST_CASE ("b32 encoding", "[strings]")
{ {

View File

@ -3,11 +3,13 @@
#include <vcpkg/base/stringview.h> #include <vcpkg/base/stringview.h>
template<std::size_t N> template<std::size_t N>
static vcpkg::StringView sv(const char (&cstr)[N]) { static vcpkg::StringView sv(const char (&cstr)[N])
{
return cstr; return cstr;
} }
TEST_CASE("string view operator==", "[stringview]") { TEST_CASE ("string view operator==", "[stringview]")
{
// these are due to a bug in operator== // these are due to a bug in operator==
// see commit 782723959399a1a0725ac49 // see commit 782723959399a1a0725ac49
REQUIRE(sv("hey") != sv("heys")); REQUIRE(sv("hey") != sv("heys"));

View File

@ -1,13 +1,15 @@
#include <vcpkg/base/system_headers.h> #include <vcpkg/base/system_headers.h>
#include <catch2/catch.hpp> #include <catch2/catch.hpp>
#include <string> #include <string>
#include <vcpkg/base/optional.h> #include <vcpkg/base/optional.h>
#include <vcpkg/base/stringview.h>
#include <vcpkg/base/zstringview.h>
#include <vcpkg/base/strings.h> #include <vcpkg/base/strings.h>
#include <vcpkg/base/stringview.h>
#include <vcpkg/base/system.h> #include <vcpkg/base/system.h>
#include <vcpkg/base/system.process.h> #include <vcpkg/base/system.process.h>
#include <vcpkg/base/zstringview.h>
using vcpkg::nullopt; using vcpkg::nullopt;
using vcpkg::Optional; using vcpkg::Optional;

View File

@ -2,7 +2,8 @@
#include <vcpkg/base/uint128.h> #include <vcpkg/base/uint128.h>
TEST_CASE ("uint128 constructor and assign", "[uint128]") { TEST_CASE ("uint128 constructor and assign", "[uint128]")
{
vcpkg::UInt128 x = 120; vcpkg::UInt128 x = 120;
REQUIRE(x.bottom_64_bits() == 120); REQUIRE(x.bottom_64_bits() == 120);
REQUIRE(x.top_64_bits() == 0); REQUIRE(x.top_64_bits() == 0);
@ -16,14 +17,16 @@ TEST_CASE ("uint128 constructor and assign", "[uint128]") {
REQUIRE(x.top_64_bits() == 0); REQUIRE(x.top_64_bits() == 0);
} }
TEST_CASE ("uint128 add-assign", "[uint128]") { TEST_CASE ("uint128 add-assign", "[uint128]")
{
vcpkg::UInt128 x = 0xFFFF'FFFF'FFFF'FFFF; vcpkg::UInt128 x = 0xFFFF'FFFF'FFFF'FFFF;
x += 1; x += 1;
REQUIRE(x.bottom_64_bits() == 0); REQUIRE(x.bottom_64_bits() == 0);
REQUIRE(x.top_64_bits() == 1); REQUIRE(x.top_64_bits() == 1);
} }
TEST_CASE ("uint128 shl-assign", "[uint128]") { TEST_CASE ("uint128 shl-assign", "[uint128]")
{
vcpkg::UInt128 x = 0xFFFF'FFFF'FFFF'FFFF; vcpkg::UInt128 x = 0xFFFF'FFFF'FFFF'FFFF;
x <<= 32; x <<= 32;
REQUIRE(x.bottom_64_bits() == 0xFFFF'FFFF'0000'0000); REQUIRE(x.bottom_64_bits() == 0xFFFF'FFFF'0000'0000);
@ -39,7 +42,8 @@ TEST_CASE ("uint128 shl-assign", "[uint128]") {
REQUIRE(x.top_64_bits() == (uint64_t(1) << 32)); REQUIRE(x.top_64_bits() == (uint64_t(1) << 32));
} }
TEST_CASE ("uint128 shr-assign", "[uint128]") { TEST_CASE ("uint128 shr-assign", "[uint128]")
{
vcpkg::UInt128 x = 0xFFFF'FFFF'FFFF'FFFF; vcpkg::UInt128 x = 0xFFFF'FFFF'FFFF'FFFF;
x <<= 64; x <<= 64;
REQUIRE(x.bottom_64_bits() == 0x0000'0000'0000'0000); REQUIRE(x.bottom_64_bits() == 0x0000'0000'0000'0000);

View File

@ -1,8 +1,7 @@
#include <catch2/catch.hpp> #include <catch2/catch.hpp>
#include <vcpkg-test/util.h> #include <vcpkg-test/util.h>
#include <vcpkg/base/sortedvector.h> #include <vcpkg/base/sortedvector.h>
#include <vcpkg/update.h> #include <vcpkg/update.h>
using namespace vcpkg; using namespace vcpkg;

View File

@ -1,8 +1,8 @@
#include <vcpkg/base/system_headers.h> #include <vcpkg/base/system_headers.h>
#include <catch2/catch.hpp> #include <catch2/catch.hpp>
#include <vcpkg-test/util.h>
#include <vcpkg-test/util.h>
#include <vcpkg/base/checks.h> #include <vcpkg/base/checks.h>
#include <vcpkg/base/files.h> #include <vcpkg/base/files.h>
#include <vcpkg/base/util.h> #include <vcpkg/base/util.h>
@ -10,7 +10,6 @@
// used to get the implementation specific compiler flags (i.e., __cpp_lib_filesystem) // used to get the implementation specific compiler flags (i.e., __cpp_lib_filesystem)
#include <ciso646> #include <ciso646>
#include <iostream> #include <iostream>
#include <memory> #include <memory>
@ -114,18 +113,20 @@ namespace vcpkg::Test
#elif !defined(_WIN32) // FILESYSTEM_SYMLINK == FILESYSTEM_SYMLINK_STD #elif !defined(_WIN32) // FILESYSTEM_SYMLINK == FILESYSTEM_SYMLINK_STD
return AllowSymlinks::Yes; return AllowSymlinks::Yes;
#else #else
constexpr static const wchar_t regkey[] = constexpr static const wchar_t regkey[] = LR"(SOFTWARE\Microsoft\Windows\CurrentVersion\AppModelUnlock)";
LR"(SOFTWARE\Microsoft\Windows\CurrentVersion\AppModelUnlock)";
constexpr static const wchar_t regkey_member[] = LR"(AllowDevelopmentWithoutDevLicense)"; constexpr static const wchar_t regkey_member[] = LR"(AllowDevelopmentWithoutDevLicense)";
DWORD data; DWORD data;
DWORD dataSize = sizeof(data); DWORD dataSize = sizeof(data);
const auto status = RegGetValueW( const auto status =
HKEY_LOCAL_MACHINE, regkey, regkey_member, RRF_RT_DWORD, nullptr, &data, &dataSize); RegGetValueW(HKEY_LOCAL_MACHINE, regkey, regkey_member, RRF_RT_DWORD, nullptr, &data, &dataSize);
if (status == ERROR_SUCCESS && data == 1) { if (status == ERROR_SUCCESS && data == 1)
{
return AllowSymlinks::Yes; return AllowSymlinks::Yes;
} else { }
else
{
std::cout << "Symlinks are not allowed on this system\n"; std::cout << "Symlinks are not allowed on this system\n";
return AllowSymlinks::No; return AllowSymlinks::No;
} }
@ -155,7 +156,6 @@ namespace vcpkg::Test
#endif #endif
} }
const fs::path& base_temporary_directory() noexcept const fs::path& base_temporary_directory() noexcept
{ {
const static fs::path BASE_TEMPORARY_DIRECTORY = internal_base_temporary_directory(); const static fs::path BASE_TEMPORARY_DIRECTORY = internal_base_temporary_directory();

View File

@ -1,9 +1,13 @@
#include <vcpkg/base/pragmas.h>
#include <vcpkg/base/system_headers.h> #include <vcpkg/base/system_headers.h>
#include <cassert>
#include <fstream>
#include <memory>
#include <random>
#include <vcpkg/base/chrono.h> #include <vcpkg/base/chrono.h>
#include <vcpkg/base/files.h> #include <vcpkg/base/files.h>
#include <vcpkg/base/pragmas.h>
#include <vcpkg/base/strings.h> #include <vcpkg/base/strings.h>
#include <vcpkg/base/system.debug.h> #include <vcpkg/base/system.debug.h>
#include <vcpkg/base/system.print.h> #include <vcpkg/base/system.print.h>
@ -17,11 +21,6 @@
#include <vcpkg/userconfig.h> #include <vcpkg/userconfig.h>
#include <vcpkg/vcpkglib.h> #include <vcpkg/vcpkglib.h>
#include <cassert>
#include <fstream>
#include <memory>
#include <random>
#if defined(_WIN32) #if defined(_WIN32)
#pragma comment(lib, "ole32") #pragma comment(lib, "ole32")
#pragma comment(lib, "shell32") #pragma comment(lib, "shell32")

View File

@ -10,6 +10,7 @@
#if !defined(_WIN32) #if !defined(_WIN32)
#include <fcntl.h> #include <fcntl.h>
#include <sys/file.h> #include <sys/file.h>
#include <sys/stat.h> #include <sys/stat.h>
#endif #endif

View File

@ -1,11 +1,10 @@
#include "pch.h" #include "pch.h"
#include <vcpkg/base/hash.h>
#include <vcpkg/base/checks.h> #include <vcpkg/base/checks.h>
#include <vcpkg/base/uint128.h> #include <vcpkg/base/hash.h>
#include <vcpkg/base/strings.h> #include <vcpkg/base/strings.h>
#include <vcpkg/base/system.process.h> #include <vcpkg/base/system.process.h>
#include <vcpkg/base/uint128.h>
#include <vcpkg/base/util.h> #include <vcpkg/base/util.h>
#if defined(_WIN32) #if defined(_WIN32)
@ -52,11 +51,13 @@ namespace vcpkg::Hash
} }
template<class UIntTy> template<class UIntTy>
auto top_bits(UIntTy x) -> std::enable_if_t<std::is_unsigned<UIntTy>::value, uchar> { auto top_bits(UIntTy x) -> std::enable_if_t<std::is_unsigned<UIntTy>::value, uchar>
{
return static_cast<uchar>(x >> ((sizeof(x) - 1) * 8)); return static_cast<uchar>(x >> ((sizeof(x) - 1) * 8));
} }
template<class UIntTy> template<class UIntTy>
auto top_bits(UIntTy x) -> decltype(top_bits(x.top_64_bits())) { auto top_bits(UIntTy x) -> decltype(top_bits(x.top_64_bits()))
{
return top_bits(x.top_64_bits()); return top_bits(x.top_64_bits());
} }

View File

@ -1,12 +1,12 @@
#include "pch.h" #include "pch.h"
#include <inttypes.h>
#include <vcpkg/base/files.h> #include <vcpkg/base/files.h>
#include <vcpkg/base/json.h> #include <vcpkg/base/json.h>
#include <vcpkg/base/system.debug.h> #include <vcpkg/base/system.debug.h>
#include <vcpkg/base/unicode.h> #include <vcpkg/base/unicode.h>
#include <inttypes.h>
namespace vcpkg::Json namespace vcpkg::Json
{ {
using VK = ValueKind; using VK = ValueKind;
@ -154,10 +154,7 @@ namespace vcpkg::Json
vcpkg::Checks::check_exit(VCPKG_LINE_INFO, is_array()); vcpkg::Checks::check_exit(VCPKG_LINE_INFO, is_array());
return underlying_->array; return underlying_->array;
} }
Array&& Value::array() && noexcept Array&& Value::array() && noexcept { return std::move(this->array()); }
{
return std::move(this->array());
}
const Object& Value::object() const& noexcept const Object& Value::object() const& noexcept
{ {
@ -169,10 +166,7 @@ namespace vcpkg::Json
vcpkg::Checks::check_exit(VCPKG_LINE_INFO, is_object()); vcpkg::Checks::check_exit(VCPKG_LINE_INFO, is_object());
return underlying_->object; return underlying_->object;
} }
Object&& Value::object() && noexcept Object&& Value::object() && noexcept { return std::move(this->object()); }
{
return std::move(this->object());
}
Value::Value() noexcept = default; Value::Value() noexcept = default;
Value::Value(Value&&) noexcept = default; Value::Value(Value&&) noexcept = default;

View File

@ -1,8 +1,8 @@
#include "pch.h" #include "pch.h"
#include <vcpkg/base/parse.h>
#include <utility> #include <utility>
#include <vcpkg/base/parse.h>
#include <vcpkg/base/system.print.h> #include <vcpkg/base/system.print.h>
#include <vcpkg/base/util.h> #include <vcpkg/base/util.h>
#include <vcpkg/packagespec.h> #include <vcpkg/packagespec.h>

View File

@ -1,11 +1,11 @@
#include "pch.h" #include "pch.h"
#include <cstring>
#include <vcpkg/base/checks.h> #include <vcpkg/base/checks.h>
#include <vcpkg/base/lineinfo.h> #include <vcpkg/base/lineinfo.h>
#include <vcpkg/base/stringview.h> #include <vcpkg/base/stringview.h>
#include <cstring>
namespace vcpkg namespace vcpkg
{ {
std::vector<StringView> StringView::find_all_enclosed(const StringView& input, std::vector<StringView> StringView::find_all_enclosed(const StringView& input,

View File

@ -1,13 +1,13 @@
#include "pch.h" #include "pch.h"
#include <ctime>
#include <vcpkg/base/checks.h> #include <vcpkg/base/checks.h>
#include <vcpkg/base/chrono.h> #include <vcpkg/base/chrono.h>
#include <vcpkg/base/system.debug.h> #include <vcpkg/base/system.debug.h>
#include <vcpkg/base/system.h> #include <vcpkg/base/system.h>
#include <vcpkg/base/util.h> #include <vcpkg/base/util.h>
#include <ctime>
using namespace vcpkg::System; using namespace vcpkg::System;
namespace vcpkg namespace vcpkg

View File

@ -1,5 +1,7 @@
#include "pch.h" #include "pch.h"
#include <ctime>
#include <vcpkg/base/checks.h> #include <vcpkg/base/checks.h>
#include <vcpkg/base/chrono.h> #include <vcpkg/base/chrono.h>
#include <vcpkg/base/system.debug.h> #include <vcpkg/base/system.debug.h>
@ -7,8 +9,6 @@
#include <vcpkg/base/system.process.h> #include <vcpkg/base/system.process.h>
#include <vcpkg/base/util.h> #include <vcpkg/base/util.h>
#include <ctime>
#if defined(__APPLE__) #if defined(__APPLE__)
#include <mach-o/dyld.h> #include <mach-o/dyld.h>
#endif #endif

View File

@ -1,20 +1,25 @@
#include <vcpkg/base/uint128.h>
#include <limits> #include <limits>
namespace vcpkg { #include <vcpkg/base/uint128.h>
UInt128& UInt128::operator<<=(int by) noexcept { namespace vcpkg
if (by == 0) { {
UInt128& UInt128::operator<<=(int by) noexcept
{
if (by == 0)
{
return *this; return *this;
} }
if (by < 64) { if (by < 64)
{
top <<= by; top <<= by;
const auto shift_up = bottom >> (64 - by); const auto shift_up = bottom >> (64 - by);
top |= shift_up; top |= shift_up;
bottom <<= by; bottom <<= by;
} else { }
else
{
top = bottom; top = bottom;
top <<= (by - 64); top <<= (by - 64);
bottom = 0; bottom = 0;
@ -23,17 +28,22 @@ UInt128& UInt128::operator<<=(int by) noexcept {
return *this; return *this;
} }
UInt128& UInt128::operator>>=(int by) noexcept { UInt128& UInt128::operator>>=(int by) noexcept
if (by == 0) { {
if (by == 0)
{
return *this; return *this;
} }
if (by < 64) { if (by < 64)
{
bottom >>= by; bottom >>= by;
const auto shift_down = top << (64 - by); const auto shift_down = top << (64 - by);
bottom |= shift_down; bottom |= shift_down;
top >>= by; top >>= by;
} else { }
else
{
bottom = top; bottom = top;
bottom >>= (by - 64); bottom >>= (by - 64);
top = 0; top = 0;
@ -42,7 +52,8 @@ UInt128& UInt128::operator>>=(int by) noexcept {
return *this; return *this;
} }
UInt128& UInt128::operator+=(uint64_t rhs) noexcept { UInt128& UInt128::operator+=(uint64_t rhs) noexcept
{
// bottom + lhs > uint64::max // bottom + lhs > uint64::max
if (bottom > std::numeric_limits<uint64_t>::max() - rhs) if (bottom > std::numeric_limits<uint64_t>::max() - rhs)
{ {

View File

@ -1,8 +1,7 @@
#include "pch.h" #include "pch.h"
#include <vcpkg/base/unicode.h>
#include <vcpkg/base/checks.h> #include <vcpkg/base/checks.h>
#include <vcpkg/base/unicode.h>
namespace vcpkg::Unicode namespace vcpkg::Unicode
{ {

View File

@ -3,7 +3,6 @@
#include <vcpkg/base/checks.h> #include <vcpkg/base/checks.h>
#include <vcpkg/base/system.print.h> #include <vcpkg/base/system.print.h>
#include <vcpkg/base/util.h> #include <vcpkg/base/util.h>
#include <vcpkg/binaryparagraph.h> #include <vcpkg/binaryparagraph.h>
#include <vcpkg/paragraphparser.h> #include <vcpkg/paragraphparser.h>
#include <vcpkg/paragraphs.h> #include <vcpkg/paragraphs.h>

View File

@ -11,7 +11,6 @@
#include <vcpkg/base/system.print.h> #include <vcpkg/base/system.print.h>
#include <vcpkg/base/system.process.h> #include <vcpkg/base/system.process.h>
#include <vcpkg/base/util.h> #include <vcpkg/base/util.h>
#include <vcpkg/binarycaching.h> #include <vcpkg/binarycaching.h>
#include <vcpkg/build.h> #include <vcpkg/build.h>
#include <vcpkg/buildenvironment.h> #include <vcpkg/buildenvironment.h>

View File

@ -5,9 +5,8 @@
#include <vcpkg/base/span.h> #include <vcpkg/base/span.h>
#include <vcpkg/base/system.process.h> #include <vcpkg/base/system.process.h>
#include <vcpkg/base/util.h> #include <vcpkg/base/util.h>
#include <vcpkg/cmakevars.h>
#include <vcpkg/buildenvironment.h> #include <vcpkg/buildenvironment.h>
#include <vcpkg/cmakevars.h>
#include <vcpkg/dependencies.h> #include <vcpkg/dependencies.h>
using namespace vcpkg; using namespace vcpkg;

View File

@ -14,8 +14,8 @@
#include <vcpkg/help.h> #include <vcpkg/help.h>
#include <vcpkg/input.h> #include <vcpkg/input.h>
#include <vcpkg/install.h> #include <vcpkg/install.h>
#include <vcpkg/platform-expression.h>
#include <vcpkg/packagespec.h> #include <vcpkg/packagespec.h>
#include <vcpkg/platform-expression.h>
#include <vcpkg/vcpkglib.h> #include <vcpkg/vcpkglib.h>
using namespace vcpkg; using namespace vcpkg;

View File

@ -8,7 +8,8 @@
using namespace vcpkg; using namespace vcpkg;
namespace { namespace
{
void clear_directory(Files::Filesystem& fs, const fs::path& target) void clear_directory(Files::Filesystem& fs, const fs::path& target)
{ {
using vcpkg::System::print2; using vcpkg::System::print2;

View File

@ -2,7 +2,6 @@
#include <vcpkg/base/hash.h> #include <vcpkg/base/hash.h>
#include <vcpkg/base/system.print.h> #include <vcpkg/base/system.print.h>
#include <vcpkg/build.h> #include <vcpkg/build.h>
#include <vcpkg/commands.h> #include <vcpkg/commands.h>
#include <vcpkg/export.h> #include <vcpkg/export.h>

View File

@ -1,5 +1,7 @@
#include "pch.h" #include "pch.h"
#include <vector>
#include <vcpkg/base/strings.h> #include <vcpkg/base/strings.h>
#include <vcpkg/base/system.print.h> #include <vcpkg/base/system.print.h>
#include <vcpkg/base/util.h> #include <vcpkg/base/util.h>
@ -9,7 +11,6 @@
#include <vcpkg/input.h> #include <vcpkg/input.h>
#include <vcpkg/install.h> #include <vcpkg/install.h>
#include <vcpkg/packagespec.h> #include <vcpkg/packagespec.h>
#include <vector>
using vcpkg::Dependencies::ActionPlan; using vcpkg::Dependencies::ActionPlan;
using vcpkg::Dependencies::InstallPlanAction; using vcpkg::Dependencies::InstallPlanAction;

View File

@ -1,6 +1,7 @@
#include "pch.h" #include "pch.h"
#include <limits.h> #include <limits.h>
#include <vcpkg/base/strings.h> #include <vcpkg/base/strings.h>
#include <vcpkg/base/system.print.h> #include <vcpkg/base/system.print.h>
#include <vcpkg/base/system.process.h> #include <vcpkg/base/system.process.h>

View File

@ -2,7 +2,6 @@
#include <vcpkg/base/strings.h> #include <vcpkg/base/strings.h>
#include <vcpkg/base/system.process.h> #include <vcpkg/base/system.process.h>
#include <vcpkg/build.h> #include <vcpkg/build.h>
#include <vcpkg/cmakevars.h> #include <vcpkg/cmakevars.h>
#include <vcpkg/commands.h> #include <vcpkg/commands.h>

View File

@ -9,22 +9,15 @@
namespace vcpkg::Commands::FormatManifest namespace vcpkg::Commands::FormatManifest
{ {
static constexpr StringLiteral OPTION_ALL = "--all"; static constexpr StringLiteral OPTION_ALL = "--all";
const CommandSwitch FORMAT_SWITCHES[] = { const CommandSwitch FORMAT_SWITCHES[] = {{OPTION_ALL, "Format all ports' manifest files."}};
{ OPTION_ALL, "Format all ports' manifest files." }
};
const CommandStructure COMMAND_STRUCTURE = { const CommandStructure COMMAND_STRUCTURE = {
create_example_string(R"###(x-format-manifest --all)###"), create_example_string(R"###(x-format-manifest --all)###"),
0, 0,
SIZE_MAX, SIZE_MAX,
{ {FORMAT_SWITCHES, {}, {}},
FORMAT_SWITCHES,
{},
{}
},
nullptr, nullptr,
}; };
@ -76,7 +69,10 @@ namespace vcpkg::Commands::FormatManifest
} }
else else
{ {
System::printf(System::Color::error, "Failed to parse %s: %s\n", path.u8string(), parsed_json_opt.error()->format()); System::printf(System::Color::error,
"Failed to parse %s: %s\n",
path.u8string(),
parsed_json_opt.error()->format());
has_error = true; has_error = true;
} }

View File

@ -24,8 +24,7 @@ namespace vcpkg::Commands::Owns
} }
} }
const CommandStructure COMMAND_STRUCTURE = { const CommandStructure COMMAND_STRUCTURE = {
Strings::format("The argument should be a pattern to search for. %s", Strings::format("The argument should be a pattern to search for. %s", create_example_string("owns zlib.dll")),
create_example_string("owns zlib.dll")),
1, 1,
1, 1,
{}, {},

View File

@ -1,11 +1,10 @@
#include "pch.h" #include "pch.h"
#include <vcpkg/commands.h>
#include <vcpkg/help.h>
#include <vcpkg/base/system.print.h> #include <vcpkg/base/system.print.h>
#include <vcpkg/base/system.process.h> #include <vcpkg/base/system.process.h>
#include <vcpkg/base/util.h> #include <vcpkg/base/util.h>
#include <vcpkg/commands.h>
#include <vcpkg/help.h>
namespace vcpkg::Commands::PortHistory namespace vcpkg::Commands::PortHistory
{ {

View File

@ -1,14 +1,13 @@
#include "pch.h" #include "pch.h"
#include <vcpkg/commands.h>
#include <vcpkg/help.h>
#include <vcpkg/paragraphs.h>
#include <vcpkg/versiont.h>
#include <vcpkg/base/sortedvector.h> #include <vcpkg/base/sortedvector.h>
#include <vcpkg/base/system.print.h> #include <vcpkg/base/system.print.h>
#include <vcpkg/base/system.process.h> #include <vcpkg/base/system.process.h>
#include <vcpkg/base/util.h> #include <vcpkg/base/util.h>
#include <vcpkg/commands.h>
#include <vcpkg/help.h>
#include <vcpkg/paragraphs.h>
#include <vcpkg/versiont.h>
namespace vcpkg::Commands::PortsDiff namespace vcpkg::Commands::PortsDiff
{ {

View File

@ -1,5 +1,7 @@
#include "pch.h" #include "pch.h"
#include <vcpkg/base/system.print.h>
#include <vcpkg/base/util.h>
#include <vcpkg/binarycaching.h> #include <vcpkg/binarycaching.h>
#include <vcpkg/commands.h> #include <vcpkg/commands.h>
#include <vcpkg/dependencies.h> #include <vcpkg/dependencies.h>
@ -11,9 +13,6 @@
#include <vcpkg/update.h> #include <vcpkg/update.h>
#include <vcpkg/vcpkglib.h> #include <vcpkg/vcpkglib.h>
#include <vcpkg/base/system.print.h>
#include <vcpkg/base/util.h>
namespace vcpkg::Commands::Upgrade namespace vcpkg::Commands::Upgrade
{ {
using Install::KeepGoing; using Install::KeepGoing;

View File

@ -1,5 +1,9 @@
#include "pch.h" #include "pch.h"
#include <vcpkg/base/stringliteral.h>
#include <vcpkg/base/system.print.h>
#include <vcpkg/base/system.process.h>
#include <vcpkg/base/util.h>
#include <vcpkg/commands.h> #include <vcpkg/commands.h>
#include <vcpkg/dependencies.h> #include <vcpkg/dependencies.h>
#include <vcpkg/export.chocolatey.h> #include <vcpkg/export.chocolatey.h>
@ -12,11 +16,6 @@
#include <vcpkg/paragraphs.h> #include <vcpkg/paragraphs.h>
#include <vcpkg/vcpkglib.h> #include <vcpkg/vcpkglib.h>
#include <vcpkg/base/stringliteral.h>
#include <vcpkg/base/system.print.h>
#include <vcpkg/base/system.process.h>
#include <vcpkg/base/util.h>
namespace vcpkg::Export namespace vcpkg::Export
{ {
using Dependencies::ExportPlanAction; using Dependencies::ExportPlanAction;

View File

@ -436,7 +436,8 @@ namespace vcpkg::Export::Prefab
utils.create_directories(meta_dir, error_code); utils.create_directories(meta_dir, error_code);
const fs::path share_root = paths.packages / fs::u8path(Strings::format("%s_%s", name, action.spec.triplet())); const fs::path share_root =
paths.packages / fs::u8path(Strings::format("%s_%s", name, action.spec.triplet()));
utils.copy_file(share_root / "share" / name / "copyright", utils.copy_file(share_root / "share" / name / "copyright",
meta_dir / "LICENSE", meta_dir / "LICENSE",
@ -518,7 +519,8 @@ namespace vcpkg::Export::Prefab
for (const auto& triplet : triplets) for (const auto& triplet : triplets)
{ {
const fs::path listfile = const fs::path listfile =
paths.vcpkg_dir_info / fs::u8path(Strings::format("%s_%s_%s", name, norm_version, triplet) + ".list"); paths.vcpkg_dir_info /
fs::u8path(Strings::format("%s_%s_%s", name, norm_version, triplet) + ".list");
const fs::path installed_dir = paths.packages / fs::u8path(Strings::format("%s_%s", name, triplet)); const fs::path installed_dir = paths.packages / fs::u8path(Strings::format("%s_%s", name, triplet));
Checks::check_exit(VCPKG_LINE_INFO, Checks::check_exit(VCPKG_LINE_INFO,
utils.exists(listfile), utils.exists(listfile),
@ -704,10 +706,9 @@ namespace vcpkg::Export::Prefab
)"); )");
} }
} }
System::print2(System::Color::success, System::print2(
Strings::format("Successfuly exported %s. Checkout %s \n", System::Color::success,
name, Strings::format("Successfuly exported %s. Checkout %s \n", name, paths.prefab.generic_u8string()));
paths.prefab.generic_u8string()));
} }
} }
} }

View File

@ -434,7 +434,9 @@ namespace vcpkg::Install
SpecSummary* current_summary = nullptr; SpecSummary* current_summary = nullptr;
Chrono::ElapsedTimer build_timer = Chrono::ElapsedTimer::create_started(); Chrono::ElapsedTimer build_timer = Chrono::ElapsedTimer::create_started();
TrackedPackageInstallGuard(const size_t package_count, std::vector<SpecSummary>& results, const PackageSpec& spec) TrackedPackageInstallGuard(const size_t package_count,
std::vector<SpecSummary>& results,
const PackageSpec& spec)
{ {
results.emplace_back(spec, nullptr); results.emplace_back(spec, nullptr);
current_summary = &results.back(); current_summary = &results.back();

View File

@ -1,14 +1,13 @@
#include "pch.h" #include "pch.h"
#include <vcpkg/commands.h>
#include <vcpkg/metrics.h>
#include <vcpkg/base/chrono.h> #include <vcpkg/base/chrono.h>
#include <vcpkg/base/files.h> #include <vcpkg/base/files.h>
#include <vcpkg/base/hash.h> #include <vcpkg/base/hash.h>
#include <vcpkg/base/json.h> #include <vcpkg/base/json.h>
#include <vcpkg/base/strings.h> #include <vcpkg/base/strings.h>
#include <vcpkg/base/system.process.h> #include <vcpkg/base/system.process.h>
#include <vcpkg/commands.h>
#include <vcpkg/metrics.h>
#if defined(_WIN32) #if defined(_WIN32)
#pragma comment(lib, "version") #pragma comment(lib, "version")
@ -30,9 +29,11 @@ namespace vcpkg::Metrics
return ""; return "";
} }
struct append_hexits { struct append_hexits
{
constexpr static char hex[17] = "0123456789abcdef"; constexpr static char hex[17] = "0123456789abcdef";
void operator()(std::string& res, std::uint8_t bits) const { void operator()(std::string& res, std::uint8_t bits) const
{
res.push_back(hex[(bits >> 4) & 0x0F]); res.push_back(hex[(bits >> 4) & 0x0F]);
res.push_back(hex[(bits >> 0) & 0x0F]); res.push_back(hex[(bits >> 0) & 0x0F]);
} }

View File

@ -244,7 +244,8 @@ namespace vcpkg
return nullopt; return nullopt;
} }
platform_string.append((++loc.it).pointer_to_current(), parser.it().pointer_to_current()); platform_string.append((++loc.it).pointer_to_current(), parser.it().pointer_to_current());
auto platform_opt = PlatformExpression::parse_platform_expression(platform_string, PlatformExpression::MultipleBinaryOperators::Allow); auto platform_opt = PlatformExpression::parse_platform_expression(
platform_string, PlatformExpression::MultipleBinaryOperators::Allow);
if (auto platform = platform_opt.get()) if (auto platform = platform_opt.get())
{ {
ret.platform = std::move(*platform); ret.platform = std::move(*platform);

View File

@ -133,7 +133,10 @@ namespace vcpkg::Paragraphs
return fs.exists(path / fs::u8path("CONTROL")) || fs.exists(path / fs::u8path("vcpkg.json")); return fs.exists(path / fs::u8path("CONTROL")) || fs.exists(path / fs::u8path("vcpkg.json"));
} }
ParseExpected<SourceControlFile> try_load_manifest(const Files::Filesystem& fs, const std::string& port_name, const fs::path& path_to_manifest, std::error_code& ec) ParseExpected<SourceControlFile> try_load_manifest(const Files::Filesystem& fs,
const std::string& port_name,
const fs::path& path_to_manifest,
std::error_code& ec)
{ {
auto error_info = std::make_unique<ParseControlErrorInfo>(); auto error_info = std::make_unique<ParseControlErrorInfo>();
auto res = Json::parse_file(fs, path_to_manifest, ec); auto res = Json::parse_file(fs, path_to_manifest, ec);
@ -164,9 +167,9 @@ namespace vcpkg::Paragraphs
{ {
const auto path_to_manifest = path / fs::u8path("vcpkg.json"); const auto path_to_manifest = path / fs::u8path("vcpkg.json");
const auto path_to_control = path / fs::u8path("CONTROL"); const auto path_to_control = path / fs::u8path("CONTROL");
if (fs.exists(path_to_manifest)) { if (fs.exists(path_to_manifest))
vcpkg::Checks::check_exit( {
VCPKG_LINE_INFO, vcpkg::Checks::check_exit(VCPKG_LINE_INFO,
!fs.exists(path_to_control), !fs.exists(path_to_control),
"Found both manifest and CONTROL file in port %s; please rename one or the other", "Found both manifest and CONTROL file in port %s; please rename one or the other",
path.u8string()); path.u8string());
@ -177,7 +180,8 @@ namespace vcpkg::Paragraphs
{ {
auto error_info = std::make_unique<ParseControlErrorInfo>(); auto error_info = std::make_unique<ParseControlErrorInfo>();
error_info->name = path.filename().u8string(); error_info->name = path.filename().u8string();
error_info->error = Strings::format("Failed to load manifest file for port: %s\n", path_to_manifest.u8string(), ec.message()); error_info->error = Strings::format(
"Failed to load manifest file for port: %s\n", path_to_manifest.u8string(), ec.message());
} }
return res; return res;

View File

@ -1,14 +1,14 @@
#include "pch.h" #include "pch.h"
#include <string>
#include <vector>
#include <vcpkg/base/parse.h> #include <vcpkg/base/parse.h>
#include <vcpkg/base/strings.h> #include <vcpkg/base/strings.h>
#include <vcpkg/base/system.print.h> #include <vcpkg/base/system.print.h>
#include <vcpkg/base/util.h> #include <vcpkg/base/util.h>
#include <vcpkg/platform-expression.h> #include <vcpkg/platform-expression.h>
#include <string>
#include <vector>
namespace vcpkg::PlatformExpression namespace vcpkg::PlatformExpression
{ {
using vcpkg::Parse::ParseError; using vcpkg::Parse::ParseError;

View File

@ -347,10 +347,11 @@ namespace vcpkg::PostBuildLint
// if there is only one candidate, provide the cmake lines needed to place it in the proper location // if there is only one candidate, provide the cmake lines needed to place it in the proper location
const fs::path found_file = potential_copyright_files[0]; const fs::path found_file = potential_copyright_files[0];
auto found_relative_native = found_file.native(); auto found_relative_native = found_file.native();
found_relative_native.erase(current_buildtrees_dir.native().size() + 1); // The +1 is needed to remove the "/" found_relative_native.erase(current_buildtrees_dir.native().size() +
1); // The +1 is needed to remove the "/"
const fs::path relative_path = found_relative_native; const fs::path relative_path = found_relative_native;
System::printf( System::printf("\n configure_file(\"${CURRENT_BUILDTREES_DIR}/%s/%s\" "
"\n configure_file(\"${CURRENT_BUILDTREES_DIR}/%s/%s\" \"${CURRENT_PACKAGES_DIR}/share/%s/copyright\" COPYONLY)\n", "\"${CURRENT_PACKAGES_DIR}/share/%s/copyright\" COPYONLY)\n",
relative_path.generic_string(), relative_path.generic_string(),
found_file.filename().generic_string(), found_file.filename().generic_string(),
spec.name()); spec.name());

Some files were not shown because too many files have changed in this diff Show More