From 6263a318571b9f9b5d23e1a4e0731883a244a378 Mon Sep 17 00:00:00 2001 From: Ross Donaldson Date: Sun, 24 Jan 2021 10:00:35 -0800 Subject: [PATCH] Remove requirement for mono for non Windows platforms (#97) --- .github/workflows/dotnetcore.yml | 2 +- Directory.Build.props | 57 +++++++------------ appveyor.yml | 4 +- docsrc/content/codec.fsx | 20 +++---- docsrc/content/combinators.fsx | 10 ++-- docsrc/content/comparison-with-json-net.fsx | 12 ++-- docsrc/content/giraffe.fsx | 8 +-- docsrc/content/suave.fsx | 10 ++-- docsrc/content/to-json-and-of-json.fsx | 26 ++++----- global.json | 10 ++-- .../Fleece.FSharpData.fsproj | 34 +++++------ .../Fleece.NewtonsoftJson.fsproj | 34 +++++------ .../Fleece.SystemJson.fsproj | 32 +++++------ .../Fleece.SystemTextJson.fsproj | 35 ++++++------ .../IntegrationCompilationTests.fsproj | 27 ++++----- test/Tests.FSharpData/Tests.FSharpData.fsproj | 38 ++++++------- .../Tests.NewtonsoftJson.fsproj | 38 ++++++------- test/Tests.SystemJson/Tests.SystemJson.fsproj | 36 ++++++------ .../Tests.SystemTextJson.fsproj | 36 ++++++------ 19 files changed, 228 insertions(+), 241 deletions(-) diff --git a/.github/workflows/dotnetcore.yml b/.github/workflows/dotnetcore.yml index 2248268c..7c91e7c5 100644 --- a/.github/workflows/dotnetcore.yml +++ b/.github/workflows/dotnetcore.yml @@ -16,7 +16,7 @@ jobs: - name: Setup .NET Core uses: actions/setup-dotnet@v1 with: - dotnet-version: 3.1.101 + dotnet-version: 3.1.405 - name: Install dependencies run: dotnet restore - name: Build diff --git a/Directory.Build.props b/Directory.Build.props index cc38a552..fc666dce 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -1,42 +1,27 @@ - - https://github.com/fsprojects/Fleece - https://github.com/fsprojects/Fleece - Mauricio Scheffer,Lev Gorodinski,Oskar Gewalli, Gustavo P. Leon - Apache-2.0 - json fsharp + + https://github.com/fsprojects/Fleece + https://github.com/fsprojects/Fleece + Mauricio Scheffer,Lev Gorodinski,Oskar Gewalli, Gustavo P. Leon + Apache-2.0 + json fsharp - 3 + 3 - 0.8.0 - - $(VersionPrefix)-$(VersionSuffix) - $(VersionPrefix) - $(VersionPrefix).0 - $(VersionPrefix).0 - + 0.8.0 + + $(VersionPrefix)-$(VersionSuffix) + $(VersionPrefix) + $(VersionPrefix).0 + $(VersionPrefix).0 + + + + + runtime; build; native; contentfiles; analyzers + all + + - - - /usr - /Library/Frameworks/Mono.framework/Versions/Current - $(MonoRoot)/lib/mono - true - $(MonoLibFolder)/4.5-api - $(MonoLibFolder)/4.5.1-api - $(MonoLibFolder)/4.5.2-api - $(MonoLibFolder)/4.6-api - $(MonoLibFolder)/4.6.1-api - $(MonoLibFolder)/4.6.2-api - $(MonoLibFolder)/4.7-api - $(MonoLibFolder)/4.7.1-api - $(MonoLibFolder)/4.7.2-api - - - - runtime; build; native; contentfiles; analyzers - all - - diff --git a/appveyor.yml b/appveyor.yml index 66fdedba..fea820cf 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -15,8 +15,8 @@ build_script: - cmd: build.bat test_script: - cmd: dotnet run -p .\test\Tests.SystemJson\Tests.SystemJson.fsproj -c Release -f net461 - - cmd: dotnet run -p .\test\Tests.FSharpData\Tests.FSharpData.fsproj -c Release -f net461 - - cmd: dotnet run -p .\test\Tests.NewtonsoftJson\Tests.NewtonsoftJson.fsproj -c Release -f net461 + - cmd: dotnet run -p .\test\Tests.FSharpData\Tests.FSharpData.fsproj -c Release -f netcoreapp3.1 + - cmd: dotnet run -p .\test\Tests.NewtonsoftJson\Tests.NewtonsoftJson.fsproj -c Release -f netcoreapp3.1 - cmd: dotnet run -p .\test\Tests.SystemTextJson\Tests.SystemTextJson.fsproj -c Release -f netcoreapp3.1 artifacts: diff --git a/docsrc/content/codec.fsx b/docsrc/content/codec.fsx index 7e28ae8b..358b110a 100644 --- a/docsrc/content/codec.fsx +++ b/docsrc/content/codec.fsx @@ -1,9 +1,9 @@ (*** hide ***) -// This block of code is omitted in the generated HTML documentation. Use +// This block of code is omitted in the generated HTML documentation. Use // it to define helpers that you do not want to show in the documentation. -#r @"../../src/Fleece.SystemJson/bin/Release/net461/System.Json.dll" -#r @"../../src/Fleece.SystemJson/bin/Release/net461/Fleece.SystemJson.dll" -#r @"../../src/Fleece.SystemJson/bin/Release/net461/FSharpPlus.dll" +#r @"../../src/Fleece.SystemJson/bin/Release/netstandard2.1/System.Json.dll" +#r @"../../src/Fleece.SystemJson/bin/Release/netstandard2.1/Fleece.SystemJson.dll" +#r @"../../src/Fleece.SystemJson/bin/Release/netstandard2.1/FSharpPlus.dll" open System.Json open Fleece.SystemJson @@ -12,14 +12,14 @@ open Fleece.SystemJson.Operators (** ## CODEC -For types that deserialize to Json Objets, typically (but not limited to) records, you can alternatively use codecs and have a single method which maps between fields and values. +For types that deserialize to Json Objets, typically (but not limited to) records, you can alternatively use codecs and have a single method which maps between fields and values. *) -type Person = { +type Person = { name : string * string age : int option - children: Person list } + children: Person list } with static member JsonObjCodec = fun f l a c -> { name = (f, l); age = a; children = c } @@ -47,7 +47,7 @@ let john = parseJson """{ If you prefer you can write the same with functions: *) -type PersonF = { +type PersonF = { name : string * string age : int option children: PersonF list } @@ -68,7 +68,7 @@ type Shape = | Rectangle of width : float * length : float | Circle of radius : float | Prism of width : float * float * height : float - with + with static member JsonObjCodec = Rectangle jreq "rectangle" (function Rectangle (x, y) -> Some (x, y) | _ -> None) <|> ( Circle jreq "radius" (function Circle x -> Some x | _ -> None) ) @@ -81,7 +81,7 @@ type ShapeC = | Rectangle of width : float * length : float | Circle of radius : float | Prism of width : float * float * height : float - with + with static member JsonObjCodec = jchoice [ diff --git a/docsrc/content/combinators.fsx b/docsrc/content/combinators.fsx index 7dc6393f..c37521f3 100644 --- a/docsrc/content/combinators.fsx +++ b/docsrc/content/combinators.fsx @@ -1,9 +1,9 @@ (*** hide ***) -// This block of code is omitted in the generated HTML documentation. Use +// This block of code is omitted in the generated HTML documentation. Use // it to define helpers that you do not want to show in the documentation. -#r @"../../src/Fleece.SystemJson/bin/Release/net461/System.Json.dll" -#r @"../../src/Fleece.SystemJson/bin/Release/net461/Fleece.SystemJson.dll" -#r @"../../src/Fleece.SystemJson/bin/Release/net461/FSharpPlus.dll" +#r @"../../src/Fleece.SystemJson/bin/Release/netstandard2.1/System.Json.dll" +#r @"../../src/Fleece.SystemJson/bin/Release/netstandard2.1/Fleece.SystemJson.dll" +#r @"../../src/Fleece.SystemJson/bin/Release/netstandard2.1/FSharpPlus.dll" open System.Json open Fleece.SystemJson @@ -41,7 +41,7 @@ let colorEncoder = function | White -> JString "white" let colorCodec = colorDecoder, colorEncoder - + let []carCodec<'t> = fun i c k -> { Id = i; Color = c; Kms = k } |> withFields diff --git a/docsrc/content/comparison-with-json-net.fsx b/docsrc/content/comparison-with-json-net.fsx index aa1c58ba..f304b820 100644 --- a/docsrc/content/comparison-with-json-net.fsx +++ b/docsrc/content/comparison-with-json-net.fsx @@ -1,9 +1,9 @@ (*** hide ***) -// This block of code is omitted in the generated HTML documentation. Use +// This block of code is omitted in the generated HTML documentation. Use // it to define helpers that you do not want to show in the documentation. -#r @"../../src/Fleece.NewtonsoftJson/bin/Release/net461/Newtonsoft.Json.dll" -#r @"../../src/Fleece.NewtonsoftJson/bin/Release/net461/Fleece.NewtonsoftJson.dll" -#r @"../../src/Fleece.NewtonsoftJson/bin/Release/net461/FSharpPlus.dll" +#r @"../../src/Fleece.NewtonsoftJson/bin/Release/netstandard2.1/Newtonsoft.Json.dll" +#r @"../../src/Fleece.NewtonsoftJson/bin/Release/netstandard2.1/Fleece.NewtonsoftJson.dll" +#r @"../../src/Fleece.NewtonsoftJson/bin/Release/netstandard2.1/FSharpPlus.dll" open System open Newtonsoft.Json @@ -86,12 +86,12 @@ It's easy to let the structure of your Json be completely independent of the str If we look at a simple example of the Json not matching the representation (where you would need a custom JsonConverter): *) -type Person = { +type Person = { Name : string * string } with static member ToJson (x: Person) = - jobj [ + jobj [ "firstname" .= fst x.Name "lastname" .= snd x.Name ] diff --git a/docsrc/content/giraffe.fsx b/docsrc/content/giraffe.fsx index aa9a5e4f..301b8cc7 100644 --- a/docsrc/content/giraffe.fsx +++ b/docsrc/content/giraffe.fsx @@ -1,9 +1,9 @@ (*** hide ***) -// This block of code is omitted in the generated HTML documentation. Use +// This block of code is omitted in the generated HTML documentation. Use // it to define helpers that you do not want to show in the documentation. -#r @"../../src/Fleece.SystemJson/bin/Release/net461/System.Json.dll" -#r @"../../src/Fleece.SystemJson/bin/Release/net461/Fleece.SystemJson.dll" -#r @"../../src/Fleece.SystemJson/bin/Release/net461/FSharpPlus.dll" +#r @"../../src/Fleece.SystemJson/bin/Release/netstandard2.1/System.Json.dll" +#r @"../../src/Fleece.SystemJson/bin/Release/netstandard2.1/Fleece.SystemJson.dll" +#r @"../../src/Fleece.SystemJson/bin/Release/netstandard2.1/FSharpPlus.dll" #r @"../../packages/docs/TaskBuilder.fs/lib/net46/TaskBuilder.fs.dll" module Giraffe= diff --git a/docsrc/content/suave.fsx b/docsrc/content/suave.fsx index 367c436f..55b22c63 100644 --- a/docsrc/content/suave.fsx +++ b/docsrc/content/suave.fsx @@ -1,10 +1,10 @@ (*** hide ***) -// This block of code is omitted in the generated HTML documentation. Use +// This block of code is omitted in the generated HTML documentation. Use // it to define helpers that you do not want to show in the documentation. -#r @"../../src/Fleece.SystemJson/bin/Release/net461/System.Json.dll" -#r @"../../src/Fleece.SystemJson/bin/Release/net461/Fleece.SystemJson.dll" -#r @"../../src/Fleece.SystemJson/bin/Release/net461/FSharpPlus.dll" -#r @"../../packages/docs/Suave/lib/net461/Suave.dll" +#r @"../../src/Fleece.SystemJson/bin/Release/netstandard2.1/System.Json.dll" +#r @"../../src/Fleece.SystemJson/bin/Release/netstandard2.1/Fleece.SystemJson.dll" +#r @"../../src/Fleece.SystemJson/bin/Release/netstandard2.1/FSharpPlus.dll" +#r @"../../packages/docs/Suave/lib/netstandard2.1/Suave.dll" (** diff --git a/docsrc/content/to-json-and-of-json.fsx b/docsrc/content/to-json-and-of-json.fsx index d14f7b98..92e69b2f 100644 --- a/docsrc/content/to-json-and-of-json.fsx +++ b/docsrc/content/to-json-and-of-json.fsx @@ -1,17 +1,17 @@ (*** hide ***) -// This block of code is omitted in the generated HTML documentation. Use +// This block of code is omitted in the generated HTML documentation. Use // it to define helpers that you do not want to show in the documentation. -#r @"../../src/Fleece.SystemJson/bin/Release/net461/System.Json.dll" -#r @"../../src/Fleece.SystemJson/bin/Release/net461/Fleece.SystemJson.dll" -#r @"../../src/Fleece.SystemJson/bin/Release/net461/FSharpPlus.dll" +#r @"../../src/Fleece.SystemJson/bin/Release/netstandard2.1/System.Json.dll" +#r @"../../src/Fleece.SystemJson/bin/Release/netstandard2.1/Fleece.SystemJson.dll" +#r @"../../src/Fleece.SystemJson/bin/Release/netstandard2.1/FSharpPlus.dll" open System.Json open Fleece.SystemJson open Fleece.SystemJson.Operators #if FSHARPDATA -#r @"../../src/Fleece.FSharpData/bin/Release/net461/FSharp.Data.dll" -#r @"../../src/Fleece.FSharpData/bin/Release/net461/Fleece.FSharpData.dll" -#r @"../../src/Fleece.FSharpData/bin/Release/net461/FSharpPlus.dll" +#r @"../../src/Fleece.FSharpData/bin/Release/netstandard2.1/FSharp.Data.dll" +#r @"../../src/Fleece.FSharpData/bin/Release/netstandard2.1/Fleece.FSharpData.dll" +#r @"../../src/Fleece.FSharpData/bin/Release/netstandard2.1/FSharpPlus.dll" open FSharp.Data open Fleece.FSharpData @@ -39,16 +39,16 @@ You can map it to JSON like this: type Person with static member ToJson (x: Person) = - jobj [ + jobj [ "name" .= x.Name "age" .= x.Age "children" .= x.Children ] -let p = +let p = { Person.Name = "John" Age = 44 - Children = + Children = [ { Person.Name = "Katy" Age = 5 @@ -80,7 +80,7 @@ type Person with } | x -> Error <| Uncategorized (sprintf "Error parsing person: %A" x) | x -> Decode.Fail.objExpected x - + let john : Person ParseResult = parseJson """{ "name": "John", "age": 44, @@ -129,7 +129,7 @@ type PersonM = { type PersonM with static member OfJson json = match json with - | JObject o -> + | JObject o -> monad { let! name = o .@ "name" let! age = o .@ "age" @@ -146,4 +146,4 @@ type PersonM with Or you can use the Choice monad/applicative in [FSharpx.Extras](https://github.com/fsprojects/FSharpx.Extras) instead, if you prefer. You can see more examples in the [EdmundsNet](https://github.com/mausch/EdmundsNet) project. -*) \ No newline at end of file +*) diff --git a/global.json b/global.json index 6096762d..0eebbb98 100644 --- a/global.json +++ b/global.json @@ -1,6 +1,6 @@ { - "sdk": { - "version": "3.0.103", - "rollForward": "latestMinor" - } -} \ No newline at end of file + "sdk": { + "version": "3.1.405", + "rollForward": "latestMinor" + } +} diff --git a/src/Fleece.FSharpData/Fleece.FSharpData.fsproj b/src/Fleece.FSharpData/Fleece.FSharpData.fsproj index baa239b8..589cabe0 100644 --- a/src/Fleece.FSharpData/Fleece.FSharpData.fsproj +++ b/src/Fleece.FSharpData/Fleece.FSharpData.fsproj @@ -1,19 +1,19 @@  - - netstandard2.0;net461 - 0686 - true - JSON mapper for FSharp.Data - FSHARPDATA;$(DefineConstants) - --warnon:1182 - - - - - - - - - - \ No newline at end of file + + netstandard2.0;netstandard2.1 + 0686 + true + JSON mapper for FSharp.Data + FSHARPDATA;$(DefineConstants) + --warnon:1182 + + + + + + + + + + diff --git a/src/Fleece.NewtonsoftJson/Fleece.NewtonsoftJson.fsproj b/src/Fleece.NewtonsoftJson/Fleece.NewtonsoftJson.fsproj index c0a130a2..efa70cd5 100644 --- a/src/Fleece.NewtonsoftJson/Fleece.NewtonsoftJson.fsproj +++ b/src/Fleece.NewtonsoftJson/Fleece.NewtonsoftJson.fsproj @@ -1,19 +1,19 @@  - - netstandard2.0;net461 - 0686 - true - JSON mapper for Newtonsoft Json - NEWTONSOFT;$(DefineConstants) - --warnon:1182 - - - - - - - - - - \ No newline at end of file + + netstandard2.0;netstandard2.1 + 0686 + true + JSON mapper for Newtonsoft Json + NEWTONSOFT;$(DefineConstants) + --warnon:1182 + + + + + + + + + + diff --git a/src/Fleece.SystemJson/Fleece.SystemJson.fsproj b/src/Fleece.SystemJson/Fleece.SystemJson.fsproj index 021dd00b..755a8d5e 100644 --- a/src/Fleece.SystemJson/Fleece.SystemJson.fsproj +++ b/src/Fleece.SystemJson/Fleece.SystemJson.fsproj @@ -1,19 +1,19 @@  - - net461;netstandard2.0 - 0686 - true - JSON mapper for System.Json - SYSTEMJSON;$(DefineConstants) - --warnon:1182 - - - - - - - - - + + netstandard2.0;netstandard2.1;net461 + 0686 + true + JSON mapper for System.Json + SYSTEMJSON;$(DefineConstants) + --warnon:1182 + + + + + + + + + diff --git a/src/Fleece.SystemTextJson/Fleece.SystemTextJson.fsproj b/src/Fleece.SystemTextJson/Fleece.SystemTextJson.fsproj index 7c21d5f6..4df0f669 100644 --- a/src/Fleece.SystemTextJson/Fleece.SystemTextJson.fsproj +++ b/src/Fleece.SystemTextJson/Fleece.SystemTextJson.fsproj @@ -1,18 +1,19 @@ - - - net461;netstandard2.0 - 0686 - true - JSON mapper for System.Text.Json - SYSTEMTEXTJSON;$(DefineConstants) - --warnon:1182 - - - - - - - - - + + + + netstandard2.0;netstandard2.1 + 0686 + true + JSON mapper for System.Text.Json + SYSTEMTEXTJSON;$(DefineConstants) + --warnon:1182 + + + + + + + + + diff --git a/test/IntegrationCompilationTests/IntegrationCompilationTests.fsproj b/test/IntegrationCompilationTests/IntegrationCompilationTests.fsproj index 682d41a7..08ba99d3 100644 --- a/test/IntegrationCompilationTests/IntegrationCompilationTests.fsproj +++ b/test/IntegrationCompilationTests/IntegrationCompilationTests.fsproj @@ -1,18 +1,19 @@ - + + - - net461 - + + netcoreapp3.1 + - - - + + + - - - - - - + + + + + + diff --git a/test/Tests.FSharpData/Tests.FSharpData.fsproj b/test/Tests.FSharpData/Tests.FSharpData.fsproj index 5d1bd390..b73dbca9 100644 --- a/test/Tests.FSharpData/Tests.FSharpData.fsproj +++ b/test/Tests.FSharpData/Tests.FSharpData.fsproj @@ -1,22 +1,22 @@ - - Exe - netcoreapp3.1;net461 - FSHARPDATA;$(DefineConstants) - - - - - - - - - - - - - - - + + Exe + netcoreapp3.1 + FSHARPDATA;$(DefineConstants) + + + + + + + + + + + + + + + diff --git a/test/Tests.NewtonsoftJson/Tests.NewtonsoftJson.fsproj b/test/Tests.NewtonsoftJson/Tests.NewtonsoftJson.fsproj index 78a583a2..26ab96b1 100644 --- a/test/Tests.NewtonsoftJson/Tests.NewtonsoftJson.fsproj +++ b/test/Tests.NewtonsoftJson/Tests.NewtonsoftJson.fsproj @@ -1,22 +1,22 @@ - - Exe - netcoreapp3.1;net461 - NEWTONSOFT;$(DefineConstants) - true - - - - - - - - - - - - - - + + Exe + netcoreapp3.1 + NEWTONSOFT;$(DefineConstants) + true + + + + + + + + + + + + + + diff --git a/test/Tests.SystemJson/Tests.SystemJson.fsproj b/test/Tests.SystemJson/Tests.SystemJson.fsproj index 8c277452..469c5cd5 100644 --- a/test/Tests.SystemJson/Tests.SystemJson.fsproj +++ b/test/Tests.SystemJson/Tests.SystemJson.fsproj @@ -1,21 +1,21 @@  - - Exe - net461;netcoreapp3.1 - SYSTEMJSON;$(DefineConstants) - - - - - - - - - - - - - - + + Exe + netcoreapp3.1;net461 + SYSTEMJSON;$(DefineConstants) + + + + + + + + + + + + + + diff --git a/test/Tests.SystemTextJson/Tests.SystemTextJson.fsproj b/test/Tests.SystemTextJson/Tests.SystemTextJson.fsproj index 570516f4..f069c4d8 100644 --- a/test/Tests.SystemTextJson/Tests.SystemTextJson.fsproj +++ b/test/Tests.SystemTextJson/Tests.SystemTextJson.fsproj @@ -1,21 +1,21 @@  - - Exe - net461;netcoreapp3.1 - SYSTEMTEXTJSON;$(DefineConstants) - - - - - - - - - - - - - - + + Exe + netcoreapp3.1 + SYSTEMTEXTJSON;$(DefineConstants) + + + + + + + + + + + + + +