mirror of
https://github.com/Thealexbarney/LibHac.git
synced 2024-11-14 10:49:41 +01:00
Add .NET Standard 2.0 target (#73)
* Add .NET Standard 2.0 target * Update dependencies
This commit is contained in:
parent
76550b0bd9
commit
7b8c3f0b4f
9 changed files with 36 additions and 27 deletions
|
@ -62,6 +62,7 @@ namespace LibHacBuild
|
|||
|
||||
private const string MyGetSource = "https://dotnet.myget.org/F/dotnet-core/api/v3/index.json";
|
||||
const string CertFileName = "cert.pfx";
|
||||
private const string CoreFrameworks = "netcoreapp2.1;netstandard2.0";
|
||||
|
||||
private bool IsMasterBranch => _gitVersion?.BranchName.Equals("master") ?? false;
|
||||
|
||||
|
@ -139,7 +140,7 @@ namespace LibHacBuild
|
|||
.SetProperties(VersionProps)
|
||||
.SetProperty("BuildType", "Release");
|
||||
|
||||
if (DoCoreBuildOnly) buildSettings = buildSettings.SetFramework("netcoreapp2.1");
|
||||
if (DoCoreBuildOnly) buildSettings = buildSettings.SetProperty("TargetFrameworks", CoreFrameworks);
|
||||
|
||||
DotNetBuild(s => buildSettings);
|
||||
|
||||
|
@ -186,7 +187,7 @@ namespace LibHacBuild
|
|||
.SetProperties(VersionProps);
|
||||
|
||||
if (DoCoreBuildOnly)
|
||||
settings = settings.SetProperty("TargetFrameworks", "netcoreapp2.1");
|
||||
settings = settings.SetProperty("TargetFrameworks", CoreFrameworks);
|
||||
|
||||
DotNetPack(s => settings);
|
||||
|
||||
|
@ -241,7 +242,7 @@ namespace LibHacBuild
|
|||
.EnableNoBuild()
|
||||
.SetConfiguration(Configuration);
|
||||
|
||||
if (DoCoreBuildOnly) settings = settings.SetFramework("netcoreapp2.1");
|
||||
if (DoCoreBuildOnly) settings = settings.SetProperty("TargetFrameworks", CoreFrameworks);
|
||||
|
||||
DotNetTest(s => settings);
|
||||
});
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
<PackageReference Include="GitVersion.CommandLine.DotNetCore" Version="4.0.0" />
|
||||
<PackageReference Include="ILRepack.Lib" Version="2.0.17" NoWarn="NU1701" />
|
||||
<PackageReference Include="NuGet.CommandLine" Version="5.0.2" />
|
||||
<PackageReference Include="Nuke.Common" Version="0.20.0" />
|
||||
<PackageReference Include="Nuke.Common" Version="0.21.0" />
|
||||
<PackageReference Include="SharpZipLib" Version="1.1.0" />
|
||||
</ItemGroup>
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
|
||||
#if NETFRAMEWORK
|
||||
#if !HAS_FILE_SYSTEM_NAME
|
||||
|
||||
// This code was introduced in .NET Core 2.1
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
using System.Collections.Generic;
|
||||
|
||||
#if NETCOREAPP
|
||||
#if CROSS_PLATFORM
|
||||
using System.Runtime.InteropServices;
|
||||
#endif
|
||||
|
||||
|
@ -64,7 +64,7 @@ namespace LibHac.Fs
|
|||
|
||||
private bool IsConcatenationFile(DirectoryEntry entry)
|
||||
{
|
||||
#if NETCOREAPP
|
||||
#if CROSS_PLATFORM
|
||||
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
|
||||
{
|
||||
return ConcatenationFileSystem.HasConcatenationFileAttribute(entry.Attributes);
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
#if NETCOREAPP
|
||||
#if CROSS_PLATFORM
|
||||
using System.Runtime.InteropServices;
|
||||
#endif
|
||||
|
||||
|
@ -51,7 +51,7 @@ namespace LibHac.Fs
|
|||
// but writing still won't work properly on those platforms
|
||||
internal bool IsConcatenationFile(string path)
|
||||
{
|
||||
#if NETCOREAPP
|
||||
#if CROSS_PLATFORM
|
||||
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
|
||||
{
|
||||
return HasConcatenationFileAttribute(BaseFileSystem.GetFileAttributes(path));
|
||||
|
@ -65,7 +65,7 @@ namespace LibHac.Fs
|
|||
#endif
|
||||
}
|
||||
|
||||
#if NETCOREAPP
|
||||
#if CROSS_PLATFORM
|
||||
private bool IsConcatenationFileHeuristic(string path)
|
||||
{
|
||||
if (BaseFileSystem.GetEntryType(path) != DirectoryEntryType.Directory) return false;
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
using System.Diagnostics;
|
||||
using System.Runtime.CompilerServices;
|
||||
|
||||
#if !NETFRAMEWORK
|
||||
#if HAS_FILE_SYSTEM_NAME
|
||||
using System.IO.Enumeration;
|
||||
#endif
|
||||
|
||||
|
@ -430,11 +430,11 @@ namespace LibHac.Fs
|
|||
|
||||
public static bool MatchesPattern(string searchPattern, string name, bool ignoreCase)
|
||||
{
|
||||
#if NETFRAMEWORK
|
||||
return Compatibility.FileSystemName.MatchesSimpleExpression(searchPattern.AsSpan(),
|
||||
name.AsSpan(), ignoreCase);
|
||||
#else
|
||||
#if HAS_FILE_SYSTEM_NAME
|
||||
return FileSystemName.MatchesSimpleExpression(searchPattern.AsSpan(),
|
||||
name.AsSpan(), ignoreCase);
|
||||
#else
|
||||
return Compatibility.FileSystemName.MatchesSimpleExpression(searchPattern.AsSpan(),
|
||||
name.AsSpan(), ignoreCase);
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
<PropertyGroup>
|
||||
<OutputType>Library</OutputType>
|
||||
<TargetFrameworks>netcoreapp2.1;net46</TargetFrameworks>
|
||||
<TargetFrameworks>netcoreapp2.1;netstandard2.0;net46</TargetFrameworks>
|
||||
<LangVersion>7.3</LangVersion>
|
||||
</PropertyGroup>
|
||||
|
||||
|
@ -30,16 +30,24 @@
|
|||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition=" '$(TargetFramework)' == 'netcoreapp2.1' ">
|
||||
<DefineConstants>$(DefineConstants);STREAM_SPAN</DefineConstants>
|
||||
<DefineConstants>$(DefineConstants);STREAM_SPAN;STRING_SPAN;HAS_FILE_SYSTEM_NAME;CROSS_PLATFORM</DefineConstants>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition=" '$(TargetFramework)' == 'netstandard2.0' ">
|
||||
<DefineConstants>$(DefineConstants);CROSS_PLATFORM</DefineConstants>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup Condition=" '$(TargetFramework)' == 'net46' ">
|
||||
<PackageReference Include="System.Buffers" Version="4.5.0" />
|
||||
<PackageReference Include="System.Memory" Version="4.5.2" />
|
||||
<PackageReference Include="System.Memory" Version="4.5.3" />
|
||||
<PackageReference Include="System.Numerics.Vectors" Version="4.5.0" />
|
||||
<PackageReference Include="System.ValueTuple" Version="4.5.0" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup Condition=" '$(TargetFramework)' == 'netstandard2.0' ">
|
||||
<PackageReference Include="System.Memory" Version="4.5.3" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup Condition=" '$(TargetFramework)' == 'netcoreapp2.1' ">
|
||||
<PackageReference Include="System.Runtime.CompilerServices.Unsafe" Version="4.5.2" />
|
||||
</ItemGroup>
|
||||
|
|
|
@ -109,10 +109,10 @@ namespace LibHac
|
|||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static string GetUtf8String(ReadOnlySpan<byte> value)
|
||||
{
|
||||
#if NETFRAMEWORK
|
||||
return Encoding.UTF8.GetString(value.ToArray());
|
||||
#else
|
||||
#if STRING_SPAN
|
||||
return Encoding.UTF8.GetString(value);
|
||||
#else
|
||||
return Encoding.UTF8.GetString(value.ToArray());
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -123,10 +123,10 @@ namespace LibHac
|
|||
|
||||
value = value.Slice(0, i);
|
||||
|
||||
#if NETFRAMEWORK
|
||||
return Encoding.UTF8.GetString(value.ToArray());
|
||||
#else
|
||||
#if STRING_SPAN
|
||||
return Encoding.UTF8.GetString(value);
|
||||
#else
|
||||
return Encoding.UTF8.GetString(value.ToArray());
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
@ -7,9 +7,9 @@
|
|||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.8.0" />
|
||||
<PackageReference Include="xunit" Version="2.3.1" />
|
||||
<PackageReference Include="xunit.runner.visualstudio" Version="2.3.1" />
|
||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.2.0" />
|
||||
<PackageReference Include="xunit" Version="2.4.1" />
|
||||
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.1" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
|
Loading…
Reference in a new issue