aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/corelib/buildgraph/buildgraphloader.h
Commit message (Collapse)AuthorAgeFilesLines
* Fix uninitialized variablesIvan Komissarov2019-05-021-2/+2
| | | | | | | | | This fixes most of clang analyzer warnings about uninitialized variables in ctors Change-Id: I879c785594307ed3fe7140588338a6b2a1e4db65 Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com> Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
* Use pass-by-value and moveIvan Komissarov2019-03-071-1/+1
| | | | | | | This fixes -Wmodernize-pass-by-value Change-Id: I85a732867866e43c39c1d77937fbc645433c96bd Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
* Replace 'typedef' with 'using' where it is possibleDenis Shienkov2019-02-231-1/+1
| | | | | | | | One exception is that the 'typedef' for function pointers were skipped due to an additional work is required. Change-Id: I2112fded3abeaee1d1f49f56adfd2914d5db0324 Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
* Module providers: Fix some change tracking problemsChristian Kandeler2019-02-111-1/+1
| | | | | | | | | | | - We must not remember our temporary files. - We need to use a different reference time stamp for the created modules. - Collecting the results of File.exists() & friends can lead to false positives, so we disable it for now. Change-Id: Id64685b510606f1991e83eb825c36a1b3ec4a4e1 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* Do not reset the product build data due to source file metadata changesChristian Kandeler2018-07-051-0/+6
| | | | | | | | | | | | | | | | It is not necessary to throw away and recreate all the product's artifacts and rule nodes if a source file's tags or properties change. Instead, just copy the new data into the corresponding Artifact object. As a necessary side effect, we also handle changes to the product- level module properties and to "fileTagsFilter groups" in a more fine- grained manner by resetting the properties and file tags of the product's Artifact objects that represent generated artifacts. This is part of a long-term effort to eliminate the build graph's "shadow structure" aka RescuableArtifactData. The next step will deal with added and removed source files. Change-Id: I054fa18d7920ea5c429c92bfca1c12e34192211e Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* Make ResolvedProject::products a vectorJoerg Bornemann2018-04-271-6/+6
| | | | | | | The value_type is not suitable for QList. Change-Id: If72af8998e9e1da37c8451bc6dc5925079be43dd Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
* Move transformer change tracking out of the build graph loaderChristian Kandeler2018-02-161-7/+1
| | | | | | | | | | | | | | | | | | | | The checks that determine whether to re-run prepare scripts and/or commands due to property or environment changes do not belong into the build graph loader. Instead, we now do them on demand during the build process. Advantages: - The code is at its "natural" place, making it easier to understand and less fragile. - There are a lot fewer unnecessary build data invalidations, speeding up both re-resolving and rebuilding in case only some rules/commands have changed. - Re-running commands due to property or environment changes no longer implies re-running prepare scripts. - We now catch property changes on generated artifacts, which was not possible before, because the build graph loader only had access to the source artifacts of the re-resolved project. Change-Id: I36b022cf631fa9e8293feec4d6f416c2686539c1 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* Move transformer change tracking to a dedicated set of filesChristian Kandeler2018-01-311-1/+2
| | | | | | | | We want to call it from a different context in a follow-up patch. No functional changes. Change-Id: I868a7e5eafc6e7b6cf6ac140b2199ef252d9af1f Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* Re-use product, module and project script valuesChristian Kandeler2018-01-261-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* Better change tracking for imported JS filesChristian Kandeler2017-11-101-2/+0
| | | | | | | | | | | | | | | 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>
* API: Allow synchronous retrieval of build graph dataChristian Kandeler2017-06-141-0/+2
| | | | | | | | This is needed to import builds into Qt Creator. Task-number: QBS-1059 Change-Id: I8a1b226d3f0044c7e90a61d195796a1e8be9a9de Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* Re-run process commands if a relevant environment variable has changedChristian Kandeler2017-06-081-1/+4
| | | | | | | | | | | | Process commands can now declare that they are sensitive to certain environment variables. If such a variable changes its value, we invalidate the respective transformer. [ChangeLog] Added new property "relevantEnvironmentVariables" to the Command class Change-Id: Id866dc676b3b483a5d843e6125c91829f5094eba Reviewed-by: Jake Petroules <jake.petroules@qt.io>
* Make use of more data from the build graph when rebuildingChristian Kandeler2017-05-021-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Assume we are building a project this way: $ qbs -f src/myproject.qbs modules.cpp.warningLevel:none Upon rebuilding, we had to list the project file and the property value again, even though both were stored in the build graph: $ qbs # Failure, no project file given $ qbs -f src/myproject.qbs # cpp.warningLevel:<default> With this patch, project file and property values as well as the environment are taken from the build graph, unless the user requests otherwise by using the resolve command: $ qbs # ok, uses the original values $ qbs -f someotherproject.qbs # error, project file has changed $ qbs resolve -f someotherproject.qbs # ok, using new project file $ qbs # ok, builds using the new project file $ qbs cpp.warningLevel:none # ok, no changes $ qbs cpp.warningLevel:all # error, conflicting properties $ qbs resolve cpp.warningLevel:all # ok, using new set of properties $ qbs # ok, build using new set of properties [ChangeLog] When rebuilding a project, the environment, project file and property values are taken from the existing build graph. Change-Id: I3c691920c3fc8ced2abba13258a6d384a9ed4eaa Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io> Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* Remove unneeded argument from BuildGraphLoader constructorChristian Kandeler2017-04-121-2/+1
| | | | | | Change-Id: Ia0bd5ed1e11903e65381854b2a9fb41644e363ee Reviewed-by: Jake Petroules <jake.petroules@qt.io> Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* Change tracking: Gather more data about the cost of operationsChristian Kandeler2017-01-241-0/+1
| | | | | Change-Id: I0abe6e177027d50bb38eb3481f16580a4ed836dc Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* Use a sorted vector rather than QSet or std::setChristian Kandeler2017-01-051-4/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | ========== 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-2/+2
| | | | | | | | | | | | | | | | 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>
* Allow Probe items inside Project itemsDenis Klychkov2016-12-191-1/+2
| | | | | | | | | | | | As long as projects do not have unique names it required to change identification of the restored probes. They used product id before. Now they use combination of item id and file path. This also led to a requirement of non-empty id for all probes. Anyway probes are very rarely used without an id. Task-number: QBS-1034 Change-Id: Ibe462a3c0abfd9925f441d722b19cea1bcde3ee2 Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
* Benchmark effort for expanding wildcards during change trackingChristian Kandeler2016-11-281-0/+1
| | | | | | | | This operation is potentially performance-sensitive. Let's gather some real-world data on it. Change-Id: I430ce6c3bb35106b7f2bf37ab978996ba92f36ad Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* Update license headersIikka Eklund2016-08-291-14/+23
| | | | | | | | | | Patch-set 1 includes *.h Every source file needs to have up-to-date license headers in order to pass ci. Change-Id: Ib6cf3ac47dfba6dff262fded44bc952aef3bda8b Reviewed-by: Jake Petroules <jake.petroules@qt.io>
* Remove support for deprecated Transformer itemChristian Kandeler2016-08-021-1/+0
| | | | | | | [ChangeLog] Support for the deprecated Transformer item was removed. Change-Id: I47b88fcf4e58a5c347838d598d44bad404381ee0 Reviewed-by: Jake Petroules <jake.petroules@qt.io>
* Cache the results of probes.Christian Kandeler2016-06-151-0/+1
| | | | | | | | | | | Probes are often used to call external processes, which can be expensive. We do not want them to be executed every time a project is re-resolved. So cache the results and provide the means to force re- execution if something changes externally. Task-number: QBS-25 Change-Id: I5c48a6f657f5829b72df7677b566177502655c5e Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* 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>
* Fix change tracking for prepare scripts using JS imports.Christian Kandeler2016-02-251-0/+2
| | | | | | | | | | | | | Comparing the old and new source code of a rule is not enough if part of the code is factored out into a JavaScript helper file and the code there has changed. So we now take the filestamp of imports into account when deciding whether a prepare script will have to be re-run. Note that this will lead to some false positives, as we do not easily get at the information which import is actually used in which prepare script. Change-Id: Iab5be90fccddff339e9d4fe36aff6a5c208ad9c2 Reviewed-by: Joerg Bornemann <joerg.bornemann@theqtcompany.com>
* Merge branch 1.4 into master.Christian Kandeler2015-07-241-0/+1
|\ | | | | | | Change-Id: I79f2638a024a807151a12d1f0b701d6533a3311f
| * Add a File.canonicalFilePath function.Jake Petroules2015-07-241-0/+1
| | | | | | | | | | Change-Id: I0759c9c81569d0bc3cc44937b7c4d6cce6af5d29 Reviewed-by: Christian Kandeler <christian.kandeler@theqtcompany.com>
* | Add a File.directoryEntries function to list directory contents.Jake Petroules2015-06-101-0/+1
|/ | | | | Change-Id: I5470ecfa79d93207858ab661ff8e5e2cf80b75c8 Reviewed-by: Christian Kandeler <christian.kandeler@theqtcompany.com>
* Improve change tracking.Christian Kandeler2015-05-041-4/+1
| | | | | | | | | | | | | | | | | | | | | | A long time ago, we introduced two categories of changed products in the change tracker: Products with "simple changes" such as a new file tag or a different module property value, and those with "severe changes" that were very likely to result in a need to re-build artifacts, such as a change in a prepare script. The latter's build data was simply thrown away and re-generated, whereas for the former we carefully applied the necessary changes to the build data "manually" with the idea to minimize the amount of rebuilds. However, some time later we introduced the concept of "rescue data", which eliminated unnecessary rebuilds for the "severe changes" case as well. In fact, it turns out that this approach is actually much more robust and reliable in addition to having the simpler implementation. So we now get rid of the hand-crafted special handling for "simple changes", as it is just inferior. Task-number: QBS-724 Task-number: QBS-791 Change-Id: Ia06ca4ce5697a13cdd48d002acdab1cc2904a044 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>
* Merge branch '1.3' into 'master'Christian Kandeler2015-01-281-6/+6
|\ | | | | | | | | | | | | | | | | Conflicts: doc/reference/jsextensions/jsextensions-general.qdoc src/lib/corelib/language/evaluatorscriptclass.cpp src/lib/corelib/language/evaluatorscriptclass.h Change-Id: Ic9b77b56e8fc8bf93e0a553930757de8c93fed22
| * Update LicenseEike Ziller2015-01-261-6/+6
| | | | | | | | | | Change-Id: I092fca9f950de1ba38826c33b155f86feae2770b Reviewed-by: Christian Kandeler <christian.kandeler@theqtcompany.com>
* | Refactor build config compatibility check in build graph loader.Christian Kandeler2014-12-111-0/+1
|/ | | | | | | We will extend the new member function in a follow-up patch. Change-Id: Ia24604d0c0d347f63c879f4fb5b77a640858f3ca Reviewed-by: Joerg Bornemann <joerg.bornemann@theqtcompany.com>
* License update.Eike Ziller2014-10-161-7/+8
| | | | | | | Add LGPLv3 option. Change-Id: I8a63ad5e46a2701032b2103f791df4dec5b707e8 Reviewed-by: Joerg Bornemann <joerg.bornemann@digia.com>
* Speed up project re-resolving by skipping the loading from file.Christian Kandeler2014-07-161-2/+4
| | | | | | | | When re-resolving an existing project, the build graph already exists in memory and does not have to be read from disk. Change-Id: Icf5cf7396a859d4ee1c495b8cc4fa7a1ee61ff1d Reviewed-by: Joerg Bornemann <joerg.bornemann@digia.com>
* Refactor BuildGraphLoader::load().Christian Kandeler2014-07-151-3/+4
| | | | | | | | | Move the code that actually loads the project from a file into its own function. Change-Id: I258f97e8411a54e99fa274041f9054ce0703e273 Reviewed-by: Joerg Bornemann <joerg.bornemann@digia.com> Reviewed-by: Christian Kandeler <christian.kandeler@digia.com>
* Remember at what point in time a project was fully resolved.Christian Kandeler2014-07-031-3/+1
| | | | | | | | | | And use that information for out-of-date checks instead of the build graph time stamp. The latter is updated after resolving or even building has finished, which means we miss all changes to project files that have happened in between. Change-Id: I4b2f9e962c26894ce167b36ae3e562e7905d2a3c Reviewed-by: Joerg Bornemann <joerg.bornemann@digia.com>
* Make sure to remove empty parent directories when removing artifacts.Christian Kandeler2014-07-021-0/+1
| | | | | | | | | | | We create these directories when we create the artifacts, so we have to remove them when the artifacts are removed. For safety, we do not do that for artifacts located outside of the build directory. Task-number: QBS-630 Change-Id: I4da91a2b940ddea6837cb881bf3dc777b71fe702 Reviewed-by: Joerg Bornemann <joerg.bornemann@digia.com>
* Do not lose rescuable artifact data after an incomplete build.Christian Kandeler2014-07-021-1/+4
| | | | | | Task-number: QBS-630 Change-Id: Ib69c541a6c1e228b1ad3c06da51d905194ed10d8 Reviewed-by: Joerg Bornemann <joerg.bornemann@digia.com>
* support transformers with an unknown number of outputsJoerg Bornemann2014-02-131-2/+10
| | | | | | | | | | | | | | | | To support different types of nodes in the build graph, we introduce the base class BuildGraphNode. Artifact now derives from BuildGraphNode. A RuleNode class is introduced that represents a rule in the build graph. Rules are applied in the build phase and not in a pre-build phase anymore. The handling of moc has been revisited. The fixed automoc pre-build phase is no more. This is the squashed merge of a feature branch. Task-number: QBS-370 Change-Id: If27cdc51cba8c9542e4282c2caa456faa723aeff Reviewed-by: Christian Kandeler <christian.kandeler@digia.com>
* rename ArtifactList to ArtifactSetJoerg Bornemann2014-01-161-2/+2
| | | | | | | Now the name reflects reality. Change-Id: I3997b99de86819c973434240103d25d6915d838b Reviewed-by: Christian Kandeler <christian.kandeler@digia.com>
* remove dead method declarationJoerg Bornemann2014-01-141-2/+0
| | | | | Change-Id: Ic9fda65275ecc01d62dc6f6acefac97c6ce3a68b Reviewed-by: Christian Kandeler <christian.kandeler@digia.com>
* Move Qt profile setup into a dedicated library.Christian Kandeler2014-01-101-0/+124
Otherwise all changes to the implementation will have to be duplicated in IDEs. Change-Id: I61e6d4fa1ee9b724eb5d9de9f233dc915a6c8bc3 Reviewed-by: Joerg Bornemann <joerg.bornemann@digia.com>