Skip to content

Commit

Permalink
feat: Porting Assistant .NET 8 Support (#1193)
Browse files Browse the repository at this point in the history
* Add create folder action for .net 8

* Add .NET 8 to SupportedFrameworks

* add .NET 8 to test fixture and test cases

* add .NET 8 to GitHub CI/CD

* remove .NET 8 from GitHub CI/CD

* use setup-dotnet@v3 in CI/CD

* remove oracle rule file from TempRules folder
  • Loading branch information
mrkdeng authored Oct 26, 2023
1 parent 36e0ec7 commit 9ed65af
Show file tree
Hide file tree
Showing 10 changed files with 41 additions and 83 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/build_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,14 @@ jobs:
git secrets --scan -r ../
echo "Repository scan completed"
- name: Setup .NET Versions
uses: actions/setup-dotnet@v1
uses: actions/setup-dotnet@v3
with:
dotnet-version: |
3.1.x
5.0.x
6.0.x
7.0.x
8.0.x
- name: Install dependencies
run: dotnet restore src/CTA.Rules.sln
- name: Build
Expand Down
11 changes: 11 additions & 0 deletions src/CTA.Rules.Actions/ProjectLevelActions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,17 @@ static string func(string projectDir, ProjectType projectType)

return func;
}

public Func<string, ProjectType, string> GetCreateNet8FolderHierarchyAction(string _)
{
static string func(string projectDir, ProjectType projectType)
{
FolderUpdate folderUpdate = new FolderUpdate(projectDir, projectType);
return folderUpdate.Run();
}

return func;
}

