From 40b09b09e674ab289e27cb38790d3451a0f1b0c2 Mon Sep 17 00:00:00 2001 From: Billy Robert O'Neal III Date: Fri, 3 May 2024 14:04:23 -0700 Subject: [PATCH 01/14] Ensure that all post-build checks have skip policies. Depends on https://github.com/microsoft/vcpkg/pull/38629 Depends on https://github.com/microsoft/vcpkg-docs/pull/319 Also audited for: * Consistently following the 'IDE error format' pointing to portfile.cmake. * Consistently referring to the correct skip policy in the error message where applicable. * Printing paths and other information relative to ${CURRENT_PACKAGES_DIR} or similar as appropriate. * Debug before release. * Don't duplicate messages when a problem happens for both debug and release. Drive by bugfix: if (!build_info.policies.is_enabled(BuildPolicy::ONLY_RELEASE_CRT)) { error_count += check_crt_linkage_of_libs( build_info, false, debug_libs, debug_lib_info.value_or_exit(VCPKG_LINE_INFO), msg_sink); } was wrong; ONLY_RELEASE_CRT should mean 'these should all be release', not 'we aren't even going to look at debug'. It is fixed to: error_count += check_crt_linkage_of_libs(build_info.crt_linkage, build_info.policies.is_enabled(BuildPolicy::ONLY_RELEASE_CRT), debug_libs, debug_lib_info.value_or_exit(VCPKG_LINE_INFO), msg_sink); here. Drive-by bugfix: EMPTY_INCLUDE_FOLDER should not block CMAKE_HELPER_PORT from checking that the include folder is, in fact, empty. Drive-by bugfix: if (!violations.empty()) { msg_sink.println_warning(msgPortBugRestrictedHeaderPaths); print_paths(msg_sink, violations); msg_sink.println(msgPortBugRestrictedHeaderPaths); // <-- duplicate! return LintStatus::PROBLEM_DETECTED; } Drive-by bugfix: There were duplicate checks for the lib/cmake and debug/lib/cmake directories which even printed the same message; these have been merged. Drive-by bugfix: The existing copyright check emitted nonsense output that included full absolute paths like: warning: The software license must be available at ${CURRENT_PACKAGES_DIR}/share/cmdline/copyright. vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/D:/b/cmdline//LICENSE") since at least https://github.com/microsoft/vcpkg-tool/pull/1116/ That check has been basically rewritten to use vcpkg_install_copyright if there's only one src directory, and otherwise give up and print them all Drive-by bugfix: Several of the outdated CRTs didn't have the debug versions listed. Also, P was duplicated and there was no R for VC6. Drive-by bugfix: https://github.com/microsoft/vcpkg-tool/pull/1368/files#diff-9a4355abe0b8aae1ff2cd6cc86c0e4ce6bc4e6b7c469eb41332da0325cd20c88R984 broke usage text for header-only libs by adding an extra paren. --- .../test-dll-port-template/portfile.cmake | 77 +- .../test-dll-port-template/vcpkg.json | 57 +- .../test-exe-port-template/build.cmd | 4 + .../test-exe-port-template/portfile.cmake | 17 + .../e2e-assets/test-exe-port-template/test.c | 7 + .../test-exe-port-template/vcpkg.json | 12 + .../build.cmd | 6 + .../portfile.cmake | 16 + .../test.c | 6 + .../test.h | 1 + .../vcpkg.json | 12 + .../portfile.cmake | 3 + .../vcpkg.json | 7 +- .../overlays/vcpkg-header-only/portfile.cmake | 4 + .../overlays/vcpkg-header-only/vcpkg.json | 4 + .../portfile.cmake | 3 + .../vcpkg.json | 7 +- .../e2e-ports/vcpkg-msvc-2013/build.cmd | 5 + .../vcpkg-msvc-2013/debug/test_dll.dll | Bin 0 -> 7680 bytes .../vcpkg-msvc-2013/debug/test_dll.lib | Bin 0 -> 1716 bytes .../e2e-ports/vcpkg-msvc-2013/portfile.cmake | 23 + .../vcpkg-msvc-2013/release/test_dll.dll | Bin 0 -> 6144 bytes .../vcpkg-msvc-2013/release/test_dll.lib | Bin 0 -> 1716 bytes .../e2e-ports/vcpkg-msvc-2013/test.c | 17 + .../e2e-ports/vcpkg-msvc-2013/test.def | 4 + .../e2e-ports/vcpkg-msvc-2013/test.h | 1 + .../e2e-ports/vcpkg-msvc-2013/vcpkg.json | 12 + .../portfile.cmake | 27 + .../vcpkg-policy-absolute-paths/vcpkg.json | 24 + .../vcpkg-policy-copyright/portfile.cmake | 26 + .../vcpkg-policy-copyright/vcpkg.json | 18 + .../vcpkg-policy-empty-folders/portfile.cmake | 8 + .../vcpkg-policy-empty-folders/vcpkg.json | 9 + .../vcpkg-policy-empty-package/portfile.cmake | 1 + .../vcpkg-policy-empty-package/vcpkg.json | 4 + .../vcpkg-policy-forgot-usage/portfile.cmake | 6 + .../e2e-ports/vcpkg-policy-forgot-usage/usage | 1 + .../vcpkg-policy-forgot-usage/vcpkg.json | 9 + .../portfile.cmake | 46 + .../vcpkg-policy-include-folder/vcpkg.json | 36 + .../portfile.cmake | 29 + .../vcpkg.json | 18 + .../portfile.cmake | 124 ++ .../vcpkg.json | 58 + .../portfile.cmake | 16 + .../vcpkg.json | 9 + .../portfile.cmake | 1 + .../vcpkg-policy-set-incorrectly/vcpkg.json | 4 + .../portfile.cmake | 1 + .../vcpkg.json | 4 + .../post-build-checks.ps1 | 1021 ++++++++++- .../end-to-end-tests-dir/usage.ps1 | 10 +- include/vcpkg/base/contractual-constants.h | 34 + include/vcpkg/base/files.h | 11 +- include/vcpkg/base/fmt.h | 4 +- include/vcpkg/base/message-args.inc.h | 1 + include/vcpkg/base/message-data.inc.h | 359 ++-- include/vcpkg/base/path.h | 1 + include/vcpkg/base/span.h | 1 - include/vcpkg/base/stringview.h | 1 - include/vcpkg/base/util.h | 43 +- include/vcpkg/commands.build.h | 4 - include/vcpkg/fwd/build.h | 15 + locales/messages.json | 125 +- src/vcpkg-test/tools.cpp | 2 - src/vcpkg-test/util-tests.cpp | 6 +- src/vcpkg/base/checks.cpp | 1 + src/vcpkg/base/files.cpp | 83 + src/vcpkg/base/strings.cpp | 2 - src/vcpkg/commands.autocomplete.cpp | 2 +- src/vcpkg/commands.build.cpp | 57 +- src/vcpkg/commands.install.cpp | 2 +- src/vcpkg/dependencies.cpp | 2 +- src/vcpkg/export.prefab.cpp | 2 +- src/vcpkg/postbuildlint.cpp | 1585 +++++++++++------ 75 files changed, 3283 insertions(+), 875 deletions(-) create mode 100644 azure-pipelines/e2e-assets/test-exe-port-template/build.cmd create mode 100644 azure-pipelines/e2e-assets/test-exe-port-template/portfile.cmake create mode 100644 azure-pipelines/e2e-assets/test-exe-port-template/test.c create mode 100644 azure-pipelines/e2e-assets/test-exe-port-template/vcpkg.json create mode 100644 azure-pipelines/e2e-assets/test-lib-port-template-dynamic-crt-release-only/build.cmd create mode 100644 azure-pipelines/e2e-assets/test-lib-port-template-dynamic-crt-release-only/portfile.cmake create mode 100644 azure-pipelines/e2e-assets/test-lib-port-template-dynamic-crt-release-only/test.c create mode 100644 azure-pipelines/e2e-assets/test-lib-port-template-dynamic-crt-release-only/test.h create mode 100644 azure-pipelines/e2e-assets/test-lib-port-template-dynamic-crt-release-only/vcpkg.json create mode 100644 azure-pipelines/e2e-ports/overlays/vcpkg-header-only/portfile.cmake create mode 100644 azure-pipelines/e2e-ports/overlays/vcpkg-header-only/vcpkg.json create mode 100644 azure-pipelines/e2e-ports/vcpkg-msvc-2013/build.cmd create mode 100644 azure-pipelines/e2e-ports/vcpkg-msvc-2013/debug/test_dll.dll create mode 100644 azure-pipelines/e2e-ports/vcpkg-msvc-2013/debug/test_dll.lib create mode 100644 azure-pipelines/e2e-ports/vcpkg-msvc-2013/portfile.cmake create mode 100644 azure-pipelines/e2e-ports/vcpkg-msvc-2013/release/test_dll.dll create mode 100644 azure-pipelines/e2e-ports/vcpkg-msvc-2013/release/test_dll.lib create mode 100644 azure-pipelines/e2e-ports/vcpkg-msvc-2013/test.c create mode 100644 azure-pipelines/e2e-ports/vcpkg-msvc-2013/test.def create mode 100644 azure-pipelines/e2e-ports/vcpkg-msvc-2013/test.h create mode 100644 azure-pipelines/e2e-ports/vcpkg-msvc-2013/vcpkg.json create mode 100644 azure-pipelines/e2e-ports/vcpkg-policy-absolute-paths/portfile.cmake create mode 100644 azure-pipelines/e2e-ports/vcpkg-policy-absolute-paths/vcpkg.json create mode 100644 azure-pipelines/e2e-ports/vcpkg-policy-copyright/portfile.cmake create mode 100644 azure-pipelines/e2e-ports/vcpkg-policy-copyright/vcpkg.json create mode 100644 azure-pipelines/e2e-ports/vcpkg-policy-empty-folders/portfile.cmake create mode 100644 azure-pipelines/e2e-ports/vcpkg-policy-empty-folders/vcpkg.json create mode 100644 azure-pipelines/e2e-ports/vcpkg-policy-empty-package/portfile.cmake create mode 100644 azure-pipelines/e2e-ports/vcpkg-policy-empty-package/vcpkg.json create mode 100644 azure-pipelines/e2e-ports/vcpkg-policy-forgot-usage/portfile.cmake create mode 100644 azure-pipelines/e2e-ports/vcpkg-policy-forgot-usage/usage create mode 100644 azure-pipelines/e2e-ports/vcpkg-policy-forgot-usage/vcpkg.json create mode 100644 azure-pipelines/e2e-ports/vcpkg-policy-include-folder/portfile.cmake create mode 100644 azure-pipelines/e2e-ports/vcpkg-policy-include-folder/vcpkg.json create mode 100644 azure-pipelines/e2e-ports/vcpkg-policy-misplaced-cmake-files/portfile.cmake create mode 100644 azure-pipelines/e2e-ports/vcpkg-policy-misplaced-cmake-files/vcpkg.json create mode 100644 azure-pipelines/e2e-ports/vcpkg-policy-misplaced-pkgconfig/portfile.cmake create mode 100644 azure-pipelines/e2e-ports/vcpkg-policy-misplaced-pkgconfig/vcpkg.json create mode 100644 azure-pipelines/e2e-ports/vcpkg-policy-misplaced-regular-files/portfile.cmake create mode 100644 azure-pipelines/e2e-ports/vcpkg-policy-misplaced-regular-files/vcpkg.json create mode 100644 azure-pipelines/e2e-ports/vcpkg-policy-set-incorrectly/portfile.cmake create mode 100644 azure-pipelines/e2e-ports/vcpkg-policy-set-incorrectly/vcpkg.json create mode 100644 azure-pipelines/e2e-ports/vcpkg-policy-skip-all-post-build-checks/portfile.cmake create mode 100644 azure-pipelines/e2e-ports/vcpkg-policy-skip-all-post-build-checks/vcpkg.json diff --git a/azure-pipelines/e2e-assets/test-dll-port-template/portfile.cmake b/azure-pipelines/e2e-assets/test-dll-port-template/portfile.cmake index a474519fd3..8550092c7d 100644 --- a/azure-pipelines/e2e-assets/test-dll-port-template/portfile.cmake +++ b/azure-pipelines/e2e-assets/test-dll-port-template/portfile.cmake @@ -1,14 +1,69 @@ -file(MAKE_DIRECTORY "${CURRENT_PACKAGES_DIR}/bin") -file(MAKE_DIRECTORY "${CURRENT_PACKAGES_DIR}/lib") -file(MAKE_DIRECTORY "${CURRENT_PACKAGES_DIR}/debug") -file(MAKE_DIRECTORY "${CURRENT_PACKAGES_DIR}/debug/bin") -file(MAKE_DIRECTORY "${CURRENT_PACKAGES_DIR}/debug/lib") file(MAKE_DIRECTORY "${CURRENT_PACKAGES_DIR}/include") -file(MAKE_DIRECTORY "${CURRENT_PACKAGES_DIR}/share") -file(MAKE_DIRECTORY "${CURRENT_PACKAGES_DIR}/share/${PORT}") -file(COPY "${CMAKE_CURRENT_LIST_DIR}/debug/test_dll.dll" DESTINATION "${CURRENT_PACKAGES_DIR}/debug/bin") -file(COPY "${CMAKE_CURRENT_LIST_DIR}/debug/test_dll.lib" DESTINATION "${CURRENT_PACKAGES_DIR}/debug/lib") -file(COPY "${CMAKE_CURRENT_LIST_DIR}/release/test_dll.dll" DESTINATION "${CURRENT_PACKAGES_DIR}/bin") -file(COPY "${CMAKE_CURRENT_LIST_DIR}/release/test_dll.lib" DESTINATION "${CURRENT_PACKAGES_DIR}/lib") file(COPY "${CMAKE_CURRENT_LIST_DIR}/test.h" DESTINATION "${CURRENT_PACKAGES_DIR}/include") + +file(MAKE_DIRECTORY "${CURRENT_PACKAGES_DIR}/share/${PORT}") file(TOUCH "${CURRENT_PACKAGES_DIR}/share/${PORT}/copyright") + +if(release-only IN_LIST FEATURES AND NOT bad-release-only IN_LIST FEATURES) + set(VCPKG_BUILD_TYPE release) +endif() + +if(NOT install-no-lib-release IN_LIST FEATURES AND NOT debug-only IN_LIST FEATURES) + file(MAKE_DIRECTORY "${CURRENT_PACKAGES_DIR}/lib") + file(COPY "${CMAKE_CURRENT_LIST_DIR}/release/test_dll.lib" DESTINATION "${CURRENT_PACKAGES_DIR}/lib") +endif() + +if(NOT install-no-lib-debug IN_LIST FEATURES AND NOT release-only IN_LIST FEATURES) + file(MAKE_DIRECTORY "${CURRENT_PACKAGES_DIR}/debug/lib") + file(COPY "${CMAKE_CURRENT_LIST_DIR}/debug/test_dll.lib" DESTINATION "${CURRENT_PACKAGES_DIR}/debug/lib") +endif() + +if(install-to-lib IN_LIST FEATURES) + if(NOT debug-only IN_LIST FEATURES) + file(COPY "${CMAKE_CURRENT_LIST_DIR}/release/test_dll.dll" DESTINATION "${CURRENT_PACKAGES_DIR}/lib") + endif() + if(NOT release-only IN_LIST FEATURES) + file(COPY "${CMAKE_CURRENT_LIST_DIR}/debug/test_dll.dll" DESTINATION "${CURRENT_PACKAGES_DIR}/debug/lib") + endif() +else() + if(NOT debug-only IN_LIST FEATURES) + file(MAKE_DIRECTORY "${CURRENT_PACKAGES_DIR}/bin") + file(COPY "${CMAKE_CURRENT_LIST_DIR}/release/test_dll.dll" DESTINATION "${CURRENT_PACKAGES_DIR}/bin") + endif() + if(NOT release-only IN_LIST FEATURES) + file(MAKE_DIRECTORY "${CURRENT_PACKAGES_DIR}/debug/bin") + file(COPY "${CMAKE_CURRENT_LIST_DIR}/debug/test_dll.dll" DESTINATION "${CURRENT_PACKAGES_DIR}/debug/bin") + endif() +endif() + +if(extra-debug IN_LIST FEATURES) + file(INSTALL "${CMAKE_CURRENT_LIST_DIR}/debug/test_dll.lib" DESTINATION "${CURRENT_PACKAGES_DIR}/debug/lib" RENAME "test_dll2.lib") + file(INSTALL "${CMAKE_CURRENT_LIST_DIR}/debug/test_dll.dll" DESTINATION "${CURRENT_PACKAGES_DIR}/debug/bin" RENAME "test_dll2.dll") +endif() + +if(extra-release IN_LIST FEATURES) + file(INSTALL "${CMAKE_CURRENT_LIST_DIR}/release/test_dll.lib" DESTINATION "${CURRENT_PACKAGES_DIR}/lib" RENAME "test_dll2.lib") + file(INSTALL "${CMAKE_CURRENT_LIST_DIR}/release/test_dll.dll" DESTINATION "${CURRENT_PACKAGES_DIR}/bin" RENAME "test_dll2.dll") +endif() + +if(policy-skip-architecture-check IN_LIST FEATURES) + set(VCPKG_POLICY_SKIP_ARCHITECTURE_CHECK enabled) +endif() +if(policy-skip-appcontainer-check IN_LIST FEATURES) + set(VCPKG_POLICY_SKIP_APPCONTAINER_CHECK enabled) +endif() +if(policy-allow-dlls-in-lib IN_LIST FEATURES) + set(VCPKG_POLICY_ALLOW_DLLS_IN_LIB enabled) +endif() +if(policy-allow-kernel32-from-xbox IN_LIST FEATURES) + set(VCPKG_POLICY_ALLOW_KERNEL32_FROM_XBOX enabled) +endif() +if(policy-dlls-in-static-library IN_LIST FEATURES) + set(VCPKG_POLICY_DLLS_IN_STATIC_LIBRARY enabled) +endif() +if(policy-mismatched-number-of-binaries IN_LIST FEATURES) + set(VCPKG_POLICY_MISMATCHED_NUMBER_OF_BINARIES enabled) +endif() +if(policy-dlls-without-libs IN_LIST FEATURES) + set(VCPKG_POLICY_DLLS_WITHOUT_LIBS enabled) +endif() diff --git a/azure-pipelines/e2e-assets/test-dll-port-template/vcpkg.json b/azure-pipelines/e2e-assets/test-dll-port-template/vcpkg.json index e7b996246b..d9f5a237f3 100644 --- a/azure-pipelines/e2e-assets/test-dll-port-template/vcpkg.json +++ b/azure-pipelines/e2e-assets/test-dll-port-template/vcpkg.json @@ -1,4 +1,59 @@ { "name": "test-dll", - "version": "1.0.0" + "version": "1.0.0", + "features": { + "bad-release-only": { + "description": "Install only the release versions, but don't set the build type", + "dependencies": [ + { + "name": "test-dll", + "features": [ + "release-only" + ] + } + ] + }, + "debug-only": { + "description": "Install only the debug versions" + }, + "extra-debug": { + "description": "Install an extra debug DLL" + }, + "extra-release": { + "description": "Install an extra release DLL" + }, + "install-to-lib": { + "description": "Incorrectly install the DLL to lib instead of bin" + }, + "install-no-lib-debug": { + "description": "Incorrectly install no import lib for debug only" + }, + "install-no-lib-release": { + "description": "Incorrectly install no import lib for release only" + }, + "policy-allow-dlls-in-lib": { + "description": "Turn on VCPKG_POLICY_ALLOW_DLLS_IN_LIB" + }, + "policy-allow-kernel32-from-xbox": { + "description": "Turn on VCPKG_POLICY_ALLOW_KERNEL32_FROM_XBOX" + }, + "policy-dlls-in-static-library": { + "description": "Turn on VCPKG_POLICY_DLLS_IN_STATIC_LIBRARY" + }, + "policy-skip-appcontainer-check": { + "description": "Turn on VCPKG_POLICY_SKIP_APPCONTAINER_CHECK" + }, + "policy-skip-architecture-check": { + "description": "Turn on VCPKG_POLICY_SKIP_ARCHITECTURE_CHECK" + }, + "policy-mismatched-number-of-binaries": { + "description": "Turn on VCPKG_POLICY_MISMATCHED_NUMBER_OF_BINARIES" + }, + "policy-dlls-without-libs": { + "description": "Turn on VCPKG_POLICY_DLLS_WITHOUT_LIBS" + }, + "release-only": { + "description": "Install only the release versions" + } + } } diff --git a/azure-pipelines/e2e-assets/test-exe-port-template/build.cmd b/azure-pipelines/e2e-assets/test-exe-port-template/build.cmd new file mode 100644 index 0000000000..f4d8c93deb --- /dev/null +++ b/azure-pipelines/e2e-assets/test-exe-port-template/build.cmd @@ -0,0 +1,4 @@ +mkdir "%~dp0debug" +mkdir "%~dp0release" +cl /MDd "%~dp0test.c" /Fo"%~dp0debug\test.obj" /Fe"%~dp0debug\test_exe.exe" +cl /MD "%~dp0test.c" /Fo"%~dp0release\test.obj" /Fe"%~dp0release\test_exe.exe" diff --git a/azure-pipelines/e2e-assets/test-exe-port-template/portfile.cmake b/azure-pipelines/e2e-assets/test-exe-port-template/portfile.cmake new file mode 100644 index 0000000000..55f2ff8e23 --- /dev/null +++ b/azure-pipelines/e2e-assets/test-exe-port-template/portfile.cmake @@ -0,0 +1,17 @@ +set(VCPKG_POLICY_EMPTY_INCLUDE_FOLDER enabled) +file(MAKE_DIRECTORY "${CURRENT_PACKAGES_DIR}/share/${PORT}") +file(TOUCH "${CURRENT_PACKAGES_DIR}/share/${PORT}/copyright") + +if(release-only IN_LIST FEATURES) + set(VCPKG_BUILD_TYPE release) +else() + file(MAKE_DIRECTORY "${CURRENT_PACKAGES_DIR}/debug/bin") + file(COPY "${CMAKE_CURRENT_LIST_DIR}/debug/test_exe.exe" DESTINATION "${CURRENT_PACKAGES_DIR}/debug/bin") +endif() + +file(MAKE_DIRECTORY "${CURRENT_PACKAGES_DIR}/bin") +file(COPY "${CMAKE_CURRENT_LIST_DIR}/release/test_exe.exe" DESTINATION "${CURRENT_PACKAGES_DIR}/bin") + +if(policy-allow-exes-in-bin IN_LIST FEATURES) + set(VCPKG_POLICY_ALLOW_EXES_IN_BIN enabled) +endif() diff --git a/azure-pipelines/e2e-assets/test-exe-port-template/test.c b/azure-pipelines/e2e-assets/test-exe-port-template/test.c new file mode 100644 index 0000000000..a2c2e7f581 --- /dev/null +++ b/azure-pipelines/e2e-assets/test-exe-port-template/test.c @@ -0,0 +1,7 @@ +#include + +int main() +{ + puts("hello world"); + return 0; +} diff --git a/azure-pipelines/e2e-assets/test-exe-port-template/vcpkg.json b/azure-pipelines/e2e-assets/test-exe-port-template/vcpkg.json new file mode 100644 index 0000000000..1824794729 --- /dev/null +++ b/azure-pipelines/e2e-assets/test-exe-port-template/vcpkg.json @@ -0,0 +1,12 @@ +{ + "name": "test-exe", + "version": "1.0.0", + "features": { + "release-only": { + "description": "Only install release binaries" + }, + "policy-allow-exes-in-bin": { + "description": "Turn on VCPKG_POLICY_ALLOW_EXES_IN_BIN" + } + } +} diff --git a/azure-pipelines/e2e-assets/test-lib-port-template-dynamic-crt-release-only/build.cmd b/azure-pipelines/e2e-assets/test-lib-port-template-dynamic-crt-release-only/build.cmd new file mode 100644 index 0000000000..04aa31b18a --- /dev/null +++ b/azure-pipelines/e2e-assets/test-lib-port-template-dynamic-crt-release-only/build.cmd @@ -0,0 +1,6 @@ +mkdir "%~dp0debug" +mkdir "%~dp0release" +cl /c /DNDEBUG /MD "%~dp0test.c" /Fo"%~dp0debug\test.obj" +lib "%~dp0debug\test.obj" /OUT:"%~dp0debug\test_lib.lib" +cl /c /DNDEBUG /MD "%~dp0test.c" /Fo"%~dp0release\test.obj" +lib "%~dp0release\test.obj" /OUT:"%~dp0release\test_lib.lib" diff --git a/azure-pipelines/e2e-assets/test-lib-port-template-dynamic-crt-release-only/portfile.cmake b/azure-pipelines/e2e-assets/test-lib-port-template-dynamic-crt-release-only/portfile.cmake new file mode 100644 index 0000000000..5b334e0001 --- /dev/null +++ b/azure-pipelines/e2e-assets/test-lib-port-template-dynamic-crt-release-only/portfile.cmake @@ -0,0 +1,16 @@ +file(MAKE_DIRECTORY "${CURRENT_PACKAGES_DIR}/lib") +file(MAKE_DIRECTORY "${CURRENT_PACKAGES_DIR}/debug") +file(MAKE_DIRECTORY "${CURRENT_PACKAGES_DIR}/debug/lib") +file(MAKE_DIRECTORY "${CURRENT_PACKAGES_DIR}/include") +file(MAKE_DIRECTORY "${CURRENT_PACKAGES_DIR}/share") +file(MAKE_DIRECTORY "${CURRENT_PACKAGES_DIR}/share/${PORT}") +file(COPY "${CMAKE_CURRENT_LIST_DIR}/debug/test_lib.lib" DESTINATION "${CURRENT_PACKAGES_DIR}/debug/lib") +file(COPY "${CMAKE_CURRENT_LIST_DIR}/release/test_lib.lib" DESTINATION "${CURRENT_PACKAGES_DIR}/lib") +file(COPY "${CMAKE_CURRENT_LIST_DIR}/test.h" DESTINATION "${CURRENT_PACKAGES_DIR}/include") +file(TOUCH "${CURRENT_PACKAGES_DIR}/share/${PORT}/copyright") +if (policy-skip-crt-linkage-check IN_LIST FEATURES) + set(VCPKG_POLICY_SKIP_CRT_LINKAGE_CHECK enabled) +endif() +if (policy-only-release-crt IN_LIST FEATURES) + set(VCPKG_POLICY_ONLY_RELEASE_CRT enabled) +endif() diff --git a/azure-pipelines/e2e-assets/test-lib-port-template-dynamic-crt-release-only/test.c b/azure-pipelines/e2e-assets/test-lib-port-template-dynamic-crt-release-only/test.c new file mode 100644 index 0000000000..ea23efed90 --- /dev/null +++ b/azure-pipelines/e2e-assets/test-lib-port-template-dynamic-crt-release-only/test.c @@ -0,0 +1,6 @@ +#include + +int __cdecl test_fn() { + puts("You called the static lib function!"); + return 42; +} diff --git a/azure-pipelines/e2e-assets/test-lib-port-template-dynamic-crt-release-only/test.h b/azure-pipelines/e2e-assets/test-lib-port-template-dynamic-crt-release-only/test.h new file mode 100644 index 0000000000..aecc80983d --- /dev/null +++ b/azure-pipelines/e2e-assets/test-lib-port-template-dynamic-crt-release-only/test.h @@ -0,0 +1 @@ +int __cdecl test_fn(); diff --git a/azure-pipelines/e2e-assets/test-lib-port-template-dynamic-crt-release-only/vcpkg.json b/azure-pipelines/e2e-assets/test-lib-port-template-dynamic-crt-release-only/vcpkg.json new file mode 100644 index 0000000000..21e686ec8d --- /dev/null +++ b/azure-pipelines/e2e-assets/test-lib-port-template-dynamic-crt-release-only/vcpkg.json @@ -0,0 +1,12 @@ +{ + "name": "test-lib", + "version": "1.0.0", + "features": { + "policy-skip-crt-linkage-check": { + "description": "Turn on VCPKG_POLICY_SKIP_CRT_LINKAGE_CHECK" + }, + "policy-only-release-crt": { + "description": "Turn on VCPKG_POLICY_ONLY_RELEASE_CRT" + } + } +} diff --git a/azure-pipelines/e2e-assets/test-lib-port-template-dynamic-crt/portfile.cmake b/azure-pipelines/e2e-assets/test-lib-port-template-dynamic-crt/portfile.cmake index d902620688..0df5fb47df 100644 --- a/azure-pipelines/e2e-assets/test-lib-port-template-dynamic-crt/portfile.cmake +++ b/azure-pipelines/e2e-assets/test-lib-port-template-dynamic-crt/portfile.cmake @@ -10,3 +10,6 @@ file(COPY "${CMAKE_CURRENT_LIST_DIR}/release/test_lib.lib" DESTINATION "${CURREN file(COPY "${CMAKE_CURRENT_LIST_DIR}/both/both_lib.lib" DESTINATION "${CURRENT_PACKAGES_DIR}/lib") file(COPY "${CMAKE_CURRENT_LIST_DIR}/test.h" DESTINATION "${CURRENT_PACKAGES_DIR}/include") file(TOUCH "${CURRENT_PACKAGES_DIR}/share/${PORT}/copyright") +if (policy-skip-crt-linkage-check IN_LIST FEATURES) + set(VCPKG_POLICY_SKIP_CRT_LINKAGE_CHECK enabled) +endif() diff --git a/azure-pipelines/e2e-assets/test-lib-port-template-dynamic-crt/vcpkg.json b/azure-pipelines/e2e-assets/test-lib-port-template-dynamic-crt/vcpkg.json index aace75bf6b..06cb4bc60e 100644 --- a/azure-pipelines/e2e-assets/test-lib-port-template-dynamic-crt/vcpkg.json +++ b/azure-pipelines/e2e-assets/test-lib-port-template-dynamic-crt/vcpkg.json @@ -1,4 +1,9 @@ { "name": "test-lib", - "version": "1.0.0" + "version": "1.0.0", + "features": { + "policy-skip-crt-linkage-check": { + "description": "Turn on VCPKG_POLICY_SKIP_CRT_LINKAGE_CHECK" + } + } } diff --git a/azure-pipelines/e2e-ports/overlays/vcpkg-header-only/portfile.cmake b/azure-pipelines/e2e-ports/overlays/vcpkg-header-only/portfile.cmake new file mode 100644 index 0000000000..b6c2c65494 --- /dev/null +++ b/azure-pipelines/e2e-ports/overlays/vcpkg-header-only/portfile.cmake @@ -0,0 +1,4 @@ +file(MAKE_DIRECTORY "${CURRENT_PACKAGES_DIR}/share/${PORT}") +file(WRITE "${CURRENT_PACKAGES_DIR}/share/${PORT}/copyright" "license text") +file(MAKE_DIRECTORY "${CURRENT_PACKAGES_DIR}/include") +file(WRITE "${CURRENT_PACKAGES_DIR}/include/vcpkg-header-only.h" "// header only port") diff --git a/azure-pipelines/e2e-ports/overlays/vcpkg-header-only/vcpkg.json b/azure-pipelines/e2e-ports/overlays/vcpkg-header-only/vcpkg.json new file mode 100644 index 0000000000..44fa328c81 --- /dev/null +++ b/azure-pipelines/e2e-ports/overlays/vcpkg-header-only/vcpkg.json @@ -0,0 +1,4 @@ +{ + "name": "vcpkg-header-only", + "version": "1" +} diff --git a/azure-pipelines/e2e-ports/vcpkg-internal-dll-with-no-exports/portfile.cmake b/azure-pipelines/e2e-ports/vcpkg-internal-dll-with-no-exports/portfile.cmake index 400e965ec8..527cf71216 100644 --- a/azure-pipelines/e2e-ports/vcpkg-internal-dll-with-no-exports/portfile.cmake +++ b/azure-pipelines/e2e-ports/vcpkg-internal-dll-with-no-exports/portfile.cmake @@ -10,3 +10,6 @@ file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/lib" "${CURRENT_PACKAGES_DIR}/lib") file(TOUCH "${CURRENT_PACKAGES_DIR}/share/${PORT}/copyright") +if(policy IN_LIST FEATURES) + set(VCPKG_POLICY_DLLS_WITHOUT_EXPORTS enabled) +endif() diff --git a/azure-pipelines/e2e-ports/vcpkg-internal-dll-with-no-exports/vcpkg.json b/azure-pipelines/e2e-ports/vcpkg-internal-dll-with-no-exports/vcpkg.json index 721a3a90f1..86537381cb 100644 --- a/azure-pipelines/e2e-ports/vcpkg-internal-dll-with-no-exports/vcpkg.json +++ b/azure-pipelines/e2e-ports/vcpkg-internal-dll-with-no-exports/vcpkg.json @@ -6,5 +6,10 @@ "name": "vcpkg-cmake", "host": true } - ] + ], + "features": { + "policy": { + "description": "Turn on VCPKG_POLICY_DLLS_WITHOUT_EXPORTS" + } + } } diff --git a/azure-pipelines/e2e-ports/vcpkg-msvc-2013/build.cmd b/azure-pipelines/e2e-ports/vcpkg-msvc-2013/build.cmd new file mode 100644 index 0000000000..41af15602b --- /dev/null +++ b/azure-pipelines/e2e-ports/vcpkg-msvc-2013/build.cmd @@ -0,0 +1,5 @@ +:: This must be run from a Visual Studio 2013 command prompt +mkdir "%~dp0debug" +mkdir "%~dp0release" +cl /MDd "%~dp0test.c" "%~dp0test.def" /Fo"%~dp0debug\test.obj" /Fe"%~dp0debug\test_dll.dll" /link /DLL +cl /MD "%~dp0test.c" "%~dp0test.def" /Fo"%~dp0release\test.obj" /Fe"%~dp0release\test_dll.dll" /link /DLL diff --git a/azure-pipelines/e2e-ports/vcpkg-msvc-2013/debug/test_dll.dll b/azure-pipelines/e2e-ports/vcpkg-msvc-2013/debug/test_dll.dll new file mode 100644 index 0000000000000000000000000000000000000000..ed29ef27e2df37a9c9feb4f2e398b8abfd3d99dd GIT binary patch literal 7680 zcmeHMeQaCTb-$z}N4BYmPRvxvoSAZ@)Ja{HAF@S})T%{#j+2QAC5v{F%4I0>Nfb?y z0{Nal+Gw!M7!CI-%-f2s*k&M(HXz%Y)(M8h&VZJVwJ>YtR1Ms~E7U>>RD%N5RBMEW z$hf@y&V7%P948I7KenOEdpP&pd(OG{o^$Rw=RQ%s$4;{<##l8#RT(=EOiw3oe{-`8 z_RZU0zM1{w#>sTr|oC=Lv!=XeXDOm?aYf4U7M-tZVhxc1YlM%6{ zu5MG4zO>`ezrKFN`_h>T{KKUu&PaUx;+YumR}--_GRFtcjB|W|^DjMf@XS$+FFkWu z$0Ho~jfA7L*2ih?7Z~d?RI`=8X&3%CWa?&-wVEt(jUD0plD_=ep9Sod@? zmTO6g@nl%H2?Q>;ZJiLhAm4XA<(3I-6bw^@i#IuQi&NN&?5;ocF6QQi6~6O#R8>{> zRcC#3dEqKil)&7D$Dye+w_N}HmaMRn8DC-2tx90U6PS}XLW(PIEWVlPh(L}>rr7qv zL&z(rUF^!&5RpWpUxx#tC(smzU|wdr_Eb(HMecwi(I<#`jF?>-Q=3Tc$c$fQ@QDUz zdU;`)Of9_d0gU%oX9HLA!VFOq-<6kFjo*|NmNVnaWW2EK5w4K&Gh|tD)p(;+5951L z5U}T>7fkK2dsWL;D3TRQneh^W%s* zp99VdOT^C$3xp6;nL;%Mm#^&cl~T7OcrtE={SkT;YM{3pWM~G4Cs0Zoi-$2ssa;iN zc2zP^&KlLg>{$v+1gfU#lEMRYReV7S6g+_?xmFS8J;H+2p!k-uz5=M(KuHl6vckOL zo6q{ni+d45FjIvtMkP>!g#-K$YAYK~k>O{l;rXDQG#Ql{pP`ff7w+?~ZQ^NxP+v<$ zo^ll5l&>{~w`<4|X20Sy^(ukdzQPt-WZHE749Lemh(5Ig0cQRkW{#Ytt^Aqk<^2Z^ zp52LbunQ&UKl>+z~hd z&|OsAg>X=|C`KLzOR#souh2yvnXbL0aED@0aVRDs)6@cGcX4yRhMbGBdI@o)_?9Et zIud>~_~kEAp;McqP+Dz{prrud_00rxU}@DpZ`N1Rix+~e{-yii)Y4?Xp&=V67jIEe zuW|-dEu=%{;!cF8CbXelSV`XnA`ZsWYf9Zlxv|fLT&a4nw%un+*MLy0E`IMrwN~FB z@pSHnc$)o<@dSe?fXFad=`UPE2SozzzAZ0YA+qijMYyu~0!jI5Kj&M>`ev2DEMf;! zswlChYvJO|_&k$u)r-{XyqV%SQc&q_ns^)YPf&fDqkt{qK<9w5@myATZB_oYqEGJ^ zyH}5IdSZMUX_Z?m?U=3I1j1GAD08&d>MA)}o}cH9N4J`#~72U zow=fi9PcY@=ZLeJaMR~0XIT}L%UlCLycIrcGpymPno4P)OBnIco9Uq9#iWgy4yr3m z-lJ3G3Poy)<`6*9CmV4wu$T}%O&z0Z*#&B5x*=0C$cCB9I;2`p%oknaLb2+YRkhf- z;8x8F)Wx+6-NG+)UeEOlov!2JX4sY|U$N_=NUKM)H^k4<$Hb3*c-NO_Dj=$S3nja1 ziF3`W7oWmbvD!iyd4T0twam{?`sRBl0}Fa}BAfh$7QTQfE6gdr zh3hOuTI+_BoAqm zc6d%-36(&#)Pm>~${?y1(`tV*u!IR_KB4RsmMU|WdG#ny3T5Xkip#`!nf9kVDL;%( z@lM3?#9O2X&ISDMZ@Hhbi*K7Z<9-d$N8l9c2BC_2x`hY6dknFlyxKu1z4f%R0Ut9) zbvE;A^~486Oa0=@s~?;2-+}L*(BuhySe|HHUTyA&1!}V&ZN>8%hCidN(4^plci{hZ zpORbvd_~xbOLgtqiu!SJMoIlb3!l`0Nouo;@351%t-ST3_3$&0jqhGs3_%!jouIDi zfb~@i18HgiF%&ZtzG&cj@R(@V`k4;mF?kc%R*e+hSj}>U?b=|y&RB0^sR`d)vCkAX zfK8v37wBrae9u&;oxZfa)LLBB-q}j+ZX2~7yU-4O-SP-Wbv+#2xs#)sCXSk|9DRNp z&|m*?jUPx6*i<*i)l>U`CxzOnej1;eLk#C@PQyzEW?*NDIn{$vzNQl`sh_Xu=3JD| z8o%DVK!1WB{t?Tc><5MPKF=wyA#=&&+5Wl`r(B%J*Cd5?wx^~P-G+lMJWn62lqYI) zH~0TO-uCd;iWaMV`h0>1euCPO1N=SU8-T9>Vt~g0zXx~+K+lmTT&jRS1w0K%0L}yE z0KW#9Aa^(5arFBEoq$%r-GBzb2Eexg%Xew(t#3Qc%$)no+IbDR2O^PyBVj3-jHd^} zDT&~y(=iZ<$J3HLG(=(rkAbk%gPvEtF!X6#}r9G~fzK6S^nWb0VF~r<#0NO;*9${hFlf)Z`!~jMq zj4Svkb20~)jdQ-lWHy9%fQ9(1HIKAlCOx0**N~JM?UmPOpI9_SH>qS+WvciLx2kX+&Z}$#Lg}~ek%N#b$nWP-|cJhRr&32 z2V#+Qsz3wA+W=MqSp5ZHd~=CuDM--twqOhnr9_eU6NX?{O4=_hS&C*g=TQP7M3hs9n^c@20a`XLy4et zd`!fCL&;zwG%BXi#m0$HoU!MOP(Lh=Nx^6+5s8bb)?hd}I+{$dlh^~t7!e2M;bAcq zj3$$Z8GD`9Oi6)+CLR&^_{n3;diu8;O zrb4OXT~I&G8Vy1sj9P@%}*Qdr0VUI(R^QRLFix`z`dqqe&V6sENnLh*gS;R;|8aFeE3!5<jl8w>8=BwLNG%XdAZ0Z7JI^+c#~0Yx|k)n(ZCi z4*P@lpgn3IwV$&8k^P(Yzq3DYzhM8d{ipV8_Fvk!JMMP`9Yc=ejuVbI9RKDhJ2pDa z&fA?<=b&@cnQ|U=KH)s+{4?h@XVLi|&gNEE>!YoS)}OTgqP21Np4}&RKePMU-FxT*5cI^z1OYtr?s>pQMjTyMDw zu4UJIE>ruC_RqH4+xN7;*nYA7_4YU0f8PFn`v&)I?wDJ4pLA#4XWTEiFSsweueyKc zUU4^h?(w)iou0j(9#5ZV&?9@k;`wvWoab#%!Sjx1#q++$;H~x6dvEjJ>230U&g=Ag zyj|Xhy^nYgdBfgO?@@2o`&ZuQyf1oR_0D+T@Lu&Ie5~3v|D^3H+ct;Q5phHvPdlD< Re9JNIc+F98{9g{R{{%PcP$>Wa literal 0 HcmV?d00001 diff --git a/azure-pipelines/e2e-ports/vcpkg-msvc-2013/debug/test_dll.lib b/azure-pipelines/e2e-ports/vcpkg-msvc-2013/debug/test_dll.lib new file mode 100644 index 0000000000000000000000000000000000000000..06996d5d10a2ee9853ca2cfa645c3dd0df27b33f GIT binary patch literal 1716 zcmcIlyG|QH6g|6Z9w#*`>;|Egl z0aQ``fF_l{AVrFFY4Qyz=-}Sf!t38~bK+mK`tS zGUCZ3U^lT!=(NdO~&aRyjDAaMzd`uqt|+}hbL2V(u>?uT-5C)h5Fuznnh+R+h& zDDC#M;kZE3bTLexKZ+TBpJ>d>Z7_TP>DPf!472GFyBOA`Fi zC?FUxk)WSNmY);JL;l_$r3ybyS>mW3tAx9fmo?c>`i6zSUsoEF6wNqAMa@Xp>Yq*y z=6Cxdutt+FN|0j#skL;oRtYQfS+z7xlOOc`kpLwJ1!Q_sZ%M+Kh6 z@Pb85=s_)DDm6wRAINQjzKiphTg_^>ecWz@_G0<9?H5a%(ds`PEAvJ^fVdXTQq&Ux z3DeDx7u9yFL+)Oj|HjpoGRS+lv4191)CDR(BZmr!;$useLR{7%AlC6>gz-7Gi8ulmd&e|FTQ2J$U?u)cjxVaTjr@$F&p`o=}o(3uEJUGrxN5i-24ub(^q79 ccwBT{NkyCgL->aJ2ESf2QGDb2^RAZ**HZ&WnE(I) literal 0 HcmV?d00001 diff --git a/azure-pipelines/e2e-ports/vcpkg-msvc-2013/portfile.cmake b/azure-pipelines/e2e-ports/vcpkg-msvc-2013/portfile.cmake new file mode 100644 index 0000000000..e93548bbb5 --- /dev/null +++ b/azure-pipelines/e2e-ports/vcpkg-msvc-2013/portfile.cmake @@ -0,0 +1,23 @@ +file(MAKE_DIRECTORY "${CURRENT_PACKAGES_DIR}/share/${PORT}") +file(WRITE "${CURRENT_PACKAGES_DIR}/share/${PORT}/copyright" "MIT License.") + +file(MAKE_DIRECTORY "${CURRENT_PACKAGES_DIR}/include/vcpkg-msvc-2013") +file(COPY "${CMAKE_CURRENT_LIST_DIR}/test.h" DESTINATION "${CURRENT_PACKAGES_DIR}/include/vcpkg-msvc-2013") + +if(release-only IN_LIST FEATURES) + set(VCPKG_BUILD_TYPE "release") +else() + file(MAKE_DIRECTORY "${CURRENT_PACKAGES_DIR}/debug/bin") + file(MAKE_DIRECTORY "${CURRENT_PACKAGES_DIR}/debug/lib") + file(COPY "${CMAKE_CURRENT_LIST_DIR}/debug/test_dll.dll" DESTINATION "${CURRENT_PACKAGES_DIR}/debug/bin") + file(COPY "${CMAKE_CURRENT_LIST_DIR}/debug/test_dll.lib" DESTINATION "${CURRENT_PACKAGES_DIR}/debug/lib") +endif() + +file(MAKE_DIRECTORY "${CURRENT_PACKAGES_DIR}/bin") +file(MAKE_DIRECTORY "${CURRENT_PACKAGES_DIR}/lib") +file(COPY "${CMAKE_CURRENT_LIST_DIR}/release/test_dll.dll" DESTINATION "${CURRENT_PACKAGES_DIR}/bin") +file(COPY "${CMAKE_CURRENT_LIST_DIR}/release/test_dll.lib" DESTINATION "${CURRENT_PACKAGES_DIR}/lib") + +if(policy IN_LIST FEATURES) + set(VCPKG_POLICY_ALLOW_OBSOLETE_MSVCRT enabled) +endif() diff --git a/azure-pipelines/e2e-ports/vcpkg-msvc-2013/release/test_dll.dll b/azure-pipelines/e2e-ports/vcpkg-msvc-2013/release/test_dll.dll new file mode 100644 index 0000000000000000000000000000000000000000..77ba791253375fa33ba6ad998796bde5650b7f63 GIT binary patch literal 6144 zcmeHLeQaCR6~B({)=8blKuoh0gtI27w2=ARFQnNFjoY-u#c4xYv!;$4ztnaUJ9>E! zwOg~5xgL10>AJRzih)81Fa~S_?St~6*1=sf++txL~KLEf|Z%dDB+b#0fD|Bxb6+b%Uuh9%8GCi;F69TaW%`@$mjp zp)U{K0+pVSB1k~!_|D}(27n1bIm#ChGEbRaqQnOQ4I)MX zajTR?)Rrz#XqL2=6S4-6w9R$jS7lO_iZX8{eH6wdy5t#vq4Jif88E!(-RUF$9Z_C{Y z0>$piIYwY1zWKwFFK7Sh2;3%4CVKQLp-A-Te6sN>6EQrcYI#vlhO-0uF!E}UjbW$~ z$2CWm!KIc=b9gtXY;1zmFHSYf#xigNyKF!^fRg70tu5`|l1W@kq;+^L;XhwV4AMa@ zAw!x9%_8u3f%n_eTQWGKu@PR74b2-%lGmZ?``tJ)nJ(F9#H9ZDF1jlf+2l}v8O}}h z%!)qEgr??2exWTb{(h?D=>^HOFf}oM$TN#2BvH#_O#xpVy+(QmCFwu=eTZcT^-ngI z!c}o9CBVy)J@?UjIH=D##aK$vr&@FgZ2u;=xw?jbZ)5g$)oT9lvMp=1QJl&OQ)>BC zc3;s!_oXwsS;{jbpAx+@)n2`z69q%HN5?-YzLWCmajrO)^5`ZWNL-M49YVK>1~GSt z620t=sk15NBGo;!CCM}#wWaS;pM6GQ&i)F7=B_09D7b83Y_d45EdJ#1sBPz0RVzD2 z3j%y0f-{P+OgO@O;6Zo?(2$k}j)qWr3s2wgM_3Prd8+OLl8#eh)+s-7tf3AiYIkD| z;jao)D!qo)SjHF2f?=a9=wu@m%UUIYX?I}Dx5T$;h2=|6D;+@dfUzv-VJ^+5_d2ep zCQ(CphMwAvQ&CMcXJ>40q*`Xh9(}6TjEYEkW|LS~T}yW_*)xi@H8Z?6Ar}Zt|J_&% zM;7KC8BsQ%Nq-u4IjPk1fh=EC9G;^XpUo)}vP!7JZI@xm2I}GoX!86wusnZKVNNKI zBxUM^TDT>D$|9Iek1b9wp?Bcz`4!7^dKtb=EEc_!qDmww&v>IxvcVOvBM$Y$5#mcs>Tp269Zpz0Gq&IPdOcI20jf%|5`3my7+{cg0i%l`D^2k0 z1}gJqHS6Jh;ZJ29_9xice78CUyIg+)JKpOVM|98lP==y|_FVatPkMzOa9l6Wqj~3~N%RpUj+eD$>GB5UpJym1c$9a6QQVKhm~>h#oS~q)^Sk zCeU7wZXiVG$$#bj$F9{Q@PTu;5r4HfU(j4;V7#hZaby&wPVgc1iGzNMQpHG)=I5C!vghvueF%`3 zkIk`rwiKVN0J=V}AD*M9^7rT5EB_nwKsiB`UxK?a-wW6eFk!boP(paNn-7FKI;sGK z-O&~2_&_I1HHJAcYz4p6guE$hs1`A!xiV4ib292*QZM7DB4 zZs$t4-%ZL@o>&|HSK^B+9+3;Aj-5NdLDML(+)f|Mwa2;6V62T@85gMUq^Mvu%dZqT zj*aoTlh%aD!a36HaS)PIRJvhjH_vu9MLOA=x{(!@a%7u&O?O@HfTdC@U*~DCS+jZmc>R4T`C>-E9~bbCx{eMuWa7iDDcf%_X%}K`Jc@Tt zdr>ZcHYd}sfKPwrSlt)%MqhgMxgvni9i57h5_5%lnb~b#YrfUoWR9BeFyCu_#QeDV zHS<5r@0oR$g_fljyQS8$+Tyj`W=UFlEe9<3TJEnXAgR)Ae1~KGz}F zeXa*xkGg*AI_5gzdd+nivxvExS;Ab$e4TMJwM-pz3$vc_Gp$UR>0)*;dzfD40CSjm zh=+?uiAi|PO9_!rI_ BW*h(j literal 0 HcmV?d00001 diff --git a/azure-pipelines/e2e-ports/vcpkg-msvc-2013/release/test_dll.lib b/azure-pipelines/e2e-ports/vcpkg-msvc-2013/release/test_dll.lib new file mode 100644 index 0000000000000000000000000000000000000000..06996d5d10a2ee9853ca2cfa645c3dd0df27b33f GIT binary patch literal 1716 zcmcIlyG|QH6g|6Z9w#*`>;|Egl z0aQ``fF_l{AVrFFY4Qyz=-}Sf!t38~bK+mK`tS zGUCZ3U^lT!=(NdO~&aRyjDAaMzd`uqt|+}hbL2V(u>?uT-5C)h5Fuznnh+R+h& zDDC#M;kZE3bTLexKZ+TBpJ>d>Z7_TP>DPf!472GFyBOA`Fi zC?FUxk)WSNmY);JL;l_$r3ybyS>mW3tAx9fmo?c>`i6zSUsoEF6wNqAMa@Xp>Yq*y z=6Cxdutt+FN|0j#skL;oRtYQfS+z7xlOOc`kpLwJ1!Q_sZ%M+Kh6 z@Pb85=s_)DDm6wRAINQjzKiphTg_^>ecWz@_G0<9?H5a%(ds`PEAvJ^fVdXTQq&Ux z3DeDx7u9yFL+)Oj|HjpoGRS+lv4191)CDR(BZmr!;$useLR{7%AlC6>gz-7Gi8ulmd&e|FTQ2J$U?u)cjxVaTjr@$F&p`o=}o(3uEJUGrxN5i-24ub(^q79 ccwBT{NkyCgL->aJ2ESf2QGDb2^RAZ**HZ&WnE(I) literal 0 HcmV?d00001 diff --git a/azure-pipelines/e2e-ports/vcpkg-msvc-2013/test.c b/azure-pipelines/e2e-ports/vcpkg-msvc-2013/test.c new file mode 100644 index 0000000000..69fc354ef0 --- /dev/null +++ b/azure-pipelines/e2e-ports/vcpkg-msvc-2013/test.c @@ -0,0 +1,17 @@ +#include +#include + +BOOLEAN WINAPI DllMain(HINSTANCE hDllHandle, DWORD nReason, LPVOID Reserved) +{ + (void)Reserved; + if (nReason == DLL_PROCESS_ATTACH) { + DisableThreadLibraryCalls( hDllHandle ); + } + + return TRUE; +} + +int __cdecl export_me() { + puts("You called the exported function!"); + return 42; +} diff --git a/azure-pipelines/e2e-ports/vcpkg-msvc-2013/test.def b/azure-pipelines/e2e-ports/vcpkg-msvc-2013/test.def new file mode 100644 index 0000000000..aa9fb49c31 --- /dev/null +++ b/azure-pipelines/e2e-ports/vcpkg-msvc-2013/test.def @@ -0,0 +1,4 @@ +LIBRARY test_dll + +EXPORTS +export_me diff --git a/azure-pipelines/e2e-ports/vcpkg-msvc-2013/test.h b/azure-pipelines/e2e-ports/vcpkg-msvc-2013/test.h new file mode 100644 index 0000000000..10d2052384 --- /dev/null +++ b/azure-pipelines/e2e-ports/vcpkg-msvc-2013/test.h @@ -0,0 +1 @@ + // empty test header diff --git a/azure-pipelines/e2e-ports/vcpkg-msvc-2013/vcpkg.json b/azure-pipelines/e2e-ports/vcpkg-msvc-2013/vcpkg.json new file mode 100644 index 0000000000..ffc1c97194 --- /dev/null +++ b/azure-pipelines/e2e-ports/vcpkg-msvc-2013/vcpkg.json @@ -0,0 +1,12 @@ +{ + "name": "vcpkg-msvc-2013", + "version": "1", + "features": { + "policy": { + "description": "Set VCPKG_POLICY_ALLOW_OBSOLETE_MSVCRT" + }, + "release-only": { + "description": "Only install the release DLL" + } + } +} diff --git a/azure-pipelines/e2e-ports/vcpkg-policy-absolute-paths/portfile.cmake b/azure-pipelines/e2e-ports/vcpkg-policy-absolute-paths/portfile.cmake new file mode 100644 index 0000000000..2a86a70a71 --- /dev/null +++ b/azure-pipelines/e2e-ports/vcpkg-policy-absolute-paths/portfile.cmake @@ -0,0 +1,27 @@ +file(MAKE_DIRECTORY "${CURRENT_PACKAGES_DIR}/share/${PORT}") +file(WRITE "${CURRENT_PACKAGES_DIR}/share/${PORT}/copyright" "N/A") + +set(PROBLEM_TEXT "") +if(build-dir IN_LIST FEATURES) + string(APPEND PROBLEM_TEXT "build-dir: ${CURRENT_BUILDTREES_DIR}\n") +endif() +if(downloads IN_LIST FEATURES) + string(APPEND PROBLEM_TEXT "downloads: ${DOWNLOADS}\n") +endif() +if(installed-root IN_LIST FEATURES) + string(APPEND PROBLEM_TEXT "installed-root: ${CURRENT_INSTALLED_DIR}\n") +endif() +if(package-dir IN_LIST FEATURES) + string(APPEND PROBLEM_TEXT "package-dir: ${CURRENT_PACKAGES_DIR}\n") +endif() +if(pkgconfig IN_LIST FEATURES) + file(MAKE_DIRECTORY "${CURRENT_PACKAGES_DIR}/share/pkgconfig") + file(WRITE "${CURRENT_PACKAGES_DIR}/share/pkgconfig/vcpkg-policy-absolute-paths.pc" "${PROBLEM_TEXT}") +endif() + +file(MAKE_DIRECTORY "${CURRENT_PACKAGES_DIR}/include") +file(WRITE "${CURRENT_PACKAGES_DIR}/include/vcpkg-policy-absolute-paths.h" "${PROBLEM_TEXT}") + +if(policy IN_LIST FEATURES) + set(VCPKG_POLICY_SKIP_ABSOLUTE_PATHS_CHECK enabled) +endif() diff --git a/azure-pipelines/e2e-ports/vcpkg-policy-absolute-paths/vcpkg.json b/azure-pipelines/e2e-ports/vcpkg-policy-absolute-paths/vcpkg.json new file mode 100644 index 0000000000..eef114b5e7 --- /dev/null +++ b/azure-pipelines/e2e-ports/vcpkg-policy-absolute-paths/vcpkg.json @@ -0,0 +1,24 @@ +{ + "name": "vcpkg-policy-absolute-paths", + "version": "1", + "features": { + "build-dir": { + "description": "write CURRENT_BUILDTREES_DIR into the file" + }, + "downloads": { + "description": "write DOWNLOADS into the file" + }, + "installed-root": { + "description": "write CURRENT_INSTALLED_DIR into the file" + }, + "package-dir": { + "description": "write CURRENT_PACKAGES_DIR into the file" + }, + "pkgconfig": { + "description": "also add a pkgconfig file" + }, + "policy": { + "description": "turn on VCPKG_POLICY_SKIP_ABSOLUTE_PATHS_CHECK" + } + } +} diff --git a/azure-pipelines/e2e-ports/vcpkg-policy-copyright/portfile.cmake b/azure-pipelines/e2e-ports/vcpkg-policy-copyright/portfile.cmake new file mode 100644 index 0000000000..310f8ff7c1 --- /dev/null +++ b/azure-pipelines/e2e-ports/vcpkg-policy-copyright/portfile.cmake @@ -0,0 +1,26 @@ +set(VCPKG_POLICY_EMPTY_INCLUDE_FOLDER enabled) + +if(copyright-directory IN_LIST FEATURES) + file(MAKE_DIRECTORY "${CURRENT_PACKAGES_DIR}/share/${PORT}/copyright") + file(WRITE "${CURRENT_PACKAGES_DIR}/share/${PORT}/copyright/LICENSE.txt" "this is some license text") + file(WRITE "${CURRENT_PACKAGES_DIR}/share/${PORT}/copyright/COPYING" "this is some different license text") +else() + # Intentionally do not create "${CURRENT_PACKAGES_DIR}/share/${PORT}/copyright" +endif() + +if(source IN_LIST FEATURES) + set(SOURCE_PATH "${CURRENT_BUILDTREES_DIR}/src/v1.16.3-6f5be3c3eb.clean") + file(MAKE_DIRECTORY "${SOURCE_PATH}") + file(WRITE "${SOURCE_PATH}/LICENSE.txt" "this is some license text") +endif() + +if(source2 IN_LIST FEATURES) + set(SOURCE_PATH "${CURRENT_BUILDTREES_DIR}/src/v1.3.1-2e5db616bf.clean") + file(MAKE_DIRECTORY "${SOURCE_PATH}") + file(WRITE "${SOURCE_PATH}/LICENSE.txt" "this is some license text") + file(WRITE "${SOURCE_PATH}/COPYING" "this is some different license text") +endif() + +if (policy IN_LIST FEATURES) + set(VCPKG_POLICY_SKIP_COPYRIGHT_CHECK enabled) +endif() diff --git a/azure-pipelines/e2e-ports/vcpkg-policy-copyright/vcpkg.json b/azure-pipelines/e2e-ports/vcpkg-policy-copyright/vcpkg.json new file mode 100644 index 0000000000..c03d160fc9 --- /dev/null +++ b/azure-pipelines/e2e-ports/vcpkg-policy-copyright/vcpkg.json @@ -0,0 +1,18 @@ +{ + "name": "vcpkg-policy-copyright", + "version": "1", + "features": { + "policy": { + "description": "enable VCPKG_POLICY_SKIP_COPYRIGHT_CHECK" + }, + "source": { + "description": "Create a source so that ${SOURCE_PATH} can be assumed to work" + }, + "source2": { + "description": "Create another source so that ${SOURCE_PATH} can't be assumed to work" + }, + "copyright-directory": { + "description": "create ${CURRENT_PACKAGES_DIR}/share/${PORT}/copyright as a directory" + } + } +} diff --git a/azure-pipelines/e2e-ports/vcpkg-policy-empty-folders/portfile.cmake b/azure-pipelines/e2e-ports/vcpkg-policy-empty-folders/portfile.cmake new file mode 100644 index 0000000000..7823bafd2d --- /dev/null +++ b/azure-pipelines/e2e-ports/vcpkg-policy-empty-folders/portfile.cmake @@ -0,0 +1,8 @@ +set(VCPKG_POLICY_EMPTY_INCLUDE_FOLDER enabled) +file(MAKE_DIRECTORY "${CURRENT_PACKAGES_DIR}/share/${PORT}") +file(WRITE "${CURRENT_PACKAGES_DIR}/share/${PORT}/copyright" "this is some license text") +file(MAKE_DIRECTORY "${CURRENT_PACKAGES_DIR}/empty-directory") +file(MAKE_DIRECTORY "${CURRENT_PACKAGES_DIR}/root/empty-inner-directory") +if (policy IN_LIST FEATURES) + set(VCPKG_POLICY_ALLOW_EMPTY_FOLDERS enabled) +endif() diff --git a/azure-pipelines/e2e-ports/vcpkg-policy-empty-folders/vcpkg.json b/azure-pipelines/e2e-ports/vcpkg-policy-empty-folders/vcpkg.json new file mode 100644 index 0000000000..b13a15e240 --- /dev/null +++ b/azure-pipelines/e2e-ports/vcpkg-policy-empty-folders/vcpkg.json @@ -0,0 +1,9 @@ +{ + "name": "vcpkg-policy-empty-folders", + "version": "1", + "features": { + "policy": { + "description": "enable VCPKG_POLICY_ALLOW_EMPTY_FOLDERS" + } + } +} diff --git a/azure-pipelines/e2e-ports/vcpkg-policy-empty-package/portfile.cmake b/azure-pipelines/e2e-ports/vcpkg-policy-empty-package/portfile.cmake new file mode 100644 index 0000000000..065116c276 --- /dev/null +++ b/azure-pipelines/e2e-ports/vcpkg-policy-empty-package/portfile.cmake @@ -0,0 +1 @@ +set(VCPKG_POLICY_EMPTY_PACKAGE enabled) diff --git a/azure-pipelines/e2e-ports/vcpkg-policy-empty-package/vcpkg.json b/azure-pipelines/e2e-ports/vcpkg-policy-empty-package/vcpkg.json new file mode 100644 index 0000000000..52bd12b38f --- /dev/null +++ b/azure-pipelines/e2e-ports/vcpkg-policy-empty-package/vcpkg.json @@ -0,0 +1,4 @@ +{ + "name": "vcpkg-policy-empty-package", + "version": "1" +} diff --git a/azure-pipelines/e2e-ports/vcpkg-policy-forgot-usage/portfile.cmake b/azure-pipelines/e2e-ports/vcpkg-policy-forgot-usage/portfile.cmake new file mode 100644 index 0000000000..2ad5b56e0b --- /dev/null +++ b/azure-pipelines/e2e-ports/vcpkg-policy-forgot-usage/portfile.cmake @@ -0,0 +1,6 @@ +set(VCPKG_POLICY_EMPTY_INCLUDE_FOLDER enabled) +file(MAKE_DIRECTORY "${CURRENT_PACKAGES_DIR}/share/${PORT}") +file(WRITE "${CURRENT_PACKAGES_DIR}/share/${PORT}/copyright" "this is some license text") +if (policy IN_LIST FEATURES) + set(VCPKG_POLICY_SKIP_USAGE_INSTALL_CHECK enabled) +endif() diff --git a/azure-pipelines/e2e-ports/vcpkg-policy-forgot-usage/usage b/azure-pipelines/e2e-ports/vcpkg-policy-forgot-usage/usage new file mode 100644 index 0000000000..12c77dbfe1 --- /dev/null +++ b/azure-pipelines/e2e-ports/vcpkg-policy-forgot-usage/usage @@ -0,0 +1 @@ +usage text one forgot to install diff --git a/azure-pipelines/e2e-ports/vcpkg-policy-forgot-usage/vcpkg.json b/azure-pipelines/e2e-ports/vcpkg-policy-forgot-usage/vcpkg.json new file mode 100644 index 0000000000..412ca2f89a --- /dev/null +++ b/azure-pipelines/e2e-ports/vcpkg-policy-forgot-usage/vcpkg.json @@ -0,0 +1,9 @@ +{ + "name": "vcpkg-policy-forgot-usage", + "version": "1", + "features": { + "policy": { + "description": "enable VCPKG_POLICY_SKIP_USAGE_INSTALL_CHECK" + } + } +} diff --git a/azure-pipelines/e2e-ports/vcpkg-policy-include-folder/portfile.cmake b/azure-pipelines/e2e-ports/vcpkg-policy-include-folder/portfile.cmake new file mode 100644 index 0000000000..96831029c3 --- /dev/null +++ b/azure-pipelines/e2e-ports/vcpkg-policy-include-folder/portfile.cmake @@ -0,0 +1,46 @@ +file(MAKE_DIRECTORY "${CURRENT_PACKAGES_DIR}/share/${PORT}") +file(WRITE "${CURRENT_PACKAGES_DIR}/share/${PORT}/copyright" "N/A") + +if(do-install IN_LIST FEATURES) + file(MAKE_DIRECTORY "${CURRENT_PACKAGES_DIR}/include") + file(WRITE "${CURRENT_PACKAGES_DIR}/include/vcpkg-policy-include-folder.h" "") +endif() + +if(do-install-debug IN_LIST FEATURES) + file(MAKE_DIRECTORY "${CURRENT_PACKAGES_DIR}/debug/include") + file(WRITE "${CURRENT_PACKAGES_DIR}/debug/include/vcpkg-policy-include-folder.h" "") +endif() + +if(do-install-debug-share IN_LIST FEATURES) + file(MAKE_DIRECTORY "${CURRENT_PACKAGES_DIR}/debug/share") + file(WRITE "${CURRENT_PACKAGES_DIR}/debug/share/example.txt" "") +endif() + +if(do-install-restricted IN_LIST FEATURES) + file(MAKE_DIRECTORY "${CURRENT_PACKAGES_DIR}/include") + file(WRITE "${CURRENT_PACKAGES_DIR}/include/json.h" "") +endif() + +if(do-install-vcpkg-port-config IN_LIST FEATURES) + file(WRITE "${CURRENT_PACKAGES_DIR}/share/${PORT}/vcpkg-port-config.cmake" "") +endif() + +if(policy-empty-include-folder IN_LIST FEATURES) + set(VCPKG_POLICY_EMPTY_INCLUDE_FOLDER enabled) +endif() + +if(policy-cmake-helper-port IN_LIST FEATURES) + set(VCPKG_POLICY_CMAKE_HELPER_PORT enabled) +endif() + +if(policy-allow-restricted-headers IN_LIST FEATURES) + set(VCPKG_POLICY_ALLOW_RESTRICTED_HEADERS enabled) +endif() + +if(policy-allow-debug-include IN_LIST FEATURES) + set(VCPKG_POLICY_ALLOW_DEBUG_INCLUDE enabled) +endif() + +if(policy-allow-debug-share IN_LIST FEATURES) + set(VCPKG_POLICY_ALLOW_DEBUG_SHARE enabled) +endif() diff --git a/azure-pipelines/e2e-ports/vcpkg-policy-include-folder/vcpkg.json b/azure-pipelines/e2e-ports/vcpkg-policy-include-folder/vcpkg.json new file mode 100644 index 0000000000..3fd01f14cf --- /dev/null +++ b/azure-pipelines/e2e-ports/vcpkg-policy-include-folder/vcpkg.json @@ -0,0 +1,36 @@ +{ + "name": "vcpkg-policy-include-folder", + "version": "1", + "features": { + "do-install": { + "description": "Put a header in include" + }, + "do-install-debug": { + "description": "Put a header in debug/include" + }, + "do-install-debug-share": { + "description": "Put a file in debug/share" + }, + "do-install-restricted": { + "description": "Put a restricted header in include" + }, + "do-install-vcpkg-port-config": { + "description": "install a share/${PORT}/vcpkg-port-config.cmake file" + }, + "policy-allow-debug-include": { + "description": "Turn on VCPKG_POLICY_ALLOW_DEBUG_INCLUDE" + }, + "policy-allow-debug-share": { + "description": "Turn on VCPKG_POLICY_ALLOW_DEBUG_SHARE" + }, + "policy-allow-restricted-headers": { + "description": "Turn on VCPKG_POLICY_ALLOW_RESTRICTED_HEADERS" + }, + "policy-cmake-helper-port": { + "description": "Turn on VCPKG_POLICY_CMAKE_HELPER_PORT" + }, + "policy-empty-include-folder": { + "description": "Turn on VCPKG_POLICY_EMPTY_INCLUDE_FOLDER" + } + } +} diff --git a/azure-pipelines/e2e-ports/vcpkg-policy-misplaced-cmake-files/portfile.cmake b/azure-pipelines/e2e-ports/vcpkg-policy-misplaced-cmake-files/portfile.cmake new file mode 100644 index 0000000000..f805cfb777 --- /dev/null +++ b/azure-pipelines/e2e-ports/vcpkg-policy-misplaced-cmake-files/portfile.cmake @@ -0,0 +1,29 @@ +file(MAKE_DIRECTORY "${CURRENT_PACKAGES_DIR}/share/${PORT}") +file(WRITE "${CURRENT_PACKAGES_DIR}/share/legitimate.cmake" "# Hello!") +file(WRITE "${CURRENT_PACKAGES_DIR}/share/${PORT}/copyright" "N/A") + +# Avoid the empty include directory check +file(MAKE_DIRECTORY "${CURRENT_PACKAGES_DIR}/include") +file(WRITE "${CURRENT_PACKAGES_DIR}/include/vcpkg-include-folder-policies.h" "") + +if (do-install-cmake IN_LIST FEATURES) + file(MAKE_DIRECTORY "${CURRENT_PACKAGES_DIR}/cmake") + file(WRITE "${CURRENT_PACKAGES_DIR}/cmake/some_cmake.cmake" "# Hello!") + file(MAKE_DIRECTORY "${CURRENT_PACKAGES_DIR}/debug/cmake") + file(WRITE "${CURRENT_PACKAGES_DIR}/debug/cmake/some_cmake.cmake" "# Hello!") +endif() + +if(do-install-lib IN_LIST FEATURES) + file(MAKE_DIRECTORY "${CURRENT_PACKAGES_DIR}/lib/cmake") + file(WRITE "${CURRENT_PACKAGES_DIR}/lib/cmake/some_cmake.cmake" "# Hello!") + file(MAKE_DIRECTORY "${CURRENT_PACKAGES_DIR}/debug/lib/cmake") + file(WRITE "${CURRENT_PACKAGES_DIR}/debug/lib/cmake/some_cmake.cmake" "# Hello!") +endif() + +if (policy-skip-misplaced-cmake-files-check IN_LIST FEATURES) + set(VCPKG_POLICY_SKIP_MISPLACED_CMAKE_FILES_CHECK enabled) +endif() + +if (policy-skip-lib-cmake-merge-check IN_LIST FEATURES) + set(VCPKG_POLICY_SKIP_LIB_CMAKE_MERGE_CHECK enabled) +endif() diff --git a/azure-pipelines/e2e-ports/vcpkg-policy-misplaced-cmake-files/vcpkg.json b/azure-pipelines/e2e-ports/vcpkg-policy-misplaced-cmake-files/vcpkg.json new file mode 100644 index 0000000000..1d997115ab --- /dev/null +++ b/azure-pipelines/e2e-ports/vcpkg-policy-misplaced-cmake-files/vcpkg.json @@ -0,0 +1,18 @@ +{ + "name": "vcpkg-policy-misplaced-cmake-files", + "version": "1", + "features": { + "do-install-cmake": { + "description": "Put CMake files in cmake and debug/cmake" + }, + "do-install-lib": { + "description": "Put CMake files in lib and debug/lib" + }, + "policy-skip-misplaced-cmake-files-check": { + "description": "Turn on VCPKG_POLICY_SKIP_MISPLACED_CMAKE_FILES_CHECK" + }, + "policy-skip-lib-cmake-merge-check": { + "description": "Turn on VCPKG_POLICY_SKIP_LIB_CMAKE_MERGE_CHECK" + } + } +} diff --git a/azure-pipelines/e2e-ports/vcpkg-policy-misplaced-pkgconfig/portfile.cmake b/azure-pipelines/e2e-ports/vcpkg-policy-misplaced-pkgconfig/portfile.cmake new file mode 100644 index 0000000000..fd98dde9a3 --- /dev/null +++ b/azure-pipelines/e2e-ports/vcpkg-policy-misplaced-pkgconfig/portfile.cmake @@ -0,0 +1,124 @@ +file(MAKE_DIRECTORY "${CURRENT_PACKAGES_DIR}/share/${PORT}") +file(WRITE "${CURRENT_PACKAGES_DIR}/share/${PORT}/copyright" "N/A") + +# Avoid the empty include directory check +file(MAKE_DIRECTORY "${CURRENT_PACKAGES_DIR}/include") +file(WRITE "${CURRENT_PACKAGES_DIR}/include/vcpkg-misplaced-pkgconfig.h" "") + +set(ARCH_DEPENDENT_DEBUG_PC_CONTENT [[prefix=${pcfiledir}/../.. +exec_prefix=${prefix} +libdir=${prefix}/lib +sharedlibdir=${prefix}/lib +includedir=${prefix}/../include + +Name: zlib +Description: zlib compression library +Version: 1.3.1 + + +Libs: "-L${libdir}" "-L${sharedlibdir}" -lz +Requires: +Cflags: "-I${includedir}" +]]) + +if(install-arch-dependent-good IN_LIST FEATURES) + file(MAKE_DIRECTORY "${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig") + file(WRITE "${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig/zlib.pc" "${ARCH_DEPENDENT_DEBUG_PC_CONTENT}") +endif() + +set(ARCH_DEPENDENT_PC_CONTENT [[prefix=${pcfiledir}/../.. +exec_prefix=${prefix} +libdir=${prefix}/lib +sharedlibdir=${prefix}/lib +includedir=${prefix}/include + +Name: zlib +Description: zlib compression library +Version: 1.3.1 + +Requires: +Libs: "-L${libdir}" "-L${sharedlibdir}" -lzlib +Cflags: "-I${includedir}" +]]) + +if(install-arch-dependent-good-release-only IN_LIST FEATURES) + file(MAKE_DIRECTORY "${CURRENT_PACKAGES_DIR}/lib/pkgconfig") + file(WRITE "${CURRENT_PACKAGES_DIR}/lib/pkgconfig/zlib.pc" "${ARCH_DEPENDENT_PC_CONTENT}") +endif() + +if(install-arch-dependent-bad-share IN_LIST FEATURES) + file(MAKE_DIRECTORY "${CURRENT_PACKAGES_DIR}/share/pkgconfig") + file(WRITE "${CURRENT_PACKAGES_DIR}/share/pkgconfig/zlib.pc" "${ARCH_DEPENDENT_PC_CONTENT}") +endif() + +if(install-arch-dependent-bad-misplaced IN_LIST FEATURES) + file(MAKE_DIRECTORY "${CURRENT_PACKAGES_DIR}/debug/bin/pkgconfig") + file(WRITE "${CURRENT_PACKAGES_DIR}/debug/bin/pkgconfig/zlib.pc" "${ARCH_DEPENDENT_DEBUG_PC_CONTENT}") +endif() + +if(install-arch-dependent-bad-misplaced-release-only IN_LIST FEATURES) + file(MAKE_DIRECTORY "${CURRENT_PACKAGES_DIR}/bin/pkgconfig") + file(WRITE "${CURRENT_PACKAGES_DIR}/bin/pkgconfig/zlib.pc" "${ARCH_DEPENDENT_PC_CONTENT}") +endif() + +set(ARCH_AGNOSTIC_WITH_EMPTY_LIBS_PC_CONTENT [[prefix=${pcfiledir}/../.. +exec_prefix=${prefix} +libdir=${prefix}/lib +sharedlibdir=${prefix}/lib +includedir=${prefix}/include + +Name: zlib +Description: zlib compression library +Version: 1.3.1 + +Requires: +Libs: +Cflags: "-I${includedir}" +]]) + +if(install-arch-agnostic-empty-libs-good IN_LIST FEATURES) + file(MAKE_DIRECTORY "${CURRENT_PACKAGES_DIR}/lib/pkgconfig") + file(WRITE "${CURRENT_PACKAGES_DIR}/lib/pkgconfig/zlib-no-libs.pc" "${ARCH_AGNOSTIC_WITH_EMPTY_LIBS_PC_CONTENT}") +endif() + +if(install-arch-agnostic-empty-libs-good-share IN_LIST FEATURES) + file(MAKE_DIRECTORY "${CURRENT_PACKAGES_DIR}/share/pkgconfig") + file(WRITE "${CURRENT_PACKAGES_DIR}/share/pkgconfig/zlib-no-libs.pc" "${ARCH_AGNOSTIC_WITH_EMPTY_LIBS_PC_CONTENT}") +endif() + +if(install-arch-agnostic-empty-libs-bad-misplaced IN_LIST FEATURES) + file(MAKE_DIRECTORY "${CURRENT_PACKAGES_DIR}/bin/pkgconfig") + file(WRITE "${CURRENT_PACKAGES_DIR}/bin/pkgconfig/zlib-no-libs.pc" "${ARCH_AGNOSTIC_WITH_EMPTY_LIBS_PC_CONTENT}") +endif() + +set(ARCH_AGNOSTIC_PC_CONTENT [[prefix=${pcfiledir}/../.. +exec_prefix=${prefix} +includedir=${prefix}/include + +Name: libmorton +Description: C++ header-only library to efficiently encode/decode Morton codes in/from 2D/3D coordinates +URL: https://github.com/Forceflow/libmorton +Version: 0.2.8 + + +Cflags: "-I${includedir}" +]]) + +if(install-arch-agnostic-good IN_LIST FEATURES) + file(MAKE_DIRECTORY "${CURRENT_PACKAGES_DIR}/lib/pkgconfig") + file(WRITE "${CURRENT_PACKAGES_DIR}/lib/pkgconfig/libmorton.pc" "${ARCH_AGNOSTIC_PC_CONTENT}") +endif() + +if(install-arch-agnostic-good-share IN_LIST FEATURES) + file(MAKE_DIRECTORY "${CURRENT_PACKAGES_DIR}/share/pkgconfig") + file(WRITE "${CURRENT_PACKAGES_DIR}/share/pkgconfig/libmorton.pc" "${ARCH_AGNOSTIC_PC_CONTENT}") +endif() + +if(install-arch-agnostic-bad-misplaced IN_LIST FEATURES) + file(MAKE_DIRECTORY "${CURRENT_PACKAGES_DIR}/bin/pkgconfig") + file(WRITE "${CURRENT_PACKAGES_DIR}/bin/pkgconfig/libmorton.pc" "${ARCH_AGNOSTIC_PC_CONTENT}") +endif() + +if (policy IN_LIST FEATURES) + set(VCPKG_POLICY_SKIP_PKGCONFIG_CHECK enabled) +endif() diff --git a/azure-pipelines/e2e-ports/vcpkg-policy-misplaced-pkgconfig/vcpkg.json b/azure-pipelines/e2e-ports/vcpkg-policy-misplaced-pkgconfig/vcpkg.json new file mode 100644 index 0000000000..798b916bb6 --- /dev/null +++ b/azure-pipelines/e2e-ports/vcpkg-policy-misplaced-pkgconfig/vcpkg.json @@ -0,0 +1,58 @@ +{ + "name": "vcpkg-policy-misplaced-pkgconfig", + "version": "1", + "features": { + "install-arch-agnostic-bad-misplaced": { + "description": "Install arch-agnostic bad pc files to an illegal place" + }, + "install-arch-agnostic-empty-libs-bad-misplaced": { + "description": "Install arch-agnostic bad pc files with empty libs directive to an illegal place" + }, + "install-arch-agnostic-empty-libs-good": { + "description": "Install arch-agnostic good pc files with empty libs directive" + }, + "install-arch-agnostic-empty-libs-good-share": { + "description": "Install arch-agnostic good pc files with empty libs directive to share" + }, + "install-arch-agnostic-good": { + "description": "Install arch-agnostic good pc files" + }, + "install-arch-agnostic-good-share": { + "description": "Install arch-agnostic good pc files to share" + }, + "install-arch-dependent-bad-misplaced": { + "description": "Install arch-dependent bad pc files to an illegal place", + "dependencies": [ + { + "name": "vcpkg-policy-misplaced-pkgconfig", + "features": [ + "install-arch-dependent-bad-misplaced-release-only" + ] + } + ] + }, + "install-arch-dependent-bad-misplaced-release-only": { + "description": "Install arch-dependent bad pc files to an illegal place" + }, + "install-arch-dependent-bad-share": { + "description": "Install arch-dependent bad pc files to share" + }, + "install-arch-dependent-good": { + "description": "Install arch-dependent good pc files", + "dependencies": [ + { + "name": "vcpkg-policy-misplaced-pkgconfig", + "features": [ + "install-arch-dependent-good-release-only" + ] + } + ] + }, + "install-arch-dependent-good-release-only": { + "description": "Install arch-dependent good pc files" + }, + "policy": { + "description": "Turn on VCPKG_POLICY_SKIP_PKGCONFIG_CHECK" + } + } +} diff --git a/azure-pipelines/e2e-ports/vcpkg-policy-misplaced-regular-files/portfile.cmake b/azure-pipelines/e2e-ports/vcpkg-policy-misplaced-regular-files/portfile.cmake new file mode 100644 index 0000000000..c32d4bbd96 --- /dev/null +++ b/azure-pipelines/e2e-ports/vcpkg-policy-misplaced-regular-files/portfile.cmake @@ -0,0 +1,16 @@ +file(MAKE_DIRECTORY "${CURRENT_PACKAGES_DIR}/share/${PORT}") +file(WRITE "${CURRENT_PACKAGES_DIR}/share/${PORT}/copyright" "N/A") + +# Avoid the empty include directory check +file(MAKE_DIRECTORY "${CURRENT_PACKAGES_DIR}/include") +file(WRITE "${CURRENT_PACKAGES_DIR}/include/vcpkg-misplaced-regular-files.h" "") + +file(MAKE_DIRECTORY "${CURRENT_PACKAGES_DIR}/debug") +file(WRITE "${CURRENT_PACKAGES_DIR}/debug/.DS_Store" "") +file(WRITE "${CURRENT_PACKAGES_DIR}/debug/bad_debug_file.txt" "") +file(WRITE "${CURRENT_PACKAGES_DIR}/.DS_Store" "") +file(WRITE "${CURRENT_PACKAGES_DIR}/bad_file.txt" "") + +if (policy IN_LIST FEATURES) + set(VCPKG_POLICY_SKIP_MISPLACED_REGULAR_FILES_CHECK enabled) +endif() diff --git a/azure-pipelines/e2e-ports/vcpkg-policy-misplaced-regular-files/vcpkg.json b/azure-pipelines/e2e-ports/vcpkg-policy-misplaced-regular-files/vcpkg.json new file mode 100644 index 0000000000..16ec1394f2 --- /dev/null +++ b/azure-pipelines/e2e-ports/vcpkg-policy-misplaced-regular-files/vcpkg.json @@ -0,0 +1,9 @@ +{ + "name": "vcpkg-policy-misplaced-regular-files", + "version": "1", + "features": { + "policy": { + "description": "Turn on VCPKG_POLICY_SKIP_MISPLACED_REGULAR_FILES_CHECK" + } + } +} diff --git a/azure-pipelines/e2e-ports/vcpkg-policy-set-incorrectly/portfile.cmake b/azure-pipelines/e2e-ports/vcpkg-policy-set-incorrectly/portfile.cmake new file mode 100644 index 0000000000..880830f5d8 --- /dev/null +++ b/azure-pipelines/e2e-ports/vcpkg-policy-set-incorrectly/portfile.cmake @@ -0,0 +1 @@ +set(VCPKG_POLICY_EMPTY_PACKAGE ON) diff --git a/azure-pipelines/e2e-ports/vcpkg-policy-set-incorrectly/vcpkg.json b/azure-pipelines/e2e-ports/vcpkg-policy-set-incorrectly/vcpkg.json new file mode 100644 index 0000000000..adf28f644a --- /dev/null +++ b/azure-pipelines/e2e-ports/vcpkg-policy-set-incorrectly/vcpkg.json @@ -0,0 +1,4 @@ +{ + "name": "vcpkg-policy-set-incorrectly", + "version": "1" +} diff --git a/azure-pipelines/e2e-ports/vcpkg-policy-skip-all-post-build-checks/portfile.cmake b/azure-pipelines/e2e-ports/vcpkg-policy-skip-all-post-build-checks/portfile.cmake new file mode 100644 index 0000000000..ac0fccb6a8 --- /dev/null +++ b/azure-pipelines/e2e-ports/vcpkg-policy-skip-all-post-build-checks/portfile.cmake @@ -0,0 +1 @@ +set(VCPKG_POLICY_SKIP_ALL_POST_BUILD_CHECKS enabled) diff --git a/azure-pipelines/e2e-ports/vcpkg-policy-skip-all-post-build-checks/vcpkg.json b/azure-pipelines/e2e-ports/vcpkg-policy-skip-all-post-build-checks/vcpkg.json new file mode 100644 index 0000000000..2cc7e0f72f --- /dev/null +++ b/azure-pipelines/e2e-ports/vcpkg-policy-skip-all-post-build-checks/vcpkg.json @@ -0,0 +1,4 @@ +{ + "name": "vcpkg-policy-skip-all-post-build-checks", + "version": "1" +} diff --git a/azure-pipelines/end-to-end-tests-dir/post-build-checks.ps1 b/azure-pipelines/end-to-end-tests-dir/post-build-checks.ps1 index 39d2585e95..0739f48abe 100644 --- a/azure-pipelines/end-to-end-tests-dir/post-build-checks.ps1 +++ b/azure-pipelines/end-to-end-tests-dir/post-build-checks.ps1 @@ -1,82 +1,987 @@ . $PSScriptRoot/../end-to-end-tests-prelude.ps1 -if (-not $IsWindows) { - Write-Host 'Skipping e2e post build checks on non-Windows' - return +$NativeSlash = '/' +if ($IsWindows) { + $NativeSlash = '\' } -# DLLs with no exports +# Empty package / disable all checks Refresh-TestRoot -[string]$buildOutput = Run-VcpkgAndCaptureOutput @commonArgs install --overlay-ports="$PSScriptRoot/../e2e-ports" vcpkg-internal-dll-with-no-exports --no-binarycaching -if (-not $buildOutput.Contains("$packagesRoot\vcpkg-internal-dll-with-no-exports_x86-windows\debug\bin\no_exports.dll") ` - -or -not $buildOutput.Contains("$packagesRoot\vcpkg-internal-dll-with-no-exports_x86-windows\bin\no_exports.dll") ` - -or -not $buildOutput.Contains('set(VCPKG_POLICY_DLLS_WITHOUT_EXPORTS enabled)')) { - throw 'Did not detect DLLs with no exports.' +[string]$buildOutput = Run-VcpkgAndCaptureStderr install @commonArgs --overlay-ports="$PSScriptRoot/../e2e-ports" vcpkg-policy-set-incorrectly +Throw-IfNotFailed +if (-not $buildOutput.Replace("`r`n", "`n").EndsWith("error: Unknown setting of VCPKG_POLICY_EMPTY_PACKAGE: ON. Valid policy values are '', 'disabled', and 'enabled'.`n")) { + throw ('Incorrect error message for incorrect policy value; output was ' + $buildOutput) +} + +$buildOutput = Run-VcpkgAndCaptureOutput install @commonArgs --overlay-ports="$PSScriptRoot/../e2e-ports" vcpkg-policy-empty-package --no-binarycaching +Throw-IfFailed +if (-not $buildOutput.Contains('Skipping post-build validation due to VCPKG_POLICY_EMPTY_PACKAGE')) { + throw ('Didn''t skip post-build checks correctly, output was ' + $buildOutput) +} + +$buildOutput = Run-VcpkgAndCaptureOutput install @commonArgs --overlay-ports="$PSScriptRoot/../e2e-ports" vcpkg-policy-skip-all-post-build-checks --no-binarycaching +Throw-IfFailed +if (-not $buildOutput.Contains('Skipping post-build validation due to VCPKG_POLICY_SKIP_ALL_POST_BUILD_CHECKS')) { + throw ('Didn''t skip post-build checks correctly, output was ' + $buildOutput) +} + +# Include folder, restricted headers, and CMake helper port checks +Refresh-TestRoot +$PortfilePath = "$PSScriptRoot/../e2e-ports$($NativeSlash)vcpkg-policy-include-folder$($NativeSlash)portfile.cmake" +$buildOutput = Run-VcpkgAndCaptureOutput @commonArgs install --overlay-ports="$PSScriptRoot/../e2e-ports" vcpkg-policy-include-folder --no-binarycaching --enforce-port-checks +Throw-IfNotFailed +[string]$expected = @" +$($PortfilePath): warning: The folder $`{CURRENT_PACKAGES_DIR}/include is empty or not present. This usually means that headers are not correctly installed. If this is a CMake helper port, add set(VCPKG_POLICY_CMAKE_HELPER_PORT enabled). If this is not a CMake helper port but this is otherwise intentional, add set(VCPKG_POLICY_EMPTY_INCLUDE_FOLDER enabled) to suppress this message. +"@ +if (-not $buildOutput.Contains($expected)) { + throw 'Did not detect empty include folder' +} + +$buildOutput = Run-VcpkgAndCaptureOutput @commonArgs install --overlay-ports="$PSScriptRoot/../e2e-ports" 'vcpkg-policy-include-folder[policy-empty-include-folder]' --no-binarycaching --enforce-port-checks +Throw-IfFailed +if ($buildOutput.Contains($expected)) { + throw 'VCPKG_POLICY_EMPTY_INCLUDE_FOLDER didn''t suppress' +} + +Refresh-TestRoot +$buildOutput = Run-VcpkgAndCaptureOutput @commonArgs install --overlay-ports="$PSScriptRoot/../e2e-ports" 'vcpkg-policy-include-folder[do-install,policy-cmake-helper-port]' --no-binarycaching --enforce-port-checks +Throw-IfNotFailed +$expected = @" +$($PortfilePath): warning: The folder $`{CURRENT_PACKAGES_DIR}/include exists in a CMake helper port; this is incorrect, since only CMake files should be installed. To suppress this message, remove set(VCPKG_POLICY_CMAKE_HELPER_PORT enabled). +"@ +if (-not $buildOutput.Contains($expected)) { + throw 'Did not detect nonempty include folder for CMake helper port.' } -# DLLs with wrong architecture Refresh-TestRoot -mkdir "$TestingRoot/wrong-architecture" -Copy-Item -Recurse "$PSScriptRoot/../e2e-assets/test-dll-port-template" "$TestingRoot/wrong-architecture/test-dll" -Run-Vcpkg env "$TestingRoot/wrong-architecture/test-dll/build.cmd" --Triplet x64-windows +$buildOutput = Run-VcpkgAndCaptureOutput @commonArgs install --overlay-ports="$PSScriptRoot/../e2e-ports" 'vcpkg-policy-include-folder[policy-cmake-helper-port]' --no-binarycaching --enforce-port-checks +Throw-IfNotFailed +$expected = @" +$($PortfilePath): warning: The $`{CURRENT_PACKAGES_DIR}/share/`${PORT}/vcpkg-port-config.cmake file does not exist. This file must exist for CMake helper ports. To suppress this message, remove set(VCPKG_POLICY_CMAKE_HELPER_PORT enabled) +"@ +if (-not $buildOutput.Contains($expected)) { + throw 'Did not detect missing vcpkg-port-config.cmake for CMake helper port.' +} + +$buildOutput = Run-VcpkgAndCaptureOutput @commonArgs install --overlay-ports="$PSScriptRoot/../e2e-ports" 'vcpkg-policy-include-folder[policy-cmake-helper-port,do-install-vcpkg-port-config]' --no-binarycaching --enforce-port-checks Throw-IfFailed -$buildOutput = Run-VcpkgAndCaptureOutput @commonArgs install --overlay-ports="$TestingRoot/wrong-architecture" test-dll --no-binarycaching -$expected = "warning: The following files were built for an incorrect architecture:`n" + ` -"warning: $packagesRoot\test-dll_x86-windows\debug\lib\test_dll.lib`n" + ` -" Expected: x86, but was x64`n" + ` -"warning: The following files were built for an incorrect architecture:`n" + ` -"warning: $packagesRoot\test-dll_x86-windows\lib\test_dll.lib`n" + ` -" Expected: x86, but was x64`n" + ` -"warning: The following files were built for an incorrect architecture:`n" + ` -"warning: $packagesRoot\test-dll_x86-windows\debug\bin\test_dll.dll`n" + ` -" Expected: x86, but was x64`n" + ` -"warning: $packagesRoot\test-dll_x86-windows\bin\test_dll.dll`n" + ` -" Expected: x86, but was x64`n" +Refresh-TestRoot +$buildOutput = Run-VcpkgAndCaptureOutput @commonArgs install --overlay-ports="$PSScriptRoot/../e2e-ports" 'vcpkg-policy-include-folder[do-install-restricted]' --no-binarycaching --enforce-port-checks +Throw-IfNotFailed +$expected = @" +$($PortfilePath): warning: Taking the following restricted headers can prevent the core C++ runtime and other packages from compiling correctly. These should be renamed or stored in a subdirectory instead. In exceptional circumstances, this warning can be suppressed by adding set(VCPKG_POLICY_ALLOW_RESTRICTED_HEADERS enabled) +$($packagesRoot)$($NativeSlash)vcpkg-policy-include-folder_$($Triplet)$($NativeSlash)include: note: the headers are relative to `${CURRENT_PACKAGES_DIR}/include here +note: +"@ if (-not $buildOutput.Replace("`r`n", "`n").Contains($expected)) { - throw 'Did not detect DLL with wrong architecture.' + throw 'Did not detect restricted header' +} + +$buildOutput = Run-VcpkgAndCaptureOutput @commonArgs install --overlay-ports="$PSScriptRoot/../e2e-ports" 'vcpkg-policy-include-folder[do-install-restricted,policy-allow-restricted-headers]' --no-binarycaching --enforce-port-checks +Throw-IfFailed +if ($buildOutput.Replace("`r`n", "`n").Contains($expected)) { + throw 'VCPKG_POLICY_ALLOW_RESTRICTED_HEADERS didn''t allow' +} + +Refresh-TestRoot +$buildOutput = Run-VcpkgAndCaptureOutput @commonArgs install --overlay-ports="$PSScriptRoot/../e2e-ports" 'vcpkg-policy-include-folder[do-install,do-install-debug]' --no-binarycaching --enforce-port-checks +Throw-IfNotFailed +$expected = @" +$($PortfilePath): warning: `${CURRENT_PACKAGES_DIR}/debug/include should not exist. To suppress this message, add set(VCPKG_POLICY_ALLOW_DEBUG_INCLUDE enabled) +note: If this directory was created by a CMake build system that does not allow installing headers in debug to be disabled, delete the duplicate directory with file(REMOVE_RECURSE "`${CURRENT_PACKAGES_DIR}/debug/include") +"@ +if (-not $buildOutput.Replace("`r`n", "`n").Contains($expected)) { + throw 'Did not detect debug headers' +} + +$buildOutput = Run-VcpkgAndCaptureOutput @commonArgs install --overlay-ports="$PSScriptRoot/../e2e-ports" 'vcpkg-policy-include-folder[do-install,do-install-debug,policy-allow-debug-include]' --no-binarycaching --enforce-port-checks +Throw-IfFailed +if ($buildOutput.Replace("`r`n", "`n").Contains($expected)) { + throw 'VCPKG_POLICY_ALLOW_DEBUG_INCLUDE didn''t suppress' } -# DLLs with no AppContainer bit Refresh-TestRoot -mkdir "$TestingRoot/wrong-appcontainer" -Copy-Item -Recurse "$PSScriptRoot/../e2e-assets/test-dll-port-template" "$TestingRoot/wrong-appcontainer/test-dll" -Run-Vcpkg env "$TestingRoot/wrong-appcontainer/test-dll/build.cmd" --Triplet x64-windows +$buildOutput = Run-VcpkgAndCaptureOutput @commonArgs install --overlay-ports="$PSScriptRoot/../e2e-ports" 'vcpkg-policy-include-folder[do-install,do-install-debug-share]' --no-binarycaching --enforce-port-checks +Throw-IfNotFailed +$expected = @" +$($PortfilePath): warning: `${CURRENT_PACKAGES_DIR}/debug/share should not exist. Please reorganize any important files, then delete any remaining by adding ``file(REMOVE_RECURSE "`${CURRENT_PACKAGES_DIR}/debug/share")``. To suppress this message, add set(VCPKG_POLICY_ALLOW_DEBUG_SHARE enabled) +"@ +if (-not $buildOutput.Replace("`r`n", "`n").Contains($expected)) { + throw 'Did not detect debug share' +} + +$buildOutput = Run-VcpkgAndCaptureOutput @commonArgs install --overlay-ports="$PSScriptRoot/../e2e-ports" 'vcpkg-policy-include-folder[do-install,do-install-debug-share,policy-allow-debug-share]' --no-binarycaching --enforce-port-checks +Throw-IfFailed +if ($buildOutput.Replace("`r`n", "`n").Contains($expected)) { + throw 'VCPKG_POLICY_ALLOW_DEBUG_SHARE didn''t suppress' +} + +# Misplaced CMake Files +Refresh-TestRoot +$PortfilePath = "$PSScriptRoot/../e2e-ports$($NativeSlash)vcpkg-policy-misplaced-cmake-files$($NativeSlash)portfile.cmake" +Run-Vcpkg @commonArgs install --overlay-ports="$PSScriptRoot/../e2e-ports" vcpkg-policy-misplaced-cmake-files --no-binarycaching --enforce-port-checks Throw-IfFailed -$buildOutput = Run-VcpkgAndCaptureOutput --triplet x64-uwp "--x-buildtrees-root=$buildtreesRoot" "--x-install-root=$installRoot" "--x-packages-root=$packagesRoot" install --overlay-ports="$TestingRoot/wrong-appcontainer" test-dll --no-binarycaching -$expected = "warning: The App Container bit must be set for Windows Store apps. The following DLLs do not have the App Container bit set:`n" + ` -"`n" + ` -" $packagesRoot\test-dll_x64-uwp\debug\bin\test_dll.dll`n" + ` -" $packagesRoot\test-dll_x64-uwp\bin\test_dll.dll`n" +Refresh-TestRoot +$buildOutput = Run-VcpkgAndCaptureOutput @commonArgs install --overlay-ports="$PSScriptRoot/../e2e-ports" 'vcpkg-policy-misplaced-cmake-files[do-install-cmake]' --no-binarycaching --enforce-port-checks +Throw-IfNotFailed +$expected = @" +$($PortfilePath): warning: This port installs the following CMake files in places CMake files are not expected. CMake should be installed in `${CURRENT_PACKAGES_DIR}/share/`${PORT}. To suppress this message, add set(VCPKG_POLICY_SKIP_MISPLACED_CMAKE_FILES_CHECK enabled) +$($packagesRoot)$($NativeSlash)vcpkg-policy-misplaced-cmake-files_$($Triplet): note: the files are relative to `${CURRENT_PACKAGES_DIR} here +note: cmake/some_cmake.cmake +note: debug/cmake/some_cmake.cmake +"@ +if ($buildOutput.Contains("legitimate.cmake")) { + throw 'Complained about legitimate CMake files' +} +if (-not $buildOutput.Replace("`r`n", "`n").Contains($expected)) { + throw 'Did not detect bad CMake files' +} + +Refresh-TestRoot +$buildOutput = Run-VcpkgAndCaptureOutput @commonArgs install --overlay-ports="$PSScriptRoot/../e2e-ports" 'vcpkg-policy-misplaced-cmake-files[do-install-lib]' --no-binarycaching --enforce-port-checks +Throw-IfNotFailed +$expected = @" +$($PortfilePath): warning: This port installs the following CMake files in places CMake files are not expected. CMake should be installed in `${CURRENT_PACKAGES_DIR}/share/`${PORT}. To suppress this message, add set(VCPKG_POLICY_SKIP_MISPLACED_CMAKE_FILES_CHECK enabled) +$($packagesRoot)$($NativeSlash)vcpkg-policy-misplaced-cmake-files_$($Triplet): note: the files are relative to `${CURRENT_PACKAGES_DIR} here +note: lib/cmake/some_cmake.cmake +note: debug/lib/cmake/some_cmake.cmake +$($PortfilePath): warning: This port creates `${CURRENT_PACKAGES_DIR}/lib/cmake and/or `${CURRENT_PACKAGES_DIR}/debug/lib/cmake, which should be merged and moved to `${CURRENT_PACKAGES_DIR}/share/`${PORT}/cmake. Please use the helper function vcpkg_cmake_config_fixup() from the port vcpkg-cmake-config. To suppress this message, add set(VCPKG_POLICY_SKIP_LIB_CMAKE_MERGE_CHECK enabled) +"@ +if ($buildOutput.Contains("legitimate.cmake")) { + throw 'Complained about legitimate CMake files' +} +if (-not $buildOutput.Replace("`r`n", "`n").Contains($expected)) { + throw 'Did not detect bad CMake files' +} + +Refresh-TestRoot +$buildOutput = Run-VcpkgAndCaptureOutput @commonArgs install --overlay-ports="$PSScriptRoot/../e2e-ports" 'vcpkg-policy-misplaced-cmake-files[do-install-cmake,do-install-lib]' --no-binarycaching --enforce-port-checks +Throw-IfNotFailed +$expected = @" +$($PortfilePath): warning: This port installs the following CMake files in places CMake files are not expected. CMake should be installed in `${CURRENT_PACKAGES_DIR}/share/`${PORT}. To suppress this message, add set(VCPKG_POLICY_SKIP_MISPLACED_CMAKE_FILES_CHECK enabled) +$($packagesRoot)$($NativeSlash)vcpkg-policy-misplaced-cmake-files_$($Triplet): note: the files are relative to `${CURRENT_PACKAGES_DIR} here +note: cmake/some_cmake.cmake +note: debug/cmake/some_cmake.cmake +note: lib/cmake/some_cmake.cmake +note: debug/lib/cmake/some_cmake.cmake +$($PortfilePath): warning: This port creates `${CURRENT_PACKAGES_DIR}/lib/cmake and/or `${CURRENT_PACKAGES_DIR}/debug/lib/cmake, which should be merged and moved to `${CURRENT_PACKAGES_DIR}/share/`${PORT}/cmake. Please use the helper function vcpkg_cmake_config_fixup() from the port vcpkg-cmake-config. To suppress this message, add set(VCPKG_POLICY_SKIP_LIB_CMAKE_MERGE_CHECK enabled) +"@ +if ($buildOutput.Contains("legitimate.cmake")) { + throw 'Complained about legitimate CMake files' +} +if (-not $buildOutput.Replace("`r`n", "`n").Contains($expected)) { + throw 'Did not detect bad CMake files' +} + +Refresh-TestRoot +$buildOutput = Run-VcpkgAndCaptureOutput @commonArgs install --overlay-ports="$PSScriptRoot/../e2e-ports" 'vcpkg-policy-misplaced-cmake-files[do-install-cmake,do-install-lib,policy-skip-misplaced-cmake-files-check]' --no-binarycaching --enforce-port-checks +Throw-IfNotFailed +$expected = @" +$($PortfilePath): warning: This port creates `${CURRENT_PACKAGES_DIR}/lib/cmake and/or `${CURRENT_PACKAGES_DIR}/debug/lib/cmake, which should be merged and moved to `${CURRENT_PACKAGES_DIR}/share/`${PORT}/cmake. Please use the helper function vcpkg_cmake_config_fixup() from the port vcpkg-cmake-config. To suppress this message, add set(VCPKG_POLICY_SKIP_LIB_CMAKE_MERGE_CHECK enabled) +"@ +if ($buildOutput.Contains("legitimate.cmake")) { + throw 'Complained about legitimate CMake files' +} +if (-not $buildOutput.Replace("`r`n", "`n").Contains($expected)) { + throw 'Did not detect bad CMake files' +} + +Refresh-TestRoot +$buildOutput = Run-VcpkgAndCaptureOutput @commonArgs install --overlay-ports="$PSScriptRoot/../e2e-ports" 'vcpkg-policy-misplaced-cmake-files[do-install-cmake,do-install-lib,policy-skip-lib-cmake-merge-check]' --no-binarycaching --enforce-port-checks +Throw-IfNotFailed +$expected = @" +$($PortfilePath): warning: This port installs the following CMake files in places CMake files are not expected. CMake should be installed in `${CURRENT_PACKAGES_DIR}/share/`${PORT}. To suppress this message, add set(VCPKG_POLICY_SKIP_MISPLACED_CMAKE_FILES_CHECK enabled) +$($packagesRoot)$($NativeSlash)vcpkg-policy-misplaced-cmake-files_$($Triplet): note: the files are relative to `${CURRENT_PACKAGES_DIR} here +note: cmake/some_cmake.cmake +note: debug/cmake/some_cmake.cmake +note: lib/cmake/some_cmake.cmake +note: debug/lib/cmake/some_cmake.cmake +"@ +if ($buildOutput.Contains("legitimate.cmake")) { + throw 'Complained about legitimate CMake files' +} +if (-not $buildOutput.Replace("`r`n", "`n").Contains($expected)) { + throw 'Did not detect bad CMake files' +} + +Refresh-TestRoot +$buildOutput = Run-VcpkgAndCaptureOutput @commonArgs install --overlay-ports="$PSScriptRoot/../e2e-ports" 'vcpkg-policy-misplaced-cmake-files[do-install-cmake,policy-skip-misplaced-cmake-files-check]' --no-binarycaching --enforce-port-checks +Throw-IfFailed + +Refresh-TestRoot +$buildOutput = Run-VcpkgAndCaptureOutput @commonArgs install --overlay-ports="$PSScriptRoot/../e2e-ports" 'vcpkg-policy-misplaced-cmake-files[do-install-lib,policy-skip-misplaced-cmake-files-check,policy-skip-lib-cmake-merge-check]' --no-binarycaching --enforce-port-checks +Throw-IfFailed + +# Copyright Files +Refresh-TestRoot +$PortfilePath = "$PSScriptRoot/../e2e-ports$($NativeSlash)vcpkg-policy-copyright$($NativeSlash)portfile.cmake" +$expected = @" +$($PortfilePath): warning: this port sets `${CURRENT_PACKAGES_DIR}/share/`${PORT}/copyright to a directory, but it should be a file. Consider combining separate copyright files into one using vcpkg_install_copyright. To suppress this message, add set(VCPKG_POLICY_SKIP_COPYRIGHT_CHECK enabled) +"@ +$buildOutput = Run-VcpkgAndCaptureOutput install @commonArgs --overlay-ports="$PSScriptRoot/../e2e-ports" 'vcpkg-policy-copyright[copyright-directory]' --no-binarycaching --enforce-port-checks +Throw-IfNotFailed +if (-not $buildOutput.Contains($expected)) { + throw 'Did not detect copyright directory' +} + +$buildOutput = Run-VcpkgAndCaptureOutput install @commonArgs --overlay-ports="$PSScriptRoot/../e2e-ports" 'vcpkg-policy-copyright[copyright-directory,policy]' --no-binarycaching --enforce-port-checks +Throw-IfFailed +if ($buildOutput.Contains($expected)) { + throw 'VCPKG_POLICY_SKIP_COPYRIGHT_CHECK didn''t suppress copyright problem' +} + +Refresh-TestRoot +$expected = @" +$($PortfilePath): warning: the license is not installed to `${CURRENT_PACKAGES_DIR}/share/`${PORT}/copyright . This can be fixed by adding a call to vcpkg_install_copyright. To suppress this message, add set(VCPKG_POLICY_SKIP_COPYRIGHT_CHECK enabled) +"@ + +$buildOutput = Run-VcpkgAndCaptureOutput install @commonArgs --overlay-ports="$PSScriptRoot/../e2e-ports" 'vcpkg-policy-copyright' --no-binarycaching --enforce-port-checks +Throw-IfNotFailed +if (-not $buildOutput.Replace("`r`n", "`n").Contains($expected)) { + throw 'Did not detect missing copyright no source' +} + +Refresh-TestRoot +$expected = @" +$($PortfilePath): warning: the license is not installed to `${CURRENT_PACKAGES_DIR}/share/`${PORT}/copyright . This can be fixed by adding a call to vcpkg_install_copyright. To suppress this message, add set(VCPKG_POLICY_SKIP_COPYRIGHT_CHECK enabled) +$($PortfilePath): note: Consider adding: vcpkg_install_copyright(FILE_LIST "`${SOURCE_PATH}/LICENSE.txt") +"@ + +$buildOutput = Run-VcpkgAndCaptureOutput install @commonArgs --overlay-ports="$PSScriptRoot/../e2e-ports" 'vcpkg-policy-copyright[source]' --no-binarycaching --enforce-port-checks +Throw-IfNotFailed +if (-not $buildOutput.Replace("`r`n", "`n").Contains($expected)) { + throw 'Did not detect missing copyright source' +} + +Refresh-TestRoot +$expected = @" +$($PortfilePath): warning: the license is not installed to `${CURRENT_PACKAGES_DIR}/share/`${PORT}/copyright . This can be fixed by adding a call to vcpkg_install_copyright. To suppress this message, add set(VCPKG_POLICY_SKIP_COPYRIGHT_CHECK enabled) +$($PortfilePath): note: Consider adding: vcpkg_install_copyright(FILE_LIST "`${SOURCE_PATH}/COPYING" "`${SOURCE_PATH}/LICENSE.txt") +"@ + +$buildOutput = Run-VcpkgAndCaptureOutput install @commonArgs --overlay-ports="$PSScriptRoot/../e2e-ports" 'vcpkg-policy-copyright[source2]' --no-binarycaching --enforce-port-checks +Throw-IfNotFailed +if (-not $buildOutput.Replace("`r`n", "`n").Contains($expected)) { + throw 'Did not detect missing copyright source2' +} + +Refresh-TestRoot +$expected = @" +$($PortfilePath): warning: the license is not installed to `${CURRENT_PACKAGES_DIR}/share/`${PORT}/copyright . This can be fixed by adding a call to vcpkg_install_copyright. To suppress this message, add set(VCPKG_POLICY_SKIP_COPYRIGHT_CHECK enabled) +$($PortfilePath): note: the following files are potential copyright files +$($buildtreesRoot)$($NativeSlash)vcpkg-policy-copyright: note: the files are relative to the build directory here +note: src/v1.16.3-6f5be3c3eb.clean/LICENSE.txt +note: src/v1.3.1-2e5db616bf.clean/COPYING +note: src/v1.3.1-2e5db616bf.clean/LICENSE.txt +"@ + +$buildOutput = Run-VcpkgAndCaptureOutput install @commonArgs --overlay-ports="$PSScriptRoot/../e2e-ports" 'vcpkg-policy-copyright[source,source2]' --no-binarycaching --enforce-port-checks +Throw-IfNotFailed +if (-not $buildOutput.Replace("`r`n", "`n").Contains($expected)) { + throw 'Did not detect missing copyright source + source2' +} + +$buildOutput = Run-VcpkgAndCaptureOutput install @commonArgs --overlay-ports="$PSScriptRoot/../e2e-ports" 'vcpkg-policy-copyright[source,source2,policy]' --no-binarycaching --enforce-port-checks +Throw-IfFailed +if ($buildOutput.Replace("`r`n", "`n").Contains($expected)) { + throw 'VCPKG_POLICY_SKIP_COPYRIGHT_CHECK didn''t suppress source + source2' +} + +# EXEs in bin +if ($IsWindows) { + Refresh-TestRoot + mkdir "$TestingRoot/exes-in-bin" + Copy-Item -Recurse "$PSScriptRoot/../e2e-assets/test-exe-port-template" "$TestingRoot/exes-in-bin/test-exe" + Run-Vcpkg env "$TestingRoot/exes-in-bin/test-exe/build.cmd" --Triplet x64-windows + + $PortfilePath = "$TestingRoot/exes-in-bin$($NativeSlash)test-exe$($NativeSlash)portfile.cmake" + $buildOutput = Run-VcpkgAndCaptureOutput @commonArgs install --overlay-ports="$TestingRoot/exes-in-bin" 'test-exe[release-only]' --no-binarycaching --enforce-port-checks + Throw-IfNotFailed + $expected = @" +$($PortfilePath): warning: The following executables were found in `${CURRENT_PACKAGES_DIR}/bin or `${CURRENT_PACKAGES_DIR}/debug/bin. Executables are not valid distribution targets. If these executables are build tools, consider using ``vcpkg_copy_tools``. To suppress this message, add set(VCPKG_POLICY_ALLOW_EXES_IN_BIN enabled) +$($packagesRoot)$($NativeSlash)test-exe_x86-windows: note: the executables are relative to `${CURRENT_PACKAGES_DIR} here +note: bin/test_exe.exe +"@ + + if (-not $buildOutput.Replace("`r`n", "`n").Contains($expected)) { + throw 'Did not detect EXE in bin.' + } + + $buildOutput = Run-VcpkgAndCaptureOutput @commonArgs install --overlay-ports="$TestingRoot/exes-in-bin" test-exe --no-binarycaching --enforce-port-checks + Throw-IfNotFailed + $expected = @" +$($PortfilePath): warning: The following executables were found in `${CURRENT_PACKAGES_DIR}/bin or `${CURRENT_PACKAGES_DIR}/debug/bin. Executables are not valid distribution targets. If these executables are build tools, consider using ``vcpkg_copy_tools``. To suppress this message, add set(VCPKG_POLICY_ALLOW_EXES_IN_BIN enabled) +$($packagesRoot)$($NativeSlash)test-exe_x86-windows: note: the executables are relative to `${CURRENT_PACKAGES_DIR} here +note: debug/bin/test_exe.exe +note: bin/test_exe.exe +"@ + + if (-not $buildOutput.Replace("`r`n", "`n").Contains($expected)) { + throw 'Did not detect EXEs in bin.' + } + + $buildOutput = Run-VcpkgAndCaptureOutput @commonArgs install --overlay-ports="$TestingRoot/exes-in-bin" "test-exe[policy-allow-exes-in-bin]" --no-binarycaching --enforce-port-checks + Throw-IfFailed + if ($buildOutput.Replace("`r`n", "`n").Contains($expected)) { + throw 'VCPKG_POLICY_ALLOW_EXES_IN_BIN didn''t suppress' + } +} # windows +# Forgot to install usage +$PortfilePath = "$PSScriptRoot/../e2e-ports$($NativeSlash)vcpkg-policy-forgot-usage$($NativeSlash)portfile.cmake" +Refresh-TestRoot +$buildOutput = Run-VcpkgAndCaptureOutput @commonArgs install --overlay-ports="$PSScriptRoot/../e2e-ports" 'vcpkg-policy-forgot-usage' --no-binarycaching --enforce-port-checks +Throw-IfNotFailed +$expected = @" +$($PortfilePath): warning: this port contains a file named "usage" but didn't install it to `${CURRENT_PACKAGES_DIR}/share/`${PORT}/usage . If this file is not intended to be usage text, consider choosing another name; otherwise, install it. To suppress this message, add set(VCPKG_POLICY_SKIP_USAGE_INSTALL_CHECK enabled) +$PSScriptRoot/../e2e-ports$($NativeSlash)vcpkg-policy-forgot-usage$($NativeSlash)usage: note: the usage file is here +note: you can install the usage file with the following CMake +note: file(INSTALL "`${CMAKE_CURRENT_LIST_DIR}/usage" DESTINATION "`${CURRENT_PACKAGES_DIR}/share/`${PORT}") +"@ if (-not $buildOutput.Replace("`r`n", "`n").Contains($expected)) { - throw 'Did not detect DLL with wrong appcontainer.' + throw 'Did not detect forgotten usage' +} +$buildOutput = Run-VcpkgAndCaptureOutput @commonArgs install --overlay-ports="$PSScriptRoot/../e2e-ports" 'vcpkg-policy-forgot-usage[policy]' --no-binarycaching --enforce-port-checks +Throw-IfFailed +if ($buildOutput.Replace("`r`n", "`n").Contains($expected)) { + throw 'VCPKG_POLICY_SKIP_USAGE_INSTALL_CHECK didn''t suppress' } +# Mismatched debug and release +if ($IsWindows) { + Refresh-TestRoot + mkdir "$TestingRoot/debug-release-mismatch" + Copy-Item -Recurse "$PSScriptRoot/../e2e-assets/test-dll-port-template" "$TestingRoot/debug-release-mismatch/test-dll" + Run-Vcpkg @commonArgs env "$TestingRoot/debug-release-mismatch/test-dll/build.cmd" + $PortfilePath = "$TestingRoot/debug-release-mismatch$($NativeSlash)test-dll$($NativeSlash)portfile.cmake" + +$expected = @" +$($PortfilePath): warning: mismatching number of debug and release binaries. This often indicates incorrect handling of debug or release in portfile.cmake or the build system. If the intent is to only ever produce release components for this triplet, the triplet should have set(VCPKG_BUILD_TYPE release) added to its .cmake file. To suppress this message, add set(VCPKG_POLICY_MISMATCHED_NUMBER_OF_BINARIES enabled) +$($packagesRoot)$($NativeSlash)test-dll_x86-windows: note: the binaries are relative to `${CURRENT_PACKAGES_DIR} here +note: The following are debug binaries: +note: debug/lib/test_dll.lib +note: debug/bin/test_dll.dll +note: Release binaries were not found. +"@ + $buildOutput = Run-VcpkgAndCaptureOutput @commonArgs install --overlay-ports="$TestingRoot/debug-release-mismatch" 'test-dll[debug-only]' --no-binarycaching --enforce-port-checks + Throw-IfNotFailed + if (-not $buildOutput.Replace("`r`n", "`n").Contains($expected)) { + throw 'Did not detect debug only mismatch' + } + +$expected = @" +$($PortfilePath): warning: mismatching number of debug and release binaries. This often indicates incorrect handling of debug or release in portfile.cmake or the build system. If the intent is to only ever produce release components for this triplet, the triplet should have set(VCPKG_BUILD_TYPE release) added to its .cmake file. To suppress this message, add set(VCPKG_POLICY_MISMATCHED_NUMBER_OF_BINARIES enabled) +$($packagesRoot)$($NativeSlash)test-dll_x86-windows: note: the binaries are relative to `${CURRENT_PACKAGES_DIR} here +note: Debug binaries were not found. +note: The following are release binaries: +note: lib/test_dll.lib +note: bin/test_dll.dll +"@ + $buildOutput = Run-VcpkgAndCaptureOutput @commonArgs install --overlay-ports="$TestingRoot/debug-release-mismatch" 'test-dll[bad-release-only]' --no-binarycaching --enforce-port-checks + Throw-IfNotFailed + if (-not $buildOutput.Replace("`r`n", "`n").Contains($expected)) { + throw 'Did not detect release only mismatch' + } + +$expected = @" +$($PortfilePath): warning: mismatching number of debug and release binaries. This often indicates incorrect handling of debug or release in portfile.cmake or the build system. If the intent is to only ever produce release components for this triplet, the triplet should have set(VCPKG_BUILD_TYPE release) added to its .cmake file. To suppress this message, add set(VCPKG_POLICY_MISMATCHED_NUMBER_OF_BINARIES enabled) +$($packagesRoot)$($NativeSlash)test-dll_x86-windows: note: the binaries are relative to `${CURRENT_PACKAGES_DIR} here +note: The following are debug binaries: +note: debug/lib/test_dll.lib +note: debug/lib/test_dll2.lib +note: debug/bin/test_dll.dll +note: debug/bin/test_dll2.dll +note: The following are release binaries: +note: lib/test_dll.lib +note: bin/test_dll.dll +"@ + $buildOutput = Run-VcpkgAndCaptureOutput @commonArgs install --overlay-ports="$TestingRoot/debug-release-mismatch" 'test-dll[extra-debug]' --no-binarycaching --enforce-port-checks + Throw-IfNotFailed + if (-not $buildOutput.Replace("`r`n", "`n").Contains($expected)) { + throw 'Did not detect extra debug mismatch' + } + +$expected = @" +$($PortfilePath): warning: mismatching number of debug and release binaries. This often indicates incorrect handling of debug or release in portfile.cmake or the build system. If the intent is to only ever produce release components for this triplet, the triplet should have set(VCPKG_BUILD_TYPE release) added to its .cmake file. To suppress this message, add set(VCPKG_POLICY_MISMATCHED_NUMBER_OF_BINARIES enabled) +$($packagesRoot)$($NativeSlash)test-dll_x86-windows: note: the binaries are relative to `${CURRENT_PACKAGES_DIR} here +note: The following are debug binaries: +note: debug/lib/test_dll.lib +note: debug/bin/test_dll.dll +note: The following are release binaries: +note: lib/test_dll.lib +note: lib/test_dll2.lib +note: bin/test_dll.dll +note: bin/test_dll2.dll +"@ + $buildOutput = Run-VcpkgAndCaptureOutput @commonArgs install --overlay-ports="$TestingRoot/debug-release-mismatch" 'test-dll[extra-release]' --no-binarycaching --enforce-port-checks + Throw-IfNotFailed + if (-not $buildOutput.Replace("`r`n", "`n").Contains($expected)) { + throw 'Did not detect extra release mismatch' + } + + $buildOutput = Run-VcpkgAndCaptureOutput @commonArgs install --overlay-ports="$TestingRoot/debug-release-mismatch" 'test-dll[extra-release,policy-mismatched-number-of-binaries]' --no-binarycaching --enforce-port-checks + Throw-IfFailed + if ($buildOutput.Replace("`r`n", "`n").Contains('mismatching number of debug and release binaries')) { + throw 'VCPKG_POLICY_MISMATCHED_NUMBER_OF_BINARIES didn''t suppress' + } +} + +# Kernel32 from XBox +if ($IsWindows) { + Refresh-TestRoot + mkdir "$TestingRoot/kernel32-from-xbox" + Copy-Item -Recurse "$PSScriptRoot/../e2e-assets/test-dll-port-template" "$TestingRoot/kernel32-from-xbox/test-dll" + Run-Vcpkg env "$TestingRoot/kernel32-from-xbox/test-dll/build.cmd" --Triplet x64-windows + + $PortfilePath = "$TestingRoot/kernel32-from-xbox$($NativeSlash)test-dll$($NativeSlash)portfile.cmake" + $buildOutput = Run-VcpkgAndCaptureOutput --triplet x64-xbox-xboxone "--x-buildtrees-root=$buildtreesRoot" "--x-install-root=$installRoot" "--x-packages-root=$packagesRoot" install --overlay-ports="$TestingRoot/kernel32-from-xbox" test-dll --no-binarycaching --enforce-port-checks + Throw-IfNotFailed + $expected = @" +$($PortfilePath): warning: The selected triplet targets Xbox, but the following DLLs link with kernel32. These DLLs cannot be loaded on Xbox, where kernel32 is not present. This is typically caused by linking with kernel32.lib rather than a suitable umbrella library, such as onecore_apiset.lib or xgameplatform.lib. You can inspect a DLL's dependencies with ``dumpbin.exe /dependents mylibfile.dll``. To suppress this message, add set(VCPKG_POLICY_ALLOW_KERNEL32_FROM_XBOX enabled) +$($packagesRoot)$($NativeSlash)test-dll_x64-xbox-xboxone: note: the DLLs are relative to `${CURRENT_PACKAGES_DIR} here +note: debug/bin/test_dll.dll +note: bin/test_dll.dll +"@ + + if (-not $buildOutput.Replace("`r`n", "`n").Contains($expected)) { + throw 'Did not detect Kernel32 from xbox.' + } + + $buildOutput = Run-VcpkgAndCaptureOutput --triplet x64-xbox-xboxone "--x-buildtrees-root=$buildtreesRoot" "--x-install-root=$installRoot" "--x-packages-root=$packagesRoot" install --overlay-ports="$TestingRoot/kernel32-from-xbox" 'test-dll[policy-allow-kernel32-from-xbox]' --no-binarycaching --enforce-port-checks + Throw-IfFailed + if ($buildOutput.Replace("`r`n", "`n").Contains($expected)) { + throw 'VCPKG_POLICY_ALLOW_KERNEL32_FROM_XBOX didn''t suppress' + } +} # windows + +# DLLs with missing libs +if ($IsWindows) { + Refresh-TestRoot + mkdir "$TestingRoot/dlls-no-lib" + Copy-Item -Recurse "$PSScriptRoot/../e2e-assets/test-dll-port-template" "$TestingRoot/dlls-no-lib/test-dll" + Run-Vcpkg @commonArgs env "$TestingRoot/dlls-no-lib/test-dll/build.cmd" + + $PortfilePath = "$TestingRoot/dlls-no-lib$($NativeSlash)test-dll$($NativeSlash)portfile.cmake" + $expected = @" +$($PortfilePath): warning: Import libraries for installed DLLs appear to be missing. If this is intended, add set(VCPKG_POLICY_DLLS_WITHOUT_LIBS enabled) +"@ + + $buildOutput = Run-VcpkgAndCaptureOutput @commonArgs install --overlay-ports="$TestingRoot/dlls-no-lib" "test-dll[install-no-lib-debug]" --no-binarycaching --enforce-port-checks + Throw-IfNotFailed + if (-not $buildOutput.Replace("`r`n", "`n").Contains($expected)) { + throw 'Did not detect DLLs with no import libraries debug' + } + + $buildOutput = Run-VcpkgAndCaptureOutput @commonArgs install --overlay-ports="$TestingRoot/dlls-no-lib" "test-dll[install-no-lib-release]" --no-binarycaching --enforce-port-checks + Throw-IfNotFailed + if (-not $buildOutput.Replace("`r`n", "`n").Contains($expected)) { + throw 'Did not detect DLLs with no import libraries release' + } + + $buildOutput = Run-VcpkgAndCaptureOutput @commonArgs install --overlay-ports="$TestingRoot/dlls-no-lib" "test-dll[install-no-lib-debug,install-no-lib-release]" --no-binarycaching --enforce-port-checks + Throw-IfNotFailed + $buildOutput = $buildOutput.Replace("`r`n", "`n") + $first = $buildOutput.IndexOf($expected) + if ($first -lt 0) { + throw 'Did not detect DLLs with no import libraries both' + } + if ($buildOutput.IndexOf($expected, $first + 1) -ge 0){ + throw 'Detected duplicate DLLs with no import libraries' + } + + $buildOutput = Run-VcpkgAndCaptureOutput @commonArgs install --overlay-ports="$TestingRoot/dlls-in-lib" "test-dll[install-no-lib-debug,install-no-lib-release,policy-dlls-without-libs]" --no-binarycaching --enforce-port-checks + Throw-IfNotFailed + if ($buildOutput.Replace("`r`n", "`n").Contains($expected)) { + throw 'VCPKG_POLICY_DLLS_WITHOUT_LIBS didn''t suppress' + } +} # windows + +# DLLs in lib +if ($IsWindows) { + Refresh-TestRoot + mkdir "$TestingRoot/dlls-in-lib" + Copy-Item -Recurse "$PSScriptRoot/../e2e-assets/test-dll-port-template" "$TestingRoot/dlls-in-lib/test-dll" + Run-Vcpkg @commonArgs env "$TestingRoot/dlls-in-lib/test-dll/build.cmd" + + $PortfilePath = "$TestingRoot/dlls-in-lib$($NativeSlash)test-dll$($NativeSlash)portfile.cmake" + $buildOutput = Run-VcpkgAndCaptureOutput @commonArgs install --overlay-ports="$TestingRoot/dlls-in-lib" "test-dll[install-to-lib]" --no-binarycaching --enforce-port-checks + Throw-IfNotFailed + $expected = @" +$($PortfilePath): warning: The following dlls were found in `${CURRENT_PACKAGES_DIR}/lib or `${CURRENT_PACKAGES_DIR}/debug/lib. Please move them to `${CURRENT_PACKAGES_DIR}/bin or `${CURRENT_PACKAGES_DIR}/debug/bin, respectively. +$($packagesRoot)$($NativeSlash)test-dll_$($Triplet): note: the DLLs are relative to `${CURRENT_PACKAGES_DIR} here +note: debug/lib/test_dll.dll +note: lib/test_dll.dll +"@ + + if (-not $buildOutput.Replace("`r`n", "`n").Contains($expected)) { + throw 'Did not detect DLL in lib.' + } + + $buildOutput = Run-VcpkgAndCaptureOutput @commonArgs install --overlay-ports="$TestingRoot/dlls-in-lib" "test-dll[install-to-lib,policy-allow-dlls-in-lib]" --no-binarycaching --enforce-port-checks + Throw-IfFailed + if ($buildOutput.Replace("`r`n", "`n").Contains($expected)) { + throw 'VCPKG_POLICY_ALLOW_DLLS_IN_LIB didn''t suppress' + } +} # windows + +# DLLs with no exports +if ($IsWindows) { + Refresh-TestRoot + $buildOutput = Run-VcpkgAndCaptureOutput @commonArgs install --overlay-ports="$PSScriptRoot/../e2e-ports" vcpkg-internal-dll-with-no-exports --no-binarycaching --enforce-port-checks + Throw-IfNotFailed + $PortfilePath = "$PSScriptRoot/../e2e-ports$($NativeSlash)vcpkg-internal-dll-with-no-exports$($NativeSlash)portfile.cmake" + $expected = @" +$($PortfilePath): warning: the following DLLs were built without any exports. DLLs without exports are likely bugs in the build script. If this is intended, add set(VCPKG_POLICY_DLLS_WITHOUT_EXPORTS enabled) +$($packagesRoot)$($NativeSlash)vcpkg-internal-dll-with-no-exports_$($Triplet): note: the DLLs are relative to `${CURRENT_PACKAGES_DIR} here +note: debug/bin/no_exports.dll +note: bin/no_exports.dll +"@ + + if (-not $buildOutput.Replace("`r`n", "`n").Contains($expected)) { + throw 'Did not detect DLLs with no exports' + } + + Refresh-TestRoot + $buildOutput = Run-VcpkgAndCaptureOutput @commonArgs install --overlay-ports="$PSScriptRoot/../e2e-ports" 'vcpkg-internal-dll-with-no-exports[policy]' --no-binarycaching --enforce-port-checks + Throw-IfFailed + if ($buildOutput.Replace("`r`n", "`n").Contains($expected)) { + throw 'VCPKG_POLICY_DLLS_WITHOUT_EXPORTS didn''t suppress' + } +} # windows + +# DLLs with wrong architecture +if ($IsWindows) { + Refresh-TestRoot + mkdir "$TestingRoot/wrong-architecture" + Copy-Item -Recurse "$PSScriptRoot/../e2e-assets/test-dll-port-template" "$TestingRoot/wrong-architecture/test-dll" + Run-Vcpkg env "$TestingRoot/wrong-architecture/test-dll/build.cmd" --Triplet x64-windows + $PortfilePath = "$TestingRoot/wrong-architecture$($NativeSlash)test-dll$($NativeSlash)portfile.cmake" + $buildOutput = Run-VcpkgAndCaptureOutput @commonArgs install --overlay-ports="$TestingRoot/wrong-architecture" test-dll --no-binarycaching --enforce-port-checks + Throw-IfNotFailed + $expected = @" +$($PortfilePath): warning: The triplet requests that binaries are built for x86, but the following binaries were built for a different architecture. This usually means toolchain information is incorrectly conveyed to the binaries' build system. To suppress this message, add set(VCPKG_POLICY_SKIP_ARCHITECTURE_CHECK enabled) +$($packagesRoot)$($NativeSlash)test-dll_$($Triplet): note: the binaries are relative to `${CURRENT_PACKAGES_DIR} here +note: debug/lib/test_dll.lib is built for x64 +note: lib/test_dll.lib is built for x64 +note: debug/bin/test_dll.dll is built for x64 +note: bin/test_dll.dll is built for x64 +"@ + + if (-not $buildOutput.Replace("`r`n", "`n").Contains($expected)) { + throw 'Did not detect DLL with wrong architecture.' + } + + $buildOutput = Run-VcpkgAndCaptureOutput @commonArgs install --overlay-ports="$TestingRoot/wrong-architecture" 'test-dll[policy-skip-architecture-check]' --no-binarycaching --enforce-port-checks + Throw-IfFailed + if ($buildOutput.Contains("warning: The following files were built for an incorrect architecture. To suppress this message, add set(VCPKG_POLICY_SKIP_ARCHITECTURE_CHECK enabled) to portfile.cmake.")) { + throw 'VCPKG_POLICY_SKIP_ARCHITECTURE_CHECK didn''t suppress' + } +} # windows + +# DLLs with no AppContainer bit +if ($IsWindows) { + Refresh-TestRoot + mkdir "$TestingRoot/wrong-appcontainer" + Copy-Item -Recurse "$PSScriptRoot/../e2e-assets/test-dll-port-template" "$TestingRoot/wrong-appcontainer/test-dll" + Run-Vcpkg env "$TestingRoot/wrong-appcontainer/test-dll/build.cmd" --Triplet x64-windows + + $PortfilePath = "$TestingRoot/wrong-appcontainer$($NativeSlash)test-dll$($NativeSlash)portfile.cmake" + $buildOutput = Run-VcpkgAndCaptureOutput --triplet x64-uwp "--x-buildtrees-root=$buildtreesRoot" "--x-install-root=$installRoot" "--x-packages-root=$packagesRoot" install --overlay-ports="$TestingRoot/wrong-appcontainer" test-dll --no-binarycaching --enforce-port-checks + Throw-IfNotFailed + $expected = @" +$($PortfilePath): warning: The App Container bit must be set for all DLLs in Windows Store apps, and the triplet requests targeting the Windows Store, but the following DLLs were not built with the bit set. This usually means that toolchain linker flags are not being properly propagated, or the linker in use does not support the /APPCONTAINER switch. To suppress this message, add set(VCPKG_POLICY_SKIP_APPCONTAINER_CHECK enabled) +$($packagesRoot)$($NativeSlash)test-dll_x64-uwp: note: the DLLs are relative to `${CURRENT_PACKAGES_DIR} here +note: debug/bin/test_dll.dll +note: bin/test_dll.dll +"@ + + if (-not $buildOutput.Replace("`r`n", "`n").Contains($expected)) { + throw 'Did not detect DLL with wrong appcontainer.' + } + + $buildOutput = Run-VcpkgAndCaptureOutput --triplet x64-uwp "--x-buildtrees-root=$buildtreesRoot" "--x-install-root=$installRoot" "--x-packages-root=$packagesRoot" install --overlay-ports="$TestingRoot/wrong-appcontainer" 'test-dll[policy-skip-appcontainer-check]' --no-binarycaching --enforce-port-checks + Throw-IfFailed + if ($buildOutput.Contains("warning: The App Container bit must be set")) { + throw 'VCPKG_POLICY_SKIP_APPCONTAINER_CHECK didn''t suppress' + } +} # windows + +# Obsolete CRTs +if ($IsWindows) { + Refresh-TestRoot + $PortfilePath = "$PSScriptRoot/../e2e-ports$($NativeSlash)vcpkg-msvc-2013$($NativeSlash)portfile.cmake" + $expected = @" +$($PortfilePath): warning: DLLs that link with obsolete C RunTime ("CRT") DLLs were installed. Installed DLLs should link with an in-support CRT. You can inspect the dependencies of a DLL with ``dumpbin.exe /dependents mylibfile.dll``. If you're using a custom triplet targeting an old CRT, add set(VCPKG_POLICY_ALLOW_OBSOLETE_MSVCRT enabled) to the triplet's .cmake file. To suppress this message for this port, add set(VCPKG_POLICY_ALLOW_OBSOLETE_MSVCRT enabled) +$($packagesRoot)$($NativeSlash)vcpkg-msvc-2013_x86-windows: note: the DLLs are relative to `${CURRENT_PACKAGES_DIR} here +note: debug/bin/test_dll.dll +note: bin/test_dll.dll +"@ + + $buildOutput = Run-VcpkgAndCaptureOutput --triplet x86-windows "--x-buildtrees-root=$buildtreesRoot" "--x-install-root=$installRoot" "--x-packages-root=$packagesRoot" install --overlay-ports="$PSScriptRoot/../e2e-ports" 'vcpkg-msvc-2013' --no-binarycaching --enforce-port-checks + Throw-IfNotFailed + if (-not $buildOutput.Replace("`r`n", "`n").Contains($expected)) { + throw 'Did not detect obsolete CRT.' + } + + $buildOutput = Run-VcpkgAndCaptureOutput --triplet x86-windows "--x-buildtrees-root=$buildtreesRoot" "--x-install-root=$installRoot" "--x-packages-root=$packagesRoot" install --overlay-ports="$PSScriptRoot/../e2e-ports" 'vcpkg-msvc-2013[policy]' --no-binarycaching --enforce-port-checks + Throw-IfFailed + if ($buildOutput.Replace("`r`n", "`n").Contains($expected)) { + throw 'VCPKG_POLICY_ALLOW_OBSOLETE_MSVCRT did not suppress' + } + + Refresh-TestRoot + $expected = @" +$($PortfilePath): warning: DLLs that link with obsolete C RunTime ("CRT") DLLs were installed. Installed DLLs should link with an in-support CRT. You can inspect the dependencies of a DLL with ``dumpbin.exe /dependents mylibfile.dll``. If you're using a custom triplet targeting an old CRT, add set(VCPKG_POLICY_ALLOW_OBSOLETE_MSVCRT enabled) to the triplet's .cmake file. To suppress this message for this port, add set(VCPKG_POLICY_ALLOW_OBSOLETE_MSVCRT enabled) +$($packagesRoot)$($NativeSlash)vcpkg-msvc-2013_x86-windows: note: the DLLs are relative to `${CURRENT_PACKAGES_DIR} here +note: bin/test_dll.dll +"@ + + $buildOutput = Run-VcpkgAndCaptureOutput --triplet x86-windows "--x-buildtrees-root=$buildtreesRoot" "--x-install-root=$installRoot" "--x-packages-root=$packagesRoot" install --overlay-ports="$PSScriptRoot/../e2e-ports" 'vcpkg-msvc-2013[release-only]' --no-binarycaching --enforce-port-checks + Throw-IfNotFailed + if (-not $buildOutput.Replace("`r`n", "`n").Contains($expected)) { + throw 'Did not detect obsolete CRT.' + } +} # windows + +# DLLs in static mode +if ($IsWindows) { + Refresh-TestRoot + mkdir "$TestingRoot/dlls-in-static" + Copy-Item -Recurse "$PSScriptRoot/../e2e-assets/test-dll-port-template" "$TestingRoot/dlls-in-static/test-dll" + Run-Vcpkg @directoryArgs env "$TestingRoot/dlls-in-static/test-dll/build.cmd" --triplet x64-windows + + $PortfilePath = "$TestingRoot/dlls-in-static$($NativeSlash)test-dll$($NativeSlash)portfile.cmake" + $buildOutput = Run-VcpkgAndCaptureOutput @directoryArgs install --triplet x64-windows-static --overlay-ports="$TestingRoot/dlls-in-static" "test-dll[release-only]" --no-binarycaching --enforce-port-checks + Throw-IfNotFailed + $expected = @" +$($PortfilePath): warning: DLLs should not be present in a static build, but the following DLLs were found. To suppress this message, add set(VCPKG_POLICY_DLLS_IN_STATIC_LIBRARY enabled) +$($packagesRoot)$($NativeSlash)test-dll_x64-windows-static: note: the DLLs are relative to `${CURRENT_PACKAGES_DIR} here +note: bin/test_dll.dll +$($PortfilePath): warning: `${CURRENT_PACKAGES_DIR}/bin exists but should not in a static build. To suppress this message, add set(VCPKG_POLICY_DLLS_IN_STATIC_LIBRARY enabled) +note: if creation of these directories cannot be disabled, you can add the following in portfile.cmake to remove them +if(VCPKG_LIBRARY_LINKAGE STREQUAL "static") + file(REMOVE_RECURSE "`${CURRENT_PACKAGES_DIR}/bin") +endif() +"@ + + if (-not $buildOutput.Replace("`r`n", "`n").Contains($expected)) { + throw 'Did not detect DLL in static release-only.' + } + + + $buildOutput = Run-VcpkgAndCaptureOutput @directoryArgs install --triplet x64-windows-static --overlay-ports="$TestingRoot/dlls-in-static" "test-dll" --no-binarycaching --enforce-port-checks + Throw-IfNotFailed + $expected = @" +$($PortfilePath): warning: DLLs should not be present in a static build, but the following DLLs were found. To suppress this message, add set(VCPKG_POLICY_DLLS_IN_STATIC_LIBRARY enabled) +$($packagesRoot)$($NativeSlash)test-dll_x64-windows-static: note: the DLLs are relative to `${CURRENT_PACKAGES_DIR} here +note: debug/bin/test_dll.dll +note: bin/test_dll.dll +$($PortfilePath): warning: `${CURRENT_PACKAGES_DIR}/debug/bin exists but should not in a static build. To suppress this message, add set(VCPKG_POLICY_DLLS_IN_STATIC_LIBRARY enabled) +$($PortfilePath): warning: `${CURRENT_PACKAGES_DIR}/bin exists but should not in a static build. To suppress this message, add set(VCPKG_POLICY_DLLS_IN_STATIC_LIBRARY enabled) +note: if creation of these directories cannot be disabled, you can add the following in portfile.cmake to remove them +if(VCPKG_LIBRARY_LINKAGE STREQUAL "static") + file(REMOVE_RECURSE "`${CURRENT_PACKAGES_DIR}/debug/bin" "`${CURRENT_PACKAGES_DIR}/bin") +endif() +"@ + + if (-not $buildOutput.Replace("`r`n", "`n").Contains($expected)) { + throw 'Did not detect DLL in static.' + } + + $buildOutput = Run-VcpkgAndCaptureOutput @directoryArgs install --triplet x64-windows-static --overlay-ports="$TestingRoot/dlls-in-static" "test-dll[policy-dlls-in-static-library]" --no-binarycaching --enforce-port-checks + Throw-IfFailed + if ($buildOutput.Replace("`r`n", "`n").Contains($expected)) { + throw 'VCPKG_POLICY_DLLS_IN_STATIC_LIBRARY didn''t suppress' + } +} # windows + # Wrong CRT linkage +if ($IsWindows) { + Refresh-TestRoot + mkdir "$TestingRoot/wrong-crt" + Copy-Item -Recurse "$PSScriptRoot/../e2e-assets/test-lib-port-template-dynamic-crt" "$TestingRoot/wrong-crt/test-lib" + Run-Vcpkg env "$TestingRoot/wrong-crt/test-lib/build.cmd" --Triplet x86-windows-static + $PortfilePath = "$TestingRoot/wrong-crt$($NativeSlash)test-lib$($NativeSlash)portfile.cmake" + $buildOutput = Run-VcpkgAndCaptureOutput --triplet x86-windows-static "--x-buildtrees-root=$buildtreesRoot" "--x-install-root=$installRoot" "--x-packages-root=$packagesRoot" install --overlay-ports="$TestingRoot/wrong-crt" test-lib --no-binarycaching --enforce-port-checks + Throw-IfNotFailed +$expected = @" +$($PortfilePath): warning: binaries built by this port link with C RunTimes ("CRTs") inconsistent with those requested by the triplet and deployment structure. If the triplet is intended to only use the release CRT, you should add set(VCPKG_POLICY_ONLY_RELEASE_CRT enabled) to the triplet .cmake file. To suppress this check entirely, add set(VCPKG_POLICY_SKIP_CRT_LINKAGE_CHECK enabled) to the triplet .cmake if this is triplet-wide, or to portfile.cmake if this is specific to the port. You can inspect the binaries with: dumpbin.exe /directives mylibfile.lib +$packagesRoot\test-lib_x86-windows-static: note: the binaries are relative to `${CURRENT_PACKAGES_DIR} here +note: The following binaries should link with only: Static Debug (/MTd) +note: debug/lib/both_lib.lib links with: Dynamic Debug (/MDd) +note: debug/lib/both_lib.lib links with: Dynamic Release (/MD) +note: debug/lib/test_lib.lib links with: Dynamic Debug (/MDd) +note: The following binaries should link with only: Static Release (/MT) +note: lib/both_lib.lib links with: Dynamic Debug (/MDd) +note: lib/both_lib.lib links with: Dynamic Release (/MD) +note: lib/test_lib.lib links with: Dynamic Release (/MD) +"@ + + if (-not $buildOutput.Replace("`r`n", "`n").Contains($expected)) { + throw 'Did not detect lib with wrong CRT linkage.' + } + + $buildOutput = Run-VcpkgAndCaptureOutput --triplet x86-windows-static "--x-buildtrees-root=$buildtreesRoot" "--x-install-root=$installRoot" "--x-packages-root=$packagesRoot" install --overlay-ports="$TestingRoot/wrong-crt" 'test-lib[policy-skip-crt-linkage-check]' --no-binarycaching --enforce-port-checks + Throw-IfFailed + if ($buildOutput.Contains('warning: The following binaries should use the Static Debug (/MTd) CRT')) { + throw 'VCPKG_POLICY_SKIP_CRT_LINKAGE_CHECK didn''t suppress' + } + +# ... also release only + Refresh-TestRoot + mkdir "$TestingRoot/wrong-crt-release-only" + $PortfilePath = "$TestingRoot/wrong-crt-release-only$($NativeSlash)test-lib$($NativeSlash)portfile.cmake" + Copy-Item -Recurse "$PSScriptRoot/../e2e-assets/test-lib-port-template-dynamic-crt-release-only" "$TestingRoot/wrong-crt-release-only/test-lib" + Run-Vcpkg env "$TestingRoot/wrong-crt-release-only/test-lib/build.cmd" --Triplet x86-windows-static + + $buildOutput = Run-VcpkgAndCaptureOutput --triplet x86-windows-static "--x-buildtrees-root=$buildtreesRoot" "--x-install-root=$installRoot" "--x-packages-root=$packagesRoot" install --overlay-ports="$TestingRoot/wrong-crt-release-only" test-lib --no-binarycaching --enforce-port-checks + Throw-IfNotFailed +$expected = @" +$($PortfilePath): warning: binaries built by this port link with C RunTimes ("CRTs") inconsistent with those requested by the triplet and deployment structure. If the triplet is intended to only use the release CRT, you should add set(VCPKG_POLICY_ONLY_RELEASE_CRT enabled) to the triplet .cmake file. To suppress this check entirely, add set(VCPKG_POLICY_SKIP_CRT_LINKAGE_CHECK enabled) to the triplet .cmake if this is triplet-wide, or to portfile.cmake if this is specific to the port. You can inspect the binaries with: dumpbin.exe /directives mylibfile.lib +$packagesRoot\test-lib_x86-windows-static: note: the binaries are relative to `${CURRENT_PACKAGES_DIR} here +note: The following binaries should link with only: Static Debug (/MTd) +note: debug/lib/test_lib.lib links with: Dynamic Release (/MD) +note: The following binaries should link with only: Static Release (/MT) +note: lib/test_lib.lib links with: Dynamic Release (/MD) +"@ + + if (-not $buildOutput.Replace("`r`n", "`n").Contains($expected)) { + throw 'Did not detect lib with wrong CRT linkage release only.' + } + + $buildOutput = Run-VcpkgAndCaptureOutput --triplet x86-windows-static "--x-buildtrees-root=$buildtreesRoot" "--x-install-root=$installRoot" "--x-packages-root=$packagesRoot" install --overlay-ports="$TestingRoot/wrong-crt-release-only" 'test-lib[policy-only-release-crt]' --no-binarycaching --enforce-port-checks + Throw-IfNotFailed +$expected = @" +$($PortfilePath): warning: binaries built by this port link with C RunTimes ("CRTs") inconsistent with those requested by the triplet and deployment structure. If the triplet is intended to only use the release CRT, you should add set(VCPKG_POLICY_ONLY_RELEASE_CRT enabled) to the triplet .cmake file. To suppress this check entirely, add set(VCPKG_POLICY_SKIP_CRT_LINKAGE_CHECK enabled) to the triplet .cmake if this is triplet-wide, or to portfile.cmake if this is specific to the port. You can inspect the binaries with: dumpbin.exe /directives mylibfile.lib +$packagesRoot\test-lib_x86-windows-static: note: the binaries are relative to `${CURRENT_PACKAGES_DIR} here +note: The following binaries should link with only: Static Release (/MT) +note: debug/lib/test_lib.lib links with: Dynamic Release (/MD) +note: lib/test_lib.lib links with: Dynamic Release (/MD) +"@ + + if (-not $buildOutput.Replace("`r`n", "`n").Contains($expected)) { + throw 'Did not detect lib with wrong CRT linkage release only.' + } + + if ($buildOutput.Contains('warning: The following binaries should use the Static Debug (/MTd) CRT')) { + throw 'VCPKG_POLICY_ONLY_RELEASE_CRT didn''t suppress detecting debug CRTs' + } + + $buildOutput = Run-VcpkgAndCaptureOutput --triplet x86-windows-static "--x-buildtrees-root=$buildtreesRoot" "--x-install-root=$installRoot" "--x-packages-root=$packagesRoot" install --overlay-ports="$TestingRoot/wrong-crt-release-only" 'test-lib[policy-skip-crt-linkage-check]' --no-binarycaching --enforce-port-checks + Throw-IfFailed + if ($buildOutput.Contains('warning: The following binaries should use the Static Release (/MT) CRT')) { + throw 'VCPKG_POLICY_SKIP_CRT_LINKAGE_CHECK didn''t suppress' + } +} # windows + +# Empty folders +Refresh-TestRoot +$PortfilePath = "$PSScriptRoot/../e2e-ports$($NativeSlash)vcpkg-policy-empty-folders$($NativeSlash)portfile.cmake" +$expected = @" +$($PortfilePath): warning: There should be no installed empty directories. Empty directories are not representable to several binary cache providers, git repositories, and are not considered semantic build outputs. You should either create a regular file inside each empty directory, or delete them with the following CMake. To suppress this message, add set(VCPKG_POLICY_ALLOW_EMPTY_FOLDERS enabled) +$($packagesRoot)$($NativeSlash)vcpkg-policy-empty-folders_$($Triplet): note: the directories are relative to `${CURRENT_PACKAGES_DIR} here +note: file(REMOVE_RECURSE "`${CURRENT_PACKAGES_DIR}/empty-directory" "`${CURRENT_PACKAGES_DIR}/root/empty-inner-directory") +"@ +$buildOutput = Run-VcpkgAndCaptureOutput @commonArgs install --overlay-ports="$PSScriptRoot/../e2e-ports" 'vcpkg-policy-empty-folders' --no-binarycaching --enforce-port-checks +Throw-IfNotFailed +if (-not $buildOutput.Replace("`r`n", "`n").Contains($expected)) { + throw 'Did not detect empty directories' +} + +$buildOutput = Run-VcpkgAndCaptureOutput @commonArgs install --overlay-ports="$PSScriptRoot/../e2e-ports" 'vcpkg-policy-empty-folders[policy]' --no-binarycaching --enforce-port-checks +Throw-IfFailed +if ($buildOutput.Replace("`r`n", "`n").Contains($expected)) { + throw 'VCPKG_POLICY_ALLOW_EMPTY_FOLDERS didn''t suppress' +} + +# Misplaced regular files Refresh-TestRoot -mkdir "$TestingRoot/wrong-crt" -Copy-Item -Recurse "$PSScriptRoot/../e2e-assets/test-lib-port-template-dynamic-crt" "$TestingRoot/wrong-crt/test-lib" -Run-Vcpkg env "$TestingRoot/wrong-crt/test-lib/build.cmd" --Triplet x86-windows-static -Throw-IfFailed - -$buildOutput = Run-VcpkgAndCaptureOutput --triplet x86-windows-static "--x-buildtrees-root=$buildtreesRoot" "--x-install-root=$installRoot" "--x-packages-root=$packagesRoot" install --overlay-ports="$TestingRoot/wrong-crt" test-lib --no-binarycaching -$expected = "warning: The following binaries should use the Static Debug (/MTd) CRT.`n" + -" $packagesRoot\test-lib_x86-windows-static\debug\lib\both_lib.lib links with:`n" + -" Dynamic Debug (/MDd)`n" + -" Dynamic Release (/MD)`n" + -" $packagesRoot\test-lib_x86-windows-static\debug\lib\test_lib.lib links with: Dynamic Debug (/MDd)`n" + -"To inspect the lib files, use:`n" + -" dumpbin.exe /directives mylibfile.lib`n" + -"warning: The following binaries should use the Static Release (/MT) CRT.`n" + -" $packagesRoot\test-lib_x86-windows-static\lib\both_lib.lib links with:`n" + -" Dynamic Debug (/MDd)`n" + -" Dynamic Release (/MD)`n" + -" $packagesRoot\test-lib_x86-windows-static\lib\test_lib.lib links with: Dynamic Release (/MD)`n" + -"To inspect the lib files, use:`n" + -" dumpbin.exe /directives mylibfile.lib`n" -if (-not $buildOutput.Replace("`r`n", "`n").Contains($expected)) { - throw 'Did not detect lib with wrong CRT linkage.' +$PortfilePath = "$PSScriptRoot/../e2e-ports$($NativeSlash)vcpkg-policy-misplaced-regular-files$($NativeSlash)portfile.cmake" +$buildOutput = Run-VcpkgAndCaptureOutput @commonArgs install --overlay-ports="$PSScriptRoot/../e2e-ports" 'vcpkg-policy-misplaced-regular-files' --no-binarycaching --enforce-port-checks +Throw-IfNotFailed +$expected = @" +$($PortfilePath): warning: The following regular files are installed to location(s) where regular files may not be installed. These should be installed in a subdirectory. To suppress this message, add set(VCPKG_POLICY_SKIP_MISPLACED_REGULAR_FILES_CHECK enabled) +$($packagesRoot)$($NativeSlash)vcpkg-policy-misplaced-regular-files_$($Triplet): note: the files are relative to `${CURRENT_PACKAGES_DIR} here +note: debug/bad_debug_file.txt +note: bad_file.txt +"@ +if (-not $buildOutput.Replace("`r`n", "`n").Contains($expected)) { + throw 'Did not detect bad regular files' +} +$buildOutput = Run-VcpkgAndCaptureOutput @commonArgs install --overlay-ports="$PSScriptRoot/../e2e-ports" 'vcpkg-policy-misplaced-regular-files[policy]' --no-binarycaching --enforce-port-checks +Throw-IfFailed +if ($buildOutput.Replace("`r`n", "`n").Contains($expected)) { + throw 'VCPKG_POLICY_SKIP_MISPLACED_REGULAR_FILES_CHECK didn''t suppress' } + +# Misplaced pkgconfig +Refresh-TestRoot +$PortfilePath = "$PSScriptRoot/../e2e-ports$($NativeSlash)vcpkg-policy-misplaced-pkgconfig$($NativeSlash)portfile.cmake" +$buildOutput = Run-VcpkgAndCaptureOutput @commonArgs install --overlay-ports="$PSScriptRoot/../e2e-ports" 'vcpkg-policy-misplaced-pkgconfig[install-arch-dependent-bad-misplaced]' --no-binarycaching --enforce-port-checks +Throw-IfNotFailed +$expected = @" +$($PortfilePath): warning: The following misplaced pkgconfig directories were installed. Misplaced pkgconfig files will not be found correctly by pkgconf or pkg-config. pkgconfig directories should be `${CURRENT_PACKAGES_DIR}/share/pkgconfig (for architecture agnostic / header only libraries only), `${CURRENT_PACKAGES_DIR}/lib/pkgconfig (for release dependencies), or `${CURRENT_PACKAGES_DIR}/lib/debug/pkgconfig (for debug dependencies). To suppress this message, add set(VCPKG_POLICY_SKIP_PKGCONFIG_CHECK enabled) +$($packagesRoot)$($NativeSlash)vcpkg-policy-misplaced-pkgconfig_$($Triplet): note: the files are relative to `${CURRENT_PACKAGES_DIR} here +note: bin/pkgconfig/zlib.pc +note: debug/bin/pkgconfig/zlib.pc +note: You can move the pkgconfig files with commands similar to: +file(MAKE_DIRECTORY "`${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig" "`${CURRENT_PACKAGES_DIR}/lib/pkgconfig") +file(RENAME "`${CURRENT_PACKAGES_DIR}/bin/pkgconfig/zlib.pc" "`${CURRENT_PACKAGES_DIR}/lib/pkgconfig/zlib.pc") +file(RENAME "`${CURRENT_PACKAGES_DIR}/debug/bin/pkgconfig/zlib.pc" "`${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig/zlib.pc") +vcpkg_fixup_pkgconfig() +file(REMOVE_RECURSE empty directories left by the above renames) +"@ +if (-not $buildOutput.Replace("`r`n", "`n").Contains($expected)) { + throw 'Did not detect bad pkgconfig misplaced' +} +$buildOutput = Run-VcpkgAndCaptureOutput @commonArgs install --overlay-ports="$PSScriptRoot/../e2e-ports" 'vcpkg-policy-misplaced-pkgconfig[install-arch-agnostic-bad-misplaced,install-arch-agnostic-empty-libs-bad-misplaced,install-arch-dependent-bad-misplaced,install-arch-dependent-bad-share]' --no-binarycaching --enforce-port-checks +Throw-IfNotFailed +$expected = @" +$($PortfilePath): warning: The following misplaced pkgconfig directories were installed. Misplaced pkgconfig files will not be found correctly by pkgconf or pkg-config. pkgconfig directories should be `${CURRENT_PACKAGES_DIR}/share/pkgconfig (for architecture agnostic / header only libraries only), `${CURRENT_PACKAGES_DIR}/lib/pkgconfig (for release dependencies), or `${CURRENT_PACKAGES_DIR}/lib/debug/pkgconfig (for debug dependencies). To suppress this message, add set(VCPKG_POLICY_SKIP_PKGCONFIG_CHECK enabled) +$($packagesRoot)$($NativeSlash)vcpkg-policy-misplaced-pkgconfig_$($Triplet): note: the files are relative to `${CURRENT_PACKAGES_DIR} here +note: bin/pkgconfig/libmorton.pc +note: bin/pkgconfig/zlib-no-libs.pc +note: bin/pkgconfig/zlib.pc +note: debug/bin/pkgconfig/zlib.pc +note: share/pkgconfig/zlib.pc +note: You can move the pkgconfig files with commands similar to: +file(MAKE_DIRECTORY "`${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig" "`${CURRENT_PACKAGES_DIR}/lib/pkgconfig" "`${CURRENT_PACKAGES_DIR}/share/pkgconfig") +file(RENAME "`${CURRENT_PACKAGES_DIR}/bin/pkgconfig/libmorton.pc" "`${CURRENT_PACKAGES_DIR}/share/pkgconfig/libmorton.pc") +file(RENAME "`${CURRENT_PACKAGES_DIR}/bin/pkgconfig/zlib-no-libs.pc" "`${CURRENT_PACKAGES_DIR}/share/pkgconfig/zlib-no-libs.pc") +file(RENAME "`${CURRENT_PACKAGES_DIR}/bin/pkgconfig/zlib.pc" "`${CURRENT_PACKAGES_DIR}/lib/pkgconfig/zlib.pc") +file(RENAME "`${CURRENT_PACKAGES_DIR}/debug/bin/pkgconfig/zlib.pc" "`${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig/zlib.pc") +file(RENAME "`${CURRENT_PACKAGES_DIR}/share/pkgconfig/zlib.pc" "`${CURRENT_PACKAGES_DIR}/lib/pkgconfig/zlib.pc") +vcpkg_fixup_pkgconfig() +file(REMOVE_RECURSE empty directories left by the above renames) +"@ +if (-not $buildOutput.Replace("`r`n", "`n").Contains($expected)) { + throw 'Did not detect bad pkgconfig all bad' +} +$buildOutput = Run-VcpkgAndCaptureOutput @commonArgs install --overlay-ports="$PSScriptRoot/../e2e-ports" 'vcpkg-policy-misplaced-pkgconfig[install-arch-agnostic-bad-misplaced,install-arch-agnostic-empty-libs-bad-misplaced,install-arch-dependent-bad-misplaced,install-arch-dependent-bad-share,policy]' --no-binarycaching --enforce-port-checks +Throw-IfFailed +if ($buildOutput.Replace("`r`n", "`n").Contains($expected)) { + throw 'VCPKG_POLICY_SKIP_PKGCONFIG_CHECK didn''t suppress' +} + +Refresh-TestRoot + +$buildOutput = Run-VcpkgAndCaptureOutput @commonArgs install --overlay-ports="$PSScriptRoot/../e2e-ports" 'vcpkg-policy-misplaced-pkgconfig[install-arch-dependent-bad-misplaced-release-only]' --no-binarycaching --enforce-port-checks +Throw-IfNotFailed +$expected = @" +$($PortfilePath): warning: The following misplaced pkgconfig directories were installed. Misplaced pkgconfig files will not be found correctly by pkgconf or pkg-config. pkgconfig directories should be `${CURRENT_PACKAGES_DIR}/share/pkgconfig (for architecture agnostic / header only libraries only), `${CURRENT_PACKAGES_DIR}/lib/pkgconfig (for release dependencies), or `${CURRENT_PACKAGES_DIR}/lib/debug/pkgconfig (for debug dependencies). To suppress this message, add set(VCPKG_POLICY_SKIP_PKGCONFIG_CHECK enabled) +$($packagesRoot)$($NativeSlash)vcpkg-policy-misplaced-pkgconfig_$($Triplet): note: the files are relative to `${CURRENT_PACKAGES_DIR} here +note: bin/pkgconfig/zlib.pc +note: You can move the pkgconfig files with commands similar to: +file(MAKE_DIRECTORY "`${CURRENT_PACKAGES_DIR}/lib/pkgconfig") +file(RENAME "`${CURRENT_PACKAGES_DIR}/bin/pkgconfig/zlib.pc" "`${CURRENT_PACKAGES_DIR}/lib/pkgconfig/zlib.pc") +vcpkg_fixup_pkgconfig() +file(REMOVE_RECURSE empty directories left by the above renames) +"@ +if (-not $buildOutput.Replace("`r`n", "`n").Contains($expected)) { + throw 'Did not detect bad pkgconfig release only' +} + +$buildOutput = Run-VcpkgAndCaptureOutput @commonArgs install --overlay-ports="$PSScriptRoot/../e2e-ports" 'vcpkg-policy-misplaced-pkgconfig[install-arch-agnostic-bad-misplaced]' --no-binarycaching --enforce-port-checks +Throw-IfNotFailed +$expected = @" +$($PortfilePath): warning: The following misplaced pkgconfig directories were installed. Misplaced pkgconfig files will not be found correctly by pkgconf or pkg-config. pkgconfig directories should be `${CURRENT_PACKAGES_DIR}/share/pkgconfig (for architecture agnostic / header only libraries only), `${CURRENT_PACKAGES_DIR}/lib/pkgconfig (for release dependencies), or `${CURRENT_PACKAGES_DIR}/lib/debug/pkgconfig (for debug dependencies). To suppress this message, add set(VCPKG_POLICY_SKIP_PKGCONFIG_CHECK enabled) +$($packagesRoot)$($NativeSlash)vcpkg-policy-misplaced-pkgconfig_$($Triplet): note: the files are relative to `${CURRENT_PACKAGES_DIR} here +note: bin/pkgconfig/libmorton.pc +note: You can move the pkgconfig files with commands similar to: +file(MAKE_DIRECTORY "`${CURRENT_PACKAGES_DIR}/share/pkgconfig") +file(RENAME "`${CURRENT_PACKAGES_DIR}/bin/pkgconfig/libmorton.pc" "`${CURRENT_PACKAGES_DIR}/share/pkgconfig/libmorton.pc") +vcpkg_fixup_pkgconfig() +file(REMOVE_RECURSE empty directories left by the above renames) +"@ +if (-not $buildOutput.Replace("`r`n", "`n").Contains($expected)) { + throw 'Did not detect bad pkgconfig arch agnostic' +} + +$buildOutput = Run-VcpkgAndCaptureOutput @commonArgs install --overlay-ports="$PSScriptRoot/../e2e-ports" 'vcpkg-policy-misplaced-pkgconfig[install-arch-agnostic-empty-libs-bad-misplaced]' --no-binarycaching --enforce-port-checks +Throw-IfNotFailed +$expected = @" +$($PortfilePath): warning: The following misplaced pkgconfig directories were installed. Misplaced pkgconfig files will not be found correctly by pkgconf or pkg-config. pkgconfig directories should be `${CURRENT_PACKAGES_DIR}/share/pkgconfig (for architecture agnostic / header only libraries only), `${CURRENT_PACKAGES_DIR}/lib/pkgconfig (for release dependencies), or `${CURRENT_PACKAGES_DIR}/lib/debug/pkgconfig (for debug dependencies). To suppress this message, add set(VCPKG_POLICY_SKIP_PKGCONFIG_CHECK enabled) +$($packagesRoot)$($NativeSlash)vcpkg-policy-misplaced-pkgconfig_$($Triplet): note: the files are relative to `${CURRENT_PACKAGES_DIR} here +note: bin/pkgconfig/zlib-no-libs.pc +note: You can move the pkgconfig files with commands similar to: +file(MAKE_DIRECTORY "`${CURRENT_PACKAGES_DIR}/share/pkgconfig") +file(RENAME "`${CURRENT_PACKAGES_DIR}/bin/pkgconfig/zlib-no-libs.pc" "`${CURRENT_PACKAGES_DIR}/share/pkgconfig/zlib-no-libs.pc") +vcpkg_fixup_pkgconfig() +file(REMOVE_RECURSE empty directories left by the above renames) +"@ +if (-not $buildOutput.Replace("`r`n", "`n").Contains($expected)) { + throw 'Did not detect bad pkgconfig arch agnostic empty libs' +} + +$buildOutput = Run-VcpkgAndCaptureOutput @commonArgs install --overlay-ports="$PSScriptRoot/../e2e-ports" 'vcpkg-policy-misplaced-pkgconfig[install-arch-dependent-bad-share]' --no-binarycaching --enforce-port-checks +Throw-IfNotFailed +$expected = @" +$($PortfilePath): warning: The following misplaced pkgconfig directories were installed. Misplaced pkgconfig files will not be found correctly by pkgconf or pkg-config. pkgconfig directories should be `${CURRENT_PACKAGES_DIR}/share/pkgconfig (for architecture agnostic / header only libraries only), `${CURRENT_PACKAGES_DIR}/lib/pkgconfig (for release dependencies), or `${CURRENT_PACKAGES_DIR}/lib/debug/pkgconfig (for debug dependencies). To suppress this message, add set(VCPKG_POLICY_SKIP_PKGCONFIG_CHECK enabled) +$($packagesRoot)$($NativeSlash)vcpkg-policy-misplaced-pkgconfig_$($Triplet): note: the files are relative to `${CURRENT_PACKAGES_DIR} here +note: share/pkgconfig/zlib.pc +note: You can move the pkgconfig files with commands similar to: +file(MAKE_DIRECTORY "`${CURRENT_PACKAGES_DIR}/lib/pkgconfig") +file(RENAME "`${CURRENT_PACKAGES_DIR}/share/pkgconfig/zlib.pc" "`${CURRENT_PACKAGES_DIR}/lib/pkgconfig/zlib.pc") +vcpkg_fixup_pkgconfig() +file(REMOVE_RECURSE empty directories left by the above renames) +"@ +if (-not $buildOutput.Replace("`r`n", "`n").Contains($expected)) { + throw 'Did not detect bad pkgconfig arch dependent share' +} + +# ... and all good places +Refresh-TestRoot +Run-VcpkgAndCaptureOutput @commonArgs install --overlay-ports="$PSScriptRoot/../e2e-ports" 'vcpkg-policy-misplaced-pkgconfig[install-arch-agnostic-empty-libs-good,install-arch-agnostic-empty-libs-good-share,install-arch-agnostic-good-share,install-arch-dependent-good]' --no-binarycaching --enforce-port-checks +Throw-IfFailed + +# Absolute paths +Refresh-TestRoot +$PortfilePath = "$PSScriptRoot/../e2e-ports$($NativeSlash)vcpkg-policy-absolute-paths$($NativeSlash)portfile.cmake" +$expectedHeader = @" +$($PortfilePath): warning: There should be no absolute paths, such as the following, in an installed package. To suppress this message, add set(VCPKG_POLICY_SKIP_ABSOLUTE_PATHS_CHECK enabled) +note: $($packagesRoot) +note: $($installRoot) +note: $($buildtreesRoot) +"@ +# downloads directory here +$expectedFooter = @" +note: Absolute paths were found in the following files +$($packagesRoot)$($NativeSlash)vcpkg-policy-absolute-paths_$($Triplet): note: the files are relative to `${CURRENT_PACKAGES_DIR} here +note: include/vcpkg-policy-absolute-paths.h +"@ + +foreach ($bad_dir in @('build-dir', 'downloads', 'installed-root', 'package-dir')) { + $buildOutput = Run-VcpkgAndCaptureOutput @commonArgs install --overlay-ports="$PSScriptRoot/../e2e-ports" "vcpkg-policy-absolute-paths[$bad_dir]" --no-binarycaching --enforce-port-checks + Throw-IfNotFailed + if (-not $buildOutput.Replace("`r`n", "`n").Contains($expectedHeader)) { + throw 'Did not detect bad absolute paths header' + } + if (-not $buildOutput.Replace("`r`n", "`n").Contains($expectedFooter)) { + throw 'Did not detect bad absolute paths footer' + } +} + +$expectedFooter = @" +$($PortfilePath): note: Adding a call to ``vcpkg_fixup_pkgconfig()`` may fix absolute paths in .pc files +note: Absolute paths were found in the following files +$($packagesRoot)$($NativeSlash)vcpkg-policy-absolute-paths_$($Triplet): note: the files are relative to `${CURRENT_PACKAGES_DIR} here +note: include/vcpkg-policy-absolute-paths.h +note: share/pkgconfig/vcpkg-policy-absolute-paths.pc +"@ + +foreach ($bad_dir in @('build-dir', 'downloads', 'installed-root', 'package-dir')) { + $buildOutput = Run-VcpkgAndCaptureOutput @commonArgs install --overlay-ports="$PSScriptRoot/../e2e-ports" "vcpkg-policy-absolute-paths[$bad_dir,pkgconfig]" --no-binarycaching --enforce-port-checks + Throw-IfNotFailed + if (-not $buildOutput.Replace("`r`n", "`n").Contains($expectedHeader)) { + throw 'Did not detect bad absolute paths header' + } + if (-not $buildOutput.Replace("`r`n", "`n").Contains($expectedFooter)) { + throw 'Did not detect bad absolute paths pkgconfig footer' + } +} + +Run-Vcpkg @commonArgs install --overlay-ports="$PSScriptRoot/../e2e-ports" 'vcpkg-policy-absolute-paths[build-dir,downloads,installed-root,package-dir,pkgconfig,policy]' --no-binarycaching --enforce-port-checks +Throw-IfFailed diff --git a/azure-pipelines/end-to-end-tests-dir/usage.ps1 b/azure-pipelines/end-to-end-tests-dir/usage.ps1 index 428bb0e356..4b6e5e7507 100644 --- a/azure-pipelines/end-to-end-tests-dir/usage.ps1 +++ b/azure-pipelines/end-to-end-tests-dir/usage.ps1 @@ -34,17 +34,25 @@ wrong-pkgconfig provides pkg-config modules: # Test lib wrong-pkgconfig +"@, +@" +vcpkg-header-only is header-only and can be used from CMake via: + + find_path(VCPKG_HEADER_ONLY_INCLUDE_DIRS "vcpkg-header-only.h") + target_include_directories(main PRIVATE `${VCPKG_HEADER_ONLY_INCLUDE_DIRS}) "@ ) [string[]]$prohibitedUsages = @( - 'vcpkg-empty-port provides CMake targets' + 'vcpkg-empty-port provides CMake targets', + 'vcpkg-header-only provides CMake targets' ) [string]$usage = Run-VcpkgAndCaptureOutput ($commonArgs + @('install', 'vcpkg-cmake-config-many-targets', 'vcpkg-empty-port', 'vcpkg-explicit-usage', + 'vcpkg-header-only', 'vcpkg-hello-world-1', 'vcpkg-hello-world-2', 'wrong-pkgconfig[header-only-good]' diff --git a/include/vcpkg/base/contractual-constants.h b/include/vcpkg/base/contractual-constants.h index 0dd0489ffa..4df94fa7d2 100644 --- a/include/vcpkg/base/contractual-constants.h +++ b/include/vcpkg/base/contractual-constants.h @@ -374,6 +374,12 @@ namespace vcpkg inline constexpr StringLiteral CMakeVariableNoDownloads = "_VCPKG_NO_DOWNLOADS"; inline constexpr StringLiteral CMakeVariablePlatformToolset = "VCPKG_PLATFORM_TOOLSET"; inline constexpr StringLiteral CMakeVariablePlatformToolsetVersion = "VCPKG_PLATFORM_TOOLSET_VERSION"; + inline constexpr StringLiteral CMakeVariablePolicyAllowDebugInclude = "VCPKG_POLICY_ALLOW_DEBUG_INCLUDE"; + inline constexpr StringLiteral CMakeVariablePolicyAllowDebugShare = "VCPKG_POLICY_ALLOW_DEBUG_SHARE"; + inline constexpr StringLiteral CMakeVariablePolicyAllowDllsInLib = "VCPKG_POLICY_ALLOW_DLLS_IN_LIB"; + inline constexpr StringLiteral CMakeVariablePolicyAllowEmptyFolders = "VCPKG_POLICY_ALLOW_EMPTY_FOLDERS"; + inline constexpr StringLiteral CMakeVariablePolicyAllowExesInBin = "VCPKG_POLICY_ALLOW_EXES_IN_BIN"; + inline constexpr StringLiteral CMakeVariablePolicyAllowKernel32FromXBox = "VCPKG_POLICY_ALLOW_KERNEL32_FROM_XBOX"; inline constexpr StringLiteral CMakeVariablePolicyAllowObsoleteMsvcrt = "VCPKG_POLICY_ALLOW_OBSOLETE_MSVCRT"; inline constexpr StringLiteral CMakeVariablePolicyAllowRestrictedHeaders = "VCPKG_POLICY_ALLOW_RESTRICTED_HEADERS"; inline constexpr StringLiteral CMakeVariablePolicyCMakeHelperPort = "VCPKG_POLICY_CMAKE_HELPER_PORT"; @@ -386,8 +392,21 @@ namespace vcpkg "VCPKG_POLICY_MISMATCHED_NUMBER_OF_BINARIES"; inline constexpr StringLiteral CMakeVariablePolicyOnlyReleaseCrt = "VCPKG_POLICY_ONLY_RELEASE_CRT"; inline constexpr StringLiteral CMakeVariablePolicySkipAbsolutePathsCheck = "VCPKG_POLICY_SKIP_ABSOLUTE_PATHS_CHECK"; + inline constexpr StringLiteral CMakeVariablePolicySkipAllPostBuildChecks = + "VCPKG_POLICY_SKIP_ALL_POST_BUILD_CHECKS"; + inline constexpr StringLiteral CMakeVariablePolicySkipAppcontainerCheck = "VCPKG_POLICY_SKIP_APPCONTAINER_CHECK"; inline constexpr StringLiteral CMakeVariablePolicySkipArchitectureCheck = "VCPKG_POLICY_SKIP_ARCHITECTURE_CHECK"; + inline constexpr StringLiteral CMakeVariablePolicySkipCopyrightCheck = "VCPKG_POLICY_SKIP_COPYRIGHT_CHECK"; + inline constexpr StringLiteral CMakeVariablePolicySkipCrtLinkageCheck = "VCPKG_POLICY_SKIP_CRT_LINKAGE_CHECK"; inline constexpr StringLiteral CMakeVariablePolicySkipDumpbinChecks = "VCPKG_POLICY_SKIP_DUMPBIN_CHECKS"; + inline constexpr StringLiteral CMakeVariablePolicySkipLibCMakeMergeCheck = + "VCPKG_POLICY_SKIP_LIB_CMAKE_MERGE_CHECK"; + inline constexpr StringLiteral CMakeVariablePolicySkipMisplacedCMakeFilesCheck = + "VCPKG_POLICY_SKIP_MISPLACED_CMAKE_FILES_CHECK"; + inline constexpr StringLiteral CMakeVariablePolicySkipMisplacedRegularFilesCheck = + "VCPKG_POLICY_SKIP_MISPLACED_REGULAR_FILES_CHECK"; + inline constexpr StringLiteral CMakeVariablePolicySkipPkgConfigCheck = "VCPKG_POLICY_SKIP_PKGCONFIG_CHECK"; + inline constexpr StringLiteral CMakeVariablePolicySkipUsageInstallCheck = "VCPKG_POLICY_SKIP_USAGE_INSTALL_CHECK"; inline constexpr StringLiteral CMakeVariablePort = "PORT"; inline constexpr StringLiteral CMakeVariablePortConfigs = "VCPKG_PORT_CONFIGS"; inline constexpr StringLiteral CMakeVariableProhibitBackcompatFeatures = "_VCPKG_PROHIBIT_BACKCOMPAT_FEATURES"; @@ -408,6 +427,12 @@ namespace vcpkg inline constexpr StringLiteral CMakeVariableZVcpkgGameDKLatest = "Z_VCPKG_GameDKLatest"; // Policies are PascalCase + inline constexpr StringLiteral PolicyAllowDebugInclude = "PolicyAllowDebugInclude"; + inline constexpr StringLiteral PolicyAllowDebugShare = "PolicyAllowDebugShare"; + inline constexpr StringLiteral PolicyAllowDllsInLib = "PolicyAllowDllsInLib"; + inline constexpr StringLiteral PolicyAllowEmptyFolders = "PolicyAllowEmptyFolders"; + inline constexpr StringLiteral PolicyAllowExesInBin = "PolicyAllowExesInBin"; + inline constexpr StringLiteral PolicyAllowKernel32FromXBox = "PolicyAllowKernel32FromXBox"; inline constexpr StringLiteral PolicyAllowObsoleteMsvcrt = "PolicyAllowObsoleteMsvcrt"; inline constexpr StringLiteral PolicyAllowRestrictedHeaders = "PolicyAllowRestrictedHeaders"; inline constexpr StringLiteral PolicyCMakeHelperPort = "PolicyCmakeHelperPort"; @@ -419,8 +444,17 @@ namespace vcpkg inline constexpr StringLiteral PolicyMismatchedNumberOfBinaries = "PolicyMismatchedNumberOfBinaries"; inline constexpr StringLiteral PolicyOnlyReleaseCrt = "PolicyOnlyReleaseCRT"; inline constexpr StringLiteral PolicySkipAbsolutePathsCheck = "PolicySkipAbsolutePathsCheck"; + inline constexpr StringLiteral PolicySkipAllPostBuildChecks = "PolicySkipAllPostBuildChecks"; + inline constexpr StringLiteral PolicySkipAppcontainerCheck = "PolicySkipAppcontainerCheck"; inline constexpr StringLiteral PolicySkipArchitectureCheck = "PolicySkipArchitectureCheck"; + inline constexpr StringLiteral PolicySkipCopyrightCheck = "PolicySkipCopyrightCheck"; + inline constexpr StringLiteral PolicySkipCrtLinkageCheck = "PolicySkipCrtLinkageCheck"; inline constexpr StringLiteral PolicySkipDumpbinChecks = "PolicySkipDumpbinChecks"; + inline constexpr StringLiteral PolicySkipLibCMakeMergeCheck = "PolicySkipLibCMakeMergeCheck"; + inline constexpr StringLiteral PolicySkipMisplacedCMakeFilesCheck = "PolicySkipMisplacedCMakeFilesCheck"; + inline constexpr StringLiteral PolicySkipMisplacedRegularFilesCheck = "PolicySkipMisplacedRegularFilesCheck"; + inline constexpr StringLiteral PolicySkipPkgConfigCheck = "PolicySkipPkgConfigCheck"; + inline constexpr StringLiteral PolicySkipUsageInstallCheck = "PolicySkipUsageInstallCheck"; // Environment variables are ALL_CAPS_WITH_UNDERSCORES inline constexpr StringLiteral EnvironmentVariableActionsCacheUrl = "ACTIONS_CACHE_URL"; diff --git a/include/vcpkg/base/files.h b/include/vcpkg/base/files.h index bfb88e4758..7b43319223 100644 --- a/include/vcpkg/base/files.h +++ b/include/vcpkg/base/files.h @@ -161,6 +161,11 @@ namespace vcpkg std::vector get_directories_recursive(const Path& dir, LineInfo li) const; ExpectedL> try_get_directories_recursive(const Path& dir) const; + virtual std::vector get_directories_recursive_lexically_proximate(const Path& dir, + std::error_code& ec) const = 0; + std::vector get_directories_recursive_lexically_proximate(const Path& dir, LineInfo li) const; + ExpectedL> try_get_directories_recursive_lexically_proximate(const Path& dir) const; + virtual std::vector get_directories_non_recursive(const Path& dir, std::error_code& ec) const = 0; std::vector get_directories_non_recursive(const Path& dir, LineInfo li) const; ExpectedL> try_get_directories_non_recursive(const Path& dir) const; @@ -339,19 +344,19 @@ namespace vcpkg struct NotExtensionCaseSensitive { - StringView ext; + StringLiteral ext; bool operator()(const Path& target) const; }; struct NotExtensionCaseInsensitive { - StringView ext; + StringLiteral ext; bool operator()(const Path& target) const; }; struct NotExtensionsCaseInsensitive { - std::vector exts; + View exts; bool operator()(const Path& target) const; }; diff --git a/include/vcpkg/base/fmt.h b/include/vcpkg/base/fmt.h index a6c72959f5..55ce1cb8b6 100644 --- a/include/vcpkg/base/fmt.h +++ b/include/vcpkg/base/fmt.h @@ -10,6 +10,8 @@ VCPKG_MSVC_WARNING(push) // ( && ) always evaluates to the result of . // // include\fmt\format.h(1812): warning C4189: 'zero': local variable is initialized but not referenced -VCPKG_MSVC_WARNING(disable : 6239 4189) +// include\fmt\compile.h(151): warning C4702: unreachable code (expected due to if constexpr) +VCPKG_MSVC_WARNING(disable : 6239 4189 4702) +#include #include VCPKG_MSVC_WARNING(pop) diff --git a/include/vcpkg/base/message-args.inc.h b/include/vcpkg/base/message-args.inc.h index 61fc7758b2..f49356c401 100644 --- a/include/vcpkg/base/message-args.inc.h +++ b/include/vcpkg/base/message-args.inc.h @@ -22,6 +22,7 @@ DECLARE_MSG_ARG(command_line, "vcpkg install zlib") DECLARE_MSG_ARG(command_name, "install") DECLARE_MSG_ARG(commit_sha, "7cfad47ae9f68b183983090afd6337cd60fd4949") DECLARE_MSG_ARG(count, "42") +DECLARE_MSG_ARG(cmake_var, "VCPKG_POLICY_EMPTY_PACKAGE") DECLARE_MSG_ARG(elapsed, "3.532 min") DECLARE_MSG_ARG(env_var, "VCPKG_DEFAULT_TRIPLET") DECLARE_MSG_ARG(error_msg, "File Not Found") diff --git a/include/vcpkg/base/message-data.inc.h b/include/vcpkg/base/message-data.inc.h index 8c276c2b09..b876cde180 100644 --- a/include/vcpkg/base/message-data.inc.h +++ b/include/vcpkg/base/message-data.inc.h @@ -127,7 +127,7 @@ DECLARE_MESSAGE(AllFormatArgsUnbalancedBraces, (msg::value), "example of {value} is 'foo bar {'", "unbalanced brace in format string \"{value}\"") -DECLARE_MESSAGE(AllPackagesAreUpdated, (), "", "All installed packages are up-to-date with the local portfile.") +DECLARE_MESSAGE(AllPackagesAreUpdated, (), "", "All installed packages are up-to-date.") DECLARE_MESSAGE(AlreadyInstalled, (msg::spec), "", "{spec} is already installed") DECLARE_MESSAGE(AlreadyInstalledNotHead, (msg::spec), @@ -303,14 +303,15 @@ DECLARE_MESSAGE(BaselineMissing, "git add versions\n" "git commit -m \"Update version database\"\n" "to set {version} as the baseline version.") +DECLARE_MESSAGE(BinariesRelativeToThePackageDirectoryHere, + (), + "", + "the binaries are relative to ${{CURRENT_PACKAGES_DIR}} here") DECLARE_MESSAGE(BinarySourcesArg, (), "'vcpkg help binarycaching' is a command line and should not be localized", "Binary caching sources. See 'vcpkg help binarycaching'") -DECLARE_MESSAGE(BinaryWithInvalidArchitecture, - (msg::path, msg::expected, msg::actual), - "{expected} and {actual} are architectures", - "{path}\n Expected: {expected}, but was {actual}") +DECLARE_MESSAGE(BinaryWithInvalidArchitecture, (msg::path, msg::arch), "", "{path} is built for {arch}") DECLARE_MESSAGE(BuildAlreadyInstalled, (msg::spec), "", @@ -409,7 +410,13 @@ DECLARE_MESSAGE( "Include '[{package_name}] Build error' in your bug report title, the following version information in your " "bug description, and attach any relevant failure logs from above.") DECLARE_MESSAGE(BuiltInTriplets, (), "", "Built-in Triplets:") -DECLARE_MESSAGE(BuiltWithIncorrectArchitecture, (), "", "The following files were built for an incorrect architecture:") +DECLARE_MESSAGE( + BuiltWithIncorrectArchitecture, + (msg::arch), + "", + "The triplet requests that binaries are built for {arch}, but the following binaries were built for a " + "different architecture. This usually means toolchain information is incorrectly conveyed to the binaries' " + "build system. To suppress this message, add set(VCPKG_POLICY_SKIP_ARCHITECTURE_CHECK enabled)") DECLARE_MESSAGE(CheckedOutGitSha, (msg::commit_sha), "", "Checked out Git SHA: {commit_sha}") DECLARE_MESSAGE(CheckedOutObjectMissingManifest, (), @@ -894,7 +901,12 @@ DECLARE_MESSAGE(ControlAndManifestFilesPresent, "Both a manifest file and a CONTROL file exist in port directory: {path}") DECLARE_MESSAGE(ControlCharacterInString, (), "", "Control character in string") DECLARE_MESSAGE(ControlSupportsMustBeAPlatformExpression, (), "", "\"Supports\" must be a platform expression") -DECLARE_MESSAGE(CopyrightIsDir, (msg::path), "", "`{path}` being a directory is deprecated.") +DECLARE_MESSAGE(CopyrightIsDir, + (), + "", + "this port sets ${{CURRENT_PACKAGES_DIR}}/share/${{PORT}}/copyright to a directory, but it should be a " + "file. Consider combining separate copyright files into one using vcpkg_install_copyright. To suppress " + "this message, add set(VCPKG_POLICY_SKIP_COPYRIGHT_CHECK enabled)") DECLARE_MESSAGE(CorruptedDatabase, (), "", @@ -995,6 +1007,14 @@ DECLARE_MESSAGE(DependencyGraphFailure, (), "", "Dependency graph submission fai DECLARE_MESSAGE(DependencyGraphSuccess, (), "", "Dependency graph submission successful.") DECLARE_MESSAGE(DeprecatedPrefabDebugOption, (), "", "--prefab-debug is now deprecated.") DECLARE_MESSAGE(DetectCompilerHash, (msg::triplet), "", "Detecting compiler hash for triplet {triplet}...") +DECLARE_MESSAGE(DirectoriesRelativeToThePackageDirectoryHere, + (), + "", + "the directories are relative to ${{CURRENT_PACKAGES_DIR}} here") +DECLARE_MESSAGE(DllsRelativeToThePackageDirectoryHere, + (), + "", + "the DLLs are relative to ${{CURRENT_PACKAGES_DIR}} here") DECLARE_MESSAGE(DocumentedFieldsSuggestUpdate, (), "", @@ -1134,6 +1154,10 @@ DECLARE_MESSAGE(ExamplesHeader, (), "Printed before a list of example command li DECLARE_MESSAGE(ExceededRecursionDepth, (), "", "Recursion depth exceeded.") DECLARE_MESSAGE(ExcludedPackage, (msg::spec), "", "Excluded {spec}") DECLARE_MESSAGE(ExcludedPackages, (), "", "The following packages are excluded:") +DECLARE_MESSAGE(ExecutablesRelativeToThePackageDirectoryHere, + (), + "", + "the executables are relative to ${{CURRENT_PACKAGES_DIR}} here") DECLARE_MESSAGE(ExpectedAnObject, (), "", "expected an object") DECLARE_MESSAGE(ExpectedAtMostOneSetOfTags, (msg::count, msg::old_value, msg::new_value, msg::value), @@ -1175,10 +1199,10 @@ DECLARE_MESSAGE(ExtendedDocumentationAtUrl, (msg::url), "", "Extended documentat DECLARE_MESSAGE(ExtractHelp, (), "", "Extracts an archive.") DECLARE_MESSAGE(ExtractingTool, (msg::tool_name), "", "Extracting {tool_name}...") DECLARE_MESSAGE(FailedPostBuildChecks, - (msg::count, msg::path), + (msg::count), "", - "Found {count} post-build check problem(s). To submit these ports to curated catalogs, please " - "first correct the portfile: {path}") + "Found {count} post-build check problem(s). These are usually caused by bugs in portfile.cmake or the " + "upstream build system. Please correct these before submitting this port to the curated registry.") DECLARE_MESSAGE(FailedToAcquireMutant, (msg::path), "'mutant' is the Windows kernel object returned by CreateMutexW", @@ -1262,12 +1286,22 @@ DECLARE_MESSAGE(FailedVendorAuthentication, "One or more {vendor} credential providers failed to authenticate. See '{url}' for more details " "on how to provide credentials.") DECLARE_MESSAGE(FileIsNotExecutable, (), "", "this file does not appear to be executable") +DECLARE_MESSAGE(FilesRelativeToTheBuildDirectoryHere, (), "", "the files are relative to the build directory here") +DECLARE_MESSAGE(FilesRelativeToThePackageDirectoryHere, + (), + "", + "the files are relative to ${{CURRENT_PACKAGES_DIR}} here") DECLARE_MESSAGE(FilesContainAbsolutePath1, (), "This message is printed before a list of found absolute paths, followed by FilesContainAbsolutePath2, " "followed by a list of found files.", - "There should be no absolute paths, such as the following, in an installed package:") -DECLARE_MESSAGE(FilesContainAbsolutePath2, (), "", "Absolute paths were found in the following files:") + "There should be no absolute paths, such as the following, in an installed package. To suppress this " + "message, add set(VCPKG_POLICY_SKIP_ABSOLUTE_PATHS_CHECK enabled)") +DECLARE_MESSAGE(FilesContainAbsolutePath2, (), "", "Absolute paths were found in the following files") +DECLARE_MESSAGE(FilesContainAbsolutePathPkgconfigNote, + (), + "", + "Adding a call to `vcpkg_fixup_pkgconfig()` may fix absolute paths in .pc files") DECLARE_MESSAGE(FindVersionArtifactsOnly, (), "'--version', 'vcpkg search', and 'vcpkg find port' are command lines that must not be localized", @@ -1982,10 +2016,7 @@ DECLARE_MESSAGE(LoadingDependencyInformation, (msg::count), "", "Loading dependency information for {count} packages...") -DECLARE_MESSAGE(LocalPortfileVersion, - (), - "", - "Using local portfile versions. To update the local portfiles, use `git pull`.") +DECLARE_MESSAGE(LocalPortfileVersion, (), "", "Using local port versions. To update the local ports, use `git pull`.") DECLARE_MESSAGE(ManifestConflict, (msg::path), "", @@ -2237,161 +2268,230 @@ DECLARE_MESSAGE(PERvaNotFound, "{value:#X} is the Relative Virtual Address sought. Portable executable is a term-of-art, see " "https://learn.microsoft.com/windows/win32/debug/pe-format", "While parsing Portable Executable {path}, could not find RVA {value:#X}.") -DECLARE_MESSAGE(PerformingPostBuildValidation, (), "", "-- Performing post-build validation") +DECLARE_MESSAGE(PerformingPostBuildValidation, (), "", "Performing post-build validation") DECLARE_MESSAGE(PortBugBinDirExists, (msg::path), "", - "There should be no bin\\ directory in a static build, but {path} is present.") -DECLARE_MESSAGE(PortBugDebugBinDirExists, - (msg::path), - "", - "There should be no debug\\bin\\ directory in a static build, but {path} is present.") + "${{CURRENT_PACKAGES_DIR}}/{path} exists but should not in a static build. To suppress this message, " + "add set(VCPKG_POLICY_DLLS_IN_STATIC_LIBRARY enabled)") DECLARE_MESSAGE(PortBugDebugShareDir, (), "", - "/debug/share should not exist. Please reorganize any important files, then use\n" - "file(REMOVE_RECURSE \"${{CURRENT_PACKAGES_DIR}}/debug/share\")") -DECLARE_MESSAGE(PortBugDllAppContainerBitNotSet, - (), - "", - "The App Container bit must be set for Windows Store apps. The following DLLs do not have the App " - "Container bit set:") -DECLARE_MESSAGE(PortBugDllInLibDir, - (), - "", - "The following dlls were found in /lib or /debug/lib. Please move them to /bin or " - "/debug/bin, respectively.") + "${{CURRENT_PACKAGES_DIR}}/debug/share should not exist. Please reorganize any important files, then " + "delete any remaining by adding `file(REMOVE_RECURSE \"${{CURRENT_PACKAGES_DIR}}/debug/share\")`. To " + "suppress this message, add set(VCPKG_POLICY_ALLOW_DEBUG_SHARE enabled)") +DECLARE_MESSAGE( + PortBugDllAppContainerBitNotSet, + (), + "", + "The App Container bit must be set for all DLLs in Windows Store apps, and the triplet requests targeting the " + "Windows Store, but the following DLLs were not built with the bit set. This usually means that toolchain linker " + "flags are not being properly propagated, or the linker in use does not support the /APPCONTAINER switch. To " + "suppress this message, add set(VCPKG_POLICY_SKIP_APPCONTAINER_CHECK enabled)") +DECLARE_MESSAGE( + PortBugDllInLibDir, + (), + "", + "The following dlls were found in ${{CURRENT_PACKAGES_DIR}}/lib or ${{CURRENT_PACKAGES_DIR}}/debug/lib. Please " + "move them to ${{CURRENT_PACKAGES_DIR}}/bin or ${{CURRENT_PACKAGES_DIR}}/debug/bin, respectively.") DECLARE_MESSAGE(PortBugDuplicateIncludeFiles, (), "", - "Include files should not be duplicated into the /debug/include directory. If this cannot " - "be disabled in the project cmake, use\n" - "file(REMOVE_RECURSE \"${{CURRENT_PACKAGES_DIR}}/debug/include\")") -DECLARE_MESSAGE(PortBugFoundCopyrightFiles, (), "", "The following files are potential copyright files:") -DECLARE_MESSAGE(PortBugFoundDebugBinaries, (msg::count), "", "Found {count} debug binaries:") + "${{CURRENT_PACKAGES_DIR}}/debug/include should not exist. To suppress this message, add " + "set(VCPKG_POLICY_ALLOW_DEBUG_INCLUDE enabled)") +DECLARE_MESSAGE( + PortBugDuplicateIncludeFilesFixIt, + (), + "", + "If this directory was created by a CMake build system that does not allow installing headers in debug to be " + "disabled, delete the duplicate directory with file(REMOVE_RECURSE \"${{CURRENT_PACKAGES_DIR}}/debug/include\")") +DECLARE_MESSAGE(PortBugFoundCopyrightFiles, (), "", "the following files are potential copyright files") +DECLARE_MESSAGE(PortBugFoundDebugBinaries, (), "", "The following are debug binaries:") DECLARE_MESSAGE(PortBugFoundDllInStaticBuild, (), "", - "DLLs should not be present in a static build, but the following DLLs were found:") + "DLLs should not be present in a static build, but the following DLLs were found. To suppress this " + "message, add set(VCPKG_POLICY_DLLS_IN_STATIC_LIBRARY enabled)") DECLARE_MESSAGE(PortBugFoundEmptyDirectories, - (msg::path), - "", - "There should be no empty directories in {path}. The following empty directories were found:") -DECLARE_MESSAGE(PortBugFoundExeInBinDir, (), "", - "The following EXEs were found in /bin or /debug/bin. EXEs are not valid distribution targets.") -DECLARE_MESSAGE(PortBugFoundReleaseBinaries, (msg::count), "", "Found {count} release binaries:") + "There should be no installed empty directories. Empty directories are not representable to several " + "binary cache providers, git repositories, and are not considered semantic build outputs. You should " + "either create a regular file inside each empty directory, or delete them with the following CMake. To " + "suppress this message, add set(VCPKG_POLICY_ALLOW_EMPTY_FOLDERS enabled)") +DECLARE_MESSAGE( + PortBugFoundExeInBinDir, + (), + "", + "The following executables were found in ${{CURRENT_PACKAGES_DIR}}/bin or ${{CURRENT_PACKAGES_DIR}}/debug/bin. " + "Executables are not valid distribution targets. If these executables are build tools, consider using " + "`vcpkg_copy_tools`. To suppress this message, add set(VCPKG_POLICY_ALLOW_EXES_IN_BIN enabled)") +DECLARE_MESSAGE(PortBugFoundReleaseBinaries, (), "", "The following are release binaries:") DECLARE_MESSAGE(PortBugIncludeDirInCMakeHelperPort, (), "", - "The folder /include exists in a cmake helper port; this is incorrect, since only cmake " - "files should be installed") -DECLARE_MESSAGE(PortBugInspectFiles, (msg::extension), "", "To inspect the {extension} files, use:") + "The folder ${{CURRENT_PACKAGES_DIR}}/include exists in a CMake helper port; this is incorrect, since " + "only CMake files should be installed. To suppress this message, remove " + "set(VCPKG_POLICY_CMAKE_HELPER_PORT enabled).") DECLARE_MESSAGE( - PortBugInvalidCrtLinkage, - (msg::expected), - "{expected} is one of LinkageDynamicDebug/LinkageDynamicRelease/LinkageStaticDebug/LinkageStaticRelease. " - "Immediately after this message is a file by file list with what linkages they contain. 'CRT' is an acronym " + PortBugInvalidCrtLinkageHeader, + (), + "This is combined with PortBugInvalidCrtLinkageCrtGroup and PortBugInvalidCrtLinkageEntry. 'CRT' is an acronym " "meaning C Runtime. See also: " - "https://learn.microsoft.com/cpp/build/reference/md-mt-ld-use-run-time-library?view=msvc-170. This is " - "complicated because a binary can link with more than one CRT.\n" + "https://learn.microsoft.com/cpp/build/reference/md-mt-ld-use-run-time-library?view=msvc-170. This is complicated " + "because a binary can link with more than one CRT.\n" "Example fully formatted message:\n" - "The following binaries should use the Dynamic Debug (/MDd) CRT.\n" - " C:\\some\\path\\to\\sane\\lib links with: Dynamic Release (/MD)\n" - " C:\\some\\path\\to\\lib links with:\n" - " Static Debug (/MTd)\n" - " Dynamic Release (/MD)\n" - " C:\\some\\different\\path\\to\\a\\dll links with:\n" - " Static Debug (/MTd)\n" - " Dynamic Debug (/MDd)\n", - "The following binaries should use the {expected} CRT.") + "D:\\vcpkg\\ports\\wrong-crt\\portfile.cmake: warning: binaries built by this port link with C RunTimes (\"CRTs\") " + "inconsistent with those requested by the triplet and deployment structure. If the triplet is intended to only use " + "the release CRT, you should add set(VCPKG_POLICY_ONLY_RELEASE_CRT enabled) to the triplet .cmake file. To " + "suppress this check entirely, add set(VCPKG_POLICY_SKIP_CRT_LINKAGE_CHECK enabled) to the triplet .cmake if this " + "is triplet-wide, or to portfile.cmake if this is specific to the port. You can inspect the binaries with: " + "dumpbin.exe /directives mylibfile.lib\n" + "D:\\vcpkg\\packages\\wrong-crt_x86-windows-static: note: the binaries are relative to ${{CURRENT_PACKAGES_DIR}} " + "here\n" + "note: The following binaries should link with only: Static Debug (/MTd)\n" + "note: debug/lib/both_lib.lib links with: Dynamic Debug (/MDd)\n" + "note: debug/lib/both_lib.lib links with: Dynamic Release (/MD)\n" + "note: debug/lib/test_lib.lib links with: Dynamic Debug (/MDd)\n" + "note: The following binaries should link with only: Static Release (/MT)\n" + "note: lib/both_lib.lib links with: Dynamic Debug (/MDd)\n" + "note: lib/both_lib.lib links with: Dynamic Debug (/MDd)\n" + "note: test_lib.lib links with: Dynamic Release (/MD)", + "binaries built by this port link with C RunTimes (\"CRTs\") inconsistent with those requested by the " + "triplet and deployment structure. If the triplet is intended to only use the release CRT, you should " + "add set(VCPKG_POLICY_ONLY_RELEASE_CRT enabled) to the triplet .cmake file. To suppress this check " + "entirely, add set(VCPKG_POLICY_SKIP_CRT_LINKAGE_CHECK enabled) to the triplet .cmake if this is " + "triplet-wide, or to portfile.cmake if this is specific to the port. You can inspect the binaries " + "with: dumpbin.exe /directives mylibfile.lib") +DECLARE_MESSAGE(PortBugInvalidCrtLinkageCrtGroup, + (msg::expected), + "See PortBugInvalidCrtLinkageHeader. {expected} is one of " + "LinkageDynamicDebug/LinkageDynamicRelease/LinkageStaticDebug/LinkageStaticRelease.", + "The following binaries should link with only: {expected}") DECLARE_MESSAGE(PortBugInvalidCrtLinkageEntry, - (msg::path), - "See explanation in PortBugInvalidCrtLinkage", - "{path} links with:") -DECLARE_MESSAGE(PortBugKernel32FromXbox, - (), - "", - "The selected triplet targets Xbox, but the following DLLs link with kernel32. These DLLs cannot be " - "loaded on Xbox, where kernel32 is not present. This is typically caused by linking with kernel32.lib " - "rather than a suitable umbrella library, such as onecore_apiset.lib or xgameplatform.lib.") + (msg::path, msg::actual), + "See explanation in PortBugInvalidCrtLinkageHeader. {actual} is one or more of " + "LinkageDynamicDebug/LinkageDynamicRelease/LinkageStaticDebug/LinkageStaticRelease , separated by " + "commas. (The vast vast vast majority of the time there will only be one and we're accepting that the " + "localized result may look a bit strange if there is more than one)", + "{path} links with: {actual}") DECLARE_MESSAGE( - PortBugMergeLibCMakeDir, - (msg::package_name), + PortBugKernel32FromXbox, + (), "", - "The /lib/cmake folder should be merged with /debug/lib/cmake and moved to /share/{package_name}/cmake. " - "Please use the helper function `vcpkg_cmake_config_fixup()` from the port vcpkg-cmake-config.`") -DECLARE_MESSAGE(PortBugMismatchedNumberOfBinaries, (), "", "Mismatching number of debug and release binaries.") + "The selected triplet targets Xbox, but the following DLLs link with kernel32. These DLLs cannot be loaded on " + "Xbox, where kernel32 is not present. This is typically caused by linking with kernel32.lib rather than a suitable " + "umbrella library, such as onecore_apiset.lib or xgameplatform.lib. You can inspect a DLL's dependencies with " + "`dumpbin.exe /dependents mylibfile.dll`. To suppress this message, add set(VCPKG_POLICY_ALLOW_KERNEL32_FROM_XBOX " + "enabled)") DECLARE_MESSAGE( - PortBugMisplacedCMakeFiles, - (msg::spec), + PortBugMergeLibCMakeDir, + (), "", - "The following cmake files were found outside /share/{spec}. Please place cmake files in /share/{spec}.") -DECLARE_MESSAGE(PortBugMisplacedFiles, (msg::path), "", "The following files are placed in {path}:") -DECLARE_MESSAGE(PortBugMisplacedFilesCont, (), "", "Files cannot be present in those directories.") -DECLARE_MESSAGE(PortBugMisplacedPkgConfigFiles, + "This port creates ${{CURRENT_PACKAGES_DIR}}/lib/cmake and/or ${{CURRENT_PACKAGES_DIR}}/debug/lib/cmake, which " + "should be merged and moved to ${{CURRENT_PACKAGES_DIR}}/share/${{PORT}}/cmake. Please use the helper " + "function vcpkg_cmake_config_fixup() from the port vcpkg-cmake-config. To suppress this message, add " + "set(VCPKG_POLICY_SKIP_LIB_CMAKE_MERGE_CHECK enabled)") +DECLARE_MESSAGE(PortBugMismatchingNumberOfBinaries, (), "", - "pkgconfig directories should be one of share/pkgconfig (for header only libraries only), " - "lib/pkgconfig, or lib/debug/pkgconfig. The following misplaced pkgconfig files were found:") -DECLARE_MESSAGE(PortBugMissingDebugBinaries, (), "", "Debug binaries were not found.") -DECLARE_MESSAGE(PortBugMissingFile, - (msg::path), + "mismatching number of debug and release binaries. This often indicates incorrect handling of debug or " + "release in portfile.cmake or the build system. If the intent is to only ever produce release " + "components for this triplet, the triplet should have set(VCPKG_BUILD_TYPE release) added to its " + ".cmake file. To suppress this message, add set(VCPKG_POLICY_MISMATCHED_NUMBER_OF_BINARIES enabled)") +DECLARE_MESSAGE(PortBugMisplacedCMakeFiles, + (), + "", + "This port installs the following CMake files in places CMake files are not expected. CMake should be " + "installed in ${{CURRENT_PACKAGES_DIR}}/share/${{PORT}}. To suppress this message, add " + "set(VCPKG_POLICY_SKIP_MISPLACED_CMAKE_FILES_CHECK enabled)") +DECLARE_MESSAGE(PortBugMisplacedFiles, + (), "", - "The /{path} file does not exist. This file must exist for CMake helper ports.") + "The following regular files are installed to location(s) where regular files may not be installed. " + "These should be installed in a subdirectory. To suppress this message, add " + "set(VCPKG_POLICY_SKIP_MISPLACED_REGULAR_FILES_CHECK enabled)") DECLARE_MESSAGE( - PortBugMissingProvidedUsage, - (msg::package_name), + PortBugMisplacedPkgConfigFiles, + (), "", - "The port provided \"usage\" but forgot to install to /share/{package_name}/usage, add the following line" - "in the portfile:") + "The following misplaced pkgconfig directories were installed. Misplaced pkgconfig files will not be found " + "correctly by pkgconf or pkg-config. pkgconfig directories should be ${{CURRENT_PACKAGES_DIR}}/share/pkgconfig " + "(for architecture agnostic / header only libraries only), ${{CURRENT_PACKAGES_DIR}}/lib/pkgconfig (for release " + "dependencies), or ${{CURRENT_PACKAGES_DIR}}/lib/debug/pkgconfig (for debug dependencies). To suppress this " + "message, add set(VCPKG_POLICY_SKIP_PKGCONFIG_CHECK enabled)") +DECLARE_MESSAGE(PortBugMissingDebugBinaries, (), "", "Debug binaries were not found.") +DECLARE_MESSAGE( + PortBugMissingCMakeHelperPortFile, + (), + "", + "The ${{CURRENT_PACKAGES_DIR}}/share/${{PORT}}/vcpkg-port-config.cmake file does not exist. This file must exist " + "for CMake helper ports. To suppress this message, remove set(VCPKG_POLICY_CMAKE_HELPER_PORT enabled)") +DECLARE_MESSAGE(PortBugMissingProvidedUsage, + (), + "", + "this port contains a file named \"usage\" but didn't install it to " + "${{CURRENT_PACKAGES_DIR}}/share/${{PORT}}/usage . If this file is not intended to be usage text, " + "consider choosing another name; otherwise, install it. To suppress this message, add " + "set(VCPKG_POLICY_SKIP_USAGE_INSTALL_CHECK enabled)") DECLARE_MESSAGE(PortBugMissingImportedLibs, - (msg::path), + (), "", - "Import libraries were not present in {path}.\nIf this is intended, add the following line in the " - "portfile:\nset(VCPKG_POLICY_DLLS_WITHOUT_LIBS enabled)") + "Import libraries for installed DLLs appear to be missing. If this is intended, add " + "set(VCPKG_POLICY_DLLS_WITHOUT_LIBS enabled)") DECLARE_MESSAGE(PortBugMissingIncludeDir, (), "", - "The folder /include is empty or not present. This indicates the library was not correctly " - "installed.") -DECLARE_MESSAGE(PortBugMissingLicense, - (msg::package_name), - "", - "The software license must be available at ${{CURRENT_PACKAGES_DIR}}/share/{package_name}/copyright") + "The folder ${{CURRENT_PACKAGES_DIR}}/include is empty or not present. This usually means that headers " + "are not correctly installed. If this is a CMake helper port, add set(VCPKG_POLICY_CMAKE_HELPER_PORT " + "enabled). If this is not a CMake helper port but this is otherwise intentional, add " + "set(VCPKG_POLICY_EMPTY_INCLUDE_FOLDER enabled) to suppress this message.") +DECLARE_MESSAGE( + PortBugMissingLicense, + (), + "", + "the license is not installed to ${{CURRENT_PACKAGES_DIR}}/share/${{PORT}}/copyright . This can be fixed by adding " + "a call to vcpkg_install_copyright. To suppress this message, add set(VCPKG_POLICY_SKIP_COPYRIGHT_CHECK enabled)") +DECLARE_MESSAGE(PortBugMissingLicenseFixIt, + (msg ::value), + "{value} is a CMake function call for the user to paste into their file, for example: " + "vcpkg_install_copyright(FILE_LIST ${{SOURCE_PATH}}/COPYING ${{SOURCE_PATH}}/LICENSE.txt)", + "Consider adding: {value}") DECLARE_MESSAGE(PortBugMissingReleaseBinaries, (), "", "Release binaries were not found.") DECLARE_MESSAGE(PortBugMovePkgConfigFiles, (), "", "You can move the pkgconfig files with commands similar to:") -DECLARE_MESSAGE(PortBugOutdatedCRT, (), "", "Detected outdated dynamic CRT in the following files:") +DECLARE_MESSAGE( + PortBugOutdatedCRT, + (), + "", + "DLLs that link with obsolete C RunTime (\"CRT\") DLLs were installed. Installed DLLs should link with an " + "in-support CRT. You can inspect the dependencies of a DLL with `dumpbin.exe /dependents mylibfile.dll`. If you're " + "using a custom triplet targeting an old CRT, add set(VCPKG_POLICY_ALLOW_OBSOLETE_MSVCRT enabled) to the triplet's " + ".cmake file. To suppress this message for this port, add set(VCPKG_POLICY_ALLOW_OBSOLETE_MSVCRT enabled)") DECLARE_MESSAGE( PortBugRemoveBinDir, (), "", - "If the creation of bin\\ and/or debug\\bin\\ cannot be disabled, use this in the portfile to remove them") -DECLARE_MESSAGE(PortBugRemoveEmptyDirectories, - (), - "", - "If a directory should be populated but is not, this might indicate an error in the portfile.\n" - "If the directories are not needed and their creation cannot be disabled, use something like this in " - "the portfile to remove them:") + "if creation of these directories cannot be disabled, you can add the following in portfile.cmake to remove them") DECLARE_MESSAGE(PortBugRemoveEmptyDirs, (), "Only the 'empty directories left by the above renames' part should be translated", "file(REMOVE_RECURSE empty directories left by the above renames)") -DECLARE_MESSAGE(PortBugRestrictedHeaderPaths, +DECLARE_MESSAGE( + PortBugRestrictedHeaderPaths, + (), + "", + "Taking the following restricted headers can prevent the core C++ runtime and other packages from compiling " + "correctly. These should be renamed or stored in a subdirectory instead. In exceptional circumstances, this " + "warning can be suppressed by adding set(VCPKG_POLICY_ALLOW_RESTRICTED_HEADERS enabled)") +DECLARE_MESSAGE(PortBugRestrictedHeaderPathsNote, (), - "A list of restricted headers is printed after this message, one per line. ", - "The following restricted headers can prevent the core C++ runtime and other packages from " - "compiling correctly. In exceptional circumstances, this policy can be disabled by setting CMake " - "variable VCPKG_POLICY_ALLOW_RESTRICTED_HEADERS in portfile.cmake.") + "", + "the headers are relative to ${{CURRENT_PACKAGES_DIR}}/include here") DECLARE_MESSAGE(PortBugSetDllsWithoutExports, (), - "'exports' means an entry in a DLL's export table. After this message, one file path per line is " - "printed listing each DLL with an empty export table.", - "DLLs without any exports are likely a bug in the build script. If this is intended, add the " - "following line in the portfile:\n" - "set(VCPKG_POLICY_DLLS_WITHOUT_EXPORTS enabled)\n" - "The following DLLs have no exports:") + "", + "the following DLLs were built without any exports. DLLs without exports are likely bugs in the build " + "script. If this is intended, add set(VCPKG_POLICY_DLLS_WITHOUT_EXPORTS enabled)") DECLARE_MESSAGE(PortDependencyConflict, (msg::package_name), "", @@ -2510,6 +2610,10 @@ DECLARE_MESSAGE(SkipClearingInvalidDir, (msg::path), "", "Skipping clearing contents of {path} because it was not a directory.") +DECLARE_MESSAGE(SkippingPostBuildValidationDueTo, + (msg::cmake_var), + "", + "Skipping post-build validation due to {cmake_var}") DECLARE_MESSAGE(SourceFieldPortNameMismatch, (msg::package_name, msg::path), "{package_name} and \"{path}\" are both names of installable ports/packages. 'Source', " @@ -2676,11 +2780,10 @@ DECLARE_MESSAGE(UnknownParameterForIntegrate, "{value} would be frobinate.", "Unknown parameter '{value}' for integrate.") DECLARE_MESSAGE(UnknownPolicySetting, - (msg::option, msg::value), - "'{value}' is the policy in question. These are unlocalized names that ports use to control post " - "build checks. Some examples are VCPKG_POLICY_DLLS_WITHOUT_EXPORTS, " - "VCPKG_POLICY_MISMATCHED_NUMBER_OF_BINARIES, or VCPKG_POLICY_ALLOW_OBSOLETE_MSVCRT", - "Unknown setting for policy '{value}': {option}") + (msg::value, msg::cmake_var), + "{value} is to what the user set the variable we don't understand. The names 'enabled' and 'disabled' " + "must not be localized.", + "Unknown setting of {cmake_var}: {value}. Valid policy values are '', 'disabled', and 'enabled'.") DECLARE_MESSAGE(UnknownSettingForBuildType, (msg::option), "", @@ -2780,6 +2883,8 @@ DECLARE_MESSAGE(UploadingBinariesToVendor, (msg::spec, msg::vendor, msg::path), "", "Uploading binaries for '{spec}' to '{vendor}' source \"{path}\".") +DECLARE_MESSAGE(UsageTextHere, (), "", "the usage file is here") +DECLARE_MESSAGE(UsageInstallInstructions, (), "", "you can install the usage file with the following CMake") DECLARE_MESSAGE(UseEnvVar, (msg::env_var), "An example of env_var is \"HTTP(S)_PROXY\"" diff --git a/include/vcpkg/base/path.h b/include/vcpkg/base/path.h index 6fd24ad605..dce843d143 100644 --- a/include/vcpkg/base/path.h +++ b/include/vcpkg/base/path.h @@ -36,6 +36,7 @@ namespace vcpkg void replace_filename(StringView sv); void remove_filename(); void make_preferred(); + void make_generic(); void clear(); Path lexically_normal() const; diff --git a/include/vcpkg/base/span.h b/include/vcpkg/base/span.h index 9e994da467..c0641d3b5a 100644 --- a/include/vcpkg/base/span.h +++ b/include/vcpkg/base/span.h @@ -2,7 +2,6 @@ #include -#include #include #include #include diff --git a/include/vcpkg/base/stringview.h b/include/vcpkg/base/stringview.h index b65ac62c4f..40b9a5e110 100644 --- a/include/vcpkg/base/stringview.h +++ b/include/vcpkg/base/stringview.h @@ -6,7 +6,6 @@ #include #include -#include #include #include #include diff --git a/include/vcpkg/base/util.h b/include/vcpkg/base/util.h index e619df7ee8..11dd46a135 100644 --- a/include/vcpkg/base/util.h +++ b/include/vcpkg/base/util.h @@ -19,16 +19,16 @@ namespace vcpkg::Util namespace Vectors { template - void append(std::vector* augend, Container&& addend) + void append(std::vector& augend, Container&& addend) { if constexpr (std::is_lvalue_reference_v || std::is_const_v) { - augend->insert(augend->end(), addend.begin(), addend.end()); + augend.insert(augend.end(), addend.begin(), addend.end()); } else { - augend->insert( - augend->end(), std::make_move_iterator(addend.begin()), std::make_move_iterator(addend.end())); + augend.insert( + augend.end(), std::make_move_iterator(addend.begin()), std::make_move_iterator(addend.end())); } } template @@ -49,6 +49,11 @@ namespace vcpkg::Util { return std::find(container.begin(), container.end(), item) != container.end(); } + template + bool contains(const Vec (&container)[N], const Key& item) + { + return std::find(container, container + N, item) != container + N; + } template std::vector concat(View r1, View r2) { @@ -213,7 +218,9 @@ namespace vcpkg::Util template using FmapOut = std::decay_t>; - template + template || std::is_const_v, int> = 0> std::vector> fmap(Range&& xs, Func&& f) { std::vector> ret; @@ -227,6 +234,28 @@ namespace vcpkg::Util return ret; } + template + using FmapRefMovedOut = decltype(std::declval()(std::move(*std::declval().begin()))); + + template + using FmapMovedOut = std::decay_t>; + + template || std::is_const_v), int> = 0> + std::vector> fmap(Range&& xs, Func&& f) + { + std::vector> ret; + ret.reserve(xs.size()); + + for (auto&& x : xs) + { + ret.emplace_back(f(std::move(x))); + } + + return ret; + } + template> Optional common_projection(Range&& input, Proj&& proj) { @@ -343,7 +372,7 @@ namespace vcpkg::Util template void search(ForwardIt1 first, ForwardIt1 last, const char*) = delete; - // 0th is the first occurence + // 0th is the first occurrence // so find_nth({1, 2, 1, 3, 1, 4}, 1, 2) // returns the 1 before the 4 template @@ -367,7 +396,7 @@ namespace vcpkg::Util return find_nth(begin(r), end(r), v, n); } - // 0th is the last occurence + // 0th is the last occurrence // so find_nth({1, 2, 1, 3, 1, 4}, 1, 2) // returns the 1 before the 2 template diff --git a/include/vcpkg/commands.build.h b/include/vcpkg/commands.build.h index 67f3388a74..89aa097765 100644 --- a/include/vcpkg/commands.build.h +++ b/include/vcpkg/commands.build.h @@ -23,7 +23,6 @@ #include #include -#include #include #include #include @@ -177,9 +176,6 @@ namespace vcpkg const IBuildLogsRecorder& build_logs_recorder, const StatusParagraphs& status_db); - // could be constexpr, but we want to generate this and that's not constexpr in C++14 - extern const std::array ALL_POLICIES; - StringLiteral to_string_view(BuildPolicy policy); std::string to_string(BuildPolicy policy); StringLiteral to_cmake_variable(BuildPolicy policy); diff --git a/include/vcpkg/fwd/build.h b/include/vcpkg/fwd/build.h index b5fab5b2cf..ee0fe89f08 100644 --- a/include/vcpkg/fwd/build.h +++ b/include/vcpkg/fwd/build.h @@ -109,6 +109,21 @@ namespace vcpkg SKIP_ARCHITECTURE_CHECK, CMAKE_HELPER_PORT, SKIP_ABSOLUTE_PATHS_CHECK, + SKIP_ALL_POST_BUILD_CHECKS, + SKIP_APPCONTAINER_CHECK, + SKIP_CRT_LINKAGE_CHECK, + SKIP_MISPLACED_CMAKE_FILES_CHECK, + SKIP_LIB_CMAKE_MERGE_CHECK, + ALLOW_DLLS_IN_LIB, + SKIP_MISPLACED_REGULAR_FILES_CHECK, + SKIP_COPYRIGHT_CHECK, + ALLOW_KERNEL32_FROM_XBOX, + ALLOW_EXES_IN_BIN, + SKIP_USAGE_INSTALL_CHECK, + ALLOW_EMPTY_FOLDERS, + ALLOW_DEBUG_INCLUDE, + ALLOW_DEBUG_SHARE, + SKIP_PKGCONFIG_CHECK, // Must be last COUNT, }; diff --git a/locales/messages.json b/locales/messages.json index 0d82c56f8a..0b3119eef7 100644 --- a/locales/messages.json +++ b/locales/messages.json @@ -112,7 +112,7 @@ "_AllFormatArgsRawArgument.comment": "example of {value} is 'foo {} bar'", "AllFormatArgsUnbalancedBraces": "unbalanced brace in format string \"{value}\"", "_AllFormatArgsUnbalancedBraces.comment": "example of {value} is 'foo bar {'", - "AllPackagesAreUpdated": "All installed packages are up-to-date with the local portfile.", + "AllPackagesAreUpdated": "All installed packages are up-to-date.", "AlreadyInstalled": "{spec} is already installed", "_AlreadyInstalled.comment": "An example of {spec} is zlib:x64-windows.", "AlreadyInstalledNotHead": "{spec} is already installed -- not building from HEAD", @@ -190,10 +190,11 @@ "_BaselineGitShowFailed.comment": "An example of {commit_sha} is 7cfad47ae9f68b183983090afd6337cd60fd4949.", "BaselineMissing": "Baseline version not found. Run:\nvcpkg x-add-version {package_name}\ngit add versions\ngit commit -m \"Update version database\"\nto set {version} as the baseline version.", "_BaselineMissing.comment": "An example of {package_name} is zlib. An example of {version} is 1.3.8.", + "BinariesRelativeToThePackageDirectoryHere": "the binaries are relative to ${{CURRENT_PACKAGES_DIR}} here", "BinarySourcesArg": "Binary caching sources. See 'vcpkg help binarycaching'", "_BinarySourcesArg.comment": "'vcpkg help binarycaching' is a command line and should not be localized", - "BinaryWithInvalidArchitecture": "{path}\n Expected: {expected}, but was {actual}", - "_BinaryWithInvalidArchitecture.comment": "{expected} and {actual} are architectures An example of {path} is /foo/bar.", + "BinaryWithInvalidArchitecture": "{path} is built for {arch}", + "_BinaryWithInvalidArchitecture.comment": "An example of {path} is /foo/bar. An example of {arch} is x64.", "BuildAlreadyInstalled": "{spec} is already installed; please remove {spec} before attempting to build it.", "_BuildAlreadyInstalled.comment": "An example of {spec} is zlib:x64-windows.", "BuildDependenciesMissing": "The build command requires all dependencies to be already installed.\nThe following dependencies are missing:", @@ -237,7 +238,8 @@ "BuildingPackageFailedDueToMissingDeps": "due to the following missing dependencies:", "_BuildingPackageFailedDueToMissingDeps.comment": "Printed after BuildingPackageFailed, and followed by a list of dependencies that were missing.", "BuiltInTriplets": "Built-in Triplets:", - "BuiltWithIncorrectArchitecture": "The following files were built for an incorrect architecture:", + "BuiltWithIncorrectArchitecture": "The triplet requests that binaries are built for {arch}, but the following binaries were built for a different architecture. This usually means toolchain information is incorrectly conveyed to the binaries' build system. To suppress this message, add set(VCPKG_POLICY_SKIP_ARCHITECTURE_CHECK enabled)", + "_BuiltWithIncorrectArchitecture.comment": "An example of {arch} is x64.", "CISettingsExclude": "Comma-separated list of ports to skip", "CISettingsOptCIBase": "Path to the ci.baseline.txt file. Used to skip ports and detect regressions.", "CISettingsOptExclude": "Comma separated list of ports to skip", @@ -519,8 +521,7 @@ "_ControlAndManifestFilesPresent.comment": "An example of {path} is /foo/bar.", "ControlCharacterInString": "Control character in string", "ControlSupportsMustBeAPlatformExpression": "\"Supports\" must be a platform expression", - "CopyrightIsDir": "`{path}` being a directory is deprecated.", - "_CopyrightIsDir.comment": "An example of {path} is /foo/bar.", + "CopyrightIsDir": "this port sets ${{CURRENT_PACKAGES_DIR}}/share/${{PORT}}/copyright to a directory, but it should be a file. Consider combining separate copyright files into one using vcpkg_install_copyright. To suppress this message, add set(VCPKG_POLICY_SKIP_COPYRIGHT_CHECK enabled)", "CorruptedDatabase": "vcpkg's installation database corrupted. This is either a bug in vcpkg or something else has modified the contents of the 'installed' directory in an unexpected way. You may be able to fix this by deleting the 'installed' directory and reinstalling what you want to use. If this problem happens consistently, please file a bug at https://github.com/microsoft/vcpkg .", "CorruptedInstallTree": "Your vcpkg 'installed' tree is corrupted.", "CouldNotDeduceNugetIdAndVersion": "Could not deduce nuget id and version from filename: {path}", @@ -580,6 +581,8 @@ "DeprecatedPrefabDebugOption": "--prefab-debug is now deprecated.", "DetectCompilerHash": "Detecting compiler hash for triplet {triplet}...", "_DetectCompilerHash.comment": "An example of {triplet} is x64-windows.", + "DirectoriesRelativeToThePackageDirectoryHere": "the directories are relative to ${{CURRENT_PACKAGES_DIR}} here", + "DllsRelativeToThePackageDirectoryHere": "the DLLs are relative to ${{CURRENT_PACKAGES_DIR}} here", "DocumentedFieldsSuggestUpdate": "If these are documented fields that should be recognized try updating the vcpkg tool.", "DownloadAvailable": "A downloadable copy of this tool is available and can be used by unsetting {env_var}.", "_DownloadAvailable.comment": "An example of {env_var} is VCPKG_DEFAULT_TRIPLET.", @@ -673,6 +676,7 @@ "ExcludedPackage": "Excluded {spec}", "_ExcludedPackage.comment": "An example of {spec} is zlib:x64-windows.", "ExcludedPackages": "The following packages are excluded:", + "ExecutablesRelativeToThePackageDirectoryHere": "the executables are relative to ${{CURRENT_PACKAGES_DIR}} here", "ExpectedAnObject": "expected an object", "ExpectedAtMostOneSetOfTags": "Found {count} sets of {old_value}.*{new_value} but expected at most 1, in block:\n{value}", "_ExpectedAtMostOneSetOfTags.comment": "{old_value} is a left tag and {new_value} is the right tag. {value} is the input. An example of {count} is 42.", @@ -709,8 +713,8 @@ "ExtractHelp": "Extracts an archive.", "ExtractingTool": "Extracting {tool_name}...", "_ExtractingTool.comment": "An example of {tool_name} is aria2.", - "FailedPostBuildChecks": "Found {count} post-build check problem(s). To submit these ports to curated catalogs, please first correct the portfile: {path}", - "_FailedPostBuildChecks.comment": "An example of {count} is 42. An example of {path} is /foo/bar.", + "FailedPostBuildChecks": "Found {count} post-build check problem(s). These are usually caused by bugs in portfile.cmake or the upstream build system. Please correct these before submitting this port to the curated registry.", + "_FailedPostBuildChecks.comment": "An example of {count} is 42.", "FailedToAcquireMutant": "failed to acquire mutant {path}", "_FailedToAcquireMutant.comment": "'mutant' is the Windows kernel object returned by CreateMutexW An example of {path} is /foo/bar.", "FailedToCheckoutRepo": "failed to check out `versions` from repo {package_name}", @@ -785,11 +789,14 @@ "_FileReadFailed.comment": "An example of {path} is /foo/bar. An example of {byte_offset} is 42. An example of {count} is 42.", "FileSeekFailed": "Failed to seek to position {byte_offset} in {path}.", "_FileSeekFailed.comment": "An example of {path} is /foo/bar. An example of {byte_offset} is 42.", - "FilesContainAbsolutePath1": "There should be no absolute paths, such as the following, in an installed package:", + "FilesContainAbsolutePath1": "There should be no absolute paths, such as the following, in an installed package. To suppress this message, add set(VCPKG_POLICY_SKIP_ABSOLUTE_PATHS_CHECK enabled)", "_FilesContainAbsolutePath1.comment": "This message is printed before a list of found absolute paths, followed by FilesContainAbsolutePath2, followed by a list of found files.", - "FilesContainAbsolutePath2": "Absolute paths were found in the following files:", + "FilesContainAbsolutePath2": "Absolute paths were found in the following files", + "FilesContainAbsolutePathPkgconfigNote": "Adding a call to `vcpkg_fixup_pkgconfig()` may fix absolute paths in .pc files", "FilesExported": "Files exported at: {path}", "_FilesExported.comment": "An example of {path} is /foo/bar.", + "FilesRelativeToTheBuildDirectoryHere": "the files are relative to the build directory here", + "FilesRelativeToThePackageDirectoryHere": "the files are relative to ${{CURRENT_PACKAGES_DIR}} here", "FindVersionArtifactsOnly": "--version can't be used with vcpkg search or vcpkg find port", "_FindVersionArtifactsOnly.comment": "'--version', 'vcpkg search', and 'vcpkg find port' are command lines that must not be localized", "FishCompletion": "vcpkg fish completion is already added at \"{path}\".", @@ -1118,7 +1125,7 @@ "LoadedOverlayTriplet": "loaded overlay triplet from here", "LoadingDependencyInformation": "Loading dependency information for {count} packages...", "_LoadingDependencyInformation.comment": "An example of {count} is 42.", - "LocalPortfileVersion": "Using local portfile versions. To update the local portfiles, use `git pull`.", + "LocalPortfileVersion": "Using local port versions. To update the local ports, use `git pull`.", "ManifestConflict": "Found both a manifest and CONTROL files in port \"{path}\"; please rename one or the other", "_ManifestConflict.comment": "An example of {path} is /foo/bar.", "ManifestFormatCompleted": "Succeeded in formatting the manifest files.", @@ -1265,62 +1272,50 @@ "_ParseQualifiedSpecifierNotEofSquareBracket.comment": "An example of {version_spec} is zlib:x64-windows@1.0.0.", "PathMustBeAbsolute": "Value of environment variable X_VCPKG_REGISTRIES_CACHE is not absolute: {path}", "_PathMustBeAbsolute.comment": "An example of {path} is /foo/bar.", - "PerformingPostBuildValidation": "-- Performing post-build validation", - "PortBugBinDirExists": "There should be no bin\\ directory in a static build, but {path} is present.", + "PerformingPostBuildValidation": "Performing post-build validation", + "PortBugBinDirExists": "${{CURRENT_PACKAGES_DIR}}/{path} exists but should not in a static build. To suppress this message, add set(VCPKG_POLICY_DLLS_IN_STATIC_LIBRARY enabled)", "_PortBugBinDirExists.comment": "An example of {path} is /foo/bar.", - "PortBugDebugBinDirExists": "There should be no debug\\bin\\ directory in a static build, but {path} is present.", - "_PortBugDebugBinDirExists.comment": "An example of {path} is /foo/bar.", - "PortBugDebugShareDir": "/debug/share should not exist. Please reorganize any important files, then use\nfile(REMOVE_RECURSE \"${{CURRENT_PACKAGES_DIR}}/debug/share\")", - "PortBugDllAppContainerBitNotSet": "The App Container bit must be set for Windows Store apps. The following DLLs do not have the App Container bit set:", - "PortBugDllInLibDir": "The following dlls were found in /lib or /debug/lib. Please move them to /bin or /debug/bin, respectively.", - "PortBugDuplicateIncludeFiles": "Include files should not be duplicated into the /debug/include directory. If this cannot be disabled in the project cmake, use\nfile(REMOVE_RECURSE \"${{CURRENT_PACKAGES_DIR}}/debug/include\")", - "PortBugFoundCopyrightFiles": "The following files are potential copyright files:", - "PortBugFoundDebugBinaries": "Found {count} debug binaries:", - "_PortBugFoundDebugBinaries.comment": "An example of {count} is 42.", - "PortBugFoundDllInStaticBuild": "DLLs should not be present in a static build, but the following DLLs were found:", - "PortBugFoundEmptyDirectories": "There should be no empty directories in {path}. The following empty directories were found:", - "_PortBugFoundEmptyDirectories.comment": "An example of {path} is /foo/bar.", - "PortBugFoundExeInBinDir": "The following EXEs were found in /bin or /debug/bin. EXEs are not valid distribution targets.", - "PortBugFoundReleaseBinaries": "Found {count} release binaries:", - "_PortBugFoundReleaseBinaries.comment": "An example of {count} is 42.", - "PortBugIncludeDirInCMakeHelperPort": "The folder /include exists in a cmake helper port; this is incorrect, since only cmake files should be installed", - "PortBugInspectFiles": "To inspect the {extension} files, use:", - "_PortBugInspectFiles.comment": "An example of {extension} is .exe.", - "PortBugInvalidCrtLinkage": "The following binaries should use the {expected} CRT.", - "_PortBugInvalidCrtLinkage.comment": "{expected} is one of LinkageDynamicDebug/LinkageDynamicRelease/LinkageStaticDebug/LinkageStaticRelease. Immediately after this message is a file by file list with what linkages they contain. 'CRT' is an acronym meaning C Runtime. See also: https://learn.microsoft.com/cpp/build/reference/md-mt-ld-use-run-time-library?view=msvc-170. This is complicated because a binary can link with more than one CRT.\nExample fully formatted message:\nThe following binaries should use the Dynamic Debug (/MDd) CRT.\n C:\\some\\path\\to\\sane\\lib links with: Dynamic Release (/MD)\n C:\\some\\path\\to\\lib links with:\n Static Debug (/MTd)\n Dynamic Release (/MD)\n C:\\some\\different\\path\\to\\a\\dll links with:\n Static Debug (/MTd)\n Dynamic Debug (/MDd)\n", - "PortBugInvalidCrtLinkageEntry": "{path} links with:", - "_PortBugInvalidCrtLinkageEntry.comment": "See explanation in PortBugInvalidCrtLinkage An example of {path} is /foo/bar.", - "PortBugKernel32FromXbox": "The selected triplet targets Xbox, but the following DLLs link with kernel32. These DLLs cannot be loaded on Xbox, where kernel32 is not present. This is typically caused by linking with kernel32.lib rather than a suitable umbrella library, such as onecore_apiset.lib or xgameplatform.lib.", - "PortBugMergeLibCMakeDir": "The /lib/cmake folder should be merged with /debug/lib/cmake and moved to /share/{package_name}/cmake. Please use the helper function `vcpkg_cmake_config_fixup()` from the port vcpkg-cmake-config.`", - "_PortBugMergeLibCMakeDir.comment": "An example of {package_name} is zlib.", - "PortBugMismatchedNumberOfBinaries": "Mismatching number of debug and release binaries.", - "PortBugMisplacedCMakeFiles": "The following cmake files were found outside /share/{spec}. Please place cmake files in /share/{spec}.", - "_PortBugMisplacedCMakeFiles.comment": "An example of {spec} is zlib:x64-windows.", - "PortBugMisplacedFiles": "The following files are placed in {path}:", - "_PortBugMisplacedFiles.comment": "An example of {path} is /foo/bar.", - "PortBugMisplacedFilesCont": "Files cannot be present in those directories.", - "PortBugMisplacedPkgConfigFiles": "pkgconfig directories should be one of share/pkgconfig (for header only libraries only), lib/pkgconfig, or lib/debug/pkgconfig. The following misplaced pkgconfig files were found:", + "PortBugDebugShareDir": "${{CURRENT_PACKAGES_DIR}}/debug/share should not exist. Please reorganize any important files, then delete any remaining by adding `file(REMOVE_RECURSE \"${{CURRENT_PACKAGES_DIR}}/debug/share\")`. To suppress this message, add set(VCPKG_POLICY_ALLOW_DEBUG_SHARE enabled)", + "PortBugDllAppContainerBitNotSet": "The App Container bit must be set for all DLLs in Windows Store apps, and the triplet requests targeting the Windows Store, but the following DLLs were not built with the bit set. This usually means that toolchain linker flags are not being properly propagated, or the linker in use does not support the /APPCONTAINER switch. To suppress this message, add set(VCPKG_POLICY_SKIP_APPCONTAINER_CHECK enabled)", + "PortBugDllInLibDir": "The following dlls were found in ${{CURRENT_PACKAGES_DIR}}/lib or ${{CURRENT_PACKAGES_DIR}}/debug/lib. Please move them to ${{CURRENT_PACKAGES_DIR}}/bin or ${{CURRENT_PACKAGES_DIR}}/debug/bin, respectively.", + "PortBugDuplicateIncludeFiles": "${{CURRENT_PACKAGES_DIR}}/debug/include should not exist. To suppress this message, add set(VCPKG_POLICY_ALLOW_DEBUG_INCLUDE enabled)", + "PortBugDuplicateIncludeFilesFixIt": "If this directory was created by a CMake build system that does not allow installing headers in debug to be disabled, delete the duplicate directory with file(REMOVE_RECURSE \"${{CURRENT_PACKAGES_DIR}}/debug/include\")", + "PortBugFoundCopyrightFiles": "the following files are potential copyright files", + "PortBugFoundDebugBinaries": "The following are debug binaries:", + "PortBugFoundDllInStaticBuild": "DLLs should not be present in a static build, but the following DLLs were found. To suppress this message, add set(VCPKG_POLICY_DLLS_IN_STATIC_LIBRARY enabled)", + "PortBugFoundEmptyDirectories": "There should be no installed empty directories. Empty directories are not representable to several binary cache providers, git repositories, and are not considered semantic build outputs. You should either create a regular file inside each empty directory, or delete them with the following CMake. To suppress this message, add set(VCPKG_POLICY_ALLOW_EMPTY_FOLDERS enabled)", + "PortBugFoundExeInBinDir": "The following executables were found in ${{CURRENT_PACKAGES_DIR}}/bin or ${{CURRENT_PACKAGES_DIR}}/debug/bin. Executables are not valid distribution targets. If these executables are build tools, consider using `vcpkg_copy_tools`. To suppress this message, add set(VCPKG_POLICY_ALLOW_EXES_IN_BIN enabled)", + "PortBugFoundReleaseBinaries": "The following are release binaries:", + "PortBugIncludeDirInCMakeHelperPort": "The folder ${{CURRENT_PACKAGES_DIR}}/include exists in a CMake helper port; this is incorrect, since only CMake files should be installed. To suppress this message, remove set(VCPKG_POLICY_CMAKE_HELPER_PORT enabled).", + "PortBugInvalidCrtLinkageCrtGroup": "The following binaries should link with only: {expected}", + "_PortBugInvalidCrtLinkageCrtGroup.comment": "See PortBugInvalidCrtLinkageHeader. {expected} is one of LinkageDynamicDebug/LinkageDynamicRelease/LinkageStaticDebug/LinkageStaticRelease.", + "PortBugInvalidCrtLinkageEntry": "{path} links with: {actual}", + "_PortBugInvalidCrtLinkageEntry.comment": "See explanation in PortBugInvalidCrtLinkageHeader. {actual} is one or more of LinkageDynamicDebug/LinkageDynamicRelease/LinkageStaticDebug/LinkageStaticRelease , separated by commas. (The vast vast vast majority of the time there will only be one and we're accepting that the localized result may look a bit strange if there is more than one) An example of {path} is /foo/bar.", + "PortBugInvalidCrtLinkageHeader": "binaries built by this port link with C RunTimes (\"CRTs\") inconsistent with those requested by the triplet and deployment structure. If the triplet is intended to only use the release CRT, you should add set(VCPKG_POLICY_ONLY_RELEASE_CRT enabled) to the triplet .cmake file. To suppress this check entirely, add set(VCPKG_POLICY_SKIP_CRT_LINKAGE_CHECK enabled) to the triplet .cmake if this is triplet-wide, or to portfile.cmake if this is specific to the port. You can inspect the binaries with: dumpbin.exe /directives mylibfile.lib", + "_PortBugInvalidCrtLinkageHeader.comment": "This is combined with PortBugInvalidCrtLinkageCrtGroup and PortBugInvalidCrtLinkageEntry. 'CRT' is an acronym meaning C Runtime. See also: https://learn.microsoft.com/cpp/build/reference/md-mt-ld-use-run-time-library?view=msvc-170. This is complicated because a binary can link with more than one CRT.\nExample fully formatted message:\nD:\\vcpkg\\ports\\wrong-crt\\portfile.cmake: warning: binaries built by this port link with C RunTimes (\"CRTs\") inconsistent with those requested by the triplet and deployment structure. If the triplet is intended to only use the release CRT, you should add set(VCPKG_POLICY_ONLY_RELEASE_CRT enabled) to the triplet .cmake file. To suppress this check entirely, add set(VCPKG_POLICY_SKIP_CRT_LINKAGE_CHECK enabled) to the triplet .cmake if this is triplet-wide, or to portfile.cmake if this is specific to the port. You can inspect the binaries with: dumpbin.exe /directives mylibfile.lib\nD:\\vcpkg\\packages\\wrong-crt_x86-windows-static: note: the binaries are relative to ${{CURRENT_PACKAGES_DIR}} here\nnote: The following binaries should link with only: Static Debug (/MTd)\nnote: debug/lib/both_lib.lib links with: Dynamic Debug (/MDd)\nnote: debug/lib/both_lib.lib links with: Dynamic Release (/MD)\nnote: debug/lib/test_lib.lib links with: Dynamic Debug (/MDd)\nnote: The following binaries should link with only: Static Release (/MT)\nnote: lib/both_lib.lib links with: Dynamic Debug (/MDd)\nnote: lib/both_lib.lib links with: Dynamic Debug (/MDd)\nnote: test_lib.lib links with: Dynamic Release (/MD)", + "PortBugKernel32FromXbox": "The selected triplet targets Xbox, but the following DLLs link with kernel32. These DLLs cannot be loaded on Xbox, where kernel32 is not present. This is typically caused by linking with kernel32.lib rather than a suitable umbrella library, such as onecore_apiset.lib or xgameplatform.lib. You can inspect a DLL's dependencies with `dumpbin.exe /dependents mylibfile.dll`. To suppress this message, add set(VCPKG_POLICY_ALLOW_KERNEL32_FROM_XBOX enabled)", + "PortBugMergeLibCMakeDir": "This port creates ${{CURRENT_PACKAGES_DIR}}/lib/cmake and/or ${{CURRENT_PACKAGES_DIR}}/debug/lib/cmake, which should be merged and moved to ${{CURRENT_PACKAGES_DIR}}/share/${{PORT}}/cmake. Please use the helper function vcpkg_cmake_config_fixup() from the port vcpkg-cmake-config. To suppress this message, add set(VCPKG_POLICY_SKIP_LIB_CMAKE_MERGE_CHECK enabled)", + "PortBugMismatchingNumberOfBinaries": "mismatching number of debug and release binaries. This often indicates incorrect handling of debug or release in portfile.cmake or the build system. If the intent is to only ever produce release components for this triplet, the triplet should have set(VCPKG_BUILD_TYPE release) added to its .cmake file. To suppress this message, add set(VCPKG_POLICY_MISMATCHED_NUMBER_OF_BINARIES enabled)", + "PortBugMisplacedCMakeFiles": "This port installs the following CMake files in places CMake files are not expected. CMake should be installed in ${{CURRENT_PACKAGES_DIR}}/share/${{PORT}}. To suppress this message, add set(VCPKG_POLICY_SKIP_MISPLACED_CMAKE_FILES_CHECK enabled)", + "PortBugMisplacedFiles": "The following regular files are installed to location(s) where regular files may not be installed. These should be installed in a subdirectory. To suppress this message, add set(VCPKG_POLICY_SKIP_MISPLACED_REGULAR_FILES_CHECK enabled)", + "PortBugMisplacedPkgConfigFiles": "The following misplaced pkgconfig directories were installed. Misplaced pkgconfig files will not be found correctly by pkgconf or pkg-config. pkgconfig directories should be ${{CURRENT_PACKAGES_DIR}}/share/pkgconfig (for architecture agnostic / header only libraries only), ${{CURRENT_PACKAGES_DIR}}/lib/pkgconfig (for release dependencies), or ${{CURRENT_PACKAGES_DIR}}/lib/debug/pkgconfig (for debug dependencies). To suppress this message, add set(VCPKG_POLICY_SKIP_PKGCONFIG_CHECK enabled)", + "PortBugMissingCMakeHelperPortFile": "The ${{CURRENT_PACKAGES_DIR}}/share/${{PORT}}/vcpkg-port-config.cmake file does not exist. This file must exist for CMake helper ports. To suppress this message, remove set(VCPKG_POLICY_CMAKE_HELPER_PORT enabled)", "PortBugMissingDebugBinaries": "Debug binaries were not found.", - "PortBugMissingFile": "The /{path} file does not exist. This file must exist for CMake helper ports.", - "_PortBugMissingFile.comment": "An example of {path} is /foo/bar.", - "PortBugMissingImportedLibs": "Import libraries were not present in {path}.\nIf this is intended, add the following line in the portfile:\nset(VCPKG_POLICY_DLLS_WITHOUT_LIBS enabled)", - "_PortBugMissingImportedLibs.comment": "An example of {path} is /foo/bar.", - "PortBugMissingIncludeDir": "The folder /include is empty or not present. This indicates the library was not correctly installed.", - "PortBugMissingLicense": "The software license must be available at ${{CURRENT_PACKAGES_DIR}}/share/{package_name}/copyright", - "_PortBugMissingLicense.comment": "An example of {package_name} is zlib.", - "PortBugMissingProvidedUsage": "The port provided \"usage\" but forgot to install to /share/{package_name}/usage, add the following linein the portfile:", - "_PortBugMissingProvidedUsage.comment": "An example of {package_name} is zlib.", + "PortBugMissingImportedLibs": "Import libraries for installed DLLs appear to be missing. If this is intended, add set(VCPKG_POLICY_DLLS_WITHOUT_LIBS enabled)", + "PortBugMissingIncludeDir": "The folder ${{CURRENT_PACKAGES_DIR}}/include is empty or not present. This usually means that headers are not correctly installed. If this is a CMake helper port, add set(VCPKG_POLICY_CMAKE_HELPER_PORT enabled). If this is not a CMake helper port but this is otherwise intentional, add set(VCPKG_POLICY_EMPTY_INCLUDE_FOLDER enabled) to suppress this message.", + "PortBugMissingLicense": "the license is not installed to ${{CURRENT_PACKAGES_DIR}}/share/${{PORT}}/copyright . This can be fixed by adding a call to vcpkg_install_copyright. To suppress this message, add set(VCPKG_POLICY_SKIP_COPYRIGHT_CHECK enabled)", + "PortBugMissingLicenseFixIt": "Consider adding: {value}", + "_PortBugMissingLicenseFixIt.comment": "{value} is a CMake function call for the user to paste into their file, for example: vcpkg_install_copyright(FILE_LIST ${{SOURCE_PATH}}/COPYING ${{SOURCE_PATH}}/LICENSE.txt)", + "PortBugMissingProvidedUsage": "this port contains a file named \"usage\" but didn't install it to ${{CURRENT_PACKAGES_DIR}}/share/${{PORT}}/usage . If this file is not intended to be usage text, consider choosing another name; otherwise, install it. To suppress this message, add set(VCPKG_POLICY_SKIP_USAGE_INSTALL_CHECK enabled)", "PortBugMissingReleaseBinaries": "Release binaries were not found.", "PortBugMovePkgConfigFiles": "You can move the pkgconfig files with commands similar to:", - "PortBugOutdatedCRT": "Detected outdated dynamic CRT in the following files:", - "PortBugRemoveBinDir": "If the creation of bin\\ and/or debug\\bin\\ cannot be disabled, use this in the portfile to remove them", - "PortBugRemoveEmptyDirectories": "If a directory should be populated but is not, this might indicate an error in the portfile.\nIf the directories are not needed and their creation cannot be disabled, use something like this in the portfile to remove them:", + "PortBugOutdatedCRT": "DLLs that link with obsolete C RunTime (\"CRT\") DLLs were installed. Installed DLLs should link with an in-support CRT. You can inspect the dependencies of a DLL with `dumpbin.exe /dependents mylibfile.dll`. If you're using a custom triplet targeting an old CRT, add set(VCPKG_POLICY_ALLOW_OBSOLETE_MSVCRT enabled) to the triplet's .cmake file. To suppress this message for this port, add set(VCPKG_POLICY_ALLOW_OBSOLETE_MSVCRT enabled)", + "PortBugRemoveBinDir": "if creation of these directories cannot be disabled, you can add the following in portfile.cmake to remove them", "PortBugRemoveEmptyDirs": "file(REMOVE_RECURSE empty directories left by the above renames)", "_PortBugRemoveEmptyDirs.comment": "Only the 'empty directories left by the above renames' part should be translated", - "PortBugRestrictedHeaderPaths": "The following restricted headers can prevent the core C++ runtime and other packages from compiling correctly. In exceptional circumstances, this policy can be disabled by setting CMake variable VCPKG_POLICY_ALLOW_RESTRICTED_HEADERS in portfile.cmake.", - "_PortBugRestrictedHeaderPaths.comment": "A list of restricted headers is printed after this message, one per line. ", - "PortBugSetDllsWithoutExports": "DLLs without any exports are likely a bug in the build script. If this is intended, add the following line in the portfile:\nset(VCPKG_POLICY_DLLS_WITHOUT_EXPORTS enabled)\nThe following DLLs have no exports:", - "_PortBugSetDllsWithoutExports.comment": "'exports' means an entry in a DLL's export table. After this message, one file path per line is printed listing each DLL with an empty export table.", + "PortBugRestrictedHeaderPaths": "Taking the following restricted headers can prevent the core C++ runtime and other packages from compiling correctly. These should be renamed or stored in a subdirectory instead. In exceptional circumstances, this warning can be suppressed by adding set(VCPKG_POLICY_ALLOW_RESTRICTED_HEADERS enabled)", + "PortBugRestrictedHeaderPathsNote": "the headers are relative to ${{CURRENT_PACKAGES_DIR}}/include here", + "PortBugSetDllsWithoutExports": "the following DLLs were built without any exports. DLLs without exports are likely bugs in the build script. If this is intended, add set(VCPKG_POLICY_DLLS_WITHOUT_EXPORTS enabled)", "PortDependencyConflict": "Port {package_name} has the following unsupported dependencies:", "_PortDependencyConflict.comment": "An example of {package_name} is zlib.", "PortDoesNotExist": "{package_name} does not exist", @@ -1389,6 +1384,8 @@ "_ShallowRepositoryDetected.comment": "An example of {path} is /foo/bar.", "SkipClearingInvalidDir": "Skipping clearing contents of {path} because it was not a directory.", "_SkipClearingInvalidDir.comment": "An example of {path} is /foo/bar.", + "SkippingPostBuildValidationDueTo": "Skipping post-build validation due to {cmake_var}", + "_SkippingPostBuildValidationDueTo.comment": "An example of {cmake_var} is VCPKG_POLICY_EMPTY_PACKAGE.", "SourceFieldPortNameMismatch": "The 'Source' field inside the CONTROL file, or \"name\" field inside the vcpkg.json file has the name {package_name} and does not match the port directory \"{path}\".", "_SourceFieldPortNameMismatch.comment": "{package_name} and \"{path}\" are both names of installable ports/packages. 'Source', 'CONTROL', 'vcpkg.json', and 'name' references are locale-invariant. An example of {package_name} is zlib. An example of {path} is /foo/bar.", "SpecifiedFeatureTurnedOff": "'{command_name}' feature specifically turned off, but --{option} was specified.", @@ -1493,8 +1490,8 @@ "_UnknownBooleanSetting.comment": "{value} is what {option} is set to An example of {option} is editable.", "UnknownParameterForIntegrate": "Unknown parameter '{value}' for integrate.", "_UnknownParameterForIntegrate.comment": "'{value}' is a user-supplied command line option. For example, given vcpkg integrate frobinate, {value} would be frobinate.", - "UnknownPolicySetting": "Unknown setting for policy '{value}': {option}", - "_UnknownPolicySetting.comment": "'{value}' is the policy in question. These are unlocalized names that ports use to control post build checks. Some examples are VCPKG_POLICY_DLLS_WITHOUT_EXPORTS, VCPKG_POLICY_MISMATCHED_NUMBER_OF_BINARIES, or VCPKG_POLICY_ALLOW_OBSOLETE_MSVCRT An example of {option} is editable.", + "UnknownPolicySetting": "Unknown setting of {cmake_var}: {value}. Valid policy values are '', 'disabled', and 'enabled'.", + "_UnknownPolicySetting.comment": "{value} is to what the user set the variable we don't understand. The names 'enabled' and 'disabled' must not be localized. An example of {cmake_var} is VCPKG_POLICY_EMPTY_PACKAGE.", "UnknownSettingForBuildType": "Unknown setting for VCPKG_BUILD_TYPE {option}. Valid settings are '', 'debug', and 'release'.", "_UnknownSettingForBuildType.comment": "An example of {option} is editable.", "UnknownTool": "vcpkg does not have a definition of this tool for this platform.", @@ -1539,6 +1536,8 @@ "UpgradeRunWithNoDryRun": "If you are sure you want to rebuild the above packages, run this command with the --no-dry-run option.", "UploadingBinariesToVendor": "Uploading binaries for '{spec}' to '{vendor}' source \"{path}\".", "_UploadingBinariesToVendor.comment": "An example of {spec} is zlib:x64-windows. An example of {vendor} is Azure. An example of {path} is /foo/bar.", + "UsageInstallInstructions": "you can install the usage file with the following CMake", + "UsageTextHere": "the usage file is here", "UseEnvVar": "-- Using {env_var} in environment variables.", "_UseEnvVar.comment": "An example of env_var is \"HTTP(S)_PROXY\"'--' at the beginning must be preserved An example of {env_var} is VCPKG_DEFAULT_TRIPLET.", "UserWideIntegrationDeleted": "User-wide integration is not installed.", diff --git a/src/vcpkg-test/tools.cpp b/src/vcpkg-test/tools.cpp index eeeef4dc28..cc902cc70c 100644 --- a/src/vcpkg-test/tools.cpp +++ b/src/vcpkg-test/tools.cpp @@ -3,8 +3,6 @@ #include #include -#include - using namespace vcpkg; TEST_CASE ("parse_tool_version_string", "[tools]") diff --git a/src/vcpkg-test/util-tests.cpp b/src/vcpkg-test/util-tests.cpp index b7583b5e4b..5a3db89171 100644 --- a/src/vcpkg-test/util-tests.cpp +++ b/src/vcpkg-test/util-tests.cpp @@ -82,7 +82,7 @@ TEST_CASE ("append", "[util]") b.emplace_back("jkl"); b.emplace_back("mno"); b.emplace_back("pqr"); - vcpkg::Util::Vectors::append(&a, std::move(b)); + vcpkg::Util::Vectors::append(a, std::move(b)); REQUIRE(b.size() == 3); REQUIRE(b[0] == ""); REQUIRE(a.size() == 6); @@ -96,7 +96,7 @@ TEST_CASE ("append", "[util]") b.emplace_back("jkl"); b.emplace_back("mno"); b.emplace_back("pqr"); - vcpkg::Util::Vectors::append(&a, b); + vcpkg::Util::Vectors::append(a, b); REQUIRE(b.size() == 3); REQUIRE(b[0] == "jkl"); REQUIRE(a.size() == 6); @@ -111,7 +111,7 @@ TEST_CASE ("append", "[util]") "mno", "pqr", }; - vcpkg::Util::Vectors::append(&a, b); + vcpkg::Util::Vectors::append(a, b); REQUIRE(b.size() == 3); REQUIRE(b[0] == "jkl"); REQUIRE(a.size() == 6); diff --git a/src/vcpkg/base/checks.cpp b/src/vcpkg/base/checks.cpp index 0597690d58..b93d06f30b 100644 --- a/src/vcpkg/base/checks.cpp +++ b/src/vcpkg/base/checks.cpp @@ -146,6 +146,7 @@ namespace vcpkg [[noreturn]] void Checks::msg_exit_maybe_upgrade(const LineInfo& line_info, const LocalizedString& error_message) { msg::write_unlocalized_text_to_stderr(Color::error, error_message); + msg::write_unlocalized_text_to_stderr(Color::error, "\n"); display_upgrade_message(); exit_fail(line_info); } diff --git a/src/vcpkg/base/files.cpp b/src/vcpkg/base/files.cpp index 561d91ee76..e466e97163 100644 --- a/src/vcpkg/base/files.cpp +++ b/src/vcpkg/base/files.cpp @@ -1161,6 +1161,46 @@ namespace vcpkg } } + void Path::make_generic() + { + char* first = m_str.data(); + char* last = first + m_str.size(); + char* after_root_name = const_cast(find_root_name_end(first, last)); + char* after_root_directory = std::find_if_not(after_root_name, last, is_slash); +#if defined(_WIN32) + // \\server\share must remain \\server but it can be \\server/share + std::replace(first, after_root_name, '/', '\\'); +#endif // _WIN32 + char* target = after_root_name; + if (after_root_name != after_root_directory) + { + *target = '/'; + ++target; + } + + first = after_root_directory; + for (;;) + { + char* next_slash = std::find_if(first, last, is_slash); + auto length = next_slash - first; + if (first != target) + { + memmove(target, first, static_cast(length)); + } + + target += length; + if (next_slash == last) + { + m_str.erase(target - m_str.data()); + return; + } + + *target = '/'; + ++target; + first = std::find_if_not(next_slash + 1, last, is_slash); + } + } + Path Path::lexically_normal() const { // copied from microsoft/STL, stl/inc/filesystem:lexically_normal() @@ -1674,6 +1714,25 @@ namespace vcpkg return maybe_directories; } + std::vector ReadOnlyFilesystem::get_directories_recursive_lexically_proximate(const Path& dir, + LineInfo li) const + { + return this->try_get_directories_recursive_lexically_proximate(dir).value_or_exit(li); + } + + ExpectedL> ReadOnlyFilesystem::try_get_directories_recursive_lexically_proximate( + const Path& dir) const + { + std::error_code ec; + auto maybe_directories = this->get_directories_recursive_lexically_proximate(dir, ec); + if (ec) + { + return format_filesystem_call_error(ec, __func__, {dir}); + } + + return maybe_directories; + } + std::vector ReadOnlyFilesystem::get_directories_non_recursive(const Path& dir, LineInfo li) const { return this->try_get_directories_non_recursive(dir).value_or_exit(li); @@ -2464,6 +2523,21 @@ namespace vcpkg return get_directories_impl(dir, ec); } + virtual std::vector get_directories_recursive_lexically_proximate(const Path& dir, + std::error_code& ec) const override + { + auto ret = this->get_directories_recursive(dir, ec); + if (!ec) + { + const auto base = to_stdfs_path(dir); + for (auto& p : ret) + { + p = from_stdfs_path(to_stdfs_path(p).lexically_proximate(base)); + } + } + return ret; + } + virtual std::vector get_directories_non_recursive(const Path& dir, std::error_code& ec) const override { return get_directories_impl(dir, ec); @@ -2770,6 +2844,15 @@ namespace vcpkg return result; } + virtual std::vector get_directories_recursive_lexically_proximate(const Path& dir, + std::error_code& ec) const override + { + std::vector result; + Path out_base; + get_files_recursive_impl(result, dir, out_base, ec, true, false, false); + return result; + } + virtual std::vector get_directories_non_recursive(const Path& dir, std::error_code& ec) const override { std::vector result; diff --git a/src/vcpkg/base/strings.cpp b/src/vcpkg/base/strings.cpp index 0d2fbe7708..c308819c9e 100644 --- a/src/vcpkg/base/strings.cpp +++ b/src/vcpkg/base/strings.cpp @@ -14,8 +14,6 @@ #include #include -#include - using namespace vcpkg; namespace vcpkg::Strings::details diff --git a/src/vcpkg/commands.autocomplete.cpp b/src/vcpkg/commands.autocomplete.cpp index bfe548e3b4..5c01ad1b53 100644 --- a/src/vcpkg/commands.autocomplete.cpp +++ b/src/vcpkg/commands.autocomplete.cpp @@ -163,7 +163,7 @@ namespace vcpkg { auto port_at_each_triplet = combine_port_with_triplets(results[0], paths.get_triplet_db().available_triplets); - Util::Vectors::append(&results, std::move(port_at_each_triplet)); + Util::Vectors::append(results, std::move(port_at_each_triplet)); } output_sorted_results_and_exit(VCPKG_LINE_INFO, std::move(results)); diff --git a/src/vcpkg/commands.build.cpp b/src/vcpkg/commands.build.cpp index 7fc24876c5..037d3728f9 100644 --- a/src/vcpkg/commands.build.cpp +++ b/src/vcpkg/commands.build.cpp @@ -215,19 +215,6 @@ namespace vcpkg } } - static std::remove_const_t generate_all_policies() - { - std::remove_const_t res{}; - for (size_t i = 0; i < res.size(); ++i) - { - res[i] = static_cast(i); - } - - return res; - } - - decltype(ALL_POLICIES) ALL_POLICIES = generate_all_policies(); - StringLiteral to_string_view(BuildPolicy policy) { switch (policy) @@ -245,6 +232,21 @@ namespace vcpkg case BuildPolicy::SKIP_ARCHITECTURE_CHECK: return PolicySkipArchitectureCheck; case BuildPolicy::CMAKE_HELPER_PORT: return PolicyCMakeHelperPort; case BuildPolicy::SKIP_ABSOLUTE_PATHS_CHECK: return PolicySkipAbsolutePathsCheck; + case BuildPolicy::SKIP_ALL_POST_BUILD_CHECKS: return PolicySkipAllPostBuildChecks; + case BuildPolicy::SKIP_APPCONTAINER_CHECK: return PolicySkipAppcontainerCheck; + case BuildPolicy::SKIP_CRT_LINKAGE_CHECK: return PolicySkipCrtLinkageCheck; + case BuildPolicy::SKIP_MISPLACED_CMAKE_FILES_CHECK: return PolicySkipMisplacedCMakeFilesCheck; + case BuildPolicy::SKIP_LIB_CMAKE_MERGE_CHECK: return PolicySkipLibCMakeMergeCheck; + case BuildPolicy::ALLOW_DLLS_IN_LIB: return PolicyAllowDllsInLib; + case BuildPolicy::SKIP_MISPLACED_REGULAR_FILES_CHECK: return PolicySkipMisplacedRegularFilesCheck; + case BuildPolicy::SKIP_COPYRIGHT_CHECK: return PolicySkipCopyrightCheck; + case BuildPolicy::ALLOW_KERNEL32_FROM_XBOX: return PolicyAllowKernel32FromXBox; + case BuildPolicy::ALLOW_EXES_IN_BIN: return PolicyAllowExesInBin; + case BuildPolicy::SKIP_USAGE_INSTALL_CHECK: return PolicySkipUsageInstallCheck; + case BuildPolicy::ALLOW_EMPTY_FOLDERS: return PolicyAllowEmptyFolders; + case BuildPolicy::ALLOW_DEBUG_INCLUDE: return PolicyAllowDebugInclude; + case BuildPolicy::ALLOW_DEBUG_SHARE: return PolicyAllowDebugShare; + case BuildPolicy::SKIP_PKGCONFIG_CHECK: return PolicySkipPkgConfigCheck; default: Checks::unreachable(VCPKG_LINE_INFO); } } @@ -267,6 +269,22 @@ namespace vcpkg case BuildPolicy::SKIP_ARCHITECTURE_CHECK: return CMakeVariablePolicySkipArchitectureCheck; case BuildPolicy::CMAKE_HELPER_PORT: return CMakeVariablePolicyCMakeHelperPort; case BuildPolicy::SKIP_ABSOLUTE_PATHS_CHECK: return CMakeVariablePolicySkipAbsolutePathsCheck; + case BuildPolicy::SKIP_ALL_POST_BUILD_CHECKS: return CMakeVariablePolicySkipAllPostBuildChecks; + case BuildPolicy::SKIP_APPCONTAINER_CHECK: return CMakeVariablePolicySkipAppcontainerCheck; + case BuildPolicy::SKIP_CRT_LINKAGE_CHECK: return CMakeVariablePolicySkipCrtLinkageCheck; + case BuildPolicy::SKIP_MISPLACED_CMAKE_FILES_CHECK: return CMakeVariablePolicySkipMisplacedCMakeFilesCheck; + case BuildPolicy::SKIP_LIB_CMAKE_MERGE_CHECK: return CMakeVariablePolicySkipLibCMakeMergeCheck; + case BuildPolicy::ALLOW_DLLS_IN_LIB: return CMakeVariablePolicyAllowDllsInLib; + case BuildPolicy::SKIP_MISPLACED_REGULAR_FILES_CHECK: + return CMakeVariablePolicySkipMisplacedRegularFilesCheck; + case BuildPolicy::SKIP_COPYRIGHT_CHECK: return CMakeVariablePolicySkipCopyrightCheck; + case BuildPolicy::ALLOW_KERNEL32_FROM_XBOX: return CMakeVariablePolicyAllowKernel32FromXBox; + case BuildPolicy::ALLOW_EXES_IN_BIN: return CMakeVariablePolicyAllowExesInBin; + case BuildPolicy::SKIP_USAGE_INSTALL_CHECK: return CMakeVariablePolicySkipUsageInstallCheck; + case BuildPolicy::ALLOW_EMPTY_FOLDERS: return CMakeVariablePolicyAllowEmptyFolders; + case BuildPolicy::ALLOW_DEBUG_INCLUDE: return CMakeVariablePolicyAllowDebugInclude; + case BuildPolicy::ALLOW_DEBUG_SHARE: return CMakeVariablePolicyAllowDebugShare; + case BuildPolicy::SKIP_PKGCONFIG_CHECK: return CMakeVariablePolicySkipPkgConfigCheck; default: Checks::unreachable(VCPKG_LINE_INFO); } } @@ -1744,8 +1762,9 @@ namespace vcpkg } std::unordered_map policies; - for (const auto& policy : ALL_POLICIES) + for (size_t policy_idx = 0; policy_idx < static_cast(BuildPolicy::COUNT); ++policy_idx) { + auto policy = static_cast(policy_idx); const auto setting = parser.optional_field_or_empty(to_string_view(policy)); if (setting.empty()) continue; if (setting == "enabled") @@ -1753,10 +1772,10 @@ namespace vcpkg else if (setting == "disabled") policies.emplace(policy, false); else - Checks::msg_exit_maybe_upgrade(VCPKG_LINE_INFO, - msgUnknownPolicySetting, - msg::option = setting, - msg::value = to_string_view(policy)); + Checks::msg_exit_with_error(VCPKG_LINE_INFO, + msgUnknownPolicySetting, + msg::value = setting, + msg::cmake_var = to_cmake_variable(policy)); } auto maybe_error = parser.error(); @@ -1830,7 +1849,7 @@ namespace vcpkg // Note that this must come after CMakeVariableEnvPassthrough since the leading values come from there if (auto value = Util::value_if_set_and_nonempty(cmakevars, CMakeVariableEnvPassthroughUntracked)) { - Util::Vectors::append(&passthrough_env_vars, Strings::split(*value, ';')); + Util::Vectors::append(passthrough_env_vars, Strings::split(*value, ';')); } Util::assign_if_set_and_nonempty(public_abi_override, cmakevars, CMakeVariablePublicAbiOverride); diff --git a/src/vcpkg/commands.install.cpp b/src/vcpkg/commands.install.cpp index 4e800b5b0c..c512a701cb 100644 --- a/src/vcpkg/commands.install.cpp +++ b/src/vcpkg/commands.install.cpp @@ -981,7 +981,7 @@ namespace vcpkg msg.append_indent() .append_raw("find_path(") .append_raw(name) - .append_raw("_INCLUDE_DIRS \")") + .append_raw("_INCLUDE_DIRS \"") .append_raw(header_path) .append_raw("\")\n"); msg.append_indent() diff --git a/src/vcpkg/dependencies.cpp b/src/vcpkg/dependencies.cpp index add2b6d182..d9d151cbbb 100644 --- a/src/vcpkg/dependencies.cpp +++ b/src/vcpkg/dependencies.cpp @@ -241,7 +241,7 @@ namespace vcpkg } } - Util::Vectors::append(&out_new_dependencies, std::move(dep_list)); + Util::Vectors::append(out_new_dependencies, std::move(dep_list)); } void create_install_info(std::vector& out_reinstall_requirements) diff --git a/src/vcpkg/export.prefab.cpp b/src/vcpkg/export.prefab.cpp index 672c905631..1759b9f178 100644 --- a/src/vcpkg/export.prefab.cpp +++ b/src/vcpkg/export.prefab.cpp @@ -18,7 +18,7 @@ namespace vcpkg::Prefab { - static std::vector find_modules(const VcpkgPaths& system, const Path& root, const std::string& ext) + static std::vector find_modules(const VcpkgPaths& system, const Path& root, StringLiteral ext) { const Filesystem& fs = system.get_filesystem(); std::error_code ec; diff --git a/src/vcpkg/postbuildlint.cpp b/src/vcpkg/postbuildlint.cpp index a4eb9f087c..5abf01c75c 100644 --- a/src/vcpkg/postbuildlint.cpp +++ b/src/vcpkg/postbuildlint.cpp @@ -1,5 +1,7 @@ #include +#include #include +#include #include #include #include @@ -15,7 +17,7 @@ namespace vcpkg { - constexpr static std::array windows_system_names = { + constexpr static StringLiteral windows_system_names[] = { "", "Windows", "WindowsStore", @@ -28,35 +30,60 @@ namespace vcpkg PROBLEM_DETECTED = 1 }; + static void print_relative_paths(MessageSink& msg_sink, + msg::MessageT<> kind_prefix, + const Path& relative_prefix_dir, + const std::vector& relative_paths) + { + auto ls = LocalizedString() + .append_raw('\n') + .append_raw(relative_prefix_dir) + .append_raw(": ") + .append_raw(NotePrefix) + .append(kind_prefix) + .append_raw('\n'); + for (const Path& package_relative_path : relative_paths) + { + auto as_generic = package_relative_path; + as_generic.make_generic(); + ls.append_raw(NotePrefix).append_raw(as_generic).append_raw('\n'); + } + + msg_sink.print(ls); + } + // clang-format off #define OUTDATED_V_NO_120 \ - StringLiteral{"msvcp100.dll"}, \ - StringLiteral{"msvcp100d.dll"}, \ - StringLiteral{"msvcp110.dll"}, \ - StringLiteral{"msvcp110_win.dll"}, \ - StringLiteral{"msvcp60.dll"}, \ - StringLiteral{"msvcp60.dll"}, \ - \ - StringLiteral{"msvcrt.dll"}, \ - StringLiteral{"msvcr100.dll"}, \ - StringLiteral{"msvcr100d.dll"}, \ - StringLiteral{"msvcr100_clr0400.dll"}, \ - StringLiteral{"msvcr110.dll"}, \ - StringLiteral{"msvcrt20.dll"}, \ - StringLiteral{"msvcrt40.dll"} + "msvcp100.dll", \ + "msvcp100d.dll", \ + "msvcp110.dll", \ + "msvcp110_win.dll", \ + "msvcp60.dll", \ + "msvcr60.dll", \ + \ + "msvcrt.dll", \ + "msvcr100.dll", \ + "msvcr100d.dll", \ + "msvcr100_clr0400.dll", \ + "msvcr110.dll", \ + "msvcr110d.dll", \ + "msvcrt20.dll", \ + "msvcrt40.dll" // clang-format on static View get_outdated_dynamic_crts(const Optional& toolset_version) { - static constexpr std::array V_NO_120 = {OUTDATED_V_NO_120}; + static constexpr StringLiteral V_NO_120[] = {OUTDATED_V_NO_120}; - static constexpr std::array V_NO_MSVCRT = { + static constexpr StringLiteral V_NO_MSVCRT[] = { OUTDATED_V_NO_120, - StringLiteral{"msvcp120.dll"}, - StringLiteral{"msvcp120_clr0400.dll"}, - StringLiteral{"msvcr120.dll"}, - StringLiteral{"msvcr120_clr0400.dll"}, + "msvcp120.dll", + "msvcp120d.dll", + "msvcp120_clr0400.dll", + "msvcr120.dll", + "msvcr120d.dll", + "msvcr120_clr0400.dll", }; const auto tsv = toolset_version.get(); @@ -72,33 +99,40 @@ namespace vcpkg #undef OUTDATED_V_NO_120 static LintStatus check_for_files_in_include_directory(const ReadOnlyFilesystem& fs, - const BuildPolicies& policies, const Path& package_dir, + const Path& portfile_cmake, MessageSink& msg_sink) { - if (policies.is_enabled(BuildPolicy::EMPTY_INCLUDE_FOLDER)) - { - return LintStatus::SUCCESS; - } - const auto include_dir = package_dir / "include"; - - if (policies.is_enabled(BuildPolicy::CMAKE_HELPER_PORT)) + if (!fs.exists(include_dir, IgnoreErrors{}) || fs.is_empty(include_dir, IgnoreErrors{})) { - if (fs.exists(include_dir, IgnoreErrors{})) - { - msg_sink.println_warning(msgPortBugIncludeDirInCMakeHelperPort); - return LintStatus::PROBLEM_DETECTED; - } - else - { - return LintStatus::SUCCESS; - } + msg_sink.print(Color::warning, + LocalizedString::from_raw(portfile_cmake) + .append_raw(": ") + .append_raw(WarningPrefix) + .append(msgPortBugMissingIncludeDir) + .append_raw('\n')); + + return LintStatus::PROBLEM_DETECTED; } - if (!fs.exists(include_dir, IgnoreErrors{}) || fs.is_empty(include_dir, IgnoreErrors{})) - { - msg_sink.println_warning(msgPortBugMissingIncludeDir); + return LintStatus::SUCCESS; + } + + static LintStatus check_for_no_files_in_cmake_helper_port_include_directory(const ReadOnlyFilesystem& fs, + const Path& package_dir, + const Path& portfile_cmake, + MessageSink& msg_sink) + { + const auto include_dir = package_dir / "include"; + if (fs.exists(include_dir, IgnoreErrors{})) + { + msg_sink.print(Color::warning, + LocalizedString::from_raw(portfile_cmake) + .append_raw(": ") + .append_raw(WarningPrefix) + .append(msgPortBugIncludeDirInCMakeHelperPort) + .append_raw('\n')); return LintStatus::PROBLEM_DETECTED; } @@ -106,15 +140,10 @@ namespace vcpkg } static LintStatus check_for_restricted_include_files(const ReadOnlyFilesystem& fs, - const BuildPolicies& policies, const Path& package_dir, + const Path& portfile_cmake, MessageSink& msg_sink) { - if (policies.is_enabled(BuildPolicy::ALLOW_RESTRICTED_HEADERS)) - { - return LintStatus::SUCCESS; - } - // These files are taken from the libc6-dev package on Ubuntu inside /usr/include/x86_64-linux-gnu/sys/ static constexpr StringLiteral restricted_sys_filenames[] = { "acct.h", "auxv.h", "bitypes.h", "cdefs.h", "debugreg.h", "dir.h", "elf.h", @@ -176,21 +205,37 @@ namespace vcpkg filenames_s.insert(file.filename()); } - std::vector violations; + std::vector violations; for (auto&& flist : restricted_lists) + { for (auto&& f : flist) { if (Util::Sets::contains(filenames_s, f)) { - violations.push_back(Path("include") / f); + violations.push_back(fmt::format(FMT_COMPILE("<{}>"), f)); } } + } if (!violations.empty()) { - msg_sink.println_warning(msgPortBugRestrictedHeaderPaths); - print_paths(msg_sink, violations); - msg_sink.println(msgPortBugRestrictedHeaderPaths); + Util::sort(violations); + msg_sink.print(Color::warning, + LocalizedString::from_raw(portfile_cmake) + .append_raw(": ") + .append_raw(WarningPrefix) + .append(msgPortBugRestrictedHeaderPaths) + .append_raw('\n')); + msg_sink.print(LocalizedString::from_raw(include_dir) + .append_raw(": ") + .append_raw(NotePrefix) + .append(msgPortBugRestrictedHeaderPathsNote) + .append_raw('\n')); + for (auto&& violation : violations) + { + msg_sink.print(LocalizedString::from_raw(NotePrefix).append_raw(violation).append_raw('\n')); + } + return LintStatus::PROBLEM_DETECTED; } @@ -199,9 +244,10 @@ namespace vcpkg static LintStatus check_for_files_in_debug_include_directory(const ReadOnlyFilesystem& fs, const Path& package_dir, + const Path& portfile_cmake, MessageSink& msg_sink) { - const auto debug_include_dir = package_dir / "debug" / "include"; + const auto debug_include_dir = package_dir / "debug" VCPKG_PREFERRED_SEPARATOR "include"; std::vector files_found = fs.get_regular_files_recursive(debug_include_dir, IgnoreErrors{}); @@ -209,7 +255,14 @@ namespace vcpkg if (!files_found.empty()) { - msg_sink.println_warning(msgPortBugDuplicateIncludeFiles); + msg_sink.print(Color::warning, + LocalizedString::from_raw(portfile_cmake) + .append_raw(": ") + .append_raw(WarningPrefix) + .append(msgPortBugDuplicateIncludeFiles) + .append_raw('\n')); + msg_sink.print( + LocalizedString::from_raw(NotePrefix).append(msgPortBugDuplicateIncludeFilesFixIt).append_raw('\n')); return LintStatus::PROBLEM_DETECTED; } @@ -218,33 +271,39 @@ namespace vcpkg static LintStatus check_for_files_in_debug_share_directory(const ReadOnlyFilesystem& fs, const Path& package_dir, + const Path& portfile_cmake, MessageSink& msg_sink) { - const auto debug_share = package_dir / "debug" / "share"; + const auto debug_share = package_dir / "debug" VCPKG_PREFERRED_SEPARATOR "share"; if (fs.exists(debug_share, IgnoreErrors{})) { - msg_sink.println_warning(msgPortBugDebugShareDir); + msg_sink.print(Color::warning, + LocalizedString::from_raw(portfile_cmake) + .append_raw(": ") + .append_raw(WarningPrefix) + .append(msgPortBugDebugShareDir) + .append_raw('\n')); return LintStatus::PROBLEM_DETECTED; } return LintStatus::SUCCESS; } - static LintStatus check_for_vcpkg_port_config(const ReadOnlyFilesystem& fs, - const BuildPolicies& policies, - const Path& package_dir, - const PackageSpec& spec, - MessageSink& msg_sink) + static LintStatus check_for_vcpkg_port_config_in_cmake_helper_port(const ReadOnlyFilesystem& fs, + const Path& package_dir, + StringView package_name, + const Path& portfile_cmake, + MessageSink& msg_sink) { - const auto relative_path = Path("share") / spec.name() / "vcpkg-port-config.cmake"; - const auto absolute_path = package_dir / relative_path; - if (policies.is_enabled(BuildPolicy::CMAKE_HELPER_PORT)) - { - if (!fs.exists(absolute_path, IgnoreErrors{})) - { - msg_sink.println_warning(msgPortBugMissingFile, msg::path = relative_path); - return LintStatus::PROBLEM_DETECTED; - } + if (!fs.exists(package_dir / "share" / package_name / "vcpkg-port-config.cmake", IgnoreErrors{})) + { + msg_sink.print(Color::warning, + LocalizedString::from_raw(portfile_cmake) + .append_raw(": ") + .append_raw(WarningPrefix) + .append(msgPortBugMissingCMakeHelperPortFile) + .append_raw("\n")); + return LintStatus::PROBLEM_DETECTED; } return LintStatus::SUCCESS; @@ -253,35 +312,35 @@ namespace vcpkg static LintStatus check_for_usage_forgot_install(const ReadOnlyFilesystem& fs, const Path& port_dir, const Path& package_dir, - const PackageSpec& spec, + const StringView package_name, + const Path& portfile_cmake, MessageSink& msg_sink) { static constexpr StringLiteral STANDARD_INSTALL_USAGE = R"###(file(INSTALL "${CMAKE_CURRENT_LIST_DIR}/usage" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}"))###"; auto usage_path_from = port_dir / "usage"; - auto usage_path_to = package_dir / "share" / spec.name() / "usage"; + auto usage_path_to = package_dir / "share" / package_name / "usage"; if (fs.is_regular_file(usage_path_from) && !fs.is_regular_file(usage_path_to)) { - msg_sink.println_warning(msg::format(msgPortBugMissingProvidedUsage, msg::package_name = spec.name()) - .append_raw('\n') - .append_raw(STANDARD_INSTALL_USAGE)); - return LintStatus::PROBLEM_DETECTED; - } - - return LintStatus::SUCCESS; - } - - static LintStatus check_folder_lib_cmake(const ReadOnlyFilesystem& fs, - const Path& package_dir, - const PackageSpec& spec, - MessageSink& msg_sink) - { - const auto lib_cmake = package_dir / "lib" / "cmake"; - if (fs.exists(lib_cmake, IgnoreErrors{})) - { - msg_sink.println_warning(msgPortBugMergeLibCMakeDir, msg::package_name = spec.name()); + msg_sink.print(Color::warning, + LocalizedString::from_raw(portfile_cmake) + .append_raw(": ") + .append_raw(WarningPrefix) + .append(msgPortBugMissingProvidedUsage) + .append_raw('\n')); + msg_sink.print(LocalizedString::from_raw(usage_path_from) + .append_raw(": ") + .append_raw(NotePrefix) + .append(msgUsageTextHere) + .append_raw('\n') + .append_raw(NotePrefix) + .append(msgUsageInstallInstructions) + .append_raw('\n') + .append_raw(NotePrefix) + .append_raw(STANDARD_INSTALL_USAGE) + .append_raw('\n')); return LintStatus::PROBLEM_DETECTED; } @@ -290,64 +349,104 @@ namespace vcpkg static LintStatus check_for_misplaced_cmake_files(const ReadOnlyFilesystem& fs, const Path& package_dir, - const PackageSpec& spec, + const Path& portfile_cmake, MessageSink& msg_sink) { - std::vector dirs = { - package_dir / "cmake", - package_dir / "debug" / "cmake", - package_dir / "lib" / "cmake", - package_dir / "debug" / "lib" / "cmake", + static constexpr StringLiteral deny_relative_dirs[] = { + "cmake", + "debug" VCPKG_PREFERRED_SEPARATOR "cmake", + "lib" VCPKG_PREFERRED_SEPARATOR "cmake", + "debug" VCPKG_PREFERRED_SEPARATOR "lib" VCPKG_PREFERRED_SEPARATOR "cmake", }; std::vector misplaced_cmake_files; - for (auto&& dir : dirs) + for (auto&& deny_relative_dir : deny_relative_dirs) { - for (auto&& file : fs.get_regular_files_recursive(dir, IgnoreErrors{})) + for (auto&& file : + fs.get_regular_files_recursive_lexically_proximate(package_dir / deny_relative_dir, IgnoreErrors{})) { if (Strings::case_insensitive_ascii_equals(file.extension(), ".cmake")) { - misplaced_cmake_files.push_back(std::move(file)); + misplaced_cmake_files.push_back(Path(deny_relative_dir) / std::move(file)); } } } if (!misplaced_cmake_files.empty()) { - msg_sink.println_warning(msgPortBugMisplacedCMakeFiles, msg::spec = spec.name()); - print_paths(msg_sink, misplaced_cmake_files); + msg_sink.print(Color::warning, + LocalizedString::from_raw(portfile_cmake) + .append_raw(": ") + .append_raw(WarningPrefix) + .append(msgPortBugMisplacedCMakeFiles)); + print_relative_paths( + msg_sink, msgFilesRelativeToThePackageDirectoryHere, package_dir, misplaced_cmake_files); return LintStatus::PROBLEM_DETECTED; } return LintStatus::SUCCESS; } - static LintStatus check_folder_debug_lib_cmake(const ReadOnlyFilesystem& fs, - const Path& package_dir, - const PackageSpec& spec, - MessageSink& msg_sink) + static LintStatus check_lib_cmake_merge(const ReadOnlyFilesystem& fs, + const Path& package_dir, + const Path& portfile_cmake, + MessageSink& msg_sink) { - const auto lib_cmake_debug = package_dir / "debug" / "lib" / "cmake"; - if (fs.exists(lib_cmake_debug, IgnoreErrors{})) - { - msg_sink.println_warning(msgPortBugMergeLibCMakeDir, msg::package_name = spec.name()); + if (fs.exists(package_dir / "lib" VCPKG_PREFERRED_SEPARATOR "cmake", IgnoreErrors{}) || + fs.exists(package_dir / "debug" VCPKG_PREFERRED_SEPARATOR "lib" VCPKG_PREFERRED_SEPARATOR "cmake", + IgnoreErrors{})) + { + msg_sink.print(Color::warning, + LocalizedString::from_raw(portfile_cmake) + .append_raw(": ") + .append_raw(WarningPrefix) + .append(msgPortBugMergeLibCMakeDir) + .append_raw('\n')); return LintStatus::PROBLEM_DETECTED; } return LintStatus::SUCCESS; } - static LintStatus check_for_dlls_in_lib_dir(const ReadOnlyFilesystem& fs, + static void add_prefix_to_all(std::vector& paths, const Path& prefix) + { + for (auto&& path : paths) + { + path = prefix / std::move(path); + } + } + + static std::vector find_relative_dlls(const ReadOnlyFilesystem& fs, const Path& package_dir, - MessageSink& msg_sink) + StringLiteral prefix) { - std::vector dlls = fs.get_regular_files_recursive(package_dir / "lib", IgnoreErrors{}); - Util::erase_remove_if(dlls, NotExtensionCaseInsensitive{".dll"}); + std::vector relative_dlls = + fs.get_regular_files_recursive_lexically_proximate(package_dir / prefix, IgnoreErrors{}); + Util::erase_remove_if(relative_dlls, NotExtensionCaseInsensitive{".dll"}); + add_prefix_to_all(relative_dlls, prefix); + return relative_dlls; + } + + static LintStatus check_for_dlls_in_lib_dirs(const ReadOnlyFilesystem& fs, + const Path& package_dir, + View lib_dir_prefixes, + const Path& portfile_cmake, + MessageSink& msg_sink) + { + std::vector bad_dlls; + for (auto&& prefix : lib_dir_prefixes) + { + Util::Vectors::append(bad_dlls, find_relative_dlls(fs, package_dir, prefix)); + } - if (!dlls.empty()) + if (!bad_dlls.empty()) { - msg_sink.println_warning(msgPortBugDllInLibDir); - print_paths(msg_sink, dlls); + msg_sink.print(Color::warning, + LocalizedString::from_raw(portfile_cmake) + .append_raw(": ") + .append_raw(WarningPrefix) + .append(msgPortBugDllInLibDir)); + print_relative_paths(msg_sink, msgDllsRelativeToThePackageDirectoryHere, package_dir, bad_dlls); return LintStatus::PROBLEM_DETECTED; } @@ -355,71 +454,122 @@ namespace vcpkg } static LintStatus check_for_copyright_file(const ReadOnlyFilesystem& fs, - const PackageSpec& spec, + StringView spec_name, const Path& package_dir, - const VcpkgPaths& paths, + const Path& build_dir, + const Path& portfile_cmake, MessageSink& msg_sink) { - const auto copyright_file = package_dir / "share" / spec.name() / "copyright"; + static constexpr StringLiteral copyright_filenames[] = {"COPYING", "LICENSE", "LICENSE.txt"}; + const auto copyright_file = package_dir / "share" / spec_name / "copyright"; switch (fs.status(copyright_file, IgnoreErrors{})) { case FileType::regular: return LintStatus::SUCCESS; break; - case FileType::directory: msg_sink.println_warning(msgCopyrightIsDir, msg::path = "copyright"); break; + case FileType::directory: + msg_sink.print(Color::warning, + LocalizedString::from_raw(portfile_cmake) + .append_raw(": ") + .append_raw(WarningPrefix) + .append(msgCopyrightIsDir) + .append_raw('\n')); + return LintStatus::PROBLEM_DETECTED; default: break; } - const auto current_buildtrees_dir = paths.build_dir(spec); - const auto current_buildtrees_dir_src = current_buildtrees_dir / "src"; + msg_sink.print(Color::warning, + LocalizedString::from_raw(portfile_cmake) + .append_raw(": ") + .append_raw(WarningPrefix) + .append(msgPortBugMissingLicense) + .append_raw('\n')); - std::vector potential_copyright_files; // We only search in the root of each unpacked source archive to reduce false positives - auto src_dirs = fs.get_directories_non_recursive(current_buildtrees_dir_src, IgnoreErrors{}); - for (auto&& src_dir : src_dirs) + auto src_relative_dirs = Util::fmap(fs.get_directories_non_recursive(build_dir / "src", IgnoreErrors{}), + [](Path&& full) -> Path { return Path(full.filename()); }); + + if (src_relative_dirs.size() == 1) { - for (auto&& src_file : fs.get_regular_files_non_recursive(src_dir, IgnoreErrors{})) + // only one src dir, try to explain the vcpkg_install_copyright line for the user to use + std::vector src_dir_relative_copyright_files; + for (auto&& copyright_filename : copyright_filenames) { - const auto filename = src_file.filename(); - if (Strings::case_insensitive_ascii_equals(filename, "LICENSE") || - Strings::case_insensitive_ascii_equals(filename, "LICENSE.txt") || - Strings::case_insensitive_ascii_equals(filename, "COPYING")) + if (fs.is_regular_file(build_dir / "src" / src_relative_dirs[0] / copyright_filename)) { - potential_copyright_files.push_back(src_file); + src_dir_relative_copyright_files.push_back(copyright_filename); } } + + if (!src_dir_relative_copyright_files.empty()) + { + auto args = Util::fmap(src_dir_relative_copyright_files, [](StringLiteral copyright_file) { + return fmt::format(FMT_COMPILE("\"${{SOURCE_PATH}}/{}\""), copyright_file); + }); + msg_sink.print( + LocalizedString::from_raw(portfile_cmake) + .append_raw(": ") + .append_raw(NotePrefix) + .append(msgPortBugMissingLicenseFixIt, + msg::value = fmt::format(FMT_COMPILE("vcpkg_install_copyright(FILE_LIST {})"), + fmt::join(args, " "))) + .append_raw('\n')); + } + + return LintStatus::PROBLEM_DETECTED; } - msg_sink.println_warning(msgPortBugMissingLicense, msg::package_name = spec.name()); - if (potential_copyright_files.size() == 1) + auto& build_dir_relative_dirs = src_relative_dirs; + add_prefix_to_all(build_dir_relative_dirs, "src"); + std::vector build_dir_relative_copyright_files; + for (auto&& build_dir_relative_dir : build_dir_relative_dirs) { - // if there is only one candidate, provide the cmake lines needed to place it in the proper location - const auto& found_file = potential_copyright_files[0]; - auto found_relative_native = found_file.native(); - found_relative_native.erase(current_buildtrees_dir.native().size() + - 1); // The +1 is needed to remove the "/" - const Path relative_path = found_relative_native; - msg_sink.print(Color::none, - fmt::format("\n vcpkg_install_copyright(FILE_LIST \"${{SOURCE_PATH}}/{}/{}\")\n", - relative_path.generic_u8string(), - found_file.filename())); + for (auto&& copyright_filename : copyright_filenames) + { + if (fs.is_regular_file(build_dir / build_dir_relative_dir / copyright_filename)) + { + build_dir_relative_copyright_files.push_back(build_dir_relative_dir / copyright_filename); + } + } } - else if (potential_copyright_files.size() > 1) + + if (!build_dir_relative_copyright_files.empty()) { - msg_sink.println_warning(msgPortBugFoundCopyrightFiles); - print_paths(msg_sink, potential_copyright_files); + msg_sink.print(LocalizedString::from_raw(portfile_cmake) + .append_raw(": ") + .append_raw(NotePrefix) + .append(msgPortBugFoundCopyrightFiles)); + print_relative_paths( + msg_sink, msgFilesRelativeToTheBuildDirectoryHere, build_dir, build_dir_relative_copyright_files); } + return LintStatus::PROBLEM_DETECTED; } - static LintStatus check_for_exes(const ReadOnlyFilesystem& fs, const Path& package_dir, MessageSink& msg_sink) + static LintStatus check_for_exes(const ReadOnlyFilesystem& fs, + const Path& package_dir, + View bin_prefixes, + const Path& portfile_cmake, + MessageSink& msg_sink) { - std::vector exes = fs.get_regular_files_recursive(package_dir / "bin", IgnoreErrors{}); - Util::erase_remove_if(exes, NotExtensionCaseInsensitive{".exe"}); + std::vector exes; + for (auto&& bin_prefix : bin_prefixes) + { + auto this_bad_exes = + fs.get_regular_files_recursive_lexically_proximate(package_dir / bin_prefix, IgnoreErrors{}); + Util::erase_remove_if(this_bad_exes, NotExtensionCaseInsensitive{".exe"}); + add_prefix_to_all(this_bad_exes, bin_prefix); + Util::Vectors::append(exes, std::move(this_bad_exes)); + } if (!exes.empty()) { - msg_sink.println_warning(msgPortBugFoundExeInBinDir); - print_paths(msg_sink, exes); + msg_sink.print(Color::warning, + LocalizedString::from_raw(portfile_cmake) + .append_raw(": ") + .append_raw(WarningPrefix) + .append(msgPortBugFoundExeInBinDir)); + + print_relative_paths(msg_sink, msgExecutablesRelativeToThePackageDirectoryHere, package_dir, exes); return LintStatus::PROBLEM_DETECTED; } @@ -428,7 +578,7 @@ namespace vcpkg struct PostBuildCheckDllData { - Path path; + Path relative_path; MachineType machine_type; bool is_arm64_ec; bool has_exports; @@ -436,9 +586,11 @@ namespace vcpkg std::vector dependencies; }; - static ExpectedL try_load_dll_data(const ReadOnlyFilesystem& fs, const Path& path) + static ExpectedL try_load_dll_data(const ReadOnlyFilesystem& fs, + const Path& package_dir, + const Path& relative_path) { - auto maybe_file = fs.try_open_for_read(path); + auto maybe_file = fs.try_open_for_read(package_dir / relative_path); auto file = maybe_file.get(); if (!file) { @@ -479,7 +631,7 @@ namespace vcpkg return std::move(maybe_dependencies).error(); } - return PostBuildCheckDllData{path, + return PostBuildCheckDllData{relative_path, metadata->get_machine_type(), metadata->is_arm64_ec(), has_exports, @@ -487,34 +639,39 @@ namespace vcpkg std::move(*dependencies)}; } - static LintStatus check_exports_of_dlls(const BuildPolicies& policies, - const std::vector& dlls_data, + static LintStatus check_exports_of_dlls(const std::vector& dlls_data, + const Path& package_dir, + const Path& portfile_cmake, MessageSink& msg_sink) { - if (policies.is_enabled(BuildPolicy::DLLS_WITHOUT_EXPORTS)) return LintStatus::SUCCESS; - std::vector dlls_with_no_exports; for (const PostBuildCheckDllData& dll_data : dlls_data) { if (!dll_data.has_exports) { - dlls_with_no_exports.push_back(dll_data.path); + dlls_with_no_exports.push_back(dll_data.relative_path); } } if (!dlls_with_no_exports.empty()) { - msg_sink.println_warning(msgPortBugSetDllsWithoutExports); - print_paths(msg_sink, dlls_with_no_exports); + msg_sink.print(Color::warning, + LocalizedString::from_raw(portfile_cmake) + .append_raw(": ") + .append_raw(WarningPrefix) + .append(msgPortBugSetDllsWithoutExports)); + print_relative_paths(msg_sink, msgDllsRelativeToThePackageDirectoryHere, package_dir, dlls_with_no_exports); return LintStatus::PROBLEM_DETECTED; } return LintStatus::SUCCESS; } - static LintStatus check_uwp_bit_of_dlls(StringView expected_system_name, - const std::vector& dlls_data, - MessageSink& msg_sink) + static LintStatus check_appcontainer_bit(StringView expected_system_name, + const Path& package_dir, + const Path& portfile_cmake, + const std::vector& dlls_data, + MessageSink& msg_sink) { if (expected_system_name != "WindowsStore") { @@ -526,14 +683,19 @@ namespace vcpkg { if (!dll_data.has_appcontainer) { - dlls_with_improper_uwp_bit.push_back(dll_data.path); + dlls_with_improper_uwp_bit.push_back(dll_data.relative_path); } } if (!dlls_with_improper_uwp_bit.empty()) { - msg_sink.println_warning(msgPortBugDllAppContainerBitNotSet); - print_paths(msg_sink, dlls_with_improper_uwp_bit); + msg_sink.print(Color::warning, + LocalizedString::from_raw(portfile_cmake) + .append_raw(": ") + .append_raw(WarningPrefix) + .append(msgPortBugDllAppContainerBitNotSet)); + print_relative_paths( + msg_sink, msgDllsRelativeToThePackageDirectoryHere, package_dir, dlls_with_improper_uwp_bit); return LintStatus::PROBLEM_DETECTED; } @@ -542,7 +704,7 @@ namespace vcpkg struct FileAndArch { - Path file; + Path relative_file; std::string actual_arch; }; @@ -580,30 +742,44 @@ namespace vcpkg case MachineType::LLVM_BITCODE: return "llvm-bitcode"; case MachineType::LOONGARCH32: return "loongarch32"; case MachineType::LOONGARCH64: return "loongarch64"; - default: return fmt::format("unknown-{}", static_cast(machine_type)); + default: return fmt::format(FMT_COMPILE("unknown-{}"), static_cast(machine_type)); } } static void print_invalid_architecture_files(const std::string& expected_architecture, + const Path& package_dir, + const Path& portfile_cmake, std::vector binaries_with_invalid_architecture, MessageSink& msg_sink) { - msg_sink.println_warning(msgBuiltWithIncorrectArchitecture); + msg_sink.print(Color::warning, + LocalizedString::from_raw(portfile_cmake) + .append_raw(": ") + .append_raw(WarningPrefix) + .append(msgBuiltWithIncorrectArchitecture, msg::arch = expected_architecture) + .append_raw('\n')); + + auto msg = LocalizedString::from_raw(package_dir) + .append_raw(": ") + .append_raw(NotePrefix) + .append(msgBinariesRelativeToThePackageDirectoryHere) + .append_raw('\n'); for (const FileAndArch& b : binaries_with_invalid_architecture) { - msg_sink.println_warning(LocalizedString().append_indent().append(msgBinaryWithInvalidArchitecture, - msg::path = b.file, - msg::expected = expected_architecture, - msg::actual = b.actual_arch)); + msg.append_raw(NotePrefix) + .append(msgBinaryWithInvalidArchitecture, + msg::path = b.relative_file.generic_u8string(), + msg::arch = b.actual_arch) + .append_raw('\n'); } + + msg_sink.print(msg); } - static LintStatus check_dll_architecture(const std::string& expected_architecture, - const std::vector& dlls_data, - MessageSink& msg_sink) + static void check_dll_architecture(const std::string& expected_architecture, + const std::vector& dlls_data, + std::vector& binaries_with_invalid_architecture) { - std::vector binaries_with_invalid_architecture; - for (const PostBuildCheckDllData& dll_data : dlls_data) { const std::string actual_architecture = get_printable_architecture(dll_data.machine_type); @@ -611,56 +787,51 @@ namespace vcpkg { if (dll_data.machine_type != MachineType::AMD64 || !dll_data.is_arm64_ec) { - binaries_with_invalid_architecture.push_back({dll_data.path, actual_architecture}); + binaries_with_invalid_architecture.push_back({dll_data.relative_path, actual_architecture}); } } else if (expected_architecture != actual_architecture) { - binaries_with_invalid_architecture.push_back({dll_data.path, actual_architecture}); + binaries_with_invalid_architecture.push_back({dll_data.relative_path, actual_architecture}); } } - - if (!binaries_with_invalid_architecture.empty()) - { - print_invalid_architecture_files(expected_architecture, binaries_with_invalid_architecture, msg_sink); - return LintStatus::PROBLEM_DETECTED; - } - - return LintStatus::SUCCESS; } - static std::vector> get_lib_info(const Filesystem& fs, View libs) + static std::vector> get_lib_info(const Filesystem& fs, + const Path& relative_root, + View libs) { std::vector> maybe_lib_infos(libs.size()); - std::transform( - libs.begin(), libs.end(), maybe_lib_infos.begin(), [&fs](const Path& lib) -> Optional { - auto maybe_rfp = fs.try_open_for_read(lib); - - if (auto file_handle = maybe_rfp.get()) - { - auto maybe_lib_info = read_lib_information(*file_handle); - if (auto lib_info = maybe_lib_info.get()) - { - return std::move(*lib_info); - } - return nullopt; - } - return nullopt; - }); + std::transform(libs.begin(), + libs.end(), + maybe_lib_infos.begin(), + [&](const Path& relative_lib) -> Optional { + auto maybe_rfp = fs.try_open_for_read(relative_root / relative_lib); + + if (auto file_handle = maybe_rfp.get()) + { + auto maybe_lib_info = read_lib_information(*file_handle); + if (auto lib_info = maybe_lib_info.get()) + { + return std::move(*lib_info); + } + return nullopt; + } + return nullopt; + }); return maybe_lib_infos; } // lib_infos[n] is the lib info for libs[n] for all n in [0, libs.size()) - static LintStatus check_lib_architecture(const std::string& expected_architecture, - View libs, - View> lib_infos, - MessageSink& msg_sink) + static void check_lib_architecture(const std::string& expected_architecture, + View relative_libs, + View> lib_infos, + std::vector& binaries_with_invalid_architecture) { - std::vector binaries_with_invalid_architecture; - for (size_t i = 0; i < libs.size(); ++i) + for (size_t i = 0; i < relative_libs.size(); ++i) { auto& maybe_lib_information = lib_infos[i]; - auto& lib = libs[i]; + auto& relative_lib = relative_libs[i]; if (!maybe_lib_information.has_value()) { @@ -685,140 +856,193 @@ namespace vcpkg if (!printable_machine_types.empty() && !Util::Vectors::contains(printable_machine_types, expected_architecture)) { - binaries_with_invalid_architecture.push_back({lib, Strings::join(",", printable_machine_types)}); + binaries_with_invalid_architecture.push_back( + {relative_lib, Strings::join(",", printable_machine_types)}); } } + } - if (!binaries_with_invalid_architecture.empty()) + static LintStatus check_no_dlls_present(const Path& package_dir, + const std::vector& relative_dlls, + const Path& portfile_cmake, + MessageSink& msg_sink) + { + if (relative_dlls.empty()) { - print_invalid_architecture_files(expected_architecture, binaries_with_invalid_architecture, msg_sink); - return LintStatus::PROBLEM_DETECTED; + return LintStatus::SUCCESS; } - return LintStatus::SUCCESS; + + msg_sink.print(Color::warning, + LocalizedString::from_raw(portfile_cmake) + .append_raw(": ") + .append_raw(WarningPrefix) + .append(msgPortBugFoundDllInStaticBuild)); + print_relative_paths(msg_sink, msgDllsRelativeToThePackageDirectoryHere, package_dir, relative_dlls); + return LintStatus::PROBLEM_DETECTED; } - static LintStatus check_no_dlls_present(const std::vector& dlls, MessageSink& msg_sink) + static size_t total_size(View> path_sets) { - if (dlls.empty()) + size_t result = 0; + for (auto&& paths : path_sets) { - return LintStatus::SUCCESS; + result += paths.size(); + } + return result; + } + + static void append_binary_set(LocalizedString& ls, View> relative_binary_sets) + { + for (auto&& binary_set : relative_binary_sets) + { + for (auto&& binary : binary_set) + { + auto as_generic = binary; + as_generic.make_generic(); + ls.append_raw(NotePrefix).append_raw(as_generic).append_raw('\n'); + } } - msg_sink.println_warning(msgPortBugFoundDllInStaticBuild); - print_paths(msg_sink, dlls); - return LintStatus::PROBLEM_DETECTED; } - static LintStatus check_matching_debug_and_release_binaries(const std::vector& debug_binaries, - const std::vector& release_binaries, + static LintStatus check_matching_debug_and_release_binaries(const Path& package_dir, + View> relative_debug_binary_sets, + View> relative_release_binary_sets, + const Path& portfile_cmake, MessageSink& msg_sink) { - const size_t debug_count = debug_binaries.size(); - const size_t release_count = release_binaries.size(); + const size_t debug_count = total_size(relative_debug_binary_sets); + const size_t release_count = total_size(relative_release_binary_sets); if (debug_count == release_count) { return LintStatus::SUCCESS; } - msg_sink.println_warning(msgPortBugMismatchedNumberOfBinaries); + msg_sink.print(Color::warning, + LocalizedString::from_raw(portfile_cmake) + .append_raw(": ") + .append_raw(WarningPrefix) + .append(msgPortBugMismatchingNumberOfBinaries) + .append_raw('\n')); + LocalizedString ls = LocalizedString::from_raw(package_dir) + .append_raw(": ") + .append_raw(NotePrefix) + .append(msgBinariesRelativeToThePackageDirectoryHere) + .append_raw('\n'); if (debug_count == 0) { - msg_sink.println(msgPortBugMissingDebugBinaries); + ls.append_raw(NotePrefix).append(msgPortBugMissingDebugBinaries).append_raw('\n'); } else { - msg_sink.println(msgPortBugFoundDebugBinaries, msg::count = debug_count); - print_paths(msg_sink, debug_binaries); + ls.append_raw(NotePrefix).append(msgPortBugFoundDebugBinaries).append_raw('\n'); + append_binary_set(ls, relative_debug_binary_sets); } if (release_count == 0) { - msg_sink.println(msgPortBugMissingReleaseBinaries); + ls.append_raw(NotePrefix).append(msgPortBugMissingReleaseBinaries).append_raw('\n'); } else { - msg_sink.println(msgPortBugFoundReleaseBinaries, msg::count = release_count); - print_paths(msg_sink, release_binaries); + ls.append_raw(NotePrefix).append(msgPortBugFoundReleaseBinaries).append_raw('\n'); + append_binary_set(ls, relative_release_binary_sets); } + msg_sink.print(ls); return LintStatus::PROBLEM_DETECTED; } - static LintStatus check_lib_files_are_available_if_dlls_are_available(const BuildPolicies& policies, - const size_t lib_count, + static LintStatus check_lib_files_are_available_if_dlls_are_available(const size_t lib_count, const size_t dll_count, - const Path& lib_dir, + const Path& portfile_cmake, MessageSink& msg_sink) { - if (policies.is_enabled(BuildPolicy::DLLS_WITHOUT_LIBS)) return LintStatus::SUCCESS; - if (lib_count == 0 && dll_count != 0) { - msg_sink.println_warning(msgPortBugMissingImportedLibs, msg::path = lib_dir); + msg_sink.print(LocalizedString::from_raw(portfile_cmake) + .append_raw(": ") + .append_raw(WarningPrefix) + .append(msgPortBugMissingImportedLibs) + .append_raw('\n')); return LintStatus::PROBLEM_DETECTED; } return LintStatus::SUCCESS; } - static LintStatus check_bin_folders_are_not_present_in_static_build(const ReadOnlyFilesystem& fs, - const Path& package_dir, - MessageSink& msg_sink) + static size_t check_bin_folders_are_not_present_in_static_build(const ReadOnlyFilesystem& fs, + const Path& package_dir, + View bin_prefixes, + const Path& portfile_cmake, + MessageSink& msg_sink) { - const auto bin = package_dir / "bin"; - const auto debug_bin = package_dir / "debug" / "bin"; - - const bool bin_exists = fs.exists(bin, IgnoreErrors{}); - const bool debug_bin_exists = fs.exists(debug_bin, IgnoreErrors{}); - if (!bin_exists && !debug_bin_exists) + std::vector bad_dirs; + for (auto&& bin_prefix : bin_prefixes) { - return LintStatus::SUCCESS; + if (fs.exists(package_dir / bin_prefix, IgnoreErrors{})) + { + bad_dirs.push_back(Path(bin_prefix).generic_u8string()); + } } - if (bin_exists) + if (bad_dirs.empty()) { - msg_sink.println_warning(msgPortBugBinDirExists, msg::path = bin); + return 0; } - if (debug_bin_exists) + for (auto&& bad_dir : bad_dirs) { - msg_sink.println_warning(msgPortBugDebugBinDirExists, msg::path = debug_bin); + msg_sink.print(Color::warning, + LocalizedString::from_raw(portfile_cmake) + .append_raw(": ") + .append_raw(WarningPrefix) + .append(msgPortBugBinDirExists, msg::path = bad_dir) + .append_raw('\n')); } - msg_sink.println_warning(msgPortBugRemoveBinDir); + auto args = Util::fmap(bad_dirs, [](const Path& bad_dir) { + return fmt::format(FMT_COMPILE("\"${{CURRENT_PACKAGES_DIR}}/{}\""), bad_dir); + }); msg_sink.print( - Color::warning, - R"###( if(VCPKG_LIBRARY_LINKAGE STREQUAL "static"))###" - "\n" - R"###( file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/bin" "${CURRENT_PACKAGES_DIR}/debug/bin"))###" - "\n" - R"###( endif())###" - "\n\n"); - - return LintStatus::PROBLEM_DETECTED; + LocalizedString::from_raw(NotePrefix) + .append(msgPortBugRemoveBinDir) + .append_raw('\n') + .append_raw("if(VCPKG_LIBRARY_LINKAGE STREQUAL \"static\")\n") + .append_indent() + .append_raw(fmt::format(FMT_COMPILE("file(REMOVE_RECURSE {})\nendif()\n"), fmt::join(args, " ")))); + return bad_dirs.size(); } - static LintStatus check_no_empty_folders(const ReadOnlyFilesystem& fs, const Path& dir, MessageSink& msg_sink) + static LintStatus check_no_empty_folders(const ReadOnlyFilesystem& fs, + const Path& package_dir, + const Path& portfile_cmake, + MessageSink& msg_sink) { - std::vector empty_directories = fs.get_directories_recursive(dir, IgnoreErrors{}); - Util::erase_remove_if(empty_directories, - [&fs](const Path& current) { return !fs.is_empty(current, IgnoreErrors{}); }); - - if (!empty_directories.empty()) - { - msg_sink.println_warning(msgPortBugFoundEmptyDirectories, msg::path = dir); - print_paths(msg_sink, empty_directories); - - std::string dirs = " file(REMOVE_RECURSE"; - for (auto&& empty_dir : empty_directories) - { - Strings::append(dirs, - " \"${CURRENT_PACKAGES_DIR}", - empty_dir.generic_u8string().substr(dir.generic_u8string().size()), - '"'); - } - dirs += ")\n"; - msg_sink.println_warning(msg::format(msgPortBugRemoveEmptyDirectories).append_raw('\n').append_raw(dirs)); - + std::vector relative_empty_directories = + fs.get_directories_recursive_lexically_proximate(package_dir, IgnoreErrors{}); + Util::erase_remove_if(relative_empty_directories, + [&](const Path& current) { return !fs.is_empty(package_dir / current, IgnoreErrors{}); }); + + if (!relative_empty_directories.empty()) + { + msg_sink.print(Color::warning, + LocalizedString::from_raw(portfile_cmake) + .append_raw(": ") + .append_raw(WarningPrefix) + .append(msgPortBugFoundEmptyDirectories) + .append_raw('\n')); + + auto args = Util::fmap(relative_empty_directories, [](const Path& empty_dir) { + return fmt::format(FMT_COMPILE("\"${{CURRENT_PACKAGES_DIR}}/{}\""), empty_dir.generic_u8string()); + }); + msg_sink.print( + LocalizedString::from_raw(package_dir) + .append_raw(": ") + .append_raw(NotePrefix) + .append(msgDirectoriesRelativeToThePackageDirectoryHere) + .append_raw('\n') + .append_raw(NotePrefix) + .append_raw(fmt::format(FMT_COMPILE("file(REMOVE_RECURSE {})\n"), fmt::join(args, " ")))); return LintStatus::PROBLEM_DETECTED; } @@ -826,12 +1050,14 @@ namespace vcpkg } static LintStatus check_pkgconfig_dir_only_in_lib_dir(const ReadOnlyFilesystem& fs, - const Path& dir_raw, + const Path& package_dir, + View relative_all_files, + const Path& portfile_cmake, MessageSink& msg_sink) { struct MisplacedFile { - Path path; + Path relative_path; enum class Type { Release, @@ -844,20 +1070,23 @@ namespace vcpkg bool contains_debug = false; bool contains_share = false; - auto dir = dir_raw.lexically_normal().generic_u8string(); // force /s + static constexpr StringLiteral share_dir = "share" VCPKG_PREFERRED_SEPARATOR "pkgconfig"; + static constexpr StringLiteral lib_dir = "lib" VCPKG_PREFERRED_SEPARATOR "pkgconfig"; + static constexpr StringLiteral debug_dir = + "debug" VCPKG_PREFERRED_SEPARATOR "lib" VCPKG_PREFERRED_SEPARATOR "pkgconfig"; - const auto share_dir = Path(dir) / "share" / "pkgconfig"; - const auto lib_dir = Path(dir) / "lib" / "pkgconfig"; - const auto debug_dir = Path(dir) / "debug" / "lib" / "pkgconfig"; - for (Path& path : fs.get_regular_files_recursive(dir, IgnoreErrors{})) + static constexpr StringLiteral generic_share_dir = "share/pkgconfig"; + static constexpr StringLiteral generic_lib_dir = "lib/pkgconfig"; + static constexpr StringLiteral generic_debug_dir = "debug/lib/pkgconfig"; + for (const Path& path : relative_all_files) { if (!Strings::ends_with(path, ".pc")) continue; - const auto parent_path = Path(path.parent_path()); + const auto parent_path = path.parent_path(); // Always allow .pc files at 'lib/pkgconfig' and 'debug/lib/pkgconfig' if (parent_path == lib_dir || parent_path == debug_dir) continue; - const bool contains_libs = - Util::any_of(fs.read_lines(path).value_or_exit(VCPKG_LINE_INFO), [](const std::string& line) { + const bool contains_libs = Util::any_of( + fs.read_lines(package_dir / path).value_or_exit(VCPKG_LINE_INFO), [](const std::string& line) { if (Strings::starts_with(line, "Libs")) { // only consider "Libs:" or "Libs.private:" directives when they have a value @@ -872,71 +1101,86 @@ namespace vcpkg { if (parent_path == share_dir) continue; contains_share = true; - misplaced_pkgconfig_files.push_back({std::move(path), MisplacedFile::Type::Share}); + misplaced_pkgconfig_files.push_back({path, MisplacedFile::Type::Share}); continue; } - const bool is_debug = Strings::starts_with(path, Path(dir) / "debug"); + const bool is_debug = Strings::starts_with(path, "debug" VCPKG_PREFERRED_SEPARATOR); if (is_debug) { - misplaced_pkgconfig_files.push_back({std::move(path), MisplacedFile::Type::Debug}); + misplaced_pkgconfig_files.push_back({path, MisplacedFile::Type::Debug}); contains_debug = true; } else { - misplaced_pkgconfig_files.push_back({std::move(path), MisplacedFile::Type::Release}); + misplaced_pkgconfig_files.push_back({path, MisplacedFile::Type::Release}); contains_release = true; } } if (!misplaced_pkgconfig_files.empty()) { - msg_sink.println_warning(msgPortBugMisplacedPkgConfigFiles); - for (const auto& item : misplaced_pkgconfig_files) + msg_sink.print(Color::warning, + LocalizedString::from_raw(portfile_cmake) + .append_raw(": ") + .append_raw(WarningPrefix) + .append(msgPortBugMisplacedPkgConfigFiles)); + print_relative_paths(msg_sink, + msgFilesRelativeToThePackageDirectoryHere, + package_dir, + Util::fmap(misplaced_pkgconfig_files, + [](const MisplacedFile& mf) -> Path { return mf.relative_path; })); + + msg_sink.print(LocalizedString::from_raw(NotePrefix).append(msgPortBugMovePkgConfigFiles).append_raw('\n')); { - msg_sink.print(Color::warning, fmt::format(" {}\n", item.path)); - } - msg_sink.println(Color::warning, msgPortBugMovePkgConfigFiles); - - std::string create_directory_line(" file(MAKE_DIRECTORY"); - if (contains_release) - { - create_directory_line += R"###( "${CURRENT_PACKAGES_DIR}/lib/pkgconfig")###"; - } + auto create_directory_line = LocalizedString::from_raw("file(MAKE_DIRECTORY"); + std::vector directories; + if (contains_debug) + { + directories.push_back(generic_debug_dir); + } - if (contains_debug) - { - create_directory_line += R"###( "${CURRENT_PACKAGES_DIR}/lib/debug/pkgconfig")###"; - } + if (contains_release) + { + directories.push_back(generic_lib_dir); + } - if (contains_share) - { - create_directory_line += R"###( "${CURRENT_PACKAGES_DIR}/share/pkgconfig")###"; - } + if (contains_share) + { + directories.push_back(generic_share_dir); + } - create_directory_line.append(")\n"); + for (auto&& directory : directories) + { + create_directory_line.append_raw( + fmt::format(FMT_COMPILE(R"###( "${{CURRENT_PACKAGES_DIR}}/{}")###"), directory)); + } - msg_sink.print(Color::warning, create_directory_line); + create_directory_line.append_raw(")\n"); + msg_sink.print(create_directory_line); + } // destroy create_directory_line for (const auto& item : misplaced_pkgconfig_files) { - auto relative = item.path.native().substr(dir.size()); - std::string rename_line(R"###( file(RENAME "${CURRENT_PACKAGES_DIR})###"); - rename_line.append(relative); - rename_line.append(R"###(" "${CURRENT_PACKAGES_DIR}/)###"); + const StringLiteral* dir; switch (item.type) { - case MisplacedFile::Type::Debug: rename_line.append("debug/lib/pkgconfig/"); break; - case MisplacedFile::Type::Release: rename_line.append("lib/pkgconfig/"); break; - case MisplacedFile::Type::Share: rename_line.append("share/pkgconfig/"); break; + case MisplacedFile::Type::Debug: dir = &generic_debug_dir; break; + case MisplacedFile::Type::Release: dir = &generic_lib_dir; break; + case MisplacedFile::Type::Share: dir = &generic_share_dir; break; + default: Checks::unreachable(VCPKG_LINE_INFO); } - rename_line.append(item.path.filename().to_string()); - rename_line.append("\")\n"); - msg_sink.print(Color::warning, rename_line); + + msg_sink.print(LocalizedString::from_raw(fmt::format( + FMT_COMPILE(R"###(file(RENAME "${{CURRENT_PACKAGES_DIR}}/{}" "${{CURRENT_PACKAGES_DIR}}/{}/{}"))###" + "\n"), + item.relative_path.generic_u8string(), + *dir, + item.relative_path.filename()))); } - msg_sink.print(Color::warning, " vcpkg_fixup_pkgconfig()\n "); - msg_sink.println(Color::warning, msgPortBugRemoveEmptyDirs); + msg_sink.print(LocalizedString::from_raw("vcpkg_fixup_pkgconfig()\n")); + msg_sink.println(msgPortBugRemoveEmptyDirs); return LintStatus::PROBLEM_DETECTED; } @@ -944,21 +1188,43 @@ namespace vcpkg return LintStatus::SUCCESS; } - struct BuildTypeAndFile + // lib_infos[n] is the lib info for libs[n] for all n in [0, libs.size()) + struct LinkageAndBuildType { - Path file; - bool has_static_release = false; - bool has_static_debug = false; - bool has_dynamic_release = false; - bool has_dynamic_debug = false; + LinkageType kind; + bool release; + + friend bool operator==(const LinkageAndBuildType& lhs, const LinkageAndBuildType& rhs) noexcept + { + return lhs.kind == rhs.kind && lhs.release == rhs.release; + } + friend bool operator!=(const LinkageAndBuildType& lhs, const LinkageAndBuildType& rhs) noexcept + { + return !(lhs == rhs); + } + + bool operator<(const LinkageAndBuildType& other) const noexcept + { + if (static_cast(kind) < static_cast(other.kind)) + { + return true; + } + + if (static_cast(kind) > static_cast(other.kind)) + { + return false; + } + + return release < other.release; + } }; - static LocalizedString format_linkage(LinkageType linkage, bool release) + static LocalizedString to_string(const LinkageAndBuildType& linkage) { - switch (linkage) + switch (linkage.kind) { case LinkageType::Dynamic: - if (release) + if (linkage.release) { return msg::format(msgLinkageDynamicRelease); } @@ -968,7 +1234,7 @@ namespace vcpkg } break; case LinkageType::Static: - if (release) + if (linkage.release) { return msg::format(msgLinkageStaticRelease); } @@ -981,18 +1247,23 @@ namespace vcpkg } } - // lib_infos[n] is the lib info for libs[n] for all n in [0, libs.size()) - static LintStatus check_crt_linkage_of_libs(const BuildInfo& build_info, - bool expect_release, - const std::vector& libs, - View> lib_infos, - MessageSink& msg_sink) + struct FileAndLinkages + { + Path relative_file; + std::vector linkages; + }; + + static void check_crt_group_linkage_of_libs( + LinkageAndBuildType expected, + const Path& relative_root, + const std::vector& relative_libs, + View> lib_infos, + std::map>& groups_of_invalid_crt) { - std::vector libs_with_invalid_crt; - for (size_t i = 0; i < libs.size(); ++i) + for (size_t i = 0; i < relative_libs.size(); ++i) { auto& maybe_lib_info = lib_infos[i]; - auto& lib = libs[i]; + auto& relative_lib = relative_libs[i]; if (!maybe_lib_info.has_value()) { @@ -1000,106 +1271,87 @@ namespace vcpkg } auto&& lib_info = maybe_lib_info.value_or_exit(VCPKG_LINE_INFO); - Debug::println( - "The lib ", lib.native(), " has directives: ", Strings::join(" ", lib_info.linker_directives)); + Debug::println("The lib ", + (relative_root / relative_lib).native(), + " has directives: ", + Strings::join(" ", lib_info.linker_directives)); - BuildTypeAndFile this_lib{lib}; - constexpr static StringLiteral static_release_crt = "/DEFAULTLIB:LIBCMT"; - constexpr static StringLiteral static_debug_crt = "/DEFAULTLIB:LIBCMTd"; - constexpr static StringLiteral dynamic_release_crt = "/DEFAULTLIB:MSVCRT"; + FileAndLinkages this_lib{relative_lib}; constexpr static StringLiteral dynamic_debug_crt = "/DEFAULTLIB:MSVCRTd"; + constexpr static StringLiteral dynamic_release_crt = "/DEFAULTLIB:MSVCRT"; + constexpr static StringLiteral static_debug_crt = "/DEFAULTLIB:LIBCMTd"; + constexpr static StringLiteral static_release_crt = "/DEFAULTLIB:LIBCMT"; for (auto&& directive : lib_info.linker_directives) { - if (Strings::case_insensitive_ascii_equals(directive, static_release_crt)) + if (Strings::case_insensitive_ascii_equals(directive, dynamic_debug_crt)) { - this_lib.has_static_release = true; + this_lib.linkages.push_back(LinkageAndBuildType{LinkageType::Dynamic, false}); } - else if (Strings::case_insensitive_ascii_equals(directive, static_debug_crt)) + else if (Strings::case_insensitive_ascii_equals(directive, dynamic_release_crt)) { - this_lib.has_static_debug = true; + this_lib.linkages.push_back(LinkageAndBuildType{LinkageType::Dynamic, true}); } - else if (Strings::case_insensitive_ascii_equals(directive, dynamic_release_crt)) + else if (Strings::case_insensitive_ascii_equals(directive, static_debug_crt)) { - this_lib.has_dynamic_release = true; + this_lib.linkages.push_back(LinkageAndBuildType{LinkageType::Static, false}); } - else if (Strings::case_insensitive_ascii_equals(directive, dynamic_debug_crt)) + else if (Strings::case_insensitive_ascii_equals(directive, static_release_crt)) { - this_lib.has_dynamic_debug = true; + this_lib.linkages.push_back(LinkageAndBuildType{LinkageType::Static, true}); } } - bool fail = false; - if (expect_release) - { - fail |= this_lib.has_static_debug; - fail |= this_lib.has_dynamic_debug; - } - else - { - fail |= this_lib.has_static_release; - fail |= this_lib.has_dynamic_release; - } - - switch (build_info.crt_linkage) - { - case LinkageType::Dynamic: - fail |= this_lib.has_static_debug; - fail |= this_lib.has_static_release; - break; - case LinkageType::Static: - fail |= this_lib.has_dynamic_debug; - fail |= this_lib.has_dynamic_release; - break; - default: Checks::unreachable(VCPKG_LINE_INFO); - } - - if (fail) + Util::sort_unique_erase(this_lib.linkages); + if (this_lib.linkages.size() > 1 || (this_lib.linkages.size() == 1 && this_lib.linkages[0] != expected)) { - libs_with_invalid_crt.push_back(std::move(this_lib)); + groups_of_invalid_crt[expected].push_back(std::move(this_lib)); } } + } - if (!libs_with_invalid_crt.empty()) + static LintStatus check_crt_linkage_of_libs( + const Path& package_dir, + const Path& portfile_cmake, + std::map>& groups_of_invalid_crt, + MessageSink& msg_sink) + { + if (groups_of_invalid_crt.empty()) { - msg_sink.println_warning(msgPortBugInvalidCrtLinkage, - msg::expected = format_linkage(build_info.crt_linkage, expect_release)); - std::vector printed_linkages; - for (const BuildTypeAndFile& btf : libs_with_invalid_crt) - { - printed_linkages.clear(); - LocalizedString this_entry; - this_entry.append_indent().append(msgPortBugInvalidCrtLinkageEntry, msg::path = btf.file); - if (btf.has_dynamic_debug) - { - printed_linkages.push_back(msg::format(msgLinkageDynamicDebug)); - } - - if (btf.has_dynamic_release) - { - printed_linkages.push_back(msg::format(msgLinkageDynamicRelease)); - } - - if (btf.has_static_debug) - { - printed_linkages.push_back(msg::format(msgLinkageStaticDebug)); - } + return LintStatus::SUCCESS; + } - if (btf.has_static_release) + msg_sink.print(Color::warning, + LocalizedString::from_raw(portfile_cmake) + .append_raw(": ") + .append_raw(WarningPrefix) + .append(msgPortBugInvalidCrtLinkageHeader) + .append_raw('\n')); + + msg_sink.print(LocalizedString::from_raw(package_dir) + .append_raw(": ") + .append_raw(NotePrefix) + .append(msgBinariesRelativeToThePackageDirectoryHere) + .append_raw('\n')); + for (auto&& group : groups_of_invalid_crt) + { + msg_sink.print(LocalizedString::from_raw(NotePrefix) + .append(msgPortBugInvalidCrtLinkageCrtGroup, msg::expected = to_string(group.first)) + .append_raw('\n')); + for (auto&& file : group.second) + { + for (auto&& linkage : file.linkages) { - printed_linkages.push_back(msg::format(msgLinkageStaticRelease)); + msg_sink.print(LocalizedString::from_raw(NotePrefix) + .append(msgPortBugInvalidCrtLinkageEntry, + msg::path = file.relative_file.generic_u8string(), + msg::actual = to_string(linkage)) + .append_raw('\n')); } - - this_entry.append_floating_list(2, printed_linkages); - msg_sink.println(this_entry); } - - msg_sink.println(msg::format(msgPortBugInspectFiles, msg::extension = "lib") - .append_raw("\n dumpbin.exe /directives mylibfile.lib")); - return LintStatus::PROBLEM_DETECTED; } - return LintStatus::SUCCESS; + return LintStatus::PROBLEM_DETECTED; } struct OutdatedDynamicCrtAndFile @@ -1109,12 +1361,11 @@ namespace vcpkg }; static LintStatus check_outdated_crt_linkage_of_dlls(const std::vector& dlls_data, - const BuildInfo& build_info, + const Path& package_dir, const PreBuildInfo& pre_build_info, + const Path& portfile_cmake, MessageSink& msg_sink) { - if (build_info.policies.is_enabled(BuildPolicy::ALLOW_OBSOLETE_MSVCRT)) return LintStatus::SUCCESS; - const auto outdated_crts = get_outdated_dynamic_crts(pre_build_info.platform_toolset); std::vector dlls_with_outdated_crt; @@ -1125,7 +1376,7 @@ namespace vcpkg if (Util::Vectors::contains( dll_data.dependencies, outdated_crt, Strings::case_insensitive_ascii_equals)) { - dlls_with_outdated_crt.push_back({dll_data.path, outdated_crt}); + dlls_with_outdated_crt.push_back({dll_data.relative_path, outdated_crt}); break; } } @@ -1133,13 +1384,18 @@ namespace vcpkg if (!dlls_with_outdated_crt.empty()) { - msg_sink.println_warning(msgPortBugOutdatedCRT); - for (const OutdatedDynamicCrtAndFile& btf : dlls_with_outdated_crt) - { - msg_sink.print(Color::warning, fmt::format(" {}:{}\n", btf.file, btf.outdated_crt)); - } - msg_sink.println(msg::format(msgPortBugInspectFiles, msg::extension = "dll") - .append_raw("\n dumpbin.exe /dependents mylibfile.dll")); + msg_sink.print(Color::warning, + LocalizedString::from_raw(portfile_cmake) + .append_raw(": ") + .append_raw(WarningPrefix) + .append(msgPortBugOutdatedCRT)); + + print_relative_paths( + msg_sink, + msgDllsRelativeToThePackageDirectoryHere, + package_dir, + Util::fmap(std::move(dlls_with_outdated_crt), + [](OutdatedDynamicCrtAndFile&& btf) -> Path { return std::move(btf.file); })); return LintStatus::PROBLEM_DETECTED; } @@ -1147,7 +1403,9 @@ namespace vcpkg } static LintStatus check_bad_kernel32_from_xbox(const std::vector& dlls_data, + const Path& package_dir, const PreBuildInfo& pre_build_info, + const Path& portfile_cmake, MessageSink& msg_sink) { if (!pre_build_info.target_is_xbox) @@ -1160,7 +1418,6 @@ namespace vcpkg { for (auto&& dependency : dll_data.dependencies) { - Debug::println("Dependency: ", dependency); if (Strings::case_insensitive_ascii_equals("kernel32.dll", dependency)) { bad_dlls.push_back(&dll_data); @@ -1174,30 +1431,62 @@ namespace vcpkg return LintStatus::SUCCESS; } - msg_sink.println(msgPortBugKernel32FromXbox); - for (auto&& bad_dll : bad_dlls) - { - msg_sink.println(LocalizedString{}.append_indent().append_raw(bad_dll->path)); - } + msg_sink.print(Color::warning, + LocalizedString::from_raw(portfile_cmake) + .append_raw(": ") + .append_raw(WarningPrefix) + .append(msgPortBugKernel32FromXbox)); + print_relative_paths( + msg_sink, + msgDllsRelativeToThePackageDirectoryHere, + package_dir, + Util::fmap(bad_dlls, [](const PostBuildCheckDllData* btf) -> Path { return btf->relative_path; })); - msg_sink.println(msg::format(msgPortBugInspectFiles, msg::extension = "dll") - .append_raw("\n dumpbin.exe /dependents mylibfile.dll")); return LintStatus::PROBLEM_DETECTED; } - static LintStatus check_no_files_in_dir(const ReadOnlyFilesystem& fs, const Path& dir, MessageSink& msg_sink) + static LintStatus check_no_regular_files_in_dirs(const ReadOnlyFilesystem& fs, + const Path& package_dir, + const Path& portfile_cmake, + View prefixes, + MessageSink& msg_sink) { - std::vector misplaced_files = fs.get_regular_files_non_recursive(dir, IgnoreErrors{}); - Util::erase_remove_if(misplaced_files, [](const Path& target) { - const auto filename = target.filename(); - return filename == "CONTROL" || filename == "BUILD_INFO" || filename == ".DS_Store"; - }); + std::vector misplaced_files; + for (auto&& prefix : prefixes) + { + auto start_in = package_dir; + if (!prefix.empty()) + { + start_in /= prefix; + } + + for (auto&& absolute_path : fs.get_regular_files_non_recursive(start_in, IgnoreErrors{})) + { + auto filename = absolute_path.filename(); + if (filename == "CONTROL" || filename == "BUILD_INFO" || filename == ".DS_Store") + { + continue; + } + + if (prefix.empty()) + { + misplaced_files.emplace_back(filename); + } + else + { + misplaced_files.emplace_back(Path(prefix) / filename); + } + } + } if (!misplaced_files.empty()) { - msg_sink.println_warning(msg::format(msgPortBugMisplacedFiles, msg::path = dir).append_raw('\n')); - print_paths(msg_sink, misplaced_files); - msg_sink.println_warning(msgPortBugMisplacedFilesCont); + msg_sink.print(Color::warning, + LocalizedString::from_raw(portfile_cmake) + .append_raw(": ") + .append_raw(WarningPrefix) + .append(msgPortBugMisplacedFiles)); + print_relative_paths(msg_sink, msgFilesRelativeToThePackageDirectoryHere, package_dir, misplaced_files); return LintStatus::PROBLEM_DETECTED; } @@ -1237,12 +1526,14 @@ namespace vcpkg } static LintStatus check_no_absolute_paths_in(const ReadOnlyFilesystem& fs, - const Path& dir, - Span absolute_paths, + const Path& package_dir, + View prohibited_absolute_paths, + View relative_all_files, + const Path& portfile_cmake, MessageSink& msg_sink) { std::vector string_paths; - for (const auto& path : absolute_paths) + for (const auto& path : prohibited_absolute_paths) { #if defined(_WIN32) // As supplied, all /s, and all \s @@ -1252,7 +1543,7 @@ namespace vcpkg string_paths.push_back(path_preferred.native()); string_paths.push_back(path.generic_u8string()); #else - string_paths.push_back(path.native()); + string_paths.push_back(paths.native()); #endif } @@ -1262,15 +1553,22 @@ namespace vcpkg Util::fmap(string_paths, [](std::string& s) { return Strings::vcpkg_searcher(s.begin(), s.end()); }); std::vector failing_files; + bool any_pc_file_fails = false; { std::mutex mtx; - auto files = fs.get_regular_files_recursive(dir, IgnoreErrors{}); - - parallel_for_each(files, [&](const Path& file) { - if (file_contains_absolute_paths(fs, file, searcher_paths)) + parallel_for_each(relative_all_files, [&](const Path& file) { + if (file_contains_absolute_paths(fs, package_dir / file, searcher_paths)) { - std::lock_guard lock{mtx}; - failing_files.push_back(file); + if (Strings::ends_with(file, ".pc")) + { + std::lock_guard lock{mtx}; + any_pc_file_fails = true; + failing_files.push_back(file); + } + else + { + failing_files.push_back(file); + } } }); } // destroy mtx @@ -1281,19 +1579,27 @@ namespace vcpkg } Util::sort(failing_files); - auto error_message = msg::format(msgFilesContainAbsolutePath1); - for (auto&& absolute_path : absolute_paths) + msg_sink.print(Color::warning, + LocalizedString::from_raw(portfile_cmake) + .append_raw(": ") + .append_raw(WarningPrefix) + .append(msgFilesContainAbsolutePath1)); + for (auto&& absolute_path : prohibited_absolute_paths) { - error_message.append_raw('\n').append_indent().append_raw(absolute_path); + msg_sink.print(LocalizedString::from_raw("\n").append_raw(NotePrefix).append_raw(absolute_path)); } - error_message.append_raw('\n').append(msgFilesContainAbsolutePath2); - for (auto&& failure : failing_files) + if (any_pc_file_fails) { - error_message.append_raw('\n').append_indent().append_raw(failure); + msg_sink.print(LocalizedString::from_raw("\n") + .append_raw(portfile_cmake) + .append_raw(": ") + .append_raw(NotePrefix) + .append(msgFilesContainAbsolutePathPkgconfigNote)); } - msg_sink.println_warning(error_message); + msg_sink.print(LocalizedString::from_raw("\n").append_raw(NotePrefix).append(msgFilesContainAbsolutePath2)); + print_relative_paths(msg_sink, msgFilesRelativeToThePackageDirectoryHere, package_dir, failing_files); return LintStatus::PROBLEM_DETECTED; } @@ -1301,13 +1607,14 @@ namespace vcpkg static size_t perform_post_build_checks_dll_loads(const ReadOnlyFilesystem& fs, std::vector& dlls_data, - const std::vector& dll_files, + const Path& package_dir, + const std::vector& relative_dll_files, MessageSink& msg_sink) { size_t error_count = 0; - for (const Path& dll : dll_files) + for (const Path& relative_dll : relative_dll_files) { - auto maybe_dll_data = try_load_dll_data(fs, dll); + auto maybe_dll_data = try_load_dll_data(fs, package_dir, relative_dll); if (auto dll_data = maybe_dll_data.get()) { dlls_data.emplace_back(std::move(*dll_data)); @@ -1322,148 +1629,284 @@ namespace vcpkg return error_count; } + static std::vector find_relative_static_libs(const ReadOnlyFilesystem& fs, + const bool windows_target, + const Path& package_dir, + const Path& prefix) + { + View lib_extensions; + if (windows_target) + { + static constexpr StringLiteral windows_lib_extensions[] = {".lib"}; + lib_extensions = windows_lib_extensions; + } + else + { + static constexpr StringLiteral unix_lib_extensions[] = {".so", ".a", ".dylib"}; + lib_extensions = unix_lib_extensions; + } + + std::vector relative_libs = + fs.get_regular_files_recursive_lexically_proximate(package_dir / prefix, IgnoreErrors{}); + Util::erase_remove_if(relative_libs, NotExtensionsCaseInsensitive{lib_extensions}); + add_prefix_to_all(relative_libs, prefix); + return relative_libs; + } + static size_t perform_all_checks_and_return_error_count(const PackageSpec& spec, const VcpkgPaths& paths, const PreBuildInfo& pre_build_info, const BuildInfo& build_info, const Path& port_dir, + const Path& portfile_cmake, MessageSink& msg_sink) { + const bool windows_target = Util::Vectors::contains(windows_system_names, pre_build_info.cmake_system_name); const auto& fs = paths.get_filesystem(); + const auto build_dir = paths.build_dir(spec); const auto package_dir = paths.package_dir(spec); + const bool not_release_only = !pre_build_info.build_type; size_t error_count = 0; - if (build_info.policies.is_enabled(BuildPolicy::EMPTY_PACKAGE)) + auto& policies = build_info.policies; + if (policies.is_enabled(BuildPolicy::CMAKE_HELPER_PORT)) { - return error_count; + // no suppression for these because CMAKE_HELPER_PORT is opt-in + error_count += + check_for_no_files_in_cmake_helper_port_include_directory(fs, package_dir, portfile_cmake, msg_sink); + error_count += check_for_vcpkg_port_config_in_cmake_helper_port( + fs, package_dir, spec.name(), portfile_cmake, msg_sink); + } + else if (!policies.is_enabled(BuildPolicy::EMPTY_INCLUDE_FOLDER)) + { + error_count += check_for_files_in_include_directory(fs, package_dir, portfile_cmake, msg_sink); } - error_count += check_for_files_in_include_directory(fs, build_info.policies, package_dir, msg_sink); - error_count += check_for_restricted_include_files(fs, build_info.policies, package_dir, msg_sink); - error_count += check_for_files_in_debug_include_directory(fs, package_dir, msg_sink); - error_count += check_for_files_in_debug_share_directory(fs, package_dir, msg_sink); - error_count += check_for_vcpkg_port_config(fs, build_info.policies, package_dir, spec, msg_sink); - error_count += check_folder_lib_cmake(fs, package_dir, spec, msg_sink); - error_count += check_for_misplaced_cmake_files(fs, package_dir, spec, msg_sink); - error_count += check_folder_debug_lib_cmake(fs, package_dir, spec, msg_sink); - error_count += check_for_dlls_in_lib_dir(fs, package_dir, msg_sink); - error_count += check_for_dlls_in_lib_dir(fs, package_dir / "debug", msg_sink); - error_count += check_for_copyright_file(fs, spec, package_dir, paths, msg_sink); - error_count += check_for_exes(fs, package_dir, msg_sink); - error_count += check_for_exes(fs, package_dir / "debug", msg_sink); - error_count += check_for_usage_forgot_install(fs, port_dir, package_dir, spec, msg_sink); + if (!policies.is_enabled(BuildPolicy::ALLOW_RESTRICTED_HEADERS)) + { + error_count += check_for_restricted_include_files(fs, package_dir, portfile_cmake, msg_sink); + } + if (!policies.is_enabled(BuildPolicy::ALLOW_DEBUG_INCLUDE)) + { + error_count += check_for_files_in_debug_include_directory(fs, package_dir, portfile_cmake, msg_sink); + } + if (!policies.is_enabled(BuildPolicy::ALLOW_DEBUG_SHARE)) + { + error_count += check_for_files_in_debug_share_directory(fs, package_dir, portfile_cmake, msg_sink); + } + if (!policies.is_enabled(BuildPolicy::SKIP_MISPLACED_CMAKE_FILES_CHECK)) + { + error_count += check_for_misplaced_cmake_files(fs, package_dir, portfile_cmake, msg_sink); + } + if (!policies.is_enabled(BuildPolicy::SKIP_LIB_CMAKE_MERGE_CHECK)) + { + error_count += check_lib_cmake_merge(fs, package_dir, portfile_cmake, msg_sink); + } - const auto debug_lib_dir = package_dir / "debug" / "lib"; - const auto release_lib_dir = package_dir / "lib"; - const auto debug_bin_dir = package_dir / "debug" / "bin"; - const auto release_bin_dir = package_dir / "bin"; + static constexpr StringLiteral debug_lib_prefix = "debug" VCPKG_PREFERRED_SEPARATOR "lib"; + static constexpr StringLiteral release_lib_prefix = "lib"; + static constexpr StringLiteral lib_prefixes[] = {debug_lib_prefix, release_lib_prefix}; + static constexpr StringLiteral debug_bin_prefix = "debug" VCPKG_PREFERRED_SEPARATOR "bin"; + static constexpr StringLiteral release_bin_prefix = "bin"; + static constexpr StringLiteral bin_prefixes[] = {debug_bin_prefix, release_bin_prefix}; - NotExtensionsCaseInsensitive lib_filter; - const bool windows_target = Util::Vectors::contains(windows_system_names, pre_build_info.cmake_system_name); - if (windows_target) + if (windows_target && !policies.is_enabled(BuildPolicy::ALLOW_DLLS_IN_LIB)) { - lib_filter = NotExtensionsCaseInsensitive{{".lib"}}; + error_count += check_for_dlls_in_lib_dirs(fs, package_dir, lib_prefixes, portfile_cmake, msg_sink); } - else + if (!policies.is_enabled(BuildPolicy::SKIP_COPYRIGHT_CHECK)) + { + error_count += check_for_copyright_file(fs, spec.name(), package_dir, build_dir, portfile_cmake, msg_sink); + } + if (windows_target && !policies.is_enabled(BuildPolicy::ALLOW_EXES_IN_BIN)) + { + error_count += check_for_exes(fs, package_dir, bin_prefixes, portfile_cmake, msg_sink); + } + if (!policies.is_enabled(BuildPolicy::SKIP_USAGE_INSTALL_CHECK)) { - lib_filter = NotExtensionsCaseInsensitive{{".so", ".a", ".dylib"}}; + error_count += + check_for_usage_forgot_install(fs, port_dir, package_dir, spec.name(), portfile_cmake, msg_sink); } - std::vector debug_libs = fs.get_regular_files_recursive(debug_lib_dir, IgnoreErrors{}); - Util::erase_remove_if(debug_libs, lib_filter); - std::vector release_libs = fs.get_regular_files_recursive(release_lib_dir, IgnoreErrors{}); - Util::erase_remove_if(release_libs, lib_filter); + std::vector relative_debug_libs = + find_relative_static_libs(fs, windows_target, package_dir, debug_lib_prefix); + std::vector relative_release_libs = + find_relative_static_libs(fs, windows_target, package_dir, release_lib_prefix); + std::vector relative_debug_dlls; + std::vector relative_release_dlls; - if (!pre_build_info.build_type && !build_info.policies.is_enabled(BuildPolicy::MISMATCHED_NUMBER_OF_BINARIES)) + if (windows_target) { - error_count += check_matching_debug_and_release_binaries(debug_libs, release_libs, msg_sink); + relative_debug_dlls = find_relative_dlls(fs, package_dir, debug_bin_prefix); + relative_release_dlls = find_relative_dlls(fs, package_dir, release_bin_prefix); } - if (windows_target) + if (not_release_only && !policies.is_enabled(BuildPolicy::MISMATCHED_NUMBER_OF_BINARIES)) { - Debug::println("Running windows targeting post-build checks"); + View relative_debug_binary_sets[] = {relative_debug_libs, relative_debug_dlls}; + View relative_release_binary_sets[] = {relative_release_libs, relative_release_dlls}; + error_count += check_matching_debug_and_release_binaries( + package_dir, relative_debug_binary_sets, relative_release_binary_sets, portfile_cmake, msg_sink); + } - auto release_lib_info = get_lib_info(fs, release_libs); + if (windows_target) + { Optional>> debug_lib_info; + Optional>> release_lib_info; - // Note that this condition is paired with the debug check_crt_linkage_of_libs below - if (!build_info.policies.is_enabled(BuildPolicy::SKIP_ARCHITECTURE_CHECK) || - !build_info.policies.is_enabled(BuildPolicy::ONLY_RELEASE_CRT)) + // Note that this condition is paired with the guarded calls to check_crt_linkage_of_libs below + if (!policies.is_enabled(BuildPolicy::SKIP_ARCHITECTURE_CHECK) || + !policies.is_enabled(BuildPolicy::SKIP_CRT_LINKAGE_CHECK)) { - debug_lib_info.emplace(get_lib_info(fs, debug_libs)); + debug_lib_info.emplace(get_lib_info(fs, package_dir, relative_debug_libs)); + release_lib_info.emplace(get_lib_info(fs, package_dir, relative_release_libs)); } - if (!build_info.policies.is_enabled(BuildPolicy::SKIP_ARCHITECTURE_CHECK)) + std::vector binaries_with_invalid_architecture; + if (!policies.is_enabled(BuildPolicy::SKIP_ARCHITECTURE_CHECK)) { - error_count += check_lib_architecture( - pre_build_info.target_architecture, debug_libs, *debug_lib_info.get(), msg_sink); - error_count += check_lib_architecture( - pre_build_info.target_architecture, release_libs, release_lib_info, msg_sink); + check_lib_architecture(pre_build_info.target_architecture, + relative_debug_libs, + debug_lib_info.value_or_exit(VCPKG_LINE_INFO), + binaries_with_invalid_architecture); + check_lib_architecture(pre_build_info.target_architecture, + relative_release_libs, + release_lib_info.value_or_exit(VCPKG_LINE_INFO), + binaries_with_invalid_architecture); } - std::vector debug_dlls = fs.get_regular_files_recursive(debug_bin_dir, IgnoreErrors{}); - Util::erase_remove_if(debug_dlls, NotExtensionCaseInsensitive{".dll"}); - std::vector release_dlls = fs.get_regular_files_recursive(release_bin_dir, IgnoreErrors{}); - Util::erase_remove_if(release_dlls, NotExtensionCaseInsensitive{".dll"}); - std::vector dlls_data; - dlls_data.reserve(debug_dlls.size() + release_dlls.size()); - error_count += perform_post_build_checks_dll_loads(fs, dlls_data, debug_dlls, msg_sink); - error_count += perform_post_build_checks_dll_loads(fs, dlls_data, release_dlls, msg_sink); - error_count += check_bad_kernel32_from_xbox(dlls_data, pre_build_info, msg_sink); - - if (!pre_build_info.build_type && - !build_info.policies.is_enabled(BuildPolicy::MISMATCHED_NUMBER_OF_BINARIES)) - error_count += check_matching_debug_and_release_binaries(debug_dlls, release_dlls, msg_sink); - - error_count += check_lib_files_are_available_if_dlls_are_available( - build_info.policies, debug_libs.size(), debug_dlls.size(), debug_lib_dir, msg_sink); - error_count += check_lib_files_are_available_if_dlls_are_available( - build_info.policies, release_libs.size(), release_dlls.size(), release_lib_dir, msg_sink); - - error_count += check_exports_of_dlls(build_info.policies, dlls_data, msg_sink); - error_count += check_uwp_bit_of_dlls(pre_build_info.cmake_system_name, dlls_data, msg_sink); - error_count += check_outdated_crt_linkage_of_dlls(dlls_data, build_info, pre_build_info, msg_sink); - if (!build_info.policies.is_enabled(BuildPolicy::SKIP_ARCHITECTURE_CHECK)) + dlls_data.reserve(relative_debug_dlls.size() + relative_release_dlls.size()); + error_count += + perform_post_build_checks_dll_loads(fs, dlls_data, package_dir, relative_debug_dlls, msg_sink); + error_count += + perform_post_build_checks_dll_loads(fs, dlls_data, package_dir, relative_release_dlls, msg_sink); + if (!policies.is_enabled(BuildPolicy::ALLOW_KERNEL32_FROM_XBOX)) { - error_count += check_dll_architecture(pre_build_info.target_architecture, dlls_data, msg_sink); + error_count += + check_bad_kernel32_from_xbox(dlls_data, package_dir, pre_build_info, portfile_cmake, msg_sink); + } + if (!policies.is_enabled(BuildPolicy::DLLS_WITHOUT_LIBS)) + { + if (check_lib_files_are_available_if_dlls_are_available( + relative_debug_libs.size(), relative_debug_dlls.size(), portfile_cmake, msg_sink) == + LintStatus::PROBLEM_DETECTED) + { + ++error_count; + } + else + { + error_count += check_lib_files_are_available_if_dlls_are_available( + relative_release_libs.size(), relative_release_dlls.size(), portfile_cmake, msg_sink); + } + } + if (!policies.is_enabled(BuildPolicy::DLLS_WITHOUT_EXPORTS)) + { + error_count += check_exports_of_dlls(dlls_data, package_dir, portfile_cmake, msg_sink); + } + if (!policies.is_enabled(BuildPolicy::SKIP_APPCONTAINER_CHECK)) + { + error_count += check_appcontainer_bit( + pre_build_info.cmake_system_name, package_dir, portfile_cmake, dlls_data, msg_sink); + } + if (!policies.is_enabled(BuildPolicy::ALLOW_OBSOLETE_MSVCRT)) + { + error_count += check_outdated_crt_linkage_of_dlls( + dlls_data, package_dir, pre_build_info, portfile_cmake, msg_sink); + } + if (!policies.is_enabled(BuildPolicy::SKIP_ARCHITECTURE_CHECK)) + { + check_dll_architecture( + pre_build_info.target_architecture, dlls_data, binaries_with_invalid_architecture); + } + if (!binaries_with_invalid_architecture.empty()) + { + ++error_count; + print_invalid_architecture_files(pre_build_info.target_architecture, + package_dir, + portfile_cmake, + binaries_with_invalid_architecture, + msg_sink); } - if (build_info.library_linkage == LinkageType::Static && !build_info.policies.is_enabled(BuildPolicy::DLLS_IN_STATIC_LIBRARY)) { - auto& dlls = debug_dlls; - dlls.insert(dlls.end(), - std::make_move_iterator(release_dlls.begin()), - std::make_move_iterator(release_dlls.end())); - error_count += check_no_dlls_present(dlls, msg_sink); - error_count += check_bin_folders_are_not_present_in_static_build(fs, package_dir, msg_sink); + auto& relative_dlls = relative_debug_dlls; + Util::Vectors::append(relative_dlls, std::move(relative_release_dlls)); + error_count += check_no_dlls_present(package_dir, relative_dlls, portfile_cmake, msg_sink); + error_count += check_bin_folders_are_not_present_in_static_build( + fs, package_dir, bin_prefixes, portfile_cmake, msg_sink); } // Note that this condition is paired with the possible initialization of `debug_lib_info` above - if (!build_info.policies.is_enabled(BuildPolicy::ONLY_RELEASE_CRT)) + if (!policies.is_enabled(BuildPolicy::SKIP_CRT_LINKAGE_CHECK)) { - error_count += check_crt_linkage_of_libs( - build_info, false, debug_libs, debug_lib_info.value_or_exit(VCPKG_LINE_INFO), msg_sink); + std::map> groups_of_invalid_crt; + check_crt_group_linkage_of_libs( + LinkageAndBuildType{build_info.crt_linkage, + build_info.policies.is_enabled(BuildPolicy::ONLY_RELEASE_CRT)}, + package_dir, + relative_debug_libs, + debug_lib_info.value_or_exit(VCPKG_LINE_INFO), + groups_of_invalid_crt); + check_crt_group_linkage_of_libs(LinkageAndBuildType{build_info.crt_linkage, true}, + package_dir, + relative_release_libs, + release_lib_info.value_or_exit(VCPKG_LINE_INFO), + groups_of_invalid_crt); + + error_count += check_crt_linkage_of_libs(package_dir, portfile_cmake, groups_of_invalid_crt, msg_sink); } + } + + if (!policies.is_enabled(BuildPolicy::ALLOW_EMPTY_FOLDERS)) + { + error_count += check_no_empty_folders(fs, package_dir, portfile_cmake, msg_sink); + } + if (!policies.is_enabled(BuildPolicy::SKIP_MISPLACED_REGULAR_FILES_CHECK)) + { + static constexpr StringLiteral bad_dirs[] = {"debug", ""}; + error_count += check_no_regular_files_in_dirs(fs, package_dir, portfile_cmake, bad_dirs, msg_sink); + } - error_count += check_crt_linkage_of_libs(build_info, true, release_libs, release_lib_info, msg_sink); + std::vector relative_all_files; + if (!policies.is_enabled(BuildPolicy::SKIP_PKGCONFIG_CHECK) || + !policies.is_enabled(BuildPolicy::SKIP_ABSOLUTE_PATHS_CHECK)) + { + relative_all_files = fs.get_regular_files_recursive_lexically_proximate(package_dir, IgnoreErrors{}); } - error_count += check_no_empty_folders(fs, package_dir, msg_sink); - error_count += check_no_files_in_dir(fs, package_dir, msg_sink); - error_count += check_no_files_in_dir(fs, package_dir / "debug", msg_sink); - error_count += check_pkgconfig_dir_only_in_lib_dir(fs, package_dir, msg_sink); - if (!build_info.policies.is_enabled(BuildPolicy::SKIP_ABSOLUTE_PATHS_CHECK)) + if (!policies.is_enabled(BuildPolicy::SKIP_PKGCONFIG_CHECK)) { - Path tests[] = {package_dir, paths.installed().root(), paths.build_dir(spec), paths.downloads}; - error_count += check_no_absolute_paths_in(fs, package_dir, tests, msg_sink); + error_count += + check_pkgconfig_dir_only_in_lib_dir(fs, package_dir, relative_all_files, portfile_cmake, msg_sink); + } + if (!policies.is_enabled(BuildPolicy::SKIP_ABSOLUTE_PATHS_CHECK)) + { + Path prohibited_absolute_paths[] = { + paths.packages(), paths.installed().root(), paths.buildtrees(), paths.downloads}; + error_count += check_no_absolute_paths_in( + fs, package_dir, prohibited_absolute_paths, relative_all_files, portfile_cmake, msg_sink); } return error_count; } + static bool should_skip_all_post_build_checks(const BuildPolicies& policies, + BuildPolicy tested_policy, + MessageSink& msg_sink) + { + if (policies.is_enabled(tested_policy)) + { + msg_sink.println(LocalizedString::from_raw("-- ").append( + msgSkippingPostBuildValidationDueTo, msg::cmake_var = to_cmake_variable(tested_policy))); + return true; + } + + return false; + } + size_t perform_post_build_lint_checks(const PackageSpec& spec, const VcpkgPaths& paths, const PreBuildInfo& pre_build_info, @@ -1471,15 +1914,27 @@ namespace vcpkg const Path& port_dir, MessageSink& msg_sink) { - msg_sink.println(msgPerformingPostBuildValidation); - const size_t error_count = - perform_all_checks_and_return_error_count(spec, paths, pre_build_info, build_info, port_dir, msg_sink); + auto& policies = build_info.policies; + if (should_skip_all_post_build_checks(policies, BuildPolicy::EMPTY_PACKAGE, msg_sink) || + should_skip_all_post_build_checks(policies, BuildPolicy::SKIP_ALL_POST_BUILD_CHECKS, msg_sink)) + { + return 0; + } + msg_sink.println(LocalizedString::from_raw("-- ").append(msgPerformingPostBuildValidation)); + const auto portfile_cmake = port_dir / FilePortfileDotCMake; + const size_t error_count = perform_all_checks_and_return_error_count( + spec, paths, pre_build_info, build_info, port_dir, portfile_cmake, msg_sink); if (error_count != 0) { - const auto portfile = port_dir / "portfile.cmake"; - msg_sink.println_error(msgFailedPostBuildChecks, msg::count = error_count, msg::path = portfile); + msg_sink.print(Color::warning, + LocalizedString::from_raw(portfile_cmake) + .append_raw(": ") + .append_raw(WarningPrefix) + .append(msgFailedPostBuildChecks, msg::count = error_count) + .append_raw('\n')); } + return error_count; } } From 4c6e0fec3dc123170255004710fde9b7f33dfd9f Mon Sep 17 00:00:00 2001 From: Billy Robert O'Neal III Date: Fri, 10 May 2024 20:12:48 -0700 Subject: [PATCH 02/14] Fix *nix compiler error --- src/vcpkg/postbuildlint.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/vcpkg/postbuildlint.cpp b/src/vcpkg/postbuildlint.cpp index 5abf01c75c..534ff5682c 100644 --- a/src/vcpkg/postbuildlint.cpp +++ b/src/vcpkg/postbuildlint.cpp @@ -1543,7 +1543,7 @@ namespace vcpkg string_paths.push_back(path_preferred.native()); string_paths.push_back(path.generic_u8string()); #else - string_paths.push_back(paths.native()); + string_paths.push_back(path.native()); #endif } From 1589400da6c637c347ac9bc4e4e1b3200cf853ee Mon Sep 17 00:00:00 2001 From: Billy Robert O'Neal III Date: Fri, 10 May 2024 23:30:14 -0700 Subject: [PATCH 03/14] Update vcpkg-scripts SHA. --- vcpkg-init/vcpkg-scripts-sha.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vcpkg-init/vcpkg-scripts-sha.txt b/vcpkg-init/vcpkg-scripts-sha.txt index bbb793327a..02e36c17b5 100644 --- a/vcpkg-init/vcpkg-scripts-sha.txt +++ b/vcpkg-init/vcpkg-scripts-sha.txt @@ -1 +1 @@ -da4b78d35084ec4e9808aa02017028da03b8d2ab +a1212c93cabaa9c5c36c1ffdb4bddd59fdf31e43 From bd3fbaf387ed8401154afcf241b10476fd43b362 Mon Sep 17 00:00:00 2001 From: Billy Robert O'Neal III Date: Mon, 13 May 2024 10:32:30 -0700 Subject: [PATCH 04/14] Sort copyright directories and put missing lock in --- src/vcpkg/postbuildlint.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/vcpkg/postbuildlint.cpp b/src/vcpkg/postbuildlint.cpp index 534ff5682c..bf21e4fc0b 100644 --- a/src/vcpkg/postbuildlint.cpp +++ b/src/vcpkg/postbuildlint.cpp @@ -518,6 +518,7 @@ namespace vcpkg return LintStatus::PROBLEM_DETECTED; } + Util::sort(src_relative_dirs); auto& build_dir_relative_dirs = src_relative_dirs; add_prefix_to_all(build_dir_relative_dirs, "src"); std::vector build_dir_relative_copyright_files; @@ -1567,6 +1568,7 @@ namespace vcpkg } else { + std::lock_guard lock{mtx}; failing_files.push_back(file); } } From 70bc2c97a0d6ebb7c12c537733f869a45e45bbb9 Mon Sep 17 00:00:00 2001 From: Billy Robert O'Neal III Date: Mon, 13 May 2024 14:11:50 -0700 Subject: [PATCH 05/14] Add a sort to make tests work on *nix. --- src/vcpkg/postbuildlint.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/vcpkg/postbuildlint.cpp b/src/vcpkg/postbuildlint.cpp index bf21e4fc0b..8438f1bef4 100644 --- a/src/vcpkg/postbuildlint.cpp +++ b/src/vcpkg/postbuildlint.cpp @@ -1877,6 +1877,7 @@ namespace vcpkg !policies.is_enabled(BuildPolicy::SKIP_ABSOLUTE_PATHS_CHECK)) { relative_all_files = fs.get_regular_files_recursive_lexically_proximate(package_dir, IgnoreErrors{}); + Util::sort(relative_all_files); } if (!policies.is_enabled(BuildPolicy::SKIP_PKGCONFIG_CHECK)) From 187a9a12b4630027b390fae34392458bb25e8e2b Mon Sep 17 00:00:00 2001 From: Billy Robert O'Neal III Date: Wed, 29 May 2024 13:36:20 -0700 Subject: [PATCH 06/14] Fix the empty directories message to be the same sort order on all platforms. --- src/vcpkg/postbuildlint.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/vcpkg/postbuildlint.cpp b/src/vcpkg/postbuildlint.cpp index 8438f1bef4..f3829c9d42 100644 --- a/src/vcpkg/postbuildlint.cpp +++ b/src/vcpkg/postbuildlint.cpp @@ -1023,9 +1023,9 @@ namespace vcpkg fs.get_directories_recursive_lexically_proximate(package_dir, IgnoreErrors{}); Util::erase_remove_if(relative_empty_directories, [&](const Path& current) { return !fs.is_empty(package_dir / current, IgnoreErrors{}); }); - if (!relative_empty_directories.empty()) { + Util::sort(relative_empty_directories); msg_sink.print(Color::warning, LocalizedString::from_raw(portfile_cmake) .append_raw(": ") From 154d1bd0bd732d3b9aa9101bd6e8c86e705c2e6b Mon Sep 17 00:00:00 2001 From: Billy Robert O'Neal III Date: Thu, 6 Jun 2024 18:08:31 -0700 Subject: [PATCH 07/14] Collapse find overloads as requested by @ras0219-msft --- include/vcpkg/base/util.h | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/include/vcpkg/base/util.h b/include/vcpkg/base/util.h index 11dd46a135..e06d0329f1 100644 --- a/include/vcpkg/base/util.h +++ b/include/vcpkg/base/util.h @@ -47,12 +47,11 @@ namespace vcpkg::Util template bool contains(const Vec& container, const Key& item) { - return std::find(container.begin(), container.end(), item) != container.end(); - } - template - bool contains(const Vec (&container)[N], const Key& item) - { - return std::find(container, container + N, item) != container + N; + using std::begin; + using std::end; + const auto first = begin(container); + const auto last = end(container); + return std::find(first, last, item) != last; } template std::vector concat(View r1, View r2) From 8426e48f7bfd20b11eb24e4e54b01424bf060205 Mon Sep 17 00:00:00 2001 From: Billy Robert O'Neal III Date: Thu, 6 Jun 2024 18:16:06 -0700 Subject: [PATCH 08/14] Audit for "prefix" -> "relative_path" as requested by @ras0219-msft --- src/vcpkg/postbuildlint.cpp | 80 ++++++++++++++++++------------------- 1 file changed, 40 insertions(+), 40 deletions(-) diff --git a/src/vcpkg/postbuildlint.cpp b/src/vcpkg/postbuildlint.cpp index f3829c9d42..2d51864dc5 100644 --- a/src/vcpkg/postbuildlint.cpp +++ b/src/vcpkg/postbuildlint.cpp @@ -32,12 +32,12 @@ namespace vcpkg static void print_relative_paths(MessageSink& msg_sink, msg::MessageT<> kind_prefix, - const Path& relative_prefix_dir, + const Path& relative_dir, const std::vector& relative_paths) { auto ls = LocalizedString() .append_raw('\n') - .append_raw(relative_prefix_dir) + .append_raw(relative_dir) .append_raw(": ") .append_raw(NotePrefix) .append(kind_prefix) @@ -418,25 +418,25 @@ namespace vcpkg static std::vector find_relative_dlls(const ReadOnlyFilesystem& fs, const Path& package_dir, - StringLiteral prefix) + StringLiteral relative_dir) { std::vector relative_dlls = - fs.get_regular_files_recursive_lexically_proximate(package_dir / prefix, IgnoreErrors{}); + fs.get_regular_files_recursive_lexically_proximate(package_dir / relative_dir, IgnoreErrors{}); Util::erase_remove_if(relative_dlls, NotExtensionCaseInsensitive{".dll"}); - add_prefix_to_all(relative_dlls, prefix); + add_prefix_to_all(relative_dlls, relative_dir); return relative_dlls; } static LintStatus check_for_dlls_in_lib_dirs(const ReadOnlyFilesystem& fs, const Path& package_dir, - View lib_dir_prefixes, + View lib_dir_relative_paths, const Path& portfile_cmake, MessageSink& msg_sink) { std::vector bad_dlls; - for (auto&& prefix : lib_dir_prefixes) + for (auto&& relative_path : lib_dir_relative_paths) { - Util::Vectors::append(bad_dlls, find_relative_dlls(fs, package_dir, prefix)); + Util::Vectors::append(bad_dlls, find_relative_dlls(fs, package_dir, relative_path)); } if (!bad_dlls.empty()) @@ -548,17 +548,17 @@ namespace vcpkg static LintStatus check_for_exes(const ReadOnlyFilesystem& fs, const Path& package_dir, - View bin_prefixes, + View bin_relative_paths, const Path& portfile_cmake, MessageSink& msg_sink) { std::vector exes; - for (auto&& bin_prefix : bin_prefixes) + for (auto&& bin_relative_path : bin_relative_paths) { auto this_bad_exes = - fs.get_regular_files_recursive_lexically_proximate(package_dir / bin_prefix, IgnoreErrors{}); + fs.get_regular_files_recursive_lexically_proximate(package_dir / bin_relative_path, IgnoreErrors{}); Util::erase_remove_if(this_bad_exes, NotExtensionCaseInsensitive{".exe"}); - add_prefix_to_all(this_bad_exes, bin_prefix); + add_prefix_to_all(this_bad_exes, bin_relative_path); Util::Vectors::append(exes, std::move(this_bad_exes)); } @@ -973,16 +973,16 @@ namespace vcpkg static size_t check_bin_folders_are_not_present_in_static_build(const ReadOnlyFilesystem& fs, const Path& package_dir, - View bin_prefixes, + View bin_relative_paths, const Path& portfile_cmake, MessageSink& msg_sink) { std::vector bad_dirs; - for (auto&& bin_prefix : bin_prefixes) + for (auto&& bin_relative_path : bin_relative_paths) { - if (fs.exists(package_dir / bin_prefix, IgnoreErrors{})) + if (fs.exists(package_dir / bin_relative_path, IgnoreErrors{})) { - bad_dirs.push_back(Path(bin_prefix).generic_u8string()); + bad_dirs.push_back(Path(bin_relative_path).generic_u8string()); } } @@ -1446,19 +1446,19 @@ namespace vcpkg return LintStatus::PROBLEM_DETECTED; } - static LintStatus check_no_regular_files_in_dirs(const ReadOnlyFilesystem& fs, + static LintStatus check_no_regular_files_in_relative_path(const ReadOnlyFilesystem& fs, const Path& package_dir, const Path& portfile_cmake, - View prefixes, + View relative_paths, MessageSink& msg_sink) { std::vector misplaced_files; - for (auto&& prefix : prefixes) + for (auto&& relative_path : relative_paths) { auto start_in = package_dir; - if (!prefix.empty()) + if (!relative_path.empty()) { - start_in /= prefix; + start_in /= relative_path; } for (auto&& absolute_path : fs.get_regular_files_non_recursive(start_in, IgnoreErrors{})) @@ -1469,13 +1469,13 @@ namespace vcpkg continue; } - if (prefix.empty()) + if (relative_path.empty()) { misplaced_files.emplace_back(filename); } else { - misplaced_files.emplace_back(Path(prefix) / filename); + misplaced_files.emplace_back(Path(relative_path) / filename); } } } @@ -1634,7 +1634,7 @@ namespace vcpkg static std::vector find_relative_static_libs(const ReadOnlyFilesystem& fs, const bool windows_target, const Path& package_dir, - const Path& prefix) + const Path& relative_path) { View lib_extensions; if (windows_target) @@ -1649,9 +1649,9 @@ namespace vcpkg } std::vector relative_libs = - fs.get_regular_files_recursive_lexically_proximate(package_dir / prefix, IgnoreErrors{}); + fs.get_regular_files_recursive_lexically_proximate(package_dir / relative_path, IgnoreErrors{}); Util::erase_remove_if(relative_libs, NotExtensionsCaseInsensitive{lib_extensions}); - add_prefix_to_all(relative_libs, prefix); + add_prefix_to_all(relative_libs, relative_path); return relative_libs; } @@ -1706,16 +1706,16 @@ namespace vcpkg error_count += check_lib_cmake_merge(fs, package_dir, portfile_cmake, msg_sink); } - static constexpr StringLiteral debug_lib_prefix = "debug" VCPKG_PREFERRED_SEPARATOR "lib"; - static constexpr StringLiteral release_lib_prefix = "lib"; - static constexpr StringLiteral lib_prefixes[] = {debug_lib_prefix, release_lib_prefix}; - static constexpr StringLiteral debug_bin_prefix = "debug" VCPKG_PREFERRED_SEPARATOR "bin"; - static constexpr StringLiteral release_bin_prefix = "bin"; - static constexpr StringLiteral bin_prefixes[] = {debug_bin_prefix, release_bin_prefix}; + static constexpr StringLiteral debug_lib_relative_path = "debug" VCPKG_PREFERRED_SEPARATOR "lib"; + static constexpr StringLiteral release_lib_relative_path = "lib"; + static constexpr StringLiteral lib_relative_paths[] = {debug_lib_relative_path, release_lib_relative_path}; + static constexpr StringLiteral debug_bin_relative_path = "debug" VCPKG_PREFERRED_SEPARATOR "bin"; + static constexpr StringLiteral release_bin_relative_path = "bin"; + static constexpr StringLiteral bin_relative_paths[] = {debug_bin_relative_path, release_bin_relative_path}; if (windows_target && !policies.is_enabled(BuildPolicy::ALLOW_DLLS_IN_LIB)) { - error_count += check_for_dlls_in_lib_dirs(fs, package_dir, lib_prefixes, portfile_cmake, msg_sink); + error_count += check_for_dlls_in_lib_dirs(fs, package_dir, lib_relative_paths, portfile_cmake, msg_sink); } if (!policies.is_enabled(BuildPolicy::SKIP_COPYRIGHT_CHECK)) { @@ -1723,7 +1723,7 @@ namespace vcpkg } if (windows_target && !policies.is_enabled(BuildPolicy::ALLOW_EXES_IN_BIN)) { - error_count += check_for_exes(fs, package_dir, bin_prefixes, portfile_cmake, msg_sink); + error_count += check_for_exes(fs, package_dir, bin_relative_paths, portfile_cmake, msg_sink); } if (!policies.is_enabled(BuildPolicy::SKIP_USAGE_INSTALL_CHECK)) { @@ -1732,16 +1732,16 @@ namespace vcpkg } std::vector relative_debug_libs = - find_relative_static_libs(fs, windows_target, package_dir, debug_lib_prefix); + find_relative_static_libs(fs, windows_target, package_dir, debug_lib_relative_path); std::vector relative_release_libs = - find_relative_static_libs(fs, windows_target, package_dir, release_lib_prefix); + find_relative_static_libs(fs, windows_target, package_dir, release_lib_relative_path); std::vector relative_debug_dlls; std::vector relative_release_dlls; if (windows_target) { - relative_debug_dlls = find_relative_dlls(fs, package_dir, debug_bin_prefix); - relative_release_dlls = find_relative_dlls(fs, package_dir, release_bin_prefix); + relative_debug_dlls = find_relative_dlls(fs, package_dir, debug_bin_relative_path); + relative_release_dlls = find_relative_dlls(fs, package_dir, release_bin_relative_path); } if (not_release_only && !policies.is_enabled(BuildPolicy::MISMATCHED_NUMBER_OF_BINARIES)) @@ -1838,7 +1838,7 @@ namespace vcpkg Util::Vectors::append(relative_dlls, std::move(relative_release_dlls)); error_count += check_no_dlls_present(package_dir, relative_dlls, portfile_cmake, msg_sink); error_count += check_bin_folders_are_not_present_in_static_build( - fs, package_dir, bin_prefixes, portfile_cmake, msg_sink); + fs, package_dir, bin_relative_paths, portfile_cmake, msg_sink); } // Note that this condition is paired with the possible initialization of `debug_lib_info` above @@ -1869,7 +1869,7 @@ namespace vcpkg if (!policies.is_enabled(BuildPolicy::SKIP_MISPLACED_REGULAR_FILES_CHECK)) { static constexpr StringLiteral bad_dirs[] = {"debug", ""}; - error_count += check_no_regular_files_in_dirs(fs, package_dir, portfile_cmake, bad_dirs, msg_sink); + error_count += check_no_regular_files_in_relative_path(fs, package_dir, portfile_cmake, bad_dirs, msg_sink); } std::vector relative_all_files; From 5365607adfe697b71bc95e8990dd0231008ec107 Mon Sep 17 00:00:00 2001 From: Billy Robert O'Neal III Date: Thu, 6 Jun 2024 18:16:49 -0700 Subject: [PATCH 09/14] check_for_exes -> check_for_exes_in_bin_dirs as requested by @ras0129-msft --- src/vcpkg/postbuildlint.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/vcpkg/postbuildlint.cpp b/src/vcpkg/postbuildlint.cpp index 2d51864dc5..fa4b59d144 100644 --- a/src/vcpkg/postbuildlint.cpp +++ b/src/vcpkg/postbuildlint.cpp @@ -546,7 +546,7 @@ namespace vcpkg return LintStatus::PROBLEM_DETECTED; } - static LintStatus check_for_exes(const ReadOnlyFilesystem& fs, + static LintStatus check_for_exes_in_bin_dirs(const ReadOnlyFilesystem& fs, const Path& package_dir, View bin_relative_paths, const Path& portfile_cmake, @@ -1723,7 +1723,7 @@ namespace vcpkg } if (windows_target && !policies.is_enabled(BuildPolicy::ALLOW_EXES_IN_BIN)) { - error_count += check_for_exes(fs, package_dir, bin_relative_paths, portfile_cmake, msg_sink); + error_count += check_for_exes_in_bin_dirs(fs, package_dir, bin_relative_paths, portfile_cmake, msg_sink); } if (!policies.is_enabled(BuildPolicy::SKIP_USAGE_INSTALL_CHECK)) { From 3082e5102386a882d967cd4ed5a5b2e904bd2332 Mon Sep 17 00:00:00 2001 From: Billy Robert O'Neal III Date: Thu, 6 Jun 2024 18:17:25 -0700 Subject: [PATCH 10/14] Rename to check_appcontainer_bit_if_uwp --- src/vcpkg/postbuildlint.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/vcpkg/postbuildlint.cpp b/src/vcpkg/postbuildlint.cpp index fa4b59d144..8af08b698a 100644 --- a/src/vcpkg/postbuildlint.cpp +++ b/src/vcpkg/postbuildlint.cpp @@ -668,7 +668,7 @@ namespace vcpkg return LintStatus::SUCCESS; } - static LintStatus check_appcontainer_bit(StringView expected_system_name, + static LintStatus check_appcontainer_bit_if_uwp(StringView expected_system_name, const Path& package_dir, const Path& portfile_cmake, const std::vector& dlls_data, @@ -1809,7 +1809,7 @@ namespace vcpkg } if (!policies.is_enabled(BuildPolicy::SKIP_APPCONTAINER_CHECK)) { - error_count += check_appcontainer_bit( + error_count += check_appcontainer_bit_if_uwp( pre_build_info.cmake_system_name, package_dir, portfile_cmake, dlls_data, msg_sink); } if (!policies.is_enabled(BuildPolicy::ALLOW_OBSOLETE_MSVCRT)) From 66ef71983457d31c9064d44f3fa4ddd804c6d478 Mon Sep 17 00:00:00 2001 From: Billy Robert O'Neal III Date: Thu, 6 Jun 2024 18:20:58 -0700 Subject: [PATCH 11/14] Move relative path constants to namespace scope and remove places they were being passed around as arguments. --- src/vcpkg/postbuildlint.cpp | 25 +++++++++++-------------- 1 file changed, 11 insertions(+), 14 deletions(-) diff --git a/src/vcpkg/postbuildlint.cpp b/src/vcpkg/postbuildlint.cpp index 8af08b698a..6ec771b20c 100644 --- a/src/vcpkg/postbuildlint.cpp +++ b/src/vcpkg/postbuildlint.cpp @@ -17,6 +17,13 @@ namespace vcpkg { + static constexpr StringLiteral debug_lib_relative_path = "debug" VCPKG_PREFERRED_SEPARATOR "lib"; + static constexpr StringLiteral release_lib_relative_path = "lib"; + static constexpr StringLiteral lib_relative_paths[] = {debug_lib_relative_path, release_lib_relative_path}; + static constexpr StringLiteral debug_bin_relative_path = "debug" VCPKG_PREFERRED_SEPARATOR "bin"; + static constexpr StringLiteral release_bin_relative_path = "bin"; + static constexpr StringLiteral bin_relative_paths[] = {debug_bin_relative_path, release_bin_relative_path}; + constexpr static StringLiteral windows_system_names[] = { "", "Windows", @@ -429,12 +436,11 @@ namespace vcpkg static LintStatus check_for_dlls_in_lib_dirs(const ReadOnlyFilesystem& fs, const Path& package_dir, - View lib_dir_relative_paths, const Path& portfile_cmake, MessageSink& msg_sink) { std::vector bad_dlls; - for (auto&& relative_path : lib_dir_relative_paths) + for (auto&& relative_path : lib_relative_paths) { Util::Vectors::append(bad_dlls, find_relative_dlls(fs, package_dir, relative_path)); } @@ -548,7 +554,6 @@ namespace vcpkg static LintStatus check_for_exes_in_bin_dirs(const ReadOnlyFilesystem& fs, const Path& package_dir, - View bin_relative_paths, const Path& portfile_cmake, MessageSink& msg_sink) { @@ -973,7 +978,6 @@ namespace vcpkg static size_t check_bin_folders_are_not_present_in_static_build(const ReadOnlyFilesystem& fs, const Path& package_dir, - View bin_relative_paths, const Path& portfile_cmake, MessageSink& msg_sink) { @@ -1706,16 +1710,9 @@ namespace vcpkg error_count += check_lib_cmake_merge(fs, package_dir, portfile_cmake, msg_sink); } - static constexpr StringLiteral debug_lib_relative_path = "debug" VCPKG_PREFERRED_SEPARATOR "lib"; - static constexpr StringLiteral release_lib_relative_path = "lib"; - static constexpr StringLiteral lib_relative_paths[] = {debug_lib_relative_path, release_lib_relative_path}; - static constexpr StringLiteral debug_bin_relative_path = "debug" VCPKG_PREFERRED_SEPARATOR "bin"; - static constexpr StringLiteral release_bin_relative_path = "bin"; - static constexpr StringLiteral bin_relative_paths[] = {debug_bin_relative_path, release_bin_relative_path}; - if (windows_target && !policies.is_enabled(BuildPolicy::ALLOW_DLLS_IN_LIB)) { - error_count += check_for_dlls_in_lib_dirs(fs, package_dir, lib_relative_paths, portfile_cmake, msg_sink); + error_count += check_for_dlls_in_lib_dirs(fs, package_dir, portfile_cmake, msg_sink); } if (!policies.is_enabled(BuildPolicy::SKIP_COPYRIGHT_CHECK)) { @@ -1723,7 +1720,7 @@ namespace vcpkg } if (windows_target && !policies.is_enabled(BuildPolicy::ALLOW_EXES_IN_BIN)) { - error_count += check_for_exes_in_bin_dirs(fs, package_dir, bin_relative_paths, portfile_cmake, msg_sink); + error_count += check_for_exes_in_bin_dirs(fs, package_dir, portfile_cmake, msg_sink); } if (!policies.is_enabled(BuildPolicy::SKIP_USAGE_INSTALL_CHECK)) { @@ -1838,7 +1835,7 @@ namespace vcpkg Util::Vectors::append(relative_dlls, std::move(relative_release_dlls)); error_count += check_no_dlls_present(package_dir, relative_dlls, portfile_cmake, msg_sink); error_count += check_bin_folders_are_not_present_in_static_build( - fs, package_dir, bin_relative_paths, portfile_cmake, msg_sink); + fs, package_dir, portfile_cmake, msg_sink); } // Note that this condition is paired with the possible initialization of `debug_lib_info` above From 04a0e569292ae53d202bdec910686df2ff189ed9 Mon Sep 17 00:00:00 2001 From: Billy Robert O'Neal III Date: Thu, 6 Jun 2024 18:21:34 -0700 Subject: [PATCH 12/14] clang-format --- src/vcpkg/postbuildlint.cpp | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/src/vcpkg/postbuildlint.cpp b/src/vcpkg/postbuildlint.cpp index 6ec771b20c..a1b0028ca1 100644 --- a/src/vcpkg/postbuildlint.cpp +++ b/src/vcpkg/postbuildlint.cpp @@ -553,9 +553,9 @@ namespace vcpkg } static LintStatus check_for_exes_in_bin_dirs(const ReadOnlyFilesystem& fs, - const Path& package_dir, - const Path& portfile_cmake, - MessageSink& msg_sink) + const Path& package_dir, + const Path& portfile_cmake, + MessageSink& msg_sink) { std::vector exes; for (auto&& bin_relative_path : bin_relative_paths) @@ -674,10 +674,10 @@ namespace vcpkg } static LintStatus check_appcontainer_bit_if_uwp(StringView expected_system_name, - const Path& package_dir, - const Path& portfile_cmake, - const std::vector& dlls_data, - MessageSink& msg_sink) + const Path& package_dir, + const Path& portfile_cmake, + const std::vector& dlls_data, + MessageSink& msg_sink) { if (expected_system_name != "WindowsStore") { @@ -1451,10 +1451,10 @@ namespace vcpkg } static LintStatus check_no_regular_files_in_relative_path(const ReadOnlyFilesystem& fs, - const Path& package_dir, - const Path& portfile_cmake, - View relative_paths, - MessageSink& msg_sink) + const Path& package_dir, + const Path& portfile_cmake, + View relative_paths, + MessageSink& msg_sink) { std::vector misplaced_files; for (auto&& relative_path : relative_paths) @@ -1834,8 +1834,8 @@ namespace vcpkg auto& relative_dlls = relative_debug_dlls; Util::Vectors::append(relative_dlls, std::move(relative_release_dlls)); error_count += check_no_dlls_present(package_dir, relative_dlls, portfile_cmake, msg_sink); - error_count += check_bin_folders_are_not_present_in_static_build( - fs, package_dir, portfile_cmake, msg_sink); + error_count += + check_bin_folders_are_not_present_in_static_build(fs, package_dir, portfile_cmake, msg_sink); } // Note that this condition is paired with the possible initialization of `debug_lib_info` above From 5a28ba17efbcd81b44b321b3cbb22491343c9ddb Mon Sep 17 00:00:00 2001 From: Billy Robert O'Neal III Date: Fri, 7 Jun 2024 16:00:09 -0700 Subject: [PATCH 13/14] Quote parameters to IN_LIST as requested by @ras0219-msft --- .../test-dll-port-template/portfile.cmake | 34 +++++++++---------- .../test-exe-port-template/portfile.cmake | 4 +-- .../portfile.cmake | 8 ++--- .../portfile.cmake | 4 +-- .../portfile.cmake | 2 +- .../e2e-ports/vcpkg-msvc-2013/portfile.cmake | 4 +-- .../portfile.cmake | 12 +++---- .../vcpkg-policy-copyright/portfile.cmake | 8 ++--- .../vcpkg-policy-empty-folders/portfile.cmake | 2 +- .../vcpkg-policy-forgot-usage/portfile.cmake | 2 +- .../portfile.cmake | 20 +++++------ .../portfile.cmake | 8 ++--- .../portfile.cmake | 24 ++++++------- .../portfile.cmake | 2 +- 14 files changed, 67 insertions(+), 67 deletions(-) diff --git a/azure-pipelines/e2e-assets/test-dll-port-template/portfile.cmake b/azure-pipelines/e2e-assets/test-dll-port-template/portfile.cmake index 8550092c7d..650c03da6d 100644 --- a/azure-pipelines/e2e-assets/test-dll-port-template/portfile.cmake +++ b/azure-pipelines/e2e-assets/test-dll-port-template/portfile.cmake @@ -4,66 +4,66 @@ file(COPY "${CMAKE_CURRENT_LIST_DIR}/test.h" DESTINATION "${CURRENT_PACKAGES_DIR file(MAKE_DIRECTORY "${CURRENT_PACKAGES_DIR}/share/${PORT}") file(TOUCH "${CURRENT_PACKAGES_DIR}/share/${PORT}/copyright") -if(release-only IN_LIST FEATURES AND NOT bad-release-only IN_LIST FEATURES) +if("release-only" IN_LIST FEATURES AND NOT "bad-release-only" IN_LIST FEATURES) set(VCPKG_BUILD_TYPE release) endif() -if(NOT install-no-lib-release IN_LIST FEATURES AND NOT debug-only IN_LIST FEATURES) +if(NOT "install-no-lib-release" IN_LIST FEATURES AND NOT "debug-only" IN_LIST FEATURES) file(MAKE_DIRECTORY "${CURRENT_PACKAGES_DIR}/lib") file(COPY "${CMAKE_CURRENT_LIST_DIR}/release/test_dll.lib" DESTINATION "${CURRENT_PACKAGES_DIR}/lib") endif() -if(NOT install-no-lib-debug IN_LIST FEATURES AND NOT release-only IN_LIST FEATURES) +if(NOT "install-no-lib-debug" IN_LIST FEATURES AND NOT "release-only" IN_LIST FEATURES) file(MAKE_DIRECTORY "${CURRENT_PACKAGES_DIR}/debug/lib") file(COPY "${CMAKE_CURRENT_LIST_DIR}/debug/test_dll.lib" DESTINATION "${CURRENT_PACKAGES_DIR}/debug/lib") endif() -if(install-to-lib IN_LIST FEATURES) - if(NOT debug-only IN_LIST FEATURES) +if("install-to-lib" IN_LIST FEATURES) + if(NOT "debug-only" IN_LIST FEATURES) file(COPY "${CMAKE_CURRENT_LIST_DIR}/release/test_dll.dll" DESTINATION "${CURRENT_PACKAGES_DIR}/lib") endif() - if(NOT release-only IN_LIST FEATURES) + if(NOT "release-only" IN_LIST FEATURES) file(COPY "${CMAKE_CURRENT_LIST_DIR}/debug/test_dll.dll" DESTINATION "${CURRENT_PACKAGES_DIR}/debug/lib") endif() else() - if(NOT debug-only IN_LIST FEATURES) + if(NOT "debug-only" IN_LIST FEATURES) file(MAKE_DIRECTORY "${CURRENT_PACKAGES_DIR}/bin") file(COPY "${CMAKE_CURRENT_LIST_DIR}/release/test_dll.dll" DESTINATION "${CURRENT_PACKAGES_DIR}/bin") endif() - if(NOT release-only IN_LIST FEATURES) + if(NOT "release-only" IN_LIST FEATURES) file(MAKE_DIRECTORY "${CURRENT_PACKAGES_DIR}/debug/bin") file(COPY "${CMAKE_CURRENT_LIST_DIR}/debug/test_dll.dll" DESTINATION "${CURRENT_PACKAGES_DIR}/debug/bin") endif() endif() -if(extra-debug IN_LIST FEATURES) +if("extra-debug" IN_LIST FEATURES) file(INSTALL "${CMAKE_CURRENT_LIST_DIR}/debug/test_dll.lib" DESTINATION "${CURRENT_PACKAGES_DIR}/debug/lib" RENAME "test_dll2.lib") file(INSTALL "${CMAKE_CURRENT_LIST_DIR}/debug/test_dll.dll" DESTINATION "${CURRENT_PACKAGES_DIR}/debug/bin" RENAME "test_dll2.dll") endif() -if(extra-release IN_LIST FEATURES) +if("extra-release" IN_LIST FEATURES) file(INSTALL "${CMAKE_CURRENT_LIST_DIR}/release/test_dll.lib" DESTINATION "${CURRENT_PACKAGES_DIR}/lib" RENAME "test_dll2.lib") file(INSTALL "${CMAKE_CURRENT_LIST_DIR}/release/test_dll.dll" DESTINATION "${CURRENT_PACKAGES_DIR}/bin" RENAME "test_dll2.dll") endif() -if(policy-skip-architecture-check IN_LIST FEATURES) +if("policy-skip-architecture-check" IN_LIST FEATURES) set(VCPKG_POLICY_SKIP_ARCHITECTURE_CHECK enabled) endif() -if(policy-skip-appcontainer-check IN_LIST FEATURES) +if("policy-skip-appcontainer-check" IN_LIST FEATURES) set(VCPKG_POLICY_SKIP_APPCONTAINER_CHECK enabled) endif() -if(policy-allow-dlls-in-lib IN_LIST FEATURES) +if("policy-allow-dlls-in-lib" IN_LIST FEATURES) set(VCPKG_POLICY_ALLOW_DLLS_IN_LIB enabled) endif() -if(policy-allow-kernel32-from-xbox IN_LIST FEATURES) +if("policy-allow-kernel32-from-xbox" IN_LIST FEATURES) set(VCPKG_POLICY_ALLOW_KERNEL32_FROM_XBOX enabled) endif() -if(policy-dlls-in-static-library IN_LIST FEATURES) +if("policy-dlls-in-static-library" IN_LIST FEATURES) set(VCPKG_POLICY_DLLS_IN_STATIC_LIBRARY enabled) endif() -if(policy-mismatched-number-of-binaries IN_LIST FEATURES) +if("policy-mismatched-number-of-binaries" IN_LIST FEATURES) set(VCPKG_POLICY_MISMATCHED_NUMBER_OF_BINARIES enabled) endif() -if(policy-dlls-without-libs IN_LIST FEATURES) +if("policy-dlls-without-libs" IN_LIST FEATURES) set(VCPKG_POLICY_DLLS_WITHOUT_LIBS enabled) endif() diff --git a/azure-pipelines/e2e-assets/test-exe-port-template/portfile.cmake b/azure-pipelines/e2e-assets/test-exe-port-template/portfile.cmake index 55f2ff8e23..75f7216a93 100644 --- a/azure-pipelines/e2e-assets/test-exe-port-template/portfile.cmake +++ b/azure-pipelines/e2e-assets/test-exe-port-template/portfile.cmake @@ -2,7 +2,7 @@ set(VCPKG_POLICY_EMPTY_INCLUDE_FOLDER enabled) file(MAKE_DIRECTORY "${CURRENT_PACKAGES_DIR}/share/${PORT}") file(TOUCH "${CURRENT_PACKAGES_DIR}/share/${PORT}/copyright") -if(release-only IN_LIST FEATURES) +if("release-only" IN_LIST FEATURES) set(VCPKG_BUILD_TYPE release) else() file(MAKE_DIRECTORY "${CURRENT_PACKAGES_DIR}/debug/bin") @@ -12,6 +12,6 @@ endif() file(MAKE_DIRECTORY "${CURRENT_PACKAGES_DIR}/bin") file(COPY "${CMAKE_CURRENT_LIST_DIR}/release/test_exe.exe" DESTINATION "${CURRENT_PACKAGES_DIR}/bin") -if(policy-allow-exes-in-bin IN_LIST FEATURES) +if("policy-allow-exes-in-bin" IN_LIST FEATURES) set(VCPKG_POLICY_ALLOW_EXES_IN_BIN enabled) endif() diff --git a/azure-pipelines/e2e-assets/test-lib-port-template-dynamic-crt-release-only/portfile.cmake b/azure-pipelines/e2e-assets/test-lib-port-template-dynamic-crt-release-only/portfile.cmake index 5b334e0001..a3330ff4d0 100644 --- a/azure-pipelines/e2e-assets/test-lib-port-template-dynamic-crt-release-only/portfile.cmake +++ b/azure-pipelines/e2e-assets/test-lib-port-template-dynamic-crt-release-only/portfile.cmake @@ -8,9 +8,9 @@ file(COPY "${CMAKE_CURRENT_LIST_DIR}/debug/test_lib.lib" DESTINATION "${CURRENT_ file(COPY "${CMAKE_CURRENT_LIST_DIR}/release/test_lib.lib" DESTINATION "${CURRENT_PACKAGES_DIR}/lib") file(COPY "${CMAKE_CURRENT_LIST_DIR}/test.h" DESTINATION "${CURRENT_PACKAGES_DIR}/include") file(TOUCH "${CURRENT_PACKAGES_DIR}/share/${PORT}/copyright") -if (policy-skip-crt-linkage-check IN_LIST FEATURES) - set(VCPKG_POLICY_SKIP_CRT_LINKAGE_CHECK enabled) +if("policy-skip-crt-linkage-check" IN_LIST FEATURES) + set(VCPKG_POLICY_SKIP_CRT_LINKAGE_CHECK enabled) endif() -if (policy-only-release-crt IN_LIST FEATURES) - set(VCPKG_POLICY_ONLY_RELEASE_CRT enabled) +if("policy-only-release-crt" IN_LIST FEATURES) + set(VCPKG_POLICY_ONLY_RELEASE_CRT enabled) endif() diff --git a/azure-pipelines/e2e-assets/test-lib-port-template-dynamic-crt/portfile.cmake b/azure-pipelines/e2e-assets/test-lib-port-template-dynamic-crt/portfile.cmake index 0df5fb47df..9d336f2e3f 100644 --- a/azure-pipelines/e2e-assets/test-lib-port-template-dynamic-crt/portfile.cmake +++ b/azure-pipelines/e2e-assets/test-lib-port-template-dynamic-crt/portfile.cmake @@ -10,6 +10,6 @@ file(COPY "${CMAKE_CURRENT_LIST_DIR}/release/test_lib.lib" DESTINATION "${CURREN file(COPY "${CMAKE_CURRENT_LIST_DIR}/both/both_lib.lib" DESTINATION "${CURRENT_PACKAGES_DIR}/lib") file(COPY "${CMAKE_CURRENT_LIST_DIR}/test.h" DESTINATION "${CURRENT_PACKAGES_DIR}/include") file(TOUCH "${CURRENT_PACKAGES_DIR}/share/${PORT}/copyright") -if (policy-skip-crt-linkage-check IN_LIST FEATURES) - set(VCPKG_POLICY_SKIP_CRT_LINKAGE_CHECK enabled) +if("policy-skip-crt-linkage-check" IN_LIST FEATURES) + set(VCPKG_POLICY_SKIP_CRT_LINKAGE_CHECK enabled) endif() diff --git a/azure-pipelines/e2e-ports/vcpkg-internal-dll-with-no-exports/portfile.cmake b/azure-pipelines/e2e-ports/vcpkg-internal-dll-with-no-exports/portfile.cmake index 527cf71216..20ca536437 100644 --- a/azure-pipelines/e2e-ports/vcpkg-internal-dll-with-no-exports/portfile.cmake +++ b/azure-pipelines/e2e-ports/vcpkg-internal-dll-with-no-exports/portfile.cmake @@ -10,6 +10,6 @@ file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/lib" "${CURRENT_PACKAGES_DIR}/lib") file(TOUCH "${CURRENT_PACKAGES_DIR}/share/${PORT}/copyright") -if(policy IN_LIST FEATURES) +if("policy" IN_LIST FEATURES) set(VCPKG_POLICY_DLLS_WITHOUT_EXPORTS enabled) endif() diff --git a/azure-pipelines/e2e-ports/vcpkg-msvc-2013/portfile.cmake b/azure-pipelines/e2e-ports/vcpkg-msvc-2013/portfile.cmake index e93548bbb5..53e3259034 100644 --- a/azure-pipelines/e2e-ports/vcpkg-msvc-2013/portfile.cmake +++ b/azure-pipelines/e2e-ports/vcpkg-msvc-2013/portfile.cmake @@ -4,7 +4,7 @@ file(WRITE "${CURRENT_PACKAGES_DIR}/share/${PORT}/copyright" "MIT License.") file(MAKE_DIRECTORY "${CURRENT_PACKAGES_DIR}/include/vcpkg-msvc-2013") file(COPY "${CMAKE_CURRENT_LIST_DIR}/test.h" DESTINATION "${CURRENT_PACKAGES_DIR}/include/vcpkg-msvc-2013") -if(release-only IN_LIST FEATURES) +if("release-only" IN_LIST FEATURES) set(VCPKG_BUILD_TYPE "release") else() file(MAKE_DIRECTORY "${CURRENT_PACKAGES_DIR}/debug/bin") @@ -18,6 +18,6 @@ file(MAKE_DIRECTORY "${CURRENT_PACKAGES_DIR}/lib") file(COPY "${CMAKE_CURRENT_LIST_DIR}/release/test_dll.dll" DESTINATION "${CURRENT_PACKAGES_DIR}/bin") file(COPY "${CMAKE_CURRENT_LIST_DIR}/release/test_dll.lib" DESTINATION "${CURRENT_PACKAGES_DIR}/lib") -if(policy IN_LIST FEATURES) +if("policy" IN_LIST FEATURES) set(VCPKG_POLICY_ALLOW_OBSOLETE_MSVCRT enabled) endif() diff --git a/azure-pipelines/e2e-ports/vcpkg-policy-absolute-paths/portfile.cmake b/azure-pipelines/e2e-ports/vcpkg-policy-absolute-paths/portfile.cmake index 2a86a70a71..2b27f39c7c 100644 --- a/azure-pipelines/e2e-ports/vcpkg-policy-absolute-paths/portfile.cmake +++ b/azure-pipelines/e2e-ports/vcpkg-policy-absolute-paths/portfile.cmake @@ -2,19 +2,19 @@ file(MAKE_DIRECTORY "${CURRENT_PACKAGES_DIR}/share/${PORT}") file(WRITE "${CURRENT_PACKAGES_DIR}/share/${PORT}/copyright" "N/A") set(PROBLEM_TEXT "") -if(build-dir IN_LIST FEATURES) +if("build-dir" IN_LIST FEATURES) string(APPEND PROBLEM_TEXT "build-dir: ${CURRENT_BUILDTREES_DIR}\n") endif() -if(downloads IN_LIST FEATURES) +if("downloads" IN_LIST FEATURES) string(APPEND PROBLEM_TEXT "downloads: ${DOWNLOADS}\n") endif() -if(installed-root IN_LIST FEATURES) +if("installed-root" IN_LIST FEATURES) string(APPEND PROBLEM_TEXT "installed-root: ${CURRENT_INSTALLED_DIR}\n") endif() -if(package-dir IN_LIST FEATURES) +if("package-dir" IN_LIST FEATURES) string(APPEND PROBLEM_TEXT "package-dir: ${CURRENT_PACKAGES_DIR}\n") endif() -if(pkgconfig IN_LIST FEATURES) +if("pkgconfig" IN_LIST FEATURES) file(MAKE_DIRECTORY "${CURRENT_PACKAGES_DIR}/share/pkgconfig") file(WRITE "${CURRENT_PACKAGES_DIR}/share/pkgconfig/vcpkg-policy-absolute-paths.pc" "${PROBLEM_TEXT}") endif() @@ -22,6 +22,6 @@ endif() file(MAKE_DIRECTORY "${CURRENT_PACKAGES_DIR}/include") file(WRITE "${CURRENT_PACKAGES_DIR}/include/vcpkg-policy-absolute-paths.h" "${PROBLEM_TEXT}") -if(policy IN_LIST FEATURES) +if("policy" IN_LIST FEATURES) set(VCPKG_POLICY_SKIP_ABSOLUTE_PATHS_CHECK enabled) endif() diff --git a/azure-pipelines/e2e-ports/vcpkg-policy-copyright/portfile.cmake b/azure-pipelines/e2e-ports/vcpkg-policy-copyright/portfile.cmake index 310f8ff7c1..42be47841b 100644 --- a/azure-pipelines/e2e-ports/vcpkg-policy-copyright/portfile.cmake +++ b/azure-pipelines/e2e-ports/vcpkg-policy-copyright/portfile.cmake @@ -1,6 +1,6 @@ set(VCPKG_POLICY_EMPTY_INCLUDE_FOLDER enabled) -if(copyright-directory IN_LIST FEATURES) +if("copyright-directory" IN_LIST FEATURES) file(MAKE_DIRECTORY "${CURRENT_PACKAGES_DIR}/share/${PORT}/copyright") file(WRITE "${CURRENT_PACKAGES_DIR}/share/${PORT}/copyright/LICENSE.txt" "this is some license text") file(WRITE "${CURRENT_PACKAGES_DIR}/share/${PORT}/copyright/COPYING" "this is some different license text") @@ -8,19 +8,19 @@ else() # Intentionally do not create "${CURRENT_PACKAGES_DIR}/share/${PORT}/copyright" endif() -if(source IN_LIST FEATURES) +if("source" IN_LIST FEATURES) set(SOURCE_PATH "${CURRENT_BUILDTREES_DIR}/src/v1.16.3-6f5be3c3eb.clean") file(MAKE_DIRECTORY "${SOURCE_PATH}") file(WRITE "${SOURCE_PATH}/LICENSE.txt" "this is some license text") endif() -if(source2 IN_LIST FEATURES) +if("source2" IN_LIST FEATURES) set(SOURCE_PATH "${CURRENT_BUILDTREES_DIR}/src/v1.3.1-2e5db616bf.clean") file(MAKE_DIRECTORY "${SOURCE_PATH}") file(WRITE "${SOURCE_PATH}/LICENSE.txt" "this is some license text") file(WRITE "${SOURCE_PATH}/COPYING" "this is some different license text") endif() -if (policy IN_LIST FEATURES) +if ("policy" IN_LIST FEATURES) set(VCPKG_POLICY_SKIP_COPYRIGHT_CHECK enabled) endif() diff --git a/azure-pipelines/e2e-ports/vcpkg-policy-empty-folders/portfile.cmake b/azure-pipelines/e2e-ports/vcpkg-policy-empty-folders/portfile.cmake index 7823bafd2d..3bf8d7a14a 100644 --- a/azure-pipelines/e2e-ports/vcpkg-policy-empty-folders/portfile.cmake +++ b/azure-pipelines/e2e-ports/vcpkg-policy-empty-folders/portfile.cmake @@ -3,6 +3,6 @@ file(MAKE_DIRECTORY "${CURRENT_PACKAGES_DIR}/share/${PORT}") file(WRITE "${CURRENT_PACKAGES_DIR}/share/${PORT}/copyright" "this is some license text") file(MAKE_DIRECTORY "${CURRENT_PACKAGES_DIR}/empty-directory") file(MAKE_DIRECTORY "${CURRENT_PACKAGES_DIR}/root/empty-inner-directory") -if (policy IN_LIST FEATURES) +if("policy" IN_LIST FEATURES) set(VCPKG_POLICY_ALLOW_EMPTY_FOLDERS enabled) endif() diff --git a/azure-pipelines/e2e-ports/vcpkg-policy-forgot-usage/portfile.cmake b/azure-pipelines/e2e-ports/vcpkg-policy-forgot-usage/portfile.cmake index 2ad5b56e0b..49feae47e6 100644 --- a/azure-pipelines/e2e-ports/vcpkg-policy-forgot-usage/portfile.cmake +++ b/azure-pipelines/e2e-ports/vcpkg-policy-forgot-usage/portfile.cmake @@ -1,6 +1,6 @@ set(VCPKG_POLICY_EMPTY_INCLUDE_FOLDER enabled) file(MAKE_DIRECTORY "${CURRENT_PACKAGES_DIR}/share/${PORT}") file(WRITE "${CURRENT_PACKAGES_DIR}/share/${PORT}/copyright" "this is some license text") -if (policy IN_LIST FEATURES) +if("policy" IN_LIST FEATURES) set(VCPKG_POLICY_SKIP_USAGE_INSTALL_CHECK enabled) endif() diff --git a/azure-pipelines/e2e-ports/vcpkg-policy-include-folder/portfile.cmake b/azure-pipelines/e2e-ports/vcpkg-policy-include-folder/portfile.cmake index 96831029c3..725616e071 100644 --- a/azure-pipelines/e2e-ports/vcpkg-policy-include-folder/portfile.cmake +++ b/azure-pipelines/e2e-ports/vcpkg-policy-include-folder/portfile.cmake @@ -1,46 +1,46 @@ file(MAKE_DIRECTORY "${CURRENT_PACKAGES_DIR}/share/${PORT}") file(WRITE "${CURRENT_PACKAGES_DIR}/share/${PORT}/copyright" "N/A") -if(do-install IN_LIST FEATURES) +if("do-install" IN_LIST FEATURES) file(MAKE_DIRECTORY "${CURRENT_PACKAGES_DIR}/include") file(WRITE "${CURRENT_PACKAGES_DIR}/include/vcpkg-policy-include-folder.h" "") endif() -if(do-install-debug IN_LIST FEATURES) +if("do-install-debug" IN_LIST FEATURES) file(MAKE_DIRECTORY "${CURRENT_PACKAGES_DIR}/debug/include") file(WRITE "${CURRENT_PACKAGES_DIR}/debug/include/vcpkg-policy-include-folder.h" "") endif() -if(do-install-debug-share IN_LIST FEATURES) +if("do-install-debug-share" IN_LIST FEATURES) file(MAKE_DIRECTORY "${CURRENT_PACKAGES_DIR}/debug/share") file(WRITE "${CURRENT_PACKAGES_DIR}/debug/share/example.txt" "") endif() -if(do-install-restricted IN_LIST FEATURES) +if("do-install-restricted" IN_LIST FEATURES) file(MAKE_DIRECTORY "${CURRENT_PACKAGES_DIR}/include") file(WRITE "${CURRENT_PACKAGES_DIR}/include/json.h" "") endif() -if(do-install-vcpkg-port-config IN_LIST FEATURES) +if("do-install-vcpkg-port-config" IN_LIST FEATURES) file(WRITE "${CURRENT_PACKAGES_DIR}/share/${PORT}/vcpkg-port-config.cmake" "") endif() -if(policy-empty-include-folder IN_LIST FEATURES) +if("policy-empty-include-folder" IN_LIST FEATURES) set(VCPKG_POLICY_EMPTY_INCLUDE_FOLDER enabled) endif() -if(policy-cmake-helper-port IN_LIST FEATURES) +if("policy-cmake-helper-port" IN_LIST FEATURES) set(VCPKG_POLICY_CMAKE_HELPER_PORT enabled) endif() -if(policy-allow-restricted-headers IN_LIST FEATURES) +if("policy-allow-restricted-headers" IN_LIST FEATURES) set(VCPKG_POLICY_ALLOW_RESTRICTED_HEADERS enabled) endif() -if(policy-allow-debug-include IN_LIST FEATURES) +if("policy-allow-debug-include" IN_LIST FEATURES) set(VCPKG_POLICY_ALLOW_DEBUG_INCLUDE enabled) endif() -if(policy-allow-debug-share IN_LIST FEATURES) +if("policy-allow-debug-share" IN_LIST FEATURES) set(VCPKG_POLICY_ALLOW_DEBUG_SHARE enabled) endif() diff --git a/azure-pipelines/e2e-ports/vcpkg-policy-misplaced-cmake-files/portfile.cmake b/azure-pipelines/e2e-ports/vcpkg-policy-misplaced-cmake-files/portfile.cmake index f805cfb777..2f9ab728f8 100644 --- a/azure-pipelines/e2e-ports/vcpkg-policy-misplaced-cmake-files/portfile.cmake +++ b/azure-pipelines/e2e-ports/vcpkg-policy-misplaced-cmake-files/portfile.cmake @@ -6,24 +6,24 @@ file(WRITE "${CURRENT_PACKAGES_DIR}/share/${PORT}/copyright" "N/A") file(MAKE_DIRECTORY "${CURRENT_PACKAGES_DIR}/include") file(WRITE "${CURRENT_PACKAGES_DIR}/include/vcpkg-include-folder-policies.h" "") -if (do-install-cmake IN_LIST FEATURES) +if("do-install-cmake" IN_LIST FEATURES) file(MAKE_DIRECTORY "${CURRENT_PACKAGES_DIR}/cmake") file(WRITE "${CURRENT_PACKAGES_DIR}/cmake/some_cmake.cmake" "# Hello!") file(MAKE_DIRECTORY "${CURRENT_PACKAGES_DIR}/debug/cmake") file(WRITE "${CURRENT_PACKAGES_DIR}/debug/cmake/some_cmake.cmake" "# Hello!") endif() -if(do-install-lib IN_LIST FEATURES) +if("do-install-lib" IN_LIST FEATURES) file(MAKE_DIRECTORY "${CURRENT_PACKAGES_DIR}/lib/cmake") file(WRITE "${CURRENT_PACKAGES_DIR}/lib/cmake/some_cmake.cmake" "# Hello!") file(MAKE_DIRECTORY "${CURRENT_PACKAGES_DIR}/debug/lib/cmake") file(WRITE "${CURRENT_PACKAGES_DIR}/debug/lib/cmake/some_cmake.cmake" "# Hello!") endif() -if (policy-skip-misplaced-cmake-files-check IN_LIST FEATURES) +if("policy-skip-misplaced-cmake-files-check" IN_LIST FEATURES) set(VCPKG_POLICY_SKIP_MISPLACED_CMAKE_FILES_CHECK enabled) endif() -if (policy-skip-lib-cmake-merge-check IN_LIST FEATURES) +if("policy-skip-lib-cmake-merge-check" IN_LIST FEATURES) set(VCPKG_POLICY_SKIP_LIB_CMAKE_MERGE_CHECK enabled) endif() diff --git a/azure-pipelines/e2e-ports/vcpkg-policy-misplaced-pkgconfig/portfile.cmake b/azure-pipelines/e2e-ports/vcpkg-policy-misplaced-pkgconfig/portfile.cmake index fd98dde9a3..a0ce407231 100644 --- a/azure-pipelines/e2e-ports/vcpkg-policy-misplaced-pkgconfig/portfile.cmake +++ b/azure-pipelines/e2e-ports/vcpkg-policy-misplaced-pkgconfig/portfile.cmake @@ -21,7 +21,7 @@ Requires: Cflags: "-I${includedir}" ]]) -if(install-arch-dependent-good IN_LIST FEATURES) +if("install-arch-dependent-good" IN_LIST FEATURES) file(MAKE_DIRECTORY "${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig") file(WRITE "${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig/zlib.pc" "${ARCH_DEPENDENT_DEBUG_PC_CONTENT}") endif() @@ -41,22 +41,22 @@ Libs: "-L${libdir}" "-L${sharedlibdir}" -lzlib Cflags: "-I${includedir}" ]]) -if(install-arch-dependent-good-release-only IN_LIST FEATURES) +if("install-arch-dependent-good-release-only" IN_LIST FEATURES) file(MAKE_DIRECTORY "${CURRENT_PACKAGES_DIR}/lib/pkgconfig") file(WRITE "${CURRENT_PACKAGES_DIR}/lib/pkgconfig/zlib.pc" "${ARCH_DEPENDENT_PC_CONTENT}") endif() -if(install-arch-dependent-bad-share IN_LIST FEATURES) +if("install-arch-dependent-bad-share" IN_LIST FEATURES) file(MAKE_DIRECTORY "${CURRENT_PACKAGES_DIR}/share/pkgconfig") file(WRITE "${CURRENT_PACKAGES_DIR}/share/pkgconfig/zlib.pc" "${ARCH_DEPENDENT_PC_CONTENT}") endif() -if(install-arch-dependent-bad-misplaced IN_LIST FEATURES) +if("install-arch-dependent-bad-misplaced" IN_LIST FEATURES) file(MAKE_DIRECTORY "${CURRENT_PACKAGES_DIR}/debug/bin/pkgconfig") file(WRITE "${CURRENT_PACKAGES_DIR}/debug/bin/pkgconfig/zlib.pc" "${ARCH_DEPENDENT_DEBUG_PC_CONTENT}") endif() -if(install-arch-dependent-bad-misplaced-release-only IN_LIST FEATURES) +if("install-arch-dependent-bad-misplaced-release-only" IN_LIST FEATURES) file(MAKE_DIRECTORY "${CURRENT_PACKAGES_DIR}/bin/pkgconfig") file(WRITE "${CURRENT_PACKAGES_DIR}/bin/pkgconfig/zlib.pc" "${ARCH_DEPENDENT_PC_CONTENT}") endif() @@ -76,17 +76,17 @@ Libs: Cflags: "-I${includedir}" ]]) -if(install-arch-agnostic-empty-libs-good IN_LIST FEATURES) +if("install-arch-agnostic-empty-libs-good" IN_LIST FEATURES) file(MAKE_DIRECTORY "${CURRENT_PACKAGES_DIR}/lib/pkgconfig") file(WRITE "${CURRENT_PACKAGES_DIR}/lib/pkgconfig/zlib-no-libs.pc" "${ARCH_AGNOSTIC_WITH_EMPTY_LIBS_PC_CONTENT}") endif() -if(install-arch-agnostic-empty-libs-good-share IN_LIST FEATURES) +if("install-arch-agnostic-empty-libs-good-share" IN_LIST FEATURES) file(MAKE_DIRECTORY "${CURRENT_PACKAGES_DIR}/share/pkgconfig") file(WRITE "${CURRENT_PACKAGES_DIR}/share/pkgconfig/zlib-no-libs.pc" "${ARCH_AGNOSTIC_WITH_EMPTY_LIBS_PC_CONTENT}") endif() -if(install-arch-agnostic-empty-libs-bad-misplaced IN_LIST FEATURES) +if("install-arch-agnostic-empty-libs-bad-misplaced" IN_LIST FEATURES) file(MAKE_DIRECTORY "${CURRENT_PACKAGES_DIR}/bin/pkgconfig") file(WRITE "${CURRENT_PACKAGES_DIR}/bin/pkgconfig/zlib-no-libs.pc" "${ARCH_AGNOSTIC_WITH_EMPTY_LIBS_PC_CONTENT}") endif() @@ -104,21 +104,21 @@ Version: 0.2.8 Cflags: "-I${includedir}" ]]) -if(install-arch-agnostic-good IN_LIST FEATURES) +if("install-arch-agnostic-good" IN_LIST FEATURES) file(MAKE_DIRECTORY "${CURRENT_PACKAGES_DIR}/lib/pkgconfig") file(WRITE "${CURRENT_PACKAGES_DIR}/lib/pkgconfig/libmorton.pc" "${ARCH_AGNOSTIC_PC_CONTENT}") endif() -if(install-arch-agnostic-good-share IN_LIST FEATURES) +if("install-arch-agnostic-good-share" IN_LIST FEATURES) file(MAKE_DIRECTORY "${CURRENT_PACKAGES_DIR}/share/pkgconfig") file(WRITE "${CURRENT_PACKAGES_DIR}/share/pkgconfig/libmorton.pc" "${ARCH_AGNOSTIC_PC_CONTENT}") endif() -if(install-arch-agnostic-bad-misplaced IN_LIST FEATURES) +if("install-arch-agnostic-bad-misplaced" IN_LIST FEATURES) file(MAKE_DIRECTORY "${CURRENT_PACKAGES_DIR}/bin/pkgconfig") file(WRITE "${CURRENT_PACKAGES_DIR}/bin/pkgconfig/libmorton.pc" "${ARCH_AGNOSTIC_PC_CONTENT}") endif() -if (policy IN_LIST FEATURES) +if("policy" IN_LIST FEATURES) set(VCPKG_POLICY_SKIP_PKGCONFIG_CHECK enabled) endif() diff --git a/azure-pipelines/e2e-ports/vcpkg-policy-misplaced-regular-files/portfile.cmake b/azure-pipelines/e2e-ports/vcpkg-policy-misplaced-regular-files/portfile.cmake index c32d4bbd96..ff699e46b9 100644 --- a/azure-pipelines/e2e-ports/vcpkg-policy-misplaced-regular-files/portfile.cmake +++ b/azure-pipelines/e2e-ports/vcpkg-policy-misplaced-regular-files/portfile.cmake @@ -11,6 +11,6 @@ file(WRITE "${CURRENT_PACKAGES_DIR}/debug/bad_debug_file.txt" "") file(WRITE "${CURRENT_PACKAGES_DIR}/.DS_Store" "") file(WRITE "${CURRENT_PACKAGES_DIR}/bad_file.txt" "") -if (policy IN_LIST FEATURES) +if("policy" IN_LIST FEATURES) set(VCPKG_POLICY_SKIP_MISPLACED_REGULAR_FILES_CHECK enabled) endif() From 84d82594e9af8ca5367074293c18ff1ebe198a1a Mon Sep 17 00:00:00 2001 From: Billy Robert O'Neal III Date: Fri, 7 Jun 2024 16:08:54 -0700 Subject: [PATCH 14/14] Apply message text fixes from @ras0219-msft --- .../post-build-checks.ps1 | 22 +++++++++---------- include/vcpkg/base/message-data.inc.h | 8 +++---- locales/messages.json | 6 ++--- 3 files changed, 18 insertions(+), 18 deletions(-) diff --git a/azure-pipelines/end-to-end-tests-dir/post-build-checks.ps1 b/azure-pipelines/end-to-end-tests-dir/post-build-checks.ps1 index 0739f48abe..3ea7fb199a 100644 --- a/azure-pipelines/end-to-end-tests-dir/post-build-checks.ps1 +++ b/azure-pipelines/end-to-end-tests-dir/post-build-checks.ps1 @@ -90,7 +90,7 @@ $buildOutput = Run-VcpkgAndCaptureOutput @commonArgs install --overlay-ports="$P Throw-IfNotFailed $expected = @" $($PortfilePath): warning: `${CURRENT_PACKAGES_DIR}/debug/include should not exist. To suppress this message, add set(VCPKG_POLICY_ALLOW_DEBUG_INCLUDE enabled) -note: If this directory was created by a CMake build system that does not allow installing headers in debug to be disabled, delete the duplicate directory with file(REMOVE_RECURSE "`${CURRENT_PACKAGES_DIR}/debug/include") +note: If this directory was created by a build system that does not allow installing headers in debug to be disabled, delete the duplicate directory with file(REMOVE_RECURSE "`${CURRENT_PACKAGES_DIR}/debug/include") "@ if (-not $buildOutput.Replace("`r`n", "`n").Contains($expected)) { throw 'Did not detect debug headers' @@ -128,7 +128,7 @@ Refresh-TestRoot $buildOutput = Run-VcpkgAndCaptureOutput @commonArgs install --overlay-ports="$PSScriptRoot/../e2e-ports" 'vcpkg-policy-misplaced-cmake-files[do-install-cmake]' --no-binarycaching --enforce-port-checks Throw-IfNotFailed $expected = @" -$($PortfilePath): warning: This port installs the following CMake files in places CMake files are not expected. CMake should be installed in `${CURRENT_PACKAGES_DIR}/share/`${PORT}. To suppress this message, add set(VCPKG_POLICY_SKIP_MISPLACED_CMAKE_FILES_CHECK enabled) +$($PortfilePath): warning: This port installs the following CMake files in places CMake files are not expected. CMake files should be installed in `${CURRENT_PACKAGES_DIR}/share/`${PORT}. To suppress this message, add set(VCPKG_POLICY_SKIP_MISPLACED_CMAKE_FILES_CHECK enabled) $($packagesRoot)$($NativeSlash)vcpkg-policy-misplaced-cmake-files_$($Triplet): note: the files are relative to `${CURRENT_PACKAGES_DIR} here note: cmake/some_cmake.cmake note: debug/cmake/some_cmake.cmake @@ -144,7 +144,7 @@ Refresh-TestRoot $buildOutput = Run-VcpkgAndCaptureOutput @commonArgs install --overlay-ports="$PSScriptRoot/../e2e-ports" 'vcpkg-policy-misplaced-cmake-files[do-install-lib]' --no-binarycaching --enforce-port-checks Throw-IfNotFailed $expected = @" -$($PortfilePath): warning: This port installs the following CMake files in places CMake files are not expected. CMake should be installed in `${CURRENT_PACKAGES_DIR}/share/`${PORT}. To suppress this message, add set(VCPKG_POLICY_SKIP_MISPLACED_CMAKE_FILES_CHECK enabled) +$($PortfilePath): warning: This port installs the following CMake files in places CMake files are not expected. CMake files should be installed in `${CURRENT_PACKAGES_DIR}/share/`${PORT}. To suppress this message, add set(VCPKG_POLICY_SKIP_MISPLACED_CMAKE_FILES_CHECK enabled) $($packagesRoot)$($NativeSlash)vcpkg-policy-misplaced-cmake-files_$($Triplet): note: the files are relative to `${CURRENT_PACKAGES_DIR} here note: lib/cmake/some_cmake.cmake note: debug/lib/cmake/some_cmake.cmake @@ -161,7 +161,7 @@ Refresh-TestRoot $buildOutput = Run-VcpkgAndCaptureOutput @commonArgs install --overlay-ports="$PSScriptRoot/../e2e-ports" 'vcpkg-policy-misplaced-cmake-files[do-install-cmake,do-install-lib]' --no-binarycaching --enforce-port-checks Throw-IfNotFailed $expected = @" -$($PortfilePath): warning: This port installs the following CMake files in places CMake files are not expected. CMake should be installed in `${CURRENT_PACKAGES_DIR}/share/`${PORT}. To suppress this message, add set(VCPKG_POLICY_SKIP_MISPLACED_CMAKE_FILES_CHECK enabled) +$($PortfilePath): warning: This port installs the following CMake files in places CMake files are not expected. CMake files should be installed in `${CURRENT_PACKAGES_DIR}/share/`${PORT}. To suppress this message, add set(VCPKG_POLICY_SKIP_MISPLACED_CMAKE_FILES_CHECK enabled) $($packagesRoot)$($NativeSlash)vcpkg-policy-misplaced-cmake-files_$($Triplet): note: the files are relative to `${CURRENT_PACKAGES_DIR} here note: cmake/some_cmake.cmake note: debug/cmake/some_cmake.cmake @@ -193,7 +193,7 @@ Refresh-TestRoot $buildOutput = Run-VcpkgAndCaptureOutput @commonArgs install --overlay-ports="$PSScriptRoot/../e2e-ports" 'vcpkg-policy-misplaced-cmake-files[do-install-cmake,do-install-lib,policy-skip-lib-cmake-merge-check]' --no-binarycaching --enforce-port-checks Throw-IfNotFailed $expected = @" -$($PortfilePath): warning: This port installs the following CMake files in places CMake files are not expected. CMake should be installed in `${CURRENT_PACKAGES_DIR}/share/`${PORT}. To suppress this message, add set(VCPKG_POLICY_SKIP_MISPLACED_CMAKE_FILES_CHECK enabled) +$($PortfilePath): warning: This port installs the following CMake files in places CMake files are not expected. CMake files should be installed in `${CURRENT_PACKAGES_DIR}/share/`${PORT}. To suppress this message, add set(VCPKG_POLICY_SKIP_MISPLACED_CMAKE_FILES_CHECK enabled) $($packagesRoot)$($NativeSlash)vcpkg-policy-misplaced-cmake-files_$($Triplet): note: the files are relative to `${CURRENT_PACKAGES_DIR} here note: cmake/some_cmake.cmake note: debug/cmake/some_cmake.cmake @@ -823,7 +823,7 @@ $PortfilePath = "$PSScriptRoot/../e2e-ports$($NativeSlash)vcpkg-policy-misplaced $buildOutput = Run-VcpkgAndCaptureOutput @commonArgs install --overlay-ports="$PSScriptRoot/../e2e-ports" 'vcpkg-policy-misplaced-pkgconfig[install-arch-dependent-bad-misplaced]' --no-binarycaching --enforce-port-checks Throw-IfNotFailed $expected = @" -$($PortfilePath): warning: The following misplaced pkgconfig directories were installed. Misplaced pkgconfig files will not be found correctly by pkgconf or pkg-config. pkgconfig directories should be `${CURRENT_PACKAGES_DIR}/share/pkgconfig (for architecture agnostic / header only libraries only), `${CURRENT_PACKAGES_DIR}/lib/pkgconfig (for release dependencies), or `${CURRENT_PACKAGES_DIR}/lib/debug/pkgconfig (for debug dependencies). To suppress this message, add set(VCPKG_POLICY_SKIP_PKGCONFIG_CHECK enabled) +$($PortfilePath): warning: The following misplaced pkgconfig directories were installed. Misplaced pkgconfig files will not be found correctly by pkgconf or pkg-config. pkgconfig directories should be `${CURRENT_PACKAGES_DIR}/share/pkgconfig (for architecture agnostic / header only libraries only), `${CURRENT_PACKAGES_DIR}/lib/pkgconfig (for release dependencies), or `${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig (for debug dependencies). To suppress this message, add set(VCPKG_POLICY_SKIP_PKGCONFIG_CHECK enabled) $($packagesRoot)$($NativeSlash)vcpkg-policy-misplaced-pkgconfig_$($Triplet): note: the files are relative to `${CURRENT_PACKAGES_DIR} here note: bin/pkgconfig/zlib.pc note: debug/bin/pkgconfig/zlib.pc @@ -840,7 +840,7 @@ if (-not $buildOutput.Replace("`r`n", "`n").Contains($expected)) { $buildOutput = Run-VcpkgAndCaptureOutput @commonArgs install --overlay-ports="$PSScriptRoot/../e2e-ports" 'vcpkg-policy-misplaced-pkgconfig[install-arch-agnostic-bad-misplaced,install-arch-agnostic-empty-libs-bad-misplaced,install-arch-dependent-bad-misplaced,install-arch-dependent-bad-share]' --no-binarycaching --enforce-port-checks Throw-IfNotFailed $expected = @" -$($PortfilePath): warning: The following misplaced pkgconfig directories were installed. Misplaced pkgconfig files will not be found correctly by pkgconf or pkg-config. pkgconfig directories should be `${CURRENT_PACKAGES_DIR}/share/pkgconfig (for architecture agnostic / header only libraries only), `${CURRENT_PACKAGES_DIR}/lib/pkgconfig (for release dependencies), or `${CURRENT_PACKAGES_DIR}/lib/debug/pkgconfig (for debug dependencies). To suppress this message, add set(VCPKG_POLICY_SKIP_PKGCONFIG_CHECK enabled) +$($PortfilePath): warning: The following misplaced pkgconfig directories were installed. Misplaced pkgconfig files will not be found correctly by pkgconf or pkg-config. pkgconfig directories should be `${CURRENT_PACKAGES_DIR}/share/pkgconfig (for architecture agnostic / header only libraries only), `${CURRENT_PACKAGES_DIR}/lib/pkgconfig (for release dependencies), or `${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig (for debug dependencies). To suppress this message, add set(VCPKG_POLICY_SKIP_PKGCONFIG_CHECK enabled) $($packagesRoot)$($NativeSlash)vcpkg-policy-misplaced-pkgconfig_$($Triplet): note: the files are relative to `${CURRENT_PACKAGES_DIR} here note: bin/pkgconfig/libmorton.pc note: bin/pkgconfig/zlib-no-libs.pc @@ -871,7 +871,7 @@ Refresh-TestRoot $buildOutput = Run-VcpkgAndCaptureOutput @commonArgs install --overlay-ports="$PSScriptRoot/../e2e-ports" 'vcpkg-policy-misplaced-pkgconfig[install-arch-dependent-bad-misplaced-release-only]' --no-binarycaching --enforce-port-checks Throw-IfNotFailed $expected = @" -$($PortfilePath): warning: The following misplaced pkgconfig directories were installed. Misplaced pkgconfig files will not be found correctly by pkgconf or pkg-config. pkgconfig directories should be `${CURRENT_PACKAGES_DIR}/share/pkgconfig (for architecture agnostic / header only libraries only), `${CURRENT_PACKAGES_DIR}/lib/pkgconfig (for release dependencies), or `${CURRENT_PACKAGES_DIR}/lib/debug/pkgconfig (for debug dependencies). To suppress this message, add set(VCPKG_POLICY_SKIP_PKGCONFIG_CHECK enabled) +$($PortfilePath): warning: The following misplaced pkgconfig directories were installed. Misplaced pkgconfig files will not be found correctly by pkgconf or pkg-config. pkgconfig directories should be `${CURRENT_PACKAGES_DIR}/share/pkgconfig (for architecture agnostic / header only libraries only), `${CURRENT_PACKAGES_DIR}/lib/pkgconfig (for release dependencies), or `${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig (for debug dependencies). To suppress this message, add set(VCPKG_POLICY_SKIP_PKGCONFIG_CHECK enabled) $($packagesRoot)$($NativeSlash)vcpkg-policy-misplaced-pkgconfig_$($Triplet): note: the files are relative to `${CURRENT_PACKAGES_DIR} here note: bin/pkgconfig/zlib.pc note: You can move the pkgconfig files with commands similar to: @@ -887,7 +887,7 @@ if (-not $buildOutput.Replace("`r`n", "`n").Contains($expected)) { $buildOutput = Run-VcpkgAndCaptureOutput @commonArgs install --overlay-ports="$PSScriptRoot/../e2e-ports" 'vcpkg-policy-misplaced-pkgconfig[install-arch-agnostic-bad-misplaced]' --no-binarycaching --enforce-port-checks Throw-IfNotFailed $expected = @" -$($PortfilePath): warning: The following misplaced pkgconfig directories were installed. Misplaced pkgconfig files will not be found correctly by pkgconf or pkg-config. pkgconfig directories should be `${CURRENT_PACKAGES_DIR}/share/pkgconfig (for architecture agnostic / header only libraries only), `${CURRENT_PACKAGES_DIR}/lib/pkgconfig (for release dependencies), or `${CURRENT_PACKAGES_DIR}/lib/debug/pkgconfig (for debug dependencies). To suppress this message, add set(VCPKG_POLICY_SKIP_PKGCONFIG_CHECK enabled) +$($PortfilePath): warning: The following misplaced pkgconfig directories were installed. Misplaced pkgconfig files will not be found correctly by pkgconf or pkg-config. pkgconfig directories should be `${CURRENT_PACKAGES_DIR}/share/pkgconfig (for architecture agnostic / header only libraries only), `${CURRENT_PACKAGES_DIR}/lib/pkgconfig (for release dependencies), or `${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig (for debug dependencies). To suppress this message, add set(VCPKG_POLICY_SKIP_PKGCONFIG_CHECK enabled) $($packagesRoot)$($NativeSlash)vcpkg-policy-misplaced-pkgconfig_$($Triplet): note: the files are relative to `${CURRENT_PACKAGES_DIR} here note: bin/pkgconfig/libmorton.pc note: You can move the pkgconfig files with commands similar to: @@ -903,7 +903,7 @@ if (-not $buildOutput.Replace("`r`n", "`n").Contains($expected)) { $buildOutput = Run-VcpkgAndCaptureOutput @commonArgs install --overlay-ports="$PSScriptRoot/../e2e-ports" 'vcpkg-policy-misplaced-pkgconfig[install-arch-agnostic-empty-libs-bad-misplaced]' --no-binarycaching --enforce-port-checks Throw-IfNotFailed $expected = @" -$($PortfilePath): warning: The following misplaced pkgconfig directories were installed. Misplaced pkgconfig files will not be found correctly by pkgconf or pkg-config. pkgconfig directories should be `${CURRENT_PACKAGES_DIR}/share/pkgconfig (for architecture agnostic / header only libraries only), `${CURRENT_PACKAGES_DIR}/lib/pkgconfig (for release dependencies), or `${CURRENT_PACKAGES_DIR}/lib/debug/pkgconfig (for debug dependencies). To suppress this message, add set(VCPKG_POLICY_SKIP_PKGCONFIG_CHECK enabled) +$($PortfilePath): warning: The following misplaced pkgconfig directories were installed. Misplaced pkgconfig files will not be found correctly by pkgconf or pkg-config. pkgconfig directories should be `${CURRENT_PACKAGES_DIR}/share/pkgconfig (for architecture agnostic / header only libraries only), `${CURRENT_PACKAGES_DIR}/lib/pkgconfig (for release dependencies), or `${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig (for debug dependencies). To suppress this message, add set(VCPKG_POLICY_SKIP_PKGCONFIG_CHECK enabled) $($packagesRoot)$($NativeSlash)vcpkg-policy-misplaced-pkgconfig_$($Triplet): note: the files are relative to `${CURRENT_PACKAGES_DIR} here note: bin/pkgconfig/zlib-no-libs.pc note: You can move the pkgconfig files with commands similar to: @@ -919,7 +919,7 @@ if (-not $buildOutput.Replace("`r`n", "`n").Contains($expected)) { $buildOutput = Run-VcpkgAndCaptureOutput @commonArgs install --overlay-ports="$PSScriptRoot/../e2e-ports" 'vcpkg-policy-misplaced-pkgconfig[install-arch-dependent-bad-share]' --no-binarycaching --enforce-port-checks Throw-IfNotFailed $expected = @" -$($PortfilePath): warning: The following misplaced pkgconfig directories were installed. Misplaced pkgconfig files will not be found correctly by pkgconf or pkg-config. pkgconfig directories should be `${CURRENT_PACKAGES_DIR}/share/pkgconfig (for architecture agnostic / header only libraries only), `${CURRENT_PACKAGES_DIR}/lib/pkgconfig (for release dependencies), or `${CURRENT_PACKAGES_DIR}/lib/debug/pkgconfig (for debug dependencies). To suppress this message, add set(VCPKG_POLICY_SKIP_PKGCONFIG_CHECK enabled) +$($PortfilePath): warning: The following misplaced pkgconfig directories were installed. Misplaced pkgconfig files will not be found correctly by pkgconf or pkg-config. pkgconfig directories should be `${CURRENT_PACKAGES_DIR}/share/pkgconfig (for architecture agnostic / header only libraries only), `${CURRENT_PACKAGES_DIR}/lib/pkgconfig (for release dependencies), or `${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig (for debug dependencies). To suppress this message, add set(VCPKG_POLICY_SKIP_PKGCONFIG_CHECK enabled) $($packagesRoot)$($NativeSlash)vcpkg-policy-misplaced-pkgconfig_$($Triplet): note: the files are relative to `${CURRENT_PACKAGES_DIR} here note: share/pkgconfig/zlib.pc note: You can move the pkgconfig files with commands similar to: diff --git a/include/vcpkg/base/message-data.inc.h b/include/vcpkg/base/message-data.inc.h index b876cde180..26e5d198dd 100644 --- a/include/vcpkg/base/message-data.inc.h +++ b/include/vcpkg/base/message-data.inc.h @@ -2303,7 +2303,7 @@ DECLARE_MESSAGE( PortBugDuplicateIncludeFilesFixIt, (), "", - "If this directory was created by a CMake build system that does not allow installing headers in debug to be " + "If this directory was created by a build system that does not allow installing headers in debug to be " "disabled, delete the duplicate directory with file(REMOVE_RECURSE \"${{CURRENT_PACKAGES_DIR}}/debug/include\")") DECLARE_MESSAGE(PortBugFoundCopyrightFiles, (), "", "the following files are potential copyright files") DECLARE_MESSAGE(PortBugFoundDebugBinaries, (), "", "The following are debug binaries:") @@ -2402,8 +2402,8 @@ DECLARE_MESSAGE(PortBugMismatchingNumberOfBinaries, DECLARE_MESSAGE(PortBugMisplacedCMakeFiles, (), "", - "This port installs the following CMake files in places CMake files are not expected. CMake should be " - "installed in ${{CURRENT_PACKAGES_DIR}}/share/${{PORT}}. To suppress this message, add " + "This port installs the following CMake files in places CMake files are not expected. CMake files " + "should be installed in ${{CURRENT_PACKAGES_DIR}}/share/${{PORT}}. To suppress this message, add " "set(VCPKG_POLICY_SKIP_MISPLACED_CMAKE_FILES_CHECK enabled)") DECLARE_MESSAGE(PortBugMisplacedFiles, (), @@ -2418,7 +2418,7 @@ DECLARE_MESSAGE( "The following misplaced pkgconfig directories were installed. Misplaced pkgconfig files will not be found " "correctly by pkgconf or pkg-config. pkgconfig directories should be ${{CURRENT_PACKAGES_DIR}}/share/pkgconfig " "(for architecture agnostic / header only libraries only), ${{CURRENT_PACKAGES_DIR}}/lib/pkgconfig (for release " - "dependencies), or ${{CURRENT_PACKAGES_DIR}}/lib/debug/pkgconfig (for debug dependencies). To suppress this " + "dependencies), or ${{CURRENT_PACKAGES_DIR}}/debug/lib/pkgconfig (for debug dependencies). To suppress this " "message, add set(VCPKG_POLICY_SKIP_PKGCONFIG_CHECK enabled)") DECLARE_MESSAGE(PortBugMissingDebugBinaries, (), "", "Debug binaries were not found.") DECLARE_MESSAGE( diff --git a/locales/messages.json b/locales/messages.json index 0b3119eef7..5f45e0b204 100644 --- a/locales/messages.json +++ b/locales/messages.json @@ -1279,7 +1279,7 @@ "PortBugDllAppContainerBitNotSet": "The App Container bit must be set for all DLLs in Windows Store apps, and the triplet requests targeting the Windows Store, but the following DLLs were not built with the bit set. This usually means that toolchain linker flags are not being properly propagated, or the linker in use does not support the /APPCONTAINER switch. To suppress this message, add set(VCPKG_POLICY_SKIP_APPCONTAINER_CHECK enabled)", "PortBugDllInLibDir": "The following dlls were found in ${{CURRENT_PACKAGES_DIR}}/lib or ${{CURRENT_PACKAGES_DIR}}/debug/lib. Please move them to ${{CURRENT_PACKAGES_DIR}}/bin or ${{CURRENT_PACKAGES_DIR}}/debug/bin, respectively.", "PortBugDuplicateIncludeFiles": "${{CURRENT_PACKAGES_DIR}}/debug/include should not exist. To suppress this message, add set(VCPKG_POLICY_ALLOW_DEBUG_INCLUDE enabled)", - "PortBugDuplicateIncludeFilesFixIt": "If this directory was created by a CMake build system that does not allow installing headers in debug to be disabled, delete the duplicate directory with file(REMOVE_RECURSE \"${{CURRENT_PACKAGES_DIR}}/debug/include\")", + "PortBugDuplicateIncludeFilesFixIt": "If this directory was created by a build system that does not allow installing headers in debug to be disabled, delete the duplicate directory with file(REMOVE_RECURSE \"${{CURRENT_PACKAGES_DIR}}/debug/include\")", "PortBugFoundCopyrightFiles": "the following files are potential copyright files", "PortBugFoundDebugBinaries": "The following are debug binaries:", "PortBugFoundDllInStaticBuild": "DLLs should not be present in a static build, but the following DLLs were found. To suppress this message, add set(VCPKG_POLICY_DLLS_IN_STATIC_LIBRARY enabled)", @@ -1296,9 +1296,9 @@ "PortBugKernel32FromXbox": "The selected triplet targets Xbox, but the following DLLs link with kernel32. These DLLs cannot be loaded on Xbox, where kernel32 is not present. This is typically caused by linking with kernel32.lib rather than a suitable umbrella library, such as onecore_apiset.lib or xgameplatform.lib. You can inspect a DLL's dependencies with `dumpbin.exe /dependents mylibfile.dll`. To suppress this message, add set(VCPKG_POLICY_ALLOW_KERNEL32_FROM_XBOX enabled)", "PortBugMergeLibCMakeDir": "This port creates ${{CURRENT_PACKAGES_DIR}}/lib/cmake and/or ${{CURRENT_PACKAGES_DIR}}/debug/lib/cmake, which should be merged and moved to ${{CURRENT_PACKAGES_DIR}}/share/${{PORT}}/cmake. Please use the helper function vcpkg_cmake_config_fixup() from the port vcpkg-cmake-config. To suppress this message, add set(VCPKG_POLICY_SKIP_LIB_CMAKE_MERGE_CHECK enabled)", "PortBugMismatchingNumberOfBinaries": "mismatching number of debug and release binaries. This often indicates incorrect handling of debug or release in portfile.cmake or the build system. If the intent is to only ever produce release components for this triplet, the triplet should have set(VCPKG_BUILD_TYPE release) added to its .cmake file. To suppress this message, add set(VCPKG_POLICY_MISMATCHED_NUMBER_OF_BINARIES enabled)", - "PortBugMisplacedCMakeFiles": "This port installs the following CMake files in places CMake files are not expected. CMake should be installed in ${{CURRENT_PACKAGES_DIR}}/share/${{PORT}}. To suppress this message, add set(VCPKG_POLICY_SKIP_MISPLACED_CMAKE_FILES_CHECK enabled)", + "PortBugMisplacedCMakeFiles": "This port installs the following CMake files in places CMake files are not expected. CMake files should be installed in ${{CURRENT_PACKAGES_DIR}}/share/${{PORT}}. To suppress this message, add set(VCPKG_POLICY_SKIP_MISPLACED_CMAKE_FILES_CHECK enabled)", "PortBugMisplacedFiles": "The following regular files are installed to location(s) where regular files may not be installed. These should be installed in a subdirectory. To suppress this message, add set(VCPKG_POLICY_SKIP_MISPLACED_REGULAR_FILES_CHECK enabled)", - "PortBugMisplacedPkgConfigFiles": "The following misplaced pkgconfig directories were installed. Misplaced pkgconfig files will not be found correctly by pkgconf or pkg-config. pkgconfig directories should be ${{CURRENT_PACKAGES_DIR}}/share/pkgconfig (for architecture agnostic / header only libraries only), ${{CURRENT_PACKAGES_DIR}}/lib/pkgconfig (for release dependencies), or ${{CURRENT_PACKAGES_DIR}}/lib/debug/pkgconfig (for debug dependencies). To suppress this message, add set(VCPKG_POLICY_SKIP_PKGCONFIG_CHECK enabled)", + "PortBugMisplacedPkgConfigFiles": "The following misplaced pkgconfig directories were installed. Misplaced pkgconfig files will not be found correctly by pkgconf or pkg-config. pkgconfig directories should be ${{CURRENT_PACKAGES_DIR}}/share/pkgconfig (for architecture agnostic / header only libraries only), ${{CURRENT_PACKAGES_DIR}}/lib/pkgconfig (for release dependencies), or ${{CURRENT_PACKAGES_DIR}}/debug/lib/pkgconfig (for debug dependencies). To suppress this message, add set(VCPKG_POLICY_SKIP_PKGCONFIG_CHECK enabled)", "PortBugMissingCMakeHelperPortFile": "The ${{CURRENT_PACKAGES_DIR}}/share/${{PORT}}/vcpkg-port-config.cmake file does not exist. This file must exist for CMake helper ports. To suppress this message, remove set(VCPKG_POLICY_CMAKE_HELPER_PORT enabled)", "PortBugMissingDebugBinaries": "Debug binaries were not found.", "PortBugMissingImportedLibs": "Import libraries for installed DLLs appear to be missing. If this is intended, add set(VCPKG_POLICY_DLLS_WITHOUT_LIBS enabled)",