diff --git a/modules/core/src/main/kotlin/com/metalbear/mirrord/MirrordApi.kt b/modules/core/src/main/kotlin/com/metalbear/mirrord/MirrordApi.kt index f866d166..5325f84a 100644 --- a/modules/core/src/main/kotlin/com/metalbear/mirrord/MirrordApi.kt +++ b/modules/core/src/main/kotlin/com/metalbear/mirrord/MirrordApi.kt @@ -110,10 +110,10 @@ class MirrordApi(private val service: MirrordProjectService) { when { message.name == "mirrord preparing to launch" && message.type == MessageType.FinishedTask -> { val success = message.success - ?: throw MirrordError("invalid message received from the mirrord binary") + ?: throw MirrordError("invalid message received from the mirrord binary") if (success) { val innerMessage = message.message - ?: throw MirrordError("invalid message received from the mirrord binary") + ?: throw MirrordError("invalid message received from the mirrord binary") val executionInfo = parser.parse(innerMessage, MirrordExecution::class.java) setText("mirrord is running") return executionInfo @@ -282,7 +282,7 @@ private abstract class MirrordCliTask(private val cli: String, private val co environment["MIRRORD_PROGRESS_MODE"] = "json" for (entry in environment.entries) { - MirrordLogger.logger.info("environment var ${entry}") + MirrordLogger.logger.info("environment var $entry") } } } diff --git a/modules/core/src/main/kotlin/com/metalbear/mirrord/MirrordBinaryManager.kt b/modules/core/src/main/kotlin/com/metalbear/mirrord/MirrordBinaryManager.kt index bdbb3fed..782109e2 100644 --- a/modules/core/src/main/kotlin/com/metalbear/mirrord/MirrordBinaryManager.kt +++ b/modules/core/src/main/kotlin/com/metalbear/mirrord/MirrordBinaryManager.kt @@ -54,10 +54,10 @@ class MirrordBinaryManager { * Should be false if wslDistribution is unknown */ private class UpdateTask( - private val project: Project, - private val product: String?, - private val wslDistribution: WSLDistribution?, - private val checkInPath: Boolean + private val project: Project, + private val product: String?, + private val wslDistribution: WSLDistribution?, + private val checkInPath: Boolean ) : Task.Backgroundable(project, "mirrord", true), DumbAware { companion object State { /** @@ -86,10 +86,10 @@ class MirrordBinaryManager { userSelectedMirrordVersion } else { project - .service() - .notifier - .notification("mirrord version format is invalid!", NotificationType.WARNING) - .fire() + .service() + .notifier + .notification("mirrord version format is invalid!", NotificationType.WARNING) + .fire() return } } @@ -112,8 +112,8 @@ class MirrordBinaryManager { } manager.latestSupportedVersion = version - // auto update -> false -> mirrordVersion is empty -> no cli found locally -> fetch latest version - ?: manager.fetchLatestSupportedVersion(product, indicator) + // auto update -> false -> mirrordVersion is empty -> no cli found locally -> fetch latest version + ?: manager.fetchLatestSupportedVersion(product, indicator) if (downloadInProgress.compareAndExchange(false, true)) { return @@ -127,8 +127,8 @@ class MirrordBinaryManager { MirrordLogger.logger.debug("binary update task failed", error) project.service() - .notifier - .notifyRichError("failed to update the mirrord binary: ${error.message ?: error.toString()}") + .notifier + .notifyRichError("failed to update the mirrord binary: ${error.message ?: error.toString()}") } override fun onFinished() { @@ -140,12 +140,12 @@ class MirrordBinaryManager { override fun onSuccess() { downloadingVersion?.let { project - .service() - .notifier - .notifySimple( - "downloaded mirrord binary version $downloadingVersion", - NotificationType.INFORMATION - ) + .service() + .notifier + .notifySimple( + "downloaded mirrord binary version $downloadingVersion", + NotificationType.INFORMATION + ) } } @@ -160,8 +160,8 @@ class MirrordBinaryManager { private fun fetchLatestSupportedVersion(product: String?, indicator: ProgressIndicator): String { val pluginVersion = if ( - System.getenv("CI_BUILD_PLUGIN") == "true" || - System.getenv("PLUGIN_TESTING_ENVIRONMENT") == "true" + System.getenv("CI_BUILD_PLUGIN") == "true" || + System.getenv("PLUGIN_TESTING_ENVIRONMENT") == "true" ) { "test" } else { @@ -171,18 +171,18 @@ class MirrordBinaryManager { indicator.text = "mirrord is checking the latest supported binary version..." val url = StringBuilder(VERSION_ENDPOINT) - .append("?source=3") - .append("&version=") - .append(URLEncoder.encode(pluginVersion, Charset.defaultCharset())) - .append("&platform=") - .append(URLEncoder.encode(SystemInfo.OS_NAME, Charset.defaultCharset())) - .toString() + .append("?source=3") + .append("&version=") + .append(URLEncoder.encode(pluginVersion, Charset.defaultCharset())) + .append("&platform=") + .append(URLEncoder.encode(SystemInfo.OS_NAME, Charset.defaultCharset())) + .toString() val client = HttpClient.newHttpClient() val builder = HttpRequest - .newBuilder(URI(url)) - .timeout(Duration.ofSeconds(10L)) - .GET() + .newBuilder(URI(url)) + .timeout(Duration.ofSeconds(10L)) + .GET() product?.let { builder.header("user-agent", it) } @@ -334,18 +334,18 @@ class MirrordBinaryManager { } ?: "using a possibly outdated local installation with version ${it.version}" project - .service() - .notifier - .notification(message, NotificationType.WARNING) - .withDontShowAgain(MirrordSettingsState.NotificationId.POSSIBLY_OUTDATED_BINARY_USED) - .fire() + .service() + .notifier + .notification(message, NotificationType.WARNING) + .withDontShowAgain(MirrordSettingsState.NotificationId.POSSIBLY_OUTDATED_BINARY_USED) + .fire() return it.command } throw MirrordError( - "no local installation of mirrord binary was found", - "mirrord binary will be downloaded in the background" + "no local installation of mirrord binary was found", + "mirrord binary will be downloaded in the background" ) } } 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 a9db7724..c487fb51 100644 --- a/modules/core/src/main/kotlin/com/metalbear/mirrord/MirrordExecManager.kt +++ b/modules/core/src/main/kotlin/com/metalbear/mirrord/MirrordExecManager.kt @@ -21,16 +21,16 @@ class MirrordExecManager(private val service: MirrordProjectService) { * @throws ProcessCanceledException if the dialog cannot be displayed */ private fun chooseTarget( - cli: String, - wslDistribution: WSLDistribution?, - config: String? + cli: String, + wslDistribution: WSLDistribution?, + config: String? ): String { MirrordLogger.logger.debug("choose target called") val pods = service.mirrordApi.listPods( - cli, - config, - wslDistribution + cli, + config, + wslDistribution ) val application = ApplicationManager.getApplication() @@ -50,27 +50,27 @@ class MirrordExecManager(private val service: MirrordProjectService) { MirrordLogger.logger.debug("read lock detected, aborting target selection") service - .notifier - .notification( - "mirrord plugin was unable to display the target selection dialog. " + - "You can set it manually in the configuration file $config.", - NotificationType.WARNING - ) - .apply { - val configFile = try { - val path = Path.of(config) - VirtualFileManager.getInstance().findFileByNioPath(path) - } catch (e: Exception) { - MirrordLogger.logger.debug("failed to find config under path $config", e) - null - } - - configFile?.let { - withOpenFile(it) - } + .notifier + .notification( + "mirrord plugin was unable to display the target selection dialog. " + + "You can set it manually in the configuration file $config.", + NotificationType.WARNING + ) + .apply { + val configFile = try { + val path = Path.of(config) + VirtualFileManager.getInstance().findFileByNioPath(path) + } catch (e: Exception) { + MirrordLogger.logger.debug("failed to find config under path $config", e) + null } - .withLink("Config doc", "https://mirrord.dev/docs/overview/configuration/#root-target") - .fire() + + configFile?.let { + withOpenFile(it) + } + } + .withLink("Config doc", "https://mirrord.dev/docs/overview/configuration/#root-target") + .fire() null } @@ -91,10 +91,10 @@ class MirrordExecManager(private val service: MirrordProjectService) { * @throws ProcessCanceledException if the user cancelled */ private fun start( - wslDistribution: WSLDistribution?, - executable: String?, - product: String, - mirrordConfigFromEnv: String? + wslDistribution: WSLDistribution?, + executable: String?, + product: String, + mirrordConfigFromEnv: String? ): Pair, String?>? { if (!service.enabled) { MirrordLogger.logger.debug("disabled, returning") @@ -135,21 +135,21 @@ class MirrordExecManager(private val service: MirrordProjectService) { if (target == MirrordExecDialog.targetlessTargetName) { MirrordLogger.logger.info("No target specified - running targetless") service.notifier.notification( - "No target specified, mirrord running targetless.", - NotificationType.INFORMATION + "No target specified, mirrord running targetless.", + NotificationType.INFORMATION ) - .withDontShowAgain(MirrordSettingsState.NotificationId.RUNNING_TARGETLESS) - .fire() + .withDontShowAgain(MirrordSettingsState.NotificationId.RUNNING_TARGETLESS) + .fire() target = null } } val executionInfo = service.mirrordApi.exec( - cli, - target, - config, - executable, - wslDistribution + cli, + target, + config, + executable, + wslDistribution ) executionInfo.environment["MIRRORD_IGNORE_DEBUGGER_PORTS"] = "35000-65535"