diff options
author | Ivan Komissarov <abbapoh@gmail.com> | 2020-02-03 19:52:56 +0100 |
---|---|---|
committer | Ivan Komissarov <ABBAPOH@gmail.com> | 2020-02-05 11:39:14 +0000 |
commit | b2e405c2f00bc82419172bb164f0b8ad75427dfc (patch) | |
tree | bc142a885d824b97aa9ebfce2f7c1210161c3d31 | |
parent | e130e492ebe6ad266a74df7b7d5efdef55dc0ff7 (diff) |
Assign allResults for all PathProbe child Probes
Despite the fact those probes do not use selectors property, it makes
sense to assign the result into the allResults property
Change-Id: Ieaf084b721a20e83c02bfdcdb706d8d98c7c16ed
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
-rw-r--r-- | share/qbs/imports/qbs/Probes/GccBinaryProbe.qbs | 19 | ||||
-rw-r--r-- | share/qbs/imports/qbs/Probes/NpmProbe.qbs | 26 | ||||
-rw-r--r-- | share/qbs/imports/qbs/Probes/TypeScriptProbe.qbs | 23 |
3 files changed, 45 insertions, 23 deletions
diff --git a/share/qbs/imports/qbs/Probes/GccBinaryProbe.qbs b/share/qbs/imports/qbs/Probes/GccBinaryProbe.qbs index 693fb6a01..8bad0710a 100644 --- a/share/qbs/imports/qbs/Probes/GccBinaryProbe.qbs +++ b/share/qbs/imports/qbs/Probes/GccBinaryProbe.qbs @@ -52,16 +52,25 @@ BinaryProbe { selectors, names, nameSuffixes, nameFilter, candidateFilter, searchPaths, pathSuffixes, platformSearchPaths, environmentPaths, platformEnvironmentPaths, pathListSeparator); + + var resultsMapper = function(result) { + (nameSuffixes || [""]).forEach(function(suffix) { + var end = _compilerName + suffix; + if (result.fileName.endsWith(end)) + result.tcPrefix = result.fileName.slice(0, -end.length); + }); + return result; + }; + _results.files = _results.files.map(resultsMapper); + found = _results.found; + allResults = _results.files; + var resultFile = _results.files[0]; candidatePaths = resultFile.candidatePaths; path = resultFile.path; filePath = resultFile.filePath; fileName = resultFile.fileName; - (nameSuffixes || [""]).forEach(function(suffix) { - var end = _compilerName + suffix; - if (fileName.endsWith(end)) - tcPrefix = fileName.slice(0, -end.length); - }); + tcPrefix = resultFile.tcPrefix; } } diff --git a/share/qbs/imports/qbs/Probes/NpmProbe.qbs b/share/qbs/imports/qbs/Probes/NpmProbe.qbs index f6a99e826..3ca6a96c2 100644 --- a/share/qbs/imports/qbs/Probes/NpmProbe.qbs +++ b/share/qbs/imports/qbs/Probes/NpmProbe.qbs @@ -57,18 +57,24 @@ NodeJsProbe { hostOS.contains("windows")); v.prepend(interpreterPath); - var result = results.files[0]; - result.npmBin = results.found - ? NodeJs.findLocation(result.filePath, "bin", v.value) - : undefined; - result.npmRoot = results.found - ? NodeJs.findLocation(result.filePath, "root", v.value) - : undefined; - result.npmPrefix = results.found - ? NodeJs.findLocation(result.filePath, "prefix", v.value) - : undefined; + var resultsMapper = function(result) { + result.npmBin = result.found + ? NodeJs.findLocation(result.filePath, "bin", v.value) + : undefined; + result.npmRoot = result.found + ? NodeJs.findLocation(result.filePath, "root", v.value) + : undefined; + result.npmPrefix = result.found + ? NodeJs.findLocation(result.filePath, "prefix", v.value) + : undefined; + return result; + }; + results.files = results.files.map(resultsMapper); found = results.found; + allResults = results.files; + + var result = results.files[0]; candidatePaths = result.candidatePaths; path = result.path; filePath = result.filePath; diff --git a/share/qbs/imports/qbs/Probes/TypeScriptProbe.qbs b/share/qbs/imports/qbs/Probes/TypeScriptProbe.qbs index a35e555cc..6a854a2e6 100644 --- a/share/qbs/imports/qbs/Probes/TypeScriptProbe.qbs +++ b/share/qbs/imports/qbs/Probes/TypeScriptProbe.qbs @@ -67,16 +67,23 @@ BinaryProbe { hostOS.contains("windows")); v.prepend(interpreterPath); - var result = results.files[0]; - result.version = results.found - ? TypeScript.findTscVersion(result.filePath, v.value) - : undefined; - if (FileInfo.fromNativeSeparators(packageManagerBinPath) !== result.path || - !File.exists(FileInfo.fromNativeSeparators(packageManagerRootPath, "typescript"))) { - result = { found: false }; - } + var resultsMapper = function(result) { + result.version = result.found + ? TypeScript.findTscVersion(result.filePath, v.value) + : undefined; + if (FileInfo.fromNativeSeparators(packageManagerBinPath) !== result.path || + !File.exists( + FileInfo.fromNativeSeparators(packageManagerRootPath, "typescript"))) { + result = { found: false }; + } + return result; + }; + results.files = results.files.map(resultsMapper); found = results.found; + allResults = results.files; + + var result = results.files[0]; candidatePaths = result.candidatePaths; path = result.path; filePath = result.filePath; |