Usecase
I'm building a library and it depends on rxjava.
Since rxjava is large, I decided to minify it using proguard and make another module called :custom_rx.
Problem
Since .test() method of RxJava does not need to be at the release, I removed tests for the minified module. However, tests will not pass.
Question
Since test task and release tasks are different, I can tell gradle to use non-modified RxJava for test tasks.
How can I replace a library to another, only when gradle is running tests?
Code I've tried
I used this code to substitute the library on test. But tests still fail:
subprojects {
project.configurations.all { config ->
if (config.name.contains("test") || config.name.contains("Test")) {
resolutionStrategy.dependencySubstitution {
substitute project(":custom_rx") because "we use a non-minified rxjava for tests" with module("io.reactivex.rxjava2:rxjava:$versions.rxJava")
}
}
}
}