Skip to content

Commit

Permalink
Add net80 as target framework (#5)
Browse files Browse the repository at this point in the history
* Add net80 as target framework
* Update nuget packages to latests
* Update unit test to use the constraint model
* Bump version to v2.1.0
  • Loading branch information
axunonb authored Jul 2, 2024
1 parent 934889e commit b0cd5b2
Show file tree
Hide file tree
Showing 7 changed files with 46 additions and 60 deletions.
14 changes: 7 additions & 7 deletions .github/workflows/dotnet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,19 @@ jobs:
name: Build
runs-on: ${{ matrix.os }}
env:
version: '2.0.1'
versionFile: '2.0.1'
packDotNetVersion: '6'
version: '2.1.0'
versionFile: '2.1.0'
packDotNetVersion: '8'
strategy:
matrix:
os: [ ubuntu-latest ]
dotnet-version: [ '3.x', '6.x' ]
dotnet-version: [ '3.x', '6.x', '8.x' ]

steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v3
uses: actions/setup-dotnet@v4
with:
dotnet-version: ${{ matrix.dotnet-version }}
- name: Restore dependencies
Expand All @@ -44,7 +44,7 @@ jobs:
dotnet build ./Src/VirtualFileSystem.sln /verbosity:minimal --configuration release /p:IncludeSymbols=true /p:SymbolPackageFormat=snupkg /p:ContinuousIntegrationBuild=true /p:PackageOutputPath=${{ github.workspace }}/artifacts/ /p:Version=${{ env.version }} /p:FileVersion=${{ env.versionFile }}
dotnet pack ./Src/VirtualFileSystem.sln /verbosity:minimal --configuration release
- name: Upload Artifacts
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
if: startsWith(matrix.dotnet-version, env.packDotNetVersion)
with:
name: Packages_${{ env.version }}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,35 +1,32 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFrameworks>net60</TargetFrameworks>
<SignAssembly>true</SignAssembly>
<AssemblyOriginatorKeyFile>..\Axuno.VirtualFileSystem\Axuno.VirtualFileSystem.snk</AssemblyOriginatorKeyFile>
</PropertyGroup>

<ItemGroup>
<None Remove="Assets\Testfile_{2}.txt" />
</ItemGroup>

<ItemGroup>
<EmbeddedResource Include="Assets\*" />
</ItemGroup>

<ItemGroup>
<EmbeddedResource Include="Assets\Text\Testfile_1.txt" />
<EmbeddedResource Include="Assets\Text\Testfile_{2}.txt" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="7.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="7.0.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.4.1" />
<PackageReference Include="NUnit" Version="3.13.3" />
<PackageReference Include="NUnit3TestAdapter" Version="4.3.1" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="8.0.1" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.10.0" />
<PackageReference Include="NUnit" Version="4.1.0" />
<PackageReference Include="NUnit3TestAdapter" Version="4.5.0" />
<PackageReference Include="NUnit.Analyzers" Version="4.2.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\Axuno.VirtualFileSystem\Axuno.VirtualFileSystem.csproj" />
</ItemGroup>

</Project>
18 changes: 9 additions & 9 deletions Src/Axuno.VirtualFileSystem.Tests/DynamicFileProviderTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ public void Should_Get_Created_Files()
);

var fileInfo = _dynamicFileProvider.GetFileInfo("/my-files/test.txt");
Assert.IsNotNull(fileInfo);
Assert.AreEqual(fileContent, fileInfo.ReadAsString());
Assert.That(fileInfo, Is.Not.Null);
Assert.That(fileInfo.ReadAsString(), Is.EqualTo(fileContent));
}

[Test]
Expand All @@ -56,21 +56,21 @@ public void Should_Create_and_Delete_Files()
() => { fileCallbackCalled = true; });

var fileInfo = _dynamicFileProvider.GetFileInfo(dynamicPath);
Assert.IsTrue(fileInfo.Exists);
Assert.That(fileInfo.Exists);

// Deleting the file should trigger the callback

_dynamicFileProvider.Delete(dynamicPath);
fileInfo = _dynamicFileProvider.GetFileInfo(dynamicPath);
Assert.IsFalse(fileInfo.Exists);
Assert.IsTrue(fileCallbackCalled);
Assert.That(fileInfo.Exists, Is.False);

