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..6176a8f 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 @@ -59,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) @@ -80,30 +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.+") - implementation(libs.theoplayer) { - useLowestSupportedPlayerVersion() - } - implementation(libs.theoplayer.ads.ima) { - useLowestSupportedPlayerVersion() - } - implementation(libs.theoplayer.cast) { - useLowestSupportedPlayerVersion() - } -} + latestPlayerImplementation(libs.theoplayer) + latestPlayerImplementation(libs.theoplayer.ads.ima) + latestPlayerImplementation(libs.theoplayer.cast) -val installLowestSupportedPlayerVersion: String by project.ext - -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" }