From 48ab68bd2a47d87b1660bdf264898e4bc32aed24 Mon Sep 17 00:00:00 2001 From: Jass Bagga Date: Mon, 30 Jan 2017 15:58:19 -0800 Subject: [PATCH] Upgrade to msbuild Addresses #57 --- JsonPatch.sln | 20 ++- NuGet.config | 1 + appveyor.yml | 4 +- build.ps1 | 2 +- build.sh | 2 +- build/Key.snk | Bin 0 -> 596 bytes build/common.props | 25 ++++ global.json | 10 -- .../Microsoft.AspNetCore.JsonPatch.csproj | 22 +++ .../Microsoft.AspNetCore.JsonPatch.xproj | 17 --- .../Properties/AssemblyInfo.cs | 11 -- .../project.json | 40 ------ ...Microsoft.AspNetCore.JsonPatch.Test.csproj | 25 ++++ .../Microsoft.AspNetCore.JsonPatch.Test.xproj | 20 --- .../ObjectVisitorTest.cs~RF1ad82e13.TMP | 119 ---------------- .../ObjectVisitorTest.cs~RF1ae034c3.TMP | 131 ------------------ .../project.json | 31 ----- version.props | 7 + 18 files changed, 101 insertions(+), 386 deletions(-) create mode 100644 build/Key.snk create mode 100644 build/common.props delete mode 100644 global.json create mode 100644 src/Microsoft.AspNetCore.JsonPatch/Microsoft.AspNetCore.JsonPatch.csproj delete mode 100644 src/Microsoft.AspNetCore.JsonPatch/Microsoft.AspNetCore.JsonPatch.xproj delete mode 100644 src/Microsoft.AspNetCore.JsonPatch/Properties/AssemblyInfo.cs delete mode 100644 src/Microsoft.AspNetCore.JsonPatch/project.json create mode 100644 test/Microsoft.AspNetCore.JsonPatch.Test/Microsoft.AspNetCore.JsonPatch.Test.csproj delete mode 100644 test/Microsoft.AspNetCore.JsonPatch.Test/Microsoft.AspNetCore.JsonPatch.Test.xproj delete mode 100644 test/Microsoft.AspNetCore.JsonPatch.Test/ObjectVisitorTest.cs~RF1ad82e13.TMP delete mode 100644 test/Microsoft.AspNetCore.JsonPatch.Test/ObjectVisitorTest.cs~RF1ae034c3.TMP delete mode 100644 test/Microsoft.AspNetCore.JsonPatch.Test/project.json create mode 100644 version.props diff --git a/JsonPatch.sln b/JsonPatch.sln index 7149fc45519..ae03b680d38 100644 --- a/JsonPatch.sln +++ b/JsonPatch.sln @@ -1,15 +1,27 @@ Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 14 -VisualStudioVersion = 14.0.23107.0 +# Visual Studio 15 +VisualStudioVersion = 15.0.26123.0 MinimumVisualStudioVersion = 10.0.40219.1 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{430B59ED-F960-4D3A-8FFE-3370008E168D}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{36CD6341-AB44-44EB-B3AA-BF98C89FECDD}" EndProject -Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.AspNetCore.JsonPatch", "src\Microsoft.AspNetCore.JsonPatch\Microsoft.AspNetCore.JsonPatch.xproj", "{4D55F4D8-633B-462F-A5B1-FEB84BD2D534}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.JsonPatch", "src\Microsoft.AspNetCore.JsonPatch\Microsoft.AspNetCore.JsonPatch.csproj", "{4D55F4D8-633B-462F-A5B1-FEB84BD2D534}" EndProject -Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.AspNetCore.JsonPatch.Test", "test\Microsoft.AspNetCore.JsonPatch.Test\Microsoft.AspNetCore.JsonPatch.Test.xproj", "{81C20848-E063-4E12-AC40-0B55A532C16C}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.JsonPatch.Test", "test\Microsoft.AspNetCore.JsonPatch.Test\Microsoft.AspNetCore.JsonPatch.Test.csproj", "{81C20848-E063-4E12-AC40-0B55A532C16C}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{C430C499-382D-47BD-B351-CF8F89C08CD2}" + ProjectSection(SolutionItems) = preProject + NuGet.config = NuGet.config + EndProjectSection +EndProject + +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "build", "build", "{6DC6B416-C8C4-4BFA-8C1E-A55A6D7EFD08}" + ProjectSection(SolutionItems) = preProject + build\common.props = build\common.props + build\Key.snk = build\Key.snk + EndProjectSection EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution diff --git a/NuGet.config b/NuGet.config index 0fd623ffdd7..93f1ac47df9 100644 --- a/NuGet.config +++ b/NuGet.config @@ -2,6 +2,7 @@ + diff --git a/appveyor.yml b/appveyor.yml index be95b88d6f9..06545db9f67 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -10,4 +10,6 @@ build_script: - build.cmd --quiet verify clone_depth: 1 test: off -deploy: off \ No newline at end of file +deploy: off +# Required for dotnet-test to work +os: Visual Studio 2015 \ No newline at end of file diff --git a/build.ps1 b/build.ps1 index 8f2f99691a7..0605b59c01d 100644 --- a/build.ps1 +++ b/build.ps1 @@ -33,7 +33,7 @@ cd $PSScriptRoot $repoFolder = $PSScriptRoot $env:REPO_FOLDER = $repoFolder -$koreBuildZip="https://github.com/aspnet/KoreBuild/archive/dev.zip" +$koreBuildZip="https://github.com/aspnet/KoreBuild/archive/feature/msbuild.zip" if ($env:KOREBUILD_ZIP) { $koreBuildZip=$env:KOREBUILD_ZIP diff --git a/build.sh b/build.sh index 4fd7ede7881..07997d6c835 100755 --- a/build.sh +++ b/build.sh @@ -2,7 +2,7 @@ repoFolder="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" cd $repoFolder -koreBuildZip="https://github.com/aspnet/KoreBuild/archive/dev.zip" +koreBuildZip="https://github.com/aspnet/KoreBuild/archive/feature/msbuild.zip" if [ ! -z $KOREBUILD_ZIP ]; then koreBuildZip=$KOREBUILD_ZIP fi diff --git a/build/Key.snk b/build/Key.snk new file mode 100644 index 0000000000000000000000000000000000000000..e10e4889c125d3120cd9e81582243d70f7cbb806 GIT binary patch literal 596 zcmV-a0;~N80ssI2Bme+XQ$aES1ONa50098=Iw=HCsnz~#iVhm& zj%TU(_THUee?3yHBjk$37ysB?i5#7WD$={H zV4B!OxRPrb|8)HPg~A}8P>^=#y<)56#=E&NzcjOtPK~<4n6GHt=K$ro*T(lhby_@U zEk(hLzk1H)0yXj{A_5>fk-TgNoP|q6(tP2xo8zt8i%212CWM#AeCd?`hS|4~L({h~Moo(~vy&3Z z1uI}`fd^*>o=rwbAGymj6RM^pZm(*Kfhs+Y1#`-2JPWZMK8@;ZWCk2+9bX4YP);~fj-BU*R zQPvWv$89!{Rl9wM+zR>_TSkn^voYxA?2G iKnV#iZ6Ah`K>b=@=IjYJXrxL124zR(38)nxe+&q_$QXwJ literal 0 HcmV?d00001 diff --git a/build/common.props b/build/common.props new file mode 100644 index 00000000000..813c202b7fb --- /dev/null +++ b/build/common.props @@ -0,0 +1,25 @@ + + + + + + Microsoft ASP.NET Core + https://github.com/aspnet/JsonPatch + git + $(MSBuildThisFileDirectory)Key.snk + true + true + 1.2.0-* + 1.6.2-* + $(VersionSuffix)-$(BuildNumber) + + + + + + + + + + + \ No newline at end of file diff --git a/global.json b/global.json deleted file mode 100644 index a5c02fe221d..00000000000 --- a/global.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "projects": [ - "src", - "test/WebSites", - "samples" - ], - "sdk": { - "version": "1.0.0-preview2-1-003180" - } -} \ No newline at end of file diff --git a/src/Microsoft.AspNetCore.JsonPatch/Microsoft.AspNetCore.JsonPatch.csproj b/src/Microsoft.AspNetCore.JsonPatch/Microsoft.AspNetCore.JsonPatch.csproj new file mode 100644 index 00000000000..5bf2f0f74ed --- /dev/null +++ b/src/Microsoft.AspNetCore.JsonPatch/Microsoft.AspNetCore.JsonPatch.csproj @@ -0,0 +1,22 @@ + + + + + ASP.NET Core support for JSON PATCH. + net451;netstandard1.3 + $(NoWarn);CS1591 + true + aspnetcore;json;jsonpatch + + + + + + + + + + + + + diff --git a/src/Microsoft.AspNetCore.JsonPatch/Microsoft.AspNetCore.JsonPatch.xproj b/src/Microsoft.AspNetCore.JsonPatch/Microsoft.AspNetCore.JsonPatch.xproj deleted file mode 100644 index 0ebf789691c..00000000000 --- a/src/Microsoft.AspNetCore.JsonPatch/Microsoft.AspNetCore.JsonPatch.xproj +++ /dev/null @@ -1,17 +0,0 @@ - - - - 14.0 - $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) - - - - 4d55f4d8-633b-462f-a5b1-feb84bd2d534 - .\obj - .\bin\ - - - 2.0 - - - \ No newline at end of file diff --git a/src/Microsoft.AspNetCore.JsonPatch/Properties/AssemblyInfo.cs b/src/Microsoft.AspNetCore.JsonPatch/Properties/AssemblyInfo.cs deleted file mode 100644 index 76feceeff00..00000000000 --- a/src/Microsoft.AspNetCore.JsonPatch/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System.Reflection; -using System.Resources; - -[assembly: AssemblyMetadata("Serviceable", "True")] -[assembly: NeutralResourcesLanguage("en-us")] -[assembly: AssemblyCompany("Microsoft Corporation.")] -[assembly: AssemblyCopyright("© Microsoft Corporation. All rights reserved.")] -[assembly: AssemblyProduct("Microsoft ASP.NET Core")] diff --git a/src/Microsoft.AspNetCore.JsonPatch/project.json b/src/Microsoft.AspNetCore.JsonPatch/project.json deleted file mode 100644 index 7214cde411f..00000000000 --- a/src/Microsoft.AspNetCore.JsonPatch/project.json +++ /dev/null @@ -1,40 +0,0 @@ -{ - "version": "1.2.0-*", - "description": "ASP.NET Core support for JSON PATCH.", - "buildOptions": { - "warningsAsErrors": true, - "keyFile": "../../tools/Key.snk", - "nowarn": [ - "CS1591" - ], - "xmlDoc": true - }, - "packOptions": { - "repository": { - "type": "git", - "url": "git://github.com/aspnet/jsonpatch" - }, - "tags": [ - "aspnetcore", - "json", - "jsonpatch" - ] - }, - "dependencies": { - "NETStandard.Library": "1.6.2-*", - "Newtonsoft.Json": "9.0.1", - "Microsoft.Extensions.ClosedGenericMatcher.Sources": { - "type": "build", - "version": "1.2.0-*" - } - }, - "frameworks": { - "net451": {}, - "netstandard1.3": { - "dependencies": { - "Microsoft.CSharp": "4.4.0-*", - "System.Reflection.TypeExtensions": "4.4.0-*" - } - } - } -} \ No newline at end of file diff --git a/test/Microsoft.AspNetCore.JsonPatch.Test/Microsoft.AspNetCore.JsonPatch.Test.csproj b/test/Microsoft.AspNetCore.JsonPatch.Test/Microsoft.AspNetCore.JsonPatch.Test.csproj new file mode 100644 index 00000000000..6715989b4e9 --- /dev/null +++ b/test/Microsoft.AspNetCore.JsonPatch.Test/Microsoft.AspNetCore.JsonPatch.Test.csproj @@ -0,0 +1,25 @@ + + + + netcoreapp1.1;net451 + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/test/Microsoft.AspNetCore.JsonPatch.Test/Microsoft.AspNetCore.JsonPatch.Test.xproj b/test/Microsoft.AspNetCore.JsonPatch.Test/Microsoft.AspNetCore.JsonPatch.Test.xproj deleted file mode 100644 index c8942c121e2..00000000000 --- a/test/Microsoft.AspNetCore.JsonPatch.Test/Microsoft.AspNetCore.JsonPatch.Test.xproj +++ /dev/null @@ -1,20 +0,0 @@ - - - - 14.0 - $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) - - - - 81c20848-e063-4e12-ac40-0b55a532c16c - .\obj - .\bin\ - - - 2.0 - - - - - - \ No newline at end of file diff --git a/test/Microsoft.AspNetCore.JsonPatch.Test/ObjectVisitorTest.cs~RF1ad82e13.TMP b/test/Microsoft.AspNetCore.JsonPatch.Test/ObjectVisitorTest.cs~RF1ad82e13.TMP deleted file mode 100644 index 694c33c633d..00000000000 --- a/test/Microsoft.AspNetCore.JsonPatch.Test/ObjectVisitorTest.cs~RF1ad82e13.TMP +++ /dev/null @@ -1,119 +0,0 @@ -using System.Collections.Generic; -using Newtonsoft.Json.Serialization; -using Xunit; - -namespace Microsoft.AspNetCore.JsonPatch.Internal -{ - public class ObjectVisitorTest - { - private class Class1 - { - public IList States { get; set; } = new List(); - public IDictionary Countries = new Dictionary(); - } - - [Fact] - public void Visit_ValidPathToArray_ReturnsListAdapter() - { - // Arrange - var visitor = new ObjectVisitor(new ParsedPath("/States/-"), new DefaultContractResolver()); - var model = new Class1(); - object targetObject = model; - IAdapter adapter = null; - string message = null; - - // Act - var visitStatus = visitor.TryVisit(ref targetObject, out adapter, out message); - - // Assert - Assert.True(visitStatus); - Assert.True(string.IsNullOrEmpty(message), "Expected no error message"); - Assert.Same(model.States, targetObject); - Assert.IsType(adapter); - } - - [Fact] - public void Visit_ValidPathToDictionary_ReturnsDictionaryAdapter() - { - // Arrange - var visitor = new ObjectVisitor(new ParsedPath("/Countries/USA"), new DefaultContractResolver()); - var model = new Class1(); - object targetObject = model; - IAdapter adapter = null; - string message = null; - - // Act - var visitStatus = visitor.TryVisit(ref targetObject, out adapter, out message); - - // Assert - Assert.True(visitStatus); - Assert.True(string.IsNullOrEmpty(message), "Expected no error message"); - Assert.Same(model.Countries, targetObject); - Assert.IsType(adapter); - } - - private class AutomobileDepartment - { - public List Customers { get; set; } = new List(); - } - - [Fact] - public void Visit_ValidPathToArray_ReturnsListAdapter_ForDeepNestedPath() - { - // Arrange - var visitor = new ObjectVisitor(new ParsedPath("/Customers/0/States/-"), new DefaultContractResolver()); - var customer = new Class1(); - var automobileDepartment = new AutomobileDepartment(); - automobileDepartment.Customers.Add(customer); - object targetObject = automobileDepartment; - IAdapter adapter = null; - string message = null; - - // Act - var visitStatus = visitor.TryVisit(ref targetObject, out adapter, out message); - - // Assert - Assert.True(visitStatus); - Assert.True(string.IsNullOrEmpty(message), "Expected no error message"); - Assert.Same(customer.States, targetObject); - Assert.IsType(adapter); - } - - [Fact] - public void Visit_InvalidPathToArray_Fails() - { - // Arrange - var invalidIndex = 2; - var visitor = new ObjectVisitor(new ParsedPath($"/Customers/{invalidIndex}/States/-"), new DefaultContractResolver()); - var automobileDepartment = new AutomobileDepartment(); - object targetObject = automobileDepartment; - IAdapter adapter = null; - string message = null; - - // Act - var visitStatus = visitor.TryVisit(ref targetObject, out adapter, out message); - - // Assert - Assert.False(visitStatus); - Assert.Equal(string.Format(ErrorMessageFormats.IndexOutOfBounds, invalidIndex), message); - } - - [Fact] - public void Visit_DoesNotValidate_FinalPathSegment() - { - // Arrange - var visitor = new ObjectVisitor(new ParsedPath($"/NonExisting"), new DefaultContractResolver()); - var model = new Class1(); - object targetObject = model; - IAdapter adapter = null; - string message = null; - - // Act - var visitStatus = visitor.TryVisit(ref targetObject, out adapter, out message); - - // Assert - Assert.False(visitStatus); - Assert.Equal(string.Format(ErrorMessageFormats.TargetLocationAtPathSegmentNotFound, "NonExisting"), message); - } - } -} diff --git a/test/Microsoft.AspNetCore.JsonPatch.Test/ObjectVisitorTest.cs~RF1ae034c3.TMP b/test/Microsoft.AspNetCore.JsonPatch.Test/ObjectVisitorTest.cs~RF1ae034c3.TMP deleted file mode 100644 index 88139198ac4..00000000000 --- a/test/Microsoft.AspNetCore.JsonPatch.Test/ObjectVisitorTest.cs~RF1ae034c3.TMP +++ /dev/null @@ -1,131 +0,0 @@ -using System.Collections.Generic; -using Newtonsoft.Json.Serialization; -using Xunit; - -namespace Microsoft.AspNetCore.JsonPatch.Internal -{ - public class ObjectVisitorTest - { - private class Class1 - { - public IList States { get; set; } = new List(); - public IDictionary Countries = new Dictionary(); - } - - public static IEnumerable ReturnsListAdapterData - { - get - { - var model = new Class1(); - yield return new object[] { model, "/States/-", model.States }; - - yield return new object[] { model.States, "/-", model.States }; - } - } - - [Theory] - [MemberData(nameof(ReturnsListAdapterData))] - public void Visit_ValidPathToArray_ReturnsListAdapter(object targetObject, string path, object expectedTargetObject) - { - // Arrange - var visitor = new ObjectVisitor(new ParsedPath(path), new DefaultContractResolver()); - IAdapter adapter = null; - string message = null; - - // Act - var visitStatus = visitor.TryVisit(ref targetObject, out adapter, out message); - - // Assert - Assert.True(visitStatus); - Assert.True(string.IsNullOrEmpty(message), "Expected no error message"); - Assert.Same(expectedTargetObject, targetObject); - Assert.IsType(adapter); - } - - [Fact] - public void Visit_ValidPathToDictionary_ReturnsDictionaryAdapter() - { - // Arrange - var visitor = new ObjectVisitor(new ParsedPath("/Countries/USA"), new DefaultContractResolver()); - var model = new Class1(); - object targetObject = model; - IAdapter adapter = null; - string message = null; - - // Act - var visitStatus = visitor.TryVisit(ref targetObject, out adapter, out message); - - // Assert - Assert.True(visitStatus); - Assert.True(string.IsNullOrEmpty(message), "Expected no error message"); - Assert.Same(model.Countries, targetObject); - Assert.IsType(adapter); - } - - private class AutomobileDepartment - { - public List Customers { get; set; } = new List(); - } - - [Fact] - public void Visit_ValidPathToArray_ReturnsListAdapter_ForDeepNestedPath() - { - // Arrange - var visitor = new ObjectVisitor(new ParsedPath("/Customers/0/States/-"), new DefaultContractResolver()); - var customer = new Class1(); - var automobileDepartment = new AutomobileDepartment(); - automobileDepartment.Customers.Add(customer); - object targetObject = automobileDepartment; - IAdapter adapter = null; - string message = null; - - // Act - var visitStatus = visitor.TryVisit(ref targetObject, out adapter, out message); - - // Assert - Assert.True(visitStatus); - Assert.True(string.IsNullOrEmpty(message), "Expected no error message"); - Assert.Same(customer.States, targetObject); - Assert.IsType(adapter); - } - - [Fact] - public void Visit_InvalidPathToArray_Fails() - { - // Arrange - var invalidIndex = 2; - var visitor = new ObjectVisitor(new ParsedPath($"/Customers/{invalidIndex}/States/-"), new DefaultContractResolver()); - var automobileDepartment = new AutomobileDepartment(); - object targetObject = automobileDepartment; - IAdapter adapter = null; - string message = null; - - // Act - var visitStatus = visitor.TryVisit(ref targetObject, out adapter, out message); - - // Assert - Assert.False(visitStatus); - Assert.Equal(string.Format(ErrorMessageFormats.IndexOutOfBounds, invalidIndex), message); - } - - // The adapter takes care of the responsibility of validating the final segment - [Fact] - public void Visit_DoesNotValidate_FinalPathSegment() - { - // Arrange - var visitor = new ObjectVisitor(new ParsedPath($"/NonExisting"), new DefaultContractResolver()); - var model = new Class1(); - object targetObject = model; - IAdapter adapter = null; - string message = null; - - // Act - var visitStatus = visitor.TryVisit(ref targetObject, out adapter, out message); - - // Assert - Assert.True(visitStatus); - Assert.True(string.IsNullOrEmpty(message), "Expected no error message"); - Assert.IsType(adapter); - } - } -} diff --git a/test/Microsoft.AspNetCore.JsonPatch.Test/project.json b/test/Microsoft.AspNetCore.JsonPatch.Test/project.json deleted file mode 100644 index 4790217eba4..00000000000 --- a/test/Microsoft.AspNetCore.JsonPatch.Test/project.json +++ /dev/null @@ -1,31 +0,0 @@ -{ - "buildOptions": { - "warningsAsErrors": true - }, - "dependencies": { - "dotnet-test-xunit": "2.2.0-*", - "Microsoft.AspNetCore.JsonPatch": "1.2.0-*", - "Microsoft.AspNetCore.Testing": "1.2.0-*", - "Moq": "4.6.36-*", - "xunit": "2.2.0-*" - }, - "testRunner": "xunit", - "frameworks": { - "netcoreapp1.1": { - "dependencies": { - "Microsoft.NETCore.App": { - "version": "1.2.0-*", - "type": "platform" - }, - "System.Diagnostics.TraceSource": "4.4.0-*" - } - }, - "net451": { - "frameworkAssemblies": { - "System.Linq.Expressions": { - "type": "build" - } - } - } - } -} \ No newline at end of file diff --git a/version.props b/version.props new file mode 100644 index 00000000000..e77c8d9c384 --- /dev/null +++ b/version.props @@ -0,0 +1,7 @@ + + + + 1.2.0 + preview1 + + \ No newline at end of file