Skip to content

Commit 7ecb727

Browse files
authored
Merge pull request #252 from touchlab/gv/multi-module-docs
Docs for Multi-module export
2 parents 447f591 + df0a46f commit 7ecb727

File tree

2 files changed

+65
-12
lines changed

2 files changed

+65
-12
lines changed

kmmbridge/src/test/kotlin/co/touchlab/faktory/dependencyManager/PackageFileUpdateTest.kt

Lines changed: 28 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -138,17 +138,25 @@ class PackageFileUpdateTest {
138138
],
139139
products: [
140140
.library(
141-
name: packageName,
142-
targets: [packageName]
141+
name: testPackagePackageName,
142+
targets: [testPackagePackageName]
143+
),
144+
.library(
145+
name: testPackage2PackageName,
146+
targets: [testPackage2PackageName]
143147
),
144148
],
145149
targets: [
146150
.binaryTarget(
147-
name: packageName,
148-
url: remoteKotlinUrl,
149-
checksum: remoteKotlinChecksum
151+
name: testPackagePackageName,
152+
url: remoteTestPackageUrl,
153+
checksum: remoteTestPackageChecksum
154+
),
155+
.binaryTarget(
156+
name: testPackage2PackageName,
157+
url: remoteTest2PackageUrl,
158+
checksum: remoteTestPackage2Checksum
150159
)
151-
,
152160
]
153161
)
154162
""".trimIndent()
@@ -176,17 +184,25 @@ class PackageFileUpdateTest {
176184
],
177185
products: [
178186
.library(
179-
name: packageName,
180-
targets: [packageName]
187+
name: testPackagePackageName,
188+
targets: [testPackagePackageName]
189+
),
190+
.library(
191+
name: testPackage2PackageName,
192+
targets: [testPackage2PackageName]
181193
),
182194
],
183195
targets: [
184196
.binaryTarget(
185-
name: packageName,
186-
url: remoteKotlinUrl,
187-
checksum: remoteKotlinChecksum
197+
name: testPackagePackageName,
198+
url: remoteTestPackageUrl,
199+
checksum: remoteTestPackageChecksum
200+
),
201+
.binaryTarget(
202+
name: testPackage2PackageName,
203+
url: remoteTest2PackageUrl,
204+
checksum: remoteTestPackage2Checksum
188205
)
189-
,
190206
]
191207
)
192208
""".trimIndent()

website/docs/spm/01_IOS_SPM.md

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,43 @@ This works by replacing a block of code that begins with the comment `// BEGIN K
6868
The custom package file mode is new and experimental. The local dev flow using the `spmDevBuild` gradle task is disabled when `useCustomPackageFile` is true.
6969
:::
7070

71+
### Exporting multiple frameworks
72+
73+
By default, KMMBridge manages the Package.swift file considering that you have only Kotlin Module being exposed as a Swift Framework. If that's not your case, and you have more modules compiling Frameworks, you can use the `perModuleVariablesBlock` flag together with the `useCustomPackageFile`.
74+
75+
```kotlin
76+
kmmbridge {
77+
...
78+
spm(useCustomPackageFile = true, perModuleVariablesBlock = true)
79+
}
80+
```
81+
82+
When set, it will modify the configuration block from KMMBridge to include the Framework name, so it can support multiple frameworks:
83+
84+
```swift
85+
///// Before
86+
87+
// BEGIN KMMBRIDGE VARIABLES BLOCK (do not edit)
88+
let remoteKotlinUrl = "https://www.example.com/"
89+
let remoteKotlinChecksum = "01234567890abcdef"
90+
let packageName = "TestPackage"
91+
// END KMMBRIDGE BLOCK
92+
93+
///// After
94+
95+
// BEGIN KMMBRIDGE VARIABLES BLOCK FOR 'TestPackage' (do not edit)
96+
let remoteTestPackageUrl = "https://www.example.com/"
97+
let remoteTestPackageChecksum = "fedcba9876543210"
98+
let testPackagePackageName = "TestPackage"
99+
// END KMMBRIDGE BLOCK FOR 'TestPackage'
100+
101+
// BEGIN KMMBRIDGE VARIABLES BLOCK FOR 'TestPackage2' (do not edit)
102+
let remoteTest2PackageUrl = "https://www.example.com/"
103+
let remoteTestPackage2Checksum = "01234567890abcdeg"
104+
let testPackage2PackageName = "TestPackage2"
105+
// END KMMBRIDGE BLOCK FOR 'TestPackage2'
106+
```
107+
71108
## Artifact Authentication
72109

73110
For artifacts that are kept in private storage, you may need to add authentication information so your `~/.netrc` file or your Mac's Keychain Access. See [the section here](../DEFAULT_GITHUB_FLOW.md#private-repos) for a description of how to set up private file access.

0 commit comments

Comments
 (0)