-Changed DateTimeOffset JValue to return TypeCode.Object

-Incremented version to 8.0.1-beta1
This commit is contained in:
James Newton-King
2015-10-18 13:42:31 +13:00
parent 18e45e2b75
commit ab2906874f
4 changed files with 21 additions and 41 deletions
+8 -32
View File
@@ -1,7 +1,7 @@
properties { properties {
$zipFileName = "Json70r2.zip" $zipFileName = "Json80r1.zip"
$majorVersion = "7.0" $majorVersion = "8.0"
$majorWithReleaseVersion = "7.0.2" $majorWithReleaseVersion = "8.0.1"
$nugetPrelease = "beta1" $nugetPrelease = "beta1"
$version = GetVersion $majorWithReleaseVersion $version = GetVersion $majorWithReleaseVersion
$packageId = "Newtonsoft.Json" $packageId = "Newtonsoft.Json"
@@ -22,9 +22,9 @@
$workingDir = "$baseDir\$workingName" $workingDir = "$baseDir\$workingName"
$workingSourceDir = "$workingDir\Src" $workingSourceDir = "$workingDir\Src"
$builds = @( $builds = @(
@{Name = "Newtonsoft.Json.Dotnet"; TestsName = "Newtonsoft.Json.Tests.Dotnet"; BuildFunction = "DnxBuild"; TestsFunction = "DnxTests"; Constants="dotnet"; FinalDir="Dotnet"; NuGetDir = "dotnet"; Framework=$null}, @{Name = "Newtonsoft.Json.Dotnet"; TestsName = "Newtonsoft.Json.Tests.Dotnet"; BuildFunction = "DnxBuild"; TestsFunction = "DnxTests"; Constants="dotnet"; FinalDir=$null; NuGetDir = $null; Framework=$null},
@{Name = "Newtonsoft.Json"; TestsName = "Newtonsoft.Json.Tests"; BuildFunction = "MSBuildBuild"; TestsFunction = "NUnitTests"; Constants=""; FinalDir="Net45"; NuGetDir = "net45"; Framework="net-4.0"}, @{Name = "Newtonsoft.Json"; TestsName = "Newtonsoft.Json.Tests"; BuildFunction = "MSBuildBuild"; TestsFunction = "NUnitTests"; Constants=""; FinalDir="Net45"; NuGetDir = "net45"; Framework="net-4.0"},
@{Name = "Newtonsoft.Json.Portable"; TestsName = "Newtonsoft.Json.Tests.Portable"; BuildFunction = "MSBuildBuild"; TestsFunction = "NUnitTests"; Constants="PORTABLE"; FinalDir="Portable"; NuGetDir = "portable-net45+wp80+win8+wpa81"; Framework="net-4.0"}, @{Name = "Newtonsoft.Json.Portable"; TestsName = "Newtonsoft.Json.Tests.Portable"; BuildFunction = "MSBuildBuild"; TestsFunction = "NUnitTests"; Constants="PORTABLE"; FinalDir="Portable"; NuGetDir = "portable-net45+wp80+win8+wpa81+dnxcore50"; Framework="net-4.0"},
@{Name = "Newtonsoft.Json.Portable40"; TestsName = "Newtonsoft.Json.Tests.Portable40"; BuildFunction = "MSBuildBuild"; TestsFunction = "NUnitTests"; Constants="PORTABLE40"; FinalDir="Portable40"; NuGetDir = "portable-net40+sl5+wp80+win8+wpa81"; Framework="net-4.0"}, @{Name = "Newtonsoft.Json.Portable40"; TestsName = "Newtonsoft.Json.Tests.Portable40"; BuildFunction = "MSBuildBuild"; TestsFunction = "NUnitTests"; Constants="PORTABLE40"; FinalDir="Portable40"; NuGetDir = "portable-net40+sl5+wp80+win8+wpa81"; Framework="net-4.0"},
@{Name = "Newtonsoft.Json.Net40"; TestsName = "Newtonsoft.Json.Tests.Net40"; BuildFunction = "MSBuildBuild"; TestsFunction = "NUnitTests"; Constants="NET40"; FinalDir="Net40"; NuGetDir = "net40"; Framework="net-4.0"}, @{Name = "Newtonsoft.Json.Net40"; TestsName = "Newtonsoft.Json.Tests.Net40"; BuildFunction = "MSBuildBuild"; TestsFunction = "NUnitTests"; Constants="NET40"; FinalDir="Net40"; NuGetDir = "net40"; Framework="net-4.0"},
@{Name = "Newtonsoft.Json.Net35"; TestsName = "Newtonsoft.Json.Tests.Net35"; BuildFunction = "MSBuildBuild"; TestsFunction = "NUnitTests"; Constants="NET35"; FinalDir="Net35"; NuGetDir = "net35"; Framework="net-2.0"}, @{Name = "Newtonsoft.Json.Net35"; TestsName = "Newtonsoft.Json.Tests.Net35"; BuildFunction = "MSBuildBuild"; TestsFunction = "NUnitTests"; Constants="NET35"; FinalDir="Net35"; NuGetDir = "net35"; Framework="net-2.0"},
@@ -56,7 +56,7 @@ task Clean {
task Build -depends Clean { task Build -depends Clean {
Write-Host "Copying source to working source directory $workingSourceDir" Write-Host "Copying source to working source directory $workingSourceDir"
robocopy $sourceDir $workingSourceDir /MIR /NP /XD bin obj TestResults AppPackages $packageDirs .vs /XF *.suo *.user project.lock.json *.project.lock.json | Out-Default robocopy $sourceDir $workingSourceDir /MIR /NP /XD bin obj TestResults AppPackages $packageDirs .vs /XF *.suo *.user *.lock.json | Out-Default
Write-Host -ForegroundColor Green "Updating assembly version" Write-Host -ForegroundColor Green "Updating assembly version"
Write-Host Write-Host
@@ -214,19 +214,7 @@ function DnxBuild($build)
Write-Host -ForegroundColor Green "Restoring packages for $name" Write-Host -ForegroundColor Green "Restoring packages for $name"
Write-Host Write-Host
exec { exec { dnu restore $projectPath | Out-Default }
try {
dnu restore $projectPath | Out-Default
Write-Host "Restore last exit code: $lastexitcode"
}
catch [System.Management.Automation.RemoteException]
{
Write-Host "Restore last exit code: $lastexitcode"
Write-Host ("Restore exception: " + $_.ToString())
$global:lastexitcode = 0
$lastexitcode = 0
}
}
Write-Host -ForegroundColor Green "Building $projectPath" Write-Host -ForegroundColor Green "Building $projectPath"
exec { dnu build $projectPath --configuration Release | Out-Default } exec { dnu build $projectPath --configuration Release | Out-Default }
@@ -245,19 +233,7 @@ function DnxTests($build)
Write-Host -ForegroundColor Green "Restoring packages for $name" Write-Host -ForegroundColor Green "Restoring packages for $name"
Write-Host Write-Host
exec { exec { dnu restore "$workingSourceDir\Newtonsoft.Json.Tests\project.json" | Out-Default }
try {
dnu restore "$workingSourceDir\Newtonsoft.Json.Tests\project.json" | Out-Default
Write-Host "Restore last exit code: $lastexitcode"
}
catch [System.Management.Automation.RemoteException]
{
Write-Host "Restore last exit code: $lastexitcode"
Write-Host ("Restore exception: " + $_.ToString())
$global:lastexitcode = 0
$lastexitcode = 0
}
}
Write-Host -ForegroundColor Green "Ensuring test project builds for $name" Write-Host -ForegroundColor Green "Ensuring test project builds for $name"
Write-Host Write-Host
@@ -114,13 +114,21 @@ namespace Newtonsoft.Json.Tests.Linq
Stopwatch sw = new Stopwatch(); Stopwatch sw = new Stopwatch();
sw.Start(); sw.Start();
int count = 0;
foreach (dynamic o in d) foreach (dynamic o in d)
{ {
if (count > 10)
{
break;
}
foreach (dynamic friend in o.friends) foreach (dynamic friend in o.friends)
{ {
UpdateValueCount(counts, friend.id); UpdateValueCount(counts, friend.id);
UpdateValueCount(counts, ((string) friend.name).Split(' ')[0]); UpdateValueCount(counts, ((string) friend.name).Split(' ')[0]);
} }
count++;
} }
Console.WriteLine("Time (secs): " + sw.Elapsed.TotalSeconds); Console.WriteLine("Time (secs): " + sw.Elapsed.TotalSeconds);
@@ -658,6 +658,11 @@ namespace Newtonsoft.Json.Tests.Linq
v = new JValue(new BigInteger(3)); v = new JValue(new BigInteger(3));
Assert.AreEqual(TypeCode.Object, v.GetTypeCode()); Assert.AreEqual(TypeCode.Object, v.GetTypeCode());
#endif #endif
#if !(NET20)
v = new JValue(new DateTimeOffset(2000, 12, 12, 12, 12, 12, TimeSpan.Zero));
Assert.AreEqual(TypeCode.Object, v.GetTypeCode());
#endif
} }
[Test] [Test]
-9
View File
@@ -973,15 +973,6 @@ namespace Newtonsoft.Json.Linq
if (_value == null) if (_value == null)
return TypeCode.Empty; return TypeCode.Empty;
#if !NET20
if (_value is DateTimeOffset)
return TypeCode.DateTime;
#endif
#if !(NET20 || NET35 || PORTABLE40)
if (_value is BigInteger)
return TypeCode.Object;
#endif
IConvertible convertable = _value as IConvertible; IConvertible convertable = _value as IConvertible;
if (convertable == null) if (convertable == null)