diff --git a/intellij-plugin/hs-Go/build.gradle.kts b/intellij-plugin/hs-Go/build.gradle.kts index e4c0ba014..8969ac6a0 100644 --- a/intellij-plugin/hs-Go/build.gradle.kts +++ b/intellij-plugin/hs-Go/build.gradle.kts @@ -2,6 +2,21 @@ plugins { id("intellij-plugin-module-conventions") } +// Almost all Go plugin classes we use (`GoSdk`, `GoSdkList`, `GoSdkService`, `GoTestRunConfiguration`, etc.) +// live in its `intellij.go.impl` content module. Since 2026.3 the module is no longer embedded: +// it has its own classloader, so it must be declared explicitly, or every Go course fails with `NoClassDefFoundError`. +// In 2025.3-2026.2 the module is embedded, so a dependency on the Go plugin is enough. +// In 2025.2 the module doesn't exist, and declaring it would stop `hs-Go` from loading +private val goModuleDependenciesMarker = "" +private val goModuleDependencies = if (environmentName.toInt() >= 263) { + listOf( + "intellij.go.impl", + ).joinToString("\n") { " " } +} +else { + "" +} + dependencies { intellijPlatform { intellijIde(ideaVersion) @@ -17,3 +32,12 @@ dependencies { testImplementation(project(":intellij-plugin:hs-core", "testOutput")) } + +tasks.processResources { + inputs.property("goModuleDependencies", goModuleDependencies) + filesMatching("hs-Go.xml") { + filter { line -> + if (goModuleDependenciesMarker in line) goModuleDependencies else line + } + } +} diff --git a/intellij-plugin/hs-Go/resources/hs-Go.xml b/intellij-plugin/hs-Go/resources/hs-Go.xml index b9589e5a7..80043ec2e 100644 --- a/intellij-plugin/hs-Go/resources/hs-Go.xml +++ b/intellij-plugin/hs-Go/resources/hs-Go.xml @@ -2,6 +2,8 @@ + + diff --git a/intellij-plugin/hs-Go/resources/messages/EduGoBundle.properties b/intellij-plugin/hs-Go/resources/messages/EduGoBundle.properties index 97c381401..f1dd52b47 100644 --- a/intellij-plugin/hs-Go/resources/messages/EduGoBundle.properties +++ b/intellij-plugin/hs-Go/resources/messages/EduGoBundle.properties @@ -5,3 +5,6 @@ error.invalid.name=Name contains forbidden symbols error.no.sdk=Specify Go SDK. Learn how to configure Go SDK here error.invalid.sdk=Go SDK is invalid. Specify another Go SDK. Learn how to configure Go SDK here error.invalid.sdk.location=Go SDK can't be in the course directory. Specify another Go SDK. Learn how to configure Go SDK here + +# Progress +progress.title.discovering.go.sdks=Discovering Go SDKs... diff --git a/intellij-plugin/hs-Go/src/org/hyperskill/academy/go/GoSdkReloadService.kt b/intellij-plugin/hs-Go/src/org/hyperskill/academy/go/GoSdkReloadService.kt index e2e3791fb..61cc9e3f7 100644 --- a/intellij-plugin/hs-Go/src/org/hyperskill/academy/go/GoSdkReloadService.kt +++ b/intellij-plugin/hs-Go/src/org/hyperskill/academy/go/GoSdkReloadService.kt @@ -1,11 +1,11 @@ package org.hyperskill.academy.go -import com.goide.i18n.GoBundle import com.goide.sdk.GoSdk import com.goide.sdk.combobox.GoSdkList import com.intellij.openapi.components.Service import com.intellij.openapi.progress.ProgressIndicator import com.intellij.openapi.progress.Task +import org.hyperskill.academy.go.messages.EduGoBundle import java.util.concurrent.atomic.AtomicBoolean @Service(Service.Level.APP) @@ -25,7 +25,8 @@ class GoSdkLoadService { @Suppress("UsagesOfObsoleteApi") // `Task.Backgroundable` is used on purpose private fun reloadSdks(action: (List) -> Unit) = - object : Task.Backgroundable(null, GoBundle.message("go.settings.sdk.discovering.go.sdks.progress.title"), true) { + // The title has its own key: the Go plugin's `GoBundle` key for it was removed in 2027.1 (GO-11779) + object : Task.Backgroundable(null, EduGoBundle.message("progress.title.discovering.go.sdks"), true) { override fun run(indicator: ProgressIndicator) { require(isStarted.get()) { "isStarted lock must be acquired" diff --git a/intellij-plugin/hs-core/src/org/hyperskill/academy/learning/newproject/coursesStorage/CoursesStorage.kt b/intellij-plugin/hs-core/src/org/hyperskill/academy/learning/newproject/coursesStorage/CoursesStorage.kt index 215d1cc27..fb05877f5 100644 --- a/intellij-plugin/hs-core/src/org/hyperskill/academy/learning/newproject/coursesStorage/CoursesStorage.kt +++ b/intellij-plugin/hs-core/src/org/hyperskill/academy/learning/newproject/coursesStorage/CoursesStorage.kt @@ -1,49 +1,21 @@ package org.hyperskill.academy.learning.newproject.coursesStorage import com.intellij.openapi.components.* -import com.intellij.openapi.wm.impl.welcomeScreen.learnIde.coursesInProgress.CourseDataStorage -import com.intellij.openapi.wm.impl.welcomeScreen.learnIde.coursesInProgress.CourseInfo import org.hyperskill.academy.learning.EduTestAware -import org.hyperskill.academy.learning.courseFormat.Course -import org.hyperskill.academy.learning.courseFormat.CourseMode import org.hyperskill.academy.learning.newproject.ui.welcomeScreen.JBACourseFromStorage import org.jetbrains.annotations.TestOnly +// It doesn't implement the platform's `CourseDataStorage`: nothing registers it as a `coursesStorageProvider` for the welcome screen Learn tab, +// and since 2027.1 that API lives in the separate `intellij.platform.ide.learnIde` module, so referencing it broke Browse Courses @State(name = "HyperskillCoursesStorage", storages = [Storage("hsCoursesStorage.xml", roamingType = RoamingType.DISABLED)]) @Service -class CoursesStorage : CourseDataStorage, CoursesStorageBase(), EduTestAware { +class CoursesStorage : CoursesStorageBase(), EduTestAware { - override fun getCoursePath(course: Course): String? = getCoursePath(JBACourseFromStorage().apply { - this.name = course.name - this.id = course.id - this.courseMode = course.courseMode - this.languageId = course.languageId - this.languageVersion = course.languageVersion - }) - - private fun getCourseMetaInfo(name: String, id: Int, courseMode: CourseMode, languageId: String): JBACourseFromStorage? { - return state.courses.find { - it.name == name - && it.id == id - && it.courseMode == courseMode - && it.languageId == languageId - } - } - - override fun getCoursePath(courseInfo: CourseInfo): String? { - return if (courseInfo is JBACourseFromStorage) { - getCourseMetaInfo(courseInfo.name, courseInfo.id, courseInfo.courseMode, courseInfo.languageId)?.location - } - else { - null - } - } - - override fun removeCourseByLocation(location: String): Boolean { + fun removeCourseByLocation(location: String): Boolean { return super.doRemoveCourseByLocation(location) } - override fun getAllCourses(): List { + fun getAllCourses(): List { return state.courses } @@ -55,4 +27,4 @@ class CoursesStorage : CourseDataStorage, CoursesStorageBase(), EduTestAware { companion object { fun getInstance(): CoursesStorage = service() } -} \ No newline at end of file +} diff --git a/intellij-plugin/hs-core/src/org/hyperskill/academy/learning/newproject/ui/welcomeScreen/JBACourseFromStorage.kt b/intellij-plugin/hs-core/src/org/hyperskill/academy/learning/newproject/ui/welcomeScreen/JBACourseFromStorage.kt index 07b8a9e90..b09bb5e45 100644 --- a/intellij-plugin/hs-core/src/org/hyperskill/academy/learning/newproject/ui/welcomeScreen/JBACourseFromStorage.kt +++ b/intellij-plugin/hs-core/src/org/hyperskill/academy/learning/newproject/ui/welcomeScreen/JBACourseFromStorage.kt @@ -1,7 +1,6 @@ package org.hyperskill.academy.learning.newproject.ui.welcomeScreen import com.intellij.openapi.vfs.LocalFileSystem -import com.intellij.openapi.wm.impl.welcomeScreen.learnIde.coursesInProgress.CourseInfo import com.intellij.util.SlowOperations import com.intellij.util.xmlb.annotations.OptionTag import com.intellij.util.xmlb.annotations.Tag @@ -10,15 +9,22 @@ import org.hyperskill.academy.learning.EduNames import org.hyperskill.academy.learning.courseFormat.Course import org.hyperskill.academy.learning.courseFormat.CourseMode import org.hyperskill.academy.learning.courseFormat.hyperskill.HyperskillCourse -import org.hyperskill.academy.learning.newproject.ui.logo -import javax.swing.Icon private const val PROGRAMMING_LANGUAGE = "programmingLanguage" private const val PROGRAMMING_LANGUAGE_ID = "programmingLanguageId" private const val PROGRAMMING_LANGUAGE_VERSION = "programmingLanguageVersion" @Tag(EduNames.COURSE) -class JBACourseFromStorage() : CourseInfo() { +class JBACourseFromStorage() { + // These used to be inherited from the platform's `CourseInfo`, which moved to the separate `intellij.platform.ide.learnIde` module in 2027.1. + // The names and defaults are kept so that the stored courses read back the same + var id: Int = -1 + var name: String = "" + var description: String = "" + var location: String = "" + var tasksTotal: Int = 0 + var tasksSolved: Int = 0 + var type: String = "" var courseMode = CourseMode.STUDENT var environment = "" @@ -53,11 +59,6 @@ class JBACourseFromStorage() : CourseInfo() { // to be compatible with previous version private var programmingLanguageVersion: String? = null - override var icon: Icon? - @Transient - get() = this.toCourse().logo - set(_) {} - constructor(location: String = "", course: Course, tasksTotal: Int = 0, tasksSolved: Int = 0) : this() { this.type = course.itemType id = course.id