summaryrefslogtreecommitdiff
path: root/src/lib/buildgraph/executor.cpp
Commit message (Collapse)AuthorAgeFilesLines
* introduce class BuildGraphNodedynablasterJoerg Bornemann2013-11-271-128/+223
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | To support different types of nodes in the build graph, we introduce the base class BuildGraphNode. Artifact now derives from BuildGraphNode. A - yet unused - RuleNode class is introduced that represents a rule in the build graph. Change-Id: Ie1ad5e7a9e65bfd5f99d3e824737516053de0f94 ***new artifacts hash in ProductBuildData Change-Id: I50521ec64f734bfb3662759076fa5e7912ac084e ***automoc fixup Change-Id: Ie2bb228ae38d63deccc600d67d283bc3beda9fec slightly nicer rule debug output Change-Id: I60ddef73cd7f0a67055f2d56e6dbe7fa45ddd450 create RuleNode objects and add them to roots Change-Id: I51a0f89b98cda524d34888ab758d7bd397d82f00 ***execute rule nodes on build Change-Id: I291c32868cd982e37393d6bc8d696f2b63fbff50 ***ArtifactSet::fromNodeSet Change-Id: I7586bcfbe43406c22b1ee1a1fd826beaa247164f ***update after rebase Change-Id: I5f73afc80b746b11eeb83aeadf29c2358accbab8 ***phonytarget Change-Id: I587b7e072e54b866e8d5ea37c874e6a8baa550e0 update after rebase Change-Id: I6017c0cbe9244fea04d513f53e3a2a85092bf962 skip nodes early We must skip Building and Built nodes. m_leaves can contain duplicates now. Change-Id: If275106a47c403a455103f4deeb20049548007f5 debug message Change-Id: I90e238eef72a8a02fb0a9f2c77715f5f15c1442d disable phony thingy Change-Id: I7bb60b850b96b65ab738c11e96c3a84cbe58d2f7 connect each output of a rule to the rule itself Change-Id: I159d76c4b63094058cc9a07ccc2d0b67c7ce06e6 TagScanner Change-Id: I4741e48cd674c0ca830ee1b4d05b59a8c542694f TagScanner deps Change-Id: If3e43a7ac25616cd151229684a085ac8ee787645 update after rebase Change-Id: I58d49a5ed1049a17733fc2154588f12c1cda53e6 only root tag scanners in product Change-Id: Ia94732a5632156a5ec3c5518c9596cd4cefac105 run TagScanners Change-Id: I869a183f2da23a43957a6df45dc5a1b30b10af92 TagScannerRunner Change-Id: Id3c5fac73e6fb84e56d6ab1d48a959f3677f7a67 crash fix Change-Id: Ie3c26dbed41ab4615915a08913c495868c3a8910 more TagScanRunner Change-Id: I80b79f101c0f4d802fb4f6515c0848e369fed066 handle removal of filetags Change-Id: Icdd8d05c2e26953f7b12d968aa5dfcc23928b9ba Qt4 build fix Change-Id: Ie5fcb64e36ddc5004003183bea7243536bc8ab15 do not waste space with type information Change-Id: I7b9354e6fceead228ba335723b9addeb701bef56 update nodes that must get new transformers Change-Id: I06cd7ffe606ae643393350c5959ef6475343929f update after rebase Change-Id: If080e664972f2950c12fd800a3e4b521e65dca3a only run tag scanners on changed sources And do not call RulesApplicator in bgloader. Change-Id: I5140c91c79a842dab933ad7b328100bdec13cb10 Conflicts: src/lib/buildgraph/buildgraphloader.cpp sketch of moc tagscanners impl Change-Id: I7736c2da1b1742bc3556ef660c163e6c32cbd4c9 Conflicts: share/qbs/modules/Qt/core/core.qbs MocTagScanner Change-Id: I87199e8f355b8b20cf2387f4d4190a20bddae0db fix lib.qbs Change-Id: Ibcb5bc290d3839b04828f8c9b155577634bcc9e4 moctagscanner split Change-Id: Iace5d48483c02b5d33d9ccd54ac07162bfc09d27
* prioritize artifacts by product when buildingJoerg Bornemann2013-11-141-9/+59
| | | | | | | | | | To prevent disk cache misses, esp. when using precompiled headers, we're prioritizing the artifacts we're building by product. Task-number: QBS-460 Change-Id: Iff2373147c2fe6f86ac79c9785c8c89260aba5b4 Reviewed-by: Christian Kandeler <christian.kandeler@digia.com>
* remove Artifact::topLevelProjectJoerg Bornemann2013-08-021-1/+1
| | | | | | | | Every artifact has a product now. That product points to its top level project. Artifact::topLevelProject can go. Change-Id: I7a7ec921043b64eec6c704128ae465fd9ef05031 Reviewed-by: Christian Kandeler <christian.kandeler@digia.com>
* move file dependencies to dedicated classJoerg Bornemann2013-08-011-24/+26
| | | | | | | | | File dependencies are a very simple variant of artifact. We save space and structure the code more clearly by introducing the FileDependency class. Change-Id: I36b95794f9d6d3d739ea4836ebc831848a89de98 Reviewed-by: Christian Kandeler <christian.kandeler@digia.com>
* add build option --check-timestampsJoerg Bornemann2013-07-231-0/+8
| | | | | | | | | Give users the possibility to force qbs to read the physical timestamps instead of using the stored timestamps. Task-number: QBS-303 Change-Id: I6010515b5e8f97ec0b91069cbc7d8a1b0931dce5 Reviewed-by: Christian Kandeler <christian.kandeler@digia.com>
* provide "compile single file" functionalityJoerg Bornemann2013-07-231-0/+9
| | | | | | | | | | To compile just one single file without any further effects, pass the file name to BuildOptions::setChangedFiles, and the file tags of the desired results to BuildOptions::setActiveFileTags. Task-number: QBS-283 Change-Id: I70213b248e1e07fd7524a54f7f2e4f250621967f Reviewed-by: Christian Kandeler <christian.kandeler@digia.com>
* Executor: do not throw in slotJoerg Bornemann2013-07-231-1/+1
| | | | | Change-Id: I95e2db29831104f9f5c917552e14cec68a0ded9e Reviewed-by: Christian Kandeler <christian.kandeler@digia.com>
* make job/executor signal/slot connections queuedJoerg Bornemann2013-07-051-4/+4
| | | | | | | | | | | | | This prevents call stacks like onProcessError ... scheduleJobs ... onProcessSuccess which destroys the executor's state handling. Change-Id: I2a98a368e3ed75f4d617389938c88809e68623f3 Reviewed-by: Christian Kandeler <christian.kandeler@digia.com>
* Improve handling of changes to restored build graph.Christian Kandeler2013-06-241-1/+1
| | | | | | | | | Instead of painstakingly inserting new product pointers into an existing build graph, do it the other way around and put existing build data into the newly resolved project. This is much more robust. Change-Id: If38e4a5e14c6a5faedb0c590e86aa5efc7844e39 Reviewed-by: Joerg Bornemann <joerg.bornemann@digia.com>
* Some minor improvements to the Error class.Christian Kandeler2013-06-181-9/+9
| | | | | | | | | | | | | - Rename "Error" to "ErrorInfo", to make clear that this class conveys information about errors, including that there might not actually be one. - Rename "ErrorData" to "ErrorItem", to make clear that these are parts of an aggregate structure. - Introduce ErrorInfo::hasError() for quick checking of whether an error occurred. Change-Id: Icea6ed5240d6d14bd30e9cea189c6babd7004792 Reviewed-by: Joerg Bornemann <joerg.bornemann@digia.com>
* Allow projects to be nested.Christian Kandeler2013-06-171-3/+3
| | | | | | | | | This is nice to have for grouping products and a requirement for aggregating existing projects into a bigger one. Change-Id: I3394642e95ea57dbc6bf1603cfed6902a5906e4c Reviewed-by: Joerg Bornemann <joerg.bornemann@digia.com>
* react on Ctrl-C when checking directory timestampsJoerg Bornemann2013-06-131-0/+5
| | | | | | | Task-number: QBS-317 Change-Id: Ie66f50d471ca02c24834cfaa83b32c625f663c44 Reviewed-by: Christian Kandeler <christian.kandeler@digia.com>
* fix tracking of addition/removal of Q_OBJECT headersJoerg Bornemann2013-06-101-22/+22
| | | | | | | Autotest: TestBlackbox::missingQObjectHeader Change-Id: I96127c47dfd3a2e38801dc1305ce7f9c528a94e3 Reviewed-by: Christian Kandeler <christian.kandeler@digia.com>
* Pass the environment to be used as part of the setupprojectparametersTobias Hunger2013-06-061-1/+1
| | | | | | | | | | | Pass in the environment to be used when resolving a project via the SetupProjectParameters. Store this environment and use it when building. Remove APIs for passing an environment when building. Change-Id: Icfd345bac27999b3e4191061a31d9df4f24cbd7f Reviewed-by: Christian Kandeler <christian.kandeler@digia.com>
* Fix misleading messages when canceling operations.Christian Kandeler2013-05-311-2/+2
| | | | | | | | | | The cause is not necessarily user intervention, but it is also possible that building for one configuration was stopped because a different one failed. Task-number: QBS-285 Change-Id: I248eda778c9cc7effa596a1d264da37d0e8348d6 Reviewed-by: Joerg Bornemann <joerg.bornemann@digia.com>
* Introduce ILogSink::printWarning().Christian Kandeler2013-05-281-1/+1
| | | | | | | | | | | To be called when warning about some issue in a specific file. Can be overridden to e.g. display the problematic location in an IDE. This replaces the BuildJob::reportWarning() signal. Task-number: QBS-284 Change-Id: Ib5c14f6793c5b59144bfd9ff7ae11ae94416b2b2 Reviewed-by: Tobias Hunger <tobias.hunger@digia.com> Reviewed-by: Joerg Bornemann <joerg.bornemann@digia.com>
* Use private implementation in API classes.Christian Kandeler2013-05-231-11/+11
| | | | | | | | | While we do not promise a stable ABI at the moment, this is conceptually correct and has to be done sooner or later, with increasing effort the longer we delay it. Change-Id: Icc98443974e54d377167480ace601db4981ed43c Reviewed-by: Joerg Bornemann <joerg.bornemann@digia.com>
* make Depends.name and Depends.submodules case sensitiveJoerg Bornemann2013-04-171-2/+2
| | | | | | | | | Also rename modules/qt to modules/Qt and use this form consequently. Task-number: QBS-254 Change-Id: I2e994f2bc5f93d4f887e14ac224ab360c54ad029 Reviewed-by: Christian Kandeler <christian.kandeler@digia.com>
* Pass the project to some operations in addition to a list of products.Christian Kandeler2013-04-161-7/+11
| | | | | | | | The list of products might be empty, in which case the project would not be accessible otherwise. Change-Id: Ifb41413439c64f8fdebee9c3f8826f45ae2fc673 Reviewed-by: Joerg Bornemann <joerg.bornemann@digia.com>
* Remove structural redundancy in project and product classes.Christian Kandeler2013-04-121-25/+26
| | | | | | | | | | | | | | | We had two project classes, each holding a list of products that was structurally identical, except that no BuildProduct object existed for a disabled ResolvedProduct. The same kind of duplication also happened for product dependencies. This patch gets rid of these parallel structures. BuildProject and BuildProduct are largely being demoted to data holders and are aggregated by ResolvedProject and ResolvedProduct, respectively. The resulting project structure should be easier to understand and maintain. Change-Id: I68beef60b9e0d62258f6a8337c9015864e18bd80 Reviewed-by: Joerg Bornemann <joerg.bornemann@digia.com>
* Mention the build configuration when giving updates on operations.Christian Kandeler2013-04-091-5/+12
| | | | | | | | | E.g. say "starting to build for configuration gcc-debug". This is especially useful when building for several configurations simultaneously. Change-Id: I441615d87be314ec819c2d2267a03fec770402eb Reviewed-by: Joerg Bornemann <joerg.bornemann@digia.com>
* Fix Qt Creator artifacts.Christian Kandeler2013-03-261-1/+1
| | | | | | | Stupid editor! Change-Id: I84c27d67d37413c7688b30e666503a73c7ab3146 Reviewed-by: Joerg Bornemann <joerg.bornemann@digia.com>
* fix usage of std::uniqueJoerg Bornemann2013-02-201-1/+2
| | | | | Change-Id: Ice227b0c91a7ccc77a039ec7f48569b17e261922 Reviewed-by: Christian Kandeler <christian.kandeler@digia.com>
* replace Q_ASSERT with QBS_ASSERT / QBS_CHECKJoerg Bornemann2013-02-141-17/+18
| | | | | Change-Id: I9f4d43b9b7be7e4ce814963d1feee81605a9d2eb Reviewed-by: Christian Kandeler <christian.kandeler@digia.com>
* Executor: catch exceptions in onProcessSuccess and onProcessErrorJoerg Bornemann2013-02-121-21/+38
| | | | | Change-Id: Ib54ee7d8e55777ad3a138d8f6e53bcd9b6d64c96 Reviewed-by: Christian Kandeler <christian.kandeler@digia.com>
* Don't start the Executor via QtConcurrent::run().Christian Kandeler2013-02-061-6/+10
| | | | | | | | | | | | | | | Since it calls QtConcurrent::run() itself further down the stack, it will deadlock on single-core systems. Alternatives: - Increase the size of the thread pool in such a case. Inacceptable for a library. (Even QThreadPool::reserveThread() messes with global state, if only temporarily.) - Document the requirement that there must be more than one thread in the thread pool (and possibly throw an error if that's not the case). Awkward. Change-Id: I5dc34e2c371fceab34f1f1fd3c492308f14088d2 Reviewed-by: Joerg Bornemann <joerg.bornemann@digia.com>
* Remove global log sink.Christian Kandeler2013-02-061-56/+69
| | | | | | | | | | | | | | | Applications may not want to use the same log sink for all builds. The logging facility is also decoupled from the command-line client in other ways: - The LogWriter modifiers for output channel and text color are gone, since this type of decision should not be made by low-level code. Instead, the "highlight" string can be forwarded to the log sink. - The console logger now lives in app/shared, as it must never be used by library code. Change-Id: I8863a554c9b74577320ef23f6f934a74e0f0cbb0 Reviewed-by: Joerg Bornemann <joerg.bornemann@digia.com>
* do not scan files that are currently generatedJoerg Bornemann2013-02-041-1/+5
| | | | | | | | | | We must not scan files that are in the state "Building". These files must be removed from the scan result cache. Inputs of dependents of these file must be scanned again in the next build round. Change-Id: Ic77f37ebc11224d16605701660ce09a8aaf6b194 Reviewed-by: Christian Kandeler <christian.kandeler@digia.com>
* Library: Take default build job count into account in Preferences.Christian Kandeler2013-02-011-2/+1
| | | | | | | | Makes the job easier for API users. Also make Preferences available via qbs.h. Change-Id: Ie3dd07badeed3df9357a9aa3e90e3a9e05d8844a Reviewed-by: Tobias Hunger <tobias.hunger@digia.com>
* Do not punish callers for not setting the maximum job count.Christian Kandeler2013-02-011-1/+6
| | | | | | | | Instead, set the fallback value in the Executor instead of the Preferences (which we cannot guarantee will be used by calling code). Change-Id: I7c52970807b2bfe07d57784362be5ecc3647ae9e Reviewed-by: Joerg Bornemann <joerg.bornemann@digia.com>
* Make sure no error messages are lost.Christian Kandeler2013-01-241-1/+1
| | | | | | | | | In certain cases, the Executor currently overwrites process errors with the generic "Products could not be built" message (e.g. if a process could not be started). Change-Id: I97bb0a1f4d3ba9b1ac94e7fbd8cb1c6831e353ce Reviewed-by: Tobias Hunger <tobias.hunger@digia.com>
* Report a proper Error in reportWarning().Christian Kandeler2013-01-171-3/+3
| | | | | | | | | | | It makes no sense to dissect the respective Error into its parts when reporting a warning and then propagating these parts up the abstraction levels. Just leave the Error object as it is; this simplifies the interface and reduces code as well as the number of signals being emitted. Change-Id: I1db2907f62bccb347471d3e01da0209dbb2877c6 Reviewed-by: Tobias Hunger <tobias.hunger@digia.com>
* Make better use of CodeLocation in Error.Christian Kandeler2013-01-171-1/+1
| | | | | Change-Id: Ibebe5b7d99557348ce43e6699c623dff7195a8d9 Reviewed-by: Tobias Hunger <tobias.hunger@digia.com>
* Allow for setting the environment to be usedTobias Hunger2013-01-151-2/+1
| | | | | | | | | | | In Creator we define an environment to run our builds in. Allow to pass the initial environment used by qbs. It will then modify this base environment and run JS and Process commands using that environment. Change-Id: If7c606da4fd754ee872b0256226ce90fe424fccf Reviewed-by: Joerg Bornemann <joerg.bornemann@digia.com>
* Fix "qbs -k".Christian Kandeler2013-01-141-1/+1
| | | | | | | | | While we did just emit a warning in that mode, we still canceled all the build jobs. Task-number: QBS-205 Change-Id: I6e6321cb9f682c91372f391fe22dd86f74334e55 Reviewed-by: Joerg Bornemann <joerg.bornemann@digia.com>
* Do not write directly into loggerTobias Hunger2013-01-111-7/+18
| | | | | | | | | | | Pass information up to the client instead so that it can decide how to handle it. This allows e.g. creator to parse compile output for build issues. Change-Id: I76be4eaeb289b211b7d2527b555536b556655492 Reviewed-by: Christian Kandeler <christian.kandeler@digia.com>
* update copyright yearJoerg Bornemann2013-01-091-1/+1
| | | | | Change-Id: Ic2962e57ede037b910d7e77b01b0163f0a22cb7d Reviewed-by: Christian Kandeler <christian.kandeler@digia.com>
* Better handling of recursive installation.Christian Kandeler2012-12-101-6/+24
| | | | | | | | | | If installation of a directory is requested, we now check the entire subtree for timestamp changes to catch things like file renamings. Task-number: QBS-174 Change-Id: I3e4aa7a3b297580acf8cb877e8627ad13b1831b8 Reviewed-by: Orgad Shaneh <orgads@gmail.com> Reviewed-by: Joerg Bornemann <joerg.bornemann@digia.com>
* Check for cancelation request also during moc'ing.Christian Kandeler2012-12-061-0/+2
| | | | | | | Task-number: QBS-168 Change-Id: I1d12f0fbc5a11898bb5802371654ddc24b73035e Reviewed-by: Joerg Bornemann <joerg.bornemann@digia.com>
* Remove the BuildGraph class.Christian Kandeler2012-12-051-6/+6
| | | | | | | | Its only contents were static member functions, which now become free functions. Change-Id: If854e6804626beddcc918d0aea155e07fd945577 Reviewed-by: Joerg Bornemann <joerg.bornemann@digia.com>
* Do not tolerate compiler warnings.Christian Kandeler2012-12-051-2/+1
| | | | | | | | This is especially useful for the test machines, as they might emit warnings we would otherwise miss. Change-Id: Id86c724ab250c0e5329de4b22b5c82b759f4fa9d Reviewed-by: Joerg Bornemann <joerg.bornemann@digia.com>
* Some engine-related optimizations.Christian Kandeler2012-12-051-33/+28
| | | | | | | | | | - Re-enable script program cache; it is safe to use now. - Create a new evaluation context only for the first build of a project. - To help with all of this, use a shared pointer for RulesEvaluationContext, as it does not have a clear owner. Change-Id: I90a7fcaf855573b756f29daff37038e98aa7c1fe Reviewed-by: Joerg Bornemann <joerg.bornemann@digia.com>
* Split up buildgraph.h and buildgraph.cpp.Christian Kandeler2012-12-041-6/+9
| | | | | | | Move things to the appropriate places. Change-Id: I2f201ccdf9c465a8c3201e229629b756cc258495 Reviewed-by: Joerg Bornemann <joerg.bornemann@digia.com>
* Move engine-related functionality out of BuildGraph.Christian Kandeler2012-12-031-20/+9
| | | | | Change-Id: I5da16ea99bce3e6f737f37770fb0fe3e2e5c0214 Reviewed-by: Joerg Bornemann <joerg.bornemann@digia.com>
* Slash more heads off the BuildGraph hydra.Christian Kandeler2012-11-291-1/+1
| | | | | | | | | | | This moves almost all state out of the class into more suitable places. The functionality left is: a) An engine wrapper that can be turned into a new dedicated class pretty much as-is. b) Static helper functions that do not naturally fit elsewhere. Change-Id: Ie3d79ecdcd58c02373fb852e9ff39659c0c4f07a Reviewed-by: Joerg Bornemann <joerg.bornemann@digia.com>
* Reduce compile dependencies.Christian Kandeler2012-11-291-14/+15
| | | | | | | | | | | | | | | | | While it seems elegant at first glance to do typedefs in class scope, it has one serious drawback: Forward declarations become impossible unless they use the non-typedef'ed type name, which defeats the purpose. As a result, dozens of headers currently include language.h and buildgraph.h, even though they technically don't have to. Fix this by introducing special forward-declaring headers and doing the typedefs there, outside the class scope. Now changes to header files included in language.h or buildgraph.h don't ripple through half the project anymore. Along the way, also remove unneeded and potentially harmful INCLUDEPATH statements from various pri files. Change-Id: Ib50db850876955216db7f39b6099c32d1239092b Reviewed-by: Joerg Bornemann <joerg.bornemann@digia.com>
* Sanitize the Executor code flow.Christian Kandeler2012-11-291-73/+58
| | | | | | | | | | | | | The current behavior is not exactly well-defined, mostly due to signals calling back on the Executor while it is calling a function on the object emitting the signal (e.g. waitForFinished()). These traps are now gone. Also make sure error messages are in a sensible order when a build is canceled. In addition, remove unused functionality. Change-Id: Icf35eb378995a55b5ba4fc6caea9492eccb43527 Reviewed-by: Joerg Bornemann <joerg.bornemann@digia.com>
* Ensure the Executor never emits error() more than once.Christian Kandeler2012-11-271-0/+2
| | | | | | | This makes things easier for higher-level code. Change-Id: I618531ae695fe088e37020c07646ebcc8db23f1a Reviewed-by: Joerg Bornemann <joerg.bornemann@digia.com>
* Make the public API asynchronous.Christian Kandeler2012-11-271-13/+16
| | | | | | | | | | | | | | | | | | | This simplifies things a lot for IDEs, which are no longer forced to run a dedicated thread for a QbsEngine, as everything on the calling side can now happen in the main loop. Getting rid of blocking operations also allows for more flexibility in that it is now possible to load one project while another is building etc. This patch also moves all the high-level types into src/lib/api/. Until now, they were scattered around language/ and tools/, where they do not belong. Very few things had to be touched in the back-end; most notable is the fact that BuildGraph's ScriptEngine is now settable, because we must exchange it between resolving and building, as the former operation runs in its own thread. Change-Id: I5c8a7cc3517ebc2489678c0d5b1068972997e930 Reviewed-by: Joerg Bornemann <joerg.bornemann@digia.com>
* Executor::cancelBuild: prevent recursion through signals/slotsJoerg Bornemann2012-11-231-1/+1
| | | | | | | | Set the canceled state as early as possible to bail out if cancelBuild gets called again as a result of a finished job. Change-Id: Icc3c08d7a64309e35ac0e17532d5a21468028b71 Reviewed-by: Christian Kandeler <christian.kandeler@digia.com>