From 525165a38302cf43a908a93f57a3a88cd6abc0e0 Mon Sep 17 00:00:00 2001 From: Christian Kandeler Date: Thu, 8 Jun 2017 10:54:50 +0200 Subject: Remove the profile name from the unique product name If the product is multiplexed by profile, its name is already uniquified by the multiplex id. If the product is not multiplexed, we don't need to make the name unique. This removes references to the top-level profile name from the build directory structure, which can be helpful when rebuilding with a different profile name, but the same effective properties. Also, it shortens the paths of generated artifacts in the common case. Change-Id: I1586049b9650542732a64be4b7d5f2db4428d87e Reviewed-by: Jake Petroules Reviewed-by: Joerg Bornemann --- tests/auto/api/tst_api.cpp | 6 +++--- .../subprofile-change-tracking/subprofile-change-tracking.qbs | 3 ++- tests/auto/blackbox/tst_blackbox.cpp | 5 +++-- tests/auto/blackbox/tst_blackboxjava.cpp | 2 +- tests/auto/shared.h | 9 +++------ 5 files changed, 12 insertions(+), 13 deletions(-) (limited to 'tests') diff --git a/tests/auto/api/tst_api.cpp b/tests/auto/api/tst_api.cpp index eb1ee0c12..bfe744ddb 100644 --- a/tests/auto/api/tst_api.cpp +++ b/tests/auto/api/tst_api.cpp @@ -1529,19 +1529,19 @@ void TestApi::multiArch() QVERIFY2(!buildJob->error().hasError(), qPrintable(buildJob->error().toString())); const QString outputBaseDir = setupParams.buildRoot() + '/'; QFile p1HostArtifact(outputBaseDir - + relativeProductBuildDir("p1", "host", p1HostMultiplexCfgId) + + relativeProductBuildDir("p1", p1HostMultiplexCfgId) + "/host+target.output"); QVERIFY2(p1HostArtifact.exists(), qPrintable(p1HostArtifact.fileName())); QVERIFY2(p1HostArtifact.open(QIODevice::ReadOnly), qPrintable(p1HostArtifact.errorString())); QCOMPARE(p1HostArtifact.readAll().constData(), "host-arch"); QFile p1TargetArtifact(outputBaseDir - + relativeProductBuildDir("p1", "target", p1TargetMultiplexCfgId) + + relativeProductBuildDir("p1", p1TargetMultiplexCfgId) + "/host+target.output"); QVERIFY2(p1TargetArtifact.exists(), qPrintable(p1TargetArtifact.fileName())); QVERIFY2(p1TargetArtifact.open(QIODevice::ReadOnly), qPrintable(p1TargetArtifact.errorString())); QCOMPARE(p1TargetArtifact.readAll().constData(), "target-arch"); QFile p2Artifact(outputBaseDir - + relativeProductBuildDir("p2", "host", p2HostMultiplexCfgId) + + relativeProductBuildDir("p2", p2HostMultiplexCfgId) + "/host-tool.output"); QVERIFY2(p2Artifact.exists(), qPrintable(p2Artifact.fileName())); QVERIFY2(p2Artifact.open(QIODevice::ReadOnly), qPrintable(p2Artifact.errorString())); diff --git a/tests/auto/blackbox/testdata/subprofile-change-tracking/subprofile-change-tracking.qbs b/tests/auto/blackbox/testdata/subprofile-change-tracking/subprofile-change-tracking.qbs index d23881940..b3fba23fe 100644 --- a/tests/auto/blackbox/testdata/subprofile-change-tracking/subprofile-change-tracking.qbs +++ b/tests/auto/blackbox/testdata/subprofile-change-tracking/subprofile-change-tracking.qbs @@ -1,8 +1,9 @@ import qbs Project { - CppApplication { files: ["main1.cpp"] } + CppApplication { name: "app1"; files: ["main1.cpp"] } CppApplication { + name: "app2" qbs.profiles: ["qbs-autotests-subprofile"] files: ["main2.cpp"] } diff --git a/tests/auto/blackbox/tst_blackbox.cpp b/tests/auto/blackbox/tst_blackbox.cpp index c9fc70c58..e0df2e7ac 100644 --- a/tests/auto/blackbox/tst_blackbox.cpp +++ b/tests/auto/blackbox/tst_blackbox.cpp @@ -616,8 +616,9 @@ void TestBlackbox::dependencyProfileMismatch() QbsRunParameters params(QStringList() << ("project.mainProfile:" + profileName()) << ("project.depProfile:" + depProfile.p.name())); params.expectFailure = true; - QVERIFY(runQbs(params) != 0); - QVERIFY2(m_qbsStderr.contains(profileName().toLocal8Bit() + "', which does not exist"), + QVERIFY2(runQbs(params) != 0, m_qbsStderr.constData()); + QVERIFY2(m_qbsStderr.contains(profileName().toLocal8Bit()) + && m_qbsStderr.contains("', which does not exist"), m_qbsStderr.constData()); } diff --git a/tests/auto/blackbox/tst_blackboxjava.cpp b/tests/auto/blackbox/tst_blackboxjava.cpp index 43a82839a..18cafead9 100644 --- a/tests/auto/blackbox/tst_blackboxjava.cpp +++ b/tests/auto/blackbox/tst_blackboxjava.cpp @@ -94,7 +94,7 @@ void TestBlackboxJava::android() for (int i = 0; i < productNames.count(); ++i) { const QString productName = productNames.at(i); QVERIFY(m_qbsStdout.contains("Creating " + productName.toLocal8Bit() + ".apk")); - const QString apkFilePath = relativeProductBuildDir(productName, p.name()) + const QString apkFilePath = relativeProductBuildDir(productName) + '/' + productName + ".apk"; QVERIFY2(regularFileExists(apkFilePath), qPrintable(apkFilePath)); const QString jarFilePath = findExecutable(QStringList("jar")); diff --git a/tests/auto/shared.h b/tests/auto/shared.h index 98e84e8c1..9c9c10df0 100644 --- a/tests/auto/shared.h +++ b/tests/auto/shared.h @@ -81,19 +81,16 @@ inline QString prefixedIfNonEmpty(const T &prefix, const QString &str) return prefix + str; } -inline QString uniqueProductName(const QString &productName, const QString &_profileName, +inline QString uniqueProductName(const QString &productName, const QString &multiplexConfigurationId) { - const QString p = _profileName.isEmpty() ? profileName() : _profileName; - return productName + '.' + p + prefixedIfNonEmpty(QLatin1Char('.'), multiplexConfigurationId); + return productName + prefixedIfNonEmpty(QLatin1Char('.'), multiplexConfigurationId); } inline QString relativeProductBuildDir(const QString &productName, - const QString &productProfileName = QString(), const QString &multiplexConfigurationId = QString()) { - const QString fullName = uniqueProductName(productName, productProfileName, - multiplexConfigurationId); + const QString fullName = uniqueProductName(productName, multiplexConfigurationId); QString dirName = qbs::Internal::HostOsInfo::rfc1034Identifier(fullName); const QByteArray hash = QCryptographicHash::hash(fullName.toUtf8(), QCryptographicHash::Sha1); dirName.append('.').append(hash.toHex().left(8)); -- cgit v1.2.1