From ae7b3399356c9b8883eb4dbe878ae33b33b94f52 Mon Sep 17 00:00:00 2001 From: Christian Kandeler Date: Mon, 11 Sep 2023 18:11:59 +0200 Subject: Loader: Properly handle the case of a local profile as top-level profile The use case seems somewhat dubious, as the intention is that profiles defined inside a project should also be attached inside that project (via qbs.profile), but why not support it if we can. Fixes: QBS-1756 Change-Id: I569c4c7b39c34fe6f4f5d4172139046310524773 Reviewed-by: Ivan Komissarov --- .../testdata/local-profile-as-top-level-profile.qbs | 7 +++++++ tests/auto/language/tst_language.cpp | 18 ++++++++++++++++++ tests/auto/language/tst_language.h | 1 + 3 files changed, 26 insertions(+) create mode 100644 tests/auto/language/testdata/local-profile-as-top-level-profile.qbs (limited to 'tests/auto') diff --git a/tests/auto/language/testdata/local-profile-as-top-level-profile.qbs b/tests/auto/language/testdata/local-profile-as-top-level-profile.qbs new file mode 100644 index 000000000..9bca3c599 --- /dev/null +++ b/tests/auto/language/testdata/local-profile-as-top-level-profile.qbs @@ -0,0 +1,7 @@ +Product { + Profile { + name: "test-profile" + qbs.architecture: "arm" + qbs.targetPlatform: "macos" + } +} diff --git a/tests/auto/language/tst_language.cpp b/tests/auto/language/tst_language.cpp index 8b50d39b9..01685157a 100644 --- a/tests/auto/language/tst_language.cpp +++ b/tests/auto/language/tst_language.cpp @@ -1706,6 +1706,24 @@ void TestLanguage::jsImportUsedInMultipleScopes() QVERIFY(!exceptionCaught); } +void TestLanguage::localProfileAsTopLevelProfile() +{ + bool exceptionCaught = false; + try { + defaultParameters.setTopLevelProfile("test-profile"); + resolveProject("local-profile-as-top-level-profile.qbs"); + QVERIFY(!!project); + QCOMPARE(int(project->products.size()), 1); + const PropertyMapConstPtr &props = project->products.front()->moduleProperties; + QCOMPARE(props->qbsPropertyValue("architecture"), "arm"); + QCOMPARE(props->qbsPropertyValue("targetPlatform"), "macos"); + } catch (const ErrorInfo &e) { + exceptionCaught = true; + qDebug() << e.toString(); + } + QCOMPARE(exceptionCaught, false); +} + void TestLanguage::moduleMergingVariantValues() { bool exceptionCaught = false; diff --git a/tests/auto/language/tst_language.h b/tests/auto/language/tst_language.h index 24077e970..c6695f7c9 100644 --- a/tests/auto/language/tst_language.h +++ b/tests/auto/language/tst_language.h @@ -115,6 +115,7 @@ private slots: void jsExtensions(); void jsImportUsedInMultipleScopes_data(); void jsImportUsedInMultipleScopes(); + void localProfileAsTopLevelProfile(); void moduleMergingVariantValues(); void modulePrioritizationBySearchPath_data(); void modulePrioritizationBySearchPath(); -- cgit v1.2.3