From 39f49f144995d2721565f6b616a9728d49d893aa Mon Sep 17 00:00:00 2001 From: Alexey Tsvetkov Date: Thu, 28 Sep 2017 19:50:50 +0300 Subject: [PATCH] Ensure dependencies are installed before running Gradle integration tests --- .../build.gradle | 31 +++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/libraries/tools/kotlin-gradle-plugin-integration-tests/build.gradle b/libraries/tools/kotlin-gradle-plugin-integration-tests/build.gradle index 245d391566e..e13e1efbcac 100644 --- a/libraries/tools/kotlin-gradle-plugin-integration-tests/build.gradle +++ b/libraries/tools/kotlin-gradle-plugin-integration-tests/build.gradle @@ -26,6 +26,37 @@ dependencies { testCompile 'org.jetbrains.kotlin:gradle-api:2.2' } +test.dependsOn(":kotlin-allopen:install", + ":kotlin-android-extensions:install", + ":kotlin-build-common:install", + ":kotlin-compiler-embeddable:install", + ":kotlin-gradle-plugin:install", + ":kotlin-reflect:install", + ":kotlin-test:kotlin-test-jvm:install", + ":kotlin-gradle-subplugin-example:install", + ":kotlin-stdlib-jre8:install") + +// Validate that all dependencies 'install' tasks are added to 'test' dependencies +// Test dependencies are specified as paths to avoid forcing dependency resolution +// and also to avoid specifying evaluationDependsOn for each testCompile dependency. +gradle.taskGraph.whenReady { + def notAddedTestTasks = [] + def testDependencies = test.dependsOn + + for (dependency in configurations.getByName("testCompile").allDependencies) { + if (!(dependency instanceof ProjectDependency)) continue + + def task = dependency.dependencyProject.tasks.findByName("install") + if (task != null && !testDependencies.contains(task.path)) { + notAddedTestTasks.add("\"${task.path}\"") + } + } + + if (!notAddedTestTasks.isEmpty()) { + throw new GradleException("Add the following tasks to ${test.path} dependencies:\n ${notAddedTestTasks.join(",\n ")}") + } +} + processResources { expand(project.properties) }