summaryrefslogtreecommitdiff
path: root/src/lib/buildgraph/buildgraph.h
Commit message (Collapse)AuthorAgeFilesLines
* introduce class BuildGraphNodedynablasterJoerg Bornemann2013-11-271-16/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Do some build graph sanity checks.Christian Kandeler2013-09-301-0/+2
| | | | | | | Check some invariants after resolving, restoring and change tracking. Change-Id: I84e92d6f16a96d4a54c928e8cebc06efbf8fde2c Reviewed-by: Joerg Bornemann <joerg.bornemann@digia.com>
* fix calling of prepare script functionJoerg Bornemann2013-09-241-0/+2
| | | | | | | | | The scope that contains inputs, outputs and friends was bound to the function object, which is wrong when applying the function later on. Instead, we're passing those variables as function arguments now. Change-Id: I7ad7b6a742091fae889ed57b7c9cbceea4a2ead2 Reviewed-by: Christian Kandeler <christian.kandeler@digia.com>
* Fix a number of bugs uncovered by a recent leak fix (ff5b33b82b).Christian Kandeler2013-09-111-4/+9
| | | | | | | | | | | | | | | To name just a few: - Product removal, adaptation and re-resolving/swapping build data was done in the wrong order, resulting in outdated information still being present and necessary new one not being there yet. - Outdated artifacts were deleted too early, so that look-ups into the old project build data would cause undefined behavior. - The list of products whose file list was changed could contain the same entry twice, causing asserts when the same code was run again for the same product. Change-Id: I0c318fb18d5a8293d863ea6802203200941b9b7b Reviewed-by: Joerg Bornemann <joerg.bornemann@digia.com>
* Better handling of property changes when restoring a build graph.Christian Kandeler2013-08-141-0/+4
| | | | | | | | | | | | If a property change is discovered in any given product, the current code throws away the whole build graph, generates a new one and then re- inserts selected data from the old one. With this patch, we only regenerate the build data of the affected product (and still re-insert some existing data into it as to not rebuild artifacts that are up to date). Change-Id: I49e475c66dfb84ad20253ab53daf25acfe5a738b Reviewed-by: Joerg Bornemann <joerg.bornemann@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 BuildGraphLoader into its own set of files.Christian Kandeler2013-06-191-40/+0
| | | | | Change-Id: Icd11a83337a34d3544bfd59c1ab93c9d2ccb4dea Reviewed-by: Joerg Bornemann <joerg.bornemann@digia.com>
* Allow installing without building.Christian Kandeler2013-06-171-13/+14
| | | | | | | Task-number: QBS-310 Change-Id: I22139a8c537ded6553f9dc326bb202b1b871c0ee 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>
* fix tracking of addition/removal of Q_OBJECT headersJoerg Bornemann2013-06-101-0/+1
| | | | | | | Autotest: TestBlackbox::missingQObjectHeader Change-Id: I96127c47dfd3a2e38801dc1305ce7f9c528a94e3 Reviewed-by: Christian Kandeler <christian.kandeler@digia.com>
* fix crash when removing Q_OBJECT headerJoerg Bornemann2013-06-071-1/+1
| | | | | | | We accidentally deleted artifact objects twice. Change-Id: I8d7af93ca9733ada64fe6c882401eb0f80ace9d6 Reviewed-by: Christian Kandeler <christian.kandeler@digia.com>
* Pass the environment to be used as part of the setupprojectparametersTobias Hunger2013-06-061-1/+3
| | | | | | | | | | | 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>
* Remove structural redundancy in project and product classes.Christian Kandeler2013-04-121-2/+52
| | | | | | | | | | | | | | | 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>
* remember product properties used in prepare scriptsJoerg Bornemann2013-03-251-1/+3
| | | | | | | | Preparation for tracking property changes. Task-number: QBS-6 Change-Id: I2d3852a4aaca116d70d9dbcbe0a202e104765737 Reviewed-by: Christian Kandeler <christian.kandeler@digia.com>
* Remove global log sink.Christian Kandeler2013-02-061-4/+5
| | | | | | | | | | | | | | | 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>
* update copyright yearJoerg Bornemann2013-01-091-1/+1
| | | | | Change-Id: Ic2962e57ede037b910d7e77b01b0163f0a22cb7d Reviewed-by: Christian Kandeler <christian.kandeler@digia.com>
* Remove the BuildGraph class.Christian Kandeler2012-12-051-35/+17
| | | | | | | | Its only contents were static member functions, which now become free functions. Change-Id: If854e6804626beddcc918d0aea155e07fd945577 Reviewed-by: Joerg Bornemann <joerg.bornemann@digia.com>
* Split up buildgraph.h and buildgraph.cpp.Christian Kandeler2012-12-041-185/+11
| | | | | | | 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-55/+23
| | | | | Change-Id: I5da16ea99bce3e6f737f37770fb0fe3e2e5c0214 Reviewed-by: Joerg Bornemann <joerg.bornemann@digia.com>
* Slash more heads off the BuildGraph hydra.Christian Kandeler2012-11-291-28/+21
| | | | | | | | | | | 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>
* Make header guards unique.Christian Kandeler2012-11-291-3/+3
| | | | | | | | | We add a "QBS_" prefix everywhere to reduce the chance of clashes with header files from somewhere else. This is especially important for the headers to be included in client code. Change-Id: I2fe8de250073a79f4ae9a4237569c21a980f7c85 Reviewed-by: Joerg Bornemann <joerg.bornemann@digia.com>
* Reduce compile dependencies.Christian Kandeler2012-11-291-41/+35
| | | | | | | | | | | | | | | | | 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>
* Rip more functionality out of the BuildGraph class.Christian Kandeler2012-11-281-33/+66
| | | | | | | This is part of our ongoing quest to untangle this unholy mess. Change-Id: Icfb7a0ee955bfe33ee5bf5356a7fd80aeb6dddab Reviewed-by: Joerg Bornemann <joerg.bornemann@digia.com>
* Make the public API asynchronous.Christian Kandeler2012-11-271-3/+4
| | | | | | | | | | | | | | | | | | | 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>
* Make Ctrl-C more responsive.Joerg Bornemann2012-11-231-0/+2
| | | | | | | Check for cancelation in the loading stage and while applying rules. Change-Id: Ic192a74017e0d263b8e8f6d2d6fbb8443a09ce68 Reviewed-by: Christian Kandeler <christian.kandeler@digia.com>
* Move build root information out of BuildGraph.Christian Kandeler2012-11-151-15/+4
| | | | | | | | | | | | | | | | | With the current implementation, we would need to create a new QbsEngine object for every project file. Instead, attach a build directory to every ResolvedProject. Also remove ResolvedProduct::buildDirectory, since it is the same for all products in a project. Along the way: - Integrate BuildProject::restoreBuildGraph() into BuildProject::loadProject(). The latter currently just forwards to the former for no apparent reason. - Remove some checks for things that can never happen. - Remove unused metatype declaration for internal class. Change-Id: Ib97b37ddfdc0f4f4334449f64cde1a33eda4316d Reviewed-by: Joerg Bornemann <joerg.bornemann@digia.com>
* use ArtifactList where applicableJoerg Bornemann2012-11-131-3/+3
| | | | | Change-Id: I60c6230dc1d00e2816c5da654c6d8b916c4d2b99 Reviewed-by: Christian Kandeler <christian.kandeler@digia.com>
* Get rid of some raw pointer members ...Christian Kandeler2012-11-131-3/+5
| | | | | | | | | | | | | | | ... where they actually point to objects held in shared pointers elsewhere. In such cases, use shared pointers when possible and weak pointers when necessary. Beside better self-documentatiom, this also enables us to get rid of some ugly loops that were needed to get from the raw pointer value back to the shared equivalent. (We ignore members held in the Artifact class for now as to not complicate the patch.) Change-Id: Icc47c790835c4d144ddab5c1de65fc2c5de5e4c7 Reviewed-by: Joerg Bornemann <joerg.bornemann@digia.com>
* Move cycle detection into its own class.Christian Kandeler2012-11-121-4/+1
| | | | | | | | | It has the characteristics of a visitor, so let's make it one. Also introduce test case. Change-Id: Ibfe14ca71268f73afe5e524fa1a15b3ab67058f1 Reviewed-by: Joerg Bornemann <joerg.bornemann@digia.com>
* Executor: out-of-date check revisitedJoerg Bornemann2012-11-121-2/+2
| | | | | | | | | | | | | Only for source artifacts and file dependencies the physical timestamp is retrieved. The timestamp of generated artifacts is the last build time of the artifact and is stored in Artifact::timestamp. Much simpler code and less stat'ing. Task-number: QBS-154 Change-Id: I96f23e911f221f1cf3af5a76df01593bb9a19033 Reviewed-by: Christian Kandeler <christian.kandeler@digia.com>
* Introduce central translation context.Christian Kandeler2012-11-121-3/+0
| | | | | | | | Let's have a central class for doing translations in the library, instead of sprinkling Q_DECLARE_TR_FUNCTIONS all over the place. Change-Id: I73b7a299356305cc903663f3d59b128afe4ec263 Reviewed-by: Joerg Bornemann <joerg.bornemann@digia.com>
* Introduce namespace Internal.Christian Kandeler2012-11-081-2/+3
| | | | | | | | | This makes it obvious at first glance which facilities are for public use and which are not, which should be useful especially for clients of the library. Change-Id: I7f74f13b5c8a4c63a1de57bf607084a3a3852653 Reviewed-by: Joerg Bornemann <joerg.bornemann@digia.com>
* rename ResolvedProduct::uses and BuildProduct::usingsJoerg Bornemann2012-11-071-1/+1
| | | | | | | | Both members are now just called "dependencies", because that's what they are. Change-Id: Iad698ef82a540c54948f9dfcd174ca8f3b8d6995 Reviewed-by: Christian Kandeler <christian.kandeler@digia.com>
* Rename classes.Christian Kandeler2012-11-061-5/+5
| | | | | | | | | The central class of the public API should have a name that suggests its role to clients, so we call it "QbsEngine". The class currently using this name is now called "ScriptEngine". Change-Id: I77eba4618a3e1313c2d3a43fe29585aad638da4e Reviewed-by: Joerg Bornemann <joerg.bornemann@digia.com>
* Do product filtering at an earlier stage.Christian Kandeler2012-11-061-0/+1
| | | | | | | | | | | | | It is unintuitive and confusing to give the Sourceproject and the Executor a list of projects as part of their build() operations, when in reality just some products should be built. So take the "selectedProducts" out of the Buildoptions and do the filtering outside of the library. This way, we can tell the API "build these projects" or "build these products" and it will mean exactly that. Change-Id: I88860a9cf7f4058145964b1b56b01e7970c9e8d0 Reviewed-by: Joerg Bornemann <joerg.bornemann@digia.com>
* Revert "Rename classes."Christian Kandeler2012-11-061-5/+5
| | | | | | | | This reverts commit c39e9a0715c4469c78a1e797426db6d94df51c4c The commit is correct in principle, but was prematurely merged and should have been based on an additional patch. Change-Id: Id5920491fa948ac48f304797f5ec959b28e9ac25 Reviewed-by: Christian Kandeler <christian.kandeler@digia.com>
* Rename classes.Christian Kandeler2012-11-061-5/+5
| | | | | | | | | The central class of the public API should have a name that suggests its role to clients, so we call it "QbsEngine". The class currently using this name is now called "ScriptEngine". Change-Id: I6c3e6d5770ac8b096d9515cbe5762fe97346ab7e Reviewed-by: Joerg Bornemann <joerg.bornemann@digia.com>
* Add some more documentation.Christian Kandeler2012-10-291-1/+1
| | | | | | | | Also rename "RuleScript" to "PrepareScript" to make it more obvious to which item it corresponds in a qbs source. Change-Id: I175446c7359091ff26a3dec81e8cd6eb66406d2d Reviewed-by: Joerg Bornemann <joerg.bornemann@digia.com>
* Move the PersistentObject class into its own header.Christian Kandeler2012-10-291-1/+1
| | | | | | | | | | | | At the moment, every declaration of a class inheriting from PersistentObject has to include the template-heavy persistence.h file, causing it to transitively be included in pretty much every source file. By decoupling PersistentObject from that header, we get rid of a bunch of unneeded compile dependencies, speeding up compilation in general and especially if something in persistence.h changes. Change-Id: I1a95390015f75bdfca0d139144fa5c54c7971dc4 Reviewed-by: Joerg Bornemann <joerg.bornemann@digia.com>
* Remove redundant QDataStream parameter from serialization functions.Christian Kandeler2012-10-291-4/+4
| | | | | | | It's *always* PersistentPool::stream(). Change-Id: I379fda58be843ab40c10f3af2fbbbda2ba12e50c Reviewed-by: Joerg Bornemann <joerg.bornemann@digia.com>
* Do not store the main project's qbs file path in the build graph.Christian Kandeler2012-10-261-2/+2
| | | | | | | | | | There is no value in storing it, since we always get the top-level project file as an input. Also, things currently break when renaming the project file, because the loader will try to open the saved location instead of the real one. Change-Id: I3b09c84eb589c0ea0ea6c4634b9d6ba3643c96dd Reviewed-by: Joerg Bornemann <joerg.bornemann@digia.com>
* remove unused member from BuildGraphJoerg Bornemann2012-10-251-1/+0
| | | | | Change-Id: If73638993f1676a660a1575ab516ff8c0bb851b1 Reviewed-by: Christian Kandeler <christian.kandeler@digia.com>
* Buildgraph: Factor out rule application.Christian Kandeler2012-10-251-12/+34
| | | | | | | | | | | Applying a rule involves calling a number of functions in the build graph that are not used for any other purpose, so make these member functions of a dedicated class. Reduce the number of arguments of these functions by making the common arguments members of that class. Change-Id: Ic99a0127480366ce518246766b69c3c644d6ca9b Reviewed-by: Joerg Bornemann <joerg.bornemann@digia.com>
* Flatten build directory structure.Christian Kandeler2012-10-231-5/+3
| | | | | | | | | Get rid of the "build" directory level, which does not seem to serve a purpose, given that we must be in some project-specific build dir anyway. Change-Id: Ifa1c374caf988f9a76f7d40cb4bdc5c59c843822 Reviewed-by: Joerg Bornemann <joerg.bornemann@digia.com>
* add missing ConstPtr typedefsJoerg Bornemann2012-10-171-0/+2
| | | | | Change-Id: I5878e33721077bab3247fdefc07ab5b11ab0b3fe Reviewed-by: Christian Kandeler <christian.kandeler@digia.com>
* fix misuse of Configuration classJoerg Bornemann2012-10-161-2/+2
| | | | | | | | | | The Configuration class is the set of properties that is attached to a product or an artifact. Do not misuse this as build configuration to set up the build. Change-Id: Idfdaae2ddbe205292e054772d51562a0162a308a Reviewed-by: Christian Kandeler <christian.kandeler@digia.com> Reviewed-by: Joerg Bornemann <joerg.bornemann@digia.com>
* Clean up main().Christian Kandeler2012-10-161-1/+1
| | | | | | | | | | | - Modularize: Move implementations of all top-level commands into their own functions. - Move a couple of checks to places where they belong better. - Remove graph dumping functionality. As a result, the code flow is now much more obvious. Change-Id: I571e07965d10c3b79da4c40e977c95e5626e8a5d Reviewed-by: Joerg Bornemann <joerg.bornemann@digia.com>
* remove unused method BuildProject::loadBuildGraphJoerg Bornemann2012-10-151-5/+0
| | | | | Change-Id: Id12a8b220e4b66c3c16a1fb314bdf98a4ba2910f Reviewed-by: Christian Kandeler <christian.kandeler@digia.com>
* share one QbsEngine with Loader and BuildGraphJoerg Bornemann2012-10-121-1/+1
| | | | | Change-Id: I972bea425982baaf3edc330bc88973f78014710b Reviewed-by: Christian Kandeler <christian.kandeler@digia.com>
* move BuildGraph::dump to BuildProduct::dumpJoerg Bornemann2012-10-121-1/+1
| | | | | | | It's doesn't access members of BuildGraph. Change-Id: I3dddaac6a0fcf762c950624726a045807af2a16f Reviewed-by: Christian Kandeler <christian.kandeler@digia.com>