plugins { id 'com.android.application' id 'kotlin-android' id 'kotlin-kapt' // hilt specific id 'dagger.hilt.android.plugin' } android { compileSdk 31 defaultConfig { applicationId "org.fnives.test.showcase" minSdk 21 targetSdk 31 versionCode 1 versionName "1.0" buildConfigField "String", "BASE_URL", '"https://606844a10add49001733fe6b.mockapi.io/"' testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" } buildTypes { release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' } } flavorDimensions 'di' productFlavors { hilt { dimension 'di' resValue "string", "app_name", "Hilt Test-ShowCase" applicationId "org.fnives.test.showcase.hilt" testInstrumentationRunner "org.fnives.test.showcase.testutils.configuration.HiltTestRunner" } koin { dimension 'di' resValue "string", "app_name", "Koin Test-ShowCase" applicationId "org.fnives.test.showcase.koin" } } buildFeatures { viewBinding true } sourceSets { androidTest { java.srcDirs += "src/sharedTest/java" } androidTestHilt { java.srcDirs += "src/sharedTestHilt/java" } androidTestKoin { java.srcDirs += "src/sharedTestKoin/java" } test { java.srcDirs += "src/sharedTest/java" java.srcDirs += "src/robolectricTest/java" } testHilt { java.srcDirs += "src/sharedTestHilt/java" java.srcDirs += "src/robolectricTestHilt/java" resources.srcDirs += "src/robolectricTestHilt/resources" } testKoin { java.srcDirs += "src/sharedTestKoin/java" java.srcDirs += "src/robolectricTestKoin/java" } } // needed for androidTest packagingOptions { exclude 'META-INF/LGPL2.1' exclude 'META-INF/AL2.0' exclude 'META-INF/LICENSE.md' exclude 'META-INF/LICENSE-notice.md' } } hilt { enableAggregatingTask = true enableExperimentalClasspathAggregation = true } afterEvaluate { // making sure the :mockserver is assembled after :clean when running tests testKoinDebugUnitTest.dependsOn tasks.getByPath(':mockserver:assemble') testKoinReleaseUnitTest.dependsOn tasks.getByPath(':mockserver:assemble') testHiltDebugUnitTest.dependsOn tasks.getByPath(':mockserver:assemble') testHiltReleaseUnitTest.dependsOn tasks.getByPath(':mockserver:assemble') } dependencies { implementation "androidx.core:core-ktx:$androidx_core_version" implementation "androidx.appcompat:appcompat:$androidx_appcompat_version" implementation "com.google.android.material:material:$androidx_material_version" implementation "androidx.constraintlayout:constraintlayout:$androidx_constraintlayout_version" implementation "androidx.lifecycle:lifecycle-livedata-core-ktx:$androidx_livedata_version" implementation "androidx.lifecycle:lifecycle-livedata-ktx:$androidx_livedata_version" implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:$androidx_livedata_version" implementation "androidx.swiperefreshlayout:swiperefreshlayout:$androidx_swiperefreshlayout_version" // Koin koinImplementation "io.insert-koin:koin-android:$koin_version" // Hilt implementation "com.google.dagger:hilt-android:$hilt_version" kaptHilt "com.google.dagger:hilt-compiler:$hilt_version" hiltImplementation "androidx.activity:activity-ktx:$activity_ktx_version" implementation "androidx.room:room-runtime:$androidx_room_version" kapt "androidx.room:room-compiler:$androidx_room_version" implementation "androidx.room:room-ktx:$androidx_room_version" implementation "io.coil-kt:coil:$coil_version" implementation project(":core") releaseImplementation project(":core") testImplementation "androidx.room:room-testing:$androidx_room_version" testImplementation "org.junit.jupiter:junit-jupiter-engine:$testing_junit5_version" testImplementation "org.junit.jupiter:junit-jupiter-params:$testing_junit5_version" testImplementation "org.mockito.kotlin:mockito-kotlin:$testing_kotlin_mockito_version" testImplementation "org.jetbrains.kotlinx:kotlinx-coroutines-test:$coroutines_version" testImplementation "com.jraska.livedata:testing-ktx:$testing_livedata_version" testImplementation "io.insert-koin:koin-test-junit5:$koin_version" testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:$testing_junit5_version" // robolectric specific testImplementation "junit:junit:$testing_junit4_version" testImplementation "org.robolectric:robolectric:$testing_robolectric_version" testImplementation "androidx.test:core:$testing_androidx_code_version" testImplementation "androidx.test:runner:$testing_androidx_code_version" testImplementation "androidx.test.ext:junit:$testing_androidx_junit_version" testImplementation "androidx.test.espresso:espresso-core:$testing_espresso_version" testImplementation "androidx.test.espresso:espresso-intents:$testing_espresso_version" testImplementation "androidx.test.espresso:espresso-contrib:$testing_espresso_version" testImplementation project(':mockserver') testImplementation "androidx.arch.core:core-testing:$testing_androidx_arch_core_version" testRuntimeOnly "org.junit.vintage:junit-vintage-engine:$testing_junit5_version" testImplementation "com.google.dagger:hilt-android-testing:$hilt_version" kaptTest "com.google.dagger:hilt-compiler:$hilt_version" androidTestImplementation "org.jetbrains.kotlinx:kotlinx-coroutines-test:$coroutines_version" androidTestImplementation "io.insert-koin:koin-test-junit4:$koin_version" androidTestImplementation "junit:junit:$testing_junit4_version" androidTestImplementation "androidx.test:core:$testing_androidx_code_version" androidTestImplementation "androidx.test:runner:$testing_androidx_code_version" androidTestImplementation "androidx.test.ext:junit:$testing_androidx_junit_version" androidTestImplementation "androidx.test.espresso:espresso-core:$testing_espresso_version" androidTestImplementation "androidx.test.espresso:espresso-intents:$testing_espresso_version" androidTestImplementation "androidx.test.espresso:espresso-contrib:$testing_espresso_version" androidTestImplementation project(':mockserver') androidTestImplementation "androidx.arch.core:core-testing:$testing_androidx_arch_core_version" androidTestRuntimeOnly "org.junit.vintage:junit-vintage-engine:$testing_junit5_version" androidTestImplementation "com.google.dagger:hilt-android-testing:$hilt_version" kaptAndroidTest "com.google.dagger:hilt-compiler:$hilt_version" androidTestImplementation project(":network") // hilt needs it implementation "io.reactivex.rxjava3:rxjava:3.1.2" }