aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/corelib/buildgraph/rulenode.h
Commit message (Collapse)AuthorAgeFilesLines
* Apply fix-its for the missing override keywordIvan Komissarov2019-05-031-1/+1
| | | | | | | | Missing override is a warning in clang Change-Id: I90b899df37e690aebb942bffc65db54d9aa4050f Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com> Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
* Executor: Increment progress bar after a rule's transformers are doneChristian Kandeler2018-10-221-0/+2
| | | | | | | | | ... rather than after the prepare script has run. This gives a more realistic estimate on average. Fixes: QTCREATORBUG-18523 Change-Id: I61214903936f964e060b92238d5644f0a8414539 Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
* Fix memory leak in RuleNodeChristian Kandeler2018-09-051-0/+6
| | | | | | | | | When we introduced our "dummy artifact" singleton, we forgot that it gets stored and consequently needs to get deallocated manually in subsequent qbs invocations. Let's use a null pointer instead. Change-Id: If19c6faa46cfcba60e24c84bfd095ade94546dbb Reviewed-by: Christian Stenger <christian.stenger@qt.io>
* corelib: Apply modernize-use-overrideAlessandro Portale2018-08-201-5/+5
| | | | | | | Add overrides to function, except for destructors. Change-Id: I1a1337b01dfef81b74ba56c5f00bf4d4cfc10935 Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
* RuleNode: Keep track of "helper inputs"Christian Kandeler2018-08-011-2/+6
| | | | | | | | | | Namely, explicitlyDependsOn and auxiliaryInputs. A change in the set of explicitlyDependsOn must cause rule re-application (see c241048e30). In addition, for "I/O rules" (see 2d1de8cc84), we re-apply on filestamp changes to explicitlyDependsOn and any changes to auxiliaryInputs. Change-Id: Ic1770ab37b0609b0d58e7bbc6c1c755dec262a19 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* Fix race condition when removing empty directoriesChristian Kandeler2018-07-181-0/+1
| | | | | | | | | | | | | After removing generated artifacts, we check whether the respective parent directory is now empty, and if it is, we remove it to keep the build directory tidy. However, we cannot do that right away as part of rule application, because concurrently running processes of other rules might access that directory. Therefore, we delay the directory removal step until the Executor has finished. Change-Id: If996e231aa34bc487bcd179d8fc7f49678519b00 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* RuleNode: Fix calculation of changed inputsChristian Kandeler2018-07-161-3/+5
| | | | | | | | | | | | | | | | | | | | | | | | The old code had a number of problems: - It partially overlapped with the calculation of compatible inputs. - It was wrong in that it failed to consider inputs from dependencies. - It was wrong in that it assumed that after rule application, input artifacts always have parent artifacts to later compare timestamps with. This is not the case for e.g. a generated cpp file without a Q_OBJECT macro on which moc is run: No transformer is created in such a case, because the outputArtifacts array is empty. The last problem was glossed over by the fact that we held a global list of "changed source artifacts" in the executor, so such changes were spotted when they happened in source artifacts. However, that code was also rather dubious in itself because the criterion for "changed" was that the timestamp was newer than it was on the last run of the executor, so I don't think it was completely safe when doing partial builds. We solve these problems by remembering when we last applied the rule. An input artifact is considered "changed" if it has been modified after that. Change-Id: Ib1bafd9e1078122776626155c4f2cc11ad622191 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* Executor: Move rule-specific code to RulesApplicatorChristian Kandeler2018-07-131-1/+0
| | | | | | | | | Having all the related code in one place makes it much easier to understand what is going on, and the Executor code is completely straightforward now. Change-Id: I0c8b2d0edafa69ad326f6afbb0ab1202fef9d885 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* RuleNode: Clarify that the returned node sets contain artifactsChristian Kandeler2018-07-121-2/+2
| | | | | | | | The naming of these sets and the code that handled them in the Executor suggested that they could contain other types of nodes as well. Change-Id: I6443f07a3615eff166965a5203002797200924b0 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* Do not generally re-apply rules just because inputs have changedChristian Kandeler2018-07-111-1/+2
| | | | | | | | | | | Only a small minority of rules determines their outputs based on the content of their inputs. In order to do that, they need to do file I/O in their outputArtifacts scripts, for instance via qbs.TextFile or qbs.Process. All rules that don't do that do not need to get re-applied if an input changes. Change-Id: Icc713a54de4f60b3ef5dca523da5bfe42cc7e176 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* RuleNode: Also consider removed inputs that no longer existChristian Kandeler2018-07-101-1/+1
| | | | | | | | | | | | | If an artifact goes away, it is removed from the "old inputs" list of rule nodes, because obviously we cannot reference invalid pointers there. However, we do need to remember that there was something there, because otherwise we will not re-apply the rule even though we have to. For this purpose, we replace the disappeared artifact with a dummy. This one will never appear as an input and thus its presence will cause re- application of the rule. Change-Id: I060db19b85ab5749ba768a7dd0a37b588cde63a7 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* Executor: Move some code into RuleNodeChristian Kandeler2018-07-101-1/+2
| | | | | | | | The information about which input artifacts changed is only relevant to the code in RuleNode, so let's set it up there. Change-Id: I4be762f91583a77f083b26abb5882c60cb6ead86 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* Get rid of redundancies between load() and store() methodsChristian Kandeler2018-02-161-1/+7
| | | | | | | | | | It's silly that we have to mention each serializable data member in both the load and the store methods. Instead, whenever possible, forward these methods to a template that calls the right function in the persistence backend based on its parameter. Change-Id: I00e2dee8cdf55405f447cee27190bc97df8673e3 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* Move transformer change tracking out of the build graph loaderChristian Kandeler2018-02-161-1/+6
| | | | | | | | | | | | | | | | | | | | 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>
* Get rid of all remaining dynamic_castsChristian Kandeler2017-12-071-0/+6
| | | | | | | This speeds up rule execution by another 2%. Change-Id: If819144f2c01bd243ec98f7a6d050bc5faa2b02c Reviewed-by: Jake Petroules <jake.petroules@qt.io>
* Get rid of the PersistentObject classChristian Kandeler2017-12-061-1/+0
| | | | | | | | | | | | Our serialization requirements are fully served by the template mechanism; there is no need to put an inheritance-based approach on top of it. Now there is no more virtual inheritance, which allowed us to get rid of one more dynamic_cast. According to our benchmarker, build graph loading has become about 3% faster. Change-Id: If2f5080f74a0ef972a575ac2798f9d94a7f3b519 Reviewed-by: Jake Petroules <jake.petroules@qt.io>
* Use a sorted vector rather than QSet or std::setChristian Kandeler2017-01-051-1/+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>
* 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>
* 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>
* 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>
* update leaves for invalidated artifactsJoerg Bornemann2015-01-131-0/+1
| | | | | | | | | Artifacts that get invalidated by rules must be considered as source for new leaves in the executor. Task-number: QBS-723 Change-Id: I6a6f40725103f1f4a917d3e71f968dc355f8a763 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>
* fix calculation of old inputs for dynamic rulesJoerg Bornemann2014-07-301-2/+2
| | | | | | | | | | | | | | Instead of deducing the old inputs of a rule from the inputs of its created transformers, we hold a dedicated list of old inputs, because the former approach doesn't work for dynamic rules. This fixes a speed regression introduced in 32c4d3d7. The outputArtifacts script of dynamic rules was always run on compatible inputs that were not input of transformers, e.g. C++ sources that don't have a Q_OBJECT macro. Change-Id: I2d43fa7c91ed9084bd27dc9b948c06152bfce726 Reviewed-by: Christian Kandeler <christian.kandeler@digia.com>
* fix calculation of added/removed artifactsJoerg Bornemann2014-07-171-1/+4
| | | | | | | | | | | We kept lists of added and removed artifacts in ProductBuildData. It was never quite clear when to invalidate those lists, which led to QBS-635. Instead we let the RuleNode decide which artifacts it considers as "added or removed for this rule". Task-number: QBS-635 Change-Id: I390e0ab775c695045c6e91ade3ac7326692cb314 Reviewed-by: Christian Kandeler <christian.kandeler@digia.com>
* run rules on dependency-only productsJoerg Bornemann2014-05-261-0/+2
| | | | | | | | | This enables compound products that do not provide their own source files but only consist of dependencies. Task-number: QBS-277 Change-Id: I8e3fc5b5e3a85ca2c6fe4890dcd52d3a55cebfe2 Reviewed-by: Christian Kandeler <christian.kandeler@digia.com>
* Condense executor code.Christian Kandeler2014-02-171-3/+1
| | | | | | | | Remove unused function and merge functions that were (nearly) doing the same thing. Change-Id: I33276068d5595456832ed44a0ff2d5705a87165a Reviewed-by: Joerg Bornemann <joerg.bornemann@digia.com>
* support transformers with an unknown number of outputsJoerg Bornemann2014-02-131-0/+76
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>