Skip to content

Commit cbd1872

Browse files
Fix module, import configs, automate T4 builds
1 parent b43a66c commit cbd1872

File tree

11 files changed

+39
-20
lines changed

11 files changed

+39
-20
lines changed

.editorconfig

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -368,8 +368,6 @@ csharp_style_throw_expression = true:suggestion
368368
csharp_style_unused_value_expression_statement_preference = discard_variable:silent
369369
csharp_style_unused_value_assignment_preference = discard_variable:suggestion
370370

371-
csharp_style_var_for_built_in_types = false:silent
371+
csharp_style_var_for_built_in_types = never
372372
csharp_style_var_when_type_is_apparent = true:warning
373373
csharp_style_var_elsewhere = false:warning
374-
375-
csharp_prefer_simple_using_statement = false:silent

.gitmodules

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,6 @@
22
path = tests/Images/External
33
url = https://github.com/SixLabors/Imagesharp.Tests.Images.git
44
branch = master
5+
[submodule "shared-infrastructure"]
6+
path = shared-infrastructure
7+
url = https://github.com/SixLabors/SharedInfrastructure

ImageSharp.sln

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -334,6 +334,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ImageSharp.Tests.ProfilingS
334334
EndProject
335335
Global
336336
GlobalSection(SharedMSBuildProjectFiles) = preSolution
337+
shared-infrastructure\src\SharedInfrastructure\SharedInfrastructure.projitems*{2aa31a1f-142c-43f4-8687-09abca4b3a26}*SharedItemsImports = 5
337338
shared-infrastructure\src\SharedInfrastructure\SharedInfrastructure.projitems*{68a8cc40-6aed-4e96-b524-31b1158fdeea}*SharedItemsImports = 13
338339
EndGlobalSection
339340
GlobalSection(SolutionConfigurationPlatforms) = preSolution

shared-infrastructure

Submodule shared-infrastructure added at 8dfef29

src/Directory.Build.props

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,4 +34,6 @@
3434
<InternalsVisibleTo Include="SixLabors.ImageSharp.Tests" PublicKey="$(SixLaborsPublicKey)" />
3535
</ItemGroup>
3636

37+
38+
3739
</Project>

src/Directory.Build.targets

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,4 +52,20 @@
5252
<!-- https://github.com/Microsoft/vstest/issues/411 -->
5353
<Target Name="VSTest" Condition="'$(IsTestProject)' == 'true'"/>
5454

55+
<ItemGroup>
56+
<!--Shared config files that have to exist at root level.-->
57+
<ConfigFilesToCopy Include="..\..\shared-infrastructure\.editorconfig;..\..\shared-infrastructure\.gitattributes" />
58+
</ItemGroup>
59+
60+
<!--Ensures our config files are up to date.-->
61+
<Target Name="CopyFiles" BeforeTargets="Build">
62+
<Copy SourceFiles="@(ConfigFilesToCopy)" DestinationFolder="..\..\" />
63+
</Target>
64+
65+
<!-- Allows regenerating T4-generated files at build time using MsBuild -->
66+
<Import Project="$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v$(VisualStudioVersion)\TextTemplating\Microsoft.TextTemplating.targets" />
67+
<PropertyGroup>
68+
<TransformOnBuild>true</TransformOnBuild>
69+
</PropertyGroup>
70+
5571
</Project>

src/ImageSharp/Common/Helpers/Guard.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ public static void MustBeValueType<TValue>(TValue value, string parameterName)
2222
{
2323
if (!value.GetType().GetTypeInfo().IsValueType)
2424
{
25-
ThrowArgumentException("Type must be a struct.", parameterName);
25+
ThrowHelper.ThrowArgumentException("Type must be a struct.", parameterName);
2626
}
2727
}
2828
}

src/ImageSharp/ImageSharp.csproj

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,11 @@
3737
</ItemGroup>
3838

3939
<ItemGroup>
40+
<Compile Update="..\..\shared-infrastructure\src\SharedInfrastructure\Guard.Numeric.cs">
41+
<DesignTime>True</DesignTime>
42+
<AutoGen>True</AutoGen>
43+
<DependentUpon>Guard.Numeric.tt</DependentUpon>
44+
</Compile>
4045
<Compile Update="Formats\Jpeg\Components\Block8x8F.Generated.cs">
4146
<DesignTime>True</DesignTime>
4247
<AutoGen>True</AutoGen>
@@ -202,12 +207,14 @@
202207
<LastGenOutput>DefaultPixelBlenders.Generated.cs</LastGenOutput>
203208
<Generator>TextTemplatingFileGenerator</Generator>
204209
</None>
210+
<None Update="..\..\shared-infrastructure\src\SharedInfrastructure\Guard.Numeric.tt">
211+
<LastGenOutput>Guard.Numeric.cs</LastGenOutput>
212+
</None>
205213
</ItemGroup>
206214

