[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    branches/kdevelop/3.4/buildtools/custommakefiles
From:       Andreas Pakulat <apaku () gmx ! de>
Date:       2007-02-28 2:10:15
Message-ID: 1172628615.945091.1958.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 637881 by apaku:

Add the possibility to run a buildtool other than make or ant

Initial patch from Achim Herwig <achim.herwig@wodca.de>, thanks.
BUG:58217


 M  +3 -2      Makefile.am  
 M  +26 -3     custombuildoptionswidget.cpp  
 M  +8 -4      custombuildoptionswidget.h  
 M  +26 -4     custombuildoptionswidgetbase.ui  
 A             customotherconfigwidget.cpp   [License: GPL (v2+)]
 A             customotherconfigwidget.h   [License: GPL (v2+)]
 A             customotherconfigwidgetbase.ui  
 M  +27 -9     customprojectpart.cpp  


--- branches/kdevelop/3.4/buildtools/custommakefiles/Makefile.am #637880:637881
@@ -12,7 +12,8 @@
 
 libkdevcustomproject_la_SOURCES = custombuildoptionswidget.cpp \
 	custombuildoptionswidgetbase.ui custommakeconfigwidget.cpp \
                custommakeconfigwidgetbase.ui \
-	custommanagerwidget.cpp custommanagerwidgetbase.ui customprojectpart.cpp
+	custommanagerwidget.cpp custommanagerwidgetbase.ui customotherconfigwidget.cpp \
+	customotherconfigwidgetbase.ui customprojectpart.cpp
 
 METASOURCES = AUTO
 
@@ -21,4 +22,4 @@
 
 rcdir = $(kde_datadir)/kdevcustomproject
 rc_DATA = kdevcustomproject.rc
-noinst_HEADERS = custommanagerwidget.h
+noinst_HEADERS = custommanagerwidget.h customotherconfigwidget.h
--- branches/kdevelop/3.4/buildtools/custommakefiles/custombuildoptionswidget.cpp \
#637880:637881 @@ -26,6 +26,7 @@
       m_dom(dom)
 {
     ant_button->setChecked(DomUtil::readEntry(dom, \
"/kdevcustomproject/build/buildtool") == "ant"); +    \
other_button->setChecked(DomUtil::readEntry(dom, \
                "/kdevcustomproject/build/buildtool") == "other");
     builddir_edit->setURL(DomUtil::readEntry(dom, \
                "/kdevcustomproject/build/builddir"));
     builddir_edit->completionObject()->setMode(KURLCompletion::DirCompletion);
     builddir_edit->setMode( KFile::Directory | KFile::ExistingOnly | \
KFile::LocalOnly ); @@ -33,7 +34,9 @@
     // This connection must not be made before the ant->setChecked() line,
     // because at this time makeToggled() would crash
     connect( make_button, SIGNAL(toggled(bool)),
-             this, SLOT(makeToggled(bool)) );
+            this, SLOT(makeToggled(bool)) );
+    connect( other_button, SIGNAL(toggled(bool)),
+             this, SLOT(otherToggled(bool)) );
 }
 
 
@@ -43,19 +46,37 @@
 
 void CustomBuildOptionsWidget::accept()
 {
-    QString buildtool = ant_button->isChecked()? "ant" : "make";
+    QString buildtool;
+    if (ant_button->isChecked())
+    {
+        buildtool = "ant";
+    }
+    else if (other_button->isChecked())
+    {
+        buildtool = "other";
+    }
+    else
+    {
+        buildtool = "make";
+    }
     DomUtil::writeEntry(m_dom, "/kdevcustomproject/build/buildtool", buildtool);
     DomUtil::writeEntry(m_dom, "/kdevcustomproject/build/builddir", \
builddir_edit->url());  }
 
 
-void CustomBuildOptionsWidget::setMakeOptionsWidget(QTabWidget *tw, QWidget *mow)
+void CustomBuildOptionsWidget::setMakeOptionsWidget(QTabWidget *tw, QWidget *mow, \
QWidget* oow)  {
     m_tabWidget = tw;
     m_makeOptions = mow;
+    m_otherOptions = oow;
     makeToggled(make_button->isChecked());
+    otherToggled(other_button->isChecked());
 }
 
