Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit caac526

Browse files
authoredJan 14, 2020
Move/Pin to 3.1 runtime (#688)
Move/Pin to 3.1 runtime
1 parent 8cb1ebc commit caac526

File tree

19 files changed

+105
-40
lines changed

19 files changed

+105
-40
lines changed
 

‎CONTRIBUTING.md

+5
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@
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+
## Requirements
6+
7+
.NET SDK 2.2 https://dotnet.microsoft.com/download/dotnet-core/2.2
8+
.NET SDK 3.1 https://dotnet.microsoft.com/download/dotnet-core/3.1
9+
510
## Building the Project
611

712
Clone this repo:

‎Directory.Build.props

+2-1
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,12 @@
44
<RepoRoot>$(MSBuildThisFileDirectory)</RepoRoot>
55
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
66
<PackageOutputPath>$(MSBuildThisFileDirectory)bin\$(Configuration)\Packages\</PackageOutputPath>
7-
87
<PublishRepositoryUrl>true</PublishRepositoryUrl>
98
<EmbedUntrackedSources>true</EmbedUntrackedSources>
109
<IncludeSymbols>true</IncludeSymbols>
1110
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
11+
<MSBuildTreatWarningsAsErrors>true</MSBuildTreatWarningsAsErrors>
12+
<LangVersion>preview</LangVersion>
1213
</PropertyGroup>
1314

1415
<ItemGroup>

‎_assets/coverlet-icon.png

6.47 KB
Loading

‎eng/build.yml

+8-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,12 @@
11
steps:
22
- task: UseDotNet@2
33
inputs:
4-
version: 2.2.402
4+
version: 2.2.207
5+
displayName: Install .NET Core SDK
6+
7+
- task: UseDotNet@2
8+
inputs:
9+
version: 3.1.100
510
displayName: Install .NET Core SDK
611

712
- script: dotnet restore
@@ -10,12 +15,12 @@ steps:
1015
- script: dotnet build -c $(BuildConfiguration) --no-restore
1116
displayName: Build
1217

13-
- script: dotnet pack -c $(BuildConfiguration) --no-build
18+
- script: dotnet pack -c $(BuildConfiguration)
1419
displayName: Pack
1520

1621
- task: DotNetCoreCLI@2
1722
displayName: Test
1823
inputs:
1924
command: test
2025
arguments: -c $(BuildConfiguration) --no-build /p:CollectCoverage=true /p:CoverletOutputFormat=opencover /p:Include=[coverlet.*]* /p:Exclude=[coverlet.tests.remoteexecutor]*
21-
testRunTitle: $(Agent.JobName)
26+
testRunTitle: $(Agent.JobName)

‎global.json

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"sdk": {
3-
"version": "2.2.402"
4-
}
5-
}
2+
"sdk": {
3+
"version": "3.1.100"
4+
}
5+
}

‎src/coverlet.collector/coverlet.collector.csproj

