68 lines
2.1 KiB
Groovy
68 lines
2.1 KiB
Groovy
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 actualSrcs = allSource.files.name as Set
|
|
def expectedSrcs = [
|
|
'EarlyEntryPointWithBindValueTest.java',
|
|
'EarlyEntryPointWithBindValueObjects.java'
|
|
] as Set
|
|
if (!actualSrcs.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"
|
|
} |