Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve build tasks packaging #299

Merged
merged 9 commits into from
Mar 1, 2019

Conversation

sharwell
Copy link
Contributor

@sharwell sharwell commented Jan 16, 2019

  • Create the coverlet.msbuild.nupkg package as a primary build output of coverlet.msbuild.tasks
  • Split coverlet.msbuild.tasks into netstandard2.0 (or netcoreapp2.0) and net472 target frameworks
  • (optional) Attach the .nupkg files as artifacts of the AppVeyor build
  • (optional) Use Nerdbank.GitVersioning to dramatically simplify the versioning process for the whole project (submitted as Use Nerdbank.GitVersioning #301)

This change will allow the build-time instrumentation to work with both dotnet msbuild (works already using .NET Core as the host runtime) and msbuild (currently fails using .NET Framework as the host runtime). The strategy will be similar to the one I use for ANTLR, except much simpler because I don't need to account for very old hosts like MSBuild 4.0.

I verified that c35018a produces the same output assembly that shipped as 2.5.0 on NuGet except for the following changes:

  1. A few additional PDB files are included (not a problem)
  2. coverlet.template.dll is included (even if unnecessary, it's very small, but let me know if this needs to be removed)
  3. The coverlet.msbuild.props and coverlet.msbuild.targets files are moved up a folder, so they are included in the build regardless of the target framework of the project using coverlet

@codecov
Copy link

codecov bot commented Jan 16, 2019

Codecov Report

Merging #299 into master will decrease coverage by 0.02%.
The diff coverage is 0%.

@@            Coverage Diff             @@
##           master     #299      +/-   ##
==========================================
- Coverage    87.1%   87.07%   -0.03%     
==========================================
  Files          31       31              
  Lines        3033     3034       +1     
==========================================
  Hits         2642     2642              
- Misses        391      392       +1

@sharwell sharwell force-pushed the cleaner-build branch 3 times, most recently from d0233d8 to 99c539c Compare January 16, 2019 13:40
@sharwell sharwell changed the title [WIP] Improve build tasks packaging Improve build tasks packaging Jan 16, 2019
@sharwell sharwell changed the title Improve build tasks packaging [WIP] Improve build tasks packaging Jan 16, 2019
@sharwell
Copy link
Contributor Author

Marked as WIP while I rebase to account for recent merges.

@sharwell sharwell changed the title [WIP] Improve build tasks packaging Improve build tasks packaging Jan 16, 2019
@sharwell
Copy link
Contributor Author

@tonerdo This is now updated. GitHub will detect a trivial conflict between this and #303, so when you merge one I'll update the other to account for the change.

@ViktorHofer
Copy link
Contributor

What's the reason that coverlet.msbuild cross-compiles against net472 but not coverlet.console?

@ViktorHofer
Copy link
Contributor

Wouldn't it also make sense to merge coverlet.msbuild and coverlet.msbuild.tasks into one folder?

@sharwell
Copy link
Contributor Author

sharwell commented Jan 17, 2019

What's the reason that coverlet.msbuild cross-compiles against net472 but not coverlet.console?

I haven't done any work to get coverlet.console working differently. This pull request is about making MSBuild-based instrumentation work on .NET Framework builds.

Wouldn't it also make sense to merge coverlet.msbuild and coverlet.msbuild.tasks into one folder?

Perhaps, but it also seems fine to leave as a follow-up item. Edit: this is now done in e4b29b4.

@ViktorHofer
Copy link
Contributor

Oh right. Coverlet.Console is a global tool, that's why it never supported .NET Framework.

@ViktorHofer
Copy link
Contributor

@tonerdo as we now cross-compile coverlet.core and coverlet.template here I propose to undo the unnecessary coverlet.template project and move the template back into core.

@sharwell
Copy link
Contributor Author

as we now cross-compile coverlet.core and coverlet.template here I propose to undo the unnecessary coverlet.template project and move the template back into core.

I do have a remaining concern that's difficult to validate prior to some of the unmerged pull requests. This pull request separates the instrumentation task according to host runtime (msbuild vs. dotnet msbuild). However, the target framework of the individual projects might also come into play, and I haven't yet verified all the combinations there.

@ViktorHofer
Copy link
Contributor

ok fine. Let's keep it in mind.

@sharwell sharwell mentioned this pull request Jan 24, 2019
@viceice
Copy link
Contributor

viceice commented Jan 30, 2019

Any timeframe when this will be merged and released? I really need that this. 😀

@ViktorHofer
Copy link
Contributor

@sharwell can you please resolve the conflicts

@ViktorHofer
Copy link
Contributor

@tonerdo can we please get this into master after the conflicts are resolved? would be great.

@tonerdo
Copy link
Collaborator

tonerdo commented Feb 9, 2019

@ViktorHofer I'll need to get some time to take a closer look at this after the conflicts are fixed. Been quite busy with work lately

@sharwell
Copy link
Contributor Author

sharwell commented Feb 9, 2019

@tonerdo I fixed the conflicts

<!-- Build tasks should not be added to the lib folder. -->
<IncludeBuildOutput>false</IncludeBuildOutput>
<IncludeSymbols>true</IncludeSymbols>
<IncludeSources>true</IncludeSources>
Copy link
Collaborator

Choose a reason for hiding this comment

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

Any reason we're including symbols and sources?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It can improve the debugging experience if needed. We can alter the way this is included in a future PR if desired.


if (relativePath.Contains("..")) continue;
var relativePath = Path.GetDirectoryName(document).Substring(Path.GetDirectoryName(key).Length + 1);
Copy link
Collaborator

Choose a reason for hiding this comment

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

If this is indeed a functional workaround to using Path.GetRelativePath then we can make coverlet.msbuild be fully compliant with netcoreapp2.0 and net472 frameworks by making it target netstandard2.0 instead

Copy link
Collaborator

@tonerdo tonerdo Feb 23, 2019

Choose a reason for hiding this comment

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

To my knowledge Coverlet worked quite well with net472 when the target was netstandard2.0. Only got issues when I changed it to netcoreapp2.0

Copy link
Contributor

Choose a reason for hiding this comment

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

It is even working with net35

Copy link
Collaborator

Choose a reason for hiding this comment

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

@sharwell are you still able to this? If not, I'll just merge it in and make the necessary changes if that's alright with you

Copy link
Collaborator

Choose a reason for hiding this comment

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

Thanks for your help so far

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@tonerdo I wanted to merge this one like this, then update and merge #301, and only then start to focus on enabling .NET Framework scenarios. Currently testing for the latter is completely blocked so I can't say for sure what will or will not work.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I'd prefer if it gets done in this PR. #301 might take a bit to get through and I want the next release (which I want to happen this week) to fix the .NET Framework issue

Copy link
Contributor Author

@sharwell sharwell Mar 1, 2019

Choose a reason for hiding this comment

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

I'm not sure I'll have time to make and test this modification. I'll try to get it done tomorrow morning though (produce one netstandard2.0 assembly, which is included twice in the resulting package under two different paths).

Copy link
Collaborator

Choose a reason for hiding this comment

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

No worries. I'll go ahead and merge this and effect the necessary changes. Thank you so much for all your work on this

@zsd4yr
Copy link

zsd4yr commented Mar 1, 2019

Just wanted to chime in and say that I am trying to get code coverage setup for https://github.com/dotnet/winforms, and I am blocked until this gets in

@tonerdo tonerdo merged commit f4aa259 into coverlet-coverage:master Mar 1, 2019
@sharwell sharwell deleted the cleaner-build branch March 1, 2019 11:47
@tonerdo tonerdo mentioned this pull request Mar 3, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants