diff options
author | Joerg Bornemann <joerg.bornemann@qt.io> | 2017-08-29 09:22:45 +0200 |
---|---|---|
committer | Joerg Bornemann <joerg.bornemann@qt.io> | 2017-08-30 08:50:00 +0000 |
commit | 1ead23729602fec9b50a84298fb00992b7043839 (patch) | |
tree | 66a9a7356e6c1a70d04516dec4483398f38cdb62 /share | |
parent | e409827c22db87466da789299464de6cd50a1b8b (diff) |
Fix Android NDK probe for NDKs older than r11
Make sure we continue after the r11 check fails.
Fix the file extension of RELEASE.TXT.
Fix the regular expression that failed for "r10e-rc4 (64-bit)".
Change-Id: I77806350b6951ca49dfb84b5cb4369e788eeaae9
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Diffstat (limited to 'share')
-rw-r--r-- | share/qbs/imports/qbs/Probes/AndroidNdkProbe.qbs | 35 |
1 files changed, 25 insertions, 10 deletions
diff --git a/share/qbs/imports/qbs/Probes/AndroidNdkProbe.qbs b/share/qbs/imports/qbs/Probes/AndroidNdkProbe.qbs index 82a60bccd..505675354 100644 --- a/share/qbs/imports/qbs/Probes/AndroidNdkProbe.qbs +++ b/share/qbs/imports/qbs/Probes/AndroidNdkProbe.qbs @@ -1,6 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2015 Jake Petroules. +** Copyright (C) 2017 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. @@ -63,6 +64,20 @@ PathProbe { property string ndkVersion configure: { + function readFileContent(filePath) { + var result = null; + if (!File.exists(filePath)) + return result; + try { + var tf = new TextFile(filePath, TextFile.ReadOnly); + result = tf.readAll(); + } finally { + if (tf) + tf.close(); + } + return result; + } + var i, j, allPaths = (environmentPaths || []).concat(platformPaths || []); for (i in allPaths) { var platforms = []; @@ -82,9 +97,9 @@ PathProbe { File.Dirs | File.NoDotAndDotDot); // NDK r11 and above - var tf = new TextFile(path + "/source.properties", TextFile.ReadOnly); - try { - var lines = tf.readAll().trim().split(/\r?\n/g).filter(function (line) { + var content = readFileContent(path + "/source.properties"); + if (content) { + var lines = content.trim().split(/\r?\n/g).filter(function (line) { return line.length > 0; }); for (var l = 0; l < lines.length; ++l) { @@ -95,21 +110,21 @@ PathProbe { return; } } - } finally { - tf.close(); } // NDK r10 and below - tf = new TextFile(path + "/RELEASE.txt", TextFile.ReadOnly); - try { - var m = tf.readAll().trim().match(/^r([0-9]+[a-z]?)( \(64-bit\))?$/); + var releaseTextFileCandidates = ["RELEASE.txt", "RELEASE.TXT"] + .map(function(v) { return FileInfo.joinPaths(path, v); }) + .filter(File.exists); + content = releaseTextFileCandidates.length + ? readFileContent(releaseTextFileCandidates[0]) : null; + if (content) { + var m = content.trim().match(/^r([0-9]+[a-z]?).*/); if (m) { ndkVersion = m[1]; found = true; return; } - } finally { - tf.close(); } } } |