aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/corelib/buildgraph/rulesevaluationcontext.cpp
Commit message (Collapse)AuthorAgeFilesLines
* 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>
* Guard QScriptEngine's creation/destruction with a mutexJoerg Bornemann2018-02-281-1/+1
| | | | | | | | | | | | | | | | | | When building multiple configurations in one go we create one QScriptEngine per configuration, each in its own thread, but nearly at the same time. It turns out that QScriptEngine's creation/destruction is not thread-safe, which leads to all kinds of interesting effects in the multiple configurations case. We fix this by guarding creation/destruction of QScriptEngine with a mutex. Task-number: QBS-1308 Change-Id: Ie01733d5943f1fb89e1d25344c4ffa998095e394 Reviewed-by: Christian Kandeler <christian.kandeler@qt.io> Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* Use nullptr to initialize the pointersDenis Shienkov2017-11-201-1/+1
| | | | | | Change-Id: I59d743f585410cb5c00d36a7b6f9a3e9d696d19e Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io> Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
* Clean up [q]fileinfo.h includesJoerg Bornemann2017-03-061-1/+0
| | | | | Change-Id: I9bc57750cf67d20f7c4fc7291c38de406078e339 Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
* Add ScriptEngine::isActive()Joerg Bornemann2017-01-101-5/+2
| | | | | | | | | Move the isActive flag from RulesEvaluationContext to ScriptEngine, because we will need in other places as well. This is a preparation for using the same fix for QBS-932 and QBS-782. Change-Id: Ifa003856f663c26f4e997a80fa660fd5aa758114 Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
* Give the two copies command.{cpp,h} non-ambiguous namesJake Petroules2017-01-051-1/+1
| | | | | | | | | | | The pair in tools/buildgraph becomes rulecommands.{cpp,h} The pair in parser becomes parsercommand.{cpp,h} This resolves a conflict which prevented compilation of the entire set of qbs sources with MSVC and the /Fo option. Change-Id: Ic909d02a230d8e59f3bf4d00fc895bf54739961a Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* Change style of #includes of Qt headersJake Petroules2017-01-041-1/+1
| | | | | | | | | | | | | | | | 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>
* Attach information about the context to our script engineChristian Kandeler2016-11-071-1/+4
| | | | | | | | Certain operations might want to know what the script engine is currently doing. This will be used in a follow-up commit. Change-Id: I90167c29e94e0f77c7d5ccf20787e9749434e728 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* Re-display warnings when loading a stored build graphChristian Kandeler2016-09-301-1/+1
| | | | | | | | | [ChangeLog] Warnings encountered during project resolving are now stored and will be re-displayed when the project is loaded. Task-number: QBS-1011 Change-Id: I5fa04d3d537866212abbdf739b09a254843de473 Reviewed-by: Jake Petroules <jake.petroules@qt.io>
* Update license headersIikka Eklund2016-08-291-14/+23
| | | | | | | | | | Patch-set 2 includes *.cpp *.c Every source file needs to have up-to-date license headers in order to pass ci. Change-Id: Ie6e493097af6f7dd6a8adff170eb856f496e689e Reviewed-by: Jake Petroules <jake.petroules@qt.io>
* Merge remote-tracking branch 'origin/1.5'Joerg Bornemann2016-06-081-1/+1
|\ | | | | | | | | | | | | | | Conflicts: doc/reference/items/transformer.qdoc share/qbs/modules/cpp/GenericGCC.qbs Change-Id: I45560834560019b18274c373c45651eb8aadd206
| * 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>
* | Revisit importing JS source codeJoerg Bornemann2016-05-101-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Import code without access to the activation object. Other script engines do not allow easy access to the activation object. The new import code evaluates the code to be imported in an anonymous function that returns an object containing all variables and functions that are declared on the top level. E.g. importing the following snippet var greeting = 'hey!'; function upperCaseGreeting() { return "HEY!"; } is evaluated as (function () { var greeting = 'hey!'; function upperCaseGreeting() { return "HEY!"; } return { greeting : greeting, upperCaseGreeting : upperCaseGreeting } })() This has the following advantages: - Imported JS files do not see variables/functions anymore that were defined in already imported JS files. - No specialities of QScriptEngine are used. Porting to another JS engine becomes easier. - The clearing of the import cache before evaluation of every rule can be removed which improves the performance of rule execution by 28 % (according to qbs_benchmarker). Change-Id: I2f635c3375a137a96c27abf89d04a27fdf2c3f23 Reviewed-by: Christian Kandeler <christian.kandeler@theqtcompany.com>
* | Do not use QScriptEngine::push/popScope in rule evaluationJoerg Bornemann2016-05-101-4/+3
|/ | | | | | | | | | | | | | | This functionality is undocumented, has its flaws and is unavailable in other JS engines. Use the following pattern instead to inject global variables without polluting the global namespace: QScriptValue g = engine.newObject(); g.setPrototype(engine.globalObject()); // set properties on g engine.setGlobalObject(g); engine.evaluate(...); engine.setGlobalObject(g.prototype()); Change-Id: I5f92da8cccfa23c3722740c1852a71fd50e8eb8a Reviewed-by: Christian Kandeler <christian.kandeler@theqtcompany.com>
* Remove dead codeJoerg Bornemann2016-04-121-3/+0
| | | | | | | | Remove code that removes the properties lastSetupProject and lastSetupProduct. They are never set. Change-Id: I2ec9fa84e05552f881fc3923f315267c89b43c17 Reviewed-by: Christian Kandeler <christian.kandeler@theqtcompany.com>
* Fix unwanted "concurrency" in Executor.v1.4.51.4Christian Kandeler2016-02-181-0/+5
| | | | | | | | | | | | | | | | | | | | | | | Script engine evaluation is interrupted once a second to check for cancel requests. At this time, jobs can finish, leading to the onJobFinished() slot being called while we are in the middle of executeRuleNode(). Possible effects: - The job that just finished was the only currently running one, and its transformer outputs have no parents. Then the Executor will think it's done, and higher-level code will free the evaluation context (and with it the engine). When script execution continues after the current round of events processing, a null pointer or freed memory will be accessed. - The job's transformer outputs do have parent artifacts. In this case, we are suddenly and most unexpectedly in executeRuleNode() twice, with the potential for all kinds of stunning behavior. Fix the problem by checking in the onJobFinished() slot whether the rules evaluation context is currently active and delaying slot execution if it is. Task-number: QBS-932 Change-Id: I03ca4f4ad844357e49d5acaddff066395a7f95cf 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>
* Update LicenseEike Ziller2015-01-261-6/+6
| | | | | Change-Id: I092fca9f950de1ba38826c33b155f86feae2770b 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>
* Move Qt profile setup into a dedicated library.Christian Kandeler2014-01-101-0/+116
Otherwise all changes to the implementation will have to be duplicated in IDEs. Change-Id: I61e6d4fa1ee9b724eb5d9de9f233dc915a6c8bc3 Reviewed-by: Joerg Bornemann <joerg.bornemann@digia.com>