aboutsummaryrefslogtreecommitdiffstats
path: root/src/app/shared
diff options
context:
space:
mode:
authorChristian Kandeler <christian.kandeler@digia.com>2012-10-18 14:59:32 +0200
committerJoerg Bornemann <joerg.bornemann@digia.com>2012-10-19 10:24:47 +0200
commitd6a10a767f1bef5ddf079c723e6c5a35cfe7df52 (patch)
tree62002383fc630cbbd984e704aa0ef52417c699d7 /src/app/shared
parent7a0091638c9870555badd46db11014eaff8b020b (diff)
Get rid of special treatment for files ending in ".qbp".
- Deprecate the ".qbp" suffix. - Do not go up the directory tree when looking for project files. Change-Id: I39ece65683556b720fb940dde27e485f865cf086 Task-number: QBS-137 Reviewed-by: Joerg Bornemann <joerg.bornemann@digia.com>
Diffstat (limited to 'src/app/shared')
-rw-r--r--src/app/shared/commandlineparser.cpp49
1 files changed, 17 insertions, 32 deletions
diff --git a/src/app/shared/commandlineparser.cpp b/src/app/shared/commandlineparser.cpp
index 0e9bc0fe2..7e2da6339 100644
--- a/src/app/shared/commandlineparser.cpp
+++ b/src/app/shared/commandlineparser.cpp
@@ -101,7 +101,7 @@ void CommandLineParser::printHelp() const
" Set or get project/global option(s).\n"
"\nGeneral options:\n"
" -h -? --help .... Show this help.\n"
- " -f <file> ....... Specify the .qbp project file.\n"
+ " -f <file> ....... Use <file> as the main project file.\n"
" -v .............. Be more verbose. Increases the log level by one.\n"
" -q .............. Be more quiet. Decreases the log level by one.\n"
"\nBuild options:\n"
@@ -173,17 +173,18 @@ void CommandLineParser::doParse()
if (isHelpSet())
return;
- // automatically detect the project file name
- if (m_projectFileName.isEmpty())
- m_projectFileName = guessProjectFileName();
- if (m_projectFileName.isEmpty())
- throw Error(tr("No project file given."));
-
- // make the project file name absolute
- if (FileInfo::isAbsolute(m_projectFileName)) {
- m_projectFileName = FileInfo::resolvePath(QDir::currentPath(), m_projectFileName);
- m_projectFileName = QDir::cleanPath(m_projectFileName);
+ if (m_projectFileName.isEmpty()) {
+ qbsDebug() << "No project file given; looking in current directory.";
+ m_projectFileName = QDir::currentPath();
}
+ setRealProjectFile();
+ m_projectFileName = FileInfo::resolvePath(QDir::currentPath(), m_projectFileName);
+ m_projectFileName = QDir::cleanPath(m_projectFileName);
+
+ // TODO: Remove in 0.4
+ if (m_projectFileName.endsWith(QLatin1String(".qbp")))
+ qbsInfo() << tr("Your main project file has the old suffix '.qbp'. This does not "
+ "hurt, but the convention is now to use '.qbs'.");
qbsDebug() << qbs::DontPrintLogLevel << "Using project file '"
<< QDir::toNativeSeparators(projectFileName()) << "'.";
@@ -244,7 +245,6 @@ void CommandLineParser::parseShortOptions(const QString &options)
break;
case 'f':
m_projectFileName = QDir::fromNativeSeparators(getShortOptionArgument(options, i));
- setRealProjectFile();
break;
case 'k':
m_buildOptions.keepGoing = true;
@@ -328,7 +328,11 @@ void CommandLineParser::setRealProjectFile()
return;
if (!projectFileInfo.isDir())
throw Error(tr("Project file '%1' has invalid type.").arg(m_projectFileName));
- const QStringList namePatterns = QStringList(QLatin1String("*.qbp"));
+
+ // TODO: Remove check for '.qbp' in 0.4.
+ const QStringList namePatterns = QStringList()
+ << QLatin1String("*.qbp") << QLatin1String("*.qbs");
+
const QStringList &actualFileNames
= QDir(m_projectFileName).entryList(namePatterns, QDir::Files);
if (actualFileNames.isEmpty())
@@ -390,23 +394,4 @@ QList<QVariantMap> CommandLineParser::buildConfigurations() const
return buildConfigs;
}
-QString CommandLineParser::guessProjectFileName()
-{
- QDir searchDir = QDir::current();
- for (;;) {
- QStringList projectFiles = searchDir.entryList(QStringList() << "*.qbp", QDir::Files);
- if (projectFiles.count() == 1) {
- QDir::setCurrent(searchDir.path());
- return searchDir.absoluteFilePath(projectFiles.first());
- } else if (projectFiles.count() > 1) {
- throw Error(tr("Multiple project files found in '%1'.\n"
- "Please specify the correct project file using the -f option.")
- .arg(QDir::toNativeSeparators(searchDir.absolutePath())));
- }
- if (!searchDir.cdUp())
- break;
- }
- return QString();
-}
-
} // namespace qbs