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 core ui module boundary

David Nashashef4213453cac
diff --git a/app/build.gradle.kts b/app/build.gradle.kts
index db202fe4..20649b98 100644
--- a/app/build.gradle.kts
+++ b/app/build.gradle.kts
@@ -371,6 +371,7 @@ kover {
dependencies {
coreLibraryDesugaring(libs.desugar.jdk.libs)
+ implementation(project(":core:ui"))
implementation(project(":domain"))
implementation(project(":data"))
implementation(project(":player"))
diff --git a/build.gradle.kts b/build.gradle.kts
index 7b71f24c..8502c30e 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -71,6 +71,12 @@ tasks.register("verifyLintBaseline") {
}
}
+tasks.register("verifyCoreUiBoundary") {
+ group = "verification"
+ description = "Verifies that :core:ui remains independent from app and feature implementations."
+ dependsOn(":core:ui:verifyCoreUiBoundary")
+}
+
abstract class VerifyBaselineProfileSourcesTask : DefaultTask() {
@get:InputDirectory
@get:PathSensitive(PathSensitivity.RELATIVE)
diff --git a/core/ui/build.gradle.kts b/core/ui/build.gradle.kts
new file mode 100644
index 00000000..c8bc81c7
--- /dev/null
+++ b/core/ui/build.gradle.kts
@@ -0,0 +1,101 @@
+import org.gradle.api.artifacts.ProjectDependency
+
+plugins {
+ alias(libs.plugins.android.library)
+ alias(libs.plugins.kotlin.android)
+ alias(libs.plugins.kotlin.compose)
+}
+
+android {
+ namespace = "com.streamvault.core.ui"
+ compileSdk = 36
+
+ defaultConfig {
+ minSdk = 25
+ testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
+ }
+
+ compileOptions {
+ sourceCompatibility = JavaVersion.VERSION_17
+ targetCompatibility = JavaVersion.VERSION_17
+ }
+}
+
+kotlin {
+ compilerOptions {
+ jvmTarget.set(org.jetbrains.kotlin.gradle.dsl.JvmTarget.JVM_17)
+ }
+}
+
+val bannedCoreUiTokens = listOf(
+ "com.streamvault.app",
+ "com.streamvault.data",
+ "com.streamvault.domain",
+ "com.streamvault.player",
+ "androidx.navigation",
+ "dagger.hilt",
+ "MainActivity",
+ "NavController",
+ "NavHost"
+)
+
+val verifyCoreUiBoundary = tasks.register("verifyCoreUiBoundary") {
+ group = "verification"
+ description = "Verifies that core UI source and dependencies remain app-independent."
+ notCompatibleWithConfigurationCache(
+ "The boundary scan reads resolved Gradle model state at execution time."
+ )
+
+ doLast {
+ val projectDependencies = configurations
+ .flatMap { configuration ->
+ configuration.dependencies
+ .withType<ProjectDependency>()
+ .filter { dependency -> dependency.path != project.path }
+ .map { dependency -> "${configuration.name}:${dependency.path}" }
+ }
+ .distinct()
+
+ check(projectDependencies.isEmpty()) {
+ ":core:ui must not declare project dependencies: ${projectDependencies.joinToString()}"
+ }
+
+ val sourceRoot = layout.projectDirectory.asFile.resolve("src/main")
+ val violations = sourceRoot
+ .walkTopDown()
+ .filter { it.isFile && it.extension == "kt" }
+ .flatMap { file ->
+ file.readLines().flatMapIndexed { index, line ->
+ bannedCoreUiTokens
+ .filter(line::contains)
+ .map { token -> "${file.relativeTo(sourceRoot)}:${index + 1}: $token" }
+ }
+ }
+ .toList()
+
+ check(violations.isEmpty()) {
+ ":core:ui contains forbidden app/feature references:\n${violations.joinToString("\n")}"
+ }
+
+ println("Verified :core:ui boundary: no project dependencies and no banned source references.")
+ }
+}
+
+tasks.named("check") {
+ dependsOn(verifyCoreUiBoundary)
+}
+
+dependencies {
+ implementation(platform(libs.compose.bom))
+ implementation(libs.compose.foundation)
+ implementation(libs.compose.ui)
+ implementation(libs.compose.material.icons.extended)
+ implementation(libs.compose.tv.foundation)
+ implementation(libs.compose.tv.material)
+ implementation(libs.lifecycle.runtime.compose)
+ implementation(libs.core.ktx)
+
+ testImplementation(libs.junit)
+ testImplementation(libs.robolectric)
+ testImplementation(libs.truth)
+}
diff --git a/core/ui/src/main/AndroidManifest.xml b/core/ui/src/main/AndroidManifest.xml
new file mode 100644
index 00000000..94cbbcfc
--- /dev/null
+++ b/core/ui/src/main/AndroidManifest.xml
@@ -0,0 +1 @@
+<manifest xmlns:android="http://schemas.android.com/apk/res/android" />
diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml
index 8c36b98b..ecaacf95 100644
--- a/gradle/libs.versions.toml
+++ b/gradle/libs.versions.toml
@@ -53,6 +53,7 @@ androidx-test-runner = "1.6.2"
kotlin-stdlib = { group = "org.jetbrains.kotlin", name = "kotlin-stdlib", version.ref = "kotlin" }
# Compose BOM
compose-bom = { group = "androidx.compose", name = "compose-bom", version.ref = "compose-bom" }
+compose-foundation = { group = "androidx.compose.foundation", name = "foundation" }
compose-ui = { group = "androidx.compose.ui", name = "ui" }
compose-material3 = { group = "androidx.compose.material3", name = "material3" }
compose-material-icons-extended = { group = "androidx.compose.material", name = "material-icons-extended" }
diff --git a/settings.gradle.kts b/settings.gradle.kts
index d4dc850e..d4ac5c80 100644
--- a/settings.gradle.kts
+++ b/settings.gradle.kts
@@ -18,6 +18,7 @@ rootProject.name = "StreamVault"
include(":app")
include(":benchmark")
+include(":core:ui")
include(":domain")
include(":data")
include(":player")