diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 334383e2..2863e528 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -30,14 +30,15 @@ jobs: runs-on: ${{ matrix.runs-on }} steps: - name: Setup .NET Core SDK - uses: actions/setup-dotnet@v3 + uses: actions/setup-dotnet@v4 with: dotnet-version: | 6.0.x 7.0.x + 8.0.x - name: Fetch Sources - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Run Tests working-directory: backend @@ -49,18 +50,18 @@ jobs: runs-on: ubuntu-latest steps: - name: Docker Setup Buildx - uses: docker/setup-buildx-action@v2.4.1 + uses: docker/setup-buildx-action@v3 # Check out current repository - name: Fetch Sources - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Run Publish Script working-directory: backend run: ./publish.sh - name: Upload Backend Artifact - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: backend-artifact path: plugin/src/main/resources/raw/RossyntBackend @@ -88,15 +89,15 @@ jobs: # Check out current repository - name: Fetch Sources - uses: actions/checkout@v3 + uses: actions/checkout@v4 # Validate wrapper - name: Gradle Wrapper Validation - uses: gradle/wrapper-validation-action@v1.0.5 + uses: gradle/wrapper-validation-action@v1 # Setup Java 11 environment for the next steps - name: Setup Java - uses: actions/setup-java@v3 + uses: actions/setup-java@v4 with: distribution: zulu java-version: 11 @@ -125,7 +126,7 @@ jobs: ./gradlew listProductsReleases # prepare list of IDEs for Plugin Verifier - name: Download Backend Artifact - uses: actions/download-artifact@v3.0.2 + uses: actions/download-artifact@v4 with: name: backend-artifact path: plugin/src/main/resources/raw/RossyntBackend @@ -138,7 +139,7 @@ jobs: # Collect Tests Result of failed tests - name: Collect Tests Result if: ${{ failure() }} - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: tests-result path: ${{ github.workspace }}/plugin/build/reports/tests @@ -158,18 +159,18 @@ jobs: # Collect Plugin Verifier Result - name: Collect Plugin Verifier Result if: ${{ always() }} - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: pluginVerifier-result path: ${{ github.workspace }}/plugin/build/reports/pluginVerifier # Run Qodana inspections - name: Qodana - Code Inspection - uses: JetBrains/qodana-action@v2022.3.0 + uses: JetBrains/qodana-action@v2023.3.0 # Store already-built plugin as an artifact for downloading - name: Upload artifact - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: plugin-artifact path: ./plugin/build/distributions/${{ steps.properties.outputs.artifact }} @@ -187,11 +188,11 @@ jobs: # Check out current repository - name: Fetch Sources - uses: actions/checkout@v3 + uses: actions/checkout@v4 # Download plugin artifact provided by the previous job - name: Download Artifact - uses: actions/download-artifact@v3.0.2 + uses: actions/download-artifact@v4 with: name: plugin-artifact diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 3c2755c1..5d33addb 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -41,7 +41,7 @@ jobs: # Check out current repository - name: Fetch Sources - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: ref: ${{ github.event.release.tag_name }} diff --git a/.github/workflows/run-ui-tests.yml b/.github/workflows/run-ui-tests.yml index 229188d9..6af3947a 100644 --- a/.github/workflows/run-ui-tests.yml +++ b/.github/workflows/run-ui-tests.yml @@ -33,11 +33,11 @@ jobs: # Check out current repository - name: Fetch Sources - uses: actions/checkout@v3 + uses: actions/checkout@v4 # Setup Java 11 environment for the next steps - name: Setup Java - uses: actions/setup-java@v3 + uses: actions/setup-java@v4 with: distribution: zulu java-version: 11 diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 8ab9df94..555106f7 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -11,7 +11,7 @@ jobs: # Check out current repository - name: Fetch Sources - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: ref: ${{ github.event.release.tag_name }} diff --git a/CHANGELOG.md b/CHANGELOG.md index dcae2849..2df62730 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,23 @@ # Rossynt Changelog ## [Unreleased] + +## [231.5.0] - 2024-01-15 +### Added +- Support for .NET 8 and CSharp12 +- Support for IntelliJ Platform 2023.2 +- Another default path for the dotnet binary which is common on Linux: `/usr/bin/dotnet` + +### Changed +- An exclusion for the `slf4-api` package has been added to the build phase to prevent another `NoClassDefFoundError` +- The plugin files have been updated according to the latest intellij-platform-plugin-template commit +- All the GitHub Action dependencies have been updated +- All the .NET dependencies have been updated (including code changes to make the backend compatible with the new NUnit version) +- All the Java dependencies have been updated + +### Removed +- Support for IDE builds `< 231`, since the plugin verifier found incompatibilities with older versions. + ## [223.4.0] - 2023-02-18 ### Added - Support .NET 7. diff --git a/README.md b/README.md index e8b3216b..e9b72986 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,7 @@ Rossynt - **Ros**lyn **syn**tax **t**ree viewer for C#. Works on JetBrains Rider ## System Requirements -* [ASP.NET Core Runtime](https://dotnet.microsoft.com/download/dotnet) (6.0 or 7.0) +* [ASP.NET Core Runtime](https://dotnet.microsoft.com/download/dotnet) (6.0, 7.0 or 8.0) * [.NET CLI tool](https://docs.microsoft.com/en-us/dotnet/core/tools/) These are all included if you have installed [.NET SDK](https://dotnet.microsoft.com/download/dotnet) or [Visual Studio](https://visualstudio.microsoft.com/downloads/). diff --git a/backend/Dockerfile b/backend/Dockerfile index 62e4cda0..27a7163b 100644 --- a/backend/Dockerfile +++ b/backend/Dockerfile @@ -5,6 +5,7 @@ # https://stackoverflow.com/a/65485962 FROM mcr.microsoft.com/dotnet/aspnet:6.0-bullseye-slim AS build COPY --from=mcr.microsoft.com/dotnet/sdk:7.0 /usr/share/dotnet /usr/share/dotnet +COPY --from=mcr.microsoft.com/dotnet/sdk:8.0 /usr/share/dotnet /usr/share/dotnet # Copy csproj and restore as distinct layers. WORKDIR /source @@ -22,15 +23,18 @@ COPY RossyntBackend/. ./RossyntBackend/ # Run unit test. WORKDIR /source/RossyntBackendUnitTest +RUN dotnet test -c release --framework net8.0 -o /app-unit-test/net8.0 RUN dotnet test -c release --framework net7.0 -o /app-unit-test/net7.0 RUN dotnet test -c release --framework net6.0 -o /app-unit-test/net6.0 # Run integration test. WORKDIR /source/RossyntBackendIntegrationTest +RUN dotnet test -c release --framework net8.0 -o /app-integration-test/net8.0 RUN dotnet test -c release --framework net7.0 -o /app-integration-test/net7.0 RUN dotnet test -c release --framework net6.0 -o /app-integration-test/net6.0 # Build app. WORKDIR /source/RossyntBackend +RUN dotnet publish -c release --framework net8.0 -o /app/net8.0 --no-restore RUN dotnet publish -c release --framework net7.0 -o /app/net7.0 --no-restore RUN dotnet publish -c release --framework net6.0 -o /app/net6.0 --no-restore diff --git a/backend/RossyntBackend/RossyntBackend.csproj b/backend/RossyntBackend/RossyntBackend.csproj index 07716b5a..3a308109 100644 --- a/backend/RossyntBackend/RossyntBackend.csproj +++ b/backend/RossyntBackend/RossyntBackend.csproj @@ -1,15 +1,15 @@ - net7.0;net6.0 + net8.0;net7.0;net6.0 en enable - - - + + + diff --git a/backend/RossyntBackendIntegrationTest/IntegrationTest.cs b/backend/RossyntBackendIntegrationTest/IntegrationTest.cs index 5dc15d68..4444fb85 100644 --- a/backend/RossyntBackendIntegrationTest/IntegrationTest.cs +++ b/backend/RossyntBackendIntegrationTest/IntegrationTest.cs @@ -63,6 +63,7 @@ public Task CompileFileCSharp9Record([Values] LanguageVersion cSharpVersion) => case LanguageVersion.CSharp9: case LanguageVersion.CSharp10: case LanguageVersion.CSharp11: + case LanguageVersion.CSharp12: case LanguageVersion.LatestMajor: case LanguageVersion.Preview: case LanguageVersion.Latest: @@ -115,43 +116,45 @@ public Task CompileFileCSharp11FileScopedType() => RunWithHttpClient(async httpC public Task GetNodeInfo() => RunWithHttpClient(async httpClient => { var root = await CompileFile(httpClient, "using"); var nodeId = root["Child"]?[0]?["Id"]?.Value(); - Assert.IsNotNull(nodeId); + Assert.That(nodeId, Is.Not.Null); var nodeInfo = await GetNodeInfo(httpClient, nodeId!); - Assert.AreEqual("", nodeInfo["Alias"]); - Assert.AreEqual("False", nodeInfo["ContainsAnnotations"]); - Assert.AreEqual("True", nodeInfo["ContainsDiagnostics"]); - Assert.AreEqual("False", nodeInfo["ContainsDirectives"]); - Assert.AreEqual("False", nodeInfo["ContainsSkippedText"]); - Assert.AreEqual("[0..5)", nodeInfo["FullSpan"]); - Assert.AreEqual("", nodeInfo["GlobalKeyword"]); - Assert.AreEqual("False", nodeInfo["HasLeadingTrivia"]); - Assert.AreEqual("False", nodeInfo["HasStructuredTrivia"]); - Assert.AreEqual("False", nodeInfo["HasTrailingTrivia"]); - Assert.AreEqual("False", nodeInfo["IsMissing"]); - Assert.AreEqual("True", nodeInfo["IsNode"]); - Assert.AreEqual("False", nodeInfo["IsStructuredTrivia"]); - Assert.AreEqual("False", nodeInfo["IsToken"]); - Assert.AreEqual("C#", nodeInfo["Language"]); - Assert.AreEqual("", nodeInfo["Name"]); - Assert.AreEqual("using", nodeInfo["Parent"]); - Assert.AreEqual("", nodeInfo["ParentTrivia"]); - Assert.AreEqual("8843", nodeInfo["RawKind"]); - Assert.AreEqual("", nodeInfo["SemicolonToken"]); - Assert.AreEqual("[0..5)", nodeInfo["Span"]); - Assert.AreEqual("0", nodeInfo["SpanStart"]); - Assert.AreEqual("", nodeInfo["StaticKeyword"]); - Assert.AreEqual("using", nodeInfo["SyntaxTree"]); - Assert.AreEqual("using", nodeInfo["UsingKeyword"]); - Assert.AreEqual(25, nodeInfo.Count); + Assert.That(nodeInfo["Alias"], Is.EqualTo("")); + Assert.That(nodeInfo["ContainsAnnotations"], Is.EqualTo("False")); + Assert.That(nodeInfo["ContainsDiagnostics"], Is.EqualTo("True")); + Assert.That(nodeInfo["ContainsDirectives"], Is.EqualTo("False")); + Assert.That(nodeInfo["ContainsSkippedText"], Is.EqualTo("False")); + Assert.That(nodeInfo["FullSpan"], Is.EqualTo("[0..5)")); + Assert.That(nodeInfo["GlobalKeyword"], Is.EqualTo("")); + Assert.That(nodeInfo["HasLeadingTrivia"], Is.EqualTo("False")); + Assert.That(nodeInfo["HasStructuredTrivia"], Is.EqualTo("False")); + Assert.That(nodeInfo["HasTrailingTrivia"], Is.EqualTo("False")); + Assert.That(nodeInfo["IsMissing"], Is.EqualTo("False")); + Assert.That(nodeInfo["IsNode"], Is.EqualTo("True")); + Assert.That(nodeInfo["IsStructuredTrivia"], Is.EqualTo("False")); + Assert.That(nodeInfo["IsToken"], Is.EqualTo("False")); + Assert.That(nodeInfo["Language"], Is.EqualTo("C#")); + Assert.That(nodeInfo["Name"], Is.EqualTo("")); + Assert.That(nodeInfo["NamespaceOrType"], Is.EqualTo("")); + Assert.That(nodeInfo["Parent"], Is.EqualTo("using")); + Assert.That(nodeInfo["ParentTrivia"], Is.EqualTo("")); + Assert.That(nodeInfo["RawKind"], Is.EqualTo("8843")); + Assert.That(nodeInfo["SemicolonToken"], Is.EqualTo("")); + Assert.That(nodeInfo["Span"], Is.EqualTo("[0..5)")); + Assert.That(nodeInfo["SpanStart"], Is.EqualTo("0")); + Assert.That(nodeInfo["StaticKeyword"], Is.EqualTo("")); + Assert.That(nodeInfo["SyntaxTree"], Is.EqualTo("using")); + Assert.That(nodeInfo["UnsafeKeyword"], Is.EqualTo("")); + Assert.That(nodeInfo["UsingKeyword"], Is.EqualTo("using")); + Assert.That(nodeInfo.Count, Is.EqualTo(27)); }); [Test] public Task ResetActiveFile() => RunWithHttpClient(async httpClient => { var root = await CompileFile(httpClient, "using"); var nodeId = root["Id"]?.Value(); - Assert.IsNotNull(nodeId); + Assert.That(nodeId, Is.Not.Null); var nodeInfo = await GetNodeInfo(httpClient, nodeId!); - Assert.IsTrue(nodeInfo.Count > 0); + Assert.That(nodeInfo.Count, Is.GreaterThan(0)); await ResetActiveFile(httpClient); Assert.CatchAsync(() => GetNodeInfo(httpClient, nodeId!)); }); @@ -165,7 +168,7 @@ public Task FindNode() => RunWithHttpClient(async httpClient => { node = node?["Child"]?[0]; // VariableDeclaration node = node?["Child"]?[1]; // VariableDeclarator node = node?["Child"]?[0]; // IdentifierToken - Assert.AreEqual(nodeId, node?["Id"]?.Value()); + Assert.That(nodeId, Is.EqualTo(node?["Id"]?.Value())); }); private static async Task RunWithHttpClient(Func func) { @@ -188,7 +191,7 @@ private async Task CompileFile(HttpClient httpClient, string fileText, } var httpResponseMessage = await httpClient.PostAsync("/syntaxTree/compileFile", new FormUrlEncodedContent(parameters)); - Assert.IsTrue(httpResponseMessage.IsSuccessStatusCode); + Assert.That(httpResponseMessage.IsSuccessStatusCode, Is.True); var responseBody = await httpResponseMessage.Content.ReadAsStringAsync(); return JObject.Parse(responseBody); } @@ -200,10 +203,10 @@ private static async Task> GetNodeInfo(HttpClient ht var parameters = ImmutableDictionary.Empty; parameters = parameters.Add("NodeId", nodeId); var httpResponseMessage = await httpClient.PostAsync("/syntaxTree/getNodeInfo", new FormUrlEncodedContent(parameters)); - Assert.IsTrue(httpResponseMessage.IsSuccessStatusCode); + Assert.That(httpResponseMessage.IsSuccessStatusCode, Is.True); var responseBody = await httpResponseMessage.Content.ReadAsStringAsync(); var dictionary = JsonConvert.DeserializeObject>(responseBody); - Assert.IsNotNull(dictionary); + Assert.That(dictionary, Is.Not.Null); return dictionary!; } @@ -212,7 +215,7 @@ private static async Task ResetActiveFile(HttpClient httpClient) { var parameters = ImmutableDictionary.Empty; var httpResponseMessage = await httpClient.PostAsync("/syntaxTree/resetActiveFile", new FormUrlEncodedContent(parameters)); - Assert.IsTrue(httpResponseMessage.IsSuccessStatusCode); + Assert.That(httpResponseMessage.IsSuccessStatusCode, Is.True); } private static async Task FindNode(HttpClient httpClient, int start, int end) { @@ -222,14 +225,14 @@ private static async Task FindNode(HttpClient httpClient, int start, int parameters = parameters.Add("Start", start.ToString()); parameters = parameters.Add("End", end.ToString()); var httpResponseMessage = await httpClient.PostAsync("/syntaxTree/findNode", new FormUrlEncodedContent(parameters)); - Assert.IsTrue(httpResponseMessage.IsSuccessStatusCode); + Assert.That(httpResponseMessage.IsSuccessStatusCode, Is.True); var responseBody = await httpResponseMessage.Content.ReadAsStringAsync(); var dictionary = JsonConvert.DeserializeObject>(responseBody); - Assert.IsNotNull(dictionary); - Assert.AreEqual(1, dictionary!.Count); - Assert.IsTrue(dictionary.ContainsKey("nodeId")); + Assert.That(dictionary, Is.Not.Null); + Assert.That(1, Is.EqualTo(dictionary!.Count)); + Assert.That(dictionary.ContainsKey("nodeId"), Is.True); var nodeId = dictionary["nodeId"]; - Assert.IsNotNull(nodeId); + Assert.That(nodeId, Is.Not.Null); return nodeId; } @@ -240,13 +243,13 @@ private static void AssertNode(JToken? node, string cat, string type, string kin if (str == null) throw new ArgumentNullException(nameof(str)); if (span == null) throw new ArgumentNullException(nameof(span)); - Assert.IsNotNull(node); - Assert.AreEqual(cat, node!["Cat"]?.Value()); - Assert.AreEqual(type, node["Type"]?.Value()); - Assert.AreEqual(kind, node["Kind"]?.Value()); - Assert.AreEqual(str.Length > 0 ? str : null, node["Str"]?.Value()); - Assert.AreEqual(span.Length > 0 ? span : null, node["Span"]?.Value()); - Assert.AreEqual(isMissing ? (int?)1 : null, node["IsMissing"]?.Value()); - Assert.AreEqual(childCount > 0 ? (int?)childCount : null, node["Child"]?.Count()); + Assert.That(node, Is.Not.Null); + Assert.That(node!["Cat"]?.Value(), Is.EqualTo(cat)); + Assert.That(node["Type"]?.Value(), Is.EqualTo(type)); + Assert.That(node["Kind"]?.Value(), Is.EqualTo(kind)); + Assert.That(node["Str"]?.Value(), Is.EqualTo(str.Length > 0 ? str : null)); + Assert.That(node["Span"]?.Value(), Is.EqualTo(span.Length > 0 ? span : null)); + Assert.That(node["IsMissing"]?.Value(), Is.EqualTo(isMissing ? (int?)1 : null)); + Assert.That(node["Child"]?.Count(), Is.EqualTo(childCount > 0 ? (int?)childCount : null)); } } diff --git a/backend/RossyntBackendIntegrationTest/RossyntBackendIntegrationTest.csproj b/backend/RossyntBackendIntegrationTest/RossyntBackendIntegrationTest.csproj index 9efa7d15..77c63e81 100644 --- a/backend/RossyntBackendIntegrationTest/RossyntBackendIntegrationTest.csproj +++ b/backend/RossyntBackendIntegrationTest/RossyntBackendIntegrationTest.csproj @@ -1,7 +1,7 @@ - net7.0;net6.0 + net8.0;net7.0;net6.0 false @@ -9,13 +9,14 @@ - + - - - - + + + + + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/backend/RossyntBackendUnitTest/CSharpVersionTest.cs b/backend/RossyntBackendUnitTest/CSharpVersionTest.cs index be0595a2..284fc714 100644 --- a/backend/RossyntBackendUnitTest/CSharpVersionTest.cs +++ b/backend/RossyntBackendUnitTest/CSharpVersionTest.cs @@ -28,6 +28,7 @@ private enum CSharpVersion { CSharp9, CSharp10, CSharp11, + CSharp12, Latest, LatestMajor, Preview diff --git a/backend/RossyntBackendUnitTest/ObjectUtilTest.cs b/backend/RossyntBackendUnitTest/ObjectUtilTest.cs index e15fd93b..cc307dff 100644 --- a/backend/RossyntBackendUnitTest/ObjectUtilTest.cs +++ b/backend/RossyntBackendUnitTest/ObjectUtilTest.cs @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; using NUnit.Framework; +using NUnit.Framework.Legacy; using RossyntBackend.Utils; namespace RossyntBackendUnitTest; diff --git a/backend/RossyntBackendUnitTest/RossyntBackendUnitTest.csproj b/backend/RossyntBackendUnitTest/RossyntBackendUnitTest.csproj index d792ed15..a3029e60 100644 --- a/backend/RossyntBackendUnitTest/RossyntBackendUnitTest.csproj +++ b/backend/RossyntBackendUnitTest/RossyntBackendUnitTest.csproj @@ -1,7 +1,7 @@ - net7.0;net6.0 + net8.0;net7.0;net6.0 false @@ -9,10 +9,10 @@ - - - - + + + + diff --git a/backend/RossyntBackendUnitTest/StringExtensionTest.cs b/backend/RossyntBackendUnitTest/StringExtensionTest.cs index 88c28038..b6953479 100644 --- a/backend/RossyntBackendUnitTest/StringExtensionTest.cs +++ b/backend/RossyntBackendUnitTest/StringExtensionTest.cs @@ -23,7 +23,7 @@ public class StringExtensionTest { [TestCase("😀", 1, "")] [TestCase("😀", 0, "")] public void SurrogateSafeLeft(string inputString, int maxLength, string expectedResult) { - Assert.AreEqual(expectedResult, inputString.SurrogateSafeLeft(maxLength)); + Assert.That(expectedResult, Is.EqualTo(inputString.SurrogateSafeLeft(maxLength))); } [Test] diff --git a/plugin/build.gradle.kts b/plugin/build.gradle.kts index 50b4e1c8..50b5c31f 100644 --- a/plugin/build.gradle.kts +++ b/plugin/build.gradle.kts @@ -1,112 +1,112 @@ import org.jetbrains.changelog.Changelog import org.jetbrains.changelog.markdownToHTML -fun properties(key: String) = project.findProperty(key).toString() +fun properties(key: String) = providers.gradleProperty(key) +fun environment(key: String) = providers.environmentVariable(key) plugins { - // Java support - id("java") - // Kotlin support - id("org.jetbrains.kotlin.jvm") version "1.8.0" - // Gradle IntelliJ Plugin - id("org.jetbrains.intellij") version "1.12.0" - // Gradle Changelog Plugin -/* ROLL_BACK_CHANGELOG_PLUGIN BEGIN - https://github.com/JetBrains/gradle-changelog-plugin/issues/147 - id("org.jetbrains.changelog") version "2.0.0" -*/ - id("org.jetbrains.changelog") version "1.3.1" -/* ROLL_BACK_CHANGELOG_PLUGIN END */ - // Gradle Qodana Plugin - id("org.jetbrains.qodana") version "0.1.13" + id("java") // Java support + alias(libs.plugins.kotlin) // Kotlin support + alias(libs.plugins.gradleIntelliJPlugin) // Gradle IntelliJ Plugin + alias(libs.plugins.changelog) // Gradle Changelog Plugin + alias(libs.plugins.qodana) // Gradle Qodana Plugin + alias(libs.plugins.kover) // Gradle Kover Plugin } -group = properties("pluginGroup") -version = properties("pluginVersion") +group = properties("pluginGroup").get() +version = properties("pluginVersion").get() // Configure project's dependencies repositories { mavenCentral() } + +// Dependencies are managed with Gradle version catalog - read more: https://docs.gradle.org/current/userguide/platforms.html#sub:version-catalog dependencies { - implementation("io.ktor:ktor-client-content-negotiation:2.2.1") - implementation("io.ktor:ktor-client-core:2.2.1") - implementation("io.ktor:ktor-client-cio:2.2.1") - implementation("io.ktor:ktor-client-gson:2.2.1") - implementation("io.ktor:ktor-serialization-gson:2.2.1") + implementation(libs.ktor.content.negotiation) + implementation(libs.ktor.client.core) + implementation(libs.ktor.client.cio) + implementation(libs.ktor.client.gson) + implementation(libs.ktor.serialization.gson) } // Set the JVM language level used to build the project. Use Java 11 for 2020.3+, and Java 17 for 2022.2+. kotlin { - jvmToolchain(17) + jvmToolchain { + languageVersion = JavaLanguageVersion.of(17) + vendor = JvmVendorSpec.JETBRAINS + } } // Configure Gradle IntelliJ Plugin - read more: https://plugins.jetbrains.com/docs/intellij/tools-gradle-intellij-plugin.html intellij { - pluginName.set(properties("pluginName")) - version.set(properties("platformVersion")) - type.set(properties("platformType")) + pluginName = properties("pluginName") + version = properties("platformVersion") + type = properties("platformType") // Plugin Dependencies. Uses `platformPlugins` property from the gradle.properties file. - plugins.set(properties("platformPlugins").split(',').map(String::trim).filter(String::isNotEmpty)) + plugins = properties("platformPlugins").map { it.split(',').map(String::trim).filter(String::isNotEmpty) } } // Configure Gradle Changelog Plugin - read more: https://github.com/JetBrains/gradle-changelog-plugin changelog { - groups.set(emptyList()) -/* ROLL_BACK_CHANGELOG_PLUGIN BEGIN - https://github.com/JetBrains/gradle-changelog-plugin/issues/147 - repositoryUrl.set(properties("pluginRepositoryUrl")) -*/ -/* ROLL_BACK_CHANGELOG_PLUGIN END */ - path.set(File(projectDir, "../CHANGELOG.md").absolutePath) + groups.empty() + repositoryUrl = properties("pluginRepositoryUrl") + path = File(projectDir, "../CHANGELOG.md").absolutePath } // Configure Gradle Qodana Plugin - read more: https://github.com/JetBrains/gradle-qodana-plugin qodana { - cachePath.set(file(".qodana").canonicalPath) - reportPath.set(file("build/reports/inspections").canonicalPath) - saveReport.set(true) - showReport.set(System.getenv("QODANA_SHOW_REPORT")?.toBoolean() ?: false) + cachePath = provider { file(".qodana").canonicalPath } + reportPath = provider { file("build/reports/inspections").canonicalPath } + saveReport = true + showReport = environment("QODANA_SHOW_REPORT").map { it.toBoolean() }.getOrElse(false) +} + +// Configure Gradle Kover Plugin - read more: https://github.com/Kotlin/kotlinx-kover#configuration +koverReport { + defaults { + xml { + onCheck = true + } + } } tasks { wrapper { - gradleVersion = properties("gradleVersion") + gradleVersion = properties("gradleVersion").get() } patchPluginXml { - version.set(properties("pluginVersion")) - sinceBuild.set(properties("pluginSinceBuild")) - untilBuild.set(properties("pluginUntilBuild")) + version = properties("pluginVersion") + sinceBuild = properties("pluginSinceBuild") + untilBuild = properties("pluginUntilBuild") // Extract the section from README.md and provide for the plugin's manifest - pluginDescription.set( - file("../README.md").readText().lines().run { - val start = "" - val end = "" + pluginDescription = providers.fileContents(layout.projectDirectory.file("../README.md")).asText.map { + val start = "" + val end = "" + with (it.lines()) { if (!containsAll(listOf(start, end))) { throw GradleException("Plugin description section not found in README.md:\n$start ... $end") } - subList(indexOf(start) + 1, indexOf(end)) - }.joinToString("\n").let { markdownToHTML(it) } - ) + subList(indexOf(start) + 1, indexOf(end)).joinToString("\n").let(::markdownToHTML) + } + } + val changelog = project.changelog // local variable for configuration cache compatibility // Get the latest available change notes from the changelog file - changeNotes.set(provider { + changeNotes = properties("pluginVersion").map { pluginVersion -> with(changelog) { -/* ROLL_BACK_CHANGELOG_PLUGIN BEGIN - https://github.com/JetBrains/gradle-changelog-plugin/issues/147 renderItem( - getOrNull(properties("pluginVersion")) - ?: runCatching { getLatest() }.getOrElse { getUnreleased() }, - Changelog.OutputType.HTML, + (getOrNull(pluginVersion) ?: getUnreleased()) + .withHeader(false) + .withEmptySections(false), + Changelog.OutputType.HTML, ) -*/ - changelog.run { - getOrNull(properties("pluginVersion")) ?: getLatest() - }.toHTML() -/* ROLL_BACK_CHANGELOG_PLUGIN END */ } - }) + } } // Configure UI tests plugin @@ -127,27 +127,27 @@ tasks { // buildPlugin { exclude { - it.name.startsWith("kotlinx-coroutines-") || it.name.startsWith("kotlin-stdlib-") || it.name.startsWith("kotlin-reflect-") + it.name.startsWith("kotlinx-coroutines-") || it.name.startsWith("kotlin-stdlib-") || it.name.startsWith("kotlin-reflect-") || it.name.startsWith("slf4j-api-") } } prepareSandbox { exclude { - it.name.startsWith("kotlinx-coroutines-") || it.name.startsWith("kotlin-stdlib-") || it.name.startsWith("kotlin-reflect-") + it.name.startsWith("kotlinx-coroutines-") || it.name.startsWith("kotlin-stdlib-") || it.name.startsWith("kotlin-reflect-") || it.name.startsWith("slf4j-api-") } } signPlugin { - certificateChain.set(System.getenv("CERTIFICATE_CHAIN")) - privateKey.set(System.getenv("PRIVATE_KEY")) - password.set(System.getenv("PRIVATE_KEY_PASSWORD")) + certificateChain = environment("CERTIFICATE_CHAIN") + privateKey = environment("PRIVATE_KEY") + password = environment("PRIVATE_KEY_PASSWORD") } publishPlugin { dependsOn("patchChangelog") - token.set(System.getenv("PUBLISH_TOKEN")) + token = environment("PUBLISH_TOKEN") // The pluginVersion is based on the SemVer (https://semver.org) and supports pre-release labels, like 2.1.7-alpha.3 // Specify pre-release label to publish the plugin in a custom Release Channel automatically. Read more: // https://plugins.jetbrains.com/docs/intellij/deployment.html#specifying-a-release-channel - channels.set(listOf(properties("pluginVersion").split('-').getOrElse(1) { "default" }.split('.').first())) + channels = properties("pluginVersion").map { listOf(it.split('-').getOrElse(1) { "default" }.split('.').first()) } } } diff --git a/plugin/gradle.properties b/plugin/gradle.properties index d1bf3ee3..e046b973 100644 --- a/plugin/gradle.properties +++ b/plugin/gradle.properties @@ -4,27 +4,32 @@ pluginGroup = org.example.githubpang.rossynt pluginName = Rossynt pluginRepositoryUrl = https://github.com/GitHubPang/Rossynt # SemVer format -> https://semver.org -pluginVersion = 223.4.0 +pluginVersion = 231.5.0 # Supported build number ranges and IntelliJ Platform versions -> https://plugins.jetbrains.com/docs/intellij/build-number-ranges.html -pluginSinceBuild = 223 -pluginUntilBuild = 231.* +pluginSinceBuild = 231 +pluginUntilBuild = 233.* # IntelliJ Platform Properties -> https://plugins.jetbrains.com/docs/intellij/tools-gradle-intellij-plugin.html#configuration-intellij-extension platformType = IC -platformVersion = 231.6471-EAP-CANDIDATE-SNAPSHOT +platformVersion = 231.9225.16 # Plugin Dependencies -> https://plugins.jetbrains.com/docs/intellij/plugin-dependencies.html # Example: platformPlugins = com.intellij.java, com.jetbrains.php:203.4449.22 platformPlugins = # Gradle Releases -> https://github.com/gradle/gradle/releases -gradleVersion = 7.6 +gradleVersion = 8.5 # Opt-out flag for bundling Kotlin standard library -> https://plugins.jetbrains.com/docs/intellij/kotlin.html#kotlin-standard-library # suppress inspection "UnusedProperty" -#kotlin.stdlib.default.dependency = false +kotlin.stdlib.default.dependency = false # Enable Gradle Configuration Cache -> https://docs.gradle.org/current/userguide/configuration_cache.html -# suppress inspection "UnusedProperty" -org.gradle.unsafe.configuration-cache = true +org.gradle.configuration-cache = true + +# Enable Gradle Build Cache -> https://docs.gradle.org/current/userguide/build_cache.html +org.gradle.caching = true + +# Enable Gradle Kotlin DSL Lazy Property Assignment -> https://docs.gradle.org/current/userguide/kotlin_dsl.html#kotdsl:assignment +systemProp.org.gradle.unsafe.kotlin.assignment = true diff --git a/plugin/gradle/libs.versions.toml b/plugin/gradle/libs.versions.toml new file mode 100644 index 00000000..df127b21 --- /dev/null +++ b/plugin/gradle/libs.versions.toml @@ -0,0 +1,26 @@ +[versions] +# libraries +annotations = "24.1.0" +ktor = "2.3.7" + +# plugins +kotlin = "1.9.22" +changelog = "2.2.0" +gradleIntelliJPlugin = "1.16.1" +qodana = "0.1.13" +kover = "0.7.5" + +[libraries] +annotations = { group = "org.jetbrains", name = "annotations", version.ref = "annotations" } +ktor-content-negotiation = { group = "io.ktor", name = "ktor-client-content-negotiation", version.ref = "ktor" } +ktor-client-core = { group = "io.ktor", name = "ktor-client-core", version.ref = "ktor" } +ktor-client-cio = { group = "io.ktor", name = "ktor-client-cio", version.ref = "ktor" } +ktor-client-gson = { group = "io.ktor", name = "ktor-client-gson", version.ref = "ktor" } +ktor-serialization-gson = { group = "io.ktor", name = "ktor-serialization-gson", version.ref = "ktor" } + +[plugins] +changelog = { id = "org.jetbrains.changelog", version.ref = "changelog" } +gradleIntelliJPlugin = { id = "org.jetbrains.intellij", version.ref = "gradleIntelliJPlugin" } +kotlin = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" } +kover = { id = "org.jetbrains.kotlinx.kover", version.ref = "kover" } +qodana = { id = "org.jetbrains.qodana", version.ref = "qodana" } \ No newline at end of file diff --git a/plugin/gradle/wrapper/gradle-wrapper.jar b/plugin/gradle/wrapper/gradle-wrapper.jar index 943f0cbf..d64cd491 100644 Binary files a/plugin/gradle/wrapper/gradle-wrapper.jar and b/plugin/gradle/wrapper/gradle-wrapper.jar differ diff --git a/plugin/gradle/wrapper/gradle-wrapper.properties b/plugin/gradle/wrapper/gradle-wrapper.properties index f398c33c..7cf08140 100644 --- a/plugin/gradle/wrapper/gradle-wrapper.properties +++ b/plugin/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,7 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip networkTimeout=10000 +validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME -zipStorePath=wrapper/dists +zipStorePath=wrapper/dists \ No newline at end of file diff --git a/plugin/settings.gradle.kts b/plugin/settings.gradle.kts index cc82ff00..0c7c55ed 100644 --- a/plugin/settings.gradle.kts +++ b/plugin/settings.gradle.kts @@ -1 +1,5 @@ +plugins { + id("org.gradle.toolchains.foojay-resolver-convention") version "0.7.0" +} + rootProject.name = "Rossynt" diff --git a/plugin/src/main/kotlin/org/example/githubpang/rossynt/services/BackendService.kt b/plugin/src/main/kotlin/org/example/githubpang/rossynt/services/BackendService.kt index d5558f9d..f402fa56 100644 --- a/plugin/src/main/kotlin/org/example/githubpang/rossynt/services/BackendService.kt +++ b/plugin/src/main/kotlin/org/example/githubpang/rossynt/services/BackendService.kt @@ -54,6 +54,7 @@ internal class BackendService : IBackendService { } else { arrayOf( "/home/user/share/dotnet/dotnet", // Default location of dotnet executable on Linux. + "/usr/bin/dotnet", // Default location of dotnet executable on Linux. "/usr/local/share/dotnet/dotnet", // Default location of dotnet executable on macOS. File(System.getProperty("user.home"), ".dotnet/dotnet").absolutePath, // Default location of dotnet executable on macOS as installed by Rider. ) diff --git a/plugin/src/main/kotlin/org/example/githubpang/rossynt/services/CSharpVersion.kt b/plugin/src/main/kotlin/org/example/githubpang/rossynt/services/CSharpVersion.kt index 09ada9b7..079eb49a 100644 --- a/plugin/src/main/kotlin/org/example/githubpang/rossynt/services/CSharpVersion.kt +++ b/plugin/src/main/kotlin/org/example/githubpang/rossynt/services/CSharpVersion.kt @@ -20,6 +20,7 @@ internal enum class CSharpVersion { CSharp9, CSharp10, CSharp11, + CSharp12, Latest, LatestMajor, Preview, diff --git a/plugin/src/main/kotlin/org/example/githubpang/rossynt/services/RossyntService.kt b/plugin/src/main/kotlin/org/example/githubpang/rossynt/services/RossyntService.kt index 25419d3e..f5720122 100644 --- a/plugin/src/main/kotlin/org/example/githubpang/rossynt/services/RossyntService.kt +++ b/plugin/src/main/kotlin/org/example/githubpang/rossynt/services/RossyntService.kt @@ -16,13 +16,13 @@ import com.intellij.openapi.util.Disposer import com.intellij.openapi.util.TextRange import com.intellij.util.LineSeparator import kotlinx.coroutines.* +import net.jcip.annotations.Immutable import org.example.githubpang.rossynt.RossyntToolWindowStateNotifier import org.example.githubpang.rossynt.events.ITextEventThrottlerCallback import org.example.githubpang.rossynt.events.TextEventThrottler import org.example.githubpang.rossynt.settings.PluginSettingsNotifier import org.example.githubpang.rossynt.trees.TreeNode import java.util.* -import javax.annotation.concurrent.Immutable import kotlin.coroutines.EmptyCoroutineContext @Service