Delete Kotlin IntelliJ IDEA plugin sources

Kotlin plugin sources were migrated to intellij-community:
https://github.com/JetBrains/intellij-community/tree/master/plugins/kotlin

Preserve `jps-plugin/testData/incremental`
because it's used in `compiler/incremental-compilation-impl/test`

Preserve `idea/testData/multiModuleHighlighting/multiplatform`
because it's used in `MppHighlightingTestDataWithGradleIT`
This commit is contained in:
Nikita Bobko
2021-07-19 18:33:33 +02:00
parent b8d74698f1
commit 39fa2b0baf
49333 changed files with 0 additions and 1160202 deletions
-64
View File
@@ -1,64 +0,0 @@
description = "Kotlin NoArg IDEA Plugin"
plugins {
kotlin("jvm")
id("jps-compatible")
}
dependencies {
compile(project(":kotlin-noarg-compiler-plugin"))
compileOnly(project(":compiler:util"))
compileOnly(project(":compiler:frontend"))
compileOnly(project(":compiler:frontend.java"))
compileOnly(project(":compiler:backend"))
compileOnly(project(":compiler:cli-common"))
compileOnly(project(":idea"))
compileOnly(project(":idea:idea-jps-common"))
compileOnly(project(":plugins:annotation-based-compiler-plugins-ide-support"))
compileOnly(intellijDep())
excludeInAndroidStudio(rootProject) { compileOnly(intellijPluginDep("maven")) }
compileOnly(intellijPluginDep("gradle"))
compileOnly(project(":idea:kotlin-gradle-tooling"))
testRuntime(project(":kotlin-reflect"))
testCompileOnly(project(":kotlin-serialization"))
testCompileOnly(project(":plugins:lint"))
testCompileOnly(project(":plugins:kapt3-idea"))
testCompileOnly(project(":plugins:android-extensions-compiler"))
testCompileOnly(project(":kotlin-android-extensions"))
testCompileOnly(project(":kotlin-android-extensions-runtime"))
testCompileOnly(project(":plugins:android-extensions-ide"))
testCompileOnly(project(":kotlin-allopen-compiler-plugin"))
testCompileOnly(project(":allopen-ide-plugin"))
testCompileOnly(project(":kotlin-imports-dumper-compiler-plugin"))
testCompileOnly(project(":kotlinx-serialization-compiler-plugin"))
testCompileOnly(project(":kotlinx-serialization-ide-plugin"))
testCompileOnly(project(":kotlin-sam-with-receiver-compiler-plugin"))
testCompileOnly(project(":sam-with-receiver-ide-plugin"))
testCompileOnly(project(":idea:idea-native"))
testCompileOnly(project(":idea:idea-gradle-native"))
testCompileOnly(projectTests(":idea:idea-test-framework"))
testCompileOnly(intellijDep())
testRuntimeOnly(intellijDep())
compileOnly(intellijPluginDep("java"))
testCompileOnly(intellijPluginDep("java"))
testRuntimeOnly(intellijPluginDep("java"))
}
sourceSets {
"main" { projectDefault() }
"test" { projectDefault() }
}
runtimeJar()
sourcesJar()
javadocJar()
projectTest(parallel = true)
@@ -1,20 +0,0 @@
/*
* Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package org.jetbrains.kotlin.noarg.ide
import com.intellij.openapi.project.Project
import org.jetbrains.kotlin.annotation.plugin.ide.CachedAnnotationNames
import org.jetbrains.kotlin.annotation.plugin.ide.getAnnotationNames
import org.jetbrains.kotlin.noarg.AbstractNoArgExpressionCodegenExtension
import org.jetbrains.kotlin.psi.KtModifierListOwner
class IdeNoArgExpressionCodegenExtension(project: Project) : AbstractNoArgExpressionCodegenExtension(invokeInitializers = false) {
private val cachedAnnotationsNames = CachedAnnotationNames(project, NO_ARG_ANNOTATION_OPTION_PREFIX)
override fun getAnnotationFqNames(modifierListOwner: KtModifierListOwner?): List<String> =
cachedAnnotationsNames.getAnnotationNames(modifierListOwner)
}
@@ -1,24 +0,0 @@
/*
* Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package org.jetbrains.kotlin.noarg.ide
import com.intellij.openapi.project.Project
import org.jetbrains.kotlin.annotation.plugin.ide.CachedAnnotationNames
import org.jetbrains.kotlin.annotation.plugin.ide.getAnnotationNames
import org.jetbrains.kotlin.noarg.NoArgCommandLineProcessor
import org.jetbrains.kotlin.noarg.diagnostic.AbstractNoArgDeclarationChecker
import org.jetbrains.kotlin.psi.KtModifierListOwner
internal val NO_ARG_ANNOTATION_OPTION_PREFIX =
"plugin:${NoArgCommandLineProcessor.PLUGIN_ID}:${NoArgCommandLineProcessor.ANNOTATION_OPTION.optionName}="
class IdeNoArgDeclarationChecker(project: Project) : AbstractNoArgDeclarationChecker(false) {
private val cachedAnnotationNames = CachedAnnotationNames(project, NO_ARG_ANNOTATION_OPTION_PREFIX)
override fun getAnnotationFqNames(modifierListOwner: KtModifierListOwner?): List<String> =
cachedAnnotationNames.getAnnotationNames(modifierListOwner)
}
@@ -1,35 +0,0 @@
/*
* Copyright 2010-2016 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jetbrains.kotlin.noarg.ide
import com.intellij.openapi.project.Project
import org.jetbrains.kotlin.container.StorageComponentContainer
import org.jetbrains.kotlin.container.useInstance
import org.jetbrains.kotlin.descriptors.ModuleDescriptor
import org.jetbrains.kotlin.extensions.StorageComponentContainerContributor
import org.jetbrains.kotlin.platform.TargetPlatform
import org.jetbrains.kotlin.platform.jvm.isJvm
class IdeNoArgComponentContainerContributor(val project: Project) : StorageComponentContainerContributor {
override fun registerModuleComponents(
container: StorageComponentContainer, platform: TargetPlatform, moduleDescriptor: ModuleDescriptor
) {
if (!platform.isJvm()) return
container.useInstance(IdeNoArgDeclarationChecker(project))
}
}
@@ -1,46 +0,0 @@
/*
* Copyright 2010-2016 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jetbrains.kotlin.noarg.ide
import org.jetbrains.kotlin.annotation.plugin.ide.AbstractAnnotationPluginGradleImportHandler
import org.jetbrains.kotlin.plugin.ide.CompilerPluginSetup.PluginOption
import org.jetbrains.kotlin.noarg.NoArgCommandLineProcessor
import org.jetbrains.kotlin.utils.PathUtil
class NoArgGradleProjectImportHandler : AbstractAnnotationPluginGradleImportHandler<NoArgModel>() {
override val compilerPluginId = NoArgCommandLineProcessor.PLUGIN_ID
override val pluginName = "noarg"
override val annotationOptionName = NoArgCommandLineProcessor.ANNOTATION_OPTION.optionName
override val pluginJarFileFromIdea = PathUtil.kotlinPathsForIdeaPlugin.noArgPluginJarPath
override val modelKey = NoArgProjectResolverExtension.KEY
override fun getAdditionalOptions(model: NoArgModel): List<PluginOption> {
return listOf(PluginOption(
NoArgCommandLineProcessor.INVOKE_INITIALIZERS_OPTION.optionName,
model.invokeInitializers.toString()))
}
override fun getAnnotationsForPreset(presetName: String): List<String> {
for ((name, annotations) in NoArgCommandLineProcessor.SUPPORTED_PRESETS.entries) {
if (presetName == name) {
return annotations
}
}
return super.getAnnotationsForPreset(presetName)
}
}
@@ -1,63 +0,0 @@
/*
* Copyright 2010-2016 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jetbrains.kotlin.noarg.ide
import org.jetbrains.kotlin.plugin.ide.CompilerPluginSetup.PluginOption
import org.jetbrains.kotlin.noarg.NoArgCommandLineProcessor
import org.jetbrains.kotlin.plugin.ide.AbstractMavenImportHandler
import org.jetbrains.kotlin.utils.PathUtil
class NoArgMavenProjectImportHandler : AbstractMavenImportHandler() {
private companion object {
val ANNOTATATION_PARAMETER_PREFIX = "no-arg:${NoArgCommandLineProcessor.ANNOTATION_OPTION.optionName}="
val INVOKEINITIALIZERS_PARAMETER_PREFIX = "no-arg:${NoArgCommandLineProcessor.INVOKE_INITIALIZERS_OPTION.optionName}="
}
override val compilerPluginId = NoArgCommandLineProcessor.PLUGIN_ID
override val pluginName = "noarg"
override val pluginJarFileFromIdea = PathUtil.kotlinPathsForIdeaPlugin.noArgPluginJarPath
override fun getOptions(enabledCompilerPlugins: List<String>, compilerPluginOptions: List<String>): List<PluginOption>? {
if ("no-arg" !in enabledCompilerPlugins && "jpa" !in enabledCompilerPlugins) {
return null
}
val annotations = mutableListOf<String>()
for ((presetName, presetAnnotations) in NoArgCommandLineProcessor.SUPPORTED_PRESETS) {
if (presetName in enabledCompilerPlugins) {
annotations.addAll(presetAnnotations)
}
}
annotations.addAll(compilerPluginOptions.mapNotNull { text ->
if (!text.startsWith(ANNOTATATION_PARAMETER_PREFIX)) return@mapNotNull null
text.substring(ANNOTATATION_PARAMETER_PREFIX.length)
})
val options = annotations.mapTo(mutableListOf()) { PluginOption(NoArgCommandLineProcessor.ANNOTATION_OPTION.optionName, it) }
val invokeInitializerOptionValue = compilerPluginOptions
.firstOrNull { it.startsWith(INVOKEINITIALIZERS_PARAMETER_PREFIX) }
?.drop(INVOKEINITIALIZERS_PARAMETER_PREFIX.length) == "true"
if (invokeInitializerOptionValue) {
options.add(PluginOption(NoArgCommandLineProcessor.INVOKE_INITIALIZERS_OPTION.optionName, "true"))
}
return options
}
}
@@ -1,29 +0,0 @@
/*
* Copyright 2010-2017 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jetbrains.kotlin.noarg.ide
import com.intellij.openapi.util.Key
import org.jetbrains.kotlin.annotation.plugin.ide.*
class NoArgProjectResolverExtension : AnnotationBasedPluginProjectResolverExtension<NoArgModel>() {
companion object {
val KEY = Key<NoArgModel>("NoArgModel")
}
override val modelClass get() = NoArgModel::class.java
override val userDataKey get() = KEY
}
@@ -1,73 +0,0 @@
/*
* Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package org.jetbrains.kotlin.noarg.ide
import com.intellij.openapi.project.Project
import org.jetbrains.kotlin.annotation.plugin.ide.CachedAnnotationNames
import org.jetbrains.kotlin.annotation.plugin.ide.getAnnotationNames
import org.jetbrains.kotlin.asJava.UltraLightClassModifierExtension
import org.jetbrains.kotlin.asJava.classes.KtUltraLightClass
import org.jetbrains.kotlin.asJava.classes.createGeneratedMethodFromDescriptor
import org.jetbrains.kotlin.asJava.elements.KtLightMethod
import org.jetbrains.kotlin.descriptors.ClassDescriptor
import org.jetbrains.kotlin.descriptors.DeclarationDescriptor
import org.jetbrains.kotlin.extensions.AnnotationBasedExtension
import org.jetbrains.kotlin.noarg.AbstractNoArgExpressionCodegenExtension
import org.jetbrains.kotlin.noarg.AbstractNoArgExpressionCodegenExtension.Companion.isZeroParameterConstructor
import org.jetbrains.kotlin.psi.*
import org.jetbrains.kotlin.util.isAnnotated
import org.jetbrains.kotlin.util.isOrdinaryClass
class NoArgUltraLightClassModifierExtension(project: Project) :
AnnotationBasedExtension,
UltraLightClassModifierExtension {
private val cachedAnnotationsNames = CachedAnnotationNames(project, NO_ARG_ANNOTATION_OPTION_PREFIX)
override fun getAnnotationFqNames(modifierListOwner: KtModifierListOwner?): List<String> =
cachedAnnotationsNames.getAnnotationNames(modifierListOwner)
private fun isSuitableDeclaration(declaration: KtDeclaration): Boolean {
if (getAnnotationFqNames(declaration).isEmpty()) return false
if (!declaration.isOrdinaryClass || declaration !is KtClassOrObject) return false
if (declaration.allConstructors.isEmpty()) return false
if (declaration.allConstructors.any { it.getValueParameters().isEmpty() }) return false
if (declaration.superTypeListEntries.isEmpty() && !declaration.isAnnotated) return false
return true
}
override fun interceptMethodsBuilding(
declaration: KtDeclaration,
descriptor: Lazy<DeclarationDescriptor?>,
containingDeclaration: KtUltraLightClass,
methodsList: MutableList<KtLightMethod>
) {
val parentClass = containingDeclaration as? KtUltraLightClass ?: return
if (methodsList.any { it.isConstructor && it.parameters.isEmpty() }) return
if (!isSuitableDeclaration(declaration)) return
val descriptorValue = descriptor.value ?: return
val classDescriptor = (descriptorValue as? ClassDescriptor)
?: descriptorValue.containingDeclaration as? ClassDescriptor
?: return
if (!classDescriptor.hasSpecialAnnotation(declaration)) return
if (classDescriptor.constructors.any { isZeroParameterConstructor(it) }) return
val constructorDescriptor = AbstractNoArgExpressionCodegenExtension.createNoArgConstructorDescriptor(classDescriptor)
methodsList.add(parentClass.createGeneratedMethodFromDescriptor(constructorDescriptor))
}
}
@@ -1,74 +0,0 @@
/*
* Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package org.jetbrains.kotlin.noarg
import com.intellij.testFramework.LightProjectDescriptor
import org.jetbrains.kotlin.config.LanguageVersion
import org.jetbrains.kotlin.idea.facet.KotlinFacet
import org.jetbrains.kotlin.idea.test.KotlinLightCodeInsightFixtureTestCase
import org.jetbrains.kotlin.idea.test.KotlinProjectDescriptorWithFacet
import org.jetbrains.kotlin.noarg.ide.NO_ARG_ANNOTATION_OPTION_PREFIX
import org.jetbrains.kotlin.psi.KtFile
import org.jetbrains.kotlin.test.JUnit3WithIdeaConfigurationRunner
import org.junit.runner.RunWith
private const val targetClassName = "TargetClassName"
private const val baseClassName = "BaseClassName"
private const val noArgAnnotationName = "HelloNoArg"
@RunWith(JUnit3WithIdeaConfigurationRunner::class)
class TestNoArgForLightClass : KotlinLightCodeInsightFixtureTestCase() {
override fun getProjectDescriptor(): LightProjectDescriptor =
KotlinProjectDescriptorWithFacet(LanguageVersion.LATEST_STABLE, multiPlatform = false)
override fun setUp() {
super.setUp()
val facet = KotlinFacet.get(module) ?: error { "Facet not found" }
val configurationArguments = facet.configuration.settings.compilerArguments ?: error { "CompilerArguments not found" }
configurationArguments.pluginClasspaths = arrayOf("SomeClasspath")
configurationArguments.pluginOptions = arrayOf("$NO_ARG_ANNOTATION_OPTION_PREFIX$noArgAnnotationName")
}
fun testNoArgAnnotation() {
val file = myFixture.configureByText(
"A.kt",
"annotation class $noArgAnnotationName\n"
+ "@$noArgAnnotationName class $targetClassName(val e: Int)"
) as KtFile
val classes = file.classes
assertEquals(2, classes.size)
val targetClass = classes.firstOrNull { it.name == targetClassName }
?: error { "Expected class $targetClassName not found" }
val constructors = targetClass.constructors
assertEquals(constructors.size, 2)
assertTrue(constructors.any { it.parameters.isEmpty() })
}
fun testNoArgDerivedAnnotation() {
val file = myFixture.configureByText(
"A.kt",
"annotation class $noArgAnnotationName\n"
+ "@$noArgAnnotationName class $baseClassName(val e: Int)\n"
+ "class $targetClassName(val k: Int) : $baseClassName(k)"
) as KtFile
val classes = file.classes
assertEquals(3, classes.size)
val targetClass = classes.firstOrNull { it.name == targetClassName }
?: error { "Expected class $targetClassName not found" }
val constructors = targetClass.constructors
assertEquals(constructors.size, 2)
assertTrue(constructors.any { it.parameters.isEmpty() })
}
}