gradle-plugins
gradle-plugins copied to clipboard
Feature Request: Android Support
When trying to use the plugin with Android Studio, one gets the following error:
Could not get unknown property 'testClasses' for project ':network' of type org.gradle.api.Project.
.
Following your blog post instructions I was able to come up with the following:
Add this to the library build.gradle:
// Note how I needed to hardcode debug here, I don't like this
task jarTest (type: Jar, dependsOn: 'compileDebugUnitTestSources') {
from 'build/tmp/kotlin-classes/debugUnitTest'
}
configurations {
testOutput
}
artifacts {
testOutput jarTest
}
And this to the app build.gradle:
testImplementation project(path: ':network', configuration: 'testOutput')
But I don't like this solution since it is not debug/release agnostic and I'd have to repeat that code in all of my library modules.
Any chance me might see Android supported by jarTest?
I don't know. Never used Android Studio.
Where is 'compileDebugUnitTestSources'
coming from? Is it used by all Android Studio projects or is it specific to your project?
Maybe android could be automatically detected by looking at the other plugins applied to the project? Is there some plugin one could watch for (not 100% sure this is possible)?
If it is easy to detect I could add it.
Currently the plugin assumes that the 'java'
plugin is available and therefore simply uses the 'testClasses'
dependency for compilation and the 'test'
source set to find the compiled (test) classes.
Another possibility would be to add some configuration but I don't like that idea very much. I fear the configuration would take more code than the plugin itself. ;-)
+1