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