Cleanup solution infrastructure

This commit is contained in:
James Jackson-South 2020-04-28 10:58:23 +01:00
Родитель 60ce2d42c9
Коммит 1c030e71f6
24 изменённых файлов: 458 добавлений и 235 удалений

1
.gitattributes поставляемый
Просмотреть файл

@ -107,6 +107,7 @@
*.tga binary
*.ttc binary
*.ttf binary
*.webp binary
*.woff binary
*.woff2 binary
*.xls binary

3
.gitmodules поставляемый Normal file
Просмотреть файл

@ -0,0 +1,3 @@
[submodule "shared-infrastructure"]
path = shared-infrastructure
url = https://github.com/SixLabors/SharedInfrastructure

139
Directory.Build.props Normal file
Просмотреть файл

@ -0,0 +1,139 @@
<?xml version="1.0" encoding="utf-8"?>
<Project>
<!--
Directory.Build.props is automatically picked up and imported by
Microsoft.Common.props. This file needs to exist, even if empty so that
files in the parent directory tree, with the same name, are not imported
instead. The import fairly early and only Sdk.props will have been imported
beforehand. We also don't need to add ourselves to MSBuildAllProjects, as
that is done by the file that imports us.
-->
<!-- Default settings that are used by other settings -->
<PropertyGroup>
<BaseArtifactsPath>$(MSBuildThisFileDirectory)artifacts/</BaseArtifactsPath>
<BaseArtifactsPathSuffix>$(ImageSharpProjectCategory)/$(MSBuildProjectName)</BaseArtifactsPathSuffix>
<RepositoryUrl Condition="'$(RepositoryUrl)' == ''">https://github.com/SixLabors/ZlibStream/</RepositoryUrl>
</PropertyGroup>
<!-- Default settings that explicitly differ from the Sdk.props defaults -->
<PropertyGroup>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<BaseIntermediateOutputPath>$(BaseArtifactsPath)obj/$(BaseArtifactsPathSuffix)/</BaseIntermediateOutputPath>
<DebugType>portable</DebugType>
<DebugType Condition="'$(codecov)' != ''">full</DebugType>
<NullableContextOptions>disable</NullableContextOptions>
<PackageRequireLicenseAcceptance>true</PackageRequireLicenseAcceptance>
<SuppressNETCoreSdkPreviewMessage>true</SuppressNETCoreSdkPreviewMessage>
</PropertyGroup>
<!--
https://apisof.net/
+===================+=======+==========+=====================+=============+=================+====================+==============+=========+===============+
| SUPPORTS | MATHF | HASHCODE | EXTENDED_INTRINSICS | SPAN_STREAM | ENCODING_STRING | RUNTIME_INTRINSICS | CODECOVERAGE | HOTPATH | SERIALIZATION |
+===================+=======+==========+=====================+=============+=================+====================+==============+=========|===============+
| netcoreapp3.1 | Y | Y | Y | Y | Y | Y | Y | Y | Y |
| netcoreapp2.1 | Y | Y | Y | Y | Y | N | Y | N | Y |
| netcoreapp2.0 | Y | N | N | N | N | N | Y | N | Y |
| netstandard2.1 | Y | Y | N | Y | Y | N | Y | N | Y |
| netstandard2.0 | N | N | N | N | N | N | Y | N | Y |
| netstandard1.3 | N | N | N | N | N | N | N | N | N |
| net472 | N | N | Y | N | N | N | Y | N | Y |
+===================+=======+==========+=====================+=============+=================+====================+==============+=========|===============+
-->
<PropertyGroup Condition="'$(TargetFramework)' == 'netcoreapp3.1'">
<DefineConstants>$(DefineConstants);SUPPORTS_MATHF;</DefineConstants>
<DefineConstants>$(DefineConstants);SUPPORTS_HASHCODE;</DefineConstants>
<DefineConstants>$(DefineConstants);SUPPORTS_EXTENDED_INTRINSICS</DefineConstants>
<DefineConstants>$(DefineConstants);SUPPORTS_SPAN_STREAM</DefineConstants>
<DefineConstants>$(DefineConstants);SUPPORTS_ENCODING_STRING</DefineConstants>
<DefineConstants>$(DefineConstants);SUPPORTS_RUNTIME_INTRINSICS</DefineConstants>
<DefineConstants>$(DefineConstants);SUPPORTS_CODECOVERAGE</DefineConstants>
<DefineConstants>$(DefineConstants);SUPPORTS_HOTPATH</DefineConstants>
<DefineConstants>$(DefineConstants);SUPPORTS_SERIALIZATION</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition="'$(TargetFramework)' == 'netcoreapp2.1'">
<DefineConstants>$(DefineConstants);SUPPORTS_MATHF;</DefineConstants>
<DefineConstants>$(DefineConstants);SUPPORTS_HASHCODE;</DefineConstants>
<DefineConstants>$(DefineConstants);SUPPORTS_EXTENDED_INTRINSICS</DefineConstants>
<DefineConstants>$(DefineConstants);SUPPORTS_SPAN_STREAM</DefineConstants>
<DefineConstants>$(DefineConstants);SUPPORTS_ENCODING_STRING</DefineConstants>
<DefineConstants>$(DefineConstants);SUPPORTS_CODECOVERAGE</DefineConstants>
<DefineConstants>$(DefineConstants);SUPPORTS_HOTPATH</DefineConstants>
<DefineConstants>$(DefineConstants);SUPPORTS_SERIALIZATION</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition="'$(TargetFramework)' == 'netcoreapp2.0'">
<DefineConstants>$(DefineConstants);SUPPORTS_MATHF;</DefineConstants>
<DefineConstants>$(DefineConstants);SUPPORTS_CODECOVERAGE</DefineConstants>
<DefineConstants>$(DefineConstants);SUPPORTS_SERIALIZATION</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition="'$(TargetFramework)' == 'netstandard2.1'">
<DefineConstants>$(DefineConstants);SUPPORTS_MATHF;</DefineConstants>
<DefineConstants>$(DefineConstants);SUPPORTS_HASHCODE;</DefineConstants>
<DefineConstants>$(DefineConstants);SUPPORTS_SPAN_STREAM</DefineConstants>
<DefineConstants>$(DefineConstants);SUPPORTS_ENCODING_STRING</DefineConstants>
<DefineConstants>$(DefineConstants);SUPPORTS_CODECOVERAGE</DefineConstants>
<DefineConstants>$(DefineConstants);SUPPORTS_SERIALIZATION</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition="'$(TargetFramework)' == 'netstandard2.0'">
<DefineConstants>$(DefineConstants);SUPPORTS_CODECOVERAGE</DefineConstants>
<DefineConstants>$(DefineConstants);SUPPORTS_SERIALIZATION</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition="'$(TargetFramework)' == 'net472'">
<DefineConstants>$(DefineConstants);SUPPORTS_EXTENDED_INTRINSICS</DefineConstants>
<DefineConstants>$(DefineConstants);SUPPORTS_CODECOVERAGE</DefineConstants>
<DefineConstants>$(DefineConstants);SUPPORTS_SERIALIZATION</DefineConstants>
</PropertyGroup>
<!-- Default settings that explicitly differ from the Sdk.targets defaults-->
<PropertyGroup>
<Authors>Six Labors and contributors</Authors>
<BaseOutputPath>$(BaseArtifactsPath)bin/$(BaseArtifactsPathSuffix)/</BaseOutputPath>
<Company>Six Labors</Company>
<PackageOutputPath>$(BaseArtifactsPath)pkg/$(BaseArtifactsPathSuffix)/$(Configuration)/</PackageOutputPath>
<Product>SixLabors.ZlibStream</Product>
<VersionPrefix>0.0.1</VersionPrefix>
<VersionPrefix Condition="'$(packageversion)' != ''">$(PackageVersion)</VersionPrefix>
<VersionSuffix></VersionSuffix>
</PropertyGroup>
<!-- Default settings that are otherwise undefined -->
<PropertyGroup>
<Copyright>Copyright © Six Labors and Contributors</Copyright>
<Features>strict;IOperation</Features>
<HighEntropyVA>true</HighEntropyVA>
<LangVersion>8.0</LangVersion>
<NeutralLanguage>en</NeutralLanguage>
<OverwriteReadOnlyFiles>true</OverwriteReadOnlyFiles>
<PackageIcon>sixlabors.128.png</PackageIcon>
<PackageLicenseFile>LICENSE</PackageLicenseFile>
<PackageProjectUrl>$(RepositoryUrl)</PackageProjectUrl>
<ProduceReferenceAssembly>true</ProduceReferenceAssembly>
<RepositoryType>git</RepositoryType>
<RestoreSources>
https://api.nuget.org/v3/index.json;
</RestoreSources>
<UseSharedCompilation>true</UseSharedCompilation>
<SignAssembly>true</SignAssembly>
<DelaySign>false</DelaySign>
<AssemblyOriginatorKeyFile>$(MSBuildThisFileDirectory)shared-infrastructure/SixLabors.snk</AssemblyOriginatorKeyFile>
<SixLaborsPublicKey>00240000048000009400000006020000002400005253413100040000010001000147e6fe6766715eec6cfed61f1e7dcdbf69748a3e355c67e9d8dfd953acab1d5e012ba34b23308166fdc61ee1d0390d5f36d814a6091dd4b5ed9eda5a26afced924c683b4bfb4b3d64b0586a57eff9f02b1f84e3cb0ddd518bd1697f2c84dcbb97eb8bb5c7801be12112ed0ec86db934b0e9a5171e6bb1384b6d2f7d54dfa97</SixLaborsPublicKey>
</PropertyGroup>
<!-- Package references and additional files which are consumed by all projects -->
<ItemGroup>
<PackageReference Include="Microsoft.Net.Compilers.Toolset" IsImplicitlyDefined="true" />
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies" IsImplicitlyDefined="true" />
<PackageReference Include="StyleCop.Analyzers" IsImplicitlyDefined="true" />
<AdditionalFiles Include="$(MSBuildThisFileDirectory)stylecop.json" />
<!--NuGet package icon source-->
<None Include="$(MSBuildThisFileDirectory)shared-infrastructure\branding\icons\org\sixlabors.128.png"
Pack="true"
PackagePath="" />
<None Include="$(MSBuildThisFileDirectory)LICENSE" Pack="true" Visible="false" PackagePath="" />
</ItemGroup>
</Project>