+21-7
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,35 @@
1-
<Project Sdk="Microsoft.NET.Sdk" >
1+
<Project Sdk="Microsoft.NET.Sdk">
22
<PropertyGroup>
33
<TargetFramework>netcoreapp2.0</TargetFramework>
44
<AssemblyTitle>coverlet.collector</AssemblyTitle>
5-
<PackageId>coverlet.collector</PackageId>
5+
<DevelopmentDependency>true</DevelopmentDependency>
6+
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
7+
<IncludeBuildOutput>false</IncludeBuildOutput>
8+
<!--
9+
suppress warning https://docs.microsoft.com/en-us/nuget/reference/errors-and-warnings/nu5128
10+
If your package does not contain any lib/ or ref/ files and is not a meta-package,
11+
it likely does not have any dependencies that the package consumer needs.
12+
If you are packing with NuGet's MSBuild Pack target, you can set <SuppressDependenciesWhenPacking>true</SuppressDependenciesWhenPacking> in any PropertyGroup in your project file.
13+
-->
14+
<SuppressDependenciesWhenPacking>true</SuppressDependenciesWhenPacking>
15+
<TargetsForTfmSpecificContentInPackage>$(TargetsForTfmSpecificContentInPackage);PackBuildOutputs</TargetsForTfmSpecificContentInPackage>
16+
<!-- Open issue https://github.com/NuGet/Home/issues/8941 -->
17+
<NoWarn>$(NoWarn);NU5127</NoWarn>
18+
</PropertyGroup>
19+
20+
<!-- Nuget package properties https://docs.microsoft.com/en-us/nuget/reference/msbuild-targets -->
21+
<PropertyGroup>
622
<Title>coverlet.collector</Title>
23+
<PackageId>coverlet.collector</PackageId>
724
<Authors>tonerdo</Authors>
825
<PackageLicenseExpression>MIT</PackageLicenseExpression>
926
<PackageProjectUrl>http://github.com/tonerdo/coverlet</PackageProjectUrl>
1027
<PackageIconUrl>https://raw.githubusercontent.com/tonerdo/coverlet/master/_assets/coverlet-icon.svg?sanitize=true</PackageIconUrl>
28+
<PackageIcon>coverlet-icon.png</PackageIcon>
1129
<PackageRequireLicenseAcceptance>false</PackageRequireLicenseAcceptance>
12-
<DevelopmentDependency>true</DevelopmentDependency>
1330
<Description>Coverlet is a cross platform code coverage library for .NET, with support for line, branch and method coverage.</Description>
1431
<PackageTags>coverage testing unit-test lcov opencover quality</PackageTags>
1532
<RepositoryType>git</RepositoryType>
16-
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
17-
<IncludeBuildOutput>false</IncludeBuildOutput>
18-
<SuppressDependenciesWhenPacking>true</SuppressDependenciesWhenPacking>
19-
<TargetsForTfmSpecificContentInPackage>$(TargetsForTfmSpecificContentInPackage);PackBuildOutputs</TargetsForTfmSpecificContentInPackage>
2033
</PropertyGroup>
2134

2235
<ItemGroup>
@@ -25,6 +38,7 @@
2538

2639
<ItemGroup>
2740
<None Update="build\**" Pack="true" PackagePath="" />
41+
<None Include="$(MSBuildThisFileDirectory)..\..\_assets\coverlet-icon.png" Pack="true" PackagePath="\" />
2842
</ItemGroup>
2943

3044
<ItemGroup>

‎src/coverlet.console/coverlet.console.csproj

+11-2
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,21 @@
1-
<Project Sdk="Microsoft.NET.Sdk">
1+
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
44
<OutputType>Exe</OutputType>
55
<TargetFramework>netcoreapp2.2</TargetFramework>
66
<ToolCommandName>coverlet</ToolCommandName>
77
<PackAsTool>true</PackAsTool>
88
<AssemblyTitle>coverlet.console</AssemblyTitle>
9-
<Authors>tonerdo</Authors>
9+
</PropertyGroup>
10+
11+
<!-- Nuget package properties https://docs.microsoft.com/en-us/nuget/reference/msbuild-targets -->
12+
<PropertyGroup>
1013
<PackageId>$(AssemblyTitle)</PackageId>
14+
<Authors>tonerdo</Authors>
1115
<Description>Coverlet is a cross platform code coverage tool for .NET, with support for line, branch and method coverage.</Description>
1216
<PackageTags>coverage;testing;unit-test;lcov;opencover;quality</PackageTags>
1317
<PackageIconUrl>https://raw.githubusercontent.com/tonerdo/coverlet/master/_assets/coverlet-icon.svg?sanitize=true</PackageIconUrl>
18+
<PackageIcon>coverlet-icon.png</PackageIcon>
1419
<PackageProjectUrl>https://github.com/tonerdo/coverlet</PackageProjectUrl>
1520
<PackageLicenseExpression>MIT</PackageLicenseExpression>
1621
<RepositoryType>git</RepositoryType>
@@ -24,4 +29,8 @@
2429
<ProjectReference Include="$(MSBuildThisFileDirectory)..\coverlet.core\coverlet.core.csproj" />
2530
</ItemGroup>
2631

32+
<ItemGroup>
33+
<None Include="$(MSBuildThisFileDirectory)..\..\_assets\coverlet-icon.png" Pack="true" PackagePath="\"/>
34+
</ItemGroup>
35+
2736
</Project>

‎src/coverlet.core/coverlet.core.csproj

