diff options
author | Brad King <brad.king@kitware.com> | 2021-03-30 11:52:36 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2021-04-05 17:43:51 (GMT) |
commit | 0237eba318b52720f07b69c3d5df0fcb90c75c66 (patch) | |
tree | 534cc3c97d1da870df96e1c01112de691e3e6177 /Tests | |
parent | fc9c1d83bf23852bfeb280aac2890b5b3fc94414 (diff) | |
download | CMake-0237eba318b52720f07b69c3d5df0fcb90c75c66.zip CMake-0237eba318b52720f07b69c3d5df0fcb90c75c66.tar.gz CMake-0237eba318b52720f07b69c3d5df0fcb90c75c66.tar.bz2 |
Utilities/Release: Add script to generate a table of files
Fixes: #22002
Diffstat (limited to 'Tests')
-rw-r--r-- | Tests/RunCMake/CMakeLists.txt | 1 | ||||
-rw-r--r-- | Tests/RunCMake/CMakeRelease/FileTable-stdout.txt | 36 | ||||
-rw-r--r-- | Tests/RunCMake/CMakeRelease/FileTable.cmake | 20 | ||||
-rw-r--r-- | Tests/RunCMake/CMakeRelease/RunCMakeTest.cmake | 10 |
4 files changed, 67 insertions, 0 deletions
diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt index 36409d8..2a39e73 100644 --- a/Tests/RunCMake/CMakeLists.txt +++ b/Tests/RunCMake/CMakeLists.txt @@ -197,6 +197,7 @@ if(UNIX AND "${CMAKE_GENERATOR}" MATCHES "Unix Makefiles|Ninja") add_RunCMake_test(Byproducts) endif() add_RunCMake_test(CMakeRoleGlobalProperty) +add_RunCMake_test(CMakeRelease -DCMake_TEST_JQ=${CMake_TEST_JQ}) if(UNIX AND "${CMAKE_GENERATOR}" MATCHES "Unix Makefiles|Ninja") add_RunCMake_test(CompilerChange) endif() diff --git a/Tests/RunCMake/CMakeRelease/FileTable-stdout.txt b/Tests/RunCMake/CMakeRelease/FileTable-stdout.txt new file mode 100644 index 0000000..441e9b0 --- /dev/null +++ b/Tests/RunCMake/CMakeRelease/FileTable-stdout.txt @@ -0,0 +1,36 @@ +^-- query: \.version \| \.major , \.minor , \.patch , \.suffix, \.string +1 +2 +3 +"rc4" +"@version@" +-- query: \.files\[\]\.name +"cmake-@version@-Linux-x86_64\.sh" +"cmake-@version@-Linux-x86_64\.tar\.gz" +"cmake-@version@-Darwin-x86_64\.dmg" +"cmake-@version@-Darwin-x86_64\.tar\.gz" +"cmake-@version@-win32-x86\.msi" +"cmake-@version@-win32-x86\.zip" +"cmake-@version@-win64-x64\.msi" +"cmake-@version@-win64-x64\.zip" +"cmake-@version@\.tar\.gz" +"cmake-@version@\.zip" +-- query: \.files\[\] \| select\(\.os\[\] \| \. == "source"\) \| \.name +"cmake-@version@\.tar\.gz" +"cmake-@version@\.zip" +-- query: \.files\[\] \| select\(\(\.os\[\] \| \. == "macOS"\) and \(\.class == "volume"\)\) \| \.name +"cmake-@version@-Darwin-x86_64\.dmg" +-- query: \.files\[\] \| select\(\(\.os\[\] \| \. == "windows"\) and \(\.architecture\[\] \| \. == "i386"\) and \(\.class == "installer"\)\) \| \.name +"cmake-@version@-win32-x86\.msi" +-- query: \.files\[\] \| select\(\.architecture\[\] \| \. == "x86_64"\) \| \.name +"cmake-@version@-Linux-x86_64\.sh" +"cmake-@version@-Linux-x86_64\.tar\.gz" +"cmake-@version@-Darwin-x86_64\.dmg" +"cmake-@version@-Darwin-x86_64\.tar\.gz" +"cmake-@version@-win64-x64\.msi" +"cmake-@version@-win64-x64\.zip" +-- query: \.files\[\] \| select\(\[\.macOSmin\] \| inside\(\["10\.7", "10\.8", "10\.9"\]\)\) \| \.name +"cmake-@version@-Darwin-x86_64\.dmg" +"cmake-@version@-Darwin-x86_64\.tar\.gz" +-- query: \.hashFiles\[\] \| select\(\.algorithm\[\] \| \. == "SHA-256"\) \| \.name +"cmake-@version@-SHA-256\.txt"$ diff --git a/Tests/RunCMake/CMakeRelease/FileTable.cmake b/Tests/RunCMake/CMakeRelease/FileTable.cmake new file mode 100644 index 0000000..1bddeb8 --- /dev/null +++ b/Tests/RunCMake/CMakeRelease/FileTable.cmake @@ -0,0 +1,20 @@ +set(version "@version@") +set(version_major "1") +set(version_minor "2") +set(version_patch "3") +set(maybe_version_suffix "\"suffix\": \"rc4\",") +configure_file("${CMAKE_CURRENT_LIST_DIR}/../../../Utilities/Release/files-v1.json.in" "files-v1.json" @ONLY) + +foreach(query + ".version | .major , .minor , .patch , .suffix, .string" + ".files[].name" + ".files[] | select(.os[] | . == \"source\") | .name" + ".files[] | select((.os[] | . == \"macOS\") and (.class == \"volume\")) | .name" + ".files[] | select((.os[] | . == \"windows\") and (.architecture[] | . == \"i386\") and (.class == \"installer\")) | .name" + ".files[] | select(.architecture[] | . == \"x86_64\") | .name" + ".files[] | select([.macOSmin] | inside([\"10.7\", \"10.8\", \"10.9\"])) | .name" + ".hashFiles[] | select(.algorithm[] | . == \"SHA-256\") | .name" + ) + message(STATUS "query: ${query}") + execute_process(COMMAND ${JQ} "${query}" files-v1.json) +endforeach() diff --git a/Tests/RunCMake/CMakeRelease/RunCMakeTest.cmake b/Tests/RunCMake/CMakeRelease/RunCMakeTest.cmake new file mode 100644 index 0000000..9a08ff3 --- /dev/null +++ b/Tests/RunCMake/CMakeRelease/RunCMakeTest.cmake @@ -0,0 +1,10 @@ +include(RunCMake) + +if(CMake_TEST_JQ) + set(JQ "${CMake_TEST_JQ}") +else() + find_program(JQ NAMES jq) +endif() +if(JQ) + run_cmake_script(FileTable -DJQ=${JQ}) +endif() |