diff --git a/build.gradle.kts b/build.gradle.kts index 482681be..11699e5b 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -38,6 +38,7 @@ repositories { val remoteRobotVersion = "0.11.19" dependencies { + /* implementation(project(":mirrord-products-idea")) implementation(project(":mirrord-products-pycharm")) implementation(project(":mirrord-products-rubymine")) @@ -45,6 +46,8 @@ dependencies { implementation(project(":mirrord-products-nodejs")) implementation(project(":mirrord-products-rider")) implementation(project(":mirrord-products-tomcat")) + */ + implementation(project(":mirrord-products-quarkus")) testImplementation("com.intellij.remoterobot:remote-robot:$remoteRobotVersion") testImplementation("com.intellij.remoterobot:remote-fixtures:$remoteRobotVersion") testImplementation("com.intellij.remoterobot:ide-launcher:0.11.19.414") @@ -231,7 +234,8 @@ tasks { listProductsReleases { val ides = System.getenv("IDE") types.set(ides?.split(',') ?: listOf("IU", "RD", "PY")) - sinceBuild.set(if (types.get() == listOf("IU")) "222.*" else "232.*") + //sinceBuild.set(if (types.get() == listOf("IU")) "222.*" else "232.*") + sinceBuild.set("241.*") releaseChannels.set(setOf(ListProductsReleasesTask.Channel.EAP, ListProductsReleasesTask.Channel.RELEASE)) } diff --git a/gradle.properties b/gradle.properties index 4a24c571..758e29eb 100644 --- a/gradle.properties +++ b/gradle.properties @@ -6,7 +6,7 @@ pluginName = mirrord # SemVer format -> https://semver.org pluginVersion = 3.60.1 -platformVersion = 2022.3.2 +platformVersion = 2024.1.1 # Plugin Dependencies -> https://plugins.jetbrains.com/docs/intellij/plugin-dependencies.html # Example: platformPlugins = com.intellij.java, com.jetbrains.php:203.4449.22 diff --git a/modules/core/src/main/kotlin/com/metalbear/mirrord/MirrordExecManager.kt b/modules/core/src/main/kotlin/com/metalbear/mirrord/MirrordExecManager.kt index 3795aecf..d049d603 100644 --- a/modules/core/src/main/kotlin/com/metalbear/mirrord/MirrordExecManager.kt +++ b/modules/core/src/main/kotlin/com/metalbear/mirrord/MirrordExecManager.kt @@ -170,6 +170,7 @@ class MirrordExecManager(private val service: MirrordProjectService) { chooseTarget(cli, wslDistribution, configPath, mirrordApi) .takeUnless { it == MirrordExecDialog.targetlessTargetName } + /* .alsoIfNull { MirrordLogger.logger.info("No target specified - running targetless") service.notifier.notification( @@ -179,6 +180,7 @@ class MirrordExecManager(private val service: MirrordProjectService) { .withDontShowAgain(MirrordSettingsState.NotificationId.RUNNING_TARGETLESS) .fire() } + */ } else { null } diff --git a/modules/products/quarkus/build.gradle.kts b/modules/products/quarkus/build.gradle.kts new file mode 100644 index 00000000..c972c075 --- /dev/null +++ b/modules/products/quarkus/build.gradle.kts @@ -0,0 +1,27 @@ +fun properties(key: String) = project.findProperty(key).toString() + +plugins { + // Java support + id("java") + // Kotlin support + id("org.jetbrains.kotlin.jvm") version "1.8.22" + // Gradle IntelliJ Plugin + id("org.jetbrains.intellij") version "1.+" +} + +tasks { + buildSearchableOptions { + enabled = false + } +} + +intellij { + type.set("IU") + //version.set(properties("platformVersion")) + version.set("2024.1") + plugins.set(listOf("java", "gradle", "maven", "com.intellij.quarkus:241.14494.158")) +} + +dependencies { + implementation(project(":mirrord-core")) +} diff --git a/modules/products/quarkus/src/main/kotlin/com/metalbear/mirrord/products/quarkus/QuarkusRunConfigurationExtension.kt b/modules/products/quarkus/src/main/kotlin/com/metalbear/mirrord/products/quarkus/QuarkusRunConfigurationExtension.kt new file mode 100644 index 00000000..75c21bcb --- /dev/null +++ b/modules/products/quarkus/src/main/kotlin/com/metalbear/mirrord/products/quarkus/QuarkusRunConfigurationExtension.kt @@ -0,0 +1,177 @@ +@file:Suppress("UnstableApiUsage") + +package com.metalbear.mirrord.products.quarkus + +import com.intellij.execution.RunConfigurationExtension +import com.intellij.execution.configurations.JavaParameters +import com.intellij.execution.configurations.RunConfigurationBase +import com.intellij.execution.configurations.RunnerSettings +import com.intellij.execution.process.ProcessEvent +import com.intellij.execution.process.ProcessHandler +import com.intellij.execution.process.ProcessListener +import com.intellij.execution.target.* +import com.intellij.execution.target.value.TargetValue +import com.intellij.execution.wsl.target.WslTargetEnvironmentRequest +import com.intellij.openapi.components.service +import com.intellij.openapi.externalSystem.service.execution.ExternalSystemRunConfiguration +import com.intellij.openapi.project.Project +import com.intellij.openapi.util.Key +import com.intellij.quarkus.run.QsLocalRepoRootHolder +import java.util.concurrent.ConcurrentHashMap +//import com.intellij.quarkus.run.QsTargetConfigurationExtension +//import com.intellij.quarkus.run.QsTargetConfigurationExtension +import com.intellij.quarkus.run.QsTargetConfigurationExtension +// import com.intellij.quarkus.run.maven.QsMavenRunConfiguration +import com.metalbear.mirrord.CONFIG_ENV_NAME +import com.metalbear.mirrord.MirrordLogger +import com.metalbear.mirrord.MirrordProjectService +import java.util.function.Consumer + +class QuarkusRunConfigurationExtension : QsTargetConfigurationExtension { + override fun customizeCommandLine( + targetConfiguration: TargetEnvironmentConfiguration, + commandLine: TargetedCommandLineBuilder, + attachDebugger: Boolean + ) { + println("targetConfig $targetConfiguration") + println("commandLine $commandLine") + println("debugger $attachDebugger") + + TODO("Not yet implemented") + } + + override fun prepareTargetLocalRepo( + request: TargetEnvironmentRequest, + targetConfiguration: TargetEnvironmentConfiguration, + holder: QsLocalRepoRootHolder + ): Pair, Consumer>? { + println("request $request") + println("targetConfiguration $targetConfiguration") + println("holder $holder") + TODO("Not yet implemented") + } +} + + +/* +class IdeaRunConfigurationExtension : RunConfigurationExtension() { + /** + * mirrord env set in ExternalRunConfigurations. Used for cleanup the configuration after the execution has ended. + */ + private val runningProcessEnvs = ConcurrentHashMap>() + + override fun isApplicableFor(configuration: RunConfigurationBase<*>): Boolean { + val applicable = !configuration.name.startsWith("Build ") && !configuration.name.startsWith("Tomcat") + + if (!applicable) { + MirrordLogger.logger.info("Configuration name %s ignored".format(configuration.name)) + } + + return applicable + } + + override fun isEnabledFor( + applicableConfiguration: RunConfigurationBase<*>, + runnerSettings: RunnerSettings? + ): Boolean { + return true + } + + private fun > getMirrordConfigPath(configuration: T, params: JavaParameters): String? { + return params.env[CONFIG_ENV_NAME] ?: if (configuration is ExternalSystemRunConfiguration) { + val ext = configuration as ExternalSystemRunConfiguration + ext.settings.env[CONFIG_ENV_NAME] + } else { + null + } + } + + override fun > updateJavaParameters( + configuration: T, + params: JavaParameters, + runnerSettings: RunnerSettings? + ) { + val service = configuration.project.service() + + MirrordLogger.logger.debug("wsl check") + val wsl = when (val request = createEnvironmentRequest(configuration, configuration.project)) { + is WslTargetEnvironmentRequest -> request.configuration.distribution!! + else -> null + } + + val extraEnv = if (configuration is ExternalSystemRunConfiguration) { + val extraEnv = params.env + configuration.settings.env + extraEnv + } else { + params.env + } + + service.execManager.wrapper("idea", extraEnv).apply { + this.wsl = wsl + }.start()?.let { executionInfo -> + val mirrordEnv = executionInfo.environment + mapOf(Pair("MIRRORD_DETECT_DEBUGGER_PORT", "javaagent")) + params.env = params.env + mirrordEnv + executionInfo.envToUnset?.let { keys -> + params.env = params.env.filterKeys { !keys.contains(it) } + } + runningProcessEnvs[configuration.project] = params.env.toMap() + + // Gradle support (and external system configuration) + if (configuration is ExternalSystemRunConfiguration) { + runningProcessEnvs[configuration.project] = configuration.settings.env.toMap() + var env = configuration.settings.env + mirrordEnv + executionInfo.envToUnset?.let { keys -> + env = env.filterKeys { !keys.contains(it) } + } + configuration.settings.env = configuration.settings.env + mirrordEnv + } + MirrordLogger.logger.debug("setting env and finishing") + } + } + + /** + * Remove mirrord env leftovers from the external system configurations. + */ + override fun attachToProcess( + configuration: RunConfigurationBase<*>, + handler: ProcessHandler, + runnerSettings: RunnerSettings? + ) { + if (configuration is QsTargetConfigurationExtension) { + val envsToRestore = runningProcessEnvs.remove(configuration.project) ?: return + + handler.addProcessListener(object : ProcessListener { + /* + override fun processTerminated(event: ProcessEvent) { + configuration.settings.env.apply { + clear() + putAll(envsToRestore) + } + } + */ + + override fun startNotified(event: ProcessEvent) {} + + override fun onTextAvailable(event: ProcessEvent, outputType: Key<*>) {} + }) + } + if (configuration is ExternalSystemRunConfiguration) { + val envsToRestore = runningProcessEnvs.remove(configuration.project) ?: return + + handler.addProcessListener(object : ProcessListener { + override fun processTerminated(event: ProcessEvent) { + configuration.settings.env.apply { + clear() + putAll(envsToRestore) + } + } + + override fun startNotified(event: ProcessEvent) {} + + override fun onTextAvailable(event: ProcessEvent, outputType: Key<*>) {} + }) + } + } +} + + */ \ No newline at end of file diff --git a/settings.gradle.kts b/settings.gradle.kts index b8f10ac8..1dd1ef80 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -2,13 +2,14 @@ rootProject.name = "mirrord" include( "modules/core", - "modules/products/idea", - "modules/products/goland", - "modules/products/pycharm", - "modules/products/rubymine", - "modules/products/nodejs", - "modules/products/rider", - "modules/products/tomcat" + // "modules/products/idea", + // "modules/products/goland", + // "modules/products/pycharm", + // "modules/products/rubymine", + // "modules/products/nodejs", + // "modules/products/rider", + // "modules/products/tomcat", + "modules/products/quarkus" ) // Rename modules to mirrord-, I think this is required IntelliJ wise. diff --git a/src/main/resources/META-INF/mirrord-quarkus.xml b/src/main/resources/META-INF/mirrord-quarkus.xml new file mode 100644 index 00000000..5e870ec6 --- /dev/null +++ b/src/main/resources/META-INF/mirrord-quarkus.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/src/main/resources/META-INF/plugin.xml b/src/main/resources/META-INF/plugin.xml index 04e32e57..05a43153 100644 --- a/src/main/resources/META-INF/plugin.xml +++ b/src/main/resources/META-INF/plugin.xml @@ -66,6 +66,7 @@ + + com.intellij.quarkus com.intellij.modules.json