Skip to content

Commit be82faa

Browse files
CodeCov!
1 parent af36835 commit be82faa

File tree

9 files changed

+136
-30
lines changed

9 files changed

+136
-30
lines changed

Diff for: .appveyor.yml

+5-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
image: Visual Studio 2017
22
build_script:
3-
- ps: .\build.ps1
3+
- ps: .\build.ps1
44
test: off
5-
environment:
6-
coveralls_repo_token:
7-
secure: 8AAVbI/45PFVPmrdybK6jSt1I5Yt4nJithGWK4ARTBJZHf6pozIK7ucWMOkwG/4d
5+
after_test:
6+
- "SET PATH=C:\\Python34;C:\\Python34\\Scripts;%PATH%"
7+
- pip install codecov
8+
- codecov -f "MyProject_coverage.xml"

Diff for: .codecov.yml

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
coverage:
2+
range: 70..100
3+
round: down
4+
precision: 2

Diff for: .coveralls.yml

Whitespace-only changes.

Diff for: .vscode/launch.json

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
{
2+
// Use IntelliSense to find out which attributes exist for C# debugging
3+
// Use hover for the description of the existing attributes
4+
// For further information visit https://github.com/OmniSharp/omnisharp-vscode/blob/master/debugger-launchjson.md
5+
"version": "0.2.0",
6+
"configurations": [
7+
{
8+
"name": ".NET Core Launch (console)",
9+
"type": "coreclr",
10+
"request": "launch",
11+
"preLaunchTask": "build",
12+
// If you have changed target frameworks, make sure to update the program path.
13+
"program": "${workspaceRoot}/sample/SampleServer/bin/Debug/netcoreapp1.1/SampleServer.dll",
14+
"args": [],
15+
"cwd": "${workspaceRoot}/sample/SampleServer",
16+
// For more information about the 'console' field, see https://github.com/OmniSharp/omnisharp-vscode/blob/master/debugger-launchjson.md#console-terminal-window
17+
"console": "internalConsole",
18+
"stopAtEntry": false,
19+
"internalConsoleOptions": "openOnSessionStart"
20+
},
21+
{
22+
"name": ".NET Core Attach",
23+
"type": "coreclr",
24+
"request": "attach",
25+
"processId": "${command:pickProcess}"
26+
}
27+
]
28+
}

Diff for: .vscode/tasks.json

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"version": "0.1.0",
3+
"command": "dotnet",
4+
"isShellCommand": true,
5+
"args": [],
6+
"tasks": [
7+
{
8+
"taskName": "build",
9+
"args": [
10+
"${workspaceRoot}/sample/SampleServer/SampleServer.csproj"
11+
],
12+
"isBuildCommand": true,
13+
"problemMatcher": "$msCompile"
14+
}
15+
]
16+
}

Diff for: LSP.sln

+8
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,15 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{2F323ED5-E
99
EndProject
1010
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".config", ".config", "{AE4D7807-6F78-428C-A0D9-914BA583A104}"
1111
ProjectSection(SolutionItems) = preProject
12+
.appveyor.yml = .appveyor.yml
13+
.coveralls.yml = .coveralls.yml
1214
.editorconfig = .editorconfig
15+
.gitattributes = .gitattributes
16+
.gitignore = .gitignore
17+
build.cake = build.cake
18+
build.ps1 = build.ps1
19+
build.sh = build.sh
20+
nuget.config = nuget.config
1321
EndProjectSection
1422
EndProject
1523
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "JsonRpc", "src\JsonRpc\JsonRpc.csproj", "{9AF43FA2-EF35-435E-B59E-724877E44DDA}"

Diff for: build.cake

+55-17
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#tool "nuget:?package=GitVersion.CommandLine"
22
#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"
55
#addin "Cake.Coveralls";
66

77
var target = Argument("target", "Default");
@@ -26,7 +26,10 @@ Task("Build")
2626
.Does(() =>
2727
{
2828
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+
});
3033
});
3134

3235
Task("Test")
@@ -42,41 +45,76 @@ Task("Test")
4245
Arguments = new ProcessArgumentBuilder()
4346
.Append("xunit")
4447
.Append("-noshadow")
48+
.AppendSwitch("-configuration", configuration)
4549
.AppendSwitchQuotedSecret("-xml", string.Format("{0}/tests/{1}.xml", artifacts, testProject.GetFilenameWithoutExtension()))
4650
.AppendSwitchQuotedSecret("-html", string.Format("{0}/tests/{1}.html", artifacts, testProject.GetFilenameWithoutExtension()))
4751
});
4852
}
4953
});
5054

5155
Task("Coverage")
52-
.IsDependentOn("Build")
56+
//.IsDependentOn("Build")
5357
.Does(() =>
5458
{
59+
CleanDirectory(artifacts + "/coverage");
5560
EnsureDirectoryExists(artifacts + "/coverage");
5661

5762
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+
// });
5973
tool.StartProcess(Context.Tools.Resolve("dotnet.exe"), new ProcessSettings() {
6074
WorkingDirectory = testProject.GetDirectory(),
6175
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()))
6682
});
6783
},
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(),
7390
WorkingDirectory = testProject.GetDirectory(),
91+
// ReportType = DotCoverReportType.XML
7492
}
75-
.WithFilter("+[JsonRpc*]*")
76-
.WithFilter("+[Lsp*]*")
77-
.WithFilter("-[*.Tests]*")
93+
.WithFilter("+:JsonRpc")
94+
.WithFilter("+:Lsp")
7895
);
7996
}
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+
);
80118
});
81119

82120
Task("Coveralls [AppVeyor]")

Diff for: nuget.config

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<configuration>
3+
<packageSources>
4+
<add key="Build Packages" value="https://www.myget.org/F/c037199d-41df-4567-b966-25ff65324688/api/v3/index.json" />
5+
<add key="NuGet.org" value="https://api.nuget.org/v3/index.json" />
6+
</packageSources>
7+
</configuration>

Diff for: src/JsonRpc/OutputHandler.cs

+13-9
Original file line numberDiff line numberDiff line change
@@ -40,18 +40,22 @@ private void ProcessOutputQueue()
4040
while (true)
4141
{
4242
if (_thread == null) return;
43-
if (_queue.TryTake(out var value, -1, token))
43+
try
4444
{
45-
var content = JsonConvert.SerializeObject(value);
45+
if (_queue.TryTake(out var value, Timeout.Infinite, token))
46+
{
47+
var content = JsonConvert.SerializeObject(value);
4648

47-
// TODO: Is this lsp specific??
48-
var sb = new StringBuilder();
49-
sb.Append($"Content-Length: {content.Length}\r\n");
50-
sb.Append($"\r\n");
51-
sb.Append(content);
49+
// TODO: Is this lsp specific??
50+
var sb = new StringBuilder();
51+
sb.Append($"Content-Length: {content.Length}\r\n");
52+
sb.Append($"\r\n");
53+
sb.Append(content);
5254

53-
_output.Write(sb.ToString());
55+
_output.Write(sb.ToString());
56+
}
5457
}
58+
catch (OperationCanceledException) { }
5559
}
5660
}
5761

@@ -62,4 +66,4 @@ public void Dispose()
6266
_cancel.Cancel();
6367
}
6468
}
65-
}
69+
}

0 commit comments

Comments
 (0)