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
17 changes: 0 additions & 17 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,6 @@ jobs:
distribution: 'corretto'
java-version: '21'
cache: 'gradle'
- uses: actions/cache@v4
with:
path: |
build/gradle-jvm
~/.nuget/packages
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-Build-${{ hashFiles('gradlew.bat', 'src/dotnet/*/*.csproj', './*.props', 'gradle-wrapper.properties') }}
- run: ./gradlew :buildPlugin --no-daemon
- run: ./gradlew :buildResharperPlugin --no-daemon
- uses: actions/upload-artifact@v4
Expand All @@ -46,13 +38,4 @@ jobs:
distribution: 'corretto'
java-version: '17'
cache: 'gradle'
- uses: actions/cache@v4
with:
path: |
build/gradle-jvm
packages
~/.nuget/packages
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-Test-${{ hashFiles('gradlew.bat', 'src/dotnet/*/*.csproj', './*.props', 'gradle-wrapper.properties') }}
- run: ./gradlew :testDotNet --no-daemon
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# Changelog

## 2024.2
* Adds support for [Parent=""] attributes
* Makes the New Mod template modular, allowing you to select the components you want included in your mod
* Bundled in Zetrith's Remodder code into this plugin
* Update the Rimworld template for 1.6
* Automatically detect and use the user-installed Harmony version for debugging, if available

## 2024.1.7
* Solved some incompatibilities for ReSharper

