-
Notifications
You must be signed in to change notification settings - Fork 296
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[post build lint] Check for absolute paths (#172)
- Loading branch information
1 parent
7fbe87b
commit fcfbfa4
Showing
16 changed files
with
425 additions
and
1 deletion.
There are no files selected for viewing
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,3 @@ | ||
#!/bin/bash | ||
|
||
test="${CURRENT_INSTALLED_DIR}" |
36 changes: 36 additions & 0 deletions
36
azure-pipelines/e2e_ports/overlays/absolute-paths/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,36 @@ | ||
set(VCPKG_POLICY_EMPTY_INCLUDE_FOLDER enabled) | ||
|
||
if("usage" IN_LIST FEATURES) | ||
file(WRITE "${CURRENT_PACKAGES_DIR}/share/${PORT}/usage" "Set TEST=${CURRENT_INSTALLED_DIR} to use the port\n") | ||
endif() | ||
if("header" IN_LIST FEATURES) | ||
configure_file("${CURRENT_PORT_DIR}/source.h.in" "${CURRENT_PACKAGES_DIR}/include/test.h") | ||
endif() | ||
if("header-comment" IN_LIST FEATURES) | ||
configure_file("${CURRENT_PORT_DIR}/source-comment.h.in" "${CURRENT_PACKAGES_DIR}/include/test.h") | ||
endif() | ||
if("python" IN_LIST FEATURES) | ||
file(WRITE "${CURRENT_PACKAGES_DIR}/share/${PORT}/test.py" "test = \"${CURRENT_INSTALLED_DIR}\"\n") | ||
message(STATUS "Wtite to ${CURRENT_PACKAGES_DIR}/share/${PORT}/test.py") | ||
endif() | ||
if("python-comment" IN_LIST FEATURES) | ||
file(WRITE "${CURRENT_PACKAGES_DIR}/share/${PORT}/test.py" "# test = \"${CURRENT_INSTALLED_DIR}\"\n") | ||
endif() | ||
if("hash" IN_LIST FEATURES) | ||
configure_file("${CURRENT_PORT_DIR}/hash.in" "${CURRENT_PACKAGES_DIR}/share/${PORT}/test") | ||
endif() | ||
if("new-policy" IN_LIST FEATURES) | ||
set(VCPKG_POLICY_SKIP_ABSOLUTE_PATHS_CHECK enabled) | ||
endif() | ||
if("packages" IN_LIST FEATURES) | ||
file(WRITE "${CURRENT_PACKAGES_DIR}/share/${PORT}/test.py" "${CURRENT_PACKAGES_DIR}") | ||
endif() | ||
if("buildtrees" IN_LIST FEATURES) | ||
file(WRITE "${CURRENT_PACKAGES_DIR}/share/${PORT}/test.py" "${CURRENT_BUILDTREES_DIR}") | ||
endif() | ||
if("native" IN_LIST FEATURES) | ||
cmake_path(NATIVE_PATH CURRENT_INSTALLED_DIR CURRENT_INSTALLED_DIR_NATIVE) | ||
file(WRITE "${CURRENT_PACKAGES_DIR}/share/${PORT}/test.py" "${CURRENT_INSTALLED_DIR_NATIVE}") | ||
endif() | ||
|
||
file(INSTALL "${CMAKE_CURRENT_LIST_DIR}/../../../../LICENSE.txt" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright) |
6 changes: 6 additions & 0 deletions
6
azure-pipelines/e2e_ports/overlays/absolute-paths/source-comment.h.in
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,6 @@ | ||
|
||
// char * test = "${CURRENT_INSTALLED_DIR}" | ||
|
||
/* | ||
${CURRENT_INSTALLED_DIR} | ||
*/ |
5 changes: 5 additions & 0 deletions
5
azure-pipelines/e2e_ports/overlays/absolute-paths/source.h.in
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 @@ | ||
|
||
char * test2 = R"--(/* | ||
|
||
// ${CURRENT_INSTALLED_DIR} */ | ||
)--"; |
37 changes: 37 additions & 0 deletions
37
azure-pipelines/e2e_ports/overlays/absolute-paths/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,37 @@ | ||
{ | ||
"$schema": "https://raw.githubusercontent.com/microsoft/vcpkg-tool/main/docs/vcpkg.schema.json", | ||
"name": "absolute-paths", | ||
"version": "1.0.0", | ||
"features": { | ||
"usage": { | ||
"description": "" | ||
}, | ||
"header": { | ||
"description": "" | ||
}, | ||
"header-comment": { | ||
"description": "" | ||
}, | ||
"python": { | ||
"description": "" | ||
}, | ||
"python-comment": { | ||
"description": "" | ||
}, | ||
"hash": { | ||
"description": "" | ||
}, | ||
"new-policy": { | ||
"description": "" | ||
}, | ||
"packages": { | ||
"description": "" | ||
}, | ||
"buildtrees": { | ||
"description": "" | ||
}, | ||
"native": { | ||
"description": "" | ||
} | ||
} | ||
} |
41 changes: 41 additions & 0 deletions
41
azure-pipelines/end-to-end-tests-dir/no-absolute-paths.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,41 @@ | ||
. $PSScriptRoot/../end-to-end-tests-prelude.ps1 | ||
|
||
$CurrentTest = "No absolute paths" | ||
|
||
$commonArgs += @("--enforce-port-checks", "--binarysource=clear") | ||
|
||
Run-Vcpkg @commonArgs install "absolute-paths[hash]" | ||
Throw-IfNotFailed | ||
Remove-Item -Recurse -Force $installRoot | ||
|
||
Run-Vcpkg @commonArgs install "absolute-paths[python]" | ||
Throw-IfNotFailed | ||
Remove-Item -Recurse -Force $installRoot | ||
|
||
Run-Vcpkg @commonArgs install "absolute-paths[python-comment]" | ||
Throw-IfFailed | ||
Remove-Item -Recurse -Force $installRoot | ||
|
||
Run-Vcpkg @commonArgs install "absolute-paths[header]" | ||
Throw-IfNotFailed | ||
Remove-Item -Recurse -Force $installRoot | ||
|
||
Run-Vcpkg @commonArgs install "absolute-paths[header-comment]" | ||
Throw-IfFailed | ||
Remove-Item -Recurse -Force $installRoot | ||
|
||
Run-Vcpkg @commonArgs install "absolute-paths[usage]" | ||
Throw-IfNotFailed | ||
Remove-Item -Recurse -Force $installRoot | ||
|
||
Run-Vcpkg @commonArgs install "absolute-paths[usage, new-policy]" | ||
Throw-IfFailed | ||
Remove-Item -Recurse -Force $installRoot | ||
|
||
Run-Vcpkg @commonArgs install "absolute-paths[packages]" | ||
Throw-IfNotFailed | ||
Remove-Item -Recurse -Force $installRoot | ||
|
||
Run-Vcpkg @commonArgs install "absolute-paths[native]" | ||
Throw-IfNotFailed | ||
Remove-Item -Recurse -Force $installRoot |
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
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.