-
Notifications
You must be signed in to change notification settings - Fork 388
Make the project function with .Net Framework classes again #286
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
Make the project function with .Net Framework classes again #286
Conversation
Codecov Report
@@ Coverage Diff @@
## master #286 +/- ##
=======================================
Coverage 88.85% 88.85%
=======================================
Files 16 16
Lines 1875 1875
=======================================
Hits 1666 1666
Misses 209 209
Continue to review full report at Codecov.
|
src/coverlet.core/Coverage.cs
Outdated
@@ -300,5 +300,18 @@ private string GetSourceLinkUrl(Dictionary<string, string> sourceLinkDocuments, | |||
url = sourceLinkDocuments[keyWithBestMatch]; | |||
return url.Replace("*", replacement); | |||
} | |||
|
|||
// This is coming to .NET Standard 2.1 as part of Path | |||
private static string GetRelativePath(string relativeTo, string path) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Move this method into a PathHelper
class. See diff in this for an example https://github.com/tonerdo/coverlet/compare/remove-netcoreapp-dep?expand=1. That was me taking a stab at fixing this, feel free to ignore the implementation and just follow the structure
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add unit tests as well
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I started to go through unit tests that the corefx team had and adapting them to my code
I found that mine didn't handle unix based paths correctly.
The code you had also failed some of those unit tests.
I ended up creating a .netstandard template library which allows the injected template to work in .NET Framework classes.
|
||
<PropertyGroup> | ||
<OutputType>Library</OutputType> | ||
<TargetFramework>netcoreapp2.0</TargetFramework> | ||
<TargetFramework>netstandard2.0</TargetFramework> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also switch coverlet.msbuild.tasks.csproj
back to netstandard2.0
6433c4b
to
cd2ec73
Compare
@glennawatson I'm curious how your new approach fixes this issue. Care to elaborate? |
@tonerdo The issue hasn't been that the injected instrumented class (because you've been hiding xunit's outut this has been obscured as part of other people's issues by not pushing out stderror) For example if I run against a .NET framework I get
The fact that your msbuild task nor the application are .NET core haven't been the issue. The new approach basically allows cecil to inject the dependencies based on .net standard rather than the .NET core ones. |
Essentially since the new template project is .NET standard when you call |
@tonerdo Any movement on this one? I can go back to a .net standard approach if you want and go through the work to make the PathHelper class work with sample paths, but this resolves all those issues. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
This fixes #285, fixes #274 and fixes #272
Changed back to using a .NET Standard project for the coverlet.core. Allows for more targets (eg Xamarin based targets too potentially).
Also do some redirecting of StdError for the process output, xunit for example sends errors there, and put them into the log.
.NET STandard 2.1 adds RelativePath() so using a place holder until that comes out.