Repository navigation
React Native: Add Swift Package Manager support #1076
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
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| '@powersync/react-native': minor | ||
| --- | ||
|
|
||
| Add experimental support for Swift Package Manager builds (requires React Native version 0.87.0 or later). |
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,30 @@ | ||
| // swift-tools-version: 6.0 | ||
| import PackageDescription | ||
|
|
||
| // When updating this, also update the version in powersync-react-native.podspec and android/build.gradle | ||
| let coreExtensionVersion: Version = "0.5.2" | ||
|
|
||
| let packageName = "PowerSyncReactNative" | ||
|
|
||
| let package = Package( | ||
| name: packageName, | ||
| platforms: [.iOS(.v15)], | ||
| products: [ | ||
| .library(name: packageName, targets: [packageName]) | ||
| ], | ||
| dependencies: [ | ||
| .package( | ||
| url: "https://github.com/powersync-ja/powersync-sqlite-core-swift.git", | ||
| exact: coreExtensionVersion | ||
| ) | ||
| ], | ||
| targets: [ | ||
| .target( | ||
| name: packageName, | ||
| dependencies: [ | ||
| .product(name: "PowerSyncSQLiteCore", package: "powersync-sqlite-core-swift") | ||
| ], | ||
| path: "swiftpm" | ||
| ) | ||
| ], | ||
| ) |
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,2 @@ | ||
| // Deliberately left empty: We need a SwiftPM target with sources, but the only responsibility of | ||
| // the build is to link the core extension. | ||
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,13 @@ | ||
| // Hack: @react-native-community/cli reads this file with import(), while react-native/scripts/spm/expand-spm-dependencies.js | ||
| // reads it using require(). Both are able to read this file, but in the require case we need to return the spm key we | ||
| // care about as a separate item because it otherwise gets exported as {default: ...} object. | ||
| export const spm = { | ||
| // Change the Swift Package name and target autolinking expects for this npm package. By default, it would use | ||
| // 'ReactNative' which conflicts with RN itself. | ||
| // This option appears to be undocumented, it's read here: https://github.com/react/react-native/blob/2dd6d4b482c2512d3e92fbaf0a10a9f8ac055e5d/packages/react-native/scripts/spm/expand-spm-dependencies.js#L59-L82 | ||
| name: 'PowerSyncReactNative' | ||
| }; | ||
|
|
||
| export default { | ||
| spm | ||
| }; |
Large diffs are not rendered by default.
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
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
2 changes: 1 addition & 1 deletion
2
tools/powersynctests/android/gradle/wrapper/gradle-wrapper.properties
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,6 @@ | ||
|
|
||
| # SPM – auto-generated at build time (do not commit) | ||
| Package.resolved | ||
| build/generated/ | ||
| build/xcframeworks/ | ||
| .build/ |
178 changes: 178 additions & 0 deletions
178
tools/powersynctests/ios/powersynctests.xcodeproj/.spm-injected.json
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,178 @@ | ||
| { | ||
| "rootUuid": "83CBB9F71A601CBA00E9B192", | ||
| "target": "powersynctests", | ||
| "targetUuid": "13B07F861A680F5B00A75B9A", | ||
| "injectedUuids": [ | ||
| "17CA21E30A8FFCB9D0FC1E35", | ||
| "27BDE9D743CB351F53154525", | ||
| "3AFDEFB917B01458307FDE0A", | ||
| "3F1E298E4A2D7CA403A328B5", | ||
| "50A8621D202A6CFB97E2C1B5", | ||
| "512EBECF5434FD7A6AF7C967", | ||
| "658A88AFBFD620F8BC6F91BA", | ||
| "69A7AB74931112BD2779B631", | ||
| "8332BE36B9C49BD2E49347C1", | ||
| "920F69A9DF98D37C8308D020", | ||
| "947DD5EF3BE079FB7F5AFF87", | ||
| "94F7C9B714A718310DA6BE9C", | ||
| "A700952B9A737913514EB28F", | ||
| "B174F870C259554596A4373B", | ||
| "C2FECF1430FDAAE3BF355839", | ||
| "D6BD17EA9023C9F39246B71F", | ||
| "F3857EDDA38AFC0011322D6D" | ||
| ], | ||
| "createdArrayFields": [], | ||
| "buildSettingChanges": [ | ||
| { | ||
| "configUuid": "13B07F941A680F5B00A75B9A", | ||
| "createdArrayKeys": [ | ||
| "HEADER_SEARCH_PATHS", | ||
| "FRAMEWORK_SEARCH_PATHS" | ||
| ], | ||
| "appendedArrayValues": { | ||
| "OTHER_LDFLAGS": [ | ||
| "\"$(RN_SPM_REACT_BINARY)\"", | ||
| "\"$(RN_SPM_REACT_NATIVE_DEPENDENCIES_BINARY)\"", | ||
| "\"$(RN_SPM_HERMES_BINARY)\"" | ||
| ] | ||
| }, | ||
| "createdScalars": [ | ||
| "CLANG_CXX_LANGUAGE_STANDARD", | ||
| "REACT_NATIVE_PATH", | ||
| "HERMES_CLI_PATH", | ||
| "RN_SPM_FLAVOR", | ||
| "\"RN_SPM_REACT_FRAMEWORK[sdk=iphoneos*]\"", | ||
| "\"RN_SPM_REACT_BINARY[sdk=iphoneos*]\"", | ||
| "\"RN_SPM_REACT_SEARCH_PATH[sdk=iphoneos*]\"", | ||
| "\"RN_SPM_REACT_FRAMEWORK[sdk=iphonesimulator*]\"", | ||
| "\"RN_SPM_REACT_BINARY[sdk=iphonesimulator*]\"", | ||
| "\"RN_SPM_REACT_SEARCH_PATH[sdk=iphonesimulator*]\"", | ||
| "\"RN_SPM_REACT_FRAMEWORK[sdk=macosx*]\"", | ||
| "\"RN_SPM_REACT_BINARY[sdk=macosx*]\"", | ||
| "\"RN_SPM_REACT_SEARCH_PATH[sdk=macosx*]\"", | ||
| "\"RN_SPM_REACT_NATIVE_DEPENDENCIES_FRAMEWORK[sdk=appletvos*]\"", | ||
| "\"RN_SPM_REACT_NATIVE_DEPENDENCIES_BINARY[sdk=appletvos*]\"", | ||
| "\"RN_SPM_REACT_NATIVE_DEPENDENCIES_SEARCH_PATH[sdk=appletvos*]\"", | ||
| "\"RN_SPM_REACT_NATIVE_DEPENDENCIES_FRAMEWORK[sdk=appletvsimulator*]\"", | ||
| "\"RN_SPM_REACT_NATIVE_DEPENDENCIES_BINARY[sdk=appletvsimulator*]\"", | ||
| "\"RN_SPM_REACT_NATIVE_DEPENDENCIES_SEARCH_PATH[sdk=appletvsimulator*]\"", | ||
| "\"RN_SPM_REACT_NATIVE_DEPENDENCIES_FRAMEWORK[sdk=iphoneos*]\"", | ||
| "\"RN_SPM_REACT_NATIVE_DEPENDENCIES_BINARY[sdk=iphoneos*]\"", | ||
| "\"RN_SPM_REACT_NATIVE_DEPENDENCIES_SEARCH_PATH[sdk=iphoneos*]\"", | ||
| "\"RN_SPM_REACT_NATIVE_DEPENDENCIES_FRAMEWORK[sdk=iphonesimulator*]\"", | ||
| "\"RN_SPM_REACT_NATIVE_DEPENDENCIES_BINARY[sdk=iphonesimulator*]\"", | ||
| "\"RN_SPM_REACT_NATIVE_DEPENDENCIES_SEARCH_PATH[sdk=iphonesimulator*]\"", | ||
| "\"RN_SPM_REACT_NATIVE_DEPENDENCIES_FRAMEWORK[sdk=macosx*]\"", | ||
| "\"RN_SPM_REACT_NATIVE_DEPENDENCIES_BINARY[sdk=macosx*]\"", | ||
| "\"RN_SPM_REACT_NATIVE_DEPENDENCIES_SEARCH_PATH[sdk=macosx*]\"", | ||
| "\"RN_SPM_REACT_NATIVE_DEPENDENCIES_FRAMEWORK[sdk=xros*]\"", | ||
| "\"RN_SPM_REACT_NATIVE_DEPENDENCIES_BINARY[sdk=xros*]\"", | ||
| "\"RN_SPM_REACT_NATIVE_DEPENDENCIES_SEARCH_PATH[sdk=xros*]\"", | ||
| "\"RN_SPM_REACT_NATIVE_DEPENDENCIES_FRAMEWORK[sdk=xrsimulator*]\"", | ||
| "\"RN_SPM_REACT_NATIVE_DEPENDENCIES_BINARY[sdk=xrsimulator*]\"", | ||
| "\"RN_SPM_REACT_NATIVE_DEPENDENCIES_SEARCH_PATH[sdk=xrsimulator*]\"", | ||
| "\"RN_SPM_HERMES_FRAMEWORK[sdk=appletvos*]\"", | ||
| "\"RN_SPM_HERMES_BINARY[sdk=appletvos*]\"", | ||
| "\"RN_SPM_HERMES_SEARCH_PATH[sdk=appletvos*]\"", | ||
| "\"RN_SPM_HERMES_FRAMEWORK[sdk=appletvsimulator*]\"", | ||
| "\"RN_SPM_HERMES_BINARY[sdk=appletvsimulator*]\"", | ||
| "\"RN_SPM_HERMES_SEARCH_PATH[sdk=appletvsimulator*]\"", | ||
| "\"RN_SPM_HERMES_FRAMEWORK[sdk=iphoneos*]\"", | ||
| "\"RN_SPM_HERMES_BINARY[sdk=iphoneos*]\"", | ||
| "\"RN_SPM_HERMES_SEARCH_PATH[sdk=iphoneos*]\"", | ||
| "\"RN_SPM_HERMES_FRAMEWORK[sdk=iphonesimulator*]\"", | ||
| "\"RN_SPM_HERMES_BINARY[sdk=iphonesimulator*]\"", | ||
| "\"RN_SPM_HERMES_SEARCH_PATH[sdk=iphonesimulator*]\"", | ||
| "\"RN_SPM_HERMES_FRAMEWORK[sdk=macosx*]\"", | ||
| "\"RN_SPM_HERMES_BINARY[sdk=macosx*]\"", | ||
| "\"RN_SPM_HERMES_SEARCH_PATH[sdk=macosx*]\"", | ||
| "\"RN_SPM_HERMES_FRAMEWORK[sdk=xros*]\"", | ||
| "\"RN_SPM_HERMES_BINARY[sdk=xros*]\"", | ||
| "\"RN_SPM_HERMES_SEARCH_PATH[sdk=xros*]\"", | ||
| "\"RN_SPM_HERMES_FRAMEWORK[sdk=xrsimulator*]\"", | ||
| "\"RN_SPM_HERMES_BINARY[sdk=xrsimulator*]\"", | ||
| "\"RN_SPM_HERMES_SEARCH_PATH[sdk=xrsimulator*]\"" | ||
| ], | ||
| "replacedScalars": {} | ||
| }, | ||
| { | ||
| "configUuid": "13B07F951A680F5B00A75B9A", | ||
| "createdArrayKeys": [ | ||
| "HEADER_SEARCH_PATHS", | ||
| "FRAMEWORK_SEARCH_PATHS" | ||
| ], | ||
| "appendedArrayValues": { | ||
| "OTHER_LDFLAGS": [ | ||
| "\"$(RN_SPM_REACT_BINARY)\"", | ||
| "\"$(RN_SPM_REACT_NATIVE_DEPENDENCIES_BINARY)\"", | ||
| "\"$(RN_SPM_HERMES_BINARY)\"" | ||
| ] | ||
| }, | ||
| "createdScalars": [ | ||
| "CLANG_CXX_LANGUAGE_STANDARD", | ||
| "REACT_NATIVE_PATH", | ||
| "HERMES_CLI_PATH", | ||
| "RN_SPM_FLAVOR", | ||
| "\"RN_SPM_REACT_FRAMEWORK[sdk=iphoneos*]\"", | ||
| "\"RN_SPM_REACT_BINARY[sdk=iphoneos*]\"", | ||
| "\"RN_SPM_REACT_SEARCH_PATH[sdk=iphoneos*]\"", | ||
| "\"RN_SPM_REACT_FRAMEWORK[sdk=iphonesimulator*]\"", | ||
| "\"RN_SPM_REACT_BINARY[sdk=iphonesimulator*]\"", | ||
| "\"RN_SPM_REACT_SEARCH_PATH[sdk=iphonesimulator*]\"", | ||
| "\"RN_SPM_REACT_FRAMEWORK[sdk=macosx*]\"", | ||
| "\"RN_SPM_REACT_BINARY[sdk=macosx*]\"", | ||
| "\"RN_SPM_REACT_SEARCH_PATH[sdk=macosx*]\"", | ||
| "\"RN_SPM_REACT_NATIVE_DEPENDENCIES_FRAMEWORK[sdk=appletvos*]\"", | ||
| "\"RN_SPM_REACT_NATIVE_DEPENDENCIES_BINARY[sdk=appletvos*]\"", | ||
| "\"RN_SPM_REACT_NATIVE_DEPENDENCIES_SEARCH_PATH[sdk=appletvos*]\"", | ||
| "\"RN_SPM_REACT_NATIVE_DEPENDENCIES_FRAMEWORK[sdk=appletvsimulator*]\"", | ||
| "\"RN_SPM_REACT_NATIVE_DEPENDENCIES_BINARY[sdk=appletvsimulator*]\"", | ||
| "\"RN_SPM_REACT_NATIVE_DEPENDENCIES_SEARCH_PATH[sdk=appletvsimulator*]\"", | ||
| "\"RN_SPM_REACT_NATIVE_DEPENDENCIES_FRAMEWORK[sdk=iphoneos*]\"", | ||
| "\"RN_SPM_REACT_NATIVE_DEPENDENCIES_BINARY[sdk=iphoneos*]\"", | ||
| "\"RN_SPM_REACT_NATIVE_DEPENDENCIES_SEARCH_PATH[sdk=iphoneos*]\"", | ||
| "\"RN_SPM_REACT_NATIVE_DEPENDENCIES_FRAMEWORK[sdk=iphonesimulator*]\"", | ||
| "\"RN_SPM_REACT_NATIVE_DEPENDENCIES_BINARY[sdk=iphonesimulator*]\"", | ||
| "\"RN_SPM_REACT_NATIVE_DEPENDENCIES_SEARCH_PATH[sdk=iphonesimulator*]\"", | ||
| "\"RN_SPM_REACT_NATIVE_DEPENDENCIES_FRAMEWORK[sdk=macosx*]\"", | ||
| "\"RN_SPM_REACT_NATIVE_DEPENDENCIES_BINARY[sdk=macosx*]\"", | ||
| "\"RN_SPM_REACT_NATIVE_DEPENDENCIES_SEARCH_PATH[sdk=macosx*]\"", | ||
| "\"RN_SPM_REACT_NATIVE_DEPENDENCIES_FRAMEWORK[sdk=xros*]\"", | ||
| "\"RN_SPM_REACT_NATIVE_DEPENDENCIES_BINARY[sdk=xros*]\"", | ||
| "\"RN_SPM_REACT_NATIVE_DEPENDENCIES_SEARCH_PATH[sdk=xros*]\"", | ||
| "\"RN_SPM_REACT_NATIVE_DEPENDENCIES_FRAMEWORK[sdk=xrsimulator*]\"", | ||
| "\"RN_SPM_REACT_NATIVE_DEPENDENCIES_BINARY[sdk=xrsimulator*]\"", | ||
| "\"RN_SPM_REACT_NATIVE_DEPENDENCIES_SEARCH_PATH[sdk=xrsimulator*]\"", | ||
| "\"RN_SPM_HERMES_FRAMEWORK[sdk=appletvos*]\"", | ||
| "\"RN_SPM_HERMES_BINARY[sdk=appletvos*]\"", | ||
| "\"RN_SPM_HERMES_SEARCH_PATH[sdk=appletvos*]\"", | ||
| "\"RN_SPM_HERMES_FRAMEWORK[sdk=appletvsimulator*]\"", | ||
| "\"RN_SPM_HERMES_BINARY[sdk=appletvsimulator*]\"", | ||
| "\"RN_SPM_HERMES_SEARCH_PATH[sdk=appletvsimulator*]\"", | ||
| "\"RN_SPM_HERMES_FRAMEWORK[sdk=iphoneos*]\"", | ||
| "\"RN_SPM_HERMES_BINARY[sdk=iphoneos*]\"", | ||
| "\"RN_SPM_HERMES_SEARCH_PATH[sdk=iphoneos*]\"", | ||
| "\"RN_SPM_HERMES_FRAMEWORK[sdk=iphonesimulator*]\"", | ||
| "\"RN_SPM_HERMES_BINARY[sdk=iphonesimulator*]\"", | ||
| "\"RN_SPM_HERMES_SEARCH_PATH[sdk=iphonesimulator*]\"", | ||
| "\"RN_SPM_HERMES_FRAMEWORK[sdk=macosx*]\"", | ||
| "\"RN_SPM_HERMES_BINARY[sdk=macosx*]\"", | ||
| "\"RN_SPM_HERMES_SEARCH_PATH[sdk=macosx*]\"", | ||
| "\"RN_SPM_HERMES_FRAMEWORK[sdk=xros*]\"", | ||
| "\"RN_SPM_HERMES_BINARY[sdk=xros*]\"", | ||
| "\"RN_SPM_HERMES_SEARCH_PATH[sdk=xros*]\"", | ||
| "\"RN_SPM_HERMES_FRAMEWORK[sdk=xrsimulator*]\"", | ||
| "\"RN_SPM_HERMES_BINARY[sdk=xrsimulator*]\"", | ||
| "\"RN_SPM_HERMES_SEARCH_PATH[sdk=xrsimulator*]\"" | ||
| ], | ||
| "replacedScalars": {} | ||
| } | ||
| ], | ||
| "generatedSources": {}, | ||
| "artifactsVersionOverride": null, | ||
| "configCommand": null, | ||
| "scheme": { | ||
| "file": "powersynctests.xcscheme", | ||
| "created": false | ||
| } | ||
| } |
Oops, something went wrong.
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.