Skip to content

Commit e590c3f

Browse files
fix(ios): Simplify SPM usage for native library (#44)
* fix(ios): Simplify SPM usage for native library * chore(ci): Speed up by separating android/ios * chore(ci): Add missing shell attribution to action * chore(ci): Fully separate verifications by platform * Revert "chore(ci): Fully separate verifications by platform" This reverts commit 1db9a3e.
1 parent da235d4 commit e590c3f

File tree

3 files changed

+54
-23
lines changed

3 files changed

+54
-23
lines changed
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
name: 'Prepare Example app'
2+
description: 'Does necessary pre-work for the example app to compile natively'
3+
4+
runs:
5+
using: 'composite'
6+
steps:
7+
- name: 'Build plugin'
8+
working-directory: ./packages/capacitor-plugin
9+
shell: bash
10+
run: npm run build
11+
- name: 'Install example app dependencies'
12+
working-directory: ./packages/example-app-capacitor
13+
shell: bash
14+
run: npm i
15+
- name: 'Build Web example app'
16+
working-directory: ./packages/example-app-capacitor
17+
shell: bash
18+
run: npm run build
19+
- name: 'Sync example app native platforms'
20+
working-directory: ./packages/example-app-capacitor
21+
shell: bash
22+
run: npx cap sync

.github/workflows/continuous_integration.yml

Lines changed: 29 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -16,41 +16,54 @@ jobs:
1616
needs: 'setup'
1717
uses: ./.github/workflows/reusable_build.yml
1818

19-
verify-plugin:
19+
verify-plugin-android:
2020
needs: ['setup', 'lint', 'build']
2121
runs-on: 'macos-15'
2222
timeout-minutes: 30
2323
steps:
2424
- uses: actions/checkout@v4
2525
- name: 'Setup Tools'
2626
uses: ./.github/actions/setup-tools
27-
- name: 'Verify iOS + Android + Web'
27+
- name: 'Verify Android'
2828
working-directory: ./packages/capacitor-plugin
29-
run: npm run verify
29+
run: npm run verify:android
3030

31-
build-example-app:
32-
needs: ['verify-plugin']
31+
verify-plugin-ios:
32+
needs: ['setup', 'lint', 'build']
3333
runs-on: 'macos-15'
3434
timeout-minutes: 30
3535
steps:
3636
- uses: actions/checkout@v4
3737
- name: 'Setup Tools'
3838
uses: ./.github/actions/setup-tools
39-
- name: 'Build plugin'
39+
- name: 'Verify iOS'
4040
working-directory: ./packages/capacitor-plugin
41-
run: npm run build
42-
- name: 'Install example app dependencies'
43-
working-directory: ./packages/example-app-capacitor
44-
run: npm i
45-
- name: 'Build Web example app'
46-
working-directory: ./packages/example-app-capacitor
47-
run: npm run build
48-
- name: 'Sync example app native platforms'
49-
working-directory: ./packages/example-app-capacitor
50-
run: npx cap sync
41+
run: npm run verify:ios
42+
43+
build-example-app-android:
44+
needs: ['verify-plugin-ios', 'verify-plugin-android']
45+
runs-on: 'macos-15'
46+
timeout-minutes: 30
47+
steps:
48+
- uses: actions/checkout@v4
49+
- name: 'Setup Tools'
50+
uses: ./.github/actions/setup-tools
51+
- name: 'Prepare example app'
52+
uses: ./.github/actions/prepare-example-app
5153
- name: 'Build Android example app'
5254
working-directory: ./packages/example-app-capacitor/android
5355
run: ./gradlew clean assembleDebug
56+
57+
build-example-app-ios:
58+
needs: ['verify-plugin-ios', 'verify-plugin-android']
59+
runs-on: 'macos-15'
60+
timeout-minutes: 30
61+
steps:
62+
- uses: actions/checkout@v4
63+
- name: 'Setup Tools'
64+
uses: ./.github/actions/setup-tools
65+
- name: 'Prepare example app'
66+
uses: ./.github/actions/prepare-example-app
5467
- name: 'Build iOS example app'
5568
working-directory: ./packages/example-app-capacitor/ios/App
5669
run: xcodebuild clean build -workspace App.xcworkspace -scheme App CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO

packages/capacitor-plugin/Package.swift

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,20 +10,16 @@ let package = Package(
1010
targets: ["FilesystemPlugin"])
1111
],
1212
dependencies: [
13-
.package(url: "https://github.com/ionic-team/capacitor-swift-pm.git", from: "7.0.0")
13+
.package(url: "https://github.com/ionic-team/capacitor-swift-pm.git", from: "7.0.0"),
14+
.package(url: "https://github.com/ionic-team/ion-ios-filesystem.git", from: "1.0.1")
1415
],
1516
targets: [
16-
.binaryTarget(
17-
name: "IONFilesystemLib",
18-
url: "https://github.com/ionic-team/ion-ios-filesystem/releases/download/1.0.1/IONFilesystemLib.zip",
19-
checksum: "2d333c2be44a51f804f3b592d61fa19d582afc40b6916c1c9d1dee43c30657b9" // sha-256
20-
),
2117
.target(
2218
name: "FilesystemPlugin",
2319
dependencies: [
2420
.product(name: "Capacitor", package: "capacitor-swift-pm"),
2521
.product(name: "Cordova", package: "capacitor-swift-pm"),
26-
"IONFilesystemLib"
22+
.product(name: "IONFilesystemLib", package: "ion-ios-filesystem")
2723
],
2824
path: "ios/Sources/FilesystemPlugin"),
2925
.testTarget(

0 commit comments

Comments
 (0)