Просмотреть файл

@ -1,22 +1,30 @@
<?xml version="1.0" encoding="utf-8"?>
<Project>
<Target Name="AddInternalsVisibleTo" BeforeTargets="CoreCompile">
<!-- Add default suffix if there is no InternalsVisibleTo or InternalsVisibleToSuffix defined -->
<ItemGroup Condition="@(InternalsVisibleToSuffix->Count()) == 0 AND @(InternalsVisibleTo->Count()) == 0">
<InternalsVisibleToSuffix Include=".Tests" />
</ItemGroup>
<!-- Handle InternalsVisibleTo -->
<ItemGroup Condition="'@(InternalsVisibleTo->Count())' &gt; 0">
<AssemblyAttribute Include="System.Runtime.CompilerServices.InternalsVisibleTo">
<_Parameter1>%(InternalsVisibleTo.Identity)</_Parameter1>
</AssemblyAttribute>
</ItemGroup>
<!--
Directory.Build.targets is automatically picked up and imported by
Microsoft.Common.targets. This file needs to exist, even if empty so that
files in the parent directory tree, with the same name, are not imported
instead. The import fairly late and most other props/targets will have been
imported beforehand. We also don't need to add ourselves to
MSBuildAllProjects, as that is done by the file that imports us.
-->
<!-- Settings that append the existing setting value -->
<PropertyGroup>
<DefineConstants>$(DefineConstants);$(OS)</DefineConstants>
</PropertyGroup>
<!-- Package versions for package references across all projects -->
<ItemGroup>
<!--Global Dependencies-->
<PackageReference Update="Microsoft.Net.Compilers.Toolset" PrivateAssets="All" Version="3.3.1" />
<PackageReference Update="Microsoft.NETFramework.ReferenceAssemblies" PrivateAssets="All" Version="1.0.0" />
<PackageReference Update="StyleCop.Analyzers" PrivateAssets="All" Version="1.1.118" />
<!--Src Dependencies-->
<PackageReference Update="System.Buffers" Version="4.5.0" />
<PackageReference Update="System.Runtime.CompilerServices.Unsafe" Version="4.7" />
</ItemGroup>
<!-- Handle InternalsVisibleToSuffix -->
<ItemGroup Condition="@(InternalsVisibleToSuffix->Count()) &gt; 0">
<AssemblyAttribute Include="System.Runtime.CompilerServices.InternalsVisibleTo">
<_Parameter1>$(AssemblyName)%(InternalsVisibleToSuffix.Identity)</_Parameter1>
</AssemblyAttribute>
</ItemGroup>
</Target>
</Project>

