-
Notifications
You must be signed in to change notification settings - Fork 288
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add VCPKG_POST_PORTFILE_INCLUDES #1417
Merged
BillyONeal
merged 5 commits into
microsoft:main
from
Neumann-A:vcpkg_post_portfile_includes
Jul 25, 2024
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
4beee16
add VCPKG_POST_PORTFILE_INCLUDES
Neumann-A ea82218
add tests for VCPKG_POST_PORTFILE_INCLUDES
Neumann-A 82f4332
run generate message map
Neumann-A 7f97345
Merge remote-tracking branch 'origin/main' into vcpkg_post_portfile_i…
BillyONeal c300b82
Fix N^2 concat and whitespace nitpicks.
BillyONeal File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Empty file.
9 changes: 9 additions & 0 deletions
9
azure-pipelines/e2e-ports/post-portfile-includes-fail/post-portfile-includes.cmake
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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_POST_PORTFILE_INCLUDES "${CMAKE_CURRENT_LIST_DIR}/invalid.extension") |
1 change: 1 addition & 0 deletions
1
...pelines/e2e-ports/post-portfile-includes-fail/vcpkg-post-portfile-includes/portfile.cmake
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
set(VCPKG_POLICY_EMPTY_PACKAGE enabled) |
5 changes: 5 additions & 0 deletions
5
...e-pipelines/e2e-ports/post-portfile-includes-fail/vcpkg-post-portfile-includes/vcpkg.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"name": "vcpkg-post-portfile-includes", | ||
"version": "0", | ||
"description": "A port to test post portfile includes" | ||
} |
9 changes: 9 additions & 0 deletions
9
azure-pipelines/e2e-ports/post-portfile-includes/post-portfile-includes.cmake
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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_POST_PORTFILE_INCLUDES "${CMAKE_CURRENT_LIST_DIR}/test1.cmake;${CMAKE_CURRENT_LIST_DIR}/test2.cmake") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# Just a random comment | ||
set(VCPKG_POST_INCLUDE_CHECK_TEST2 ON) |
10 changes: 10 additions & 0 deletions
10
azure-pipelines/e2e-ports/post-portfile-includes/test2.cmake
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
|
||
if(NOT VCPKG_POST_INCLUDE_CHECK_TEST1) | ||
message(FATAL_ERROR "VCPKG_POST_INCLUDE_CHECK_TEST1 failed") | ||
endif() | ||
|
||
if(NOT VCPKG_POST_INCLUDE_CHECK_TEST2) | ||
message(FATAL_ERROR "VCPKG_POST_INCLUDE_CHECK_TEST2 failed") | ||
endif() | ||
|
||
message(STATUS "VCPKG_POST_INCLUDE_CHECK_TEST successful") |
35 changes: 35 additions & 0 deletions
35
azure-pipelines/e2e-ports/post-portfile-includes/vcpkg-post-portfile-includes/portfile.cmake
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
file(STRINGS "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}.vcpkg_abi_info.txt" lines) | ||
list(FILTER lines INCLUDE REGEX "post_portfile_include_(0|1)") | ||
list(GET lines 0 first_line) | ||
list(GET lines 1 second_line) | ||
|
||
set(expected1 "post_portfile_include_0 ad6ac07ed1e066eaf23af161afb36b25a3ec03af49cd3e52ceb3a91d388f23f8") | ||
set(expected2 "post_portfile_include_1 f8b37330094530b0fc7a5606fea7b491ec0e67edd1fd8f7e1a5607f7be0a3ff2") | ||
|
||
if(first_line STREQUAL "${expected1}") | ||
message(STATUS "ABI hash succesful!") | ||
else() | ||
message(FATAL_ERROR "First line in abi info is not the post include file to be hashed but:\n first_line: '${first_line}'\n expected: '${expected1}' ") | ||
endif() | ||
if(second_line STREQUAL "${expected2}") | ||
message(STATUS "ABI hash succesful!") | ||
else() | ||
message(FATAL_ERROR "Second line in abi info is not the second post include file to be hashed but:\n second_line: '${second_line}'\n expected: '${expected2}' ") | ||
endif() | ||
|
||
if(NOT Z_VCPKG_POST_PORTFILE_INCLUDES) | ||
message(FATAL_ERROR "Variable Z_VCPKG_POST_PORTFILE_INCLUDES not set by vcpkg-tool!") | ||
endif() | ||
|
||
set(path1 "${CMAKE_CURRENT_LIST_DIR}/../test1.cmake") | ||
cmake_path(NORMAL_PATH path1) | ||
set(path2 "${CMAKE_CURRENT_LIST_DIR}/../test2.cmake") | ||
cmake_path(NORMAL_PATH path2) | ||
|
||
if(NOT Z_VCPKG_POST_PORTFILE_INCLUDES STREQUAL "${path1};${path2}") | ||
message(FATAL_ERROR "Z_VCPKG_POST_PORTFILE_INCLUDES ist not equal to '${path1};${path2}' (Z_VCPKG_POST_PORTFILE_INCLUDES:'${Z_VCPKG_POST_PORTFILE_INCLUDES}') ") | ||
endif() | ||
|
||
set(VCPKG_POST_INCLUDE_CHECK_TEST1 ON) | ||
|
||
set(VCPKG_POLICY_EMPTY_PACKAGE enabled) |
5 changes: 5 additions & 0 deletions
5
azure-pipelines/e2e-ports/post-portfile-includes/vcpkg-post-portfile-includes/vcpkg.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"name": "vcpkg-post-portfile-includes", | ||
"version": "0", | ||
"description": "A port to test post portfile includes" | ||
} |
23 changes: 23 additions & 0 deletions
23
azure-pipelines/end-to-end-tests-dir/post-portfile-includes.ps1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
. $PSScriptRoot/../end-to-end-tests-prelude.ps1 | ||
|
||
Run-Vcpkg @directoryArgs ` | ||
"--overlay-triplets=$PSScriptRoot/../e2e-ports/post-portfile-includes" ` | ||
"--overlay-ports=$PSScriptRoot/../e2e-ports/post-portfile-includes" ` | ||
x-set-installed ` | ||
vcpkg-post-portfile-includes ` | ||
--host-triplet post-portfile-includes ` | ||
--binarysource=clear | ||
Throw-IfFailed | ||
|
||
$output = Run-VcpkgAndCaptureOutput @directoryArgs ` | ||
"--overlay-triplets=$PSScriptRoot/../e2e-ports/post-portfile-includes-fail" ` | ||
"--overlay-ports=$PSScriptRoot/../e2e-ports/post-portfile-includes-fail" ` | ||
x-set-installed ` | ||
vcpkg-post-portfile-includes ` | ||
--host-triplet post-portfile-includes ` | ||
--binarysource=clear | ||
Throw-IfNotFailed | ||
if ($output -notmatch "Variable VCPKG_POST_PORTFILE_INCLUDES contains invalid file path") | ||
{ | ||
throw "Expected to fail since VCPKG_POST_PORTFILE_INCLUDES is set to a relative path" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should the extensions check be dropped? CMake can include arbitrary files and if it is not in cmake syntax, cmake will complain about it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like the idea of requiring CMake for now; if someone complains we could always relax it later, but once shipped we can't strengthen it.