Skip to content

Multi-target more projects used by unit tests#43836

Merged
RikkiGibson merged 6 commits intodotnet:masterfrom
RikkiGibson:single-build-cs
May 4, 2020
Merged

Multi-target more projects used by unit tests#43836
RikkiGibson merged 6 commits intodotnet:masterfrom
RikkiGibson:single-build-cs

Conversation

@RikkiGibson
Copy link
Member

@RikkiGibson RikkiGibson commented Apr 30, 2020

Related to #43805

This change makes it so when you edit sources in Microsoft.CodeAnalysis.CSharp and incrementally build a test project, you only need to build Microsoft.CodeAnalysis.CSharp and everything in between once in netcoreapp3.1 instead of needing to build both netcoreapp3.1 and netstandard2.0 flavors.

When I edit a file in Microsoft.CodeAnalysis.CSharp and incrementally build a test project on my machine, this PR reduces the build time from ~14 seconds to ~8 seconds. Here's the command I used:

.\.dotnet\dotnet.exe msbuild .\src\Compilers\CSharp\Test\Symbol\ -p:TargetFramework=netcoreapp3.1 -p:UseRoslynAnalyzers=false

@RikkiGibson RikkiGibson requested a review from a team as a code owner April 30, 2020 18:18
@RikkiGibson RikkiGibson requested review from a team as code owners April 30, 2020 23:56
@RikkiGibson RikkiGibson requested a review from a team as a code owner April 30, 2020 23:57
@RikkiGibson RikkiGibson requested a review from 333fred May 1, 2020 17:15
<DisableImplicitNuGetFallbackFolder>true</DisableImplicitNuGetFallbackFolder>
<ToolsetPackagesDir>$(RepoRoot)build\ToolsetPackages\</ToolsetPackagesDir>
<RoslynPortableTargetFrameworks>netcoreapp3.1;net472</RoslynPortableTargetFrameworks>
<RoslynLibraryTargetFrameworks>netcoreapp3.1;netstandard2.0</RoslynLibraryTargetFrameworks>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I prefer that we not use MSBuild properties for our TargetFramework groups. It makes the projects themselves harder to read. I do understand I am the one who created the original groups but ended up deleting them later because I didn't really think it was worth the cost here.

<OutputType>Library</OutputType>
<RootNamespace>Roslyn.Test.PdbUtilities</RootNamespace>
<TargetFramework>netstandard2.0</TargetFramework>
<TargetFrameworks>$(RoslynLibraryTargetFrameworks)</TargetFrameworks>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change means that when you build for netcoreapp3.1 then yes you get the single TF build experience. But when you build for net472 you still build all TF. Why did we not change this to multi-target between net472 and netcoreapp3.1 instead?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

MS.CA.CSharp.Test.Utilities and MS.CA.VisualBasic.Test.Utilities depend on this. We could make those target 'netcoreapp3.1;net472' as well. Let me know if I had the right idea in 56f5b10.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would go ahead and move those to netcoreapp3.1;net472. If we're going to do this lets commit to it and do it right.

Copy link
Member

@jaredpar jaredpar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we should add new MSBuild property groups here. I rejected this approach with reason when we initially flipped to multi-targeting large parts of our code. It ends up making the consuming code harder to read.

@jaredpar
Copy link
Member

jaredpar commented May 4, 2020

Once you get this merged I'll remove the existing MSBuild property here that is leading people down the wrong path here.

Copy link
Member

@jaredpar jaredpar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment to make GitHub happy

@RikkiGibson
Copy link
Member Author

@jaredpar do you want me to change new usages of $(RoslynPortableTargetFrameworks) to netcoreapp3.1;net472 in this PR, or just let you do it in the mop-up PR?

@jaredpar
Copy link
Member

jaredpar commented May 4, 2020

@RikkiGibson

do you want me to change new usages of $(RoslynPortableTargetFrameworks) to netcoreapp3.1;net472 in this PR, or just let you do it in the mop-up PR?

Definitely okay with you doing the work 😄

@RikkiGibson
Copy link
Member Author

@jaredpar please let me know if further changes are required to this PR. You still have this one marked 'changes requested'.

@RikkiGibson RikkiGibson merged commit aa8c553 into dotnet:master May 4, 2020
@ghost ghost added this to the Next milestone May 4, 2020
@RikkiGibson RikkiGibson deleted the single-build-cs branch May 4, 2020 21:06
@JoeRobich JoeRobich removed this from the Next milestone May 18, 2020
@JoeRobich JoeRobich added this to the 16.7.P2 milestone May 18, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants