Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into error-document
Browse files Browse the repository at this point in the history
# Conflicts:
#	azure-pipelines/end-to-end-tests-dir/cli.ps1
#	include/vcpkg/base/parse.h
#	include/vcpkg/input.h
#	include/vcpkg/packagespec.h
#	include/vcpkg/paragraphparser.h
#	include/vcpkg/sourceparagraph.h
#	src/vcpkg/base/parse.cpp
#	src/vcpkg/binarycaching.cpp
#	src/vcpkg/binaryparagraph.cpp
#	src/vcpkg/commands.build-external.cpp
#	src/vcpkg/commands.build.cpp
#	src/vcpkg/commands.check-support.cpp
#	src/vcpkg/commands.depend-info.cpp
#	src/vcpkg/commands.export.cpp
#	src/vcpkg/commands.install.cpp
#	src/vcpkg/commands.package-info.cpp
#	src/vcpkg/commands.remove.cpp
#	src/vcpkg/commands.set-installed.cpp
#	src/vcpkg/commands.upgrade.cpp
#	src/vcpkg/input.cpp
#	src/vcpkg/packagespec.cpp
#	src/vcpkg/paragraphs.cpp
#	src/vcpkg/sourceparagraph.cpp
  • Loading branch information
BillyONeal committed Apr 20, 2024
2 parents de35a73 + 87adc3f commit f69db32
Show file tree
Hide file tree
Showing 137 changed files with 4,718 additions and 3,810 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@ jobs:
run: echo "::add-matcher::.github/workflows/matchers.json"
- name: '[CI Only] Initialize CodeQL'
if: inputs.codeql
uses: github/codeql-action/init@v2
uses: github/codeql-action/init@v3
with:
languages: cpp, javascript
languages: javascript
- name: Configure and Build
if: matrix.preset != 'windows-ci'
run: |
Expand All @@ -57,7 +57,7 @@ jobs:
cmake --build --preset ${{ matrix.preset }} -- -k0
- name: '[CI Only] Perform CodeQL Analysis'
if: inputs.codeql
uses: github/codeql-action/analyze@v2
uses: github/codeql-action/analyze@v3
- name: Run vcpkg unit tests
run: ctest --preset ${{ matrix.preset }} --output-on-failure 2>&1
- name: Run vcpkg-artifacts unit tests
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/pr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@ jobs:
cmake --preset windows-ci
IF %ERRORLEVEL% NEQ 0 exit /B %ERRORLEVEL%
cmake --build --preset windows-ci --target generate-message-map -- -k0
- name: Verify Messages
shell: pwsh
run: |
cmake --build --preset windows-ci --target verify-messages -- -k0
- name: 'Format C++'
shell: pwsh
run: ./azure-pipelines/Format-CxxCode.ps1
Expand Down
37 changes: 24 additions & 13 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -54,23 +54,27 @@ if(MSVC AND NOT COMMAND target_precompile_headers)
endif()

if(VCPKG_EMBED_GIT_SHA)
find_package(Git REQUIRED)
execute_process(
COMMAND "${GIT_EXECUTABLE}" status --porcelain=v1
WORKING_DIRECTORY "${CMAKE_CURRENT_LIST_DIR}"
OUTPUT_VARIABLE VCPKG_GIT_STATUS
OUTPUT_STRIP_TRAILING_WHITESPACE
)

if(VCPKG_GIT_STATUS STREQUAL "")
if(DEFINED VCPKG_VERSION)
message(STATUS "Using supplied version SHA ${VCPKG_VERSION}.")
else()
find_package(Git REQUIRED)
execute_process(
COMMAND "${GIT_EXECUTABLE}" rev-parse HEAD
COMMAND "${GIT_EXECUTABLE}" status --porcelain=v1
WORKING_DIRECTORY "${CMAKE_CURRENT_LIST_DIR}"
OUTPUT_VARIABLE VCPKG_VERSION
OUTPUT_VARIABLE VCPKG_GIT_STATUS
OUTPUT_STRIP_TRAILING_WHITESPACE
)
else()
message(WARNING "Skipping embedding SHA due to local changes.")

