Skip to content

Commit 664eb73

Browse files
committed
Remove build.proj in favor of regular dotnet commands
Simple removal of the build.proj file allows `dotnet` commands to just work without having to specify the sln file explicitly, which is really nice. The build.proj was building all projects 3 times (build, test, and pack all rebuilt everything and repeated package restore, etc.), so it was slower than necessary anyway. In its place: 1. folks can just use `dotnet build` or whatever command suits them. 1. Azure Pipelines simply executes dotnet commands, which I break up into 4 steps so the pipeline can show timings for each step, etc. Because we use the Azure Pipelines DotNetCoreCLI task for running tests, the test results are automatically collected and reported as a searchable database. Test results can be analyzed over time to see how they perform, which ones are unstable, etc.
1 parent 0dd5624 commit 664eb73

File tree

5 files changed

+33
-56
lines changed

5 files changed

+33
-56
lines changed

CONTRIBUTING.md

Lines changed: 12 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -2,33 +2,22 @@
22

33
Contributions are highly welcome, however, except for very small changes, kindly file an issue and let's have a discussion before you open a pull request.
44

5-
## Building The Project
5+
## Building the Project
66

77
Clone this repo:
88

9-
```bash
10-
git clone https://github.com/tonerdo/coverlet
11-
```
9+
git clone https://github.com/tonerdo/coverlet.git
10+
cd coverlet
1211

13-
Change directory to repo root:
12+
Building, testing, and packing use all the standard dotnet commands:
1413

15-
```bash
16-
cd coverlet
17-
```
14+
dotnet build
15+
dotnet test
16+
dotnet pack
1817

19-
Execute build script:
18+
To see code coverage results while testing, run with a few extra parameters:
2019

21-
```bash
22-
dotnet msbuild build.proj
23-
```
24-
25-
This will result in the following:
26-
27-
* Restore all NuGet packages required for building
28-
* Build and publish all projects. Final binaries are placed into `<repo_root>\build\<Configuration>`
29-
* Build and run tests
30-
31-
These steps must be followed before you attempt to open the solution in an IDE (e.g. Visual Studio, Rider) for all projects to be loaded successfully.
20+
dotnet test /p:CollectCoverage=true /p:CoverletOutputFormat=opencover /p:Include=[coverlet.*]*
3221

3322
## Performance testing
3423

@@ -48,8 +37,8 @@ For more realistic testing it is recommended to try out any changes to the hit c
4837

4938
Change to the directory of the library and run the msbuild code coverage command:
5039

51-
dotnet msbuild /t:BuildAndTest /p:Coverage=true
52-
40+
dotnet test /p:Coverage=true
41+
5342
To run with a development version of coverlet call `dotnet run` instead of the installed coverlet version, e.g.:
5443

55-
dotnet msbuild /t:BuildAndTest /p:Coverage=true /p:CoverageExecutablePath="dotnet run -p C:\...\coverlet\src\coverlet.console\coverlet.console.csproj"
44+
dotnet test /p:Coverage=true /p:CoverageExecutablePath="dotnet run -p C:\...\coverlet\src\coverlet.console\coverlet.console.csproj"

build.proj

Lines changed: 0 additions & 25 deletions
This file was deleted.

build.yml

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,18 @@ steps:
44
version: 2.2.300
55
displayName: Install .NET Core SDK
66

7-
- script: dotnet msbuild build.proj /p:Configuration=$(buildConfiguration)
8-
displayName: 'Run Build'
7+
- script: dotnet restore
8+
displayName: Restore packages
9+
10+
- script: dotnet build -c $(BuildConfiguration) --no-restore
11+
displayName: Build
12+
13+
- task: DotNetCoreCLI@2
14+
displayName: Test
15+
inputs:
16+
command: test
17+
arguments: -c $(BuildConfiguration) --no-build /p:CollectCoverage=true /p:CoverletOutputFormat=opencover /p:Include=[coverlet.*]*
18+
testRunTitle: $(Agent.JobName)
19+
20+
- script: dotnet pack -c $(BuildConfiguration)
21+
displayName: Pack

eng/azure-pipelines-nightly.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
pool:
22
vmImage: 'windows-2019'
33
steps:
4-
- task: DotNetCoreInstaller@0
4+
- task: UseDotNet@2
55
inputs:
6-
version: '2.2.300'
6+
version: 2.2.300
77
- powershell:
88
.\eng\nightly.ps1 -apiKey $env:APIKEY -source $env:SOURCE
9-
ignoreLASTEXITCODE: "true"
9+
ignoreLASTEXITCODE: true
1010
env:
1111
APIKEY: $(apikey)
12-
SOURCE: $(source)
12+
SOURCE: $(source)

eng/nightly.ps1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ Write-Host -ForegroundColor Blue Publish with .NET CLI
1313
& dotnet --info
1414

1515
Write-Host -ForegroundColor Green Create Packages
16-
& dotnet msbuild "$PSScriptRoot\..\build.proj" /t:CreateNuGetPackage /p:Configuration=Release /p:PublicRelease=false # amend build.proj path if changes
16+
& dotnet pack -c Release
1717

1818
Write-Host -ForegroundColor Green Upload Packages
19-
& dotnet nuget push "$PSScriptRoot\..\build\Release\*.nupkg" -k $apiKey -s $source
19+
& dotnet nuget push "$PSScriptRoot\..\build\Release\*.nupkg" -k $apiKey -s $source

0 commit comments

Comments
 (0)