mirror of
git://code.qt.io/qt/qt5.git
synced 2026-03-17 17:56:11 +08:00
Do not error out on missing optional repository dependencies
Read the 'required' value from dependencies.yaml and store all required dependencies of repository 'qtfoo' in a global property QT_REQUIRED_DEPS_FOR_qtfoo. Check this property in the top-level CMakeLists.txt and only print informational messages instead of errors for optional dependencies. Fixes: QTBUG-91144 Change-Id: I0e1b84a70221857cebba1b9a27456ad3667bfe3a Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
This commit is contained in:
@@ -17,24 +17,34 @@ endfunction()
|
||||
# Each entry will be in the format dependency/sha1
|
||||
function(qt_internal_parse_dependencies depends_file out_dependencies)
|
||||
file(STRINGS "${depends_file}" lines)
|
||||
set(eof_marker "---EOF---")
|
||||
list(APPEND lines "${eof_marker}")
|
||||
set(required_default TRUE)
|
||||
set(dependencies "")
|
||||
set(dependency "")
|
||||
set(revision "")
|
||||
set(required "${required_default}")
|
||||
foreach(line IN LISTS lines)
|
||||
if(line STREQUAL "dependencies:")
|
||||
set(found_dependencies 1)
|
||||
elseif(found_dependencies)
|
||||
if(line MATCHES "^ ref: (.*)$")
|
||||
set(revision "${CMAKE_MATCH_1}")
|
||||
list(APPEND dependencies ${dependency}/${revision})
|
||||
set(dependency "")
|
||||
elseif (line MATCHES "^ (.*):$")
|
||||
if(dependency)
|
||||
if(line MATCHES "^ (.+):$" OR line STREQUAL "${eof_marker}")
|
||||
# Found a repo entry or end of file. Add the last seen dependency.
|
||||
if(NOT dependency STREQUAL "")
|
||||
if(revision STREQUAL "")
|
||||
message(FATAL_ERROR "Format error in ${depends_file} - ${dependency} does not specify revision!")
|
||||
endif()
|
||||
list(APPEND dependencies "${dependency}/${revision}/${required}")
|
||||
endif()
|
||||
# Remember the current dependency
|
||||
if(NOT line STREQUAL "${eof_marker}")
|
||||
set(dependency "${CMAKE_MATCH_1}")
|
||||
set(revision "")
|
||||
set(required "${required_default}")
|
||||
# dependencies are specified with relative path to this module
|
||||
string(REPLACE "../" "" dependency ${dependency})
|
||||
endif()
|
||||
elseif(line MATCHES "^ ref: (.+)$")
|
||||
set(revision "${CMAKE_MATCH_1}")
|
||||
elseif(line MATCHES "^ required: (.+)$")
|
||||
string(TOUPPER "${CMAKE_MATCH_1}" required)
|
||||
endif()
|
||||
endforeach()
|
||||
message(DEBUG "qt_internal_parse_dependencies for ${depends_file}: ${dependencies} ${revisions}")
|
||||
@@ -66,10 +76,16 @@ function(qt_internal_add_module_dependencies module ordered out_ordered out_has_
|
||||
endif()
|
||||
set(modules_dependencies "")
|
||||
foreach(dependency IN LISTS dependencies)
|
||||
string(FIND "${dependency}" "/" splitindex REVERSE)
|
||||
string(SUBSTRING "${dependency}" ${splitindex} -1 revision)
|
||||
string(SUBSTRING "${revision}" 1 -1 revision)
|
||||
string(SUBSTRING "${dependency}" 0 ${splitindex} dependency)
|
||||
if(dependency MATCHES "(.*)/([^/]+)/([^/]+)")
|
||||
set(dependency "${CMAKE_MATCH_1}")
|
||||
set(revision "${CMAKE_MATCH_2}")
|
||||
set(required "${CMAKE_MATCH_3}")
|
||||
if(required)
|
||||
set_property(GLOBAL APPEND PROPERTY QT_REQUIRED_DEPS_FOR_${module} ${dependency})
|
||||
endif()
|
||||
else()
|
||||
message(FATAL_ERROR "Internal Error: wrong dependency format ${dependency}")
|
||||
endif()
|
||||
list(APPEND modules_dependencies "${dependency}")
|
||||
list(FIND ordered "${dependency}" dindex)
|
||||
if (dindex EQUAL -1)
|
||||
|
||||
Reference in New Issue
Block a user