diff --git a/compiler/tests-common/tests/org/jetbrains/kotlin/test/JUnit3RunnerWithInnersForJPS.java b/compiler/tests-common/tests/org/jetbrains/kotlin/test/JUnit3RunnerWithInnersForJPS.java index 90a196fe7fe..a141cdedfe6 100644 --- a/compiler/tests-common/tests/org/jetbrains/kotlin/test/JUnit3RunnerWithInnersForJPS.java +++ b/compiler/tests-common/tests/org/jetbrains/kotlin/test/JUnit3RunnerWithInnersForJPS.java @@ -26,9 +26,13 @@ import org.junit.runner.Runner; import org.junit.runner.manipulation.*; import org.junit.runner.notification.RunNotifier; +import java.io.IOException; import java.lang.reflect.Method; +import java.nio.file.Files; +import java.nio.file.Paths; import java.util.*; +import static java.nio.file.StandardCopyOption.REPLACE_EXISTING; import static org.jetbrains.kotlin.test.JUnit3RunnerWithInners.isTestMethod; /** @@ -45,6 +49,7 @@ public class JUnit3RunnerWithInnersForJPS extends Runner implements Filterable, public JUnit3RunnerWithInnersForJPS(Class klass) { this.klass = klass; requestedRunners.add(klass); + ensureCompilerXmlExists(); } @Override @@ -76,6 +81,22 @@ public class JUnit3RunnerWithInnersForJPS extends Runner implements Filterable, delegateRunner = new JUnit38ClassRunner(getCollectedTests()); } + /** + * compiler.xml needs to be in both compiler & ide module for tests execution. + * To avoid file duplication copy it to the out dir idea module before test execution. + */ + private static void ensureCompilerXmlExists() { + String compilerXmlSourcePath = "compiler/cli/cli-common/resources/META-INF/extensions/compiler.xml"; + String compilerXmlTargetPath = "out/production/kotlin.idea.main/META-INF/extensions/compiler.xml"; + + try { + Files.copy(Paths.get(compilerXmlSourcePath), Paths.get(compilerXmlTargetPath), REPLACE_EXISTING); + } + catch (IOException e) { + throw new RuntimeException(e); + } + } + private Test getCollectedTests() { List innerClasses = collectDeclaredClasses(klass, false); Set unprocessedInnerClasses = unprocessedClasses(innerClasses); diff --git a/idea/build.gradle.kts b/idea/build.gradle.kts index 1c1e059e621..3edaf479232 100644 --- a/idea/build.gradle.kts +++ b/idea/build.gradle.kts @@ -197,6 +197,12 @@ dependencies { performanceTestRuntime(sourceSets["performanceTest"].output) } +tasks.named("processResources") { + from(provider { project(":compiler:cli-common").mainSourceSet.resources }) { + include("META-INF/extensions/compiler.xml") + } +} + projectTest(parallel = true) { dependsOn(":dist") workingDir = rootDir diff --git a/idea/resources/META-INF/extensions/compiler.xml b/idea/resources/META-INF/extensions/compiler.xml deleted file mode 100644 index ac06e4cf7ef..00000000000 --- a/idea/resources/META-INF/extensions/compiler.xml +++ /dev/null @@ -1,66 +0,0 @@ - - org.jetbrains.kotlin - 1.2 - - - - - - - - - - - - - - - - - - - - - - - - - -