Fix calls to qtFlattenResources from outside resources.prf

The xml_escape function must be part of resources_functions.prf, and the
qmake_immediate resource must not be created multiple times. Instead,
create another qmake_immediate resource with a number suffix.

This commit amends 577b6554.

Task-number: QTBUG-79672
Change-Id: Ibbe20c0fd1940f1fe7733cd1e5b0891f65689782
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
This commit is contained in:
Joerg Bornemann 2019-11-27 14:52:32 +01:00
parent 42aa740df7
commit c5777ad81c
2 changed files with 21 additions and 14 deletions

View File

@ -6,16 +6,6 @@ isEmpty(QMAKE_MOD_RCC):QMAKE_MOD_RCC = qrc
!contains(QMAKE_RESOURCE_FLAGS, -root):!isEmpty(QMAKE_RESOURCE_ROOT):QMAKE_RESOURCE_FLAGS += -root $$QMAKE_RESOURCE_ROOT
!contains(QMAKE_RESOURCE_FLAGS, -name): QMAKE_RESOURCE_FLAGS += -name ${QMAKE_FILE_BASE}
# http://www.w3.org/TR/xml/#syntax
defineReplace(xml_escape) {
1 ~= s,&,&amp;,
1 ~= s,\',&apos;,
1 ~= s,\",&quot;,
1 ~= s,<,&lt;,
1 ~= s,>,&gt;,
return($$1)
}
load(resources_functions)
qtFlattenResources()

View File

@ -1,5 +1,21 @@
# http://www.w3.org/TR/xml/#syntax
defineReplace(xml_escape) {
1 ~= s,&,&amp;,
1 ~= s,\',&apos;,
1 ~= s,\",&quot;,
1 ~= s,<,&lt;,
1 ~= s,>,&gt;,
return($$1)
}
defineTest(qtFlattenResources) {
RESOURCES += qmake_immediate
immediate = qmake_immediate$$QMAKE_RESOURCES_IMMEDIATE_NR
defined(QMAKE_RESOURCES_IMMEDIATE_NR, var): \
QMAKE_RESOURCES_IMMEDIATE_NR = $$num_add($$QMAKE_RESOURCES_IMMEDIATE_NR, 1)
else: \
QMAKE_RESOURCES_IMMEDIATE_NR = 1
RESOURCES += $$immediate
for(resource, RESOURCES) {
# Regular case of user qrc file
contains(resource, ".*\\.qrc$"): \
@ -7,10 +23,10 @@ defineTest(qtFlattenResources) {
# Fallback for stand-alone files/directories
!defined($${resource}.files, var) {
!equals(resource, qmake_immediate) {
!equals(resource, $$immediate) {
!exists($$absolute_path($$resource, $$_PRO_FILE_PWD_)): \
warning("Failure to find: $$resource")
qmake_immediate.files += $$resource
$${immediate}.files += $$resource
OTHER_FILES *= $$resource
}
RESOURCES -= $$resource
@ -56,8 +72,9 @@ defineTest(qtFlattenResources) {
RESOURCES -= $$resource
RESOURCES += $$resource_file
}
export(QMAKE_RESOURCES_IMMEDIATE_NR)
export(RESOURCES)
export(OTHER_FILES)
export(qmake_immediate.files)
export($${immediate}.files)
return(true)
}