OSDN Git Service

Qt4Project: do not show a error on make clean without a Makefile
authordt <qtc-committer@nokia.com>
Thu, 24 Mar 2011 19:44:46 +0000 (20:44 +0100)
committerdt <qtc-committer@nokia.com>
Thu, 24 Mar 2011 19:44:46 +0000 (20:44 +0100)
Task-Nr:

src/plugins/qt4projectmanager/makestep.cpp
src/plugins/qt4projectmanager/makestep.h
src/plugins/qt4projectmanager/qmakestep.cpp

index 319a938..4c6c084 100644 (file)
@@ -166,14 +166,23 @@ bool MakeStep::init()
 
     ProjectExplorer::ToolChain *toolchain = bc->toolChain();
 
-    if (bc->subNodeBuild()){
-        if(!bc->subNodeBuild()->makefile().isEmpty()) {
+    if (bc->subNodeBuild()) {
+        QString makefile = bc->subNodeBuild()->makefile();
+        if(!makefile.isEmpty()) {
             Utils::QtcProcess::addArg(&args, QLatin1String("-f"));
-            Utils::QtcProcess::addArg(&args, bc->subNodeBuild()->makefile());
+            Utils::QtcProcess::addArg(&args, makefile);
+            m_makeFileExists = QDir(workingDirectory).exists(makefile);
+        } else {
+            m_makeFileExists = QDir(workingDirectory).exists("Makefile");
+        }
+    } else {
+        if (!bc->makefile().isEmpty()) {
+            Utils::QtcProcess::addArg(&args, QLatin1String("-f"));
+            Utils::QtcProcess::addArg(&args, bc->makefile());
+            m_makeFileExists = QDir(workingDirectory).exists(bc->makefile());
+        } else {
+            m_makeFileExists = QDir(workingDirectory).exists("Makefile");
         }
-    } else if (!bc->makefile().isEmpty()) {
-        Utils::QtcProcess::addArg(&args, QLatin1String("-f"));
-        Utils::QtcProcess::addArg(&args, bc->makefile());
     }
 
     Utils::QtcProcess::addArgs(&args, m_userArgs);
@@ -215,6 +224,13 @@ void MakeStep::run(QFutureInterface<bool> & fi)
         return;
     }
 
+    if (!m_makeFileExists) {
+        if (!m_clean)
+            emit addOutput(tr("Makefile not found. Please check your build settings"), BuildStep::MessageOutput);
+        fi.reportResult(m_clean);
+        return;
+    }
+
     // Warn on common error conditions:
     bool canContinue = true;
     foreach (const ProjectExplorer::Task &t, m_tasks) {
@@ -228,7 +244,6 @@ void MakeStep::run(QFutureInterface<bool> & fi)
         return;
     }
 
-
     AbstractProcessStep::run(fi);
 }
 
index 599b78e..6a5a030 100644 (file)
@@ -115,6 +115,7 @@ protected:
 private:
     void ctor();
     bool m_clean;
+    bool m_makeFileExists;
     QString m_userArgs;
     QString m_makeCmd;
     QList<ProjectExplorer::Task> m_tasks;
index fa46167..8ad8afd 100644 (file)
@@ -257,7 +257,6 @@ void QMakeStep::run(QFutureInterface<bool> &fi)
     }
 
     // Warn on common error conditions:
-
     bool canContinue = true;
     foreach (const ProjectExplorer::Task &t, m_tasks) {
         addTask(t);