diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index ac7a0a3..79bc706 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -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: @@ -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: @@ -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: @@ -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 \ No newline at end of file diff --git a/.github/workflows/Deploy.yml b/.github/workflows/Deploy.yml index 9a84968..c07f7a9 100644 --- a/.github/workflows/Deploy.yml +++ b/.github/workflows/Deploy.yml @@ -7,7 +7,7 @@ on: jobs: Publish: - runs-on: windows-latest + runs-on: ubuntu-latest environment: Deploy steps: - uses: actions/checkout@v4 @@ -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 diff --git a/CHANGELOG.md b/CHANGELOG.md index 1857d33..79fdd53 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/Directory.Build.props b/Directory.Build.props index 7557298..20c468f 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -35,6 +35,16 @@ $(WaveVersionBase).9999.0 + + + + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + diff --git a/build.gradle.kts b/build.gradle.kts index 04e7337..407f416 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -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 @@ -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 { @@ -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 @@ -69,7 +81,7 @@ tasks.instrumentTestCode { } tasks.compileKotlin { - kotlinOptions { jvmTarget = "17" } + kotlinOptions { jvmTarget = "21" } } val setBuildTool by tasks.registering { @@ -122,6 +134,22 @@ 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).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 { @@ -129,24 +157,29 @@ tasks.buildPlugin { 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" @@ -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) @@ -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) } } @@ -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") { + "
  • ${it.trim().replace(Regex("^\\*\\s+?"), "")}
  • " + }.trim() + + pluginVersion.set(PluginVersion) + changeNotes.set(""); untilBuild.set(provider { null }) } \ No newline at end of file diff --git a/gradle.properties b/gradle.properties index c5915c1..36f8eab 100644 --- a/gradle.properties +++ b/gradle.properties @@ -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 diff --git a/src/dotnet/ReSharperPlugin.RimworldDev.Tests/ReSharperPlugin.RimworldDev.Tests.csproj b/src/dotnet/ReSharperPlugin.RimworldDev.Tests/ReSharperPlugin.RimworldDev.Tests.csproj index 9598e48..5088e5a 100644 --- a/src/dotnet/ReSharperPlugin.RimworldDev.Tests/ReSharperPlugin.RimworldDev.Tests.csproj +++ b/src/dotnet/ReSharperPlugin.RimworldDev.Tests/ReSharperPlugin.RimworldDev.Tests.csproj @@ -6,10 +6,6 @@ - - runtime; build; native; contentfiles; analyzers; buildtransitive - - diff --git a/src/dotnet/ReSharperPlugin.RimworldDev/ReSharperPlugin.RimworldDev.Rider.csproj b/src/dotnet/ReSharperPlugin.RimworldDev/ReSharperPlugin.RimworldDev.Rider.csproj index 629b4d3..bbae16a 100644 --- a/src/dotnet/ReSharperPlugin.RimworldDev/ReSharperPlugin.RimworldDev.Rider.csproj +++ b/src/dotnet/ReSharperPlugin.RimworldDev/ReSharperPlugin.RimworldDev.Rider.csproj @@ -21,13 +21,6 @@ - - - - - all - runtime; build; native; contentfiles; analyzers; buildtransitive - diff --git a/src/dotnet/ReSharperPlugin.RimworldDev/ReSharperPlugin.RimworldDev.csproj b/src/dotnet/ReSharperPlugin.RimworldDev/ReSharperPlugin.RimworldDev.csproj index 9ad59b3..d37d610 100644 --- a/src/dotnet/ReSharperPlugin.RimworldDev/ReSharperPlugin.RimworldDev.csproj +++ b/src/dotnet/ReSharperPlugin.RimworldDev/ReSharperPlugin.RimworldDev.csproj @@ -20,17 +20,13 @@ - - - - @@ -54,7 +50,7 @@ - + diff --git a/src/dotnet/ReSharperPlugin.RimworldDev/RimworldXMLItemProvider.cs b/src/dotnet/ReSharperPlugin.RimworldDev/RimworldXMLItemProvider.cs index 97f58e3..8181a62 100644 --- a/src/dotnet/ReSharperPlugin.RimworldDev/RimworldXMLItemProvider.cs +++ b/src/dotnet/ReSharperPlugin.RimworldDev/RimworldXMLItemProvider.cs @@ -282,7 +282,7 @@ public static List GetHierarchy(ITreeNode treeNode) // classes that it inherits from public static List GetAllPublicFields(ITypeElement desiredClass, ISymbolScope symbolScope) { - return desiredClass.GetAllClassMembers() + return desiredClass.EnumerateTypeMembersWholeHierarchyIncludeOverridenMembersFromBase() .Where(field => !field.Member.GetAttributeInstances(AttributesSource.All) .Select(attribute => attribute.GetAttributeShortName()).Contains("UnsavedAttribute")) .Where(member => diff --git a/src/dotnet/ReSharperPlugin.RimworldDev/ScopeHelper.cs b/src/dotnet/ReSharperPlugin.RimworldDev/ScopeHelper.cs index f603da2..07ececf 100644 --- a/src/dotnet/ReSharperPlugin.RimworldDev/ScopeHelper.cs +++ b/src/dotnet/ReSharperPlugin.RimworldDev/ScopeHelper.cs @@ -192,13 +192,16 @@ private static IEnumerable 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 diff --git a/src/rider/main/resources/META-INF/plugin.xml b/src/rider/main/resources/META-INF/plugin.xml index 9bf760a..f7727ce 100644 --- a/src/rider/main/resources/META-INF/plugin.xml +++ b/src/rider/main/resources/META-INF/plugin.xml @@ -1,7 +1,7 @@ com.jetbrains.rider.plugins.rimworlddev Rimworld Development Environment - 2024.1.5 + 0.0.0 Garethp com.intellij.modules.rider @@ -15,13 +15,7 @@ in your mods!

    ]]> - -
      -
    • Fix case-sensitive matching of mod dependencies
    • -

    -]]> -
    + Will be auto-generated