Browse Source

Fix module, import configs, automate T4 builds

pull/1574/head
James Jackson-South 6 years ago
parent
commit
893ae087c6
  1. 4
      .editorconfig
  2. 3
      .gitmodules
  3. 1
      ImageSharp.sln
  4. 1
      shared-infrastructure
  5. 2
      src/Directory.Build.props
  6. 16
      src/Directory.Build.targets
  7. 2
      src/ImageSharp/Common/Helpers/Guard.cs
  8. 9
      src/ImageSharp/ImageSharp.csproj
  9. 9
      src/ImageSharp/PixelFormats/PixelBlenders/PorterDuffFunctions.Generated.cs
  10. 8
      tests/ImageSharp.Tests/Image/ImageFrameCollectionTests.Generic.cs
  11. 4
      tests/ImageSharp.Tests/Image/ImageFrameCollectionTests.NonGeneric.cs

4
.editorconfig

@ -368,8 +368,6 @@ csharp_style_throw_expression = true:suggestion
csharp_style_unused_value_expression_statement_preference = discard_variable:silent
csharp_style_unused_value_assignment_preference = discard_variable:suggestion
csharp_style_var_for_built_in_types = false:silent
csharp_style_var_for_built_in_types = never
csharp_style_var_when_type_is_apparent = true:warning
csharp_style_var_elsewhere = false:warning
csharp_prefer_simple_using_statement = false:silent

3
.gitmodules

@ -2,3 +2,6 @@
path = tests/Images/External
url = https://github.com/SixLabors/Imagesharp.Tests.Images.git
branch = master
[submodule "shared-infrastructure"]
path = shared-infrastructure
url = https://github.com/SixLabors/SharedInfrastructure

1
ImageSharp.sln

@ -334,6 +334,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ImageSharp.Tests.ProfilingS
EndProject
Global
GlobalSection(SharedMSBuildProjectFiles) = preSolution
shared-infrastructure\src\SharedInfrastructure\SharedInfrastructure.projitems*{2aa31a1f-142c-43f4-8687-09abca4b3a26}*SharedItemsImports = 5
shared-infrastructure\src\SharedInfrastructure\SharedInfrastructure.projitems*{68a8cc40-6aed-4e96-b524-31b1158fdeea}*SharedItemsImports = 13
EndGlobalSection
GlobalSection(SolutionConfigurationPlatforms) = preSolution

1
shared-infrastructure

@ -0,0 +1 @@
Subproject commit 8dfef29f1838da76be9596f1a2f1be6d93e453d3

2
src/Directory.Build.props

@ -34,4 +34,6 @@
<InternalsVisibleTo Include="SixLabors.ImageSharp.Tests" PublicKey="$(SixLaborsPublicKey)" />
</ItemGroup>
</Project>

16
src/Directory.Build.targets

@ -52,4 +52,20 @@
<!-- 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)" DestinationFolder="..\..\" />
</Target>
<!-- Allows regenerating T4-generated files at build time using MsBuild -->
<Import Project="$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v$(VisualStudioVersion)\TextTemplating\Microsoft.TextTemplating.targets" />
<PropertyGroup>
<TransformOnBuild>true</TransformOnBuild>
</PropertyGroup>
</Project>

2
src/ImageSharp/Common/Helpers/Guard.cs

@ -22,7 +22,7 @@ namespace SixLabors
{
if (!value.GetType().GetTypeInfo().IsValueType)
{
ThrowArgumentException("Type must be a struct.", parameterName);
ThrowHelper.ThrowArgumentException("Type must be a struct.", parameterName);
}
}
}

9
src/ImageSharp/ImageSharp.csproj

@ -37,6 +37,11 @@
</ItemGroup>
<ItemGroup>
<Compile Update="..\..\shared-infrastructure\src\SharedInfrastructure\Guard.Numeric.cs">
<DesignTime>True</DesignTime>
<AutoGen>True</AutoGen>
<DependentUpon>Guard.Numeric.tt</DependentUpon>
</Compile>
<Compile Update="Formats\Jpeg\Components\Block8x8F.Generated.cs">
<DesignTime>True</DesignTime>
<AutoGen>True</AutoGen>
@ -202,6 +207,9 @@
<LastGenOutput>DefaultPixelBlenders.Generated.cs</LastGenOutput>
<Generator>TextTemplatingFileGenerator</Generator>
</None>
<None Update="..\..\shared-infrastructure\src\SharedInfrastructure\Guard.Numeric.tt">
<LastGenOutput>Guard.Numeric.cs</LastGenOutput>
</None>
</ItemGroup>
<ItemGroup>
@ -209,5 +217,4 @@
</ItemGroup>
<Import Project="..\..\shared-infrastructure\src\SharedInfrastructure\SharedInfrastructure.projitems" Label="Shared" />
</Project>