Assert.That(fileCallbackCalled);
}

[Test]
public void Deleting_Non_Existing_File_Just_Fails()
{
Assert.IsFalse(_dynamicFileProvider.Delete("does-not-exist"));
Assert.That(_dynamicFileProvider.Delete("does-not-exist"), Is.False);
}

[Test]
Expand Down Expand Up @@ -104,7 +104,7 @@ public void Should_Get_Notified_On_File_Change()
)
);

Assert.IsTrue(fileCallbackCalled);
Assert.That(fileCallbackCalled);

// Updating the file should trigger the callback (2nd test)

Expand All @@ -118,6 +118,6 @@ public void Should_Get_Notified_On_File_Change()
)
);

Assert.IsTrue(fileCallbackCalled);
Assert.That(fileCallbackCalled);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ public class VirtualFilePathHelperTests
public void NormalizePath()
{
// Hyphens should be normalized to underscores
Assert.AreEqual("~/test_one/test_two/test-three.txt", VirtualFilePathHelper.NormalizePath("~/test-one/test-two/test-three.txt"));
Assert.That(VirtualFilePathHelper.NormalizePath("~/test-one/test-two/test-three.txt"), Is.EqualTo("~/test_one/test_two/test-three.txt"));
}
}
22 changes: 11 additions & 11 deletions Src/Axuno.VirtualFileSystem.Tests/VirtualFileProviderTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,37 +22,37 @@ public void Should_Define_And_Get_Embedded_Resources()
{
var resource = _virtualFileProvider.GetFileInfo("/Text/Testfile_1.txt");

Assert.IsNotNull(resource);
Assert.IsTrue(resource.Exists);
Assert.That(resource, Is.Not.Null);
Assert.That(resource.Exists);

// file is expected as UTF8 without BOM
using var stream = resource.CreateReadStream();
Assert.AreEqual("Testfile_1.txt Content No <Cr><Lf>!", Encoding.UTF8.GetString(stream.GetAllBytes()));
Assert.That(Encoding.UTF8.GetString(stream.GetAllBytes()), Is.EqualTo("Testfile_1.txt Content No <Cr><Lf>!"));
}

[Test]
public void Should_Define_And_Get_Embedded_Resources_With_Special_Chars()
{
var resource = _virtualFileProvider.GetFileInfo("/Text/Testfile_{2}.txt");
Assert.IsNotNull(resource);
Assert.IsTrue(resource.Exists);
Assert.That(resource, Is.Not.Null);
Assert.That(resource.Exists);

// file is expected as UTF8 without BOM
using var stream = resource.CreateReadStream();
Assert.AreEqual("Testfile_{2}.txt Content No <Cr><Lf>!", Encoding.UTF8.GetString(stream.GetAllBytes()));
Assert.That(Encoding.UTF8.GetString(stream.GetAllBytes()), Is.EqualTo("Testfile_{2}.txt Content No <Cr><Lf>!"));
}

[Test]
public void Should_Define_And_Get_Embedded_Directory_Contents()
{
var contents = _virtualFileProvider.GetDirectoryContents("/Text");

Assert.IsTrue(contents.Exists);
Assert.That(contents.Exists);

var contentList = contents.ToList();

Assert.Contains("Testfile_1.txt", contentList.Select(c => c.Name).ToList());
Assert.Contains("Testfile_{2}.txt", contentList.Select(c => c.Name).ToList());
Assert.That(contentList.Select(c => c.Name).ToList(), Does.Contain("Testfile_1.txt"));
Assert.That(contentList.Select(c => c.Name).ToList(), Does.Contain("Testfile_{2}.txt"));
}

[TestCase("/")]
Expand All @@ -61,9 +61,9 @@ public void Should_Define_And_Get_Embedded_Root_Directory_Contents(string path)
{
var contents = _virtualFileProvider.GetDirectoryContents(path);

Assert.IsTrue(contents.Exists);
Assert.That(contents.Exists);

var contentList = contents.ToList();
Assert.Contains("Text", contents.ToList().Select(c => c.Name).ToList());
Assert.That(contents.ToList().Select(c => c.Name).ToList(), Does.Contain("Text"));
}
}
25 changes: 7 additions & 18 deletions Src/Axuno.VirtualFileSystem/Axuno.VirtualFileSystem.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>netstandard2.1;net60</TargetFrameworks>
<TargetFrameworks>netstandard2.1;net60;net80</TargetFrameworks>

