Files
php-qml/examples/todo/Makefile

75 lines
2.6 KiB
Makefile
Raw Normal View History

Phase 3 sub-commit 3: examples/todo POC app, built via the makers Standalone Composer/CMake project under examples/todo/ derived from the skeleton, demonstrating every Phase 3 architectural primitive in a non-trivial app. All cross-side wiring is maker-generated; no handwritten bridge glue. Generated and customised: - src/Entity/Todo.php — make:bridge:resource Todo (UUIDv7 id) - src/Controller/TodoController.php — make:bridge:resource Todo (CRUD) - src/Controller/MarkAllDoneController.php — make:bridge:command MarkAllDone, body filled in to flip done=true on every row - qml/TodoList.qml — make:bridge:resource Todo (starter ListView) - qml/TodoWindow.qml — make:bridge:window Todo, body customised to embed a read-only mirror of the same ReactiveListModel The Phase 1 ping demo is dropped from this app — it doesn't fit the todo flow and nothing in Main.qml references it. Main.qml is the real list UI: - Add input + button (POST /api/todos with optimistic-friendly key). - Per-row CheckBox + delete button (PATCH/DELETE via todoModel.invoke() with `pending` role driving opacity). - "Mark all done" button (POST /api/mark-all-done). - "Open second window" button (Component { TodoWindow {} } pattern). Build / run delegated to the same Makefile shape as the skeleton, with SCRIPT_DIR/QT_BIN updated for the renamed binary (build/qml/todo). composer.json's path repo points at ../../../framework/php (one level deeper than the skeleton's path repo). Verified end-to-end with offscreen QPA: POST/PATCH/DELETE on /api/todos all round-trip, /api/mark-all-done flips every row, Mercure dual- publishes on every change. Clean shutdown. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-02 15:22:36 +02:00
# php-qml — Todo example app — Make targets.
.DEFAULT_GOAL := help
SYMFONY_DIR := symfony
QML_SRC_DIR := qml
BUILD_DIR := build/qml
QT_BIN := $(BUILD_DIR)/todo
.PHONY: help
help: ## Show available targets
@awk 'BEGIN {FS = ":.*?## "} /^[a-zA-Z_-]+:.*?## / {printf " %-12s %s\n", $$1, $$2}' $(MAKEFILE_LIST)
.PHONY: install
install: ## Install Composer dependencies for the Symfony app
cd $(SYMFONY_DIR) && composer install
.PHONY: build
build: ## Build the Qt host
cmake -S $(QML_SRC_DIR) -B $(BUILD_DIR) -DCMAKE_BUILD_TYPE=Debug
cmake --build $(BUILD_DIR) --parallel
.PHONY: dev
dev: build ## Run the todo app in dev mode (FrankenPHP --watch + Qt host)
./scripts/dev.sh
.PHONY: doctor
doctor: ## Run bridge:doctor inside the Symfony app
cd $(SYMFONY_DIR) && bin/console bridge:doctor
.PHONY: doctor-connect
doctor-connect: ## Run bridge:doctor with backend connectivity probe
cd $(SYMFONY_DIR) && bin/console bridge:doctor --connect
.PHONY: clean
clean: ## Remove build artefacts
rm -rf $(BUILD_DIR)
.PHONY: integration
integration: ## Run the bridge-integration test (FrankenPHP boot + HTTP/SSE round-trip + crash-recover)
./tests/integration.sh
Phase 4a sub-commit 2: AppImage recipe (build-appimage.sh + make appimage) packaging/linux/build-appimage.sh produces a single-file Linux AppImage from a built host + Symfony tree + FrankenPHP binary. Auto-downloads (cached in tools/, gitignored) the three pieces of upstream tooling: - linuxdeploy + linuxdeploy-plugin-qt — gathers Qt runtime and QML modules into the AppDir, and bundles the offscreen platform plugin via EXTRA_PLATFORM_PLUGINS so headless CI can smoke it. - appimagetool — squashes the AppDir into the .AppImage. - runtime-x86_64 — appimagetool's prepended runtime stub, fetched once and passed via --runtime-file (ad-hoc downloads stalled on some networks). The two stages are kept separate (linuxdeploy stages, then we invoke appimagetool ourselves) so failures are observable rather than swallowed by linuxdeploy's bundled-tool path. AppDir layout matches BackendConnection's resolve* fallbacks: AppDir/usr/bin/<app> AppDir/usr/bin/frankenphp AppDir/usr/share/<app>/symfony/ AppDir/usr/share/<app>/Caddyfile examples/todo gets `make appimage`: stages a no-dev composer install into build/staging-symfony, points the path repo at the bundle's absolute path so Composer can find php-qml/bridge from the staging dir, then drives build-appimage.sh. Output: build/Todo-x86_64.AppImage (~104 MB). Verified locally: `make appimage` produces a working AppImage; mount + inspect + extract all clean. Headless run requires the bundled offscreen plugin (now wired); a real desktop launches it normally. Includes a 64×64 placeholder PNG icon (todo.png) and a minimal .desktop file for the example. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-02 19:42:51 +02:00
.PHONY: appimage
appimage: build ## Package as a single-file Linux AppImage at build/Todo-x86_64.AppImage
# Composer install --no-dev in a staging copy of symfony so the
# dev tree (with maker-bundle etc.) is left untouched.
rm -rf build/staging-symfony
rsync -a --delete \
--exclude='vendor/' \
--exclude='var/cache/' --exclude='var/log/' \
$(SYMFONY_DIR)/ build/staging-symfony/
# Rewrite the path repo to absolute so composer can find the bundle
# from the staging dir (different relative depth than the source tree).
BUNDLE_ABS="$$(cd $(SYMFONY_DIR)/../../../framework/php && pwd)"; \
sed -i "s|\"../../../framework/php\"|\"$$BUNDLE_ABS\"|" build/staging-symfony/composer.json
rm -f build/staging-symfony/composer.lock
cd build/staging-symfony && composer install --no-dev --no-interaction --classmap-authoritative
../../packaging/linux/build-appimage.sh \
--app-name todo \
--host-binary $(QT_BIN) \
--symfony-dir build/staging-symfony \
--frankenphp $${FRANKENPHP:-frankenphp} \
--caddyfile Caddyfile \
--desktop packaging/todo.desktop \
--icon packaging/todo.png \
--output build/Todo-x86_64.AppImage
@echo
@echo "AppImage built. Test with: ./build/Todo-x86_64.AppImage"
Phase 3 sub-commit 3: examples/todo POC app, built via the makers Standalone Composer/CMake project under examples/todo/ derived from the skeleton, demonstrating every Phase 3 architectural primitive in a non-trivial app. All cross-side wiring is maker-generated; no handwritten bridge glue. Generated and customised: - src/Entity/Todo.php — make:bridge:resource Todo (UUIDv7 id) - src/Controller/TodoController.php — make:bridge:resource Todo (CRUD) - src/Controller/MarkAllDoneController.php — make:bridge:command MarkAllDone, body filled in to flip done=true on every row - qml/TodoList.qml — make:bridge:resource Todo (starter ListView) - qml/TodoWindow.qml — make:bridge:window Todo, body customised to embed a read-only mirror of the same ReactiveListModel The Phase 1 ping demo is dropped from this app — it doesn't fit the todo flow and nothing in Main.qml references it. Main.qml is the real list UI: - Add input + button (POST /api/todos with optimistic-friendly key). - Per-row CheckBox + delete button (PATCH/DELETE via todoModel.invoke() with `pending` role driving opacity). - "Mark all done" button (POST /api/mark-all-done). - "Open second window" button (Component { TodoWindow {} } pattern). Build / run delegated to the same Makefile shape as the skeleton, with SCRIPT_DIR/QT_BIN updated for the renamed binary (build/qml/todo). composer.json's path repo points at ../../../framework/php (one level deeper than the skeleton's path repo). Verified end-to-end with offscreen QPA: POST/PATCH/DELETE on /api/todos all round-trip, /api/mark-all-done flips every row, Mercure dual- publishes on every change. Clean shutdown. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-02 15:22:36 +02:00
.PHONY: quality
quality: build ## Run PHPStan, php-cs-fixer (check), PHPUnit, qmllint, integration
cd ../../framework/php && composer quality
Phase 3 sub-commit 3: examples/todo POC app, built via the makers Standalone Composer/CMake project under examples/todo/ derived from the skeleton, demonstrating every Phase 3 architectural primitive in a non-trivial app. All cross-side wiring is maker-generated; no handwritten bridge glue. Generated and customised: - src/Entity/Todo.php — make:bridge:resource Todo (UUIDv7 id) - src/Controller/TodoController.php — make:bridge:resource Todo (CRUD) - src/Controller/MarkAllDoneController.php — make:bridge:command MarkAllDone, body filled in to flip done=true on every row - qml/TodoList.qml — make:bridge:resource Todo (starter ListView) - qml/TodoWindow.qml — make:bridge:window Todo, body customised to embed a read-only mirror of the same ReactiveListModel The Phase 1 ping demo is dropped from this app — it doesn't fit the todo flow and nothing in Main.qml references it. Main.qml is the real list UI: - Add input + button (POST /api/todos with optimistic-friendly key). - Per-row CheckBox + delete button (PATCH/DELETE via todoModel.invoke() with `pending` role driving opacity). - "Mark all done" button (POST /api/mark-all-done). - "Open second window" button (Component { TodoWindow {} } pattern). Build / run delegated to the same Makefile shape as the skeleton, with SCRIPT_DIR/QT_BIN updated for the renamed binary (build/qml/todo). composer.json's path repo points at ../../../framework/php (one level deeper than the skeleton's path repo). Verified end-to-end with offscreen QPA: POST/PATCH/DELETE on /api/todos all round-trip, /api/mark-all-done flips every row, Mercure dual- publishes on every change. Clean shutdown. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-02 15:22:36 +02:00
cmake --build $(BUILD_DIR) --target all_qmllint
./tests/integration.sh