+void CustomBuildOptionsWidget::otherToggled(bool b)
+{
+    m_tabWidget->setTabEnabled(m_otherOptions, b);
+}
 
 void CustomBuildOptionsWidget::makeToggled(bool b)
 {
@@ -63,3 +84,5 @@
 }
 
 #include "custombuildoptionswidget.moc"
+
+// kate: space-indent on; indent-width 4; tab-width 4; replace-tabs on
--- branches/kdevelop/3.4/buildtools/custommakefiles/custombuildoptionswidget.h \
#637880:637881 @@ -21,22 +21,26 @@
 class CustomBuildOptionsWidget : public CustomBuildOptionsWidgetBase
 {
     Q_OBJECT
-    
+
 public:
     CustomBuildOptionsWidget( QDomDocument &dom, QWidget *parent=0, const char \
*name=0 );  ~CustomBuildOptionsWidget();
 
-    void setMakeOptionsWidget(QTabWidget *tw, QWidget *mow);
-    
+    void setMakeOptionsWidget(QTabWidget *tw, QWidget *mow, QWidget *oow);
+
 public slots:
     void accept();
 
 private:
     virtual void makeToggled(bool b);
-    
+    virtual void otherToggled(bool b);
+
     QDomDocument &m_dom;
     QTabWidget *m_tabWidget;
     QWidget *m_makeOptions;
+    QWidget *m_otherOptions;
 };
 
 #endif
+
+// kate: space-indent on; indent-width 4; tab-width 4; replace-tabs on
--- branches/kdevelop/3.4/buildtools/custommakefiles/custombuildoptionswidgetbase.ui \
#637880:637881 @@ -37,6 +37,9 @@
                     <property name="text">
                         <string>&amp;Make</string>
                     </property>
+                    <property name="accel">
+                        <string>Alt+M</string>
+                    </property>
                     <property name="checked">
                         <bool>true</bool>
                     </property>
@@ -46,9 +49,29 @@
                         <cstring>ant_button</cstring>
                     </property>
                     <property name="text">
-                        <string>&amp;Ant</string>
+                        <string>A&amp;nt</string>
                     </property>
+                    <property name="accel">
+                        <string>Alt+N</string>
+                    </property>
                 </widget>
+                <widget class="QRadioButton">
+                    <property name="name">
+                        <cstring>other_button</cstring>
+                    </property>
+                    <property name="text">
+                        <string>Other</string>
+                    </property>
+                    <property name="accel">
+                        <string></string>
+                    </property>
+                    <property name="toolTip" stdset="0">
+                        <string>other custom build tool, e.g. script</string>
+                    </property>
+                    <property name="whatsThis" stdset="0">
+                        <string>There are myriads of buildtools out there that are \
not ant or make. If you use one of them (or have your own scripts), select this \
option.</string> +                    </property>
+                </widget>
             </vbox>
         </widget>
         <spacer>
@@ -73,7 +96,7 @@
                 <cstring>builddir_label</cstring>
             </property>
             <property name="text">
-                <string>Run the &amp;build tool in the following directory:</string>
+                <string>Run &amp;the build tool in the following directory:</string>
             </property>
             <property name="buddy" stdset="0">
                 <cstring>builddir_edit</cstring>
@@ -130,13 +153,12 @@
         </spacer>
     </vbox>
 </widget>
-<customwidgets>
-</customwidgets>
 <includes>
     <include location="global" impldecl="in implementation">kdialog.h</include>
 </includes>
 <slots>
     <slot access="protected">makeToggled(bool)</slot>
+    <slot access="protected">otherToggled(bool)</slot>
 </slots>
 <layoutdefaults spacing="6" margin="11"/>
 <layoutfunctions spacing="KDialog::spacingHint" margin="KDialog::marginHint"/>
--- branches/kdevelop/3.4/buildtools/custommakefiles/customprojectpart.cpp \
#637880:637881 @@ -48,6 +48,7 @@
 #include "makeoptionswidget.h"
 #include "custombuildoptionswidget.h"
 #include "custommakeconfigwidget.h"
+#include "customotherconfigwidget.h"
 #include "custommanagerwidget.h"
 #include "config.h"
 #include "envvartools.h"
@@ -185,10 +186,15 @@
     connect( dlg, SIGNAL( okClicked() ), w2, SLOT( accept() ) );
     buildtab->addTab( w2, i18n( "&Build" ) );
 
