diff --git a/build/launch/src/com/intellij/tools/launch/ide/splitMode/IdeBackend.kt b/build/launch/src/com/intellij/tools/launch/ide/splitMode/IdeBackend.kt index 75d26e467617..66d7ac56fa54 100644 --- a/build/launch/src/com/intellij/tools/launch/ide/splitMode/IdeBackend.kt +++ b/build/launch/src/com/intellij/tools/launch/ide/splitMode/IdeBackend.kt @@ -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, diff --git a/build/launch/src/com/intellij/tools/launch/ide/splitMode/IdeConstants.kt b/build/launch/src/com/intellij/tools/launch/ide/splitMode/IdeConstants.kt index 10e3b1eb769e..4e124dc998d5 100644 --- a/build/launch/src/com/intellij/tools/launch/ide/splitMode/IdeConstants.kt +++ b/build/launch/src/com/intellij/tools/launch/ide/splitMode/IdeConstants.kt @@ -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" diff --git a/build/launch/src/com/intellij/tools/launch/ide/splitMode/IdeFrontend.kt b/build/launch/src/com/intellij/tools/launch/ide/splitMode/IdeFrontend.kt index e0d021a5648e..2c48081d25b1 100644 --- a/build/launch/src/com/intellij/tools/launch/ide/splitMode/IdeFrontend.kt +++ b/build/launch/src/com/intellij/tools/launch/ide/splitMode/IdeFrontend.kt @@ -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, diff --git a/build/launch/src/com/intellij/tools/launch/ide/splitMode/IdeLauncher.kt b/build/launch/src/com/intellij/tools/launch/ide/splitMode/IdeLauncher.kt index d134fabe3777..173615744f63 100644 --- a/build/launch/src/com/intellij/tools/launch/ide/splitMode/IdeLauncher.kt +++ b/build/launch/src/com/intellij/tools/launch/ide/splitMode/IdeLauncher.kt @@ -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 { diff --git a/build/launch/src/com/intellij/tools/launch/ide/splitMode/dsl/IdeLauncherDsl.kt b/build/launch/src/com/intellij/tools/launch/ide/splitMode/dsl/IdeLauncherDsl.kt index 3c6981ff3f40..c2fd297dc5c6 100644 --- a/build/launch/src/com/intellij/tools/launch/ide/splitMode/dsl/IdeLauncherDsl.kt +++ b/build/launch/src/com/intellij/tools/launch/ide/splitMode/dsl/IdeLauncherDsl.kt @@ -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 {