-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use NonBlockingFileSystem fs wrapper (#162)
* Bump * Add NonBlockingFileSystem * Fix CS
- Loading branch information
Showing
4 changed files
with
191 additions
and
138 deletions.
There are no files selected for viewing
138 changes: 69 additions & 69 deletions
138
src/GitReader.SourceGenerator.Tests/GitReader.SourceGenerator.Tests.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,69 +1,69 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<TargetFrameworks>net8.0;net9.0</TargetFrameworks> | ||
<LangVersion>13.0</LangVersion> | ||
<Nullable>enable</Nullable> | ||
<IsPackable>false</IsPackable> | ||
</PropertyGroup> | ||
|
||
<Import Project="..\WarningConfiguration.targets" /> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="H.Generators.Tests.Extensions" Version="1.24.1" /> | ||
<PackageReference Include="Microsoft.Bcl.TimeProvider" Version="8.0.1" /> | ||
<PackageReference Include="Microsoft.CodeAnalysis.Analyzers" Version="3.11.0" PrivateAssets="all" /> | ||
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Workspaces" Version="4.12.0" PrivateAssets="all" /> | ||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.12.0" /> | ||
<PackageReference Include="System.ComponentModel.Annotations" Version="5.0.0" /> | ||
<PackageReference Include="Verify.XUnit" Version="28.9.0" /> | ||
<PackageReference Include="Verify.SourceGenerators" Version="2.5.0" /> | ||
<PackageReference Include="xunit" Version="2.9.3" /> | ||
<PackageReference Include="xunit.runner.visualstudio" Version="3.0.1"> | ||
<PrivateAssets>all</PrivateAssets> | ||
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets> | ||
</PackageReference> | ||
</ItemGroup> | ||
|
||
<ItemGroup Condition=" '$(TargetFramework)' == 'net8.0' "> | ||
<PackageReference Include="System.Text.Json" Version="8.0.5" /> | ||
<PackageReference Include="Microsoft.Extensions.TimeProvider.Testing" Version="8.10.0" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup Condition=" '$(TargetFramework)' == 'net9.0' "> | ||
<PackageReference Include="System.Text.Json" Version="9.0.1" /> | ||
<PackageReference Include="Microsoft.Extensions.TimeProvider.Testing" Version="9.1.0" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<ProjectReference Include="..\GitReader.SourceGenerator\GitReader.SourceGenerator.csproj" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<None Update="GitReaderSnapshotTests.*.g.verified.cs"> | ||
<DependentUpon>GitReaderSnapshotTests.cs</DependentUpon> | ||
</None> | ||
</ItemGroup> | ||
|
||
<Target Name="ExtractSnapshots" BeforeTargets="Restore;_GenerateRestoreProjectSpec"> | ||
<Message Importance="High" Text="Extracting $(MSBuildProjectDirectory)/../../v-tag-repository.zip to the $(MSBuildProjectDirectory)/../../repository-snapshots" /> | ||
<Message Importance="High" Text="Extracting $(MSBuildProjectDirectory)/../../tag-repository.zip to the $(MSBuildProjectDirectory)/../../repository-snapshots" /> | ||
<Message Importance="High" Text="Extracting $(MSBuildProjectDirectory)/../../no-tag-repository.zip to the $(MSBuildProjectDirectory)/../../repository-snapshots" /> | ||
|
||
<Unzip SourceFiles="$(MSBuildProjectDirectory)/../../repository-snapshots/v-tag-repository.zip" | ||
DestinationFolder="$(MSBuildProjectDirectory)/../../repository-snapshots" | ||
Condition="!Exists('$(MSBuildProjectDirectory)/../../repository-snapshots/v-tag-repository')" | ||
OverwriteReadOnlyFiles="true" /> | ||
|
||
<Unzip SourceFiles="$(MSBuildProjectDirectory)/../../repository-snapshots/tag-repository.zip" | ||
DestinationFolder="$(MSBuildProjectDirectory)/../../repository-snapshots" | ||
Condition="!Exists('$(MSBuildProjectDirectory)/../../repository-snapshots/tag-repository')" | ||
OverwriteReadOnlyFiles="true" /> | ||
|
||
<Unzip SourceFiles="$(MSBuildProjectDirectory)/../../repository-snapshots/no-tag-repository.zip" | ||
DestinationFolder="$(MSBuildProjectDirectory)/../../repository-snapshots" | ||
Condition="!Exists('$(MSBuildProjectDirectory)/../../repository-snapshots/no-tag-repository')" | ||
OverwriteReadOnlyFiles="true" /> | ||
</Target> | ||
|
||
</Project> | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<TargetFrameworks>net8.0;net9.0</TargetFrameworks> | ||
<LangVersion>13.0</LangVersion> | ||
<Nullable>enable</Nullable> | ||
<IsPackable>false</IsPackable> | ||
</PropertyGroup> | ||
|
||
<Import Project="..\WarningConfiguration.targets" /> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="H.Generators.Tests.Extensions" Version="1.24.1" /> | ||
<PackageReference Include="Microsoft.Bcl.TimeProvider" Version="8.0.1" /> | ||
<PackageReference Include="Microsoft.CodeAnalysis.Analyzers" Version="3.11.0" PrivateAssets="all" /> | ||
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Workspaces" Version="4.12.0" PrivateAssets="all" /> | ||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.12.0" /> | ||
<PackageReference Include="System.ComponentModel.Annotations" Version="5.0.0" /> | ||
<PackageReference Include="Verify.XUnit" Version="28.9.0" /> | ||
<PackageReference Include="Verify.SourceGenerators" Version="2.5.0" /> | ||
<PackageReference Include="xunit" Version="2.9.3" /> | ||
<PackageReference Include="xunit.runner.visualstudio" Version="3.0.1"> | ||
<PrivateAssets>all</PrivateAssets> | ||
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets> | ||
</PackageReference> | ||
</ItemGroup> | ||
|
||
<ItemGroup Condition=" '$(TargetFramework)' == 'net8.0' "> | ||
<PackageReference Include="System.Text.Json" Version="8.0.5" /> | ||
<PackageReference Include="Microsoft.Extensions.TimeProvider.Testing" Version="8.10.0" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup Condition=" '$(TargetFramework)' == 'net9.0' "> | ||
<PackageReference Include="System.Text.Json" Version="9.0.1" /> | ||
<PackageReference Include="Microsoft.Extensions.TimeProvider.Testing" Version="9.1.0" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<ProjectReference Include="..\GitReader.SourceGenerator\GitReader.SourceGenerator.csproj" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<None Update="GitReaderSnapshotTests.*.g.verified.cs"> | ||
<DependentUpon>GitReaderSnapshotTests.cs</DependentUpon> | ||
</None> | ||
</ItemGroup> | ||
|
||
<Target Name="ExtractSnapshots" BeforeTargets="Restore;_GenerateRestoreProjectSpec"> | ||
<Message Importance="High" Text="Extracting $(MSBuildProjectDirectory)/../../v-tag-repository.zip to the $(MSBuildProjectDirectory)/../../repository-snapshots" /> | ||
<Message Importance="High" Text="Extracting $(MSBuildProjectDirectory)/../../tag-repository.zip to the $(MSBuildProjectDirectory)/../../repository-snapshots" /> | ||
<Message Importance="High" Text="Extracting $(MSBuildProjectDirectory)/../../no-tag-repository.zip to the $(MSBuildProjectDirectory)/../../repository-snapshots" /> | ||
|
||
<Unzip SourceFiles="$(MSBuildProjectDirectory)/../../repository-snapshots/v-tag-repository.zip" | ||
DestinationFolder="$(MSBuildProjectDirectory)/../../repository-snapshots" | ||
Condition="!Exists('$(MSBuildProjectDirectory)/../../repository-snapshots/v-tag-repository')" | ||
OverwriteReadOnlyFiles="true" /> | ||
|
||
<Unzip SourceFiles="$(MSBuildProjectDirectory)/../../repository-snapshots/tag-repository.zip" | ||
DestinationFolder="$(MSBuildProjectDirectory)/../../repository-snapshots" | ||
Condition="!Exists('$(MSBuildProjectDirectory)/../../repository-snapshots/tag-repository')" | ||
OverwriteReadOnlyFiles="true" /> | ||
|
||
<Unzip SourceFiles="$(MSBuildProjectDirectory)/../../repository-snapshots/no-tag-repository.zip" | ||
DestinationFolder="$(MSBuildProjectDirectory)/../../repository-snapshots" | ||
Condition="!Exists('$(MSBuildProjectDirectory)/../../repository-snapshots/no-tag-repository')" | ||
OverwriteReadOnlyFiles="true" /> | ||
</Target> | ||
|
||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
118 changes: 59 additions & 59 deletions
118
src/GitReader.SourceGenerator/GitReader.SourceGenerator.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,59 +1,59 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<TargetFramework>netstandard2.0</TargetFramework> | ||
<LangVersion>13.0</LangVersion> | ||
<Nullable>enable</Nullable> | ||
<ProjectName>GitReader.Generator</ProjectName> | ||
<EnforceExtendedAnalyzerRules>true</EnforceExtendedAnalyzerRules> | ||
<DisableImplicitNuGetFallbackFolder>true</DisableImplicitNuGetFallbackFolder> | ||
<IsPackable>true</IsPackable> | ||
</PropertyGroup> | ||
|
||
<Import Project="..\WarningConfiguration.targets" /> | ||
|
||
<PropertyGroup Label="NuGet"> | ||
<PackageLicense>MIT</PackageLicense> | ||
<RepositoryUrl>https://github.com/aviationexam/git-reader-source-generator</RepositoryUrl> | ||
<RepositoryType>git</RepositoryType> | ||
<IncludeSymbols>true</IncludeSymbols> | ||
<SymbolPackageFormat>snupkg</SymbolPackageFormat> | ||
<DevelopmentDependency>true</DevelopmentDependency> | ||
<PackageReadmeFile>README.md</PackageReadmeFile> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<None Include="$(OutputPath)\$(AssemblyName).dll" Pack="true" PackagePath="analyzers/dotnet/cs" Visible="false" /> | ||
<None Include="$(AssemblyName).props" Pack="true" PackagePath="build" /> | ||
<None Include="..\..\README.md" Pack="true" PackagePath="\" Visible="false"/> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="Microsoft.Bcl.TimeProvider" Version="8.0.1" PrivateAssets="all" GeneratePathProperty="true" /> | ||
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="4.12.0" PrivateAssets="all" /> | ||
<PackageReference Include="GitReader" Version="1.8.0" PrivateAssets="all" GeneratePathProperty="true" /> | ||
<PackageReference Include="GitReader.Core" Version="1.8.0" PrivateAssets="all" GeneratePathProperty="true" /> | ||
<PackageReference Include="H.Generators.Extensions" Version="1.24.0" PrivateAssets="all" GeneratePathProperty="true" /> | ||
<PackageReference Include="PolySharp" Version="1.15.0" PrivateAssets="all" /> | ||
</ItemGroup> | ||
|
||
<PropertyGroup> | ||
<TargetsForTfmSpecificContentInPackage>$(TargetsForTfmSpecificContentInPackage);_AddAnalyzersToOutput</TargetsForTfmSpecificContentInPackage> | ||
</PropertyGroup> | ||
|
||
<Target Name="_AddAnalyzersToOutput"> | ||
<Message Importance="High" Text="$(MSBuildProjectDirectory)\$(OutputPath)" /> | ||
<Message Importance="High" Text="$(PkgMicrosoft_Bcl_TimeProvider)\lib\netstandard2.0\Microsoft.Bcl.TimeProvider.dll" /> | ||
<Message Importance="High" Text="$(PkgGitReader)\lib\netstandard2.0\GitReader.dll" /> | ||
<Message Importance="High" Text="$(PkgGitReader_Core)\lib\netstandard2.0\GitReader.Core.dll" /> | ||
<Message Importance="High" Text="$(PkgH_Generators_Extensions)\lib\netstandard2.0\H.Generators.Extensions.dll" /> | ||
|
||
<ItemGroup> | ||
<TfmSpecificPackageFile Include="$(PkgMicrosoft_Bcl_TimeProvider)\lib\netstandard2.0\Microsoft.Bcl.TimeProvider.dll" PackagePath="analyzers/dotnet/cs" /> | ||
<TfmSpecificPackageFile Include="$(PkgGitReader)\lib\netstandard2.0\GitReader.dll" PackagePath="analyzers/dotnet/cs" /> | ||
<TfmSpecificPackageFile Include="$(PkgGitReader_Core)\lib\netstandard2.0\GitReader.Core.dll" PackagePath="analyzers/dotnet/cs" /> | ||
<TfmSpecificPackageFile Include="$(PkgH_Generators_Extensions)\lib\netstandard2.0\H.Generators.Extensions.dll" PackagePath="analyzers/dotnet/cs" /> | ||
</ItemGroup> | ||
</Target> | ||
|
||
</Project> | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<TargetFramework>netstandard2.0</TargetFramework> | ||
<LangVersion>13.0</LangVersion> | ||
<Nullable>enable</Nullable> | ||
<ProjectName>GitReader.Generator</ProjectName> | ||
<EnforceExtendedAnalyzerRules>true</EnforceExtendedAnalyzerRules> | ||
<DisableImplicitNuGetFallbackFolder>true</DisableImplicitNuGetFallbackFolder> | ||
<IsPackable>true</IsPackable> | ||
</PropertyGroup> | ||
|
||
<Import Project="..\WarningConfiguration.targets" /> | ||
|
||
<PropertyGroup Label="NuGet"> | ||
<PackageLicense>MIT</PackageLicense> | ||
<RepositoryUrl>https://github.com/aviationexam/git-reader-source-generator</RepositoryUrl> | ||
<RepositoryType>git</RepositoryType> | ||
<IncludeSymbols>true</IncludeSymbols> | ||
<SymbolPackageFormat>snupkg</SymbolPackageFormat> | ||
<DevelopmentDependency>true</DevelopmentDependency> | ||
<PackageReadmeFile>README.md</PackageReadmeFile> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<None Include="$(OutputPath)\$(AssemblyName).dll" Pack="true" PackagePath="analyzers/dotnet/cs" Visible="false" /> | ||
<None Include="$(AssemblyName).props" Pack="true" PackagePath="build" /> | ||
<None Include="..\..\README.md" Pack="true" PackagePath="\" Visible="false"/> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="Microsoft.Bcl.TimeProvider" Version="8.0.1" PrivateAssets="all" GeneratePathProperty="true" /> | ||
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="4.12.0" PrivateAssets="all" /> | ||
<PackageReference Include="GitReader" Version="1.8.0" PrivateAssets="all" GeneratePathProperty="true" /> | ||
<PackageReference Include="GitReader.Core" Version="1.8.0" PrivateAssets="all" GeneratePathProperty="true" /> | ||
<PackageReference Include="H.Generators.Extensions" Version="1.24.0" PrivateAssets="all" GeneratePathProperty="true" /> | ||
<PackageReference Include="PolySharp" Version="1.15.0" PrivateAssets="all" /> | ||
</ItemGroup> | ||
|
||
<PropertyGroup> | ||
<TargetsForTfmSpecificContentInPackage>$(TargetsForTfmSpecificContentInPackage);_AddAnalyzersToOutput</TargetsForTfmSpecificContentInPackage> | ||
</PropertyGroup> | ||
|
||
<Target Name="_AddAnalyzersToOutput"> | ||
<Message Importance="High" Text="$(MSBuildProjectDirectory)\$(OutputPath)" /> | ||
<Message Importance="High" Text="$(PkgMicrosoft_Bcl_TimeProvider)\lib\netstandard2.0\Microsoft.Bcl.TimeProvider.dll" /> | ||
<Message Importance="High" Text="$(PkgGitReader)\lib\netstandard2.0\GitReader.dll" /> | ||
<Message Importance="High" Text="$(PkgGitReader_Core)\lib\netstandard2.0\GitReader.Core.dll" /> | ||
<Message Importance="High" Text="$(PkgH_Generators_Extensions)\lib\netstandard2.0\H.Generators.Extensions.dll" /> | ||
|
||
<ItemGroup> | ||
<TfmSpecificPackageFile Include="$(PkgMicrosoft_Bcl_TimeProvider)\lib\netstandard2.0\Microsoft.Bcl.TimeProvider.dll" PackagePath="analyzers/dotnet/cs" /> | ||
<TfmSpecificPackageFile Include="$(PkgGitReader)\lib\netstandard2.0\GitReader.dll" PackagePath="analyzers/dotnet/cs" /> | ||
<TfmSpecificPackageFile Include="$(PkgGitReader_Core)\lib\netstandard2.0\GitReader.Core.dll" PackagePath="analyzers/dotnet/cs" /> | ||
<TfmSpecificPackageFile Include="$(PkgH_Generators_Extensions)\lib\netstandard2.0\H.Generators.Extensions.dll" PackagePath="analyzers/dotnet/cs" /> | ||
</ItemGroup> | ||
</Target> | ||
|
||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
using GitReader.IO; | ||
using System.Diagnostics.CodeAnalysis; | ||
using System.IO; | ||
using System.Threading; | ||
using System.Threading.Tasks; | ||
|
||
namespace GitReader.SourceGenerator; | ||
|
||
[SuppressMessage("MicrosoftCodeAnalysisCorrectness", "RS1035:Do not use APIs banned for analyzers")] | ||
internal sealed class NonBlockingFileSystem( | ||
int bufferSize | ||
) : IFileSystem | ||
{ | ||
private readonly IFileSystem _fileSystem = new StandardFileSystem(bufferSize); | ||
|
||
public string Combine( | ||
params string[] paths | ||
) => _fileSystem.Combine(paths); | ||
|
||
public string GetDirectoryPath( | ||
string path | ||
) => _fileSystem.GetDirectoryPath(path); | ||
|
||
public string GetFullPath( | ||
string path | ||
) => _fileSystem.GetFullPath(path); | ||
|
||
public bool IsPathRooted( | ||
string path | ||
) => _fileSystem.IsPathRooted(path); | ||
|
||
public string ResolveRelativePath( | ||
string basePath, string path | ||
) => _fileSystem.ResolveRelativePath(basePath, path); | ||
|
||
public Task<bool> IsFileExistsAsync( | ||
string path, CancellationToken ct | ||
) => _fileSystem.IsFileExistsAsync(path, ct); | ||
|
||
public Task<string[]> GetFilesAsync( | ||
string basePath, string match, CancellationToken ct | ||
) => _fileSystem.GetFilesAsync(basePath, match, ct); | ||
|
||
public Task<Stream> OpenAsync( | ||
string path, bool isSeekable, CancellationToken ct | ||
) => Task.FromResult<Stream>(new FileStream( | ||
path, | ||
FileMode.Open, | ||
FileAccess.Read, | ||
FileShare.ReadWrite, | ||
65536, | ||
true | ||
)); | ||
|
||
public Task<TemporaryFileDescriptor> CreateTemporaryAsync( | ||
CancellationToken ct | ||
) => _fileSystem.CreateTemporaryAsync(ct); | ||
} |