[Plugins] Extract parts of cli modules which were used from IDE into common modules
This is needed to avoid IDE dependencies on cli modules, because they include FIR classes, which are inaccessible in regular Kotlin IDE plugin
This commit is contained in:
committed by
teamcity
parent
9b56a01d74
commit
66c2679673
@@ -6,6 +6,7 @@ plugins {
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation(project(":kotlin-allopen-compiler-plugin.common"))
|
||||
implementation(project(":kotlin-allopen-compiler-plugin.k1"))
|
||||
implementation(project(":kotlin-allopen-compiler-plugin.k2"))
|
||||
compileOnly(project(":compiler:plugin-api"))
|
||||
|
||||
@@ -6,9 +6,10 @@
|
||||
package org.jetbrains.kotlin.allopen
|
||||
|
||||
import com.intellij.mock.MockProject
|
||||
import org.jetbrains.kotlin.allopen.AllOpenCommandLineProcessor.Companion.SUPPORTED_PRESETS
|
||||
import org.jetbrains.kotlin.allopen.AllOpenConfigurationKeys.ANNOTATION
|
||||
import org.jetbrains.kotlin.allopen.AllOpenConfigurationKeys.PRESET
|
||||
import org.jetbrains.kotlin.allopen.AllOpenPluginNames.ANNOTATION_OPTION_NAME
|
||||
import org.jetbrains.kotlin.allopen.AllOpenPluginNames.SUPPORTED_PRESETS
|
||||
import org.jetbrains.kotlin.allopen.fir.FirAllOpenExtensionRegistrar
|
||||
import org.jetbrains.kotlin.compiler.plugin.*
|
||||
import org.jetbrains.kotlin.config.CompilerConfiguration
|
||||
@@ -23,29 +24,8 @@ object AllOpenConfigurationKeys {
|
||||
|
||||
class AllOpenCommandLineProcessor : CommandLineProcessor {
|
||||
companion object {
|
||||
val SUPPORTED_PRESETS = mapOf(
|
||||
"spring" to listOf(
|
||||
"org.springframework.stereotype.Component",
|
||||
"org.springframework.transaction.annotation.Transactional",
|
||||
"org.springframework.scheduling.annotation.Async",
|
||||
"org.springframework.cache.annotation.Cacheable",
|
||||
"org.springframework.boot.test.context.SpringBootTest",
|
||||
"org.springframework.validation.annotation.Validated"
|
||||
),
|
||||
"quarkus" to listOf(
|
||||
"javax.enterprise.context.ApplicationScoped",
|
||||
"javax.enterprise.context.RequestScoped"
|
||||
),
|
||||
"micronaut" to listOf(
|
||||
"io.micronaut.aop.Around",
|
||||
"io.micronaut.aop.Introduction",
|
||||
"io.micronaut.aop.InterceptorBinding",
|
||||
"io.micronaut.aop.InterceptorBindingDefinitions"
|
||||
)
|
||||
)
|
||||
|
||||
val ANNOTATION_OPTION = CliOption(
|
||||
"annotation", "<fqname>", "Annotation qualified names",
|
||||
ANNOTATION_OPTION_NAME, "<fqname>", "Annotation qualified names",
|
||||
required = false, allowMultipleOccurrences = true
|
||||
)
|
||||
|
||||
@@ -53,11 +33,9 @@ class AllOpenCommandLineProcessor : CommandLineProcessor {
|
||||
"preset", "<name>", "Preset name (${SUPPORTED_PRESETS.keys.joinToString()})",
|
||||
required = false, allowMultipleOccurrences = true
|
||||
)
|
||||
|
||||
const val PLUGIN_ID = "org.jetbrains.kotlin.allopen"
|
||||
}
|
||||
|
||||
override val pluginId = PLUGIN_ID
|
||||
override val pluginId = AllOpenPluginNames.PLUGIN_ID
|
||||
override val pluginOptions = listOf(ANNOTATION_OPTION, PRESET_OPTION)
|
||||
|
||||
override fun processOption(option: AbstractCliOption, value: String, configuration: CompilerConfiguration) = when (option) {
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
description = "Kotlin NoArg Compiler Plugin (Common)"
|
||||
|
||||
plugins {
|
||||
kotlin("jvm")
|
||||
id("jps-compatible")
|
||||
}
|
||||
|
||||
dependencies {
|
||||
compileOnly(project(":compiler:util"))
|
||||
compileOnly(project(":core:compiler.common"))
|
||||
}
|
||||
|
||||
sourceSets {
|
||||
"main" { projectDefault() }
|
||||
"test" { none() }
|
||||
}
|
||||
|
||||
runtimeJar()
|
||||
javadocJar()
|
||||
sourcesJar()
|
||||
@@ -0,0 +1,32 @@
|
||||
/*
|
||||
* Copyright 2010-2022 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.allopen
|
||||
|
||||
object AllOpenPluginNames {
|
||||
val SUPPORTED_PRESETS = mapOf(
|
||||
"spring" to listOf(
|
||||
"org.springframework.stereotype.Component",
|
||||
"org.springframework.transaction.annotation.Transactional",
|
||||
"org.springframework.scheduling.annotation.Async",
|
||||
"org.springframework.cache.annotation.Cacheable",
|
||||
"org.springframework.boot.test.context.SpringBootTest",
|
||||
"org.springframework.validation.annotation.Validated"
|
||||
),
|
||||
"quarkus" to listOf(
|
||||
"javax.enterprise.context.ApplicationScoped",
|
||||
"javax.enterprise.context.RequestScoped"
|
||||
),
|
||||
"micronaut" to listOf(
|
||||
"io.micronaut.aop.Around",
|
||||
"io.micronaut.aop.Introduction",
|
||||
"io.micronaut.aop.InterceptorBinding",
|
||||
"io.micronaut.aop.InterceptorBindingDefinitions"
|
||||
)
|
||||
)
|
||||
|
||||
const val PLUGIN_ID = "org.jetbrains.kotlin.allopen"
|
||||
const val ANNOTATION_OPTION_NAME = "annotation"
|
||||
}
|
||||
@@ -6,11 +6,13 @@ plugins {
|
||||
}
|
||||
|
||||
dependencies {
|
||||
embedded(project(":kotlin-allopen-compiler-plugin.common")) { isTransitive = false }
|
||||
embedded(project(":kotlin-allopen-compiler-plugin.cli")) { isTransitive = false }
|
||||
embedded(project(":kotlin-allopen-compiler-plugin.k1")) { isTransitive = false }
|
||||
embedded(project(":kotlin-allopen-compiler-plugin.k2")) { isTransitive = false }
|
||||
|
||||
testImplementation(project(":kotlin-allopen-compiler-plugin"))
|
||||
testImplementation(project(":kotlin-allopen-compiler-plugin.common"))
|
||||
testImplementation(project(":kotlin-allopen-compiler-plugin.k1"))
|
||||
testImplementation(project(":kotlin-allopen-compiler-plugin.k2"))
|
||||
testImplementation(project(":kotlin-allopen-compiler-plugin.cli"))
|
||||
|
||||
@@ -17,7 +17,7 @@ import org.jetbrains.kotlin.test.services.TestServices
|
||||
class AllOpenEnvironmentConfigurator(testServices: TestServices) : EnvironmentConfigurator(testServices) {
|
||||
override fun registerCompilerExtensions(project: Project, module: TestModule, configuration: CompilerConfiguration) {
|
||||
val annotations = AbstractAllOpenDeclarationAttributeAltererExtension.ANNOTATIONS_FOR_TESTS +
|
||||
AllOpenCommandLineProcessor.SUPPORTED_PRESETS.flatMap { it.value }
|
||||
AllOpenPluginNames.SUPPORTED_PRESETS.flatMap { it.value }
|
||||
|
||||
DeclarationAttributeAltererExtension.registerExtension(
|
||||
project,
|
||||
|
||||
Reference in New Issue
Block a user