User: rednesto Date: 28 Sep 24 16:26 Revision: 00b9a23f0955903f61dbb0501834942ff1a49474 Summary: Merge branch '2024.1' into 2024.2 # Conflicts: # gradle/libs.versions.toml TeamCity URL: https://ci.mcdev.io/viewModification.html?tab=vcsModificationFiles&modId=9720&personal=false Index: build.gradle.kts =================================================================== --- build.gradle.kts (revision 98b7912661e2ce498ec41ede3ae40dfea10cfc84) +++ build.gradle.kts (revision 00b9a23f0955903f61dbb0501834942ff1a49474) @@ -34,7 +34,6 @@ `mcdev-publishing` } -val ideaVersionName: String by project val coreVersion: String by project val gradleToolingExtension: Configuration by configurations.creating @@ -43,7 +42,6 @@ } group = "com.demonwav.mcdev" -version = "$ideaVersionName-$coreVersion" val gradleToolingExtensionSourceSet: SourceSet = sourceSets.create("gradle-tooling-extension") { configurations.named(compileOnlyConfigurationName) { Index: buildSrc/src/main/kotlin/mcdev-core.gradle.kts =================================================================== --- buildSrc/src/main/kotlin/mcdev-core.gradle.kts (revision 98b7912661e2ce498ec41ede3ae40dfea10cfc84) +++ buildSrc/src/main/kotlin/mcdev-core.gradle.kts (revision 00b9a23f0955903f61dbb0501834942ff1a49474) @@ -32,6 +32,17 @@ id("org.cadixdev.licenser") } +val ideaVersionName: String by project +val coreVersion: String by project +val buildNumber: String? by project + +version = "$ideaVersionName-$coreVersion" + +// Build numbers are used for nightlies +if (buildNumber != null) { + version = "$version-$buildNumber" +} + java { toolchain { languageVersion.set(JavaLanguageVersion.of(21)) @@ -99,7 +110,7 @@ } testImplementation(libs.junit.api) - testCompileOnly(libs.junit.vintage) // Hack to get tests to compile and run + testImplementation(libs.junit.vintage) // Hack to get tests to compile and run testRuntimeOnly(libs.junit.engine) testRuntimeOnly(libs.junit.platform.launcher) } Index: gradle/libs.versions.toml =================================================================== --- gradle/libs.versions.toml (revision 98b7912661e2ce498ec41ede3ae40dfea10cfc84) +++ gradle/libs.versions.toml (revision 00b9a23f0955903f61dbb0501834942ff1a49474) @@ -7,7 +7,7 @@ fuel = "2.3.1" licenser = "0.6.1" changelog = "2.2.0" -intellij-plugin = "2.0.1" +intellij-plugin = "2.1.0" intellij-ide = "2024.2" idea-ext = "1.1.8" psiPlugin = "242.4697" Index: src/main/kotlin/translations/identification/TranslationExternalAnnotationsArtifactsResolver.kt =================================================================== --- src/main/kotlin/translations/identification/TranslationExternalAnnotationsArtifactsResolver.kt (revision 98b7912661e2ce498ec41ede3ae40dfea10cfc84) +++ src/main/kotlin/translations/identification/TranslationExternalAnnotationsArtifactsResolver.kt (revision 00b9a23f0955903f61dbb0501834942ff1a49474) @@ -46,7 +46,6 @@ import com.intellij.platform.workspace.jps.entities.modifyLibraryEntity import com.intellij.platform.workspace.storage.MutableEntityStorage import com.intellij.workspaceModel.ide.impl.legacyBridge.library.LibraryBridge -import com.intellij.workspaceModel.ide.impl.legacyBridge.library.ProjectLibraryTableBridgeImpl.Companion.findLibraryEntity import org.jetbrains.concurrency.AsyncPromise import org.jetbrains.concurrency.Promise import org.jetbrains.concurrency.resolvedPromise @@ -83,7 +82,7 @@ val annotationsPath = findAnnotationsPath(false) ?: findAnnotationsPath(true) ?: return false - val libraryEntity = diff.findLibraryEntity(library) ?: return true + val libraryEntity = diff.resolve(library.libraryId) ?: return true val vfUrlManager = WorkspaceModel.getInstance(project).getVirtualFileUrlManager() val newUrl = annotationsPath.toVirtualFileUrl(vfUrlManager) val annotationsRootType = LibraryRootTypeId(AnnotationOrderRootType.ANNOTATIONS_ID) Index: src/main/kotlin/util/utils.kt =================================================================== --- src/main/kotlin/util/utils.kt (revision 98b7912661e2ce498ec41ede3ae40dfea10cfc84) +++ src/main/kotlin/util/utils.kt (revision 00b9a23f0955903f61dbb0501834942ff1a49474) @@ -49,6 +49,7 @@ import com.intellij.psi.util.PsiUtil import java.lang.invoke.MethodHandles import java.util.Locale +import java.util.concurrent.CancellationException import kotlin.math.min import kotlin.reflect.KClass import org.jetbrains.annotations.NonNls @@ -358,7 +359,8 @@ return this.firstOrNull { it is T } as? T } -fun libraryKind(id: String): LibraryKind = LibraryKindRegistry.getInstance().findKindById(id) ?: LibraryKind.create(id) +fun libraryKind(id: String): Lazy = + lazy { LibraryKindRegistry.getInstance().findKindById(id) ?: LibraryKind.create(id) } fun String.capitalize(): String = replaceFirstChar { @@ -389,6 +391,19 @@ } } +fun Result.getOrLogException(logger: Logger): T? { + return getOrLogException(logger::error) +} + +inline fun Result.getOrLogException(log: (Throwable) -> Unit): T? { + return onFailure { e -> + if (e is ProcessCanceledException || e is CancellationException) { + throw e + } + log(e) + }.getOrNull() +} + fun withSuppressed(original: T?, other: T): T = original?.apply { addSuppressed(other) } ?: other