Просмотреть файл

@ -1,57 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<RuleSet Name="SixLabors.Tests" ToolsVersion="15.0">
<!--Inherit basic rules-->
<Include Path="SixLabors.ruleset" Action="Default" />
<!--Additional rules-->
<Rules AnalyzerId="StyleCop.Analyzers" RuleNamespace="StyleCop.Analyzers">
<!--XML comment analysis is disabled due to project configuration-->
<Rule Id="SA0001" Action="None" />
<!--Parameter must follow comma.-->
<Rule Id="SA1115" Action="None" />
<!--A field should not follow a method-->
<Rule Id="SA1201" Action="None" />
<!--Elements must be ordered by access-->
<Rule Id="SA1202" Action="None" />
<!--Constants must appear before fields-->
<Rule Id="SA1203" Action="None" />
<!--Static members should appear before non-static members-->
<Rule Id="SA1204" Action="None" />
<!--Field names must not contain underscore-->
<Rule Id="SA1310" Action="None" />
<!--Field should be private-->
<Rule Id="SA1401" Action="None" />
<!--Elements should be documented.-->
<Rule Id="SA1600" Action="None" />
<!--Partial elements should be documented.-->
<Rule Id="SA1601" Action="None" />
<!--Enumeration items should be documented.-->
<Rule Id="SA1602" Action="None" />
<!--Constructor is missing documentation for one or more of its parameters.-->
<Rule Id="SA1611" Action="None" />
<!--A generic C# element is missing documentation for one or more of its generic type parameters..-->
<Rule Id="SA1618" Action="None" />
<!--The XML documentation header for a C# constructor does not contain the appropriate summary text.-->
<Rule Id="SA1642" Action="None" />
</Rules>
<Rules AnalyzerId="Microsoft.CodeAnalysis.CSharp" RuleNamespace="Microsoft.CodeAnalysis.CSharp">
<!--Missing XML comment for publicly visible type or member-->
<Rule Id="CS1591" Action="None" />
</Rules>
</RuleSet>

