Repository navigation
Enable native window detection for consumers [#397] - #410
Conversation
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 48 minutes. View limit details
No actionable comments were generated in the recent review.
|
| Layer / File(s) | Summary |
|---|---|
Détection par défaut et registre partagé CMakeLists.txt, cmake/Frontends.cmake, docs/FRONTENDS.md, docs/PROJECT_STATUS.md |
L’autodétection par défaut ne dépend plus de la construction des exemples ni du statut de projet racine. Le registre et les options des frontends sont conservés dans les propriétés globales et rechargés par les fonctions qui les consultent. |
Configuration de la fenêtre native cmake/Frontends.cmake, README.md, docs/FRONTENDS.md, docs/CHANGELOG.md, test/cmake/consumer/CMakeLists.txt, test/cmake/consumer/main.cpp |
webfront_use_native_window(target) applique le hook SETUP et définit WEBFRONT_NATIVE_WINDOW lorsque le frontend natif est activé. Dans le cas contraire, la fonction signale le recours au navigateur par défaut. Le projet consommateur de test choisit son type WebFront selon cette définition. |
Vérification des projets consommateurs test/cmake/CheckFrontendConsumer.cmake, test/cmake/frontend-consumer/*, test/unit/CMakeLists.txt |
Les tests vérifient l’accès aux API depuis des répertoires parent et frère, le comportement sur une plateforme non prise en charge et les configurations avec ou sans le projet complet. Le test consommateur existant désactive explicitement l’autodétection native. |
Priority:
Estimated code review effort: 3 (Moderate) | ~25 minutes
Change: Feature · Severity of issue fixed: Medium
Sequence Diagram(s)
sequenceDiagram
participant ConsumerCMake
participant webfront_use_native_window
participant NativeFrontendSetup
participant ConsumerTarget
ConsumerCMake->>webfront_use_native_window: Configure la cible
webfront_use_native_window->>webfront_use_native_window: Vérifie l’option native de la plateforme
alt Frontend natif activé
webfront_use_native_window->>NativeFrontendSetup: Appelle le hook SETUP
NativeFrontendSetup->>ConsumerTarget: Configure la cible
webfront_use_native_window->>ConsumerTarget: Définit WEBFRONT_NATIVE_WINDOW
else Frontend natif non activé
webfront_use_native_window-->>ConsumerCMake: Signale le navigateur par défaut
end
Possibly related issues
- WebFront issue 398 : le PR couvre le choix entre fenêtre native et navigateur lors de la configuration, mais pas le repli à l’exécution sans session graphique.
Possibly related PRs
- ambroise-leclerc/WebFront#371 : cette PR introduit l’autodétection et les options natives réutilisées ici.
Suggested reviewers: am-l
Merge Risk: 
Minimal · previous review 1cf23
-
Native detection is available to consumers, with browser fallback when unavailable. No merge-blocking issue was established.
Pre-merge checks: 
4 · 
1
-
Failed checks: 1 warning Passed checks: 4 passed-
Full details: Linked Issues check
-
Explanation
Les exigences de l’issue
#397sont couvertes.CMakeLists.txtactive la détection native pour les consommateurs hors tests et fuzzing.cmake/Frontends.cmakepartage le registre et les résultats via des propriétés globales. Les helpers publics rechargent ces données depuis les répertoires consommateurs.webfront_use_native_window(target)applique le hook du moteur actif, définitWEBFRONT_NATIVE_WINDOWseulement si le moteur est disponible et conserve le repli navigateur sinon. Les fixturestest/cmake/frontend-consumervérifient les répertoires parent et frère, les hooks, les moteurs activés ou désactivés et la plateforme non prise en charge.
Full details: Out of Scope Changes check
-
Explanation
Les changements restent dans le périmètre de
#397. La documentation, le changelog, le statut du projet et les tests CMake décrivent ou vérifient la détection native pour les consommateurs. Aucun changement indépendant ou sans lien avec cet objectif n’est démontré.
Full details: Description check
-
Explanation
La description décrit directement les changements du PR : détection native pour les consommateurs add_subdirectory/CPM, partage du registre frontend, ajout de webfront_use_native_window(target), repli vers le navigateur et tests associés.
-
Full details: Docstring Coverage
-
Explanation
Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 1 functions across 1 files. (13 skipped: 13 unsupported.)
Resolution
Write docstrings for the functions missing them to satisfy the coverage threshold.
-
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
Comment @coderabbitai help to get the list of available commands.
There was a problem hiding this comment.
🟡 Changes recommended
Two unresolved active findings remain in the change, including grammatical and maintainability issues flagged in the docs and CMake files that still need author attention.
2 open issues
What changed in this PR
This PR resolves #397, where consumers integrating WebFront via add_subdirectory/CPM could not benefit from native-window detection: the frontend registry and detection results lived in WebFront's directory scope (PARENT_SCOPE normal variables), so the public frontend helpers were inert outside WebFront's own directory. The change moves the registry and configured option state into GLOBAL properties (reloaded in each helper via a new _webfront_load_frontends macro), enables native detection by default for any non-test/non-fuzzing build, and adds a single consumer-facing helper webfront_use_native_window(target) that applies the native engine's setup and defines WEBFRONT_NATIVE_WINDOW with a browser fallback and installation guidance.
Changes:
- Share frontend metadata and the detected/declared option state across directory scopes via
GLOBALproperties, sowebfront_native_frontend_option/webfront_setup_frontends_for_targetwork from parent/sibling dirs. - Default
WEBFRONT_AUTODETECT_NATIVEto ON for all builds exceptENABLE_TESTING/ENABLE_FUZZING, and addwebfront_use_native_window(target). - Add CMake regression fixtures (parent/sibling/unsupported, enabled/disabled engine, full-project offline configure) plus README/FRONTENDS/PROJECT_STATUS/CHANGELOG documentation.
| File | Description |
|---|---|
cmake/Frontends.cmake |
Core change: _webfront_load_frontends macro, GLOBAL-property registry/ENABLED publishing, and new webfront_use_native_window helper. |
CMakeLists.txt |
Default native detection to ON outside test/fuzzing builds, regardless of top-level/examples. |
test/cmake/frontend-consumer/** |
New fixture exercising the helpers across parent/sibling/unsupported scopes and offline full-project configure. |
test/cmake/CheckFrontendConsumer.cmake |
Driver running the fixture for probe×full-project combinations and asserting the fallback notice. |
test/cmake/consumer/{CMakeLists.txt,main.cpp} |
Smoke consumer now calls webfront_use_native_window and selects the app type via WEBFRONT_NATIVE_WINDOW. |
test/unit/CMakeLists.txt |
Registers FrontendConsumerConfiguration and opts the smoke test out of detection. |
README.md, docs/FRONTENDS.md, docs/PROJECT_STATUS.md, docs/CHANGELOG.md |
Document the consumer helper, default detection, and cross-directory behavior. |
I verified the global-property sharing, ENABLED republishing, and option-precedence logic are internally consistent, that WebFrontWithFrontend/NativeWebViewFrontend exist as referenced, and that the README anchor resolves. Two findings recorded: a subject–verb grammar error in docs/FRONTENDS.md, and an optional maintainability note about the fallback-advice block being duplicated from examples/CMakeLists.txt.
Review effort: Balanced
1cf2327 to
24c09a1
Compare
A parent's ENABLE_TESTING or ENABLE_FUZZING no longer disables native window detection for its consumers; only a top-level WebFront build keeps that exclusion. The registry loader leaves ordinary variables untouched when no registry was published, and the browser-fallback advice is printed once per configuration. Generic test option names are tracked in #412.

Consumer projects using add_subdirectory or CPM cannot see the native frontend registry or automatically detected options, so the public frontend helpers do not configure their application targets. This enables native detection by default outside test and fuzzing builds, shares the registry and configured results across directories, and adds
webfront_use_native_window(target)to select the native frontend with a browser fallback.The default MSVC detection downloads the pinned WebView2 SDK during configuration; browser-only or offline consumers can disable automatic detection. The helper distinguishes explicitly disabled engines from missing dependencies, and the registry publishes option changes made while loading support modules.
Regression fixtures retain the actual host system while testing parent and sibling scopes, caller overrides, support-module changes and offline configuration. Native desktop jobs also compile a consumer against the real platform frontend, reusing the provisioned SDK.
Fixes #397
Validation:
JasmineRunnerArgumentsAndDeadlinefailed its unrelated-SIGKILL timeout case.-Wno-error=nonnullfor an existing React test warning. WebKitGTK development files were unavailable locally; the native desktop CI jobs cover actual native consumer compilation.FrontendConsumerConfigurationandAddSubdirectoryNativeConsumerpassed on all three platforms.