Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Changelog

## 2025.1.2
* Implement the Debug Run Configuration on Linux

## 2025.1.1
* Fixes an issue with the Rimworld Run Configuration when using multiple parameters

Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
DotnetPluginId=ReSharperPlugin.RimworldDev
DotnetSolution=ReSharperPlugin.RimworldDev.sln
RiderPluginId=com.jetbrains.rider.plugins.rimworlddev
PluginVersion=2025.1.1
PluginVersion=2025.1.2

BuildConfiguration=Release

Expand Down
25 changes: 16 additions & 9 deletions src/rider/main/kotlin/run/RunConfiguration.kt
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,17 @@ import com.intellij.execution.process.*
import com.intellij.execution.runners.ExecutionEnvironment
import com.intellij.openapi.options.SettingsEditor
import com.intellij.openapi.project.Project
import com.intellij.openapi.rd.util.startOnUiAsync
import com.intellij.openapi.rd.util.toPromise
import com.jetbrains.rd.platform.util.lifetime
import com.intellij.util.system.OS
import com.jetbrains.rider.debugger.IRiderDebuggable
import com.jetbrains.rider.plugins.unity.run.configurations.UnityAttachToPlayerFactory
import com.jetbrains.rider.plugins.unity.run.configurations.UnityPlayerDebugConfigurationOptions
import com.jetbrains.rider.run.configurations.AsyncRunConfiguration
import com.jetbrains.rider.run.getProcess
import kotlinx.coroutines.ExperimentalCoroutinesApi
import org.jetbrains.concurrency.Promise
import com.jetbrains.rider.plugins.unity.UnityBundle
import com.jetbrains.rider.plugins.unity.run.configurations.unityExe.UnityExeConfiguration
import com.jetbrains.rider.run.RiderRunBundle
import icons.UnityIcons
import kotlin.io.path.Path


internal class UnityPlayerDebugConfigurationTypeInternal : ConfigurationTypeBase(
Expand Down Expand Up @@ -111,7 +108,7 @@ class RunConfiguration(project: Project, factory: ConfigurationFactory, name: St
getScriptName(),
getSaveFilePath(),
getModListPath(),
getRimworldState(environment),
getRimworldState(environment, OS.CURRENT == OS.Linux),
UnityDebugRemoteConfiguration(),
environment,
"CustomPlayer"
Expand All @@ -122,11 +119,21 @@ class RunConfiguration(project: Project, factory: ConfigurationFactory, name: St
return RimworldDev.Rider.run.SettingsEditor(project)
}

private fun getRimworldState(environment: ExecutionEnvironment): CommandLineState {
private fun getRimworldState(environment: ExecutionEnvironment, debugInLinux: Boolean = false): CommandLineState {
return object : CommandLineState(environment) {
override fun startProcess(): ProcessHandler {
val commandLine = GeneralCommandLine(getScriptName())
.withParameters(getCommandLineOptions().split(' '))
var pathToRun = getScriptName()
var arguments = getCommandLineOptions()

// If we're debugging in Rimworld, instead of /pwd/RimWorldLinux ...args we want to run /bin/sh /pwd/run.sh /pwd/RimWorldLinux ...args
if (debugInLinux) {
val bashScriptPath = "${Path(pathToRun).parent}/run.sh"
arguments = "$bashScriptPath $pathToRun $arguments"
pathToRun = "/bin/sh"
}

val commandLine = GeneralCommandLine(pathToRun)
.withParameters(arguments.split(' ').filter { it.isNotEmpty() })

EnvironmentVariablesData.create(getEnvData(), true).configureCommandLine(commandLine, true)

Expand Down
23 changes: 21 additions & 2 deletions src/rider/main/kotlin/run/RunState.kt
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,20 @@ class RunState(
"Doorstop/Mono.CompilerServices.SymbolWriter.dll",
"Doorstop/pdb2mdb.exe",
),
OS.Linux to listOf(
"run.sh",
".doorstop_version",

"Doorstop/0Harmony.dll",
"Doorstop/dnlib.dll",
"Doorstop/Doorstop.dll",
"Doorstop/Doorstop.pdb",
"Doorstop/HotReload.dll",
"Doorstop/libdoorstop.so",
"Doorstop/Mono.Cecil.dll",
"Doorstop/Mono.CompilerServices.SymbolWriter.dll",
"Doorstop/pdb2mdb.exe",
),
OS.macOS to listOf(
".doorstop_version",
".doorstop_config.ini",
Expand All @@ -69,7 +83,7 @@ class RunState(

val rimworldResult = rimworldState.execute(executor, runner)
workerProcessHandler.debuggerWorkerRealHandler.addProcessListener(createProcessListener(rimworldResult?.processHandler))

return result
}

Expand All @@ -79,7 +93,12 @@ class RunState(
val processHandler = event.processHandler
processHandler.removeProcessListener(this)

siblingProcessHandler?.getProcess()?.destroy()
if (OS.CURRENT == OS.Linux) {
siblingProcessHandler?.getProcess()?.destroyForcibly()
} else {
siblingProcessHandler?.getProcess()?.destroy()
}

QuickStartUtils.tearDown(saveFilePath)
removeDoorstep()
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
4.0.0
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading