Add support for QTQUICK_COMPILER_SKIPPED_RESOURCES

Detect this in the conversion script and map it to a source file
property. When that's the case, avoid repeating the file list but
instead store it in a variable.

Change-Id: If3119d83914bb798766e27351746b4e867bd3ab3
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
This commit is contained in:
Simon Hausmann 2019-08-09 11:01:41 +02:00
parent 587581963e
commit 8ba882a0b3
2 changed files with 13 additions and 4 deletions

View File

@ -2425,7 +2425,7 @@ function(qt_quick_compiler_process_resources target resource_name)
foreach(file IN LISTS arg_FILES)
# check whether this resource should not be processed by the qt quick
# compiler
get_source_file_property(skip_compiler_check ${file} QT_QUICKCOMPILER_SKIPPED_RESOURCE)
get_source_file_property(skip_compiler_check ${file} QT_SKIP_QUICKCOMPILER)
if (skip_compiler_check)
list(APPEND resource_files ${file})
continue()

View File

@ -115,7 +115,7 @@ def find_qmake_conf(project_file_path: str = '') -> typing.Optional[str]:
return None
def process_qrc_file(target: str, filepath: str, base_dir: str = '', project_file_path: str = '') -> str:
def process_qrc_file(target: str, filepath: str, base_dir: str = '', project_file_path: str = '', skip_qtquick_compiler: bool = False) -> str:
assert(target)
# Hack to handle QT_SOURCE_TREE. Assume currently that it's the same
@ -181,6 +181,14 @@ def process_qrc_file(target: str, filepath: str, base_dir: str = '', project_fil
output += 'set_source_files_properties("{}"\n' \
' PROPERTIES alias "{}"\n)\n'.format(full_source, alias)
if skip_qtquick_compiler:
file_list = '\n '.join(sorted_files)
output += 'set(resource_files\n {}\n)\n\n'.format(file_list)
file_list = "${resource_files}"
output += 'set_source_files_properties(${resource_files} QT_SKIP_QUICKCOMPILER 1)\n\n'
else:
file_list = '\n '.join(sorted_files)
params = ''
if lang:
params += ' LANG\n "{}"\n'.format(lang)
@ -190,7 +198,7 @@ def process_qrc_file(target: str, filepath: str, base_dir: str = '', project_fil
params += ' BASE\n "{}"\n'.format(base_dir)
output += 'add_qt_resource({} "{}"\n{} FILES\n {}\n)\n'.format(target, full_resource_name,
params,
'\n '.join(sorted_files))
file_list)
resource_count += 1
@ -1666,12 +1674,13 @@ def write_resources(cm_fh: typing.IO[str], target: str, scope: Scope, indent: in
# Handle QRC files by turning them into add_qt_resource:
resources = scope.get_files('RESOURCES')
qtquickcompiler_skipped = scope.get_files('QTQUICK_COMPILER_SKIPPED_RESOURCES')
qrc_output = ''
if resources:
qrc_only = True
for r in resources:
if r.endswith('.qrc'):
qrc_output += process_qrc_file(target, r, scope.basedir, scope.file_absolute_path)
qrc_output += process_qrc_file(target, r, scope.basedir, scope.file_absolute_path, r in qtquickcompiler_skipped)
else:
qrc_only = False