Просмотреть файл

@ -1,26 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<RuleSet Name="SixLabors" ToolsVersion="15.0">
<Rules AnalyzerId="Roslynator.CSharp.Analyzers" RuleNamespace="Roslynator.CSharp">
<!--Call 'ConfigureAwait(false)'-->
<Rule Id="RCS1090" Action="None" />
</Rules>
<Rules AnalyzerId="StyleCop.Analyzers" RuleNamespace="StyleCop.Analyzers">
<!--Using directive should appear within a namespace declaration-->
<Rule Id="SA1200" Action="None" />
<!--A C# code file contains more than one unique type.-->
<Rule Id="SA1402" Action="None" />
<!--The last statement in a multi-line C# initializer or list is missing a trailing comma.-->
<Rule Id="SA1413" Action="None" />
<!--Comments should end with a period. I like this but there's 2956+ errors to fix in ImageSharp-->
<Rule Id="SA1629" Action="None" />
<!--A C# code file is missing a standard file header.-->
<Rule Id="SA1633" Action="Warning" />
</Rules>
</RuleSet>

Просмотреть файл

@ -2,15 +2,29 @@ Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.30011.22
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ZlibStream", "src\ZlibStream\ZlibStream.csproj", "{0C89B7A2-A218-49E4-B545-5B044A45F977}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ZlibStream", "src\ZlibStream\ZlibStream.csproj", "{0C89B7A2-A218-49E4-B545-5B044A45F977}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{78670B24-8720-48FC-BD04-68C667B1C8CC}"
ProjectSection(SolutionItems) = preProject
src\Directory.Build.props = src\Directory.Build.props
src\Directory.Build.targets = src\Directory.Build.targets
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tests", "tests", "{CB611663-07F2-4419-B83D-7AED9B406865}"
ProjectSection(SolutionItems) = preProject
tests\Directory.Build.props = tests\Directory.Build.props
tests\Directory.Build.targets = tests\Directory.Build.targets
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ZlibStream.Tests", "tests\ZlibStream.Tests\ZlibStream.Tests.csproj", "{01E63166-CDBA-450F-A597-DE096B05A052}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ZlibStream.Tests", "tests\ZlibStream.Tests\ZlibStream.Tests.csproj", "{01E63166-CDBA-450F-A597-DE096B05A052}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ZlibStream.Benchmarks", "tests\ZlibStream.Benchmarks\ZlibStream.Benchmarks.csproj", "{15FE1586-DED2-41F4-9292-6BE8787A60C4}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ZlibStream.Benchmarks", "tests\ZlibStream.Benchmarks\ZlibStream.Benchmarks.csproj", "{15FE1586-DED2-41F4-9292-6BE8787A60C4}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{F450D162-1FE5-4295-BDB8-8F78F6B51672}"
ProjectSection(SolutionItems) = preProject
Directory.Build.props = Directory.Build.props
Directory.Build.targets = Directory.Build.targets
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution

1
shared-infrastructure Submodule

@ -0,0 +1 @@
Subproject commit a71135a9749cb2823171d918fc936e05cd7f36a6

36
src/Directory.Build.props Normal file
Просмотреть файл

@ -0,0 +1,36 @@
<?xml version="1.0" encoding="utf-8"?>
<Project>
<!--
Directory.Build.props is automatically picked up and imported by
Microsoft.Common.props. This file needs to exist, even if empty so that
files in the parent directory tree, with the same name, are not imported
instead. The import fairly early and only Sdk.props will have been
imported beforehand. We also don't need to add ourselves to
MSBuildAllProjects, as that is done by the file that imports us.
-->
<PropertyGroup>
<MSBuildAllProjects>$(MSBuildAllProjects);$(MSBuildThisFileDirectory)..\Directory.Build.props</MSBuildAllProjects>
<ImageSharpProjectCategory>src</ImageSharpProjectCategory>
</PropertyGroup>
<Import Project="$(MSBuildThisFileDirectory)..\Directory.Build.props" />
<PropertyGroup>
<CodeAnalysisRuleSet>$(MSBuildThisFileDirectory)..\shared-infrastructure\SixLabors.ruleset</CodeAnalysisRuleSet>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)' == 'Release'">
<!--<TreatWarningsAsErrors>true</TreatWarningsAsErrors>-->
</PropertyGroup>
<ItemGroup>
<InternalsVisibleTo Include="ZlibStream.Benchmarks" PublicKey="$(SixLaborsPublicKey)" />
<InternalsVisibleTo Include="ZlibStream.Tests" PublicKey="$(SixLaborsPublicKey)" />
</ItemGroup>
</Project>

Просмотреть файл

