generator: --backend ui — universal authoring for UI plugin backends

New emitters (lidl_gen_ui.{h,cpp}) for type=ui_qml + interface=universal
modules: from the author's single clean impl class (optionally deriving
LogosModuleContext), generate
  <name>.rep            — the view contract, one SLOT per public method
                          (framework hooks like onContextReady excluded)
  <name>_ui_interface.h — PluginInterface subclass + IID
  <name>_ui_glue.{h,cpp}— plugin deriving <Cls>SimpleSource +
                          <Cls>Interface + <Cls>ViewPluginBase; slots
                          forward to the impl (std<->Qt at the boundary);
                          Q_INVOKABLE initLogos(LogosAPI*) builds
                          LogosModules, wires modules(), stamps context
                          (fires onContextReady — same order as the
                          universal core glue), then setBackend(this).

Typed dependency callers, typed event subscriptions and bind_<interface>
binders come from the existing umbrella pass (logos_sdk.h), which already
runs for UI modules. ui-host's reflection-based initLogos call site is
unchanged; legacy LogosAPI*-based UI plugins are untouched. v1 view API
types: void/int/uint/float64/bool/string; logos_events: rejected for ui
backends (views talk to QML via .rep, not module events).
This commit is contained in:
Dario Gabriel Lipicar
2026-06-12 15:06:04 -03:00
parent 78a59a0610
commit f21b62a6fc
4 changed files with 284 additions and 0 deletions
+35
View File
@@ -2,6 +2,7 @@
#include "experimental/lidl_gen_client.h"
#include "experimental/lidl_gen_provider.h"
#include "experimental/lidl_gen_cdylib.h"
#include "experimental/lidl_gen_ui.h"
#include "experimental/lidl_parser.h"
#include "experimental/lidl_serializer.h"
#include "experimental/impl_header_parser.h"
@@ -196,6 +197,40 @@ int main(int argc, char* argv[])
return 0;
}
if (backend == "ui") {
// UI-backend authoring (type=ui_qml + interface=universal):
// derive the .rep view contract from the impl header and emit
// the plugin glue that forwards slots to the impl and wires
// LogosModules/context in initLogos. Typed dependency callers,
// typed event subscriptions and bind_<interface> binders come
// from the umbrella pass (logos_sdk.h), same as core modules.
QString uiErr;
if (!lidlUiSupported(mod, &uiErr)) {
err << "Error: module not ui-backend-eligible: " << uiErr << "\n";
return 12;
}
struct Out { QString file; QString content; };
QList<Out> outs;
outs.append({mod.name + ".rep", lidlMakeUiRepFile(mod)});
outs.append({mod.name + "_ui_interface.h", lidlMakeUiInterfaceHeader(mod)});
outs.append({mod.name + "_ui_glue.h",
lidlMakeUiGlueHeader(mod, implClass, implHeader)});
outs.append({mod.name + "_ui_glue.cpp",
lidlMakeUiGlueSource(mod, implClass)});
for (const Out& o : outs) {
const QString abs = QDir(genDirPath).filePath(o.file);
QFile f(abs);
if (!f.open(QIODevice::WriteOnly | QIODevice::Truncate | QIODevice::Text)) {
err << "Failed to write: " << abs << "\n";
return 13;
}
f.write(o.content.toUtf8());
out << "Generated: " << abs << "\n";
}
out.flush();
return 0;
}
if (backend == "qt") {
// Generate provider header (Qt glue)
QString glueHeaderAbs = QDir(genDirPath).filePath(mod.name + "_qt_glue.h");