Skip to content

Commit

Permalink
Remove requirement for mono for non Windows platforms (#97)
Browse files Browse the repository at this point in the history
  • Loading branch information
Gastove committed Jan 24, 2021
1 parent 8de4a78 commit 6263a31
Show file tree
Hide file tree
Showing 19 changed files with 228 additions and 241 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/dotnetcore.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
57 changes: 21 additions & 36 deletions Directory.Build.props
Original file line number Diff line number Diff line change
@@ -1,42 +1,27 @@
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<RepositoryUrl>https://github.com/fsprojects/Fleece</RepositoryUrl>
<PackageProjectUrl>https://github.com/fsprojects/Fleece</PackageProjectUrl>
<Authors>Mauricio Scheffer,Lev Gorodinski,Oskar Gewalli, Gustavo P. Leon</Authors>
<PackageLicenseExpression>Apache-2.0</PackageLicenseExpression>
<PackageTags>json fsharp</PackageTags>
<PropertyGroup>
<RepositoryUrl>https://github.com/fsprojects/Fleece</RepositoryUrl>
<PackageProjectUrl>https://github.com/fsprojects/Fleece</PackageProjectUrl>
<Authors>Mauricio Scheffer,Lev Gorodinski,Oskar Gewalli, Gustavo P. Leon</Authors>
<PackageLicenseExpression>Apache-2.0</PackageLicenseExpression>
<PackageTags>json fsharp</PackageTags>

<WarningLevel>3</WarningLevel>
<WarningLevel>3</WarningLevel>

<VersionPrefix>0.8.0</VersionPrefix>
<VersionSuffix></VersionSuffix>
<Version Condition=" '$(VersionSuffix)' != '' ">$(VersionPrefix)-$(VersionSuffix)</Version>
<Version Condition=" '$(VersionSuffix)' == '' ">$(VersionPrefix)</Version>
<AssemblyVersion>$(VersionPrefix).0</AssemblyVersion>
<FileVersion>$(VersionPrefix).0</FileVersion>
</PropertyGroup>
<VersionPrefix>0.8.0</VersionPrefix>
<VersionSuffix></VersionSuffix>
<Version Condition=" '$(VersionSuffix)' != '' ">$(VersionPrefix)-$(VersionSuffix)</Version>
<Version Condition=" '$(VersionSuffix)' == '' ">$(VersionPrefix)</Version>
<AssemblyVersion>$(VersionPrefix).0</AssemblyVersion>
<FileVersion>$(VersionPrefix).0</FileVersion>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies" Version="1.0.0">
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
</ItemGroup>

<!-- mono -->
<PropertyGroup Condition="'$(OS)' == 'Unix'">
<MonoRoot Condition="'$(MonoRoot)' == '' and $([MSBuild]::IsOsPlatform('Linux'))">/usr</MonoRoot>
<MonoRoot Condition="'$(MonoRoot)' == '' and $([MSBuild]::IsOsPlatform('OSX'))">/Library/Frameworks/Mono.framework/Versions/Current</MonoRoot>
<MonoLibFolder>$(MonoRoot)/lib/mono</MonoLibFolder>
<MonoPackaging Condition="$(TargetFramework.StartsWith('net4'))">true</MonoPackaging>
<FrameworkPathOverride Condition="'$(TargetFramework)' == 'net45'">$(MonoLibFolder)/4.5-api</FrameworkPathOverride>
<FrameworkPathOverride Condition="'$(TargetFramework)' == 'net451'">$(MonoLibFolder)/4.5.1-api</FrameworkPathOverride>
<FrameworkPathOverride Condition="'$(TargetFramework)' == 'net452'">$(MonoLibFolder)/4.5.2-api</FrameworkPathOverride>
<FrameworkPathOverride Condition="'$(TargetFramework)' == 'net46'">$(MonoLibFolder)/4.6-api</FrameworkPathOverride>
<FrameworkPathOverride Condition="'$(TargetFramework)' == 'net461'">$(MonoLibFolder)/4.6.1-api</FrameworkPathOverride>
<FrameworkPathOverride Condition="'$(TargetFramework)' == 'net462'">$(MonoLibFolder)/4.6.2-api</FrameworkPathOverride>
<FrameworkPathOverride Condition="'$(TargetFramework)' == 'net47'">$(MonoLibFolder)/4.7-api</FrameworkPathOverride>
<FrameworkPathOverride Condition="'$(TargetFramework)' == 'net471'">$(MonoLibFolder)/4.7.1-api</FrameworkPathOverride>
<FrameworkPathOverride Condition="'$(TargetFramework)' == 'net472'">$(MonoLibFolder)/4.7.2-api</FrameworkPathOverride>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies" Version="1.0.0">
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
</ItemGroup>
</Project>
4 changes: 2 additions & 2 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
20 changes: 10 additions & 10 deletions docsrc/content/codec.fsx
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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 }
Expand Down Expand Up @@ -47,7 +47,7 @@ let john = parseJson<Person> """{
If you prefer you can write the same with functions:
*)

type PersonF = {
type PersonF = {
name : string * string
age : int option
children: PersonF list }
Expand All @@ -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) )
Expand All @@ -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
[
Expand Down
10 changes: 5 additions & 5 deletions docsrc/content/combinators.fsx
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -41,7 +41,7 @@ let colorEncoder = function
| White -> JString "white"

let colorCodec = colorDecoder, colorEncoder

let [<GeneralizableValue>]carCodec<'t> =
fun i c k -> { Id = i; Color = c; Kms = k }
|> withFields
Expand Down
12 changes: 6 additions & 6 deletions docsrc/content/comparison-with-json-net.fsx
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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
]
Expand Down
8 changes: 4 additions & 4 deletions docsrc/content/giraffe.fsx
Original file line number Diff line number Diff line change
@@ -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=
Expand Down
10 changes: 5 additions & 5 deletions docsrc/content/suave.fsx
Original file line number Diff line number Diff line change
@@ -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"


(**
Expand Down
26 changes: 13 additions & 13 deletions docsrc/content/to-json-and-of-json.fsx
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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"
Expand All @@ -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.
*)
*)
10 changes: 5 additions & 5 deletions global.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"sdk": {
"version": "3.0.103",
"rollForward": "latestMinor"
}
}
"sdk": {
"version": "3.1.405",
"rollForward": "latestMinor"
}
}
34 changes: 17 additions & 17 deletions src/Fleece.FSharpData/Fleece.FSharpData.fsproj
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>netstandard2.0;net461</TargetFrameworks>
<NoWarn>0686</NoWarn>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<Description>JSON mapper for FSharp.Data</Description>
<DefineConstants>FSHARPDATA;$(DefineConstants)</DefineConstants>
<OtherFlags>--warnon:1182</OtherFlags>
</PropertyGroup>
<ItemGroup>
<Compile Include="../Fleece/Fleece.fs" />
</ItemGroup>
<ItemGroup>
<PackageReference Update="FSharp.Core" Version="4.6.2" />
<PackageReference Include="FSharpPlus" Version="1.1.1" />
<PackageReference Include="FSharp.Data" Version="3.0.0" />
</ItemGroup>
</Project>
<PropertyGroup>
<TargetFrameworks>netstandard2.0;netstandard2.1</TargetFrameworks>
<NoWarn>0686</NoWarn>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<Description>JSON mapper for FSharp.Data</Description>
<DefineConstants>FSHARPDATA;$(DefineConstants)</DefineConstants>
<OtherFlags>--warnon:1182</OtherFlags>
</PropertyGroup>
<ItemGroup>
<Compile Include="../Fleece/Fleece.fs" />
</ItemGroup>
<ItemGroup>
<PackageReference Update="FSharp.Core" Version="4.6.2" />
<PackageReference Include="FSharpPlus" Version="1.1.1" />
<PackageReference Include="FSharp.Data" Version="3.0.0" />
</ItemGroup>
</Project>
34 changes: 17 additions & 17 deletions src/Fleece.NewtonsoftJson/Fleece.NewtonsoftJson.fsproj
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>netstandard2.0;net461</TargetFrameworks>
<NoWarn>0686</NoWarn>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<Description>JSON mapper for Newtonsoft Json</Description>
<DefineConstants>NEWTONSOFT;$(DefineConstants)</DefineConstants>
<OtherFlags>--warnon:1182</OtherFlags>
</PropertyGroup>
<ItemGroup>
<Compile Include="../Fleece/Fleece.fs" />
</ItemGroup>
<ItemGroup>
<PackageReference Update="FSharp.Core" Version="4.6.2" />
<PackageReference Include="FSharpPlus" Version="1.1.1" />
<PackageReference Include="Newtonsoft.Json" Version="10.0.2" />
</ItemGroup>
</Project>
<PropertyGroup>
<TargetFrameworks>netstandard2.0;netstandard2.1</TargetFrameworks>
<NoWarn>0686</NoWarn>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<Description>JSON mapper for Newtonsoft Json</Description>
<DefineConstants>NEWTONSOFT;$(DefineConstants)</DefineConstants>
<OtherFlags>--warnon:1182</OtherFlags>
</PropertyGroup>
<ItemGroup>
<Compile Include="../Fleece/Fleece.fs" />
</ItemGroup>
<ItemGroup>
<PackageReference Update="FSharp.Core" Version="4.6.2" />
<PackageReference Include="FSharpPlus" Version="1.1.1" />
<PackageReference Include="Newtonsoft.Json" Version="10.0.2" />
</ItemGroup>
</Project>
Loading

0 comments on commit 6263a31

Please sign in to comment.