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:
Alexey Tsvetkov
2018-02-01 02:17:56 +03:00
parent 3ead464671
commit 7cba035f80
7 changed files with 34 additions and 38 deletions
@@ -1,8 +1,6 @@
apply { plugin("kotlin") }
val androidSdk by configurations.creating
dependencies {
testRuntime(intellijDep())
@@ -25,8 +23,6 @@ dependencies {
testRuntime(intellijPluginDep("android"))
testRuntime(intellijDep("jps-build-test"))
testRuntime(intellijDep("jps-standalone"))
androidSdk(project(":custom-dependencies:android-sdk", configuration = "androidSdk"))
}
sourceSets {
@@ -36,8 +32,8 @@ sourceSets {
projectTest {
workingDir = rootDir
useAndroidSdk()
doFirst {
systemProperty("android.sdk", androidSdk.singleFile.canonicalPath)
systemProperty("idea.home.path", intellijRootDir().canonicalPath)
}
}