Skip to content

Commit

Permalink
feat: enable net8.0 (#1032)
Browse files Browse the repository at this point in the history
  • Loading branch information
vbreuss authored Nov 16, 2023
1 parent 96ac967 commit 5971bfd
Show file tree
Hide file tree
Showing 20 changed files with 79 additions and 15 deletions.
1 change: 1 addition & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ jobs:
5.0.x
6.0.x
7.0.x
8.0.x
- name: Run tests
run: dotnet test --collect:"XPlat Code Coverage" --logger "GitHubActions"
- name: Upload coverage
Expand Down
8 changes: 4 additions & 4 deletions Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<PackageReadmeFile>README.md</PackageReadmeFile>
<DefineConstants Condition="'$(TargetFramework)' != 'net461'">$(DefineConstants);FEATURE_FILE_SYSTEM_ACL_EXTENSIONS</DefineConstants>
<DefineConstants Condition="'$(TargetFramework)' == 'net7.0' OR '$(TargetFramework)' == 'net6.0' OR '$(TargetFramework)' == 'net5.0' OR '$(TargetFramework)' == 'netcoreapp3.1' OR '$(TargetFramework)' == 'netstandard2.1'">$(DefineConstants);FEATURE_ASYNC_FILE;FEATURE_ENUMERATION_OPTIONS;FEATURE_ADVANCED_PATH_OPERATIONS;FEATURE_PATH_JOIN_WITH_SPAN;FEATURE_SPAN</DefineConstants>
<DefineConstants Condition="'$(TargetFramework)' == 'net7.0' OR '$(TargetFramework)' == 'net6.0' OR '$(TargetFramework)' == 'net5.0'">$(DefineConstants);FEATURE_FILE_MOVE_WITH_OVERWRITE;FEATURE_SUPPORTED_OS_ATTRIBUTE;FEATURE_FILE_SYSTEM_WATCHER_FILTERS;FEATURE_ENDS_IN_DIRECTORY_SEPARATOR;FEATURE_PATH_JOIN_WITH_PARAMS;FEATURE_PATH_JOIN_WITH_FOUR_PATHS</DefineConstants>
<DefineConstants Condition="'$(TargetFramework)' == 'net7.0' OR '$(TargetFramework)' == 'net6.0'">$(DefineConstants);FEATURE_FILE_SYSTEM_INFO_LINK_TARGET;FEATURE_CREATE_SYMBOLIC_LINK;FEATURE_FILESTREAM_OPTIONS</DefineConstants>
<DefineConstants Condition="'$(TargetFramework)' == 'net7.0'">$(DefineConstants);FEATURE_PATH_EXISTS;FEATURE_FILE_SYSTEM_WATCHER_WAIT_WITH_TIMESPAN;FEATURE_FILE_ATTRIBUTES_VIA_HANDLE;FEATURE_CREATE_TEMP_SUBDIRECTORY;FEATURE_READ_LINES_ASYNC;FEATURE_UNIX_FILE_MODE</DefineConstants>
<DefineConstants Condition="'$(TargetFramework)' == 'net8.0' OR '$(TargetFramework)' == 'net7.0' OR '$(TargetFramework)' == 'net6.0' OR '$(TargetFramework)' == 'net5.0' OR '$(TargetFramework)' == 'netcoreapp3.1' OR '$(TargetFramework)' == 'netstandard2.1'">$(DefineConstants);FEATURE_ASYNC_FILE;FEATURE_ENUMERATION_OPTIONS;FEATURE_ADVANCED_PATH_OPERATIONS;FEATURE_PATH_JOIN_WITH_SPAN;FEATURE_SPAN</DefineConstants>
<DefineConstants Condition="'$(TargetFramework)' == 'net8.0' OR '$(TargetFramework)' == 'net7.0' OR '$(TargetFramework)' == 'net6.0' OR '$(TargetFramework)' == 'net5.0'">$(DefineConstants);FEATURE_FILE_MOVE_WITH_OVERWRITE;FEATURE_SUPPORTED_OS_ATTRIBUTE;FEATURE_FILE_SYSTEM_WATCHER_FILTERS;FEATURE_ENDS_IN_DIRECTORY_SEPARATOR;FEATURE_PATH_JOIN_WITH_PARAMS;FEATURE_PATH_JOIN_WITH_FOUR_PATHS</DefineConstants>
<DefineConstants Condition="'$(TargetFramework)' == 'net8.0' OR '$(TargetFramework)' == 'net7.0' OR '$(TargetFramework)' == 'net6.0'">$(DefineConstants);FEATURE_FILE_SYSTEM_INFO_LINK_TARGET;FEATURE_CREATE_SYMBOLIC_LINK;FEATURE_FILESTREAM_OPTIONS</DefineConstants>
<DefineConstants Condition="'$(TargetFramework)' == 'net8.0' OR '$(TargetFramework)' == 'net7.0'">$(DefineConstants);FEATURE_PATH_EXISTS;FEATURE_FILE_SYSTEM_WATCHER_WAIT_WITH_TIMESPAN;FEATURE_FILE_ATTRIBUTES_VIA_HANDLE;FEATURE_CREATE_TEMP_SUBDIRECTORY;FEATURE_READ_LINES_ASYNC;FEATURE_UNIX_FILE_MODE</DefineConstants>
<DefineConstants>$(DefineConstants);FEATURE_SERIALIZABLE</DefineConstants>
</PropertyGroup>
<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion global.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"sdk": {
"version": "7.0.404",
"version": "8.0.100",
"rollForward": "latestMinor"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<AssemblyName>TestableIO.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>net7.0;net6.0;net5.0;netstandard2.1;netstandard2.0;net461</TargetFrameworks>
<TargetFrameworks>net8.0;net7.0;net6.0;net5.0;netstandard2.1;netstandard2.0;net461</TargetFrameworks>
<PackageIcon>icon_256x256.png</PackageIcon>
</PropertyGroup>
<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<AssemblyName>TestableIO.System.IO.Abstractions.Wrappers</AssemblyName>
<RootNamespace>System.IO.Abstractions</RootNamespace>
<Description>A set of abstractions to help make file system interactions testable.</Description>
<TargetFrameworks>net7.0;net6.0;net5.0;netstandard2.1;netstandard2.0;net461</TargetFrameworks>
<TargetFrameworks>net8.0;net7.0;net6.0;net5.0;netstandard2.1;netstandard2.0;net461</TargetFrameworks>
<PackageIcon>icon_256x256.png</PackageIcon>
</PropertyGroup>
<ItemGroup Condition="'$(TargetFramework)' == 'netstandard2.1' OR '$(TargetFramework)' == 'netstandard2.0'">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@
<AssemblyName>TestableIO.System.IO.Abstractions</AssemblyName>
<RootNamespace>System.IO.Abstractions</RootNamespace>
<Description>A set of abstractions to help make file system interactions testable.</Description>
<TargetFrameworks>net7.0;net6.0;net5.0;netstandard2.1;netstandard2.0;net461</TargetFrameworks>
<TargetFrameworks>net8.0;net7.0;net6.0;net5.0;netstandard2.1;netstandard2.0;net461</TargetFrameworks>
<PackageIcon>icon_256x256.png</PackageIcon>
<Nullable>enable</Nullable>
<LangVersion>preview</LangVersion>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies.net461" Version="1.0.3">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ public void SerializationBytes()

//Act
var memoryStream = new MemoryStream();
#pragma warning disable SYSLIB0011
var serializer = new Runtime.Serialization.Formatters.Binary.BinaryFormatter();

#pragma warning disable SYSLIB0011
serializer.Serialize(memoryStream, fileSystem);
memoryStream.Flush();
memoryStream.Position = 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -174,9 +174,9 @@ public void MockFileSystem_ByDefault_IsSerializable()
});
var memoryStream = new MemoryStream();

