From 548790931ccac858d9244e4c5546ef1664b0dc4a Mon Sep 17 00:00:00 2001 From: Christian Kandeler Date: Fri, 28 Jul 2017 11:41:26 +0200 Subject: Revert change to module merger that broke overriding list properties ... from the command line. The original change was part of 41595d0cf8, but it is not clear anymore exactly which problem it was supposed to solve. It may well be that it only worked around a temporary problem that no longer existed when the patch was merged. Task-number: QBS-1152 Change-Id: I7e89cf4bf64ef5c8dae5e598154403d4909969c0 Reviewed-by: Joerg Bornemann --- src/lib/corelib/language/modulemerger.cpp | 5 +---- .../module-property-overrides-per-product.qbs | 3 +++ tests/auto/language/tst_language.cpp | 26 +++++++++++++++++----- 3 files changed, 25 insertions(+), 9 deletions(-) diff --git a/src/lib/corelib/language/modulemerger.cpp b/src/lib/corelib/language/modulemerger.cpp index ea79d6562..9dc066bf1 100644 --- a/src/lib/corelib/language/modulemerger.cpp +++ b/src/lib/corelib/language/modulemerger.cpp @@ -223,11 +223,8 @@ void ModuleMerger::insertProperties(Item::PropertyMap *dst, Item *srcItem, Prope for (Item::PropertyMap::const_iterator it = srcItem->properties().constBegin(); it != srcItem->properties().constEnd(); ++it) { const ValuePtr &srcVal = it.value(); - if (srcVal->type() == Value::ItemValueType - || it.key() == QLatin1String("_qbs_sourceDir")) { + if (srcVal->type() != Value::JSSourceValueType) continue; - } - const PropertyDeclaration srcDecl = srcItem->propertyDeclaration(it.key()); if (!srcDecl.isValid() || srcDecl.isScalar() != (type == ScalarProperties)) continue; diff --git a/tests/auto/language/testdata/module-property-overrides-per-product.qbs b/tests/auto/language/testdata/module-property-overrides-per-product.qbs index e58f563a0..3ff811080 100644 --- a/tests/auto/language/testdata/module-property-overrides-per-product.qbs +++ b/tests/auto/language/testdata/module-property-overrides-per-product.qbs @@ -4,13 +4,16 @@ Project { Product { Depends { name: "dummy" } name: "a" + property stringList rpaths: dummy.rpaths } Product { Depends { name: "dummy" } name: "b" + property stringList rpaths: dummy.rpaths } Product { Depends { name: "dummy" } name: "c" + property stringList rpaths: dummy.rpaths } } diff --git a/tests/auto/language/tst_language.cpp b/tests/auto/language/tst_language.cpp index fdcd98da8..380d23669 100644 --- a/tests/auto/language/tst_language.cpp +++ b/tests/auto/language/tst_language.cpp @@ -1511,9 +1511,11 @@ void TestLanguage::modulePropertyOverridesPerProduct() try { SetupProjectParameters params = defaultParameters; params.setOverriddenValues({ + std::make_pair("modules.dummy.rpaths", QStringList({"/usr/lib"})), std::make_pair("modules.dummy.someString", "m"), std::make_pair("products.b.dummy.someString", "b"), - std::make_pair("products.c.dummy.someString", "c") + std::make_pair("products.c.dummy.someString", "c"), + std::make_pair("products.c.dummy.rpaths", QStringList({"/home", "/tmp"})) }); params.setProjectFilePath( testProject("module-property-overrides-per-product.qbs")); @@ -1528,14 +1530,28 @@ void TestLanguage::modulePropertyOverridesPerProduct() const ResolvedProductConstPtr c = products.value("c"); QVERIFY(!!c); - const auto propertyValue = [](const ResolvedProductConstPtr &p) -> QString + const auto stringPropertyValue = [](const ResolvedProductConstPtr &p) -> QString { return p->moduleProperties->moduleProperty("dummy", "someString").toString(); }; + const auto listPropertyValue = [](const ResolvedProductConstPtr &p) -> QStringList + { + return p->moduleProperties->moduleProperty("dummy", "rpaths").toStringList(); + }; + const auto productPropertyValue = [](const ResolvedProductConstPtr &p) -> QStringList + { + return p->productProperties.value("rpaths").toStringList(); + }; - QCOMPARE(propertyValue(a), QString("m")); - QCOMPARE(propertyValue(b), QString("b")); - QCOMPARE(propertyValue(c), QString("c")); + QCOMPARE(stringPropertyValue(a), QString("m")); + QCOMPARE(stringPropertyValue(b), QString("b")); + QCOMPARE(stringPropertyValue(c), QString("c")); + QCOMPARE(listPropertyValue(a), QStringList({"/usr/lib"})); + QCOMPARE(listPropertyValue(b), QStringList({"/usr/lib"})); + QCOMPARE(listPropertyValue(c), QStringList({"/home", "/tmp"})); + QCOMPARE(listPropertyValue(a), productPropertyValue(a)); + QCOMPARE(listPropertyValue(b), productPropertyValue(b)); + QCOMPARE(listPropertyValue(c), productPropertyValue(c)); } catch (const ErrorInfo &e) { exceptionCaught = true; -- cgit v1.2.3