Skip to content

Commit

Permalink
Fix build warnings in linux
Browse files Browse the repository at this point in the history
  • Loading branch information
EdwardCooke committed Sep 5, 2024
1 parent 32ecda7 commit d46152a
Show file tree
Hide file tree
Showing 8 changed files with 32 additions and 22 deletions.
4 changes: 1 addition & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ RUN wget https://packages.microsoft.com/config/debian/11/packages-microsoft-prod
RUN dpkg -i packages-microsoft-prod.deb
RUN apt update
RUN apt install -y dotnet-sdk-6.0
RUN apt install -y dotnet-sdk-7.0

FROM builder AS build
WORKDIR /src
Expand All @@ -32,6 +31,7 @@ COPY YamlDotNet.Analyzers.StaticGenerator/YamlDotNet.Analyzers.StaticGenerator.c
COPY YamlDotNet.Core7AoTCompileTest/YamlDotNet.Core7AoTCompileTest.csproj YamlDotNet.Core7AoTCompileTest/YamlDotNet.Core7AoTCompileTest.csproj
COPY YamlDotNet.Core7AoTCompileTest.Model/YamlDotNet.Core7AoTCompileTest.Model.csproj YamlDotNet.Core7AoTCompileTest.Model/YamlDotNet.Core7AoTCompileTest.Model.csproj
COPY YamlDotNet.Samples.Fsharp/YamlDotNet.Samples.Fsharp.fsproj YamlDotNet.Samples.Fsharp/YamlDotNet.Samples.Fsharp.fsproj
COPY YamlDotNet.Fsharp.Test/YamlDotNet.Fsharp.Test.fsproj YamlDotNet.Fsharp.Test/YamlDotNet.Fsharp.Test.fsproj

RUN dotnet restore YamlDotNet.sln

Expand All @@ -41,13 +41,11 @@ RUN dotnet build -c Release --framework net47 YamlDotNet/YamlDotNet.csproj -o /o
RUN dotnet build -c Release --framework netstandard2.0 YamlDotNet/YamlDotNet.csproj -o /output/netstandard2.0
RUN dotnet build -c Release --framework netstandard2.1 YamlDotNet/YamlDotNet.csproj -o /output/netstandard2.1
RUN dotnet build -c Release --framework net6.0 YamlDotNet/YamlDotNet.csproj -o /output/net6.0
RUN dotnet build -c Release --framework net7.0 YamlDotNet/YamlDotNet.csproj -o /output/net7.0
RUN dotnet build -c Release --framework net8.0 YamlDotNet/YamlDotNet.csproj -o /output/net8.0

RUN dotnet pack -c Release YamlDotNet/YamlDotNet.csproj -o /output/package /p:Version=$PACKAGE_VERSION

RUN dotnet test -c Release YamlDotNet.Test/YamlDotNet.Test.csproj --framework net8.0 --logger:"trx;LogFileName=/output/tests-net8.0.trx" --logger:"console;Verbosity=detailed"
RUN dotnet test -c Release YamlDotNet.Test/YamlDotNet.Test.csproj --framework net7.0 --logger:"trx;LogFileName=/output/tests-net7.0.trx" --logger:"console;Verbosity=detailed"
RUN dotnet test -c Release YamlDotNet.Test/YamlDotNet.Test.csproj --framework net6.0 --logger:"trx;LogFileName=/output/tests-net6.0.trx" --logger:"console;Verbosity=detailed"

FROM alpine
Expand Down
4 changes: 1 addition & 3 deletions Dockerfile.NonEnglish
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ RUN wget https://packages.microsoft.com/config/debian/11/packages-microsoft-prod
RUN dpkg -i packages-microsoft-prod.deb
RUN apt update
RUN apt install -y dotnet-sdk-6.0
RUN apt install -y dotnet-sdk-7.0