#pragma warning disable SYSLIB0011
var serializer = new Runtime.Serialization.Formatters.Binary.BinaryFormatter();

#pragma warning disable SYSLIB0011
serializer.Serialize(memoryStream, fileSystem);
#pragma warning restore SYSLIB0011

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -541,10 +541,10 @@ public void Serializable_works()
MockFileData data = new MockFileData("Text Contents");

//Act
#pragma warning disable SYSLIB0011
IFormatter formatter = new BinaryFormatter();
Stream stream = new MemoryStream();

#pragma warning disable SYSLIB0011
formatter.Serialize(stream, data);
#pragma warning restore SYSLIB0011

Expand All @@ -561,9 +561,9 @@ public void Serializable_can_deserialize()
//Act
MockFileData data = new MockFileData(textContentStr);

#pragma warning disable SYSLIB0011
IFormatter formatter = new BinaryFormatter();
Stream stream = new MemoryStream();
#pragma warning disable SYSLIB0011
formatter.Serialize(stream, data);

stream.Seek(0, SeekOrigin.Begin);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net7.0;net6.0;net5.0;netcoreapp3.1</TargetFrameworks>
<TargetFrameworks>net8.0;net7.0;net6.0;net5.0;netcoreapp3.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
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,8 @@ public ApiDiff(IEnumerable<string> extraMembers, IEnumerable<string> missingMemb
private const string snapshotSuffix = ".NET 6.0";
#elif NET7_0
private const string snapshotSuffix = ".NET 7.0";
#elif NET8_0
private const string snapshotSuffix = ".NET 8.0";
#else
#error Unknown target framework.
#endif
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ public void Is_Serializable()
var fileSystem = new FileSystem();
var memoryStream = new MemoryStream();

#pragma warning disable SYSLIB0011
var serializer = new Runtime.Serialization.Formatters.Binary.BinaryFormatter();

#pragma warning disable SYSLIB0011
serializer.Serialize(memoryStream, fileSystem);
#pragma warning restore SYSLIB0011

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net7.0;net6.0;net5.0;netcoreapp3.1</TargetFrameworks>
<TargetFrameworks>net8.0;net7.0;net6.0;net5.0;netcoreapp3.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
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"ExtraMembers": [],
"MissingMembers": [
"System.Object GetLifetimeService()",
"System.Object InitializeLifetimeService()",
"Void .ctor(System.String)",
"Void GetObjectData(System.Runtime.Serialization.SerializationInfo, System.Runtime.Serialization.StreamingContext)"
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"ExtraMembers": [],
"MissingMembers": []
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"ExtraMembers": [],
"MissingMembers": [
"System.IO.Abstractions.IDriveInfo[] GetDrives()",
"Void .ctor(System.String)"
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"ExtraMembers": [],
"MissingMembers": [
"System.Object GetLifetimeService()",
"System.Object InitializeLifetimeService()",
"Void .ctor(System.String)",
"Void GetObjectData(System.Runtime.Serialization.SerializationInfo, System.Runtime.Serialization.StreamingContext)"
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"ExtraMembers": [
"Void Dispose(Boolean)"
],
"MissingMembers": [
"System.EventHandler Disposed",
"System.Object GetLifetimeService()",
"System.Object InitializeLifetimeService()",
"Void .ctor()",
"Void .ctor(System.String)",
"Void .ctor(System.String, System.String)",
"Void add_Disposed(System.EventHandler)",
"Void remove_Disposed(System.EventHandler)"
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"ExtraMembers": [],
"MissingMembers": [
"Microsoft.Win32.SafeHandles.SafeFileHandle OpenHandle(System.String, System.IO.FileMode, System.IO.FileAccess, System.IO.FileShare, System.IO.FileOptions, Int64)"
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"ExtraMembers": [
"Char get_AltDirectorySeparatorChar()",
"Char get_DirectorySeparatorChar()",
"Char get_PathSeparator()",
"Char get_VolumeSeparatorChar()",
"Char[] get_InvalidPathChars()"
],
"MissingMembers": []
}

0 comments on commit 5971bfd

Please sign in to comment.