aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/corelib/buildgraph/depscanner.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Use pass-by-value and moveIvan Komissarov2019-03-071-2/+2
| | | | | | | This fixes -Wmodernize-pass-by-value Change-Id: I85a732867866e43c39c1d77937fbc645433c96bd Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
* Return initializer list where it is possibleDenis Shienkov2019-02-261-3/+3
| | | | | | | | | This fixes this clang-tidy warning: warning: avoid repeating the return type from the declaration; use a braced initializer list instead [modernize-return-braced-init-list] Change-Id: I421e1e47462fe0e97788672684d47943af7df850 Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
* Do not ignore file dependencies in the Scanner itemChristian Kandeler2019-01-181-9/+11
| | | | | | | We used to look only at artifacts when scanning recursively. Change-Id: I39f968c05dd3e6af362bf3bb98380814b01de172 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* Re-use product, module and project script valuesChristian Kandeler2018-01-261-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | These script values were set up from scratch not only for every rule, but also when creating the dependencies array. As a result, a rule traversing the dependencies of a product recursively would potentially create a huge amount of identical script values for modules appearing more than once in the dependency graph, such as the qbs module. See the benchmark data below for how the performance degraded with the size of the project. Instead, we now re-use these values, which stay valid throughout the lifetime of the script engine. For prepare scripts, that's the same as the lifetime of the executor. As a side effect, this also gives us change tracking for accesses to product and module properties via the dependencies array. These were completely unobserved before. Benchmarker result using qbs as the test project: ========== Performance data for Rule Execution ========== Old instruction count: 3265471304 New instruction count: 2733833913 Relative change: -17 % Old peak memory usage: 19023592 Bytes New peak memory usage: 19871640 Bytes Relative change: +4 % Benchmarker result using Qt Creator as the test project: ========== Performance data for Rule Execution ========== Old instruction count: 318848392341 New instruction count: 75056789023 Relative change: -77 % Old peak memory usage: 248922136 Bytes New peak memory usage: 258454408 Bytes Relative change: +3 % Change-Id: Id69062eea4dd8f9c7153599610c52bf4ea986464 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* Remove as many dynamic_casts as possibleChristian Kandeler2017-11-301-3/+2
| | | | | | | | According to our benchmarker, this speeds up rule execution by three per cent. Change-Id: Iaf146ba6073b897d19e0fe470d7b0dc4a04d264c Reviewed-by: Jake Petroules <jake.petroules@qt.io>
* corelib: Gather string constants in central placeChristian Kandeler2017-11-291-9/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The same string literals appeared over and over again in the code base, causing redundancy in the sources as well as at run-time. We now give them a name and make sure they get instantiated at most once. String literals that occur only once are converted from QLatin1String to QStringLiteral unless they appear only in contexts that make use of QLatin1String overloads or they are clearly outside of any hot code paths. This seems to result in small, but measurable performance improvements, even if we assume the 1% changes to be noise: ========== Performance data for Resolving ========== Old instruction count: 3266514138 New instruction count: 3209355927 Relative change: -2 % Old peak memory usage: 29649896 Bytes New peak memory usage: 29436264 Bytes Relative change: -1 % ========== Performance data for Rule Execution ========== Old instruction count: 3367804753 New instruction count: 3319029596 Relative change: -2 % Old peak memory usage: 19577760 Bytes New peak memory usage: 19091328 Bytes Relative change: -3 % ========== Performance data for Null Build ========== Old instruction count: 608946535 New instruction count: 604566001 Relative change: -1 % Old peak memory usage: 14606384 Bytes New peak memory usage: 14579936 Bytes Relative change: -1 % Change-Id: Ia055a52e0a4b6fe6fd0f1e7ba4bfa583cba1b0ef Reviewed-by: Jake Petroules <jake.petroules@qt.io>
* Share ScriptFunction objects between productsChristian Kandeler2017-11-231-7/+7
| | | | | | | | | | | The source code of script functions does not differ among module instantiations, so there's no need to give each product its own copy. For example, resolving the QtCreator super project now allocates about 80 of these objects, rather than 16000, each of which had their own unshared copy of the script source code. Change-Id: I10d67991ce170826346d434fe58ea6608fa18a1f Reviewed-by: Jake Petroules <jake.petroules@qt.io>
* STL compatibility: use push_back() instead of append()Jake Petroules2017-11-221-4/+4
| | | | | | | | | | ...or operator<< if the argument was itself a list, or brace init where appropriate. This is a simple find and replace with manual sanity check. Change-Id: I94b79cbf3752192dd258001bf1dfcd46f58ca352 Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
* Use nullptr to initialize the pointersDenis Shienkov2017-11-201-2/+2
| | | | | | Change-Id: I59d743f585410cb5c00d36a7b6f9a3e9d696d19e Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io> Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
* Make Module.setup{Build,Run}Environment first-class citizensChristian Kandeler2017-11-201-1/+1
| | | | | | | | | | | They did not have the project and product variables available, and they accessed module properties in a way that made it look as if they were normal properties rather than scripts, which was misleading. Now everything works the same as in Rule scripts and JS commands. Task-number: QBS-744 Change-Id: I11d70876185d528282a56747747dd8310a77fbc4 Reviewed-by: Jake Petroules <jake.petroules@qt.io>
* STL compatibility: use empty() instead of isEmpty()Jake Petroules2017-11-161-1/+1
| | | | | | | This is a simple find and replace with manual sanity check. Change-Id: Iab6d46dcc3be246d1650aae2b1730f933b717be8 Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
* Amend some function signatures to take raw pointersChristian Kandeler2017-11-151-2/+2
| | | | | | | Preparation for a follow-up patch. Change-Id: Iec86f2719d5fee1ca8a564b37baf44f13a8db5cc Reviewed-by: Jake Petroules <jake.petroules@qt.io>
* Better change tracking for imported JS filesChristian Kandeler2017-11-101-2/+3
| | | | | | | | | | | | | | | We did both too much and too little: Firstly, we invalidated all rules that appeared in a file that imported a changed JS file, independent of whether that import was relevant to the rule. Secondly, we did not catch changes to recursively imported files at all. Now we track accesses to functions in imports and invalidate a rule or command only if a file to which such an access refers has been modified. More fine-grained checks (e.g. per function) would be possible, but incur more overhead, as we'd have to store the respective source code in the build graph. Change-Id: I95f62d233bf87d2c39abbe37056a8fe434f20b5a Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* Remove unnecessary indirection from property mapsChristian Kandeler2017-11-081-6/+3
| | | | | | | | The top-level "module" entry has not been needed ever since we separated the product properties and module properties maps. Change-Id: Ic669a6c76206c87ee6458e5528c2a55d1c55bac1 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* Generalize signature of setupScriptEngineForFileJoerg Bornemann2017-09-011-0/+1
| | | | | | | | | This function can take a FileContextBase object. This enables us to pass FileContext and ResolvedFileContext objects. We will make use of this in a subsequent commit. Change-Id: I052640ed3cb6637b68ac7484d83df532719788ba Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
* Remove superfluous Logger from UserDependencyScannerJoerg Bornemann2017-08-011-2/+1
| | | | | | | Nothing is logged here. Change-Id: Ida96c19f6b0c1919bde537ae9cee1101d1cd708e Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
* Replace QSharedPointer/QWeakPointer with std::shared_ptr/std::weak_ptrJake Petroules2017-05-231-4/+4
| | | | | Change-Id: I2915c578968bed425a8d8b617b56df88ed3f2882 Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
* Try harder to find out the correct location for evaluation errorsChristian Kandeler2017-05-041-1/+2
| | | | | | Task-number: QBS-946 Change-Id: I2fb5d573f7caf44f96fd4a96fd5069a44cdfb16a Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* Un-duplicate code in UserDependencyScanner::evaluateJoerg Bornemann2017-02-241-10/+2
| | | | | | | | | Use Transformer::translateFileConfig to create an artifact's JS representation. This removes duplicated code and makes sure that no artifact property is missing. Change-Id: Iba3d5713eb08f2c5a6f1aa84e1cfbe09e3a549f6 Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
* Add operator== for PropertyMapInternalJoerg Bornemann2017-01-251-1/+1
| | | | | | | Reduce the usage of PropertyMapInternal::value. Change-Id: Ib88fca8d318c43cb1b367a33d2c96ee05c91bd32 Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
* Make it configurable whether system headers become dependenciesChristian Kandeler2017-01-121-5/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | We spent an inordinate amount of resources on scanning and collecting system headers, of which there are a lot and which typically do not change in a relevant way. Make this behavior opt-in. ========== Performance data for Rule Execution ========== Old instruction count: 4331820265 New instruction count: 2557300533 Relative change: -41 % Old peak memory usage: 18892592 Bytes New peak memory usage: 16887880 Bytes Relative change: -11 % ========== Performance data for Null Build ========== Old instruction count: 521956733 New instruction count: 443021349 Relative change: -16 % Old peak memory usage: 12498888 Bytes New peak memory usage: 11186984 Bytes Relative change: -11 % [ChangeLog] Introduced cpp.treatSystemHeadersAsDependencies Change-Id: Iae9d9ca63852fb38a68e8dd2cc10b512eafe15e1 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* Set script engine's active flag while executing custom scannersJoerg Bornemann2017-01-101-8/+20
| | | | | | | | | | | | | | This reverts commit 6a8a7f4fb25ff7259ed66de70b9b4f956dfe0e14 and fixes QBS-782 in a simpler way, without instantiating another ScriptEngine. Having two script engines in the executor thread is wasteful and even potentially dangerous. Also, the removal of the setProcessEventsInterval(-1) call allows us to cancel long running user dependency scanners. Task-number: QBS-782 Change-Id: If680c66c901c809718013860be3d81241e0f782b Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
* Make scanning information persistentChristian Kandeler2017-01-101-0/+35
| | | | | | | | | This way, a change in some artifact or dependency will not cause re- scanning of tons of other header files anymore. Task-number: QBS-1052 Change-Id: I1713da416b47b19275641cbbacd0a5c9da866578 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* Use a sorted vector rather than QSet or std::setChristian Kandeler2017-01-051-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | ========== Performance data for Resolving ========== Old instruction count: 2324724447 New instruction count: 2317712921 Relative change: -1 % Old peak memory usage: 21411584 Bytes New peak memory usage: 21070552 Bytes Relative change: -2 % ========== Performance data for Rule Execution ========== Old instruction count: 4231322611 New instruction count: 4246208129 Relative change: +0 % Old peak memory usage: 19239000 Bytes New peak memory usage: 18181072 Bytes Relative change: -6 % ========== Performance data for Null Build ========== Old instruction count: 542161499 New instruction count: 505511534 Relative change: -7 % Old peak memory usage: 13599040 Bytes New peak memory usage: 11892952 Bytes Relative change: -13 % Change-Id: I36b3dbd3fd2a4bc7503ee7779d31bd0217000785 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* Change style of #includes of Qt headersJake Petroules2017-01-041-3/+4
| | | | | | | | | | | | | | | | By using q<lowercase>.h headers, we become more bootstrap-friendly, as no full syncqt is required any more. In the same go, prefix all includes with the module name. This helps grep-based analysis of which parts of Qt are used and where. It's also consistent with Qt's public headers (where syncqt enforces the style). Testdata and examples are excluded from the change, as they are not relevant for bootstrapping. Change-Id: I9539b1d795e87fca6e5fc6c91acbb775b79208d9 Reviewed-by: Christian Kandeler <christian.kandeler@qt.io> Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* Add distribution-specific properties for include, library, and framework pathsJake Petroules2016-12-191-0/+1
| | | | | | | | | | This allows to ensure that custom (user) locations come before canonical shared locations of a particular distribution like MacPorts (/opt/local/include) or FreeBSD (/usr/local/include). Change-Id: Ia37b28408312300a42ccc31c7532ffdaf49c1c51 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io> Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
* Merge the C/C++ include scannersChristian Kandeler2016-12-191-3/+5
| | | | | | | | | | | | | | | | | | | We had one scanner for every type of file in the C family, all of which collected the same set of includes, but under a different entry in the scanner cache. Thus, lots of header files were unnecessarily re-scanned. We fix this by making the scanner plugins declare a *list* of tags they can handle and passing the currently active tags in the open() function. ========== Performance data for Rule Execution ========== Old instruction count: 3775190973 New instruction count: 3441085735 Relative change: -9 % Old peak memory usage: 18174216 Bytes New peak memory usage: 17307600 Bytes Relative change: -5 % Change-Id: I222d1ec4bbfbc06ecd8c81faa55a500bc0da1ee6 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* Fix input.fileName for Scanner itemsJoerg Bornemann2016-11-231-1/+3
| | | | | | | | | | | Let fileName contain the file name and filePath the file path like everywhere else. [ChangeLog] In Scanner items input.fileName now contains a file name, and input.filePath contains the file path. Change-Id: I3abc01989c56940df935047db56055936b3ab224 Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
* Fix include path order in C++ dependency scannerJoerg Bornemann2016-11-171-27/+13
| | | | | | | | | | The list of include paths must not be stored in a temporary set. Otherwise the order of include paths is undefined. Also, since introduction of merged top-level modules in commit 16404c35 we don't need to recurse through the dependency hierarchy. Change-Id: I50a843fc85dbf1cb04883774d43e5904da815579 Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
* Attach information about the context to our script engineChristian Kandeler2016-11-071-1/+1
| | | | | | | | Certain operations might want to know what the script engine is currently doing. This will be used in a follow-up commit. Change-Id: I90167c29e94e0f77c7d5ccf20787e9749434e728 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* Re-display warnings when loading a stored build graphChristian Kandeler2016-09-301-1/+1
| | | | | | | | | [ChangeLog] Warnings encountered during project resolving are now stored and will be re-displayed when the project is loaded. Task-number: QBS-1011 Change-Id: I5fa04d3d537866212abbdf739b09a254843de473 Reviewed-by: Jake Petroules <jake.petroules@qt.io>
* Merge 1.6 into masterChristian Kandeler2016-09-301-4/+14
|\ | | | | | | Change-Id: I5a0de1ab1c38080d6061045d28fa9220a88ef4ba
| * Handle ALL include path lists in the cpp dependency scannerJake Petroules2016-09-051-4/+14
| | | | | | | | | | | | | | | | | | This will ensure that source files depending on header files within the search paths listed in systemIncludePaths and compilerIncludePaths will be recompiled when those headers change, as well. Change-Id: I6995fcd533b065505e3eec219294540579a73407 Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
* | Update license headersIikka Eklund2016-08-291-14/+23
|/ | | | | | | | | | Patch-set 2 includes *.cpp *.c Every source file needs to have up-to-date license headers in order to pass ci. Change-Id: Ie6e493097af6f7dd6a8adff170eb856f496e689e Reviewed-by: Jake Petroules <jake.petroules@qt.io>
* Merge remote-tracking branch 'origin/1.5'Joerg Bornemann2016-06-081-1/+1
|\ | | | | | | | | | | | | | | Conflicts: doc/reference/items/transformer.qdoc share/qbs/modules/cpp/GenericGCC.qbs Change-Id: I45560834560019b18274c373c45651eb8aadd206
| * Replace 'the Qt build suite' with 'Qbs' in copyright notices.Jake Petroules2016-06-061-1/+1
| | | | | | | | | | | | Change-Id: I885d94bb14b325dc36767a840ebdb0be1fb59dd2 Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io> Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* | Do not use QScriptEngine::push/popScope in rule evaluationJoerg Bornemann2016-05-101-3/+3
|/ | | | | | | | | | | | | | | This functionality is undocumented, has its flaws and is unavailable in other JS engines. Use the following pattern instead to inject global variables without polluting the global namespace: QScriptValue g = engine.newObject(); g.setPrototype(engine.globalObject()); // set properties on g engine.setGlobalObject(g); engine.evaluate(...); engine.setGlobalObject(g.prototype()); Change-Id: I5f92da8cccfa23c3722740c1852a71fd50e8eb8a Reviewed-by: Christian Kandeler <christian.kandeler@theqtcompany.com>
* Code clean-up in corelib/language/.Christian Kandeler2015-07-301-0/+2
| | | | | | | | | | | - Remove unneeded #includes (particularly from header files). - Make inline member function implementations less verbose. - De-QObjectify the Loader class and remove unneeded members & heap allocations. - Minor stuff (const issues, unneeded namespace qualifications). Change-Id: I55f2d7ed98b32faed7582bc6adfa04eb799de874 Reviewed-by: Jake Petroules <jake.petroules@petroules.com>
* Always show the correct error string from the script engine.Christian Kandeler2015-07-201-1/+1
| | | | | | | | Meaning that we check whether the value is an error or the engine has an uncaught exception, and print the respective string. Change-Id: Ie2912e28a82906c7ee9323e2f0e55c6b3de96872 Reviewed-by: Joerg Bornemann <joerg.bornemann@theqtcompany.com>
* Do not process events in custom scanners' script engines.Christian Kandeler2015-04-241-4/+10
| | | | | | | | | | | | | Otherwise we will get calls to slots in the executor at points in time where none are expected. Note: This means that custom scanner scripts become non-interruptible. It is not clear if and how we can fix the relevant bug otherwise. Putting the input artifact scanner into its own thread seems even more problematic. Task-number: QBS-782 Change-Id: I44edebfb2a38dc00062cdb9572991ff9352ddd9f Reviewed-by: Joerg Bornemann <joerg.bornemann@theqtcompany.com>
* Clean up dependency scanner classes.Christian Kandeler2015-04-241-19/+6
| | | | | | | | | | - Make implementations of base class virtuals private. - Remove redundant "virtual" keywords. - Remove unused members. - More const-correctness. Change-Id: I9b4134102415610ecaf6fa20dc13d519dc3e74c6 Reviewed-by: Joerg Bornemann <joerg.bornemann@theqtcompany.com>
* update license headersJoerg Bornemann2015-03-021-2/+2
| | | | | Change-Id: I36d825db3a5ef32c162c3063aab1e8a1f2696f4f Reviewed-by: Christian Kandeler <christian.kandeler@theqtcompany.com>
* Update LicenseEike Ziller2015-01-261-6/+6
| | | | | Change-Id: I092fca9f950de1ba38826c33b155f86feae2770b Reviewed-by: Christian Kandeler <christian.kandeler@theqtcompany.com>
* License update.Eike Ziller2014-10-161-7/+8
| | | | | | | Add LGPLv3 option. Change-Id: I8a63ad5e46a2701032b2103f791df4dec5b707e8 Reviewed-by: Joerg Bornemann <joerg.bornemann@digia.com>
* add getter/setters for Artifact::fileTagsJoerg Bornemann2014-07-311-1/+1
| | | | | | | | | The setters take care of keeping the product's artifact-by-filetags hash up to date. Before, one had to set up the artifact's file tags before insertArtifactToProduct was called. Otherwise the hash didn't get updated. Change-Id: Ibb530d2c992d72c0a99152009b4e6eecbf770098 Reviewed-by: Christian Kandeler <christian.kandeler@digia.com>
* let scanners operate on FileResourceBase objectsJoerg Bornemann2014-05-201-4/+8
| | | | | | | File dependencies should be scannable for dependencies too. Change-Id: I7223ba65ee6ca02f70c8e48165652550007e91f6 Reviewed-by: Christian Kandeler <christian.kandeler@digia.com>
* Add new qml item ScannerMaxim Zaitsev2014-03-121-0/+217
This item allows to write custom dependency scanners in modules. Change-Id: I6cb49969973ee29896d1909e7a16bf5da50f8aef Reviewed-by: Joerg Bornemann <joerg.bornemann@digia.com>