@ -0,0 +1,67 @@
<?xml version="1.0" encoding="utf-8"?>
<Project>
<!--
Directory.Build.targets is automatically picked up and imported by
Microsoft.Common.targets. This file needs to exist, even if empty so that
files in the parent directory tree, with the same name, are not imported
instead. The import fairly late and most other props/targets will have
been imported beforehand. We also don't need to add ourselves to
MSBuildAllProjects, as that is done by the file that imports us.
-->
<PropertyGroup>
<MSBuildAllProjects>$(MSBuildAllProjects);$(MSBuildThisFileDirectory)..\Directory.Build.targets</MSBuildAllProjects>
</PropertyGroup>
<Import Project="$(MSBuildThisFileDirectory)..\Directory.Build.targets" />
<PropertyGroup>
<GeneratedInternalsVisibleToFile Condition="'$(GeneratedInternalsVisibleToFile)' == ''">$(IntermediateOutputPath)$(MSBuildProjectName).InternalsVisibleTo$(DefaultLanguageSourceExtension)</GeneratedInternalsVisibleToFile>
</PropertyGroup>
<ItemDefinitionGroup>
<InternalsVisibleTo>
<Visible>false</Visible>
</InternalsVisibleTo>
</ItemDefinitionGroup>
<Target Name="GenerateInternalsVisibleTo"
BeforeTargets="CoreCompile"
DependsOnTargets="PrepareForBuild;CoreGenerateInternalsVisibleTo"
Condition="'@(InternalsVisibleTo)' != ''" />
<Target Name="CoreGenerateInternalsVisibleTo"
Condition="'$(Language)' == 'VB' or '$(Language)' == 'C#'"
Inputs="$(MSBuildAllProjects)"
Outputs="$(GeneratedInternalsVisibleToFile)">
<CreateItem Include="System.Runtime.CompilerServices.InternalsVisibleToAttribute" AdditionalMetadata="_Parameter1=%(InternalsVisibleTo.Identity)" Condition="'%(InternalsVisibleTo.PublicKey)' == ''">
<Output TaskParameter="Include" ItemName="InternalsVisibleToAttribute" />
</CreateItem>
<CreateItem Include="System.Runtime.CompilerServices.InternalsVisibleToAttribute" AdditionalMetadata="_Parameter1=%(InternalsVisibleTo.Identity), PublicKey=%(InternalsVisibleTo.PublicKey)" Condition="'%(InternalsVisibleTo.PublicKey)' != ''">
<Output TaskParameter="Include" ItemName="InternalsVisibleToAttribute" />
</CreateItem>
<WriteCodeFragment AssemblyAttributes="@(InternalsVisibleToAttribute)" Language="$(Language)" OutputFile="$(GeneratedInternalsVisibleToFile)">
<Output TaskParameter="OutputFile" ItemName="Compile" />
<Output TaskParameter="OutputFile" ItemName="FileWrites" />
</WriteCodeFragment>
</Target>
<!-- Empty target so that `dotnet test` will work on the solution -->
<!-- https://github.com/Microsoft/vstest/issues/411 -->
<Target Name="VSTest" Condition="'$(IsTestProject)' == 'true'"/>
<ItemGroup>
<!--Shared config files that have to exist at root level.-->
<ConfigFilesToCopy Include="..\..\shared-infrastructure\.editorconfig;..\..\shared-infrastructure\.gitattributes" />
</ItemGroup>
<!--Ensures our config files are up to date.-->
<Target Name="CopyFiles" BeforeTargets="Build">
<Copy SourceFiles="@(ConfigFilesToCopy)"
SkipUnchangedFiles = "true"
DestinationFolder="..\..\" />
</Target>
</Project>

Просмотреть файл

@ -1453,9 +1453,11 @@ namespace SixLabors
return best_len <= this.Lookahead ? best_len : this.Lookahead;
}
internal ZlibCompressionState DeflateInit(ZStream strm, ZlibCompression level, int bits) => this.DeflateInit2(strm, level, ZDEFLATED, bits, DEFMEMLEVEL, ZlibCompressionStrategy.ZDEFAULTSTRATEGY);
internal ZlibCompressionState DeflateInit(ZStream strm, ZlibCompression level, int bits)
=> this.DeflateInit2(strm, level, ZDEFLATED, bits, DEFMEMLEVEL, ZlibCompressionStrategy.ZDEFAULTSTRATEGY);
internal ZlibCompressionState DeflateInit(ZStream strm, ZlibCompression level) => this.DeflateInit(strm, level, MAXWBITS);
internal ZlibCompressionState DeflateInit(ZStream strm, ZlibCompression level)
=> this.DeflateInit(strm, level, MAXWBITS);
internal ZlibCompressionState DeflateInit2(ZStream strm, ZlibCompression level, int method, int windowBits, int memLevel, ZlibCompressionStrategy strategy)
{
@ -1853,4 +1855,4 @@ namespace SixLabors
internal int Func { get; set; }
}
}
}
}

Просмотреть файл

@ -1,9 +1,7 @@
// <auto-generated />
// <auto-generated />
// Copyright (c) 2018-2020, Els_kom org.
// https://github.com/Elskom/
// All rights reserved.
// license: See LICENSE for more details.
// Copyright (c) Six Labors and contributors.
// See LICENSE for more details.
#if SUPPORTS_SERIALIZATION
using System.Runtime.CompilerServices;

