diff options
author | Christian Kandeler <christian.kandeler@qt.io> | 2019-04-08 13:39:45 +0200 |
---|---|---|
committer | Christian Kandeler <christian.kandeler@qt.io> | 2019-04-08 13:52:39 +0000 |
commit | 1301eb87fd40d200310365f7553ab4b901a855d8 (patch) | |
tree | 35d3dd7b356ae0d05eadd53ae908675edd0036bd | |
parent | e0c6f88fe51186eb6fc697ba74f60136bf2106e4 (diff) |
Qt support: Fix detection of deployment target for Apple platformsv1.13.0
In Qt 5.12, the deployment target information has moved from qmake.conf
into an included file, so let's expand the includes before looking for
the respective line.
Fixes: QBS-1434
Change-Id: I174c03cf227f319e33f484e82735d7ed550c2b11
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
-rw-r--r-- | share/qbs/module-providers/Qt/setup-qt.js | 59 |
1 files changed, 27 insertions, 32 deletions
diff --git a/share/qbs/module-providers/Qt/setup-qt.js b/share/qbs/module-providers/Qt/setup-qt.js index 236b4dea4..b3044d72e 100644 --- a/share/qbs/module-providers/Qt/setup-qt.js +++ b/share/qbs/module-providers/Qt/setup-qt.js @@ -331,32 +331,25 @@ function getQtProperties(qmakeFilePath, qbs) { qtProps.entryPointLibsRelease = fillEntryPointLibs(qtProps, false); } else if (qtProps.mkspecPath.contains("macx")) { if (qtProps.qtMajorVersion >= 5) { - try { - var qmakeConf = new TextFile(FileInfo.joinPaths(qtProps.mkspecPath, "qmake.conf"), - TextFile.ReadOnly); - while (!qmakeConf.atEof()) { - var line = qmakeConf.readLine().trim(); - match = line.match - (/^QMAKE_(MACOSX|IOS|TVOS|WATCHOS)_DEPLOYMENT_TARGET\s*=\s*(.*)\s*$/); - if (match) { - var platform = match[1]; - var version = match[2]; - if (platform === "MACOSX") - qtProps.macosVersion = version; - else if (platform === "IOS") - qtProps.iosVersion = version; - else if (platform === "TVOS") - qtProps.tvosVersion = version; - else if (platform === "WATCHOS") - qtProps.watchosVersion = version; - } + var lines = getFileContentsRecursively(FileInfo.joinPaths(qtProps.mkspecPath, + "qmake.conf")); + for (var i = 0; i < lines.length; ++i) { + var line = lines[i].trim(); + match = line.match + (/^QMAKE_(MACOSX|IOS|TVOS|WATCHOS)_DEPLOYMENT_TARGET\s*=\s*(.*)\s*$/); + if (match) { + var platform = match[1]; + var version = match[2]; + if (platform === "MACOSX") + qtProps.macosVersion = version; + else if (platform === "IOS") + qtProps.iosVersion = version; + else if (platform === "TVOS") + qtProps.tvosVersion = version; + else if (platform === "WATCHOS") + qtProps.watchosVersion = version; } } - catch (e) {} - finally { - if (qmakeConf) - qmakeConf.close(); - } var isMac = qtProps.mkspecName !== "macx-ios-clang" && qtProps.mkspecName !== "macx-tvos-clang" && qtProps.mkspecName !== "macx-watchos-clang"; @@ -872,9 +865,9 @@ function allQt4Modules(qtProps) { return modules; } -function getPriFileContentsRecursively(priFilePath) { - var priFile = new TextFile(priFilePath, TextFile.ReadOnly); - var lines = splitNonEmpty(priFile.readAll(), '\n'); +function getFileContentsRecursively(filePath) { + var file = new TextFile(filePath, TextFile.ReadOnly); + var lines = splitNonEmpty(file.readAll(), '\n'); for (var i = 0; i < lines.length; ++i) { var includeString = "include("; var line = lines[i].trim(); @@ -883,17 +876,19 @@ function getPriFileContentsRecursively(priFilePath) { var offset = includeString.length; var closingParenPos = line.indexOf(')', offset); if (closingParenPos === -1) { - console.warn("Invalid include statement in '" + toNative(priFilePath) + "'"); + console.warn("Invalid include statement in '" + toNative(filePath) + "'"); continue; } - var includedFilePath = line.slice(offset, closingParenPos - offset); - var includedContents = getPriFileContentsRecursively(includedFilePath); + var includedFilePath = line.slice(offset, closingParenPos); + if (!FileInfo.isAbsolutePath(includedFilePath)) + includedFilePath = FileInfo.joinPaths(FileInfo.path(filePath), includedFilePath); + var includedContents = getFileContentsRecursively(includedFilePath); var j = i; for (var k = 0; k < includedContents.length; ++k) lines.splice(++j, 0, includedContents[k]); lines.splice(i--, 1); } - priFile.close(); + file.close(); return lines; } @@ -1033,7 +1028,7 @@ function allQt5Modules(qtProps) { moduleInfo.qbsName = moduleInfo.qbsName.replace("_private", "-private"); var hasV2 = false; var hasModuleEntry = false; - var lines = getPriFileContentsRecursively(priFilePath); + var lines = getFileContentsRecursively(priFilePath); for (var j = 0; j < lines.length; ++j) { var line = lines[j].trim(); var firstEqualsOffset = line.indexOf('='); |