[kotlin] extract frontend agnostic kotlin.ide module

it supposed to contain ide/ui specific actions which are shared between k1 and k2

part of KTIJ-28142

GitOrigin-RevId: 9ee0d5808a80ab36d9c0aa4176a1633f48e482c4
This commit is contained in:
Anna Kozlova
2024-01-12 10:35:22 +01:00
committed by intellij-monorepo-bot
parent 1f6272bff4
commit 70910a1bf9
16 changed files with 39 additions and 13 deletions

1
.idea/modules.xml generated
View File

@@ -1386,6 +1386,7 @@
<module fileurl="file://$PROJECT_DIR$/plugins/kotlin/highlighting/highlighting-shared/kotlin.highlighting.shared.iml" filepath="$PROJECT_DIR$/plugins/kotlin/highlighting/highlighting-shared/kotlin.highlighting.shared.iml" />
<module fileurl="file://$PROJECT_DIR$/plugins/kotlin/i18n/kotlin.i18n.iml" filepath="$PROJECT_DIR$/plugins/kotlin/i18n/kotlin.i18n.iml" />
<module fileurl="file://$PROJECT_DIR$/plugins/kotlin/i18n/tests/kotlin.i18n.tests.iml" filepath="$PROJECT_DIR$/plugins/kotlin/i18n/tests/kotlin.i18n.tests.iml" />
<module fileurl="file://$PROJECT_DIR$/plugins/kotlin/kotlin.ide/kotlin.ide.iml" filepath="$PROJECT_DIR$/plugins/kotlin/kotlin.ide/kotlin.ide.iml" />
<module fileurl="file://$PROJECT_DIR$/plugins/kotlin/idea/kotlin.idea.iml" filepath="$PROJECT_DIR$/plugins/kotlin/idea/kotlin.idea.iml" />
<module fileurl="file://$PROJECT_DIR$/plugins/kotlin/idea/tests/kotlin.idea.tests.iml" filepath="$PROJECT_DIR$/plugins/kotlin/idea/tests/kotlin.idea.tests.iml" />
<module fileurl="file://$PROJECT_DIR$/plugins/kotlin/injection/k1/kotlin.injection.iml" filepath="$PROJECT_DIR$/plugins/kotlin/injection/k1/kotlin.injection.iml" />

View File

