summaryrefslogtreecommitdiffstats
path: root/qmake/library/ioutils.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Windows: centralize how we handle error messagesYuhang Zhao2022-11-161-19/+5
| | | | | | | | | | | | | | | | Currently QtBase contains multiple implementation of how to get the Win32 and COM error messages, and they are almost exactly the same, what's worse, Qt already has a private QSystemError class to do such things, so we are re-inventing the wheel in many places. This patch removes all other custom error message implementations besides the QSystemError one. And since there are a lot of places need the COM error message, move the implementation to QSystemError so that it can handle both Win32 error and COM error. Since I'm touching these lines anyway, break them into short lines if they are above the length limit. Change-Id: I1067c874011800303f0f114b5cb8830ac6810fc0 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Port from container.count()/length() to size()Marc Mutz2022-10-041-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is semantic patch using ClangTidyTransformator: auto QtContainerClass = expr(hasType(namedDecl(hasAnyName(<classes>)))).bind(o) makeRule(cxxMemberCallExpr(on(QtContainerClass), callee(cxxMethodDecl(hasAnyName({"count", "length"), parameterCountIs(0))))), changeTo(cat(access(o, cat("size"), "()"))), cat("use 'size()' instead of 'count()/length()'")) a.k.a qt-port-to-std-compatible-api with config Scope: 'Container'. <classes> are: // sequential: "QByteArray", "QList", "QQueue", "QStack", "QString", "QVarLengthArray", "QVector", // associative: "QHash", "QMultiHash", "QMap", "QMultiMap", "QSet", // Qt has no QMultiSet Change-Id: Ibe8837be96e8d30d1846881ecd65180c1bc459af Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Use SPDX license identifiersLucie Gérard2022-05-161-27/+2
| | | | | | | | | | | | | Replace the current license disclaimer in files by a SPDX-License-Identifier. Files that have to be modified by hand are modified. License files are organized under LICENSES directory. Task-number: QTBUG-67283 Change-Id: Id880c92784c40f3bbde861c0d93f58151c18b9f1 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
* QtBase: replace windows.h with qt_windows.hYuhang Zhao2021-11-231-1/+1
| | | | | | | | | | We have some special handling in qt_windows.h, use it instead of the original windows.h Change-Id: I12fa45b09d3f2aad355573dce45861d7d28e1d77 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* Improve QMakeLibraryInfo encapsulationAlexey Edelev2021-03-011-0/+34
| | | | | | | | | | | QMakeLibraryInfo uses external data to produce paths. This causes issues when trying to use it out of the existing qmake environment. Add data fields that contain the path to the binary that uses QMakeLibraryInfo and manually specified qtconf. Task-number: QTBUG-75870 Change-Id: Ic6fa274ede3a9287826ff66c79f155b10d0d455c Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* Port qmake from QStringRef to QStringViewLars Knoll2020-06-051-4/+4
| | | | | | Change-Id: Ie07a976cd3c634e04c8b9b1e0a6cacd4c2d94939 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Port qmake over to user QRegularExpressionLars Knoll2020-05-051-3/+3
| | | | | | | | | Use the DotMatchesEverythingOption for all places where we interpret .pro files, to increase compatibility with QRegExp. Change-Id: I347d6b17858069f3c9cedcedd04df58358d83f27 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* QRegExp include cleanupSamuel Gaist2019-04-191-0/+1
| | | | | | | | | | | | | | | | QRegExp includes can be found in several files where there's not even a use of the class. This patch aims to avoid needless includes as well as follow the "include only what you use" moto. This patch removes a QRegExp include from the QStringList header which means that there is likely going to be code breaking since QStringList is used in many places and would get QRegExp in. [ChangeLog][Potentially Source-Incompatible Changes] qstringlist.h no longer includes qregexp.h. Change-Id: I32847532f16e419d4cb735ddc11a26551127e923 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Recognize UNC paths as absolute (i.e. not relative)Edward Welbourne2019-02-131-1/+6
| | | | | | | | | | | | IoUtils::isRelativePath() didn't attempt to consider UNC paths, due to a belief that qmake fails on them so badly that it wasn't worth the extra code. However, it turns out Qt Creator's copy of this code does need to take this into account, so start the change off in qmake's version so as to keep in sync. Task-number: QTCREATORBUG-21881 Change-Id: I3084b87c1d3ca6508255e94e04ac8db3ceaebb7e Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* qmake: Apply modernize-use-nullptrAlessandro Portale2018-08-081-3/+3
| | | | | | | Use nullptr instead of 0. Change-Id: Ib3120b9c424a274a2d4dd4c42ec5d7cd5bdead65 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
* qmake: minor fixups to ioutils for building in qt creator contextOswald Buddenhagen2018-03-291-2/+3
| | | | | Change-Id: If82a5387a03f400cde04d582dd7e8567a2b661a0 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* qmake: make IoUtils::fileType() return more expressive resultOswald Buddenhagen2018-03-291-1/+1
| | | | | | | | | | it now does not see anything except regular files and directories any more. that's not expected to be a problem, given the function's scope. Change-Id: I53063ad8cacb3afe5cc1baf6d6d5feba3465e74f Reviewed-by: Tobias Hunger <tobias.hunger@qt.io> (cherry picked from qtcreator/cf82f210804151452fce3cddb3cb2793dab976eb) Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* Make sure $$relative_path() uses an absolute path as its first argEdward Welbourne2018-03-221-1/+1
| | | | | | | | | | | | | | | | Thanks to QTBUG-61373, this qmake function was called with /usr/local/5.10.1 as baseDir, which isn't absolute, leading to an assertion failure. We could raise the error within qmake but it proved easier to simply resolve any non-absolute baseDir using PWD, before trying to use it as an absolute path. Did the same for $$absolute_path(). Documented both. Adjusted the assert that caught this to report any non-absolute path that upsets it. Added simple tests, fixed an existing test. Task-number: QTBUG-66156 Change-Id: Icfef2e2f5b236e071177c9beffa38d71bf404292 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
* qmake: require a drive in a DOS path for it to be absoluteEdward Welbourne2018-01-181-8/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | For Q_OS_WIN, a path is only truly absolute if it includes a drive letter; merely starting with a slash is not enough. (We can't support UNC paths, so don't even try: qmake runs various commands in the source directory using CMD.exe, which doesn't support UNC as PWD.) This requires, when resolving a path relative to a root, transcribing the root's drive to such not-quite-absolute paths. Changed QMakeGlobals, $$absolute_path() and $$relative_path() to now use IoUtils::resolvePath() rather than delegating to QDir's absolute path method, since that doesn't correctly recognize the need for a drive letter (and qmake did run into problems with some paths, from splitPathList and a failing test, as a result). Moved existing ioUtils tests for handling of relative / absolute paths out into separate functions and expanded significantly. Fixed some existing tests to use an absolute path where one is needed; added two tests involving driveless (but rooted) paths; and fixed the test init to set a value for QT_HOST_DATA/src property (the lack of which lead to an assertion failure with this fix). Task-number: QTBUG-50839 Change-Id: I2bfc13c1bfbe1ae09997274622ea55cb3de31b43 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
* Preserve last modification timestamps of installed directoriesSimon Hausmann2017-05-021-0/+35
| | | | | | | | | Similar to the two parent commits, this patchs preserves the time stamps of files we install as a result of recursive directory copying. Change-Id: Id5931a467196d5cd67acfa0deffc2488af8a3669 Task-number: QTBUG-59004 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
* Preserve last modification timestamps of installed filesSimon Hausmann2017-04-121-0/+70
| | | | | | | | | | | On non-windows platforms, we use the "-p" parameter of install(1) to preserve the last modification timestamps of files. On Windows the use of copy does not preserve them. As a cross-platform solution, this patch introduces a simple built-in install command in qmake to copy files. Task-number: QTBUG-59004 Change-Id: I3064d29a2b8c7b009a1efbf8f00b84c079ea5417 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
* Updated license headersJani Heikkinen2016-01-211-17/+12
| | | | | | | | | | | | | From Qt 5.7 -> tools & applications are lisenced under GPL v3 with some exceptions, see http://blog.qt.io/blog/2016/01/13/new-agreement-with-the-kde-free-qt-foundation/ Updated license headers to use new GPL-EXCEPT header instead of LGPL21 one (in those files which will be under GPL 3 with exceptions) Change-Id: I42a473ddc97101492a60b9287d90979d9eb35ae1 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* consider qt resource paths absoluteOswald Buddenhagen2015-10-271-0/+4
| | | | | | | | | | | this fixes an assertion failure with qt4 mingw specs when PATH contains a "." element. Task-number: QTCREATORBUG-12528 Change-Id: I2b6b7e02cf38881d40bd78bb0d705f7d58d0736c Reviewed-by: Christian Kandeler <christian.kandeler@digia.com> (cherry picked from qtcreator/d0428a05220ed0550dd84cdb8299a1fb37b0fe72) Reviewed-by: Christian Kandeler <christian.kandeler@theqtcompany.com>
* Update copyright headersJani Heikkinen2015-02-111-7/+7
| | | | | | | | | | | | | | | | | | Qt copyrights are now in The Qt Company, so we could update the source code headers accordingly. In the same go we should also fix the links to point to qt.io. Outdated header.LGPL removed (use header.LGPL21 instead) Old header.LGPL3 renamed to header.LGPL3-COMM to match actual licensing combination. New header.LGPL-COMM taken in the use file which were using old header.LGPL3 (src/plugins/platforms/android/extract.cpp) Added new header.LGPL3 containing Commercial + LGPLv3 + GPLv2 license combination Change-Id: I6f49b819a8a20cc4f88b794a8f6726d975e8ffbe Reviewed-by: Matti Paaso <matti.paaso@theqtcompany.com>
* make shellQuoteWin() be more sparing with circumflexesOswald Buddenhagen2015-02-041-13/+35
| | | | | | | | | | | | ... as newer versions of nmake (and jom, for compatibility) have botched circumflex processing (they simply don't do it when shortcutting the shell evaluation). as a side effect, the output is also more readable if the string contains quotes. Change-Id: I0506b59ceecb70da258c482f9973156b2803066d Reviewed-by: Joerg Bornemann <joerg.bornemann@theqtcompany.com>
* always use single quotes in shellQuoteUnix()Oswald Buddenhagen2015-02-041-1/+1
| | | | | | | | double quotes cause mingw32-make to switch from direct execution to going through the shell, so avoid them. Change-Id: I05b71a050e425a1b327f747fab01755ff528ba0b Reviewed-by: Joerg Bornemann <joerg.bornemann@theqtcompany.com>
* Update license headers and add new license filesMatti Paaso2014-09-241-19/+11
| | | | | | | | | - Renamed LICENSE.LGPL to LICENSE.LGPLv21 - Added LICENSE.LGPLv3 - Removed LICENSE.GPL Change-Id: Iec3406e3eb3f133be549092015cefe33d259a3f2 Reviewed-by: Iikka Eklund <iikka.eklund@digia.com>
* minor optimization: don't concatenate strings needlesslyOswald Buddenhagen2013-07-191-0/+5
| | | | | | | Change-Id: Iddec1a818ff9f3ad8b12491100883e433e4b8246 Reviewed-by: Daniel Teske <daniel.teske@digia.com> (cherry picked from qtcreator/12652c20711fd29dcba62b8d5ba71c077d8bd06c) Reviewed-by: Joerg Bornemann <joerg.bornemann@digia.com>
* Update copyright year in Digia's license headersSergio Ahumada2013-01-181-1/+1
| | | | | Change-Id: Ic804938fc352291d011800d21e549c10acac66fb Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Change copyrights from Nokia to DigiaIikka Eklund2012-09-221-24/+24
| | | | | | | | Change copyrights and license headers from Nokia to Digia Change-Id: If1cc974286d29fd01ec6c19dd4719a67f4c3f00e Reviewed-by: Lars Knoll <lars.knoll@digia.com> Reviewed-by: Sergio Ahumada <sergio.ahumada@digia.com>
* port qmake to qt creator's qmake language evaluatorOswald Buddenhagen2012-09-111-0/+168
this is a monster commit which does the following things: - import the evaluator as-is from qt creator into qmake/library/ - integrate it into qmake's makefiles - overwrite proitems.h with actual special types - remove the parts of Option which are redundant with QMakeGlobals - make QMakeProperty a singleton owned by Option::globals. the dynamic handling so far made no sense. - make QMakeProject a subclass of QMakeEvaluator, with relatively few extensions the changes to existing qmake code outside project.* and option.* are minor. implementing the changes gradually would mean changing a lot of code which will be just replaced in the next commit, so i'm not wasting my time on it. Change-Id: I9746650423b8c5b3fbd8c3979a73228982a46195 Reviewed-by: Qt Doc Bot <qt_docbot@qt-project.org> Reviewed-by: Joerg Bornemann <joerg.bornemann@nokia.com>