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
@@ -1,4 +1,4 @@
#region License
#region License
// Copyright (c) 2007 James Newton-King
//
// Permission is hereby granted, free of charge, to any person
@@ -23,12 +23,12 @@
// OTHER DEALINGS IN THE SOFTWARE.
#endregion
#if !(NET20 || NET35 || NET40 || PORTABLE40)
#if HAVE_ASYNC
using System;
using System.Globalization;
using System.Threading;
#if !PORTABLE || NETSTANDARD1_1
#if HAVE_BIG_INTEGER
using System.Numerics;
#endif
using System.Threading.Tasks;
@@ -612,7 +612,7 @@ namespace Newtonsoft.Json
case JsonToken.Integer:
ValidationUtils.ArgumentNotNull(value, nameof(value));
return
#if !PORTABLE || NETSTANDARD1_1
#if HAVE_BIG_INTEGER
value is BigInteger ? WriteValueAsync((BigInteger)value, cancellationToken) :
#endif
WriteValueAsync(Convert.ToInt64(value, CultureInfo.InvariantCulture), cancellationToken);
@@ -1652,7 +1652,7 @@ namespace Newtonsoft.Json
return writer.WriteValueAsync((TimeSpan)value, cancellationToken);
case PrimitiveTypeCode.TimeSpanNullable:
return writer.WriteValueAsync(value == null ? (TimeSpan?)null : (TimeSpan)value, cancellationToken);
#if !PORTABLE || NETSTANDARD1_1
#if HAVE_BIG_INTEGER
case PrimitiveTypeCode.BigInteger:
// this will call to WriteValueAsync(object)
@@ -1668,12 +1668,12 @@ namespace Newtonsoft.Json
return writer.WriteValueAsync((string)value, cancellationToken);
case PrimitiveTypeCode.Bytes:
return writer.WriteValueAsync((byte[])value, cancellationToken);
#if !(PORTABLE || DOTNET)
#if HAVE_DB_NULL_TYPE_CODE
case PrimitiveTypeCode.DBNull:
return writer.WriteNullAsync(cancellationToken);
#endif
default:
#if !PORTABLE
#if HAVE_ICONVERTIBLE
IConvertible convertable = value as IConvertible;
if (convertable != null)
{