Repository navigation
0.27.0: rules-qml (QML applications) on rules-qt - #66
Merged
Merged
Conversation
…all off or unchanged by default
…d (mcpp#1011), marked and checked as an engine-gap workaround
…conf; fixture qml-consumer
…ders and the plugin-logic cases
…le name Windows refuses
speak-agent
marked this pull request as draft
November 23, 2026 20:03
…ies what the build deploys beside the program; mcpp.plugins.binary and its fixture go with it
…sources, plain base classes reach the registrar, import scanning keeps line breaks); restore the qml plugin-logic cases the workaround removal dropped
…mlIntegration (header-only) lives; QtQml's own header includes it
…lt into; mcpp pack does not stage Qt's frameworks there yet
…DK only, not to a project's import_paths
… deploys (mcpp#1011)
…s from the module lists; the shader check accepts the url a compiled component reports
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
rules-qml(mcpp.rules.qml): mcpp's first-class support for QML applications, as a build plugin that sits onrules-qt. A project states its QML modules inbuild.mcpp; the rule declares the chainqt_add_qml_moduleruns as actions, places Qt's own QML modules beside the program, and writes aqt.conf.mcpp::rules::qml::options o; o.qt.modules = { "Core", "Gui", "Qml", "Quick" }; mcpp::rules::qml::qml_module probe; probe.uri = "Probe"; probe.root = "qml/Probe"; probe.sources = { "qml/Probe/**/*.qml", "qml/Probe/**/*.js" }; o.modules = { probe }; return mcpp::rules::qml::compile(o) ? 0 : 1;moc --output-json→qmltyperegistrar(the SDK's and the other modules' type descriptions as foreign types, so a C++ type may derive from another module's) →qmlcachegenper file and its loader →rcc;qsbfor shaders;qmllintas acheck. Everything is arole = sourceaction with declared inputs/outputs; the generated.cppfiles are compiled into the executable, so a module is static andloadFromModulefinds it.importstatements and the SDK'sqmldir/.qmlfiles at plan time (the closureqmlimportscannercomputes; equal to the scanner's on four samples), and placed underqml/withdeploy.qt.conf(Prefix = .,Qml2Imports = qml), written by default, yielding to a project's own.rules-qt, additive and off by default:moc_json,moc_includes,compile_ex,i18n.extensions.The engine gap (mcpp#1011) was the engine's
mcpp packcomputed the runtime closure from the program alone, so a plugin thatdeployplaces beside it (libqxcb.so,libqquicklayoutsplugin.so) was packed without the libraries it loads (measured onqml-deploy: 40 libraries packed, none oflibQt6QuickLayouts,libQt6QuickShapes,libQt6XcbQpa). mcpp 2026.11.23.1 (mcpp#1006) takes what the build deploys beside the program as a root of the closure, so this PR carries no workaround. CI pins that release (MCPP_VERSION,MCPP_BOOTSTRAP,MCPP_EDITOR_VERSION). The package floor stays 2026.10.30.1, as for 0.21.0's cross CMake lane: the build andrules-qtrun on the older engine and only a pack that carries the plugins' libraries needs the new one, which README anddocs/rules-qml.mdstate. Measured with the release on Linux:qml-deploy's packed tree holds all 1058 SDK dependencies of its files, andqt-widgets-consumer's haslibQt6XcbQpa.so.6.On macOS
mcpp packdoes not stage Qt's frameworks yet (the Widgets fixture ofrules-qtdoes not pack there either), so the QML fixtures checkqml/andqt.confin the directory the program is built into.Tests
tests/plugin-logic: a golden of the 0.26rules-qtdirectives that fails if any changes; every action ofrules-qml, its generatedqmldir/qrc text, input refusals, header ownership, the import closure withstyles/imports/import_paths,qt.conf. 70 cases in all.qml-consumer(C++ types, singletons, a script, a nested file, a resource,qsTr; AOT symbol check; an edit regenerates one unit and the resources and nothing else, by time stamp; variantsnoaot,styles,noconf),qml-modules,qml-deploy(compared withqmlimportscanner, packed-tree closure, packed program run with the SDK's directory renamed away),qml-import-only,qml-shaders(Linux; skips with a notice while the publishedqsbis the pre-xim-pkgindex#1262 one).--configure-only) and the editor lane;plugin-logicpasses under LLVM 22.1.8 with libc++.Toolchains follow
rules-qt: Linux gcc withcxx_runtime = "toolchain-coupled", the engine's default elsewhere.Verification
CI on 2be9a2b, all six jobs: rules (windows), rules (macos), consumers (linux), llvm (linux, libc++), editor, deps without Visual Studio (managed MSVC). The Windows and macOS code paths (
qt.conf,-Fand-I<sdk>/includeformoc, the deployedqml/tree,qmlimportscanneragainst the deployed modules) first ran there, and the two bugs they showed are fixed (QtQmlIntegration, header-only, is in<sdk>/includeon macOS; Python andllvm-readobjwrite\r\non Windows). No display was available on Linux, so the xcb plugin is checked by what the packed tree contains, not by a start;qml-shadersruns on Linux CI now thatqsbstarts.A multi-perspective review of the diff reported ten items. Six are fixed:
qsbmissing left.qsbfiles in the resources; shader outputs could collide and their directory was not created; a plain QObject base header never reached the registrar; an empty SDK metatypes entry gave--foreign-types=,...; the import scanner lost line breaks in comments and ran an unterminated quote across lines; the Windows debug-twin rule hit a project'simport_paths. Four are left on purpose: explicitheadersare matched to moc units by the path string (the same route builds both, and the fixtures that list headers pass on all three platforms); header ownership is read from the text, so a QML macro in a comment counts (the refusal names the header and how to list it); onedeployper file, which costs plan time only; an emptyi18n.extensions, which is what the project asked for.Design and evidence:
.agents/docs/2026-11-24-rules-qml-design.mdand its spikes.