Skip to content
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 @@ -17,7 +17,7 @@ import co.touchlab.kmmbridge.findStringProperty
import org.gradle.api.Project

internal val Project.githubPublishTokenOrNull: String?
get() = project.property("GITHUB_PUBLISH_TOKEN") as String?
get() = project.findStringProperty("GITHUB_PUBLISH_TOKEN")

internal val Project.githubPublishUser: String?
get() = project.findStringProperty("GITHUB_PUBLISH_USER")
Expand All @@ -37,10 +37,8 @@ internal val Project.githubRepoOrNull: String?

internal val Project.githubPublishToken
get() =
(
project.property("GITHUB_PUBLISH_TOKEN")
?: throw IllegalArgumentException("KMMBridge Github operations need property GITHUB_PUBLISH_TOKEN")
) as String
project.findStringProperty("GITHUB_PUBLISH_TOKEN")
?: throw IllegalArgumentException("KMMBridge Github operations need property GITHUB_PUBLISH_TOKEN")

internal val Project.githubArtifactReleaseId
get() = project.findStringProperty("GITHUB_ARTIFACT_RELEASE_ID")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import java.net.URLEncoder
import org.gradle.api.Project

internal val Project.gitLabPublishTokenOrNull: String?
get() = project.property("GITLAB_PUBLISH_TOKEN") as String?
get() = project.findStringProperty("GITLAB_PUBLISH_TOKEN")

internal val Project.gitLabPublishUser: String?
get() = project.findStringProperty("GITLAB_PUBLISH_USER")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,9 @@
package co.touchlab.kmmbridge

import org.gradle.api.Project
import org.gradle.api.plugins.ExtraPropertiesExtension
import org.gradle.api.publish.PublishingExtension
import org.gradle.kotlin.dsl.getByType

val Project.publishingExtension get() = extensions.getByType<PublishingExtension>()

fun Project.findStringProperty(name: String): String? {
rootProject.extensions.getByType(ExtraPropertiesExtension::class.java).run {
if (has(name)) {
return get(name).toString()
}
}
return null
}
fun Project.findStringProperty(name: String): String? = providers.gradleProperty(name).getOrNull()
Loading