Ensure tasks using android sdk or android jar have proper dependencies
A test task, that uses android dependency but does not depend on a corresponding configuration, would fail when it was run after 'clean' task. I've extracted 'useAndroidSdk', 'useAndroidJar' extensions making it harder for a developer to forget to set up task dependencies.
This commit is contained in:
@@ -3,8 +3,6 @@ import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
|
||||
|
||||
apply { plugin("kotlin") }
|
||||
|
||||
val androidSdk by configurations.creating
|
||||
|
||||
dependencies {
|
||||
testRuntime(intellijDep())
|
||||
|
||||
@@ -59,8 +57,6 @@ dependencies {
|
||||
testRuntime(intellijPluginDep("junit"))
|
||||
testRuntime(intellijPluginDep("maven"))
|
||||
testRuntime(intellijPluginDep("testng"))
|
||||
|
||||
androidSdk(project(":custom-dependencies:android-sdk", configuration = "androidSdk"))
|
||||
}
|
||||
|
||||
sourceSets {
|
||||
@@ -69,10 +65,9 @@ sourceSets {
|
||||
}
|
||||
|
||||
projectTest {
|
||||
dependsOn(androidSdk)
|
||||
workingDir = rootDir
|
||||
useAndroidSdk()
|
||||
doFirst {
|
||||
systemProperty("android.sdk", androidSdk.singleFile.canonicalPath)
|
||||
systemProperty("idea.home.path", intellijRootDir().canonicalPath)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user