if(VCPKG_GIT_STATUS STREQUAL "")
execute_process(
COMMAND "${GIT_EXECUTABLE}" rev-parse HEAD
WORKING_DIRECTORY "${CMAKE_CURRENT_LIST_DIR}"
OUTPUT_VARIABLE VCPKG_VERSION
OUTPUT_STRIP_TRAILING_WHITESPACE
)
else()
message(WARNING "Skipping embedding SHA due to local changes.")
endif()
endif()
endif()

Expand Down Expand Up @@ -556,6 +560,13 @@ add_executable(test-script-asset-cache ${TEST_SCRIPT_ASSET_CACHE_SOURCES} "${CMA
set_property(TARGET test-script-asset-cache PROPERTY PDB_NAME "test-script-asset-cache${VCPKG_PDB_SUFFIX}")
endif()

# === Target: verify_messages ===
add_custom_target(
verify-messages
COMMAND pwsh -File "${CMAKE_CURRENT_SOURCE_DIR}/scripts/verifyMessages.ps1"
COMMENT "Running PowerShell script to verify message usage..."
)

# === Target: format ===

find_program(CLANG_FORMAT clang-format PATHS "$ENV{PROGRAMFILES}/LLVM/bin")
Expand Down
25 changes: 22 additions & 3 deletions CMakePresets.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
"name": "base",
"hidden": true,
"generator": "Ninja",
"binaryDir": "out\\build\\${presetName}",
"installDir": "out\\install\\${presetName}",
"binaryDir": "out/build/${presetName}",
"installDir": "out/install/${presetName}",
"cacheVariables": {
"VCPKG_BUILD_BENCHMARKING": true,
"VCPKG_BUILD_FUZZING": true
Expand Down Expand Up @@ -172,6 +172,25 @@
"CMAKE_OSX_DEPLOYMENT_TARGET": "10.13",
"VCPKG_WARNINGS_AS_ERRORS": true
}
},
{
"name": "bootstrap.sh",
"description": "Preset used by vcpkg's bootstrap-vcpkg.sh",
"generator": "Ninja",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Release",
"VCPKG_DEVELOPMENT_WARNINGS": "OFF"
}
},
{
"name": "bootstrap.sh parallel build",
"description": "Preset used by vcpkg's bootstrap-vcpkg.sh when the VCPKG_MAX_CONCURRENCY variable is non-empty",
"inherits": ["bootstrap.sh"],
"cacheVariables": {
"CMAKE_JOB_POOL_COMPILE": "compile",
"CMAKE_JOB_POOL_LINK": "link",
"CMAKE_JOB_POOLS": "compile=$env{VCPKG_MAX_CONCURRENCY};link=$env{VCPKG_MAX_CONCURRENCY}"
}
}
],
"buildPresets": [
Expand Down Expand Up @@ -202,4 +221,4 @@
"configurePreset": "macos-ci"
}
]
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Just for testing!
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
set(VCPKG_TARGET_ARCHITECTURE x64)
set(VCPKG_CRT_LINKAGE dynamic)
set(VCPKG_LIBRARY_LINKAGE dynamic)
if(APPLE)
set(VCPKG_CMAKE_SYSTEM_NAME Darwin)
elseif(UNIX)
set(VCPKG_CMAKE_SYSTEM_NAME Linux)
endif()
set(VCPKG_HASH_ADDITIONAL_FILES "additional_abi_file.txt") # relatives path should fail.
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# should fail earlier than running the portfile

