-
-
Notifications
You must be signed in to change notification settings - Fork 0
🚸 add Linux support #6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 25 commits
Commits
Show all changes
26 commits
Select commit
Hold shift + click to select a range
a6dcd4f
:heavy_plus_sign: add ReerKit dependency on Linux
techouse 99abcf0
:children_crossing: add NSMapTable for Linux
techouse e08cdd0
:children_crossing: do not compile QsSwiftComparison on non-Apple pla…
techouse eea44ba
:see_no_evil: ignore cache
techouse 1e9fc83
:hammer: do not keep history of cache
techouse 2ab515d
:children_crossing: enhance NSNumber handling for Linux compatibility…
techouse 6989252
:test_tube: add Linux compatibility for NSDictionary self-referential…
techouse f0b718e
:see_no_evil: add core directory to .gitignore for Linux compatibility
techouse c0729a5
:test_tube: enhance Linux compatibility for self-referential collecti…
techouse 40ec7fa
:construction_worker: add Linux support for Swift tests in CI configu…
techouse 7f4892d
:green_heart: update CI configuration to use 'ubuntu-latest' for Swif…
techouse 9a716cc
:test_tube: add Linux-specific handling for Shift JIS encoding in Enc…
techouse 5a31f31
:green_heart: optimize Swift test command for quieter output in CI co…
techouse 2296ee0
:green_heart: refactor CI configuration to run coverage script instea…
techouse db493c1
:memo: update README to reflect experimental Linux support and caveats
techouse 982b36d
:memo: update README to correct Swift version for experimental Linux …
techouse e849152
:green_heart: update CI configuration to use ubuntu-latest for Linux …
techouse d984d7f
:package: refactor Package.swift
techouse 43fde42
:package: update Package.resolved
techouse b4fe284
:bulb: update error message for ReerKit dependency on Linux
techouse ec6f7be
:see_no_evil: update .gitignore to include trailing slashes for direc…
techouse 9d2c72d
:memo: correct logo image URL in README.md
techouse 7a4994e
:see_no_evil: update .gitignore to remove trailing slashes from .swif…
techouse ce3d233
:recycle: update conditional compilation for Linux and improve error …
techouse b92d047
:test_tube: improve Linux compatibility in tests and enhance type safety
techouse 8f8df0b
:test_tube: fix encodeOrNil_cycle test to handle errors on Linux
techouse File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
#if os(Linux) | ||
import Foundation | ||
#if canImport(ReerKit) | ||
import ReerKit | ||
|
||
/// Linux shim: adapt ReerKit's `WeakMap` (weak key + weak value) to the minimal | ||
/// `NSMapTable` API surface that Qs uses (weakToWeakObjects, setObject, object(forKey:)). | ||
/// | ||
/// This lets existing call sites keep using `NSMapTable<AnyObject, AnyObject>.weakToWeakObjects()` | ||
/// without conditional code. On Apple platforms the real `NSMapTable` is used; on Linux this shim | ||
/// is compiled instead. | ||
final class NSMapTable<Key: AnyObject, Value: AnyObject> { | ||
// ReerKit exposes WeakMap which can be configured for weak keys and weak values. | ||
// We use NSObject as the storage types to interoperate with Foundation containers | ||
// commonly used as keys/values during encoding. | ||
private var map = WeakMap<WeakKeyValue, NSObject, NSObject>() | ||
|
||
/// Matches Foundation's convenience: create a weak-to-weak map table. | ||
static func weakToWeakObjects() -> NSMapTable<Key, Value> { NSMapTable<Key, Value>() } | ||
|
||
/// Store or remove a value for a key. Passing `nil` removes the entry. | ||
@inline(__always) | ||
func setObject(_ obj: Value?, forKey key: Key) { | ||
guard let keyNS = key as? NSObject else { return } | ||
if let vNS = obj as? NSObject { | ||
map[keyNS] = vNS | ||
} else { | ||
_ = map.removeValue(forKey: keyNS) | ||
} | ||
} | ||
|
||
/// Retrieve a value for a key, or `nil` if none (or if the key/value was released). | ||
@inline(__always) | ||
func object(forKey key: Key) -> Value? { | ||
guard let keyNS = key as? NSObject else { return nil } | ||
return map[keyNS] as? Value | ||
} | ||
} | ||
#else | ||
#error("ReerKit is required on Linux. Add it as a conditional dependency for Linux in Package.swift.") | ||
#endif | ||
#endif |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.