TODO: move to background thread, probably best would be to use a proper ParseJob
| 283 | |
| 284 | ///TODO: move to background thread, probably best would be to use a proper ParseJob |
| 285 | QStringList 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 | |
| 318 | void CustomMakeManager::projectClosing(IProject* project) |
| 319 | { |
nothing calls this directly
no test coverage detected