set(VCPKG_POLICY_EMPTY_PACKAGE enabled)
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"name": "vcpkg-test-hash-additional",
"version": "0",
"description": ""
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Just for testing!
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
set(VCPKG_TARGET_ARCHITECTURE x64)
set(VCPKG_CRT_LINKAGE dynamic)
set(VCPKG_LIBRARY_LINKAGE dynamic)
if(APPLE)
set(VCPKG_CMAKE_SYSTEM_NAME Darwin)
elseif(UNIX)
set(VCPKG_CMAKE_SYSTEM_NAME Linux)
endif()
set(VCPKG_HASH_ADDITIONAL_FILES "${CMAKE_CURRENT_LIST_DIR}/additional_abi_file.txt")
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
file(STRINGS "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}.vcpkg_abi_info.txt" lines)
list(GET lines 0 first_line)

set(expected "additional_file_0 61ba0c7fc1f696e28c1b7aa9460980a571025ff8c97bb90a57e990463aa25660")

if(first_line STREQUAL "${expected}")
message(STATUS "Test succesful!")
else()
message(FATAL_ERROR "First line in abi info is not the additional file to be hashed but:\n first_line: '${first_line}'\n expected: '${expected}' ")
endif()

set(VCPKG_POLICY_EMPTY_PACKAGE enabled)
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"name": "vcpkg-test-hash-additional",
"version": "0",
"description": "A port that inspects the abi"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
set(VCPKG_POLICY_EMPTY_PACKAGE enabled)
file(MAKE_DIRECTORY "${CURRENT_PACKAGES_DIR}/share/${PORT}")
file(WRITE "${CURRENT_PACKAGES_DIR}/share/${PORT}/copyright" "copyright message")
file(WRITE "${CURRENT_PACKAGES_DIR}/share/${PORT}/installed.txt" "${PORT} installed")
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"name": "vcpkg-e2e-test-fails-in-download-only-transitive",
"version": "1.0.0",
"dependencies": [ "vcpkg-e2e-test-fails-in-download-only" ]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
if(DEFINED VCPKG_DOWNLOAD_MODE)
message(FATAL_ERROR "This port does not compile in download mode")
endif()

set(VCPKG_POLICY_EMPTY_PACKAGE enabled)
file(MAKE_DIRECTORY "${CURRENT_PACKAGES_DIR}/share/${PORT}")
file(WRITE "${CURRENT_PACKAGES_DIR}/share/${PORT}/copyright" "copyright message")
file(WRITE "${CURRENT_PACKAGES_DIR}/share/${PORT}/installed.txt" "${PORT} installed")
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"name": "vcpkg-e2e-test-fails-in-download-only",
"version": "1.0.0",
"dependencies": ["vcpkg-internal-e2e-test-port"]
}
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
set(VCPKG_POLICY_EMPTY_PACKAGE enabled)
file(MAKE_DIRECTORY "${CURRENT_PACKAGES_DIR}/share/${PORT}")
file(WRITE "${CURRENT_PACKAGES_DIR}/share/${PORT}/copyright" "copyright message")
file(WRITE "${CURRENT_PACKAGES_DIR}/share/${PORT}/installed.txt" "${PORT} installed")
1 change: 1 addition & 0 deletions azure-pipelines/end-to-end-tests-dir/asset-caching.ps1
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
. $PSScriptRoot/../end-to-end-tests-prelude.ps1

Refresh-TestRoot
Run-Vcpkg -TestArgs ($commonArgs + @('fetch', 'cmake'))
Run-Vcpkg -TestArgs ($commonArgs + @("install", "vcpkg-test-x-script", "--x-binarysource=clear", "--overlay-ports=$PSScriptRoot/../e2e-ports", "--x-asset-sources=x-script,$TestScriptAssetCacheExe {url} {sha512} {dst};x-block-origin"))
Throw-IfFailed
11 changes: 10 additions & 1 deletion azure-pipelines/end-to-end-tests-dir/build-test-ports.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,17 @@

$CurrentTest = "Build Test Ports"

