forked from square/dagger
-
Notifications
You must be signed in to change notification settings - Fork 2k
/
build.gradle
67 lines (60 loc) · 2.04 KB
/
build.gradle
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
plugins {
id 'com.android.library'
id 'dagger.hilt.android.plugin'
}
android {
compileSdkVersion 30
buildToolsVersion "30.0.2"
defaultConfig {
minSdkVersion 15
targetSdkVersion 30
versionCode 1
versionName "1.0"
}
compileOptions {
sourceCompatibility 1.8
targetCompatibility 1.8
}
testOptions {
unitTests.includeAndroidResources = true
}
}
hilt {
enableTransformForLocalTests = true
enableAggregatingTask = true
}
// This is a regression test for https://github.com/google/dagger/issues/2789.
// Reproducing this issue requires that we don't have unexpected tests, so this
// check validates that. In particular, if we accidentally add a test with no
// test-specific bindings the EarlyEntryPoints will use the component for that
// test instead of generating a component just for the EarlyEntryPoints, which
// causes this issue.
task checkSourceSetTask(){
sourceSets {
test {
def expectedSrcs = [
'EarlyEntryPointWithBindValueTest.java',
'EarlyEntryPointWithBindValueObjects.java'
]
if (!allSource.files.name.equals(expectedSrcs)) {
throw new StopExecutionException(
'Unexpected test sources: ' + allSource.files.name)
}
}
}
}
gradle.projectsEvaluated {
preBuild.dependsOn checkSourceSetTask
}
dependencies {
implementation "com.google.dagger:hilt-android:$dagger_version"
annotationProcessor "com.google.dagger:hilt-compiler:$dagger_version"
testImplementation 'com.google.truth:truth:1.0.1'
testImplementation 'junit:junit:4.13'
testImplementation 'org.robolectric:robolectric:4.5-alpha-3'
testImplementation 'androidx.core:core:1.3.2'
testImplementation 'androidx.test.ext:junit:1.1.2'
testImplementation 'androidx.test:runner:1.3.0'
testImplementation "com.google.dagger:hilt-android-testing:$dagger_version"
testAnnotationProcessor "com.google.dagger:hilt-compiler:$dagger_version"
}