diff --git a/build.gradle.kts b/build.gradle.kts index e59a812e..9e7dd881 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -89,17 +89,17 @@ fun getVersionString(baseVersion: String): String { if (System.getenv("PUBLISH_EAP") != "1" && tag.isNotEmpty() && tag.contains(baseVersion)) return baseVersion + val branch = "git rev-parse --abbrev-ref HEAD".runCommand(workingDir = rootDir) + val numberOfCommits = if (branch == "main") { + val lastTag = "git describe --tags --abbrev=0 @^".runCommand(workingDir = rootDir) + "git rev-list ${lastTag}..HEAD --count".runCommand(workingDir = rootDir) + } else { + "git rev-list --count HEAD ^origin/main".runCommand(workingDir = rootDir) + } val commitId = "git rev-parse --short=8 HEAD".runCommand(workingDir = rootDir) return if (System.getenv("PUBLISH_EAP") == "1") { - "$baseVersion-eap-$commitId" + "$baseVersion.$numberOfCommits-eap-$commitId" } else { - val branch = "git rev-parse --abbrev-ref HEAD".runCommand(workingDir = rootDir) - val numberOfCommits = if (branch == "main") { - val lastTag = "git describe --tags --abbrev=0 @^".runCommand(workingDir = rootDir) - "git rev-list ${lastTag}..HEAD --count".runCommand(workingDir = rootDir) - } else { - "git rev-list --count HEAD ^origin/main".runCommand(workingDir = rootDir) - } "$baseVersion-$branch-$numberOfCommits-$commitId" } } diff --git a/src/main/kotlin/com/smallcloud/refactai/PluginErrorReportSubmitter.kt b/src/main/kotlin/com/smallcloud/refactai/PluginErrorReportSubmitter.kt index e5aa426e..6a15fa4a 100644 --- a/src/main/kotlin/com/smallcloud/refactai/PluginErrorReportSubmitter.kt +++ b/src/main/kotlin/com/smallcloud/refactai/PluginErrorReportSubmitter.kt @@ -12,6 +12,7 @@ import com.smallcloud.refactai.struct.DeploymentMode import java.awt.Component import java.net.URLEncoder import com.smallcloud.refactai.io.InferenceGlobalContext.Companion.instance as InferenceGlobalContext +import com.smallcloud.refactai.lsp.LSPProcessHolder.Companion.instance as LSPProcessHolder private fun String.urlEncoded(): String = URLEncoder.encode(this, "UTF-8") @@ -42,6 +43,7 @@ class PluginErrorReportSubmitter : ErrorReportSubmitter(), Disposable { "; Vendor: " + properties.getProperty("java.vendor", "unknown") val os = SystemInfo.getOsNameAndVersion() val arch = SystemInfo.OS_ARCH + var buildInfo = LSPProcessHolder.buildInfo() val issueBody = """ |An internal error happened in the IDE plugin. | @@ -59,6 +61,7 @@ class PluginErrorReportSubmitter : ErrorReportSubmitter(), Disposable { |- OS: $os |- ARCH: $arch |- MODE: $mode + |- LSP BUILD INFO: $buildInfo | |### Additional information |${additionalInfo.orEmpty()} diff --git a/src/main/kotlin/com/smallcloud/refactai/lsp/LSPProcessHolder.kt b/src/main/kotlin/com/smallcloud/refactai/lsp/LSPProcessHolder.kt index f481cb4f..8ae3f0bf 100644 --- a/src/main/kotlin/com/smallcloud/refactai/lsp/LSPProcessHolder.kt +++ b/src/main/kotlin/com/smallcloud/refactai/lsp/LSPProcessHolder.kt @@ -128,7 +128,7 @@ class LSPProcessHolder: Disposable { address = address, apiKey = AccountManager.apiKey, port = (32000..32199).random(), - clientVersion = "${Resources.client}-${Resources.version}", + clientVersion = "${Resources.client}-${Resources.version}/${Resources.jbBuildVersion}", useTelemetry = true, deployment = InferenceGlobalContext.deploymentMode ) @@ -226,6 +226,21 @@ class LSPProcessHolder: Disposable { schedulerCaps.shutdown() } + fun buildInfo(): String { + var res = "" + InferenceGlobalContext.connection.get(url.resolve("/build_info"), + dataReceiveEnded = {}, + errorDataReceived = {}).also { + try { + res = it.get().get() as String + logger.debug("build_info request finished") + } catch (e: Exception) { + logger.debug("build_info ${e.message}") + } + } + return res + } + val url: URI get() { val port = xDebugLSPPort?: lastConfig?.port ?: return URI("")