aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Kandeler <christian.kandeler@qt.io>2018-10-26 15:54:34 +0200
committerChristian Kandeler <christian.kandeler@qt.io>2018-10-26 15:54:34 +0200
commit87fbe18ca58c96a17136e2bc62ccfafcc9cd4ed2 (patch)
tree98dcb18081d3cd3f46938a6c9b06bc1a129027ce
parente46b1f09fca2af0782648d14cac401ec62ac46b4 (diff)
parent783f2f91854d9c0a3cacca668d52ea761cc2a1b8 (diff)
Merge 1.12 into master
-rw-r--r--src/lib/corelib/language/projectresolver.cpp2
-rw-r--r--src/lib/qtprofilesetup/qtprofilesetup.cpp51
-rw-r--r--tests/auto/blackbox/tst_blackbox.cpp24
-rw-r--r--tests/auto/language/testdata/eval-error-in-non-present-module.qbs7
-rw-r--r--tests/auto/language/testdata/modules/broken/broken.qbs19
-rw-r--r--tests/auto/language/tst_language.cpp34
-rw-r--r--tests/auto/language/tst_language.h2
7 files changed, 120 insertions, 19 deletions
diff --git a/src/lib/corelib/language/projectresolver.cpp b/src/lib/corelib/language/projectresolver.cpp
index 92c92fd4b..4f871c17f 100644
--- a/src/lib/corelib/language/projectresolver.cpp
+++ b/src/lib/corelib/language/projectresolver.cpp
@@ -1696,6 +1696,8 @@ QVariantMap ProjectResolver::evaluateModuleValues(Item *item, bool lookupPrototy
? &m_elapsedTimeModPropEval : nullptr);
QVariantMap moduleValues;
for (const Item::Module &module : item->modules()) {
+ if (!module.item->isPresentModule())
+ continue;
const QString fullName = module.name.toString();
moduleValues[fullName] = evaluateProperties(module.item, lookupPrototype, true);
}
diff --git a/src/lib/qtprofilesetup/qtprofilesetup.cpp b/src/lib/qtprofilesetup/qtprofilesetup.cpp
index 3bc21b279..804844d13 100644
--- a/src/lib/qtprofilesetup/qtprofilesetup.cpp
+++ b/src/lib/qtprofilesetup/qtprofilesetup.cpp
@@ -692,21 +692,36 @@ static QStringList fillEntryPointLibs(const QtEnvironment &qtEnvironment, const
bool debug)
{
QStringList result;
- QString qtmain = qtEnvironment.libraryPath + QLatin1Char('/');
const bool isMinGW = qtEnvironment.isForMinGw();
- if (isMinGW)
- qtmain += QLatin1String("lib");
- qtmain += QLatin1String("qtmain") + qtEnvironment.qtLibInfix;
- if (debug)
- qtmain += QLatin1Char('d');
- if (isMinGW) {
- qtmain += QLatin1String(".a");
- } else {
- qtmain += QLatin1String(".lib");
- if (qtVersion >= Version(5, 4, 0))
- result << QLatin1String("Shell32.lib");
+
+ // Some Linux distributions rename the qtmain library.
+ QStringList qtMainCandidates(QLatin1String("qtmain"));
+ if (isMinGW && qtEnvironment.qtMajorVersion == 5)
+ qtMainCandidates << QLatin1String("qt5main");
+
+ for (const QString &baseNameCandidate : qtMainCandidates) {
+ QString qtmain = qtEnvironment.libraryPath + QLatin1Char('/');
+ if (isMinGW)
+ qtmain += QLatin1String("lib");
+ qtmain += baseNameCandidate + qtEnvironment.qtLibInfix;
+ if (debug)
+ qtmain += QLatin1Char('d');
+ if (isMinGW) {
+ qtmain += QLatin1String(".a");
+ } else {
+ qtmain += QLatin1String(".lib");
+ if (qtVersion >= Version(5, 4, 0))
+ result << QLatin1String("Shell32.lib");
+ }
+ if (QFile::exists(qtmain)) {
+ result << qtmain;
+ break;
+ }
+ }
+ if (result.isEmpty()) {
+ qDebug("Warning: Could not find the qtmain library. "
+ "You will not be able to link Qt applications.");
}
- result << qtmain;
return result;
}
@@ -726,8 +741,14 @@ void doSetupQtProfile(const QString &profileName, Settings *settings,
const Version qtVersion = Version(qtEnvironment.qtMajorVersion,
qtEnvironment.qtMinorVersion,
qtEnvironment.qtPatchVersion);
- qtEnvironment.entryPointLibsDebug = fillEntryPointLibs(qtEnvironment, qtVersion, true);
- qtEnvironment.entryPointLibsRelease = fillEntryPointLibs(qtEnvironment, qtVersion, false);
+ if (qtEnvironment.buildVariant.contains(QLatin1String("debug"))) {
+ qtEnvironment.entryPointLibsDebug = fillEntryPointLibs(qtEnvironment, qtVersion,
+ true);
+ }
+ if (qtEnvironment.buildVariant.contains(QLatin1String("release"))) {
+ qtEnvironment.entryPointLibsRelease = fillEntryPointLibs(qtEnvironment, qtVersion,
+ false);
+ }
} else if (qtEnvironment.mkspecPath.contains(QLatin1String("macx"))) {
if (qtEnvironment.qtMajorVersion >= 5) {
QFile qmakeConf(qtEnvironment.mkspecPath + QStringLiteral("/qmake.conf"));
diff --git a/tests/auto/blackbox/tst_blackbox.cpp b/tests/auto/blackbox/tst_blackbox.cpp
index 3d15281e2..0302309fb 100644
--- a/tests/auto/blackbox/tst_blackbox.cpp
+++ b/tests/auto/blackbox/tst_blackbox.cpp
@@ -47,6 +47,7 @@
#include <QtCore/qjsonvalue.h>
#include <QtCore/qlocale.h>
#include <QtCore/qregexp.h>
+#include <QtCore/qsettings.h>
#include <QtCore/qtemporarydir.h>
#include <QtCore/qtemporaryfile.h>
@@ -5057,13 +5058,28 @@ void TestBlackbox::qbsConfig()
"most qbs-config tests";
#endif // QBS_ENABLE_UNIT_TESTS
+ bool canWriteToSystemSettings;
+ QString testSettingsFilePath;
+ {
+ QSettings testSettings(QSettings::IniFormat, QSettings::SystemScope,
+ "dummyOrg", "dummyApp");
+ testSettings.setValue("dummyKey", "dummyValue");
+ testSettings.sync();
+ canWriteToSystemSettings = testSettings.status() == QSettings::NoError;
+ testSettingsFilePath = testSettings.fileName();
+ }
+ if (canWriteToSystemSettings)
+ QVERIFY(QFile::remove(testSettingsFilePath));
+
// Check that trying to write to actual system settings causes access failure.
- params.expectFailure = true;
+ params.expectFailure = !canWriteToSystemSettings;
params.environment.clear();
params.arguments = QStringList{"--system", "key.subkey.scalar", "s"};
- QVERIFY(runQbs(params) != 0);
- QVERIFY2(m_qbsStderr.contains("You do not have permission to write to that location."),
- m_qbsStderr.constData());
+ QCOMPARE(runQbs(params) == 0, canWriteToSystemSettings);
+ if (!canWriteToSystemSettings) {
+ QVERIFY2(m_qbsStderr.contains("You do not have permission to write to that location."),
+ m_qbsStderr.constData());
+ }
}
void TestBlackbox::radAfterIncompleteBuild_data()
diff --git a/tests/auto/language/testdata/eval-error-in-non-present-module.qbs b/tests/auto/language/testdata/eval-error-in-non-present-module.qbs
new file mode 100644
index 000000000..c112bc6d4
--- /dev/null
+++ b/tests/auto/language/testdata/eval-error-in-non-present-module.qbs
@@ -0,0 +1,7 @@
+import qbs
+
+Product {
+ name: "p"
+ property bool moduleRequired
+ Depends { name: "broken"; required: moduleRequired }
+}
diff --git a/tests/auto/language/testdata/modules/broken/broken.qbs b/tests/auto/language/testdata/modules/broken/broken.qbs
new file mode 100644
index 000000000..b960117cf
--- /dev/null
+++ b/tests/auto/language/testdata/modules/broken/broken.qbs
@@ -0,0 +1,19 @@
+import qbs
+
+Module {
+ Probe {
+ id: theProbe
+
+ property stringList broken
+ property stringList fine
+
+ configure: {
+ broken = [["x"]];
+ fine = ["x"]
+ found = true;
+ }
+ }
+
+ property stringList broken: theProbe.broken
+ property stringList fine: theProbe.fine.filter(function(incl) { return incl != "y"; });
+}
diff --git a/tests/auto/language/tst_language.cpp b/tests/auto/language/tst_language.cpp
index da8f1d7a8..edcd4200d 100644
--- a/tests/auto/language/tst_language.cpp
+++ b/tests/auto/language/tst_language.cpp
@@ -665,6 +665,40 @@ void TestLanguage::enumerateProjectProperties()
QCOMPARE(exceptionCaught, false);
}
+void TestLanguage::evalErrorInNonPresentModule_data()
+{
+ QTest::addColumn<bool>("moduleRequired");
+ QTest::addColumn<QString>("errorMessage");
+
+ QTest::newRow("module required")
+ << true << "broken.qbs:4:5 Element at index 0 of list property 'broken' "
+ "does not have string type";
+ QTest::newRow("module not required") << false << QString();
+}
+
+void TestLanguage::evalErrorInNonPresentModule()
+{
+ QFETCH(bool, moduleRequired);
+ QFETCH(QString, errorMessage);
+ try {
+ SetupProjectParameters params = defaultParameters;
+ params.setProjectFilePath(testProject("eval-error-in-non-present-module.qbs"));
+ QVariantMap overridden{std::make_pair("products.p.moduleRequired", moduleRequired)};
+ params.setOverriddenValues(overridden);
+ TopLevelProjectPtr project = loader->loadProject(params);
+ QVERIFY(errorMessage.isEmpty());
+ QVERIFY(!!project);
+ QHash<QString, ResolvedProductPtr> products = productsFromProject(project);
+ QCOMPARE(products.size(), 1);
+ const ResolvedProductPtr product = products.value("p");
+ QVERIFY(!!product);
+ }
+ catch (const ErrorInfo &e) {
+ QVERIFY(!errorMessage.isEmpty());
+ QVERIFY2(e.toString().contains(errorMessage), qPrintable(e.toString()));
+ }
+}
+
void TestLanguage::defaultValue()
{
bool exceptionCaught = false;
diff --git a/tests/auto/language/tst_language.h b/tests/auto/language/tst_language.h
index d724e5fc6..660c1b9b6 100644
--- a/tests/auto/language/tst_language.h
+++ b/tests/auto/language/tst_language.h
@@ -95,6 +95,8 @@ private slots:
void dottedNames();
void emptyJsFile();
void enumerateProjectProperties();
+ void evalErrorInNonPresentModule_data();
+ void evalErrorInNonPresentModule();
void environmentVariable();
void errorInDisabledProduct();
void erroneousFiles_data();