-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added support for setting the target framework for projects with mult…
…iple target frameworks, fixes #76
- Loading branch information
Showing
15 changed files
with
238 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
Source/AsyncGenerator.TestProjects/MultiTargetFrameworks.sln
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
|
||
Microsoft Visual Studio Solution File, Format Version 12.00 | ||
# Visual Studio 15 | ||
VisualStudioVersion = 15.0.27130.0 | ||
MinimumVisualStudioVersion = 10.0.40219.1 | ||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MultiTargetFrameworks", "MultiTargetFrameworks\MultiTargetFrameworks.csproj", "{794C5BC3-7A73-4C7E-885F-085275A02B5B}" | ||
EndProject | ||
Global | ||
GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||
Debug|Any CPU = Debug|Any CPU | ||
Release|Any CPU = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(ProjectConfigurationPlatforms) = postSolution | ||
{794C5BC3-7A73-4C7E-885F-085275A02B5B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{794C5BC3-7A73-4C7E-885F-085275A02B5B}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{794C5BC3-7A73-4C7E-885F-085275A02B5B}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{794C5BC3-7A73-4C7E-885F-085275A02B5B}.Release|Any CPU.Build.0 = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(SolutionProperties) = preSolution | ||
HideSolutionNode = FALSE | ||
EndGlobalSection | ||
GlobalSection(ExtensibilityGlobals) = postSolution | ||
SolutionGuid = {6F5C3A8F-1BF9-4D5A-BA6B-47E6EA3D546E} | ||
EndGlobalSection | ||
EndGlobal |
11 changes: 11 additions & 0 deletions
11
Source/AsyncGenerator.TestProjects/MultiTargetFrameworks/MultiTargetFrameworks.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<TargetFrameworks>netcoreapp2.0;net461</TargetFrameworks> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="nunit" Version="3.7.1" /> | ||
</ItemGroup> | ||
|
||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,135 @@ | ||
using System; | ||
using System.Diagnostics; | ||
using System.Linq; | ||
using System.Threading.Tasks; | ||
using AsyncGenerator.Analyzation; | ||
using AsyncGenerator.Configuration; | ||
using AsyncGenerator.Core; | ||
using AsyncGenerator.Core.Plugins; | ||
using NUnit.Framework; | ||
|
||
namespace AsyncGenerator.Tests.TargetFramework | ||
{ | ||
[TestFixture] | ||
public class Fixture : BaseFixture | ||
{ | ||
[OneTimeSetUp] | ||
public void Restore() | ||
{ | ||
var process = new Process(); | ||
var startInfo = new ProcessStartInfo | ||
{ | ||
WindowStyle = ProcessWindowStyle.Hidden, | ||
FileName = "cmd.exe", | ||
Arguments = $"/C dotnet restore {GetTestSolutionPath("MultiTargetFrameworks")}" | ||
}; | ||
process.StartInfo = startInfo; | ||
process.Start(); | ||
} | ||
|
||
[Test] | ||
public Task TestSolution() | ||
{ | ||
var config = AsyncCodeConfiguration.Create() | ||
.ConfigureSolution(GetTestSolutionPath("MultiTargetFrameworks"), s => s | ||
.TargetFramework("net461") | ||
.ApplyChanges(false) | ||
.ConfigureProject("MultiTargetFrameworks", p => p | ||
.RegisterPlugin<NUnitAsyncCounterpartsFinder>())); | ||
|
||
return AsyncCodeGenerator.GenerateAsync(config); | ||
} | ||
|
||
[Test] | ||
public Task TestProject() | ||
{ | ||
var config = AsyncCodeConfiguration.Create() | ||
.ConfigureProject(GetTestProjectPath("MultiTargetFrameworks"), p => p | ||
.TargetFramework("net461") | ||
.ApplyChanges(false) | ||
.RegisterPlugin<NUnitAsyncCounterpartsFinder>()); | ||
|
||
return AsyncCodeGenerator.GenerateAsync(config); | ||
} | ||
|
||
[Test] | ||
public Task TestYamlSolution() | ||
{ | ||
var config = ConfigureByYaml( | ||
$@" | ||
solution: | ||
filePath: {GetTestSolutionPath("MultiTargetFrameworks")} | ||
targetFramework: net461 | ||
applyChanges: false | ||
projects: | ||
- name: MultiTargetFrameworks | ||
registerPlugin: | ||
- type: AsyncGenerator.Core.Plugins.NUnitAsyncCounterpartsFinder | ||
assemblyName: AsyncGenerator.Core | ||
"); | ||
|
||
return AsyncCodeGenerator.GenerateAsync(config); | ||
} | ||
|
||
[Test] | ||
public Task TestYamlProject() | ||
{ | ||
var config = ConfigureByYaml( | ||
$@" | ||
projects: | ||
- filePath: {GetTestProjectPath("MultiTargetFrameworks")} | ||
targetFramework: net461 | ||
applyChanges: false | ||
registerPlugin: | ||
- type: AsyncGenerator.Core.Plugins.NUnitAsyncCounterpartsFinder | ||
assemblyName: AsyncGenerator.Core | ||
"); | ||
|
||
return AsyncCodeGenerator.GenerateAsync(config); | ||
} | ||
|
||
[Test] | ||
public Task TestXmlSolution() | ||
{ | ||
var config = ConfigureByXml( | ||
$@" | ||
<AsyncGenerator xmlns=""https://github.com/maca88/AsyncGenerator""> | ||
<Solution filePath=""{GetTestSolutionPath("MultiTargetFrameworks")}""> | ||
<ApplyChanges>false</ApplyChanges> | ||
<TargetFramework>net461</TargetFramework> | ||
<Projects> | ||
<Project name=""MultiTargetFrameworks""> | ||
<RegisterPlugin> | ||
<Plugin type=""AsyncGenerator.Core.Plugins.NUnitAsyncCounterpartsFinder"" assemblyName=""AsyncGenerator.Core"" /> | ||
</RegisterPlugin> | ||
</Project> | ||
</Projects> | ||
</Solution> | ||
</AsyncGenerator> | ||
"); | ||
|
||
return AsyncCodeGenerator.GenerateAsync(config); | ||
} | ||
|
||
[Test] | ||
public Task TestXmlProject() | ||
{ | ||
var config = ConfigureByXml( | ||
$@" | ||
<AsyncGenerator xmlns=""https://github.com/maca88/AsyncGenerator""> | ||
<Projects> | ||
<Project filePath=""{GetTestProjectPath("MultiTargetFrameworks")}""> | ||
<ApplyChanges>false</ApplyChanges> | ||
<TargetFramework>net461</TargetFramework> | ||
<RegisterPlugin> | ||
<Plugin type=""AsyncGenerator.Core.Plugins.NUnitAsyncCounterpartsFinder"" assemblyName=""AsyncGenerator.Core"" /> | ||
</RegisterPlugin> | ||
</Project> | ||
</Projects> | ||
</AsyncGenerator> | ||
"); | ||
|
||
return AsyncCodeGenerator.GenerateAsync(config); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.