-
Notifications
You must be signed in to change notification settings - Fork 409
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update custom Gradle utils to use Gradle Kotlin DSL (#2833)
- Loading branch information
Showing
21 changed files
with
201 additions
and
191 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 0 additions & 20 deletions
20
runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/DokkaProperty.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,6 @@ | ||
package org.jetbrains.dokka.gradle | ||
|
||
import org.gradle.api.model.ObjectFactory | ||
import org.gradle.api.provider.Property | ||
import org.gradle.api.provider.Provider | ||
import org.gradle.kotlin.dsl.property | ||
import org.jetbrains.dokka.utilities.cast | ||
import kotlin.reflect.typeOf | ||
|
||
internal inline fun <reified T : Any> ObjectFactory.safeProperty() = property<T?>() | ||
|
||
internal inline fun <reified T : Any> Property<T?>.safeConvention(value: T): Property<T> { | ||
return this.convention(value).cast() | ||
} | ||
|
||
internal inline fun <reified T : Any> Property<T?>.safeConvention(provider: Provider<T?>): Property<T> { | ||
return this.convention(provider).cast() | ||
} | ||
|
||
@OptIn(ExperimentalStdlibApi::class) | ||
internal inline fun <reified T> Provider<T>.getSafe(): T = | ||
if (typeOf<T>().isMarkedNullable) orNull as T | ||
else get() | ||
|
||
internal fun Provider<String>.getValidVersionOrNull() = orNull?.takeIf { it != "unspecified" } | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.