Skip to content

Conversation

@keeshux
Copy link
Member

@keeshux keeshux commented Dec 5, 2025

Replace the dummy PartoutFoundation with a set of MiniFoundation* targets to replace Foundation on non-Apple platforms. The compatibility layer wraps a few Foundation entities:

  • CharacterSet
  • Data
  • Date
  • FileManager
  • ProcessInfo
  • (NS)RegularExpression (C++ regex in Compat)
  • URL
  • UUID (uuid4 in Compat)

To offer the native Foundation entity on Apple systems (though wrapped), and a compatible Swift/C/C++ replacement on non-Apple platforms:

  • CharacterSet: Swift Set<Unicode.Scalar>
  • Data: [UInt8], still inefficient though
  • Date: UNIX timestamps
  • FileManager: C stdlib and POSIX/Win32
  • ProcessInfo: OS version via POSIX/Win32
  • RegularExpression: C++ regex
  • String extensions: libc
  • URL: libyuarl
  • UUID: uuid4

Tests succeeded 100%, but a few had to be excluded. CMake configuration was fixed as needed.

Changes to active Partout code:

  • Replace NotificationCenter in TLSWrapper with a PassthroughStream
  • Foundation String extensions
  • Foundation Data extensions

Other safe changes:

  • Move streams and PlatformPRNG to MiniFoundationCore
  • Add OID generic argument to streams to decouple from UUID with RandomlyInitialized

Many FIXMEs to resolve in compatible code (inactive on Apple). JSON encoding is not implemented yet.

Partially addresses #228

@keeshux keeshux self-assigned this Dec 5, 2025
@keeshux keeshux added enhancement New feature or request refactoring Reworks the software architecture Cross Building on non-Apple platforms labels Dec 5, 2025
@keeshux keeshux moved this to In Progress in 2025 Q2-Q4 Scaling Dec 5, 2025
@keeshux keeshux marked this pull request as draft December 6, 2025 10:15
@keeshux keeshux changed the title Provide Foundation compatibility with MiniFoundation Provide initial Foundation compatibility with MiniFoundation Dec 6, 2025
Can now restore TunnelStrategy .sendMessage()
.appending(path:) returns trailing "/".
@keeshux keeshux marked this pull request as ready for review December 7, 2025 10:58
@keeshux keeshux merged commit b2d8631 into master Dec 7, 2025
1 check passed
@keeshux keeshux deleted the refactoring/drop-foundation branch December 7, 2025 10:58
@keeshux keeshux moved this from In Progress to Done in 2025 Q2-Q4 Scaling Dec 7, 2025
@keeshux keeshux mentioned this pull request Dec 7, 2025
keeshux added a commit to partout-io/passepartout that referenced this pull request Dec 7, 2025
Rely on the extensions from
[MiniFoundation](partout-io/partout#281):

- Rename PSP_DYNLIB symbol to PSP_CROSS in CMake
- Decouple log formatting logic
- LocalLogger maps log lines internally
- DebugLogView maps agnostic ABI.AppLogLine in the app layer
- Exclude providers for now (based on PSP_PROVIDERS)

Split Foundation logic:

- Decouple URLSession via fetcher closures in GitHub*Strategy
- Split SystemExtensionManager via agnostic ExtensionInstaller (annoying
NSObject)
- Split MultipartForm from toURLRequest() extension

Move to Apple targets:

- String l10n
- URL extensions
- UserDefaultsStore
- TestFlight checker
- HTMLTemplate
- NIO handlers

The cross-platform library is untested and still lacks JSON support, but
app-cross builds fine with it, and `ldd` reports no Foundation
dependency.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Cross Building on non-Apple platforms enhancement New feature or request refactoring Reworks the software architecture

Projects

No open projects
Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants