MCPcopy Create free account
hub / github.com/KDE/kdevelop / parseCustomMakeFile

Method parseCustomMakeFile

plugins/custommake/custommakemanager.cpp:285–316  ·  view source on GitHub ↗

TODO: move to background thread, probably best would be to use a proper ParseJob

Source from the content-addressed store, hash-verified

283
284///TODO: move to background thread, probably best would be to use a proper ParseJob
285QStringList CustomMakeManager::parseCustomMakeFile( const Path &makefile )
286{
287 if( !makefile.isValid() )
288 return QStringList();
289
290 QStringList ret; // the list of targets
291 QFile f( makefile.toLocalFile() );
292 if ( !f.open( QIODevice::ReadOnly | QIODevice::Text ) )
293 {
294 qCDebug(CUSTOMMAKE) << "could not open" << makefile;
295 return ret;
296 }
297
298 QRegExp targetRe(QStringLiteral("^ *([^\\t$.#]\\S+) *:?:(?!=).*$"));
299 targetRe.setMinimal( true );
300
301 QString str;
302 QTextStream stream( &f );
303 while ( !stream.atEnd() )
304 {
305 str = stream.readLine();
306
307 if ( targetRe.indexIn( str ) != -1 )
308 {
309 QString tmpTarget = targetRe.cap( 1 ).simplified();
310 if ( ! ret.contains( tmpTarget ) )
311 ret.append( tmpTarget );
312 }
313 }
314 f.close();
315 return ret;
316}
317
318void CustomMakeManager::projectClosing(IProject* project)
319{

Callers

nothing calls this directly

Calls 9

QStringListClass · 0.85
toLocalFileMethod · 0.80
atEndMethod · 0.80
readLineMethod · 0.80
isValidMethod · 0.45
openMethod · 0.45
containsMethod · 0.45
appendMethod · 0.45
closeMethod · 0.45

Tested by

no test coverage detected