-
Notifications
You must be signed in to change notification settings - Fork 8
Get debug working on linux #77
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: linux-debugging
Are you sure you want to change the base?
Changes from 3 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| #!/bin/sh | ||
| set -e | ||
| # This script builds the plugin on Linux | ||
|
|
||
| export Version="2024.1-EAP" | ||
|
|
||
| cd "src/dotnet/ReSharperPlugin.RimworldDev" | ||
| FrameworkPathOverride=$(dirname $(which dotnet))/../../../../lib/dotnet/sdk/7.0.202/ dotnet build ReSharperPlugin.RimworldDev.csproj /property:Configuration=Release | ||
| FrameworkPathOverride=$(dirname $(which dotnet))/../../../../lib/dotnet/sdk/7.0.202/ dotnet build ReSharperPlugin.RimworldDev.Rider.csproj /property:Configuration=Release | ||
|
|
||
| cd - | ||
|
|
||
| ./gradlew :buildPlugin -x compileDotNet | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -122,18 +122,22 @@ class RunConfiguration(project: Project, factory: ConfigurationFactory, name: St | |
| private fun getRimworldState(environment: ExecutionEnvironment, debugInLinux: Boolean = false): CommandLineState { | ||
| return object : CommandLineState(environment) { | ||
| override fun startProcess(): ProcessHandler { | ||
| var pathToRun = getScriptName() | ||
| var arguments = getCommandLineOptions() | ||
| val rimworldPath = getScriptName() | ||
| var pathToRun = rimworldPath | ||
| // Splitting on space will be a source of future bugs. In the future the arguments should be List as early as possible | ||
| val arguments = getCommandLineOptions().split(' ').filter { it.isNotEmpty() }.toMutableList() | ||
|
|
||
| // 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" | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This line was messing up the commandline.
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It shouldn't have been messing it up. The arguments I had should have ended up as Perhaps it was the fact that the executable name shouldn't include it's directory?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. To make it work the way you had it you would want The reason I refactored the code some is to do the "Perhaps it was the fact that the executable name shouldn't include it's directory?"
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I had some trouble getting But yeah, I think moving the
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Passing a bash script into /bin/sh is a MUCH more portable solution than trying to execute the bash script directly. This was the right call. "But yeah, I think moving the .split earlier makes sense, I was going to just look into having getCommandLineOptions return a list directly" |
||
| pathToRun = "/bin/sh" | ||
| val bashScriptPath = "${Path(rimworldPath).parent}/run.sh" | ||
| arguments.add(0, bashScriptPath) | ||
| } | ||
|
|
||
| println("Calling $pathToRun with arguments ${arguments.joinToString(" ")} with working directory ${Path(rimworldPath).parent}") | ||
| val commandLine = GeneralCommandLine(pathToRun) | ||
| .withParameters(arguments.split(' ').filter { it.isNotEmpty() }) | ||
| .withParameters(arguments) | ||
| .withWorkingDirectory(Path(rimworldPath).parent) | ||
|
|
||
| EnvironmentVariablesData.create(getEnvData(), true).configureCommandLine(commandLine, true) | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this needed? I would have thought that the
globals.jsonin the root dir of this project should have negated the need to do thisThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, does just calling
:buildPluginfrom gradle without excludingcompileDotNetnot work? That's how I do it in my CIThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm apparently ./gradlew :buildPlugin does work. It didn't when I first setup the script, but that was before you created this branch.
I just got something working and never revised it. I'll push an update.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This file could be removed all together. It is really just documentation at this point.
I am the type of dev that runs git commands in the Intellij terminal rather than use the UI.