aboutsummaryrefslogtreecommitdiffstats
path: root/tools/qmlcachegen/qmlcachegen.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Revert "Update commercial license headers"Tarja Sundqvist2022-11-241-11/+11
| | | | | | | | | | | This reverts commit 74089697cf2a4961fb697100555b17ae2342d734. Revert of commercial license headers is required for the Qt 6.2.x opensource releases, Qt 6.2.5 onwards. Task-number: QTBUG-107760 Change-Id: Id49069cb5e5f261da185fd082dfb71deb259d387 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Update commercial license headersTarja Sundqvist2022-06-041-11/+11
| | | | | | | | | | | | | | | Updated header.COMM to the files in tqtc-qtdeclarative. Examples, tests, or documentation files are not updated. The commercial license header may contain some additional lines so that its line count equals with the earlier license header. Reason for this is that some autotests use hard coded line numbers and a change in the line count causes failures in tests. Task-number: QTQAINFRA-4941 Change-Id: I32f554b0a8cb527f74d46f3c02b0e745d9fc5ddf Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* qmlcachegen: Fix typo in command line option descriptionPavol Markovic2021-09-281-1/+1
| | | | | | | | | | | 'resource-file-mapping option' is actually using '=' in code and tools Task-number: QBS-1676 Change-Id: I0d67e13e9d614bf973a0d4332c6b4dcda4c121a4 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io> (cherry picked from commit 1bae74dfa031ed12eb3ca002040559425571303f) Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Ivan Komissarov <ABBAPOH@gmail.com>
* Replace qmlcachegen's --qmljs-runtime with generic mechanismUlf Hermann2021-07-091-3/+0
| | | | | | | | | | | | | We don't need --qmljs-runtime after all. However, we do want to pass custom arguments to qmlcachegen. This way we don't need to change the world whenever we invent one. Change-Id: I99f0c99c4b15e469605dc43d26871fa43dc36c08 Reviewed-by: Andrei Golubev <andrei.golubev@qt.io> Reviewed-by: Fawzi Mohamed <fawzi.mohamed@qt.io> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> (cherry picked from commit 06b3f1f2e7898b72b6c2baf87d63c118dc1ae267) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* qmlcachegen: Add an ignored option -IUlf Hermann2021-03-041-0/+3
| | | | | | | | In other implementations this may be used the same way as qmllint's -I option, to specify additional import paths. Change-Id: I447712551ff1fb2a7c379712e938f778b37c514a Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Rework QQmlJSResourceFileMapperUlf Hermann2021-02-241-3/+5
| | | | | | | | | | We need more generic filtering capabilities so that it can, for example, retrieve all the .qml files in a directory, both as qrc paths and local file paths. Change-Id: I72a72abc6dd39adb41bcd035f7aa6777e50cb5a5 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
* qmlcachegen: Accept both --resource and --resource-pathUlf Hermann2021-02-231-7/+0
| | | | | | | | | | --resource-path directly specifies the resource path for the file being compiled and overrides any information we might retrieve from the qrc file. However, we might still find other relevant information in the qrc file. Change-Id: I587c6e4e81f792f62a28b035ee97b33d12eeb06d Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Add a -i <qmltypes> option to qmlcachegenUlf Hermann2021-01-121-0/+5
| | | | | | | | | | | | | qmlcachegen needs to see the qmltypes file for the current project so that it can query it for C++ types exposed to QML. This is only relevant when generating C++ code, which qmlcachegen itself cannot do. However, in order to write a compatible drop-in, we need it. Also, hide related ignored options from --help in qmlcachegen. Change-Id: Id2f1b8b1750351c7de8dfe49e4065ef1b29423b7 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Allow passing --qmljs-runtime to the qmlcachegen implementationUlf Hermann2020-12-021-0/+2
| | | | | | | | | | | | This signals qmlcachegenplus to not paste the whole JavaScript type system into each generated file. In turn, user projects need to add a dependency in order to build against the JS runtime. qmlcachegen ignores the option. Change-Id: I0f87dedb969e99e94fbb712b7faa23d84f76dfbe Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Allow passing --direct-calls to the qmlcachegen implementationUlf Hermann2020-12-011-0/+2
| | | | | | | | | | | | | qmlcachegenplus has an argument --direct-calls which instructs it to call methods of known C++ types directly rather than through the JS engine or the metaobject. This is faster but requires that all those types are visible to the generated code. Introduce a way to pass this option on a per-target base. Adjust qmlcachegen to ignore the option. Change-Id: I474e577e4a197f6ca4c8b8e868dfd39983e77041 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* qmlcachegen: Move functions to compile QML/JS files to QmlCompilerUlf Hermann2020-10-231-375/+13
| | | | | | | | We need to re-use them. Also, provide a way to insert AOT compiled functions into the C++ code. Change-Id: I7b0d13cb307e8f979745f096a9614f087d135f68 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* qmlcachegen: Add empty AOT built functions to the loaderUlf Hermann2020-10-231-1/+11
| | | | | | | | This enables us to use the same generateloader.cpp for qmlcachegen and any replacement that actually produces AOT compiled functions. Change-Id: I12fe81236e4ef16a627729c644d54b6c171b3860 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Move generateloader.cpp to QmlCompilerUlf Hermann2020-10-231-9/+6
| | | | | | | We need to be able to generate the loader code from multiple places. Change-Id: I9e04fd3583b535bc5f7d5fb293cb61309c1e199a Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* qmlcachegen: Move resourcefilter.cpp into QmlCompilerUlf Hermann2020-10-201-4/+3
| | | | | | | | For backwards compatibility, a replacement for qmlcachegen will need to provide the same functionality. Change-Id: I22664230ea636d384190122223d15819ebee930c Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* QmlCompiler: Rename ResourceFileMapperUlf Hermann2020-10-051-3/+3
| | | | | | | The file class names should start with a common prefix. Change-Id: I5e014c103668a1bc73d359b00a1dda33e5637a79 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Long live libQtQmlCompiler!Ulf Hermann2020-10-051-2/+1
| | | | | | | | Move all the code from tools/shared into src/qmlcompiler and build a static library from it so that we can re-use it in external tools. Change-Id: I7c8d8e59063dc7c711f4072f103a01095e6f5997 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Merge remote-tracking branch 'origin/dev' into wip/cmakeAlexandru Croitor2020-03-121-3/+3
|\ | | | | | | | | | | | | | | Conflicts: dependencies.yaml src/qml/qml/qqmlengine.cpp Change-Id: I6a73fd1064286f4a2232de85c2ce7f80452d4641
| * Restore offset/length in QQmlJS::DiagnosticMessageSimon Hausmann2020-03-021-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | This is needed in a few places outside of declarative, so this change restores the loc member in DiagnosticMessage and moves QQmlJS::AST::SourceLocation into common's QQmlJS namespace/directory. QQmlError is unaffected and retains only line/column. Amends d4d197d06279f9257647628f7e1ccc9ec763a6bb Change-Id: Ifb9d344228e3c6e9e26fc4fe112686f9336ea2b2 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
| * Avoid deprecated non-q-prefixed hex() functionUlf Hermann2019-12-171-1/+1
| | | | | | | | | | | | | | Use Qt::hex() instead. Change-Id: I46bc2f2006ce860cd938a86432783011365c8164 Reviewed-by: Liang Qi <liang.qi@qt.io>
* | Merge remote-tracking branch 'origin/dev' into wip/cmakeAlexandru Croitor2019-10-141-12/+4
|\ \ | | | | | | | | | | | | | | | | | | Removed dependencies.yaml because we don't use it yet in wip/cmake. Fixed conflict in qmlcachegen.cpp. Change-Id: Ie1060c737bee1daa85779903598e5b6d5020d922
| * | Merge remote-tracking branch 'origin/5.15' into devQt Forward Merge Bot2019-09-221-0/+7
| |\| | | | | | | | | | Change-Id: I801567c11fcc3244a1ee7dabeb5079d49fc5c3a1
| | * Fix regression when using CONFIG+=QtQuickCompiler and .qrc files in subdirsSimon Hausmann2019-09-191-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Commit 41864db3b61d9e81a9fe4906918d2cd3d6d32a0c removed the processing of .qrc files that removed .qml/etc. files. Since the chaining of resources remains critical to ensure that the cached compilation units are loaded, the build system copied the input .qrc file to a new one. That mere copying caused the build to break when the copied .qrc file was not in the same directory as the original one, as file paths within the .qrc file are interpreted as relative to the .qrc file, which was now in a different location. To fix this, this patch brings back the "filtering" code that rewrites the paths to the source files in the .qrc file. Fixes: QTBUG-78253 Change-Id: Ie1d56f3248e713a964260bc2da37c9374f7b6a36 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
| * | Merge remote-tracking branch 'origin/wip/qt6' into devSimon Hausmann2019-09-191-1/+1
| |\ \ | | |/ | |/| | | | Change-Id: I10c4b7fcfa0397d999d45e310c2f8f051d57d4d2
| * | Fix *.js files disappearing from RESOURCES when not using QtQmlSimon Hausmann2019-09-091-16/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | [ChangeLog][QtQml][Important Behavior Changes] Using the Qt Quick Compiler would exclude the original .qml files from the resource system. This made it impossible to change the Qt library binary later as the program binary was tied the to the exact Qt version. In addition sometimes unrelated files (QTBUG-73669) were removed. For the latter scenario, retain and skip options were added for the Qt Quick Compiler. In Qt 5.15 the Qt Quick Compiler does not remove the input files anymore. All files are retained and the compiler merely adds the more efficient binary representation to the application. Task-number: QTBUG-73669 Change-Id: I5a523bfc69d4f48a1451bd880616c82fd73b8d15 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* | | Merge remote-tracking branch 'origin/wip/qt6' into wip/cmakeAlexandru Croitor2019-10-111-0/+6
|\ \ \ | | |/ | |/| | | | Change-Id: I4a91928610f79c8e21a05781953ffa41508c828a
| * | Merge remote-tracking branch 'origin/dev' into wip/qt6Ulf Hermann2019-09-051-0/+6
| |\| | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: .qmake.conf src/qml/qml/qqmlengine.cpp src/qmlmodels/qqmlmodelsmodule.cpp Change-Id: Id60420f8250a9c97fcfe56d4eea19b62c6870404
| | * Fix build without features.temporaryfileTasuku Suzuki2019-08-191-0/+6
| | | | | | | | | | | | | | | Change-Id: If990efb64a4117bc7624062fededa7ce6a910f14 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* | | Extend qmlcachge to support --retain with CMakeLeander Beernaert2019-08-131-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | Add missing code so we can use the --retain argument when running qmlcachgen from a CMake project. Change-Id: I0b4a2f2ea6c424ba698ee178a332f585271b945e Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* | | Add support for generating qmlcache_loader without qrcLeander Beernaert2019-07-311-4/+57
|/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Added support for response file expansion to qmlcachegen. Add the option --standalone-namespace to qmlcachegen so we can generate qmlcache_loader from a collection of resource paths instead of operating on qrc files. This is necessary, since the namespace identifier is extraced from the qrc file name, which we no longer have. This pach was made in order to tend to the cmake port's version of qtquickcompiler support which does not rely on qrc files. Change-Id: If15190f3492e6695f5a6e61bf8816998760541f7 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | Merge remote-tracking branch 'origin/dev' into wip/qt6Simon Hausmann2019-07-121-7/+4
|\| | | | | | | Change-Id: I4476733af61fcf3a2af1d121a4585c3fae1c240e
| * Disentangle includes and namespacesUlf Hermann2019-07-111-0/+2
| | | | | | | | | | | | | | | | Avoid using namespace in headers and include only the headers we actually need. Change-Id: I526a0f874dc09b07693fd87070665be396d3b637 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
| * Merge JSCodeGen and QQmlJSCodeGeneratorUlf Hermann2019-07-101-7/+2
| | | | | | | | | | Change-Id: I2219cba0dd3782cb2e0b09b8f3c4d5472e6e5d7e Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | Merge remote-tracking branch 'origin/dev' into wip/qt6Alexandru Croitor2019-07-081-11/+14
|\| | | | | | | Change-Id: Ifc24fbd99ee216e528a213fdbfd2892b3df419fe
| * Simplify codegen error handlingUlf Hermann2019-07-041-11/+14
| | | | | | | | | | | | | | | | | | | | There can only ever be one error, either a syntax error or a reference error. We record the error type as we want to get rid of the virtual throw<X>Error methods in favor of an explicit compilation result. Change-Id: Ie228490aad8efb7885083f6485f931299567f54c Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | Fix Qt6 build in preparation of qt5 submodule updateAlexandru Croitor2019-07-081-1/+1
|/ | | | | | | | Fixes the QTextStream usages. Change-Id: I0c009a82fb644a9f3c3d42ec410d18b680977f23 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Move saveToDisk into SaveableUnitPointerUlf Hermann2019-06-241-21/+26
| | | | | | | | | This way we can keep the flag mutilation closely local to the place where we write the data. Also, SaveableUnitPointer doesn't need a full CompilationUnit this way. Change-Id: I01872e4c406cb2ccbaa1fa35325cc063b1e8a7df Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Simplify errors and diagnosticsUlf Hermann2019-06-141-3/+3
| | | | | | | | | | | | | | | | We only need two classes to describe all possible diagnostics: * A low-level private POD DiagnosticMessage. This is easily copied and passed around internally. It doesn't need to adhere to a stable API and it doesn't carry any extra baggage. * The high-level public QQmlError with its stable interface. This can internally also use a DiagnosticMessage as storage. Change-Id: I52be88d9b5d9855a661b8032b01eedb43a0fb0b3 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Add abstraction for temporarily setting StaticData when savingUlf Hermann2019-05-171-22/+14
| | | | | | | | | The StaticData flag needs to be saved to disk, but removed again afterwards so that we can free() the malloc'd data. This also allows us to avoid copying all the data into a byte array before saving. Change-Id: I96513f8d98acf0ea0b4514d96376b487e8444917 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Split CompiledData::CompilationUnit in twoUlf Hermann2019-05-161-13/+17
| | | | | | | | We need a CompilationUnit that only holds the data needed for compilation and another one that is executable by the runtime. Change-Id: I704d859ba028576a18460f5e3a59f210f64535d3 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Move compileModule() into qv4codegen.cppUlf Hermann2019-05-081-1/+2
| | | | | | | | | This is a better fit for the method. In turn, remove all the V4_BOOTSTRAP conditions from qv4engine_p.h and make sure we don't include or compile it in bootstrap mode. Change-Id: I5933b0724e561313ca20c420b83e4d70e63bddf5 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Merge remote-tracking branch 'origin/5.12' into 5.13Qt Forward Merge Bot2019-03-271-1/+0
|\ | | | | | | Change-Id: I2f0b4f8543a448c9acffe0932e0fd67c0b7412f4
| * Enable lookups for imported scripts and worker scriptsSimon Hausmann2019-03-251-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | This is straight-forward to enable, with the minor adjustment that we need to handle the case where a global lookup is done without a calling qml context (worker script). We don't know at compile time whether a script will be imported directly or used as a worker script, so we have to generate the global qml lookup instruction regardless and handle it at run-time. Change-Id: Ia033afa214d919d906c676498dd3eceb1c5639d8 Reviewed-by: Michael Brasser <michael.brasser@live.com> Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* | Merge remote-tracking branch 'origin/5.12' into 5.13Qt Forward Merge Bot2019-03-251-5/+0
|\| | | | | | | | | | | | | | | | | Conflicts: .qmake.conf src/qmltest/quicktest.cpp tests/auto/qml/qmlcachegen/qmlcachegen.pro Change-Id: I70e96e8817d59647f876b8b77b30cdeede8f0662
| * Enable lookups in QML files when compiling ahead of timeSimon Hausmann2019-03-221-1/+0
| | | | | | | | | | | | | | | | This should have been enabled in the series earlier when for QTBUG-69898. Change-Id: Ide7507d5dcf439463c22b631d49d654624737d1f Reviewed-by: Lars Knoll <lars.knoll@qt.io>
| * Fix memory "leaks" in qmlcachegenSimon Hausmann2019-03-221-4/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | The CompilationUnit class owns the unit data. An exception was made in bootstrap builds, where it was up to the caller to free the memory. This lead to cases in qmlcachegen where we didn't free the memory. This is best fixed by unifying the behavior. This fixes the build when using an ASAN enabled build, as the runtime aborts after calling qmlcachegen due to "leaks". Change-Id: I8b55b4e302a9569a1d4e09eeb488c479368b50f0 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* | Merge remote-tracking branch 'origin/5.12' into 5.13Qt Forward Merge Bot2019-03-211-6/+3
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/qml/compiler/qqmltypecompiler.cpp src/qml/compiler/qv4bytecodehandler.cpp src/qml/compiler/qv4codegen.cpp src/qml/compiler/qv4compileddata_p.h src/qml/compiler/qv4compiler.cpp src/qml/compiler/qv4instr_moth.cpp src/qml/compiler/qv4instr_moth_p.h src/qml/jit/qv4baselinejit.cpp src/qml/jit/qv4baselinejit_p.h src/qml/jsruntime/qv4function.cpp src/qml/jsruntime/qv4vme_moth.cpp Change-Id: I8fb4d6f19677bcec0a4593b250f2eda5ae85e3d2
| * Remove dead compile time QML context/scope property and id object codeSimon Hausmann2019-03-201-6/+3
| | | | | | | | | | | | | | | | | | | | | | After enabling lookups in QML files, we can remove all the code that tries to deal with (type) compile time detection of access to id objects and properties of the scope/context object. This also allows removing quite a bit of run-time code paths and even byte code instructions. Task-number: QTBUG-69898 Change-Id: I7b26d7983393594a3ef56466d3e633f1822b76f4 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* | Merge remote-tracking branch 'origin/5.12' into 5.13Qt Forward Merge Bot2019-03-181-11/+2
|\| | | | | | | | | | | | | Conflicts: src/qml/compiler/qv4codegen.cpp Change-Id: I66b7db42bf208855889094ace0267326595ce03c
| * Fix up global name determination when compiling ahead of timeSimon Hausmann2019-03-151-11/+2
| | | | | | | | | | | | | | | | The list of names is still suboptimal, but at least it's shared now. Task-number: QTBUG-69898 Change-Id: I16c9839c4a1f097053b28caea894b67757972826 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* | qmlcachegen: Eliminate foreachUlf Hermann2019-01-041-2/+2
| | | | | | | | | | Change-Id: Ic13e5af7ddb92cf5988988ebe1c2b7470a5f8c1e Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>