-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
<TargetFramework>netstandard2.0</TargetFramework>
66
<AssemblyVersion>5.3.0</AssemblyVersion>
77
<IsPackable>false</IsPackable>
8-
<LangVersion>preview</LangVersion>
98
</PropertyGroup>
109

1110
<ItemGroup>

‎src/coverlet.msbuild.tasks/coverlet.msbuild.tasks.csproj

+21-5
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,33 @@
44
<OutputType>Library</OutputType>
55
<TargetFramework>netstandard2.0</TargetFramework>
66
<AssemblyTitle>coverlet.msbuild.tasks</AssemblyTitle>
7+
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
8+
<TargetsForTfmSpecificContentInPackage>$(TargetsForTfmSpecificContentInPackage);PackBuildOutputs</TargetsForTfmSpecificContentInPackage>
9+
<ContentTargetFolders>build</ContentTargetFolders>
10+
<IncludeBuildOutput>false</IncludeBuildOutput>
11+
<!--
12+
suppress warning https://docs.microsoft.com/en-us/nuget/reference/errors-and-warnings/nu5128
13+
If your package does not contain any lib/ or ref/ files and is not a meta-package,
14+
it likely does not have any dependencies that the package consumer needs.
15+
If you are packing with NuGet's MSBuild Pack target, you can set <SuppressDependenciesWhenPacking>true</SuppressDependenciesWhenPacking> in any PropertyGroup in your project file.
16+
-->
17+
<SuppressDependenciesWhenPacking>true</SuppressDependenciesWhenPacking>
18+
</PropertyGroup>
19+
20+
<!-- Nuget package properties https://docs.microsoft.com/en-us/nuget/reference/msbuild-targets -->
21+
<PropertyGroup>
722
<PackageId>coverlet.msbuild</PackageId>
823
<Title>coverlet.msbuild</Title>
924
<Authors>tonerdo</Authors>
1025
<PackageLicenseExpression>MIT</PackageLicenseExpression>
1126
<PackageProjectUrl>http://github.com/tonerdo/coverlet</PackageProjectUrl>
1227
<PackageIconUrl>https://raw.githubusercontent.com/tonerdo/coverlet/master/_assets/coverlet-icon.svg?sanitize=true</PackageIconUrl>
28+
<PackageIcon>coverlet-icon.png</PackageIcon>
1329
<PackageRequireLicenseAcceptance>false</PackageRequireLicenseAcceptance>
1430
<DevelopmentDependency>true</DevelopmentDependency>
1531
<Description>Coverlet is a cross platform code coverage library for .NET, with support for line, branch and method coverage.</Description>
1632
<PackageTags>coverage testing unit-test lcov opencover quality</PackageTags>
1733
<RepositoryType>git</RepositoryType>
18-
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
19-
<TargetsForTfmSpecificContentInPackage>$(TargetsForTfmSpecificContentInPackage);PackBuildOutputs</TargetsForTfmSpecificContentInPackage>
20-
<ContentTargetFolders>build</ContentTargetFolders>
21-
<IncludeBuildOutput>false</IncludeBuildOutput>
2234
</PropertyGroup>
2335

2436
<ItemGroup>
@@ -30,14 +42,18 @@
3042
</ItemGroup>
3143

3244
<ItemGroup>
33-
<Compile Include="..\coverlet.console\ConsoleTables\ConsoleTable.cs" Link="ConsoleTables\ConsoleTable.cs" />
45+
<Compile Include="$(MSBuildThisFileDirectory)..\coverlet.console\ConsoleTables\ConsoleTable.cs" Link="ConsoleTables\ConsoleTable.cs" />
3446
</ItemGroup>
3547

3648
<ItemGroup>
3749
<Content Include="coverlet.msbuild.props" />
3850
<Content Include="coverlet.msbuild.targets" />
3951
</ItemGroup>
4052

53+
<ItemGroup>
54+
<None Include="$(MSBuildThisFileDirectory)..\..\_assets\coverlet-icon.png" Pack="true" PackagePath="\" />
55+
</ItemGroup>
56+
4157
<Target Name="PackBuildOutputs" DependsOnTargets="ResolveProjectReferences;SatelliteDllsProjectOutputGroup;DebugSymbolsProjectOutputGroup;SatelliteDllsProjectOutputGroupDependencies;ResolveAssemblyReferences">
4258
<ItemGroup>
4359
<TfmSpecificPackageFile Include="$(TargetPath)" PackagePath="build\" />

