Skip to content

Commit

Permalink
Part of the auxiliary code was moved to external libraries: Polyfills…
Browse files Browse the repository at this point in the history
…ForOldDotNet and AdvancedStringBuilder
  • Loading branch information
Taritsyn committed Dec 20, 2018
1 parent 67aae28 commit ee4621b
Show file tree
Hide file tree
Showing 15 changed files with 52 additions and 474 deletions.
95 changes: 0 additions & 95 deletions src/LibSassHost/Extensions/StringBuilderExtensions.cs

This file was deleted.

7 changes: 4 additions & 3 deletions src/LibSassHost/FileManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@
#if NET45 || NET471 || NETSTANDARD
using System.Runtime.InteropServices;
#endif

using LibSassHost.Helpers;
#if NET40
using LibSassHost.Polyfills.System.Runtime.InteropServices;

using PolyfillsForOldDotNet.System.Runtime.InteropServices;
#endif

using LibSassHost.Helpers;
using LibSassHost.Resources;
using LibSassHost.Utilities;

Expand Down
4 changes: 2 additions & 2 deletions src/LibSassHost/Helpers/MarshallingHelpers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Text;

#if NET40
using LibSassHost.Polyfills.System.Runtime.InteropServices;

using PolyfillsForOldDotNet.System.Runtime.InteropServices;
#endif

namespace LibSassHost.Helpers
Expand Down
18 changes: 11 additions & 7 deletions src/LibSassHost/Helpers/SassErrorHelpers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@
using System.Globalization;
using System.Text;

using AdvancedStringBuilder;

using LibSassHost.Resources;
using LibSassHost.Utilities;

namespace LibSassHost.Helpers
{
Expand All @@ -27,7 +28,8 @@ internal static string GenerateCompilerLoadErrorMessage(string description, bool

if (!string.IsNullOrWhiteSpace(description))
{
StringBuilder messageBuilder = StringBuilderPool.GetBuilder();
var stringBuilderPool = StringBuilderPool.Shared;
StringBuilder messageBuilder = stringBuilderPool.Rent();
messageBuilder.Append(compilerNotLoadedPart);
messageBuilder.Append(" ");
if (quoteDescription)
Expand All @@ -40,7 +42,7 @@ internal static string GenerateCompilerLoadErrorMessage(string description, bool
}

message = messageBuilder.ToString();
StringBuilderPool.ReleaseBuilder(messageBuilder);
stringBuilderPool.Return(messageBuilder);
}
else
{
Expand All @@ -67,7 +69,8 @@ public static string GenerateErrorDetails(SassException sassException, bool omit
throw new ArgumentNullException(nameof(sassException));
}

StringBuilder detailsBuilder = StringBuilderPool.GetBuilder();
var stringBuilderPool = StringBuilderPool.Shared;
StringBuilder detailsBuilder = stringBuilderPool.Rent();
WriteCommonErrorDetails(detailsBuilder, sassException, omitMessage);

var sassСompilationException = sassException as SassСompilationException;
Expand All @@ -79,7 +82,7 @@ public static string GenerateErrorDetails(SassException sassException, bool omit
detailsBuilder.TrimEnd();

string errorDetails = detailsBuilder.ToString();
StringBuilderPool.ReleaseBuilder(detailsBuilder);
stringBuilderPool.Return(detailsBuilder);

return errorDetails;
}
Expand All @@ -98,14 +101,15 @@ public static string GenerateErrorDetails(SassСompilationException sassСompila
throw new ArgumentNullException(nameof(sassСompilationException));
}

StringBuilder detailsBuilder = StringBuilderPool.GetBuilder();
var stringBuilderPool = StringBuilderPool.Shared;
StringBuilder detailsBuilder = stringBuilderPool.Rent();
WriteCommonErrorDetails(detailsBuilder, sassСompilationException, omitMessage);
WriteCompilationErrorDetails(detailsBuilder, sassСompilationException);

detailsBuilder.TrimEnd();

string errorDetails = detailsBuilder.ToString();
StringBuilderPool.ReleaseBuilder(detailsBuilder);
stringBuilderPool.Return(detailsBuilder);

return errorDetails;
}
Expand Down
8 changes: 4 additions & 4 deletions src/LibSassHost/Internal/FileManagerMarshaler.cs
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
#if NET45 || NET471 || NETSTANDARD
using System.Runtime.InteropServices;

#endif
using LibSassHost.Internal.Native;
#if NET40
using LibSassHost.Polyfills.System.Runtime.InteropServices;

using PolyfillsForOldDotNet.System.Runtime.InteropServices;
#endif
using LibSassHost.Utilities;

using LibSassHost.Internal.Native;

namespace LibSassHost.Internal
{
Expand Down
8 changes: 7 additions & 1 deletion src/LibSassHost/LibSassHost.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ This package does not contain the native implementations of LibSass. Therefore,
<RepositoryUrl>https://github.com/Taritsyn/LibSassHost</RepositoryUrl>
<RepositoryType>git</RepositoryType>
<PackageTags>LibSass;Sass;SCSS;CSS</PackageTags>
<PackageReleaseNotes>An attempt was made to fix a error #26 “"Unable to find an entry point named 'libsass_version' in DLL 'libsass'." on Azure Web App”.</PackageReleaseNotes>
<PackageReleaseNotes>1. An attempt was made to fix a error #26 “"Unable to find an entry point named 'libsass_version' in DLL 'libsass'." on Azure Web App”;
2. Part of the auxiliary code was moved to external libraries: PolyfillsForOldDotNet and AdvancedStringBuilder.</PackageReleaseNotes>
<NeutralLanguage>en-US</NeutralLanguage>
<GenerateAssemblyTitleAttribute>false</GenerateAssemblyTitleAttribute>
<GenerateAssemblyDescriptionAttribute>false</GenerateAssemblyDescriptionAttribute>
Expand All @@ -41,6 +42,11 @@ This package does not contain the native implementations of LibSass. Therefore,

<ItemGroup>
<PackageReference Include="ResxToCs.MSBuild" Version="1.0.0-alpha5" PrivateAssets="All" />
<PackageReference Include="AdvancedStringBuilder" Version="0.1.0" />
</ItemGroup>

<ItemGroup Condition=" '$(TargetFramework)' == 'net40-client' ">
<PackageReference Include="PolyfillsForOldDotNet.System.Runtime.InteropServices.RuntimeInformation" Version="0.1.1" />
</ItemGroup>

<ItemGroup Condition=" '$(TargetFramework)' == 'net45' ">
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

Loading

0 comments on commit ee4621b

Please sign in to comment.