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: 11 additions & 6 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
name: CI

on: [push, pull_request]
on:
push:
branches:
- main
pull_request:

jobs:
Build:
runs-on: windows-latest
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
Expand All @@ -13,7 +17,7 @@ jobs:
uses: actions/setup-java@v4
with:
distribution: 'corretto'
java-version: '17'
java-version: '21'
cache: 'gradle'
- uses: actions/cache@v4
with:
Expand All @@ -22,15 +26,16 @@ jobs:
~/.nuget/packages
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-Build-${{ hashFiles('gradlew.bat', 'src/dotnet/*/*.csproj', 'src/dotnet/*.props', 'gradle-wrapper.properties') }}
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
if: always()
with:
name: ${{ github.event.repository.name }}.CI.${{ github.head_ref || github.ref_name }}
path: output
Test:
runs-on: windows-latest
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
Expand All @@ -49,5 +54,5 @@ jobs:
~/.nuget/packages
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-Test-${{ hashFiles('gradlew.bat', 'src/dotnet/*/*.csproj', 'src/dotnet/*.props', 'gradle-wrapper.properties') }}
key: ${{ runner.os }}-Test-${{ hashFiles('gradlew.bat', 'src/dotnet/*/*.csproj', './*.props', 'gradle-wrapper.properties') }}
- run: ./gradlew :testDotNet --no-daemon
14 changes: 12 additions & 2 deletions .github/workflows/Deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:

jobs:
Publish:
runs-on: windows-latest
runs-on: ubuntu-latest
environment: Deploy
steps:
- uses: actions/checkout@v4
Expand All @@ -19,7 +19,17 @@ jobs:
distribution: 'corretto'
java-version: '17'
cache: 'gradle'
- run: ./gradlew :publishPlugin -PBuildConfiguration="Release" -PPluginVersion="${{ github.ref_name }}" -PPublishToken="${{ secrets.PUBLISH_TOKEN }}"
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x
- name: Publish Rider Package
run: ./gradlew :publishPlugin -PBuildConfiguration="Release" -PPluginVersion="${{ github.ref_name }}" -PPublishToken="${{ secrets.PUBLISH_TOKEN }}"
env:
PUBLISH_TOKEN: ${{ secrets.PUBLISH_TOKEN }}
- run: ./gradlew :buildResharperPlugin
- name: Publish ReSharper Package
run: nuget push --source "https://plugins.jetbrains.com/api/v2/package" --api-key "$PUBLISH_TOKEN" output/ReSharperPlugin*.nupkg
env:
PUBLISH_TOKEN: ${{ secrets.PUBLISH_TOKEN }}
- name: Upload binaries to release
Expand Down
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# Changelog

## 2024.1.6
* Restore missing new project template
* Start automatically publishing ReSharper versions
* Fix some exceptions for non-absolute paths under non-Windows systems
* Start automatically generating the changelogs under the plugin xml
* Look for Steam in more locations on Linux

## 2024.1.5
* Fix case-sensitive matching of mod dependencies

Expand Down
10 changes: 10 additions & 0 deletions Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,16 @@
<UpperWaveVersion>$(WaveVersionBase).9999.0</UpperWaveVersion>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="JetBrains.Annotations" Version="2024.3.0" />
<PackageReference Include="JetBrains.Lifetimes" Version="$(SdkVersion)" />
<PackageReference Include="JetBrains.RdFramework" Version="$(SdkVersion)" />
<PackageReference Include="JetBrains.Rider.SDK" Version="$(SdkVersion)">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies" Version="1.0.0" PrivateAssets="All" />
</ItemGroup>
Expand Down
71 changes: 59 additions & 12 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,15 +1,25 @@
import groovy.ant.FileNameFinder
import org.apache.tools.ant.taskdefs.condition.Os
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.2.1" // https://github.com/JetBrains/gradle-intellij-plugin/releases
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"
}


java {
sourceCompatibility = JavaVersion.VERSION_21

toolchain {
languageVersion = JavaLanguageVersion.of(21)
}
}

val isWindows = Os.isFamily(Os.FAMILY_WINDOWS)
extra["isWindows"] = isWindows

Expand All @@ -19,6 +29,7 @@ val ProductVersion: String by project
val DotnetPluginId: String by project
val RiderPluginId: String by project
val PublishToken: String by project
val PluginVersion: String by project

