diff options
author | Ivan Komissarov <ABBAPOH@gmail.com> | 2019-06-08 18:20:03 +0200 |
---|---|---|
committer | Ivan Komissarov <ABBAPOH@gmail.com> | 2019-06-26 15:25:30 +0000 |
commit | 06f46da6c31de7d5b767da38713b11b1a117b34e (patch) | |
tree | b23b248961c0d71943a3978969cdd1bd19361de1 /share | |
parent | d214864b666d3551fe25a648b82832fcbd241b2e (diff) |
Add PathProbe::candidateFilter property
This property can be used to check if candidate conforms with some
conditions. For example, an architecture of a shared
library candidate should match the current qbs.architecture.
Also, this will allow to implement support for the "text based stub
libraries" (yaml files that point to a real library in a system) on
macOS - instead of checking real file architecture, it should be read
from .tbd file
Change-Id: Ie84a3e70d883dec949440358e2f08213a8501982
Reviewed-by: Qbs CI Bot <travis-bot@weickelt.de>
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
Diffstat (limited to 'share')
-rw-r--r-- | share/qbs/imports/qbs/Probes/GccBinaryProbe.qbs | 4 | ||||
-rw-r--r-- | share/qbs/imports/qbs/Probes/NpmProbe.qbs | 4 | ||||
-rw-r--r-- | share/qbs/imports/qbs/Probes/PathProbe.qbs | 7 | ||||
-rw-r--r-- | share/qbs/imports/qbs/Probes/TypeScriptProbe.qbs | 4 | ||||
-rw-r--r-- | share/qbs/imports/qbs/Probes/path-probe.js | 9 |
5 files changed, 15 insertions, 13 deletions
diff --git a/share/qbs/imports/qbs/Probes/GccBinaryProbe.qbs b/share/qbs/imports/qbs/Probes/GccBinaryProbe.qbs index e0ca3e654..693fb6a01 100644 --- a/share/qbs/imports/qbs/Probes/GccBinaryProbe.qbs +++ b/share/qbs/imports/qbs/Probes/GccBinaryProbe.qbs @@ -49,8 +49,8 @@ BinaryProbe { configure: { var selectors; var _results = PathProbeConfigure.configure( - selectors, names, nameSuffixes, nameFilter, searchPaths, pathSuffixes, - platformSearchPaths, environmentPaths, platformEnvironmentPaths, + selectors, names, nameSuffixes, nameFilter, candidateFilter, searchPaths, + pathSuffixes, platformSearchPaths, environmentPaths, platformEnvironmentPaths, pathListSeparator); found = _results.found; var resultFile = _results.files[0]; diff --git a/share/qbs/imports/qbs/Probes/NpmProbe.qbs b/share/qbs/imports/qbs/Probes/NpmProbe.qbs index d0a77b421..f6a99e826 100644 --- a/share/qbs/imports/qbs/Probes/NpmProbe.qbs +++ b/share/qbs/imports/qbs/Probes/NpmProbe.qbs @@ -49,8 +49,8 @@ NodeJsProbe { var selectors; var results = PathProbeConfigure.configure( - selectors, names, nameSuffixes, nameFilter, searchPaths, pathSuffixes, - platformSearchPaths, environmentPaths, platformEnvironmentPaths, + selectors, names, nameSuffixes, nameFilter, candidateFilter, searchPaths, + pathSuffixes, platformSearchPaths, environmentPaths, platformEnvironmentPaths, pathListSeparator); var v = new ModUtils.EnvironmentVariable("PATH", pathListSeparator, diff --git a/share/qbs/imports/qbs/Probes/PathProbe.qbs b/share/qbs/imports/qbs/Probes/PathProbe.qbs index 42e3a45d4..d0edea682 100644 --- a/share/qbs/imports/qbs/Probes/PathProbe.qbs +++ b/share/qbs/imports/qbs/Probes/PathProbe.qbs @@ -36,6 +36,7 @@ Probe { property stringList names property stringList nameSuffixes property var nameFilter + property var candidateFilter property varList selectors property pathList pathPrefixes property pathList searchPaths @@ -63,9 +64,9 @@ Probe { var _searchPaths = ModUtils.concatAll(pathPrefixes, searchPaths); var _platformSearchPaths = ModUtils.concatAll(platformPaths, platformSearchPaths); var results = PathProbeConfigure.configure(selectors, names, nameSuffixes, nameFilter, - _searchPaths, pathSuffixes, _platformSearchPaths, - environmentPaths, platformEnvironmentPaths, - pathListSeparator); + candidateFilter, _searchPaths, pathSuffixes, + _platformSearchPaths, environmentPaths, + platformEnvironmentPaths, pathListSeparator); found = results.found; allResults = results.files; diff --git a/share/qbs/imports/qbs/Probes/TypeScriptProbe.qbs b/share/qbs/imports/qbs/Probes/TypeScriptProbe.qbs index 5696b78c8..a35e555cc 100644 --- a/share/qbs/imports/qbs/Probes/TypeScriptProbe.qbs +++ b/share/qbs/imports/qbs/Probes/TypeScriptProbe.qbs @@ -59,8 +59,8 @@ BinaryProbe { var selectors; var results = PathProbeConfigure.configure( - selectors, names, nameSuffixes, nameFilter, searchPaths, pathSuffixes, - platformSearchPaths, environmentPaths, platformEnvironmentPaths, + selectors, names, nameSuffixes, nameFilter, candidateFilter, searchPaths, + pathSuffixes, platformSearchPaths, environmentPaths, platformEnvironmentPaths, pathListSeparator); var v = new ModUtils.EnvironmentVariable("PATH", pathListSeparator, diff --git a/share/qbs/imports/qbs/Probes/path-probe.js b/share/qbs/imports/qbs/Probes/path-probe.js index 9e338712f..a997f77f2 100644 --- a/share/qbs/imports/qbs/Probes/path-probe.js +++ b/share/qbs/imports/qbs/Probes/path-probe.js @@ -58,9 +58,9 @@ function canonicalSelectors(selectors) { return selectors.map(mapper); } -function configure(selectors, names, nameSuffixes, nameFilter, searchPaths, pathSuffixes, - platformSearchPaths, environmentPaths, platformEnvironmentPaths, - pathListSeparator) { +function configure(selectors, names, nameSuffixes, nameFilter, candidateFilter, + searchPaths, pathSuffixes, platformSearchPaths, environmentPaths, + platformEnvironmentPaths, pathListSeparator) { var result = { found: false, files: [] }; if (!selectors && !names) throw '"names" or "selectors" must be specified'; @@ -107,7 +107,8 @@ function configure(selectors, names, nameSuffixes, nameFilter, searchPaths, path for (var k = 0; k < _suffixes.length; ++k) { var _filePath = FileInfo.joinPaths(_paths[j], _suffixes[k], selector.names[i]); file.candidatePaths.push(_filePath); - if (File.exists(_filePath)) { + if (File.exists(_filePath) + && (!candidateFilter || candidateFilter(_filePath))) { file.found = true; file.filePath = _filePath; |