Skip to content
Open
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
31 changes: 16 additions & 15 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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 }}
Expand All @@ -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

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}

Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/run-ui-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}

Expand Down
17 changes: 17 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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/).
Expand Down
4 changes: 4 additions & 0 deletions backend/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
8 changes: 4 additions & 4 deletions backend/RossyntBackend/RossyntBackend.csproj
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFrameworks>net7.0;net6.0</TargetFrameworks>
<TargetFrameworks>net8.0;net7.0;net6.0</TargetFrameworks>
<SatelliteResourceLanguages>en</SatelliteResourceLanguages>
<Nullable>enable</Nullable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="JetBrains.Annotations" Version="2022.3.1" PrivateAssets="All" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="4.4.0" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.2" />
<PackageReference Include="JetBrains.Annotations" Version="2023.3.0" PrivateAssets="All" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="4.8.0" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
</ItemGroup>

</Project>
97 changes: 50 additions & 47 deletions backend/RossyntBackendIntegrationTest/IntegrationTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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<string>();
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<string>();
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<Exception>(() => GetNodeInfo(httpClient, nodeId!));
});
Expand All @@ -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<string>());
Assert.That(nodeId, Is.EqualTo(node?["Id"]?.Value<string>()));
});

private static async Task RunWithHttpClient(Func<HttpClient, Task> func) {
Expand All @@ -188,7 +191,7 @@ private async Task<JObject> 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);
}
Expand All @@ -200,10 +203,10 @@ private static async Task<IDictionary<string, string>> GetNodeInfo(HttpClient ht
var parameters = ImmutableDictionary<string, string>.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<IDictionary<string, string>>(responseBody);
Assert.IsNotNull(dictionary);
Assert.That(dictionary, Is.Not.Null);
return dictionary!;
}

Expand All @@ -212,7 +215,7 @@ private static async Task ResetActiveFile(HttpClient httpClient) {

var parameters = ImmutableDictionary<string, string>.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<string> FindNode(HttpClient httpClient, int start, int end) {
Expand All @@ -222,14 +225,14 @@ private static async Task<string> 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<IDictionary<string, string>>(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;
}

Expand All @@ -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<string>());
Assert.AreEqual(type, node["Type"]?.Value<string>());
Assert.AreEqual(kind, node["Kind"]?.Value<string>());
Assert.AreEqual(str.Length > 0 ? str : null, node["Str"]?.Value<string>());
Assert.AreEqual(span.Length > 0 ? span : null, node["Span"]?.Value<string>());
Assert.AreEqual(isMissing ? (int?)1 : null, node["IsMissing"]?.Value<int>());
Assert.AreEqual(childCount > 0 ? (int?)childCount : null, node["Child"]?.Count());
Assert.That(node, Is.Not.Null);
Assert.That(node!["Cat"]?.Value<string>(), Is.EqualTo(cat));
Assert.That(node["Type"]?.Value<string>(), Is.EqualTo(type));
Assert.That(node["Kind"]?.Value<string>(), Is.EqualTo(kind));
Assert.That(node["Str"]?.Value<string>(), Is.EqualTo(str.Length > 0 ? str : null));
Assert.That(node["Span"]?.Value<string>(), Is.EqualTo(span.Length > 0 ? span : null));
Assert.That(node["IsMissing"]?.Value<int>(), Is.EqualTo(isMissing ? (int?)1 : null));
Assert.That(node["Child"]?.Count(), Is.EqualTo(childCount > 0 ? (int?)childCount : null));
}
}
Loading