diff options
author | Jake Petroules <jake.petroules@petroules.com> | 2015-08-21 16:44:38 -0700 |
---|---|---|
committer | Jake Petroules <jake.petroules@petroules.com> | 2015-08-25 11:46:58 +0000 |
commit | f37572a06f4990680d38a288eb90994cf531946f (patch) | |
tree | acdc1790133e5321c42b14e4efdd85276cf80be3 | |
parent | ce154e7834e08a22bc9a292cde3b21c6cb77b660 (diff) | |
download | qbs-f37572a06f4990680d38a288eb90994cf531946f.tar.gz |
Fix qbs run when used in conjunction with qbs.installSourceBase.
Task-number: QBS-858
Change-Id: Iafb1eb61e9e7f41fa9e5c5d1f3a8e7f58b6c1a60
Reviewed-by: Christian Kandeler <christian.kandeler@theqtcompany.com>
-rw-r--r-- | src/lib/corelib/api/project.cpp | 8 | ||||
-rw-r--r-- | src/lib/corelib/api/projectdata.cpp | 12 | ||||
-rw-r--r-- | src/lib/corelib/api/projectdata.h | 1 | ||||
-rw-r--r-- | src/lib/corelib/api/projectdata_p.h | 2 | ||||
-rw-r--r-- | src/lib/corelib/buildgraph/productinstaller.cpp | 9 | ||||
-rw-r--r-- | src/lib/corelib/buildgraph/productinstaller.h | 2 | ||||
-rw-r--r-- | tests/auto/api/tst_api.cpp | 2 |
7 files changed, 12 insertions, 24 deletions
diff --git a/src/lib/corelib/api/project.cpp b/src/lib/corelib/api/project.cpp index afa170a67..01a8fa829 100644 --- a/src/lib/corelib/api/project.cpp +++ b/src/lib/corelib/api/project.cpp @@ -1010,12 +1010,12 @@ QList<InstallableFile> Project::installableFilesForProduct(const ProductData &pr InstallableFile f; const QString &targetFilePath = ProductInstaller::targetFilePath(internalProduct->topLevelProject(), internalProduct->sourceDirectory, - artifact->absoluteFilePath, artifact->properties, mutableOptions, - &f.d->targetDirectory); + artifact->absoluteFilePath, artifact->properties, mutableOptions); if (targetFilePath.isEmpty()) continue; f.d->sourceFilePath = artifact->absoluteFilePath; f.d->fileTags = artifact->fileTags.toStringList(); + f.d->targetFilePath = targetFilePath; f.d->isValid = true; installableFiles << f; } @@ -1029,12 +1029,12 @@ QList<InstallableFile> Project::installableFilesForProduct(const ProductData &pr InstallableFile f; const QString &targetFilePath = ProductInstaller::targetFilePath(internalProduct->topLevelProject(), internalProduct->sourceDirectory, - artifact->filePath(), artifact->properties, mutableOptions, - &f.d->targetDirectory); + artifact->filePath(), artifact->properties, mutableOptions); if (targetFilePath.isEmpty()) continue; f.d->sourceFilePath = artifact->filePath(); f.d->fileTags = artifact->fileTags().toStringList(); + f.d->targetFilePath = targetFilePath; f.d->isValid = true; installableFiles << f; } diff --git a/src/lib/corelib/api/projectdata.cpp b/src/lib/corelib/api/projectdata.cpp index 1a07003fa..cf969cb96 100644 --- a/src/lib/corelib/api/projectdata.cpp +++ b/src/lib/corelib/api/projectdata.cpp @@ -371,21 +371,11 @@ QString InstallableFile::sourceFilePath() const } /*! - * \brief The directory that this file will be copied into on installation. - */ -QString InstallableFile::targetDirectory() const -{ - return d->targetDirectory; -} - -/*! * \brief The file path that this file will be copied to on installation. - * This is a convenience function. - * \sa InstallableFile::targetDirectory() */ QString InstallableFile::targetFilePath() const { - return d->targetDirectory + QLatin1Char('/') + Internal::FileInfo::fileName(d->sourceFilePath); + return d->targetFilePath; } /*! diff --git a/src/lib/corelib/api/projectdata.h b/src/lib/corelib/api/projectdata.h index 72aa69ea7..ae8fbe153 100644 --- a/src/lib/corelib/api/projectdata.h +++ b/src/lib/corelib/api/projectdata.h @@ -171,7 +171,6 @@ public: bool isValid() const; QString sourceFilePath() const; - QString targetDirectory() const; QString targetFilePath() const; QStringList fileTags() const; bool isExecutable() const; diff --git a/src/lib/corelib/api/projectdata_p.h b/src/lib/corelib/api/projectdata_p.h index 895be44b8..e0a055641 100644 --- a/src/lib/corelib/api/projectdata_p.h +++ b/src/lib/corelib/api/projectdata_p.h @@ -79,7 +79,7 @@ public: InstallableFilePrivate() : isValid(false) {} QString sourceFilePath; - QString targetDirectory; + QString targetFilePath; QStringList fileTags; bool isValid; }; diff --git a/src/lib/corelib/buildgraph/productinstaller.cpp b/src/lib/corelib/buildgraph/productinstaller.cpp index dced7abe1..ba64f3f5b 100644 --- a/src/lib/corelib/buildgraph/productinstaller.cpp +++ b/src/lib/corelib/buildgraph/productinstaller.cpp @@ -102,7 +102,7 @@ void ProductInstaller::install() QString ProductInstaller::targetFilePath(const TopLevelProject *project, const QString &productSourceDir, const QString &sourceFilePath, const PropertyMapConstPtr &properties, - InstallOptions &options, QString *targetDirectory) + InstallOptions &options) { if (!properties->qbsPropertyValue(QLatin1String("install")).toBool()) return QString(); @@ -136,8 +136,6 @@ QString ProductInstaller::targetFilePath(const TopLevelProject *project, } targetFilePath.prepend(targetDir + QLatin1Char('/')); - if (targetDirectory) - *targetDirectory = targetDir; return targetFilePath; } @@ -174,10 +172,11 @@ void ProductInstaller::copyFile(const Artifact *artifact) throw ErrorInfo(Tr::tr("Installation canceled for configuration '%1'.") .arg(m_products.first()->project->topLevelProject()->id())); } - QString targetDir; + const QString targetFilePath = this->targetFilePath(m_project.data(), artifact->product->sourceDirectory, artifact->filePath(), - artifact->properties, m_options, &targetDir); + artifact->properties, m_options); + const QString targetDir = FileInfo::path(targetFilePath); const QString nativeFilePath = QDir::toNativeSeparators(artifact->filePath()); const QString nativeTargetDir = QDir::toNativeSeparators(targetDir); if (m_options.dryRun()) { diff --git a/src/lib/corelib/buildgraph/productinstaller.h b/src/lib/corelib/buildgraph/productinstaller.h index 0daf0c931..da4a903cd 100644 --- a/src/lib/corelib/buildgraph/productinstaller.h +++ b/src/lib/corelib/buildgraph/productinstaller.h @@ -51,7 +51,7 @@ public: static QString targetFilePath(const TopLevelProject *project, const QString &productSourceDir, const QString &sourceFilePath, const PropertyMapConstPtr &properties, - InstallOptions &options, QString *targetDirectory = 0); + InstallOptions &options); static void initInstallRoot(const TopLevelProject *project, InstallOptions &options); void removeInstallRoot(); diff --git a/tests/auto/api/tst_api.cpp b/tests/auto/api/tst_api.cpp index 03bc86195..7f0d59afc 100644 --- a/tests/auto/api/tst_api.cpp +++ b/tests/auto/api/tst_api.cpp @@ -936,7 +936,7 @@ void TestApi::fileTagsFilterOverride() QList<qbs::InstallableFile> installableFiles = project.installableFilesForProduct(product, qbs::InstallOptions()); QCOMPARE(installableFiles.count(), 1); - QVERIFY(installableFiles.first().targetDirectory().contains("habicht")); + QVERIFY(installableFiles.first().targetFilePath().contains("habicht")); } void TestApi::infiniteLoopBuilding() |