From kdevelop-bugs Mon Jul 30 01:01:57 2007 From: Andreas Pakulat Date: Mon, 30 Jul 2007 01:01:57 +0000 To: kdevelop-bugs Subject: [Bug 146144] kdevelop consumes all CPU resourses while building Message-Id: <20070730010157.26334.qmail () ktown ! kde ! org> X-MARC-Message: https://marc.info/?l=kdevelop-bugs&m=118575749316879 ------- You are receiving this mail because: ------- You are the assignee for the bug, or are watching the assignee. http://bugs.kde.org/show_bug.cgi?id=146144 apaku gmx de changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution| |FIXED ------- Additional Comments From apaku gmx de 2007-07-30 03:01 ------- SVN commit 694087 by apaku: Remove the dirwatcher, it caused more trouble than its worth. BUG:146144 M +21 -94 customprojectpart.cpp M +1 -6 customprojectpart.h --- branches/KDE/3.5/kdevelop/buildtools/custommakefiles/customprojectpart.cpp #694086:694087 @ -27,7 +27,6 @ #include #include -#include #include #include #include @ -67,7 +66,6 @ CustomProjectPart::CustomProjectPart( QObject *parent, const char *name, const QStringList & ) : KDevBuildTool( &data, parent, name ? name : "CustomProjectPart" ) , m_lastCompilationFailed( false ), m_recursive(false), m_first_recursive(false) - , dirwatch(new KDirWatch(this)) { setInstance( CustomProjectFactory::instance() ); setXMLFile( "kdevcustomproject.rc" ); @ -80,10 +78,6 @ action->setToolTip( i18n( "Re-Populate Project" ) ); action->setWhatsThis( i18n( "Re-Populate Project

Re-Populate's the project, searches through the project directory and adds all files that match one of the wildcards set in the custom manager options to the project filelist." ) ); - action = new KAction( i18n( "Add New Files To Project" ), 0, this, SLOT( addNewFilesToProject() ), actionCollection(), "addnewfiles_project" ); - action->setToolTip( i18n( "Add New Files To Project" ) ); - action->setWhatsThis( i18n( "Add New Files To Project

