diff --git a/prepare/compiler-client-embeddable/build.gradle.kts b/prepare/compiler-client-embeddable/build.gradle.kts index f3fbd1f37c7..f0ec0b7c825 100644 --- a/prepare/compiler-client-embeddable/build.gradle.kts +++ b/prepare/compiler-client-embeddable/build.gradle.kts @@ -5,9 +5,8 @@ plugins { kotlin("jvm") } -val testRuntimeCompilerJar by configurations.creating -val testStdlibJar by configurations.creating -val testScriptRuntimeJar by configurations.creating +val testCompilerClasspath by configurations.creating +val testCompilationClasspath by configurations.creating dependencies { embedded(project(":compiler:cli-common")) { isTransitive = false } @@ -22,27 +21,23 @@ dependencies { testCompile(commonDep("junit:junit")) testCompile(project(":kotlin-test:kotlin-test-jvm")) testCompile(project(":kotlin-test:kotlin-test-junit")) - testRuntimeCompilerJar(project(":kotlin-compiler")) - testStdlibJar(kotlinStdlib()) - testScriptRuntimeJar(project(":kotlin-script-runtime")) + testCompilerClasspath(project(":kotlin-compiler")) + testCompilerClasspath(project(":kotlin-scripting-compiler")) + testCompilerClasspath(project(":kotlin-daemon")) + testCompilationClasspath(kotlinStdlib()) + testCompilationClasspath(project(":kotlin-script-runtime")) } sourceSets { "main" {} - "test" { - // TODO: move closer - java.srcDir("../../libraries/tools/kotlin-compiler-client-embeddable-test/src") - } + "test" { projectDefault() } } projectTest { - dependsOn(":dist") - workingDir = File(rootDir, "libraries/tools/kotlin-compiler-client-embeddable-test/src") doFirst { systemProperty("kotlin.test.script.classpath", testSourceSet.output.classesDirs.joinToString(File.pathSeparator)) - systemProperty("compilerJar", testRuntimeCompilerJar.singleFile.canonicalPath) - systemProperty("stdlibJar", testStdlibJar.singleFile.canonicalPath) - systemProperty("scriptRuntimeJar", testScriptRuntimeJar.singleFile.canonicalPath) + systemProperty("compilerClasspath", testCompilerClasspath.asPath) + systemProperty("compilationClasspath", testCompilationClasspath.asPath) } } diff --git a/libraries/tools/kotlin-compiler-client-embeddable-test/src/test/resources/scripts/simpleHelloWorld.kts b/prepare/compiler-client-embeddable/testData/scripts/simpleHelloWorld.kts similarity index 100% rename from libraries/tools/kotlin-compiler-client-embeddable-test/src/test/resources/scripts/simpleHelloWorld.kts rename to prepare/compiler-client-embeddable/testData/scripts/simpleHelloWorld.kts diff --git a/libraries/tools/kotlin-compiler-client-embeddable-test/src/test/kotlin/org/jetbrains/kotlin/compiler/client/CompilerClientIT.kt b/prepare/compiler-client-embeddable/tests/kotlin/org/jetbrains/kotlin/compiler/client/CompilerClientIT.kt similarity index 88% rename from libraries/tools/kotlin-compiler-client-embeddable-test/src/test/kotlin/org/jetbrains/kotlin/compiler/client/CompilerClientIT.kt rename to prepare/compiler-client-embeddable/tests/kotlin/org/jetbrains/kotlin/compiler/client/CompilerClientIT.kt index 9e676ff5b58..467d69d0f0a 100644 --- a/libraries/tools/kotlin-compiler-client-embeddable-test/src/test/kotlin/org/jetbrains/kotlin/compiler/client/CompilerClientIT.kt +++ b/prepare/compiler-client-embeddable/tests/kotlin/org/jetbrains/kotlin/compiler/client/CompilerClientIT.kt @@ -38,12 +38,11 @@ class CompilerClientIT { val workingDir = TemporaryFolder() private val compilerClasspath: List by lazy { - listOf(fileFromProp("compilerJar", "kotlin-compiler.jar")) + filesFromProp("compilerClasspath", "kotlin-compiler.jar", "kotlin-daemon.jar") } private val compilationClasspath: List by lazy { - listOf(fileFromProp("stdlibJar", "kotlin-stdlib.jar"), - fileFromProp("scriptRuntimeJar", "kotlin-script-runtime.jar")) + filesFromProp("compilationClasspath", "kotlin-stdlib.jar", "kotlin-script-runtime.jar") } private val clientAliveFile by lazy { @@ -52,11 +51,11 @@ class CompilerClientIT { } } - private fun fileFromProp(propName: String, defaultPath: String) = - File((System.getProperty(propName) ?: defaultPath)).apply { - if (!exists()) - throw FileNotFoundException("cannot find $defaultPath ($this)") - } + private fun filesFromProp(propName: String, vararg defaultPaths: String): List = + (System.getProperty(propName)?.split(File.pathSeparator) ?: defaultPaths.asList()).map { + File(it).takeIf(File::exists) + ?: throw FileNotFoundException("cannot find ($it)") + } private val compilerService: CompileService by lazy { val compilerId = CompilerId.makeCompilerId(compilerClasspath) @@ -75,7 +74,7 @@ class CompilerClientIT { fun testSimpleScript() { val (out, code) = runCompiler( "-cp", compilationClasspath.joinToString(File.pathSeparator) { it.canonicalPath }, - File("../src/test/resources/scripts/simpleHelloWorld.kts").canonicalPath) + File("testData/scripts/simpleHelloWorld.kts").canonicalPath) assertEquals(0, code, "compilation failed:\n" + out + "\n") }