1
1
plugins {
2
- id (" com.android.application" )
2
+ id(" com.android.application" )
3
3
id(" jacoco" )
4
4
id(" kotlin-android" )
5
5
id(" kotlin-kapt" )
6
6
id(" kotlin-allopen" )
7
7
id(" androidx.navigation.safeargs.kotlin" )
8
8
id(" com.google.dagger.hilt.android" )
9
-
10
9
}
11
10
12
11
allOpen {
@@ -15,21 +14,24 @@ allOpen {
15
14
}
16
15
17
16
android {
18
- compileSdkVersion 33
17
+ namespace " com.kanchanpal.newsfeed"
18
+ compileSdk 34
19
19
20
20
buildFeatures {
21
21
22
- dataBinding true
23
22
viewBinding = true
23
+ buildConfig = true
24
+ }
24
25
25
- // for view binding:
26
- // viewBinding true
26
+ compileOptions {
27
+ sourceCompatibility JavaVersion . VERSION_17
28
+ targetCompatibility JavaVersion . VERSION_17
27
29
}
28
30
29
31
defaultConfig {
30
32
applicationId " com.kanchanpal.newsfeed"
31
33
minSdkVersion 21
32
- targetSdkVersion 33
34
+ targetSdkVersion 34
33
35
versionCode 1
34
36
versionName " 1.0"
35
37
testInstrumentationRunner " com.kanchanpal.newsfeed.util.AppTestRunner"
@@ -57,6 +59,10 @@ android {
57
59
}
58
60
}
59
61
62
+ kotlin {
63
+ jvmToolchain (17 )
64
+ }
65
+
60
66
jacoco {
61
67
toolVersion = " $rootProject . jacocoVersion "
62
68
}
@@ -68,8 +74,8 @@ dependencies {
68
74
implementation ' androidx.constraintlayout:constraintlayout:1.1.3'
69
75
testImplementation ' junit:junit:4.12'
70
76
71
- implementation(" com.google.dagger:hilt-android:2.44 " )
72
- kapt(" com.google.dagger:hilt-android-compiler:2.44 " )
77
+ implementation(" com.google.dagger:hilt-android:2.47 " )
78
+ kapt(" com.google.dagger:hilt-android-compiler:2.47 " )
73
79
74
80
kapt " androidx.room:room-compiler:$rootProject . roomVersion "
75
81
kapt " com.github.bumptech.glide:compiler:$rootProject . glideVersion "
@@ -132,8 +138,8 @@ dependencies {
132
138
androidTestImplementation " org.mockito:mockito-core:$rootProject . mockitoVersion "
133
139
androidTestImplementation " org.mockito:mockito-android:$rootProject . mockitoAndroidVersion "
134
140
135
- androidTestImplementation (' androidx.test.espresso:espresso-core:' + rootProject. espressoVersion) {
136
- exclude group :' com.androidx.support'
141
+ androidTestImplementation(' androidx.test.espresso:espresso-core:' + rootProject. espressoVersion) {
142
+ exclude group : ' com.androidx.support'
137
143
138
144
}
139
145
}
@@ -145,8 +151,8 @@ task fullCoverageReport(type: JacocoReport) {
145
151
dependsOn ' createDebugCoverageReport'
146
152
dependsOn ' testDebugUnitTest'
147
153
reports {
148
- xml. enabled = true
149
- html. enabled = true
154
+ xml. getRequired() . set( true )
155
+ html. getRequired() . set( true )
150
156
}
151
157
152
158
def fileFilter = [' **/R.class' , ' **/R$*.class' , ' **/BuildConfig.*' , ' **/Manifest*.*' ,
@@ -157,19 +163,19 @@ task fullCoverageReport(type: JacocoReport) {
157
163
' **/*_*Factory.class' ,
158
164
' **/*ComponentImpl.class' ,
159
165
' **/*SubComponentBuilder.class' ]
160
- def debugTree = fileTree(dir : " ${ buildDir} /intermediates/classes/debug" , excludes : fileFilter)
166
+ def debugTree = fileTree(dir : " ${ layout. buildDir} /intermediates/classes/debug" , excludes : fileFilter)
161
167
def mainSrc = " ${ project.projectDir} /src/main/java"
162
168
163
169
sourceDirectories. from = files([mainSrc])
164
170
classDirectories. from = files([debugTree])
165
- executionData. from = fileTree(dir : " $b uildDir " , includes : [
171
+ executionData. from = fileTree(dir : " ${ layout.buildDirectory } " , includes : [
166
172
" jacoco/testDebugUnitTest.exec" ,
167
173
" outputs/code-coverage/connected/*coverage.ec"
168
174
])
169
175
}
170
176
171
177
// we need all open to run tests which a we enable only for debug builds.
172
- project. tasks. whenTaskAdded {
178
+ project. tasks. configureEach {
173
179
if (it. name == " testReleaseUnitTest" ) {
174
180
it. enabled = false
175
181
}
0 commit comments