mardi 26 avril 2016

Dagger 2 prefixed component class not generated in androidTest

I am creating 2 dagger app components, one for testing and one for prod. I am following the Android boilerplate example

The modules classes are being generated as expected for both (I can see them in the generated classes), but the component class is only being generated in prod, not in the instrumentation tests source folder.

The Component in androidTest:

@Singleton
@Component(modules = {AppModuleTest.class, SoajsServiceModuleTest.class)
public interface AppComponentTest extends AppComponent{

}

The production component:

@Singleton
@Component(modules = {AppModule.class, SoajsServiceModule.class, PreferencesModule.class, DeeplinkModule.class})
public interface AppComponent {
    // injects...
}

The relevant dependencies.

    testCompile 'junit:junit:4.12'
    testCompile "org.hamcrest:hamcrest-core:$HAMCREST_VERSION"
    testCompile "org.hamcrest:hamcrest-library:$HAMCREST_VERSION"
    testCompile "org.hamcrest:hamcrest-integration:$HAMCREST_VERSION"
    testCompile "org.mockito:mockito-core:$MOCKITO_VERSION"    

    compile "com.google.dagger:dagger:$DAGGER_VERSION"
    apt "com.google.dagger:dagger-compiler:$DAGGER_VERSION"
    provided 'javax.annotation:jsr250-api:1.0'

    testCompile "org.powermock:powermock-api-mockito:$POWERMOCK_VERSION"
    androidTestCompile "org.powermock:powermock-api-mockito:$POWERMOCK_VERSION"
    testCompile 'org.powermock:powermock-module-junit4:1.6.2'
    androidTestCompile "junit:junit:$JUNIT_VERSION"
    androidTestCompile "com.android.support:support-annotations:$SUPPORT_LIBRARY_VERSION"
    androidTestCompile("com.android.support.test.espresso:espresso-contrib:$ESPRESSO_VERSION") {
        exclude group: 'com.android.support', module: 'appcompat'
        exclude group: 'com.android.support', module: 'support-v4'
        exclude group: 'com.android.support', module: 'recyclerview-v7'
    }
    androidTestCompile "com.android.support.test.espresso:espresso-core:$ESPRESSO_VERSION"
    androidTestCompile "com.android.support.test.espresso:espresso-intents:$ESPRESSO_VERSION"
    androidTestCompile "com.android.support.test:runner:$RUNNER_VERSION"
    androidTestCompile "com.android.support.test:rules:$RUNNER_VERSION"
    androidTestCompile "org.mockito:mockito-core:$MOCKITO_VERSION"
    androidTestCompile "com.crittercism.dexmaker:dexmaker:$DEXMAKER_VERSION"
    androidTestCompile "com.crittercism.dexmaker:dexmaker-dx:$DEXMAKER_VERSION"
    androidTestCompile "com.crittercism.dexmaker:dexmaker-mockito:$DEXMAKER_VERSION"

    androidTestApt "com.google.dagger:dagger-compiler:$DAGGER_VERSION"

    testCompile "junit:junit:$JUNIT_VERSION"
    testCompile "org.hamcrest:hamcrest-core:$HAMCREST_VERSION"
    testCompile "org.hamcrest:hamcrest-library:$HAMCREST_VERSION"
    testCompile "org.hamcrest:hamcrest-integration:$HAMCREST_VERSION"
    testCompile "org.mockito:mockito-core:$MOCKITO_VERSION"
    testCompile 'org.robolectric:robolectric:3.0'

    testApt "com.google.dagger:dagger-compiler:$DAGGER_VERSION"

Where do I go from there?

Aucun commentaire:

Enregistrer un commentaire