Skip to content

Commit cce9bf8

Browse files
Use product flavor for latest or minimum supported THEOplayer (#88)
1 parent 0a1f7d8 commit cce9bf8

3 files changed

Lines changed: 28 additions & 26 deletions

File tree

.github/workflows/ci.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,5 +31,3 @@ jobs:
3131
run: ./gradlew test --configuration-cache
3232
- name: Assemble
3333
run: ./gradlew assembleRelease --configuration-cache
34-
- name: Assemble with lowest supported player version
35-
run: ./gradlew assembleRelease --configuration-cache -PinstallLowestSupportedPlayerVersion=true

app/build.gradle.kts

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,19 @@ android {
3838
matchingFallbacks += listOf("debug")
3939
}
4040
}
41+
42+
flavorDimensions += "player"
43+
productFlavors {
44+
create("latestPlayer") {
45+
// Use the latest supported THEOplayer version
46+
dimension = "player"
47+
}
48+
create("minPlayer") {
49+
// Use the minimum supported THEOplayer version
50+
dimension = "player"
51+
}
52+
}
53+
4154
compileOptions {
4255
sourceCompatibility = JavaVersion.VERSION_1_8
4356
targetCompatibility = JavaVersion.VERSION_1_8
@@ -59,6 +72,10 @@ android {
5972
}
6073

6174
dependencies {
75+
val mavenImplementation = configurations.getByName("mavenImplementation")
76+
val latestPlayerImplementation = configurations.getByName("latestPlayerImplementation")
77+
val minPlayerImplementation = configurations.getByName("minPlayerImplementation")
78+
6279
implementation(platform(libs.androidx.compose.bom))
6380

6481
implementation(libs.androidx.ktx)
@@ -80,30 +97,13 @@ dependencies {
8097

8198
debugImplementation(project(":ui"))
8299
releaseImplementation(project(":ui"))
83-
"mavenImplementation"("com.theoplayer.android-ui:android-ui:1.+")
100+
mavenImplementation("com.theoplayer.android-ui:android-ui:1.+")
84101

85-
implementation(libs.theoplayer) {
86-
useLowestSupportedPlayerVersion()
87-
}
88-
implementation(libs.theoplayer.ads.ima) {
89-
useLowestSupportedPlayerVersion()
90-
}
91-
implementation(libs.theoplayer.cast) {
92-
useLowestSupportedPlayerVersion()
93-
}
94-
}
102+
latestPlayerImplementation(libs.theoplayer)
103+
latestPlayerImplementation(libs.theoplayer.ads.ima)
104+
latestPlayerImplementation(libs.theoplayer.cast)
95105

96-
val installLowestSupportedPlayerVersion: String by project.ext
97-
98-
fun ExternalDependency.useLowestSupportedPlayerVersion() {
99-
if (installLowestSupportedPlayerVersion.toBooleanStrict()) {
100-
val lowestVersion = versionConstraint.strictVersion
101-
.removePrefix("[")
102-
.split(",", limit = 2)
103-
.first()
104-
version {
105-
prefer(lowestVersion)
106-
strictly(lowestVersion)
107-
}
108-
}
106+
minPlayerImplementation(libs.theoplayer.min)
107+
minPlayerImplementation(libs.theoplayer.min.ads.ima)
108+
minPlayerImplementation(libs.theoplayer.min.cast)
109109
}

gradle/libs.versions.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ androidx-espresso = "3.7.0"
1717
androidx-mediarouter = "1.8.1"
1818
dokka = "2.0.0"
1919
theoplayer = { prefer="10.11.0", strictly = "[7.6.0, 11.0)" }
20+
theoplayer-min = { strictly = "7.6.0" }
2021

2122
[libraries]
2223
androidx-ktx = { group = "androidx.core", name = "core-ktx", version.ref = "ktx" }
@@ -44,6 +45,9 @@ junit4 = { group = "junit", name = "junit", version.ref = "junit4" }
4445
theoplayer = { group = "com.theoplayer.theoplayer-sdk-android", name = "core", version.ref = "theoplayer" }
4546
theoplayer-ads-ima = { group = "com.theoplayer.theoplayer-sdk-android", name = "integration-ads-ima", version.ref = "theoplayer" }
4647
theoplayer-cast = { group = "com.theoplayer.theoplayer-sdk-android", name = "integration-cast", version.ref = "theoplayer" }
48+
theoplayer-min = { group = "com.theoplayer.theoplayer-sdk-android", name = "core", version.ref = "theoplayer-min" }
49+
theoplayer-min-ads-ima = { group = "com.theoplayer.theoplayer-sdk-android", name = "integration-ads-ima", version.ref = "theoplayer-min" }
50+
theoplayer-min-cast = { group = "com.theoplayer.theoplayer-sdk-android", name = "integration-cast", version.ref = "theoplayer-min" }
4751

4852
[plugins]
4953
android-application = { id = "com.android.application", version.ref = "gradle" }

0 commit comments

Comments
 (0)