Files
Dario Gabriel LipicarandClaude Opus 5 fe4f26cecf feat: build ui_qml glue with logos-view-generator, not logos-qt-generator
modulePreConfigure.nix switches the `--backend ui` invocation to
logos-view-generator (logos-view-module), which now owns that emitter and
the logos_ui_plugin_context.h it pairs with.

THE REASON THIS IS NOT COSMETIC. This builder pins logos-qt-sdk at 4a1104c,
which predates b7b82e5 — the commit that added the module teardown hook to
the ui emitter. At 4a1104c BOTH halves lack it, so every build has been
green and self-consistent, and the hook has NEVER REACHED A SINGLE SHIPPED
ui_qml MODULE. Measured on the same module, before and after, by loading the
built plugin with QPluginLoader and dumping its QMetaObject:

    BASELINE                      MIGRATED
      initLogos(LogosAPI*)          unloadFinished()      [signal]
                                    initLogos(LogosAPI*)
                                    int aboutToUnload()   [invokable]

So this delivers the hook for the first time rather than preserving it.

LOGOS_VIEW_INCLUDE_DIR is added BEFORE the qt-sdk root in
LogosModule.cmake, so the emitter and its header resolve from ONE pin. That
ordering is load-bearing until logos-qt-sdk stops installing its copy of
logos_ui_plugin_context.h — anything going through logos_module() is safe;
a hand-run cmake putting LOGOS_QT_SDK_ROOT first would silently get the
wrong header. Called out in the code rather than left implicit.

Blast radius is 7 modules, not one: package_manager_ui, chat_ui, wallet_ui,
test_uiqml_probe, test_fullapi_ui, calc_ui_cpp and templates/ui-qml-backend
all match ui_qml + interface:universal. None override aboutToUnload(), and
the base default is Synchronous, so every one answers 0 and no host waits —
the change is additive. Only package_manager_ui was built end to end.

Three assertions in tests/test-module-pre-configure.nix pin the binary
choice; repointing at logos-qt-generator fails them. Also corrects a comment
there that claimed "the ui backend still legitimately uses qt-sdk's".

7/7 checks green, 399 unit tests.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-22 19:59:50 -03:00

77 lines
3.3 KiB
Nix

# Main entry point for logos-module-builder library
# This file exports all the builder functions.
# The actual plugin build logic is delegated to the pluginBackend (e.g. logos-plugin-qt).
#
# logos-cpp-sdk and logos-module are owned by this builder and injected into
# backends — backends never resolve these deps themselves.
{ nixpkgs, lib, logos-nix ? null, uiBackend, coreBackend, logos-plugin-qt ? null, logos-view-module, logos-cpp-sdk, logos-protocol ? null, logos-qt-sdk ? null, logos-module, logos-test-framework, logos-rust-sdk ? null, nix-bundle-lgx, nix-bundle-logos-module-install, logos-standalone-app, builderRoot, rust-overlay ? null }:
let
# Import common utilities (backend-agnostic)
common = import ./common.nix { inherit lib nix-bundle-lgx nixpkgs logos-nix; };
# Import the metadata parser (reads metadata.json)
parseMetadata = import ./parseMetadata.nix { inherit lib; };
# Import the core module builder (routes to the right backend by type)
mkLogosModule = import ./mkLogosModule.nix {
inherit nixpkgs nix-bundle-lgx nix-bundle-logos-module-install logos-standalone-app lib;
inherit common parseMetadata builderRoot uiBackend coreBackend;
inherit logos-cpp-sdk logos-protocol logos-qt-sdk logos-module logos-test-framework logos-rust-sdk;
inherit logos-plugin-qt;
# The view (ui_qml) authoring flavour: source of the LogosView*.in
# templates handed to every plugin build as LOGOS_VIEW_TEMPLATE_DIR.
inherit logos-view-module;
inherit rust-overlay;
};
# Import the shared C++ plugin build pipeline (used by mkLogosQmlModule for backend builds)
buildCppPlugin = import ./buildCppPlugin.nix {
inherit nixpkgs nix-bundle-lgx nix-bundle-logos-module-install lib;
inherit common parseMetadata logos-cpp-sdk logos-protocol logos-qt-sdk logos-module uiBackend coreBackend builderRoot;
inherit logos-plugin-qt logos-view-module;
};
# Import the ui_qml module builder (QML view + optional C++ backend)
mkLogosQmlModule = import ./mkLogosQmlModule.nix {
inherit nixpkgs nix-bundle-lgx nix-bundle-logos-module-install logos-standalone-app lib;
inherit common parseMetadata logos-cpp-sdk logos-protocol logos-qt-sdk logos-module uiBackend coreBackend builderRoot;
inherit logos-plugin-qt logos-view-module;
};
# Import sub-builders that remain backend-agnostic
mkExternalLib = import ./mkExternalLib.nix { inherit lib common; };
mkStandaloneApp = import ./mkStandaloneApp.nix;
# Import the test builder
mkLogosModuleTests = import ./mkLogosModuleTests.nix {
inherit nixpkgs lib common parseMetadata;
inherit logos-cpp-sdk logos-protocol logos-qt-sdk logos-plugin-qt logos-test-framework;
# Source of logos-view-generator: a ui_qml module's unit tests run the same
# autoCodegen the plugin build does.
inherit logos-view-module;
};
in {
# Main builders
inherit mkLogosModule; # C++ Qt plugin modules (delegates to pluginBackend)
inherit mkLogosQmlModule; # ui_qml modules — QML view + optional C++ backend
inherit mkLogosModuleTests; # Unit tests for modules
# Lower-level standalone app builder
inherit mkStandaloneApp;
# Lower-level builders for advanced use cases
inherit mkExternalLib;
# Utilities
inherit parseMetadata;
inherit common;
# The active plugin backends
inherit uiBackend coreBackend;
# Version info
version = "0.2.0";
}