aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Kandeler <christian.kandeler@qt.io>2017-12-13 15:32:32 +0100
committerChristian Kandeler <christian.kandeler@qt.io>2017-12-13 17:05:09 +0000
commit73f5d22f936570cfb741d5b00d48cf7540c8f816 (patch)
treecb4c1577e0c18484206fb98cd7c5d1ca58b8e40a
parenta04af57252c7a858b7920166be32ad9b5773dbd7 (diff)
Fix regression resolving exported paths defined in the exporting product
Commit aa1c500411 inadvertently changed the behavior for cases like this: DynamicLibrary { property path inclPath: "." Export { cpp.includePaths: [product.inclPath] } } Before that patch, the base dir for resolving the include path was the exporting product, afterwards it was the importing one. This patch restores the original behavior, which is the intended one. Change-Id: I8a56cff1163e7fc87361b5ab5e9cbd527b53b79b Reviewed-by: Jake Petroules <jake.petroules@qt.io>
-rw-r--r--src/lib/corelib/language/evaluatorscriptclass.cpp10
-rw-r--r--tests/auto/language/testdata/modules/dummy/dummy.qbs1
-rw-r--r--tests/auto/language/testdata/subdir/exports-mylib.qbs3
-rw-r--r--tests/auto/language/tst_language.cpp4
4 files changed, 16 insertions, 2 deletions
diff --git a/src/lib/corelib/language/evaluatorscriptclass.cpp b/src/lib/corelib/language/evaluatorscriptclass.cpp
index be99a53a2..0d0b5e654 100644
--- a/src/lib/corelib/language/evaluatorscriptclass.cpp
+++ b/src/lib/corelib/language/evaluatorscriptclass.cpp
@@ -480,6 +480,12 @@ static void convertToPropertyType(const QString &pathPropertiesBaseDir, const It
if (v.isUndefined() || v.isError())
return;
QString srcDir;
+ QString actualBaseDir;
+ if (!pathPropertiesBaseDir.isEmpty()) {
+ const VariantValueConstPtr itemSourceDir
+ = item->variantProperty(QLatin1String("sourceDirectory"));
+ actualBaseDir = itemSourceDir ? itemSourceDir->value().toString() : pathPropertiesBaseDir;
+ }
const CodeLocation &location = value->location();
switch (decl.type()) {
case PropertyDeclaration::UnknownType:
@@ -499,7 +505,7 @@ static void convertToPropertyType(const QString &pathPropertiesBaseDir, const It
makeTypeError(decl, location, v);
break;
}
- const QString srcDir = overriddenSourceDirectory(item, pathPropertiesBaseDir);
+ const QString srcDir = overriddenSourceDirectory(item, actualBaseDir);
if (!srcDir.isEmpty())
v = v.engine()->toScriptValue(QDir::cleanPath(
FileInfo::resolvePath(srcDir, v.toString())));
@@ -510,7 +516,7 @@ static void convertToPropertyType(const QString &pathPropertiesBaseDir, const It
makeTypeError(decl, location, v);
break;
case PropertyDeclaration::PathList:
- srcDir = overriddenSourceDirectory(item, pathPropertiesBaseDir);
+ srcDir = overriddenSourceDirectory(item, actualBaseDir);
// Fall-through.
case PropertyDeclaration::StringList:
{
diff --git a/tests/auto/language/testdata/modules/dummy/dummy.qbs b/tests/auto/language/testdata/modules/dummy/dummy.qbs
index 1b985880e..2dba99adc 100644
--- a/tests/auto/language/testdata/modules/dummy/dummy.qbs
+++ b/tests/auto/language/testdata/modules/dummy/dummy.qbs
@@ -14,6 +14,7 @@ DummyBase {
property string upperCaseProductName: productName.toUpperCase()
property string zort: "zort in dummy"
property pathList includePaths
+ property path somePath
property stringList listProp: product.type.contains("blubb") ? ["123"] : ["456"]
property bool controllingProp: false
diff --git a/tests/auto/language/testdata/subdir/exports-mylib.qbs b/tests/auto/language/testdata/subdir/exports-mylib.qbs
index e3802de50..51e5b6831 100644
--- a/tests/auto/language/testdata/subdir/exports-mylib.qbs
+++ b/tests/auto/language/testdata/subdir/exports-mylib.qbs
@@ -5,10 +5,13 @@ StaticLibrary {
Depends { name: "dummy" }
dummy.defines: ["BUILD_" + product.name.toUpperCase()]
property string definePrefix: "USE_"
+ property path aPath: "."
+ dummy.somePath: aPath
Export {
Depends { name: "dummy" }
Depends { name: "mylib2" }
dummy.defines: [product.definePrefix + product.name.toUpperCase()]
dummy.includePaths: ["./lib"]
+ dummy.somePath: product.aPath
}
}
diff --git a/tests/auto/language/tst_language.cpp b/tests/auto/language/tst_language.cpp
index 9f5b3b13a..c6697b61b 100644
--- a/tests/auto/language/tst_language.cpp
+++ b/tests/auto/language/tst_language.cpp
@@ -833,12 +833,16 @@ void TestLanguage::exports()
QCOMPARE(product->moduleProperties->moduleProperty("dummy", "productName").toString(),
QString("myapp"));
+ QVERIFY(product->moduleProperties->moduleProperty("dummy", "somePath").toString()
+ .endsWith("/subdir"));
product = products.value("mylib");
QVERIFY(!!product);
propertyName = QStringList() << "modules" << "dummy" << "defines";
propertyValue = product->moduleProperties->property(propertyName);
QCOMPARE(propertyValue.toStringList(), QStringList() << "BUILD_MYLIB");
+ QVERIFY(product->moduleProperties->moduleProperty("dummy", "somePath").toString()
+ .endsWith("/subdir"));
product = products.value("mylib2");
QVERIFY(!!product);