aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/corelib/buildgraph/executor.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Use std:: containers in ProjectBuildDataIvan Komissarov2019-05-221-3/+2
| | | | | | | | | | | | | | | It appears, that destruction of complex QHashes/QLists took a bit time in refcounts. Optimize them by using std::unordered_map and std::vector instead. Plus, make structure simplier, instead of 2 hashes, use pair as a key. qbs::Internal::ProjectBuildData::~ProjectBuildData() Before: 11.00 ms 0.1% After: 6.00 ms 0.0% Change-Id: I82d8bec5a465210cfa54762088f47c606c0e48e5 Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com> Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
* Apply modernize-use-auto fix-itIvan Komissarov2019-05-201-1/+1
| | | | | | | | Makes clang-tidy happier Change-Id: I75f3b6409b425b9a7054d7886ab0160a040b25d5 Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com> Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
* Fix -Wclazy-inefficient-qlist-softIvan Komissarov2019-05-201-1/+1
| | | | | | | | | QLists were used with types that bigger than sizeof(void*) which lead to extra allocations Change-Id: Id716c6b4919f9a0ad62e1d2972319a600785afc5 Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com> Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
* Fix uninitialized variablesIvan Komissarov2019-05-021-1/+1
| | | | | | | | | 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-2/+2
| | | | | | | This fixes -Wmodernize-pass-by-value Change-Id: I85a732867866e43c39c1d77937fbc645433c96bd Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
* Fix calls to non-const begin()/end() in range-for loopsIvan Komissarov2019-03-061-7/+12
| | | | | | | | This fixes -Wclazy-range-loop Change-Id: I08a435b700017cdbe27fbfdbda6e26840d9a3568 Reviewed-by: Christian Kandeler <christian.kandeler@qt.io> Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
* Use QStringLiteral more where it is possibleDenis Shienkov2019-02-251-1/+1
| | | | | | Change-Id: I7419cc3fbc1e8776de3943852dcedab4c95d1c32 Reviewed-by: Anton Kudryavtsev <antkudr@mail.ru> Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
* Use 'const auto' keywords more at objects allocationsDenis Shienkov2019-02-231-1/+1
| | | | | | Change-Id: I592d433e7c473ae9f27ca08e701516efe53650ba Reviewed-by: Ivan Komissarov <ABBAPOH@gmail.com> Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
* Executor: Increment progress bar after a rule's transformers are doneChristian Kandeler2018-10-221-2/+19
| | | | | | | | | ... 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>
* Merge 1.12 into masterChristian Kandeler2018-09-041-1/+1
|\ | | | | | | Change-Id: Ia115255ae46772a83c1196fbe291ff295927ee92
| * Executor: Fix invalid assertionChristian Kandeler2018-09-031-1/+1
| | | | | | | | | | | | | | | | An artifact whose alwaysUpdated property is false does not need to exist and is therefore not required to have a valid timestamp. Change-Id: I642349c49a53e6e45d6b09d1acc87f4c9a0edae9 Reviewed-by: Christian Stenger <christian.stenger@qt.io>
* | Merge 1.12 into masterChristian Kandeler2018-08-311-2/+2
|\| | | | | | | Change-Id: I745a07a3b25abd6c89afcd3b2199119a751e8a0c
| * Fix potential inconsistency in Artifact dataChristian Kandeler2018-08-101-2/+2
| | | | | | | | | | | | | | | | If safeConnect() returns false, we must not add that "child" to the list of children added by scanners. Change-Id: Icbb1b2d14d99f002e2370ee2bda25daafb0398b2 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* | corelib: Apply modernize-use-nullptrAlessandro Portale2018-08-201-1/+1
| | | | | | | | | | | | | | Use nullptr instead of 0. Change-Id: Id5b7933844730e244a2dcf3fcebf24f9f048047f Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
* | corelib: Apply modernize-use-autoAlessandro Portale2018-08-201-3/+3
| | | | | | | | | | | | | | Use more auto. Change-Id: I27e1e2345c6bede459a375663be72ec3370a5e39 Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
* | Add support for job poolsChristian Kandeler2018-08-081-3/+84
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Commands can now be assigned to an arbitrary job pool and a limit for the number of concurrently running jobs in such pools can be provided in a number of ways: - via the build command line: qbs --job-limits linker:1 - via the settings: qbs config preferences.jobLimit.linker 1 - in a project file: JobLimit { jobPool: "linker"; jobCount: 1 } We provide two job pools ourselves with the cpp module: "compiler" and "linker". [ChangeLog] Added the concept of job pools for limiting concurrent execution of commands by type Task-number: QBS-743 Change-Id: Ib3f361dbc73093e342bf0eba0daf2079a2b3a8ce Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io> 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-6/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-25/+2
| | | | | | | | | | | | | | | | | | 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>
* | Make sure every input artifact is connected to its rule nodeChristian Kandeler2018-07-121-4/+0
| | | | | | | | | | | | | | | | | | The old code did that only upon output artifact creation, which meant that source artifacts that became inputs to a rule that had already run were not added to that rule node as a child. Change-Id: I4998cbc54abbbcbf0cb2feafd34f2ee44d6d329d Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* | Executor: Sync file dependency timestamps onceChristian Kandeler2018-07-121-18/+8
| | | | | | | | | | | | | | | | | | | | ... instead of doing it again for every artifact. Typically, artifacts share a lot of file dependencies (e.g. external header files). The old code retrieved such timestamps over and over again during the same build. Change-Id: I100287eff93792adcc4b10847173081809439cac Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* | RuleNode: Clarify that the returned node sets contain artifactsChristian Kandeler2018-07-121-6/+5
| | | | | | | | | | | | | | | | 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>
* | Merge 1.12 into masterChristian Kandeler2018-07-121-1/+3
|\| | | | | | | Change-Id: I056a96c062881c2a07ec15b1803efa9c9aa1a02a
| * Update the timestamps of file dependencies of rescued artifactsChristian Kandeler2018-07-101-1/+3
| | | | | | | | | | | | | | | | | | | | | | Resetting the timestamps of file dependencies happens per artifact before the rescue procedure, so any dependencies added there must get their timestamp reset explicitly. Task-number: QBS-1359 Change-Id: Iec22b105a4132ada65b52391d4212c3b9ba52a2a Reviewed-by: Ola Røer Thorsen <ola@silentwings.no> Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* | Executor: Move some code into RuleNodeChristian Kandeler2018-07-101-29/+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>
* | Merge 1.12 into masterChristian Kandeler2018-07-061-18/+19
|\| | | | | | | Change-Id: I616949b321c26699ada0f2ae81b20a88db40b610
| * Remove quotes and escaping from debug logsOrgad Shaneh2018-07-031-18/+19
| | | | | | | | | | | | | | | | | | | | | | Before: qbs.exec: adding leaf "RULE [c_pch][c_pch_src] [test] located at F:\\Projects\\qt-creator\\build-qtc\\share\\qtcreator\\qbs\\share\\qbs\\modules\\cpp\\GenericGCC.qbs:616:18" After: qbs.exec: adding leaf RULE [c_pch][c_pch_src] [test] located at F:\Projects\qt-creator\build-qtc\share\qtcreator\qbs\share\qbs\modules\cpp\GenericGCC.qbs:616:18 Change-Id: Ia1bcc197b9ce71934febbde7515b5d71d3cde0db Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
* | Store the "out of date" flag per transformer rather than per artifactChristian Kandeler2018-06-291-8/+8
|/ | | | | | | That's a better fit. Change-Id: I3eff4ce461342b2966196da4e9aeff35544a38c4 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* Make RescuableArtifactData::children a std::vectorJoerg Bornemann2018-06-141-1/+1
| | | | | | | The value_type ChildData is not suitable for QList. Change-Id: I33057a739c26e36a7c6dabc44dad72262a05cdb0 Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
* Fix C4267 warningsJoerg Bornemann2018-06-141-1/+1
| | | | | | | | | This fixes the following warnings: executor.cpp(832): warning C4267: 'initializing': conversion from 'size_t' to 'int', possible loss of data executor.cpp(832): warning C4267: 'initializing': conversion from 'size_t' to 'const int', possible loss of data Change-Id: Ic23b855b8213a7b4feee81553233ad882a6c8ed2 Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
* Change tracking: Do not rescue outdated child artifactsChristian Kandeler2018-06-081-9/+12
| | | | | | | | | | | | | If a former child artifact is not in the list anymore after the rules applicator has run and it was not originally added as a result of scanning, then it is no longer a child artifact. We used to add these artifacts back to the list of children, so that an existing parent/child connection persisted even after changing the rule input tags in a way that the child would not match anymore. Change-Id: I700f515bbe5732bdb9251d48e3fc5ad53fb181cc Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io> Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* Mark parent artifacts explicitly as out of dateChristian Kandeler2018-05-181-0/+9
| | | | | | | | | | ... after a transformer finishes. This makes our "out of date" check independent of the local clock resolution for generated artifacts that do not have source artifacts as children. Change-Id: If3d47f1fd859c30846806fabaddf3b47a840a6d3 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Make ResolvedProject::products a vectorJoerg Bornemann2018-04-271-12/+12
| | | | | | | The value_type is not suitable for QList. Change-Id: If72af8998e9e1da37c8451bc6dc5925079be43dd Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
* Print debug output when the project's "dirty" flag is writtenChristian Kandeler2018-04-261-1/+1
| | | | | Change-Id: I67bac50beea4efb572b3299137ef52dc725647ee Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* Fix false positives in change tracking of exported modulesChristian Kandeler2018-04-121-2/+4
| | | | | | | ... by sorting some data structures. Change-Id: I59b0244d9e489e2d4445846f6a8c796e603837c5 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* Fix and rename the excludedAuxiliaryInputs propertyChristian Kandeler2018-04-051-2/+2
| | | | | | | | | | | | | | | | | | This property did not only exclude auxiliary inputs, but all kinds of inputs ("inputs", "auxiliaryInputs", "explicitlyDependsOn"), which happens to be what we want, as it does not appear to make any sense to exclude only tags from one of the relevant "input-like" properties. But the behavior was inconsistent: When building the (product-local) rule graph, the property was considered, but not when collecting artifacts from other products during rule application. This is now fixed. [ChangeLog] The excludedAuxiliaryInputs property of the Rule item has been renamed to excludedInputs. The old name is deprecated. Change-Id: Id7eae3461a6e85f53b3d47750d296c3e47a18a95 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io> Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
* Provide rules with information about the content of Export itemsChristian Kandeler2018-03-141-0/+4
| | | | | | | | | | | | | | | The product variable gets a new property "exports" that provides a "dependencies" array as well as property values the same way that the product variable itself does, but for exported dependencies and properties, respectively. In addition, meta data about these properties is provided via a "properties" array, and structural information can be retrieved via "childItems". This data is intended to be used by modules creating interface files from products. Task-number: QBS-268 Change-Id: I2bb106e1ca1b18abbd6fe60411bc81bda9ee35e7 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* Fix handling of rules whose outputs all have "alwaysUpdated == false"Christian Kandeler2018-02-261-8/+12
| | | | | | | | | It is wrong to always run the transformer in that case. If any of these outputs are up to date, then it must not be re-run. Change-Id: Ia79fba235d8829aad1d41c2c4288cc57d89434cc Reviewed-by: Ola Røer Thorsen <ola@silentwings.no> Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* Track accesses to product.artifactsChristian Kandeler2018-02-161-0/+4
| | | | | | | | ... and take the data into account when deciding whether to re-run rules and commands. Change-Id: Ib0f733028617eaa91cbf902c5537f30375900646 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* Move transformer change tracking out of the build graph loaderChristian Kandeler2018-02-161-1/+17
| | | | | | | | | | | | | | | | | | | | 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>
* Introduce dedicated type for command listsChristian Kandeler2018-02-151-1/+1
| | | | | | | Mainly to streamline the serialization calls. Change-Id: Ia54d51a193b2db52dab66d36e526f8516c15f20a Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* Merge 1.11 into masterChristian Kandeler2018-02-021-9/+48
|\ | | | | | | Change-Id: Id4986b2170ac13bf8931656659f6f60432cdbe8d
| * Merge 1.10 into 1.11Christian Kandeler2018-01-311-9/+48
| |\ | | | | | | | | | Change-Id: I2d6cac6f24144c2c7e463ef7eed2e2c109f50bbf
| | * Clean up the list of file dependencies before buildingChristian Kandeler2018-01-301-9/+48
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | After adding an external file dependency, we would never remove it from the global list again, meaning the look-up table would contain stale entries if an external header file was moved around. Because we still checked the status of the artifact-local list of dependencies, the result was that in such a situation, the files including such a header would get recompiled on every build. [ChangeLog] Fixed constant rebuilding after moving an external header file. Task-number: QBS-1285 Change-Id: Id764da7485dd540f2ff64bcd890e43723f18e6cd Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* | | Implement change tracking for the product.dependencies arrayChristian Kandeler2018-01-291-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | We added change tracking for the elements of the array in 898d09d479, but the array itself was not covered. Change-Id: I7d4083e8bf77f52e1f4a3b5da85ba13cf52fe750 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* | | Make ProductBuildData a proper class with accessors and modifiersChristian Kandeler2018-01-231-14/+14
| | | | | | | | | | | | | | | | | | | | | | | | We will need to keep track of some mutating accesses in a follow-up change. Change-Id: I8b3c92f6cca0f5dceb35ef7559cc1357cdf38656 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* | | Use 'auto' keywords more for the allocated variablesDenis Shienkov2018-01-231-1/+1
|/ / | | | | | | | | Change-Id: I25ec97e64522d7fa486fcf408d8134cbbd8b24ea Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* | Executor: Add missing check for module target artifactChristian Kandeler2018-01-121-0/+2
| | | | | | | | | | | | | | | | Such files are not to be matched against Rule.inputs. This part was forgotten in 8ca922793f. Change-Id: I0a01b3642f4a16c09d189e8c2228205fd0e9962b Reviewed-by: Jake Petroules <jake.petroules@qt.io>
* | Executor: Improve unbuilt products outputChristian Kandeler2018-01-051-2/+6
| | | | | | | | | | | | | | | | | | | | | | | | It is helpful to print a list of unbuilt products after a failed build, but putting each one on a line of its own takes up too much space for larger projects, potentially scrolling the actual error message(s) out of view. Put the product names on one line instead. Also sort them, so users can easily look for a specific product. Change-Id: Ib21b987196350264462940dade2f6af2625a2e81 Reviewed-by: Jake Petroules <jake.petroules@qt.io>
* | Remove as many dynamic_casts as possibleChristian Kandeler2017-11-301-11/+15
| | | | | | | | | | | | | | | | According to our benchmarker, this speeds up rule execution by three per cent. Change-Id: Iaf146ba6073b897d19e0fe470d7b0dc4a04d264c Reviewed-by: Jake Petroules <jake.petroules@qt.io>