+    CustomOtherConfigWidget *w4 = new CustomOtherConfigWidget(this, \
"/kdevcustomproject", buildtab); +    connect( dlg, SIGNAL( okClicked() ), w4, SLOT( \
accept() ) ); +    buildtab->addTab(w4, i18n("&Other"));
+
     CustomMakeConfigWidget *w3 = new CustomMakeConfigWidget( this, \
"/kdevcustomproject", buildtab );  buildtab->addTab( w3, i18n( "Ma&ke" ) );
-    w2->setMakeOptionsWidget( buildtab, w3 );
+    w2->setMakeOptionsWidget( buildtab, w3, w4 );
     connect( dlg, SIGNAL( okClicked() ), w3, SLOT( accept() ) );
+
 }
 
 
@@ -378,11 +384,12 @@
     }
 
     // check if there is an old envvars entry (from old project file with single \
make environment) +    QString buildtool = DomUtil::readEntry(dom , \
"/kdevcustomproject/build/buildtool" );  QDomElement el =
-        DomUtil::elementByPath( dom , "/kdevcustomproject/make/envvars" );
+        DomUtil::elementByPath( dom , "/kdevcustomproject/"+buildtool+"/envvars" );
     if ( !el.isNull() )
     {
-        QDomElement envs = DomUtil::createElementByPath( dom , \
"/kdevcustomproject/make/environments" ); +        QDomElement envs = \
DomUtil::createElementByPath( dom , "/kdevcustomproject/"+buildtool+"/environments" \
);  DomUtil::makeEmpty( envs );
         el.setTagName( "default" );
         envs.appendChild( el );
@@ -712,8 +719,9 @@
     // in the form of: "ENV_VARIABLE=ENV_VALUE"
     // Note that we quote the variable value due to the possibility of
     // embedded spaces
+    QString buildtool = DomUtil::readEntry( *projectDom(), \
"/kdevcustomproject/build/buildtool" );  DomUtil::PairList envvars =
-        DomUtil::readPairListEntry( *projectDom(), \
"/kdevcustomproject/make/environments/" + currentMakeEnvironment(), "envvar", "name", \
"value" ); +        DomUtil::readPairListEntry( *projectDom(), \
"/kdevcustomproject/"+buildtool+"/environments/" + currentMakeEnvironment(), \
"envvar", "name", "value" );  
     QString environstr;
     DomUtil::PairList::ConstIterator it;
@@ -734,15 +742,23 @@
         return; //user cancelled
 
     QDomDocument &dom = *projectDom();
-    bool ant = DomUtil::readEntry( dom, "/kdevcustomproject/build/buildtool" ) == \
"ant"; +    QString buildtool = DomUtil::readEntry( dom, \
"/kdevcustomproject/build/buildtool" );  
     QString cmdline;
-    if ( ant )
+    if ( buildtool == "ant" )
     {
         cmdline = "ant";
     }
-    else
+    else if( buildtool == "other" )
     {
+        cmdline = DomUtil::readEntry(dom, "/kdevcustomproject/other/otherbin");
+        if (cmdline.isEmpty())
+            cmdline = "echo";
+        else if( cmdline.find("/") == -1 )
+            cmdline = "./"+cmdline;
+        cmdline += " " + DomUtil::readEntry(dom, \
"/kdevcustomproject/other/otheroptions"); +    }else
+    {
         cmdline = DomUtil::readEntry( dom, "/kdevcustomproject/make/makebin" );
         if ( cmdline.isEmpty() )
             cmdline = MAKE_COMMAND;
@@ -767,7 +783,7 @@
     dircmd += KProcess::quote( dir );
     dircmd += " && ";
 
-    int prio = DomUtil::readIntEntry( dom, "/kdevcustomproject/make/prio" );
+    int prio = DomUtil::readIntEntry( dom, "/kdevcustomproject/"+buildtool+"/prio" \
);  QString nice;
     if ( prio != 0 )
     {
@@ -789,7 +805,9 @@
 void CustomProjectPart::slotBuild()
 {
     m_lastCompilationFailed = false;
-    startMakeCommand( buildDirectory(), DomUtil::readEntry( *projectDom(), \
"/kdevcustomproject/make/defaulttarget" ) ); +    QString buildtool = \
DomUtil::readEntry( *projectDom(), "/kdevcustomproject/build/buildtool" ); +    \
startMakeCommand( buildDirectory(), DomUtil::readEntry( *projectDom(), +            \
"/kdevcustomproject/"+buildtool+"/defaulttarget" ) );  }
 
 


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic