├── .github
├── ISSUE_TEMPLATE
│ ├── bug_report.md
│ ├── feature_request.md
│ └── other_issue.md
├── PULL_REQUEST_TEMPLATE.md
├── dependabot.yml
└── workflows
│ └── build_test.yml
├── .gitignore
├── .vscode
└── settings.json
├── CODEOWNERS
├── CONTRIBUTING.md
├── Directory.Build.props
├── LICENSE
├── NOTICE
├── NuGet.Config
├── PortingAssistant.Client.sln
├── README.md
├── THIRD-PARTY
├── benchmark-targets.json
├── benchmark
└── tags
│ └── static-baseline
│ └── BenchmarkDotNet.Artifacts
│ └── results
│ └── TuxNet.Benchmarking.Wrapper.PA_Client_Benchmark-report.csv
├── hooks
└── pre-commit
├── logo.png
├── nuspec.props
├── scripts
├── coverlet.runsettings
└── verify-cov.sh
├── sleet.json
├── src
├── PortingAssistant.Client.Analysis
│ ├── AnalysisHandler.cs
│ ├── CacheService.cs
│ ├── IAnalysisHandler.cs
│ ├── ICacheService.cs
│ ├── Mappers
│ │ ├── CompatibilityResultMapper.cs
│ │ ├── PackageAnalysisResultsMapper.cs
│ │ ├── PackageVersionPairMapper.cs
│ │ └── RecommandationMapper.cs
│ ├── PortingAssistant.Client.Analysis.csproj
│ ├── Utils
│ │ ├── ApiCompatiblity.cs
│ │ ├── CodeEntityModelToCodeEntities.cs
│ │ ├── CompatibilityCheckerHelper.cs
│ │ ├── NugetVersionExtensions.cs
│ │ ├── NugetVersionHelper.cs
│ │ ├── PackageCompatibility.cs
│ │ └── ProjectActionsToRecommendedActions.cs
│ └── packages.lock.json
├── PortingAssistant.Client.Client
│ ├── DependencyInjection.cs
│ ├── FileParser
│ │ ├── GitConfigFileParser.cs
│ │ ├── ProjectFileParser.cs
│ │ └── SolutionFileParser.cs
│ ├── IPortingAssistantClient.cs
│ ├── Model
│ │ └── ProjectApiAnalysisResult.cs
│ ├── PortingAssistant.Client.Client.csproj
│ ├── PortingAssistantBuilder.cs
│ ├── PortingAssistantClient.cs
│ ├── Reports
│ │ ├── IReportExporter.cs
│ │ └── ReportExporter.cs
│ └── Utils
│ │ └── HashUtils.cs
├── PortingAssistant.Client.Common
│ ├── Exception
│ │ ├── ExceptionMessage.cs
│ │ ├── InnerException
│ │ │ ├── NamespaceNotFoundException.cs
│ │ │ ├── PackageDownloadMismatchException.cs
│ │ │ ├── PackageNotFoundException.cs
│ │ │ └── PackageSourceNotFoundException.cs
│ │ ├── PortingAssistantClientException.cs
│ │ └── PortingAssistantException.cs
│ ├── Model
│ │ ├── AnalyzerSettings.cs
│ │ ├── ApiAnalysisResult.cs
│ │ ├── ApiRecommedation.cs
│ │ ├── CodeEntityCompatibilityResult.cs
│ │ ├── CodeEntityDetails.cs
│ │ ├── CodeEntityType.cs
│ │ ├── Compatibility.cs
│ │ ├── CompatibilityResult.cs
│ │ ├── DataStoreSettings.cs
│ │ ├── InternalNugetCompatibilityResult.cs
│ │ ├── NuGetServerSettings.cs
│ │ ├── PackageAnalysisResult.cs
│ │ ├── PackageDetails.cs
│ │ ├── PackageDetailsWithApiIndices.cs
│ │ ├── PackageRecommendation.cs
│ │ ├── PackageSourceType.cs
│ │ ├── PackageVersionPair.cs
│ │ ├── PortingAction.cs
│ │ ├── PortingAssistantConfiguration.cs
│ │ ├── PortingRequest.cs
│ │ ├── PortingResult.cs
│ │ ├── ProjectAnalysisResult.cs
│ │ ├── ProjectCompatibilityResult.cs
│ │ ├── ProjectDetails.cs
│ │ ├── ProjectReference.cs
│ │ ├── RecommendationDetails.cs
│ │ ├── Recommendations.cs
│ │ ├── RecommendedAction.cs
│ │ ├── RecommendedActionType.cs
│ │ ├── Schema.cs
│ │ ├── SolutionAnalysisResult.cs
│ │ ├── SolutionDetails.cs
│ │ ├── SourceFileAnalysisResult.cs
│ │ ├── TextSpan.cs
│ │ └── VisualStudioVersion.cs
│ ├── PortingAssistant.Client.Common.csproj
│ └── Utils
│ │ ├── AnalysisUtils.cs
│ │ ├── FileSystem.cs
│ │ ├── FileSystemAccess.cs
│ │ ├── IFileSystem.cs
│ │ ├── Logging.cs
│ │ ├── MemoryUtils.cs
│ │ └── XDocumentExtensions.cs
├── PortingAssistant.Client.NuGet
│ ├── Checkers
│ │ ├── ExternalCompatibilityChecker.cs
│ │ ├── ExternalPackagesCompatibilityChecker.cs
│ │ ├── InternalPackagesCompatibilityChecker.cs
│ │ ├── PortabilityAnalyzerCompatibilityChecker.cs
│ │ └── SdkCompatibilityChecker.cs
│ ├── Interfaces
│ │ ├── ICompatibilityChecker.cs
│ │ ├── IHttpService.cs
│ │ ├── IPortingAssistantNuGetHandler.cs
│ │ └── IPortingAssistantRecommendationHandler.cs
│ ├── InternalNuget
│ │ ├── IPortingAssistantInternalNuGetCompatibilityHandler.cs
│ │ └── PortingAssistantInternalNuGetCompatibilityHandler.cs
│ ├── PortingAssistant.Client.NuGet.csproj
│ ├── PortingAssistantNuGetHandler.cs
│ ├── PortingAssistantRecommendationHandler.cs
│ └── Utils
│ │ └── HttpService.cs
├── PortingAssistant.Client.Porting
│ ├── IPortingHandler.cs
│ ├── PortingAssistant.Client.Porting.csproj
│ ├── PortingHandler.cs
│ ├── PortingProjectFile
│ │ ├── IPortingProjectFileHandler.cs
│ │ └── PortingProjectFileHandler.cs
│ └── packages.lock.json
├── PortingAssistant.Client.Telemetry
│ ├── ITelemetryClient.cs
│ ├── Model
│ │ ├── APIMetrics.cs
│ │ ├── MetricsBase.cs
│ │ ├── MetricsType.cs
│ │ ├── NugetMetrics.cs
│ │ ├── ProjectMetrics.cs
│ │ └── SolutionMetrics.cs
│ ├── PortingAssistant.Client.Telemetry.csproj
│ ├── TelemetryClient.cs
│ ├── TelemetryClientConfig.cs
│ ├── TelemetryCollector.cs
│ ├── TelemetryConfiguration.cs
│ ├── TelemetryRequest.cs
│ ├── Uploader.cs
│ └── packages.lock.json
├── PortingAssistant.Client
│ ├── PortingAssistant.Client.CLI.csproj
│ ├── PortingAssistantCLI.cs
│ ├── PortingAssistantTelemetryConfig.json
│ └── Program.cs
├── PortingAssistant.Compatibility.Common
│ ├── Interface
│ │ ├── ICacheManager.cs
│ │ ├── ICompatibilityChecker.cs
│ │ ├── ICompatibilityCheckerHandler.cs
│ │ ├── ICompatibilityCheckerNuGetHandler.cs
│ │ ├── ICompatibilityCheckerRecommendationActionHandler.cs
│ │ ├── ICompatibilityCheckerRecommendationHandler.cs
│ │ ├── IHttpService.cs
│ │ └── IRegionalDatastoreService.cs
│ ├── Model
│ │ ├── AnalysisResult.cs
│ │ ├── ApiEntity.cs
│ │ ├── CodeEntityType.cs
│ │ ├── Compatibility.cs
│ │ ├── CompatibilityCheckerConfiguration.cs
│ │ ├── CompatibilityCheckerRequest.cs
│ │ ├── CompatibilityCheckerResponse.cs
│ │ ├── CompatibilityResult.cs
│ │ ├── Exception
│ │ │ ├── ExceptionMessage.cs
│ │ │ ├── NamespaceNotFoundException.cs
│ │ │ ├── PackageDownloadMismatchException.cs
│ │ │ ├── PackageNotFoundException.cs
│ │ │ └── PortingAssistantClientException.cs
│ │ ├── PackageAnalysisResult.cs
│ │ ├── PackageApiDetails.cs
│ │ ├── PackageDetailsWithApiIndices.cs
│ │ ├── PackageSourceType.cs
│ │ ├── PackageVersionPair.cs
│ │ ├── RecommendationActionFileDetails.cs
│ │ ├── RecommendationDetails.cs
│ │ └── Recommendations.cs
│ ├── PortingAssistant.Compatibility.Common.csproj
│ └── Utils
│ │ ├── ApiCompatiblity.cs
│ │ ├── Constants.cs
│ │ ├── HttpService.cs
│ │ ├── NugetVersionExtensions.cs
│ │ ├── NugetVersionHelper.cs
│ │ ├── PackageCompatibility.cs
│ │ └── RegionalDatastoreService.cs
└── PortingAssistant.Compatibility.Core
│ ├── CacheManager.cs
│ ├── Checkers
│ ├── ExternalCompatibilityChecker.cs
│ ├── NugetCompatibilityChecker.cs
│ ├── PortabilityAnalyzerCompatibilityChecker.cs
│ └── SdkCompatibilityChecker.cs
│ ├── CompatibilityCheckerBuilder.cs
│ ├── CompatibilityCheckerHandler.cs
│ ├── CompatibilityCheckerNuGetHandler.cs
│ ├── CompatibilityCheckerRecommendationActionHandler.cs
│ ├── CompatibilityCheckerRecommendationHandler.cs
│ └── PortingAssistant.Compatibility.Core.csproj
├── tests
├── PortingAssistant.Client.IntegrationTests
│ ├── AssessOptionsTest.cs
│ ├── CorrectnessTestBase.cs
│ ├── PortingAssistant.Client.IntegrationTests.csproj
│ ├── RunAnalysisCorrectnessWithDotNetFramework.cs
│ ├── RunPortingCorrectnessWithDotNetFramework.cs
│ ├── RunPortingWithWebFormFramework.cs
│ ├── RunSchemaVersionApi.cs
│ ├── RunWithDotNetCoreFrameowrk.cs
│ ├── RunWithDotNetFramework.cs
│ ├── SolutionAnalyzerTests.cs
│ ├── TestProjects
│ │ ├── Miniblog.Core-master.zip
│ │ ├── NetFrameworkExample-analyze
│ │ │ ├── NetFrameworkExample-api-analysis.json
│ │ │ └── NetFrameworkExample-package-analysis.json
│ │ ├── NetFrameworkExample-ported.zip
│ │ ├── NetFrameworkExample.zip
│ │ ├── Schemas
│ │ │ ├── api-analysis-schema.json
│ │ │ └── package-analysis-schema.json
│ │ ├── TestNet31Empty.zip
│ │ ├── VBWebApi.zip
│ │ ├── eShopOnBlazor-ported.zip
│ │ └── eShopOnBlazor.zip
│ └── TestUtils
│ │ ├── CacheUtils.cs
│ │ ├── DirectoryUtils.cs
│ │ └── JsonUtils.cs
├── PortingAssistant.Client.UnitTests
│ ├── GitConfigFileParserTest.cs
│ ├── HashUtilsTest.cs
│ ├── MemoryUtilsTest.cs
│ ├── MockInvocationExpressionModel.cs
│ ├── NUnitLogger.cs
│ ├── PortingAssistant.Client.UnitTests.csproj
│ ├── PortingAssistantAnalysisHandlerTest.cs
│ ├── PortingAssistantClientTest.cs
│ ├── PortingAssistantNugetHandlerTest.cs
│ ├── PortingAssistantPortingTest.cs
│ ├── PortingAssistantProjectFileParserTest.cs
│ ├── PortingAssistantRecommendationTest.cs
│ ├── PortingAssistantTelemetryCollectorTest.cs
│ ├── ReportExporterTest.cs
│ ├── SolutionFileParserTest.cs
│ ├── TelemetryClientFactoryTest.cs
│ ├── TelemetryClientTest.cs
│ ├── TelemetryConfigurationTest.cs
│ ├── TestProjects
│ │ └── mvcmusicstore.zip
│ ├── TestXml
│ │ ├── ProjectWithPackagesConfig
│ │ │ ├── ProjectWithPackagesConfig.csproj
│ │ │ └── packages.config
│ │ ├── ProjectWithReference
│ │ │ └── ProjectWithReference.csproj
│ │ ├── SolutionWithApi
│ │ │ ├── SolutionWithApi.sln
│ │ │ └── testproject
│ │ │ │ ├── Program.cs
│ │ │ │ └── testproject.csproj
│ │ ├── SolutionWithFailedContent
│ │ │ ├── ProjectInWrongDirectory.csproj
│ │ │ ├── SolutionWithFailedContent.sln
│ │ │ ├── packages.config
│ │ │ └── test
│ │ │ │ ├── ProjectWithCorruptContent.csproj
│ │ │ │ └── ProjectWithCorruptPackageVersion.csproj
│ │ ├── SolutionWithNugetConfigFile
│ │ │ ├── SolutionWithNugetConfigFile.sln
│ │ │ ├── Test1
│ │ │ │ └── Test1.csproj
│ │ │ ├── Test2
│ │ │ │ └── Test2.csproj
│ │ │ └── nuget.config
│ │ ├── SolutionWithProjects
│ │ │ ├── Nop.Core
│ │ │ │ ├── Nop.Core.csproj
│ │ │ │ └── packages.config
│ │ │ ├── PortingAssistantApi
│ │ │ │ └── PortingAssistantApi.csproj
│ │ │ ├── PortingAssistantApiElectron
│ │ │ │ ├── PortingAssistantApiElectron.csproj
│ │ │ │ └── packages.config
│ │ │ ├── PortingAssistantAssessment
│ │ │ │ └── PortingAssistantAssessment.csproj
│ │ │ ├── PortingAssistantCache
│ │ │ │ ├── PortingAssistantCache.csproj
│ │ │ │ └── packages.config
│ │ │ └── SolutionWithProjects.sln
│ │ ├── TestNugetRepository
│ │ │ ├── newtonsoft.json.12.0.3.nupkg
│ │ │ └── newtonsoft.json.6.0.1.nupkg
│ │ ├── TestPorting
│ │ │ ├── corrupt
│ │ │ │ ├── CorruptProject.csproj
│ │ │ │ ├── CorruptSolution.sln
│ │ │ │ └── packages.config
│ │ │ └── src
│ │ │ │ ├── Libraries
│ │ │ │ └── Nop.Core
│ │ │ │ │ ├── Nop.Core.csproj
│ │ │ │ │ ├── Program.cs
│ │ │ │ │ ├── app.config
│ │ │ │ │ └── packages.config
│ │ │ │ └── NopCommerce.sln
│ │ └── VBSolutionWithApi
│ │ │ ├── VBSolutionWithApi.sln
│ │ │ └── VBtestproject
│ │ │ ├── Program.vb
│ │ │ └── VBtestproject.vbproj
│ └── UploaderTest.cs
└── PortingAssistant.Compatibility.Core.Tests
│ ├── PortingAssistant.Compatibility.Core.Tests.csproj
│ └── UnitTests
│ ├── ApiCompatibilityTest.cs
│ ├── NugetHandlerTest.cs
│ ├── NugetVersionExtensionTest.cs
│ ├── NugetVersionHelperTest.cs
│ ├── RecommendationActionTest.cs
│ └── RecommendationTest.cs
└── version.json
/.github/ISSUE_TEMPLATE/bug_report.md:
--------------------------------------------------------------------------------
1 | ---
2 | name: Bug report
3 | about: Create a report to help us improve
4 | title: ''
5 | labels: ''
6 | assignees: ''
7 |
8 | ---
9 |
10 | ## Describe the bug
11 | A clear and concise description of what the bug is.
12 |
13 | ### Expected behavior
14 | A clear and concise description of what you expected to happen.
15 |
16 | ### Steps to Reproduce
17 | Steps to reproduce the behavior:
18 | 1. Go to '...'
19 | 2. Click on '....'
20 | 3. Scroll down to '....'
21 | 4. See error
22 |
23 | ### Screenshots
24 | If applicable, add screenshots to help explain your problem.
25 |
26 | ### Desktop (please complete the following information)
27 | - OS: [e.g. Windows, macOS, Linux, etc]
28 | - Version/Distro: [e.g. 11, Big Sur, Ubuntu 18.04]
29 |
30 | ### Additional context
31 | Add any other context about the problem here.
32 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/feature_request.md:
--------------------------------------------------------------------------------
1 | ---
2 | name: Feature request
3 | about: Suggest an idea for this project
4 | title: ''
5 | labels: ''
6 | assignees: ''
7 |
8 | ---
9 |
10 | ## Description
11 | A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
12 |
13 | ## Solution idea(s)
14 | A clear and concise description of what you want to happen.
15 |
16 | ## Additional context
17 | Add any other context or screenshots about the feature request here.
18 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/other_issue.md:
--------------------------------------------------------------------------------
1 | ---
2 | name: Other issues
3 | about: Not a bug or feature request? Let us know how else we can improve.
4 | title: "[Other Issue]"
5 | labels: ''
6 | assignees: ''
7 |
8 | ---
9 |
10 | ## Description of issue
11 | Describe the issue
12 |
13 | ## Additional context
14 | Provide any additional information
15 |
--------------------------------------------------------------------------------
/.github/PULL_REQUEST_TEMPLATE.md:
--------------------------------------------------------------------------------
1 | #### Description of change
2 | [//]: # (What are you trying to fix? What did you change)
3 |
4 | #### Issue
5 | [//]: # (Having an issue # for the PR is required for tracking purposes. If an existing issue does not exist please create one.)
6 |
7 | #### PR reviewer notes
8 | [//]: # (Let us know if there is anything we should focus on.)
9 |
10 |
11 | By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.
12 |
--------------------------------------------------------------------------------
/.github/dependabot.yml:
--------------------------------------------------------------------------------
1 | version: 2
2 | registries:
3 | porting-assistant-nuget:
4 | type: nuget-feed
5 | url: https://s3-us-west-2.amazonaws.com/aws.portingassistant.dotnet.download/nuget/index.json
6 | nuget-org:
7 | type: nuget-feed
8 | url: https://api.nuget.org/v3/index.json
9 | updates:
10 | - package-ecosystem: "nuget"
11 | directory: "/src/PortingAssistant.Client.Analysis"
12 | registries:
13 | - porting-assistant-nuget
14 | - nuget-org
15 | schedule:
16 | interval: "weekly"
17 | - package-ecosystem: "nuget"
18 | directory: "/src/PortingAssistant.Client.Client"
19 | registries:
20 | - porting-assistant-nuget
21 | - nuget-org
22 | schedule:
23 | interval: "weekly"
24 | - package-ecosystem: "nuget"
25 | directory: "/src/PortingAssistant.Client.Common"
26 | registries:
27 | - porting-assistant-nuget
28 | - nuget-org
29 | schedule:
30 | interval: "weekly"
31 | - package-ecosystem: "nuget"
32 | directory: "/src/PortingAssistant.Client.NuGet"
33 | registries:
34 | - porting-assistant-nuget
35 | - nuget-org
36 | schedule:
37 | interval: "weekly"
38 | - package-ecosystem: "nuget"
39 | directory: "/src/PortingAssistant.Client.Porting"
40 | registries:
41 | - porting-assistant-nuget
42 | - nuget-org
43 | schedule:
44 | interval: "weekly"
45 | - package-ecosystem: "nuget"
46 | directory: "/src/PortingAssistant.Client.Telemetry"
47 | registries:
48 | - porting-assistant-nuget
49 | - nuget-org
50 | schedule:
51 | interval: "weekly"
52 | - package-ecosystem: "nuget"
53 | directory: "/src/PortingAssistant.Client"
54 | registries:
55 | - porting-assistant-nuget
56 | - nuget-org
57 | schedule:
58 | interval: "weekly"
59 | - package-ecosystem: "nuget"
60 | directory: "/tests/PortingAssistant.Client.IntegrationTests"
61 | registries:
62 | - porting-assistant-nuget
63 | - nuget-org
64 | schedule:
65 | interval: "weekly"
66 | - package-ecosystem: "nuget"
67 | directory: "/tests/PortingAssistant.Client.UnitTests"
68 | registries:
69 | - porting-assistant-nuget
70 | - nuget-org
71 | schedule:
72 | interval: "weekly"
--------------------------------------------------------------------------------
/.vscode/settings.json:
--------------------------------------------------------------------------------
1 | {
2 | "markiscodecoverage.searchCriteria": "commit-hook-tests/*/coverage.info"
3 | }
--------------------------------------------------------------------------------
/CODEOWNERS:
--------------------------------------------------------------------------------
1 | # When someone opens a pull request that only
2 | # modifies the files specified below, notification will
3 | # be sent to owner(s) for a review.
4 |
5 |
6 | /src/PortingAssistant.Client.Common/Model/ @saikiranakula-amzn @cslong @huawenm
7 | /src/PortingAssistant.Client/PortingAssistantCLI.cs @saikiranakula-amzn @cslong @huawenm
8 | /src/PortingAssistant.Client.Client/PortingAssistantClient.cs @saikiranakula-amzn @cslong @huawenm
9 | /src/PortingAssistant.Client.Analysis/AnalysisHandler.cs @saikiranakula-amzn @cslong @huawenm
10 | /src/PortingAssistant.Client.Porting/PortingProjectFile/PortingProjectFileHandler.cs @saikiranakula-amzn @cslong @huawenm
11 |
--------------------------------------------------------------------------------
/Directory.Build.props:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | $(MSBuildThisFileDirectory)
5 |
6 |
7 |
8 | 3.4.231
9 | all
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/NOTICE:
--------------------------------------------------------------------------------
1 |
2 | Porting Assistant for .NET
3 | Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
4 |
--------------------------------------------------------------------------------
/NuGet.Config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/benchmark-targets.json:
--------------------------------------------------------------------------------
1 | {
2 | "Jobs": [
3 | {
4 | "JobName": "PA_Client_Benchmark",
5 | "Profilers": [],
6 | "IncludeEC2Labels": true,
7 | "Labels": {},
8 | "JobRunStrategy": 1,
9 | "JobLaunchCount": 1,
10 | "JobWarmupCount": 0,
11 | "JobIterationCount": 1,
12 | "JobInvocationCount": 1,
13 | "Targets": [
14 | {
15 | "Name": "Assess_OwinExtraAPI",
16 | "Class": "PortingAssistant.Client.CLI.Program",
17 | "Method": "Main",
18 | "MethodIsAsync": false,
19 | "MethodParameters": [
20 | {
21 | "Name": "Porting",
22 | "FullTypeName": "string[]",
23 | "JsonValues": [
24 | "[\u0022assess\u0022, \u0022-s\u0022, \u0022c:\\\\temp\\\\OwinExtraAPI\\\\OwinExtraAPI.sln\u0022, \u0022-o\u0022, \u0022c:\\\\temp\\\\OwinExtraAPI_output\u0022]"
25 | ]
26 | }
27 | ]
28 | },
29 | {
30 | "Name": "Port_IonicZipSample",
31 | "Class": "PortingAssistant.Client.CLI.Program",
32 | "Method": "Main",
33 | "MethodIsAsync": false,
34 | "MethodParameters": [
35 | {
36 | "Name": "Porting",
37 | "FullTypeName": "string[]",
38 | "JsonValues": [
39 | "[\u0022assess\u0022, \u0022-s\u0022, \u0022c:\\\\temp\\\\IonicZipSample\\\\IonicZipSample.sln\u0022, \u0022-p\u0022, \u0022IonicZipSample\u0022, \u0022-o\u0022, \u0022c:\\\\temp\\\\IonicZipSample_output\u0022]"
40 | ]
41 | }
42 | ]
43 | }
44 | ]
45 | }
46 | ]
47 | }
--------------------------------------------------------------------------------
/benchmark/tags/static-baseline/BenchmarkDotNet.Artifacts/results/TuxNet.Benchmarking.Wrapper.PA_Client_Benchmark-report.csv:
--------------------------------------------------------------------------------
1 | Method,Job,AnalyzeLaunchVariance,EvaluateOverhead,MaxAbsoluteError,MaxRelativeError,MinInvokeCount,MinIterationTime,OutlierMode,Affinity,EnvironmentVariables,Jit,LargeAddressAware,Platform,PowerPlanMode,Runtime,AllowVeryLargeObjects,Concurrent,CpuGroups,Force,HeapAffinitizeMask,HeapCount,NoAffinitize,RetainVm,Server,Arguments,BuildConfiguration,Clock,EngineFactory,NuGetReferences,Toolchain,IsMutator,InvocationCount,IterationCount,IterationTime,LaunchCount,MaxIterationCount,MaxWarmupIterationCount,MemoryRandomization,MinIterationCount,MinWarmupIterationCount,RunStrategy,UnrollFactor,WarmupCount,Porting,Mean,Error,Processor Count,Instance ID,Region,EC2 Instance Type,Exceptions,Gen0,Completed Work Items,Lock Contentions,Gen1,Gen2,Allocated
2 | Port_IonicZipSample,Job-FCZMGH,False,Default,Default,Default,Default,Default,Default,11,Empty,RyuJit,Default,X64,8c5e7fda-e8bf-4a96-9a85-a6e23a8c635c,.NET 7.0,False,True,False,True,Default,Default,False,False,False,Default,Default,Default,Default,Default,Default,Default,1,1,Default,1,Default,Default,Default,Default,Default,ColdStart,1,0,"[""as(...)ut""] [129]",600 s,NA,2,,,,101.0000,143000.0000,1339.0000,17.0000,140000.0000,11000.0000,3.3 GB
3 | Assess_OwinExtraAPI,Job-FCZMGH,False,Default,Default,Default,Default,Default,Default,11,Empty,RyuJit,Default,X64,8c5e7fda-e8bf-4a96-9a85-a6e23a8c635c,.NET 7.0,False,True,False,True,Default,Default,False,False,False,Default,Default,Default,Default,Default,Default,Default,1,1,Default,1,Default,Default,Default,Default,Default,ColdStart,1,0,"[""ass(...)put""] [99]",500 s,NA,2,,,,58.0000,175000.0000,549.0000,22.0000,174000.0000,7000.0000,4.2 GB
4 |
--------------------------------------------------------------------------------
/hooks/pre-commit:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | #
3 | # An example hook script to verify what is about to be committed.
4 | # Called by "git commit" with no arguments. The hook should
5 | # exit with non-zero status after issuing an appropriate message if
6 | # it wants to stop the commit.
7 | #
8 | # To enable this hook, rename this file to "pre-commit".
9 | git secrets --pre_commit_hook -- "$@"
10 |
11 | if git rev-parse --verify HEAD >/dev/null 2>&1
12 | then
13 | against=HEAD
14 | else
15 | # Initial commit: diff against an empty tree object
16 | against=$(git hash-object -t tree /dev/null)
17 | fi
18 |
19 | # If you want to allow non-ASCII filenames set this variable to true.
20 | allownonascii=$(git config --bool hooks.allownonascii)
21 |
22 | # Redirect output to stderr.
23 | exec 1>&2
24 |
25 | # Cross platform projects tend to avoid non-ASCII filenames; prevent
26 | # them from being added to the repository. We exploit the fact that the
27 | # printable range starts at the space character and ends with tilde.
28 | if [ "$allownonascii" != "true" ] &&
29 | # Note that the use of brackets around a tr range is ok here, (it's
30 | # even required, for portability to Solaris 10's /usr/bin/tr), since
31 | # the square bracket bytes happen to fall in the designated range.
32 | test $(git diff --cached --name-only --diff-filter=A -z $against |
33 | LC_ALL=C tr -d '[ -~]\0' | wc -c) != 0
34 | then
35 | cat <<\EOF
36 | Error: Attempt to add a non-ASCII file name.
37 |
38 | This can cause problems if you want to work with people on other platforms.
39 |
40 | To be portable it is advisable to rename the file.
41 |
42 | If you know what you are doing you can disable this check using:
43 |
44 | git config hooks.allownonascii true
45 | EOF
46 | exit 1
47 | fi
48 |
49 | echo "Running tests and code coverage."
50 | ./scripts/verify-cov.sh
51 | # $? stores exit value of the last command
52 | if [ $? -ne 0 ]; then
53 | echo ""
54 | echo "COMMIT FAILED"
55 | echo "Test Coverage failed. Please check that all tests pass and ensure code coverage is above 20%."
56 | echo "You can check test coverage in TestResult/**/coverage.cobertura.xml"
57 | exit 1
58 | fi
59 | echo "Tests and code coverage passed."
--------------------------------------------------------------------------------
/logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aws/porting-assistant-dotnet-client/a273c70e07eb66b467425a453b529c81d4b988ae/logo.png
--------------------------------------------------------------------------------
/nuspec.props:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Amazon Web Services
5 | Amazon Web Services
6 | Amazon Web Services
7 | Porting Assistant for .NET Client
8 | en-US
9 | Porting Assistant .NET Client
10 | https://github.com/aws/porting-assistant-dotnet-client
11 | Apache-2.0
12 | true
13 | true
14 | true
15 | true
16 | true
17 | snupkg
18 |
19 |
20 |
21 | true
22 |
23 |
24 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/scripts/coverlet.runsettings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | json,cobertura,lcov
8 |
9 | **/src/PortingAssistant.Client.Common/**/**.cs,
10 | **/src/PortingAssistant.Client.Handler/DependencyInjection.cs,
11 | **/tests/PortingAssistant.Client.UnitTests/TestXml/**/**.cs,
12 | **/tests/PortingAssistant.Client.IntegrationTests/TestProjects/**/**.cs,
13 |
14 | false
15 | true
16 |
17 |
18 |
19 |
20 |
--------------------------------------------------------------------------------
/scripts/verify-cov.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh -e
2 | rm -rf ./commit-hook-tests
3 | dotnet test --settings scripts/coverlet.runsettings tests/PortingAssistant.Client.UnitTests/PortingAssistant.Client.UnitTests.csproj -r ./commit-hook-tests
4 | for f in ./commit-hook-tests/**/*.xml
5 | do
6 | echo ""
7 | echo "Code Coverage Check: $f"
8 |
9 | coverage=`cat $f | grep " 0.20, Actual: $coverage"
13 | exit 1
14 | fi
15 | echo "Code coverage: $coverage"
16 | done
--------------------------------------------------------------------------------
/sleet.json:
--------------------------------------------------------------------------------
1 | {
2 | "sources": [
3 | {
4 | "name": "s3Feed",
5 | "type": "s3",
6 | "path": "https://s3-us-west-2.amazonaws.com/aws.portingassistant.dotnet.download/nuget/",
7 | "bucketName": "aws.portingassistant.dotnet.download",
8 | "feedSubPath": "nuget",
9 | "region": "us-west-2"
10 | }
11 | ]
12 | }
13 |
--------------------------------------------------------------------------------
/src/PortingAssistant.Client.Analysis/IAnalysisHandler.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 | using System.Runtime.CompilerServices;
3 | using System.Threading;
4 | using System.Threading.Tasks;
5 | using Codelyzer.Analysis.Model;
6 | using NuGet.Protocol.Plugins;
7 | using PortingAssistant.Client.Model;
8 | using PortingAssistant.Compatibility.Common.Model;
9 |
10 | namespace PortingAssistant.Client.Analysis
11 | {
12 | public interface IPortingAssistantAnalysisHandler
13 | {
14 |
15 | Task> AnalyzeSolution(string solutionFilename, List projects, string targetFramework = "net6.0", AnalyzerSettings settings = null,
16 | AssessmentType assessmentType = AssessmentType.FullAssessment);
17 |
18 | Task> AnalyzeSolution(
19 | string solutionFilename,
20 | List projects,
21 | List analyzerResults,
22 | string targetFramework,
23 | AssessmentType assessmentType = AssessmentType.FullAssessment);
24 |
25 | Task> AnalyzeSolutionIncremental(string solutionFilename, List projects,
26 | string targetFramework = "net6.0", AnalyzerSettings settings = null);
27 |
28 | Dictionary GetCompatibilityResults(string solutionFilename, List projects, List analyzerResults, string targetFramework = "net6.0");
29 | Dictionary GetCompatibilityResultsIncremental(string solutionFilename, List projects, List analyzerResults,
30 | string targetFramework = "net6.0");
31 | IAsyncEnumerable AnalyzeSolutionGeneratorAsync(string solutionFilename, List projects,
32 | string targetFramework = "net6.0", [EnumeratorCancellation] CancellationToken ct = default);
33 |
34 | ProjectAnalysisResult GetProjectAnalysisResult(
35 | string solutionFilename,
36 | string project,
37 | AnalyzerResult analyzerResult,
38 | string targetFramework = "net6.0",
39 | AssessmentType assessmentType = AssessmentType.FullAssessment
40 | );
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/src/PortingAssistant.Client.Analysis/ICacheService.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using PortingAssistant.Compatibility.Common.Model;
3 | using System.Collections.Generic;
4 |
5 | namespace PortingAssistant.Client.Analysis
6 | {
7 | public interface ICacheService
8 | {
9 | public void ValidateCacheFile(Model.PortingAssistantConfiguration config);
10 | public void ValidateCacheFile(string cacheFilePath, int cacheExpirationHours = 24);
11 | public void ApplyCacheToCompatibleCheckerResults(CompatibilityCheckerRequest compatibilityCheckerRequest,
12 | List packageVersionPairs,
13 | out Dictionary> packageWithApisNeedToCheck,
14 | ref Dictionary packageAnalysisResultsDic,
15 | ref Dictionary> apiAnalysisResultsDic);
16 |
17 | public void UpdateCacheInLocal(CompatibilityCheckerResponse response, string targetFramework);
18 | public bool IsCacheAvailable();
19 | }
20 | }
21 |
22 |
--------------------------------------------------------------------------------
/src/PortingAssistant.Client.Analysis/Mappers/CompatibilityResultMapper.cs:
--------------------------------------------------------------------------------
1 | using PortingAssistant.Client.Model;
2 | using PortingAssistant.Compatibility.Common.Model;
3 | using System;
4 | using System.Collections.Generic;
5 | using System.Linq;
6 | using System.Text;
7 | using System.Threading.Tasks;
8 | using CompatibilityResult = PortingAssistant.Compatibility.Common.Model.CompatibilityResult;
9 |
10 | namespace PortingAssistant.Client.Analysis.Mappers
11 | {
12 | public static class CompatibilityResultMapper
13 | {
14 |
15 | public static PortingAssistant.Client.Model.CompatibilityResult Convert(CompatibilityResult result)
16 | {
17 | if (result == null)
18 | {
19 | return new PortingAssistant.Client.Model.CompatibilityResult()
20 | {
21 | Compatibility = Model.Compatibility.UNKNOWN,
22 | CompatibleVersions = new List(),
23 | };
24 |
25 | }
26 | Enum.TryParse(result.Compatibility.ToString(), out PortingAssistant.Client.Model.Compatibility p);
27 | return new PortingAssistant.Client.Model.CompatibilityResult()
28 | {
29 | Compatibility = p,
30 | CompatibleVersions = result.CompatibleVersions,
31 | };
32 | }
33 |
34 | public static CompatibilityResult Convert(PortingAssistant.Client.Model.CompatibilityResult result)
35 | {
36 | if (result == null)
37 | {
38 | return new CompatibilityResult()
39 | {
40 | Compatibility = Compatibility.Common.Model.Compatibility.UNKNOWN,
41 | CompatibleVersions = new List(),
42 | };
43 | }
44 |
45 | Enum.TryParse(result.Compatibility.ToString(), out PortingAssistant.Compatibility.Common.Model.Compatibility p);
46 | return new CompatibilityResult()
47 | {
48 | Compatibility = p,
49 | CompatibleVersions = result.CompatibleVersions,
50 | };
51 | }
52 |
53 | public static Dictionary Convert(Dictionary compatibilityResults)
54 | {
55 | var result = new Dictionary();
56 | if (compatibilityResults == null)
57 | {
58 | return result;
59 | }
60 |
61 | foreach (var item in compatibilityResults)
62 | {
63 | result.Add(item.Key, Convert(item.Value));
64 | }
65 |
66 | return result;
67 | }
68 | }
69 | }
70 |
--------------------------------------------------------------------------------
/src/PortingAssistant.Client.Analysis/Mappers/PackageAnalysisResultsMapper.cs:
--------------------------------------------------------------------------------
1 | using Amazon.Runtime.Internal.Transform;
2 | using PortingAssistant.Client.Model;
3 | using System;
4 | using System.Collections.Generic;
5 | using System.Linq;
6 | using System.Text;
7 | using System.Threading.Tasks;
8 | using Codelyzer.Analysis.Model;
9 | using PortingAssistant.Compatibility.Common.Model;
10 |
11 | namespace PortingAssistant.Client.Analysis.Mappers
12 | {
13 | public class PackageAnalysisResultsMapper
14 | {
15 | public static Dictionary> Convert(Dictionary packageAnalysisResults)
16 | {
17 |
18 | Dictionary> result
19 | = new Dictionary>();
20 | if (packageAnalysisResults == null)
21 | {
22 | return result;
23 | }
24 | foreach (var r in packageAnalysisResults)
25 | {
26 | var package = PackageVersionPairMapper.Convert(r.Key);
27 | var task = new PortingAssistant.Client.Model.PackageAnalysisResult()
28 | {
29 |
30 | Recommendations = new PortingAssistant.Client.Model.Recommendations
31 | {
32 | RecommendedActions = RecommandationMapper.ConvertToPackageRecommendation(r.Value?.Recommendations?.RecommendedActions),
33 | RecommendedPackageVersions = r.Value?.Recommendations?.RecommendedPackageVersions
34 | },
35 | PackageVersionPair = package,
36 | CompatibilityResults = CompatibilityResultMapper.Convert(r.Value.CompatibilityResults)
37 | };
38 |
39 | result.Add(package, GetPackageAnalysisResultTask(task));
40 | }
41 | return result;
42 | }
43 |
44 | private static async Task GetPackageAnalysisResultTask(PortingAssistant.Client.Model.PackageAnalysisResult result)
45 | {
46 | await Task.Run(() => { });
47 | return result;
48 | }
49 | }
50 | }
51 |
--------------------------------------------------------------------------------
/src/PortingAssistant.Client.Analysis/Mappers/PackageVersionPairMapper.cs:
--------------------------------------------------------------------------------
1 | using PortingAssistant.Client.Model;
2 | using System;
3 | using System.Collections.Generic;
4 | using System.Linq;
5 | using System.Text;
6 | using System.Threading.Tasks;
7 | using PortingAssistant.Compatibility.Common.Interface;
8 | using PortingAssistant.Compatibility.Common.Model;
9 | using PackageVersionPair = PortingAssistant.Client.Model.PackageVersionPair;
10 |
11 | namespace PortingAssistant.Client.Analysis.Mappers
12 | {
13 | public static class PackageVersionPairMapper
14 | {
15 | public static PackageVersionPair Convert(Compatibility.Common.Model.PackageVersionPair pvp)
16 | {
17 | Enum.TryParse(pvp.PackageSourceType.ToString(), out PortingAssistant.Client.Model.PackageSourceType pst);
18 | return new PackageVersionPair()
19 | {
20 | PackageId = pvp.PackageId,
21 | Version = pvp.Version,
22 | PackageSourceType = pst
23 | };
24 | }
25 |
26 | public static PortingAssistant.Compatibility.Common.Model.PackageVersionPair Convert(PackageVersionPair pvp)
27 | {
28 | Enum.TryParse(pvp.PackageSourceType.ToString(), out PortingAssistant.Compatibility.Common.Model.PackageSourceType pst);
29 | return new PortingAssistant.Compatibility.Common.Model.PackageVersionPair()
30 | {
31 | PackageId = pvp.PackageId,
32 | Version = pvp.Version,
33 | PackageSourceType = pst
34 | };
35 | }
36 |
37 | public static List Convert(List pvplist)
38 | {
39 | var result = new List();
40 | foreach ( var pv in pvplist )
41 | {
42 | result.Add( Convert(pv));
43 | }
44 | return result;
45 |
46 | }
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/src/PortingAssistant.Client.Analysis/Mappers/RecommandationMapper.cs:
--------------------------------------------------------------------------------
1 | using PortingAssistant.Client.Model;
2 | using PortingAssistant.Compatibility.Common.Model;
3 | using System;
4 | using System.Collections.Generic;
5 | using System.Linq;
6 | using System.Text;
7 | using System.Threading.Tasks;
8 |
9 | namespace PortingAssistant.Client.Analysis.Mappers
10 | {
11 | public static class RecommandationMapper
12 | {
13 | public static List Convert(List r)
14 | {
15 |
16 | List actions = new List();
17 | if (r == null) {
18 | return actions;
19 | }
20 | foreach (var action in r)
21 | {
22 | Enum.TryParse(action.RecommendedActionType.ToString(), out PortingAssistant.Client.Model.RecommendedActionType actionType);
23 | var recommendation = new RecommendedAction
24 | {
25 | Description = action.Description,
26 | RecommendedActionType = actionType
27 | };
28 | actions.Add(recommendation);
29 | }
30 | return actions;
31 | }
32 |
33 | public static List ConvertToPackageRecommendation(List r)
34 | {
35 |
36 | List actions = new List();
37 | if (r == null)
38 | {
39 | return actions;
40 | }
41 | foreach (var action in r)
42 | {
43 | Enum.TryParse(action.RecommendedActionType.ToString(), out PortingAssistant.Client.Model.RecommendedActionType actionType);
44 | var recommendation = new PackageRecommendation
45 | {
46 | PackageId = action.PackageId,
47 | //Version = action.Version,
48 | TargetVersions = GetCompatibleVersionsWithoutPreReleases(action.TargetVersions),
49 | Description = action.Description,
50 | RecommendedActionType = actionType
51 | };
52 | actions.Add(recommendation);
53 | }
54 | return actions;
55 | }
56 |
57 | public static List GetCompatibleVersionsWithoutPreReleases(List compatibleVersions)
58 | {
59 | if (compatibleVersions == null) return compatibleVersions;
60 | return compatibleVersions.Where(v => !v.Contains("-")).ToList();
61 | }
62 | }
63 | }
64 |
--------------------------------------------------------------------------------
/src/PortingAssistant.Client.Analysis/PortingAssistant.Client.Analysis.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | net6.0
5 | true
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/src/PortingAssistant.Client.Analysis/Utils/NugetVersionHelper.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 | using System.Linq;
3 | using NuGet.Versioning;
4 |
5 | namespace PortingAssistant.Client.Analysis.Utils
6 | {
7 | public class NugetVersionHelper
8 | {
9 | public static NuGetVersion GetMaxVersion(IEnumerable nugetVersions)
10 | {
11 | var parsedVersions = nugetVersions.Select(v =>
12 | {
13 | if (NuGetVersion.TryParse(v, out var validVersion))
14 | {
15 | return validVersion;
16 | }
17 |
18 | return null;
19 | }).Where(v => v!= null);
20 |
21 | // Returns null if there are no valid nugetVersions
22 | return GetMaxVersion(parsedVersions);
23 | }
24 |
25 | public static NuGetVersion GetMaxVersion(IEnumerable nugetVersions)
26 | {
27 | return nugetVersions.Max();
28 | }
29 |
30 | public static bool HasLowerCompatibleVersionWithSameMajor(NuGetVersion nugetVersion, IEnumerable compatibleNugetVersions)
31 | {
32 | return compatibleNugetVersions.Any(v =>
33 | nugetVersion.IsGreaterThanOrEqualTo(v)
34 | && nugetVersion.HasSameMajorAs(v)
35 | );
36 | }
37 |
38 | public static IEnumerable ToNugetVersionCollection(IEnumerable nugetStringVersions)
39 | {
40 | var nugetVersions = new List();
41 |
42 | foreach (var nugetStringVersion in nugetStringVersions)
43 | {
44 | if (NuGetVersion.TryParse(nugetStringVersion, out var nugetVersion))
45 | {
46 | nugetVersions.Add(nugetVersion);
47 | }
48 | }
49 |
50 | return nugetVersions;
51 | }
52 | }
53 | }
54 |
--------------------------------------------------------------------------------
/src/PortingAssistant.Client.Analysis/Utils/ProjectActionsToRecommendedActions.cs:
--------------------------------------------------------------------------------
1 | using CTA.Rules.Models;
2 | using PortingAssistant.Client.Model;
3 | using System;
4 | using System.Collections.Generic;
5 | using System.Linq;
6 |
7 | namespace PortingAssistant.Client.Analysis.Utils
8 | {
9 | public static class ProjectActionsToRecommendedActions
10 | {
11 | public static Dictionary> Convert(ProjectActions projectActions)
12 | {
13 | return projectActions.FileActions.Select(fileAction =>
14 | {
15 | var RecommendedActions = fileAction.NodeTokens.ConvertAll(t => new RecommendedAction
16 | {
17 | TargetCPU = t.TargetCPU,
18 | TextSpan = new TextSpan
19 | {
20 | EndCharPosition = t.TextSpan.EndCharPosition,
21 | EndLinePosition = t.TextSpan.EndLinePosition,
22 | StartCharPosition = t.TextSpan.StartCharPosition,
23 | StartLinePosition = t.TextSpan.StartLinePosition
24 | },
25 | Description = t.Description,
26 | RecommendedActionType = RecommendedActionType.ReplaceNamespace,
27 | TextChanges = t.TextChanges
28 | }).ToHashSet();
29 |
30 | return new Tuple>(fileAction.FilePath, RecommendedActions.ToList());
31 | }).ToDictionary(t => t.Item1, t => t.Item2);
32 | }
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/src/PortingAssistant.Client.Client/FileParser/GitConfigFileParser.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 | using System.IO;
3 | using System.Linq;
4 | using LibGit2Sharp;
5 |
6 | namespace PortingAssistant.Client.Client.FileParser
7 | {
8 | public class GitConfigFileParser
9 | {
10 | public static string getGitRepositoryRootPath(string solutionPath)
11 | {
12 | string dirName = Path.GetDirectoryName(solutionPath);
13 | if (System.String.IsNullOrWhiteSpace(dirName))
14 | {
15 | return null;
16 | }
17 |
18 | var gitRepoRootPath = Repository.Discover(dirName);
19 |
20 | if (gitRepoRootPath != null)
21 | {
22 | return gitRepoRootPath;
23 | }
24 |
25 | // The solution is not versioned by git
26 | return null;
27 | }
28 |
29 | public static string getGitRepositoryUrl(string gitRepositoryRootPath)
30 | {
31 | if (gitRepositoryRootPath == null || !Directory.Exists(gitRepositoryRootPath))
32 | {
33 | return null;
34 | }
35 | try
36 | {
37 | var repo = new Repository(gitRepositoryRootPath);
38 |
39 | var configEntries = new List>(repo.Config.Find("remote.origin.url"));
40 | return configEntries.FirstOrDefault()?.Value;
41 | }
42 | catch
43 | {
44 | return null;
45 | }
46 | }
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/src/PortingAssistant.Client.Client/FileParser/SolutionFileParser.cs:
--------------------------------------------------------------------------------
1 | using System.IO;
2 | using System.Text.RegularExpressions;
3 |
4 | namespace PortingAssistant.Client.Client.FileParser
5 | {
6 | public class SolutionFileParser
7 | {
8 | public static string getSolutionGuid(string solutionPath)
9 | {
10 | if (!File.Exists(solutionPath))
11 | {
12 | return null;
13 | }
14 | if (solutionPath.EndsWith(".sln"))
15 | {
16 | Regex rx = new Regex(".*SolutionGuid = {(.*)}");
17 | string solutionFile = File.ReadAllText(solutionPath);
18 | Match m = rx.Match(solutionFile);
19 | if (m.Success)
20 | {
21 | /*
22 | * A regular expression pattern can include subexpressions, which are defined by enclosing a portion of the regular expression pattern in parentheses. Every such subexpression forms a group. The Groups property provides access to information about those subexpression matches where:
23 | *
24 | * At index 0: the full match.
25 | * At index 1: the contents of the first parentheses.
26 | * At index 2: the contents of the second parentheses.
27 | * …and so on…
28 | *
29 | * We need the cotent matched by the first parentheses, hence access the value through Groups[1].
30 | */
31 | return m.Groups[1].Value.ToLower();
32 | }
33 | }
34 | return null;
35 | }
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/src/PortingAssistant.Client.Client/IPortingAssistantClient.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 | using System.Runtime.CompilerServices;
3 | using System.Threading;
4 | using System.Threading.Tasks;
5 | using Codelyzer.Analysis;
6 | using Codelyzer.Analysis.Model;
7 | using CTA.Rules.Models;
8 | using PortingAssistant.Client.Model;
9 | using PortingAssistant.Compatibility.Common.Model;
10 |
11 | namespace PortingAssistant.Client.Client
12 | {
13 | public interface IPortingAssistantClient
14 | {
15 | Task AnalyzeSolutionAsync(string solutionFilePath, AnalyzerSettings settings, AssessmentType assessmentType = AssessmentType.FullAssessment);
16 | IAsyncEnumerable AnalyzeSolutionGeneratorAsync(string solutionFilePath, AnalyzerSettings settings, [EnumeratorCancellation] CancellationToken cancellationToken = default);
17 | /*
18 | Task> AnalyzeFileAsync(string filePath, string projectFile, string solutionFilePath,
19 | List preportReferences, List currentReferences, RootNodes rules, ExternalReferences externalReferences, AnalyzerSettings settings);
20 | Task> AnalyzeFileAsync(string filePath, string fileContent, string projectFile, string solutionFilePath,
21 | List preportReferences, List currentReferences, RootNodes rules, ExternalReferences externalReferences, AnalyzerSettings settings);
22 | */
23 | List ApplyPortingChanges(PortingRequest request);
24 | SolutionAnalysisResult GetCompatibilityResults(string solutionFilePath, AnalyzerSettings settings, List analyzerResults);
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/src/PortingAssistant.Client.Client/Model/ProjectApiAnalysisResult.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 |
4 | namespace PortingAssistant.Client.Model
5 | {
6 | public class ProjectApiAnalysisResult : IDisposable
7 | {
8 | public string SolutionFile { get; set; }
9 | public string SolutionGuid { get; set; }
10 | public string ApplicationGuid { get; set; }
11 | public string RepositoryUrl { get; set; }
12 | public string ProjectFile { get; set; }
13 | public string ProjectGuid { get; set; }
14 | public List Errors { get; set; }
15 | public string SchemaVersion { get; set; }
16 | public List SourceFileAnalysisResults { get; set; }
17 |
18 | public void Dispose()
19 | {
20 | SourceFileAnalysisResults = null;
21 | Errors = null;
22 | }
23 | }
24 | }
--------------------------------------------------------------------------------
/src/PortingAssistant.Client.Client/PortingAssistant.Client.Client.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | net6.0
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
--------------------------------------------------------------------------------
/src/PortingAssistant.Client.Client/PortingAssistantBuilder.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Text;
3 | using Microsoft.Extensions.DependencyInjection;
4 | using Microsoft.Extensions.Logging;
5 | using PortingAssistant.Client.Analysis;
6 | using PortingAssistant.Client.Client.Reports;
7 | using PortingAssistant.Client.Model;
8 |
9 | namespace PortingAssistant.Client.Client
10 | {
11 | public class PortingAssistantBuilder
12 | {
13 |
14 | private ServiceCollection ServiceCollection;
15 | private readonly IPortingAssistantClient PortingAssistantClient;
16 | private readonly IReportExporter ReportExporter;
17 | private readonly PortingAssistantConfiguration Configuration;
18 | private readonly Action LogConfiguration;
19 | public IPortingAssistantClient GetPortingAssistant()
20 | {
21 | return PortingAssistantClient;
22 | }
23 |
24 | public IReportExporter GetReportExporter()
25 | {
26 | return ReportExporter;
27 | }
28 |
29 | private PortingAssistantBuilder(PortingAssistantConfiguration configuration, Action logConfiguration)
30 | {
31 | this.LogConfiguration = logConfiguration;
32 | this.Configuration = configuration;
33 | ConfigureServices();
34 | var services = ServiceCollection.BuildServiceProvider();
35 | this.PortingAssistantClient = services.GetService();
36 | this.ReportExporter = services.GetService();
37 | var cacheService = services.GetService();
38 | cacheService.ValidateCacheFile(configuration);
39 |
40 | }
41 |
42 | public static PortingAssistantBuilder Build(PortingAssistantConfiguration configuration, Action logConfiguration = null)
43 | {
44 | if (logConfiguration == null)
45 | {
46 | logConfiguration = (config) => config.AddConsole();
47 | }
48 | return new PortingAssistantBuilder(configuration, logConfiguration);
49 | }
50 |
51 | private void ConfigureServices()
52 | {
53 | ServiceCollection = new ServiceCollection();
54 | ServiceCollection.AddLogging(LogConfiguration);
55 | ServiceCollection.AddAssessment(Configuration);
56 | ServiceCollection.AddSingleton();
57 | ServiceCollection.AddOptions();
58 | Encoding.RegisterProvider(CodePagesEncodingProvider.Instance);
59 | }
60 | }
61 |
62 | }
63 |
--------------------------------------------------------------------------------
/src/PortingAssistant.Client.Client/Reports/IReportExporter.cs:
--------------------------------------------------------------------------------
1 | using PortingAssistant.Client.Model;
2 | using System.Collections.Generic;
3 | using System.Threading.Tasks;
4 |
5 | namespace PortingAssistant.Client.Client.Reports
6 | {
7 | public interface IReportExporter
8 | {
9 | bool GenerateJsonReport(List portingResults, string SolutionName, string outputFolder);
10 | bool GenerateJsonReport(SolutionAnalysisResult solutionAnalysisResult, string outputFolder, bool separateApiAnalyzeByEachCodeFile = false);
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/src/PortingAssistant.Client.Client/Utils/HashUtils.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Text;
4 | using System.Security.Cryptography;
5 |
6 | namespace PortingAssistant.Client.Client.Utils
7 | {
8 | public class HashUtils
9 | {
10 | public static string GenerateGuid(List guids)
11 | {
12 | if (guids == null || guids.Count == 0)
13 | {
14 | return null;
15 | }
16 |
17 | guids.Sort();
18 |
19 | string inputStr = String.Join(",", guids);
20 | using (MD5 md5 = MD5.Create())
21 | {
22 | byte[] inputBytes = md5.ComputeHash(Encoding.Default.GetBytes(inputStr));
23 | byte[] hashBytes = md5.ComputeHash(inputBytes);
24 | return new Guid(hashBytes).ToString().ToLower();
25 | }
26 | }
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/src/PortingAssistant.Client.Common/Exception/ExceptionMessage.cs:
--------------------------------------------------------------------------------
1 | using NuGet.Packaging.Core;
2 |
3 | namespace PortingAssistant.Client.Model
4 | {
5 | public static class ExceptionMessage
6 | {
7 | public static string PackageNotFound(PackageVersionPair packageVersion)
8 | => PackageNotFound(packageVersion.ToString());
9 | public static string PackageNotFound(string package)
10 | => $"Cannot find package {package}";
11 | public static string PackageSourceNotFound(PackageIdentity package)
12 | => PackageSourceNotFound(package.ToString());
13 | public static string PackageSourceNotFound(string packageVersion)
14 | => $"Package source not found for {packageVersion}";
15 | public static string NamespaceNotFound(string @namespace)
16 | => $"Could not find recommended namespace {@namespace}";
17 | public static string NamespaceFailedToProcess(string @namespace)
18 | => $"Failed to process namespace {@namespace}";
19 | }
20 | }
--------------------------------------------------------------------------------
/src/PortingAssistant.Client.Common/Exception/InnerException/NamespaceNotFoundException.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace PortingAssistant.Client.Model
4 | {
5 | public class NamespaceNotFoundException : Exception
6 | {
7 | public NamespaceNotFoundException(string message) :
8 | base(message)
9 | {
10 | }
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/src/PortingAssistant.Client.Common/Exception/InnerException/PackageDownloadMismatchException.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace PortingAssistant.Client.Model
4 | {
5 | public class PackageDownloadMismatchException : Exception
6 | {
7 |
8 | public PackageDownloadMismatchException(string message) :
9 | base(message)
10 | {
11 | }
12 |
13 | public PackageDownloadMismatchException(string expectedPackage, string actualPackage) :
14 | base(DefaultMessage(expectedPackage, actualPackage))
15 | {
16 | }
17 |
18 | private static string DefaultMessage(string expectedPackage, string actualPackage)
19 | {
20 | return $"Downloaded package did not match expected package. Expected: {expectedPackage}, Actual: {actualPackage}";
21 | }
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/src/PortingAssistant.Client.Common/Exception/InnerException/PackageNotFoundException.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace PortingAssistant.Client.Model
4 | {
5 | public class PackageNotFoundException : Exception
6 | {
7 | public PackageNotFoundException(string message) :
8 | base(message)
9 | {
10 | }
11 |
12 | public PackageNotFoundException(PackageVersionPair packageVersion) :
13 | base(DefaultMessage(packageVersion))
14 | {
15 | }
16 |
17 | private static string DefaultMessage(PackageVersionPair packageVersion)
18 | {
19 | return $"Could not find package {packageVersion}.";
20 | }
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/src/PortingAssistant.Client.Common/Exception/InnerException/PackageSourceNotFoundException.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace PortingAssistant.Client.Model
4 | {
5 | public class PackageSourceNotFoundException : Exception
6 | {
7 | public PackageSourceNotFoundException(string message) :
8 | base(message)
9 | {
10 | }
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/src/PortingAssistant.Client.Common/Exception/PortingAssistantClientException.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace PortingAssistant.Client.Model
4 | {
5 | public class PortingAssistantClientException : Exception
6 | {
7 | public PortingAssistantClientException(string message, Exception innerException) :
8 | base(message, innerException)
9 | {
10 | }
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/src/PortingAssistant.Client.Common/Exception/PortingAssistantException.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | namespace PortingAssistant.Client.Model
3 | {
4 | public class PortingAssistantException : Exception
5 | {
6 | public PortingAssistantException(string message, Exception innerException) :
7 | base(message, innerException)
8 | {
9 | }
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/src/PortingAssistant.Client.Common/Model/AnalyzerSettings.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 |
4 | namespace PortingAssistant.Client.Model
5 | {
6 | public class AnalyzerSettings
7 | {
8 | public List IgnoreProjects { get; set; }
9 |
10 | public string TargetFramework { get; set; }
11 |
12 | public bool ContiniousEnabled { get; set; }
13 |
14 | public bool CompatibleOnly { get; set; }
15 |
16 | public bool ActionsOnly { get; set; }
17 |
18 | public bool UseGenerator { get; set; }
19 |
20 | public VisualStudioVersion? VisualStudioVersion { get; set; }
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/src/PortingAssistant.Client.Common/Model/ApiAnalysisResult.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 |
3 | namespace PortingAssistant.Client.Model
4 | {
5 | public class ApiAnalysisResult
6 | {
7 | public CodeEntityDetails CodeEntityDetails { get; set; }
8 | public Dictionary CompatibilityResults { get; set; } // Target Framework CompatibilityResults pair
9 | public Recommendations Recommendations { get; set; }
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/src/PortingAssistant.Client.Common/Model/ApiRecommedation.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | namespace PortingAssistant.Client.Model
3 | {
4 | public class ApiRecommendation : RecommendedAction
5 | {
6 | public CodeEntityDetails CodeEntityDetails { get; set; }
7 | }
8 | }
9 |
--------------------------------------------------------------------------------
/src/PortingAssistant.Client.Common/Model/CodeEntityCompatibilityResult.cs:
--------------------------------------------------------------------------------
1 | using PortingAssistant.Client.Model;
2 | using System;
3 | using System.Collections.Generic;
4 | using System.Text;
5 |
6 | namespace PortingAssistant.Client.Common.Model
7 | {
8 | public class CodeEntityCompatibilityResult
9 | {
10 | public CodeEntityCompatibilityResult(CodeEntityType codeEntityType)
11 | {
12 | CodeEntityType = codeEntityType;
13 | }
14 | public CodeEntityType CodeEntityType { get; set; }
15 | public int Compatible { get; set; }
16 | public int Incompatible { get; set; }
17 | public int Unknown { get; set; }
18 | public int Actions { get; set; }
19 | public int Deprecated { get; set; }
20 |
21 | public override bool Equals(object obj)
22 | {
23 | return base.Equals(obj as CodeEntityCompatibilityResult);
24 | }
25 |
26 | public bool Equals(CodeEntityCompatibilityResult compareResult)
27 | {
28 | return compareResult?.CodeEntityType.Equals(CodeEntityType) == true;
29 | }
30 | public override int GetHashCode()
31 | {
32 | return HashCode.Combine(CodeEntityType);
33 | }
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/src/PortingAssistant.Client.Common/Model/CodeEntityDetails.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using Newtonsoft.Json;
3 | using Newtonsoft.Json.Converters;
4 |
5 | namespace PortingAssistant.Client.Model
6 | {
7 | public class CodeEntityDetails
8 | {
9 | [JsonConverter(typeof(StringEnumConverter))]
10 | public CodeEntityType CodeEntityType { get; set; }
11 | public string ClassName { get; set; }
12 | public string Name { get; set; }
13 | public string Namespace { get; set; }
14 | public string Signature { get; set; } //valid for method
15 | public string OriginalDefinition { get; set; } //valid for method
16 | public TextSpan TextSpan { get; set; }
17 | public PackageVersionPair Package { get; set; }
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/src/PortingAssistant.Client.Common/Model/CodeEntityType.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | namespace PortingAssistant.Client.Model
3 | {
4 | public enum CodeEntityType
5 | {
6 | Namespace,
7 | Class,
8 | Method,
9 | InstanceAttribute,
10 | ClassAttribute,
11 | Annotation,
12 | Declaration,
13 | Using,
14 | Enum,
15 | Struct
16 | }
17 | }
--------------------------------------------------------------------------------
/src/PortingAssistant.Client.Common/Model/Compatibility.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | namespace PortingAssistant.Client.Model
3 | {
4 | public enum Compatibility
5 | {
6 | UNKNOWN,
7 | COMPATIBLE,
8 | INCOMPATIBLE,
9 | DEPRECATED
10 | };
11 | }
12 |
--------------------------------------------------------------------------------
/src/PortingAssistant.Client.Common/Model/CompatibilityResult.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using Newtonsoft.Json;
4 | using Newtonsoft.Json.Converters;
5 | using System.Linq;
6 |
7 | namespace PortingAssistant.Client.Model
8 | {
9 | public class CompatibilityResult
10 | {
11 | [JsonConverter(typeof(StringEnumConverter))]
12 | public Compatibility Compatibility { get; set; }
13 | public List CompatibleVersions { get; set; }
14 |
15 | ///
16 | /// Returns list of compatible versions with and pre-release (alpha, beta, rc) versions filtered out
17 | ///
18 | public List GetCompatibleVersionsWithoutPreReleases()
19 | {
20 | return CompatibleVersions.Where(v => !v.Contains("-")).ToList();
21 | }
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/src/PortingAssistant.Client.Common/Model/DataStoreSettings.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | namespace PortingAssistant.Client.Model
3 | {
4 | public class DataStoreSettings
5 | {
6 | public string HttpsEndpoint { get; set; }
7 | public string S3Endpoint { get; set; }
8 | public string GitHubEndpoint { get; set; }
9 | public DataStoreSettings DeepCopy()
10 | {
11 | return new DataStoreSettings
12 | {
13 | HttpsEndpoint = this.HttpsEndpoint,
14 | S3Endpoint = this.S3Endpoint,
15 | GitHubEndpoint = this.GitHubEndpoint
16 | };
17 | }
18 |
19 |
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/src/PortingAssistant.Client.Common/Model/InternalNugetCompatibilityResult.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 |
3 | namespace PortingAssistant.Client.Model
4 | {
5 | public class InternalNuGetCompatibilityResult
6 | {
7 | public bool IsCompatible { get; set; }
8 | public string Source { get; set; }
9 | public List IncompatibleDlls;
10 | public List CompatibleDlls;
11 | public List DependencyPackages;
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/src/PortingAssistant.Client.Common/Model/NuGetServerSettings.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | namespace PortingAssistant.Client.Model
3 | {
4 | public class NuGetServerSettings
5 | {
6 | public string NugetServerEndpoint { get; set; }
7 |
8 | public NuGetServerSettings DeepCopy()
9 | {
10 | return new NuGetServerSettings
11 | {
12 | NugetServerEndpoint = this.NugetServerEndpoint
13 | };
14 | }
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/src/PortingAssistant.Client.Common/Model/PackageAnalysisResult.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 |
3 | namespace PortingAssistant.Client.Model
4 | {
5 | public class PackageAnalysisResult
6 | {
7 | public PackageVersionPair PackageVersionPair { get; set; }
8 | public Dictionary CompatibilityResults { get; set; } // Target Framework CompatibilityResults pair
9 | public Recommendations Recommendations { get; set; }
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/src/PortingAssistant.Client.Common/Model/PackageDetailsWithApiIndices.cs:
--------------------------------------------------------------------------------
1 | using PortingAssistant.Client.Model;
2 | using System;
3 | using System.Collections.Generic;
4 | using System.Text;
5 |
6 | namespace PortingAssistant.Client.Model
7 | {
8 | public class PackageDetailsWithApiIndices
9 | {
10 | public PackageDetails PackageDetails { get; set; }
11 | public Dictionary IndexDict { get; set; }
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/src/PortingAssistant.Client.Common/Model/PackageRecommendation.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 |
4 | namespace PortingAssistant.Client.Model
5 | {
6 | public class PackageRecommendation : RecommendedAction
7 | {
8 | public string PackageId { get; set; }
9 | public string Version { get; set; }
10 | public List TargetVersions { get; set; }
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/src/PortingAssistant.Client.Common/Model/PackageSourceType.cs:
--------------------------------------------------------------------------------
1 | namespace PortingAssistant.Client.Model
2 | {
3 | public enum PackageSourceType
4 | {
5 | SDK,
6 | NUGET,
7 | PORTABILITY_ANALYZER,
8 | RECOMMENDATION,
9 | PRIVATE
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/src/PortingAssistant.Client.Common/Model/PackageVersionPair.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using Newtonsoft.Json;
3 | using Newtonsoft.Json.Converters;
4 |
5 | namespace PortingAssistant.Client.Model
6 | {
7 | public class PackageVersionPair
8 | {
9 | public string PackageId { get; set; }
10 | public string Version { get; set; }
11 | [JsonConverter(typeof(StringEnumConverter))]
12 | public PackageSourceType PackageSourceType { get; set; }
13 |
14 | public override bool Equals(object obj)
15 | {
16 | return obj is PackageVersionPair pair &&
17 | PackageId == pair.PackageId &&
18 | Version == pair.Version &&
19 | PackageSourceType == pair.PackageSourceType;
20 | }
21 |
22 | public override int GetHashCode()
23 | {
24 | return HashCode.Combine(PackageId, Version, PackageSourceType);
25 | }
26 |
27 | public override string ToString()
28 | {
29 | return $"{PackageId}-{Version}-{PackageSourceType.ToString()}";
30 | }
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/src/PortingAssistant.Client.Common/Model/PortingAction.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Text;
4 |
5 | namespace PortingAssistant.Client.Model
6 | {
7 | public class PortingAction
8 | {
9 | public TextSpan TextSpan { get; set; }
10 | public RecommendedAction RecommendedAction { get; set; }
11 | public Dictionary> TargetFramework { get; set; }
12 |
13 | public override bool Equals(object obj)
14 | {
15 | return obj is PortingAction pair &&
16 | TextSpan == pair.TextSpan &&
17 | RecommendedAction == pair.RecommendedAction;
18 | }
19 |
20 | public override int GetHashCode()
21 | {
22 | return HashCode.Combine(TextSpan, RecommendedAction);
23 | }
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/src/PortingAssistant.Client.Common/Model/PortingAssistantConfiguration.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 |
4 | namespace PortingAssistant.Client.Model
5 | {
6 | public class PortingAssistantConfiguration
7 | {
8 |
9 | public PortingAssistantConfiguration()
10 | {
11 | this.UseDataStoreSettings = true;
12 | this.CacheExpirationHours = 24;
13 | }
14 |
15 |
16 | public bool UseDataStoreSettings { get; set; }
17 | public int CacheExpirationHours { get; set; }
18 | public string CompatibilityCheckerCacheFilePath { get; set; }
19 |
20 |
21 | public PortingAssistantConfiguration DeepCopy()
22 | {
23 | return new PortingAssistantConfiguration
24 | {
25 | UseDataStoreSettings = this.UseDataStoreSettings,
26 | CacheExpirationHours = this.CacheExpirationHours,
27 | CompatibilityCheckerCacheFilePath = this.CompatibilityCheckerCacheFilePath
28 | };
29 | }
30 |
31 | public PortingAssistantConfiguration DeepCopy(PortingAssistantConfiguration that)
32 | {
33 | that.UseDataStoreSettings = this.UseDataStoreSettings;
34 | that.CacheExpirationHours = this.CacheExpirationHours;
35 | that.CompatibilityCheckerCacheFilePath= this.CompatibilityCheckerCacheFilePath;
36 | return that;
37 | }
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/src/PortingAssistant.Client.Common/Model/PortingRequest.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 |
4 | namespace PortingAssistant.Client.Model
5 | {
6 | public class PortingRequest
7 | {
8 | public List Projects { get; set; }
9 | public string SolutionPath { get; set; }
10 | public string TargetFramework { get; set; }
11 | public List RecommendedActions { get; set; }
12 | public bool IncludeCodeFix { get; set; }
13 | public VisualStudioVersion? VisualStudioVersion { get; set; }
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/src/PortingAssistant.Client.Common/Model/PortingResult.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | namespace PortingAssistant.Client.Model
3 | {
4 | public class PortingResult
5 | {
6 | public bool Success { get; set; }
7 | public string ProjectFile { get; set; }
8 | public string ProjectName { get; set; }
9 | public string Message { get; set; }
10 | public Exception Exception { get; set; }
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/src/PortingAssistant.Client.Common/Model/ProjectAnalysisResult.cs:
--------------------------------------------------------------------------------
1 | using Codelyzer.Analysis.Model;
2 | using CTA.Rules.Models;
3 | using PortingAssistant.Client.Common.Model;
4 | using System;
5 | using System.Collections.Generic;
6 | using System.Threading.Tasks;
7 | using CTA.Rules.Models.VisualBasic;
8 |
9 | namespace PortingAssistant.Client.Model
10 | {
11 | public class ProjectAnalysisResult : ProjectDetails, IDisposable
12 | {
13 | public List Errors { get; set; }
14 | public List SourceFileAnalysisResults { get; set; }
15 | public Dictionary> PackageAnalysisResults { get; set; }
16 | public List PreportMetaReferences { get; set; }
17 | public List MetaReferences { get; set; }
18 | public RootNodes ProjectRules { get; set; }
19 | public VisualBasicRootNodes VisualBasicProjectRules { get; set; }
20 | public ExternalReferences ExternalReferences { get; set; }
21 | public ProjectCompatibilityResult ProjectCompatibilityResult { get; set; }
22 | public bool HasCompatibilityCheckingError { get; set; } //GetCompatibilityResponse HasError
23 | public void Dispose()
24 | {
25 | Errors = null;
26 | SourceFileAnalysisResults = null;
27 | PackageAnalysisResults = null;
28 | PreportMetaReferences = null;
29 | MetaReferences = null;
30 | ProjectRules = null;
31 | VisualBasicProjectRules = null;
32 | ExternalReferences = null;
33 | ProjectCompatibilityResult = null;
34 | LinesOfCode= 0;
35 | }
36 | }
37 | }
--------------------------------------------------------------------------------
/src/PortingAssistant.Client.Common/Model/ProjectCompatibilityResult.cs:
--------------------------------------------------------------------------------
1 | using PortingAssistant.Client.Model;
2 | using System;
3 | using System.Collections.Generic;
4 | using System.Text;
5 | using System.Linq;
6 |
7 | namespace PortingAssistant.Client.Common.Model
8 | {
9 | public class ProjectCompatibilityResult
10 | {
11 | public ProjectCompatibilityResult()
12 | {
13 | CodeEntityCompatibilityResults = new HashSet();
14 | CodeEntityCompatibilityResults.Add(new CodeEntityCompatibilityResult(CodeEntityType.Annotation));
15 | CodeEntityCompatibilityResults.Add(new CodeEntityCompatibilityResult(CodeEntityType.Method));
16 | CodeEntityCompatibilityResults.Add(new CodeEntityCompatibilityResult(CodeEntityType.Declaration));
17 | CodeEntityCompatibilityResults.Add(new CodeEntityCompatibilityResult(CodeEntityType.Enum));
18 | CodeEntityCompatibilityResults.Add(new CodeEntityCompatibilityResult(CodeEntityType.Struct));
19 | }
20 | public string ProjectPath { get; set; }
21 | public bool IsPorted { get; set; }
22 |
23 | public HashSet CodeEntityCompatibilityResults { get; set; }
24 |
25 | public override string ToString()
26 | {
27 | var str = new StringBuilder();
28 | if (IsPorted)
29 | {
30 | str.AppendLine($"Ported Project Compatibilities for {ProjectPath}:");
31 | }
32 | else
33 | {
34 | str.AppendLine($"Analyzed Project Compatibilities for {ProjectPath}:");
35 | }
36 |
37 | CodeEntityCompatibilityResults.ToList().ForEach(result =>
38 | {
39 | str.AppendLine($"{ result.CodeEntityType }: Compatible:{result.Compatible}, Incompatible:{result.Incompatible}, Unknown:{result.Unknown}, Deprecated:{result.Deprecated}, Actions:{result.Actions}");
40 | });
41 | return str.ToString();
42 | }
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/src/PortingAssistant.Client.Common/Model/ProjectDetails.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 |
3 | namespace PortingAssistant.Client.Model
4 | {
5 | public class ProjectDetails
6 | {
7 | public string ProjectName { get; set; }
8 | public string ProjectFilePath { get; set; }
9 | public string ProjectGuid { get; set; }
10 | public string ProjectType { get; set; }
11 | public string FeatureType { get; set; }
12 | public List TargetFrameworks { get; set; }
13 | public List PackageReferences { get; set; }
14 | public List ProjectReferences { get; set; }
15 | public bool IsBuildFailed { get; set; }
16 | public int LinesOfCode { get; set; }
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/src/PortingAssistant.Client.Common/Model/ProjectReference.cs:
--------------------------------------------------------------------------------
1 | using System.IO;
2 | using System.Xml.Linq;
3 | using PortingAssistant.Client.Utils;
4 |
5 | namespace PortingAssistant.Client.Model
6 | {
7 | public class ProjectReference
8 | {
9 | public string ReferencePath { get; set; }
10 |
11 | public static ProjectReference Get(XElement packageReferenceElement, string projectAbsolutePath)
12 | {
13 | return new ProjectReference
14 | {
15 | ReferencePath = Path.GetFullPath(Path.Combine(
16 | Path.GetDirectoryName(projectAbsolutePath),
17 | packageReferenceElement.GetAttributeValue("Include")
18 | .Replace("\\", Path.DirectorySeparatorChar.ToString())))
19 | };
20 | }
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/src/PortingAssistant.Client.Common/Model/Recommendations.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 |
3 | namespace PortingAssistant.Client.Model
4 | {
5 | public class Recommendations
6 | {
7 | public List RecommendedActions { get; set; }
8 | public List RecommendedPackageVersions { get; set; }
9 | }
10 | }
11 |
--------------------------------------------------------------------------------
/src/PortingAssistant.Client.Common/Model/RecommendedAction.cs:
--------------------------------------------------------------------------------
1 | using CTA.Rules.Models;
2 | using Newtonsoft.Json;
3 | using Newtonsoft.Json.Converters;
4 | using System;
5 | using System.Collections.Generic;
6 | using System.Linq;
7 |
8 | namespace PortingAssistant.Client.Model
9 | {
10 | public class RecommendedAction
11 | {
12 | [JsonConverter(typeof(StringEnumConverter))]
13 | public RecommendedActionType RecommendedActionType { get; set; }
14 | public string Description { get; set; }
15 | public TextSpan TextSpan { get; set; }
16 | public List TargetCPU { get; set; }
17 |
18 | public IList TextChanges { get; set; }
19 |
20 | public override bool Equals(object obj)
21 | {
22 | return obj is RecommendedAction pair &&
23 | RecommendedActionType == pair.RecommendedActionType &&
24 | TextSpan.Equals(pair.TextSpan) &&
25 | Description == pair.Description &&
26 | ((TargetCPU == null && pair.TargetCPU == null) || TargetCPU.OrderBy(t => t).SequenceEqual(pair.TargetCPU.OrderBy(t => t)));
27 | }
28 | public override int GetHashCode()
29 | {
30 | return HashCode.Combine(RecommendedActionType.ToString(), TextSpan, Description, TargetCPU);
31 | }
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/src/PortingAssistant.Client.Common/Model/RecommendedActionType.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | namespace PortingAssistant.Client.Model
3 | {
4 | public enum RecommendedActionType
5 | {
6 | UpgradePackage,
7 | ReplaceApi,
8 | //Future
9 | ReplaceNamespace,
10 | ReplacePackage,
11 | NoRecommendation
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/src/PortingAssistant.Client.Common/Model/Schema.cs:
--------------------------------------------------------------------------------
1 | namespace PortingAssistant.Client.Common.Model
2 | {
3 | public class Schema
4 | {
5 | /* Schema version. Used to keep track of schema of assessment result PortingAssistant.Client generates */
6 | // Major version needs to be incremented if there is any non-backward compatible changes made to the schema.
7 | // Minor version needs to be incremented if there is any backward compatible changes made.
8 | public const string version = "1.0";
9 | }
10 | }
11 |
--------------------------------------------------------------------------------
/src/PortingAssistant.Client.Common/Model/SolutionAnalysisResult.cs:
--------------------------------------------------------------------------------
1 | using Codelyzer.Analysis;
2 | using CTA.Rules.Models;
3 | using System.Collections.Generic;
4 | using System.Threading.Tasks;
5 |
6 | namespace PortingAssistant.Client.Model
7 | {
8 | public class SolutionAnalysisResult
9 | {
10 | public string Version { get; set; }
11 | public SolutionDetails SolutionDetails { get; set; }
12 | public List ProjectAnalysisResults { get; set; }
13 | public List FailedProjects { get; set; }
14 | public List Errors { get; set; } //Solution errors; solution file errors etc.
15 | public bool HasCompatibilityCheckingError { get; set; } //GetCompatibilityResponse HasError for any project
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/src/PortingAssistant.Client.Common/Model/SolutionDetails.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 |
3 | namespace PortingAssistant.Client.Model
4 | {
5 | public class SolutionDetails
6 | {
7 | public string SolutionName { get; set; }
8 | public string SolutionFilePath { get; set; }
9 | public string SolutionGuid { get; set; }
10 | /*
11 | * Used to uniquely identify the solution PA is analyzing.
12 | * Its value is the same as SolutionGuid if SolutionGuid presents.
13 | * Otherwise, we compute the hash based on all the ProjectGuids.
14 | */
15 | public string ApplicationGuid { get; set; }
16 | public string RepositoryUrl { get; set; }
17 | public List FailedProjects { get; set; }
18 | public List Projects { get; set; }
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/src/PortingAssistant.Client.Common/Model/SourceFileAnalysisResult.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 |
3 | namespace PortingAssistant.Client.Model
4 | {
5 | public class SourceFileAnalysisResult
6 | {
7 | public string SourceFileName { get; set; }
8 | public string SourceFilePath { get; set; }
9 | public List ApiAnalysisResults { get; set; }
10 | public List RecommendedActions { get; set; }
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/src/PortingAssistant.Client.Common/Model/TextSpan.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace PortingAssistant.Client.Model
4 | {
5 | public class TextSpan
6 | {
7 | public long? StartCharPosition { get; set; }
8 | public long? EndCharPosition { get; set; }
9 | public long? StartLinePosition { get; set; }
10 | public long? EndLinePosition { get; set; }
11 |
12 | public override bool Equals(object obj)
13 | {
14 | return obj is TextSpan pair &&
15 | StartCharPosition == pair.StartCharPosition &&
16 | EndCharPosition == pair.EndCharPosition &&
17 | StartLinePosition == pair.StartLinePosition &&
18 | EndLinePosition == pair.EndLinePosition;
19 | }
20 |
21 | public override int GetHashCode()
22 | {
23 | return HashCode.Combine(StartLinePosition, StartCharPosition, EndLinePosition, EndCharPosition);
24 | }
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/src/PortingAssistant.Client.Common/Model/VisualStudioVersion.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace PortingAssistant.Client.Model
8 | {
9 | public enum VisualStudioVersion
10 | {
11 | VS2019,
12 | VS2022
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/src/PortingAssistant.Client.Common/PortingAssistant.Client.Common.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | net6.0
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/src/PortingAssistant.Client.Common/Utils/AnalysisUtils.cs:
--------------------------------------------------------------------------------
1 | using PortingAssistant.Client.Common.Model;
2 | using PortingAssistant.Client.Model;
3 | using System;
4 | using System.Collections.Generic;
5 | using System.Linq;
6 | using System.Text;
7 | using System.Threading.Tasks;
8 |
9 | namespace PortingAssistant.Client.Common.Utils
10 | {
11 | public static class AnalysisUtils
12 | {
13 | public static ProjectCompatibilityResult GenerateCompatibilityResults(List sourceFileAnalysisResults, string projectPath, bool isPorted)
14 | {
15 | var projectCompatibilityResult = new ProjectCompatibilityResult() { IsPorted = isPorted, ProjectPath = projectPath };
16 |
17 | sourceFileAnalysisResults.ForEach(SourceFileAnalysisResult =>
18 | {
19 | SourceFileAnalysisResult.ApiAnalysisResults.ForEach(apiAnalysisResult =>
20 | {
21 | var currentEntity = projectCompatibilityResult.CodeEntityCompatibilityResults.First(r => r.CodeEntityType == apiAnalysisResult.CodeEntityDetails.CodeEntityType);
22 |
23 | var hasAction = SourceFileAnalysisResult.RecommendedActions.Any(ra => ra.TextSpan.Equals(apiAnalysisResult.CodeEntityDetails.TextSpan));
24 | if (hasAction)
25 | {
26 | currentEntity.Actions++;
27 | }
28 | var compatibility = apiAnalysisResult.CompatibilityResults?.FirstOrDefault().Value?.Compatibility;
29 | if (compatibility == Compatibility.COMPATIBLE)
30 | {
31 | currentEntity.Compatible++;
32 | }
33 | else if (compatibility == Compatibility.INCOMPATIBLE)
34 | {
35 | currentEntity.Incompatible++;
36 | }
37 | else if (compatibility == Compatibility.UNKNOWN)
38 | {
39 | currentEntity.Unknown++;
40 |
41 | }
42 | else if (compatibility == Compatibility.DEPRECATED)
43 | {
44 | currentEntity.Deprecated++;
45 | }
46 | else
47 | {
48 | currentEntity.Unknown++;
49 | }
50 | });
51 | });
52 |
53 | return projectCompatibilityResult;
54 | }
55 |
56 | }
57 | }
58 |
--------------------------------------------------------------------------------
/src/PortingAssistant.Client.Common/Utils/FileSystem.cs:
--------------------------------------------------------------------------------
1 | using System.IO;
2 |
3 | namespace PortingAssistant.Client.Common.Utils
4 | {
5 | class FileSystem : IFileSystem
6 | {
7 | public string GetTempPath()
8 | {
9 | return Path.GetTempPath();
10 | }
11 | public bool DirectoryExists(string directory)
12 | {
13 | return Directory.Exists(directory);
14 | }
15 | public bool FileExists(string file)
16 | {
17 | return File.Exists(file);
18 | }
19 | public DirectoryInfo CreateDirectory(string directory)
20 | {
21 | return Directory.CreateDirectory(directory);
22 | }
23 | public Stream FileOpenWrite(string filePath)
24 | {
25 | return File.OpenWrite(filePath);
26 | }
27 | public Stream FileOpenRead(string filePath)
28 | {
29 | return File.OpenRead(filePath);
30 | }
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/src/PortingAssistant.Client.Common/Utils/IFileSystem.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.IO;
4 | using System.Text;
5 |
6 | namespace PortingAssistant.Client.Common.Utils
7 | {
8 | public interface IFileSystem
9 | {
10 | public string GetTempPath();
11 | public bool DirectoryExists(string directory);
12 | public bool FileExists(string file);
13 | public DirectoryInfo CreateDirectory(string directory);
14 | public Stream FileOpenWrite(string filePath);
15 | public Stream FileOpenRead(string filePath);
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/src/PortingAssistant.Client.Common/Utils/Logging.cs:
--------------------------------------------------------------------------------
1 | using Microsoft.Extensions.Logging;
2 |
3 | namespace PortingAssistant.Client.Common.Utils;
4 |
5 | public class TraceEvent
6 | {
7 | private static bool _disabledMetrics = false;
8 |
9 | public static void Start(ILogger logger, string eventDescription)
10 | {
11 | if (_disabledMetrics) { return; }
12 | logger.LogInformation($"Starting: {eventDescription}");
13 | }
14 |
15 | public static void End(ILogger logger, string eventDescription)
16 | {
17 | if (_disabledMetrics) { return; }
18 | logger.LogInformation($"Complete: {eventDescription}");
19 | }
20 |
21 | public static void Start(Serilog.ILogger logger, string eventDescription)
22 | {
23 | if (_disabledMetrics) { return; }
24 | logger.Information($"Starting: {eventDescription}");
25 | }
26 |
27 | public static void End(Serilog.ILogger logger, string eventDescription)
28 | {
29 | if (_disabledMetrics) { return; }
30 | logger.Information($"Complete: {eventDescription}");
31 | }
32 |
33 | public static void ToggleMetrics(bool disabledMetrics)
34 | {
35 | _disabledMetrics = disabledMetrics;
36 | }
37 | }
--------------------------------------------------------------------------------
/src/PortingAssistant.Client.Common/Utils/XDocumentExtensions.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Xml.Linq;
5 |
6 | namespace PortingAssistant.Client.Utils
7 | {
8 | public static class XDocumentExtensions
9 | {
10 | public static IEnumerable GetDescendants(this XDocument document, string name) =>
11 | document.Descendants().Where(x => string.Equals(x.Name.LocalName, name, StringComparison.OrdinalIgnoreCase));
12 |
13 | public static IEnumerable GetDescendants(this XElement element, string name) =>
14 | element.Descendants().Where(x => string.Equals(x.Name.LocalName, name, StringComparison.OrdinalIgnoreCase));
15 |
16 | public static string GetAttributeValue(this XElement element, string name) =>
17 | element.Attributes().FirstOrDefault(x => string.Equals(x.Name.LocalName, name, StringComparison.OrdinalIgnoreCase))?.Value;
18 |
19 | // Adds a child element with the same namespace as the parent
20 | public static void AddChildElement(this XElement element, string name, string value) =>
21 | element.Add(new XElement(XName.Get(name, element.Name.NamespaceName), value));
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/src/PortingAssistant.Client.NuGet/Checkers/ExternalPackagesCompatibilityChecker.cs:
--------------------------------------------------------------------------------
1 | using Microsoft.Extensions.Logging;
2 | using PortingAssistant.Client.Model;
3 | using PortingAssistant.Client.NuGet.Interfaces;
4 |
5 | namespace PortingAssistant.Client.NuGet
6 | {
7 | public class ExternalPackagesCompatibilityChecker : ExternalCompatibilityChecker
8 | {
9 | public override PackageSourceType CompatibilityCheckerType => PackageSourceType.NUGET;
10 |
11 | public ExternalPackagesCompatibilityChecker(
12 | IHttpService httpService,
13 | ILogger logger,
14 | IFileSystem fileSystem = null
15 | )
16 | : base(httpService, logger, fileSystem)
17 | {
18 | }
19 | }
20 | }
--------------------------------------------------------------------------------
/src/PortingAssistant.Client.NuGet/Checkers/SdkCompatibilityChecker.cs:
--------------------------------------------------------------------------------
1 | using Microsoft.Extensions.Logging;
2 | using PortingAssistant.Client.Model;
3 | using PortingAssistant.Client.NuGet.Interfaces;
4 |
5 | namespace PortingAssistant.Client.NuGet
6 | {
7 | public class SdkCompatibilityChecker : ExternalCompatibilityChecker
8 | {
9 | public override PackageSourceType CompatibilityCheckerType => PackageSourceType.SDK;
10 |
11 | public SdkCompatibilityChecker(
12 | IHttpService httpService,
13 | ILogger logger)
14 | : base(httpService, logger)
15 | {
16 | }
17 | }
18 | }
--------------------------------------------------------------------------------
/src/PortingAssistant.Client.NuGet/Interfaces/ICompatibilityChecker.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 | using System.Threading.Tasks;
3 | using PortingAssistant.Client.Model;
4 |
5 | namespace PortingAssistant.Client.NuGet
6 | {
7 | ///
8 | /// Represents a compatibility checker for packages
9 | ///
10 | public interface ICompatibilityChecker
11 | {
12 | ///
13 | /// Gets the type of the compatibility checker
14 | ///
15 | /// The type of the compatibility checker
16 | public PackageSourceType CompatibilityCheckerType { get; }
17 |
18 | ///
19 | /// Runs the compatibility check
20 | ///
21 | /// A collection of packages and their versions
22 | /// The solution to check
23 | /// If Check is part of incremental assessment, we will use Temp Directory Cache. Default to false
24 | /// If Check should refresh Temp Directory Cache. Default to false.
25 | ///
26 | public Dictionary> Check(IEnumerable packageVersions, string pathToSolution, bool isIncremental = false, bool incrementalRefresh = false);
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/src/PortingAssistant.Client.NuGet/Interfaces/IHttpService.cs:
--------------------------------------------------------------------------------
1 | using System.IO;
2 | using System.Threading.Tasks;
3 |
4 | namespace PortingAssistant.Client.NuGet.Interfaces
5 | {
6 | public interface IHttpService
7 | {
8 | public Task DownloadS3FileAsync(string fileToDownload);
9 | public Task DownloadGitHubFileAsync(string fileToDownload);
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/src/PortingAssistant.Client.NuGet/Interfaces/IPortingAssistantNuGetHandler.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 | using System.Threading.Tasks;
3 | using PortingAssistant.Client.Model;
4 |
5 | namespace PortingAssistant.Client.NuGet
6 | {
7 | public interface IPortingAssistantNuGetHandler
8 | {
9 | public Dictionary> GetNugetPackages(List nugetPackages, string pathToSolution, bool isIncremental, bool incrementalRefresh);
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/src/PortingAssistant.Client.NuGet/Interfaces/IPortingAssistantRecommendationHandler.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 | using System.Threading.Tasks;
3 | using PortingAssistant.Client.Model;
4 |
5 | namespace PortingAssistant.Client.NuGet
6 | {
7 | public interface IPortingAssistantRecommendationHandler
8 | {
9 | public Dictionary> GetApiRecommendation(IEnumerable namespaces);
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/src/PortingAssistant.Client.NuGet/InternalNuget/IPortingAssistantInternalNuGetCompatibilityHandler.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 | using System.Threading.Tasks;
3 | using NuGet.Protocol.Core.Types;
4 | using PortingAssistant.Client.Model;
5 |
6 | namespace PortingAssistant.Client.NuGet.InternalNuGet
7 | {
8 | public interface IPortingAssistantInternalNuGetCompatibilityHandler
9 | {
10 | public Task CheckCompatibilityAsync(
11 | string packageName, string version, string targetFramework, IEnumerable internalRepositories);
12 | }
13 | }
--------------------------------------------------------------------------------
/src/PortingAssistant.Client.NuGet/PortingAssistant.Client.NuGet.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | net6.0
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
--------------------------------------------------------------------------------
/src/PortingAssistant.Client.NuGet/Utils/HttpService.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Net.Http;
3 | using PortingAssistant.Client.NuGet.Interfaces;
4 | using System.IO;
5 | using System.Threading.Tasks;
6 | using Microsoft.Extensions.Options;
7 | using PortingAssistant.Client.Model;
8 | using System.Threading;
9 |
10 | namespace PortingAssistant.Client.NuGet.Utils
11 | {
12 | public class HttpService : IHttpService
13 | {
14 | private readonly HttpClient _S3httpClient;
15 | private readonly HttpClient _GitHubHttpClient;
16 |
17 | public HttpService(IHttpClientFactory httpClientFactory, IOptions options)
18 | {
19 | _S3httpClient = httpClientFactory.CreateClient("s3");
20 | _S3httpClient.BaseAddress = new Uri(options.Value.DataStoreSettings.HttpsEndpoint);
21 | _GitHubHttpClient = httpClientFactory.CreateClient("github");
22 | _GitHubHttpClient.BaseAddress = new Uri(options.Value.DataStoreSettings.GitHubEndpoint);
23 | }
24 |
25 | public async Task DownloadS3FileAsync(string fileToDownload)
26 | {
27 | CancellationTokenSource tokenSource = new CancellationTokenSource();
28 | try
29 | {
30 | return await _S3httpClient.GetStreamAsync(fileToDownload, tokenSource.Token);
31 | }
32 | catch (TaskCanceledException e) when (!tokenSource.Token.IsCancellationRequested)
33 | {
34 | // cancellation due to the http request timeout
35 | throw new TimeoutException(e.Message);
36 | }
37 | }
38 |
39 | public async Task DownloadGitHubFileAsync(string fileToDownload)
40 | {
41 | CancellationTokenSource tokenSource = new CancellationTokenSource();
42 | try
43 | {
44 | return await _GitHubHttpClient.GetStreamAsync(fileToDownload);
45 | }
46 | catch (TaskCanceledException e) when (!tokenSource.Token.IsCancellationRequested)
47 | {
48 | // cancellation due to the http request timeout
49 | throw new TimeoutException(e.Message);
50 | }
51 | }
52 | }
53 | }
54 |
--------------------------------------------------------------------------------
/src/PortingAssistant.Client.Porting/IPortingHandler.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using PortingAssistant.Client.Model;
4 |
5 | namespace PortingAssistant.Client.Porting
6 | {
7 | ///
8 | /// Represents a handler to port projects
9 | ///
10 | public interface IPortingHandler
11 | {
12 | ///
13 | /// Ports a list of projects
14 | ///
15 | /// List of projects
16 | /// Path to solution file
17 | /// Target framework to be used when porting
18 | /// List of key/value pairs where key is package and value is version number tuple
19 | /// A PortingResult object, representing the result of the porting operation
20 | List ApplyPortProjectFileChanges(
21 | List projects,
22 | string solutionPath,
23 | string targetFramework,
24 | Dictionary> upgradeVersions);
25 |
26 | ///
27 | /// Ports a list of projects
28 | ///
29 | /// List of projects
30 | /// Path to solution file
31 | /// Target framework to be used when porting
32 | /// List of key/value pairs where key is package and value is version number tuple
33 | /// A PortingResult object, representing the result of the porting operation
34 | List ApplyPortProjectFileChanges(
35 | List projects,
36 | string solutionPath,
37 | string targetFramework,
38 | bool includeCodeFix,
39 | Dictionary> upgradeVersions, VisualStudioVersion? visualStudioVersion = null);
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/src/PortingAssistant.Client.Porting/PortingAssistant.Client.Porting.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | net6.0
5 | true
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/src/PortingAssistant.Client.Porting/PortingHandler.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using PortingAssistant.Client.Model;
4 | using PortingAssistant.Client.PortingProjectFile;
5 |
6 | namespace PortingAssistant.Client.Porting
7 | {
8 | public class PortingHandler : IPortingHandler
9 | {
10 | private readonly IPortingProjectFileHandler _portingProjectFileHandler;
11 |
12 | ///
13 | /// Create an Instance of a PortingHandler
14 | ///
15 | /// An ILogger object
16 | /// A instance of a handler object to run the porting
17 | public PortingHandler(IPortingProjectFileHandler portingProjectFileHandler)
18 | {
19 | _portingProjectFileHandler = portingProjectFileHandler;
20 | }
21 |
22 | ///
23 | /// Ports a list of projects
24 | ///
25 | /// List of projects paths
26 | /// Path to solution file
27 | /// Target framework to be used when porting
28 | /// List of key/value pairs where key is package and value is version number tuple
29 | /// A PortingProjectFileResult object, representing the result of the porting operation
30 | public List ApplyPortProjectFileChanges(
31 | List projects, string solutionPath, string targetFramework,
32 | Dictionary> upgradeVersions)
33 | {
34 | return ApplyPortProjectFileChanges(projects, solutionPath, targetFramework, true, upgradeVersions);
35 | }
36 |
37 | ///
38 | /// Ports a list of projects
39 | ///
40 | /// List of projects paths
41 | /// Path to solution file
42 | /// Target framework to be used when porting
43 | /// List of key/value pairs where key is package and value is version number tuple
44 | /// A PortingProjectFileResult object, representing the result of the porting operation
45 | public List ApplyPortProjectFileChanges(
46 | List projects, string solutionPath, string targetFramework,
47 | bool includeCodeFix,
48 | Dictionary> upgradeVersions, VisualStudioVersion? visualStudioVersion = null)
49 | {
50 | return _portingProjectFileHandler.ApplyProjectChanges(projects, solutionPath, targetFramework, includeCodeFix, upgradeVersions, visualStudioVersion);
51 | }
52 |
53 | }
54 | }
55 |
--------------------------------------------------------------------------------
/src/PortingAssistant.Client.Porting/PortingProjectFile/IPortingProjectFileHandler.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using PortingAssistant.Client.Model;
4 |
5 | namespace PortingAssistant.Client.PortingProjectFile
6 | {
7 | ///
8 | /// Represents a handler to port projects
9 | ///
10 | public interface IPortingProjectFileHandler
11 | {
12 | ///
13 | /// Ports a list of projects
14 | ///
15 | /// List of projects paths
16 | /// Path to solution file
17 | /// Target framework to be used when porting
18 | /// List of key/value pairs where key is package and value is version number
19 | /// A PortingProjectFileResult object, representing the result of the porting operation
20 | List ApplyProjectChanges(
21 | List projects, string solutionPath, string targetFramework,
22 | Dictionary> upgradeVersions);
23 |
24 | ///
25 | /// Ports a list of projects
26 | ///
27 | /// List of projects paths
28 | /// Path to solution file
29 | /// Target framework to be used when porting
30 | /// List of key/value pairs where key is package and value is version number
31 | /// A PortingProjectFileResult object, representing the result of the porting operation
32 | List ApplyProjectChanges(
33 | List projects, string solutionPath, string targetFramework,
34 | bool includeCodeFix,
35 | Dictionary> upgradeVersions, VisualStudioVersion? visualStudioVersion = null);
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/src/PortingAssistant.Client.Telemetry/ITelemetryClient.cs:
--------------------------------------------------------------------------------
1 | using System.Threading.Tasks;
2 | using Amazon.Runtime;
3 |
4 | namespace PortingAssistant.Client.Telemetry
5 | {
6 | public interface ITelemetryClient
7 | {
8 | public Task SendAsync(TelemetryRequest request);
9 | }
10 | }
11 |
--------------------------------------------------------------------------------
/src/PortingAssistant.Client.Telemetry/Model/APIMetrics.cs:
--------------------------------------------------------------------------------
1 | using Newtonsoft.Json;
2 | using Newtonsoft.Json.Converters;
3 | using PortingAssistant.Client.Model;
4 |
5 | namespace PortingAssistant.Client.Telemetry.Model
6 | {
7 | public class APIMetrics : MetricsBase
8 | {
9 | public string name { get; set; }
10 | public string nameSpace { get; set; }
11 | public string originalDefinition { get; set; }
12 | [JsonConverter(typeof(StringEnumConverter))]
13 | public PortingAssistant.Client.Model.Compatibility compatibility { get; set; }
14 | public string packageId { get; set; }
15 | public string packageVersion { get; set; }
16 | public string projectGuid { get; set; }
17 | public string solutionGuid { get; set; }
18 | public string? accountId { get; set; }
19 |
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/src/PortingAssistant.Client.Telemetry/Model/MetricsBase.cs:
--------------------------------------------------------------------------------
1 | using Microsoft.CodeAnalysis;
2 |
3 | using Newtonsoft.Json;
4 | using Newtonsoft.Json.Converters;
5 | using static System.Net.Mime.MediaTypeNames;
6 |
7 | using System.Security.Cryptography;
8 |
9 | namespace PortingAssistant.Client.Telemetry.Model
10 | {
11 | public class MetricsBase
12 | {
13 | [JsonConverter(typeof(StringEnumConverter))]
14 | public MetricsType metricsType { get; set; }
15 | public string portingAssistantSource { get; set; }
16 | public string tag { get; set; }
17 | public string version { get; set; }
18 | public string targetFramework { get; set; }
19 | public string timeStamp { get; set; }
20 | public string SessionId { get; set; }
21 | // Application id is the hash of(solution path + mac id)
22 | public string ApplicationId { get; set; }
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/src/PortingAssistant.Client.Telemetry/Model/MetricsType.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Text;
4 |
5 | namespace PortingAssistant.Client.Telemetry.Model
6 | {
7 | public enum MetricsType
8 | {
9 | project,
10 | solution,
11 | api,
12 | nuget,
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/src/PortingAssistant.Client.Telemetry/Model/NugetMetrics.cs:
--------------------------------------------------------------------------------
1 | using Newtonsoft.Json;
2 | using Newtonsoft.Json.Converters;
3 | using PortingAssistant.Client.Model;
4 |
5 | namespace PortingAssistant.Client.Telemetry.Model
6 | {
7 | public class NugetMetrics : MetricsBase
8 | {
9 | public string pacakgeName { get; set; }
10 | public string packageVersion { get; set; }
11 | [JsonConverter(typeof(StringEnumConverter))]
12 | public PortingAssistant.Client.Model.Compatibility compatibility { get; set; }
13 | public string projectGuid { get; set; }
14 | public string solutionGuid { get; set; }
15 | public string? accountId { get; set; }
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/src/PortingAssistant.Client.Telemetry/Model/ProjectMetrics.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Text;
4 |
5 | namespace PortingAssistant.Client.Telemetry.Model
6 | {
7 | public class ProjectMetrics : MetricsBase
8 | {
9 | public int numNugets { get; set; }
10 | public int numReferences { get; set; }
11 | public string projectGuid { get; set; }
12 | public bool isBuildFailed { get; set; }
13 | public string projectType { get; set; }
14 | public string projectName { get; set; }
15 | public List sourceFrameworks { get; set; }
16 | public string language { get; set; }
17 | public int linesOfCode { get; set; }
18 | public string solutionPath { get; set; }
19 | public string SolutionGuid { get; set; }
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/src/PortingAssistant.Client.Telemetry/Model/SolutionMetrics.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Text;
4 |
5 | namespace PortingAssistant.Client.Telemetry.Model
6 | {
7 | public class SolutionMetrics : MetricsBase
8 | {
9 | public string solutionName { get; set; }
10 | public string ApplicationGuid { get; set; }
11 | public string RepositoryUrl { get; set; }
12 | public double analysisTime { get; set; }
13 | public int linesOfCode { get; set; }
14 | public int numLogicalCores { get; set; }
15 | public double systemMemory { get; set; }
16 | public string solutionPath { get; set; }
17 | public string SolutionGuid { get; set; }
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/src/PortingAssistant.Client.Telemetry/PortingAssistant.Client.Telemetry.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | net6.0
5 |
6 |
7 | true
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/src/PortingAssistant.Client.Telemetry/TelemetryClientConfig.cs:
--------------------------------------------------------------------------------
1 |
2 | using Amazon.Runtime;
3 | using Amazon.Util.Internal;
4 |
5 | namespace PortingAssistant.Client.Telemetry
6 | {
7 | public class TelemetryClientConfig : ClientConfig
8 | {
9 | private static readonly string userAgentString =
10 | InternalSDKUtils.BuildUserAgentString("3.5.0.9");
11 | public TelemetryClientConfig(string url)
12 | {
13 | if (url.Contains("application-transformation"))
14 | {
15 | AuthenticationServiceName = "application-transformation";
16 | }
17 | else
18 | {
19 | AuthenticationServiceName = "execute-api";
20 | }
21 | }
22 | public override string RegionEndpointServiceName => "encore";
23 | public override string ServiceVersion => "";
24 | public override string UserAgent => userAgentString;
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/src/PortingAssistant.Client.Telemetry/TelemetryConfiguration.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.IO;
4 |
5 | namespace PortingAssistantExtensionTelemetry.Model
6 | {
7 | public class TelemetryConfiguration
8 | {
9 | public string InvokeUrl { get; set; }
10 | public string Region { get; set; }
11 | public string LogsPath { get; set; }
12 | public string ServiceName { get; set; }
13 | public string Description { get; set; }
14 | public List Suffix { get; set; }
15 | public string LogFilePath { get; set; }
16 | public string MetricsFilePath { get; set; }
17 | public long LogsFolderSizeLimit { get; set; }
18 | public string LogPrefix { get; set; }
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/src/PortingAssistant.Client.Telemetry/TelemetryRequest.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using Amazon.Runtime;
4 |
5 | namespace PortingAssistant.Client.Telemetry
6 | {
7 | public class TelemetryRequest : AmazonWebServiceRequest
8 | {
9 | public string Content;
10 | public readonly RequestMetadata RequestMetadata;
11 | public string CustomizedResourcePath;
12 |
13 | public TelemetryRequest(string serviceName, string content, string customizedResourcePath)
14 | {
15 | Content = content;
16 | RequestMetadata = new RequestMetadata(serviceName);
17 | CustomizedResourcePath = customizedResourcePath;
18 | }
19 | }
20 |
21 | public class RequestMetadata
22 | {
23 | public string Service;
24 | public readonly string Version = "1.0";
25 | public readonly string Token = "12345678";
26 | public readonly string Created = DateTime.UtcNow.Date.ToString("yyyy-MM-dd");
27 | public RequestMetadata(string serviceName)
28 | {
29 | Service = serviceName;
30 | }
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/src/PortingAssistant.Client/PortingAssistant.Client.CLI.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Exe
5 | net6.0
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 | Always
22 | True
23 |
24 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/src/PortingAssistant.Client/PortingAssistantTelemetryConfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "InvokeUrl": "https://localhost",
3 | "Region": "us-east-1",
4 | "ServiceName": "service_name",
5 | "Suffix": [ ".log", ".metrics" ],
6 | "Description": "Porting Assistant for .NET Telemetry Logs"
7 | }
8 |
--------------------------------------------------------------------------------
/src/PortingAssistant.Compatibility.Common/Interface/ICacheManager.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using PortingAssistant.Compatibility.Common.Model;
3 |
4 | namespace PortingAssistant.Compatibility.Common.Interface
5 | {
6 | public interface ICacheManager
7 | {
8 | void Add(string key, AnalysisResult analysisResult);
9 | //public void Add(Tuple packageVersionPair_methodSiganiture, AnalysisResult analysisResult);
10 | AnalysisResult Get(string key);
11 | bool CacheExists(PackageVersionPair package, string targetFramework);
12 | AnalysisResult Get(PackageVersionPair package, string targetFramework);
13 | bool CacheExists(PackageVersionPair package, ApiEntity apiEntity, string targetFramework);
14 |
15 | AnalysisResult Get(PackageVersionPair package, ApiEntity apiEntity, string targetFramework);
16 | void Add(PackageVersionPair package, string targetFramework, AnalysisResult analysisResult);
17 | void Add(PackageVersionPair package, string targetFramework, string apiMethodSignature, AnalysisResult analysisResult);
18 | void Clear();
19 |
20 | bool TryLoadCacheObjectFromLocalFile(string content, out Exception? exception);
21 | bool TrySaveCacheObjectToLocalFile(string fileName, out Exception? exception);
22 | public bool DoseCacheObjectsContainData();
23 | }
24 |
25 | }
26 |
27 |
--------------------------------------------------------------------------------
/src/PortingAssistant.Compatibility.Common/Interface/ICompatibilityChecker.cs:
--------------------------------------------------------------------------------
1 |
2 | using System;
3 | using System.Collections.Generic;
4 | using System.Linq;
5 | using System.Text;
6 | using System.Threading.Tasks;
7 | using Amazon.Lambda.Core;
8 | using PortingAssistant.Compatibility.Common.Model;
9 |
10 | namespace PortingAssistant.Compatibility.Common.Interface
11 | {
12 | ///
13 | /// Represents a compatibility checker for packages
14 | ///
15 | public interface ICompatibilityChecker
16 | {
17 | ///
18 | /// Gets the type of the compatibility checker
19 | ///
20 | /// The type of the compatibility checker
21 | public PackageSourceType CompatibilityCheckerType { get; }
22 |
23 | ///
24 | /// Runs the compatibility check
25 | ///
26 | /// A collection of packages and their versions
27 | ///
28 | public Task>> Check(
29 | IEnumerable packageVersions);
30 |
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/src/PortingAssistant.Compatibility.Common/Interface/ICompatibilityCheckerHandler.cs:
--------------------------------------------------------------------------------
1 | using PortingAssistant.Compatibility.Common.Model;
2 |
3 | namespace PortingAssistant.Compatibility.Common.Interface
4 | {
5 | ///
6 | /// Represents a compatibility checker for packages
7 | ///
8 | public interface ICompatibilityCheckerHandler
9 | {
10 | ///
11 | /// Runs the compatibility check
12 | ///
13 | /// A collection of packages and their versions
14 | ///
15 | public CompatibilityCheckerResponse Check(CompatibilityCheckerRequest request, HashSet fullSdks);
16 |
17 | public CompatibilityCheckerResponse Check(CompatibilityCheckerRequest request);
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/src/PortingAssistant.Compatibility.Common/Interface/ICompatibilityCheckerNuGetHandler.cs:
--------------------------------------------------------------------------------
1 | using Microsoft.Extensions.Logging;
2 | using PortingAssistant.Compatibility.Common.Model;
3 |
4 | namespace PortingAssistant.Compatibility.Common.Interface
5 | {
6 | public interface ICompatibilityCheckerNuGetHandler
7 | {
8 | public Dictionary> GetNugetPackages(List allPackages);
9 | }
10 | }
11 |
--------------------------------------------------------------------------------
/src/PortingAssistant.Compatibility.Common/Interface/ICompatibilityCheckerRecommendationActionHandler.cs:
--------------------------------------------------------------------------------
1 | using Amazon.Lambda.Core;
2 | using PortingAssistant.Compatibility.Common.Model;
3 | using System;
4 | using System.Collections.Generic;
5 | using System.Linq;
6 | using System.Text;
7 | using System.Threading.Tasks;
8 |
9 | namespace PortingAssistant.Compatibility.Common.Interface
10 | {
11 | public interface ICompatibilityCheckerRecommendationActionHandler
12 | {
13 | public Task> GetRecommendationActionFileAsync(IEnumerable namespaces);
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/src/PortingAssistant.Compatibility.Common/Interface/ICompatibilityCheckerRecommendationHandler.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 | using Amazon.Lambda.Core;
7 | using PortingAssistant.Compatibility.Common.Model;
8 |
9 | namespace PortingAssistant.Compatibility.Common.Interface
10 | {
11 | public interface ICompatibilityCheckerRecommendationHandler
12 | {
13 | public Dictionary> GetApiRecommendation(IEnumerable namespaces);
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/src/PortingAssistant.Compatibility.Common/Interface/IHttpService.cs:
--------------------------------------------------------------------------------
1 | namespace PortingAssistant.Compatibility.Common.Interface
2 | {
3 | public interface IHttpService
4 | {
5 | public Task DownloadS3FileAsync(string fileToDownload);
6 |
7 | public Task> ListNamespacesObjectAsync();
8 |
9 | public Task DownloadGitHubFileAsync(string fileToDownload);
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/src/PortingAssistant.Compatibility.Common/Interface/IRegionalDatastoreService.cs:
--------------------------------------------------------------------------------
1 | namespace PortingAssistant.Compatibility.Common.Interface
2 | {
3 | public interface IRegionalDatastoreService
4 | {
5 | public Task DownloadRegionalS3FileAsync(string fileToDownload, bool isRegionalCall = false, bool compressed = true);
6 | public Task> ListRegionalNamespacesObjectAsync(bool isRegionalCall = false);
7 | public Task DownloadGitHubFileAsync(string fileToDownload);
8 | public Task CheckObjectExistsAsync(string objectKey);
9 | public Task ParseS3ObjectToString(Stream stream, string fileToDownload, bool compressed);
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/src/PortingAssistant.Compatibility.Common/Model/AnalysisResult.cs:
--------------------------------------------------------------------------------
1 |
2 |
3 | namespace PortingAssistant.Compatibility.Common.Model
4 | {
5 | public class AnalysisResult
6 | {
7 | public Dictionary CompatibilityResults { get; set; } // Target Framework CompatibilityResults pair
8 | public Recommendations Recommendations { get; set; }
9 | }
10 | }
11 |
--------------------------------------------------------------------------------
/src/PortingAssistant.Compatibility.Common/Model/ApiEntity.cs:
--------------------------------------------------------------------------------
1 |
2 |
3 | using Newtonsoft.Json;
4 | using Newtonsoft.Json.Converters;
5 |
6 | namespace PortingAssistant.Compatibility.Common.Model
7 | {
8 | public class ApiEntity
9 | {
10 | [JsonConverter(typeof(StringEnumConverter))]
11 | public CodeEntityType CodeEntityType { get; set; }
12 | public string Namespace { get; set; }
13 | public string OriginalDefinition { get; set; } //valid for method
14 |
15 | public override bool Equals(object obj)
16 | {
17 | return obj is ApiEntity entity &&
18 | CodeEntityType == entity.CodeEntityType &&
19 | Namespace == entity.Namespace &&
20 | OriginalDefinition == entity.OriginalDefinition;
21 | }
22 |
23 | public override int GetHashCode()
24 | {
25 | return HashCode.Combine(CodeEntityType, Namespace, OriginalDefinition);
26 | }
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/src/PortingAssistant.Compatibility.Common/Model/CodeEntityType.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace PortingAssistant.Compatibility.Common.Model
8 | {
9 | public enum CodeEntityType
10 | {
11 | Namespace,
12 | Class,
13 | Method,
14 | InstanceAttribute,
15 | ClassAttribute,
16 | Annotation,
17 | Declaration,
18 | Using,
19 | Enum,
20 | Struct
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/src/PortingAssistant.Compatibility.Common/Model/Compatibility.cs:
--------------------------------------------------------------------------------
1 | namespace PortingAssistant.Compatibility.Common.Model
2 | {
3 | public enum Compatibility
4 | {
5 | UNKNOWN,
6 | COMPATIBLE,
7 | INCOMPATIBLE,
8 | DEPRECATED,
9 | PACKAGE_NOT_FOUND,
10 | OUT_OF_MEMORY_PARSE_ERROR,
11 | GENERAL_PARSE_ERROR
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/src/PortingAssistant.Compatibility.Common/Model/CompatibilityCheckerConfiguration.cs:
--------------------------------------------------------------------------------
1 | using Amazon.S3.Model;
2 | using System;
3 | using System.Collections.Generic;
4 | using System.Linq;
5 | using System.Text;
6 | using System.Threading.Tasks;
7 |
8 | namespace PortingAssistant.Compatibility.Common.Model
9 | {
10 | public class CompatibilityCheckerConfiguration
11 | {
12 | public DataStoreSettings DataStoreSettings { get; set; }
13 | public CompatibilityCheckerConfiguration()
14 | {
15 |
16 | this.DataStoreSettings = new DataStoreSettings
17 | {
18 | HttpsEndpoint = "https://s3.us-west-2.amazonaws.com/preprod.aws.portingassistant.service.datastore.uswest2/",
19 | S3Endpoint = "preprod.aws.portingassistant.service.datastore.uswest2",
20 | GitHubEndpoint = "https://raw.githubusercontent.com/aws/porting-assistant-dotnet-datastore/master/",
21 | };
22 | }
23 | }
24 |
25 | public class DataStoreSettings
26 | {
27 | public string HttpsEndpoint { get; set; }
28 | public string S3Endpoint { get; set; }
29 | public string GitHubEndpoint { get; set; }
30 |
31 |
32 | public DataStoreSettings DeepCopy()
33 | {
34 | return new DataStoreSettings
35 | {
36 | HttpsEndpoint = this.HttpsEndpoint,
37 | S3Endpoint = this.S3Endpoint,
38 | GitHubEndpoint = this.GitHubEndpoint
39 | };
40 | }
41 | }
42 | }
--------------------------------------------------------------------------------
/src/PortingAssistant.Compatibility.Common/Model/CompatibilityCheckerRequest.cs:
--------------------------------------------------------------------------------
1 | using Newtonsoft.Json;
2 | using Newtonsoft.Json.Converters;
3 |
4 | namespace PortingAssistant.Compatibility.Common.Model
5 | {
6 | public class CompatibilityCheckerRequest
7 | {
8 | public string TargetFramework { get; set; }
9 | public string SolutionGUID { get; set; }
10 | [JsonConverter(typeof(StringEnumConverter))]
11 | public Language Language { get; set; }
12 | public Dictionary> PackageWithApis { get; set; }
13 | [JsonConverter(typeof(StringEnumConverter))]
14 | public AssessmentType AssessmentType{ get; set;}
15 | }
16 |
17 | public enum Language
18 | {
19 | CSharp,
20 | Vb
21 | }
22 |
23 | public enum AssessmentType
24 | {
25 | // Compatibility Checker results Only. No need to append Recommandation result.
26 | CompatibilityOnly,
27 | FullAssessment,
28 | RecommendationOnly
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/src/PortingAssistant.Compatibility.Common/Model/CompatibilityCheckerResponse.cs:
--------------------------------------------------------------------------------
1 |
2 |
3 | using Newtonsoft.Json;
4 | using Newtonsoft.Json.Converters;
5 |
6 | namespace PortingAssistant.Compatibility.Common.Model
7 | {
8 | public class CompatibilityCheckerResponse: RecommendationOnlyResponse
9 | {
10 | public Dictionary PackageAnalysisResults { get; set; }
11 | public Dictionary> ApiAnalysisResults { get; set; }
12 | }
13 |
14 | // No need ApiAnalysisResults for RecommendationOnly Response
15 | public class RecommendationOnlyResponse
16 | {
17 | public string SolutionGUID { get; set; }
18 | [JsonConverter(typeof(StringEnumConverter))]
19 | public Language Language { get; set; }
20 | public Dictionary PackageRecommendationResults { get; set; }
21 | public Dictionary> ApiRecommendationResults { get; set; }
22 | public bool HasCompatibilityCheckingError { get; set; } = false;
23 | public Recommendations? GetRecommendationsForPackage(PackageVersionPair pkgVersionPair)
24 | {
25 | if (PackageRecommendationResults == null
26 | || !PackageRecommendationResults.TryGetValue(pkgVersionPair, out var pkgRecommendationResult))
27 | {
28 | return null;
29 | }
30 |
31 | return pkgRecommendationResult.Recommendations;
32 | }
33 |
34 | public Recommendations? GetRecommendationsForApi(PackageVersionPair pkgVersionPair, string methodSignature)
35 | {
36 | if (ApiRecommendationResults == null
37 | || !ApiRecommendationResults.TryGetValue(pkgVersionPair, out var apiRecommendationResultsForPackage)
38 | || !apiRecommendationResultsForPackage.TryGetValue(methodSignature, out var apiRecommendationResult)
39 | )
40 | {
41 | return null;
42 | }
43 |
44 | return apiRecommendationResult.Recommendations;
45 | }
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/src/PortingAssistant.Compatibility.Common/Model/CompatibilityResult.cs:
--------------------------------------------------------------------------------
1 | using Newtonsoft.Json;
2 | using Newtonsoft.Json.Converters;
3 |
4 | namespace PortingAssistant.Compatibility.Common.Model
5 | {
6 | public class CompatibilityResult
7 | {
8 | [JsonConverter(typeof(StringEnumConverter))]
9 | public Compatibility Compatibility { get; set; }
10 | public List CompatibleVersions { get; set; } = new();
11 |
12 | ///
13 | /// Returns list of compatible versions with and pre-release (alpha, beta, rc) versions filtered out
14 | ///
15 | public List GetCompatibleVersionsWithoutPreReleases()
16 | {
17 | return CompatibleVersions.Where(v => !v.Contains("-")).ToList();
18 | }
19 | }
20 | }
--------------------------------------------------------------------------------
/src/PortingAssistant.Compatibility.Common/Model/Exception/ExceptionMessage.cs:
--------------------------------------------------------------------------------
1 | using NuGet.Packaging.Core;
2 |
3 | namespace PortingAssistant.Compatibility.Common.Model.Exception
4 | {
5 | public static class ExceptionMessage
6 | {
7 | public static string PackageNotFound(PackageVersionPair packageVersion)
8 | => PackageNotFound(packageVersion.ToString());
9 | public static string PackageNotFound(string package)
10 | => $"Cannot find package {package}";
11 | public static string PackageSourceNotFound(PackageIdentity package)
12 | => PackageSourceNotFound(package.ToString());
13 | public static string PackageSourceNotFound(string packageVersion)
14 | => $"Package source not found for {packageVersion}";
15 | public static string NamespaceNotFound(string @namespace)
16 | => $"Could not find recommended namespace {@namespace}";
17 | public static string NamespaceFailedToProcess(string @namespace)
18 | => $"Failed to process namespace {@namespace}";
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/src/PortingAssistant.Compatibility.Common/Model/Exception/NamespaceNotFoundException.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace PortingAssistant.Compatibility.Common.Model.Exception
8 | {
9 | public class NamespaceNotFoundException : System.Exception
10 | {
11 | public NamespaceNotFoundException(string message) :
12 | base(message)
13 | {
14 | }
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/src/PortingAssistant.Compatibility.Common/Model/Exception/PackageDownloadMismatchException.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace PortingAssistant.Compatibility.Common.Model.Exception
8 | {
9 | public class PackageDownloadMismatchException : System.Exception
10 | {
11 |
12 | public PackageDownloadMismatchException(string message) :
13 | base(message)
14 | {
15 | }
16 |
17 | public PackageDownloadMismatchException(string expectedPackage, string actualPackage) :
18 | base(DefaultMessage(expectedPackage, actualPackage))
19 | {
20 | }
21 |
22 | private static string DefaultMessage(string expectedPackage, string actualPackage)
23 | {
24 | return $"{expectedPackage} is either not downloaded successfully due to wrong name, or downloaded package did not match expected package. Expected: {expectedPackage}, Actual: {actualPackage}";
25 | }
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/src/PortingAssistant.Compatibility.Common/Model/Exception/PackageNotFoundException.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace PortingAssistant.Compatibility.Common.Model.Exception
8 | {
9 | public class PackageNotFoundException : System.Exception
10 | {
11 | public PackageNotFoundException(string message) :
12 | base(message)
13 | {
14 | }
15 |
16 | public PackageNotFoundException(PackageVersionPair packageVersion) :
17 | base(DefaultMessage(packageVersion))
18 | {
19 | }
20 |
21 | private static string DefaultMessage(PackageVersionPair packageVersion)
22 | {
23 | return $"Could not find package {packageVersion}.";
24 | }
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/src/PortingAssistant.Compatibility.Common/Model/Exception/PortingAssistantClientException.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace PortingAssistant.Compatibility.Common.Model.Exception
8 | {
9 | public class PortingAssistantClientException : System.Exception
10 | {
11 | public PortingAssistantClientException(string message, System.Exception innerException) :
12 | base(message, innerException)
13 | {
14 | }
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/src/PortingAssistant.Compatibility.Common/Model/PackageAnalysisResult.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace PortingAssistant.Compatibility.Common.Model
8 | {
9 | public class PackageAnalysisResult
10 | {
11 | public PackageVersionPair PackageVersionPair { get; set; }
12 | public Dictionary CompatibilityResults { get; set; } // Target Framework CompatibilityResults pair
13 | public Recommendations Recommendations { get; set; }
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/src/PortingAssistant.Compatibility.Common/Model/PackageDetailsWithApiIndices.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace PortingAssistant.Compatibility.Common.Model
8 | {
9 | public class PackageDetailsWithApiIndices
10 | {
11 | public PackageDetails PackageDetails { get; set; }
12 | public Dictionary IndexDict { get; set; }
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/src/PortingAssistant.Compatibility.Common/Model/PackageSourceType.cs:
--------------------------------------------------------------------------------
1 |
2 |
3 | namespace PortingAssistant.Compatibility.Common.Model
4 | {
5 | public enum PackageSourceType
6 | {
7 | SDK,
8 | NUGET,
9 | PORTABILITY_ANALYZER,
10 | RECOMMENDATION
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/src/PortingAssistant.Compatibility.Common/Model/PackageVersionPair.cs:
--------------------------------------------------------------------------------
1 | using Newtonsoft.Json;
2 | using Newtonsoft.Json.Converters;
3 |
4 | namespace PortingAssistant.Compatibility.Common.Model
5 | {
6 | public class PackageVersionPair
7 | {
8 | public string PackageId { get; set; }
9 | public string Version { get; set; }
10 | [JsonConverter(typeof(StringEnumConverter))]
11 | public PackageSourceType? PackageSourceType { get; set; }
12 |
13 | public override bool Equals(object obj)
14 | {
15 | return obj is PackageVersionPair pair &&
16 | PackageId == pair.PackageId &&
17 | Version == pair.Version &&
18 | PackageSourceType == pair.PackageSourceType;
19 | }
20 |
21 | public override int GetHashCode()
22 | {
23 | if (PackageSourceType== null)
24 | {
25 | return HashCode.Combine(PackageId, Version);
26 | }
27 | else
28 | {
29 | return HashCode.Combine(PackageId, Version, PackageSourceType);
30 | }
31 |
32 | }
33 |
34 | public override string ToString()
35 | {
36 | if (PackageSourceType== null)
37 | {
38 | return $"{PackageId}-{Version}";
39 | }
40 | else{
41 | return $"{PackageId}-{Version}-{PackageSourceType.ToString()}";
42 | }
43 |
44 | }
45 | }
46 | }
47 |
--------------------------------------------------------------------------------
/src/PortingAssistant.Compatibility.Common/Model/RecommendationActionFileDetails.cs:
--------------------------------------------------------------------------------
1 | using Newtonsoft.Json;
2 | using System;
3 | using System.Collections.Generic;
4 | using System.Linq;
5 | using System.Text;
6 | using System.Threading.Tasks;
7 |
8 | namespace PortingAssistant.Compatibility.Common.Model
9 | {
10 | // File details of recommendation action files "namespace.json".
11 | public class RecommendationActionFileDetails
12 | {
13 | public string Name { get; set; }
14 | public string Version { get; set; }
15 | public ActionFilePackages[] Packages { get; set; }
16 | public RecommendationActionFileModel[] Recommendations { get; set; }
17 | }
18 |
19 | public class ActionFilePackages
20 | {
21 | public string Type { get; set; }
22 | public string Name { get; set; }
23 | }
24 |
25 | public class RecommendationActionFileModel
26 | {
27 | public string Type { get; set; }
28 | public string Value { get; set; }
29 | public string Name { get; set; }
30 | public string KeyType { get; set; }
31 | public RecommendedActionActionFileModel[] RecommendedActions { get; set; }
32 | }
33 |
34 | public class RecommendedActionActionFileModel
35 | {
36 | public string Source { get; set; }
37 | public string Preferred { get; set; }
38 | public List TargetFrameworks { get; set; }
39 | public string Description { get; set; }
40 | public ActionFileActions[] Actions { get; set; }
41 | }
42 |
43 | public class TargetFramework
44 | {
45 | public string Name { get; set; }
46 | public List TargetCPU { get; set; }
47 | }
48 |
49 | public class ActionFileActions
50 | {
51 | public string Name { get; set; }
52 | public string Type { get; set; }
53 | public object Value { get; set; } // For CSharp
54 | public object VbValue { get; set; } // For Vb
55 | public string Description { get; set; }
56 | public ActionValidation ActionValidation { get; set; } // For CSharp
57 | public ActionValidation VbActionValidation { get; set; } // For Vb
58 | }
59 |
60 | public class ActionValidation
61 | {
62 | public string Contains { get; set; }
63 | public string NotContains { get; set; }
64 | public string CheckComments { get; set; }
65 | }
66 | }
--------------------------------------------------------------------------------
/src/PortingAssistant.Compatibility.Common/Model/Recommendations.cs:
--------------------------------------------------------------------------------
1 | using Newtonsoft.Json.Converters;
2 | using Newtonsoft.Json;
3 |
4 | namespace PortingAssistant.Compatibility.Common.Model
5 | {
6 | public class Recommendations
7 | {
8 | public List RecommendedActions { get; set; }
9 | public List RecommendedPackageVersions { get; set; }
10 |
11 | }
12 |
13 | public class Recommendation
14 | {
15 | public string PackageId { get; set; }
16 | public string Version { get; set; }
17 | public List TargetVersions { get; set; }
18 | public string Description { get; set; }
19 |
20 | [JsonConverter(typeof(StringEnumConverter))]
21 | public RecommendedActionType RecommendedActionType { get; set; }
22 | }
23 |
24 | public enum RecommendedActionType
25 | {
26 | UpgradePackage,
27 | ReplaceApi,
28 | //Future
29 | ReplaceNamespace,
30 | ReplacePackage,
31 | NoRecommendation
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/src/PortingAssistant.Compatibility.Common/PortingAssistant.Compatibility.Common.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | net6.0
5 | enable
6 | enable
7 | PortingAssistant.Compatibility.Common
8 | 2.0.0
9 | blueshift
10 | aws
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
--------------------------------------------------------------------------------
/src/PortingAssistant.Compatibility.Common/Utils/Constants.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace PortingAssistant.Compatibility.Common.Utils
8 | {
9 | public class Constants
10 | {
11 | public const string DefaultAssessmentTargetFramework = "net6.0";
12 |
13 | public const string DestinationKeySuffix = "compatibility-result.json";
14 |
15 | public const string BetaStageName = "beta";
16 |
17 | public const string GammaStageName = "gamma";
18 |
19 | public const string ProdStageName = "prod";
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/src/PortingAssistant.Compatibility.Common/Utils/NugetVersionHelper.cs:
--------------------------------------------------------------------------------
1 | using NuGet.Versioning;
2 | using System;
3 | using System.Collections.Generic;
4 | using System.Linq;
5 | using System.Text;
6 | using System.Threading.Tasks;
7 |
8 | namespace PortingAssistant.Compatibility.Common.Utils
9 | {
10 | public class NugetVersionHelper
11 | {
12 | public static NuGetVersion GetMaxVersion(IEnumerable nugetVersions)
13 | {
14 | var parsedVersions = nugetVersions.Select(v =>
15 | {
16 | if (NuGetVersion.TryParse(v, out var validVersion))
17 | {
18 | return validVersion;
19 | }
20 |
21 | return null;
22 | }).Where(v => v != null);
23 |
24 | // Returns null if there are no valid nugetVersions
25 | return GetMaxVersion(parsedVersions);
26 | }
27 |
28 | public static NuGetVersion GetMaxVersion(IEnumerable nugetVersions)
29 | {
30 | return nugetVersions.Max();
31 | }
32 |
33 | public static bool HasLowerCompatibleVersionWithSameMajor(NuGetVersion nugetVersion, IEnumerable compatibleNugetVersions)
34 | {
35 | return compatibleNugetVersions.Any(v =>
36 | nugetVersion.IsGreaterThanOrEqualTo(v)
37 | && nugetVersion.HasSameMajorAs(v)
38 | );
39 | }
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/src/PortingAssistant.Compatibility.Core/Checkers/NugetCompatibilityChecker.cs:
--------------------------------------------------------------------------------
1 | using Microsoft.Extensions.Logging;
2 | using PortingAssistant.Compatibility.Common.Interface;
3 | using PortingAssistant.Compatibility.Common.Model;
4 |
5 | namespace PortingAssistant.Compatibility.Core.Checkers
6 | {
7 | public class NugetCompatibilityChecker : ExternalCompatibilityChecker
8 | {
9 | public override PackageSourceType CompatibilityCheckerType => PackageSourceType.NUGET;
10 | public ILogger _logger;
11 | public NugetCompatibilityChecker(
12 | IRegionalDatastoreService regionalDatastoreService,
13 | ILogger logger
14 | )
15 | : base(regionalDatastoreService, logger)
16 | {
17 | }
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/src/PortingAssistant.Compatibility.Core/Checkers/SdkCompatibilityChecker.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 | using Microsoft.Extensions.Logging;
7 | using PortingAssistant.Compatibility.Common.Interface;
8 | using PortingAssistant.Compatibility.Common.Model;
9 |
10 | namespace PortingAssistant.Compatibility.Core.Checkers
11 | {
12 | public class SdkCompatibilityChecker : ExternalCompatibilityChecker
13 | {
14 | public override PackageSourceType CompatibilityCheckerType => PackageSourceType.SDK;
15 | private ILogger _logger;
16 | public SdkCompatibilityChecker(
17 | IRegionalDatastoreService regionalDatastoreService,
18 | ILogger logger)
19 | : base(regionalDatastoreService, logger)
20 | {
21 | }
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/src/PortingAssistant.Compatibility.Core/PortingAssistant.Compatibility.Core.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | net6.0
5 | enable
6 | enable
7 | PortingAssistant.Compatibility.Core
8 | 2.0.0
9 | blueshift
10 | aws
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
--------------------------------------------------------------------------------
/tests/PortingAssistant.Client.IntegrationTests/CorrectnessTestBase.cs:
--------------------------------------------------------------------------------
1 | using NUnit.Framework;
2 | using System.IO;
3 |
4 | namespace PortingAssistant.Client.IntegrationTests
5 | {
6 | public class CorrectnessTestBase
7 | {
8 | protected string _testDirectoryRoot;
9 | protected string _tmpTestFixturePath_FirstRun;
10 | protected string _tmpTestFixturePath_SecondRun;
11 | protected string _testProjectZipPath;
12 |
13 | [OneTimeSetUp]
14 | public virtual void OneTimeSetUp()
15 | {
16 | _testDirectoryRoot = TestContext.CurrentContext.TestDirectory;
17 |
18 | _tmpTestFixturePath_FirstRun = Path.GetFullPath(Path.Combine(
19 | Path.GetTempPath(),
20 | Path.GetRandomFileName()));
21 | Directory.CreateDirectory(_tmpTestFixturePath_FirstRun);
22 |
23 | _tmpTestFixturePath_SecondRun = Path.GetFullPath(Path.Combine(
24 | Path.GetTempPath(),
25 | Path.GetRandomFileName()));
26 | Directory.CreateDirectory(_tmpTestFixturePath_SecondRun);
27 |
28 | _testProjectZipPath = Path.Combine(
29 | _testDirectoryRoot,
30 | "TestProjects",
31 | "NetFrameworkExample.zip");
32 | }
33 |
34 | [OneTimeTearDown]
35 | public void Cleanup()
36 | {
37 | Directory.Delete(_tmpTestFixturePath_FirstRun, true);
38 | }
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/tests/PortingAssistant.Client.IntegrationTests/TestProjects/Miniblog.Core-master.zip:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aws/porting-assistant-dotnet-client/a273c70e07eb66b467425a453b529c81d4b988ae/tests/PortingAssistant.Client.IntegrationTests/TestProjects/Miniblog.Core-master.zip
--------------------------------------------------------------------------------
/tests/PortingAssistant.Client.IntegrationTests/TestProjects/NetFrameworkExample-ported.zip:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aws/porting-assistant-dotnet-client/a273c70e07eb66b467425a453b529c81d4b988ae/tests/PortingAssistant.Client.IntegrationTests/TestProjects/NetFrameworkExample-ported.zip
--------------------------------------------------------------------------------
/tests/PortingAssistant.Client.IntegrationTests/TestProjects/NetFrameworkExample.zip:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aws/porting-assistant-dotnet-client/a273c70e07eb66b467425a453b529c81d4b988ae/tests/PortingAssistant.Client.IntegrationTests/TestProjects/NetFrameworkExample.zip
--------------------------------------------------------------------------------
/tests/PortingAssistant.Client.IntegrationTests/TestProjects/TestNet31Empty.zip:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aws/porting-assistant-dotnet-client/a273c70e07eb66b467425a453b529c81d4b988ae/tests/PortingAssistant.Client.IntegrationTests/TestProjects/TestNet31Empty.zip
--------------------------------------------------------------------------------
/tests/PortingAssistant.Client.IntegrationTests/TestProjects/VBWebApi.zip:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aws/porting-assistant-dotnet-client/a273c70e07eb66b467425a453b529c81d4b988ae/tests/PortingAssistant.Client.IntegrationTests/TestProjects/VBWebApi.zip
--------------------------------------------------------------------------------
/tests/PortingAssistant.Client.IntegrationTests/TestProjects/eShopOnBlazor-ported.zip:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aws/porting-assistant-dotnet-client/a273c70e07eb66b467425a453b529c81d4b988ae/tests/PortingAssistant.Client.IntegrationTests/TestProjects/eShopOnBlazor-ported.zip
--------------------------------------------------------------------------------
/tests/PortingAssistant.Client.IntegrationTests/TestProjects/eShopOnBlazor.zip:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aws/porting-assistant-dotnet-client/a273c70e07eb66b467425a453b529c81d4b988ae/tests/PortingAssistant.Client.IntegrationTests/TestProjects/eShopOnBlazor.zip
--------------------------------------------------------------------------------
/tests/PortingAssistant.Client.IntegrationTests/TestUtils/CacheUtils.cs:
--------------------------------------------------------------------------------
1 | using CTA.FeatureDetection.Common;
2 | using Microsoft.Extensions.Logging;
3 | using System;
4 | using System.IO;
5 |
6 | namespace PortingAssistant.Client.IntegrationTests.TestUtils
7 | {
8 | public class CacheUtils
9 | {
10 | public static void CleanupCacheFiles()
11 | {
12 | try
13 | {
14 | var roamingFolder = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData);
15 | var cacheFolder = Path.Combine(roamingFolder, "Porting Assistant for .NET");
16 |
17 | var files = Directory.GetFiles(cacheFolder, "compatibility-checker-cache*");
18 | foreach (var file in files)
19 | {
20 | var fi = new FileInfo(file);
21 | fi.Delete();
22 | }
23 | }
24 | catch (Exception ex)
25 | {
26 | Log.Logger.LogError(ex, "Failed to delete cache file");
27 | }
28 | }
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/tests/PortingAssistant.Client.UnitTests/GitConfigFileParserTest.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.IO;
3 | using NUnit.Framework;
4 | using PortingAssistant.Client.Client.FileParser;
5 |
6 | namespace PortingAssistant.Client.UnitTests
7 | {
8 | public class GitConfigFileParserTest
9 | {
10 | [Test]
11 | public void getGitRepositoryRootPath_Returns_Expected_Path()
12 | {
13 | string gitRootPath = GitConfigFileParser.getGitRepositoryRootPath(
14 | Directory.GetCurrentDirectory());
15 | string expectedRootPathEnding = Path.Combine("porting-assistant-dotnet-client", ".git");
16 | Assert.IsTrue(gitRootPath.Contains(expectedRootPathEnding, StringComparison.OrdinalIgnoreCase));
17 | }
18 |
19 | [Test]
20 | public void getGitRepositoryRootPath_Returns_Null_On_NonExisting_Path()
21 | {
22 | string gitRootPath = GitConfigFileParser.getGitRepositoryRootPath(@"C:\\RandomFile\\Path\\solution.sln");
23 | Assert.AreEqual(null, gitRootPath);
24 | }
25 |
26 | [Test]
27 | public void getGitRepositoryUrl_Returns_Null_On_Invalid_Path()
28 | {
29 | string gitUrl = GitConfigFileParser.getGitRepositoryUrl(@"C:\\RandomFile\\Path\\solution\\.git\");
30 | Assert.AreEqual(null, gitUrl);
31 | }
32 |
33 | [Test]
34 | public void getGitRepositoryUrl_Returns_Null_On_Null_Path()
35 | {
36 | string gitUrl = GitConfigFileParser.getGitRepositoryUrl(null);
37 | Assert.AreEqual(null, gitUrl);
38 | }
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/tests/PortingAssistant.Client.UnitTests/HashUtilsTest.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Text;
4 |
5 | using NUnit.Framework;
6 | using PortingAssistant.Client.Client.Utils;
7 |
8 | namespace PortingAssistant.Client.UnitTests
9 | {
10 | public class HashUtilsTest
11 | {
12 | [Test]
13 | public void GenerateGuid_Returns_Expected_Hash()
14 | {
15 | List guids = new List {"a", "b", "c" };
16 | string actualHash = HashUtils.GenerateGuid(guids);
17 | string expectedHash = "b16bfbd6-a33f-e8a2-3f5f-f8477184d858";
18 | Assert.AreEqual(expectedHash, actualHash);
19 | }
20 |
21 | [Test]
22 | public void GenerateGuid_Returns_Expected_On_Empty_Guid_Values()
23 | {
24 | List guids = new List { "", "", "" };
25 | string actualHash = HashUtils.GenerateGuid(guids);
26 | string expectedHash = "1b01c3c3-99e5-cc66-54e9-cdac516c7d62";
27 | Assert.AreEqual(expectedHash, actualHash);
28 | }
29 |
30 | [Test]
31 | public void GenerateGuid_Returns_Expected_On_Null_Guid_Values()
32 | {
33 | List guids = new List { null, null, null };
34 | string actualHash = HashUtils.GenerateGuid(guids);
35 | string expectedHash = "1b01c3c3-99e5-cc66-54e9-cdac516c7d62";
36 | Assert.AreEqual(expectedHash, actualHash);
37 | }
38 |
39 | [Test]
40 | public void GenerateGuid_Returns_Null_On_Empty_Input()
41 | {
42 | List guids = new List { };
43 | string actualHash = HashUtils.GenerateGuid(guids);
44 | Assert.AreEqual(null, actualHash);
45 | }
46 |
47 | [Test]
48 | public void GenerateGuid_Returns_Null_On_Null_Input()
49 | {
50 | string actualHash = HashUtils.GenerateGuid(null);
51 | Assert.AreEqual(null, actualHash);
52 | }
53 | }
54 | }
55 |
--------------------------------------------------------------------------------
/tests/PortingAssistant.Client.UnitTests/MockInvocationExpressionModel.cs:
--------------------------------------------------------------------------------
1 | using Codelyzer.Analysis.Model;
2 |
3 | namespace PortingAssistant.Client.Tests
4 | {
5 | public class MockInvocationExpressionModel : InvocationExpression
6 | {
7 | public MockInvocationExpressionModel(string originalDefinition, string namespaceName, string assembly)
8 | {
9 | SemanticOriginalDefinition = originalDefinition;
10 | SemanticNamespace = namespaceName;
11 | Reference = new Reference
12 | {
13 | Assembly = assembly
14 | };
15 | TextSpan = new TextSpan();
16 | }
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/tests/PortingAssistant.Client.UnitTests/NUnitLogger.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using Microsoft.Extensions.Logging;
3 |
4 | namespace NUnit.Framework
5 | {
6 | public static class TestLogger
7 | {
8 | public static ILogger Create()
9 | {
10 | var logger = new NUnitLogger();
11 | return logger;
12 | }
13 |
14 | class NUnitLogger : ILogger, IDisposable
15 | {
16 | private readonly Action output = Console.WriteLine;
17 |
18 | public void Dispose()
19 | {
20 | }
21 |
22 | public void Log(LogLevel logLevel, EventId eventId, TState state, Exception exception,
23 | Func formatter) => output(formatter(state, exception));
24 |
25 | public bool IsEnabled(LogLevel logLevel) => true;
26 |
27 | public IDisposable BeginScope(TState state) => this;
28 | }
29 | }
30 | }
--------------------------------------------------------------------------------
/tests/PortingAssistant.Client.UnitTests/ReportExporterTest.cs:
--------------------------------------------------------------------------------
1 | using NUnit.Framework;
2 | using PortingAssistant.Client.Client.Utils;
3 | using PortingAssistant.Client.Model;
4 | using System;
5 | using System.Collections.Generic;
6 | using System.Linq;
7 | using System.Text;
8 | using System.Threading.Tasks;
9 | using PortingAssistant.Client.Client.Reports;
10 | using Microsoft.Extensions.Logging;
11 | using Microsoft.Extensions.DependencyInjection;
12 | using System.IO;
13 |
14 | namespace PortingAssistant.Client.UnitTests
15 | {
16 | public class ReportExporterTest
17 | {
18 | private string testDirectoryRoot;
19 | private string tmpTestFixturePath;
20 | private ILogger testLogger;
21 | private IReportExporter _reportExporter;
22 | [OneTimeSetUp]
23 | public void OneTimeSetup()
24 | {
25 | testDirectoryRoot = TestContext.CurrentContext.TestDirectory;
26 | tmpTestFixturePath = Path.GetFullPath(Path.Combine(
27 | Path.GetTempPath(),
28 | Path.GetRandomFileName()));
29 | Directory.CreateDirectory(tmpTestFixturePath);
30 | var serviceCollection = new ServiceCollection();
31 | serviceCollection.AddSingleton();
32 | var serviceProvider = serviceCollection
33 | .AddLogging()
34 | .BuildServiceProvider();
35 | var factory = serviceProvider.GetService();
36 | testLogger = factory.CreateLogger();
37 | testLogger.LogInformation("Total logs");
38 | _reportExporter = new ReportExporter(testLogger);
39 |
40 | }
41 | [Test]
42 | public void GenerateJsonReportTest()
43 | {
44 | var solutionName = "test";
45 | var portingResults = new List { new PortingResult { ProjectFile = "test", Message = "test", ProjectName = "test", Success = true } };
46 | Assert.DoesNotThrow(() =>
47 | {
48 | _reportExporter.GenerateJsonReport(portingResults, solutionName, tmpTestFixturePath);
49 | }
50 | );
51 | }
52 |
53 | [OneTimeTearDown]
54 | public void Cleanup()
55 | {
56 | Directory.Delete(tmpTestFixturePath, true);
57 | }
58 | }
59 | }
60 |
--------------------------------------------------------------------------------
/tests/PortingAssistant.Client.UnitTests/SolutionFileParserTest.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Text;
4 | using System.IO;
5 | using System.IO.Compression;
6 | using NUnit.Framework;
7 | using PortingAssistant.Client.Client.FileParser;
8 |
9 | namespace PortingAssistant.Client.UnitTests
10 | {
11 | public class SolutionFileParserTest
12 | {
13 | protected string tmpTestFixturePath;
14 | protected string testSolutionPath;
15 | protected string testSolutionParentDir;
16 |
17 | [OneTimeSetUp]
18 | public virtual void OneTimeSetUp()
19 | {
20 | tmpTestFixturePath = Path.GetFullPath(Path.Combine(
21 | Path.GetTempPath(),
22 | Path.GetRandomFileName()));
23 | Directory.CreateDirectory(tmpTestFixturePath);
24 |
25 | string testDirectoryRoot = TestContext.CurrentContext.TestDirectory;
26 | string testProjectZipPath = Path.Combine(
27 | testDirectoryRoot,
28 | "TestProjects",
29 | "mvcmusicstore.zip");
30 |
31 | using (ZipArchive archive = ZipFile.Open(
32 | testProjectZipPath, ZipArchiveMode.Read))
33 | {
34 | archive.ExtractToDirectory(tmpTestFixturePath);
35 | }
36 |
37 | testSolutionParentDir = Path.Combine(tmpTestFixturePath, "mvcmusicstore");
38 | testSolutionPath = Path.Combine(testSolutionParentDir, "MvcMusicStore.sln");
39 | }
40 |
41 | [OneTimeTearDown]
42 | public void Cleanup()
43 | {
44 | Directory.Delete(tmpTestFixturePath, true);
45 | }
46 |
47 | [Test]
48 | public void getSolutionGuid_Returns_Expected_Guid()
49 | {
50 | string actualSolutionGuid = SolutionFileParser.getSolutionGuid(testSolutionPath);
51 | string expectedSolutionGuid = "2ADD3674-EB3F-480D-BF17-3434E0BD5A5C".ToLower();
52 | Assert.AreEqual(expectedSolutionGuid, actualSolutionGuid);
53 | }
54 |
55 | [Test]
56 | public void getSolutionGuid_Returns_Null_On_NonExisting_Solution_Path()
57 | {
58 | string actualSolutionGuid = SolutionFileParser.getSolutionGuid(@"C:\\Random\\Path\\Invalid\\Solution.sln");
59 | Assert.AreEqual(null, actualSolutionGuid);
60 | }
61 |
62 | [Test]
63 | public void getSolutionGuid_Returns_Null_On_Invalid_Solution_Path()
64 | {
65 | string projectPath = Path.Combine(
66 | testSolutionParentDir,
67 | "MvcMusicStore", "MvcMusicStore.csproj"
68 | );
69 | // Path exists, but not a valid solution file with file extension .sln
70 | string actualSolutionGuid = SolutionFileParser.getSolutionGuid(projectPath);
71 | Assert.AreEqual(null, actualSolutionGuid);
72 | }
73 | }
74 | }
75 |
--------------------------------------------------------------------------------
/tests/PortingAssistant.Client.UnitTests/TelemetryClientFactoryTest.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using Amazon.Runtime;
3 | using NUnit.Framework;
4 | using PortingAssistant.Client.Telemetry;
5 | using PortingAssistantExtensionTelemetry.Model;
6 | using static System.Net.WebRequestMethods;
7 |
8 | namespace PortingAssistant.Client.UnitTests
9 | {
10 | public class TelemetryClientFactoryTest
11 | {
12 | [Test]
13 | public void EnablingDefaultCredentials_CreatesTelemetryClient()
14 | {
15 | var enabledDefaultCredentials = true;
16 | var telemetryConfig = new TelemetryConfiguration()
17 | {
18 | InvokeUrl = @"https://dummy.amazonaws.com/gamma",
19 | Region = "us-east-1",
20 | };
21 | var isClientCreated = TelemetryClientFactory.TryGetClient(
22 | "NonExistentProfile",
23 | telemetryConfig,
24 | out var client,
25 | enabledDefaultCredentials);
26 |
27 | Assert.IsTrue(isClientCreated);
28 | }
29 |
30 | [Test]
31 | public void CreatesTelemetryClient_WithCredentials()
32 | {
33 | string profile = null;
34 | var telemetryConfig = new TelemetryConfiguration()
35 | {
36 | InvokeUrl = @"https://dummy.amazonaws.com/gamma",
37 | Region = "us-east-1",
38 | };
39 | AWSCredentials credentials = new BasicAWSCredentials("accessKey", "secretKey");
40 | ITelemetryClient client;
41 |
42 | bool result = TelemetryClientFactory.TryGetClient(profile, telemetryConfig, out client, awsCredentials: credentials);
43 |
44 | Assert.IsTrue(result);
45 | Assert.IsNotNull(client);
46 | }
47 |
48 | [Test]
49 | public void CreatesTelemetryClient_WithoutProfileOrCredentials_Failed()
50 | {
51 | string profile = null;
52 | var telemetryConfig = new TelemetryConfiguration()
53 | {
54 | InvokeUrl = @"https://dummy.amazonaws.com/gamma",
55 | Region = "us-east-1",
56 | };
57 | AWSCredentials credentials = null;
58 | ITelemetryClient client;
59 |
60 | bool result = TelemetryClientFactory.TryGetClient(profile, telemetryConfig, out client, awsCredentials: credentials);
61 |
62 | Assert.IsFalse(result);
63 | Assert.IsNull(client);
64 | }
65 | }
66 | }
67 |
--------------------------------------------------------------------------------
/tests/PortingAssistant.Client.UnitTests/TelemetryClientTest.cs:
--------------------------------------------------------------------------------
1 | using Amazon.Runtime;
2 | using NUnit.Framework;
3 | using PortingAssistant.Client.Telemetry;
4 |
5 | namespace PortingAssistant.Client.UnitTests
6 | {
7 | public class TelemetryClientTest
8 | {
9 | [Test]
10 | public void EnablingDefaultCredentials_CreatesTelemetryClient()
11 | {
12 | var url = "https://dummy.amazonaws.com/gamma";
13 | var telemetryClientConfig = new TelemetryClientConfig(url)
14 | {
15 | ServiceURL = url
16 | };
17 |
18 | var fallbackCredentials = FallbackCredentialsFactory.GetCredentials();
19 | TelemetryClient client;
20 |
21 | client = new TelemetryClient(telemetryClientConfig);
22 | Assert.IsNotNull(client);
23 |
24 | client = new TelemetryClient(fallbackCredentials, telemetryClientConfig);
25 | Assert.IsNotNull(client);
26 |
27 | client = new TelemetryClient(
28 | "AccessKey",
29 | "SecretKey",
30 | telemetryClientConfig);
31 | Assert.IsNotNull(client);
32 |
33 | client = new TelemetryClient(
34 | "AccessKey",
35 | "SecretKey",
36 | "token",
37 | telemetryClientConfig);
38 | Assert.IsNotNull(client);
39 | }
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/tests/PortingAssistant.Client.UnitTests/TelemetryConfigurationTest.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 | using NUnit.Framework;
3 | using PortingAssistantExtensionTelemetry.Model;
4 |
5 | namespace PortingAssistant.Client.UnitTests
6 | {
7 | public class TelemetryConfigurationTest
8 | {
9 | private TelemetryConfiguration telemetryConfiguration;
10 | [SetUp]
11 | public void Setup()
12 | {
13 | telemetryConfiguration = new TelemetryConfiguration();
14 | }
15 |
16 | [Test]
17 | public void TestSettersAndGetters()
18 | {
19 | telemetryConfiguration.InvokeUrl = nameof(telemetryConfiguration.InvokeUrl);
20 | telemetryConfiguration.Region = nameof(telemetryConfiguration.Region);
21 | telemetryConfiguration.LogsPath = nameof(telemetryConfiguration.LogsPath);
22 | telemetryConfiguration.ServiceName = nameof(telemetryConfiguration.ServiceName);
23 | telemetryConfiguration.Description = nameof(telemetryConfiguration.Description);
24 | telemetryConfiguration.LogFilePath = nameof(telemetryConfiguration.LogFilePath);
25 | telemetryConfiguration.MetricsFilePath = nameof(telemetryConfiguration.MetricsFilePath);
26 | telemetryConfiguration.LogPrefix = nameof(telemetryConfiguration.LogPrefix);
27 | telemetryConfiguration.LogsFolderSizeLimit = 10000;
28 | telemetryConfiguration.Suffix = new List { nameof(telemetryConfiguration.Suffix) };
29 |
30 | Assert.AreEqual(nameof(telemetryConfiguration.InvokeUrl), telemetryConfiguration.InvokeUrl);
31 | Assert.AreEqual(nameof(telemetryConfiguration.Region), telemetryConfiguration.Region);
32 | Assert.AreEqual(nameof(telemetryConfiguration.LogsPath), telemetryConfiguration.LogsPath);
33 | Assert.AreEqual(nameof(telemetryConfiguration.ServiceName), telemetryConfiguration.ServiceName);
34 | Assert.AreEqual(nameof(telemetryConfiguration.Description), telemetryConfiguration.Description);
35 | Assert.AreEqual(nameof(telemetryConfiguration.LogFilePath), telemetryConfiguration.LogFilePath);
36 | Assert.AreEqual(nameof(telemetryConfiguration.MetricsFilePath), telemetryConfiguration.MetricsFilePath);
37 | Assert.AreEqual(nameof(telemetryConfiguration.LogPrefix), telemetryConfiguration.LogPrefix);
38 | Assert.AreEqual(10000, telemetryConfiguration.LogsFolderSizeLimit);
39 | CollectionAssert.AreEquivalent(new List { nameof(telemetryConfiguration.Suffix) }, telemetryConfiguration.Suffix);
40 | }
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/tests/PortingAssistant.Client.UnitTests/TestProjects/mvcmusicstore.zip:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aws/porting-assistant-dotnet-client/a273c70e07eb66b467425a453b529c81d4b988ae/tests/PortingAssistant.Client.UnitTests/TestProjects/mvcmusicstore.zip
--------------------------------------------------------------------------------
/tests/PortingAssistant.Client.UnitTests/TestXml/ProjectWithPackagesConfig/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/tests/PortingAssistant.Client.UnitTests/TestXml/ProjectWithReference/ProjectWithReference.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | netcoreapp3.1
5 | false
6 |
7 |
8 |
9 |
10 | runtime; build; native; contentfiles; analyzers; buildtransitive
11 | all
12 |
13 |
14 |
15 | runtime; build; native; contentfiles; analyzers; buildtransitive
16 | all
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 | PreserveNewest
31 |
32 |
33 | PreserveNewest
34 |
35 |
36 | PreserveNewest
37 |
38 |
39 |
--------------------------------------------------------------------------------
/tests/PortingAssistant.Client.UnitTests/TestXml/SolutionWithApi/SolutionWithApi.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio 15
4 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "testproject", "testproject\testproject.csproj", "{3800C2D3-A925-4FD1-8CA2-08CB94CCDDFC}"
5 | EndProject
6 | Global
7 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
8 | Debug|Any CPU = Debug|Any CPU
9 | Release|Any CPU = Release|Any CPU
10 | EndGlobalSection
11 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
12 | {3800C2D3-A925-4FD1-8CA2-08CB94CCDDFC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
13 | {3800C2D3-A925-4FD1-8CA2-08CB94CCDDFC}.Debug|Any CPU.Build.0 = Debug|Any CPU
14 | {3800C2D3-A925-4FD1-8CA2-08CB94CCDDFC}.Release|Any CPU.ActiveCfg = Release|Any CPU
15 | {3800C2D3-A925-4FD1-8CA2-08CB94CCDDFC}.Release|Any CPU.Build.0 = Release|Any CPU
16 | EndGlobalSection
17 | EndGlobal
18 |
--------------------------------------------------------------------------------
/tests/PortingAssistant.Client.UnitTests/TestXml/SolutionWithApi/testproject/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using Newtonsoft.Json;
3 |
4 | namespace Test2
5 | {
6 | class Program
7 | {
8 | static void print()
9 | {
10 | var macbook = new Computer
11 | {
12 | Vendor = "apple Inc",
13 | produceDate = new DateTime(),
14 | price = "1200$"
15 | };
16 |
17 | string json = JsonConvert.SerializeObject(macbook);
18 |
19 | Console.WriteLine("my new computer is {0}", json);
20 | }
21 |
22 | public class Computer
23 | {
24 | public string Vendor { get; set; }
25 | public DateTime produceDate { get; set; }
26 | public string price { get; set; }
27 |
28 | }
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/tests/PortingAssistant.Client.UnitTests/TestXml/SolutionWithApi/testproject/testproject.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | netcoreapp3.1
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/tests/PortingAssistant.Client.UnitTests/TestXml/SolutionWithFailedContent/ProjectInWrongDirectory.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Debug
5 | AnyCPU
6 | 8.0.30703
7 | 2.0
8 | {6BDA8332-939F-45B7-A25E-7A797260AE59}
9 | Library
10 | Properties
11 | Nop.Core
12 | Nop.Core
13 | v4.5.1
14 | 512
15 |
16 |
17 |
18 | true
19 | full
20 | false
21 | bin\Debug\
22 | DEBUG;TRACE
23 | prompt
24 | 4
25 | false
26 |
27 |
28 | pdbonly
29 | true
30 | bin\Release\
31 | TRACE
32 | prompt
33 | 4
34 | false
35 |
36 |
37 |
38 | ..\..\packages\Newtonsoft.Json.9.0.1\lib\net45\Newtonsoft.Json.dll
39 | True
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
67 |
--------------------------------------------------------------------------------
/tests/PortingAssistant.Client.UnitTests/TestXml/SolutionWithFailedContent/SolutionWithFailedContent.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio 14
4 | VisualStudioVersion = 14.0.23107.0
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Libraries", "Libraries", "{E4ACA93B-D3DE-4557-B069-F1DB42925A4B}"
7 | EndProject
8 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Nop.Core", "Libraries\Nop\ProjectInWrongDirectory.csproj", "{6BDA8332-939F-45B7-A25E-7A797260AE59}"
9 | EndProject
10 | Global
11 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
12 | Debug|Any CPU = Debug|Any CPU
13 | Debug|Mixed Platforms = Debug|Mixed Platforms
14 | Debug|x86 = Debug|x86
15 | Release|Any CPU = Release|Any CPU
16 | Release|Mixed Platforms = Release|Mixed Platforms
17 | Release|x86 = Release|x86
18 | EndGlobalSection
19 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
20 | {6BDA8332-939F-45B7-A25E-7A797260AE59}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
21 | {6BDA8332-939F-45B7-A25E-7A797260AE59}.Debug|Any CPU.Build.0 = Debug|Any CPU
22 | {6BDA8332-939F-45B7-A25E-7A797260AE59}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
23 | {6BDA8332-939F-45B7-A25E-7A797260AE59}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
24 | {6BDA8332-939F-45B7-A25E-7A797260AE59}.Debug|x86.ActiveCfg = Debug|Any CPU
25 | {6BDA8332-939F-45B7-A25E-7A797260AE59}.Release|Any CPU.ActiveCfg = Release|Any CPU
26 | {6BDA8332-939F-45B7-A25E-7A797260AE59}.Release|Any CPU.Build.0 = Release|Any CPU
27 | {6BDA8332-939F-45B7-A25E-7A797260AE59}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
28 | {6BDA8332-939F-45B7-A25E-7A797260AE59}.Release|Mixed Platforms.Build.0 = Release|Any CPU
29 | {6BDA8332-939F-45B7-A25E-7A797260AE59}.Release|x86.ActiveCfg = Release|Any CPU
30 | EndGlobalSection
31 | GlobalSection(SolutionProperties) = preSolution
32 | HideSolutionNode = FALSE
33 | EndGlobalSection
34 | GlobalSection(NestedProjects) = preSolution
35 | {6BDA8332-939F-45B7-A25E-7A797260AE59} = {E4ACA93B-D3DE-4557-B069-F1DB42925A4B}
36 | EndGlobalSection
37 | GlobalSection(NDepend) = preSolution
38 | Project = ".\NopCommerce.ndproj"
39 | EndGlobalSection
40 | EndGlobal
41 |
--------------------------------------------------------------------------------
/tests/PortingAssistant.Client.UnitTests/TestXml/SolutionWithFailedContent/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/tests/PortingAssistant.Client.UnitTests/TestXml/SolutionWithFailedContent/test/ProjectWithCorruptContent.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
--------------------------------------------------------------------------------
/tests/PortingAssistant.Client.UnitTests/TestXml/SolutionWithFailedContent/test/ProjectWithCorruptPackageVersion.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | netstandard2.0
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/tests/PortingAssistant.Client.UnitTests/TestXml/SolutionWithNugetConfigFile/SolutionWithNugetConfigFile.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio 15
4 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Test1", "Test1\Test1.csproj", "{EF29CFFB-0A0E-495F-93AD-16157F9E826D}"
5 | EndProject
6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Test2", "Test2\Test2.csproj", "{8C0E3528-82C3-48B4-83E8-515554554CBB}"
7 | EndProject
8 | Global
9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
10 | Debug|Any CPU = Debug|Any CPU
11 | Release|Any CPU = Release|Any CPU
12 | EndGlobalSection
13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
14 | {EF29CFFB-0A0E-495F-93AD-16157F9E826D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15 | {EF29CFFB-0A0E-495F-93AD-16157F9E826D}.Debug|Any CPU.Build.0 = Debug|Any CPU
16 | {EF29CFFB-0A0E-495F-93AD-16157F9E826D}.Release|Any CPU.ActiveCfg = Release|Any CPU
17 | {EF29CFFB-0A0E-495F-93AD-16157F9E826D}.Release|Any CPU.Build.0 = Release|Any CPU
18 | {8C0E3528-82C3-48B4-83E8-515554554CBB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
19 | {8C0E3528-82C3-48B4-83E8-515554554CBB}.Debug|Any CPU.Build.0 = Debug|Any CPU
20 | {8C0E3528-82C3-48B4-83E8-515554554CBB}.Release|Any CPU.ActiveCfg = Release|Any CPU
21 | {8C0E3528-82C3-48B4-83E8-515554554CBB}.Release|Any CPU.Build.0 = Release|Any CPU
22 | EndGlobalSection
23 | EndGlobal
24 |
--------------------------------------------------------------------------------
/tests/PortingAssistant.Client.UnitTests/TestXml/SolutionWithNugetConfigFile/Test1/Test1.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | netstandard2.0
5 |
6 |
7 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/tests/PortingAssistant.Client.UnitTests/TestXml/SolutionWithNugetConfigFile/Test2/Test2.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | netstandard2.0
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/tests/PortingAssistant.Client.UnitTests/TestXml/SolutionWithNugetConfigFile/nuget.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/tests/PortingAssistant.Client.UnitTests/TestXml/SolutionWithProjects/Nop.Core/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/tests/PortingAssistant.Client.UnitTests/TestXml/SolutionWithProjects/PortingAssistantApi/PortingAssistantApi.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | netcoreapp3.1
5 | false
6 |
7 |
8 |
9 |
10 | runtime; build; native; contentfiles; analyzers; buildtransitive
11 | all
12 |
13 |
14 |
15 | runtime; build; native; contentfiles; analyzers; buildtransitive
16 | all
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 | PreserveNewest
31 |
32 |
33 | PreserveNewest
34 |
35 |
36 | PreserveNewest
37 |
38 |
39 |
--------------------------------------------------------------------------------
/tests/PortingAssistant.Client.UnitTests/TestXml/SolutionWithProjects/PortingAssistantApiElectron/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/tests/PortingAssistant.Client.UnitTests/TestXml/SolutionWithProjects/PortingAssistantAssessment/PortingAssistantAssessment.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | netcoreapp3.1
5 | false
6 |
7 |
8 |
9 |
10 | runtime; build; native; contentfiles; analyzers; buildtransitive
11 | all
12 |
13 |
14 |
15 | runtime; build; native; contentfiles; analyzers; buildtransitive
16 | all
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 | PreserveNewest
31 |
32 |
33 | PreserveNewest
34 |
35 |
36 | PreserveNewest
37 |
38 |
39 |
--------------------------------------------------------------------------------
/tests/PortingAssistant.Client.UnitTests/TestXml/SolutionWithProjects/PortingAssistantCache/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/tests/PortingAssistant.Client.UnitTests/TestXml/SolutionWithProjects/SolutionWithProjects.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio 15
4 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PortingAssistantCache", "PortingAssistantCache\PortingAssistantCache.csproj", "{B1538334-C3E6-4521-A291-9038842B4EEB}"
5 | EndProject
6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PortingAssistantApi", "PortingAssistantApi\PortingAssistantApi.csproj", "{F7AB2408-8611-4386-B9C9-625C943E7ECD}"
7 | EndProject
8 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PortingAssistantAssessment", "PortingAssistantAssessment\PortingAssistantAssessment.csproj", "{CEF40EC4-B952-47D0-88ED-8D94D432479A}"
9 | EndProject
10 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PortingAssistantApiElectron", "PortingAssistantApiElectron\PortingAssistantApiElectron.csproj", "{BD666D95-074C-4D31-969A-B62B5A3E0D1E}"
11 | EndProject
12 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Nop.Core", "Nop.Core\Nop.Core.csproj", "{BD666D95-074C-4D31-969A-B62B5A3E0D1D}"
13 | EndProject
14 | Global
15 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
16 | Debug|Any CPU = Debug|Any CPU
17 | Release|Any CPU = Release|Any CPU
18 | EndGlobalSection
19 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
20 | {B1538334-C3E6-4521-A291-9038842B4EEB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
21 | {B1538334-C3E6-4521-A291-9038842B4EEB}.Debug|Any CPU.Build.0 = Debug|Any CPU
22 | {B1538334-C3E6-4521-A291-9038842B4EEB}.Release|Any CPU.ActiveCfg = Release|Any CPU
23 | {B1538334-C3E6-4521-A291-9038842B4EEB}.Release|Any CPU.Build.0 = Release|Any CPU
24 | {F7AB2408-8611-4386-B9C9-625C943E7ECD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
25 | {F7AB2408-8611-4386-B9C9-625C943E7ECD}.Debug|Any CPU.Build.0 = Debug|Any CPU
26 | {F7AB2408-8611-4386-B9C9-625C943E7ECD}.Release|Any CPU.ActiveCfg = Release|Any CPU
27 | {F7AB2408-8611-4386-B9C9-625C943E7ECD}.Release|Any CPU.Build.0 = Release|Any CPU
28 | {CEF40EC4-B952-47D0-88ED-8D94D432479A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
29 | {CEF40EC4-B952-47D0-88ED-8D94D432479A}.Debug|Any CPU.Build.0 = Debug|Any CPU
30 | {CEF40EC4-B952-47D0-88ED-8D94D432479A}.Release|Any CPU.ActiveCfg = Release|Any CPU
31 | {CEF40EC4-B952-47D0-88ED-8D94D432479A}.Release|Any CPU.Build.0 = Release|Any CPU
32 | {BD666D95-074C-4D31-969A-B62B5A3E0D1E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
33 | {BD666D95-074C-4D31-969A-B62B5A3E0D1E}.Debug|Any CPU.Build.0 = Debug|Any CPU
34 | {BD666D95-074C-4D31-969A-B62B5A3E0D1E}.Release|Any CPU.ActiveCfg = Release|Any CPU
35 | {BD666D95-074C-4D31-969A-B62B5A3E0D1E}.Release|Any CPU.Build.0 = Release|Any CPU
36 | EndGlobalSection
37 | EndGlobal
38 |
--------------------------------------------------------------------------------
/tests/PortingAssistant.Client.UnitTests/TestXml/TestNugetRepository/newtonsoft.json.12.0.3.nupkg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aws/porting-assistant-dotnet-client/a273c70e07eb66b467425a453b529c81d4b988ae/tests/PortingAssistant.Client.UnitTests/TestXml/TestNugetRepository/newtonsoft.json.12.0.3.nupkg
--------------------------------------------------------------------------------
/tests/PortingAssistant.Client.UnitTests/TestXml/TestNugetRepository/newtonsoft.json.6.0.1.nupkg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aws/porting-assistant-dotnet-client/a273c70e07eb66b467425a453b529c81d4b988ae/tests/PortingAssistant.Client.UnitTests/TestXml/TestNugetRepository/newtonsoft.json.6.0.1.nupkg
--------------------------------------------------------------------------------
/tests/PortingAssistant.Client.UnitTests/TestXml/TestPorting/corrupt/CorruptProject.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Debug
5 | AnyCPU
6 | 8.0.30703
7 | 2.0
8 | {6BDA8332-939F-45B7-A25E-7A797260AE59}
9 | Library
10 | Properties
11 | Nop.Core
12 | CorruptProject
13 | v4.5.1
14 | 512
15 |
16 |
17 |
18 | true
19 | full
20 | false
21 | bin\Debug\
22 | DEBUG;TRACE
23 | prompt
24 | 4
25 | false
26 |
27 |
28 | pdbonly
29 | true
30 | bin\Release\
31 | TRACE
32 | prompt
33 | 4
34 | false
35 |
36 |
37 |
38 | ..\..\packages\Newtonsoft.Json.9.0.1\lib\net45\Newtonsoft.Json.dll
39 | True
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
67 |
--------------------------------------------------------------------------------
/tests/PortingAssistant.Client.UnitTests/TestXml/TestPorting/corrupt/CorruptSolution.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio 14
4 | VisualStudioVersion = 14.0.23107.0
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Libraries", "Libraries", "{E4ACA93B-D3DE-4557-B069-F1DB42925A4B}"
7 | EndProject
8 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CorruptProject", "CorruptProject.csproj", "{6BDA8332-939F-45B7-A25E-7A797260AE59}"
9 | EndProject
10 | Global
11 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
12 | Debug|Any CPU = Debug|Any CPU
13 | Debug|Mixed Platforms = Debug|Mixed Platforms
14 | Debug|x86 = Debug|x86
15 | Release|Any CPU = Release|Any CPU
16 | Release|Mixed Platforms = Release|Mixed Platforms
17 | Release|x86 = Release|x86
18 | EndGlobalSection
19 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
20 | {6BDA8332-939F-45B7-A25E-7A797260AE59}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
21 | {6BDA8332-939F-45B7-A25E-7A797260AE59}.Debug|Any CPU.Build.0 = Debug|Any CPU
22 | {6BDA8332-939F-45B7-A25E-7A797260AE59}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
23 | {6BDA8332-939F-45B7-A25E-7A797260AE59}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
24 | {6BDA8332-939F-45B7-A25E-7A797260AE59}.Debug|x86.ActiveCfg = Debug|Any CPU
25 | {6BDA8332-939F-45B7-A25E-7A797260AE59}.Release|Any CPU.ActiveCfg = Release|Any CPU
26 | {6BDA8332-939F-45B7-A25E-7A797260AE59}.Release|Any CPU.Build.0 = Release|Any CPU
27 | {6BDA8332-939F-45B7-A25E-7A797260AE59}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
28 | {6BDA8332-939F-45B7-A25E-7A797260AE59}.Release|Mixed Platforms.Build.0 = Release|Any CPU
29 | {6BDA8332-939F-45B7-A25E-7A797260AE59}.Release|x86.ActiveCfg = Release|Any CPU
30 | EndGlobalSection
31 | GlobalSection(SolutionProperties) = preSolution
32 | HideSolutionNode = FALSE
33 | EndGlobalSection
34 | GlobalSection(NestedProjects) = preSolution
35 | {6BDA8332-939F-45B7-A25E-7A797260AE59} = {E4ACA93B-D3DE-4557-B069-F1DB42925A4B}
36 | EndGlobalSection
37 | GlobalSection(NDepend) = preSolution
38 | Project = ".\NopCommerce.ndproj"
39 | EndGlobalSection
40 | EndGlobal
41 |
--------------------------------------------------------------------------------
/tests/PortingAssistant.Client.UnitTests/TestXml/TestPorting/corrupt/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/tests/PortingAssistant.Client.UnitTests/TestXml/TestPorting/src/Libraries/Nop.Core/Nop.Core.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Debug
5 | AnyCPU
6 | 8.0.30703
7 | 2.0
8 | {6BDA8332-939F-45B7-A25E-7A797260AE59}
9 | Library
10 | Properties
11 | Nop.Core
12 | Nop.Core
13 | v4.5.1
14 | 512
15 |
16 |
17 |
18 | true
19 | full
20 | false
21 | bin\Debug\
22 | DEBUG;TRACE
23 | prompt
24 | 4
25 | false
26 |
27 |
28 | pdbonly
29 | true
30 | bin\Release\
31 | TRACE
32 | prompt
33 | 4
34 | false
35 |
36 |
37 |
38 | ..\..\packages\Newtonsoft.Json.13.0.1\lib\net45\Newtonsoft.Json.dll
39 | True
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
67 |
--------------------------------------------------------------------------------
/tests/PortingAssistant.Client.UnitTests/TestXml/TestPorting/src/Libraries/Nop.Core/Program.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aws/porting-assistant-dotnet-client/a273c70e07eb66b467425a453b529c81d4b988ae/tests/PortingAssistant.Client.UnitTests/TestXml/TestPorting/src/Libraries/Nop.Core/Program.cs
--------------------------------------------------------------------------------
/tests/PortingAssistant.Client.UnitTests/TestXml/TestPorting/src/Libraries/Nop.Core/app.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/tests/PortingAssistant.Client.UnitTests/TestXml/TestPorting/src/Libraries/Nop.Core/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/tests/PortingAssistant.Client.UnitTests/TestXml/TestPorting/src/NopCommerce.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio 14
4 | VisualStudioVersion = 14.0.23107.0
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Libraries", "Libraries", "{E4ACA93B-D3DE-4557-B069-F1DB42925A4B}"
7 | EndProject
8 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Nop.Core", "Libraries\Nop.Core\Nop.Core.csproj", "{6BDA8332-939F-45B7-A25E-7A797260AE59}"
9 | EndProject
10 | Global
11 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
12 | Debug|Any CPU = Debug|Any CPU
13 | Debug|Mixed Platforms = Debug|Mixed Platforms
14 | Debug|x86 = Debug|x86
15 | Release|Any CPU = Release|Any CPU
16 | Release|Mixed Platforms = Release|Mixed Platforms
17 | Release|x86 = Release|x86
18 | EndGlobalSection
19 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
20 | {6BDA8332-939F-45B7-A25E-7A797260AE59}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
21 | {6BDA8332-939F-45B7-A25E-7A797260AE59}.Debug|Any CPU.Build.0 = Debug|Any CPU
22 | {6BDA8332-939F-45B7-A25E-7A797260AE59}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
23 | {6BDA8332-939F-45B7-A25E-7A797260AE59}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
24 | {6BDA8332-939F-45B7-A25E-7A797260AE59}.Debug|x86.ActiveCfg = Debug|Any CPU
25 | {6BDA8332-939F-45B7-A25E-7A797260AE59}.Release|Any CPU.ActiveCfg = Release|Any CPU
26 | {6BDA8332-939F-45B7-A25E-7A797260AE59}.Release|Any CPU.Build.0 = Release|Any CPU
27 | {6BDA8332-939F-45B7-A25E-7A797260AE59}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
28 | {6BDA8332-939F-45B7-A25E-7A797260AE59}.Release|Mixed Platforms.Build.0 = Release|Any CPU
29 | {6BDA8332-939F-45B7-A25E-7A797260AE59}.Release|x86.ActiveCfg = Release|Any CPU
30 | EndGlobalSection
31 | GlobalSection(SolutionProperties) = preSolution
32 | HideSolutionNode = FALSE
33 | EndGlobalSection
34 | GlobalSection(NestedProjects) = preSolution
35 | {6BDA8332-939F-45B7-A25E-7A797260AE59} = {E4ACA93B-D3DE-4557-B069-F1DB42925A4B}
36 | EndGlobalSection
37 | GlobalSection(NDepend) = preSolution
38 | Project = ".\NopCommerce.ndproj"
39 | EndGlobalSection
40 | EndGlobal
41 |
--------------------------------------------------------------------------------
/tests/PortingAssistant.Client.UnitTests/TestXml/VBSolutionWithApi/VBSolutionWithApi.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio Version 16
4 | VisualStudioVersion = 16.0.32510.428
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{778DAE3C-4631-46EA-AA77-85C1314464D9}") = "VBtestproject", "VBtestproject\VBtestproject.vbproj", "{B6F200EF-1FAA-4F53-9819-02014D78712E}"
7 | EndProject
8 | Global
9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
10 | Debug|Any CPU = Debug|Any CPU
11 | Release|Any CPU = Release|Any CPU
12 | EndGlobalSection
13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
14 | {B6F200EF-1FAA-4F53-9819-02014D78712E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15 | {B6F200EF-1FAA-4F53-9819-02014D78712E}.Debug|Any CPU.Build.0 = Debug|Any CPU
16 | {B6F200EF-1FAA-4F53-9819-02014D78712E}.Release|Any CPU.ActiveCfg = Release|Any CPU
17 | {B6F200EF-1FAA-4F53-9819-02014D78712E}.Release|Any CPU.Build.0 = Release|Any CPU
18 | EndGlobalSection
19 | GlobalSection(SolutionProperties) = preSolution
20 | HideSolutionNode = FALSE
21 | EndGlobalSection
22 | GlobalSection(ExtensibilityGlobals) = postSolution
23 | SolutionGuid = {F4B05B5D-BE93-4593-8725-DEC8974FE95A}
24 | EndGlobalSection
25 | EndGlobal
26 |
--------------------------------------------------------------------------------
/tests/PortingAssistant.Client.UnitTests/TestXml/VBSolutionWithApi/VBtestproject/Program.vb:
--------------------------------------------------------------------------------
1 | Imports System
2 | Imports Newtonsoft.Json
3 |
4 | Namespace Test2
5 | Class Program
6 | Private Shared Sub print()
7 | Dim macbook = New Computer With {
8 | .Vendor = "apple Inc",
9 | .produceDate = New DateTime(),
10 | .price = "1200$"
11 | }
12 | Dim json As String = JsonConvert.SerializeObject(macbook)
13 | Console.WriteLine("my new computer is {0}", json)
14 | End Sub
15 |
16 | Public Class Computer
17 | Public Property Vendor As String
18 | Public Property produceDate As DateTime
19 | Public Property price As String
20 | End Class
21 | End Class
22 | End Namespace
23 |
--------------------------------------------------------------------------------
/tests/PortingAssistant.Client.UnitTests/TestXml/VBSolutionWithApi/VBtestproject/VBtestproject.vbproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | VBtestproject
5 | netcoreapp3.1
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/tests/PortingAssistant.Compatibility.Core.Tests/PortingAssistant.Compatibility.Core.Tests.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | net6.0
5 | enable
6 | enable
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
--------------------------------------------------------------------------------
/tests/PortingAssistant.Compatibility.Core.Tests/UnitTests/NugetVersionHelperTest.cs:
--------------------------------------------------------------------------------
1 | using NuGet.Versioning;
2 | using NUnit.Framework;
3 | using PortingAssistant.Compatibility.Common.Utils;
4 |
5 | namespace PortingAssistant.Compatibility.Core.Tests.UnitTests
6 | {
7 | public class NugetVersionHelperTest
8 | {
9 | [Test]
10 | public void GetMaxVersion_Returns_Largest_Version()
11 | {
12 | var expectedResult = NuGetVersion.Parse("3.0.0");
13 | var actualResult = NugetVersionHelper.GetMaxVersion(new List
14 | {
15 | "1.0.0",
16 | "2.1.0",
17 | "3.0.0",
18 | "2.9.0"
19 | });
20 |
21 | Assert.AreEqual(expectedResult.ToString(), actualResult.ToString());
22 | }
23 |
24 | [Test]
25 | public void GetMaxVersion_Returns_Null_When_Input_Is_Empty()
26 | {
27 | var actualResult = NugetVersionHelper.GetMaxVersion(new List());
28 | Assert.IsNull(actualResult);
29 | }
30 |
31 | [Test]
32 | public void HasLowerCompatibleVersionWithSameMajor_Returns_True_With_LowerCompatibleVersionWithSameMajor()
33 | {
34 | var nugetVersion = NuGetVersion.Parse("3.1.0");
35 | var actualResult = NugetVersionHelper.HasLowerCompatibleVersionWithSameMajor(nugetVersion, new List
36 | {
37 | "3.0.0"
38 | });
39 | Assert.IsTrue(actualResult);
40 | }
41 |
42 | [Test]
43 | public void HasLowerCompatibleVersionWithSameMajor_Returns_False_Without_LowerCompatibleVersionWithSameMajor()
44 | {
45 | var nugetVersion = NuGetVersion.Parse("3.1.0");
46 | var actualResult = NugetVersionHelper.HasLowerCompatibleVersionWithSameMajor(nugetVersion, new List
47 | {
48 | "2.9.0",
49 | "3.2.0"
50 | });
51 | Assert.IsFalse(actualResult);
52 | }
53 | }
54 | }
55 |
--------------------------------------------------------------------------------
/tests/PortingAssistant.Compatibility.Core.Tests/UnitTests/RecommendationActionTest.cs:
--------------------------------------------------------------------------------
1 | using Microsoft.Extensions.Logging;
2 | using Moq;
3 | using NUnit.Framework;
4 | using PortingAssistant.Compatibility.Common.Interface;
5 |
6 | namespace PortingAssistant.Compatibility.Core.Tests.UnitTests
7 | {
8 | public class RecommendationActionTest
9 | {
10 | private Mock _httpService;
11 | private ICompatibilityCheckerRecommendationActionHandler _compatibilityCheckerRecommendationActionHandler;
12 | private Mock _loggerMock;
13 |
14 | [OneTimeSetUp]
15 | public void OneTimeSetup()
16 | {
17 | _httpService = new Mock();
18 | }
19 |
20 | [SetUp]
21 | public void Setup()
22 | {
23 | _compatibilityCheckerRecommendationActionHandler = new CompatibilityCheckerRecommendationActionHandler(
24 | _httpService.Object, Mock.Of>());
25 |
26 | _loggerMock.Reset();
27 | }
28 |
29 | [Test]
30 | public async Task GetRecommendationAction_NamespaceNotFound_Return404Exception()
31 | {
32 | _httpService
33 | .Setup(transfer => transfer.DownloadS3FileAsync(It.IsAny()))
34 | .ThrowsAsync(new Exception("404 not found"));
35 |
36 | IEnumerable namepaces = new List() { "test.namespace" };
37 | var resultTasks = await _compatibilityCheckerRecommendationActionHandler.GetRecommendationActionFileAsync( namepaces);
38 |
39 | Assert.AreEqual(1, resultTasks.Count);
40 | Assert.IsNull(resultTasks[namepaces.First()]);
41 | _loggerMock.Verify(mock => mock.LogInformation(It.IsAny()), Times.Once);
42 | _loggerMock.Verify(mock => mock.LogError(It.IsAny()), Times.Never);
43 | }
44 |
45 | [Test]
46 | public async Task GetRecommendationAction_ReturnOtherException()
47 | {
48 | _httpService
49 | .Setup(transfer => transfer.DownloadS3FileAsync(It.IsAny()))
50 | .ThrowsAsync(new Exception("error"));
51 |
52 | IEnumerable namepaces = new List() { "test.namespace" };
53 | var resultTasks = await _compatibilityCheckerRecommendationActionHandler.GetRecommendationActionFileAsync( namepaces);
54 |
55 | Assert.AreEqual(1, resultTasks.Count);
56 | Assert.IsNull(resultTasks[namepaces.First()]);
57 | _loggerMock.Verify(mock => mock.LogInformation(It.IsAny()), Times.Never);
58 | _loggerMock.Verify(mock => mock.LogError(It.IsAny()), Times.Once);
59 | }
60 | }
61 | }
62 |
--------------------------------------------------------------------------------
/version.json:
--------------------------------------------------------------------------------
1 | {
2 | "$schema": "https://raw.githubusercontent.com/dotnet/Nerdbank.GitVersioning/main/src/NerdBank.GitVersioning/version.schema.json",
3 | "version": "3.2-alpha",
4 | "publicReleaseRefSpec": [
5 | "^refs/heads/release/v\\d+(?:\\.\\d+)?$"
6 | ],
7 | "cloudBuild": {
8 | "buildNumber": {
9 | "enabled": true
10 | }
11 | },
12 | "release": {
13 | "branchName": "release/v{version}"
14 | }
15 | }
--------------------------------------------------------------------------------