FROM builder AS build
Expand All @@ -34,6 +33,7 @@ COPY YamlDotNet.Analyzers.StaticGenerator/YamlDotNet.Analyzers.StaticGenerator.c
COPY YamlDotNet.Core7AoTCompileTest/YamlDotNet.Core7AoTCompileTest.csproj YamlDotNet.Core7AoTCompileTest/YamlDotNet.Core7AoTCompileTest.csproj
COPY YamlDotNet.Core7AoTCompileTest.Model/YamlDotNet.Core7AoTCompileTest.Model.csproj YamlDotNet.Core7AoTCompileTest.Model/YamlDotNet.Core7AoTCompileTest.Model.csproj
COPY YamlDotNet.Samples.Fsharp/YamlDotNet.Samples.Fsharp.fsproj YamlDotNet.Samples.Fsharp/YamlDotNet.Samples.Fsharp.fsproj
COPY YamlDotNet.Fsharp.Test/YamlDotNet.Fsharp.Test.fsproj YamlDotNet.Fsharp.Test/YamlDotNet.Fsharp.Test.fsproj

RUN dotnet restore YamlDotNet.sln

Expand All @@ -43,7 +43,6 @@ RUN dotnet build -c Release --framework net47 YamlDotNet/YamlDotNet.csproj -o /o
RUN dotnet build -c Release --framework netstandard2.0 YamlDotNet/YamlDotNet.csproj -o /output/netstandard2.0
RUN dotnet build -c Release --framework netstandard2.1 YamlDotNet/YamlDotNet.csproj -o /output/netstandard2.1
RUN dotnet build -c Release --framework net6.0 YamlDotNet/YamlDotNet.csproj -o /output/net6.0
RUN dotnet build -c Release --framework net7.0 YamlDotNet/YamlDotNet.csproj -o /output/net7.0
RUN dotnet build -c Release --framework net8.0 YamlDotNet/YamlDotNet.csproj -o /output/net8.0

RUN dotnet pack -c Release YamlDotNet/YamlDotNet.csproj -o /output/package /p:Version=$PACKAGE_VERSION
Expand All @@ -63,7 +62,6 @@ RUN echo -n "${LC_ALL}" > /etc/locale.gen && \
locale-gen

RUN dotnet test -c Release YamlDotNet.Test/YamlDotNet.Test.csproj --framework net8.0 --logger:"trx;LogFileName=/output/tests-net8.0.trx" --logger:"console;Verbosity=detailed"
RUN dotnet test -c Release YamlDotNet.Test/YamlDotNet.Test.csproj --framework net7.0 --logger:"trx;LogFileName=/output/tests-net7.0.trx" --logger:"console;Verbosity=detailed"
RUN dotnet test -c Release YamlDotNet.Test/YamlDotNet.Test.csproj --framework net6.0 --logger:"trx;LogFileName=/output/tests-net6.0.trx" --logger:"console;Verbosity=detailed"
RUN dotnet test -c Release YamlDotNet.Test/YamlDotNet.Test.csproj --framework netcoreapp3.1 --logger:"trx;LogFileName=/output/tests-netcoreapp3.1.trx" --logger:"console;Verbosity=detailed"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public void TestConverterOnAttribute_Serializes()
};
var actual = serializer.Serialize(o).NormalizeNewLines().TrimNewLines();
var expected = @"Value:
abc: def";
abc: def".NormalizeNewLines().TrimNewLines();
Assert.Equal(expected, actual);
}

Expand Down
21 changes: 21 additions & 0 deletions YamlDotNet/Helpers/FsharpHelper.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,24 @@
// This file is part of YamlDotNet - A .NET library for YAML.
// Copyright (c) Antoine Aubry and contributors
//
// Permission is hereby granted, free of charge, to any person obtaining a copy of
// this software and associated documentation files (the "Software"), to deal in
// the Software without restriction, including without limitation the rights to
// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
// of the Software, and to permit persons to whom the Software is furnished to do
// so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.

using System;
using YamlDotNet.Serialization;

