Skip to content

Commit

Permalink
Add option to switch between versions of the SDK (#428)
Browse files Browse the repository at this point in the history
Add build option to switch between releases, snapshots, unstable snapshots and local versions of the SDK

Co-authored-by: Maxr1998 <[email protected]>
  • Loading branch information
nielsvanvelzen and Maxr1998 authored Jun 14, 2021
1 parent bfcaecb commit 88bf27a
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 9 deletions.
12 changes: 6 additions & 6 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import com.android.build.gradle.options.parseBoolean
import com.github.benmanes.gradle.versions.updates.DependencyUpdatesTask
import com.github.benmanes.gradle.versions.updates.gradle.GradleReleaseChannel
import io.gitlab.arturbosch.detekt.Detekt
Expand Down Expand Up @@ -139,12 +138,13 @@ dependencies {
kapt(Dependencies.Room.compiler)

// Network
val useSdkSnapshot: String by project
val sdkVersion = findProperty("sdk.version")?.toString()
implementation(Dependencies.Network.jellyfinSdk) {
version {
if (parseBoolean("useSdkSnapshot", useSdkSnapshot)) {
strictly(Dependencies.Versions.jellyfinSdkSnapshot)
}
// Change version if desired
when (sdkVersion) {
"local" -> version { strictly(Dependencies.Versions.jellyfinSdkLocal) }
"snapshot" -> version { strictly(Dependencies.Versions.jellyfinSdkSnapshot) }
"unstable-snapshot" -> version { strictly(Dependencies.Versions.jellyfinSdkSnapshotUnstable) }
}
}
implementation(Dependencies.Network.okHttp)
Expand Down
8 changes: 7 additions & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,15 @@ allprojects {
repositories {
mavenCentral()
google()
mavenLocal {
content {
includeVersionByRegex(Dependencies.Groups.jellyfin, ".*", Dependencies.Versions.jellyfinSdkLocal)
}
}
maven("https://s01.oss.sonatype.org/content/repositories/snapshots/") {
content {
includeVersionByRegex(Dependencies.Groups.jellyfin, ".*", ".*-SNAPSHOT")
includeVersionByRegex(Dependencies.Groups.jellyfin, ".*", Dependencies.Versions.jellyfinSdkSnapshot)
includeVersionByRegex(Dependencies.Groups.jellyfin, ".*", Dependencies.Versions.jellyfinSdkSnapshotUnstable)
}
}
}
Expand Down
2 changes: 2 additions & 0 deletions buildSrc/src/main/kotlin/Dependencies.kt
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,9 @@ object Dependencies {

// Network
const val jellyfinSdk = "1.0.0-beta.8"
const val jellyfinSdkLocal = "latest-SNAPSHOT"
const val jellyfinSdkSnapshot = "master-SNAPSHOT"
const val jellyfinSdkSnapshotUnstable = "openapi-unstable-SNAPSHOT"
const val okHttp = "4.9.1"
const val coil = "1.1.1"

Expand Down
8 changes: 6 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,9 @@ android.enableJetifier=true
kotlin.code.style=official
# Kotlin version for this project
kotlinVersion=1.5.10
# Use snapshot release of Jellyfin SDK
useSdkSnapshot=false
# Allow using snapshot releases of Jellyfin SDK. Possible values are:
# - "default"
# - "local" (local Maven repository)
# - "snapshot" (SDK master)
# - "unstable-snapshot" (SDK with unstable Jellyfin API)
sdk.version=default

0 comments on commit 88bf27a

Please sign in to comment.