‎test/coverlet.collector.tests/coverlet.collector.tests.csproj

+1-2
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,8 @@
22
<Import Project="$(RepoRoot)src\coverlet.msbuild.tasks\coverlet.msbuild.props" />
33

44
<PropertyGroup>
5-
<TargetFramework>netcoreapp2.2</TargetFramework>
5+
<TargetFramework>netcoreapp3.1</TargetFramework>
66
<IsPackable>false</IsPackable>
7-
<LangVersion>preview</LangVersion>
87
</PropertyGroup>
98

109
<ItemGroup>

‎test/coverlet.core.performancetest/coverlet.core.performancetest.csproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<Import Project="$(RepoRoot)src\coverlet.msbuild.tasks\coverlet.msbuild.props" />
33

44
<PropertyGroup>
5-
<TargetFramework>netcoreapp2.0</TargetFramework>
5+
<TargetFramework>netcoreapp3.1</TargetFramework>
66
<IsPackable>false</IsPackable>
77
</PropertyGroup>
88

‎test/coverlet.core.tests/Instrumentation/InstrumenterTests.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -346,7 +346,7 @@ public void TestInstrument_ExcludedFilesHelper(string[] excludeFilterHelper, Val
346346
[Fact]
347347
public void SkipEmbeddedPpdbWithoutLocalSource()
348348
{
349-
string xunitDll = Directory.GetFiles(Directory.GetCurrentDirectory(), "xunit.*.dll").First();
349+
string xunitDll = Directory.GetFiles(Directory.GetCurrentDirectory(), "xunit.core.dll").First();
350350
var loggerMock = new Mock<ILogger>();
351351
Instrumenter instrumenter = new Instrumenter(xunitDll, "_xunit_instrumented", Array.Empty<string>(), Array.Empty<string>(), Array.Empty<string>(), Array.Empty<string>(), false, loggerMock.Object, _instrumentationHelper, new FileSystem());
352352
Assert.True(_instrumentationHelper.HasPdb(xunitDll, out bool embedded));

‎test/coverlet.core.tests/coverlet.core.tests.csproj

+1-2
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,8 @@
22
<Import Project="$(RepoRoot)src\coverlet.msbuild.tasks\coverlet.msbuild.props" />
33

44
<PropertyGroup>
5-
<TargetFramework>netcoreapp2.2</TargetFramework>
5+
<TargetFramework>netcoreapp3.1</TargetFramework>
66
<IsPackable>false</IsPackable>
7-
<LangVersion>preview</LangVersion>
87
<NoWarn>$(NoWarn);CS8002</NoWarn>
98
<!--For test TestInstrument_NetstandardAwareAssemblyResolver_PreserveCompilationContext-->
109
<PreserveCompilationContext>true</PreserveCompilationContext>

‎test/coverlet.integration.template/coverlet.integration.template.csproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFramework>netcoreapp2.2</TargetFramework>
4+
<TargetFramework>netcoreapp3.1</TargetFramework>
55
<IsPackable>false</IsPackable>
66
<AssemblyName>coverletsamplelib.integration.template</AssemblyName>
77
</PropertyGroup>

‎test/coverlet.integration.tests/BaseTest.cs

+24-5
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,12 @@ public abstract class BaseTest
2525
private BuildConfiguration GetAssemblyBuildConfiguration()
2626
{
2727
var configurationAttribute = Assembly.GetExecutingAssembly().GetCustomAttribute<AssemblyConfigurationAttribute>();
28+
29+
if (configurationAttribute is null)
30+
{
31+
throw new ArgumentNullException("AssemblyConfigurationAttribute not found");
32+
}
33+
2834
if (configurationAttribute.Configuration.Equals("Debug", StringComparison.InvariantCultureIgnoreCase))
2935
{
3036
return BuildConfiguration.Debug;
@@ -260,6 +266,11 @@ private protected void UpdateProjectTargetFramework(ClonedTemplateProject projec
260266

261267
private protected void PinSDK(ClonedTemplateProject project, string sdkVersion)
262268
{
269+
if (project is null)
270+
{
271+
throw new ArgumentNullException(nameof(project));
272+
}
273+
263274
if (string.IsNullOrEmpty(sdkVersion))
264275
{
265276
throw new ArgumentException("Invalid sdkVersion", nameof(sdkVersion));
@@ -270,23 +281,31 @@ private protected void PinSDK(ClonedTemplateProject project, string sdkVersion)
270281
throw new FileNotFoundException("coverlet.integration.template.csproj not found", "coverlet.integration.template.csproj");
271282
}
272283

284+
if (project.ProjectRootPath is null || !Directory.Exists(project.ProjectRootPath))
285+
{
286+
throw new ArgumentException("Invalid ProjectRootPath");
287+
}
288+
273289
File.WriteAllText(Path.Combine(project.ProjectRootPath, "global.json"), $"{{ \"sdk\": {{ \"version\": \"{sdkVersion}\" }} }}");
274290
}
275291
}
276292

277293
class ClonedTemplateProject : IDisposable
278294
{
279-
private bool _cleanupOnDispose;
280-
281-
public string? ProjectRootPath { get; private set; }
295+
public string ProjectRootPath { get; private set; }
296+
public bool CleanupOnDispose { get; private set; }
282297

283298
// We need to have a different asm name to avoid issue with collectors, we filter [coverlet.*]* by default
284299
// https://github.com/tonerdo/coverlet/pull/410#discussion_r284526728
285300
public static string AssemblyName { get; } = "coverletsamplelib.integration.template";
286301
public static string ProjectFileName { get; } = "coverlet.integration.template.csproj";
287302
public string ProjectFileNamePath => Path.Combine(ProjectRootPath, "coverlet.integration.template.csproj");
288303

289-
public ClonedTemplateProject(string projectRootPath, bool cleanupOnDispose) => (ProjectRootPath, _cleanupOnDispose) = (projectRootPath, cleanupOnDispose);
304+
public ClonedTemplateProject(string? projectRootPath, bool cleanupOnDispose)
305+
{
306+
ProjectRootPath = (projectRootPath ?? throw new ArgumentNullException(nameof(projectRootPath)));
307+
CleanupOnDispose = cleanupOnDispose;
308+
}
290309

291310
public bool IsMultipleTargetFramework()
292311
{
@@ -314,7 +333,7 @@ public string[] GetFiles(string filter)
314333

315334
public void Dispose()
316335
{
317-
if (_cleanupOnDispose)
336+
if (CleanupOnDispose)
318337
{
319338
Directory.Delete(ProjectRootPath, true);
320339
}

‎test/coverlet.integration.tests/coverlet.integration.tests.csproj

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFramework>netcoreapp2.2</TargetFramework>
4+
<TargetFramework>netcoreapp3.1</TargetFramework>
55
<IsPackable>false</IsPackable>
6-
<LangVersion>preview</LangVersion>
76
<Nullable>enable</Nullable>
87
</PropertyGroup>
98

‎test/coverlet.tests.projectsample.excludedbyattribute/coverlet.tests.projectsample.excludedbyattribute.csproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFramework>netcoreapp2.2</TargetFramework>
4+
<TargetFramework>netcoreapp3.1</TargetFramework>
55
<IsPackable>false</IsPackable>
66
<IsTestProject>false</IsTestProject>
77
</PropertyGroup>

‎test/coverlet.tests.remoteexecutor/coverlet.tests.remoteexecutor.csproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
<PropertyGroup>
44
<OutputType>Exe</OutputType>
5-
<TargetFramework>netcoreapp2.2</TargetFramework>
5+
<TargetFramework>netcoreapp3.1</TargetFramework>
66
<RootNamespace>Coverlet.Tests.RemoteExecutor</RootNamespace>
77
<IsPackable>false</IsPackable>
88
<IsTestProject>false</IsTestProject>

‎test/coverlet.testsubject/coverlet.testsubject.csproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFramework>netcoreapp2.0</TargetFramework>
4+
<TargetFramework>netcoreapp3.1</TargetFramework>
55
<IsPackable>false</IsPackable>
66
<IsTestProject>false</IsTestProject>
77
</PropertyGroup>

1 commit comments

Comments
 (1)

Juancanico5 commented on Feb 28, 2024

@Juancanico5

#****

Please sign in to comment.