Last active
January 27, 2020 08:22
-
-
Save realdadfish/6db1a4fade396966e12172f94b174397 to your computer and use it in GitHub Desktop.
JVM Integration Tests with the Android Gradle Plugin. ATTENTION: Does not work!
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
android.applicationVariants.all { variant -> | |
configurations.create("${variant.name}IntegrationTestImplementation") { | |
extendsFrom configurations.find { it.name == "implementation" } | |
extendsFrom configurations.find { it.name == "${variant.name}Implementation" } | |
} | |
def sourceSet = android.sourceSets.create("${variant.name}IntegrationTest") { | |
// this fails here because `compileClasspath` is not existant in `AndroidSourceSet` | |
compileClasspath += variant.javaCompile.classpath | |
runtimeClasspath += variant.javaCompile.classpath | |
} | |
task "test${variant.name.capitalize()}IntegrationTest"(type: Test) { | |
description = "Runs integration tests for variant ${variant.name}" | |
group = 'verification' | |
testClassesDirs = sourceSet.output.classesDirs | |
classpath = sourceSet.runtimeClasspath | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment