Skip to content

Commit 183c7c5

Browse files
Merge pull request #12 from ashwini009/deps-management-dsl
Migration from Groovy to Kotlin DSL
2 parents faff570 + b28f53d commit 183c7c5

File tree

12 files changed

+405
-376
lines changed

12 files changed

+405
-376
lines changed

app/build.gradle

Lines changed: 0 additions & 72 deletions
This file was deleted.

app/build.gradle.kts

Lines changed: 168 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,168 @@
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+

app/dependencies.gradle

Lines changed: 0 additions & 85 deletions
This file was deleted.

app/proguard-rules.pro

Lines changed: 19 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -20,21 +20,6 @@
2020
}
2121
-dontwarn org.apache.**
2222

23-
# Design support library
24-
-keep class android.support.design.widget.** { *; }
25-
-keep interface android.support.design.widget.** { *; }
26-
-dontwarn android.support.design.**
27-
28-
-keep class android.support.v4.** { *; }
29-
-keep interface android.support.v4.app.** { *; }
30-
31-
# FOR APPCOMPAT 23.1.1 and higher to avoid crashes on specific devices
32-
# Need to check if it will be necessary starting with 24.0.0
33-
# https://code.google.com/p/android/issues/detail?id=78377#c336
34-
-keep class !android.support.v7.view.menu.*MenuBuilder*, android.support.v7.** { *; }
35-
-keep interface android.support.v7.** { *; }
36-
37-
3823
# Needed by commons logging
3924
-keep class org.apache.commons.logging.* { *; }
4025

@@ -112,4 +97,22 @@
11297
public static *** v(...);
11398
public static *** d(...);
11499
public static *** i(...);
115-
}
100+
}
101+
102+
# OkHttp platform used only on JVM and when Conscrypt dependency is available.
103+
-dontwarn okhttp3.internal.platform.ConscryptPlatform
104+
105+
# Animal Sniffer compileOnly dependency to ensure APIs are compatible with older versions of Java.
106+
-dontwarn org.codehaus.mojo.animal_sniffer.*
107+
108+
-keep public class * implements com.bumptech.glide.module.GlideModule
109+
-keep class * extends com.bumptech.glide.module.AppGlideModule {
110+
<init>(...);
111+
}
112+
-keep public enum com.bumptech.glide.load.ImageHeaderParser$** {
113+
**[] $VALUES;
114+
public *;
115+
}
116+
-keep class com.bumptech.glide.load.data.ParcelFileDescriptorRewinder$InternalRewinder {
117+
*** rewind();
118+
}

0 commit comments

Comments
 (0)