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:
@@ -5,9 +5,6 @@ apply { plugin("kotlin") }
|
||||
|
||||
jvmTarget = "1.6"
|
||||
|
||||
val androidSdk by configurations.creating
|
||||
val androidJar by configurations.creating
|
||||
|
||||
dependencies {
|
||||
testRuntime(intellijDep())
|
||||
|
||||
@@ -53,9 +50,6 @@ dependencies {
|
||||
testRuntime(intellijPluginDep("java-decompiler"))
|
||||
testRuntime(intellijPluginDep("maven"))
|
||||
testRuntime(intellijPluginDep("android"))
|
||||
|
||||
androidSdk(project(":custom-dependencies:android-sdk", configuration = "androidSdk"))
|
||||
androidJar(project(":custom-dependencies:android-sdk", configuration = "androidJar"))
|
||||
}
|
||||
|
||||
sourceSets {
|
||||
@@ -67,11 +61,10 @@ testsJar {}
|
||||
|
||||
projectTest {
|
||||
dependsOn(":kotlin-android-extensions-runtime:dist")
|
||||
dependsOn(androidSdk)
|
||||
workingDir = rootDir
|
||||
useAndroidSdk()
|
||||
useAndroidJar()
|
||||
doFirst {
|
||||
systemProperty("android.sdk", androidSdk.singleFile.canonicalPath)
|
||||
systemProperty("android.jar", androidJar.singleFile.canonicalPath)
|
||||
systemProperty("idea.home.path", intellijRootDir().canonicalPath)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user