Isolate platform SDK includes from app header

This commit is contained in:
2026-06-04 18:58:02 +02:00
parent 08d8c1e82c
commit 63ea626cef
5 changed files with 30 additions and 8 deletions

View File

@@ -583,6 +583,12 @@ Known local toolchain state:
while non-Windows platforms still reach retained platform bridges through
the debt-tracked adapter isolated in
`src/platform_legacy/legacy_platform_services.*`.
- `src/app.h` now forward-declares retained platform handles instead of
including Objective-C, Android, or GLFW SDK headers. The full platform SDK
headers needed by retained non-Windows bridges are included in
`src/platform_legacy/legacy_platform_services.cpp`, keeping central app
header consumers lighter while `DEBT-0055` tracks removal of those handles
from `App`.
- `pp_platform_api` also owns `plan_asset_file_load`, the SDK-free file-load
policy consumed by `LayoutManager` for XML layout reload decisions. The
helper preserves desktop mtime-based reload behavior and non-desktop

View File

@@ -72,6 +72,7 @@ agent or engineer to remove them without reconstructing context from chat.
| DEBT-0052 | Open | Modernization | Native UI/window state saving now dispatches through `PlatformServices`, but macOS execution still lives in `src/platform_legacy/legacy_platform_services.*` and forwards to the retained Objective-C app bridge | Preserve current Windows/macOS UI persistence while platform shells are extracted incrementally | `pp_platform_api_tests`; `ctest --preset desktop-fast --build-config Debug`; Windows app build; Apple package smoke once root Apple builds exist | UI/window state persistence is owned by injected platform services with no legacy adapter branch |
| DEBT-0053 | Open | Modernization | Prepared-file writable target selection and prepared-file export-dialog policy now dispatch through `PlatformServices`, but iOS/Web target selection still lives in `src/platform_legacy/legacy_platform_services.*` | Preserve mobile/Web export handoff behavior while platform shells are extracted incrementally | `pp_platform_api_tests`; `ctest --preset desktop-fast --build-config Debug`; Windows app build; Apple/Web package smoke once root package builds exist | Prepared-file target selection, export-dialog policy, and save/download handoff are owned by injected platform services with no legacy adapter branch |
| DEBT-0054 | Open | Modernization | Layout XML file read/reload decisions now consume `pp_platform_api::plan_asset_file_load`, but that helper still encodes the retained compile-time platform policy: Windows/macOS use `stat` mtime reload checks, while other platforms treat already-loaded layouts as successful no-op loads | Preserve current layout hot-reload and mobile/Web single-load behavior while removing platform guards from the shared `LayoutManager` parser | `pp_platform_api_tests`; `ctest --preset desktop-fast --build-config Debug -R pp_platform_api_tests`; Windows app build | Layout reload decisions are owned by injected platform storage/file-watch services or an asset manager boundary with platform-specific file watching removed from compile-time helpers |
| DEBT-0055 | Open | Modernization | `src/app.h` now forward-declares retained iOS/macOS/Android/Linux/Web platform handles instead of including platform SDK headers, and full SDK includes are isolated in `src/platform_legacy/legacy_platform_services.cpp`, but the `App` singleton still stores those platform handles directly | Reduce central header platform coupling incrementally without rewriting non-Windows platform entrypoints before Phase 6 | Windows app build; Apple/Android/Linux/Web package smoke once platform root builds are active | Platform handles are owned by injected `pp_platform_*` shell state or services, and `App` has no platform SDK handle fields or platform conditional members |
## Closed Debt

View File

@@ -658,6 +658,10 @@ Windows installs an injected `WindowsPlatformServices` implementation from
other platforms still route through the debt-tracked legacy fallback adapter
now isolated in `src/platform_legacy/legacy_platform_services.*`, so behavior
is preserved while their platform shell implementations are extracted.
The central `App` header now forward-declares retained platform handles instead
of including Objective-C, Android, or GLFW SDK headers; the full platform
headers live in the legacy platform adapter until those handles move out of
`App` during Phase 6.
Prepared-file save/download handoff is now also part of the service contract,
so iOS/Web export completion routes through `PlatformServices` after the app
writes the temporary/exported payload.

View File

@@ -32,23 +32,23 @@ struct PlatformStoragePaths;
}
#if defined(__OBJC__) && defined(__IOS__)
#import <Foundation/Foundation.h>
#import "GameViewController.h"
#import "AppDelegate.h"
@class GameViewController;
@class AppDelegate;
#endif
#if defined(__OBJC__) && defined(__OSX__)
#import "main.h"
@class View;
@class AppOSX;
#endif
#ifdef __ANDROID__
#include "main.h"
struct android_app;
struct engine;
#endif
#ifdef __LINUX__
#include <GLFW/glfw3.h>
#if __LINUX__ || __WEB__
struct GLFWwindow;
#endif
struct VRController
{
enum class kButton : uint8_t

View File

@@ -7,6 +7,7 @@
#include "renderer_gl/opengl_capabilities.h"
#ifdef __ANDROID__
#include "main.h"
void displayKeyboard(bool pShow);
void android_async_lock();
void android_async_swap();
@@ -18,16 +19,26 @@ void android_pick_file_save(std::function<void(std::string)> callback);
std::string android_get_clipboard();
bool android_set_clipboard(const std::string& s);
#elif __APPLE__
#include <Foundation/Foundation.h>
#include "objc_utils.h"
#ifdef __IOS__
#include "AppDelegate.h"
#include "GameViewController.h"
#elif defined(__OSX__)
#include "main.h"
#endif
void delete_all_files_in_path(const std::string& source_path);
#ifdef __IOS__
void save_image_library(const std::string& path);
#endif
#elif __LINUX__
#include <GLFW/glfw3.h>
#include <tinyfiledialogs.h>
std::string linux_home_path();
int mkpath(const std::string& dir, mode_t mode = DEFFILEMODE);
void linux_update_fps(int frames);
#elif __WEB__
#include <GLFW/glfw3.h>
void webgl_pick_file(std::function<void(std::string)> callback);
void webgl_pick_file_save(
const std::string& path,