Skip to content
This repository was archived by the owner on Dec 24, 2022. It is now read-only.

Commit 761a9b5

Browse files
committed
Refactor to use NETCORE/NETSTANDARD2_0 build symbols
1 parent 8cdc795 commit 761a9b5

35 files changed

+96
-69
lines changed

src/Directory.Build.props

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<Version>5.12.1</Version>
55
<Authors>ServiceStack</Authors>
66
<Company>ServiceStack, Inc.</Company>
7-
<Copyright>&#169; 2008-2018 ServiceStack, Inc</Copyright>
7+
<Copyright>&#169; 2008-2022 ServiceStack, Inc</Copyright>
88
<PackageRequireLicenseAcceptance>true</PackageRequireLicenseAcceptance>
99
<PackageProjectUrl>https://github.com/ServiceStack/ServiceStack.Text</PackageProjectUrl>
1010
<PackageLicenseUrl>https://servicestack.net/terms</PackageLicenseUrl>
@@ -43,6 +43,14 @@
4343
<DefineConstants>$(DefineConstants);NETSTANDARD;NETSTANDARD2_1</DefineConstants>
4444
</PropertyGroup>
4545

46+
<PropertyGroup Condition=" '$(TargetFramework)' == 'net6.0' ">
47+
<DefineConstants>$(DefineConstants);NET6_0;NET6_0_OR_GREATER</DefineConstants>
48+
</PropertyGroup>
49+
50+
<PropertyGroup Condition=" '$(TargetFramework)' == 'netstandard2.0' OR '$(TargetFramework)' == 'netstandard2.1' OR '$(TargetFramework)' == 'netcoreapp3.1' OR '$(TargetFramework)' == 'net5.0' OR '$(TargetFramework)' == 'net6.0' ">
51+
<DefineConstants>$(DefineConstants);NETCORE;NETCORE_SUPPORT</DefineConstants>
52+
</PropertyGroup>
53+
4654
<ItemGroup>
4755
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0" PrivateAssets="All"/>
4856
</ItemGroup>

src/ServiceStack.Memory/ServiceStack.Memory.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<TargetFrameworks>netcoreapp2.1</TargetFrameworks>
44
</PropertyGroup>
55
<PropertyGroup Condition=" '$(TargetFramework)' == 'netcoreapp2.1' ">
6-
<DefineConstants>$(DefineConstants);NETSTANDARD;NETCORE2_1</DefineConstants>
6+
<DefineConstants>$(DefineConstants);NETSTANDARD;NETCORE;NETCORE2_1</DefineConstants>
77
</PropertyGroup>
88
<ItemGroup>
99
<ProjectReference Include="..\ServiceStack.Text\ServiceStack.Text.csproj" />

src/ServiceStack.Text.sln

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "build", "build", "{F7FB50ED
1212
Directory.Build.props = Directory.Build.props
1313
ServiceStack.Text\ServiceStack.Text.Core.csproj = ServiceStack.Text\ServiceStack.Text.Core.csproj
1414
..\build\build-core.proj = ..\build\build-core.proj
15+
..\tests\Directory.Build.props = ..\tests\Directory.Build.props
1516
EndProjectSection
1617
EndProject
1718
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ServiceStack.Text", "ServiceStack.Text\ServiceStack.Text.csproj", "{579B3FDB-CDAD-44E1-8417-885C38E49A0E}"

src/ServiceStack.Text/Env.cs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ static Env()
1717
if (PclExport.Instance == null)
1818
throw new ArgumentException("PclExport.Instance needs to be initialized");
1919

20-
#if NETSTANDARD
20+
#if NETCORE
2121
IsNetStandard = true;
2222
try
2323
{
@@ -64,7 +64,7 @@ static Env()
6464
SupportsDynamic = true;
6565
#endif
6666

67-
#if NETCORE2_1 || NET6_0
67+
#if NETCORE
6868
IsNetStandard = false;
6969
IsNetCore = true;
7070
SupportsDynamic = true;
@@ -73,7 +73,6 @@ static Env()
7373
#if NET6_0
7474
IsNet6 = true;
7575
#endif
76-
7776
#if NETSTANDARD2_0
7877
IsNetStandard20 = true;
7978
#endif
@@ -218,7 +217,7 @@ public static string ReferenceAssemblyPath
218217
set => referenceAssemblyPath = value;
219218
}
220219

