2012-10-02 09:12:39 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								/****************************************************************************
 
							 
						 
					
						
							
								
									
										
										
										
											2010-09-27 15:51:49 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								* * 
							 
						 
					
						
							
								
									
										
										
										
											2016-01-15 14:58:39 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								* *  Copyright  ( C )  2016  The  Qt  Company  Ltd . 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								* *  Contact :  https : //www.qt.io/licensing/
 
							 
						 
					
						
							
								
									
										
										
										
											2010-09-27 15:51:49 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								* * 
							 
						 
					
						
							
								
									
										
										
										
											2012-10-02 09:12:39 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								* *  This  file  is  part  of  Qt  Creator . 
							 
						 
					
						
							
								
									
										
										
										
											2010-09-27 15:51:49 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								* * 
							 
						 
					
						
							
								
									
										
										
										
											2012-10-02 09:12:39 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								* *  Commercial  License  Usage 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								* *  Licensees  holding  valid  commercial  Qt  licenses  may  use  this  file  in 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								* *  accordance  with  the  commercial  license  agreement  provided  with  the 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								* *  Software  or ,  alternatively ,  in  accordance  with  the  terms  contained  in 
							 
						 
					
						
							
								
									
										
										
										
											2016-01-15 14:58:39 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								* *  a  written  agreement  between  you  and  The  Qt  Company .  For  licensing  terms 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								* *  and  conditions  see  https : //www.qt.io/terms-conditions. For further
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								* *  information  use  the  contact  form  at  https : //www.qt.io/contact-us.
 
							 
						 
					
						
							
								
									
										
										
										
											2010-09-27 15:51:49 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								* * 
							 
						 
					
						
							
								
									
										
										
										
											2016-01-15 14:58:39 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								* *  GNU  General  Public  License  Usage 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								* *  Alternatively ,  this  file  may  be  used  under  the  terms  of  the  GNU 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								* *  General  Public  License  version  3  as  published  by  the  Free  Software 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								* *  Foundation  with  exceptions  as  appearing  in  the  file  LICENSE . GPL3 - EXCEPT 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								* *  included  in  the  packaging  of  this  file .  Please  review  the  following 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								* *  information  to  ensure  the  GNU  General  Public  License  requirements  will 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								* *  be  met :  https : //www.gnu.org/licenses/gpl-3.0.html.
 
							 
						 
					
						
							
								
									
										
										
										
											2010-12-17 16:01:08 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								* * 
							 
						 
					
						
							
								
									
										
										
										
											2012-10-02 09:12:39 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ 
							 
						 
					
						
							
								
									
										
										
										
											2010-09-27 15:51:49 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								# include  "buildablehelperlibrary.h" 
 
							 
						 
					
						
							
								
									
										
										
										
											2013-03-18 14:47:33 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								# include  "hostosinfo.h" 
 
							 
						 
					
						
							
								
									
										
										
										
											2021-04-30 15:01:55 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								# include  "qtcprocess.h" 
 
							 
						 
					
						
							
								
									
										
										
										
											2010-09-27 15:51:49 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-02-15 10:42:41 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								# include  <QDateTime> 
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								# include  <QDebug> 
 
							 
						 
					
						
							
								
									
										
										
										
											2019-03-15 10:43:35 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								# include  <QDir> 
 
							 
						 
					
						
							
								
									
										
										
										
											2020-06-10 12:09:17 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								# include  <QRegularExpression> 
 
							 
						 
					
						
							
								
									
										
										
										
											2010-09-27 15:51:49 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-03-15 10:43:35 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								# include  <set> 
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2010-09-27 15:51:49 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								namespace  Utils  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2013-08-05 13:03:43 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								bool  BuildableHelperLibrary : : isQtChooser ( const  QFileInfo  & info ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    return  info . isSymLink ( )  & &  info . symLinkTarget ( ) . endsWith ( QLatin1String ( " /qtchooser " ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								QString  BuildableHelperLibrary : : qtChooserToQmakePath ( const  QString  & path ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
									
										
										
										
											2016-04-29 16:52:58 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    const  QString  toolDir  =  QLatin1String ( " QTTOOLDIR= \" " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    SynchronousProcess  proc ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    proc . setTimeoutS ( 1 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-05-17 12:02:42 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    proc . setCommand ( { path ,  { " -print-env " } } ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    proc . runBlocking ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-05-28 13:19:38 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    if  ( proc . result ( )  ! =  QtcProcess : : FinishedWithSuccess ) 
							 
						 
					
						
							
								
									
										
										
										
											2013-08-05 13:03:43 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        return  QString ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-05-12 14:25:50 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    const  QString  output  =  proc . stdOut ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2013-10-10 10:39:36 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    int  pos  =  output . indexOf ( toolDir ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2013-08-05 13:03:43 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    if  ( pos  = =  - 1 ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        return  QString ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-12-31 20:34:38 -05:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    pos  + =  toolDir . count ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2013-08-05 13:03:43 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    int  end  =  output . indexOf ( ' \" ' ,  pos ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    if  ( end  = =  - 1 ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        return  QString ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-04-29 16:52:58 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    return  output . mid ( pos ,  end  -  pos )  +  QLatin1String ( " /qmake " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2013-08-05 13:03:43 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2014-10-30 15:54:25 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								static  bool  isQmake ( const  QString  & path ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    if  ( path . isEmpty ( ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        return  false ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    QFileInfo  fi ( path ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    if  ( BuildableHelperLibrary : : isQtChooser ( fi ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        fi . setFile ( BuildableHelperLibrary : : qtChooserToQmakePath ( fi . symLinkTarget ( ) ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-02-05 13:21:04 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    if  ( ! fi . exists ( )  | |  fi . isDir ( ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        return  false ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-10-30 15:54:25 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    return  ! BuildableHelperLibrary : : qtVersionForQMake ( fi . absoluteFilePath ( ) ) . isEmpty ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-05-28 13:49:26 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								static  FilePath  findQmakeInDir ( const  FilePath  & path ) 
							 
						 
					
						
							
								
									
										
										
										
											2010-09-27 15:51:49 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
									
										
										
										
											2019-03-15 10:43:35 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    if  ( path . isEmpty ( ) ) 
							 
						 
					
						
							
								
									
										
										
										
											2019-05-28 13:49:26 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        return  FilePath ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-10-30 15:54:25 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-10-21 22:56:09 +03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    const  QString  qmake  =  HostOsInfo : : withExecutableSuffix ( " qmake " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-03-15 10:43:35 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    QDir  dir ( path . toString ( ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    if  ( dir . exists ( qmake ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        const  QString  qmakePath  =  dir . absoluteFilePath ( qmake ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        if  ( isQmake ( qmakePath ) ) 
							 
						 
					
						
							
								
									
										
										
										
											2019-05-28 13:49:26 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								            return  FilePath : : fromString ( qmakePath ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-03-15 10:43:35 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    } 
							 
						 
					
						
							
								
									
										
										
										
											2014-10-30 15:54:25 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-03-15 10:43:35 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    // Prefer qmake-qt5 to qmake-qt4 by sorting the filenames in reverse order.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    const  QFileInfoList  candidates  =  dir . entryInfoList ( 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                BuildableHelperLibrary : : possibleQMakeCommands ( ) , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                QDir : : Files ,  QDir : : Name  |  QDir : : Reversed ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    for  ( const  QFileInfo  & fi  :  candidates )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        if  ( fi . fileName ( )  = =  qmake ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            continue ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        if  ( isQmake ( fi . absoluteFilePath ( ) ) ) 
							 
						 
					
						
							
								
									
										
										
										
											2019-05-28 13:49:26 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								            return  FilePath : : fromFileInfo ( fi ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-03-15 10:43:35 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    } 
							 
						 
					
						
							
								
									
										
										
										
											2019-05-28 13:49:26 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    return  FilePath ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-03-15 10:43:35 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
									
										
										
										
											2014-10-30 15:54:25 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-05-28 13:49:26 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								FilePath  BuildableHelperLibrary : : findSystemQt ( const  Environment  & env ) 
							 
						 
					
						
							
								
									
										
										
										
											2019-03-15 10:43:35 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
									
										
										
										
											2019-12-17 14:07:53 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    const  FilePaths  list  =  findQtsInEnvironment ( env ,  1 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-05-28 13:49:26 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    return  list . size ( )  = =  1  ?  list . first ( )  :  FilePath ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-03-15 10:43:35 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
									
										
										
										
											2013-08-05 13:03:43 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-12-17 14:07:53 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								FilePaths  BuildableHelperLibrary : : findQtsInEnvironment ( const  Environment  & env ,  int  maxCount ) 
							 
						 
					
						
							
								
									
										
										
										
											2019-03-15 10:43:35 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
									
										
										
										
											2019-12-17 14:07:53 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    FilePaths  qmakeList ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-03-15 10:43:35 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    std : : set < QString >  canonicalEnvPaths ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-12-17 14:07:53 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    const  FilePaths  paths  =  env . path ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-05-28 13:49:26 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    for  ( const  FilePath  & path  :  paths )  { 
							 
						 
					
						
							
								
									
										
										
										
											2019-03-15 10:43:35 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        if  ( ! canonicalEnvPaths . insert ( path . toFileInfo ( ) . canonicalFilePath ( ) ) . second ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            continue ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-05-28 13:49:26 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        const  FilePath  qmake  =  findQmakeInDir ( path ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-03-15 10:43:35 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        if  ( qmake . isEmpty ( ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            continue ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        qmakeList  < <  qmake ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        if  ( maxCount  ! =  - 1  & &  qmakeList . size ( )  = =  maxCount ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            break ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-09-27 15:51:49 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								    } 
							 
						 
					
						
							
								
									
										
										
										
											2019-03-15 10:43:35 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    return  qmakeList ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-09-27 15:51:49 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								QString  BuildableHelperLibrary : : qtVersionForQMake ( const  QString  & qmakePath ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
									
										
										
										
											2014-10-30 15:56:01 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    if  ( qmakePath . isEmpty ( ) ) 
							 
						 
					
						
							
								
									
										
										
										
											2010-09-27 15:51:49 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								        return  QString ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-04-29 16:52:58 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    SynchronousProcess  qmake ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    qmake . setTimeoutS ( 5 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-05-17 12:02:42 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    qmake . setCommand ( { qmakePath ,  { " --version " } } ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    qmake . runBlocking ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-05-28 13:19:38 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    if  ( qmake . result ( )  ! =  QtcProcess : : FinishedWithSuccess )  { 
							 
						 
					
						
							
								
									
										
										
										
											2021-05-14 13:12:46 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        qWarning ( )  < <  qmake . exitMessage ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-09-27 15:51:49 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								        return  QString ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    } 
							 
						 
					
						
							
								
									
										
										
										
											2011-07-14 13:35:40 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-05-12 14:25:50 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    const  QString  output  =  qmake . allOutput ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-06-10 12:09:17 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    static  const  QRegularExpression  regexp ( " (QMake version:?)[ \\ s]*([ \\ d.]*) " , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                                           QRegularExpression : : CaseInsensitiveOption ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    const  QRegularExpressionMatch  match  =  regexp . match ( output ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    const  QString  qmakeVersion  =  match . captured ( 2 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-09-25 15:07:36 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    if  ( qmakeVersion . startsWith ( QLatin1String ( " 2. " ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            | |  qmakeVersion . startsWith ( QLatin1String ( " 3. " ) ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2020-06-10 12:09:17 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        static  const  QRegularExpression  regexp2 ( " Using Qt version[ \\ s]*([ \\ d \\ .]*) " , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                                                QRegularExpression : : CaseInsensitiveOption ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        const  QRegularExpressionMatch  match2  =  regexp2 . match ( output ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        const  QString  version  =  match2 . captured ( 1 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-09-27 15:51:49 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								        return  version ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    return  QString ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2015-03-31 18:53:42 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								QString  BuildableHelperLibrary : : filterForQmakeFileDialog ( ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    QString  filter  =  QLatin1String ( " qmake ( " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    const  QStringList  commands  =  possibleQMakeCommands ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    for  ( int  i  =  0 ;  i  <  commands . size ( ) ;  + + i )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        if  ( i ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            filter  + =  QLatin1Char ( '   ' ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        if  ( HostOsInfo : : isMacHost ( ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            // work around QTBUG-7739 that prohibits filters that don't start with *
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            filter  + =  QLatin1Char ( ' * ' ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        filter  + =  commands . at ( i ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        if  ( HostOsInfo : : isAnyUnixHost ( )  & &  ! HostOsInfo : : isMacHost ( ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            // kde bug, we need at least one wildcard character
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            // see QTCREATORBUG-7771
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            filter  + =  QLatin1Char ( ' * ' ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    filter  + =  QLatin1Char ( ' ) ' ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    return  filter ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2010-09-27 15:51:49 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								QStringList  BuildableHelperLibrary : : possibleQMakeCommands ( ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
									
										
										
										
											2014-10-17 13:53:46 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    // On Windows it is always "qmake.exe"
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    // On Unix some distributions renamed qmake with a postfix to avoid clashes
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    // On OS X, Qt 4 binary packages also has renamed qmake. There are also symbolic links that are
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    // named "qmake", but the file dialog always checks against resolved links (native Cocoa issue)
 
							 
						 
					
						
							
								
									
										
										
										
											2020-10-14 11:41:39 +03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    QStringList  commands ( HostOsInfo : : withExecutableSuffix ( " qmake* " ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    // Qt 6 CMake built targets, such as Android, are dependent on the host installation
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    // and use a script wrapper around the host qmake executable
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    if  ( HostOsInfo : : isWindowsHost ( ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        commands . append ( " qmake*.bat " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    return  commands ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-09-27 15:51:49 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								// Copy helper source files to a target directory, replacing older files.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								bool  BuildableHelperLibrary : : copyFiles ( const  QString  & sourcePath , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                                     const  QStringList  & files , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                                     const  QString  & targetDirectory , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                                     QString  * errorMessage ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
									
										
										
										
											2011-07-20 13:47:04 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    // try remove the directory
 
							 
						 
					
						
							
								
									
										
										
										
											2019-05-28 13:49:26 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    if  ( ! FileUtils : : removeRecursively ( FilePath : : fromString ( targetDirectory ) ,  errorMessage ) ) 
							 
						 
					
						
							
								
									
										
										
										
											2011-07-20 13:47:04 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        return  false ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-09-27 15:51:49 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								    if  ( ! QDir ( ) . mkpath ( targetDirectory ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        * errorMessage  =  QCoreApplication : : translate ( " ProjectExplorer::DebuggingHelperLibrary " ,  " The target directory %1 could not be created. " ) . arg ( targetDirectory ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        return  false ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    } 
							 
						 
					
						
							
								
									
										
										
										
											2020-06-13 23:39:57 +03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    for  ( const  QString  & file  :  files )  { 
							 
						 
					
						
							
								
									
										
										
										
											2010-09-27 15:51:49 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								        const  QString  source  =  sourcePath  +  file ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        const  QString  dest  =  targetDirectory  +  file ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        const  QFileInfo  destInfo ( dest ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        if  ( destInfo . exists ( ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            if  ( destInfo . lastModified ( )  > =  QFileInfo ( source ) . lastModified ( ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                continue ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            if  ( ! QFile : : remove ( dest ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                * errorMessage  =  QCoreApplication : : translate ( " ProjectExplorer::DebuggingHelperLibrary " ,  " The existing file %1 could not be removed. " ) . arg ( destInfo . absoluteFilePath ( ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                return  false ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        } 
							 
						 
					
						
							
								
									
										
										
											
												Remove braces for single lines of conditions
#!/usr/bin/env ruby
Dir.glob('**/*.cpp') { |file|
  # skip ast (excluding paste, astpath, and canv'ast'imer)
  next if file =~ /ast[^eip]|keywords\.|qualifiers|preprocessor|names.cpp/i
  s = File.read(file)
  next if s.include?('qlalr')
  orig = s.dup
  s.gsub!(/\n *if [^\n]*{\n[^\n]*\n\s+}(\s+else if [^\n]* {\n[^\n]*\n\s+})*(\s+else {\n[^\n]*\n\s+})?\n/m) { |m|
    res = $&
    if res =~ /^\s*(\/\/|[A-Z_]{3,})/ # C++ comment or macro (Q_UNUSED, SDEBUG), do not touch braces
      res
    else
      res.gsub!('} else', 'else')
      res.gsub!(/\n +} *\n/m, "\n")
      res.gsub(/ *{$/, '')
    end
  }
  s.gsub!(/ *$/, '')
  File.open(file, 'wb').write(s) if s != orig
}
Change-Id: I3b30ee60df0986f66c02132c65fc38a3fbb6bbdc
Reviewed-by: hjk <qthjk@ovi.com>
											 
										 
										
											2013-01-08 03:32:53 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        if  ( ! destInfo . dir ( ) . exists ( ) ) 
							 
						 
					
						
							
								
									
										
										
										
											2010-12-10 13:09:28 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								            QDir ( ) . mkpath ( destInfo . dir ( ) . absolutePath ( ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2010-09-27 15:51:49 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								        if  ( ! QFile : : copy ( source ,  dest ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            * errorMessage  =  QCoreApplication : : translate ( " ProjectExplorer::DebuggingHelperLibrary " ,  " The file %1 could not be copied to %2. " ) . arg ( source ,  dest ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            return  false ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    return  true ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2010-10-08 15:13:02 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								// Helper: Run a build process with merged stdout/stderr
 
							 
						 
					
						
							
								
									
										
										
										
											2021-04-30 15:01:55 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								static  inline  bool  runBuildProcessI ( QtcProcess  & proc , 
							 
						 
					
						
							
								
									
										
										
										
											2015-04-14 22:30:46 +03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								                                    int  timeoutS , 
							 
						 
					
						
							
								
									
										
										
										
											2010-10-08 15:13:02 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								                                    bool  ignoreNonNullExitCode , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                                    QString  * output ,  QString  * errorMessage ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
									
										
										
										
											2021-04-30 15:01:55 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    proc . start ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-10-08 15:13:02 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    if  ( ! proc . waitForStarted ( ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        * errorMessage  =  QCoreApplication : : translate ( " ProjectExplorer::BuildableHelperLibrary " , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                                                    " Cannot start process: %1 " ) . 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                                                    arg ( proc . errorString ( ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        return  false ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    // Read stdout/err and check for timeouts
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    QByteArray  stdOut ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    QByteArray  stdErr ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-04-30 15:01:55 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    if  ( ! proc . readDataFromProcess ( timeoutS ,  & stdOut ,  & stdErr ,  false ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2010-10-08 15:13:02 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        * errorMessage  =  QCoreApplication : : translate ( " ProjectExplorer::BuildableHelperLibrary " , 
							 
						 
					
						
							
								
									
										
										
										
											2015-04-14 22:30:46 +03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								                                                    " Timeout after %1 s. " ) . 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                                                    arg ( timeoutS ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-04-30 15:01:55 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        proc . stopProcess ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-10-08 15:13:02 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        return  false ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    if  ( proc . exitStatus ( )  ! =  QProcess : : NormalExit )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        * errorMessage  =  QCoreApplication : : translate ( " ProjectExplorer::BuildableHelperLibrary " , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                                                    " The process crashed. " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        return  false ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    const  QString  stdOutS  =  QString : : fromLocal8Bit ( stdOut ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    if  ( ! ignoreNonNullExitCode  & &  proc . exitCode ( )  ! =  0 )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            * errorMessage  =  QCoreApplication : : translate ( " ProjectExplorer::BuildableHelperLibrary " , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                                                        " The process returned exit code %1: \n %2 " ) . 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                                                         arg ( proc . exitCode ( ) ) . arg ( stdOutS ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        return  false ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    output - > append ( stdOutS ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    return  true ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								// Run a build process with merged stdout/stderr and qWarn about errors.
 
							 
						 
					
						
							
								
									
										
										
										
											2021-04-30 15:01:55 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								static  bool  runBuildProcess ( QtcProcess  & proc , 
							 
						 
					
						
							
								
									
										
										
										
											2019-05-28 13:49:26 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								                            const  FilePath  & binary , 
							 
						 
					
						
							
								
									
										
										
										
											2010-10-08 15:13:02 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								                            const  QStringList  & args , 
							 
						 
					
						
							
								
									
										
										
										
											2015-04-14 22:30:46 +03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								                            int  timeoutS , 
							 
						 
					
						
							
								
									
										
										
										
											2010-10-08 15:13:02 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								                            bool  ignoreNonNullExitCode , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                            QString  * output ,  QString  * errorMessage ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
									
										
										
										
											2021-04-30 15:01:55 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    proc . setCommand ( { binary ,  args } ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    const  bool  rc  =  runBuildProcessI ( proc ,  timeoutS ,  ignoreNonNullExitCode ,  output ,  errorMessage ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-10-08 15:13:02 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    if  ( ! rc )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        // Fail - reformat error.
 
							 
						 
					
						
							
								
									
										
										
										
											2014-07-15 23:32:11 +03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        QString  cmd  =  binary . toString ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-10-08 15:13:02 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        if  ( ! args . isEmpty ( ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            cmd  + =  QLatin1Char ( '   ' ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-08-23 01:19:53 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								            cmd  + =  args . join ( QLatin1Char ( '   ' ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-10-08 15:13:02 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        * errorMessage  = 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                QCoreApplication : : translate ( " ProjectExplorer::BuildableHelperLibrary " , 
							 
						 
					
						
							
								
									
										
										
										
											2014-04-17 14:09:47 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								                                            " Error running  \" %1 \"  in %2: %3 " ) . 
							 
						 
					
						
							
								
									
										
										
										
											2021-06-03 10:39:15 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								                                            arg ( cmd ,  proc . workingDirectory ( ) . toUserOutput ( ) , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                                                * errorMessage ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-10-08 15:13:02 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        qWarning ( " %s " ,  qPrintable ( * errorMessage ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    return  rc ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-04-29 13:35:19 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								bool  BuildableHelperLibrary : : buildHelper ( const  BuildHelperArguments  & arguments , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                                         QString  * log ,  QString  * errorMessage ) 
							 
						 
					
						
							
								
									
										
										
										
											2010-09-27 15:51:49 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    const  QChar  newline  =  QLatin1Char ( ' \n ' ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    // Setup process
 
							 
						 
					
						
							
								
									
										
										
										
											2021-04-30 15:01:55 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    QtcProcess  proc ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    proc . setEnvironment ( arguments . environment ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-04-29 13:35:19 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    proc . setWorkingDirectory ( arguments . directory ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-09-27 15:51:49 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								    proc . setProcessChannelMode ( QProcess : : MergedChannels ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-04-29 13:35:19 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    log - > append ( QCoreApplication : : translate ( " ProjectExplorer::BuildableHelperLibrary " , 
							 
						 
					
						
							
								
									
										
										
										
											2014-04-17 14:09:47 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								                                          " Building helper  \" %1 \"  in %2 \n " ) . arg ( arguments . helperName , 
							 
						 
					
						
							
								
									
										
										
										
											2011-04-29 13:35:19 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								                                                                              arguments . directory ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    log - > append ( newline ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-09-27 15:51:49 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-05-28 13:49:26 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    const  FilePath  makeFullPath  =  arguments . environment . searchInPath ( arguments . makeCommand ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-10-24 10:28:28 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    if  ( QFileInfo : : exists ( arguments . directory  +  QLatin1String ( " /Makefile " ) ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2010-10-08 15:13:02 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        if  ( makeFullPath . isEmpty ( ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            * errorMessage  =  QCoreApplication : : translate ( " ProjectExplorer::DebuggingHelperLibrary " , 
							 
						 
					
						
							
								
									
										
										
										
											2011-04-29 13:35:19 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								                                                       " %1 not found in PATH \n " ) . arg ( arguments . makeCommand ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-10-08 15:13:02 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								            return  false ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-09-27 15:51:49 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								        } 
							 
						 
					
						
							
								
									
										
										
										
											2010-10-08 15:13:02 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        const  QString  cleanTarget  =  QLatin1String ( " distclean " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-04-29 13:35:19 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        log - > append ( QCoreApplication : : translate ( " ProjectExplorer::BuildableHelperLibrary " , 
							 
						 
					
						
							
								
									
										
										
										
											2014-07-15 23:32:11 +03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								                                                   " Running %1 %2... \n " ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                    . arg ( makeFullPath . toUserOutput ( ) ,  cleanTarget ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2015-04-14 22:30:46 +03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        if  ( ! runBuildProcess ( proc ,  makeFullPath ,  QStringList ( cleanTarget ) ,  30 ,  true ,  log ,  errorMessage ) ) 
							 
						 
					
						
							
								
									
										
										
										
											2010-10-08 15:13:02 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								            return  false ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-09-27 15:51:49 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								    } 
							 
						 
					
						
							
								
									
										
										
										
											2011-01-12 16:24:00 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    QStringList  qmakeArgs ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-04-29 13:35:19 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    if  ( ! arguments . targetMode . isEmpty ( ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        qmakeArgs  < <  arguments . targetMode ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    if  ( ! arguments . mkspec . isEmpty ( ) ) 
							 
						 
					
						
							
								
									
										
										
										
											2011-11-25 13:19:58 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        qmakeArgs  < <  QLatin1String ( " -spec " )  < <  arguments . mkspec . toUserOutput ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-04-29 13:35:19 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    qmakeArgs  < <  arguments . proFilename ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    qmakeArgs  < <  arguments . qmakeArguments ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-02-10 15:24:49 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-04-29 13:35:19 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    log - > append ( newline ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    log - > append ( QCoreApplication : : translate ( " ProjectExplorer::BuildableHelperLibrary " , 
							 
						 
					
						
							
								
									
										
										
										
											2011-11-25 13:19:58 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								                                            " Running %1 %2 ... \n " ) . arg ( arguments . qmakeCommand . toUserOutput ( ) , 
							 
						 
					
						
							
								
									
										
										
										
											2014-08-23 01:19:53 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								                                                                       qmakeArgs . join ( QLatin1Char ( '   ' ) ) ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-02-10 15:24:49 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2015-04-14 22:30:46 +03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    if  ( ! runBuildProcess ( proc ,  arguments . qmakeCommand ,  qmakeArgs ,  30 ,  false ,  log ,  errorMessage ) ) 
							 
						 
					
						
							
								
									
										
										
										
											2010-10-08 15:13:02 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        return  false ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-04-29 13:35:19 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    log - > append ( newline ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-10-08 15:13:02 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    if  ( makeFullPath . isEmpty ( ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2011-04-29 13:35:19 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        * errorMessage  =  QCoreApplication : : translate ( " ProjectExplorer::BuildableHelperLibrary " , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                                                " %1 not found in PATH \n " ) . arg ( arguments . makeCommand ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-10-08 15:13:02 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        return  false ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-09-27 15:51:49 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								    } 
							 
						 
					
						
							
								
									
										
										
										
											2011-04-29 13:35:19 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    log - > append ( QCoreApplication : : translate ( " ProjectExplorer::BuildableHelperLibrary " , 
							 
						 
					
						
							
								
									
										
										
										
											2014-07-15 23:32:11 +03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								                                            " Running %1 %2 ... \n " ) 
							 
						 
					
						
							
								
									
										
										
										
											2014-08-23 01:19:53 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								                . arg ( makeFullPath . toUserOutput ( ) ,  arguments . makeArguments . join ( QLatin1Char ( '   ' ) ) ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-10-31 15:56:20 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    return  runBuildProcess ( proc ,  makeFullPath ,  arguments . makeArguments ,  120 ,  false ,  log ,  errorMessage ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-09-27 15:51:49 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								bool  BuildableHelperLibrary : : getHelperFileInfoFor ( const  QStringList  & validBinaryFilenames , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                                                  const  QString  & directory ,  QFileInfo *  info ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    if  ( ! info ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        return  false ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-06-13 23:39:57 +03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    for  ( const  QString  & binaryFilename  :  validBinaryFilenames )  { 
							 
						 
					
						
							
								
									
										
										
										
											2010-09-27 15:51:49 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								        info - > setFile ( directory  +  binaryFilename ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        if  ( info - > exists ( ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            return  true ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    return  false ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-02-18 14:43:33 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								QString  BuildableHelperLibrary : : byInstallDataHelper ( const  QString  & sourcePath , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                                                    const  QStringList  & sourceFileNames , 
							 
						 
					
						
							
								
									
										
										
										
											2010-09-27 15:51:49 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								                                                    const  QStringList  & installDirectories , 
							 
						 
					
						
							
								
									
										
										
										
											2011-04-18 14:13:18 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								                                                    const  QStringList  & validBinaryFilenames , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                                                    bool  acceptOutdatedHelper ) 
							 
						 
					
						
							
								
									
										
										
										
											2010-09-27 15:51:49 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
									
										
										
										
											2011-02-18 14:43:33 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    // find the latest change to the sources
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    QDateTime  sourcesModified ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-04-18 14:13:18 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    if  ( ! acceptOutdatedHelper )  { 
							 
						 
					
						
							
								
									
										
										
										
											2020-06-13 23:39:57 +03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        for  ( const  QString  & sourceFileName  :  sourceFileNames )  { 
							 
						 
					
						
							
								
									
										
										
										
											2011-04-18 14:13:18 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								            const  QDateTime  fileModified  =  QFileInfo ( sourcePath  +  sourceFileName ) . lastModified ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            if  ( fileModified . isValid ( )  & &  ( ! sourcesModified . isValid ( )  | |  fileModified  >  sourcesModified ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                sourcesModified  =  fileModified ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        } 
							 
						 
					
						
							
								
									
										
										
										
											2011-02-18 14:43:33 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-06-28 18:00:38 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    // We pretend that the lastmodified of dumper.cpp is 5 minutes before what
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    // the file system says because afer a installation from the package the
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    // modified dates of dumper.cpp and the actual library are close to each
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    // other, but not deterministic in one direction.
 
							 
						 
					
						
							
								
									
										
										
										
											2011-04-18 14:13:18 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    if  ( sourcesModified . isValid ( ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        sourcesModified  =  sourcesModified . addSecs ( - 300 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-09-27 15:51:49 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    // look for the newest helper library in the different locations
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    QString  newestHelper ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    QDateTime  newestHelperModified  =  sourcesModified ;  // prevent using one that's older than the sources
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    QFileInfo  fileInfo ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-06-13 23:39:57 +03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    for  ( const  QString  & installDirectory  :  installDirectories )  { 
							 
						 
					
						
							
								
									
										
										
										
											2010-09-27 15:51:49 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								        if  ( getHelperFileInfoFor ( validBinaryFilenames ,  installDirectory ,  & fileInfo ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2011-04-18 14:13:18 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								            if  ( ! newestHelperModified . isValid ( ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                    | |  ( fileInfo . lastModified ( )  >  newestHelperModified ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2010-09-27 15:51:49 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								                newestHelper  =  fileInfo . filePath ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                newestHelperModified  =  fileInfo . lastModified ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    return  newestHelper ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								}  // namespace Utils