summaryrefslogtreecommitdiffhomepage
path: root/android/buildSrc/src/main/kotlin/Extensions.kt
blob: 400df4406e4477a030af7e47dd645bcde408fc65 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
import org.gradle.api.artifacts.Dependency
import org.gradle.api.artifacts.dsl.DependencyHandler

fun String.isNonStableVersion(): Boolean {
    val nonStableQualifiers = listOf("alpha", "beta", "rc")

    val isNonStable =
        nonStableQualifiers
            .map { qualifier -> Regex("(?i).*[.-]$qualifier[.\\d-+]*") }
            .any { it.matches(this) }

    return isNonStable
}

fun DependencyHandler.leakCanaryImplementation(dependencyNotation: Any): Dependency? =
    add("leakCanaryImplementation", dependencyNotation)

fun DependencyHandler.playImplementation(dependencyNotation: Any): Dependency? =
    add("playImplementation", dependencyNotation)