i18n: add bundle for idea-gradle
This commit is contained in:
@@ -0,0 +1,43 @@
|
|||||||
|
action.label.text.load.script.configuration=Load script configuration
|
||||||
|
action.text.install=Install
|
||||||
|
action.text.show.kotlin.gradle.dsl.logs.in=Show Kotlin Gradle DSL Logs in {0}
|
||||||
|
description.text.a.single.platform.kotlin.library.or.application.targeting.javascript=A single-platform Kotlin library or application targeting JavaScript
|
||||||
|
description.text.a.single.platform.kotlin.library.or.application.targeting.js.for.browser=A single-platform Kotlin library or application targeting JavaScript for browser
|
||||||
|
description.text.a.single.platform.kotlin.library.or.application.targeting.js.for.node.js=A single-platform Kotlin library or application targeting JavaScript for Node.js
|
||||||
|
description.text.a.single.platform.kotlin.library.or.application.targeting.the.jvm=A single-platform Kotlin library or application targeting the JVM
|
||||||
|
description.text.adds.support.for.building.kotlin.projects=Adds support for building Kotlin projects
|
||||||
|
description.text.multi.targeted.jvm.js.ios.etc.project.with.shared.code.in.common.modules=Multi-targeted (JVM, JS, iOS, etc.) project with shared code in common modules. The targets can be configured in the project''s build script.
|
||||||
|
description.text.multiplatform.gradle.project.allowing.reuse.of.the.same.kotlin.code.between.android.and.ios.mobile.platforms=Multiplatform Gradle project allowing reuse of the same Kotlin code between Android and iOS mobile platforms
|
||||||
|
description.text.multiplatform.gradle.project.allowing.reuse.of.the.same.kotlin.code.between.js.client.and.jvm.server=Multiplatform Gradle project allowing reuse of the same Kotlin code between JS Client and JVM Server
|
||||||
|
description.text.multiplatform.gradle.project.allowing.reuse.of.the.same.kotlin.code.between.two.mobile.platforms.jvm.android.and.native=Multiplatform Gradle project allowing reuse of the same Kotlin code between two mobile platforms (JVM/Android and Native)
|
||||||
|
description.text.multiplatform.jvm.js.native=Multiplatform Gradle project allowing reuse of the same Kotlin code between all three main platforms (JVM, JS, and Native)
|
||||||
|
error.text.cannot.find.build.gradle.file.for.module=Cannot find build.gradle file for module {0}
|
||||||
|
error.text.coroutines.support.requires.version.1.1.or.later.of.the.kotlin.runtime.library=Coroutines support requires version 1.1 or later of the Kotlin runtime library. Please update the version in your build script.
|
||||||
|
error.text.different.kotlin.gradle.version=Kotlin version that is used for building with Gradle ({0}) differs from the one bundled into the IDE plugin ({1})
|
||||||
|
error.text.different.kotlin.library.version=Plugin version ({0}) is not the same as library version ({1})
|
||||||
|
error.text.failed.to.load.script.definitions.by=Failed to load script definitions by {0}
|
||||||
|
error.text.highlighting.is.impossible.during.gradle.import=Highlighting is impossible during Gradle Import
|
||||||
|
error.text.invalid.gradle.libraries.directory=Invalid Gradle libraries directory {0}
|
||||||
|
error.text.missing.jars.in.gradle.directory=Missing jars in gradle directory
|
||||||
|
error.text.project.isn.t.linked.with.gradle=Project ''{0}'' isn''t linked with Gradle
|
||||||
|
error.text.support.requires.version={0} support requires version {1} or later of the Kotlin runtime library. Please update the version in your build script.
|
||||||
|
error.text.this.language.feature.requires.version=This language feature requires version {0} or later of the Kotlin runtime library. Please update the version in your build script.
|
||||||
|
error.text.unable.to.get.gradle.home.directory=Unable to get Gradle home directory
|
||||||
|
title.plugin.suggestion=Plugins Suggestion
|
||||||
|
notification.text.native.debug.provides.debugger.for.kotlin.native=Native Debug provides debugger for Kotlin/Native
|
||||||
|
presentable.text.java.with.gradle=Java with Gradle
|
||||||
|
presentable.text.javascript.with.gradle=JavaScript with Gradle
|
||||||
|
presentable.text.js.client.and.jvm.server.gradle=JS Client and JVM Server | Gradle
|
||||||
|
presentable.text.mobile.android.ios.gradle=Mobile Android/iOS | Gradle
|
||||||
|
presentable.text.mobile.shared.library.gradle=Mobile Shared Library | Gradle
|
||||||
|
presentable.text.multiplatform.library.gradle=Multiplatform Library | Gradle
|
||||||
|
text.couldn.t.configure.kotlin.gradle.plugin.automatically=Couldn''t configure kotlin-gradle plugin automatically.
|
||||||
|
text.default.kotlin.gradle.script=Default Kotlin Gradle Script
|
||||||
|
text.gradle.dsl.logs.cannot.be.found.automatically.see.how.to.find.logs=Gradle DSL Logs cannot be found automatically.<br/>See how to find logs <a href="{0}">here</a>."
|
||||||
|
text.see.manual.installation.instructions=See manual installation instructions <a href="https://kotlinlang.org/docs/reference/using-gradle.html">here</a>.
|
||||||
|
text.the.associated.gradle.project.isn.t.imported=The associated Gradle Project isn''t imported.
|
||||||
|
text.was.modified={0} was modified
|
||||||
|
title.configure.kotlin.gradle.plugin=Configure Kotlin-Gradle Plugin
|
||||||
|
title.kotlin.build.script=Kotlin Build Script
|
||||||
|
title.update.language.version=Update Language Version
|
||||||
|
tool.tip.text.the.external.gradle.project.needs.to.be.imported.to.get.this.script.analyzed=The external Gradle project needs to be imported to get this script analyzed. <br/>You can import the related Gradle project or click "{0}" to get code insight without importing.
|
||||||
@@ -18,6 +18,7 @@ import com.intellij.openapi.util.SystemInfo
|
|||||||
import com.intellij.openapi.wm.WindowManager
|
import com.intellij.openapi.wm.WindowManager
|
||||||
import com.intellij.psi.PsiFile
|
import com.intellij.psi.PsiFile
|
||||||
import com.intellij.ui.BrowserHyperlinkListener
|
import com.intellij.ui.BrowserHyperlinkListener
|
||||||
|
import org.jetbrains.kotlin.idea.KotlinIdeaGradleBundle
|
||||||
import java.io.File
|
import java.io.File
|
||||||
|
|
||||||
class ShowKotlinGradleDslLogs : IntentionAction, AnAction(), DumbAware {
|
class ShowKotlinGradleDslLogs : IntentionAction, AnAction(), DumbAware {
|
||||||
@@ -47,7 +48,10 @@ class ShowKotlinGradleDslLogs : IntentionAction, AnAction(), DumbAware {
|
|||||||
?: WindowManager.getInstance().findVisibleFrame().rootPane
|
?: WindowManager.getInstance().findVisibleFrame().rootPane
|
||||||
JBPopupFactory.getInstance()
|
JBPopupFactory.getInstance()
|
||||||
.createHtmlTextBalloonBuilder(
|
.createHtmlTextBalloonBuilder(
|
||||||
"Gradle DSL Logs cannot be found automatically.<br/>See how to find logs <a href=\"$gradleTroubleshootingLink\">here</a>.",
|
KotlinIdeaGradleBundle.message(
|
||||||
|
"text.gradle.dsl.logs.cannot.be.found.automatically.see.how.to.find.logs",
|
||||||
|
gradleTroubleshootingLink
|
||||||
|
),
|
||||||
MessageType.ERROR,
|
MessageType.ERROR,
|
||||||
BrowserHyperlinkListener.INSTANCE
|
BrowserHyperlinkListener.INSTANCE
|
||||||
)
|
)
|
||||||
@@ -79,6 +83,6 @@ class ShowKotlinGradleDslLogs : IntentionAction, AnAction(), DumbAware {
|
|||||||
companion object {
|
companion object {
|
||||||
private const val gradleTroubleshootingLink = "https://docs.gradle.org/current/userguide/kotlin_dsl.html#troubleshooting"
|
private const val gradleTroubleshootingLink = "https://docs.gradle.org/current/userguide/kotlin_dsl.html#troubleshooting"
|
||||||
|
|
||||||
val NAME = "Show Kotlin Gradle DSL Logs in ${RevealFileAction.getFileManagerName()}"
|
val NAME = KotlinIdeaGradleBundle.message("action.text.show.kotlin.gradle.dsl.logs.in", RevealFileAction.getFileManagerName())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+6
-2
@@ -18,6 +18,7 @@ import com.intellij.openapi.util.SystemInfo
|
|||||||
import com.intellij.openapi.wm.WindowManager
|
import com.intellij.openapi.wm.WindowManager
|
||||||
import com.intellij.psi.PsiFile
|
import com.intellij.psi.PsiFile
|
||||||
import com.intellij.ui.BrowserHyperlinkListener
|
import com.intellij.ui.BrowserHyperlinkListener
|
||||||
|
import org.jetbrains.kotlin.idea.KotlinIdeaGradleBundle
|
||||||
import java.io.File
|
import java.io.File
|
||||||
|
|
||||||
class ShowKotlinGradleDslLogs : IntentionAction, AnAction(), DumbAware {
|
class ShowKotlinGradleDslLogs : IntentionAction, AnAction(), DumbAware {
|
||||||
@@ -46,7 +47,10 @@ class ShowKotlinGradleDslLogs : IntentionAction, AnAction(), DumbAware {
|
|||||||
?: WindowManager.getInstance().findVisibleFrame().rootPane
|
?: WindowManager.getInstance().findVisibleFrame().rootPane
|
||||||
JBPopupFactory.getInstance()
|
JBPopupFactory.getInstance()
|
||||||
.createHtmlTextBalloonBuilder(
|
.createHtmlTextBalloonBuilder(
|
||||||
"Gradle DSL Logs cannot be found automatically.<br/>See how to find logs <a href=\"$gradleTroubleshootingLink\">here</a>.",
|
KotlinIdeaGradleBundle.message(
|
||||||
|
"text.gradle.dsl.logs.cannot.be.found.automatically.see.how.to.find.logs",
|
||||||
|
gradleTroubleshootingLink
|
||||||
|
),
|
||||||
MessageType.ERROR,
|
MessageType.ERROR,
|
||||||
BrowserHyperlinkListener.INSTANCE
|
BrowserHyperlinkListener.INSTANCE
|
||||||
)
|
)
|
||||||
@@ -78,6 +82,6 @@ class ShowKotlinGradleDslLogs : IntentionAction, AnAction(), DumbAware {
|
|||||||
companion object {
|
companion object {
|
||||||
private const val gradleTroubleshootingLink = "https://docs.gradle.org/current/userguide/kotlin_dsl.html#troubleshooting"
|
private const val gradleTroubleshootingLink = "https://docs.gradle.org/current/userguide/kotlin_dsl.html#troubleshooting"
|
||||||
|
|
||||||
val NAME = "Show Kotlin Gradle DSL Logs in ${ShowFilePathAction.getFileManagerName()}"
|
val NAME = KotlinIdeaGradleBundle.message("action.text.show.kotlin.gradle.dsl.logs.in", RevealFileAction.getFileManagerName())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+10
-6
@@ -29,6 +29,7 @@ import com.intellij.openapi.vfs.LocalFileSystem
|
|||||||
import com.intellij.openapi.vfs.VfsUtil.createDirectoryIfMissing
|
import com.intellij.openapi.vfs.VfsUtil.createDirectoryIfMissing
|
||||||
import com.intellij.psi.PsiFile
|
import com.intellij.psi.PsiFile
|
||||||
import org.jetbrains.kotlin.idea.KotlinIcons
|
import org.jetbrains.kotlin.idea.KotlinIcons
|
||||||
|
import org.jetbrains.kotlin.idea.KotlinIdeaGradleBundle
|
||||||
import org.jetbrains.kotlin.idea.formatter.KotlinStyleGuideCodeStyle
|
import org.jetbrains.kotlin.idea.formatter.KotlinStyleGuideCodeStyle
|
||||||
import org.jetbrains.kotlin.idea.formatter.ProjectCodeStyleImporter
|
import org.jetbrains.kotlin.idea.formatter.ProjectCodeStyleImporter
|
||||||
import org.jetbrains.kotlin.idea.statistics.FUSEventGroups
|
import org.jetbrains.kotlin.idea.statistics.FUSEventGroups
|
||||||
@@ -194,7 +195,8 @@ open class GradleKotlinJavaFrameworkSupportProvider(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun getDescription() = "A single-platform Kotlin library or application targeting the JVM"
|
override fun getDescription() =
|
||||||
|
KotlinIdeaGradleBundle.message("description.text.a.single.platform.kotlin.library.or.application.targeting.the.jvm")
|
||||||
}
|
}
|
||||||
|
|
||||||
abstract class GradleKotlinJSFrameworkSupportProvider(
|
abstract class GradleKotlinJSFrameworkSupportProvider(
|
||||||
@@ -228,7 +230,8 @@ abstract class GradleKotlinJSFrameworkSupportProvider(
|
|||||||
override fun getPluginExpression() = "id 'org.jetbrains.kotlin.js'"
|
override fun getPluginExpression() = "id 'org.jetbrains.kotlin.js'"
|
||||||
override fun getDependencies(sdk: Sdk?) = listOf(MAVEN_JS_STDLIB_ID)
|
override fun getDependencies(sdk: Sdk?) = listOf(MAVEN_JS_STDLIB_ID)
|
||||||
override fun getTestDependencies() = listOf(MAVEN_JS_TEST_ID)
|
override fun getTestDependencies() = listOf(MAVEN_JS_TEST_ID)
|
||||||
override fun getDescription() = "A single-platform Kotlin library or application targeting JavaScript"
|
override fun getDescription() =
|
||||||
|
KotlinIdeaGradleBundle.message("description.text.a.single.platform.kotlin.library.or.application.targeting.javascript")
|
||||||
}
|
}
|
||||||
|
|
||||||
open class GradleKotlinJSBrowserFrameworkSupportProvider(
|
open class GradleKotlinJSBrowserFrameworkSupportProvider(
|
||||||
@@ -238,7 +241,8 @@ open class GradleKotlinJSBrowserFrameworkSupportProvider(
|
|||||||
override val jsSubTargetName: String
|
override val jsSubTargetName: String
|
||||||
get() = "browser"
|
get() = "browser"
|
||||||
|
|
||||||
override fun getDescription() = "A single-platform Kotlin library or application targeting JavaScript for browser"
|
override fun getDescription() =
|
||||||
|
KotlinIdeaGradleBundle.message("description.text.a.single.platform.kotlin.library.or.application.targeting.js.for.browser")
|
||||||
|
|
||||||
override fun addSupport(
|
override fun addSupport(
|
||||||
buildScriptData: BuildScriptDataBuilder,
|
buildScriptData: BuildScriptDataBuilder,
|
||||||
@@ -301,7 +305,8 @@ open class GradleKotlinJSNodeFrameworkSupportProvider(
|
|||||||
override val jsSubTargetName: String
|
override val jsSubTargetName: String
|
||||||
get() = "nodejs"
|
get() = "nodejs"
|
||||||
|
|
||||||
override fun getDescription() = "A single-platform Kotlin library or application targeting JavaScript for Node.js"
|
override fun getDescription() =
|
||||||
|
KotlinIdeaGradleBundle.message("description.text.a.single.platform.kotlin.library.or.application.targeting.js.for.node.js")
|
||||||
}
|
}
|
||||||
|
|
||||||
open class GradleKotlinMPPFrameworkSupportProvider : GradleKotlinFrameworkSupportProvider(
|
open class GradleKotlinMPPFrameworkSupportProvider : GradleKotlinFrameworkSupportProvider(
|
||||||
@@ -314,8 +319,7 @@ open class GradleKotlinMPPFrameworkSupportProvider : GradleKotlinFrameworkSuppor
|
|||||||
override fun getTestDependencies(): List<String> = listOf()
|
override fun getTestDependencies(): List<String> = listOf()
|
||||||
|
|
||||||
override fun getDescription() =
|
override fun getDescription() =
|
||||||
"Multi-targeted (JVM, JS, iOS, etc.) project with shared code in common modules. " +
|
KotlinIdeaGradleBundle.message("description.text.multi.targeted.jvm.js.ios.etc.project.with.shared.code.in.common.modules")
|
||||||
"The targets can be configured in the project's build script."
|
|
||||||
}
|
}
|
||||||
|
|
||||||
open class GradleKotlinMPPSourceSetsFrameworkSupportProvider : GradleKotlinMPPFrameworkSupportProvider() {
|
open class GradleKotlinMPPSourceSetsFrameworkSupportProvider : GradleKotlinMPPFrameworkSupportProvider() {
|
||||||
|
|||||||
+3
-2
@@ -6,6 +6,7 @@
|
|||||||
package org.jetbrains.kotlin.idea.configuration
|
package org.jetbrains.kotlin.idea.configuration
|
||||||
|
|
||||||
import com.intellij.openapi.vfs.VirtualFile
|
import com.intellij.openapi.vfs.VirtualFile
|
||||||
|
import org.jetbrains.kotlin.idea.KotlinIdeaGradleBundle
|
||||||
import org.jetbrains.kotlin.idea.configuration.xcode.XcodeProjectConfigurator
|
import org.jetbrains.kotlin.idea.configuration.xcode.XcodeProjectConfigurator
|
||||||
import org.jetbrains.plugins.gradle.frameworkSupport.BuildScriptDataBuilder
|
import org.jetbrains.plugins.gradle.frameworkSupport.BuildScriptDataBuilder
|
||||||
import java.io.BufferedWriter
|
import java.io.BufferedWriter
|
||||||
@@ -29,10 +30,10 @@ class KotlinGradleMobileMultiplatformModuleBuilder :
|
|||||||
|
|
||||||
override fun getBuilderId() = "kotlin.gradle.multiplatform.mobile"
|
override fun getBuilderId() = "kotlin.gradle.multiplatform.mobile"
|
||||||
|
|
||||||
override fun getPresentableName() = "Mobile Android/iOS | Gradle"
|
override fun getPresentableName() = KotlinIdeaGradleBundle.message("presentable.text.mobile.android.ios.gradle")
|
||||||
|
|
||||||
override fun getDescription() =
|
override fun getDescription() =
|
||||||
"Multiplatform Gradle project allowing reuse of the same Kotlin code between Android and iOS mobile platforms"
|
KotlinIdeaGradleBundle.message("description.text.multiplatform.gradle.project.allowing.reuse.of.the.same.kotlin.code.between.android.and.ios.mobile.platforms")
|
||||||
|
|
||||||
override fun BuildScriptDataBuilder.setupAdditionalDependencies() {
|
override fun BuildScriptDataBuilder.setupAdditionalDependencies() {
|
||||||
addBuildscriptDependencyNotation("classpath 'com.android.tools.build:gradle:3.2.1'")
|
addBuildscriptDependencyNotation("classpath 'com.android.tools.build:gradle:3.2.1'")
|
||||||
|
|||||||
+3
-2
@@ -6,6 +6,7 @@
|
|||||||
package org.jetbrains.kotlin.idea.configuration
|
package org.jetbrains.kotlin.idea.configuration
|
||||||
|
|
||||||
import com.intellij.openapi.vfs.VirtualFile
|
import com.intellij.openapi.vfs.VirtualFile
|
||||||
|
import org.jetbrains.kotlin.idea.KotlinIdeaGradleBundle
|
||||||
import java.io.BufferedWriter
|
import java.io.BufferedWriter
|
||||||
|
|
||||||
class KotlinGradleMobileSharedMultiplatformModuleBuilder : KotlinGradleAbstractMultiplatformModuleBuilder() {
|
class KotlinGradleMobileSharedMultiplatformModuleBuilder : KotlinGradleAbstractMultiplatformModuleBuilder() {
|
||||||
@@ -25,10 +26,10 @@ class KotlinGradleMobileSharedMultiplatformModuleBuilder : KotlinGradleAbstractM
|
|||||||
|
|
||||||
override fun getBuilderId() = "kotlin.gradle.multiplatform.mobileshared"
|
override fun getBuilderId() = "kotlin.gradle.multiplatform.mobileshared"
|
||||||
|
|
||||||
override fun getPresentableName() = "Mobile Shared Library | Gradle"
|
override fun getPresentableName() = KotlinIdeaGradleBundle.message("presentable.text.mobile.shared.library.gradle")
|
||||||
|
|
||||||
override fun getDescription() =
|
override fun getDescription() =
|
||||||
"Multiplatform Gradle project allowing reuse of the same Kotlin code between two mobile platforms (JVM/Android and Native)"
|
KotlinIdeaGradleBundle.message("description.text.multiplatform.gradle.project.allowing.reuse.of.the.same.kotlin.code.between.two.mobile.platforms.jvm.android.and.native")
|
||||||
|
|
||||||
override fun createProjectSkeleton(rootDir: VirtualFile) {
|
override fun createProjectSkeleton(rootDir: VirtualFile) {
|
||||||
val src = rootDir.createChildDirectory(this, "src")
|
val src = rootDir.createChildDirectory(this, "src")
|
||||||
|
|||||||
+2
-1
@@ -19,6 +19,7 @@ package org.jetbrains.kotlin.idea.configuration
|
|||||||
import com.intellij.openapi.module.Module
|
import com.intellij.openapi.module.Module
|
||||||
import com.intellij.openapi.projectRoots.Sdk
|
import com.intellij.openapi.projectRoots.Sdk
|
||||||
import com.intellij.psi.PsiFile
|
import com.intellij.psi.PsiFile
|
||||||
|
import org.jetbrains.kotlin.idea.KotlinIdeaGradleBundle
|
||||||
import org.jetbrains.kotlin.idea.core.isAndroidModule
|
import org.jetbrains.kotlin.idea.core.isAndroidModule
|
||||||
import org.jetbrains.kotlin.idea.versions.getDefaultJvmTarget
|
import org.jetbrains.kotlin.idea.versions.getDefaultJvmTarget
|
||||||
import org.jetbrains.kotlin.platform.TargetPlatform
|
import org.jetbrains.kotlin.platform.TargetPlatform
|
||||||
@@ -36,7 +37,7 @@ class KotlinGradleModuleConfigurator : KotlinWithGradleConfigurator() {
|
|||||||
override fun getTargetPlatform() = JvmPlatforms.CompatJvmPlatform
|
override fun getTargetPlatform() = JvmPlatforms.CompatJvmPlatform
|
||||||
|
|
||||||
override val presentableText: String
|
override val presentableText: String
|
||||||
get() = "Java with Gradle"
|
get() = KotlinIdeaGradleBundle.message("presentable.text.java.with.gradle")
|
||||||
|
|
||||||
override val kotlinPluginName: String
|
override val kotlinPluginName: String
|
||||||
get() = KOTLIN
|
get() = KOTLIN
|
||||||
|
|||||||
+2
-1
@@ -16,9 +16,10 @@
|
|||||||
|
|
||||||
package org.jetbrains.kotlin.idea.configuration
|
package org.jetbrains.kotlin.idea.configuration
|
||||||
|
|
||||||
|
import org.jetbrains.kotlin.idea.KotlinIdeaGradleBundle
|
||||||
import org.jetbrains.plugins.gradle.codeInsight.GradlePluginDescriptionsExtension
|
import org.jetbrains.plugins.gradle.codeInsight.GradlePluginDescriptionsExtension
|
||||||
|
|
||||||
class KotlinGradlePluginDescription : GradlePluginDescriptionsExtension {
|
class KotlinGradlePluginDescription : GradlePluginDescriptionsExtension {
|
||||||
override fun getPluginDescriptions(): Map<String, String> =
|
override fun getPluginDescriptions(): Map<String, String> =
|
||||||
mapOf("kotlin" to "Adds support for building Kotlin projects")
|
mapOf("kotlin" to KotlinIdeaGradleBundle.message("description.text.adds.support.for.building.kotlin.projects"))
|
||||||
}
|
}
|
||||||
|
|||||||
+3
-2
@@ -6,6 +6,7 @@
|
|||||||
package org.jetbrains.kotlin.idea.configuration
|
package org.jetbrains.kotlin.idea.configuration
|
||||||
|
|
||||||
import com.intellij.openapi.vfs.VirtualFile
|
import com.intellij.openapi.vfs.VirtualFile
|
||||||
|
import org.jetbrains.kotlin.idea.KotlinIdeaGradleBundle
|
||||||
import org.jetbrains.kotlin.konan.target.presetName
|
import org.jetbrains.kotlin.konan.target.presetName
|
||||||
import java.io.BufferedWriter
|
import java.io.BufferedWriter
|
||||||
|
|
||||||
@@ -29,10 +30,10 @@ class KotlinGradleSharedMultiplatformModuleBuilder : KotlinGradleAbstractMultipl
|
|||||||
|
|
||||||
override fun getBuilderId() = "kotlin.gradle.multiplatform.shared"
|
override fun getBuilderId() = "kotlin.gradle.multiplatform.shared"
|
||||||
|
|
||||||
override fun getPresentableName() = "Multiplatform Library | Gradle"
|
override fun getPresentableName() = KotlinIdeaGradleBundle.message("presentable.text.multiplatform.library.gradle")
|
||||||
|
|
||||||
override fun getDescription() =
|
override fun getDescription() =
|
||||||
"Multiplatform Gradle project allowing reuse of the same Kotlin code between all three main platforms (JVM, JS, and Native)"
|
KotlinIdeaGradleBundle.message("description.text.multiplatform.jvm.js.native")
|
||||||
|
|
||||||
override fun createProjectSkeleton(rootDir: VirtualFile) {
|
override fun createProjectSkeleton(rootDir: VirtualFile) {
|
||||||
val src = rootDir.createChildDirectory(this, "src")
|
val src = rootDir.createChildDirectory(this, "src")
|
||||||
|
|||||||
+3
-2
@@ -6,6 +6,7 @@
|
|||||||
package org.jetbrains.kotlin.idea.configuration
|
package org.jetbrains.kotlin.idea.configuration
|
||||||
|
|
||||||
import com.intellij.openapi.vfs.VirtualFile
|
import com.intellij.openapi.vfs.VirtualFile
|
||||||
|
import org.jetbrains.kotlin.idea.KotlinIdeaGradleBundle
|
||||||
import org.jetbrains.plugins.gradle.frameworkSupport.BuildScriptDataBuilder
|
import org.jetbrains.plugins.gradle.frameworkSupport.BuildScriptDataBuilder
|
||||||
import java.io.BufferedWriter
|
import java.io.BufferedWriter
|
||||||
|
|
||||||
@@ -24,10 +25,10 @@ class KotlinGradleWebMultiplatformModuleBuilder : KotlinGradleAbstractMultiplatf
|
|||||||
|
|
||||||
override fun getBuilderId() = "kotlin.gradle.multiplatform.web"
|
override fun getBuilderId() = "kotlin.gradle.multiplatform.web"
|
||||||
|
|
||||||
override fun getPresentableName() = "JS Client and JVM Server | Gradle"
|
override fun getPresentableName() = KotlinIdeaGradleBundle.message("presentable.text.js.client.and.jvm.server.gradle")
|
||||||
|
|
||||||
override fun getDescription() =
|
override fun getDescription() =
|
||||||
"Multiplatform Gradle project allowing reuse of the same Kotlin code between JS Client and JVM Server"
|
KotlinIdeaGradleBundle.message("description.text.multiplatform.gradle.project.allowing.reuse.of.the.same.kotlin.code.between.js.client.and.jvm.server")
|
||||||
|
|
||||||
override fun BuildScriptDataBuilder.setupAdditionalDependencies() {
|
override fun BuildScriptDataBuilder.setupAdditionalDependencies() {
|
||||||
addBuildscriptRepositoriesDefinition("jcenter()")
|
addBuildscriptRepositoriesDefinition("jcenter()")
|
||||||
|
|||||||
+2
-1
@@ -18,6 +18,7 @@ package org.jetbrains.kotlin.idea.configuration
|
|||||||
|
|
||||||
import com.intellij.openapi.projectRoots.Sdk
|
import com.intellij.openapi.projectRoots.Sdk
|
||||||
import com.intellij.psi.PsiFile
|
import com.intellij.psi.PsiFile
|
||||||
|
import org.jetbrains.kotlin.idea.KotlinIdeaGradleBundle
|
||||||
import org.jetbrains.kotlin.idea.util.module
|
import org.jetbrains.kotlin.idea.util.module
|
||||||
import org.jetbrains.kotlin.idea.versions.MAVEN_JS_STDLIB_ID
|
import org.jetbrains.kotlin.idea.versions.MAVEN_JS_STDLIB_ID
|
||||||
import org.jetbrains.kotlin.platform.TargetPlatform
|
import org.jetbrains.kotlin.platform.TargetPlatform
|
||||||
@@ -25,7 +26,7 @@ import org.jetbrains.kotlin.platform.js.JsPlatforms
|
|||||||
|
|
||||||
class KotlinJsGradleModuleConfigurator : KotlinWithGradleConfigurator() {
|
class KotlinJsGradleModuleConfigurator : KotlinWithGradleConfigurator() {
|
||||||
override val name: String = "gradle-js"
|
override val name: String = "gradle-js"
|
||||||
override val presentableText: String = "JavaScript with Gradle"
|
override val presentableText: String = KotlinIdeaGradleBundle.message("presentable.text.javascript.with.gradle")
|
||||||
override val targetPlatform: TargetPlatform = JsPlatforms.defaultJsPlatform
|
override val targetPlatform: TargetPlatform = JsPlatforms.defaultJsPlatform
|
||||||
override val kotlinPluginName: String = KOTLIN_JS
|
override val kotlinPluginName: String = KOTLIN_JS
|
||||||
override fun getKotlinPluginExpression(forKotlinDsl: Boolean): String =
|
override fun getKotlinPluginExpression(forKotlinDsl: Boolean): String =
|
||||||
|
|||||||
+16
-15
@@ -29,6 +29,7 @@ import org.gradle.util.GradleVersion
|
|||||||
import org.jetbrains.kotlin.config.ApiVersion
|
import org.jetbrains.kotlin.config.ApiVersion
|
||||||
import org.jetbrains.kotlin.config.CoroutineSupport
|
import org.jetbrains.kotlin.config.CoroutineSupport
|
||||||
import org.jetbrains.kotlin.config.LanguageFeature
|
import org.jetbrains.kotlin.config.LanguageFeature
|
||||||
|
import org.jetbrains.kotlin.idea.KotlinIdeaGradleBundle
|
||||||
import org.jetbrains.kotlin.idea.facet.getRuntimeLibraryVersion
|
import org.jetbrains.kotlin.idea.facet.getRuntimeLibraryVersion
|
||||||
import org.jetbrains.kotlin.idea.facet.toApiVersion
|
import org.jetbrains.kotlin.idea.facet.toApiVersion
|
||||||
import org.jetbrains.kotlin.idea.framework.ui.ConfigureDialogWithModulesAndVersion
|
import org.jetbrains.kotlin.idea.framework.ui.ConfigureDialogWithModulesAndVersion
|
||||||
@@ -140,7 +141,10 @@ abstract class KotlinWithGradleConfigurator : KotlinProjectConfigurator {
|
|||||||
if (file != null && canConfigureFile(file)) {
|
if (file != null && canConfigureFile(file)) {
|
||||||
configureModule(module, file, false, kotlinVersion, collector, filesToOpen)
|
configureModule(module, file, false, kotlinVersion, collector, filesToOpen)
|
||||||
} else {
|
} else {
|
||||||
showErrorMessage(project, "Cannot find build.gradle file for module " + module.name)
|
showErrorMessage(
|
||||||
|
project,
|
||||||
|
KotlinIdeaGradleBundle.message("error.text.cannot.find.build.gradle.file.for.module", module.name)
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return filesToOpen
|
return filesToOpen
|
||||||
@@ -207,7 +211,7 @@ abstract class KotlinWithGradleConfigurator : KotlinProjectConfigurator {
|
|||||||
|
|
||||||
val virtualFile = file.virtualFile
|
val virtualFile = file.virtualFile
|
||||||
if (virtualFile != null && isModified) {
|
if (virtualFile != null && isModified) {
|
||||||
collector.addMessage(virtualFile.path + " was modified")
|
collector.addMessage(KotlinIdeaGradleBundle.message("text.was.modified", virtualFile.path))
|
||||||
}
|
}
|
||||||
return isModified
|
return isModified
|
||||||
}
|
}
|
||||||
@@ -226,9 +230,8 @@ abstract class KotlinWithGradleConfigurator : KotlinProjectConfigurator {
|
|||||||
if (runtimeUpdateRequired) {
|
if (runtimeUpdateRequired) {
|
||||||
Messages.showErrorDialog(
|
Messages.showErrorDialog(
|
||||||
module.project,
|
module.project,
|
||||||
"This language feature requires version $requiredStdlibVersion or later of the Kotlin runtime library. " +
|
KotlinIdeaGradleBundle.message("error.text.this.language.feature.requires.version", requiredStdlibVersion),
|
||||||
"Please update the version in your build script.",
|
KotlinIdeaGradleBundle.message("title.update.language.version")
|
||||||
"Update Language Version"
|
|
||||||
)
|
)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@@ -247,8 +250,7 @@ abstract class KotlinWithGradleConfigurator : KotlinProjectConfigurator {
|
|||||||
if (runtimeUpdateRequired) {
|
if (runtimeUpdateRequired) {
|
||||||
Messages.showErrorDialog(
|
Messages.showErrorDialog(
|
||||||
module.project,
|
module.project,
|
||||||
"Coroutines support requires version 1.1 or later of the Kotlin runtime library. " +
|
KotlinIdeaGradleBundle.message("error.text.coroutines.support.requires.version.1.1.or.later.of.the.kotlin.runtime.library"),
|
||||||
"Please update the version in your build script.",
|
|
||||||
ChangeCoroutineSupportFix.getFixText(state)
|
ChangeCoroutineSupportFix.getFixText(state)
|
||||||
)
|
)
|
||||||
return
|
return
|
||||||
@@ -271,8 +273,7 @@ abstract class KotlinWithGradleConfigurator : KotlinProjectConfigurator {
|
|||||||
if (state != LanguageFeature.State.DISABLED && getRuntimeLibraryVersion(module).toApiVersion() < sinceVersion) {
|
if (state != LanguageFeature.State.DISABLED && getRuntimeLibraryVersion(module).toApiVersion() < sinceVersion) {
|
||||||
Messages.showErrorDialog(
|
Messages.showErrorDialog(
|
||||||
module.project,
|
module.project,
|
||||||
"${feature.presentableName} support requires version $sinceVersion or later of the Kotlin runtime library. " +
|
KotlinIdeaGradleBundle.message("error.text.support.requires.version", feature.presentableName, sinceVersion),
|
||||||
"Please update the version in your build script.",
|
|
||||||
ChangeCoroutineSupportFix.getFixText(state)
|
ChangeCoroutineSupportFix.getFixText(state)
|
||||||
)
|
)
|
||||||
return
|
return
|
||||||
@@ -331,7 +332,7 @@ abstract class KotlinWithGradleConfigurator : KotlinProjectConfigurator {
|
|||||||
|
|
||||||
buildScript.virtualFile?.let {
|
buildScript.virtualFile?.let {
|
||||||
createConfigureKotlinNotificationCollector(buildScript.project)
|
createConfigureKotlinNotificationCollector(buildScript.project)
|
||||||
.addMessage(it.path + " was modified")
|
.addMessage(KotlinIdeaGradleBundle.message("text.was.modified", it.path))
|
||||||
.showNotification()
|
.showNotification()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -431,7 +432,7 @@ abstract class KotlinWithGradleConfigurator : KotlinProjectConfigurator {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun findBuildGradleFile(path: String, vararg fileNames: String): File? =
|
private fun findBuildGradleFile(path: String, vararg fileNames: String): File? =
|
||||||
fileNames.asSequence().map { File(path + "/" + it) }.firstOrNull { it.exists() }
|
fileNames.asSequence().map { File("$path/$it") }.firstOrNull { it.exists() }
|
||||||
|
|
||||||
private fun File.getPsiFile(project: Project) = VfsUtil.findFileByIoFile(this, true)?.let {
|
private fun File.getPsiFile(project: Project) = VfsUtil.findFileByIoFile(this, true)?.let {
|
||||||
PsiManager.getInstance(project).findFile(it)
|
PsiManager.getInstance(project).findFile(it)
|
||||||
@@ -440,10 +441,10 @@ abstract class KotlinWithGradleConfigurator : KotlinProjectConfigurator {
|
|||||||
private fun showErrorMessage(project: Project, message: String?) {
|
private fun showErrorMessage(project: Project, message: String?) {
|
||||||
Messages.showErrorDialog(
|
Messages.showErrorDialog(
|
||||||
project,
|
project,
|
||||||
"<html>Couldn't configure kotlin-gradle plugin automatically.<br/>" +
|
"<html>" + KotlinIdeaGradleBundle.message("text.couldn.t.configure.kotlin.gradle.plugin.automatically") + "<br/>" +
|
||||||
(if (message != null) message + "<br/>" else "") +
|
(if (message != null) "$message<br/>" else "") +
|
||||||
"<br/>See manual installation instructions <a href=\"https://kotlinlang.org/docs/reference/using-gradle.html\">here</a>.</html>",
|
"<br/>${KotlinIdeaGradleBundle.message("text.see.manual.installation.instructions")}</html>",
|
||||||
"Configure Kotlin-Gradle Plugin"
|
KotlinIdeaGradleBundle.message("title.configure.kotlin.gradle.plugin")
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ import com.intellij.openapi.extensions.PluginId
|
|||||||
import com.intellij.openapi.project.ProjectManager
|
import com.intellij.openapi.project.ProjectManager
|
||||||
import com.intellij.openapi.updateSettings.impl.pluginsAdvertisement.PluginsAdvertiser
|
import com.intellij.openapi.updateSettings.impl.pluginsAdvertisement.PluginsAdvertiser
|
||||||
import com.intellij.util.PlatformUtils
|
import com.intellij.util.PlatformUtils
|
||||||
|
import org.jetbrains.kotlin.idea.KotlinIdeaGradleBundle
|
||||||
|
|
||||||
const val NATIVE_DEBUG_ID = "com.intellij.nativeDebug"
|
const val NATIVE_DEBUG_ID = "com.intellij.nativeDebug"
|
||||||
|
|
||||||
@@ -27,10 +28,10 @@ fun suggestNativeDebug(projectPath: String) {
|
|||||||
val project = ProjectManager.getInstance().openProjects.firstOrNull { it.basePath == projectPath } ?: return
|
val project = ProjectManager.getInstance().openProjects.firstOrNull { it.basePath == projectPath } ?: return
|
||||||
|
|
||||||
PluginsAdvertiser.NOTIFICATION_GROUP.createNotification(
|
PluginsAdvertiser.NOTIFICATION_GROUP.createNotification(
|
||||||
"Plugins Suggestion",
|
KotlinIdeaGradleBundle.message("title.plugin.suggestion"),
|
||||||
"Native Debug provides debugger for Kotlin/Native",
|
KotlinIdeaGradleBundle.message("notification.text.native.debug.provides.debugger.for.kotlin.native"),
|
||||||
NotificationType.INFORMATION, null
|
NotificationType.INFORMATION, null
|
||||||
).addAction(object : NotificationAction("Install") {
|
).addAction(object : NotificationAction(KotlinIdeaGradleBundle.message("action.text.install")) {
|
||||||
override fun actionPerformed(e: AnActionEvent, notification: Notification) {
|
override fun actionPerformed(e: AnActionEvent, notification: Notification) {
|
||||||
PluginsAdvertiser.installAndEnablePlugins(setOf(NATIVE_DEBUG_ID)) { notification.expire() }
|
PluginsAdvertiser.installAndEnablePlugins(setOf(NATIVE_DEBUG_ID)) { notification.expire() }
|
||||||
}
|
}
|
||||||
|
|||||||
+4
-3
@@ -14,6 +14,7 @@ import com.intellij.openapi.extensions.PluginId
|
|||||||
import com.intellij.openapi.project.ProjectManager
|
import com.intellij.openapi.project.ProjectManager
|
||||||
import com.intellij.openapi.updateSettings.impl.pluginsAdvertisement.PluginsAdvertiser
|
import com.intellij.openapi.updateSettings.impl.pluginsAdvertisement.PluginsAdvertiser
|
||||||
import com.intellij.util.PlatformUtils
|
import com.intellij.util.PlatformUtils
|
||||||
|
import org.jetbrains.kotlin.idea.KotlinIdeaGradleBundle
|
||||||
|
|
||||||
const val NATIVE_DEBUG_ID = "com.intellij.nativeDebug"
|
const val NATIVE_DEBUG_ID = "com.intellij.nativeDebug"
|
||||||
|
|
||||||
@@ -26,10 +27,10 @@ fun suggestNativeDebug(projectPath: String) {
|
|||||||
val project = ProjectManager.getInstance().openProjects.firstOrNull { it.basePath == projectPath } ?: return
|
val project = ProjectManager.getInstance().openProjects.firstOrNull { it.basePath == projectPath } ?: return
|
||||||
|
|
||||||
PluginsAdvertiser.NOTIFICATION_GROUP.createNotification(
|
PluginsAdvertiser.NOTIFICATION_GROUP.createNotification(
|
||||||
"Plugins Suggestion",
|
KotlinIdeaGradleBundle.message("title.plugin.suggestion"),
|
||||||
"Native Debug provides debugger for Kotlin/Native",
|
KotlinIdeaGradleBundle.message("notification.text.native.debug.provides.debugger.for.kotlin.native"),
|
||||||
NotificationType.INFORMATION, null
|
NotificationType.INFORMATION, null
|
||||||
).addAction(object : NotificationAction("Install") {
|
).addAction(object : NotificationAction(KotlinIdeaGradleBundle.message("action.text.install")) {
|
||||||
override fun actionPerformed(e: AnActionEvent, notification: Notification) {
|
override fun actionPerformed(e: AnActionEvent, notification: Notification) {
|
||||||
PluginsAdvertiser.installAndEnablePlugins(setOf(NATIVE_DEBUG_ID)) { notification.expire() }
|
PluginsAdvertiser.installAndEnablePlugins(setOf(NATIVE_DEBUG_ID)) { notification.expire() }
|
||||||
}
|
}
|
||||||
|
|||||||
+3
-3
@@ -17,6 +17,7 @@
|
|||||||
package org.jetbrains.kotlin.idea.inspections.gradle
|
package org.jetbrains.kotlin.idea.inspections.gradle
|
||||||
|
|
||||||
import org.jetbrains.annotations.TestOnly
|
import org.jetbrains.annotations.TestOnly
|
||||||
|
import org.jetbrains.kotlin.idea.KotlinIdeaGradleBundle
|
||||||
import org.jetbrains.kotlin.idea.inspections.PluginVersionDependentInspection
|
import org.jetbrains.kotlin.idea.inspections.PluginVersionDependentInspection
|
||||||
import org.jetbrains.kotlin.idea.versions.bundledRuntimeVersion
|
import org.jetbrains.kotlin.idea.versions.bundledRuntimeVersion
|
||||||
import org.jetbrains.kotlin.psi.psiUtil.getStrictParentOfType
|
import org.jetbrains.kotlin.psi.psiUtil.getStrictParentOfType
|
||||||
@@ -36,9 +37,8 @@ class DifferentKotlinGradleVersionInspection : BaseInspection(), PluginVersionDe
|
|||||||
|
|
||||||
override fun getGroupDisplayName() = PROBABLE_BUGS
|
override fun getGroupDisplayName() = PROBABLE_BUGS
|
||||||
|
|
||||||
override fun buildErrorString(vararg args: Any): String {
|
override fun buildErrorString(vararg args: Any): String =
|
||||||
return "Kotlin version that is used for building with Gradle (${args[0]}) differs from the one bundled into the IDE plugin (${args[1]})"
|
KotlinIdeaGradleBundle.message("error.text.different.kotlin.gradle.version", args[0], args[1])
|
||||||
}
|
|
||||||
|
|
||||||
private abstract class VersionFinder : KotlinGradleInspectionVisitor() {
|
private abstract class VersionFinder : KotlinGradleInspectionVisitor() {
|
||||||
protected abstract fun onFound(kotlinPluginVersion: String, kotlinPluginStatement: GrCallExpression)
|
protected abstract fun onFound(kotlinPluginVersion: String, kotlinPluginStatement: GrCallExpression)
|
||||||
|
|||||||
+2
-1
@@ -19,6 +19,7 @@ package org.jetbrains.kotlin.idea.inspections.gradle
|
|||||||
import com.intellij.openapi.externalSystem.model.ProjectKeys
|
import com.intellij.openapi.externalSystem.model.ProjectKeys
|
||||||
import com.intellij.openapi.roots.ProjectRootManager
|
import com.intellij.openapi.roots.ProjectRootManager
|
||||||
import com.intellij.psi.PsiFile
|
import com.intellij.psi.PsiFile
|
||||||
|
import org.jetbrains.kotlin.idea.KotlinIdeaGradleBundle
|
||||||
import org.jetbrains.kotlin.idea.configuration.KOTLIN_GROUP_ID
|
import org.jetbrains.kotlin.idea.configuration.KOTLIN_GROUP_ID
|
||||||
import org.jetbrains.kotlin.idea.inspections.gradle.GradleHeuristicHelper.PRODUCTION_DEPENDENCY_STATEMENTS
|
import org.jetbrains.kotlin.idea.inspections.gradle.GradleHeuristicHelper.PRODUCTION_DEPENDENCY_STATEMENTS
|
||||||
import org.jetbrains.kotlin.idea.platform.tooling
|
import org.jetbrains.kotlin.idea.platform.tooling
|
||||||
@@ -34,7 +35,7 @@ class DifferentStdlibGradleVersionInspection : BaseInspection() {
|
|||||||
override fun buildVisitor(): BaseInspectionVisitor = MyVisitor(KOTLIN_GROUP_ID, JvmIdePlatformKind.tooling.mavenLibraryIds)
|
override fun buildVisitor(): BaseInspectionVisitor = MyVisitor(KOTLIN_GROUP_ID, JvmIdePlatformKind.tooling.mavenLibraryIds)
|
||||||
|
|
||||||
override fun buildErrorString(vararg args: Any) =
|
override fun buildErrorString(vararg args: Any) =
|
||||||
"Plugin version (${args[0]}) is not the same as library version (${args[1]})"
|
KotlinIdeaGradleBundle.message("error.text.different.kotlin.library.version", args[0], args[1])
|
||||||
|
|
||||||
private abstract class VersionFinder(private val groupId: String, private val libraryIds: List<String>) :
|
private abstract class VersionFinder(private val groupId: String, private val libraryIds: List<String>) :
|
||||||
KotlinGradleInspectionVisitor() {
|
KotlinGradleInspectionVisitor() {
|
||||||
|
|||||||
+15
-8
@@ -10,6 +10,7 @@ import com.intellij.openapi.diagnostic.Logger
|
|||||||
import com.intellij.openapi.externalSystem.util.ExternalSystemApiUtil
|
import com.intellij.openapi.externalSystem.util.ExternalSystemApiUtil
|
||||||
import com.intellij.openapi.project.Project
|
import com.intellij.openapi.project.Project
|
||||||
import com.intellij.util.EnvironmentUtil
|
import com.intellij.util.EnvironmentUtil
|
||||||
|
import org.jetbrains.kotlin.idea.KotlinIdeaGradleBundle
|
||||||
import org.jetbrains.kotlin.idea.core.script.ScriptDefinitionSourceAsContributor
|
import org.jetbrains.kotlin.idea.core.script.ScriptDefinitionSourceAsContributor
|
||||||
import org.jetbrains.kotlin.idea.core.script.ScriptDefinitionsManager
|
import org.jetbrains.kotlin.idea.core.script.ScriptDefinitionsManager
|
||||||
import org.jetbrains.kotlin.idea.core.script.loadDefinitionsFromTemplates
|
import org.jetbrains.kotlin.idea.core.script.loadDefinitionsFromTemplates
|
||||||
@@ -184,10 +185,11 @@ class GradleScriptDefinitionsContributor(private val project: Project) : ScriptD
|
|||||||
}
|
}
|
||||||
|
|
||||||
val gradleSettings = ExternalSystemApiUtil.getSettings(project, GradleConstants.SYSTEM_ID)
|
val gradleSettings = ExternalSystemApiUtil.getSettings(project, GradleConstants.SYSTEM_ID)
|
||||||
if (gradleSettings.getLinkedProjectsSettings().isEmpty()) error("Project '${project.name}' isn't linked with Gradle")
|
if (gradleSettings.getLinkedProjectsSettings().isEmpty())
|
||||||
|
error(KotlinIdeaGradleBundle.message("error.text.project.isn.t.linked.with.gradle", project.name))
|
||||||
|
|
||||||
val projectSettings = gradleSettings.getLinkedProjectsSettings().filterIsInstance<GradleProjectSettings>().firstOrNull()
|
val projectSettings = gradleSettings.getLinkedProjectsSettings().filterIsInstance<GradleProjectSettings>().firstOrNull()
|
||||||
?: error("Project '${project.name}' isn't linked with Gradle")
|
?: error(KotlinIdeaGradleBundle.message("error.text.project.isn.t.linked.with.gradle", project.name))
|
||||||
|
|
||||||
val gradleExeSettings = ExternalSystemApiUtil.getExecutionSettings<GradleExecutionSettings>(
|
val gradleExeSettings = ExternalSystemApiUtil.getExecutionSettings<GradleExecutionSettings>(
|
||||||
project,
|
project,
|
||||||
@@ -195,15 +197,17 @@ class GradleScriptDefinitionsContributor(private val project: Project) : ScriptD
|
|||||||
GradleConstants.SYSTEM_ID
|
GradleConstants.SYSTEM_ID
|
||||||
)
|
)
|
||||||
|
|
||||||
val gradleHome = gradleExeSettings.gradleHome ?: error("Unable to get Gradle home directory")
|
val gradleHome = gradleExeSettings.gradleHome
|
||||||
|
?: error(KotlinIdeaGradleBundle.message("error.text.unable.to.get.gradle.home.directory"))
|
||||||
|
|
||||||
val gradleLibDir = File(gradleHome, "lib").let {
|
val gradleLibDir = File(gradleHome, "lib").let {
|
||||||
it.takeIf { it.exists() && it.isDirectory } ?: error("Invalid Gradle libraries directory $it")
|
it.takeIf { it.exists() && it.isDirectory }
|
||||||
|
?: error(KotlinIdeaGradleBundle.message("error.text.invalid.gradle.libraries.directory", it))
|
||||||
}
|
}
|
||||||
val templateClasspath = gradleLibDir.listFiles { it ->
|
val templateClasspath = gradleLibDir.listFiles { it ->
|
||||||
/* an inference problem without explicit 'it', TODO: remove when fixed */
|
/* an inference problem without explicit 'it', TODO: remove when fixed */
|
||||||
dependencySelector.matches(it.name)
|
dependencySelector.matches(it.name)
|
||||||
}.takeIf { it.isNotEmpty() }?.asList() ?: error("Missing jars in gradle directory")
|
}.takeIf { it.isNotEmpty() }?.asList() ?: error(KotlinIdeaGradleBundle.message("error.text.missing.jars.in.gradle.directory"))
|
||||||
|
|
||||||
return loadDefinitionsFromTemplates(
|
return loadDefinitionsFromTemplates(
|
||||||
listOf(templateClass),
|
listOf(templateClass),
|
||||||
@@ -251,7 +255,7 @@ class GradleScriptDefinitionsContributor(private val project: Project) : ScriptD
|
|||||||
private const val KOTLIN_DSL_SCRIPT_EXTENSION = "gradle.kts"
|
private const val KOTLIN_DSL_SCRIPT_EXTENSION = "gradle.kts"
|
||||||
}
|
}
|
||||||
|
|
||||||
override val name: String = "Default Kotlin Gradle Script"
|
override val name: String = KotlinIdeaGradleBundle.message("text.default.kotlin.gradle.script")
|
||||||
override val fileExtension: String =
|
override val fileExtension: String =
|
||||||
KOTLIN_DSL_SCRIPT_EXTENSION
|
KOTLIN_DSL_SCRIPT_EXTENSION
|
||||||
|
|
||||||
@@ -274,9 +278,12 @@ class GradleScriptDefinitionsContributor(private val project: Project) : ScriptD
|
|||||||
private class ErrorScriptDependenciesResolver(private val message: String? = null) : DependenciesResolver {
|
private class ErrorScriptDependenciesResolver(private val message: String? = null) : DependenciesResolver {
|
||||||
override fun resolve(scriptContents: ScriptContents, environment: Environment): ResolveResult {
|
override fun resolve(scriptContents: ScriptContents, environment: Environment): ResolveResult {
|
||||||
val failureMessage = if (GradleScriptDefinitionsUpdater.gradleState.isSyncInProgress) {
|
val failureMessage = if (GradleScriptDefinitionsUpdater.gradleState.isSyncInProgress) {
|
||||||
"Highlighting is impossible during Gradle Import"
|
KotlinIdeaGradleBundle.message("error.text.highlighting.is.impossible.during.gradle.import")
|
||||||
} else {
|
} else {
|
||||||
message ?: "Failed to load script definitions by ${GradleScriptDefinitionsContributor::class.java.name}"
|
message ?: KotlinIdeaGradleBundle.message(
|
||||||
|
"error.text.failed.to.load.script.definitions.by",
|
||||||
|
GradleScriptDefinitionsContributor::class.java.name
|
||||||
|
)
|
||||||
}
|
}
|
||||||
return ResolveResult.Failure(ScriptReport(failureMessage, ScriptReport.Severity.FATAL))
|
return ResolveResult.Failure(ScriptReport(failureMessage, ScriptReport.Severity.FATAL))
|
||||||
}
|
}
|
||||||
|
|||||||
+8
-5
@@ -13,6 +13,7 @@ import com.intellij.openapi.vfs.VirtualFile
|
|||||||
import com.intellij.ui.EditorNotificationPanel
|
import com.intellij.ui.EditorNotificationPanel
|
||||||
import com.intellij.ui.EditorNotifications
|
import com.intellij.ui.EditorNotifications
|
||||||
import org.jetbrains.kotlin.idea.KotlinFileType
|
import org.jetbrains.kotlin.idea.KotlinFileType
|
||||||
|
import org.jetbrains.kotlin.idea.KotlinIdeaGradleBundle
|
||||||
import org.jetbrains.kotlin.idea.core.script.ScriptConfigurationManager
|
import org.jetbrains.kotlin.idea.core.script.ScriptConfigurationManager
|
||||||
|
|
||||||
class GradleScriptOutOfSourceNotificationProvider(private val project: Project) : EditorNotifications.Provider<EditorNotificationPanel>() {
|
class GradleScriptOutOfSourceNotificationProvider(private val project: Project) : EditorNotifications.Provider<EditorNotificationPanel>() {
|
||||||
@@ -25,16 +26,18 @@ class GradleScriptOutOfSourceNotificationProvider(private val project: Project)
|
|||||||
if (isInAffectedGradleProjectFiles(project, file.path)) return null
|
if (isInAffectedGradleProjectFiles(project, file.path)) return null
|
||||||
|
|
||||||
return EditorNotificationPanel().apply {
|
return EditorNotificationPanel().apply {
|
||||||
text("The associated Gradle Project isn't imported.")
|
text(KotlinIdeaGradleBundle.message("text.the.associated.gradle.project.isn.t.imported"))
|
||||||
createActionLabel("Load script configuration") {
|
val loadScriptConfigurationText = KotlinIdeaGradleBundle.message("action.label.text.load.script.configuration")
|
||||||
|
createActionLabel(loadScriptConfigurationText) {
|
||||||
ScriptConfigurationManager.getInstance(project).forceReloadConfiguration(file, loaderForOutOfProjectScripts)
|
ScriptConfigurationManager.getInstance(project).forceReloadConfiguration(file, loaderForOutOfProjectScripts)
|
||||||
}
|
}
|
||||||
val link = createActionLabel("") {}
|
val link = createActionLabel("") {}
|
||||||
link.setIcon(AllIcons.General.ContextHelp)
|
link.setIcon(AllIcons.General.ContextHelp)
|
||||||
link.setUseIconAsLink(true)
|
link.setUseIconAsLink(true)
|
||||||
link.toolTipText = "The external Gradle project needs to be imported to get this script analyzed. <br/>" +
|
link.toolTipText = KotlinIdeaGradleBundle.message(
|
||||||
"You can import the related Gradle project or click \"Load script configuration\" " +
|
"tool.tip.text.the.external.gradle.project.needs.to.be.imported.to.get.this.script.analyzed",
|
||||||
"to get code insight without importing."
|
loadScriptConfigurationText
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+2
-1
@@ -22,6 +22,7 @@ import com.intellij.openapi.project.Project
|
|||||||
import com.intellij.openapi.vfs.VfsUtil
|
import com.intellij.openapi.vfs.VfsUtil
|
||||||
import com.intellij.openapi.vfs.VirtualFile
|
import com.intellij.openapi.vfs.VirtualFile
|
||||||
import com.intellij.pom.Navigatable
|
import com.intellij.pom.Navigatable
|
||||||
|
import org.jetbrains.kotlin.idea.KotlinIdeaGradleBundle
|
||||||
import org.jetbrains.kotlin.idea.core.script.ScriptConfigurationManager
|
import org.jetbrains.kotlin.idea.core.script.ScriptConfigurationManager
|
||||||
import org.jetbrains.kotlin.idea.core.script.configuration.cache.CachedConfigurationInputs
|
import org.jetbrains.kotlin.idea.core.script.configuration.cache.CachedConfigurationInputs
|
||||||
import org.jetbrains.kotlin.idea.core.script.configuration.cache.ScriptConfigurationSnapshot
|
import org.jetbrains.kotlin.idea.core.script.configuration.cache.ScriptConfigurationSnapshot
|
||||||
@@ -116,7 +117,7 @@ class KotlinDslScriptModelDataService : AbstractProjectDataService<ProjectData,
|
|||||||
project: Project
|
project: Project
|
||||||
) {
|
) {
|
||||||
val notification = NotificationData(
|
val notification = NotificationData(
|
||||||
"Kotlin Build Script",
|
KotlinIdeaGradleBundle.message("title.kotlin.build.script"),
|
||||||
message.text,
|
message.text,
|
||||||
when (message.severity) {
|
when (message.severity) {
|
||||||
KotlinDslScriptModel.Severity.WARNING -> NotificationCategory.WARNING
|
KotlinDslScriptModel.Severity.WARNING -> NotificationCategory.WARNING
|
||||||
|
|||||||
Reference in New Issue
Block a user