@@ -54,6 +54,7 @@ object KotlinPluginBuilder {
"kotlin.base.fe10.obsolete-compat",
"kotlin.base.fe10.project-structure",
"kotlin.core",
"kotlin.ide",
"kotlin.idea",
"kotlin.fir.frontend-independent",
"kotlin.jvm",

View File

@@ -127,5 +127,6 @@
<orderEntry type="module" module-name="intellij.platform.core" />
<orderEntry type="module" module-name="kotlin.base.analysis-api.utils" />
<orderEntry type="module" module-name="kotlin.code-insight.inspections-shared" />
<orderEntry type="module" module-name="kotlin.ide" />
</component>
</module>

View File

@@ -136,5 +136,6 @@
<orderEntry type="module" module-name="kotlin.refactorings.common.tests" scope="TEST" />
<orderEntry type="module" module-name="intellij.platform.analysis" scope="TEST" />
<orderEntry type="module" module-name="intellij.platform.projectModel" scope="TEST" />
<orderEntry type="module" module-name="kotlin.ide" scope="TEST" />
</component>
</module>

View File

@@ -117,7 +117,7 @@ class NewKotlinFileActionTest : BasePlatformTestCase() {
}
val actDir = myFixture.psiManager.findDirectory(myFixture.tempDirFixture.findOrCreateDir("."))!!
val file = createKotlinFileFromTemplateForTest(userInput, testTemplate, actDir)!!
val file = createKotlinFileFromTemplate(userInput, testTemplate, actDir)!!
assertEquals(expectedDirPath, file.virtualFile.parent.path.removePrefix(actDir.virtualFile.path))
assertEquals(expectedFileName, file.name)

View File

@@ -206,5 +206,6 @@
<orderEntry type="module" module-name="kotlin.base.code-insight.minimal" exported="" />
<orderEntry type="module" module-name="kotlin.highlighting.minimal" exported="" />
<orderEntry type="module" module-name="kotlin.formatter.minimal" exported="" />
<orderEntry type="module" module-name="kotlin.ide" exported="" />
</component>
</module>

View File

@@ -63,5 +63,6 @@
<orderEntry type="module" module-name="intellij.platform.core.ui" />
<orderEntry type="module" module-name="kotlin.base.indices" />
<orderEntry type="module" module-name="kotlin.code-insight.api" />
<orderEntry type="module" module-name="kotlin.ide" />
</component>
</module>

View File

@@ -0,0 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="module" module-name="kotlin.base.frontend-agnostic" scope="RUNTIME" />
<orderEntry type="module" module-name="intellij.platform.core.ui" />
<orderEntry type="module" module-name="intellij.platform.analysis" />
<orderEntry type="module" module-name="intellij.platform.lang.impl" />
<orderEntry type="library" name="kotlinc.kotlin-compiler-common" level="project" />
<orderEntry type="module" module-name="kotlin.base.project-structure" />
<orderEntry type="module" module-name="kotlin.base.resources" />
<orderEntry type="module" module-name="kotlin.base.statistics" />
<orderEntry type="module" module-name="kotlin.project-configuration" />
<orderEntry type="module" module-name="intellij.java.impl" />
</component>
</module>

View File

@@ -1,4 +1,4 @@
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package org.jetbrains.kotlin.idea.actions

View File

@@ -1,4 +1,4 @@
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package org.jetbrains.kotlin.idea.actions
@@ -28,7 +28,6 @@ import com.intellij.psi.PsiDirectory
import com.intellij.psi.PsiFile
import com.intellij.util.IncorrectOperationException
import org.jetbrains.annotations.ApiStatus
import org.jetbrains.annotations.TestOnly
import org.jetbrains.jps.model.java.JavaModuleSourceRootTypes
import org.jetbrains.kotlin.config.LanguageFeature
import org.jetbrains.kotlin.idea.KotlinFileType
@@ -258,11 +257,7 @@ internal fun createFileFromTemplateWithStat(name: String, template: FileTemplate
return createKotlinFileFromTemplate(name, template, dir)
}
@TestOnly
fun createKotlinFileFromTemplateForTest(name: String, template: FileTemplate, dir: PsiDirectory) =
createKotlinFileFromTemplate(name, template, dir)
internal fun createKotlinFileFromTemplate(name: String, template: FileTemplate, dir: PsiDirectory): PsiFile? {
fun createKotlinFileFromTemplate(name: String, template: FileTemplate, dir: PsiDirectory): PsiFile? {
val directorySeparators = when (template.name) {
"Kotlin File" -> FILE_SEPARATORS
"Kotlin Worksheet" -> FILE_SEPARATORS

View File

@@ -1,4 +1,4 @@
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package org.jetbrains.kotlin.idea.actions
@@ -11,8 +11,8 @@ import com.intellij.openapi.project.DumbAware
import com.intellij.openapi.project.Project
import com.intellij.openapi.roots.ProjectRootManager
import com.intellij.psi.PsiDirectory
import org.jetbrains.kotlin.idea.KotlinIcons
import org.jetbrains.kotlin.idea.base.resources.KotlinBundle
import kotlin.collections.none
internal class NewKotlinScriptAction : AbstractNewKotlinFileAction(), DumbAware {
override fun isAvailable(dataContext: DataContext): Boolean {

View File

@@ -26,5 +26,6 @@
<orderEntry type="module" module-name="intellij.platform.diagnostic.telemetry" />
<orderEntry type="module" module-name="intellij.platform.diagnostic.telemetry.impl" />
<orderEntry type="module" module-name="kotlin.base.code-insight.minimal" />
<orderEntry type="module" module-name="kotlin.ide" />
</component>
</module>

View File

@@ -15,7 +15,7 @@ import com.jetbrains.performancePlugin.PerformanceTestSpan
import com.jetbrains.performancePlugin.commands.PerformanceCommandCoroutineAdapter
import com.jetbrains.performancePlugin.utils.VcsTestUtil
import io.opentelemetry.context.Context
import org.jetbrains.kotlin.idea.actions.createKotlinFileFromTemplateForTest
import org.jetbrains.kotlin.idea.actions.createKotlinFileFromTemplate
/**
* Command to add Kotlin file to project
@@ -57,7 +57,7 @@ class CreateKotlinFileCommand(text: String, line: Int) : PerformanceCommandCorou
ApplicationManager.getApplication().invokeAndWait(Context.current().wrap(Runnable {
PerformanceTestSpan.TRACER.spanBuilder(NAME).useWithScopeBlocking {
val createdFile = createKotlinFileFromTemplateForTest(fileName, template, directory)
val createdFile = createKotlinFileFromTemplate(fileName, template, directory)
createdFile?.let {
LOG.info("Created kotlin file\n${createdFile.text}")
}

View File

@@ -157,5 +157,6 @@
<orderEntry type="module" module-name="kotlin.base.code-insight.minimal" scope="RUNTIME" />
<orderEntry type="module" module-name="kotlin.highlighting.minimal" />
<orderEntry type="module" module-name="kotlin.formatter.minimal" />
<orderEntry type="module" module-name="kotlin.ide" />
</component>
</module>

View File

@@ -111,5 +111,6 @@
<orderEntry type="module" module-name="kotlin.base.code-insight.minimal" scope="RUNTIME" />
<orderEntry type="module" module-name="kotlin.highlighting.minimal" />
<orderEntry type="module" module-name="kotlin.formatter.minimal" />
<orderEntry type="module" module-name="kotlin.ide" />
</component>
</module>

View File

@@ -31,5 +31,6 @@
<orderEntry type="module" module-name="intellij.platform.editor" scope="TEST" />
<orderEntry type="module" module-name="intellij.platform.vcs.impl" scope="TEST" />
<orderEntry type="module" module-name="intellij.java.psi" scope="TEST" />
<orderEntry type="module" module-name="kotlin.ide" scope="TEST" />
</component>
</module>