Skip to content
This repository was archived by the owner on Oct 19, 2021. It is now read-only.

Support the ability for pods to be declared “link only” #13

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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 @@ -86,15 +86,16 @@ open class CocoapodsExtension(private val project: Project) {
* Add a CocoaPods dependency to the pod built from this project.
*/
@JvmOverloads
fun pod(name: String, version: String? = null, moduleName: String = name.split("/")[0]) {
fun pod(name: String, version: String? = null, moduleName: String = name.split("/")[0], linkOnly: Boolean = false) {
check(_pods.findByName(name) == null) { "Project already has a CocoaPods dependency with name $name" }
_pods.add(CocoapodsDependency(name, version, moduleName))
_pods.add(CocoapodsDependency(name, version, moduleName, linkOnly))
}

data class CocoapodsDependency(
private val name: String,
@get:Optional @get:Input val version: String?,
@get:Input val moduleName: String
@get:Input val moduleName: String,
@get:Input val linkOnly: Boolean
) : Named {
@Input
override fun getName(): String = name
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ open class KotlinCocoapodsPlugin : Plugin<Project> {
) {
val moduleNames = mutableSetOf<String>()
cocoapodsExtension.pods.all { pod ->
if (moduleNames.contains(pod.moduleName)) {
if (moduleNames.contains(pod.moduleName) || pod.linkOnly) {
return@all
}
moduleNames.add(pod.moduleName)
Expand Down