Skip to content

Commit 4fc12f9

Browse files
feat: Capacitor SPM (#973)
1 parent 6830f4a commit 4fc12f9

47 files changed

Lines changed: 1860 additions & 2026 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.changeset/shiny-buses-jump.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
'@powersync/capacitor': minor
3+
---
4+
5+
Add Swift Package Manager support for iOS projects.
6+
7+
This raises the minimum supported Capacitor version to Capacitor 8.

demos/example-capacitor/android/app/build.gradle

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
apply plugin: 'com.android.application'
22

33
android {
4-
namespace "com.powersync.example"
5-
compileSdk rootProject.ext.compileSdkVersion
4+
namespace = "com.powersync.example"
5+
compileSdk = rootProject.ext.compileSdkVersion
66
defaultConfig {
77
applicationId "com.powersync.example"
88
minSdkVersion rootProject.ext.minSdkVersion
@@ -13,7 +13,7 @@ android {
1313
aaptOptions {
1414
// Files and dirs to omit from the packaged assets dir, modified to accommodate modern web apps.
1515
// Default: https://android.googlesource.com/platform/frameworks/base/+/282e181b58cf72b6ca770dc7ca5f91f135444502/tools/aapt/AaptAssets.cpp#61
16-
ignoreAssetsPattern '!.svn:!.git:!.ds_store:!*.scc:.*:!CVS:!thumbs.db:!picasa.ini:!*~'
16+
ignoreAssetsPattern = '!.svn:!.git:!.ds_store:!*.scc:.*:!CVS:!thumbs.db:!picasa.ini:!*~'
1717
}
1818
}
1919
buildTypes {

demos/example-capacitor/android/app/src/main/AndroidManifest.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
android:theme="@style/AppTheme">
1111

1212
<activity
13-
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale|smallestScreenSize|screenLayout|uiMode|navigation"
13+
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale|smallestScreenSize|screenLayout|uiMode|navigation|density"
1414
android:name=".MainActivity"
1515
android:label="@string/title_activity_main"
1616
android:theme="@style/AppTheme.NoActionBarLaunch"

demos/example-capacitor/android/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ buildscript {
77
mavenCentral()
88
}
99
dependencies {
10-
classpath 'com.android.tools.build:gradle:8.7.2'
11-
classpath 'com.google.gms:google-services:4.4.2'
10+
classpath 'com.android.tools.build:gradle:8.13.0'
11+
classpath 'com.google.gms:google-services:4.4.4'
1212

1313
// NOTE: Do not place your application dependencies here; they belong
1414
// in the individual module build.gradle files
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
// DO NOT EDIT THIS FILE! IT IS GENERATED EACH TIME "capacitor update" IS RUN
22
include ':capacitor-android'
3-
project(':capacitor-android').projectDir = new File('../node_modules/.pnpm/@capacitor+android@7.4.4_@capacitor+core@7.4.3/node_modules/@capacitor/android/capacitor')
3+
project(':capacitor-android').projectDir = new File('../node_modules/.pnpm/@capacitor+android@8.3.4_@capacitor+core@8.3.4/node_modules/@capacitor/android/capacitor')
44

55
include ':capacitor-community-sqlite'
6-
project(':capacitor-community-sqlite').projectDir = new File('../node_modules/.pnpm/@capacitor-community+sqlite@7.0.3_@capacitor+core@7.4.3/node_modules/@capacitor-community/sqlite/android')
6+
project(':capacitor-community-sqlite').projectDir = new File('../node_modules/.pnpm/@capacitor-community+sqlite@8.1.0_@capacitor+core@8.3.4/node_modules/@capacitor-community/sqlite/android')
77

88
include ':capacitor-splash-screen'
9-
project(':capacitor-splash-screen').projectDir = new File('../node_modules/.pnpm/@capacitor+splash-screen@7.0.0_@capacitor+core@7.4.3/node_modules/@capacitor/splash-screen/android')
9+
project(':capacitor-splash-screen').projectDir = new File('../node_modules/.pnpm/@capacitor+splash-screen@8.0.1_@capacitor+core@8.3.4/node_modules/@capacitor/splash-screen/android')
1010

1111
include ':powersync-capacitor'
1212
project(':powersync-capacitor').projectDir = new File('../node_modules/@powersync/capacitor/android')

demos/example-capacitor/android/gradle/wrapper/gradle-wrapper.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-8.11.1-all.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.13-all.zip
44
networkTimeout=10000
55
validateDistributionUrl=true
66
zipStoreBase=GRADLE_USER_HOME
Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
ext {
2-
minSdkVersion = 23
3-
compileSdkVersion = 35
4-
targetSdkVersion = 35
5-
androidxActivityVersion = '1.9.2'
6-
androidxAppCompatVersion = '1.7.0'
7-
androidxCoordinatorLayoutVersion = '1.2.0'
8-
androidxCoreVersion = '1.15.0'
9-
androidxFragmentVersion = '1.8.4'
10-
coreSplashScreenVersion = '1.0.1'
11-
androidxWebkitVersion = '1.12.1'
2+
minSdkVersion = 24
3+
compileSdkVersion = 36
4+
targetSdkVersion = 36
5+
androidxActivityVersion = '1.11.0'
6+
androidxAppCompatVersion = '1.7.1'
7+
androidxCoordinatorLayoutVersion = '1.3.0'
8+
androidxCoreVersion = '1.17.0'
9+
androidxFragmentVersion = '1.8.9'
10+
coreSplashScreenVersion = '1.2.0'
11+
androidxWebkitVersion = '1.14.0'
1212
junitVersion = '4.13.2'
13-
androidxJunitVersion = '1.2.1'
14-
androidxEspressoCoreVersion = '3.6.1'
15-
cordovaAndroidVersion = '10.1.1'
13+
androidxJunitVersion = '1.3.0'
14+
androidxEspressoCoreVersion = '3.7.0'
15+
cordovaAndroidVersion = '14.0.1'
1616
}

demos/example-capacitor/ios/App/App.xcodeproj/project.pbxproj

Lines changed: 40 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,18 @@
33
archiveVersion = 1;
44
classes = {
55
};
6-
objectVersion = 48;
6+
objectVersion = 60;
77
objects = {
88

99
/* Begin PBXBuildFile section */
1010
2FAD9763203C412B000D30F8 /* config.xml in Resources */ = {isa = PBXBuildFile; fileRef = 2FAD9762203C412B000D30F8 /* config.xml */; };
11+
4D22ABE92AF431CB00220026 /* CapApp-SPM in Frameworks */ = {isa = PBXBuildFile; productRef = 4D22ABE82AF431CB00220026 /* CapApp-SPM */; };
1112
50379B232058CBB4000EE86E /* capacitor.config.json in Resources */ = {isa = PBXBuildFile; fileRef = 50379B222058CBB4000EE86E /* capacitor.config.json */; };
1213
504EC3081FED79650016851F /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 504EC3071FED79650016851F /* AppDelegate.swift */; };
1314
504EC30D1FED79650016851F /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 504EC30B1FED79650016851F /* Main.storyboard */; };
1415
504EC30F1FED79650016851F /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 504EC30E1FED79650016851F /* Assets.xcassets */; };
1516
504EC3121FED79650016851F /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 504EC3101FED79650016851F /* LaunchScreen.storyboard */; };
1617
50B271D11FEDC1A000F3C39B /* public in Resources */ = {isa = PBXBuildFile; fileRef = 50B271D01FEDC1A000F3C39B /* public */; };
17-
A084ECDBA7D38E1E42DFC39D /* Pods_App.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = AF277DCFFFF123FFC6DF26C7 /* Pods_App.framework */; };
1818
/* End PBXBuildFile section */
1919

2020
/* Begin PBXFileReference section */
@@ -27,38 +27,27 @@
2727
504EC3111FED79650016851F /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };
2828
504EC3131FED79650016851F /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
2929
50B271D01FEDC1A000F3C39B /* public */ = {isa = PBXFileReference; lastKnownFileType = folder; path = public; sourceTree = "<group>"; };
30-
AF277DCFFFF123FFC6DF26C7 /* Pods_App.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_App.framework; sourceTree = BUILT_PRODUCTS_DIR; };
31-
AF51FD2D460BCFE21FA515B2 /* Pods-App.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-App.release.xcconfig"; path = "Pods/Target Support Files/Pods-App/Pods-App.release.xcconfig"; sourceTree = "<group>"; };
32-
FC68EB0AF532CFC21C3344DD /* Pods-App.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-App.debug.xcconfig"; path = "Pods/Target Support Files/Pods-App/Pods-App.debug.xcconfig"; sourceTree = "<group>"; };
30+
958DCC722DB07C7200EA8C5F /* debug.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = debug.xcconfig; path = ../debug.xcconfig; sourceTree = SOURCE_ROOT; };
3331
/* End PBXFileReference section */
3432

