Build: Remove duplicated compiler.xml from idea module

Workaround for JPS build by copying compiler.xml in test runner before tests

For gradle just copy it in the processResourcesTask of idea project

 #KT-34528
This commit is contained in:
Vyacheslav Gerasimov
2019-11-21 22:58:04 +03:00
parent 8c103629a6
commit 027bc671c1
3 changed files with 27 additions and 66 deletions
@@ -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<Class> innerClasses = collectDeclaredClasses(klass, false);
Set<Class> unprocessedInnerClasses = unprocessedClasses(innerClasses);
+6
View File
@@ -197,6 +197,12 @@ dependencies {
performanceTestRuntime(sourceSets["performanceTest"].output)
}
tasks.named<Copy>("processResources") {
from(provider { project(":compiler:cli-common").mainSourceSet.resources }) {
include("META-INF/extensions/compiler.xml")
}
}
projectTest(parallel = true) {
dependsOn(":dist")
workingDir = rootDir
@@ -1,66 +0,0 @@
<idea-plugin>
<id>org.jetbrains.kotlin</id>
<version>1.2</version>
<extensionPoints>
<extensionPoint qualifiedName="org.jetbrains.kotlin.diagnosticSuppressor"
interface="org.jetbrains.kotlin.resolve.diagnostics.DiagnosticSuppressor"/>
<extensionPoint qualifiedName="org.jetbrains.kotlin.analyzeCompleteHandlerExtension"
interface="org.jetbrains.kotlin.resolve.jvm.extensions.AnalysisHandlerExtension"
area="IDEA_PROJECT"/>
<extensionPoint qualifiedName="org.jetbrains.kotlin.extensions.internal.callResolutionInterceptorExtension"
interface="org.jetbrains.kotlin.extensions.internal.CallResolutionInterceptorExtension"
area="IDEA_PROJECT"/>
<extensionPoint qualifiedName="org.jetbrains.kotlin.extensions.internal.typeResolutionInterceptorExtension"
interface="org.jetbrains.kotlin.extensions.internal.TypeResolutionInterceptorExtension"
area="IDEA_PROJECT"/>
<extensionPoint qualifiedName="org.jetbrains.kotlin.expressionCodegenExtension"
interface="org.jetbrains.kotlin.codegen.extensions.ExpressionCodegenExtension"
area="IDEA_PROJECT"/>
<extensionPoint qualifiedName="org.jetbrains.kotlin.syntheticResolveExtension"
interface="org.jetbrains.kotlin.resolve.extensions.SyntheticResolveExtension"
area="IDEA_PROJECT"/>
<extensionPoint qualifiedName="org.jetbrains.kotlin.jsSyntheticTranslateExtension"
interface="org.jetbrains.kotlin.js.translate.extensions.JsSyntheticTranslateExtension"
area="IDEA_PROJECT"/>
<extensionPoint qualifiedName="org.jetbrains.kotlin.irGenerationExtension"
interface="org.jetbrains.kotlin.backend.common.extensions.IrGenerationExtension"
area="IDEA_PROJECT"/>
<extensionPoint qualifiedName="org.jetbrains.kotlin.simpleNameReferenceExtension"
interface="org.jetbrains.kotlin.plugin.references.SimpleNameReferenceExtension"
area="IDEA_PROJECT"/>
<extensionPoint qualifiedName="org.jetbrains.kotlin.kotlinIndicesHelperExtension"
interface="org.jetbrains.kotlin.idea.core.extension.KotlinIndicesHelperExtension"
area="IDEA_PROJECT"/>
<extensionPoint qualifiedName="org.jetbrains.kotlin.classBuilderFactoryInterceptorExtension"
interface="org.jetbrains.kotlin.codegen.extensions.ClassBuilderInterceptorExtension"
area="IDEA_PROJECT"/>
<extensionPoint qualifiedName="org.jetbrains.kotlin.packageFragmentProviderExtension"
interface="org.jetbrains.kotlin.resolve.jvm.extensions.PackageFragmentProviderExtension"
area="IDEA_PROJECT"/>
<extensionPoint qualifiedName="org.jetbrains.kotlin.quickFixContributor"
interface="org.jetbrains.kotlin.idea.quickfix.QuickFixContributor"/>
<extensionPoint qualifiedName="org.jetbrains.kotlin.storageComponentContainerContributor"
interface="org.jetbrains.kotlin.extensions.StorageComponentContainerContributor"
area="IDEA_PROJECT"/>
<extensionPoint qualifiedName="org.jetbrains.kotlin.scriptDefinitionContributor"
interface="org.jetbrains.kotlin.idea.core.script.ScriptDefinitionContributor"
area="IDEA_PROJECT"/>
<extensionPoint qualifiedName="org.jetbrains.kotlin.scriptTemplatesProvider"
interface="org.jetbrains.kotlin.script.ScriptTemplatesProvider"
area="IDEA_PROJECT"/>
<extensionPoint qualifiedName="org.jetbrains.kotlin.extraImportsProviderExtension"
interface="org.jetbrains.kotlin.resolve.extensions.ExtraImportsProviderExtension"
area="IDEA_PROJECT"/>
<extensionPoint qualifiedName="org.jetbrains.kotlin.facetConfigurationExtension"
interface="org.jetbrains.kotlin.idea.facet.KotlinFacetConfigurationExtension"/>
<extensionPoint qualifiedName="org.jetbrains.kotlin.versionInfoProvider"
interface="org.jetbrains.kotlin.idea.facet.KotlinVersionInfoProvider"/>
<extensionPoint qualifiedName="org.jetbrains.kotlin.completionInformationProvider"
interface="org.jetbrains.kotlin.idea.completion.CompletionInformationProvider" />
<extensionPoint qualifiedName="org.jetbrains.kotlin.moduleBuilder"
interface="com.intellij.ide.util.projectWizard.ModuleBuilder"/>
<extensionPoint qualifiedName="org.jetbrains.kotlin.renameHandler"
interface="com.intellij.refactoring.rename.RenameHandler"/>
</extensionPoints>
</idea-plugin>