Merge pull request #325 from jellyfin/dependency-maintanance

Dependency maintanance
This commit is contained in:
Niels van Velzen authored and GitHub committed 2021-03-23 09:37:46 +01:00
commit 1c761c92c9
3 files changed
+32 -22

No files matched your search

+5 -3
View File
@@ -80,7 +80,6 @@ dependencies {
val proprietaryImplementation by configurations
// Kotlin
implementation(kotlin("stdlib-jdk8"))
implementation(Dependencies.Kotlin.coroutinesCore)
implementation(Dependencies.Kotlin.coroutinesAndroid)
@@ -156,8 +155,11 @@ tasks.withType<Test> {
tasks.withType<DependencyUpdatesTask> {
gradleReleaseChannel = GradleReleaseChannel.CURRENT.id
rejectVersionIf {
!Dependencies.Versions.isStable(candidate.version) &&
Dependencies.Versions.isStable(currentVersion)
val currentType = classifyVersion(currentVersion)
val candidateType = classifyVersion(candidate.version)
(currentType == VersionType.STABLE && candidateType != VersionType.STABLE) ||
(currentType == VersionType.MILESTONE && candidateType == VersionType.UNSTABLE)
}
}
+9 -17
View File
@@ -1,23 +1,21 @@
import java.util.*
object Dependencies {
object Versions {
// Gradle plugins
const val dependencyUpdates = "0.36.0"
const val dependencyUpdates = "0.38.0"
// KotlinX
const val coroutines = "1.4.2"
const val coroutines = "1.4.3"
// Core
const val koin = "2.1.6"
const val appCompat = "1.2.0"
const val androidxCore = "1.4.0-alpha01"
const val activity = "1.2.0-rc01"
const val fragment = "1.2.5"
const val androidxCore = "1.5.0-beta03"
const val activity = "1.2.1"
const val fragment = "1.3.1"
const val exoPlayer = "2.12.3"
// Lifecycle
const val lifecycleExtensions = "2.2.0"
const val lifecycleExtensions = "2.3.0"
// UI
const val constraintLayout = "2.0.4"
@@ -34,7 +32,7 @@ object Dependencies {
const val coil = "1.1.1"
// Cast
const val mediaRouter = "1.2.1"
const val mediaRouter = "1.2.2"
const val playServicesCast = "19.0.0"
// Media
@@ -45,16 +43,10 @@ object Dependencies {
const val leakCanary = "2.6"
const val redScreenOfDeath = "0.1.2"
const val junit = "5.7.1"
const val kotest = "4.4.1"
const val mockk = "1.10.6"
const val kotest = "4.4.3"
const val mockk = "1.11.0"
const val androidXRunner = "1.3.0"
const val androidXEspresso = "3.3.0"
fun isStable(version: String): Boolean {
return listOf("alpha", "beta", "dev", "rc", "m").none {
version.toLowerCase(Locale.ROOT).contains(it)
}
}
}
object Kotlin {
+18 -2
View File
@@ -1,4 +1,5 @@
import org.gradle.api.Project
import java.util.*
/**
* Get the version name from the current environment or use the fallback.
@@ -10,7 +11,7 @@ import org.gradle.api.Project
* v2.0.0 -> 2.0.0
* null -> 0.0.0-dev.1 (unless different fallback set)
*/
fun Project.getVersionName(fallback: String = "0.0.0-dev.1"): String? {
fun Project.getVersionName(fallback: String = "0.0.0-dev.1"): String {
val configuredVersion = System.getenv("JELLYFIN_VERSION")
?: findProperty("jellyfin.version")?.toString()
@@ -34,7 +35,7 @@ fun Project.getVersionName(fallback: String = "0.0.0-dev.1"): String? {
* 2.0.0 > 2 00 00 99
* 99.99.99-rc.1 > 99 99 99 01
*/
fun getVersionCode(versionName: String): Int? {
fun getVersionCode(versionName: String): Int {
// Split to core and pre release parts with a default for pre release (null)
val (versionCore, versionPreRelease) =
when (val index = versionName.indexOf('-')) {
@@ -66,3 +67,18 @@ fun getVersionCode(versionName: String): Int? {
return code
}
enum class VersionType {
STABLE, MILESTONE, UNSTABLE
}
fun classifyVersion(version: String): VersionType {
val normalizedVersion = version.toLowerCase(Locale.ROOT)
return when {
normalizedVersion.containsAny(listOf("alpha", "beta", "dev")) -> VersionType.UNSTABLE
normalizedVersion.containsAny(listOf("rc", "m")) -> VersionType.MILESTONE
else -> VersionType.STABLE
}
}
fun String.containsAny(strings: Iterable<String>): Boolean = strings.any { contains(it) }