Remove retained quick compiler resource files

Remove retained file feature as the expected behavior now is for the
compiled file to be retained by default.

Change-Id: I5a791a182825b223eb4497970fbb1c47c70135cc
Reviewed-by: Qt CMake Build Bot
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
This commit is contained in:
Leander Beernaert 2020-02-04 16:50:30 +01:00
parent 5a985f020d
commit 7e2c198e90

View File

@ -40,13 +40,11 @@ function(__qt_quick_compiler_process_resources target resource_name)
set(qml_files) set(qml_files)
set(resource_files) set(resource_files)
set(retained_files)
# scan for qml files # scan for qml files
foreach(file IN LISTS arg_FILES) foreach(file IN LISTS arg_FILES)
# check whether this resource should not be processed by the qt quick # check whether this resource should not be processed by the qt quick
# compiler # compiler
get_source_file_property(skip_compiler_check ${file} QT_SKIP_QUICKCOMPILER) get_source_file_property(skip_compiler_check ${file} QT_SKIP_QUICKCOMPILER)
get_source_file_property(retain_compiler_check ${file} QT_RETAIN_QUICKCOMPILER)
if (skip_compiler_check) if (skip_compiler_check)
list(APPEND resource_files ${file}) list(APPEND resource_files ${file})
continue() continue()
@ -56,19 +54,13 @@ function(__qt_quick_compiler_process_resources target resource_name)
OR ${file} MATCHES "\.mjs$" OR ${file} MATCHES "\.mjs$"
OR ${file} MATCHES "\.qml$") OR ${file} MATCHES "\.qml$")
list(APPEND qml_files ${file}) list(APPEND qml_files ${file})
if (retain_compiler_check)
list(APPEND retained_files ${file})
list(APPEND resource_files ${file})
endif()
else()
list(APPEND resource_files ${file})
endif() endif()
list(APPEND resource_files ${file})
endforeach() endforeach()
if (NOT TARGET @QT_CMAKE_EXPORT_NAMESPACE@::qmlcachegen AND qml_files) if (NOT TARGET @QT_CMAKE_EXPORT_NAMESPACE@::qmlcachegen AND qml_files)
message(WARNING "QT@PROJECT_VERSION_MAJOR@_PROCESS_RESOURCE: Qml files were detected but the qmlcachgen target is not defined. Consider adding QmlTools to your find_package command.") message(WARNING "QT@PROJECT_VERSION_MAJOR@_PROCESS_RESOURCE: Qml files were detected but the qmlcachgen target is not defined. Consider adding QmlTools to your find_package command.")
endif() endif()
set(retained_resource_paths)
if (TARGET @QT_CMAKE_EXPORT_NAMESPACE@::qmlcachegen AND qml_files) if (TARGET @QT_CMAKE_EXPORT_NAMESPACE@::qmlcachegen AND qml_files)
# Enable qt quick compiler support # Enable qt quick compiler support
set(qml_resource_file "${CMAKE_CURRENT_BINARY_DIR}/.rcc/${resource_name}.qrc") set(qml_resource_file "${CMAKE_CURRENT_BINARY_DIR}/.rcc/${resource_name}.qrc")
@ -86,9 +78,6 @@ function(__qt_quick_compiler_process_resources target resource_name)
else() else()
set(file_resource_path "${arg_PREFIX}/${file_resource_path}") set(file_resource_path "${arg_PREFIX}/${file_resource_path}")
endif() endif()
if (file IN_LIST retained_files)
list(APPEND retained_resource_paths ${file_resource_path})
endif()
file(TO_CMAKE_PATH ${file_resource_path} file_resource_path) file(TO_CMAKE_PATH ${file_resource_path} file_resource_path)
list(APPEND file_resource_paths ${file_resource_path}) list(APPEND file_resource_paths ${file_resource_path})
string(REGEX REPLACE "\.js$" "_js" compiled_file ${file_relative}) string(REGEX REPLACE "\.js$" "_js" compiled_file ${file_relative})
@ -127,21 +116,11 @@ function(__qt_quick_compiler_process_resources target resource_name)
set(resource_name_arg "${resource_name_arg}=${chained_resource_name}") set(resource_name_arg "${resource_name_arg}=${chained_resource_name}")
endif() endif()
if (retained_resource_paths)
set(retained_loader_list "${CMAKE_CURRENT_BINARY_DIR}/.rcc/qmlcache/${resource_name}/retained_file_list.rsp")
file(GENERATE
OUTPUT ${retained_loader_list}
CONTENT "$<JOIN:${retained_resource_paths},\n>"
)
set(retained_args "--retain" "@${retained_loader_list}")
endif()
add_custom_command( add_custom_command(
OUTPUT ${qmlcache_loader_file} OUTPUT ${qmlcache_loader_file}
${QT_TOOL_PATH_SETUP_COMMAND} ${QT_TOOL_PATH_SETUP_COMMAND}
COMMAND COMMAND
@QT_CMAKE_EXPORT_NAMESPACE@::qmlcachegen @QT_CMAKE_EXPORT_NAMESPACE@::qmlcachegen
${retained_args}
--resource-name "${resource_name_arg}" --resource-name "${resource_name_arg}"
-o "${qmlcache_loader_file}" -o "${qmlcache_loader_file}"
"@${qmlcache_loader_list}" "@${qmlcache_loader_list}"