diff options
Diffstat (limited to 'src/lib/corelib/language/projectresolver.cpp')
-rw-r--r-- | src/lib/corelib/language/projectresolver.cpp | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/src/lib/corelib/language/projectresolver.cpp b/src/lib/corelib/language/projectresolver.cpp index f2910787f..9d9d56a87 100644 --- a/src/lib/corelib/language/projectresolver.cpp +++ b/src/lib/corelib/language/projectresolver.cpp @@ -678,8 +678,36 @@ void ProjectResolver::resolveGroup(Item *item, ProjectContext *projectContext) } const CodeLocation filesLocation = item->property(QLatin1String("files"))->location(); + + // TODO: Remove in 1.8 + bool emittedRelPathWarning = false; + const auto relPathChecker = [this, group, &filesLocation, &emittedRelPathWarning] + (const QString &fileName) { + if (emittedRelPathWarning) + return; + if (FileInfo::isAbsolute(fileName)) + return; + if (FileInfo::isAbsolute(group->prefix)) + return; + if (FileInfo::path(filesLocation.filePath()) + == FileInfo::path(m_productContext->product->location.filePath())) { + return; + } + if (m_groupLocationWarnings.contains(filesLocation)) + return; + const QString warningMessage = Tr::tr("Deprecation warning: Group is not located in the " + "same directory as the associated product and references files using a " + "relative path. The base directory for resolving such paths will change " + "in Qbs 1.8 from the directory of the product to the directory of the group. " + "You should probably use an absolute path as the group prefix here."); + m_logger.printWarning(ErrorInfo(warningMessage, filesLocation)); + m_groupLocationWarnings << filesLocation; + emittedRelPathWarning = true; + }; + ErrorInfo fileError; if (!patterns.isEmpty()) { + std::for_each(patterns.cbegin(), patterns.cend(), relPathChecker); SourceWildCards::Ptr wildcards = SourceWildCards::create(); wildcards->excludePatterns = m_evaluator->stringListValue(item, QLatin1String("excludeFiles")); @@ -693,6 +721,7 @@ void ProjectResolver::resolveGroup(Item *item, ProjectContext *projectContext) } foreach (const QString &fileName, files) { + relPathChecker(fileName); createSourceArtifact(m_productContext->product, fileName, group, false, filesLocation, &m_productContext->sourceArtifactLocations, &fileError); } |