|
| 1 | +import org.jetbrains.kotlin.gradle.dsl.JvmTarget |
| 2 | + |
| 3 | +plugins { |
| 4 | + alias(libs.plugins.android.application) |
| 5 | + alias(libs.plugins.hilt) |
| 6 | + alias(libs.plugins.kotlin.android) |
| 7 | + alias(libs.plugins.kotlin.compose.compiler) |
| 8 | + alias(libs.plugins.kotlin.parcelize) |
| 9 | + alias(libs.plugins.kotlin.serialization) |
| 10 | + alias(libs.plugins.ksp) |
| 11 | +} |
| 12 | + |
| 13 | +android { |
| 14 | + namespace = "com.x8bit.bitwarden.testharness" |
| 15 | + compileSdk = libs.versions.compileSdk.get().toInt() |
| 16 | + |
| 17 | + defaultConfig { |
| 18 | + applicationId = "com.x8bit.bitwarden.testharness" |
| 19 | + // API 28 - CredentialManager with Play Services support |
| 20 | + minSdk = libs.versions.minSdkBwa.get().toInt() |
| 21 | + targetSdk = libs.versions.targetSdk.get().toInt() |
| 22 | + versionCode = 1 |
| 23 | + versionName = "1.0.0" |
| 24 | + |
| 25 | + testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" |
| 26 | + } |
| 27 | + |
| 28 | + buildTypes { |
| 29 | + debug { |
| 30 | + applicationIdSuffix = ".dev" |
| 31 | + isDebuggable = true |
| 32 | + } |
| 33 | + release { |
| 34 | + isMinifyEnabled = true |
| 35 | + proguardFiles( |
| 36 | + getDefaultProguardFile("proguard-android-optimize.txt"), |
| 37 | + "proguard-rules.pro", |
| 38 | + ) |
| 39 | + } |
| 40 | + } |
| 41 | + |
| 42 | + buildFeatures { |
| 43 | + compose = true |
| 44 | + buildConfig = true |
| 45 | + } |
| 46 | + |
| 47 | + testOptions { |
| 48 | + // Required for Android framework classes in unit tests |
| 49 | + unitTests.isIncludeAndroidResources = true |
| 50 | + unitTests.isReturnDefaultValues = true |
| 51 | + } |
| 52 | + |
| 53 | + compileOptions { |
| 54 | + sourceCompatibility = JavaVersion.valueOf( |
| 55 | + libs.versions.jvmTarget.get().replace(".", "_").let { "VERSION_$it" }, |
| 56 | + ) |
| 57 | + targetCompatibility = JavaVersion.valueOf( |
| 58 | + libs.versions.jvmTarget.get().replace(".", "_").let { "VERSION_$it" }, |
| 59 | + ) |
| 60 | + } |
| 61 | + |
| 62 | + kotlin { |
| 63 | + compilerOptions { |
| 64 | + jvmTarget = JvmTarget.fromTarget(libs.versions.jvmTarget.get()) |
| 65 | + } |
| 66 | + } |
| 67 | +} |
| 68 | + |
| 69 | +dependencies { |
| 70 | + // Internal modules |
| 71 | + implementation(project(":annotation")) |
| 72 | + implementation(project(":core")) |
| 73 | + implementation(project(":ui")) |
| 74 | + |
| 75 | + // AndroidX Credentials - PRIMARY DEPENDENCY |
| 76 | + implementation(libs.androidx.credentials) |
| 77 | + |
| 78 | + // Hilt DI |
| 79 | + implementation(libs.google.hilt.android) |
| 80 | + ksp(libs.google.hilt.compiler) |
| 81 | + implementation(libs.androidx.hilt.navigation.compose) |
| 82 | + |
| 83 | + // Compose UI |
| 84 | + implementation(platform(libs.androidx.compose.bom)) |
| 85 | + implementation(libs.androidx.compose.material3) |
| 86 | + implementation(libs.androidx.compose.runtime) |
| 87 | + implementation(libs.androidx.compose.ui) |
| 88 | + implementation(libs.androidx.compose.ui.tooling.preview) |
| 89 | + implementation(libs.androidx.activity.compose) |
| 90 | + implementation(libs.androidx.lifecycle.runtime.compose) |
| 91 | + implementation(libs.androidx.splashscreen) |
| 92 | + |
| 93 | + // Kotlin essentials |
| 94 | + implementation(libs.androidx.core.ktx) |
| 95 | + implementation(libs.kotlinx.coroutines.android) |
| 96 | + implementation(libs.kotlinx.serialization) |
| 97 | + implementation(libs.kotlinx.collections.immutable) |
| 98 | + |
| 99 | + // Testing |
| 100 | + testImplementation(libs.androidx.compose.ui.test) |
| 101 | + testImplementation(libs.google.hilt.android.testing) |
| 102 | + testImplementation(platform(libs.junit.bom)) |
| 103 | + testRuntimeOnly(libs.junit.platform.launcher) |
| 104 | + testImplementation(libs.junit.jupiter) |
| 105 | + testImplementation(libs.junit.vintage) |
| 106 | + testImplementation(libs.kotlinx.coroutines.test) |
| 107 | + testImplementation(libs.mockk.mockk) |
| 108 | + // Robolectric reserved for future Android framework tests if needed |
| 109 | + testImplementation(libs.robolectric.robolectric) |
| 110 | + testImplementation(libs.square.turbine) |
| 111 | + |
| 112 | + testImplementation(testFixtures(project(":ui"))) |
| 113 | +} |
| 114 | + |
| 115 | +tasks { |
| 116 | + withType<Test> { |
| 117 | + useJUnitPlatform() |
| 118 | + maxHeapSize = "2g" |
| 119 | + maxParallelForks = Runtime.getRuntime().availableProcessors() |
| 120 | + } |
| 121 | +} |
0 commit comments