3533
/* Begin PBXFrameworksBuildPhase section */
3634
504EC3011FED79650016851F /* Frameworks */ = {
3735
isa = PBXFrameworksBuildPhase;
3836
buildActionMask = 2147483647;
3937
files = (
40-
A084ECDBA7D38E1E42DFC39D /* Pods_App.framework in Frameworks */,
38+
4D22ABE92AF431CB00220026 /* CapApp-SPM in Frameworks */,
4139
);
4240
runOnlyForDeploymentPostprocessing = 0;
4341
};
4442
/* End PBXFrameworksBuildPhase section */
4543

4644
/* Begin PBXGroup section */
47-
27E2DDA53C4D2A4D1A88CE4A /* Frameworks */ = {
48-
isa = PBXGroup;
49-
children = (
50-
AF277DCFFFF123FFC6DF26C7 /* Pods_App.framework */,
51-
);
52-
name = Frameworks;
53-
sourceTree = "<group>";
54-
};
5545
504EC2FB1FED79650016851F = {
5646
isa = PBXGroup;
5747
children = (
48+
958DCC722DB07C7200EA8C5F /* debug.xcconfig */,
5849
504EC3061FED79650016851F /* App */,
5950
504EC3051FED79650016851F /* Products */,
60-
7F8756D8B27F46E3366F6CEA /* Pods */,
61-
27E2DDA53C4D2A4D1A88CE4A /* Frameworks */,
6251
);
6352
sourceTree = "<group>";
6453
};
@@ -85,33 +74,25 @@
8574
path = App;
8675
sourceTree = "<group>";
8776
};
88-
7F8756D8B27F46E3366F6CEA /* Pods */ = {
89-
isa = PBXGroup;
90-
children = (
91-
FC68EB0AF532CFC21C3344DD /* Pods-App.debug.xcconfig */,
92-
AF51FD2D460BCFE21FA515B2 /* Pods-App.release.xcconfig */,
93-
);
94-
name = Pods;
95-
sourceTree = "<group>";
96-
};
9777
/* End PBXGroup section */
9878

