Skip to content

Commit

Permalink
Add option to switch between releases, snapshots, unstable snapshots …
Browse files Browse the repository at this point in the history
…and local versions of the SDK
  • Loading branch information
nielsvanvelzen authored and Maxr1998 committed Jun 14, 2021
1 parent bfcaecb commit d332b92
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 7 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) }
"unstable-snapshot" -> version { strictly(Dependencies.Versions.jellyfinSdkSnapshotUnstable) }
"snapshot" -> version { strictly(Dependencies.Versions.jellyfinSdkSnapshot) }
}
}
implementation(Dependencies.Network.okHttp)
Expand Down
5 changes: 5 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@ 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")
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
3 changes: 2 additions & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,5 @@ kotlin.code.style=official
# Kotlin version for this project
kotlinVersion=1.5.10
# Use snapshot release of Jellyfin SDK
useSdkSnapshot=false
# Possible values "default", "snapshot" (master), "unstable-snapshot" (unstable api) or "local" (MavenLocal)
sdk.version=default

0 comments on commit d332b92

Please sign in to comment.