This comment has been minimized.

Copy link
@kasperk81

kasperk81 Jul 25, 2024

Contributor

fyi, some tools have problem scanning non-standard framework names: #6

<Nullable>enable</Nullable>
<NoWarn>$(NoWarn);1591</NoWarn>
<SignAssembly>true</SignAssembly>
Expand All @@ -13,8 +12,7 @@
<PublishRepositoryUrl>true</PublishRepositoryUrl>
<PackageIcon>VirtualFileSystem.png</PackageIcon>
<PackageTags>virtual file system netstandard c#</PackageTags>
<PackageReleaseNotes>Bumped to v2.0.0
Breaking changes caused by updated dependencies</PackageReleaseNotes>
<PackageReleaseNotes></PackageReleaseNotes>
<Description>The Virtual File System makes it possible to manage files that do not exist on a physical file system (e.g. disk).

* The VirtualFileSystem can be extended by additional IVirtualFileProviders.
Expand All @@ -26,13 +24,11 @@ The library is a modified version of Volo.Abp.VirtualFileSystem 7.0</Description
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<PackageRequireLicenseAcceptance>true</PackageRequireLicenseAcceptance>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DocumentationFile></DocumentationFile>
<OutputPath>bin\Debug\</OutputPath>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
<OutputPath>bin\Release\</OutputPath>
<DocumentationFile>bin\Release\Axuno.VirtualFileSystem.xml</DocumentationFile>
Expand All @@ -42,32 +38,25 @@ The library is a modified version of Volo.Abp.VirtualFileSystem 7.0</Description
<EmbedUntrackedSources>true</EmbedUntrackedSources>
<IncludeSymbols>true</IncludeSymbols>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Extensions.FileProviders.Composite" Version="7.0.0" />
<PackageReference Include="Microsoft.Extensions.FileProviders.Embedded" Version="7.0.2" />
<PackageReference Include="Microsoft.Extensions.FileProviders.Physical" Version="7.0.0" />
<PackageReference Include="Microsoft.Extensions.Options" Version="7.0.0" />
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.1.1">
<PackageReference Include="Microsoft.Extensions.FileProviders.Composite" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.FileProviders.Embedded" Version="8.0.6" />
<PackageReference Include="Microsoft.Extensions.FileProviders.Physical" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Options" Version="8.0.2" />
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="8.0.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
</ItemGroup>

<ItemGroup>
<AssemblyAttribute Include="System.Runtime.CompilerServices.InternalsVisibleToAttribute">
<!-- Generate PublicKey: -->
<!-- Export public key: sn -p Axuno.VirtualFileSystem.snk Axuno.VirtualFileSystem.publickey -->
<!-- Display PublicKey: sn -tp Axuno.VirtualFileSystem.publickey -->
<_Parameter1>Axuno.VirtualFileSystem.Tests, PublicKey=002400000480000094000000060200000024000052534131000400000100010091cc5ebb97cd2f332fbb3f69e2c1b0092fdc87141c9f3085913c152796473e3772c3d0cc09f55a16bbd33eec598fd583ef5ab28f1a459672f56f1b9a9b68ead56c0a238800864d25c480d185b16a198ff19d15449ec18d2c19af4049432e3d089731430ea28d378c2c70f051d3f5356d0d1d483ad9cffb0762b748029bd3e0cb</_Parameter1>
</AssemblyAttribute>
</ItemGroup>

<ItemGroup>
<None Include="..\..\VirtualFileSystem.png">
<Pack>True</Pack>
<PackagePath></PackagePath>
</None>
</ItemGroup>

</Project>
4 changes: 2 additions & 2 deletions Src/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

<PropertyGroup>
<Product>Axuno.VirtualFileSystem</Product>
<Version>2.0.1</Version>
<FileVersion>2.0.1</FileVersion>
<Version>2.1.0</Version>
<FileVersion>2.1.0</FileVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion> <!--only update AssemblyVersion with major releases -->
<Company>axuno gGmbH</Company>
<Authors>axuno gGmbH</Authors>
Expand Down

0 comments on commit b0cd5b2

Please sign in to comment.