Summary: | Implement custom build tools (jam, scons, ... instead of make) | ||
---|---|---|---|
Product: | [Applications] kdevelop | Reporter: | Matthias Braun <MatzeBraun> |
Component: | general | Assignee: | KDevelop Developers <kdevelop-devel> |
Status: | RESOLVED FIXED | ||
Severity: | wishlist | CC: | arne.schmitz, mlesin |
Priority: | NOR | ||
Version: | 3.0.0a4 | ||
Target Milestone: | --- | ||
Platform: | Gentoo Packages | ||
OS: | Linux | ||
Latest Commit: | Version Fixed In: | ||
Sentry Crash Report: | |||
Attachments: | Adds a "other" build tool to buildtools/customakefiles |
Description
Matthias Braun
2003-05-07 19:25:39 UTC
Currently all you need to do is to copy autoproject and rename it to jamproject or sconsproject. And afterwords make the changes you need to this files. There is already a qmakeproject (the actual name is trollproject) and a antproject. Your second whish is already implemented in autoproject Amilcar Lucas This changed a bit. KDevelop's official build tools are: Ant, Autotools, CustomMakefiles (You need to edit them by hand), Generic, QMake, If you want to do this you should implement a generic build tool instead. Read http://developer.kde.org/documentation/library/cvs-api/kdevelop/html/howToAddGenericBuildTools.html Currently (2003.11.23) the document is not finished but in the future it will have more info. Jam would be a nice, integrated feature (as Ant and Make currently are) Could the above page be updated some time? I would love to add another custom make tool, but I can't figure out how. The page wasn't updated because there is ongoing work to implement project management and this work isn't based on generic project manager. But I can't say when will it be finished. what is the status of the generic project manager? I have to work with a jam-project and need a rough estimate when the project manager and/or jam-support may be ready... Created attachment 12549 [details]
Adds a "other" build tool to buildtools/customakefiles
I extended the selection of buildtools for the custommakefile project type.
Instead of only supporting ant (AFAIK with no options) and make (implicitely
adding make-specific command line arguments), I added an "other" tool where
anyone can specify his/her buildtool directly (we use jam with a bash wrapper
script called build.sh).
It's mostly copy&paste from the make part and I did not touch the environment
part (that is totaly duplicated), but it works for me...
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>&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>&Ant</string> + <string>A&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 &build tool in the following directory:</string> + <string>Run &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" ) ); } |