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
6 changes: 3 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: 6.0.x
dotnet-version: 10.0.x
- name: Build Solution
run: dotnet test src\SourceGenerator.Foundations.sln

Expand All @@ -40,7 +40,7 @@ jobs:
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: 6.0.x
dotnet-version: 10.0.x
- name: Test | ${{ matrix.project.name }}
run: dotnet test src\${{ matrix.project.path }}${{ matrix.project.name }}\${{ matrix.project.name }}.csproj

Expand All @@ -65,7 +65,7 @@ jobs:
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: 6.0.x
dotnet-version: 10.0.x
- name: Restore
run: dotnet tool restore
- name: GitVersion
Expand Down
8 changes: 8 additions & 0 deletions src/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,12 @@
<Message Importance="high" Text="SGFMSBuildProjectDir: $(SGFMSBuildProjectDir)"/>
<Message Importance="high" Text="SGFWindowsPluginProjectDir: $(SGFWindowsPluginProjectDir)"/>
</Target>
<PropertyGroup Condition="$(MSBuildProjectName.EndsWith('.Tests'))">
<IsPackable>false</IsPackable>
<TargetFramework>net10.0</TargetFramework>
<IsPackable>false</IsPackable>
Comment on lines +42 to +44
<IsTestProject>true</IsTestProject>
<ImplicitUsings>true</ImplicitUsings>
<OutputType>Exe</OutputType>
</PropertyGroup>
</Project>
4 changes: 3 additions & 1 deletion src/Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,14 @@
<PackageVersion Include="Microsoft.CodeAnalysis.Workspaces.Common" Version="4.3.1" />
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.8.0" />
<PackageVersion Include="Microsoft.SourceLink.GitHub" Version="1.1.1" />
<PackageVersion Include="Microsoft.Testing.Platform" Version="2.4.1" />
<PackageVersion Include="Microsoft.VisualStudio.Interop" Version="17.4.33103.184" />
<PackageVersion Include="Newtonsoft.Json" Version="13.0.2" />
<PackageVersion Include="System.Management" Version="7.0.0" />
<PackageVersion Include="System.Net.Http" Version="4.3.4" />
<PackageVersion Include="System.Text.RegularExpressions" Version="4.3.1" />
<PackageVersion Include="xunit" Version="2.5.3" />
<PackageVersion Include="xunit.runner.visualstudio" Version="2.5.3" />
<PackageVersion Include="xunit.runner.visualstudio" Version="4.0.0" />
<PackageVersion Include="xunit.v3" Version="4.0.1" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
@@ -1,23 +1,13 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<LangVersion>12</LangVersion>

<IsPackable>false</IsPackable>
<IsTestProject>true</IsTestProject>
</PropertyGroup>

<Project Sdk="Microsoft.NET.Sdk">
<ItemGroup>
<PackageReference Include="coverlet.collector" />
<PackageReference Include="Microsoft.NET.Test.Sdk" />
<PackageReference Include="Newtonsoft.Json" />
<PackageReference Include="System.Net.Http" />
<PackageReference Include="System.Text.RegularExpressions" />
<PackageReference Include="xunit" />
<PackageReference Include="xunit.runner.visualstudio" />
<PackageReference Include="Microsoft.NET.Test.Sdk" />
<PackageReference Include="Microsoft.Testing.Platform" />
<PackageReference Include="Newtonsoft.Json" />
<PackageReference Include="xunit.runner.visualstudio">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="xunit.v3" />
</ItemGroup>

<ItemGroup>
Expand Down
4 changes: 2 additions & 2 deletions src/SourceGenerator.Foundations.Tests/CompiliationTestBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
using System.Collections.Immutable;
using System.Reflection;
using System.Text;
using Xunit.Abstractions;
using Xunit.Sdk;

namespace SGF
{
Expand Down Expand Up @@ -39,7 +39,7 @@ protected CompilationTestBase(ITestOutputHelper outputHelper)
ITest? test = testField?.GetValue(outputHelper) as ITest;
if (test != null)
{
TestMethodName = test.TestCase.TestMethod.ToString()!;
TestMethodName = test.TestCase.TestMethod?.ToString()!;
}

AddAssemblyReference("System.Runtime");
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
using Microsoft.CodeAnalysis.CSharp.Analyzers;
using SGF;
using Xunit.Abstractions;

namespace SourceGenerator.Foundations.Tests
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,37 +1,22 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<LangVersion>12</LangVersion>
<Nullable>enable</Nullable>

<IsPackable>false</IsPackable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" />
<PackageReference Include="Microsoft.CodeAnalysis.Workspaces.Common" />
<PackageReference Include="Microsoft.NET.Test.Sdk" />
<PackageReference Include="Microsoft.Testing.Platform" />
<PackageReference Include="Newtonsoft.Json" />
<PackageReference Include="System.Net.Http"/>
<PackageReference Include="System.Text.RegularExpressions"/>
<PackageReference Include="xunit"/>
<PackageReference Include="xunit.runner.visualstudio">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="coverlet.collector">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>

<!-- ==== Referencing Analyzers ====
Normally you never actually reference the analyzer they just get used by the compiler internally.
When adding a NuGet reference it just does that behind the scenes. For these unit tests I needed
to reference the type, so that is this weird workaround of using the path and navigating to the dll
-->
<PackageReference Include="Microsoft.CodeAnalysis.Analyzers" GeneratePathProperty="true" />
<PackageReference Include="xunit.runner.visualstudio">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="xunit.v3" />
<Reference Include="$(PkgMicrosoft_CodeAnalysis_Analyzers)\analyzers\dotnet\cs\Microsoft.CodeAnalysis.CSharp.Analyzers.dll" />
<Reference Include="$(PkgMicrosoft_CodeAnalysis_Analyzers)\analyzers\dotnet\cs\Microsoft.CodeAnalysis.Analyzers.dll" />
</ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
using SGF;
using SGF.Analyzer;
using SGF.Analyzer.Rules;
using Xunit.Abstractions;

namespace SourceGenerator.Foundations.Tests
{
Expand Down
1 change: 1 addition & 0 deletions src/SourceGenerator.Foundations.sln
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
Directory.Build.props = Directory.Build.props
Directory.Build.targets = Directory.Build.targets
Directory.Packages.props = Directory.Packages.props
global.json = global.json
Nuget.Build.props = Nuget.Build.props
EndProjectSection
EndProject
Expand Down
9 changes: 9 additions & 0 deletions src/global.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"sdk": {
"version": "10.0.100",
"rollForward": "latestFeature"
},
"test": {
"runner": "Microsoft.Testing.Platform"
}
}
Loading