Skip to content

Commit

Permalink
Upgrade R# to 2021.3 (#188)
Browse files Browse the repository at this point in the history
* Upgrade R# to 2021.3

* tests

* changes

* tidy

* fixes

* refactoring

* cleanup

* icon

* update

* build

* assembly
  • Loading branch information
robertcoltheart authored Dec 8, 2021
1 parent 80e8934 commit e9627da
Show file tree
Hide file tree
Showing 61 changed files with 847 additions and 792 deletions.
2 changes: 1 addition & 1 deletion .config/dotnet-tools.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"isRoot": true,
"tools": {
"gitversion.tool": {
"version": "5.3.7",
"version": "5.8.1",
"commands": [
"dotnet-gitversion"
]
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v2
- uses: actions/setup-dotnet@v1
with:
dotnet-version: '6.0.x'
- name: Fetch all tags and branches
run: git fetch --prune --unshallow
- name: Build
Expand Down
8 changes: 8 additions & 0 deletions build/build.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@
var notes = GetReleaseNotes();
var apiKey = Environment.GetEnvironmentVariable("JETBRAINS_API_KEY");

version.SemVer = "1.0.0";
version.AssemblySemVer = "1.0.0";
version.AssemblySemFileVer = "1.0.0";
version.InformationalVersion = "1.0.0";

Target("clean", () =>
{
Run("dotnet", "clean");
Expand Down Expand Up @@ -80,8 +85,11 @@
.Replace("${UntilBuild}", waveVersion + ".*")
.Replace("${ChangeNotes}", notes);
var icon = File.ReadAllBytes(Path.Combine("images", "pluginIcon.svg"));
File.WriteAllText(Path.Combine(metaPath, "plugin.xml"), plugin);
File.WriteAllText(Path.Combine(metaPath, "MANIFEST.MF"), "Manifest-Version: 1.0");
File.WriteAllBytes(Path.Combine(metaPath, "pluginIcon.svg"), icon);
ZipFile.CreateFromDirectory(metaPath, jarPath, CompressionLevel.Optimal, true, new UnixUTF8Encoding());
Expand Down
2 changes: 1 addition & 1 deletion build/build.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net5.0</TargetFramework>
<TargetFramework>net6.0</TargetFramework>
</PropertyGroup>

<ItemGroup>
Expand Down
30 changes: 30 additions & 0 deletions images/pluginIcon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions install-plugin.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,8 @@ Function Write-Nuspec {
<file src="..\src\Machine.Specifications.Runner.ReSharper\bin\Debug\net461\Machine.Specifications.Runner.ReSharper.dll" target="DotFiles" />
<file src="..\src\Machine.Specifications.Runner.ReSharper\bin\Debug\net461\Machine.Specifications.Runner.Utility.dll" target="DotFiles" />
<file src="..\src\Machine.Specifications.Runner.ReSharper.Adapters\bin\Debug\net40\Machine.Specifications.Runner.ReSharper.Adapters.net40.dll" target="DotFiles" />
<file src="..\src\Machine.Specifications.Runner.ReSharper.Tasks\bin\Debug\net40\Machine.Specifications.Runner.ReSharper.Tasks.net40.dll" target="DotFiles" />
<file src="..\src\Machine.Specifications.Runner.ReSharper.Adapters\bin\Debug\net461\Machine.Specifications.Runner.ReSharper.Adapters.net461.dll" target="DotFiles" />
<file src="..\src\Machine.Specifications.Runner.ReSharper.Tasks\bin\Debug\net461\Machine.Specifications.Runner.ReSharper.Tasks.net461.dll" target="DotFiles" />
<file src="..\src\Machine.Specifications.Runner.ReSharper.Adapters\bin\Debug\netstandard2.0\Machine.Specifications.Runner.ReSharper.Adapters.netstandard20.dll" target="DotFiles" />
<file src="..\src\Machine.Specifications.Runner.ReSharper.Tasks\bin\Debug\netstandard2.0\Machine.Specifications.Runner.ReSharper.Tasks.netstandard20.dll" target="DotFiles" />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>netstandard2.0;net40</TargetFrameworks>
<TargetFrameworks>netstandard2.0;net461</TargetFrameworks>
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
<PackageId>Machine.Specifications.Runner.ReSharper.Adapters</PackageId>
<IsPackable>false</IsPackable>
<LangVersion>latest</LangVersion>
<Nullable>enable</Nullable>

<AssemblyName Condition="'$(TargetFramework)' == 'net40'">Machine.Specifications.Runner.ReSharper.Adapters.net40</AssemblyName>
<AssemblyName Condition="'$(TargetFramework)' == 'net461'">Machine.Specifications.Runner.ReSharper.Adapters.net461</AssemblyName>
<AssemblyName Condition="'$(TargetFramework)' == 'netstandard2.0'">Machine.Specifications.Runner.ReSharper.Adapters.netstandard20</AssemblyName>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="ILRepack" Version="2.0.18" PrivateAssets="All" />
<PackageReference Include="JetBrains.ReSharper.TestRunner.Abstractions" Version="2.2.1" PrivateAssets="All" />
<PackageReference Include="JetBrains.ReSharper.TestRunner.Abstractions" Version="2.6.1" PrivateAssets="All" />
<PackageReference Include="Machine.Specifications.Runner.Utility" Version="1.0.2" PrivateAssets="All" />
</ItemGroup>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,14 +61,23 @@ public static string Self(ContextInfo context, SpecificationInfo behaviorSpecifi

public static MspecReSharperId Create(RemoteTask task)
{
return task switch
switch (task)
{
MspecContextRemoteTask context => new MspecReSharperId(context),
MspecContextSpecificationRemoteTask specification => new MspecReSharperId(specification),
MspecBehaviorRemoteTask behavior => new MspecReSharperId(behavior),
MspecBehaviorSpecificationRemoteTask specification => new MspecReSharperId(specification),
_ => throw new ArgumentOutOfRangeException(nameof(task))
};
case MspecContextRemoteTask context:
return new MspecReSharperId(context);

case MspecContextSpecificationRemoteTask specification:
return new MspecReSharperId(specification);

case MspecBehaviorRemoteTask behavior:
return new MspecReSharperId(behavior);

case MspecBehaviorSpecificationRemoteTask specification:
return new MspecReSharperId(specification);

default:
throw new ArgumentOutOfRangeException(nameof(task));
}
}

public bool Equals(MspecReSharperId? other)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,23 @@ public static class RemoteTaskBuilder
{
public static MspecRemoteTask GetRemoteTask(RemoteTask task)
{
return task switch
switch (task)
{
MspecContextRemoteTask context => FromContext(context),
MspecContextSpecificationRemoteTask specification => FromContextSpecification(specification),
MspecBehaviorRemoteTask behavior => FromBehavior(behavior),
MspecBehaviorSpecificationRemoteTask specification => FromBehaviorSpecification(specification),
_ => throw new ArgumentOutOfRangeException(nameof(task))
};
case MspecContextRemoteTask context:
return FromContext(context);

case MspecContextSpecificationRemoteTask specification:
return FromContextSpecification(specification);

case MspecBehaviorRemoteTask behavior:
return FromBehavior(behavior);

case MspecBehaviorSpecificationRemoteTask specification:
return FromBehaviorSpecification(specification);

default:
throw new ArgumentOutOfRangeException(nameof(task));
}
}

private static MspecRemoteTask FromContext(MspecContextRemoteTask task)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>netstandard2.0;net40</TargetFrameworks>
<TargetFrameworks>netstandard2.0;net461</TargetFrameworks>
<PackageId>Machine.Specifications.Runner.ReSharper.Tasks</PackageId>
<IsPackable>false</IsPackable>
<LangVersion>latest</LangVersion>
<Nullable>enable</Nullable>

<AssemblyName Condition="'$(TargetFramework)' == 'net40'">Machine.Specifications.Runner.ReSharper.Tasks.net40</AssemblyName>
<AssemblyName Condition="'$(TargetFramework)' == 'net461'">Machine.Specifications.Runner.ReSharper.Tasks.net461</AssemblyName>
<AssemblyName Condition="'$(TargetFramework)' == 'netstandard2.0'">Machine.Specifications.Runner.ReSharper.Tasks.netstandard20</AssemblyName>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="JetBrains.ReSharper.TestRunner.Abstractions" Version="2.2.1" PrivateAssets="All" />
<PackageReference Include="JetBrains.ReSharper.TestRunner.Abstractions" Version="2.6.1" PrivateAssets="All" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
using System.Threading.Tasks;
using JetBrains.Application.Components;
using JetBrains.ReSharper.TestRunner.Abstractions.Isolation;
using JetBrains.ReSharper.UnitTestFramework.TestRunner;
using JetBrains.ReSharper.UnitTestFramework.Execution.TestRunner;

namespace Machine.Specifications.Runner.ReSharper.Tests
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
using JetBrains.Lifetimes;
using JetBrains.ReSharper.TestRunner.Abstractions;
using JetBrains.ReSharper.TestRunner.Abstractions.Objects;
using JetBrains.ReSharper.UnitTestFramework.TestRunner;
using JetBrains.ReSharper.UnitTestFramework.Execution.TestRunner;
using JetBrains.Util;

namespace Machine.Specifications.Runner.ReSharper.Tests
Expand Down Expand Up @@ -34,17 +34,17 @@ public Task<int> Shutdown()

public ITestRunnerExecutionContext Context { get; }

public async Task RunTests(CancellationToken cancelCt, CancellationToken abortCt)
public async Task RunTests(CancellationToken cancelCt)
{
abortCt.Register(() => MessageBroker.Abort());
cancelCt.Register(() => MessageBroker.Abort());

var taskDepot = Context.Container.GetComponent<ITestRunnerRemoteTaskDepot>();

var loader = Context.Adapter.GetTestAdapterLoader(Context);
var container = Context.Adapter.GetTestContainer(Context);

var tasks = taskDepot.GetRemoteTasks(Context.Run);

await MessageBroker.Initialize(new RemoteAgentInitializationRequest(loader)).ConfigureAwait(false);
await MessageBroker.RunTests(new TestRunRequest(container, tasks)).ConfigureAwait(false);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net472</TargetFramework>
<TargetFramework>net461</TargetFramework>
<IsPackable>false</IsPackable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="JetBrains.Lifetimes" Version="2021.2.0" />
<PackageReference Include="JetBrains.ReSharper.SDK.Tests" Version="2021.2.2">
<PackageReference Include="JetBrains.Lifetimes" Version="2021.3.4" />
<PackageReference Include="JetBrains.ReSharper.SDK.Tests" Version="2021.3.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="JetBrains.ReSharper.TestRunner.Abstractions" Version="2.2.1" />
<PackageReference Include="NUnit" Version="3.12.0" />
<PackageReference Include="JetBrains.ReSharper.TestRunner.Abstractions" Version="2.6.1" />
<PackageReference Include="NUnit" Version="3.13.2" />
<PackageReference Include="NUnit3TestAdapter" Version="4.1.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.0.0" />
</ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ namespace Machine.Specifications.Runner.ReSharper.Tests.Metadata
{
[MspecReferences]
[TestNetFramework46]
public class MspecMetadataTests : MspecMetadataTestBase
public class MspecMetadataTests : UnitTestMetadataTestBase
{
protected override string RelativeTestDataPath => "Exploration";

Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ namespace Machine.Specifications.Runner.ReSharper.Tests.Runner
{
[MspecReferences]
[TestNetFramework46]
public class MspecRunnerTests : MspecTaskRunnerTestBase
public class MspecRunnerTests : UnitTestRunnerTestBase
{
protected override string RelativeTestDataPath => "Runner";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ namespace Machine.Specifications.Runner.ReSharper.Tests.Source
{
[MspecReferences]
[TestNetFramework46]
public class MspecSourceTests : MspecSourceTestBase
public class MspecSourceTests : UnitTestSourceTestBase
{
protected override string RelativeTestDataPath => "Exploration";

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using JetBrains.Application.Components;
using JetBrains.ProjectModel;
using JetBrains.ReSharper.TestRunner.Abstractions.Isolation;
using JetBrains.ReSharper.UnitTestFramework.TestRunner;
using JetBrains.ReSharper.UnitTestFramework.Execution.TestRunner;
using Machine.Specifications.Runner.ReSharper.Runner;

namespace Machine.Specifications.Runner.ReSharper.Tests
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
using JetBrains.ReSharper.UnitTestFramework.Elements;
using JetBrains.ReSharper.UnitTestFramework.Exploration;
using JetBrains.Util;

namespace Machine.Specifications.Runner.ReSharper.Tests
{
public class TestElementObserverOnFile : IUnitTestElementObserverOnFile
{
private readonly IUnitTestElementObserver inner;

public TestElementObserverOnFile(IUnitTestElementObserver inner)
{
this.inner = inner;
}

public IUnitTestElementSource Source => inner.Source;

public T GetElementById<T>(string testId)
{
return inner.GetElementById<T>(testId);
}

public void OnUnitTestElement(IUnitTestElement element)
{
inner.OnUnitTestElement(element);
}

public void OnUnitTestElementDisposition(IUnitTestLikeElement element, TextRange navigationRange, TextRange containingRange)
{
}
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using System.Linq;
using JetBrains.ProjectModel;
using JetBrains.ReSharper.UnitTestFramework.Exploration;
using JetBrains.ReSharper.UnitTestFramework.Exploration.Artifacts;
using JetBrains.Util;
using JetBrains.Util.Dotnet.TargetFrameworkIds;

Expand All @@ -16,7 +16,7 @@ public bool CanResolveArtifact(IProject project, TargetFrameworkId targetFramewo

public FileSystemPath ResolveArtifact(IProject project, TargetFrameworkId targetFrameworkId)
{
return project.GetSubItems().First().Location;
return project.GetSubItems().First().Location.ToNativeFileSystemPath();
}
}
}
Loading

0 comments on commit e9627da

Please sign in to comment.