configure: turn qtConfOutputPostProcess_*() callbacks into replace functions

now the callbacks don't need to re-export the designated file contents,
which improves the abstraction and removes some boilerplate.

Change-Id: Ifa50313155fc96762025e2610b810ebb71daa373
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
This commit is contained in:
Oswald Buddenhagen 2016-11-08 18:50:54 +01:00
parent 4d90bd55a5
commit 1a43199fce
2 changed files with 15 additions and 11 deletions

View File

@ -457,9 +457,10 @@ defineTest(qtConfOutput_qmakeArgs) {
export($${currentConfig}.output.privatePro) export($${currentConfig}.output.privatePro)
} }
defineTest(qtConfOutputPostProcess_publicPro) { defineReplace(qtConfOutputPostProcess_publicPro) {
qt_version = $$[QT_VERSION] qt_version = $$[QT_VERSION]
output = \ output = \
$$1 \
"QT_VERSION = $$qt_version" \ "QT_VERSION = $$qt_version" \
"QT_MAJOR_VERSION = $$section(qt_version, '.', 0, 0)" \ "QT_MAJOR_VERSION = $$section(qt_version, '.', 0, 0)" \
"QT_MINOR_VERSION = $$section(qt_version, '.', 1, 1)" \ "QT_MINOR_VERSION = $$section(qt_version, '.', 1, 1)" \
@ -476,13 +477,13 @@ defineTest(qtConfOutputPostProcess_publicPro) {
"QT_RELEASE_DATE = $$config.input.qt_release_date" "QT_RELEASE_DATE = $$config.input.qt_release_date"
} }
$${currentConfig}.output.publicPro += $$output return($$output)
export($${currentConfig}.output.publicPro)
} }
defineTest(qtConfOutputPostProcess_publicHeader) { defineReplace(qtConfOutputPostProcess_publicHeader) {
qt_version = $$[QT_VERSION] qt_version = $$[QT_VERSION]
output = \ output = \
$$1 \
"$${LITERAL_HASH}define QT_VERSION_STR \"$$qt_version\"" \ "$${LITERAL_HASH}define QT_VERSION_STR \"$$qt_version\"" \
"$${LITERAL_HASH}define QT_VERSION_MAJOR $$section(qt_version, '.', 0, 0)" \ "$${LITERAL_HASH}define QT_VERSION_MAJOR $$section(qt_version, '.', 0, 0)" \
"$${LITERAL_HASH}define QT_VERSION_MINOR $$section(qt_version, '.', 1, 1)" \ "$${LITERAL_HASH}define QT_VERSION_MINOR $$section(qt_version, '.', 1, 1)" \
@ -499,8 +500,7 @@ defineTest(qtConfOutputPostProcess_publicHeader) {
!isEmpty(config.input.qt_libinfix): \ !isEmpty(config.input.qt_libinfix): \
output += "$${LITERAL_HASH}define QT_LIBINFIX \"$$eval(config.input.qt_libinfix)\"" output += "$${LITERAL_HASH}define QT_LIBINFIX \"$$eval(config.input.qt_libinfix)\""
$${currentConfig}.output.publicHeader += $$output return($$output)
export($${currentConfig}.output.publicHeader)
} }

View File

@ -1672,13 +1672,17 @@ defineTest(qtConfProcessOutput) {
} }
} }
ppScope = content = $$eval($${currentConfig}.output.$${type})
!isEmpty(module): ppScope = $${module}_
defined(qtConfOutputPostProcess_$${ppScope}$${type}, test): \ !isEmpty(module): \
qtConfOutputPostProcess_$${ppScope}$${type}() call = qtConfOutputPostProcess_$${module}_$${type}
else: \
call = qtConfOutputPostProcess_$${type}
defined($$call, replace): \
eval(content = \$\$"$$call"(\$\$content))
file = $$eval($${currentConfig}.files.$${type}) file = $$eval($${currentConfig}.files.$${type})
fileCont.$$file += $$eval($${currentConfig}.output.$${type}) fileCont.$$file += $$content
fileCont._KEYS_ *= $$file fileCont._KEYS_ *= $$file
} }