gradle.kts: remove useless gradle build root kinds
This commit is contained in:
@@ -25,23 +25,43 @@ import kotlin.script.experimental.jvm.jvm
|
|||||||
sealed class GradleBuildRoot {
|
sealed class GradleBuildRoot {
|
||||||
abstract val pathPrefix: String
|
abstract val pathPrefix: String
|
||||||
|
|
||||||
abstract class Unlinked : GradleBuildRoot()
|
/**
|
||||||
|
* Add Gradle Project
|
||||||
class UnlinkedUnknown(override val pathPrefix: String) : Unlinked()
|
* for other scripts too
|
||||||
|
*
|
||||||
class UnlinkedLegacy(override val pathPrefix: String) : Unlinked()
|
* definitely not precompiled scripts (it is detected as in sources roots)
|
||||||
|
* may be also included scripts not returned by gradle: todo proper notification
|
||||||
class UnlinkedSupported(override val pathPrefix: String) : Unlinked()
|
*/
|
||||||
|
class Unlinked(override val pathPrefix: String) : GradleBuildRoot()
|
||||||
|
|
||||||
abstract class Linked : GradleBuildRoot() {
|
abstract class Linked : GradleBuildRoot() {
|
||||||
@Volatile
|
@Volatile
|
||||||
var importing = false
|
var importing = false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Notification: please update to Gradle 6.0
|
||||||
|
* default loader, cases:
|
||||||
|
* - not loaded: todo: Notification: Load configration to get code insights
|
||||||
|
* - loaded, not up-to-date: Notifaction: Reload configuraiton
|
||||||
|
* - loaded, up-to-date: Nothing
|
||||||
|
*/
|
||||||
class Legacy(override val pathPrefix: String) : Linked()
|
class Legacy(override val pathPrefix: String) : Linked()
|
||||||
|
|
||||||
|
/**
|
||||||
|
* not imported:
|
||||||
|
* Notification: Import Gradle project to get code insights
|
||||||
|
* during import:
|
||||||
|
* - todo: disable action on importing. don't miss failed import
|
||||||
|
* - pause analyzing, todo: change status text to: importing gradle project
|
||||||
|
*
|
||||||
|
* todo:
|
||||||
|
* detect precompiled scripts (in sources roots)
|
||||||
|
*/
|
||||||
class New(override val pathPrefix: String) : Linked()
|
class New(override val pathPrefix: String) : Linked()
|
||||||
|
|
||||||
|
// precompiled scripts not detected by gradle
|
||||||
|
|
||||||
class Imported(
|
class Imported(
|
||||||
val project: Project,
|
val project: Project,
|
||||||
val dir: VirtualFile,
|
val dir: VirtualFile,
|
||||||
|
|||||||
+1
-2
@@ -48,7 +48,6 @@ class GradleScriptingSupportProvider(val project: Project) : ScriptingSupport.Pr
|
|||||||
override fun isApplicable(file: VirtualFile): Boolean {
|
override fun isApplicable(file: VirtualFile): Boolean {
|
||||||
val buildRoot = findScriptBuildRoot(file) ?: return false
|
val buildRoot = findScriptBuildRoot(file) ?: return false
|
||||||
if (buildRoot is GradleBuildRoot.Legacy) return false
|
if (buildRoot is GradleBuildRoot.Legacy) return false
|
||||||
if (buildRoot is GradleBuildRoot.UnlinkedLegacy) return false
|
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -130,7 +129,7 @@ class GradleScriptingSupportProvider(val project: Project) : ScriptingSupport.Pr
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun detectUnlinkedGradleBuildRoot(file: String): GradleBuildRoot.Unlinked =
|
private fun detectUnlinkedGradleBuildRoot(file: String): GradleBuildRoot.Unlinked =
|
||||||
GradleBuildRoot.UnlinkedUnknown(file)
|
GradleBuildRoot.Unlinked(file)
|
||||||
|
|
||||||
init {
|
init {
|
||||||
getGradleProjectSettings(project).forEach {
|
getGradleProjectSettings(project).forEach {
|
||||||
|
|||||||
+1
-1
@@ -29,7 +29,7 @@ class MissingGradleScriptConfigurationNotificationProvider(private val project:
|
|||||||
if (file.fileType != KotlinFileType.INSTANCE) return null
|
if (file.fileType != KotlinFileType.INSTANCE) return null
|
||||||
|
|
||||||
return when (GradleScriptingSupportProvider.getInstance(project).findScriptBuildRoot(file)) {
|
return when (GradleScriptingSupportProvider.getInstance(project).findScriptBuildRoot(file)) {
|
||||||
is GradleBuildRoot.UnlinkedSupported -> EditorNotificationPanel().apply {
|
is GradleBuildRoot.Unlinked -> EditorNotificationPanel().apply {
|
||||||
text(KotlinIdeaGradleBundle.message("text.the.associated.gradle.project.isn.t.imported"))
|
text(KotlinIdeaGradleBundle.message("text.the.associated.gradle.project.isn.t.imported"))
|
||||||
|
|
||||||
val linkProjectText = KotlinIdeaGradleBundle.message("action.label.text.load.script.configuration")
|
val linkProjectText = KotlinIdeaGradleBundle.message("action.label.text.load.script.configuration")
|
||||||
|
|||||||
Reference in New Issue
Block a user