From e0cc36bbcfb799c8d9d32b6b6721bdbd7db31e37 Mon Sep 17 00:00:00 2001 From: Mattias Buelens Date: Wed, 18 Mar 2026 14:01:42 +0100 Subject: [PATCH 1/2] Use product flavor for latest or minimum supported THEOplayer --- .github/workflows/ci.yml | 2 -- app/build.gradle.kts | 42 ++++++++++++++++++--------------------- gradle/libs.versions.toml | 4 ++++ 3 files changed, 23 insertions(+), 25 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b0a05ca..550d8c4 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -31,5 +31,3 @@ jobs: run: ./gradlew test --configuration-cache - name: Assemble run: ./gradlew assembleRelease --configuration-cache - - name: Assemble with lowest supported player version - run: ./gradlew assembleRelease --configuration-cache -PinstallLowestSupportedPlayerVersion=true diff --git a/app/build.gradle.kts b/app/build.gradle.kts index 7d6bffe..c1af451 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -38,6 +38,19 @@ android { matchingFallbacks += listOf("debug") } } + + flavorDimensions += "player" + productFlavors { + create("latestPlayer") { + // Use the latest supported THEOplayer version + dimension = "player" + } + create("minPlayer") { + // Use the minimum supported THEOplayer version + dimension = "player" + } + } + compileOptions { sourceCompatibility = JavaVersion.VERSION_1_8 targetCompatibility = JavaVersion.VERSION_1_8 @@ -82,28 +95,11 @@ dependencies { releaseImplementation(project(":ui")) "mavenImplementation"("com.theoplayer.android-ui:android-ui:1.+") - implementation(libs.theoplayer) { - useLowestSupportedPlayerVersion() - } - implementation(libs.theoplayer.ads.ima) { - useLowestSupportedPlayerVersion() - } - implementation(libs.theoplayer.cast) { - useLowestSupportedPlayerVersion() - } -} - -val installLowestSupportedPlayerVersion: String by project.ext + "latestPlayerImplementation"(libs.theoplayer) + "latestPlayerImplementation"(libs.theoplayer.ads.ima) + "latestPlayerImplementation"(libs.theoplayer.cast) -fun ExternalDependency.useLowestSupportedPlayerVersion() { - if (installLowestSupportedPlayerVersion.toBooleanStrict()) { - val lowestVersion = versionConstraint.strictVersion - .removePrefix("[") - .split(",", limit = 2) - .first() - version { - prefer(lowestVersion) - strictly(lowestVersion) - } - } + "minPlayerImplementation"(libs.theoplayer.min) + "minPlayerImplementation"(libs.theoplayer.min.ads.ima) + "minPlayerImplementation"(libs.theoplayer.min.cast) } diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index e1932a3..1869fa5 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -17,6 +17,7 @@ androidx-espresso = "3.7.0" androidx-mediarouter = "1.8.1" dokka = "2.0.0" theoplayer = { prefer="10.11.0", strictly = "[7.6.0, 11.0)" } +theoplayer-min = { strictly = "7.6.0" } [libraries] androidx-ktx = { group = "androidx.core", name = "core-ktx", version.ref = "ktx" } @@ -44,6 +45,9 @@ junit4 = { group = "junit", name = "junit", version.ref = "junit4" } theoplayer = { group = "com.theoplayer.theoplayer-sdk-android", name = "core", version.ref = "theoplayer" } theoplayer-ads-ima = { group = "com.theoplayer.theoplayer-sdk-android", name = "integration-ads-ima", version.ref = "theoplayer" } theoplayer-cast = { group = "com.theoplayer.theoplayer-sdk-android", name = "integration-cast", version.ref = "theoplayer" } +theoplayer-min = { group = "com.theoplayer.theoplayer-sdk-android", name = "core", version.ref = "theoplayer-min" } +theoplayer-min-ads-ima = { group = "com.theoplayer.theoplayer-sdk-android", name = "integration-ads-ima", version.ref = "theoplayer-min" } +theoplayer-min-cast = { group = "com.theoplayer.theoplayer-sdk-android", name = "integration-cast", version.ref = "theoplayer-min" } [plugins] android-application = { id = "com.android.application", version.ref = "gradle" } From 4a9780de379c45928f422aab385b197bdcd9a7cf Mon Sep 17 00:00:00 2001 From: Mattias Buelens Date: Wed, 18 Mar 2026 14:48:26 +0100 Subject: [PATCH 2/2] Use `configurations.getByName()` first --- app/build.gradle.kts | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/app/build.gradle.kts b/app/build.gradle.kts index c1af451..6176a8f 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -72,6 +72,10 @@ android { } dependencies { + val mavenImplementation = configurations.getByName("mavenImplementation") + val latestPlayerImplementation = configurations.getByName("latestPlayerImplementation") + val minPlayerImplementation = configurations.getByName("minPlayerImplementation") + implementation(platform(libs.androidx.compose.bom)) implementation(libs.androidx.ktx) @@ -93,13 +97,13 @@ dependencies { debugImplementation(project(":ui")) releaseImplementation(project(":ui")) - "mavenImplementation"("com.theoplayer.android-ui:android-ui:1.+") + mavenImplementation("com.theoplayer.android-ui:android-ui:1.+") - "latestPlayerImplementation"(libs.theoplayer) - "latestPlayerImplementation"(libs.theoplayer.ads.ima) - "latestPlayerImplementation"(libs.theoplayer.cast) + latestPlayerImplementation(libs.theoplayer) + latestPlayerImplementation(libs.theoplayer.ads.ima) + latestPlayerImplementation(libs.theoplayer.cast) - "minPlayerImplementation"(libs.theoplayer.min) - "minPlayerImplementation"(libs.theoplayer.min.ads.ima) - "minPlayerImplementation"(libs.theoplayer.min.cast) + minPlayerImplementation(libs.theoplayer.min) + minPlayerImplementation(libs.theoplayer.min.ads.ima) + minPlayerImplementation(libs.theoplayer.min.cast) }