android - How can I share a specific srcSet/configuration with a downstream module? -
i have :a (upstream module).
inside :a, there's src/fakes/java want share downstream modules. contains fake implementations of interfaces within :a useful testing purposes. want include within :a tests, , optionally expose downstream consumers.
:a's build.gradle
android { sourcesets { fakes { java { srcdir android.sourcesets.main.java srcdir 'src/fakes/java' } } test.java.srcdir 'src/fakes/java' } configurations { fakes fakes.extendsfrom(main) fakes.transitive false } } }
:b's build.gradle
dependencies { compile project(path: ':a') testcompile project(path: ':a', configuration: 'fakes') } however, when compiling test classes within :b reference classes within :a's src/fake/java, unresolved reference error. because :a not build .apk fakes configuration.
how can achieve this? i'd prefer not utilize android's product flavors if possible.
Comments
Post a Comment