Run-Vcpkg @commonArgs --overlay-ports="$PSScriptRoot/../e2e-ports" install vcpkg-internal-e2e-test-port3
$output = Run-VcpkgAndCaptureOutput @commonArgs --overlay-ports="$PSScriptRoot/../e2e-ports" install vcpkg-internal-e2e-test-port3
Throw-IfFailed
if ($output -match "Compiler found: ([^\r\n]+)") {
$detected = $matches[1]
if (-Not (Test-Path $detected)) {
throw "Did not print a valid compiler path (detected $detected)"
}
} else {
throw "Did not detect a compiler"
}


$output = Run-VcpkgAndCaptureOutput @commonArgs --overlay-ports="$PSScriptRoot/../e2e-ports/vcpkg-internal-e2e-test-port2" install vcpkg-internal-e2e-test-port2
Throw-IfFailed
Expand Down
22 changes: 11 additions & 11 deletions azure-pipelines/end-to-end-tests-dir/bundles.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,9 @@ $b = @{
downloads = Join-Path $VcpkgRoot "downloads"
packages = Join-Path $VcpkgRoot "packages"
installed = Join-Path $VcpkgRoot "installed"
versions_output = Join-Path $VcpkgRoot "buildtrees" "versioning_" "versions"
'versions-output' = Join-Path $VcpkgRoot "buildtrees" "versioning_" "versions"
tools = Join-Path $VcpkgRoot "downloads" "tools"
vcpkg_root = $VcpkgRoot
'vcpkg-root' = $VcpkgRoot
}
foreach ($k in $b.keys) {
if ($a[$k] -ne $b[$k]) {
Expand All @@ -67,9 +67,9 @@ $b = @{
downloads = Join-Path $cache_home "vcpkg" "downloads"
packages = $null
installed = $null
versions_output = $null
'versions-output' = $null
tools = Join-Path $cache_home "vcpkg" "downloads" "tools"
vcpkg_root = $VcpkgRoot
'vcpkg-root' = $VcpkgRoot
}
foreach ($k in $b.keys) {
if ($a[$k] -ne $b[$k]) {
Expand Down Expand Up @@ -97,10 +97,10 @@ $b = @{
downloads = Join-Path $cache_home "vcpkg" "downloads"
packages = Join-Path $manifestdir "vcpkg_installed" "vcpkg" "pkgs"
installed = Join-Path $manifestdir "vcpkg_installed"
versions_output = Join-Path $manifestdir "vcpkg_installed" "vcpkg" "blds" "versioning_" "versions"
'versions-output' = Join-Path $manifestdir "vcpkg_installed" "vcpkg" "blds" "versioning_" "versions"
tools = Join-Path $cache_home "vcpkg" "downloads" "tools"
vcpkg_root = $VcpkgRoot
manifest_mode_enabled = $True
'vcpkg-root' = $VcpkgRoot
'manifest-mode-enabled' = $True
}
foreach ($k in $b.keys) {
if ($a[$k] -ne $b[$k]) {
Expand Down Expand Up @@ -137,10 +137,10 @@ $b = @{
downloads = Join-Path $cache_home "vcpkg" "downloads"
packages = $packagesRoot
installed = $installRoot
versions_output = Join-Path $buildtreesRoot "versioning_" "versions"
'versions-output' = Join-Path $buildtreesRoot "versioning_" "versions"
tools = Join-Path $cache_home "vcpkg" "downloads" "tools"
vcpkg_root = $VcpkgRoot
manifest_mode_enabled = $True
'vcpkg-root' = $VcpkgRoot
'manifest-mode-enabled' = $True
}
foreach ($k in $b.keys) {
if ($a[$k] -ne $b[$k]) {
Expand Down Expand Up @@ -198,7 +198,7 @@ Run-Vcpkg search vcpkg-hello-world-1 @commonArgs `
Throw-IfFailed

# Test CI environment detection
$detected_ci_key = 'detected_ci_environment'
$detected_ci_key = 'detected-ci-environment'
$known_ci_vars = (
"env:VCPKG_NO_CI",
"env:TF_BUILD",
Expand Down
Loading

0 comments on commit f69db32

Please sign in to comment.