public Func<string, ProjectType, string> GetMigrateConfigAction(string _)
{
Expand Down
4 changes: 3 additions & 1 deletion src/CTA.Rules.Models/Enums.cs
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,11 @@ public class SupportedFrameworks
public const string Net5 = "net5.0";
public const string Net6 = "net6.0";
public const string Net7 = "net7.0";
public const string Net8 = "net8.0";

//Needs to be a constant since this is used at compile time for CTA.Rules.PortCore\PortCoreRulesCli.cs
public const string SupportedFrameworksString = Netcore31 + ", " + Net5 + ", " + Net6 + ", " + Net7;
public const string SupportedFrameworksString = Netcore31 + ", " + Net5 + ", " + Net6 + ", " + Net7 + ", " +
Net8;

public static List<string> GetSupportedFrameworksList()
{
Expand Down
4 changes: 2 additions & 2 deletions tst/CTA.Rules.Test/OwinTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public void TestAspNetRoutes(string version)

StringAssert.Contains(@"Microsoft.AspNetCore.Owin", csProjContent);
StringAssert.Contains(@"Microsoft.AspNetCore.Diagnostics", csProjContent);
StringAssert.Contains(new[] { SupportedFrameworks.Net5, SupportedFrameworks.Net6, SupportedFrameworks.Net7}.Contains(version)
StringAssert.Contains(new[] { SupportedFrameworks.Net5, SupportedFrameworks.Net6, SupportedFrameworks.Net7, SupportedFrameworks.Net8}.Contains(version)
? @"Microsoft.AspNetCore.Authentication.Google"
: @"<PackageReference Include=""Microsoft.AspNetCore.Authentication.Google"" Version=""3.1.18"" />",
csProjContent);
Expand Down Expand Up @@ -267,7 +267,7 @@ public void TestWebApi(string version)
StringAssert.AreEqualIgnoringCase(ExpectedOutputConstants.OwinWebApiStartup.NormalizeNewLineChars(), startupText.NormalizeNewLineChars());

//Check that package has been added:
StringAssert.Contains(new []{SupportedFrameworks.Net5, SupportedFrameworks.Net6, SupportedFrameworks.Net7}.Contains(version)
StringAssert.Contains(new []{SupportedFrameworks.Net5, SupportedFrameworks.Net6, SupportedFrameworks.Net7, SupportedFrameworks.Net8}.Contains(version)
? @"Microsoft.AspNetCore.Authentication.OpenIdConnect"
: @"<PackageReference Include=""Microsoft.AspNetCore.Authentication.OpenIdConnect"" Version=""3.1.15"" />",
csProjContent);
Expand Down
1 change: 1 addition & 0 deletions tst/CTA.Rules.Test/PortCoreTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ public void TestSampleWebApi3Solution()
TestWebApi(SupportedFrameworks.Net5, solutionDir);
}

[TestCase(SupportedFrameworks.Net8)]
[TestCase(SupportedFrameworks.Net7)]
[TestCase(SupportedFrameworks.Net6)]
[TestCase(SupportedFrameworks.Net5)]
Expand Down
6 changes: 4 additions & 2 deletions tst/CTA.Rules.Test/RuleContributionTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,15 @@ public void Setup()
var net50Results = CopySolutionToUniqueTempDirAndAnalyze(RuleContributionsSolutionFileName, _ctaTestProjectsDir, SupportedFrameworks.Net5);
var net60Results = CopySolutionToUniqueTempDirAndAnalyze(RuleContributionsSolutionFileName, _ctaTestProjectsDir, SupportedFrameworks.Net6);
var net70Results = CopySolutionToUniqueTempDirAndAnalyze(RuleContributionsSolutionFileName, _ctaTestProjectsDir, SupportedFrameworks.Net7);

var net80Results = CopySolutionToUniqueTempDirAndAnalyze(RuleContributionsSolutionFileName, _ctaTestProjectsDir, SupportedFrameworks.Net8);

_resultsDict = new Dictionary<string, TestSolutionAnalysis>
{
{SupportedFrameworks.Netcore31, net31Results},
{SupportedFrameworks.Net5, net50Results},
{SupportedFrameworks.Net6, net60Results},
{SupportedFrameworks.Net7, net70Results}
{SupportedFrameworks.Net7, net70Results},
{SupportedFrameworks.Net8, net80Results}
};
}

Expand Down
71 changes: 0 additions & 71 deletions tst/CTA.Rules.Test/TempRules/oracle.manageddataaccess.json

This file was deleted.

8 changes: 6 additions & 2 deletions tst/CTA.Rules.Test/WCFTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,25 +29,29 @@ public void Setup()
var net50Results = CopySolutionToUniqueTempDirAndAnalyze(solutionName, ctaTestProjectsDir, SupportedFrameworks.Net5);
var net60Results = CopySolutionToUniqueTempDirAndAnalyze(solutionName, ctaTestProjectsDir, SupportedFrameworks.Net6);
var net70Results = CopySolutionToUniqueTempDirAndAnalyze(solutionName, ctaTestProjectsDir, SupportedFrameworks.Net7);
var net80Results = CopySolutionToUniqueTempDirAndAnalyze(solutionName, ctaTestProjectsDir, SupportedFrameworks.Net8);
_paCoreWCFSupportResultsDict = new Dictionary<string, TestSolutionAnalysis>
{
{SupportedFrameworks.Netcore31, net31Results},
{SupportedFrameworks.Net5, net50Results},
{SupportedFrameworks.Net6, net60Results},
{SupportedFrameworks.Net7, net70Results}
{SupportedFrameworks.Net7, net70Results},
{SupportedFrameworks.Net8, net80Results}
};

solutionName = "WCFTCPSelfHost.sln";
net31Results = CopySolutionToUniqueTempDirAndAnalyze(solutionName, ctaTestProjectsDir, SupportedFrameworks.Netcore31);
net50Results = CopySolutionToUniqueTempDirAndAnalyze(solutionName, ctaTestProjectsDir, SupportedFrameworks.Net5);
net60Results = CopySolutionToUniqueTempDirAndAnalyze(solutionName, ctaTestProjectsDir, SupportedFrameworks.Net6);
net70Results = CopySolutionToUniqueTempDirAndAnalyze(solutionName, ctaTestProjectsDir, SupportedFrameworks.Net7);
net80Results = CopySolutionToUniqueTempDirAndAnalyze(solutionName, ctaTestProjectsDir, SupportedFrameworks.Net8);
_wcfTCPSelfHostResultsDict = new Dictionary<string, TestSolutionAnalysis>
{
{SupportedFrameworks.Netcore31, net31Results},
{SupportedFrameworks.Net5, net50Results},
{SupportedFrameworks.Net6, net60Results},
{SupportedFrameworks.Net7, net70Results}
{SupportedFrameworks.Net7, net70Results},
{SupportedFrameworks.Net8, net80Results}
};
}

Expand Down
5 changes: 4 additions & 1 deletion tst/CTA.Rules.Test/WebFormsFullTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,15 @@ public void Setup()
var net50Results = CopySolutionToUniqueTempDirAndAnalyze(solutionName, ctaTestProjectsDir, SupportedFrameworks.Net5);
var net60Results = CopySolutionToUniqueTempDirAndAnalyze(solutionName, ctaTestProjectsDir, SupportedFrameworks.Net6);
var net70Results = CopySolutionToUniqueTempDirAndAnalyze(solutionName, ctaTestProjectsDir, SupportedFrameworks.Net7);
var net80Results = CopySolutionToUniqueTempDirAndAnalyze(solutionName, ctaTestProjectsDir, SupportedFrameworks.Net8);

_resultsDict = new Dictionary<string, TestSolutionAnalysis>
{
{SupportedFrameworks.Netcore31, net31Results},
{SupportedFrameworks.Net5, net50Results},
{SupportedFrameworks.Net6, net60Results},
{SupportedFrameworks.Net7, net70Results}
{SupportedFrameworks.Net7, net70Results},
{SupportedFrameworks.Net8, net80Results}
};
}