Expand Down
1 change: 1 addition & 0 deletions Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
<PackageReference Include="JetBrains.Annotations" Version="2024.3.0" />
<PackageReference Include="JetBrains.Lifetimes" Version="$(SdkVersion)" />
<PackageReference Include="JetBrains.RdFramework" Version="$(SdkVersion)" />
<PackageReference Include="System.Diagnostics.TraceSource" Version="4.3.0" />
<PackageReference Include="JetBrains.Rider.SDK" Version="$(SdkVersion)">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
Expand Down
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,14 @@ into the definitions on which the XML sits.
* Autocomplete DefNames when using `DefDatabase<Def>.GetNamed()`
* Autocomplete DefNames when creating fields in `[DefOf]` classes
* Autocomplete certain values for properties with fixed options (Such as Altitude Layer, boolean and directions)
* Autocompletion for `Parent=""` attributes
* Use `Ctrl+Click` to go references
* When using them on DefTypes, just to the C# class for that Def
* When using them on XML Properties, jump to the C# definition for that property
* When using them on DefName references, jump to the XML definition for that DefName
* When using them on certain XML values, jump to the C# definition for that value
* When using them on `[DefOf]` fields, or `DefDatabase<Def>.GetNamed()` calls, jump to the XML definition for that DefName
* When using them on `Parent=""` attributes, jump to the XML definition for that parent
* Read the values in `Class=""` attributes to fetch the correct class to autocomplete from, such as in comps
* Support for Custom Def Classes (Such as `<MyMod.CustomThingDef>`)
* A Rimworld Run Configuration
Expand All @@ -38,6 +40,7 @@ into the definitions on which the XML sits.
* The ability to perform Find Usages on XML Defs
* A "Generate" menu option to generate properties for a given XML Def
* Includes a Rimworld Dictionary so that Rimworld terms don't get flagged as not real words by Rider
* Transpilation Explorer, curtesy of [Zetrith](https://github.com/Zetrith/Remodder)

## Quick Architecture For Developers

Expand Down Expand Up @@ -75,6 +78,10 @@ our own custom context provider which grabs the solution from the XML File and a
The other is the [`RimworldXmlReference`](./src/dotnet/ReSharperPlugin.RimworldDev/References/RimworldXmlReference.cs)
which is just a class that we have to define to hold our reference from the XML to the C#.

## Acknowledgements
The feature of exploring transpiled code is taken from Zetrith's open source plugin, [Remodder](https://github.com/Zetrith/Remodder).
The feature would not have happened without them.

## FAQ

**VS Code Plugin When?**
Expand Down
28 changes: 27 additions & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
import com.jetbrains.plugin.structure.base.utils.isFile
import groovy.ant.FileNameFinder
import org.apache.tools.ant.taskdefs.condition.Os
import org.jetbrains.intellij.platform.gradle.Constants
import org.jetbrains.intellij.platform.gradle.IntelliJPlatformType
import java.io.ByteArrayOutputStream

plugins {
id("java")
alias(libs.plugins.kotlinJvm)
id("org.jetbrains.intellij.platform") version "2.5.0" // https://github.com/JetBrains/gradle-intellij-plugin/releases
// id("com.jetbrains.rdgen") version libs.versions.rdGen // https://www.myget.org/feed/rd-snapshots/package/maven/com.jetbrains.rd/rd-gen
id("me.filippov.gradle.jvm.wrapper") version "0.14.0"
}

Expand Down Expand Up @@ -196,6 +197,14 @@ tasks.prepareSandbox {
val dllFiles = listOf(
"$outputFolder/${DotnetPluginId}.dll",
"$outputFolder/${DotnetPluginId}.pdb",

// Not 100% sure why, but we manually need to include these dependencies for Remodder to work
"$outputFolder/0Harmony.dll",
"$outputFolder/AsmResolver.dll",
"$outputFolder/AsmResolver.DotNet.dll",
"$outputFolder/AsmResolver.PE.dll",
"$outputFolder/AsmResolver.PE.File.dll",
"$outputFolder/ICSharpCode.Decompiler.dll"
)

dllFiles.forEach({ f ->
Expand Down Expand Up @@ -243,4 +252,21 @@ tasks.patchPluginXml {
pluginVersion.set(PluginVersion)
changeNotes.set("<ul>\r\n$changelogText\r\n</ul>");
untilBuild.set(provider { null })
}

val riderModel: Configuration by configurations.creating {
isCanBeConsumed = true
isCanBeResolved = false
}

artifacts {
add(riderModel.name, provider {
intellijPlatform.platformPath.resolve("lib/rd/rider-model.jar").also {
check(it.isFile) {
"rider-model.jar is not found at $riderModel"
}
}
}) {
builtBy(Constants.Tasks.INITIALIZE_INTELLIJ_PLATFORM_PLUGIN)
}
}
7 changes: 5 additions & 2 deletions 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=2024.1.7
PluginVersion=2024.2

BuildConfiguration=Release

Expand All @@ -25,4 +25,7 @@ rdVersion=2025.1
rdKotlinVersion=2.1.0
intellijPlatformGradlePluginVersion=2.2.1
gradleJvmWrapperVersion=0.14.0
riderBaseVersion=2025.1
riderBaseVersion=2025.1

# Required to download Rider artifacts from Maven (and not "binary" releases from CDN).
org.jetbrains.intellij.platform.buildFeature.useBinaryReleases=false
2 changes: 1 addition & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[versions]
kotlin = "2.1.20" # https://plugins.jetbrains.com/docs/intellij/using-kotlin.html#kotlin-standard-library
kotlin = "2.1.10" # https://plugins.jetbrains.com/docs/intellij/using-kotlin.html#kotlin-standard-library
rdGen = "2025.1.1" # https://github.com/JetBrains/rd/releases

[libraries]
Expand Down
52 changes: 52 additions & 0 deletions protocol/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
import com.jetbrains.rd.generator.gradle.RdGenTask

plugins {
id("org.jetbrains.kotlin.jvm")
id("com.jetbrains.rdgen") version libs.versions.rdGen
}

dependencies {
implementation(libs.kotlinStdLib)
implementation(libs.rdGen)
implementation(
project(
mapOf(
"path" to ":",
"configuration" to "riderModel"
)
)
)
}

val DotnetPluginId: String by rootProject
val RiderPluginId: String by rootProject

rdgen {
val csOutput = File(rootDir, "src/dotnet/${DotnetPluginId}")
val ktOutput = File(rootDir, "src/rider/main/kotlin/remodder")

verbose = true
packages = "model.rider"

generator {
language = "kotlin"
transform = "asis"
root = "com.jetbrains.rider.model.nova.ide.IdeRoot"
namespace = "com.jetbrains.rider.model"
directory = "$ktOutput"
}

generator {
language = "csharp"
transform = "reversed"
root = "com.jetbrains.rider.model.nova.ide.IdeRoot"
namespace = "JetBrains.Rider.Model"
directory = "$csOutput"
}
}

tasks.withType<RdGenTask> {
val classPath = sourceSets["main"].runtimeClasspath
dependsOn(classPath)
classpath(classPath)
}
18 changes: 18 additions & 0 deletions protocol/src/main/kotlin/model/rider/Model.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package model.rider

import com.jetbrains.rd.generator.nova.Ext
import com.jetbrains.rd.generator.nova.csharp.CSharp50Generator
import com.jetbrains.rd.generator.nova.kotlin.Kotlin11Generator
import com.jetbrains.rd.generator.nova.*
import com.jetbrains.rd.generator.nova.PredefinedType.*
import com.jetbrains.rider.model.nova.ide.SolutionModel

object RemodderProtocolModel : Ext(SolutionModel.Solution) {
init {
setting(CSharp50Generator.Namespace, "ReSharperPlugin.RdProtocol")
setting(Kotlin11Generator.Namespace, "com.jetbrains.rider.plugins.rdprotocol")

// Remote procedure on backend
call("decompile", array(string), array(string)).async
}
}
14 changes: 8 additions & 6 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,11 @@ pluginManagement {

resolutionStrategy {
eachPlugin {
when (requested.id.name) {
// This required to correctly rd-gen plugin resolution. May be we should switch our naming to match Gradle plugin naming convention.
"rdgen" -> {
useModule("com.jetbrains.rd:rd-gen:${rdVersion}")
}
// Gradle has to map a plugin dependency to Maven coordinates - '{groupId}:{artifactId}:{version}'. It tries
// to do use '{plugin.id}:{plugin.id}.gradle.plugin:version'.
// This doesn't work for rdgen, so we provide some help
if (requested.id.id == "com.jetbrains.rdgen") {
useModule("com.jetbrains.rd:rd-gen:${requested.version}")
}
}
}
Expand All @@ -54,4 +54,6 @@ dependencyResolutionManagement {
maven("https://cache-redirector.jetbrains.com/dl.bintray.com/kotlin/kotlin-eap")
maven("https://cache-redirector.jetbrains.com/myget.org.rd-snapshots.maven")
}
}
}

include(":protocol")
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net472</TargetFramework>
<TargetFramework>net6.0</TargetFramework>
<IsPackable>false</IsPackable>
</PropertyGroup>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,38 @@
"isRequired": "false",
"defaultValue": ""
},
"PublisherPlus": {
"type": "parameter",
"datatype": "bool",
"displayName": "Include a PublisherPlus config",
"description": "If enabled, a PublisherPlus config file will be included in the mod",
"isRequired": "false",
"defaultValue": "true"
},
"CSharp": {
"type": "parameter",
"datatype": "bool",
"displayName": "Add a C# Project and Sources",
"description": "If enabled, this mod will be created with a .sln file, Sources folder and a csproj file",
"isRequired": "false",
"defaultValue": "true"
},
"XML": {
"type": "parameter",
"datatype": "bool",
"displayName": "Add a Defs folder with a starting XML file",
"description": "If enabled, this mod will be created with a Defs folder and a starting XML file",
"isRequired": "false",
"defaultValue": "true"
},
"Languages": {
"type": "parameter",
"datatype": "bool",
"displayName": "Add a Languages folder",
"description": "If enabled, this mod will be created with a Languages folder with a starting English.xml file",
"isRequired": "false",
"defaultValue": "true"
},
"AssemblyDir": {
"type": "derived",
"valueSource": "RimworldDLL",
Expand All @@ -64,11 +96,22 @@
{
"type": "conditional",
"configuration": {
"if": [ "<!--#if" ],
"else": [ "#else", "<!--#else" ],
"elseif": [ "#elseif", "<!--#elseif" ],
"endif": [ "#endif", "<!--#endif" ],
"trim" : "true",
"if": [
"<!--#if"
],
"else": [
"#else",
"<!--#else"
],
"elseif": [
"#elseif",
"<!--#elseif"
],
"endif": [
"#endif",
"<!--#endif"
],
"trim": "true",
"wholeLine": "true"
}
}
Expand All @@ -82,6 +125,28 @@
"replacement": "$1"
}
},
"sources": [
{
"modifiers": [
{
"condition": "PublisherPlus == false",
"exclude": ["_PublisherPlus.xml"]
},
{
"condition": "CSharp == false",
"exclude": ["Source/**/*"]
},
{
"condition": "XML == false",
"exclude": ["Defs/**/*"]
},
{
"condition": "Languages == false",
"exclude": ["Languages/**/*"]
}
]
}
],
"primaryOutputs": [
{
"path": "About/About.xml"
Expand Down Expand Up @@ -120,9 +185,11 @@
},
{
"description": "Restore NuGet packages required by this project.",
"manualInstructions": [{
"text": "Run 'dotnet restore'"
}],
"manualInstructions": [
{
"text": "Run 'dotnet restore'"
}
],
"actionId": "210D431B-A78B-4D2F-B762-4ED3E3EA9025",
"continueOnError": true
}
Expand Down
Loading
Loading