9979
/* Begin PBXNativeTarget section */
10080
504EC3031FED79650016851F /* App */ = {
10181
isa = PBXNativeTarget;
10282
buildConfigurationList = 504EC3161FED79650016851F /* Build configuration list for PBXNativeTarget "App" */;
10383
buildPhases = (
104-
6634F4EFEBD30273BCE97C65 /* [CP] Check Pods Manifest.lock */,
10584
504EC3001FED79650016851F /* Sources */,
10685
504EC3011FED79650016851F /* Frameworks */,
10786
504EC3021FED79650016851F /* Resources */,
108-
9592DBEFFC6D2A0C8D5DEB22 /* [CP] Embed Pods Frameworks */,
10987
);
11088
buildRules = (
11189
);
11290
dependencies = (
11391
);
11492
name = App;
93+
packageProductDependencies = (
94+
4D22ABE82AF431CB00220026 /* CapApp-SPM */,
95+
);
11596
productName = App;
11697
productReference = 504EC3041FED79650016851F /* App.app */;
11798
productType = "com.apple.product-type.application";
@@ -142,6 +123,7 @@
142123
);
143124
mainGroup = 504EC2FB1FED79650016851F;
144125
packageReferences = (
126+
D4C12C0A2AAA248700AAC8A2 /* XCLocalSwiftPackageReference "CapApp-SPM" */,
145127
);
146128
productRefGroup = 504EC3051FED79650016851F /* Products */;
147129
projectDirPath = "";
@@ -168,42 +150,6 @@
168150
};
169151
/* End PBXResourcesBuildPhase section */
170152

