Skip to content

StreamVault is a TV-first free IPTV player for Android TV built with Kotlin, Jetpack Compose, Room, Hilt, and Media3.

build: add playback feature module

David Nashashb3abd617ae6f
diff --git a/app/build.gradle.kts b/app/build.gradle.kts
index 57dedb44..983553a8 100644
--- a/app/build.gradle.kts
+++ b/app/build.gradle.kts
@@ -421,6 +421,7 @@ dependencies {
implementation(project(":domain"))
implementation(project(":data"))
implementation(project(":player"))
+ implementation(project(":feature:playback"))
implementation(libs.profileinstaller)
baselineProfile(project(":benchmark"))
diff --git a/build.gradle.kts b/build.gradle.kts
index b4ca765d..ded857bf 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -27,6 +27,7 @@ dependencies {
kover(project(":data"))
kover(project(":domain"))
kover(project(":player"))
+ kover(project(":feature:playback"))
}
tasks.register("verifyLintBaseline") {
@@ -83,6 +84,12 @@ tasks.register("verifyCoreNavigationBoundary") {
dependsOn(":core:navigation:verifyCoreNavigationBoundary")
}
+tasks.register("verifyFeaturePlaybackBoundary") {
+ group = "verification"
+ description = "Verifies that :feature:playback remains independent from :app and root navigation controllers."
+ dependsOn(":feature:playback:verifyFeaturePlaybackBoundary")
+}
+
abstract class VerifyBaselineProfileSourcesTask : DefaultTask() {
@get:InputDirectory
@get:PathSensitive(PathSensitivity.RELATIVE)
diff --git a/feature/playback/build.gradle.kts b/feature/playback/build.gradle.kts
new file mode 100644
index 00000000..0220d220
--- /dev/null
+++ b/feature/playback/build.gradle.kts
@@ -0,0 +1,144 @@
+import org.gradle.api.artifacts.ProjectDependency
+
+plugins {
+ alias(libs.plugins.android.library)
+ alias(libs.plugins.kotlin.android)
+ alias(libs.plugins.kotlin.compose)
+ alias(libs.plugins.ksp)
+ alias(libs.plugins.hilt)
+ alias(libs.plugins.kover)
+}
+
+android {
+ namespace = "com.streamvault.feature.playback"
+ compileSdk = 36
+
+ defaultConfig {
+ minSdk = 25
+ testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
+ }
+
+ compileOptions {
+ sourceCompatibility = JavaVersion.VERSION_17
+ targetCompatibility = JavaVersion.VERSION_17
+ }
+
+ buildFeatures {
+ compose = true
+ }
+}
+
+kotlin {
+ compilerOptions {
+ jvmTarget.set(org.jetbrains.kotlin.gradle.dsl.JvmTarget.JVM_17)
+ }
+}
+
+kover {
+ currentProject {
+ createVariant("ci") {
+ add("debug")
+ }
+ }
+}
+
+val allowedProjectDependencies = setOf(
+ ":core:navigation",
+ ":core:ui",
+ ":domain",
+ ":player",
+ ":data"
+)
+
+val verifyFeaturePlaybackBoundary = tasks.register("verifyFeaturePlaybackBoundary") {
+ group = "verification"
+ description = "Verifies that playback feature source and dependencies remain app-independent."
+ notCompatibleWithConfigurationCache(
+ "The boundary scan reads resolved Gradle model state at execution time."
+ )
+
+ doLast {
+ val projectDependencyPaths = configurations
+ .flatMap { configuration ->
+ configuration.dependencies
+ .withType<ProjectDependency>()
+ .filter { dependency -> dependency.path != project.path }
+ .map { dependency -> dependency.path }
+ }
+ .toSet()
+
+ check(projectDependencyPaths == allowedProjectDependencies) {
+ ":feature:playback project dependencies must be exactly " +
+ "${allowedProjectDependencies.sorted()}; found ${projectDependencyPaths.sorted()}"
+ }
+
+ val sourceRoot = layout.projectDirectory.asFile.resolve("src/main")
+ val forbiddenTokens = listOf(
+ "import com.streamvault.app",
+ "NavHostController",
+ "NavController"
+ )
+ val violations = sourceRoot.walkTopDown()
+ .filter { it.isFile && it.extension == "kt" }
+ .flatMap { file ->
+ file.readLines().flatMapIndexed { index, line ->
+ forbiddenTokens.filter(line::contains).map { token ->
+ "${file.relativeTo(sourceRoot)}:${index + 1}: $token"
+ }
+ }
+ }
+ .toList()
+
+ check(violations.isEmpty()) {
+ ":feature:playback contains forbidden app or root navigation references:\n" +
+ violations.joinToString("\n")
+ }
+
+ println("Verified :feature:playback boundary: approved dependencies and no forbidden source references.")
+ }
+}
+
+tasks.named("check") {
+ dependsOn(verifyFeaturePlaybackBoundary)
+}
+
+dependencies {
+ implementation(project(":core:navigation"))
+ implementation(project(":core:ui"))
+ implementation(project(":domain"))
+ implementation(project(":player"))
+ implementation(project(":data"))
+
+ implementation(platform(libs.compose.bom))
+ implementation(libs.compose.ui)
+ implementation(libs.compose.material3)
+ implementation(libs.compose.material.icons.extended)
+ implementation(libs.compose.tv.foundation)
+ implementation(libs.compose.tv.material)
+ implementation(libs.activity.compose)
+ implementation(libs.lifecycle.runtime.compose)
+ implementation(libs.lifecycle.viewmodel.compose)
+ implementation(libs.navigation.compose)
+ implementation(libs.hilt.android)
+ ksp(libs.hilt.compiler)
+ implementation(libs.hilt.navigation.compose)
+ implementation(libs.coroutines.core)
+ implementation(libs.coroutines.android)
+ implementation(libs.coil.compose)
+ implementation(libs.coil.network.okhttp)
+ implementation(libs.core.ktx)
+ implementation(libs.mediarouter)
+ implementation(libs.play.services.cast.framework)
+ implementation(libs.okhttp)
+
+ testImplementation(libs.junit)
+ testImplementation(libs.truth)
+ testImplementation(libs.coroutines.test)
+ testImplementation(libs.robolectric)
+
+ androidTestImplementation(platform(libs.compose.bom))
+ androidTestImplementation("androidx.compose.ui:ui-test-junit4")
+ androidTestImplementation(libs.androidx.test.ext.junit)
+ androidTestImplementation(libs.androidx.test.runner)
+ androidTestImplementation(libs.truth)
+}
diff --git a/feature/playback/src/main/AndroidManifest.xml b/feature/playback/src/main/AndroidManifest.xml
new file mode 100644
index 00000000..8072ee00
--- /dev/null
+++ b/feature/playback/src/main/AndroidManifest.xml
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="utf-8"?>
+<manifest />
diff --git a/feature/playback/src/test/java/com/streamvault/feature/playback/PlaybackModuleBoundaryTest.kt b/feature/playback/src/test/java/com/streamvault/feature/playback/PlaybackModuleBoundaryTest.kt
new file mode 100644
index 00000000..5a70382c
--- /dev/null
+++ b/feature/playback/src/test/java/com/streamvault/feature/playback/PlaybackModuleBoundaryTest.kt
@@ -0,0 +1,54 @@
+package com.streamvault.feature.playback
+
+import com.google.common.truth.Truth.assertThat
+import java.io.File
+import org.junit.Test
+
+class PlaybackModuleBoundaryTest {
+
+ private val allowedProjectDependencies = setOf(
+ ":core:navigation",
+ ":core:ui",
+ ":domain",
+ ":player",
+ ":data"
+ )
+
+ @Test
+ fun `module build declares exactly the approved project dependencies`() {
+ val buildScript = File("build.gradle.kts")
+ assertThat(buildScript.isFile).isTrue()
+
+ val declaredProjectDependencies = Regex(
+ """implementation\(project\(\"([^\"]+)\"\)\)"""
+ ).findAll(buildScript.readText())
+ .map { it.groupValues[1] }
+ .toSet()
+
+ assertThat(declaredProjectDependencies).containsExactlyElementsIn(allowedProjectDependencies)
+ }
+
+ @Test
+ fun `main source does not reference app packages or root navigation controllers`() {
+ val sourceRoot = File("src/main")
+ assertThat(sourceRoot.isDirectory).isTrue()
+
+ val forbiddenTokens = listOf(
+ "import com.streamvault.app",
+ "NavHostController",
+ "NavController"
+ )
+ val violations = sourceRoot.walkTopDown()
+ .filter { it.isFile && it.extension == "kt" }
+ .flatMap { source ->
+ source.readLines().flatMapIndexed { index, line ->
+ forbiddenTokens.filter(line::contains).map { token ->
+ "${source.relativeTo(sourceRoot)}:${index + 1}: $token"
+ }
+ }
+ }
+ .toList()
+
+ assertThat(violations).isEmpty()
+ }
+}
diff --git a/settings.gradle.kts b/settings.gradle.kts
index ad21ef1e..5d5d01e7 100644
--- a/settings.gradle.kts
+++ b/settings.gradle.kts
@@ -23,3 +23,4 @@ include(":core:ui")
include(":domain")
include(":data")
include(":player")
+include(":feature:playback")