allprojects {
repositories {
Expand Down Expand Up @@ -47,7 +58,8 @@ apply {
tasks.wrapper {
gradleVersion = "8.8"
distributionType = Wrapper.DistributionType.ALL
distributionUrl = "https://cache-redirector.jetbrains.com/services.gradle.org/distributions/gradle-${gradleVersion}-all.zip"
distributionUrl =
"https://cache-redirector.jetbrains.com/services.gradle.org/distributions/gradle-${gradleVersion}-all.zip"
}

version = extra["PluginVersion"] as String
Expand All @@ -69,7 +81,7 @@ tasks.instrumentTestCode {
}

tasks.compileKotlin {
kotlinOptions { jvmTarget = "17" }
kotlinOptions { jvmTarget = "21" }
}

val setBuildTool by tasks.registering {
Expand Down Expand Up @@ -122,31 +134,52 @@ val compileDotNet by tasks.registering {
}
}

val buildResharperPlugin by tasks.registering {
dependsOn(setBuildTool)
doLast {
val executable: String by setBuildTool.get().extra
val arguments = (setBuildTool.get().extra["args"] as List<String>).toMutableList()
arguments.add("/t:Restore;Rebuild;Pack")
arguments.add("/v:minimal")
arguments.add("/p:PackageOutputPath=\"$rootDir/output\"")
arguments.add("/p:PackageVersion=$PluginVersion")
exec {
executable(executable)
args(arguments)
workingDir(rootDir)
}
}
}

tasks.buildPlugin {
doLast {
copy {
from("${buildDir}/distributions/${rootProject.name}-${version}.zip")
into("${rootDir}/output")
}

val changelogText = file("${rootDir}/CHANGELOG.md").readText()
val changelogMatches = Regex("(?s)(-.+?)(?=##|$)").findAll(changelogText)
val changeNotes = changelogMatches.map {
it.groups[1]!!.value.replace("(?s)- ".toRegex(), "\u2022 ").replace("`", "").replace(",", "%2C").replace(";", "%3B")
}.take(1).joinToString()
}
}

dependencies {
intellijPlatform {
rider(ProductVersion)
rider(ProductVersion, useInstaller = false)
jetbrainsRuntime()

bundledPlugin("com.intellij.resharper.unity")
}
}

intellijPlatform {
pluginVerification {
freeArgs = listOf("-mute", "TemplateWordInPluginId")

ides {
ide(IntelliJPlatformType.Rider, ProductVersion)
recommended()
}
}
}

tasks.runIde {
// Match Rider's default heap size of 1.5Gb (default for runIde is 512Mb)
maxHeapSize = "1500m"
Expand All @@ -170,6 +203,8 @@ tasks.prepareSandbox {
from(file, { into("${rootProject.name}/dotnet") })
})

from("${rootDir}/src/dotnet/${DotnetPluginId}/projectTemplates", { into("${rootProject.name}/projectTemplates") })

doLast {
dllFiles.forEach({ f ->
val file = file(f)
Expand All @@ -182,7 +217,7 @@ val testDotNet by tasks.registering {
doLast {
exec {
executable("dotnet")
args("test", DotnetSolution,"--logger","GitHubActions")
args("test", DotnetSolution, "--logger", "GitHubActions")
workingDir(rootDir)
}
}
Expand All @@ -194,6 +229,18 @@ tasks.publishPlugin {
token.set(PublishToken)
}

tasks.patchPluginXml {
tasks.patchPluginXml {
val changelogText = file("${rootDir}/CHANGELOG.md").readText()
.lines()
.dropWhile { !it.trim().startsWith("##") }
.drop(1)
.takeWhile { !it.trim().startsWith("##") }
.filter { it.trim().isNotEmpty() }
.joinToString("\r\n") {
"<li>${it.trim().replace(Regex("^\\*\\s+?"), "")}</li>"
}.trim()

pluginVersion.set(PluginVersion)
changeNotes.set("<ul>\r\n$changelogText\r\n</ul>");
untilBuild.set(provider { null })
}
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=2024.1.5
PluginVersion=2024.1.6

BuildConfiguration=Release

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,6 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="JetBrains.ReSharper.SDK" Version="2025.1.0" PrivateAssets="all">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Update="Microsoft.NETFramework.ReferenceAssemblies" Version="1.0.3" />
<PackageReference Include="Lib.Harmony" Version="2.3.3" />
</ItemGroup>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,6 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="JetBrains.Annotations" Version="2024.3.0" />
<PackageReference Include="JetBrains.Lifetimes" Version="$(SdkVersion)" />
<PackageReference Include="JetBrains.RdFramework" Version="$(SdkVersion)" />
<PackageReference Include="JetBrains.Rider.SDK" Version="$(SdkVersion)">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Lib.Harmony" Version="2.3.3" />
</ItemGroup>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,13 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="JetBrains.ReSharper.SDK" Version="$(SdkVersion)" PrivateAssets="all" />
<PackageReference Include="Wave" Version="$(WaveVersion)" />
<!-- TODO: https://github.com/NuGet/Home/issues/7154 -->
</ItemGroup>


<ItemGroup>
<Content Include="bin\$(AssemblyName)\$(Configuration)\$(AssemblyName).dll" PackagePath="dotFiles" Pack="true" />
<Content Include="bin\$(AssemblyName)\$(Configuration)\$(AssemblyName).pdb" PackagePath="dotFiles" Pack="true" />

<!-- TODO: add additional assemblies -->
</ItemGroup>

<ItemGroup>
Expand All @@ -54,7 +50,7 @@
<ItemGroup>
<None Remove="projectTemplates\**" />
</ItemGroup>

<Import Project="Sdk.targets" Sdk="Microsoft.NET.Sdk" />

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ public static List<string> GetHierarchy(ITreeNode treeNode)
// classes that it inherits from
public static List<IField> GetAllPublicFields(ITypeElement desiredClass, ISymbolScope symbolScope)
{
return desiredClass.GetAllClassMembers<IField>()
return desiredClass.EnumerateTypeMembersWholeHierarchyIncludeOverridenMembersFromBase<IField>()
.Where(field => !field.Member.GetAttributeInstances(AttributesSource.All)
.Select(attribute => attribute.GetAttributeShortName()).Contains("UnsavedAttribute"))
.Where(member =>
Expand Down
5 changes: 4 additions & 1 deletion src/dotnet/ReSharperPlugin.RimworldDev/ScopeHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -192,13 +192,16 @@ private static IEnumerable<string> GetSteamLocations()
{
@"C:\Program Files (x86)\Steam\steamapps\",
@"C:\Program Files\Steam\steamapps\",
$"{Environment.GetFolderPath(Environment.SpecialFolder.UserProfile)}/steam/steam/steamapps/"
$"{Environment.GetFolderPath(Environment.SpecialFolder.UserProfile)}/steam/steam/steamapps/",
$"{Environment.GetFolderPath(Environment.SpecialFolder.UserProfile)}/snap/steam/common/.local/share/Steam/steamapps/",
$"{Environment.GetFolderPath(Environment.SpecialFolder.UserProfile)}/.local/share/Steam/steamapps/",
};

locations.AddRange(
DriveInfo
.GetDrives()
.Select(drive => $@"{drive.RootDirectory.Name}/SteamLibrary/steamapps/")
.Select(location => !RuntimeInfo.IsRunningUnderWindows ? $"/{location}" : location)
);

return locations
Expand Down
10 changes: 2 additions & 8 deletions src/rider/main/resources/META-INF/plugin.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<idea-plugin require-restart="true">
<id>com.jetbrains.rider.plugins.rimworlddev</id>
<name>Rimworld Development Environment</name>
<version>2024.1.5</version>
<version>0.0.0</version>
<vendor url="https://github.com/Garethp/Rider-RimworldDevelopment">Garethp</vendor>
<idea-version since-build="251" />
<depends>com.intellij.modules.rider</depends>
Expand All @@ -15,13 +15,7 @@ in your mods!</p>
]]>
</description>

<change-notes>
<![CDATA[
<p><ul>
<li>Fix case-sensitive matching of mod dependencies</li>
</ul></p>
]]>
</change-notes>
<change-notes>Will be auto-generated</change-notes>

<extensions defaultExtensionNs="com.intellij">
<applicationConfigurable groupId="language" instance="RimworldDev.Rider.settings.RimworldSettings" displayName="Rimworld" id="preferences.build.rimworldPlugin" />
Expand Down
Loading