Skip to content

Refactor: Foundational Major InfiniFrame.Native c++ rework#322

Merged
AnnaSasDev merged 86 commits into
corefrom
native-rework
May 19, 2026
Merged

Refactor: Foundational Major InfiniFrame.Native c++ rework#322
AnnaSasDev merged 86 commits into
corefrom
native-rework

Conversation

@AnnaSasDev
Copy link
Copy Markdown
Member

@AnnaSasDev AnnaSasDev commented May 17, 2026

Summary

A comprehensive rework of the InfiniFrame.NativeBridge native C++ layer. The previously monolithic Window.cpp and Exports.cpp have been decomposed into focused, single-responsibility files grouped by platform and concern. New shared utility headers, a Public/ API surface, .clang-format/.clang-tidy configs, and a native-tidy.ps1 script bring the C++ codebase up to a consistent, maintainable standard. CI workflows have been updated to match the new folder structure and to validate that test exports do not leak into production builds.


Type of Change

  • Bug fix (non-breaking change fixing an issue)
  • New feature (non-breaking change adding functionality)
  • Breaking change (fix or feature impacting existing APIs)
  • Refactor / Code cleanup (no functional change)
  • Documentation update
  • Test addition or update
  • Other (please describe):

Affected Modules / Scope

  • InfiniFrame
  • InfiniFrame.Blazor
  • InfiniFrame.BlazorWebView
  • InfiniFrame.Js
  • InfiniFrame.Native
  • InfiniFrame.Shared
  • InfiniFrame.WebServer
  • InfiniFrame.Tools.Pack
  • InfiniFrameExample
  • InfiniFrameTests
  • Other: CI / GitHub Actions workflows, native build & tidy scripts

Changes Introduced

Native C++ modularisation

  • Deleted Window.cpp and Exports.cpp; replaced with a modular file tree grouped by platform and responsibility.
  • Windows (Platform/Windows/Core/): WindowLifecycle, WindowState, WindowEvents, WindowProc, WindowStorage, WindowTracing, WindowEncoding, WindowOwnership + header context files Window.Win32.Context.h / Window.Win32.Internal.h.
  • Windows WebView2 (Platform/Windows/WebView/): WebView2Attach, WebView2Controller, WebView2Host, WebView2Runtime.
  • Linux (Platform/Linux/Core/): UiDispatcher.Gtk, WindowCore.Gtk, WindowEvents.Gtk, WindowInitialization.Gtk, WindowLifecycle.Gtk, WindowSignals.Gtk.
  • Exports (Public/Exports/): Exports.Dialog, Exports.Events, Exports.Lifecycle, Exports.Memory, Exports.Platform, Exports.WindowCommands, Exports.WindowState, Exports.Tests.

Public API surface

  • Moved InfiniFrame.h, InfiniFrameWindow.h, InfiniFrameWindowImpl.h, InfiniFrameInitParams.h, InfiniFrameDialog.h to Native/Public/ to clearly separate the stable API from internal implementation files.

New shared utilities

  • Utils/ExportGuards.h — guards that prevent test exports from appearing in release builds (validated by CI).
  • Utils/ErrorCode.h — standardised error-code helpers.
  • Utils/StringCopy.h — safe cross-platform string-copy utilities.
  • Utils/WindowsHandles.h — RAII wrappers for Win32 handles.
  • Utils/Dimensions.h — geometry helpers.
  • Utils/Result.h — lightweight result type.

Interop safety & naming

  • Renamed InfiniFrameNativeStatusInfiniFrameNativeInteropStatus for clarity.
  • Refactored all export functions to validate status before executing, replacing throw-based paths with early-return InteropStatus codes.
  • Added NullToEmpty utility for safe nullable-string handling in exports.

Code-style tooling

  • Added .clang-format (column width, access-modifier alignment, parameter formatting) and .clang-tidy (naming conventions, modern-C++ checks) configs.
  • Added native-tidy.ps1 with parameterised build-dir and ApplyFixes flag.
  • Updated native-format.ps1 to exclude build/, dependencies/, and packages/ directories.

CI / workflow updates

  • Updated all workflow paths and CMakeLists.txt references to reflect the new folder structure (.gitattributes, codeql-config.yml, bump_version.py).
  • Added NativeArch parameter support to release and testing workflows.
  • Added a step that validates the absence of forbidden NativeBridge test exports in production artifacts.
  • Commented out macOS ARM64 CodeQL matrix entry pending runner availability.
  • Upgraded TUnit to v1.45.0; removed redundant native dependency-handling from test projects.

Related Issues

Closes #323


Checklist

  • My code follows InfiniFrame's coding conventions
  • I added comments for complex or non-obvious code
  • Documentation updated (if applicable)
  • All tests pass locally
  • Added new tests for any new functionality (InfiniFrameNativeParameterTests.cs)
  • Existing tests pass
  • No new warnings or errors introduced
  • PR only includes changes relevant to the issue / feature

