diff --git a/build.gradle.kts b/build.gradle.kts index cd36b275..6b533cdb 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -19,7 +19,7 @@ plugins { // Java support id("java") // Kotlin support - id("org.jetbrains.kotlin.jvm") version "1.7.20" + id("org.jetbrains.kotlin.jvm") version "1.9.0" // Gradle IntelliJ Plugin id("org.jetbrains.intellij") version "1.13.3" // Gradle Changelog Plugin @@ -47,8 +47,8 @@ dependencies { implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.4") implementation("org.jetbrains.kotlinx:kotlinx-coroutines-swing:1.6.4") - implementation("org.jetbrains.kotlin:kotlin-reflect:1.7.10") - implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.4.1") + implementation("org.jetbrains.kotlin:kotlin-reflect:1.9.0") + implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.6.0") implementation("io.ktor:ktor-client-core:$ktor_version") implementation("io.ktor:ktor-client-java:$ktor_version") diff --git a/gradle.properties b/gradle.properties index b9dd7a04..7b328280 100644 --- a/gradle.properties +++ b/gradle.properties @@ -6,10 +6,12 @@ pluginRepositoryUrl = https://github.com/Pushpavel/AutoCp pluginVersion=v0.7.10 # See https://plugins.jetbrains.com/docs/intellij/build-number-ranges.html # for insight into build numbers and IntelliJ Platform versions. -pluginSinceBuild=232 +pluginSinceBuild=241 platformType=CL -platformVersion=LATEST-EAP-SNAPSHOT +# Using not EAP now because EAP requires breaking change(Java 21 requirement from 2024.2 EAP) +platformVersion=2024.1.1 +# LATEST-EAP-SNAPSHOT # Plugin Dependencies -> https://plugins.jetbrains.com/docs/intellij/plugin-dependencies.html # Example: platformPlugins = com.intellij.java, com.jetbrains.php:203.4449.22 platformPlugins= diff --git a/src/main/kotlin/com/github/pushpavel/autocp/common/compat/autocpFile/DeleteInvalid.kt b/src/main/kotlin/com/github/pushpavel/autocp/common/compat/autocpFile/DeleteInvalid.kt index 4b4a2c10..97f15703 100644 --- a/src/main/kotlin/com/github/pushpavel/autocp/common/compat/autocpFile/DeleteInvalid.kt +++ b/src/main/kotlin/com/github/pushpavel/autocp/common/compat/autocpFile/DeleteInvalid.kt @@ -3,7 +3,7 @@ package com.github.pushpavel.autocp.common.compat.autocpFile import com.github.pushpavel.autocp.common.compat.base.AutoCpFileConverter import com.google.gson.JsonParser import com.intellij.util.io.delete -import com.intellij.util.io.readText +import kotlin.io.path.readText import java.nio.file.Path /** diff --git a/src/main/kotlin/com/github/pushpavel/autocp/common/compat/autocpFile/RelativizePaths.kt b/src/main/kotlin/com/github/pushpavel/autocp/common/compat/autocpFile/RelativizePaths.kt index da47cca2..e7a9dbbb 100644 --- a/src/main/kotlin/com/github/pushpavel/autocp/common/compat/autocpFile/RelativizePaths.kt +++ b/src/main/kotlin/com/github/pushpavel/autocp/common/compat/autocpFile/RelativizePaths.kt @@ -5,7 +5,7 @@ import com.github.pushpavel.autocp.common.res.R import com.google.gson.JsonObject import com.google.gson.JsonParser import com.intellij.openapi.project.Project -import com.intellij.util.io.readText +import kotlin.io.path.readText import com.intellij.util.io.write import java.nio.file.Path import kotlin.io.path.Path diff --git a/src/main/kotlin/com/github/pushpavel/autocp/config/actions/RunAutoCpAction.kt b/src/main/kotlin/com/github/pushpavel/autocp/config/actions/RunAutoCpAction.kt index 7bb924bd..365303a9 100644 --- a/src/main/kotlin/com/github/pushpavel/autocp/config/actions/RunAutoCpAction.kt +++ b/src/main/kotlin/com/github/pushpavel/autocp/config/actions/RunAutoCpAction.kt @@ -39,4 +39,9 @@ class RunAutoCpAction : AnAction("Run with AutoCp", "Run the currently focused f override fun update(e: AnActionEvent) { e.presentation.isEnabled = e.project != null && e.getData(CommonDataKeys.VIRTUAL_FILE) != null } + + /* TODO: I have no idea what this means but at least it works */ + override fun getActionUpdateThread(): ActionUpdateThread { + return ActionUpdateThread.EDT + } } diff --git a/src/main/kotlin/com/github/pushpavel/autocp/database/AutoCpStorage.kt b/src/main/kotlin/com/github/pushpavel/autocp/database/AutoCpStorage.kt index 8ad0166d..d5e7b097 100644 --- a/src/main/kotlin/com/github/pushpavel/autocp/database/AutoCpStorage.kt +++ b/src/main/kotlin/com/github/pushpavel/autocp/database/AutoCpStorage.kt @@ -12,18 +12,17 @@ import com.intellij.openapi.project.Project import com.intellij.openapi.project.ProjectManager import com.intellij.openapi.vfs.VfsUtil import com.intellij.psi.PsiManager -import com.intellij.util.io.readText import kotlinx.coroutines.flow.MutableStateFlow -import kotlinx.serialization.decodeFromString import kotlinx.serialization.encodeToString import kotlinx.serialization.json.Json import java.nio.file.Paths import kotlin.io.path.Path import kotlin.io.path.exists import kotlin.io.path.pathString +import kotlin.io.path.readText -@Service +@Service(Service.Level.PROJECT) class AutoCpStorage(val project: Project) { val database by lazy { diff --git a/src/main/kotlin/com/github/pushpavel/autocp/database/SolutionFiles.kt b/src/main/kotlin/com/github/pushpavel/autocp/database/SolutionFiles.kt index 180ec284..ab6407c3 100644 --- a/src/main/kotlin/com/github/pushpavel/autocp/database/SolutionFiles.kt +++ b/src/main/kotlin/com/github/pushpavel/autocp/database/SolutionFiles.kt @@ -12,7 +12,7 @@ import java.nio.file.Path import kotlin.io.path.Path import kotlin.io.path.pathString -@Service +@Service(Service.Level.PROJECT) class SolutionFiles(val project: Project) { private val db = project.autoCp() private val solutionFiles get() = db.solutionFilesFlow.value diff --git a/src/main/kotlin/com/github/pushpavel/autocp/gather/base/ProblemGatheringBridge.kt b/src/main/kotlin/com/github/pushpavel/autocp/gather/base/ProblemGatheringBridge.kt index 2279be7b..7c8584f8 100644 --- a/src/main/kotlin/com/github/pushpavel/autocp/gather/base/ProblemGatheringBridge.kt +++ b/src/main/kotlin/com/github/pushpavel/autocp/gather/base/ProblemGatheringBridge.kt @@ -5,23 +5,22 @@ import com.github.pushpavel.autocp.common.res.R import com.github.pushpavel.autocp.gather.models.ProblemJson import com.intellij.openapi.project.DumbAware import com.intellij.openapi.project.Project -import com.intellij.openapi.startup.StartupActivity +import com.intellij.openapi.startup.ProjectActivity import kotlinx.coroutines.coroutineScope import kotlinx.coroutines.delay import kotlinx.coroutines.launch import kotlinx.serialization.SerializationException -import kotlinx.serialization.decodeFromString import kotlinx.serialization.json.Json import java.net.SocketTimeoutException /** * Bridge between Competitive Companion extension and [BatchProcessor] */ -class ProblemGatheringBridge : StartupActivity, DumbAware { +class ProblemGatheringBridge : ProjectActivity, DumbAware { private val scope = ioScope() private val serializer = Json { ignoreUnknownKeys = true } - override fun runActivity(project: Project) { + fun runActivity(project: Project) { // initialize server scope.launch { try { @@ -58,4 +57,6 @@ class ProblemGatheringBridge : StartupActivity, DumbAware { } } } + + override suspend fun execute(project: Project) = runActivity(project) } diff --git a/src/main/kotlin/com/github/pushpavel/autocp/tool/ui/testcaseHeader.kt b/src/main/kotlin/com/github/pushpavel/autocp/tool/ui/testcaseHeader.kt index 7238100b..01f09523 100644 --- a/src/main/kotlin/com/github/pushpavel/autocp/tool/ui/testcaseHeader.kt +++ b/src/main/kotlin/com/github/pushpavel/autocp/tool/ui/testcaseHeader.kt @@ -41,7 +41,8 @@ fun testcaseHeader( ActionManager .getInstance() .createActionToolbar(ActionPlaces.TOOLWINDOW_CONTENT, actionGroup, true).apply { - layoutPolicy = ActionToolbar.NOWRAP_LAYOUT_POLICY + // TODO Nah?? deprecated API... + // layoutPolicy = ActionToolbar.NOWRAP_LAYOUT_POLICY targetComponent = jbPanel } .component,