Skip to content
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

Docs for Multi-module export #252

Merged
merged 3 commits into from
Aug 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -138,17 +138,25 @@ class PackageFileUpdateTest {
],
products: [
.library(
name: packageName,
targets: [packageName]
name: testPackagePackageName,
targets: [testPackagePackageName]
),
.library(
name: testPackage2PackageName,
targets: [testPackage2PackageName]
),
],
targets: [
.binaryTarget(
name: packageName,
url: remoteKotlinUrl,
checksum: remoteKotlinChecksum
name: testPackagePackageName,
url: remoteTestPackageUrl,
checksum: remoteTestPackageChecksum
),
.binaryTarget(
name: testPackage2PackageName,
url: remoteTest2PackageUrl,
checksum: remoteTestPackage2Checksum
)
,
]
)
""".trimIndent()
Expand Down Expand Up @@ -176,17 +184,25 @@ class PackageFileUpdateTest {
],
products: [
.library(
name: packageName,
targets: [packageName]
name: testPackagePackageName,
targets: [testPackagePackageName]
),
.library(
name: testPackage2PackageName,
targets: [testPackage2PackageName]
),
],
targets: [
.binaryTarget(
name: packageName,
url: remoteKotlinUrl,
checksum: remoteKotlinChecksum
name: testPackagePackageName,
url: remoteTestPackageUrl,
checksum: remoteTestPackageChecksum
),
.binaryTarget(
name: testPackage2PackageName,
url: remoteTest2PackageUrl,
checksum: remoteTestPackage2Checksum
)
,
]
)
""".trimIndent()
Expand Down
37 changes: 37 additions & 0 deletions website/docs/spm/01_IOS_SPM.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,43 @@ This works by replacing a block of code that begins with the comment `// BEGIN K
The custom package file mode is new and experimental. The local dev flow using the `spmDevBuild` gradle task is disabled when `useCustomPackageFile` is true.
:::

### Exporting multiple frameworks

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`.

```kotlin
kmmbridge {
...
spm(useCustomPackageFile = true, perModuleVariablesBlock = true)
}
```

When set, it will modify the configuration block from KMMBridge to include the Framework name, so it can support multiple frameworks:

```swift
///// Before

// BEGIN KMMBRIDGE VARIABLES BLOCK (do not edit)
let remoteKotlinUrl = "https://www.example.com/"
let remoteKotlinChecksum = "01234567890abcdef"
let packageName = "TestPackage"
// END KMMBRIDGE BLOCK

///// After

// BEGIN KMMBRIDGE VARIABLES BLOCK FOR 'TestPackage' (do not edit)
let remoteTestPackageUrl = "https://www.example.com/"
let remoteTestPackageChecksum = "fedcba9876543210"
let testPackagePackageName = "TestPackage"
// END KMMBRIDGE BLOCK FOR 'TestPackage'

// BEGIN KMMBRIDGE VARIABLES BLOCK FOR 'TestPackage2' (do not edit)
let remoteTest2PackageUrl = "https://www.example.com/"
let remoteTestPackage2Checksum = "01234567890abcdeg"
let testPackage2PackageName = "TestPackage2"
// END KMMBRIDGE BLOCK FOR 'TestPackage2'
```

## Artifact Authentication

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.
Expand Down
Loading