9
src/ImageSharp/PixelFormats/PixelBlenders/PorterDuffFunctions.Generated.cs

@ -13,7 +13,6 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
/// <summary>
/// Returns the result of the "NormalSrc" compositing equation.
/// </summary>
@ -419,7 +418,6 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
return dest;
}
/// <summary>
/// Returns the result of the "MultiplySrc" compositing equation.
/// </summary>
@ -825,7 +823,6 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
return dest;
}
/// <summary>
/// Returns the result of the "AddSrc" compositing equation.
/// </summary>
@ -1231,7 +1228,6 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
return dest;
}
/// <summary>
/// Returns the result of the "SubtractSrc" compositing equation.
/// </summary>
@ -1637,7 +1633,6 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
return dest;
}
/// <summary>
/// Returns the result of the "ScreenSrc" compositing equation.
/// </summary>
@ -2043,7 +2038,6 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
return dest;
}
/// <summary>
/// Returns the result of the "DarkenSrc" compositing equation.
/// </summary>
@ -2449,7 +2443,6 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
return dest;
}
/// <summary>
/// Returns the result of the "LightenSrc" compositing equation.
/// </summary>
@ -2855,7 +2848,6 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
return dest;
}
/// <summary>
/// Returns the result of the "OverlaySrc" compositing equation.
/// </summary>
@ -3261,7 +3253,6 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
return dest;
}
/// <summary>
/// Returns the result of the "HardLightSrc" compositing equation.
/// </summary>

8
tests/ImageSharp.Tests/Image/ImageFrameCollectionTests.Generic.cs

@ -43,7 +43,7 @@ namespace SixLabors.ImageSharp.Tests
this.Collection.AddFrame((ImageFrame<Rgba32>)null);
});
Assert.StartsWith("Value cannot be null.", ex.Message);
Assert.StartsWith("Parameter \"frame\" must be not null.", ex.Message);
}
[Fact]
@ -57,7 +57,7 @@ namespace SixLabors.ImageSharp.Tests
this.Collection.AddFrame(data);
});
Assert.StartsWith("Value cannot be null.", ex.Message);
Assert.StartsWith("Parameter \"source\" must be not null.", ex.Message);
}
[Fact]
@ -69,7 +69,7 @@ namespace SixLabors.ImageSharp.Tests
this.Collection.AddFrame(new Rgba32[0]);
});
Assert.StartsWith("Value 0 must be greater than or equal to 100.", ex.Message);
Assert.StartsWith($"Parameter \"data\" ({typeof(int)}) must be greater than or equal to {100}, was {0}", ex.Message);
}
[Fact]
@ -93,7 +93,7 @@ namespace SixLabors.ImageSharp.Tests
this.Collection.InsertFrame(1, null);
});
Assert.StartsWith("Value cannot be null.", ex.Message);
Assert.StartsWith("Parameter \"frame\" must be not null.", ex.Message);
}
[Fact]

4
tests/ImageSharp.Tests/Image/ImageFrameCollectionTests.NonGeneric.cs

@ -90,7 +90,7 @@ namespace SixLabors.ImageSharp.Tests
this.Collection.AddFrame(null);
});
Assert.StartsWith("Value cannot be null.", ex.Message);
Assert.StartsWith("Parameter \"source\" must be not null.", ex.Message);
}
[Fact]
@ -114,7 +114,7 @@ namespace SixLabors.ImageSharp.Tests
this.Collection.InsertFrame(1, null);
});
Assert.StartsWith("Value cannot be null.", ex.Message);
Assert.StartsWith("Parameter \"source\" must be not null.", ex.Message);
}
[Fact]

Loading…
Cancel
Save