aboutsummaryrefslogtreecommitdiffstats
path: root/tools
Commit message (Collapse)AuthorAgeFilesLines
...
* qmltc: Drop duplicate "QQmlContextData::" in context set generationAndrei Golubev2021-12-231-2/+1
| | | | | | | | | qmltc generates QQmlContextData::QQmlContextData::DocumentRoot so one "QQmlContextData::" is not needed Pick-to: 6.3 Change-Id: Ice2bb1c221996f04d8107f6f6caec7f52aad3735 Reviewed-by: Fawzi Mohamed <fawzi.mohamed@qt.io>
* qmltc: Support different property change handlersAndrei Golubev2021-12-231-24/+51
| | | | | | | | | | | | | | | | qmltc must be able to compile property change handlers: - for bindable properties (with no notify) - for notifiable properties (with no bindable) - for both bindable and notifiable properties (preferring notify signal) Test the aforementioned cases and some signal handling cases along the way Task-number: QTBUG-84368 Pick-to: 6.3 Change-Id: I2cd2d0ad6407889942c806e03831dec4c7ce265a Reviewed-by: Fawzi Mohamed <fawzi.mohamed@qt.io>
* qmlls qlanguageserver: clientInfo and serverInfo locking fixesFawzi Mohamed2021-12-231-26/+4
| | | | | | | | correct and more concise double locking or clientInfo and serverInfo. Pick-to: 6.3 Change-Id: Ib168fc4fd3d5d5b9b8dbc0ff318b1abaaa23517c Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
* qmlls textblock: operator== and != as friend functionsFawzi Mohamed2021-12-232-6/+6
| | | | | | Pick-to: 6.3 Change-Id: I3efdb3ff7ffa1f7856d818d1cffea52eb3f6c6e8 Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
* Unify common logic around QQmlJSScope and friendsAndrei Golubev2021-12-229-153/+28
| | | | | | | | We have many things duplicated all over the place Pick-to: 6.3 Change-Id: If929a5d683153781f6db630312240bf9c24ec777 Reviewed-by: Fawzi Mohamed <fawzi.mohamed@qt.io>
* qmltc: Fix explicit import of local QML typesAndrei Golubev2021-12-225-115/+25
| | | | | | | | | | | | | | | | | | qmltc passes re-import local QML types in order to get their URLs and modifiable versions of types. The existing logic seems to work only when we've already imported the types before. But re-import may, in fact, easily load *same* types from a *different* place. This is totally wrong and exceptionally evil (even within the passes). Re-write this logic by looking up the already-imported types from QQmlJSImportVisitor instead This, in particular, fixes a case: import MyOwnModule 1.0 MyOwnType { } // oops, does not include "myowntype.h" Pick-to: 6.3 Change-Id: I35be7e41094c3bb9e210727a7a59bee33b548698 Reviewed-by: Fawzi Mohamed <fawzi.mohamed@qt.io>
* qmlls qlanguageserver: minor cleanupsFawzi Mohamed2021-12-222-4/+2
| | | | | | | | | Fixes that do not affect the running code: Q_ENUM declaration, default constructor, clarifying comment Pick-to: 6.3 Change-Id: Ic93dba58b33e4532fd16cabdc450fc3920b1ca55 Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
* qmlls: fix license header (tool -> GPL)Fawzi Mohamed2021-12-2218-281/+81
| | | | | | Pick-to: 6.3 Change-Id: I6ebd1e8f3ca9fc88f2c92cd10703540154040baf Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
* qmlls: qml language server implementationFawzi Mohamed2021-12-2120-0/+3115
| | | | | | | | | | This is the initial commit, with just qmllint integration, but many of the tricky bits and the architecture are already there, see the description in qqmllanguageserver.cpp and qqmlcodemodel.cpp Pick-to: 6.3 Change-Id: Ie493fed02276f938fde641e8d91c67aed0514d1f Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
* qmltc: Do not crash on import namespacesAndrei Golubev2021-12-181-0/+8
| | | | | | Pick-to: 6.3 Change-Id: I9767857076ea6ae565c7efd75d64cb47a82b7be7 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* qmltc: Be aware of Component-wrapped typesAndrei Golubev2021-12-186-33/+137
| | | | | | | | | | | | | | | | | | | | | While implicit components (the ones bound to Component-based property) are covered, cases like `Component { Text{} }` are not, so fix that Revisit the logic in the QmlIR / QQmlJSScope passes and code generator as part of this This might be a fairly used pattern in QML so no reason not to address this right away, especially given that we have most of the infrastructure in place already While at it, bring over extra tests that some other (non-merged) commit introduced. These give good coverage for missing cases and also exercise the feature supported here Task-number: QTBUG-84368 Pick-to: 6.3 Change-Id: I8f5c74fc79380566475b1139d4cc5560fac123e3 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Add prefer record to the output of qmlimportscannerAlexey Edelev2021-12-171-1/+9
| | | | | | | Pick-to: 6.3 Task-number: QTBUG-95984 Change-Id: I2e126db655ef986b23d66a465e8b28b9fb17bbb1 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* qmltc: Explicitly reject inline componentsAndrei Golubev2021-12-172-0/+12
| | | | | | | | | | Because they seem to be hard and there's little reason to invest in their support immediately Task-number: QTBUG-84368 Pick-to: 6.3 Change-Id: If056aa401d8f54d067eb583669074cb3f6bfd304 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* qmltc: Make special functions protectedAndrei Golubev2021-12-176-14/+70
| | | | | | | | | | | | Special functions are only invoked internally by the qmltc-generated code. There is no reason in making them public as the compiler should know which exact type would use another type (and so can generate meaningful friend declarations) Task-number: QTBUG-84368 Pick-to: 6.3 Change-Id: I887ca8db7f916dba042f0ccbf19085aa438bf82d Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Add listing of the components and scripts that belongs to the qml moduleAlexey Edelev2021-12-171-4/+38
| | | | | | | | | | Add qml components and scripts to the qmlimportscanner output to give information about files that actually belong to the qml module. Pick-to: 6.3 Task-number: QTBUG-97834 Change-Id: I41394ba6fe9d9fe3af74786b4a802903849ae27d Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Use qmltc compiler prototype as a fallback implementationAndrei Golubev2021-12-1718-17/+4780
| | | | | | | | | | Task-number: QTBUG-91927 Task-number: QTBUG-96041 Task-number: QTBUG-84368 Pick-to: 6.3 Change-Id: I47320b5f3ed8efff6fb234778df5fae5be5b64f2 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Add CMake deploy support for QML module appsCraig Scott2021-12-131-1/+21
| | | | | | | Task-number: QTBUG-98545 Pick-to: 6.3 Change-Id: I2d04ccbae0288c88ada399552e8f9c20e221b21d Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* Pass qmldir to qmlcachegen, qmllint and qmltc, not the qmltypes fileUlf Hermann2021-12-135-36/+45
| | | | | | | | | | | | | | | | | | The tools will still grudgingly accept qmltypes files being passed via the -i option. We generally expect qmldir files, though. Ignoring the qmldir file and importing the qmltypes directly, ignores qmldir imports, dependencies and other component entries. This leads to unresolvable types. [ChangeLog][QML Tooling] qmllint expects qmldir files, not qmltypes files to be passed via the -i option now. This enables it to see the imports and dependencies of the module being imported. For backwards compatibility it still accepts qmltypes files, with a warning. Pick-to: 6.3 Fixes: QTBUG-99043 Change-Id: I5ed32d7e78df1e604aaf1bfa2ebda09d5d57b628 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* qmllint: Use fix suggestions in a more structured wayMaximilian Goldstein2021-12-101-1/+1
| | | | | | | | | | | Fix suggestions are now attached to the warnings they are caused by and are also accessible via JSON. This allows us to use the qmllint library for more of tst_qmllint, greatly improving performance. Change-Id: Idd0398028bff1272a75dc1193d2c15a25d335dbf Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* qmllint: Fix diagnostics output for test runUlf Hermann2021-12-071-1/+1
| | | | | | | We do want to see the output if the cleanQmlCode test fails. Change-Id: I6b7e9d3412af9fffac68d2e394418de2faf09626 Reviewed-by: Maximilian Goldstein <max.goldstein@qt.io>
* Compile QML files ahead of time with qmlcachegenUlf Hermann2021-12-031-33/+83
| | | | | | | | | | | | | | | | | | | | | qmlcachegen compiles bindings and functions to C++ as far as QQmlJSAotCompiler can. It does respect "pragma Strict" and rejects the file if it's violated. Furthermore, it sets up the logger to follow the qt.qml.compiler.aot logging category. By default it's completely silent. Compiling the examples with qmlcachegen exposes a bug in the type resolver where it returns an invalid generic type. It should never do that. Fix it by returning JSValue. [ChangeLog][QtQml][Important Behavior Changes] QML bindings and functions are now compiled to C++ by qmlcachegen, if possible. Use the qt.qml.compiler.aot logging category to receive diagnostics about the compilation. Task-number: QTBUG-98305 Change-Id: I6953812c3fd20b68339617a5714fcbe16a384360 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Add a default implementation for QQmlJSAotCompilerUlf Hermann2021-11-291-1/+3
| | | | | | | | | | | | | | | | The default AOT compiler compiles QML code in indirect, dynamic mode. It uses the logger's Log_Compiler category to determine the verbosity of its output. In addition you can use the qt.qml.compiler.aot category for even more verbosity. In preparation for using QQmlJSAotCompiler with qmlcachegen, the default level of that category is increased to QtFatalMsg. The highest level we actually output is QtDebugMsg, so it doesn't make a difference yet. If the logger's Log_Compiler category is set to produce errors, it will qFatal() on "pragma Strict" violations. Change-Id: Ieb74bfa7cd51cfa8616792ab467c32f6ba0e0702 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* qmllint: Properly handle JavaScript functions with variable argumentsMaximilian Goldstein2021-11-261-0/+1
| | | | | | | | | | | | | Previously calling a JavaScript function with variable arguments could cause the linting process to error out because of a lack of matching function arguments. This is now handled by defaulting to a JavaScript method if no matching function signature can be found. Fixes: QTBUG-98299 Change-Id: I748a60839106243a12bffd8d715b48cbc53d7f57 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* QmlCompiler: Tighten the constness of various method parametersUlf Hermann2021-11-262-5/+3
| | | | | | | | | | The compile passes shouldn't need to change the document, AST, or IR. At least not accidentally. We might add interfaces to explicitly modify things later. As a side effect, you can now use one instance of QQmlJSTypeResolver for multiple documents by re-init()'ing it. Change-Id: Ic3544b3ddedd30d7f8d00b1df9cee3e6292ca7de Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* QmlCompiler: Move type generalization into separate compile passUlf Hermann2021-11-262-4/+3
| | | | | | | | We want to be able to skip it. Task-number: QTBUG-98305 Change-Id: Ibb0293d348f2828a28be4c458cf955b4cc706caa Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* qmllint: Re-enable warning about automatched signal handlerUlf Hermann2021-11-262-5/+4
| | | | | | | | ... and give a hint on what to do about it. In order to not duplicate all the warnings from the importer, make sure it runs only once. Change-Id: Ie2b314ff659664f7c84c20cc7971c094e15c59cf Reviewed-by: Maximilian Goldstein <max.goldstein@qt.io>
* qmllint: Expand qmllint library APIMaximilian Goldstein2021-11-251-2/+2
| | | | | | | | | | | The API now allows for specifying the file contents yourself for either on-the-fly editing or if you have your own caching scheme. It's now also possible to access the logger directly in order to read diagnostic messages instead of structured JSON output. Change-Id: I4eb8440c7b25068cd09f28a5f3cbd0a318774522 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io> Reviewed-by: Fawzi Mohamed <fawzi.mohamed@qt.io>
* qmllint: Move most code into a separate libraryMaximilian Goldstein2021-11-238-1031/+6
| | | | | | | | | | | | | | | This is necessary step for both making qmllint viable for use in controls' tst_sanity, as well as for integration with the language server. As an additional upside it allows us to run our tests up to 10x faster. Eventually we want to integrate all of this into qmlcompiler but due to the state of some of the code we will keep qmllint in a separate library as to keep qmlcompiler tidier. Change-Id: Ic057ef0cd4424d28aa05e517d74280a442ec9c5a Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
* qmlcompiler: Use QT_BEGIN_NAMESPACE / QT_END_NAMESPACE everywhereMaximilian Goldstein2021-11-231-1/+2
| | | | | | | Some code was not properly wrapped in a namespace. Change-Id: If70fd9782391309c511b66ae01eae43cb36292ac Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* qmltc: Support literal bindingsAndrei Golubev2021-11-235-1/+153
| | | | | | | | | | Ignore type conversions for now. Expect C++ to handle them magically for us. The simple binding type dependent conversions that are performed already should suffice Task-number: QTBUG-84368 Change-Id: I62bd36ccf6c60fd62c2a50b6e011c637c5bcfbce Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* qmllint: Fix typo in app descriptionMaximilian Goldstein2021-11-191-1/+1
| | | | | | | | | Disabling uses the keyword "disable" not "disabled". Fixed in this change. Pick-to: 6.2 Change-Id: I544a543043627121a11ca3ab56ad3d967707efb6 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Remove QQmlJSTypeResolver::SemanticsUlf Hermann2021-11-183-10/+5
| | | | | | | | We only support dynamic semantics here. Task-number: QTBUG-98305 Change-Id: I520da912062917e40e5628d003558fe80b612948 Reviewed-by: Maximilian Goldstein <max.goldstein@qt.io>
* qmllint: Add option for logging absolute pathsMaximilian Goldstein2021-11-171-6/+15
| | | | | | | | | | | | Some IDEs might want to parse qmllints logging messages directly instead of using the structured JSON output. For these a hidden --absolute-path option has been introduced so the messages can more easily be mapped to the actual files. Task-number: QTCREATORBUG-17224 Change-Id: I23c4272a45adcb2bf7aeb6ae7b130839b9f05b72 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* QmlCompiler: Phrase the shadow check as separate passUlf Hermann2021-11-171-2/+7
| | | | | | | | | ... and add a test to qmllint to check that it actually does something. Task-number: QTBUG-98305 Change-Id: Ib14bc6822cc15200018646c3a0395d0786ec28a8 Reviewed-by: Andrei Golubev <andrei.golubev@qt.io> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* QmlCompiler: Introduce compile passesUlf Hermann2021-11-172-73/+50
| | | | | | | | | | | | Concentrate code likely to be used by more than one pass in a base class, and adapt the existing users. Also, stub out all the byte code visitors so that we can easily implement passes that only target part of the byte code. Task-number: QTBUG-98305 Change-Id: Ib1e16daf678bf478d9d2d11b3604ded3749f2096 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
* qmltc: Learn to set QML context for objectsAndrei Golubev2021-11-177-5/+207
| | | | | | | | | | | Add the minimal test along the way. The most we can do at present is to check that root object's context is set correctly. Comprehensive tests require binding compilation The QQmlParserStatus::classBegin() shenanigans are skipped for now Change-Id: I5c28c8a4406753dcf0fc93d968800b4376ec6017 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* qmltc: Compile QML properties into C++Andrei Golubev2021-11-1710-11/+243
| | | | | | | | | Update the QQmlJSScope::insertPropertyIdentifier along the way since it doesn't mark a signal method as a signal Task-number: QTBUG-84368 Change-Id: I4594520e46e2d85cc7fa82357d9cc1c62c66b732 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* qmltc: Compile QML methods to C++Andrei Golubev2021-11-176-7/+154
| | | | | | | | | This also requires some changes to the output IR + couple things could also be fixed while at it Task-number: QTBUG-84368 Change-Id: Ie1535cbbe36cd874e9787ea91fe85b638326de20 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* qmltc: Compile QML enums into C++Andrei Golubev2021-11-174-2/+31
| | | | | | Task-number: QTBUG-84368 Change-Id: Idf6c724496c807477ce0914ab0d32a80a9b90b5a Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* qmltc: support user-specified namespaces in the generated codeAndrei Golubev2021-11-166-12/+30
| | | | | | | | | | | | | | | Already during the prototyping phase, conflicts in class names were encountered within Qt code base. Those could be avoided by namespaces. Initial qmltc logic was using meaningless "q_qmltc" namespace, so let's improve that by allowing user-specified namespaces + making Qt's own QML files (compiled to C++) being available under QT_NAMESPACE. The latter is achieved by providing (and using) the internal version of a qmltc-invoking function Task-number: QTBUG-84368 Task-number: QTBUG-96040 Change-Id: I99cdf1baba8838c093b6b469f6744869f72af093 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* qmllint: Use the raw type for type inference, not the stored oneUlf Hermann2021-11-151-5/+3
| | | | | | | If we use the stored type, we lose important information. Change-Id: I09264642cee8da2bd9103d01488855ebbc5648b5 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Explicitly include qloggingcategory.hKai Köhne2021-11-152-0/+2
| | | | | | | | | Do not rely on QLoggingCategory being implicitly declared through other headers. Pick-to: 6.2 Change-Id: Ib6cda43f281d31a7127dd591be2540fb00a0a699 Reviewed-by: Maximilian Goldstein <max.goldstein@qt.io>
* qmltc: Introduce object creation infrastructureAndrei Golubev2021-11-153-32/+67
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The so-far strategy is the following: * allocate a linear storage for the QObject pointers using QQmltcObjectCreationBase (to reference the to-be-created objects) * "type-erase" the QQmltcObjectCreationBase into QQmltcObjectCreationHelper (so now we don't need to know the template specialization across different QML documents): non-document roots' ctors can accept QQmltcObjectCreationHelper as an input parameter * use QQmltcObjectCreationHelper to set object pointers into the storage when creating all the objects (also from other QML documents) * use QQmltcObjectCreationHelper later to retrieve necessary objects during creation finalization Provide basic implementation for the first and second bullets straight away This model seems to allow to hide the details of QQmltcObjectCreationBase interaction within the QML top-level document root (the type that we instantiate in the user code), which is very convenient Task-number: QTBUG-84368 Change-Id: I04cf64c54e48f169acfd4337cf93a58a05336b3b Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* qmltc: Learn to collect C++ includes for a type hierarchyAndrei Golubev2021-11-155-3/+145
| | | | | | | | | | | | | We need this to be able to properly include types, properties, etc. The strategy right now is very exhaustive but it seems necessary (afair) to be able to support weird cases with non-trivial forward declarations As a drive-by, fix some mistakes in QQmlJSScopeVisitor and its qmltc's counterpart Task-number: QTBUG-84368 Change-Id: I97719222598af85886821c0bf6e0e788770c8924 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* qmllint: Decouple the parenting mode from the QML semanticsUlf Hermann2021-11-101-4/+9
| | | | | | | | qmllint wants only the parenting. It should still warn about shadowing (once it can). Change-Id: If49a11cd086643f9626754fdeaaf6a9a7c1bc626 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* qmltc: Do not crash on import errorsAndrei Golubev2021-11-091-5/+5
| | | | | | Task-number: QTBUG-84368 Change-Id: I8d2a39a3c064d0542b9bf56cbf8246ae18975f04 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* CMake: Don't build Qt apps using Ninja when targeting iOSAlexandru Croitor2021-11-091-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | Building them using ninja is pointless because they can't deployed / executed without the Xcode generator. Apart from that, the qml app will also fail to link in a static top-level build with Undefined symbols for architecture arm64: "_qt_main_wrapper", referenced from: implicit entry/start for main executable due to QTBUG-98058. The linking failure does not happen in CI because it does per-repo builds and not top-level builds. Amends 3e2a85384b1f5454e51a27827114e49746f8837a Pick-to: 6.2 Fixes: QTBUG-98015 Task-number: QTBUG-98058 Change-Id: I7fe6538ac0e2f2ea0f89b09bb1b77265a3cd51fe Reviewed-by: Alexey Edelev <alexey.edelev@qt.io> Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* qmlimportscanner: Prefer directories with qmldirFabian Kosmale2021-11-041-5/+19
| | | | | | | | | | | | | With the new CMake module API, we often have both the source and the binary dir as an import path, with the qmldir only being available in the binary directory. For deployment to work correctly, we need to pick up the qmldir. Thus, when finding a module both with and without a qmldir in different paths, prefer the version with the qmldir. Pick-to: 6.2 Change-Id: I12efeae321da60b1b5ffe5c6d950ba486887ceb1 Reviewed-by: Craig Scott <craig.scott@qt.io> Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* CMake: Allow disabling package version checkAlexandru Croitor2021-11-021-1/+6
| | | | | | | | | | Allow to opt out of package version checks by configuring with -DQT_NO_PACKAGE_VERSION_CHECK=TRUE. Pick-to: 6.2 Fixes: QTBUG-96458 Change-Id: Ibcba9a6b74ba770cb2fc949603eed275d47e55dd Reviewed-by: Craig Scott <craig.scott@qt.io>
* qmllint: Fix some settings not being checked properlyMaximilian Goldstein2021-10-291-19/+44
| | | | | | | | | | | Previously some settings were only checked before any settings file could be loaded, thus resulting in misapplied settings. Now every settings option will be applied on a per-file basis as it should be. Pick-to: 6.2 Change-Id: Ib7c8a8d7dbec2d4379f634488e3899e1746c0c51 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>