Expand All @@ -58,6 +60,7 @@ public void TestProjectFilePortingResults(string version)
}

[TestCase(SupportedFrameworks.Net7)]
[TestCase(SupportedFrameworks.Net8)]
public void TestProjectFilePortingResults_Dotnet7AndAbove(string version)
{
var results = _resultsDict[version];
Expand Down
11 changes: 8 additions & 3 deletions tst/CTA.Rules.Test/WebFormsTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,27 +29,31 @@ public void Setup()
var net50Results = CopySolutionToUniqueTempDirAndAnalyze(aspnetWebFormsSolutionName, ctaTestProjectsDir, SupportedFrameworks.Net5);
var net60Results = CopySolutionToUniqueTempDirAndAnalyze(aspnetWebFormsSolutionName, ctaTestProjectsDir, SupportedFrameworks.Net6);
var net70Results = CopySolutionToUniqueTempDirAndAnalyze(aspnetWebFormsSolutionName, ctaTestProjectsDir, SupportedFrameworks.Net7);
var net80Results = CopySolutionToUniqueTempDirAndAnalyze(aspnetWebFormsSolutionName, ctaTestProjectsDir, SupportedFrameworks.Net8);

_aspnetWebFormsSolution = new Dictionary<string, TestSolutionAnalysis>
{
{SupportedFrameworks.Netcore31, net31Results},
{SupportedFrameworks.Net5, net50Results},
{SupportedFrameworks.Net6, net60Results},
{SupportedFrameworks.Net7, net70Results}
{SupportedFrameworks.Net7, net70Results},
{SupportedFrameworks.Net8, net80Results}
};

var mvcDualWebFormsSolutionName = "MvcAndDualWebForms.sln";
net31Results = CopySolutionToUniqueTempDirAndAnalyze(mvcDualWebFormsSolutionName, ctaTestProjectsDir, SupportedFrameworks.Netcore31);
net50Results = CopySolutionToUniqueTempDirAndAnalyze(mvcDualWebFormsSolutionName, ctaTestProjectsDir, SupportedFrameworks.Net5);
net60Results = CopySolutionToUniqueTempDirAndAnalyze(mvcDualWebFormsSolutionName, ctaTestProjectsDir, SupportedFrameworks.Net6);
net70Results = CopySolutionToUniqueTempDirAndAnalyze(mvcDualWebFormsSolutionName, ctaTestProjectsDir, SupportedFrameworks.Net7);

net80Results = CopySolutionToUniqueTempDirAndAnalyze(mvcDualWebFormsSolutionName, ctaTestProjectsDir, SupportedFrameworks.Net8);

_mvcAndDualWebFormsSolution = new Dictionary<string, TestSolutionAnalysis>
{
{SupportedFrameworks.Netcore31, net31Results},
{SupportedFrameworks.Net5, net50Results},
{SupportedFrameworks.Net6, net60Results},
{SupportedFrameworks.Net7, net70Results}
{SupportedFrameworks.Net7, net70Results},
{SupportedFrameworks.Net8, net80Results}
};
}

Expand Down Expand Up @@ -98,6 +102,7 @@ public void TestSolutionWithMvcAndDualWebForms(string version)
}

[TestCase(SupportedFrameworks.Net7)]
[TestCase(SupportedFrameworks.Net8)]
public void TestSolutionWithMvcAndDualWebForms_Dotnet7AndAbove(string version)
{
var results = _mvcAndDualWebFormsSolution[version];
Expand Down

0 comments on commit 9ed65af

Please sign in to comment.