Adds files created outside of kdevelop to the project." ) ); - action = new KAction( i18n( "&Build Project" ), "make_kdevelop", Key_F8, this, SLOT( slotBuild() ), actionCollection(), "build_build" ); @ -187,8 +181,6 @ this, SLOT( slotCommandFinished( const QString& ) ) ); connect( makeFrontend(), SIGNAL( commandFailed( const QString& ) ), this, SLOT( slotCommandFailed( const QString& ) ) ); - connect( dirwatch, SIGNAL( dirty( const QString&) ), - this, SLOT( slotDirDirty( const QString& ) ) ); } @ -237,6 +229,9 @ QString popupstr = fcontext->urls().first().fileName(); + if( popupstr == QString::null ) + popupstr = "."; + if ( fcontext->urls().size() == 1 && URLUtil::isDirectory( fcontext->urls().first() ) && !isInBlacklist( fcontext->urls().first().path() ) ) { popup->insertSeparator(); @ -250,6 +245,7 @ "like the New Class wizard." ) ); } + kdDebug(9025) << "context urls: " << fcontext->urls() << endl; if( fcontext->urls().size() == 1 && ( isProjectFileType( fcontext->urls().first().path() ) || URLUtil::isDirectory( fcontext->urls().first() ) ) ) { popup->insertSeparator(); @ -283,8 +279,10 @ for ( KURL::List::ConstIterator it = urls.begin(); it != urls.end(); ++it ) { + kdDebug(9025) << "Checking URL: " << *it << endl; QString canPath( URLUtil::canonicalPath(( *it ).path() ) ); QString relPath = relativeToProject( canPath ); + kdDebug(9025) << "relpath: " << relPath << "|canpath: " << canPath << endl; if( isInBlacklist( relPath ) ) continue; if ((( *it ).isLocalFile() && isProjectFileType(( *it ).fileName() ) ) ) @ -393,14 +391,9 @ void CustomProjectPart::openProject( const QString &dirName, const QString &projectName ) { - dirwatch->blockSignals( true ); - dirwatch->stopScan(); - m_projectDirectory = dirName; m_projectName = projectName; - m_autoAddFiles.clear(); - QDomDocument &dom = *projectDom(); // Set the default directory radio to "executable" if ( DomUtil::readEntry( dom, "/kdevcustomproject/run/directoryradio" ) == "" ) @ -451,11 +444,9 @ if( newfiles.count() > 0 ) { - m_autoAddFiles = newfiles; - addNewFilesToProject(); + addNewFilesToProject(newfiles); } - addDirWatches( dirName ); } else { @ -480,8 +471,6 @ envs.appendChild( el ); } KDevProject::openProject( dirName, projectName ); - dirwatch->startScan(); - dirwatch->blockSignals( false ); } void CustomProjectPart::findNewFiles( const QString& dir, QStringList& filelist ) const @ -511,19 +500,7 @ } } -void CustomProjectPart::addDirWatches( const QString& absPath ) -{ - dirwatch->addDir( absPath ); - QStringList entries = QDir( absPath ).entryList( QDir::Dirs ); - entries.remove("."); - entries.remove(".."); - for( QStringList::const_iterator it = entries.begin(); it != entries.end(); ++it ) - { - addDirWatches( absPath + "/" + *it ); - } -} - void CustomProjectPart::populateProject() { @ -546,17 +523,14 @ findNewFiles( projectDirectory(), newlist ); - m_autoAddFiles = newlist; QApplication::restoreOverrideCursor(); - addNewFilesToProject(); - addDirWatches( m_projectDirectory ); + addNewFilesToProject(newlist); } void CustomProjectPart::closeProject() { saveProject(); - m_autoAddFiles.clear(); } void CustomProjectPart::saveProject() @ -691,11 +665,14 @ if ( isInBlacklist( *it ) ) continue; QString relpath; + kdDebug(9025) << "Checking path: " << *it << endl; if( QDir::isRelativePath( *it ) ) { + kdDebug(9025) << *it << " is relative" << endl; relpath = *it; }else { + kdDebug(9025) << *it << " is not relative" << endl; relpath = relativeToProject( *it ); } @ -704,13 +681,18 @ if ( QFileInfo( projectDirectory() + "/" + relpath ).isDir() && ( m_recursive || m_first_recursive ) ) { + kdDebug(9025) << "is a dir and " << m_recursive << "|" << m_first_recursive << endl; m_first_recursive = false; QStringList fileentries = QDir( projectDirectory() + "/" + relpath ).entryList( filetypes().join(";") ); QStringList dirs = QDir( projectDirectory() + "/" + relpath ).entryList(QDir::Dirs); QStringList subentries = fileentries+dirs; for ( QStringList::iterator subit = subentries.begin(); subit != subentries.end(); ++subit ) + { if ( *subit != "." && *subit != ".." ) *subit = relpath + "/" + ( *subit ); + if( (*subit).startsWith("/") ) + *subit = (*subit).mid(1,(*subit).length()); + } addFiles( subentries ); addedFiles << relpath; m_sourceFiles.append( relpath ); @ -1474,58 +1456,6 @ return false; } -void CustomProjectPart::slotDirDirty( const QString& dir ) -{ - - QStringList remove; - QString reldir = relativeToProject( dir ); - if( !reldir.isEmpty() ) - reldir += "/"; - - QStringList blacklist = this->blacklist(); - for( QStringList::const_iterator it = m_sourceFiles.begin(); it != - m_sourceFiles.end(); ++it) - { - if( (*it).startsWith(reldir) ) - { - QString lastpart = (*it).mid(reldir.length()); - if( !QFileInfo(dir+"/"+lastpart).exists() ) - { - remove << (*it); - } - } - } - for( QStringList::const_iterator it = remove.begin(); it != remove.end(); ++it ) - { - if( isInBlacklist(*it) ) - { - blacklist.remove(*it); - } - } - updateBlacklist( blacklist ); - removeFiles(remove); - - QStringList fileentries = QDir( dir ).entryList( filetypes().join(";") ); - QStringList dirs = QDir( dir ).entryList(QDir::Dirs); - QStringList files = fileentries+dirs; - files.remove("."); - files.remove(".."); - kdDebug(9025) << "Got dirty signal from " << dir << endl; - for( QStringList::const_iterator it = files.begin(); it != files.end(); ++it ) - { - if( m_sourceFiles.find( reldir+*it ) == m_sourceFiles.end() && ( isProjectFileType( *it ) || QFileInfo( dir+"/"+*it ).isDir() ) && !isInBlacklist( reldir+*it ) ) - { - kdDebug(9025) << "Adding " << reldir+*it << " to autolist" << endl; - m_autoAddFiles.append( reldir+*it ); - if( QFileInfo( dir+"/"+*it ).isDir() ) - { - addDirWatches( dir+"/"+*it ); - } - }else - kdDebug(9025) << "Not Adding" << reldir+*it << endl; - } -} - void CustomProjectPart::switchBlacklistEntry( const QString& path) { QStringList blacklist = this->blacklist(); @ -1546,8 +1476,11 @ QString CustomProjectPart::relativeToProject( const QString& abspath ) const { QString path = abspath.mid( projectDirectory().length()+1 ); + kdDebug(9025) <<"abspath: " << "|project dir: " << projectDirectory() << "|path: " << path << endl; if( path.endsWith("/") ) path = path.mid( 0, path.length()-1 ); + if( path.startsWith("/") ) + path = path.mid( 1, path.length() ); return path; } @ -1581,10 +1514,10 @ return DomUtil::readListEntry( *projectDom(), "kdevcustomproject/blacklist", "path"); } -void CustomProjectPart::addNewFilesToProject() +void CustomProjectPart::addNewFilesToProject( const QStringList& filelist ) { QStringList addfiles; - for( QStringList::const_iterator it = m_autoAddFiles.begin(); it != m_autoAddFiles.end(); ++it ) + for( QStringList::const_iterator it = filelist.begin(); it != filelist.end(); ++it ) { if( m_sourceFiles.find( *it ) == m_sourceFiles.end() && ( isProjectFileType( *it ) || QFileInfo( projectDirectory()+"/"+*it ).isDir() ) && !isInBlacklist( *it ) ) { @ -1598,7 +1531,6 @ AddFilesDialog *dlg = new AddFilesDialog( addfiles, mainWindow()->main() ); if( dlg->exec() == KDialog::Accepted ) { - m_autoAddFiles.clear(); m_first_recursive = false; m_recursive = false; QStringList blacklist = this->blacklist(); @ -1622,11 +1554,6 @ excludelist.remove(*it); } blacklist += excludelist; - for( QStringList::const_iterator it = excludelist.begin(); it != excludelist.end(); ++it ) - { - if( QFileInfo( projectDirectory()+"/"+*it ).isDir() ) - dirwatch->removeDir(projectDirectory()+"/"+*it); - } updateBlacklist( blacklist ); addFiles( dlg->includedPaths() ); } --- branches/KDE/3.5/kdevelop/buildtools/custommakefiles/customprojectpart.h #694086:694087 @ -26,7 +26,6 @ class QPopupMenu; class QStringList; class KDialogBase; -class KDirWatch; class CustomProjectWidget; class Context; class KSelectAction; @ -66,14 +65,13 @ private slots: void populateProject(); - void slotDirDirty( const QString& dir ); void projectConfigWidget( KDialogBase *dlg ); void contextMenu( QPopupMenu *popup, const Context *context ); void slotAddToProject(); void slotRemoveFromProject(); void slotAddToProjectRecursive(); void slotRemoveFromProjectRecursive(); - void addNewFilesToProject(); + void addNewFilesToProject( const QStringList& ); void slotChangeBlacklist(); void slotChooseActiveDirectory(); void slotBuild(); @ -102,7 +100,6 @ void cleanFileList(); void setFiletypes( const QStringList& ); QString relativeToProject( const QString& ) const; - void addDirWatches( const QString& ); void findNewFiles( const QString& dir, QStringList& list) const; QStringList filetypes() const; @ -119,7 +116,6 @ QString m_projectName; QString m_filelistDir; QStringList m_sourceFiles; - QStringList m_autoAddFiles; QPopupMenu *m_targetMenu; QPopupMenu *m_targetObjectFilesMenu; QPopupMenu *m_targetOtherFilesMenu; @ -140,7 +136,6 @ QMap m_makefileVars; bool m_recursive; bool m_first_recursive; - KDirWatch* dirwatch; }; #endif _______________________________________________ KDevelop-bugs mailing list KDevelop-bugs@kdevelop.org https://barney.cs.uni-potsdam.de/mailman/listinfo/kdevelop-bugs