Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/AlecKazakova/kotlin-native-cocoapods
A Gradle plugin for configuring Kotlin/Native with Cocoapods
https://github.com/AlecKazakova/kotlin-native-cocoapods
Last synced: 2 months ago
JSON representation
A Gradle plugin for configuring Kotlin/Native with Cocoapods
- Host: GitHub
- URL: https://github.com/AlecKazakova/kotlin-native-cocoapods
- Owner: AlecKazakova
- License: apache-2.0
- Archived: true
- Created: 2019-01-17T20:56:01.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2020-05-27T14:12:27.000Z (over 4 years ago)
- Last Synced: 2024-05-21T15:19:49.691Z (8 months ago)
- Language: Kotlin
- Homepage:
- Size: 126 KB
- Stars: 128
- Watchers: 8
- Forks: 11
- Open Issues: 9
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE.txt
Awesome Lists containing this project
- awesome-kotlin-multiplatform - kotlin-native-cocoapods - Gradle plugin for configuring Kotlin/Native with Cocoapods. (Libraries / Build & Development Tools)
README
# DEPRECATED!
Please use the [official cocoapods support](https://github.com/JetBrains/kotlin-native/blob/master/COCOAPODS.md) which is included in the regular kotlin multiplatform gradle plugin.
# kotlin-native-cocoapods
A Gradle plugin which handles creating a podspec for a local Kotlin/Native project. The generated podspec properly integrates your project with cocoapods, and release/debug fat binaries will be created and linked when you compile the xcode project. Using this plugin means you do not need to manually set up xcode or the `packForXcode` task as described in the [documentation](https://kotlinlang.org/docs/tutorials/native/mpp-ios-android.html#creating-ios-application).
### Setup
```groovy
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.alecstrong:cocoapods-gradle-plugin:0.3.3'
}
}// Cocoapods plugin is only applicable for multiplatform projects with Kotlin/Native
apply plugin: 'org.jetbrains.kotlin.multiplatform'
apply plugin: 'com.alecstrong.cocoapods'// Optional configuration of plugin.
cocoapods {
version = "1.0.0-LOCAL" // Defaults to "1.0.0-LOCAL"
homepage = www.mywebsite.com // Default to empty
deploymentTarget = "10.0" // Defaults to "10.0"
authors = "Ben Asher" // Defaults to empty
license = "..." // Defaults to empty
summary = "..." // Defaults to empty
daemon = true // Defaults to false
wrapperExecutableName = "gradlew" // Defaults to "gradlew"
wrapperAdditionalArgs = "..." // Defaults to empty
}
```From this the plugin will generate a task `generatePodspec` to create a `.podspec` file in that directory for the kotlin native project.
```
> Code/Kotlin/gradlew -p Code/Kotlin :common:generatePodspec
```The above command is assuming a module structure where `Code/Kotlin` is the root of your gradle project, and `common` is a Kotlin Multiplatform module with iOS targets.
Then in your `Podfile` you can reference the module:
```ruby
target 'MyProject' do
...
pod 'common', :path => 'Code/Kotlin/common'
end
```And that's it! From your iOS project you will be able to `import common`.
### Custom Target
The plugin also includes a custom target which sets up the source sets:
```groovy
kotlin {
targetForCocoapods('ios')
sourceSets {
iosMain { ... }
iosTest { ... }
}
}
```Doing this will also generate a `iosTest` task for running tests against this target.
### Custom Architectures
By default this packages a fat binary with x64, arm64, and arm32 architectures inside. To override this behavior pass a list of presets into the `targetForCocoapods` method:
```groovy
kotlin {
targetForCocoapods([presets.iosArm64, presets.iosX64], 'ios')
}
```Its also possible to use the full 1.3.20 DSL to customize the targets:
```groovy
kotlin {
targetForCocoapods([presets.iosArm64, presets.iosX64], 'ios') {
compilations.main.extraOpts '-module-name', 'CP'
}
}
```