Expand Down
4 changes: 3 additions & 1 deletion YamlDotNet/Properties/AssemblyInfo.template
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.

#pragma warning disable IDE0055
#if !UNITY
using System.Reflection;
using System.Runtime.InteropServices;
Expand All @@ -41,4 +42,5 @@ using System.Runtime.InteropServices;
[assembly: AssemblyFileVersion("<%assemblyFileVersion%>")]
[assembly: AssemblyInformationalVersion("<%assemblyInformationalVersion%>")]

#endif
#endif
#pragma warning restore IDE0055
2 changes: 2 additions & 0 deletions YamlDotNet/Serialization/BuilderSkeleton.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@

namespace YamlDotNet.Serialization
{
#pragma warning disable IDE0055 // Fix formatting
/// <summary>
/// Common implementation of <see cref="SerializerBuilder" /> and <see cref="DeserializerBuilder" />.
/// </summary>
Expand All @@ -35,6 +36,7 @@ public abstract class BuilderSkeleton<TBuilder>
#pragma warning restore CA1708
where TBuilder : BuilderSkeleton<TBuilder>
{
#pragma warning restore IDE0055
internal INamingConvention namingConvention = NullNamingConvention.Instance;
internal INamingConvention enumNamingConvention = NullNamingConvention.Instance;
internal ITypeResolver typeResolver;
Expand Down
3 changes: 2 additions & 1 deletion YamlDotNet/Serialization/SerializerBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@

namespace YamlDotNet.Serialization
{

#pragma warning disable IDE0055 // Fix formatting
/// <summary>
/// Creates and configures instances of <see cref="Serializer" />.
/// This class is used to customize the behavior of <see cref="Serializer" />. Use the relevant methods
Expand All @@ -50,6 +50,7 @@ namespace YamlDotNet.Serialization
#endif
public sealed class SerializerBuilder : BuilderSkeleton<SerializerBuilder>
{
#pragma warning restore IDE0055
private ObjectGraphTraversalStrategyFactory objectGraphTraversalStrategyFactory;
private readonly LazyComponentRegistrationList<IEnumerable<IYamlTypeConverter>, IObjectGraphVisitor<Nothing>> preProcessingPhaseObjectGraphVisitorFactories;
private readonly LazyComponentRegistrationList<EmissionPhaseObjectGraphVisitorArgs, IObjectGraphVisitor<IEmitter>> emissionPhaseObjectGraphVisitorFactories;
Expand Down
14 changes: 1 addition & 13 deletions YamlDotNet/Serialization/Utilities/TypeConverter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@

using System;
using System.Globalization;
using System.Linq;
using System.Reflection;
using System.ComponentModel;
using YamlDotNet.Helpers;
Expand Down Expand Up @@ -224,24 +225,12 @@ public static T ChangeType<T>(object? value, INamingConvention enumNamingConvent
// Default to the Convert class
return Convert.ChangeType(value, destinationType, CultureInfo.InvariantCulture);
}
}
}

#if !(NETSTANDARD1_3 || UNITY)
namespace YamlDotNet.Serialization.Utilities
{
using System.Linq;

partial class TypeConverter
{
/// <summary>
/// Registers a <see cref="System.ComponentModel.TypeConverter"/> dynamically.
/// </summary>
/// <typeparam name="TConvertible">The type to which the converter should be associated.</typeparam>
/// <typeparam name="TConverter">The type of the converter.</typeparam>
#if NET20 || NET35 || NET45
[System.Security.Permissions.PermissionSet(System.Security.Permissions.SecurityAction.LinkDemand, Name = "FullTrust")]
#endif
public static void RegisterTypeConverter<TConvertible, TConverter>()
where TConverter : System.ComponentModel.TypeConverter
{
Expand All @@ -257,4 +246,3 @@ public static void RegisterTypeConverter<TConvertible, TConverter>()

}
}
#endif

0 comments on commit d46152a

Please sign in to comment.