Bug 76037

Summary: qmake project: binary not rebuild before execution (after changes in files)
Product: [Applications] kdevelop Reporter: Daniel Franke <franke.daniel>
Component: Build tools: QMakeAssignee: KDevelop Developers <kdevelop-devel>
Status: RESOLVED FIXED    
Severity: normal    
Priority: NOR    
Version: 3.0.1   
Target Milestone: ---   
Platform: Compiled Sources   
OS: Solaris   
Latest Commit: Version Fixed In:
Sentry Crash Report:
Attachments: patch against CVS HEAD (2004/04/23)

Description Daniel Franke 2004-02-24 17:26:34 UTC
Version:           3.0.1 (using KDE 3.1.4)
Installed from:    compiled sources
Compiler:          gcc version 3.2.2
OS:          SunOS (sun4u) release 5.8

In automake based projects, the executable is rebuild before execution [SHIFT+F9] (if necessary, e.g. if files have changed). 
One would expect this would be true for qmake projects also - but it isn't. The binary has to be rebuild explicitly [F8] before execution [SHIFT+F9].

version: kdevelop-3.0.1 (CVS 040219)
Comment 1 Daniel Franke 2004-04-24 10:30:13 UTC
Created attachment 5758 [details]
patch against CVS HEAD (2004/04/23)

Could somebody have a look at this patch? Works fine so far, but it might not
be the best solution since I'm not involved in history of trollproject.
Comment 2 Alexander Dymo 2004-12-11 01:19:38 UTC
CVS commit by dymo: 

Build the project (or subproject) before execution if source files were changed.
BUG: 76037
Thanks to Daniel Franke for the patch.


  M +26 -6     trollprojectpart.cpp   1.81
  M +2 -0      trollprojectpart.h   1.29


--- kdevelop/buildtools/qmake/trollprojectpart.cpp  #1.80:1.81
@@ -112,5 +112,5 @@ TrollProjectPart::TrollProjectPart(QObje
 
     action = new KAction( i18n("Execute Main Program"), "exec", SHIFT+Key_F9,
-                          m_widget, SLOT(slotExecuteProject()),
+                          this, SLOT(slotBuildAndExecuteProject()),
                           actionCollection(), "build_execute_project" );
     action->setToolTip(i18n("Execute main program"));
@@ -149,5 +149,5 @@ TrollProjectPart::TrollProjectPart(QObje
 
     action = new KAction( i18n("Execute Subproject"), "exec", 0,
-                          m_widget, SLOT(slotExecuteTarget()),
+                          this, SLOT(slotBuildAndExecuteTarget()),
                           actionCollection(), "build_execute_target" );
     action->setToolTip(i18n("Execute subproject"));
@@ -276,4 +276,24 @@ DomUtil::PairList TrollProjectPart::runE
 }
 
+void TrollProjectPart::slotBuildAndExecuteProject()
+{
+    partController()->saveAllFiles();
+    if (isDirty()) {
+        m_executeAfterBuild = true;
+        m_widget->slotBuildProject();
+    } else
+        m_widget->slotExecuteProject();
+}
+
+void TrollProjectPart::slotBuildAndExecuteTarget()
+{
+    partController()->saveAllFiles();
+    if (isDirty()) {
+        m_executeAfterBuild = true;
+        m_widget->slotBuildTarget();
+    } else
+        m_widget->slotExecuteTarget();
+}
+
 
 /** Retuns the currently selected run directory
@@ -497,8 +517,8 @@ void TrollProjectPart::slotCommandFinish
     Q_UNUSED( command );
 
-    if( m_buildCommand != command )
-        return;
-
-    m_buildCommand = QString::null;
+//     if( m_buildCommand != command )
+//         return;
+// 
+//     m_buildCommand = QString::null;
 
     m_timestamp.clear();

--- kdevelop/buildtools/qmake/trollprojectpart.h  #1.28:1.29
@@ -66,4 +66,6 @@ private slots:
 //    void slotExecute();
     void slotCommandFinished( const QString& command );
+    void slotBuildAndExecuteProject();
+    void slotBuildAndExecuteTarget();
 
 private: