diff options
| author | Billy O'Neal <bion@microsoft.com> | 2020-10-28 14:18:07 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-10-28 14:18:07 -0700 |
| commit | 09a647a5261e981cbbc8219292c838490ed0b06f (patch) | |
| tree | 9d18df2f364a3d2bbaa156d76f5d265fc442c2f3 /scripts | |
| parent | ead8d6bad477f0b075f31097673c3e440356cd3b (diff) | |
| download | vcpkg-09a647a5261e981cbbc8219292c838490ed0b06f.tar.gz vcpkg-09a647a5261e981cbbc8219292c838490ed0b06f.zip | |
Delete use of vcpkg_test_cmake and vcpkg_common_functions. (#13065)
Diffstat (limited to 'scripts')
| -rw-r--r-- | scripts/azure-pipelines/end-to-end-tests.ps1 | 28 | ||||
| -rw-r--r-- | scripts/cmake/vcpkg_common_functions.cmake | 52 | ||||
| -rw-r--r-- | scripts/cmake/vcpkg_test_cmake.cmake | 27 | ||||
| -rw-r--r-- | scripts/e2e_ports/vcpkg-uses-test-cmake/portfile.cmake | 3 | ||||
| -rw-r--r-- | scripts/e2e_ports/vcpkg-uses-test-cmake/vcpkg.json | 6 | ||||
| -rw-r--r-- | scripts/e2e_ports/vcpkg-uses-vcpkg-common-functions/portfile.cmake | 3 | ||||
| -rw-r--r-- | scripts/e2e_ports/vcpkg-uses-vcpkg-common-functions/vcpkg.json | 6 | ||||
| -rw-r--r-- | scripts/ports.cmake | 60 | ||||
| -rw-r--r-- | scripts/templates/portfile.in.cmake | 3 |
9 files changed, 107 insertions, 81 deletions
diff --git a/scripts/azure-pipelines/end-to-end-tests.ps1 b/scripts/azure-pipelines/end-to-end-tests.ps1 index 50e7f6afd..3b6fe5aaa 100644 --- a/scripts/azure-pipelines/end-to-end-tests.ps1 +++ b/scripts/azure-pipelines/end-to-end-tests.ps1 @@ -41,7 +41,8 @@ $commonArgs = @( $Triplet,
"--x-buildtrees-root=$buildtreesRoot",
"--x-install-root=$installRoot",
- "--x-packages-root=$packagesRoot"
+ "--x-packages-root=$packagesRoot",
+ "--overlay-ports=scripts/e2e_ports"
)
$CurrentTest = 'unassigned'
@@ -190,6 +191,31 @@ if ((Get-ChildItem $NuGetRoot -Filter '*.nupkg' | Measure-Object).Count -ne 1) { throw "In '$CurrentTest': did not create exactly 1 NuGet package"
}
+# Test that prohibiting backcompat features actually prohibits
+$backcompatFeaturePorts = @('vcpkg-uses-test-cmake', 'vcpkg-uses-vcpkg-common-functions')
+foreach ($backcompatFeaturePort in $backcompatFeaturePorts) {
+ $succeedArgs = $commonArgs + @('install',$backcompatFeaturePort,'--no-binarycaching')
+ $failArgs = $succeedArgs + @('--x-prohibit-backcompat-features')
+ $CurrentTest = "Should fail: ./vcpkg $($failArgs -join ' ')"
+ Write-Host $CurrentTest
+ ./vcpkg @failArgs
+ if ($LastExitCode -ne 0) {
+ Write-Host "... failed (this is good!)"
+ } else {
+ throw $CurrentTest
+ }
+
+ # Install failed when prohibiting backcompat features, so it should succeed if we allow them
+ $CurrentTest = "Should succeeed: ./vcpkg $($succeedArgs -join ' ')"
+ Write-Host $CurrentTest
+ ./vcpkg @succeedArgs
+ if ($LastExitCode -ne 0) {
+ throw $CurrentTest
+ } else {
+ Write-Host "... succeeded."
+ }
+}
+
# Test export
$CurrentTest = 'Prepare for export test'
Write-Host $CurrentTest
diff --git a/scripts/cmake/vcpkg_common_functions.cmake b/scripts/cmake/vcpkg_common_functions.cmake index 2fad7f0ed..4aeb9524a 100644 --- a/scripts/cmake/vcpkg_common_functions.cmake +++ b/scripts/cmake/vcpkg_common_functions.cmake @@ -1,51 +1 @@ -include(execute_process) -include(vcpkg_acquire_msys) -include(vcpkg_add_to_path) -include(vcpkg_check_features) -include(vcpkg_check_linkage) -include(vcpkg_clean_executables_in_bin) -include(vcpkg_clean_msbuild) -include(vcpkg_download_distfile) -include(vcpkg_extract_source_archive) -include(vcpkg_extract_source_archive_ex) -include(vcpkg_execute_required_process) -include(vcpkg_execute_required_process_repeat) -include(vcpkg_execute_build_process) -include(vcpkg_fail_port_install) -include(vcpkg_find_acquire_program) -include(vcpkg_fixup_cmake_targets) -include(vcpkg_fixup_pkgconfig) -include(vcpkg_from_github) -include(vcpkg_from_gitlab) -include(vcpkg_from_bitbucket) -include(vcpkg_from_sourceforge) -include(vcpkg_build_cmake) -include(vcpkg_build_gn) -include(vcpkg_build_msbuild) -include(vcpkg_build_qmake) -include(vcpkg_build_make) -include(vcpkg_build_ninja) -include(vcpkg_build_nmake) -include(vcpkg_install_cmake) -include(vcpkg_install_gn) -include(vcpkg_install_meson) -include(vcpkg_install_msbuild) -include(vcpkg_install_make) -include(vcpkg_install_nmake) -include(vcpkg_install_qmake) -include(vcpkg_configure_cmake) -include(vcpkg_configure_gn) -include(vcpkg_configure_meson) -include(vcpkg_configure_qmake) -include(vcpkg_configure_make) -include(vcpkg_apply_patches) -include(vcpkg_copy_pdbs) -include(vcpkg_copy_tool_dependencies) -include(vcpkg_copy_tools) -include(vcpkg_get_program_files_platform_bitness) -include(vcpkg_get_windows_sdk) -include(vcpkg_replace_string) -include(vcpkg_from_git) -include(vcpkg_test_cmake) -include(vcpkg_prettify_command) -include(vcpkg_buildpath_length_warning) +message("${_VCPKG_BACKCOMPAT_MESSAGE_LEVEL}" "vcpkg_common_functions has been removed and all values are automatically provided in all portfile.cmake invocations. Please remove `include(vcpkg_common_functions)`.")
diff --git a/scripts/cmake/vcpkg_test_cmake.cmake b/scripts/cmake/vcpkg_test_cmake.cmake index eeb27867c..48d247f67 100644 --- a/scripts/cmake/vcpkg_test_cmake.cmake +++ b/scripts/cmake/vcpkg_test_cmake.cmake @@ -1,24 +1,3 @@ -## # vcpkg_test_cmake -## -## Tests a built package for CMake `find_package()` integration. -## -## ## Usage: -## ```cmake -## vcpkg_test_cmake(PACKAGE_NAME <name> [MODULE]) -## ``` -## -## ## Parameters: -## -## ### PACKAGE_NAME -## The expected name to find with `find_package()`. -## -## ### MODULE -## Indicates that the library expects to be found via built-in CMake targets. -## -function(vcpkg_test_cmake) - # The following issues need to be addressed before re-enabling this function. - # 1. Use the actual vcpkg toolchain file. - # 2. Select a generator in the same method as vcpkg_configure_cmake() as though the PREFER_NINJA flag was always passed. - # 3. Fully emulate the toolchain file for the just-built package (just adding it to CMAKE_PREFIX_PATH is not enough). - return() -endfunction() +function(vcpkg_test_cmake)
+ message("${_VCPKG_BACKCOMPAT_MESSAGE_LEVEL}" "vcpkg_test_cmake was a no-op and has been removed. Please remove the call to `vcpkg_test_cmake()`.")
+endfunction()
diff --git a/scripts/e2e_ports/vcpkg-uses-test-cmake/portfile.cmake b/scripts/e2e_ports/vcpkg-uses-test-cmake/portfile.cmake new file mode 100644 index 000000000..571ae3b7a --- /dev/null +++ b/scripts/e2e_ports/vcpkg-uses-test-cmake/portfile.cmake @@ -0,0 +1,3 @@ +set(VCPKG_POLICY_EMPTY_PACKAGE enabled)
+
+vcpkg_test_cmake(args args args)
diff --git a/scripts/e2e_ports/vcpkg-uses-test-cmake/vcpkg.json b/scripts/e2e_ports/vcpkg-uses-test-cmake/vcpkg.json new file mode 100644 index 000000000..9f34e058d --- /dev/null +++ b/scripts/e2e_ports/vcpkg-uses-test-cmake/vcpkg.json @@ -0,0 +1,6 @@ +{
+ "name": "vcpkg-uses-test-cmake",
+ "version-string": "1.0.0",
+ "description": "A test port that uses the deprecated function vcpkg_test_cmake.",
+ "homepage": ""
+}
diff --git a/scripts/e2e_ports/vcpkg-uses-vcpkg-common-functions/portfile.cmake b/scripts/e2e_ports/vcpkg-uses-vcpkg-common-functions/portfile.cmake new file mode 100644 index 000000000..9207d30b1 --- /dev/null +++ b/scripts/e2e_ports/vcpkg-uses-vcpkg-common-functions/portfile.cmake @@ -0,0 +1,3 @@ +set(VCPKG_POLICY_EMPTY_PACKAGE enabled)
+
+include(vcpkg_common_functions)
diff --git a/scripts/e2e_ports/vcpkg-uses-vcpkg-common-functions/vcpkg.json b/scripts/e2e_ports/vcpkg-uses-vcpkg-common-functions/vcpkg.json new file mode 100644 index 000000000..7c16ffe82 --- /dev/null +++ b/scripts/e2e_ports/vcpkg-uses-vcpkg-common-functions/vcpkg.json @@ -0,0 +1,6 @@ +{
+ "name": "vcpkg-uses-vcpkg-common-functions",
+ "version-string": "1.0.0",
+ "description": "A test port that uses the deprecated file vcpkg_common_functions.",
+ "homepage": ""
+}
diff --git a/scripts/ports.cmake b/scripts/ports.cmake index 5e21e3d7d..c05323ec9 100644 --- a/scripts/ports.cmake +++ b/scripts/ports.cmake @@ -6,6 +6,13 @@ macro(debug_message) endif() endmacro() +option(_VCPKG_PROHIBIT_BACKCOMPAT_FEATURES "Controls whether use of a backcompat only support feature fails the build.") +if (_VCPKG_PROHIBIT_BACKCOMPAT_FEATURES) + set(_VCPKG_BACKCOMPAT_MESSAGE_LEVEL "FATAL_ERROR") +else() + set(_VCPKG_BACKCOMPAT_MESSAGE_LEVEL "WARNING") +endif() + if((NOT DEFINED VCPKG_ROOT_DIR) OR (NOT DEFINED DOWNLOADS) OR (NOT DEFINED _VCPKG_INSTALLED_DIR) @@ -29,7 +36,6 @@ if(PORT) set(CURRENT_PACKAGES_DIR ${PACKAGES_DIR}/${PORT}_${TARGET_TRIPLET}) endif() - if(CMD MATCHES "^BUILD$") set(CMAKE_TRIPLET_FILE ${TARGET_TRIPLET_FILE}) if(NOT EXISTS ${CMAKE_TRIPLET_FILE}) @@ -75,7 +81,57 @@ if(CMD MATCHES "^BUILD$") set(TRIPLET_SYSTEM_ARCH ${VCPKG_TARGET_ARCHITECTURE}) include(${SCRIPTS}/cmake/vcpkg_common_definitions.cmake) - include(${SCRIPTS}/cmake/vcpkg_common_functions.cmake) + include(execute_process) + include(vcpkg_acquire_msys) + include(vcpkg_add_to_path) + include(vcpkg_apply_patches) + include(vcpkg_build_cmake) + include(vcpkg_build_gn) + include(vcpkg_build_make) + include(vcpkg_build_msbuild) + include(vcpkg_build_ninja) + include(vcpkg_build_nmake) + include(vcpkg_build_qmake) + include(vcpkg_buildpath_length_warning) + include(vcpkg_check_features) + include(vcpkg_check_linkage) + include(vcpkg_clean_executables_in_bin) + include(vcpkg_clean_msbuild) + include(vcpkg_configure_cmake) + include(vcpkg_configure_gn) + include(vcpkg_configure_make) + include(vcpkg_configure_meson) + include(vcpkg_configure_qmake) + include(vcpkg_copy_pdbs) + include(vcpkg_copy_tool_dependencies) + include(vcpkg_copy_tools) + include(vcpkg_download_distfile) + include(vcpkg_execute_build_process) + include(vcpkg_execute_required_process) + include(vcpkg_execute_required_process_repeat) + include(vcpkg_extract_source_archive) + include(vcpkg_extract_source_archive_ex) + include(vcpkg_fail_port_install) + include(vcpkg_find_acquire_program) + include(vcpkg_fixup_cmake_targets) + include(vcpkg_fixup_pkgconfig) + include(vcpkg_from_bitbucket) + include(vcpkg_from_git) + include(vcpkg_from_github) + include(vcpkg_from_gitlab) + include(vcpkg_from_sourceforge) + include(vcpkg_get_program_files_platform_bitness) + include(vcpkg_get_windows_sdk) + include(vcpkg_install_cmake) + include(vcpkg_install_gn) + include(vcpkg_install_make) + include(vcpkg_install_meson) + include(vcpkg_install_msbuild) + include(vcpkg_install_nmake) + include(vcpkg_install_qmake) + include(vcpkg_prettify_command) + include(vcpkg_replace_string) + include(vcpkg_test_cmake) include(${CURRENT_PORT_DIR}/portfile.cmake) if(DEFINED PORT) include(${SCRIPTS}/build_info.cmake) diff --git a/scripts/templates/portfile.in.cmake b/scripts/templates/portfile.in.cmake index 7ddf662e8..5cd363ddc 100644 --- a/scripts/templates/portfile.in.cmake +++ b/scripts/templates/portfile.in.cmake @@ -75,6 +75,3 @@ vcpkg_install_cmake() # # Handle copyright # file(INSTALL ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/@PORT@ RENAME copyright) - -# # Post-build test for cmake libraries -# vcpkg_test_cmake(PACKAGE_NAME @PORT@) |
