aboutsummaryrefslogtreecommitdiffstats
path: root/tools/qmlcachegen
Commit message (Collapse)AuthorAgeFilesLines
* 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-05-011-1/+1
|\ | | | | | | Change-Id: Ic008bf9223a9ac293c925044355ff218f7ed7f78
| * Skip QtQuickCompiler resource extraction when using lupdateSimon Hausmann2019-04-291-1/+1
| | | | | | | | | | | | | | | | | | Otherwise lupdate won't see a .qrc file that contains the .qml/.js files. Change-Id: I8b5fd79299adcde338d68fb6ca39ab03c9300286 Fixes: QTBUG-75501 Reviewed-by: Ulf Hermann <ulf.hermann@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>
* | Merge remote-tracking branch 'origin/5.12' into 5.13Qt Forward Merge Bot2019-03-131-0/+1
|\| | | | | | | | | | | | | | | Conflicts: src/qml/compiler/qv4codegen.cpp src/qml/animations/qsequentialanimationgroupjob.cpp Change-Id: I8b76e509fd7c8599d4cef25181d790ee28edab54
| * Skip processing qtquickcompiler.prf when parsed by Qt CreatorChristian Kandeler2019-02-271-0/+1
| | | | | | | | | | | | Task-number: QTCREATORBUG-17521 Change-Id: I9f16c3a030ad49a4fa8d9b5baa2eb79f411fab12 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* | Merge remote-tracking branch 'origin/5.12' into devLiang Qi2019-01-291-10/+12
|\| | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/3rdparty/masm/yarr/YarrJIT.cpp src/qml/compiler/qv4instr_moth.cpp src/quick/handlers/qquicksinglepointhandler_p.h src/quick/handlers/qquicktaphandler.cpp src/quick/items/context2d/qquickcontext2d.cpp Done-With: Ulf Hermann <ulf.hermann@qt.io> Change-Id: I109453131f9f0a05316ae37c7d6ed1edc8c0f9d4
| * CMake: Don't handle empty resource filesAndy Shaw2018-12-171-10/+12
| | | | | | | | | | | | | | | | [ChangeLog][Qml] Empty resource files will not be passed to Qt Quick Compiler to be handled when using CMake. Change-Id: I1513d29b70d8a4b08a2947f4a97fbd525c5ace8f Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | qmlcachegen: Eliminate foreachUlf Hermann2019-01-042-3/+3
| | | | | | | | | | Change-Id: Ic13e5af7ddb92cf5988988ebe1c2b7470a5f8c1e Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | Add option to retain sources when generating QML cacheUlf Hermann2019-01-043-11/+41
| | | | | | | | | | | | | | | | | | | | | | By default any .qrc files are filtered and QML and JS sources dropped when generating the cache. The new QTQUICK_COMPILER_RETAINED_RESOURCES option allows the specification of .qrc files to be kept as they are. The source fils specified in them will be available to the application. Change-Id: If45bcd95c29fe4b91f5817573964ff55b1db8a00 Fixes: QTBUG-72430 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | Fix warnings about unused Qt containersSergio Martins2018-11-301-1/+1
| | | | | | | | | | | | | | | | | | | | | | Fixes -Wclazy-unused-non-trivial warnings, in preparation for using gcc/clang's warn_unused attribute in all containers. Maintainers please check if some unused variable isn't hidding an actual bug. Change-Id: I83c5a11aa2328db3dce4c6c402295d86ef297c83 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | Merge remote-tracking branch 'origin/5.12' into devQt Forward Merge Bot2018-11-301-0/+1
|\| | | | | | | Change-Id: Ie977b1998eba8c9aa8582a96132bf1aa0ec55ca4
| * Fix Qt Quick Compiler with CMake on WindowsSimon Hausmann2018-11-271-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We perform a qmake substitution pass on QtQuickCompilerCompiler.cmake.in, which contains code to determine the location of the qmlcachegen tool. The expression set(compiler_path \"$${CMAKE_BIN_DIR}qmlcachegen$$CMAKE_BIN_SUFFIX\") requires that $$CMAKE_BIN_SUFFIX is set correctly, so that it expands to .exe on Windows and we can locate the binary correctly. This is identical to what's done in create_cmake.prf. [ChangeLog][Qml] Fix Qt Quick Compiler with CMake on Windows Task-number: QTBUG-71829 Change-Id: I81a7452b7dc7f01c9114900b9c103122fec07cf6 Reviewed-by: Kevin Funk <kevin.funk@kdab.com>
* | QMLCacheGen: add missing QRegExp includeSamuel Gaist2018-11-171-0/+1
|/ | | | | | | | | Following qtbase's QRegExp include cleanup, this patch adds it here. This also follows the "include what you use" philosophy. Change-Id: I2692736e37bca304b7f95563b98c92cf01c7aedb Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* Clone ContextType::Global as ContextType::ScriptImportedByQMLJüri Valdmann2018-11-011-1/+1
| | | | | | | | | | Add new enum value QV4::Compiler::ContextType::ScriptImportedByQML, which behaves exactly the same as ContextType::Global. A follow-up patch will change the behavior slightly. Task-number: QTBUG-69408 Change-Id: I20d27804fd1433f2229704546bcd78a0ac108c01 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Fix long file name generated for certain qmlcache.qrcJarkko Koivikko2018-10-061-0/+1
| | | | | | | | | | | | | | | | | | | | When compiling qtvirtualkeyboard with MSVC, it may choke on the long file name generated for certain *_qmlcache.qrc files. Specifically, these files are originally generated by qmake, therefore reside in the build directory. For example, this happens when compiling qtvirtualkeyboard out-of-tree using shadow build (e.g. in Qt Creator): qrc____build_qtvirtualkeyboard_Desktop_Qt_5_12_0_MSVC2017_x86_64_Debug_src_virtualkeyboard_.rcc_release_qmake_virtualkeyboard_layouts_qmlcache.cpp c1xx: fatal error C1083: Cannot open source file: '.rcc\release\qrc____build_qtvirtualkeyboard_Desktop_Qt_5_12_0_MSVC2017_x86_64_Debug_src_virtualkeyboard_.rcc_release_qmake_virtualkeyboard_layouts_qmlcache.cpp': No such file or directory This change changes the base directory to $$OUT_PWD for paths which point outside the source directory. Change-Id: I9733af98d916a60ca1ab02cd49ab67024f1db086 Reviewed-by: Jarkko Koivikko <jarkko.koivikko@code-q.fi> Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
* Add support for compiling ES modules ahead of timeSimon Hausmann2018-08-175-77/+86
| | | | | | | | | | | | This is also pretty straight-forward by adding .mjs as supported extension in the qmake and cmake support. This also tweaks qv4engine.cpp to share the same module compilation function across all code paths. Change-Id: Ia0e23c78a794f2330ecf8f991ee6ea948f4ac89d Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Clean up internal QML unit creation APISimon Hausmann2018-07-311-12/+12
| | | | | | | | | Since the callers always end up assigning the returned unit pointer back to the compilation unit's data member, we might as well do that inside the function and return void instead. Change-Id: I7a7f3e7a0c89ffe2f9474149fcf61736609b363d Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Fix import of precompiled .js filesSimon Hausmann2018-07-311-0/+4
| | | | | | | | | | | Loading those must not fail the file relocation test, so set the source file names to empty, as we also do for .qml files. Also added tests for all the scenarios: no embedded file paths for AOT files but absolute paths for run-time created cache files. Change-Id: I3fc92e89cfd0da512afeac22bd0da3e915ec46ea Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Fix qtquick_compiler_add_resources when cross-compilingSimon Hausmann2018-07-032-12/+40
| | | | | | | | | | Attempt to locate the qmlcachegen binary in the host bin directory if possible. Task-number: QTBUG-68724 Change-Id: If0d28408a316b3dd33f4734464e0d5fe44c9fc2c Reviewed-by: Rolf Eike Beer <eb@emlix.com> Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Merge remote-tracking branch 'origin/5.11' into devQt Forward Merge Bot2018-06-291-5/+7
|\ | | | | | | Change-Id: I800f39ea59efd6049d3226ec27b8ecb3f6e9ae28
| * Clarify error message when using eval in signal handlersSimon Hausmann2018-06-281-5/+7
| | | | | | | | | | | | Task-number: QTBUG-64024 Change-Id: If8f749ef9ec072928cb352ad7cd4dcf140b6ed53 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* | Remove obsolete optionSimon Hausmann2018-06-261-3/+0
| | | | | | | | | | | | | | | | | | | | The check-if-supported option does not make sense anymore since the generated output is cross-platform. Change-Id: If7802267b51b445d2e41387d556a344616e9afc8 Reviewed-by: Christian Kandeler <christian.kandeler@qt.io> Reviewed-by: Rolf Eike Beer <eb@emlix.com> Reviewed-by: Kevin Funk <kevin.funk@kdab.com>
* | Merge remote-tracking branch 'origin/5.11' into devUlf Hermann2018-06-253-9/+63
|\| | | | | | | | | | | | | | | | | | | Conflicts: src/plugins/qmltooling/packetprotocol/qpacketprotocol.cpp src/quick/handlers/qquickhandlerpoint.cpp src/quick/handlers/qquicksinglepointhandler.cpp tests/auto/qml/ecmascripttests/test262 Change-Id: I8908ec8c6116ca626fbd269af7625d4c429429ca
| * CMake: fix bad argument quoting when calling rccRolf Eike Beer2018-06-191-1/+1
| | | | | | | | | | | | | | | | Fixes: 8735ff6499f4ef93675a9e8158af77461f6e93bc Change-Id: If8a3a394e52027fe99acc98ea8f4b7847db81497 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io> Reviewed-by: Kevin Funk <kevin.funk@kdab.com>
| * qmlcachegen: Remove superfluous semicolons from generated codeJoerg Bornemann2018-06-191-2/+2
| | | | | | | | | | | | | | | | | | This fixes the "extra ';'" warnings when compiling generated code with -Werror=pedantic. Task-number: QTBUG-68809 Change-Id: Ie26cdc4e06bc26587766dd72b258624773a7f990 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
| * Fix CONFIG+=qtquickcompiler with umlauts in the file pathSimon Hausmann2018-06-191-6/+48
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Instead of replacing every character that is not allowed in C++ identifiers with an underscore (which in turn could lead to collissions), replace it with the hexadecimal value of the offending character's unicode value. In addition we must use the complete suffix when mapping Foo.qml to Foo_qml.cpp. Task-number: QTBUG-68608 Started-by: Erik Verbruggen <erik.verbruggen@qt.io> Change-Id: I7e2153f0e6671b37dcaee4efb9aaae1d9b230f0c Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
| * Fix support for QTQUICK_COMPILER_SKIPPED_RESOURCESSimon Hausmann2018-06-191-0/+12
| | | | | | | | | | | | | | | | This used to work with QQC before 5.11 and somehow was lost in translation. Change-Id: Id3d38c609e228d0f7676d3fb177b271eb46f6f73 Reviewed-by: Andy Shaw <andy.shaw@qt.io>
* | Merge remote-tracking branch 'origin/5.11' into devSimon Hausmann2018-06-191-2/+2
|\| | | | | | | | | | | | | | | | | | | Conflicts: .qmake.conf src/plugins/qmltooling/packetprotocol/qpacketprotocol.cpp src/qml/compiler/qv4codegen.cpp tests/auto/qml/debugger/qv4debugger/tst_qv4debugger.cpp Change-Id: I010505326d76ee728ffe5fbd4c7879f28adadb12
| * CMake: avoid x${var} tricksRolf Eike Beer2018-06-081-1/+1
| | | | | | | | | | | | | | | | | | | | | | Just passing the variable name to if() will make CMake evaluate it exactly once, without the need for any specific tricks. The x${var} tricks may be necessary for macro() arguments, which are not variables, but here an ordinary variable in a function is tested. Change-Id: Ibf8fc3efd43a6d8ea729eaaaf14ddeaa15804924 Reviewed-by: Kevin Funk <kevin.funk@kdab.com> Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
| * CMake: replace deprecated exec_program() with execute_process()Rolf Eike Beer2018-06-081-1/+1
| | | | | | | | | | | | Change-Id: Ic3fc1a59703c11aab17529d4b0e92789e4650ca7 Reviewed-by: Kevin Funk <kevin.funk@kdab.com> Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | Merge remote-tracking branch 'origin/5.11' into devLiang Qi2018-05-151-1/+1
|\| | | | | | | | | | | | | Conflicts: src/qml/qml/qqmltypeloader.cpp Change-Id: If9874faf23e813b05ee4cf042133a528d73ba72a
| * Fix .import within .js files with CONFIG+=qtquickcompilerSimon Hausmann2018-05-111-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When loading a .js file without QQC, we scan the sources and use the ScriptDirectivesCollector to extract things like .pragma library or .import ahead of time. That information is passed on to the compilation unit generator for serialization. When compiling .js files ahead of time, we also used the same collector, but we forgot to save the data into the right location before serialization, so we essentially lost the imports. This patch fixes that by centralizing this code into the ScriptDirectivesCollector itself. [ChangeLog][QtQml] Fix regression with .import in .js files not working when using CONFIG+=qtquickcompiler. Change-Id: I5413c14b1b8bd3114a997011534fe55cdb7634aa Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* | Rename the CompilationMode enum to ContextTypeLars Knoll2018-05-021-1/+1
| | | | | | | | | | | | | | | | | | And make it an enum class. The new name fits better, as it's mainly used to determine the type of the context when parsing. Also already added the 'Block' value that will be needed. Change-Id: I70d963b6a0b22db1a3c607cce6bdd2054b29e000 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | Clean up manual reference of QQmlTypeData and QQmlPropertyCacheSimon Hausmann2018-04-261-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We have a few places in the type loader where we do adventurous manual reference counting, where getType() returns a raw pointer that has been addref()'ed and then sometimes somehow we call release() later. Commit 0b394e30bba4f6bb7e6f7dbe5585a2e15aa0f21d is an example of where this can easily go wrong. As a consequence and also in preparation for future work on the type loader, this patch starts replacing the manual reference counting there. Changing the return type from QQmlTypeData *getType() to a QQmlRefPointer<> itself is not sufficient though, as the implicit operator T*() will still allow the caller to store the result as a raw pointer. Therefore this patch removes the "unsafe" implicit extraction operator. As a result of that change, other types that are sometimes stored in QQmlRefPointer are also affected and their usage needs to be adapted to QQmlRefPointer usage or manual raw pointer extraction with .data(). Change-Id: I18fd40634047f13196a237f4e6766cbef3bfbea2 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* | Disentangle some includes by moving QQmlJS::Directives into qqmljsengine_p.hLars Knoll2018-04-251-0/+1
|/ | | | | Change-Id: Iee5a5a9edc8b79649a8f43612584ecf046a9aa2c Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Fix debug-and-release builds with CONFIG += qtquickcompilerSimon Hausmann2018-03-311-1/+1
| | | | | | | | | Allow for QMLCACHE_DIR to be pre-defined when modified with debug or release suffix via exclusive_builds_post.prf. Task-number: QTBUG-66675 Change-Id: I007fd8359a860e4c7c2b3efdd90a678ddaad72c3 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
* Fix CONFIG+=qtquickcompiler with paths that contain spacesSimon Hausmann2018-03-271-0/+1
| | | | | | | | Map spaces to underscores as well. Task-number: QTBUG-54683 Change-Id: Id73c086a2845111623df631c06733ba2b42249e0 Reviewed-by: Andy Shaw <andy.shaw@qt.io>
* qtquick_compiler_add_resources() with spaces in pathsSimon Hausmann2018-03-271-1/+1
| | | | | | | | Ensure a quoted path when constructing the command line for rcc -list. Change-Id: I43e31015e3de58f65f46d2e594cb362d71b123ed Task-number: QTBUG-57758 Reviewed-by: Kevin Funk <kevin.funk@kdab.com>
* Fix CONFIG+=qtquickcompiler with Q_CLEANUP_RESOURCESimon Hausmann2018-03-191-3/+11
| | | | | | | | | As we provide the init resources wrapper, we must also provide the cleanup wrapper. Change-Id: I7e45ae48ba955e70ffd8e253d4d2c15d0a50dabe Task-number: QTBUG-67087 Reviewed-by: Lars Knoll <lars.knoll@qt.io>