221-
#if NETSTANDARD
220+
#if NETCORE
222221
private static bool IsRunningAsUwp()
223222
{
224223
try
@@ -315,7 +314,7 @@ public static ConfiguredTaskAwaitable ConfigAwait(this Task task) =>
315314
public static ConfiguredTaskAwaitable<T> ConfigAwait<T>(this Task<T> task) =>
316315
task.ConfigureAwait(ContinueOnCapturedContext);
317316

318-
#if NETSTANDARD || NETCORE2_1 || NET6_0
317+
#if NETCORE
319318
[MethodImpl(MethodImplOptions.AggressiveInlining)]
320319
public static ConfiguredValueTaskAwaitable ConfigAwait(this ValueTask task) =>
321320
task.ConfigureAwait(ContinueOnCapturedContext);

src/ServiceStack.Text/JsConfigScope.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ public sealed class JsConfigScope : Config, IDisposable
1313
bool disposed;
1414
readonly JsConfigScope parent;
1515

16-
#if NETSTANDARD
16+
#if NETCORE
1717
private static AsyncLocal<JsConfigScope> head = new AsyncLocal<JsConfigScope>();
1818
#else
1919
[ThreadStatic] private static JsConfigScope head;
@@ -23,7 +23,7 @@ internal JsConfigScope()
2323
{
2424
PclExport.Instance.BeginThreadAffinity();
2525

26-
#if NETSTANDARD
26+
#if NETCORE
2727
parent = head.Value;
2828
head.Value = this;
2929
#else
@@ -33,7 +33,7 @@ internal JsConfigScope()
3333
}
3434

3535
internal static JsConfigScope Current =>
36-
#if NETSTANDARD
36+
#if NETCORE
3737
head.Value;
3838
#else
3939
head;
@@ -44,7 +44,7 @@ public void Dispose()
4444
if (!disposed)
4545
{
4646
disposed = true;
47-
#if NETSTANDARD
47+
#if NETCORE
4848
head.Value = parent;
4949
#else
5050
head = parent;

src/ServiceStack.Text/LicenseUtils.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -499,7 +499,7 @@ public static bool VerifySignedHash(byte[] DataToVerify, byte[] SignedData, Syst
499499

500500
public static LicenseKey VerifyLicenseKeyText(string licenseKeyText)
501501
{
502-
#if NET45 || NETCORE2_1 || NET6_0
502+
#if NET45 || NETCORE
503503
LicenseKey key;
504504
try
505505
{

src/ServiceStack.Text/MemoryProvider.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ namespace ServiceStack.Text
1212
public abstract class MemoryProvider
1313
{
1414
public static MemoryProvider Instance =
15-
#if NETCORE2_1 || NET6_0
15+
#if NETCORE && !NETSTANDARD2_0
1616
ServiceStack.Memory.NetCoreMemory.Provider;
1717
#else
1818
DefaultMemory.Provider;

src/ServiceStack.Text/NetCoreMemory.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#if NETCORE2_1 || NET6_0
1+
#if NETCORE && !NETSTANDARD2_0
22

33
using System;
44
using System.Buffers.Text;

src/ServiceStack.Text/PathUtils.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ public static string MapAbsolutePath(this string relativePath)
6666
public static string MapHostAbsolutePath(this string relativePath)
6767
{
6868
var sep = PclExport.Instance.DirSep;
69-
#if !NETSTANDARD
69+
#if !NETCORE
7070
return PclExport.Instance.MapAbsolutePath(relativePath, $"{sep}..");
7171
#else
7272
return PclExport.Instance.MapAbsolutePath(relativePath, $"{sep}..{sep}..{sep}..");

src/ServiceStack.Text/PclExport.NetCore.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#if NETCORE2_1 || NET6_0
1+
#if NETCORE && !NETSTANDARD2_0
22

33
using System;
44
using ServiceStack.Text;

0 commit comments

Comments
 (0)