diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index f79ffe5..dd234c7 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -2,6 +2,11 @@ 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. +## Requirements + +.NET SDK 2.2 https://dotnet.microsoft.com/download/dotnet-core/2.2 +.NET SDK 3.1 https://dotnet.microsoft.com/download/dotnet-core/3.1 + ## Building the Project Clone this repo: diff --git a/Directory.Build.props b/Directory.Build.props index 99cdb52..d40cabc 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -4,11 +4,12 @@ $(MSBuildThisFileDirectory) Debug $(MSBuildThisFileDirectory)bin\$(Configuration)\Packages\ - true true true snupkg + true + preview diff --git a/_assets/coverlet-icon.png b/_assets/coverlet-icon.png new file mode 100644 index 0000000..fb062f3 Binary files /dev/null and b/_assets/coverlet-icon.png differ diff --git a/eng/build.yml b/eng/build.yml index dfc5872..e12b506 100644 --- a/eng/build.yml +++ b/eng/build.yml @@ -1,7 +1,12 @@ steps: - task: UseDotNet@2 inputs: - version: 2.2.402 + version: 2.2.207 + displayName: Install .NET Core SDK + +- task: UseDotNet@2 + inputs: + version: 3.1.100 displayName: Install .NET Core SDK - script: dotnet restore @@ -10,7 +15,7 @@ steps: - script: dotnet build -c $(BuildConfiguration) --no-restore displayName: Build -- script: dotnet pack -c $(BuildConfiguration) --no-build +- script: dotnet pack -c $(BuildConfiguration) displayName: Pack - task: DotNetCoreCLI@2 @@ -18,4 +23,4 @@ steps: inputs: command: test arguments: -c $(BuildConfiguration) --no-build /p:CollectCoverage=true /p:CoverletOutputFormat=opencover /p:Include=[coverlet.*]* /p:Exclude=[coverlet.tests.remoteexecutor]* - testRunTitle: $(Agent.JobName) + testRunTitle: $(Agent.JobName) \ No newline at end of file diff --git a/global.json b/global.json index 323ede7..e9aac8c 100644 --- a/global.json +++ b/global.json @@ -1,5 +1,5 @@ { - "sdk": { - "version": "2.2.402" - } -} \ No newline at end of file + "sdk": { + "version": "3.1.100" + } +} diff --git a/src/coverlet.collector/coverlet.collector.csproj b/src/coverlet.collector/coverlet.collector.csproj index d1fc144..b23f2a2 100644 --- a/src/coverlet.collector/coverlet.collector.csproj +++ b/src/coverlet.collector/coverlet.collector.csproj @@ -1,22 +1,35 @@ - + netcoreapp2.0 coverlet.collector - coverlet.collector + true + true + false + + true + $(TargetsForTfmSpecificContentInPackage);PackBuildOutputs + + $(NoWarn);NU5127 + + + + coverlet.collector + coverlet.collector tonerdo MIT http://github.com/tonerdo/coverlet https://raw.githubusercontent.com/tonerdo/coverlet/master/_assets/coverlet-icon.svg?sanitize=true + coverlet-icon.png false - true Coverlet is a cross platform code coverage library for .NET, with support for line, branch and method coverage. coverage testing unit-test lcov opencover quality git - true - false - true - $(TargetsForTfmSpecificContentInPackage);PackBuildOutputs @@ -25,6 +38,7 @@ + diff --git a/src/coverlet.console/coverlet.console.csproj b/src/coverlet.console/coverlet.console.csproj index 8d3855d..07b0d63 100644 --- a/src/coverlet.console/coverlet.console.csproj +++ b/src/coverlet.console/coverlet.console.csproj @@ -1,4 +1,4 @@ - + Exe @@ -6,11 +6,16 @@ coverlet true coverlet.console - tonerdo + + + + $(AssemblyTitle) + tonerdo Coverlet is a cross platform code coverage tool for .NET, with support for line, branch and method coverage. coverage;testing;unit-test;lcov;opencover;quality https://raw.githubusercontent.com/tonerdo/coverlet/master/_assets/coverlet-icon.svg?sanitize=true + coverlet-icon.png https://github.com/tonerdo/coverlet MIT git @@ -24,4 +29,8 @@ + + + + diff --git a/src/coverlet.core/coverlet.core.csproj b/src/coverlet.core/coverlet.core.csproj index e16a418..357d42e 100644 --- a/src/coverlet.core/coverlet.core.csproj +++ b/src/coverlet.core/coverlet.core.csproj @@ -5,7 +5,6 @@ netstandard2.0 5.3.0 false - preview diff --git a/src/coverlet.msbuild.tasks/coverlet.msbuild.tasks.csproj b/src/coverlet.msbuild.tasks/coverlet.msbuild.tasks.csproj index 3c3bf2e..bcd6a04 100644 --- a/src/coverlet.msbuild.tasks/coverlet.msbuild.tasks.csproj +++ b/src/coverlet.msbuild.tasks/coverlet.msbuild.tasks.csproj @@ -4,21 +4,33 @@ Library netstandard2.0 coverlet.msbuild.tasks + true + $(TargetsForTfmSpecificContentInPackage);PackBuildOutputs + build + false + + true + + + + coverlet.msbuild coverlet.msbuild tonerdo MIT http://github.com/tonerdo/coverlet https://raw.githubusercontent.com/tonerdo/coverlet/master/_assets/coverlet-icon.svg?sanitize=true + coverlet-icon.png false true Coverlet is a cross platform code coverage library for .NET, with support for line, branch and method coverage. coverage testing unit-test lcov opencover quality git - true - $(TargetsForTfmSpecificContentInPackage);PackBuildOutputs - build - false @@ -30,7 +42,7 @@ - + @@ -38,6 +50,10 @@ + + + + diff --git a/test/coverlet.collector.tests/coverlet.collector.tests.csproj b/test/coverlet.collector.tests/coverlet.collector.tests.csproj index b8ff66c..0e2c3c6 100644 --- a/test/coverlet.collector.tests/coverlet.collector.tests.csproj +++ b/test/coverlet.collector.tests/coverlet.collector.tests.csproj @@ -2,9 +2,8 @@ - netcoreapp2.2 + netcoreapp3.1 false - preview diff --git a/test/coverlet.core.performancetest/coverlet.core.performancetest.csproj b/test/coverlet.core.performancetest/coverlet.core.performancetest.csproj index 893340c..1c30298 100644 --- a/test/coverlet.core.performancetest/coverlet.core.performancetest.csproj +++ b/test/coverlet.core.performancetest/coverlet.core.performancetest.csproj @@ -2,7 +2,7 @@ - netcoreapp2.0 + netcoreapp3.1 false diff --git a/test/coverlet.core.tests/Instrumentation/InstrumenterTests.cs b/test/coverlet.core.tests/Instrumentation/InstrumenterTests.cs index 899161f..55997da 100644 --- a/test/coverlet.core.tests/Instrumentation/InstrumenterTests.cs +++ b/test/coverlet.core.tests/Instrumentation/InstrumenterTests.cs @@ -346,7 +346,7 @@ namespace Coverlet.Core.Instrumentation.Tests [Fact] public void SkipEmbeddedPpdbWithoutLocalSource() { - string xunitDll = Directory.GetFiles(Directory.GetCurrentDirectory(), "xunit.*.dll").First(); + string xunitDll = Directory.GetFiles(Directory.GetCurrentDirectory(), "xunit.core.dll").First(); var loggerMock = new Mock(); Instrumenter instrumenter = new Instrumenter(xunitDll, "_xunit_instrumented", Array.Empty(), Array.Empty(), Array.Empty(), Array.Empty(), false, loggerMock.Object, _instrumentationHelper, new FileSystem()); Assert.True(_instrumentationHelper.HasPdb(xunitDll, out bool embedded)); diff --git a/test/coverlet.core.tests/coverlet.core.tests.csproj b/test/coverlet.core.tests/coverlet.core.tests.csproj index 56c196f..14807ed 100644 --- a/test/coverlet.core.tests/coverlet.core.tests.csproj +++ b/test/coverlet.core.tests/coverlet.core.tests.csproj @@ -2,9 +2,8 @@ - netcoreapp2.2 + netcoreapp3.1 false - preview $(NoWarn);CS8002 true diff --git a/test/coverlet.integration.template/coverlet.integration.template.csproj b/test/coverlet.integration.template/coverlet.integration.template.csproj index 141809a..301a097 100644 --- a/test/coverlet.integration.template/coverlet.integration.template.csproj +++ b/test/coverlet.integration.template/coverlet.integration.template.csproj @@ -1,7 +1,7 @@  - netcoreapp2.2 + netcoreapp3.1 false coverletsamplelib.integration.template diff --git a/test/coverlet.integration.tests/BaseTest.cs b/test/coverlet.integration.tests/BaseTest.cs index 73df393..3da7adf 100644 --- a/test/coverlet.integration.tests/BaseTest.cs +++ b/test/coverlet.integration.tests/BaseTest.cs @@ -25,6 +25,12 @@ namespace Coverlet.Integration.Tests private BuildConfiguration GetAssemblyBuildConfiguration() { var configurationAttribute = Assembly.GetExecutingAssembly().GetCustomAttribute(); + + if (configurationAttribute is null) + { + throw new ArgumentNullException("AssemblyConfigurationAttribute not found"); + } + if (configurationAttribute.Configuration.Equals("Debug", StringComparison.InvariantCultureIgnoreCase)) { return BuildConfiguration.Debug; @@ -260,6 +266,11 @@ namespace Coverlet.Integration.Tests private protected void PinSDK(ClonedTemplateProject project, string sdkVersion) { + if (project is null) + { + throw new ArgumentNullException(nameof(project)); + } + if (string.IsNullOrEmpty(sdkVersion)) { throw new ArgumentException("Invalid sdkVersion", nameof(sdkVersion)); @@ -270,15 +281,19 @@ namespace Coverlet.Integration.Tests throw new FileNotFoundException("coverlet.integration.template.csproj not found", "coverlet.integration.template.csproj"); } + if (project.ProjectRootPath is null || !Directory.Exists(project.ProjectRootPath)) + { + throw new ArgumentException("Invalid ProjectRootPath"); + } + File.WriteAllText(Path.Combine(project.ProjectRootPath, "global.json"), $"{{ \"sdk\": {{ \"version\": \"{sdkVersion}\" }} }}"); } } class ClonedTemplateProject : IDisposable { - private bool _cleanupOnDispose; - - public string? ProjectRootPath { get; private set; } + public string ProjectRootPath { get; private set; } + public bool CleanupOnDispose { get; private set; } // We need to have a different asm name to avoid issue with collectors, we filter [coverlet.*]* by default // https://github.com/tonerdo/coverlet/pull/410#discussion_r284526728 @@ -286,7 +301,11 @@ namespace Coverlet.Integration.Tests public static string ProjectFileName { get; } = "coverlet.integration.template.csproj"; public string ProjectFileNamePath => Path.Combine(ProjectRootPath, "coverlet.integration.template.csproj"); - public ClonedTemplateProject(string projectRootPath, bool cleanupOnDispose) => (ProjectRootPath, _cleanupOnDispose) = (projectRootPath, cleanupOnDispose); + public ClonedTemplateProject(string? projectRootPath, bool cleanupOnDispose) + { + ProjectRootPath = (projectRootPath ?? throw new ArgumentNullException(nameof(projectRootPath))); + CleanupOnDispose = cleanupOnDispose; + } public bool IsMultipleTargetFramework() { @@ -314,7 +333,7 @@ namespace Coverlet.Integration.Tests public void Dispose() { - if (_cleanupOnDispose) + if (CleanupOnDispose) { Directory.Delete(ProjectRootPath, true); } diff --git a/test/coverlet.integration.tests/coverlet.integration.tests.csproj b/test/coverlet.integration.tests/coverlet.integration.tests.csproj index 2ccf104..6172dea 100644 --- a/test/coverlet.integration.tests/coverlet.integration.tests.csproj +++ b/test/coverlet.integration.tests/coverlet.integration.tests.csproj @@ -1,9 +1,8 @@  - netcoreapp2.2 + netcoreapp3.1 false - preview enable diff --git a/test/coverlet.tests.projectsample.excludedbyattribute/coverlet.tests.projectsample.excludedbyattribute.csproj b/test/coverlet.tests.projectsample.excludedbyattribute/coverlet.tests.projectsample.excludedbyattribute.csproj index 939b54a..f38bbae 100644 --- a/test/coverlet.tests.projectsample.excludedbyattribute/coverlet.tests.projectsample.excludedbyattribute.csproj +++ b/test/coverlet.tests.projectsample.excludedbyattribute/coverlet.tests.projectsample.excludedbyattribute.csproj @@ -1,7 +1,7 @@ - netcoreapp2.2 + netcoreapp3.1 false false diff --git a/test/coverlet.tests.remoteexecutor/coverlet.tests.remoteexecutor.csproj b/test/coverlet.tests.remoteexecutor/coverlet.tests.remoteexecutor.csproj index 39c9769..6e8630c 100644 --- a/test/coverlet.tests.remoteexecutor/coverlet.tests.remoteexecutor.csproj +++ b/test/coverlet.tests.remoteexecutor/coverlet.tests.remoteexecutor.csproj @@ -2,7 +2,7 @@ Exe - netcoreapp2.2 + netcoreapp3.1 Coverlet.Tests.RemoteExecutor false false diff --git a/test/coverlet.testsubject/coverlet.testsubject.csproj b/test/coverlet.testsubject/coverlet.testsubject.csproj index bd52eaa..f38bbae 100644 --- a/test/coverlet.testsubject/coverlet.testsubject.csproj +++ b/test/coverlet.testsubject/coverlet.testsubject.csproj @@ -1,7 +1,7 @@ - netcoreapp2.0 + netcoreapp3.1 false false