Change ifdefs to be by feature, not by platform (#1146)

* First pass

* Second pass

* Third pass

* Temporarily change build script to build only portable

* Add portable features for release build

* Add feature constants to build script

* Add more feature constants to build script

* Fix build issues

* Fix build issues

* Get rid of constants in build.ps1

* HAVE_NUMERICS -> HAVE_BIG_INTEGER

* Remove HAVE_NULLABLE

* Remove HAVE_NUMERICS from csprojs

* Add missing ifdef

* Add feature defines to pj

* Re-enable netstd builds

* Fix defines in pj

* Trying to get better build outputs

* Trying to get the build error

* Use newer cli

* Address review feedback; make netstd build work

* Introduce HAVE_DB_NULL_TYPE

* Adapt to upstream changes; address remaining review feedback

* Adapt to upstream changes; address remaining review feedback

* Rename some constants for constistency

* Address review feedback

* -Fixed build with signed assembly

* Fix merge erorr

* Address review feedback

* Introduce HAVE_NON_SERIALIZED_ATTRIBUTE

* HAVE_IGNORE_DATA_MEMBER_ATTRIBUTE
This commit is contained in:
Florian Greinacher
2017-01-12 11:07:02 +13:00
committed by James Newton-King
parent eb96cb9f62
commit b8e60c773b
114 changed files with 642 additions and 550 deletions
+7 -7
View File
@@ -27,12 +27,12 @@ using System;
using System.Collections.Generic;
using System.IO;
using System.Globalization;
#if !(NET20 || NET35 || PORTABLE40 || PORTABLE) || NETSTANDARD1_1
#if HAVE_BIG_INTEGER
using System.Numerics;
#endif
using Newtonsoft.Json.Serialization;
using Newtonsoft.Json.Utilities;
#if NET20
#if !HAVE_LINQ
using Newtonsoft.Json.Utilities.LinqBridge;
#else
using System.Linq;
@@ -193,7 +193,7 @@ namespace Newtonsoft.Json
set
{
if (value < DateParseHandling.None ||
#if !NET20
#if HAVE_DATE_TIME_OFFSET
value > DateParseHandling.DateTimeOffset
#else
value > DateParseHandling.DateTime
@@ -629,7 +629,7 @@ namespace Newtonsoft.Json
if (!(Value is double))
{
double d;
#if !(NET20 || NET35 || PORTABLE40 || PORTABLE) || NETSTANDARD1_1
#if HAVE_BIG_INTEGER
if (Value is BigInteger)
{
d = (double)(BigInteger)Value;
@@ -689,7 +689,7 @@ namespace Newtonsoft.Json
case JsonToken.Integer:
case JsonToken.Float:
bool b;
#if !(NET20 || NET35 || PORTABLE40 || PORTABLE) || NETSTANDARD1_1
#if HAVE_BIG_INTEGER
if (Value is BigInteger)
{
b = (BigInteger)Value != 0;
@@ -796,7 +796,7 @@ namespace Newtonsoft.Json
case JsonToken.EndArray:
return null;
case JsonToken.Date:
#if !NET20
#if HAVE_DATE_TIME_OFFSET
if (Value is DateTimeOffset)
{
SetToken(JsonToken.Date, ((DateTimeOffset)Value).DateTime, false);
@@ -838,7 +838,7 @@ namespace Newtonsoft.Json
throw JsonReaderException.Create(this, "Could not convert string to DateTime: {0}.".FormatWith(CultureInfo.InvariantCulture, s));
}
#if !NET20
#if HAVE_DATE_TIME_OFFSET
/// <summary>
/// Reads the next JSON token from the source as a <see cref="Nullable{T}"/> of <see cref="DateTimeOffset"/>.
/// </summary>