207215
<ItemGroup>
208216
<Service Include="{508349B6-6B84-4DF5-91F0-309BEEBAD82D}" />
209217
</ItemGroup>
210218

211219
<Import Project="..\..\shared-infrastructure\src\SharedInfrastructure\SharedInfrastructure.projitems" Label="Shared" />
212-
213220
</Project>

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

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ internal static partial class PorterDuffFunctions
1313

1414

1515

16-
1716
/// <summary>
1817
/// Returns the result of the "NormalSrc" compositing equation.
1918
/// </summary>
@@ -419,7 +418,6 @@ public static TPixel NormalXor<TPixel>(TPixel backdrop, TPixel source, float opa
419418
return dest;
420419
}
421420

422-
423421
/// <summary>
424422
/// Returns the result of the "MultiplySrc" compositing equation.
425423
/// </summary>
@@ -825,7 +823,6 @@ public static TPixel MultiplyXor<TPixel>(TPixel backdrop, TPixel source, float o
825823
return dest;
826824
}
827825

828-
829826
/// <summary>
830827
/// Returns the result of the "AddSrc" compositing equation.
831828
/// </summary>
@@ -1231,7 +1228,6 @@ public static TPixel AddXor<TPixel>(TPixel backdrop, TPixel source, float opacit
12311228
return dest;
12321229
}
12331230

1234-
12351231
/// <summary>
12361232
/// Returns the result of the "SubtractSrc" compositing equation.
12371233
/// </summary>
@@ -1637,7 +1633,6 @@ public static TPixel SubtractXor<TPixel>(TPixel backdrop, TPixel source, float o
16371633
return dest;
16381634
}
16391635

1640-
16411636
/// <summary>
16421637
/// Returns the result of the "ScreenSrc" compositing equation.
16431638
/// </summary>
@@ -2043,7 +2038,6 @@ public static TPixel ScreenXor<TPixel>(TPixel backdrop, TPixel source, float opa
20432038
return dest;
20442039
}
20452040

2046-
20472041
/// <summary>
20482042
/// Returns the result of the "DarkenSrc" compositing equation.
20492043
/// </summary>
@@ -2449,7 +2443,6 @@ public static TPixel DarkenXor<TPixel>(TPixel backdrop, TPixel source, float opa
24492443
return dest;
24502444
}
24512445

2452-
24532446
/// <summary>
24542447
/// Returns the result of the "LightenSrc" compositing equation.
24552448
/// </summary>
@@ -2855,7 +2848,6 @@ public static TPixel LightenXor<TPixel>(TPixel backdrop, TPixel source, float op
28552848
return dest;
28562849
}
28572850

2858-
28592851
/// <summary>
28602852
/// Returns the result of the "OverlaySrc" compositing equation.
28612853
/// </summary>
@@ -3261,7 +3253,6 @@ public static TPixel OverlayXor<TPixel>(TPixel backdrop, TPixel source, float op
32613253
return dest;
32623254
}
32633255

3264-
32653256
/// <summary>
32663257
/// Returns the result of the "HardLightSrc" compositing equation.
32673258
/// </summary>

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ public void AddNewFrame_Frame_FramesNotBeNull()
4343
this.Collection.AddFrame((ImageFrame<Rgba32>)null);
4444
});
4545

46-
Assert.StartsWith("Value cannot be null.", ex.Message);
46+
Assert.StartsWith("Parameter \"frame\" must be not null.", ex.Message);
4747
}
4848

4949
[Fact]
@@ -57,7 +57,7 @@ public void AddNewFrame_PixelBuffer_DataMustNotBeNull()
5757
this.Collection.AddFrame(data);
5858
});
5959

60-
Assert.StartsWith("Value cannot be null.", ex.Message);
60+
Assert.StartsWith("Parameter \"source\" must be not null.", ex.Message);
6161
}
6262

6363
[Fact]
@@ -69,7 +69,7 @@ public void AddNewFrame_PixelBuffer_BufferIncorrectSize()
6969
this.Collection.AddFrame(new Rgba32[0]);
7070
});
7171

72-
Assert.StartsWith("Value 0 must be greater than or equal to 100.", ex.Message);
72+
Assert.StartsWith($"Parameter \"data\" ({typeof(int)}) must be greater than or equal to {100}, was {0}", ex.Message);
7373
}
7474

7575
[Fact]
@@ -93,7 +93,7 @@ public void InsertNewFrame_FramesNotBeNull()
9393
this.Collection.InsertFrame(1, null);
9494
});
9595

96-
Assert.StartsWith("Value cannot be null.", ex.Message);
96+
Assert.StartsWith("Parameter \"frame\" must be not null.", ex.Message);
9797
}
9898

9999
[Fact]

0 commit comments

Comments
 (0)