diff options
author | Christian Kamm <christian.d.kamm@nokia.com> | 2011-02-18 14:43:33 +0100 |
---|---|---|
committer | Christian Kamm <christian.d.kamm@nokia.com> | 2011-02-18 14:58:22 +0100 |
commit | e236c5de5fe71e73850c1e67b524745ba17f6455 (patch) | |
tree | 662b6e5b0ad70874571d6ae00bae85f3647dba30 /src | |
parent | 3593fe08aead243cb3b4bea1cfdef80012409ea1 (diff) | |
download | qt-creator-e236c5de5fe71e73850c1e67b524745ba17f6455.tar.gz |
Compiled helpers: Use only ones that are newer than all source files.
Reviewed-by: Kai Koehne
Diffstat (limited to 'src')
-rw-r--r-- | src/libs/utils/buildablehelperlibrary.cpp | 12 | ||||
-rw-r--r-- | src/libs/utils/buildablehelperlibrary.h | 3 | ||||
-rw-r--r-- | src/plugins/projectexplorer/debugginghelper.cpp | 26 | ||||
-rw-r--r-- | src/plugins/qt4projectmanager/qmldebugginglibrary.cpp | 19 | ||||
-rw-r--r-- | src/plugins/qt4projectmanager/qmldebugginglibrary.h | 3 | ||||
-rw-r--r-- | src/plugins/qt4projectmanager/qmldumptool.cpp | 27 | ||||
-rw-r--r-- | src/plugins/qt4projectmanager/qmlobservertool.cpp | 20 | ||||
-rw-r--r-- | src/plugins/qt4projectmanager/qmlobservertool.h | 3 |
8 files changed, 71 insertions, 42 deletions
diff --git a/src/libs/utils/buildablehelperlibrary.cpp b/src/libs/utils/buildablehelperlibrary.cpp index 3bc6b6e449..809aab9b85 100644 --- a/src/libs/utils/buildablehelperlibrary.cpp +++ b/src/libs/utils/buildablehelperlibrary.cpp @@ -322,11 +322,19 @@ bool BuildableHelperLibrary::getHelperFileInfoFor(const QStringList &validBinary return false; } -QString BuildableHelperLibrary::byInstallDataHelper(const QString &mainFilename, +QString BuildableHelperLibrary::byInstallDataHelper(const QString &sourcePath, + const QStringList &sourceFileNames, const QStringList &installDirectories, const QStringList &validBinaryFilenames) { - QDateTime sourcesModified = QFileInfo(mainFilename).lastModified(); + // find the latest change to the sources + QDateTime sourcesModified; + foreach (const QString &sourceFileName, sourceFileNames) { + const QDateTime fileModified = QFileInfo(sourcePath + sourceFileName).lastModified(); + if (fileModified.isValid() && (!sourcesModified.isValid() || fileModified > sourcesModified)) + sourcesModified = fileModified; + } + // We pretend that the lastmodified of gdbmacros.cpp is 5 minutes before what the file system says // Because afer a installation from the package the modified dates of gdbmacros.cpp // and the actual library are close to each other, but not deterministic in one direction diff --git a/src/libs/utils/buildablehelperlibrary.h b/src/libs/utils/buildablehelperlibrary.h index 5753eeccf0..1a8063541f 100644 --- a/src/libs/utils/buildablehelperlibrary.h +++ b/src/libs/utils/buildablehelperlibrary.h @@ -59,7 +59,8 @@ public: static QString qtInstallHeadersDir(const QString &qmakePath); static QString qtInstallDataDir(const QString &qmakePath); - static QString byInstallDataHelper(const QString &mainFilename, + static QString byInstallDataHelper(const QString &sourcePath, + const QStringList &sourceFileNames, const QStringList &installDirectories, const QStringList &validBinaryFilenames); diff --git a/src/plugins/projectexplorer/debugginghelper.cpp b/src/plugins/projectexplorer/debugginghelper.cpp index 35cfed88a6..0c75515e13 100644 --- a/src/plugins/projectexplorer/debugginghelper.cpp +++ b/src/plugins/projectexplorer/debugginghelper.cpp @@ -81,17 +81,28 @@ QStringList DebuggingHelperLibrary::locationsByInstallData(const QString &qtInst return result; } +static QString sourcePath() +{ + return Core::ICore::instance()->resourcePath() + QLatin1String("/gdbmacros/"); +} + +static QStringList sourceFileNames() +{ + return QStringList() + << QLatin1String("gdbmacros.cpp") << QLatin1String("gdbmacros_p.h") + << QLatin1String("gdbmacros.h") << QLatin1String("gdbmacros.pro") + << QLatin1String("LICENSE.LGPL") << QLatin1String("LGPL_EXCEPTION.TXT"); +} + QString DebuggingHelperLibrary::debuggingHelperLibraryByInstallData(const QString &qtInstallData) { if (!Core::ICore::instance()) return QString(); - const QString mainFilename = Core::ICore::instance()->resourcePath() - + QLatin1String("/gdbmacros/gdbmacros.cpp"); const QStringList directories = DebuggingHelperLibrary::debuggingHelperLibraryDirectories(qtInstallData); const QStringList binFilenames = validBinaryFilenames(); - return byInstallDataHelper(mainFilename, directories, binFilenames); + return byInstallDataHelper(sourcePath(), sourceFileNames(), directories, binFilenames); } QString DebuggingHelperLibrary::copy(const QString &qtInstallData, @@ -103,16 +114,9 @@ QString DebuggingHelperLibrary::copy(const QString &qtInstallData, // $USERDIR/qtc-debugging-helper/$hash const QStringList directories = DebuggingHelperLibrary::debuggingHelperLibraryDirectories(qtInstallData); - QStringList files; - files << QLatin1String("gdbmacros.cpp") << QLatin1String("gdbmacros_p.h") - << QLatin1String("gdbmacros.h") << QLatin1String("gdbmacros.pro") - << QLatin1String("LICENSE.LGPL") << QLatin1String("LGPL_EXCEPTION.TXT"); - - QString sourcePath = Core::ICore::instance()->resourcePath() + QLatin1String("/gdbmacros/"); - // Try to find a writeable directory. foreach(const QString &directory, directories) - if (copyFiles(sourcePath, files, directory, errorMessage)) { + if (copyFiles(sourcePath(), sourceFileNames(), directory, errorMessage)) { errorMessage->clear(); return directory; } diff --git a/src/plugins/qt4projectmanager/qmldebugginglibrary.cpp b/src/plugins/qt4projectmanager/qmldebugginglibrary.cpp index 354e990420..ff38b50f52 100644 --- a/src/plugins/qt4projectmanager/qmldebugginglibrary.cpp +++ b/src/plugins/qt4projectmanager/qmldebugginglibrary.cpp @@ -52,8 +52,6 @@ QString QmlDebuggingLibrary::libraryByInstallData(const QString &qtInstallData, if (!Core::ICore::instance()) return QString(); - const QString mainFilename = Core::ICore::instance()->resourcePath() - + QLatin1String("/qml/qmljsdebugger/qmljsdebugger.pro"); const QStringList directories = installDirectories(qtInstallData); QStringList binFilenames; @@ -65,7 +63,7 @@ QString QmlDebuggingLibrary::libraryByInstallData(const QString &qtInstallData, } binFilenames << QLatin1String("libqmljsdebugger.a"); - return byInstallDataHelper(mainFilename, directories, binFilenames); + return byInstallDataHelper(sourcePath(), sourceFileNames(), directories, binFilenames); } bool QmlDebuggingLibrary::canBuild(const QtVersion *qtVersion) @@ -97,10 +95,6 @@ QString QmlDebuggingLibrary::copy(const QString &qtInstallData, QString *errorMe { const QStringList directories = QmlDebuggingLibrary::installDirectories(qtInstallData); - QString sourcePath = Core::ICore::instance()->resourcePath() + QLatin1String("/qml/qmljsdebugger/"); - - QStringList qmljsDebuggerFiles = recursiveFileList(QDir(sourcePath)); - // Try to find a writeable directory. foreach (const QString &directory, directories) { if (!mkpath(directory, errorMessage)) { @@ -109,7 +103,7 @@ QString QmlDebuggingLibrary::copy(const QString &qtInstallData, QString *errorMe errorMessage->clear(); } - if (copyFiles(sourcePath, qmljsDebuggerFiles, + if (copyFiles(sourcePath(), sourceFileNames(), directory, errorMessage)) { errorMessage->clear(); @@ -152,5 +146,14 @@ QStringList QmlDebuggingLibrary::installDirectories(const QString &qtInstallData return directories; } +QString QmlDebuggingLibrary::sourcePath() +{ + return Core::ICore::instance()->resourcePath() + QLatin1String("/qml/qmljsdebugger/"); +} + +QStringList QmlDebuggingLibrary::sourceFileNames() +{ + return recursiveFileList(QDir(sourcePath())); +} } // namespace diff --git a/src/plugins/qt4projectmanager/qmldebugginglibrary.h b/src/plugins/qt4projectmanager/qmldebugginglibrary.h index 21db8f0a91..44e65c9a88 100644 --- a/src/plugins/qt4projectmanager/qmldebugginglibrary.h +++ b/src/plugins/qt4projectmanager/qmldebugginglibrary.h @@ -66,7 +66,8 @@ public: private: static QStringList recursiveFileList(const QDir &dir, const QString &prefix = QString()); static QStringList installDirectories(const QString &qtInstallData); - + static QString sourcePath(); + static QStringList sourceFileNames(); }; } // namespace diff --git a/src/plugins/qt4projectmanager/qmldumptool.cpp b/src/plugins/qt4projectmanager/qmldumptool.cpp index 47b0d96685..fc61c15c3c 100644 --- a/src/plugins/qt4projectmanager/qmldumptool.cpp +++ b/src/plugins/qt4projectmanager/qmldumptool.cpp @@ -228,6 +228,21 @@ QString QmlDumpTool::toolForProject(ProjectExplorer::Project *project, bool debu return QString(); } +static QString sourcePath() +{ + return Core::ICore::instance()->resourcePath() + QLatin1String("/qml/qmldump/"); +} + +static QStringList sourceFileNames() +{ + QStringList files; + files << QLatin1String("main.cpp") << QLatin1String("qmldump.pro") + << QLatin1String("qmlstreamwriter.cpp") << QLatin1String("qmlstreamwriter.h") + << QLatin1String("LICENSE.LGPL") << QLatin1String("LGPL_EXCEPTION.TXT") + << QLatin1String("Info.plist"); + return files; +} + QString QmlDumpTool::toolByInstallData(const QString &qtInstallData, bool debugDump) { if (!Core::ICore::instance()) @@ -238,7 +253,7 @@ QString QmlDumpTool::toolByInstallData(const QString &qtInstallData, bool debugD const QStringList directories = installDirectories(qtInstallData); const QStringList binFilenames = validBinaryFilenames(debugDump); - return byInstallDataHelper(mainFilename, directories, binFilenames); + return byInstallDataHelper(sourcePath(), sourceFileNames(), directories, binFilenames); } QStringList QmlDumpTool::locationsByInstallData(const QString &qtInstallData, bool debugDump) @@ -267,17 +282,9 @@ QString QmlDumpTool::copy(const QString &qtInstallData, QString *errorMessage) { const QStringList directories = QmlDumpTool::installDirectories(qtInstallData); - QStringList files; - files << QLatin1String("main.cpp") << QLatin1String("qmldump.pro") - << QLatin1String("qmlstreamwriter.cpp") << QLatin1String("qmlstreamwriter.h") - << QLatin1String("LICENSE.LGPL") << QLatin1String("LGPL_EXCEPTION.TXT") - << QLatin1String("Info.plist"); - - QString sourcePath = Core::ICore::instance()->resourcePath() + QLatin1String("/qml/qmldump/"); - // Try to find a writeable directory. foreach(const QString &directory, directories) { - if (copyFiles(sourcePath, files, directory, errorMessage)) { + if (copyFiles(sourcePath(), sourceFileNames(), directory, errorMessage)) { return directory; } } diff --git a/src/plugins/qt4projectmanager/qmlobservertool.cpp b/src/plugins/qt4projectmanager/qmlobservertool.cpp index cfd888e8f3..6a71634fa2 100644 --- a/src/plugins/qt4projectmanager/qmlobservertool.cpp +++ b/src/plugins/qt4projectmanager/qmlobservertool.cpp @@ -84,12 +84,10 @@ QString QmlObserverTool::toolByInstallData(const QString &qtInstallData) if (!Core::ICore::instance()) return QString(); - const QString mainFilename = Core::ICore::instance()->resourcePath() - + QLatin1String("/qml/qmlobserver/main.cpp"); const QStringList directories = installDirectories(qtInstallData); const QStringList binFilenames = validBinaryFilenames(); - return byInstallDataHelper(mainFilename, directories, binFilenames); + return byInstallDataHelper(sourcePath(), sourceFileNames(), directories, binFilenames); } QStringList QmlObserverTool::locationsByInstallData(const QString &qtInstallData) @@ -129,10 +127,6 @@ QString QmlObserverTool::copy(const QString &qtInstallData, QString *errorMessag { const QStringList directories = QmlObserverTool::installDirectories(qtInstallData); - QString sourcePath = Core::ICore::instance()->resourcePath() + QLatin1String("/qml/qmlobserver/"); - - QStringList observerFiles = recursiveFileList(QDir(sourcePath)); - // Try to find a writeable directory. foreach(const QString &directory, directories) { if (!mkpath(directory, errorMessage)) { @@ -141,7 +135,7 @@ QString QmlObserverTool::copy(const QString &qtInstallData, QString *errorMessag errorMessage->clear(); } - if (copyFiles(sourcePath, observerFiles, directory, errorMessage)) { + if (copyFiles(sourcePath(), sourceFileNames(), directory, errorMessage)) { errorMessage->clear(); return directory; } @@ -182,4 +176,14 @@ QStringList QmlObserverTool::installDirectories(const QString &qtInstallData) return directories; } +QString QmlObserverTool::sourcePath() +{ + return Core::ICore::instance()->resourcePath() + QLatin1String("/qml/qmlobserver/"); +} + +QStringList QmlObserverTool::sourceFileNames() +{ + return recursiveFileList(QDir(sourcePath())); +} + } // namespace diff --git a/src/plugins/qt4projectmanager/qmlobservertool.h b/src/plugins/qt4projectmanager/qmlobservertool.h index 865c8ef42d..35580de96b 100644 --- a/src/plugins/qt4projectmanager/qmlobservertool.h +++ b/src/plugins/qt4projectmanager/qmlobservertool.h @@ -71,7 +71,8 @@ public: private: static QStringList recursiveFileList(const QDir &dir, const QString &prefix = QString()); static QStringList installDirectories(const QString &qtInstallData); - + static QString sourcePath(); + static QStringList sourceFileNames(); }; } // namespace |