|
| 1 | +plugins { |
| 2 | + id("com.android.application") |
| 3 | + kotlin("android") |
| 4 | + kotlin("kapt") |
| 5 | + kotlin("android.extensions") |
| 6 | + id("dagger.hilt.android.plugin") |
| 7 | +} |
| 8 | + |
| 9 | +apply { |
| 10 | + from(rootProject.file("tools/checkstyle.gradle")) |
| 11 | + from(rootProject.file("tools/pmd.gradle")) |
| 12 | +} |
| 13 | + |
| 14 | +android { |
| 15 | + compileSdkVersion(Deps.Versions.compile_sdk) |
| 16 | + |
| 17 | + buildFeatures { |
| 18 | + viewBinding = true |
| 19 | + dataBinding = true |
| 20 | + buildConfig = true |
| 21 | + } |
| 22 | + |
| 23 | + defaultConfig { |
| 24 | + applicationId = "com.android.tvflix" |
| 25 | + minSdkVersion(Deps.Versions.min_sdk) |
| 26 | + targetSdkVersion(Deps.Versions.target_sdk) |
| 27 | + versionCode = Deps.Versions.app_version_code |
| 28 | + versionName = Deps.Versions.app_version_name |
| 29 | + testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" |
| 30 | + javaCompileOptions { |
| 31 | + annotationProcessorOptions { |
| 32 | + // Refer https://developer.android.com/jetpack/androidx/releases/room#compiler-options |
| 33 | + arguments( |
| 34 | + mapOf( |
| 35 | + "room.schemaLocation" to "$projectDir/schemas", |
| 36 | + "room.incremental" to "true", |
| 37 | + "room.expandProjection" to "true" |
| 38 | + ) |
| 39 | + ) |
| 40 | + } |
| 41 | + } |
| 42 | + } |
| 43 | + flavorDimensions("default") |
| 44 | + productFlavors { |
| 45 | + create("prod") { |
| 46 | + applicationId = "com.android.tvflix" |
| 47 | + } |
| 48 | + create("dev") { |
| 49 | + applicationId = "com.android.tvflix.dev" |
| 50 | + } |
| 51 | + } |
| 52 | + buildTypes { |
| 53 | + getByName("debug") { |
| 54 | + applicationIdSuffix = ".debug" |
| 55 | + } |
| 56 | + getByName("release") { |
| 57 | + isMinifyEnabled = true |
| 58 | + isShrinkResources = true |
| 59 | + isDebuggable = false |
| 60 | + proguardFiles( |
| 61 | + getDefaultProguardFile("proguard-android-optimize.txt"), |
| 62 | + "proguard-rules.pro" |
| 63 | + ) |
| 64 | + } |
| 65 | + } |
| 66 | + compileOptions { |
| 67 | + sourceCompatibility = JavaVersion.VERSION_1_8 |
| 68 | + targetCompatibility = JavaVersion.VERSION_1_8 |
| 69 | + } |
| 70 | + |
| 71 | + testOptions { |
| 72 | + unitTests.isIncludeAndroidResources = true |
| 73 | + animationsDisabled = true |
| 74 | + } |
| 75 | + |
| 76 | + kapt { |
| 77 | + useBuildCache = true |
| 78 | + javacOptions { |
| 79 | + // Increase the max count of errors from annotation processors. |
| 80 | + // Default is 100. |
| 81 | + option("-Xmaxerrs", 500) |
| 82 | + } |
| 83 | + } |
| 84 | + testBuildType = "debug" |
| 85 | + |
| 86 | + packagingOptions { |
| 87 | + exclude("META-INF/ASL2.0") |
| 88 | + exclude("META-INF/DEPENDENCIES") |
| 89 | + exclude("META-INF/NOTICE") |
| 90 | + exclude("META-INF/LICENSE") |
| 91 | + exclude("META-INF/LICENSE.txt") |
| 92 | + exclude("META-INF/NOTICE.txt") |
| 93 | + exclude(".readme") |
| 94 | + } |
| 95 | + |
| 96 | + kotlinOptions { |
| 97 | + jvmTarget = "1.8" |
| 98 | + } |
| 99 | +} |
| 100 | + |
| 101 | +dependencies { |
| 102 | + implementation(fileTree(mapOf("dir" to "libs", "include" to listOf("*.jar")))) |
| 103 | + implementation(Deps.Google.material) |
| 104 | + // start-region AndroidX |
| 105 | + implementation(Deps.AndroidX.ktx_core) |
| 106 | + implementation(Deps.AndroidX.ktx_fragment) |
| 107 | + implementation(Deps.AndroidX.ktx_activity) |
| 108 | + implementation(Deps.AndroidX.constraint_layout) |
| 109 | + implementation(Deps.AndroidX.Lifecycle.extensions) |
| 110 | + kapt(Deps.AndroidX.Lifecycle.compiler) |
| 111 | + implementation(Deps.AndroidX.Lifecycle.viewmodel) |
| 112 | + implementation(Deps.AndroidX.Lifecycle.livedata) |
| 113 | + implementation(Deps.AndroidX.Paging.runtime) |
| 114 | + testImplementation(Deps.AndroidX.Paging.common) |
| 115 | + implementation(Deps.AndroidX.Room.runtime) |
| 116 | + kapt(Deps.AndroidX.Room.compiler) |
| 117 | + testImplementation(Deps.AndroidX.Room.testing) |
| 118 | + implementation(Deps.AndroidX.Room.ktx) |
| 119 | + implementation(Deps.AndroidX.Hilt.viewmodel) |
| 120 | + kapt(Deps.AndroidX.Hilt.compiler) |
| 121 | + implementation(Deps.AndroidX.multidex) |
| 122 | + implementation(Deps.AndroidX.annotation) |
| 123 | + // end-region AndroidX |
| 124 | + |
| 125 | + implementation(Deps.OkHttp.main) |
| 126 | + implementation(Deps.OkHttp.logging_interceptor) |
| 127 | + implementation(Deps.Glide.runtime) |
| 128 | + implementation(Deps.Glide.okhttp_integration) |
| 129 | + kapt(Deps.Glide.compiler) |
| 130 | + implementation(Deps.Retrofit.main) |
| 131 | + implementation(Deps.Retrofit.moshi) |
| 132 | + |
| 133 | + implementation(Deps.timber) |
| 134 | + |
| 135 | + // start-region Test |
| 136 | + testImplementation(Deps.junit) |
| 137 | + testImplementation(Deps.Mockito.core) |
| 138 | + androidTestImplementation(Deps.Mockito.android) |
| 139 | + testImplementation(Deps.Mockito.kotlin) |
| 140 | + testImplementation(Deps.Mockito.inline) |
| 141 | + testImplementation(Deps.robolectric) |
| 142 | + testImplementation(Deps.AndroidX.Test.arch_core_testing) |
| 143 | + testImplementation(Deps.AndroidX.Test.core) |
| 144 | + androidTestImplementation(Deps.AndroidX.Test.runner) |
| 145 | + androidTestImplementation(Deps.AndroidX.Test.junit) |
| 146 | + // Espresso |
| 147 | + androidTestImplementation(Deps.AndroidX.Test.Espresso.core) |
| 148 | + androidTestImplementation(Deps.AndroidX.Test.Espresso.contrib) |
| 149 | + androidTestImplementation(Deps.AndroidX.Test.Espresso.idling_resource) |
| 150 | + androidTestImplementation(Deps.AndroidX.Test.rules) |
| 151 | + testImplementation(Deps.truth) |
| 152 | + testImplementation(Deps.Coroutines.test) |
| 153 | + // end-region Test |
| 154 | + |
| 155 | + implementation(Deps.Moshi.kotlin) |
| 156 | + kapt(Deps.Moshi.codegen) |
| 157 | + |
| 158 | + implementation(Deps.Coroutines.core) |
| 159 | + implementation(Deps.Coroutines.android) |
| 160 | + |
| 161 | + debugImplementation(Deps.Chucker.debug) |
| 162 | + releaseImplementation(Deps.Chucker.release) |
| 163 | + |
| 164 | + implementation(Deps.Hilt.android) |
| 165 | + kapt(Deps.Hilt.android_compiler) |
| 166 | +} |
| 167 | + |
| 168 | + |
0 commit comments