📖 Additional Context

The primary motivation was maintainability: the old single-file approach made it impossible to navigate, review, or inc

…I calls, improving diagnostics, and ensuring resource cleanup.
…orts.Events.cpp`, improving maintainability and organization. Removed unused and redundant code.
…nux (GTK/WebKit) and Windows (Win32/WebView2).
…Windows (Win32/WebView2) window initialization logic to a dedicated file.
@AnnaSasDev AnnaSasDev changed the title Feat: Native rework Refactor: Major InfiniFrame.Native c++ rework May 17, 2026
@AnnaSasDev AnnaSasDev self-assigned this May 17, 2026
@AnnaSasDev AnnaSasDev mentioned this pull request May 17, 2026
15 tasks
AnnaSasDev added 23 commits May 17, 2026 19:07
…t) and macOS (Cocoa/WebKit); replace with modularized, cross-platform WebView bridge components.
…indows, macOS, Linux), preparing for a unified, modularized bridge.
…ies to a dedicated folder. Update CMake and include paths accordingly.
…Exports.h`. Update include paths and CMake references accordingly.
…ort logic into shared core. Update references and CMake configurations accordingly.
…afer lock age calculations and improving error handling.
…update `InteropStatus` handling. Renamed `InfiniFrameNativeStatus` to `InfiniFrameNativeInteropStatus` for clarity.
…zation for build directory and error fixing, and enhance Visual Studio environment setup with robust error handling.
…clang-format` settings with improved parameter alignment. Remove redundant option from `.clang-tidy`.
… single-line conditional statements and aligning parameter formatting across methods.
…namespace indentation, access modifier alignment, and naming conventions.
…ional `--extra-arg` options, improving compatibility.
…dded.h` for consistent naming conventions.
…nd parameter formatting for consistency throughout.
AnnaSasDev added 25 commits May 18, 2026 15:27
…ic, consolidate input handling, and improve artifact copy and verification processes."

This reverts commit 2939101.
…th `if-elif` for artifact type handling, update step names for clarity, and simplify artifact copy logic."

This reverts commit 01fc842.
…t handling, streamline `current-runner-only` logic, and improve verification process."

This reverts commit f98aa66.
…fact copy/verification logic and improve `current-runner-only` handling."

This reverts commit f210f8e.
…tion by replacing `copy_artifact` with `copy_flat`."

This reverts commit 611dc81.
… and improved `current-runner-only` support"

This reverts commit 25f1fb7.
…` action and update workflows"

This reverts commit a07e97e.
… native binary handling

- Refine `NativeArch` conditions for better platform distinction (e.g., separate `x64` and `arm64` handling).
- Standardize `<Content>` item attributes for clarity and consistency.
- Ensure alignment of native binaries with their respective runtime paths.
…eArch` conditions in project file

- Pass `NativeArch` as a matrix variable in Windows, macOS, and Linux workflows.
- Update `InfiniFrame.NativeBridge.csproj` to conditionally use `NativeArch` when specified, improving platform-specific handling.
- Eliminated unnecessary `/p:CMakePlatform` usage across Windows, macOS, and Linux workflows.
- Ensured `NativeArch` parameter is used consistently for platform-specific configurations.
…niframeJsSize` to `GInfiniframeJsData` and `GInfiniframeJsSize
…s `InfiniFrameJsUtf16` and `InfiniFrameJsUtf8` functions. Add section comments for clarity.
…ents for `Imports` and `Code`. Use `auto` for clarity and simplify mutex locks.
- Increase `dotnet build` timeout to 45 minutes and simplify build command formatting.
- Add timeout mechanism for native build lock to prevent indefinite waits.
- Simplified `CleanNative` target condition in `InfiniFrame.NativeBridge.csproj`.
- Expanded `native-clean.ps1` script to include additional directories for cleanup.
… adjust includes, and update alignment logic.
…ts with section comments for `Imports` and `Code`, adjust include paths for consistency.
@AnnaSasDev AnnaSasDev changed the title Refactor: Major InfiniFrame.Native c++ rework Refactor: Foundational Major InfiniFrame.Native c++ rework May 19, 2026
@AnnaSasDev AnnaSasDev linked an issue May 19, 2026 that may be closed by this pull request
2 tasks
@AnnaSasDev AnnaSasDev merged commit 95dc1e6 into core May 19, 2026
60 checks passed
@AnnaSasDev AnnaSasDev deleted the native-rework branch May 19, 2026 09:45
@AnnaSasDev AnnaSasDev linked an issue May 20, 2026 that may be closed by this pull request
2 tasks
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.

Feature | Harden and modularize the native interop layer Feature | Step away form Native Monolithic files

2 participants