aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/lib/corelib/buildgraph/buildgraphloader.cpp26
-rw-r--r--src/lib/corelib/tools/settings.cpp20
-rw-r--r--tests/auto/api/tst_api.cpp18
-rw-r--r--tests/auto/blackbox/testdata/installed_artifact/installed_artifact.qbs6
-rw-r--r--tests/auto/blackbox/testdata/trackExternalProductChanges/fileList.js5
-rw-r--r--tests/auto/blackbox/testdata/trackExternalProductChanges/project.qbs5
-rw-r--r--tests/auto/blackbox/tst_blackbox.cpp38
7 files changed, 79 insertions, 39 deletions
diff --git a/src/lib/corelib/buildgraph/buildgraphloader.cpp b/src/lib/corelib/buildgraph/buildgraphloader.cpp
index b76b33eb6..5931a3dc7 100644
--- a/src/lib/corelib/buildgraph/buildgraphloader.cpp
+++ b/src/lib/corelib/buildgraph/buildgraphloader.cpp
@@ -588,7 +588,7 @@ void BuildGraphLoader::onProductFileListChanged(const ResolvedProductPtr &restor
continue;
}
- // TODO: overrideFileTags and properties have to be checked for changes as well.
+ // TODO: overrideFileTags has to be checked for changes as well.
if (changedArtifact->fileTags != a->fileTags) {
// artifact's filetags have changed
m_logger.qbsDebug() << "[BG] filetags have changed for artifact '"
@@ -617,6 +617,18 @@ void BuildGraphLoader::onProductFileListChanged(const ResolvedProductPtr &restor
}
}
}
+
+ if (changedArtifact->properties->value() != a->properties->value()) {
+ m_logger.qbsDebug() << "[BG] properties have changed for artifact '"
+ << a->absoluteFilePath << "'";
+ Artifact * const oldArtifact
+ = lookupArtifact(restoredProduct, oldBuildData, a->absoluteFilePath, true);
+ QBS_CHECK(oldArtifact);
+ newlyResolvedProduct->topLevelProject()->buildData
+ ->removeArtifactAndExclusiveDependents(oldArtifact, m_logger, true,
+ &artifactsToRemove);
+ addedArtifacts += createArtifact(newlyResolvedProduct, changedArtifact, m_logger);
+ }
}
// apply rules for new artifacts
@@ -797,12 +809,12 @@ void BuildGraphLoader::rescueOldBuildData(const ResolvedProductConstPtr &restore
artifact->setTimestamp(oldArtifact->timestamp());
foreach (Artifact * const oldChild, childLists.value(oldArtifact)) {
- foreach (FileResourceBase *childFileRes,
- newlyResolvedProduct->topLevelProject()->buildData->lookupFiles(oldChild)) {
- Artifact * const child = dynamic_cast<Artifact *>(childFileRes);
- if (child && !artifact->children.contains(child))
- safeConnect(artifact, child, m_logger);
- }
+ Artifact * const newChild = lookupArtifact(oldChild->product,
+ newlyResolvedProduct->topLevelProject()->buildData.data(),
+ oldChild->filePath(), true);
+ if (!newChild || artifact->children.contains(newChild))
+ continue;
+ safeConnect(artifact, newChild, m_logger);
}
}
}
diff --git a/src/lib/corelib/tools/settings.cpp b/src/lib/corelib/tools/settings.cpp
index 95d27ba24..f170930eb 100644
--- a/src/lib/corelib/tools/settings.cpp
+++ b/src/lib/corelib/tools/settings.cpp
@@ -68,18 +68,16 @@ static void migrateGroup(QSettings *settings, const QString &group)
Settings::Settings(const QString &organization, const QString &application)
: m_settings(new QSettings(format(), QSettings::UserScope, organization, application))
{
- if (HostOsInfo::isOsxHost()) {
- // Migrate settings to internal group.
- // ### remove in qbs 1.3
- if (!m_settings->childGroups().contains(QLatin1String("org/qt-project/qbs"))) {
- migrateValue(m_settings, QLatin1String("defaultProfile"));
- migrateGroup(m_settings, QLatin1String("profiles"));
- migrateGroup(m_settings, QLatin1String("preferences"));
- }
- // Actual qbs settings are stored within a group, because QSettings sees extra system global
- // settings on OS X we're not interested in.
- m_settings->beginGroup(QLatin1String("org/qt-project/qbs"));
+ // Migrate settings to internal group.
+ // ### remove in qbs 1.3
+ if (!m_settings->childGroups().contains(QLatin1String("org/qt-project/qbs"))) {
+ migrateValue(m_settings, QLatin1String("defaultProfile"));
+ migrateGroup(m_settings, QLatin1String("profiles"));
+ migrateGroup(m_settings, QLatin1String("preferences"));
}
+ // Actual qbs settings are stored transparently within a group, because QSettings
+ // can see non-qbs fallback settings e.g. from QtProject that we're not interested in.
+ m_settings->beginGroup(QLatin1String("org/qt-project/qbs"));
}
Settings::~Settings()
diff --git a/tests/auto/api/tst_api.cpp b/tests/auto/api/tst_api.cpp
index 577c1a7f6..dbe5237a8 100644
--- a/tests/auto/api/tst_api.cpp
+++ b/tests/auto/api/tst_api.cpp
@@ -385,13 +385,17 @@ void TestApi::installableFiles()
installOptions.setInstallRoot(QLatin1String("/tmp"));
QList<qbs::InstallableFile> installableFiles
= project.installableFilesForProduct(product, installOptions);
- QCOMPARE(installableFiles.count(), 1);
- qbs::InstallableFile const application = installableFiles.first();
- QVERIFY(application.isExecutable());
- QString expectedTargetFilePath
- = qbs::Internal::HostOsInfo::appendExecutableSuffix(QLatin1String("/tmp/usr/bin/installedApp"));
- QCOMPARE(application.targetFilePath(), expectedTargetFilePath);
- QCOMPARE(project.targetExecutable(product, installOptions), expectedTargetFilePath);
+ QCOMPARE(installableFiles.count(), 2);
+ foreach (const qbs::InstallableFile &f,installableFiles) {
+ if (!f.sourceFilePath().endsWith("main.cpp")) {
+ QVERIFY(f.isExecutable());
+ QString expectedTargetFilePath = qbs::Internal::HostOsInfo
+ ::appendExecutableSuffix(QLatin1String("/tmp/usr/bin/installedApp"));
+ QCOMPARE(f.targetFilePath(), expectedTargetFilePath);
+ QCOMPARE(project.targetExecutable(product, installOptions), expectedTargetFilePath);
+ break;
+ }
+ }
setupParams.setProjectFilePath(QDir::cleanPath(QLatin1String(SRCDIR "/../blackbox/testdata"
"/recursive_wildcards/recursive_wildcards.qbs")));
diff --git a/tests/auto/blackbox/testdata/installed_artifact/installed_artifact.qbs b/tests/auto/blackbox/testdata/installed_artifact/installed_artifact.qbs
index 106ccdf54..81562a70b 100644
--- a/tests/auto/blackbox/testdata/installed_artifact/installed_artifact.qbs
+++ b/tests/auto/blackbox/testdata/installed_artifact/installed_artifact.qbs
@@ -4,7 +4,11 @@ Application {
name: "installedApp"
type: "application"
Depends { name: "cpp" }
- files: "main.cpp"
+ Group {
+ files: "main.cpp"
+ qbs.install: true
+ qbs.installDir: "src"
+ }
qbs.installPrefix: "/usr"
Group {
fileTagsFilter: "application"
diff --git a/tests/auto/blackbox/testdata/trackExternalProductChanges/fileList.js b/tests/auto/blackbox/testdata/trackExternalProductChanges/fileList.js
index 0d540d82e..5174f8ce7 100644
--- a/tests/auto/blackbox/testdata/trackExternalProductChanges/fileList.js
+++ b/tests/auto/blackbox/testdata/trackExternalProductChanges/fileList.js
@@ -1 +1,6 @@
function fileList() { return []; }
+
+function filesFromEnv(qbs) { return qbs.getEnv("QBS_TEST_PULL_IN_FILE_VIA_ENV") ? ["environmentChange.cpp"] : []; }
+
+function filesFromFs(qbs) { return File.exists(path + "/fileExists.cpp") ? ["fileExists.cpp"] : []; }
+
diff --git a/tests/auto/blackbox/testdata/trackExternalProductChanges/project.qbs b/tests/auto/blackbox/testdata/trackExternalProductChanges/project.qbs
index 6b4bfa951..c3eb9b0b7 100644
--- a/tests/auto/blackbox/testdata/trackExternalProductChanges/project.qbs
+++ b/tests/auto/blackbox/testdata/trackExternalProductChanges/project.qbs
@@ -3,8 +3,5 @@ import qbs.File
import "fileList.js" as FileList
CppApplication {
- property pathList filesFromEnv: qbs.getEnv("QBS_TEST_PULL_IN_FILE_VIA_ENV") ? ["environmentChange.cpp"] : []
- property pathList filesFromJs: FileList.fileList()
- property pathList filesFromFs: File.exists(path + "/fileExists.cpp") ? ["fileExists.cpp"] : []
- files: ["main.cpp"].concat(filesFromJs).concat(filesFromEnv).concat(filesFromFs)
+ files: ["main.cpp"].concat(FileList.fileList()).concat(FileList.filesFromEnv(qbs)).concat(FileList.filesFromFs(qbs))
}
diff --git a/tests/auto/blackbox/tst_blackbox.cpp b/tests/auto/blackbox/tst_blackbox.cpp
index 5e4f34119..8e894d2ae 100644
--- a/tests/auto/blackbox/tst_blackbox.cpp
+++ b/tests/auto/blackbox/tst_blackbox.cpp
@@ -378,15 +378,21 @@ void TestBlackbox::clean()
const QString appObjectFilePath = buildDir + "/.obj/app/main.cpp" + QTC_HOST_OBJECT_SUFFIX;
const QString appExeFilePath = buildDir + "/app" + QTC_HOST_EXE_SUFFIX;
const QString depObjectFilePath = buildDir + "/.obj/dep/dep.cpp" + QTC_HOST_OBJECT_SUFFIX;
- const QString depLibBase = buildDir + '/' + QTC_HOST_DYNAMICLIB_PREFIX + "dep"
- + QTC_HOST_DYNAMICLIB_SUFFIX;
+ const QString depLibBase = buildDir + '/' + QTC_HOST_DYNAMICLIB_PREFIX + "dep";
QString depLibFilePath;
QStringList symlinks;
- if (qbs::Internal::HostOsInfo::isAnyUnixHost()) {
- depLibFilePath = depLibBase + ".1.1.0";
- symlinks << depLibBase + ".1.1" << depLibBase + ".1" << depLibBase;
+ if (qbs::Internal::HostOsInfo::isOsxHost()) {
+ depLibFilePath = depLibBase + ".1.1.0" + QTC_HOST_DYNAMICLIB_SUFFIX;
+ symlinks << depLibBase + ".1.1" + QTC_HOST_DYNAMICLIB_SUFFIX
+ << depLibBase + ".1" + QTC_HOST_DYNAMICLIB_SUFFIX
+ << depLibBase + QTC_HOST_DYNAMICLIB_SUFFIX;
+ } else if (qbs::Internal::HostOsInfo::isAnyUnixHost()) {
+ depLibFilePath = depLibBase + QTC_HOST_DYNAMICLIB_SUFFIX + ".1.1.0";
+ symlinks << depLibBase + QTC_HOST_DYNAMICLIB_SUFFIX + ".1.1"
+ << depLibBase + QTC_HOST_DYNAMICLIB_SUFFIX + ".1"
+ << depLibBase + QTC_HOST_DYNAMICLIB_SUFFIX;
} else {
- depLibFilePath = depLibBase;
+ depLibFilePath = depLibBase + QTC_HOST_DYNAMICLIB_SUFFIX;
}
QDir::setCurrent(testDataDir + "/clean");
@@ -710,7 +716,7 @@ void TestBlackbox::trackExternalProductChanges()
QFile jsFile("fileList.js");
QVERIFY(jsFile.open(QIODevice::ReadWrite));
QByteArray jsCode = jsFile.readAll();
- jsCode.replace("[]", "['jsFileChange.cpp']");
+ jsCode.replace("return []", "return ['jsFileChange.cpp']");
jsFile.resize(0);
jsFile.write(jsCode);
jsFile.close();
@@ -1213,7 +1219,10 @@ void TestBlackbox::propertyChanges()
QVERIFY(m_qbsStdout.contains("compiling source2.cpp"));
QVERIFY(m_qbsStdout.contains("compiling source3.cpp"));
QVERIFY(!m_qbsStdout.contains("generated.txt"));
- QVERIFY(!m_qbsStdout.contains("Making output from input"));
+
+ // Not actually necessary, but qbs cannot know that, since a property change is potentially
+ // relevant to all rules.
+ QVERIFY(m_qbsStdout.contains("Making output from input"));
// Incremental build, non-essential dependency removed.
waitForNewTimestamp();
@@ -1532,6 +1541,7 @@ void TestBlackbox::installedApp()
QCOMPARE(runQbs(QbsRunParameters(QLatin1String("install"), QStringList("--remove-first"))), 0);
QVERIFY(QFile::exists(defaultInstallRoot
+ HostOsInfo::appendExecutableSuffix(QLatin1String("/usr/bin/installedApp"))));
+ QVERIFY(QFile::exists(defaultInstallRoot + QLatin1String("/usr/src/main.cpp")));
QVERIFY(!addedFile.exists());
// Check whether changing install parameters on the product causes re-installation.
@@ -1546,17 +1556,27 @@ void TestBlackbox::installedApp()
QCOMPARE(runQbs(QbsRunParameters(QLatin1String("install"))), 0);
QVERIFY(QFile::exists(defaultInstallRoot
+ HostOsInfo::appendExecutableSuffix(QLatin1String("/usr/local/bin/installedApp"))));
+ QVERIFY(QFile::exists(defaultInstallRoot + QLatin1String("/usr/local/src/main.cpp")));
// Check whether changing install parameters on the artifact causes re-installation.
content.replace("qbs.installDir: \"bin\"", "qbs.installDir: 'custom'");
waitForNewTimestamp();
projectFile.resize(0);
projectFile.write(content);
- projectFile.close();
+ QVERIFY(projectFile.flush());
QCOMPARE(runQbs(QbsRunParameters(QLatin1String("install"))), 0);
QVERIFY(QFile::exists(defaultInstallRoot
+ HostOsInfo::appendExecutableSuffix(QLatin1String("/usr/local/custom/installedApp"))));
+ // Check whether changing install parameters on a source file causes re-installation.
+ content.replace("qbs.installDir: \"src\"", "qbs.installDir: 'source'");
+ waitForNewTimestamp();
+ projectFile.resize(0);
+ projectFile.write(content);
+ projectFile.close();
+ QCOMPARE(runQbs(QbsRunParameters(QLatin1String("install"))), 0);
+ QVERIFY(QFile::exists(defaultInstallRoot + QLatin1String("/usr/local/source/main.cpp")));
+
rmDirR(buildDir);
QbsRunParameters params;
params.command = "install";