1
1
#tool "nuget:?package=GitVersion.CommandLine"
2
2
#tool "nuget:?package=xunit.runner.console"
3
- #tool "nuget:?package=OpenCover "
4
- #tool "nuget:?package=coveralls.net "
3
+ #tool "nuget:?package=JetBrains.dotCover.CommandLineTools "
4
+ #tool "nuget:?package=coveralls.io.dotcover "
5
5
#addin "Cake.Coveralls" ;
6
6
7
7
var target = Argument ( "target" , "Default" ) ;
@@ -26,7 +26,10 @@ Task("Build")
26
26
. Does ( ( ) =>
27
27
{
28
28
foreach ( var project in GetFiles ( "src/*/*.csproj" ) . Concat ( GetFiles ( "test/*/*.csproj" ) ) )
29
- DotNetCoreBuild ( project . FullPath ) ;
29
+ DotNetCoreBuild ( project . FullPath , new DotNetCoreBuildSettings
30
+ {
31
+ Configuration = configuration
32
+ } ) ;
30
33
} ) ;
31
34
32
35
Task ( "Test" )
@@ -42,41 +45,76 @@ Task("Test")
42
45
Arguments = new ProcessArgumentBuilder ( )
43
46
. Append ( "xunit" )
44
47
. Append ( "-noshadow" )
48
+ . AppendSwitch ( "-configuration" , configuration )
45
49
. AppendSwitchQuotedSecret ( "-xml" , string . Format ( "{0}/tests/{1}.xml" , artifacts , testProject . GetFilenameWithoutExtension ( ) ) )
46
50
. AppendSwitchQuotedSecret ( "-html" , string . Format ( "{0}/tests/{1}.html" , artifacts , testProject . GetFilenameWithoutExtension ( ) ) )
47
51
} ) ;
48
52
}
49
53
} ) ;
50
54
51
55
Task ( "Coverage" )
52
- . IsDependentOn ( "Build" )
56
+ // .IsDependentOn("Build")
53
57
. Does ( ( ) =>
54
58
{
59
+ CleanDirectory ( artifacts + "/coverage" ) ;
55
60
EnsureDirectoryExists ( artifacts + "/coverage" ) ;
56
61
57
62
foreach ( var testProject in GetFiles ( "test/*/*.csproj" ) ) {
58
- OpenCover ( tool => {
63
+ DotCoverCover ( tool => {
64
+ // tool.XUnit2()
65
+ // tool.StartProcess(Context.Tools.Resolve("dotnet.exe"), new ProcessSettings() {
66
+ // WorkingDirectory = testProject.GetDirectory(),
67
+ // Arguments = new ProcessArgumentBuilder()
68
+ // .Append("test")
69
+ // .AppendSwitch("-c", configuration)
70
+ // .Append("--no-build")
71
+ // .Append("-f net46")
72
+ // });
59
73
tool . StartProcess ( Context . Tools . Resolve ( "dotnet.exe" ) , new ProcessSettings ( ) {
60
74
WorkingDirectory = testProject . GetDirectory ( ) ,
61
75
Arguments = new ProcessArgumentBuilder ( )
62
- . Append ( "test" )
63
- . Append ( "--no-build" )
64
- . Append ( "-f net46" )
65
-
76
+ . Append ( "xunit" )
77
+ . Append ( "-noshadow" )
78
+ . AppendSwitch ( "-configuration" , configuration )
79
+ . AppendSwitch ( "-framework" , "net46" )
80
+ . AppendSwitchQuotedSecret ( "-xml" , string . Format ( "{0}/tests/{1}.xml" , artifacts , testProject . GetFilenameWithoutExtension ( ) ) )
81
+ . AppendSwitchQuotedSecret ( "-html" , string . Format ( "{0}/tests/{1}.html" , artifacts , testProject . GetFilenameWithoutExtension ( ) ) )
66
82
} ) ;
67
83
} ,
68
- artifacts + "/coverage/coverage.opencover" ,
69
- new OpenCoverSettings ( ) {
70
- Register = "user" ,
71
- MergeOutput = true ,
72
- OldStyle = true ,
84
+ artifacts + "/coverage/coverage-" + testProject . GetFilenameWithoutExtension ( ) + ".dcvr" ,
85
+ new DotCoverCoverSettings ( ) {
86
+ // Register = "user",
87
+ // MergeOutput = true,
88
+ // OldStyle = true,
89
+ TargetWorkingDir = testProject . GetDirectory ( ) ,
73
90
WorkingDirectory = testProject . GetDirectory ( ) ,
91
+ // ReportType = DotCoverReportType.XML
74
92
}
75
- . WithFilter ( "+[JsonRpc*]*" )
76
- . WithFilter ( "+[Lsp*]*" )
77
- . WithFilter ( "-[*.Tests]*" )
93
+ . WithFilter ( "+:JsonRpc" )
94
+ . WithFilter ( "+:Lsp" )
78
95
) ;
79
96
}
97
+
98
+ DotCoverMerge (
99
+ GetFiles ( artifacts + "/coverage/*.dcvr" ) ,
100
+ artifacts + "/coverage/coverage.dcvr"
101
+ ) ;
102
+
103
+ DotCoverReport (
104
+ artifacts + "/coverage/coverage.dcvr" ,
105
+ new FilePath ( artifacts + "/coverage/coverage.html" ) ,
106
+ new DotCoverReportSettings {
107
+ ReportType = DotCoverReportType . HTML
108
+ }
109
+ ) ;
110
+
111
+ DotCoverReport (
112
+ artifacts + "/coverage/coverage.dcvr" ,
113
+ new FilePath ( artifacts + "/coverage/coverage.xml" ) ,
114
+ new DotCoverReportSettings {
115
+ ReportType = DotCoverReportType . DetailedXML
116
+ }
117
+ ) ;
80
118
} ) ;
81
119
82
120
Task ( "Coveralls [AppVeyor]" )
0 commit comments