Skip to content

extract app builder from module builder - #103

Open
iurimatias wants to merge 1 commit into
masterfrom
extract_app_builder
Open

extract app builder from module builder#103
iurimatias wants to merge 1 commit into
masterfrom
extract_app_builder

Conversation

@iurimatias

Copy link
Copy Markdown
Contributor

This simplifies the code here and also removes a circular dependency

Copilot AI review requested due to automatic review settings May 26, 2026 17:51

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR extracts UI/QML app-building responsibilities out of logos-module-builder into logos-app-builder to simplify the module builder and remove a circular dependency.

Changes:

  • Removed UI/QML builders (mkLogosQmlModule, mkStandaloneApp) and dependency collection helper (collectAllModuleDeps) from logos-module-builder, while keeping/exposing buildCppPlugin for reuse.
  • Removed UI/QML templates and related tests/integration checks from this repo.
  • Updated README/docs/skills to redirect UI/QML guidance to logos-app-builder.

Reviewed changes

Copilot reviewed 26 out of 26 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
tests/test-templates.nix Drops UI/QML template assertions; keeps core template validation.
tests/test-qml-integration.nix Removes QML integration test tied to mkLogosQmlModule.
tests/test-common.nix Removes collectAllModuleDeps test now that helper moved out.
tests/test-collectAllModuleDeps.nix Removes dedicated dependency-walker test suite (function moved out).
tests/default.nix Stops importing/running removed dependency-walker tests.
templates/ui-qml/metadata.json Removes QML-only template content from this repo.
templates/ui-qml/Main.qml Removes QML-only template content from this repo.
templates/ui-qml/flake.nix Removes QML-only template flake from this repo.
templates/ui-qml-backend/src/ui_example.rep Removes UI backend template content from this repo.
templates/ui-qml-backend/src/ui_example_plugin.h Removes UI backend template content from this repo.
templates/ui-qml-backend/src/ui_example_plugin.cpp Removes UI backend template content from this repo.
templates/ui-qml-backend/src/ui_example_interface.h Removes UI backend template content from this repo.
templates/ui-qml-backend/src/qml/Main.qml Removes UI backend template content from this repo.
templates/ui-qml-backend/metadata.json Removes UI backend template content from this repo.
templates/ui-qml-backend/flake.nix Removes UI backend template flake from this repo.
templates/ui-qml-backend/CMakeLists.txt Removes UI backend template build file from this repo.
skills/create-ui-module.md Updates UI module guidance to use logos-app-builder.
skills/create-qml-module.md Updates QML-only module guidance to use logos-app-builder.
README.md Removes in-repo UI/QML instructions and redirects to logos-app-builder.
lib/mkStandaloneApp.nix Deletes standalone app launcher builder (moved out).
lib/mkLogosQmlModule.nix Deletes QML module builder (moved out).
lib/mkLogosModule.nix Removes nix run/standalone-app wiring; keeps module build/test outputs.
lib/default.nix Stops exporting removed app/QML builders; exports buildCppPlugin for reuse.
lib/common.nix Removes collectAllModuleDeps; retains shared utility helpers.
flake.nix Drops logos-standalone-app input, removes UI templates, removes QML integration check.
docs/nix-api.md Updates API overview to reflect moved functions and new buildCppPlugin focus.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread docs/nix-api.md Outdated
Comment on lines 14 to 18
> **Note:** `mkLogosQmlModule`, `mkStandaloneApp`, and `collectAllModuleDeps` have been moved to [`logos-app-builder`](https://github.com/logos-co/logos-app-builder). Use `logos-app-builder.lib.mkLogosQmlModule` for `ui_qml` modules.

## mkLogosModule

Builder for core C++ modules and legacy UI widget modules. For `ui_qml` modules (QML view with optional C++ backend), use `mkLogosQmlModule` instead.
Comment thread docs/nix-api.md Outdated
Comment on lines 247 to 251
## mkLogosQmlModule (moved to logos-app-builder)

> **Moved:** This function is now in `logos-app-builder.lib.mkLogosQmlModule`. The documentation below is kept for reference.

Builder for `ui_qml` modules — QML view with an optional C++ backend. Validates that `metadata.json` has `"type": "ui_qml"` and a non-null `"view"` field. When `"main"` is declared, compiles the C++ backend via `buildCppPlugin` and bundles it alongside the QML view. When `"main"` is absent, produces a QML-only output (no compilation). Always wires `apps.default`.
Comment thread docs/nix-api.md Outdated
Comment on lines 441 to 445
### mkStandaloneApp (moved to logos-app-builder)

> **Moved:** This function is now in `logos-app-builder.lib.mkStandaloneApp`.

Build the `apps.default` entry for `nix run`.
Comment thread README.md
Comment on lines +82 to +86
### UI modules

For `type: "ui_qml"` modules, `logos-module-builder` automatically wires up `apps.default` so `nix run .` launches the module in `logos-standalone-app`. No separate `logos-standalone-app` input is needed — it is bundled inside `logos-module-builder`.
UI/QML module building and standalone app launching have been moved to [`logos-app-builder`](https://github.com/logos-co/logos-app-builder). Use `logos-app-builder.lib.mkLogosQmlModule` for `type: "ui_qml"` modules and `logos-app-builder.lib.mkLogosApp` to add `nix run` support to legacy UI modules.

**With C++ backend** (`mkLogosQmlModule` — validates `"type": "ui_qml"` + `"view"` field, compiles backend when `"main"` is set):

The C++ plugin runs in a separate `ui-host` process (process-isolated), and the QML view is loaded in the host application. Communication happens via Qt Remote Objects over a private socket. Use `logos.module()` from QML to access the backend replica.

```nix
{
inputs = {
logos-module-builder.url = "github:logos-co/logos-module-builder";
# Add backend dependencies as inputs:
# calc_module.url = "github:logos-co/logos-tutorial?dir=logos-calc-module";
};

outputs = inputs@{ logos-module-builder, ... }:
logos-module-builder.lib.mkLogosQmlModule {
src = ./.;
configFile = ./metadata.json;
flakeInputs = inputs;
};
}
```

**QML-only** (`mkLogosQmlModule` — no C++ compilation, runs in-process):
```nix
{
inputs = {
logos-module-builder.url = "github:logos-co/logos-module-builder";
};

outputs = inputs@{ logos-module-builder, ... }:
logos-module-builder.lib.mkLogosQmlModule {
src = ./.;
configFile = ./metadata.json;
flakeInputs = inputs;
};
}
```

Then `nix run .` launches the module in `logos-standalone-app`. Dependencies listed in `metadata.json` are automatically bundled from their LGX packages and loaded at runtime.

See `templates/ui-qml-backend`, `templates/ui-qml`, and `lib/mkLogosQmlModule.nix`.

### UI integration tests

For `ui_qml` modules, `mkLogosQmlModule` auto-detects `.mjs` test files in the `tests/` directory and wires up integration testing using [logos-qt-mcp](https://github.com/logos-co/logos-qt-mcp)'s test framework. No extra flake inputs needed.

```bash
# Run tests hermetically (builds everything, launches headless, runs tests)
nix build .#integration-test -L

# Build the test framework for interactive use (one-time)
nix build .#test-framework -o result-mcp

# Run tests interactively (app must be running with inspector on :3768)
node tests/ui-tests.mjs
```

Tests use the QML inspector to interact with the running UI — finding elements, clicking buttons, verifying text. Example test file (`tests/ui-tests.mjs`):

```javascript
import { resolve } from "node:path";

// CI sets LOGOS_QT_MCP automatically; for interactive use: nix build .#test-framework -o result-mcp
const root = process.env.LOGOS_QT_MCP || new URL("../result-mcp", import.meta.url).pathname;
const { test, run } = await import(resolve(root, "test-framework/framework.mjs"));

test("my_module: loads UI", async (app) => {
await app.waitFor(
async () => { await app.expectTexts(["Hello"]); },
{ timeout: 15000, interval: 500, description: "UI to load" }
);
});

run();
```

See the [logos-qt-mcp](https://github.com/logos-co/logos-qt-mcp) test framework for available assertions and helpers.
See the [logos-app-builder README](https://github.com/logos-co/logos-app-builder) for details.
extract app builder from module builder

ci fix

update docs
@iurimatias
iurimatias force-pushed the extract_app_builder branch from 6799296 to a960afa Compare May 26, 2026 18:04
dlipicar added a commit that referenced this pull request Jul 17, 2026
Bumps the SDK inputs to the merged fixes surfaced by the full_api test chain:
- logos-protocol   -> 4775e63 (#21, qvariantToNlohmann container int-preservation)
- logos-cpp-sdk    -> 2f34804 (#103, bstr + composite-any codegen)
- logos-qt-sdk     -> 089142d (#10, QtProviderObject QVariantList/Map args)
- logos-rust-sdk   -> a55fdac (#26, clone any event params)

Validated: all five test-modules full_api modules (C++/Rust providers, C++/Rust
proxies, ui_qml plugin) build through this module-builder with no SDK overrides.

Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants