aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIvan Komissarov <abbapoh@gmail.com>2020-07-14 21:48:53 +0200
committerIvan Komissarov <ABBAPOH@gmail.com>2020-07-16 08:43:08 +0000
commit6fa78d83517308a193f4a57818acfb51a4da0652 (patch)
tree8084a833e39c915fc7009e873b553bece8f098b4
parent3ae5188b20dca13fb2c23ca09457b9eda2147b4c (diff)
Probes: Remove nameFilter from FrameworkProbe
It is not possible to use functions as values for properties with the new JS engine. Remove nameFilter by allowing to have common nameSuffixes for different selectors. Change-Id: I24ae747f4d609c956285e77ee832c6e99304a622 Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
-rw-r--r--share/qbs/imports/qbs/Probes/FrameworkProbe.qbs7
-rw-r--r--share/qbs/imports/qbs/Probes/path-probe.js6
-rw-r--r--tests/auto/blackbox/testdata/path-probe/mult-files-common-suffixes.qbs10
-rw-r--r--tests/auto/blackbox/tst_blackbox.cpp1
4 files changed, 16 insertions, 8 deletions
diff --git a/share/qbs/imports/qbs/Probes/FrameworkProbe.qbs b/share/qbs/imports/qbs/Probes/FrameworkProbe.qbs
index e0fe73b40..c3d98a49f 100644
--- a/share/qbs/imports/qbs/Probes/FrameworkProbe.qbs
+++ b/share/qbs/imports/qbs/Probes/FrameworkProbe.qbs
@@ -35,10 +35,5 @@ PathProbe {
"/Library/Frameworks",
"/System/Library/Frameworks"
])
-
- nameFilter: {
- return function(name) {
- return name + ".framework";
- }
- }
+ nameSuffixes: ".framework"
}
diff --git a/share/qbs/imports/qbs/Probes/path-probe.js b/share/qbs/imports/qbs/Probes/path-probe.js
index a997f77f2..b4d745428 100644
--- a/share/qbs/imports/qbs/Probes/path-probe.js
+++ b/share/qbs/imports/qbs/Probes/path-probe.js
@@ -41,7 +41,7 @@ function asStringList(key, value) {
throw key + " must be a string or a stringList";
}
-function canonicalSelectors(selectors) {
+function canonicalSelectors(selectors, nameSuffixes) {
var mapper = function(selector) {
if (typeof(selector) === "string")
return {names : [selector]};
@@ -53,6 +53,8 @@ function canonicalSelectors(selectors) {
selector.names = asStringList("names", selector.names);
if (selector.nameSuffixes)
selector.nameSuffixes = asStringList("nameSuffixes", selector.nameSuffixes);
+ else
+ selector.nameSuffixes = nameSuffixes;
return selector;
};
return selectors.map(mapper);
@@ -70,7 +72,7 @@ function configure(selectors, names, nameSuffixes, nameFilter, candidateFilter,
{names: names, nameSuffixes: nameSuffixes}
];
} else {
- selectors = canonicalSelectors(selectors);
+ selectors = canonicalSelectors(selectors, nameSuffixes);
}
if (nameFilter) {
diff --git a/tests/auto/blackbox/testdata/path-probe/mult-files-common-suffixes.qbs b/tests/auto/blackbox/testdata/path-probe/mult-files-common-suffixes.qbs
new file mode 100644
index 000000000..c4d53a715
--- /dev/null
+++ b/tests/auto/blackbox/testdata/path-probe/mult-files-common-suffixes.qbs
@@ -0,0 +1,10 @@
+BaseApp {
+ inputSelectors: [
+ {names : "tool"},
+ {names : "super-tool"},
+ ]
+ inputNameSuffixes: ".1"
+ inputSearchPaths: "bin"
+ outputFilePaths: ["bin/tool.1", "bin/super-tool.1"]
+ outputCandidatePaths: [["bin/tool.1"], ["bin/super-tool.1"]]
+}
diff --git a/tests/auto/blackbox/tst_blackbox.cpp b/tests/auto/blackbox/tst_blackbox.cpp
index b0d9c2976..786a43725 100644
--- a/tests/auto/blackbox/tst_blackbox.cpp
+++ b/tests/auto/blackbox/tst_blackbox.cpp
@@ -2931,6 +2931,7 @@ void TestBlackbox::pathProbe_data()
QTest::newRow("mult-files-mult-variants") << QString("mult-files-mult-variants.qbs") << true;
QTest::newRow("single-file-suffixes") << QString("single-file-suffixes.qbs") << true;
QTest::newRow("mult-files-suffixes") << QString("mult-files-suffixes.qbs") << true;
+ QTest::newRow("mult-files-common-suffixes") << QString("mult-files-common-suffixes.qbs") << true;
QTest::newRow("mult-files-mult-suffixes") << QString("mult-files-mult-suffixes.qbs") << true;
QTest::newRow("name-filter") << QString("name-filter.qbs") << true;
QTest::newRow("candidate-filter") << QString("candidate-filter.qbs") << true;