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
@@ -7,10 +7,6 @@ repositories {
jcenter()
}
configurations {
androidSdk
}
dependencies {
testCompile project(':kotlin-gradle-plugin')
testCompile project(':kotlin-gradle-plugin').sourceSets.test.output
@@ -29,8 +25,6 @@ dependencies {
testCompile gradleApi()
testRuntime project(path: ':kotlin-android-extensions', configuration: 'runtimeJar')
androidSdk project(path: ":custom-dependencies:android-sdk", configuration: "androidSdk")
}
// Include Gradle task properties validation into the testing procedure:
@@ -87,9 +81,8 @@ tasks.withType(Test) {
if (mavenLocalRepo != null) {
systemProperty("maven.repo.local", mavenLocalRepo)
}
doFirst {
systemProperty("android.sdk", project.configurations["androidSdk"].singleFile.getCanonicalPath())
}
TasksKt.useAndroidSdk(it)
testLogging {
// set options for log level LIFECYCLE