Skip to content

Commit

Permalink
Add netstandard 2.0 support.
Browse files Browse the repository at this point in the history
  • Loading branch information
peters committed Jun 29, 2020
1 parent 6945eb9 commit 5c6b2b5
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 12 deletions.
4 changes: 2 additions & 2 deletions src/Snap.Shared.Tests/Snap.Shared.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<IsPackable>false</IsPackable>
<IsTestProject>false</IsTestProject>
<TargetFrameworks Condition="$(OsPlatform) == 'Windows'">netcoreapp2.1;net461</TargetFrameworks>
<TargetFrameworks Condition="$(OsPlatform) != 'Windows'">netcoreapp3.1</TargetFrameworks>
<TargetFrameworks Condition="$(OsPlatform) != 'Windows'">netcoreapp2.1</TargetFrameworks>
</PropertyGroup>

<ItemGroup>
Expand All @@ -17,7 +17,7 @@
<PackageReference Include="XunitXml.TestLogger" Version="2.1.26" />
</ItemGroup>

<ItemGroup Condition="'$(IsNetFullFramework)' == 'true'">
<ItemGroup Condition="$(IsNetFullFramework) == 'true'">
<PackageReference Include="System.Runtime.InteropServices.RuntimeInformation" Version="4.3.0">
<PrivateAssets>all</PrivateAssets>
</PackageReference>
Expand Down
4 changes: 2 additions & 2 deletions src/Snap.Tests/Snap.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<IsPackable>false</IsPackable>
<IsTestProject>true</IsTestProject>
<TargetFrameworks Condition="$(OsPlatform) == 'Windows'">netcoreapp2.1;net461</TargetFrameworks>
<TargetFrameworks Condition="$(OsPlatform) != 'Windows'">netcoreapp3.1</TargetFrameworks>
<TargetFrameworks Condition="$(OsPlatform) != 'Windows'">netcoreapp2.1;netstandard2.0</TargetFrameworks>
</PropertyGroup>

<ItemGroup>
Expand All @@ -31,7 +31,7 @@
</PackageReference>
</ItemGroup>

<ItemGroup Condition="'$(IsNetFullFramework)' == 'true'">
<ItemGroup Condition="$(IsNetFullFramework) == 'true'">
<PackageReference Include="System.Runtime.InteropServices.RuntimeInformation" Version="4.3.0">
<PrivateAssets>all</PrivateAssets>
</PackageReference>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
#if NETFULLFRAMEWORK
#if NETFULLFRAMEWORK || NETSTANDARD
using System.Collections.Generic;
using JetBrains.Annotations;

// ReSharper disable once CheckNamespace
namespace System.Linq
{
internal static class NetFullFrameworkShimExtensions
internal static class ShimExtensions
{
public static IEnumerable<TSource> SkipLast<TSource>([NotNull] this IEnumerable<TSource> source)
{
Expand Down
4 changes: 3 additions & 1 deletion src/Snap/Core/SnapBinaryPatcher.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
// Resharper disable all
using System;
using System.IO;
using System.IO.Compression;
using System.Threading;
using SharpCompress.Compressors;
using SharpCompress.Compressors.BZip2;
using CompressionMode = SharpCompress.Compressors.CompressionMode;

// Adapted from https://github.com/LogosBible/bsdiff.net/blob/master/src/bsdiff/BinaryPatchUtility.cs
// Adapter from https://raw.githubusercontent.com/Squirrel/Squirrel.Windows/afe47c9c064bf9860404c61d6ef36d8ecb250b04/src/Squirrel/BinaryPatchUtility.cs
Expand Down Expand Up @@ -925,4 +927,4 @@ public static void ReadExactly(this Stream stream, byte[] buffer, int offset, in
}
}
}
// Resharper enable all
// Resharper enable all
4 changes: 2 additions & 2 deletions src/Snap/CoreRunLib.cs
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ public bool Chmod([JetBrains.Annotations.NotNull] string filename, int mode)
{
if (filename == null) throw new ArgumentNullException(nameof(filename));
pal_fs_chmod.ThrowIfDangling();
#if !NETFULLFRAMEWORK
#if NETCOREAPP
return pal_fs_chmod.Invoke(filename, mode) == 1;
#endif
var filenameUtf8 = Utf16ToUtf8(filename);
Expand All @@ -137,7 +137,7 @@ public bool SetIcon([JetBrains.Annotations.NotNull] string exeAbsolutePath, [Jet
{
throw new FileNotFoundException(iconAbsolutePath);
}
#if !NETFULLFRAMEWORK
#if NETCOREAPP
return pal_set_icon.Invoke(exeAbsolutePath, iconAbsolutePath) == 1;
#endif
var exeAbsolutePathUtf8 = Utf16ToUtf8(exeAbsolutePath);
Expand Down
4 changes: 2 additions & 2 deletions src/Snap/Snap.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
<IAmSnapCore>true</IAmSnapCore>
<TargetFrameworks Condition="$(OsPlatform) == 'Windows'">netcoreapp2.1;net461</TargetFrameworks>
<TargetFrameworks Condition="$(OsPlatform) != 'Windows'">netcoreapp3.1</TargetFrameworks>
<TargetFrameworks Condition="$(OsPlatform) == 'Windows'">netcoreapp2.1;netstandard2.0;net461</TargetFrameworks>
<TargetFrameworks Condition="$(OsPlatform) != 'Windows'">netcorapp2.1;netstandard2.0</TargetFrameworks>
<IsPackable>true</IsPackable>
<IsTestProject>false</IsTestProject>
</PropertyGroup>
Expand Down
2 changes: 1 addition & 1 deletion src/Snapx.Tests/Snapx.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
</PackageReference>
</ItemGroup>

<ItemGroup Condition="'$(IsNetFullFramework)' == 'true'">
<ItemGroup Condition="$(IsNetFullFramework) == 'true'">
<PackageReference Include="System.Runtime.InteropServices.RuntimeInformation" Version="4.3.0">
<PrivateAssets>all</PrivateAssets>
</PackageReference>
Expand Down

0 comments on commit 5c6b2b5

Please sign in to comment.