From 61b78d7edad8161acb7fd1e46586ce0086a61eb5 Mon Sep 17 00:00:00 2001 From: Ilya Gorbunov Date: Tue, 31 Oct 2017 23:04:16 +0300 Subject: [PATCH] Make projectTests type of dependency transitive on testRuntime dependencies `tests-jar` configuration now extends testRuntime instead of testCompile (note that testRuntime extends testCompile), and projectTests() dependency shortcut makes it transitive. This is required to depend on test utility modules producing `-tests` jar instead of default one without listing all their transitive dependencies. --- buildSrc/src/main/kotlin/artifacts.kt | 2 +- buildSrc/src/main/kotlin/dependencies.kt | 2 +- compiler/tests-common-jvm6/build.gradle.kts | 2 +- compiler/tests-java8/build.gradle.kts | 1 - 4 files changed, 3 insertions(+), 4 deletions(-) diff --git a/buildSrc/src/main/kotlin/artifacts.kt b/buildSrc/src/main/kotlin/artifacts.kt index 97f69be42e0..defda542c8a 100644 --- a/buildSrc/src/main/kotlin/artifacts.kt +++ b/buildSrc/src/main/kotlin/artifacts.kt @@ -37,7 +37,7 @@ fun Project.classesDirsArtifact(): FileCollection { } fun Project.testsJar(body: Jar.() -> Unit = {}): Jar { - val testsJarCfg = configurations.getOrCreate("tests-jar").extendsFrom(configurations["testCompile"]) + val testsJarCfg = configurations.getOrCreate("tests-jar").extendsFrom(configurations["testRuntime"]) return task("testsJar") { dependsOn("testClasses") diff --git a/buildSrc/src/main/kotlin/dependencies.kt b/buildSrc/src/main/kotlin/dependencies.kt index 8aa8b1917fd..15ac950da18 100644 --- a/buildSrc/src/main/kotlin/dependencies.kt +++ b/buildSrc/src/main/kotlin/dependencies.kt @@ -66,7 +66,7 @@ fun Project.ideaUltimatePluginDeps(vararg artifactBaseNames: String, plugin: Str fun Project.kotlinDep(artifactBaseName: String, version: String): String = "org.jetbrains.kotlin:kotlin-$artifactBaseName:$version" fun DependencyHandler.projectDist(name: String): Dependency = project(name, configuration = "distJar").apply { isTransitive = false } -fun DependencyHandler.projectTests(name: String): Dependency = project(name, configuration = "tests-jar").apply { isTransitive = false } +fun DependencyHandler.projectTests(name: String): Dependency = project(name, configuration = "tests-jar") fun DependencyHandler.projectRuntimeJar(name: String): Dependency = project(name, configuration = "runtimeJar") fun DependencyHandler.projectArchives(name: String): Dependency = project(name, configuration = "archives") fun DependencyHandler.projectClasses(name: String): Dependency = project(name, configuration = "classes-dirs") diff --git a/compiler/tests-common-jvm6/build.gradle.kts b/compiler/tests-common-jvm6/build.gradle.kts index 8656ebaaa85..c1e74486d51 100644 --- a/compiler/tests-common-jvm6/build.gradle.kts +++ b/compiler/tests-common-jvm6/build.gradle.kts @@ -5,7 +5,7 @@ jvmTarget = "1.6" dependencies { compile(project(":kotlin-stdlib")) - compile(project(":kotlin-test:kotlin-test-jvm")) + testCompile(project(":kotlin-test:kotlin-test-jvm")) } sourceSets { diff --git a/compiler/tests-java8/build.gradle.kts b/compiler/tests-java8/build.gradle.kts index 3ffa98e4edf..f9751c0d0c3 100644 --- a/compiler/tests-java8/build.gradle.kts +++ b/compiler/tests-java8/build.gradle.kts @@ -20,7 +20,6 @@ dependencies { testCompile(projectDist(":kotlin-reflect")) testCompile(projectTests(":compiler")) testCompile(projectTests(":compiler:tests-common")) - testCompile(projectTests(":compiler:tests-common-jvm6")) testRuntime(projectRuntimeJar(":kotlin-preloader")) testRuntime(preloadedDeps("dx", subdir = "android-5.0/lib")) testRuntime(ideaSdkCoreDeps("*.jar"))