Skip to content

Commit

Permalink
feat: add support for .NET 5
Browse files Browse the repository at this point in the history
  • Loading branch information
fgreinacher committed Nov 15, 2020
1 parent cdf4a0e commit 016d16b
Show file tree
Hide file tree
Showing 15 changed files with 122 additions and 19 deletions.
16 changes: 16 additions & 0 deletions .github/workflows/ci.yml
Expand Up @@ -17,6 +17,16 @@ jobs:
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Setup .NET Core 2.1
uses: actions/setup-dotnet@v1
with:
dotnet-version: "2.1.x"
- name: Setup .NET Core 3.1
uses: actions/setup-dotnet@v1
with:
dotnet-version: "3.1.x"
- name: Setup .NET
uses: actions/setup-dotnet@v1
- name: Run tests
run: dotnet test --collect:"XPlat Code Coverage"
- name: Upload coverage
Expand All @@ -31,6 +41,8 @@ jobs:
steps:
- name: Checkout sources
uses: actions/checkout@v2
- name: Setup .NET
uses: actions/setup-dotnet@v1
- uses: actions/download-artifact@v2
with:
name: Code coverage ubuntu-latest
Expand Down Expand Up @@ -64,6 +76,8 @@ jobs:
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Setup .NET
uses: actions/setup-dotnet@v
- name: Create packages
run: dotnet pack --configuration Release --output ./packages
- name: Upload a Build Artifact
Expand All @@ -81,6 +95,8 @@ jobs:
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Setup .NET
uses: actions/setup-dotnet@v1
- uses: actions/download-artifact@v2
with:
name: NuGet packages
Expand Down
5 changes: 4 additions & 1 deletion Directory.Build.props
Expand Up @@ -8,7 +8,10 @@
<IncludeSymbols>true</IncludeSymbols>
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
<LangVersion>8.0</LangVersion>
<DefineConstants Condition="'$(TargetFramework)' == 'netcoreapp3.0' OR '$(TargetFramework)' == 'netstandard2.1'">$(DefineConstants);FEATURE_ASYNC_FILE;FEATURE_ENUMERATION_OPTIONS;FEATURE_ADVANCED_PATH_OPERATIONS</DefineConstants>
<PackageTags>testing</PackageTags>
<PackageProjectUrl>https://github.com/System-IO-Abstractions/System.IO.Abstractions</PackageProjectUrl>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<DefineConstants Condition="'$(TargetFramework)' == 'net5.0' OR '$(TargetFramework)' == 'netcoreapp3.0' OR '$(TargetFramework)' == 'netstandard2.1'">$(DefineConstants);FEATURE_ASYNC_FILE;FEATURE_ENUMERATION_OPTIONS;FEATURE_ADVANCED_PATH_OPERATIONSFEATURE_PATH_JOIN_WITH_SPAN</DefineConstants>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Nerdbank.GitVersioning" Version="3.3.37">
Expand Down
Expand Up @@ -3,7 +3,7 @@
<AssemblyName>System.IO.Abstractions.Benchmarks</AssemblyName>
<RootNamespace>System.IO.Abstractions.Benchmarks</RootNamespace>
<Description>Bencharmks comparisons.</Description>
<TargetFrameworks>netcoreapp3.1;net461</TargetFrameworks>
<TargetFrameworks>net5.0;netcoreapp3.1;net461</TargetFrameworks>
<PackageProjectUrl>https://github.com/System-IO-Abstractions/System.IO.Abstractions</PackageProjectUrl>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<PackageTags>testing</PackageTags>
Expand Down
4 changes: 2 additions & 2 deletions global.json
@@ -1,6 +1,6 @@
{
"sdk": {
"version": "3.1.300",
"rollForward": "latestMinor"
"version": "5.0.100",
"rollForward": "latestFeature"
}
}
Expand Up @@ -3,10 +3,7 @@
<AssemblyName>System.IO.Abstractions.TestingHelpers</AssemblyName>
<RootNamespace>System.IO.Abstractions.TestingHelpers</RootNamespace>
<Description>A set of pre-built mocks to help when testing file system interactions.</Description>
<TargetFrameworks>netstandard2.1;netstandard2.0;net461</TargetFrameworks>
<PackageProjectUrl>https://github.com/System-IO-Abstractions/System.IO.Abstractions</PackageProjectUrl>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<PackageTags>testing</PackageTags>
<TargetFrameworks>net5.0;netstandard2.1;netstandard2.0;net461</TargetFrameworks>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="../System.IO.Abstractions/System.IO.Abstractions.csproj" />
Expand Down
11 changes: 5 additions & 6 deletions src/System.IO.Abstractions/System.IO.Abstractions.csproj
Expand Up @@ -3,15 +3,14 @@
<AssemblyName>System.IO.Abstractions</AssemblyName>
<RootNamespace>System.IO.Abstractions</RootNamespace>
<Description>A set of abstractions to help make file system interactions testable.</Description>
<TargetFrameworks>netstandard2.1;netstandard2.0;net461</TargetFrameworks>
<PackageProjectUrl>https://github.com/System-IO-Abstractions/System.IO.Abstractions</PackageProjectUrl>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<PackageTags>testing</PackageTags>
<DefineConstants Condition="'$(TargetFramework)' == 'netstandard2.1'">$(DefineConstants);FEATURE_ASYNC_FILE;FEATURE_ENUMERATION_OPTIONS;FEATURE_ADVANCED_PATH_OPERATIONS;FEATURE_PATH_JOIN_WITH_SPAN</DefineConstants>
<TargetFrameworks>net5.0;netstandard2.1;netstandard2.0;net461</TargetFrameworks>
</PropertyGroup>
<ItemGroup Condition="'$(TargetFramework)' != 'net461'">
<ItemGroup Condition="'$(TargetFramework)' == 'netstandard2.1' OR '$(TargetFramework)' == 'netstandard2.0'">
<PackageReference Include="System.IO.FileSystem.AccessControl" Version="4.7.0"/>
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework)' == 'net5.0'">
<PackageReference Include="System.IO.FileSystem.AccessControl" Version="5.0.0"/>
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies.net461" Version="1.0.0">
<PrivateAssets>all</PrivateAssets>
Expand Down
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>netcoreapp3.1;netcoreapp2.1</TargetFrameworks>
<TargetFrameworks>net5.0;netcoreapp3.1;netcoreapp2.1</TargetFrameworks>
<TargetFrameworks Condition="!$([MSBuild]::IsOsUnixLike())">$(TargetFrameworks);net461</TargetFrameworks>
<Description>The unit tests for our pre-built mocks</Description>
<AssemblyName>System.IO.Abstractions.TestingHelpers.Tests</AssemblyName>
Expand Down
7 changes: 4 additions & 3 deletions tests/System.IO.Abstractions.Tests/ApiParityTests.cs
@@ -1,6 +1,5 @@
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using NUnit.Framework;
using Snapshooter;
using Snapshooter.NUnit;
Expand Down Expand Up @@ -92,9 +91,11 @@ public ApiDiff(IEnumerable<string> extraMembers, IEnumerable<string> missingMemb
#if NETCOREAPP3_1
private const string snapshotSuffix = ".NET Core 3.1";
#elif NETCOREAPP2_1
private const string snapshotSuffix = ".NET Core 2.1";
private const string snapshotSuffix = ".NET Core 2.1";
#elif NET461
private const string snapshotSuffix = ".NET Framework 4.6.1";
private const string snapshotSuffix = ".NET Framework 4.6.1";
#elif NET5_0
private const string snapshotSuffix = ".NET 5.0";
#else
#error Unknown target framework.
#endif
Expand Down
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>netcoreapp3.1;netcoreapp2.1</TargetFrameworks>
<TargetFrameworks>net5.0;netcoreapp3.1;netcoreapp2.1</TargetFrameworks>
<TargetFrameworks Condition="!$([MSBuild]::IsOsUnixLike())">$(TargetFrameworks);net461</TargetFrameworks>
<Description>The unit tests for our the core abstractions</Description>
<AssemblyName>System.IO.Abstractions.Tests</AssemblyName>
Expand Down
@@ -0,0 +1,14 @@
{
"ExtraMembers": [
"System.Security.AccessControl.DirectorySecurity GetAccessControl()",
"System.Security.AccessControl.DirectorySecurity GetAccessControl(System.Security.AccessControl.AccessControlSections)",
"Void Create(System.Security.AccessControl.DirectorySecurity)",
"Void SetAccessControl(System.Security.AccessControl.DirectorySecurity)"
],
"MissingMembers": [
"System.Object GetLifetimeService()",
"System.Object InitializeLifetimeService()",
"Void .ctor(System.String)",
"Void GetObjectData(System.Runtime.Serialization.SerializationInfo, System.Runtime.Serialization.StreamingContext)"
]
}
@@ -0,0 +1,12 @@
{
"ExtraMembers": [
"System.IO.Abstractions.IDirectoryInfo CreateDirectory(System.String, System.Security.AccessControl.DirectorySecurity)",
"System.Security.AccessControl.DirectorySecurity GetAccessControl(System.String)",
"System.Security.AccessControl.DirectorySecurity GetAccessControl(System.String, System.Security.AccessControl.AccessControlSections)",
"Void SetAccessControl(System.String, System.Security.AccessControl.DirectorySecurity)"
],
"MissingMembers": [
"System.String[] GetFileSystemEntries(System.String, System.String, System.IO.EnumerationOptions)",
"System.String[] GetFileSystemEntries(System.String, System.String, System.IO.SearchOption)"
]
}
@@ -0,0 +1,7 @@
{
"ExtraMembers": [],
"MissingMembers": [
"System.IO.Abstractions.IDriveInfo[] GetDrives()",
"Void .ctor(System.String)"
]
}
@@ -0,0 +1,14 @@
{
"ExtraMembers": [
"System.Security.AccessControl.FileSecurity GetAccessControl()",
"System.Security.AccessControl.FileSecurity GetAccessControl(System.Security.AccessControl.AccessControlSections)",
"Void SetAccessControl(System.Security.AccessControl.FileSecurity)"
],
"MissingMembers": [
"System.Object GetLifetimeService()",
"System.Object InitializeLifetimeService()",
"Void .ctor(System.String)",
"Void GetObjectData(System.Runtime.Serialization.SerializationInfo, System.Runtime.Serialization.StreamingContext)",
"Void MoveTo(System.String, Boolean)"
]
}
@@ -0,0 +1,12 @@
{
"ExtraMembers": [
"System.Security.AccessControl.FileSecurity GetAccessControl(System.String)",
"System.Security.AccessControl.FileSecurity GetAccessControl(System.String, System.Security.AccessControl.AccessControlSections)",
"System.Threading.Tasks.Task WriteAllLinesAsync(System.String, System.String[], System.Text.Encoding, System.Threading.CancellationToken)",
"System.Threading.Tasks.Task WriteAllLinesAsync(System.String, System.String[], System.Threading.CancellationToken)",
"Void SetAccessControl(System.String, System.Security.AccessControl.FileSecurity)"
],
"MissingMembers": [
"Void Move(System.String, System.String, Boolean)"
]
}
@@ -0,0 +1,28 @@
{
"ExtraMembers": [
"Char get_AltDirectorySeparatorChar()",
"Char get_DirectorySeparatorChar()",
"Char get_PathSeparator()",
"Char get_VolumeSeparatorChar()",
"Char[] get_InvalidPathChars()"
],
"MissingMembers": [
"Boolean EndsInDirectorySeparator(System.ReadOnlySpan`1[System.Char])",
"Boolean EndsInDirectorySeparator(System.String)",
"Boolean HasExtension(System.ReadOnlySpan`1[System.Char])",
"Boolean IsPathFullyQualified(System.ReadOnlySpan`1[System.Char])",
"Boolean IsPathRooted(System.ReadOnlySpan`1[System.Char])",
"System.ReadOnlySpan`1[System.Char] GetDirectoryName(System.ReadOnlySpan`1[System.Char])",
"System.ReadOnlySpan`1[System.Char] GetExtension(System.ReadOnlySpan`1[System.Char])",
"System.ReadOnlySpan`1[System.Char] GetFileName(System.ReadOnlySpan`1[System.Char])",
"System.ReadOnlySpan`1[System.Char] GetFileNameWithoutExtension(System.ReadOnlySpan`1[System.Char])",
"System.ReadOnlySpan`1[System.Char] GetPathRoot(System.ReadOnlySpan`1[System.Char])",
"System.ReadOnlySpan`1[System.Char] TrimEndingDirectorySeparator(System.ReadOnlySpan`1[System.Char])",
"System.String Join(System.ReadOnlySpan`1[System.Char], System.ReadOnlySpan`1[System.Char], System.ReadOnlySpan`1[System.Char], System.ReadOnlySpan`1[System.Char])",
"System.String Join(System.String, System.String)",
"System.String Join(System.String, System.String, System.String)",
"System.String Join(System.String, System.String, System.String, System.String)",
"System.String Join(System.String[])",
"System.String TrimEndingDirectorySeparator(System.String)"
]
}

0 comments on commit 016d16b

Please sign in to comment.