171-
/* Begin PBXShellScriptBuildPhase section */
172-
6634F4EFEBD30273BCE97C65 /* [CP] Check Pods Manifest.lock */ = {
173-
isa = PBXShellScriptBuildPhase;
174-
buildActionMask = 2147483647;
175-
files = (
176-
);
177-
inputPaths = (
178-
"${PODS_PODFILE_DIR_PATH}/Podfile.lock",
179-
"${PODS_ROOT}/Manifest.lock",
180-
);
181-
name = "[CP] Check Pods Manifest.lock";
182-
outputPaths = (
183-
"$(DERIVED_FILE_DIR)/Pods-App-checkManifestLockResult.txt",
184-
);
185-
runOnlyForDeploymentPostprocessing = 0;
186-
shellPath = /bin/sh;
187-
shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
188-
showEnvVarsInLog = 0;
189-
};
190-
9592DBEFFC6D2A0C8D5DEB22 /* [CP] Embed Pods Frameworks */ = {
191-
isa = PBXShellScriptBuildPhase;
192-
buildActionMask = 2147483647;
193-
files = (
194-
);
195-
inputPaths = (
196-
);
197-
name = "[CP] Embed Pods Frameworks";
198-
outputPaths = (
199-
);
200-
runOnlyForDeploymentPostprocessing = 0;
201-
shellPath = /bin/sh;
202-
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-App/Pods-App-frameworks.sh\"\n";
203-
showEnvVarsInLog = 0;
204-
};
205-
/* End PBXShellScriptBuildPhase section */
206-
207153
/* Begin PBXSourcesBuildPhase section */
208154
504EC3001FED79650016851F /* Sources */ = {
209155
isa = PBXSourcesBuildPhase;
@@ -237,6 +183,7 @@
237183
/* Begin XCBuildConfiguration section */
238184
504EC3141FED79650016851F /* Debug */ = {
239185
isa = XCBuildConfiguration;
186+
baseConfigurationReference = 958DCC722DB07C7200EA8C5F /* debug.xcconfig */;
240187
buildSettings = {
241188
ALWAYS_SEARCH_USER_PATHS = NO;
242189
CLANG_ANALYZER_NONNULL = YES;
@@ -283,7 +230,7 @@
283230
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
284231
GCC_WARN_UNUSED_FUNCTION = YES;
285232
GCC_WARN_UNUSED_VARIABLE = YES;
286-
IPHONEOS_DEPLOYMENT_TARGET = 14.0;
233+
IPHONEOS_DEPLOYMENT_TARGET = 15.0;
287234
MTL_ENABLE_DEBUG_INFO = YES;
288235
ONLY_ACTIVE_ARCH = YES;
289236
SDKROOT = iphoneos;
@@ -334,24 +281,28 @@
334281
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
335282
GCC_WARN_UNUSED_FUNCTION = YES;
336283
GCC_WARN_UNUSED_VARIABLE = YES;
337-
IPHONEOS_DEPLOYMENT_TARGET = 14.0;
284+
IPHONEOS_DEPLOYMENT_TARGET = 15.0;
338285
MTL_ENABLE_DEBUG_INFO = NO;
339286
SDKROOT = iphoneos;
340-
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
287+
SWIFT_COMPILATION_MODE = wholemodule;
288+
SWIFT_OPTIMIZATION_LEVEL = "-O";
341289
VALIDATE_PRODUCT = YES;
342290
};
343291
name = Release;
344292
};
345293
504EC3171FED79650016851F /* Debug */ = {
346294
isa = XCBuildConfiguration;
347-
baseConfigurationReference = FC68EB0AF532CFC21C3344DD /* Pods-App.debug.xcconfig */;
295+
baseConfigurationReference = 958DCC722DB07C7200EA8C5F /* debug.xcconfig */;
348296
buildSettings = {
349297
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
350298
CODE_SIGN_STYLE = Automatic;
351299
CURRENT_PROJECT_VERSION = 1;
352300
INFOPLIST_FILE = App/Info.plist;
353-
IPHONEOS_DEPLOYMENT_TARGET = 14.0;
354-
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
301+
IPHONEOS_DEPLOYMENT_TARGET = 15.0;
302+
LD_RUNPATH_SEARCH_PATHS = (
303+
"$(inherited)",
304+
"@executable_path/Frameworks",
305+
);
355306
MARKETING_VERSION = 1.0;
356307
OTHER_SWIFT_FLAGS = "$(inherited) \"-D\" \"COCOAPODS\" \"-DDEBUG\"";
357308
PRODUCT_BUNDLE_IDENTIFIER = com.powersync.example;
@@ -364,14 +315,16 @@
364315
};
365316
504EC3181FED79650016851F /* Release */ = {
366317
isa = XCBuildConfiguration;
367-
baseConfigurationReference = AF51FD2D460BCFE21FA515B2 /* Pods-App.release.xcconfig */;
368318
buildSettings = {
369319
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
370320
CODE_SIGN_STYLE = Automatic;
371321
CURRENT_PROJECT_VERSION = 1;
372322
INFOPLIST_FILE = App/Info.plist;
373-
IPHONEOS_DEPLOYMENT_TARGET = 14.0;
374-
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
323+
IPHONEOS_DEPLOYMENT_TARGET = 15.0;
324+
LD_RUNPATH_SEARCH_PATHS = (
325+
"$(inherited)",
326+
"@executable_path/Frameworks",
327+
);
375328
MARKETING_VERSION = 1.0;
376329
PRODUCT_BUNDLE_IDENTIFIER = com.powersync.example;
377330
PRODUCT_NAME = "$(TARGET_NAME)";
@@ -403,6 +356,21 @@
403356
defaultConfigurationName = Release;
404357
};
405358
/* End XCConfigurationList section */
359+
360+
/* Begin XCLocalSwiftPackageReference section */
361+
D4C12C0A2AAA248700AAC8A2 /* XCLocalSwiftPackageReference "CapApp-SPM" */ = {
362+
isa = XCLocalSwiftPackageReference;
363+
relativePath = "CapApp-SPM";
364+
};
365+
/* End XCLocalSwiftPackageReference section */
366+
367+
/* Begin XCSwiftPackageProductDependency section */
368+
4D22ABE82AF431CB00220026 /* CapApp-SPM */ = {
369+
isa = XCSwiftPackageProductDependency;
370+
package = D4C12C0A2AAA248700AAC8A2 /* XCLocalSwiftPackageReference "CapApp-SPM" */;
371+
productName = "CapApp-SPM";
372+
};
373+
/* End XCSwiftPackageProductDependency section */
406374
};
407375
rootObject = 504EC2FC1FED79650016851F /* Project object */;
408376
}

demos/example-capacitor/ios/App/App.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist renamed to demos/example-capacitor/ios/App/App.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist

File renamed without changes.

demos/example-capacitor/ios/App/App.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved

Lines changed: 42 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)