android - How to add build.gradle dependency for both local and instrumented tests in a single line? -
to add library dependecy both local , instrumented unit tests need add 2 lines of code build.gradle
:
testcompile "org.mockito:mockito-core:${mockitoversion}" androidtestcompile "org.mockito:mockito-core:${mockitoversion}"
is possible in single line?
i'm looking like:
bothtestcompile "org.mockito:mockito-core:${mockitoversion}"
you can let configurations extend other configurations. code below creates new configuration, testcompile
, androidtestcompile
extend from. way, each dependency of new configuration dependency of these configurations.
configurations { // create new configuration bothtestcompile // let both configurations extend 'bothtestcompile' testcompile.extendsfrom(bothtestcompile) androidtestcompile.extendsfrom(bothtestcompile) }
now can use new configuration in dependencies
closure did in example.
Comments
Post a Comment