mirror of
https://gitflic.ru/project/openide/openide.git
synced 2025-12-13 06:59:44 +07:00
[remote dev] update logic which runs the frontend process in dev launcher (RDCT-1194)
It now uses IDE-specific frontend and the module-based loader to make the behavior more similar to running from a real installation. GitOrigin-RevId: 7fb6f910e938fe815167e7519ea495b56a4f113d
This commit is contained in:
committed by
intellij-monorepo-bot
parent
837cdcffe7
commit
53ff4b070b
@@ -35,7 +35,7 @@ internal sealed interface BackendLaunchResult {
|
||||
|
||||
internal fun runIdeBackend(backendDescription: IdeBackendInEnvDescription, coroutineScope: CoroutineScope): BackendLaunchResult {
|
||||
val projectPath = backendDescription.ideBackendDescription.projectPath
|
||||
val mainModule = backendDescription.ideBackendDescription.product.mainModule
|
||||
val mainModule = backendDescription.ideBackendDescription.product.backendMainModule
|
||||
val paths = IdeaPathsProvider()
|
||||
val classpathCollector = classpathCollector(
|
||||
localPaths = paths,
|
||||
|
||||
@@ -11,11 +11,7 @@ internal object IdeConstants {
|
||||
*/
|
||||
const val JETBRAINS_CLIENT_PREFIX = "JetBrainsClient"
|
||||
|
||||
/**
|
||||
* See `com.jetbrains.rdct.testFramework.launch.ProcessLauncher.GATEWAY_PLUGIN_MODULE`
|
||||
*/
|
||||
const val INTELLIJ_CWM_GUEST_MAIN_MODULE = "intellij.platform.frontend.split.main"
|
||||
const val INTELLIJ_IDEA_ULTIMATE_MAIN_MODULE = "intellij.idea.ultimate.main"
|
||||
const val PLATFORM_LOADER_MODULE = "intellij.platform.runtime.loader"
|
||||
const val GATEWAY_PLUGIN_MODULE = "intellij.gateway.plugin"
|
||||
|
||||
const val DEFAULT_CWM_PASSWORD = "qwerty123"
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.intellij.tools.launch.ide.splitMode
|
||||
|
||||
import com.intellij.openapi.application.PathManager
|
||||
import com.intellij.openapi.diagnostic.logger
|
||||
import com.intellij.platform.runtime.product.ProductMode
|
||||
import com.intellij.tools.launch.PathsProvider
|
||||
import com.intellij.tools.launch.ide.IdeDebugOptions
|
||||
import com.intellij.tools.launch.ide.IdeLaunchContext
|
||||
@@ -10,6 +11,7 @@ import com.intellij.tools.launch.ide.classpathCollector
|
||||
import com.intellij.tools.launch.ide.environments.local.LocalIdeCommandLauncherFactory
|
||||
import com.intellij.tools.launch.ide.environments.local.LocalProcessLaunchResult
|
||||
import com.intellij.tools.launch.ide.environments.local.localLaunchOptions
|
||||
import com.intellij.tools.launch.ide.splitMode.dsl.Product
|
||||
import com.intellij.tools.launch.os.ProcessOutputStrategy
|
||||
import kotlinx.coroutines.CoroutineScope
|
||||
import java.io.File
|
||||
@@ -19,13 +21,12 @@ data class IdeFrontendLaunchResult(
|
||||
val debugPort: Int,
|
||||
)
|
||||
|
||||
fun runIdeFrontendLocally(frontendProcessLifespanScope: CoroutineScope): IdeFrontendLaunchResult {
|
||||
fun runIdeFrontendLocally(product: Product, frontendProcessLifespanScope: CoroutineScope): IdeFrontendLaunchResult {
|
||||
IdeFrontend.logger.info("Starting IDE Frontend")
|
||||
val paths = IdeFrontendIdeaPathsProvider()
|
||||
val classpath = classpathCollector(
|
||||
paths,
|
||||
mainModule = IdeConstants.INTELLIJ_CWM_GUEST_MAIN_MODULE,
|
||||
additionalRuntimeModules = listOf(IdeConstants.GATEWAY_PLUGIN_MODULE)
|
||||
mainModule = IdeConstants.PLATFORM_LOADER_MODULE,
|
||||
)
|
||||
val debugPort = 5007
|
||||
val localProcessLaunchResult = IdeLauncher.launchCommand(
|
||||
@@ -40,7 +41,13 @@ fun runIdeFrontendLocally(frontendProcessLifespanScope: CoroutineScope): IdeFron
|
||||
localPaths = paths,
|
||||
ideDebugOptions = IdeDebugOptions(debugPort, debugSuspendOnStart = true, bindToHost = ""),
|
||||
platformPrefix = IdeConstants.JETBRAINS_CLIENT_PREFIX,
|
||||
productMode = ProductMode.FRONTEND,
|
||||
ideaArguments = listOf("thinClient", "debug://localhost:5990#newUi=true"),
|
||||
javaArguments = listOf(
|
||||
"-Dintellij.platform.root.module=${product.frontendRootProductModule}",
|
||||
"-Dintellij.platform.runtime.repository.path=${paths.outputRootFolder.toPath().resolve("module-descriptors.jar")}",
|
||||
"-D${PathManager.SYSTEM_PATHS_CUSTOMIZER}=com.intellij.platform.ide.impl.startup.multiProcess.FrontendProcessPathCustomizer",
|
||||
),
|
||||
environment = mapOf(
|
||||
"CWM_NO_TIMEOUTS" to "1",
|
||||
"CWM_CLIENT_PASSWORD" to IdeConstants.DEFAULT_CWM_PASSWORD,
|
||||
|
||||
@@ -22,8 +22,8 @@ private class LaunchIdeBuilderImpl : LaunchIdeBuilder {
|
||||
private lateinit var ideFrontendResult: IdeFrontendBuilderImpl.Result
|
||||
private lateinit var ideBackendInEnvDescription: IdeBackendInEnvDescription
|
||||
|
||||
override fun frontend(init: IdeFrontendBuilder.() -> Unit) {
|
||||
ideFrontendResult = IdeFrontendBuilderImpl().let {
|
||||
override fun frontend(product: Product, init: IdeFrontendBuilder.() -> Unit) {
|
||||
ideFrontendResult = IdeFrontendBuilderImpl(product).let {
|
||||
it.init()
|
||||
it.build()
|
||||
}
|
||||
@@ -61,7 +61,7 @@ private class LaunchIdeBuilderImpl : LaunchIdeBuilder {
|
||||
logger.info("Starting IDE frontend")
|
||||
val (ideFrontendLocalProcessResult, ideFrontendDebugPort) =
|
||||
withContext(CoroutineName("IDE Frontend Launcher")) {
|
||||
runIdeFrontendLocally(ideLifespanScope)
|
||||
runIdeFrontendLocally(ideFrontendResult.product, ideLifespanScope)
|
||||
}
|
||||
handleLocalProcessOutput(
|
||||
ideFrontendLocalProcessResult.processWrapper.processOutputInfo,
|
||||
@@ -155,10 +155,10 @@ private abstract class IdeBuilderImpl : IdeBuilder {
|
||||
}
|
||||
}
|
||||
|
||||
private class IdeFrontendBuilderImpl : IdeBuilderImpl(), IdeFrontendBuilder {
|
||||
fun build(): Result = Result(attachDebuggerCallback)
|
||||
private class IdeFrontendBuilderImpl(private val product: Product) : IdeBuilderImpl(), IdeFrontendBuilder {
|
||||
fun build(): Result = Result(product, attachDebuggerCallback)
|
||||
|
||||
data class Result(val attachDebuggerCallback: (suspend (Int) -> Unit)?)
|
||||
data class Result(val product: Product, val attachDebuggerCallback: (suspend (Int) -> Unit)?)
|
||||
}
|
||||
|
||||
private class DockerBuilderImpl : DockerBuilder {
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
package com.intellij.tools.launch.ide.splitMode.dsl
|
||||
|
||||
import com.intellij.tools.launch.ide.splitMode.IdeConstants
|
||||
import java.nio.file.Path
|
||||
|
||||
interface LaunchIdeBuilder {
|
||||
fun frontend(init: IdeFrontendBuilder.() -> Unit)
|
||||
fun frontend(product: Product, init: IdeFrontendBuilder.() -> Unit)
|
||||
|
||||
fun docker(init: DockerBuilder.() -> Unit)
|
||||
|
||||
@@ -15,8 +14,12 @@ interface IdeBuilder {
|
||||
fun attachDebugger(callback: suspend (Int) -> Unit)
|
||||
}
|
||||
|
||||
enum class Product(val mainModule: String) {
|
||||
IDEA_ULTIMATE(mainModule = IdeConstants.INTELLIJ_IDEA_ULTIMATE_MAIN_MODULE),
|
||||
enum class Product(val backendMainModule: String,
|
||||
val frontendRootProductModule: String) {
|
||||
IDEA_ULTIMATE(
|
||||
backendMainModule = "intellij.idea.ultimate.main",
|
||||
frontendRootProductModule = "intellij.idea.frontend"
|
||||
),
|
||||
}
|
||||
|
||||
interface IdeBackendBuilder : IdeBuilder {
|
||||
|
||||
Reference in New Issue
Block a user