Просмотреть файл

@ -1,4 +1,4 @@
// Copyright (c) Six Labors and contributors.
// Copyright (c) Six Labors and contributors.
// See LICENSE for more details.
namespace SixLabors
@ -16,15 +16,15 @@ namespace SixLabors
/// <summary>
/// No compression.
/// </summary>
ZNOCOMPRESSION,
ZNOCOMPRESSION = 0,
/// <summary>
/// best speed compression level.
/// Best speed compression level.
/// </summary>
ZBESTSPEED,
ZBESTSPEED = 1,
/// <summary>
/// the best compression level.
/// Best compression level.
/// </summary>
ZBESTCOMPRESSION = 9,
}

Просмотреть файл

@ -1,74 +1,25 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>netcoreapp2.0;netcoreapp2.1;netcoreapp3.1;netstandard1.3;netstandard2.0;netstandard2.1;net472</TargetFrameworks>
<AssemblyName>zlib.managed</AssemblyName>
<LangVersion>latest</LangVersion>
<Company>Els_kom org.</Company>
<Authors>Els_kom org.</Authors>
<PackageTags>zlib</PackageTags>
<RepositoryType>git</RepositoryType>
<RepositoryUrl>https://github.com/Elskom/zlib.managed/</RepositoryUrl>
<PackageProjectUrl>https://github.com/Elskom/zlib.managed/</PackageProjectUrl>
<!--<PackageLicenseFile>LICENSE</PackageLicenseFile>-->
<Copyright>Copyright (c) 2018-2019</Copyright>
<Description>A cleaned up and bug fixed version of zlib.net. This is also planned to be updated frequently if needed too.</Description>
<PackageReleaseNotes>Code fixes to expose more members and fix null data output.</PackageReleaseNotes>
<Version>1.1.5</Version>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<ProduceReferenceAssembly>true</ProduceReferenceAssembly>
<NoWarn>$(NoWarn);NU5104;NU5118</NoWarn>
<PackageOutputPath Condition="'$(SolutionName)' == 'build_all_packages'">$(MSBuildThisFileDirectory)..\..\artifacts\</PackageOutputPath>
<!-- Optional: Publish the repository URL in the built .nupkg (in the NuSpec <Repository> element) -->
<PublishRepositoryUrl>true</PublishRepositoryUrl>
<!-- Optional: Embed source files that are not tracked by the source control manager in the PDB -->
<EmbedUntrackedSources>true</EmbedUntrackedSources>
<!-- Optional: Build symbol package (.snupkg) to distribute the PDB containing Source Link -->
<IncludeSymbols>true</IncludeSymbols>
<IncludeBuildOutput>true</IncludeBuildOutput>
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
<CodeAnalysisRuleSet>$(MSBuildThisFileDirectory)..\..\SixLabors.ruleset</CodeAnalysisRuleSet>
<AssemblyName>SixLabors.ZlibStream</AssemblyName>
<AssemblyTitle>SixLabors.ZlibStream</AssemblyTitle>
<Description>A cross platform, managed, implementation of Zlib.</Description>
<NeutralLanguage>en</NeutralLanguage>
<VersionPrefix Condition="$(packageversion) != ''">$(packageversion)</VersionPrefix>
<VersionPrefix Condition="$(packageversion) == ''">0.0.1</VersionPrefix>
<TargetFrameworks>netcoreapp3.1;netcoreapp2.1;netstandard2.1;netstandard2.0;netstandard1.3;net472</TargetFrameworks>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<PackageId>SixLabors.ZlibStream</PackageId>
<PackageTags>Zlib Compression</PackageTags>
<RootNamespace>SixLabors.ZlibStream</RootNamespace>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<DefineConstants>DEBUG;TRACE</DefineConstants>
<OutputPath>bin\Any CPU\Debug\</OutputPath>
<DocumentationFile>bin\Any CPU\Debug\zlib.managed.xml</DocumentationFile>
<DebugType>full</DebugType>
<DebugSymbols>true</DebugSymbols>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
<OutputPath>bin\Any CPU\Release\</OutputPath>
<DocumentationFile>bin\Any CPU\Release\zlib.managed.xml</DocumentationFile>
<DebugType>full</DebugType>
<DebugSymbols>true</DebugSymbols>
</PropertyGroup>
<PropertyGroup Condition="'$(TargetFramework)' != 'netstandard1.3'">
<DefineConstants>$(DefineConstants);SUPPORTS_SERIALIZATION</DefineConstants>
</PropertyGroup>
<ItemGroup>
<None Remove=".gitignore" />
<None Remove="appveyor.yml" />
<!--<None Include="LICENSE" Pack="true" Visible="false" PackagePath="" />-->
<None Remove="readme.md" />
<None Remove="stylecop.json" />
</ItemGroup>
<ItemGroup>
<AdditionalFiles Include="$(MSBuildThisFileDirectory)..\..\stylecop.json" />
<InternalsVisibleTo Include="ZlibStream.Tests"/>
<!--<InternalsVisibleTo Include="ZlibStream.Benchmarks"/>-->
</ItemGroup>
<ItemGroup>
<PackageReference Update="Microsoft.Net.Compilers.Toolset" PrivateAssets="All" Version="3.3.1" />
<PackageReference Include="StyleCop.Analyzers" Version="1.1.118" PrivateAssets="All" IncludeAssets="runtime; build; native; contentfiles; analyzers" />
<PackageReference Include="System.Runtime.Extensions" Condition="!$(TargetFramework.StartsWith('net4'))" Version="4.3.1" />
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.1.0-beta-20225-01" PrivateAssets="All" />
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies" Version="1.0.0" PrivateAssets="All" />
<ItemGroup Condition=" '$(TargetFramework)' == 'netcoreapp2.1' ">
<PackageReference Include="System.Runtime.CompilerServices.Unsafe" />
</ItemGroup>
</Project>

