• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

AlecStrong/kotlin-native-cocoapods: A Gradle plugin for configuring Kotlin/Nativ ...

原作者: [db:作者] 来自: 网络 收藏 邀请

开源软件名称(OpenSource Name):

AlecStrong/kotlin-native-cocoapods

开源软件地址(OpenSource Url):

https://github.com/AlecStrong/kotlin-native-cocoapods

开源编程语言(OpenSource Language):

Kotlin 94.8%

开源软件介绍(OpenSource Introduction):

DEPRECATED!

Please use the official cocoapods support 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.

Setup

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:

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:

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:

kotlin {
  targetForCocoapods([presets.iosArm64, presets.iosX64], 'ios')
}

Its also possible to use the full 1.3.20 DSL to customize the targets:

kotlin {
  targetForCocoapods([presets.iosArm64, presets.iosX64], 'ios') {
    compilations.main.extraOpts '-module-name', 'CP'
  }
}



鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap