|
5 | 5 |
|
6 | 6 | import org.gradle.api.Project
|
7 | 7 | import org.gradle.api.artifacts.Configuration
|
| 8 | +import org.gradle.api.artifacts.ProjectDependency |
| 9 | +import org.gradle.api.artifacts.dsl.DependencyHandler |
8 | 10 | import org.gradle.kotlin.dsl.dependencies
|
9 | 11 | import org.gradle.kotlin.dsl.project
|
10 | 12 |
|
@@ -40,45 +42,50 @@ abstract class CompilerTestsExtension(private val project: Project) {
|
40 | 42 | isTransitive = false
|
41 | 43 | }
|
42 | 44 |
|
| 45 | + private val noOp = project.kotlinBuildProperties.isInJpsBuildIdeaSync |
| 46 | + private fun add(configuration: Configuration, dependency: DependencyHandler.() -> ProjectDependency) { |
| 47 | + if (!noOp) { |
| 48 | + project.dependencies { configuration(dependency(this)) } |
| 49 | + } |
| 50 | + } |
| 51 | + |
43 | 52 | init {
|
44 | 53 | project.dependencies {
|
45 |
| - stdlibRuntimeForTests(project(":kotlin-stdlib")) |
46 |
| - stdlibMinimalRuntimeForTests(project(":kotlin-stdlib-jvm-minimal-for-test")) |
47 |
| - kotlinReflectJarForTests(project(":kotlin-reflect")) |
| 54 | + add(stdlibRuntimeForTests) { project(":kotlin-stdlib") } |
| 55 | + add(stdlibMinimalRuntimeForTests) { project(":kotlin-stdlib-jvm-minimal-for-test") } |
| 56 | + add(kotlinReflectJarForTests) { project(":kotlin-reflect") } |
48 | 57 | }
|
49 | 58 | }
|
50 | 59 |
|
51 | 60 | fun withStdlibCommon() {
|
52 |
| - project.dependencies { stdlibCommonRuntimeForTests(project(":kotlin-stdlib-common")) } |
| 61 | + add(stdlibCommonRuntimeForTests) { project(":kotlin-stdlib-common") } |
53 | 62 | }
|
54 | 63 |
|
55 | 64 | fun withScriptRuntime() {
|
56 |
| - project.dependencies { scriptRuntimeForTests(project(":kotlin-script-runtime")) } |
| 65 | + add(scriptRuntimeForTests) { project(":kotlin-script-runtime") } |
57 | 66 | }
|
58 | 67 |
|
59 | 68 | fun withTestJar() {
|
60 |
| - project.dependencies { kotlinTestJarForTests(project(":kotlin-test")) } |
| 69 | + add(kotlinTestJarForTests) { project(":kotlin-test") } |
61 | 70 | }
|
62 | 71 |
|
63 | 72 | fun withAnnotations() {
|
64 |
| - project.dependencies { kotlinAnnotationsForTests(project(":kotlin-annotations-jvm")) } |
| 73 | + add(kotlinAnnotationsForTests) { project(":kotlin-annotations-jvm") } |
65 | 74 | }
|
66 | 75 |
|
67 | 76 | fun withStdlibJsRuntime() {
|
68 |
| - project.dependencies { stdlibJsRuntimeForTests(project(":kotlin-stdlib", "distJsKlib")) } |
| 77 | + add(stdlibJsRuntimeForTests) { project(":kotlin-stdlib", "distJsKlib") } |
69 | 78 | }
|
70 | 79 |
|
71 | 80 | fun withTestJsRuntime() {
|
72 |
| - project.dependencies { testJsRuntimeForTests(project(":kotlin-test", "jsRuntimeElements")) } |
| 81 | + add(testJsRuntimeForTests) { project(":kotlin-test", "jsRuntimeElements") } |
73 | 82 | }
|
74 | 83 |
|
75 | 84 | fun withScriptingPlugin() {
|
76 |
| - project.dependencies { |
77 |
| - scriptingPluginForTests(project(":kotlin-scripting-compiler")) |
78 |
| - scriptingPluginForTests(project(":kotlin-scripting-compiler-impl")) |
79 |
| - scriptingPluginForTests(project(":kotlin-scripting-common")) |
80 |
| - scriptingPluginForTests(project(":kotlin-scripting-jvm")) |
81 |
| - } |
| 85 | + add(scriptingPluginForTests) { project(":kotlin-scripting-compiler") } |
| 86 | + add(scriptingPluginForTests) { project(":kotlin-scripting-compiler-impl") } |
| 87 | + add(scriptingPluginForTests) { project(":kotlin-scripting-common") } |
| 88 | + add(scriptingPluginForTests) { project(":kotlin-scripting-jvm") } |
82 | 89 | /*
|
83 | 90 | KOTLIN_SCRIPTING_COMPILER_PLUGIN_JAR
|
84 | 91 | KOTLIN_SCRIPTING_COMPILER_IMPL_JAR
|
|
0 commit comments