Просмотреть файл

@ -0,0 +1,41 @@
<?xml version="1.0" encoding="utf-8"?>
<Project>
<!--
Directory.Build.props is automatically picked up and imported by
Microsoft.Common.props. This file needs to exist, even if empty so that
files in the parent directory tree, with the same name, are not imported
instead. The import fairly early and only Sdk.props will have been
imported beforehand. We also don't need to add ourselves to
MSBuildAllProjects, as that is done by the file that imports us.
-->
<PropertyGroup>
<MSBuildAllProjects>$(MSBuildAllProjects);$(MSBuildThisFileDirectory)..\Directory.Build.props</MSBuildAllProjects>
<ImageSharpProjectCategory>tests</ImageSharpProjectCategory>
<IsPackable>false</IsPackable>
</PropertyGroup>
<PropertyGroup>
<CodeAnalysisRuleSet>$(MSBuildThisFileDirectory)..\shared-infrastructure\SixLabors.Tests.ruleset</CodeAnalysisRuleSet>
<!--TODO: We should remove all obsolete code from the solution-->
<NoWarn>$(NoWarn);CS0618</NoWarn>
</PropertyGroup>
<Import Project="$(MSBuildThisFileDirectory)..\Directory.Build.props" />
<ItemGroup Condition="'$(IsTestProject)' == 'true'">
<PackageReference Include="Microsoft.NET.Test.Sdk" IsImplicitlyDefined="true" />
<PackageReference Include="xunit" IsImplicitlyDefined="true" />
<PackageReference Include="xunit.runner.visualstudio" IsImplicitlyDefined="true" />
</ItemGroup>
<ItemGroup Condition="'$(codecov)' == 'true' AND '$(IsTestProject)' == 'true'">
<PackageReference Include="coverlet.collector" IsImplicitlyDefined="true" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="$(MSBuildThisFileDirectory)..\src\ZlibStream\ZlibStream.csproj" />
</ItemGroup>
</Project>

Просмотреть файл

@ -0,0 +1,41 @@
<?xml version="1.0" encoding="utf-8"?>
<Project>
<!--
Directory.Build.targets is automatically picked up and imported by
Microsoft.Common.targets. This file needs to exist, even if empty so that
files in the parent directory tree, with the same name, are not imported
instead. The import fairly late and most other props/targets will have
been imported beforehand. We also don't need to add ourselves to
MSBuildAllProjects, as that is done by the file that imports us.
-->
<PropertyGroup>
<MSBuildAllProjects>$(MSBuildAllProjects);$(MSBuildThisFileDirectory)..\Directory.Build.targets</MSBuildAllProjects>
</PropertyGroup>
<Import Project="$(MSBuildThisFileDirectory)..\Directory.Build.targets" />
<!-- Tool versions for tool references across all projects -->
<ItemGroup Condition="'$(IsTestProject)' == 'true'">
<!--dotnet tools does not have an x86 runner. You have to use separate SDKs-->
<!--https://github.com/actions/setup-dotnet/issues/72-->
<DotNetCliToolReference Update="dotnet-xunit" Version="2.3.1" />
</ItemGroup>
<ItemGroup>
<!--Test Dependencies-->
<PackageReference Update="BenchmarkDotNet" Version="0.12.1" />
<PackageReference Update="BenchmarkDotNet.Diagnostics.Windows" Version="0.12.1" Condition="'$(OS)' == 'Windows_NT'" />
<PackageReference Update="Microsoft.NET.Test.Sdk" Version="16.6.1" />
<PackageReference Update="xunit" Version="2.4.1" />
<PackageReference Update="xunit.runner.visualstudio" Version="2.4.1"/>
<PackageReference Update="coverlet.collector" Version="1.2.1" PrivateAssets="All"/>
<PackageReference Update="SharpZipLib" Version="1.2.0" />
<PackageReference Update="zlib.managed" Version="1.1.4" />
<PackageReference Update="zlib.net" Version="1.0.4" />
</ItemGroup>
</Project>

Просмотреть файл

