aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/corelib/language/projectresolver.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Do not collect exported properties for disabled productsChristian Kandeler2018-06-191-0/+6
| | | | | Change-Id: I1d4e8a28485f421e3bcefe7e498fdc1a3ba99f98 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* Fix property values that are pure assignments of importsJoerg Bornemann2018-06-061-1/+15
| | | | | | | | Those were broken, because QScriptValue::toVariant() doesn't take QScriptValue::prototype() into account, which we set for imports. Change-Id: I571f7a4b63df08b1768f61bcc1d622f3730c2a73 Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
* Add new property explicitlyDependsOnFromDependenciesAlexandru Croitor2018-05-091-0/+2
| | | | | | | | | | | | | | | | This change adds new Rule item property called explicitlyDependsOnFromDependencies. It allows specifying a list of file tags to consider in dependent target artifacts which should be used as dependencies. [ChangeLog] The Rule item property explicitlyDependsOn no longer considers target artifacts of products that the processed product depends on. The new property explicitlyDependsOnFromDependencies can be used for that purpose. Change-Id: I47a80699fe881d4075b292ad164dd6e776049a83 Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
* Handle Depends.productTypes entirely in the ModuleLoaderChristian Kandeler2018-05-021-13/+2
| | | | | | | The old approach was not compatible with product multiplexing. Change-Id: Iac5947665c41c284fa9e177920fd4f225d353973 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* Make ResolvedProject::products a vectorJoerg Bornemann2018-04-271-6/+6
| | | | | | | The value_type is not suitable for QList. Change-Id: If72af8998e9e1da37c8451bc6dc5925079be43dd Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
* Make lists of SourceArtifactPtr vectorsJoerg Bornemann2018-04-261-1/+1
| | | | | | | The value_type is not suitable for QList. Change-Id: I5a0f238838a90fa9ca942711ce9376ce6b832d8e Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
* Make ResolvedProduct::artifactProperties a vectorJoerg Bornemann2018-04-261-3/+2
| | | | | | | The value_type is not suitable for QList. Change-Id: I73d021f0c635ed46992397c4d6e3f3394ec5a7f8 Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
* Make ProjectResolver::ProjectContext::rules a vectorJoerg Bornemann2018-04-261-2/+2
| | | | | | | The value_type is not suitable for QList. Change-Id: I5e6b77b97671dae26b9aea9950429b084b6c78bd Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
* Make ResolvedProduct::fileTaggers a vectorJoerg Bornemann2018-04-261-2/+2
| | | | | | | The value_type is not suitable for QList. Change-Id: I0810dcf8f2c9977aa3f86ecdbdb02ca6dd51facb Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
* Do not use QRegularExpressionJoerg Bornemann2018-04-191-5/+5
| | | | | | | | | Use only one regexp engine. This makes bootstrapping easier. Change-Id: Ifa24a9850b3a880b5a4068e9b3990ab986705361 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
* Remove the deprecated Product.profile propertyChristian Kandeler2018-04-131-4/+2
| | | | | | | It was not used anywhere anymore. Change-Id: I420c40f562634159e838a805aeedbefb89185c75 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* Fix false positives in change tracking of exported modulesChristian Kandeler2018-04-121-2/+14
| | | | | | | ... by sorting some data structures. Change-Id: I59b0244d9e489e2d4445846f6a8c796e603837c5 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* ProjectResolver: Queue errors until all products have been processedChristian Kandeler2018-04-101-12/+14
| | | | | | | | | | This way, we can make users aware of all relevant errors at once, while not also flooding them with irrelevant errors from products that are disabled. Task-number: QBS-1334 Change-Id: I744621ff3a40277053ebf0e70748da0399241b48 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* Exporter support: Correctly detect use of importsChristian Kandeler2018-04-061-3/+4
| | | | | | | ... of the form "var obj = Data". We did not consider this case so far. Change-Id: I665ef26849e21cbb8c8b39f3a7d016d4126d279c Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* Sort the list of exported import statementsChristian Kandeler2018-04-061-0/+1
| | | | | | | Otherwise we can get false positives in change tracking. Change-Id: I32d8284910c8e3da5a17966bd5585c65c0521420 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* Fix and rename the excludedAuxiliaryInputs propertyChristian Kandeler2018-04-051-2/+6
| | | | | | | | | | | | | | | | | | 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>
* Fix using the prefixMapping property in a Properties itemChristian Kandeler2018-03-141-1/+1
| | | | | | | | This property must be skipped in the property declaration check as well as for exporting purposes. Change-Id: I250e1ef752c9bb288d5aecd455ef022dd304aa84 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* Provide rules with information about the content of Export itemsChristian Kandeler2018-03-141-56/+426
| | | | | | | | | | | | | | | 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>
* Add new property type "varList"Christian Kandeler2018-03-131-0/+2
| | | | | | | | | | | While we could already assign arrays to variant properties, these would not have list semantics when merging modules, so this fills a gap in our type system. [ChangeLog] Added new property type "varList". Change-Id: I54581119f60582f2b11290e13cd4920fd72f55a1 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* AST visitor: Keep Properties items that are children of Export itemsChristian Kandeler2018-03-091-0/+1
| | | | | | | We will need them to be present at a later stage in a follow-up patch. Change-Id: Iee376fadfc22a572c61b9f264b44f45897270b25 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* Do not apply file tags filter to target artifacts of modulesChristian Kandeler2018-02-191-1/+3
| | | | | | | These do not conceptually belong to the product. Change-Id: Ic55cf246fe38ba7ad03563b5f67a8622810dad7d Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* Remove defaultValue argument from Evaluator::boolValue()Christian Kandeler2018-02-121-1/+1
| | | | | | | | | | The few usages either made no difference or were plain wrong. In particular, it makes no sense to return a default value if the RHS of the property assignment evaluates to undefined, as "undefined" usually implies "false" for bool properties. Change-Id: I46d563712b2778ef82fa88f49a3229e451782a50 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* Mark values that were set up as the defaults of built-in item propertiesChristian Kandeler2018-01-051-1/+1
| | | | | | | | | | | There are several contexts in which we need to find out whether a property value of a built-in item is the default one that was created by us when initializing the item. Rather than using heuristics for that, we now set a flag on such values, so we can always get the correct information. Change-Id: Ieb0d87a423d6c6836a2c1d60ccf503fa0b4f801b Reviewed-by: Jake Petroules <jake.petroules@qt.io>
* Re-use VariantValue objectsChristian Kandeler2017-11-301-1/+1
| | | | | | | | | | | | | | | | These objects are self-contained, i.e. they have no additional context such as a scope. Therefore, there is no need to have more than one VariantValue for the same QVariant. We now share VariantValue objects for true, false and default QVariant, which is easy to do, has no trade-offs such as requiring a map and is enough to bring down the number of VariantValue objects by over 50% for larger projects. The overall memory savings are nothing to write home about (because there are far more JSSourceValues), but doing fewer allocations cannot be a bad thing. Change-Id: Ic0c1a5cbcf3bfd8e1ee06fa71899002e899f1202 Reviewed-by: Jake Petroules <jake.petroules@qt.io>
* corelib: Gather string constants in central placeChristian Kandeler2017-11-291-70/+82
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The same string literals appeared over and over again in the code base, causing redundancy in the sources as well as at run-time. We now give them a name and make sure they get instantiated at most once. String literals that occur only once are converted from QLatin1String to QStringLiteral unless they appear only in contexts that make use of QLatin1String overloads or they are clearly outside of any hot code paths. This seems to result in small, but measurable performance improvements, even if we assume the 1% changes to be noise: ========== Performance data for Resolving ========== Old instruction count: 3266514138 New instruction count: 3209355927 Relative change: -2 % Old peak memory usage: 29649896 Bytes New peak memory usage: 29436264 Bytes Relative change: -1 % ========== Performance data for Rule Execution ========== Old instruction count: 3367804753 New instruction count: 3319029596 Relative change: -2 % Old peak memory usage: 19577760 Bytes New peak memory usage: 19091328 Bytes Relative change: -3 % ========== Performance data for Null Build ========== Old instruction count: 608946535 New instruction count: 604566001 Relative change: -1 % Old peak memory usage: 14606384 Bytes New peak memory usage: 14579936 Bytes Relative change: -1 % Change-Id: Ia055a52e0a4b6fe6fd0f1e7ba4bfa583cba1b0ef Reviewed-by: Jake Petroules <jake.petroules@qt.io>
* Replace more loops with range-forJake Petroules2017-11-271-2/+2
| | | | | | | | ...or raw iterators for reverse iterations. Change-Id: I62a110ceeefaf70aaa41f6fb09d811f0eac05657 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io> Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
* Share ScriptFunction objects between productsChristian Kandeler2017-11-231-11/+13
| | | | | | | | | | | The source code of script functions does not differ among module instantiations, so there's no need to give each product its own copy. For example, resolving the QtCreator super project now allocates about 80 of these objects, rather than 16000, each of which had their own unshared copy of the script source code. Change-Id: I10d67991ce170826346d434fe58ea6608fa18a1f Reviewed-by: Jake Petroules <jake.petroules@qt.io>
* STL compatibility: use push_back() instead of append()Jake Petroules2017-11-221-1/+1
| | | | | | | | | | ...or operator<< if the argument was itself a list, or brace init where appropriate. This is a simple find and replace with manual sanity check. Change-Id: I94b79cbf3752192dd258001bf1dfcd46f58ca352 Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
* Use nullptr to initialize the pointersDenis Shienkov2017-11-201-3/+3
| | | | | | Change-Id: I59d743f585410cb5c00d36a7b6f9a3e9d696d19e Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io> Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
* STL compatibility: use push_back() instead of operator<<Jake Petroules2017-11-161-15/+15
| | | | | | | ...and operator+= Change-Id: I848610544cacc2d187d601c0db567703c3e68c93 Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
* STL compatibility: use empty() instead of isEmpty()Jake Petroules2017-11-161-17/+17
| | | | | | | This is a simple find and replace with manual sanity check. Change-Id: Iab6d46dcc3be246d1650aae2b1730f933b717be8 Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
* STL compatibility: use size() instead of count()Jake Petroules2017-11-151-8/+8
| | | | | | | This is a simple find and replace with manual sanity check. Change-Id: Ia733befe7885dc3c643d5c84e151312bfd86a3c6 Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
* Amend some function signatures to take raw pointersChristian Kandeler2017-11-151-1/+1
| | | | | | | Preparation for a follow-up patch. Change-Id: Iec86f2719d5fee1ca8a564b37baf44f13a8db5cc Reviewed-by: Jake Petroules <jake.petroules@qt.io>
* Do not store argument names in ScriptFunction objectsChristian Kandeler2017-11-151-1/+0
| | | | | | | These are fixed and always available from the calling context. Change-Id: Ibdf55de1fdb0c1819ae8afa6d44e54ebb3e126d7 Reviewed-by: Jake Petroules <jake.petroules@qt.io>
* Remove unnecessary indirection from property mapsChristian Kandeler2017-11-081-16/+8
| | | | | | | | The top-level "module" entry has not been needed ever since we separated the product properties and module properties maps. Change-Id: Ic669a6c76206c87ee6458e5528c2a55d1c55bac1 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* Enable modules to declare target artifactsChristian Kandeler2017-11-071-0/+4
| | | | | | | | | | | | | Such artifacts appear to rules just like target artifacts of products. This functionality will be useful for auto-generating qbs modules from products. [ChangeLog] Modules can now declare target artifacts using the new filesAreTargets property of the Group item. Task-number: QBS-882 Change-Id: I3bba000be9a1057d9fef01e5576363719ff1f244 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* Always mention the affected product for errors during project resolvingChristian Kandeler2017-10-261-15/+17
| | | | | | | | | This is particularly useful for errors that occur when evaluating module properties, as the location where the error occurs usually gives no hint as to which product is involved. Change-Id: I92e5e23064c5d82f114d0144c41064276fd0491d Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* ProjectResolver: Sanitize error handlingChristian Kandeler2017-10-251-55/+111
| | | | | | | | | | | | | | There was lots of ad-hoc code dealing with errors, introduced by different patches dealing with concrete bugs in an isolated manner. Instead, we now use a structured approach that should reliably satisfy the constraints of both command-line and IDE mode, handling errors only on the project, product and group level. The most visible effect of this is that we no longer run the risk of emitting errors from disabled products, e.g. while evaluating properties or file lists. Change-Id: I0a27ff9d3f1f398d429c22d3ca2628b43f2e7879 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* Add a product back pointer to ResolvedModuleChristian Kandeler2017-10-201-0/+1
| | | | | | | Will be used in a subsequent commit. Change-Id: I349154bf8735be700ae3d7da15282a9c6c50acdb Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* Use ranged-based for loops where applicableJoerg Bornemann2017-09-191-2/+1
| | | | | Change-Id: Iad8468472cb585b919f0c463e45d091d6f5395ae Reviewed-by: Jake Petroules <jake.petroules@qt.io>
* Remove currently unused informationJoerg Bornemann2017-08-301-1/+0
| | | | | | | | | We were storing every call to getEnv and did not use that information. We can resurrect this code when a complete environment variable change tracking feature is implemented. Change-Id: I2e9b93d62f39cde0dce53181b5f71432c41f630e Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
* Use std::vector for ModuleLoader::ProductDependenciesJoerg Bornemann2017-08-231-3/+1
| | | | | | | | The value_type is a somewhat bigger struct which is a suboptimal type for QList. Change-Id: I25c9f3942d1ee573f58fc01ac1ac66794cb2be4f Reviewed-by: Jake Petroules <jake.petroules@qt.io>
* Remove effect-free codeJoerg Bornemann2017-08-231-14/+0
| | | | | | | | | We're iterating backwards over the product dependencies. Adding/removing elements at the current index has no effect for the next iteration. Remove that code. Change-Id: Ibd9168356772b92843dae9ad6ca7b287fb8fdf36 Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
* Make a Group's prefix default to the one of the parent groupChristian Kandeler2017-08-141-1/+5
| | | | | | | | | | This should be the most sensible default. [ChangeLog] Groups without a prefix now inherit the one of the parent group. Change-Id: Ieee94d1a0f5cb073def8db9feff8c1ca5ea1eacf Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* Add FileTagger.priorityJoerg Bornemann2017-08-031-1/+7
| | | | | | | | | | | | Enable users to override FileTagger items by creating a conflicting FileTagger that has a higher numerical priority value. [ChangeLog] Introduced the property FileTagger.priority, and enable users to override FileTagger items. Change-Id: Idc6f5d003b7ad468f03a2eae5d19404c1f3eb06b Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io> Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
* Make it possible to add file tags to generated artifactsJoerg Bornemann2017-08-031-2/+5
| | | | | | | | | | | | | | | | | To add another file tag to an application one can write Group { fileTagsFilter: ["application"] fileTags: ["my_additional_tag"] } [ChangeLog] It is now possible to add file tags to generated artifacts by setting the fileTags property in a Group that has a fileTagsFilter. Change-Id: Iac977011073defd532d82f015d93970e27a66ba3 Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io> Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io> Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
* Centralize conversion of multiplex id to human-readable stringChristian Kandeler2017-08-031-3/+6
| | | | | | | | | | | ... and use it to construct a unique product display name that can be used in error messages and so on. [ChangeLog][API] Introduced ProductData::fullDisplayName() Change-Id: I9a35765d3694a8f24741f1506b00d499a1aa23a0 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io> Reviewed-by: Jake Petroules <jake.petroules@qt.io>
* Fix problems regarding multiplexing and Depends.profilesChristian Kandeler2017-08-021-12/+14
| | | | | | | | | | | | | | | | | | | - Change the default of Depends.profiles from [product.profile] to undefined, so that we can by default use the same heuristics for dependencies, regardless over which property the products were multiplexed. - Replace the the internal Depends property "multiplexConfigurationId" by "multiplexConfigurationIds", which is a string list rather than a string. This way, we don't have to create additional Depends items anymore for the case where we want to depend on several variants of a product. Note that the old approach did not even work, because all but the first Depends item were ignored by the code that resolved the dependencies (since a module of that name already existed). The problem was masked by the fact that we set Depends.profiles to "*" in various places. This hack is now also gone. Change-Id: Ic05fdeed3978e2f7b184dfdc9c173d93406faec2 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* Use categorized logging in ProjectResolverJoerg Bornemann2017-08-021-10/+9
| | | | | Change-Id: I295560c9463dde2800547d66ed9af5f6d2201059 Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
* Add a ResolvedProduct backpointer to RuleJoerg Bornemann2017-07-311-4/+9
| | | | | | | | | | Rule now has a back pointer to the owning product. Rule objects are not shared anymore among products. This allows for cleaner code in a subsequent commit. Change-Id: I44b90d4819afc3bdbe74cea22c4551e8db71b2f6 Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>