@ -12,7 +12,6 @@ namespace ZlibStream.Benchmarks
[Params(1024, 2048, 4096)]
public int Count { get; set; }
[GlobalSetup]
public void SetUp()
{

Просмотреть файл

@ -1,3 +1,6 @@
// Copyright (c) Six Labors and contributors.
// See LICENSE for more details.
using BenchmarkDotNet.Configs;
using BenchmarkDotNet.Environments;
using BenchmarkDotNet.Jobs;

Просмотреть файл

@ -1,11 +1,14 @@
// Copyright (c) Six Labors and contributors.
// See LICENSE for more details.
using System.Reflection;
using BenchmarkDotNet.Running;
namespace ZlibStream.Benchmarks
{
class Program
public class Program
{
static void Main(string[] args)
public static void Main(string[] args)
{
new BenchmarkSwitcher(typeof(Program).GetTypeInfo().Assembly).Run(args);
}

Просмотреть файл

@ -1,23 +1,18 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp3.1</TargetFramework>
<IsPackable>false</IsPackable>
<!--Used to hide test project from dotnet test-->
<IsTestProject>false</IsTestProject>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="BenchmarkDotNet" Version="0.12.1" />
<PackageReference Include="SharpZipLib" Version="1.2.0" />
<PackageReference Include="zlib.managed" Version="1.1.4" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\src\ZlibStream\ZlibStream.csproj" />
</ItemGroup>
<ItemGroup>
<Compile Include="..\..\src\ZlibStream\Adler32.cs" />
<PackageReference Include="BenchmarkDotNet" />
<PackageReference Include="BenchmarkDotNet.Diagnostics.Windows" Condition="'$(OS)' == 'Windows_NT'" />
<PackageReference Include="SharpZipLib" />
<PackageReference Include="zlib.managed" />
</ItemGroup>
</Project>

Просмотреть файл

@ -1,3 +1,6 @@
// Copyright (c) Six Labors and contributors.
// See LICENSE for more details.
using System;
using SixLabors;
using Xunit;

Просмотреть файл

@ -2,28 +2,15 @@
<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<IsPackable>false</IsPackable>
<AllowUnsafeBlocks>True</AllowUnsafeBlocks>
<DebugSymbols>True</DebugSymbols>
<IsTestProject>True</IsTestProject>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.6.1" />
<PackageReference Include="xunit" Version="2.4.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.1">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="coverlet.collector" Version="1.2.1">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="SharpZipLib" Version="1.2.0" />
<PackageReference Include="zlib.managed" Version="1.1.4" />
<PackageReference Include="zlib.net" Version="1.0.4" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\src\ZlibStream\ZlibStream.csproj" />
<PackageReference Include="SharpZipLib" />
<PackageReference Include="zlib.managed" />
<PackageReference Include="zlib.net" />
</ItemGroup>
</Project>

Просмотреть файл

@ -1,3 +1,6 @@
// Copyright (c) Six Labors and contributors.
// See LICENSE for more details.
using System;
using System.IO;
using ICSharpCode.SharpZipLib.Zip.Compression.Streams;
@ -8,15 +11,21 @@ namespace ZlibStream.Tests
{
public partial class ZlibStreamTests
{
[Fact]
public void EncodeDecode()
[Theory]
[InlineData(ZlibCompression.ZBESTCOMPRESSION)]
[InlineData(ZlibCompression.ZBESTSPEED)]
[InlineData(ZlibCompression.ZDEFAULTCOMPRESSION)]
[InlineData(ZlibCompression.ZNOCOMPRESSION)]
public void EncodeDecode(ZlibCompression compression)
{
var expected = GetBuffer(4096 * 4);
var reference = new byte[4096 * 4];
var actual = new byte[4096 * 4];
const int count = 4096 * 4;
var expected = GetBuffer(count);
var reference = new byte[count];
var actual = new byte[count];
using (var compressed = new MemoryStream())
{
using (var deflate = new ZOutputStream(compressed, ZlibCompression.ZDEFAULTCOMPRESSION))
using (var deflate = new ZOutputStream(compressed, compression))
{
deflate.Write(expected);
}
@ -43,18 +52,9 @@ namespace ZlibStream.Tests
byte r = reference[i];
byte a = actual[i];
if (e != r)
{
throw new Exception();
}
if (e != a)
{
throw new Exception();
}
Assert.Equal(e, r);
Assert.Equal(e, a);
}
Assert.Equal(expected, actual);
}
private static byte[] GetBuffer(int length)

Просмотреть файл

@ -0,0 +1,14 @@
<?xml version="1.0" encoding="utf-8" ?>
<RunSettings>
<DataCollectionRunSettings>
<DataCollectors>
<DataCollector friendlyName="XPlat code coverage">
<Configuration>
<Format>lcov</Format>
<Include>[SixLabors.*]*</Include>
<UseSourceLink>true</UseSourceLink>
</Configuration>
</DataCollector>
</DataCollectors>
</DataCollectionRunSettings>
</RunSettings>