Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrated to FSharp.TypeProviders.SDK NuGet package from referenced files #229

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 3 additions & 5 deletions paket.dependencies
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
version 7.2.1
storage: none
source https://api.nuget.org/v3/index.json
frameworks: net6.0, netstandard2.0

nuget FSharp.Core ~> 6 // We need task{} CE from F# 6.0
nuget System.Text.Json ~> 6
nuget FSharp.SystemTextJson
nuget FSharp.TypeProviders.SDK >= 8
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. It is already a recommended way to use SDK? Dependencies always were a pain to TPs
  2. What is your motivation for this change?

nuget System.Text.Json ~> 6
nuget Microsoft.OpenApi.Readers
nuget NETStandard.Library.NETFramework

Expand All @@ -14,10 +16,6 @@ nuget Microsoft.Bcl.AsyncInterfaces ~> 6
# delete when we drop custom parser for v2
nuget YamlDotNet

# THis lines are used by Paket to get the latest version of the Type Provider SDK files
github fsprojects/FSharp.TypeProviders.SDK src/ProvidedTypes.fsi
github fsprojects/FSharp.TypeProviders.SDK src/ProvidedTypes.fs

github fsprojects/FSharp.Data:main src/FSharp.Data.Runtime.Utilities/Pluralizer.fs
github fsprojects/FSharp.Data:main src/FSharp.Data.Runtime.Utilities/NameUtils.fs

Expand Down
20 changes: 10 additions & 10 deletions paket.lock
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
STORAGE: NONE
RESTRICTION: || (== net6.0) (== netstandard2.0)
NUGET
remote: https://api.nuget.org/v3/index.json
FSharp.Core (6.0.7)
FSharp.SystemTextJson (1.1.23)
FSharp.SystemTextJson (1.2.42)
FSharp.Core (>= 4.7)
System.Text.Json (>= 6.0)
FSharp.TypeProviders.SDK (8.0.2)
FSharp.Core (>= 4.7.2)
Microsoft.Bcl.AsyncInterfaces (6.0)
System.Threading.Tasks.Extensions (>= 4.5.4) - restriction: || (&& (== net6.0) (>= net461)) (&& (== net6.0) (< netstandard2.1)) (== netstandard2.0)
Microsoft.OpenApi (1.6.5)
Microsoft.OpenApi.Readers (1.6.5)
Microsoft.OpenApi (>= 1.6.5)
Microsoft.OpenApi (1.6.9)
Microsoft.OpenApi.Readers (1.6.9)
Microsoft.OpenApi (>= 1.6.9)
SharpYaml (>= 2.1)
NETStandard.Library.NETFramework (2.0.0-preview2-25405-01)
SharpYaml (2.1)
Expand All @@ -34,14 +37,11 @@ NUGET
System.Threading.Tasks.Extensions (>= 4.5.4) - restriction: || (&& (== net6.0) (>= net461)) (&& (== net6.0) (< netcoreapp3.1)) (== netstandard2.0)
System.Threading.Tasks.Extensions (4.5.4) - restriction: || (&& (== net6.0) (>= net461)) (&& (== net6.0) (< netcoreapp3.1)) (== netstandard2.0)
System.Runtime.CompilerServices.Unsafe (>= 4.5.3) - restriction: || (&& (== net6.0) (>= net461)) (&& (== net6.0) (< netcoreapp2.1)) (&& (== net6.0) (< netstandard1.0)) (&& (== net6.0) (< netstandard2.0)) (&& (== net6.0) (>= wp8)) (== netstandard2.0)
YamlDotNet (13.1.1)
YamlDotNet (13.7.1)
GITHUB
remote: fsprojects/FSharp.TypeProviders.SDK
src/ProvidedTypes.fs (b7c930b0bd9e0e0476981ba0813ac17e7d61742b)
src/ProvidedTypes.fsi (b7c930b0bd9e0e0476981ba0813ac17e7d61742b)
remote: fsprojects/FSharp.Data
src/FSharp.Data.Runtime.Utilities/NameUtils.fs (5088a474da5756b4537a356ba3a016eecafca596)
src/FSharp.Data.Runtime.Utilities/Pluralizer.fs (5088a474da5756b4537a356ba3a016eecafca596)
src/FSharp.Data.Runtime.Utilities/NameUtils.fs (6e7d332943f1b26be034d283ef292296913d40ab)
src/FSharp.Data.Runtime.Utilities/Pluralizer.fs (6e7d332943f1b26be034d283ef292296913d40ab)
GROUP Server
RESTRICTION: == net6.0
NUGET
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,6 @@
<Paket>True</Paket>
<Link>paket-files/NameUtils.fs</Link>
</Compile>
<Compile Include="..\..\paket-files\fsprojects\FSharp.TypeProviders.SDK\src\ProvidedTypes.fsi">
<Paket>True</Paket>
<Link>paket-files/ProvidedTypes.fsi</Link>
</Compile>
<Compile Include="..\..\paket-files\fsprojects\FSharp.TypeProviders.SDK\src\ProvidedTypes.fs">
<Paket>True</Paket>
<Link>paket-files/ProvidedTypes.fs</Link>
</Compile>
<Compile Include="..\SwaggerProvider.Runtime\ProvidedApiClientBase.fs">
<Link>ProvidedApiClientBase.fs</Link>
</Compile>
Expand Down
3 changes: 1 addition & 2 deletions src/SwaggerProvider.DesignTime/paket.references
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
File: ProvidedTypes.fsi
File: ProvidedTypes.fs
File: Pluralizer.fs
File: NameUtils.fs

System.Text.Json
Microsoft.OpenApi.Readers
FSharp.TypeProviders.SDK

YamlDotNet
7 changes: 3 additions & 4 deletions src/SwaggerProvider.DesignTime/v2/DefinitionCompiler.fs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ namespace SwaggerProvider.Internal.v2.Compilers
open System
open System.Reflection
open ProviderImplementation.ProvidedTypes
open UncheckedQuotations
open FSharp.Data.Runtime.NameUtils
open SwaggerProvider.Internal.v2.Parser.Schema
open Swagger.Internal
Expand Down Expand Up @@ -172,11 +171,11 @@ type DefinitionCompiler(schema: SwaggerObject, provideNullable) as this =
ty,
getterCode =
(function
| [ this ] -> Expr.FieldGetUnchecked(this, providedField)
| [ this ] -> Expr.FieldGet(this, providedField)
| _ -> failwith "invalid property getter params"),
setterCode =
(function
| [ this; v ] -> Expr.FieldSetUnchecked(this, providedField, v)
| [ this; v ] -> Expr.FieldSet(this, providedField, v)
| _ -> failwith "invalid property setter params")
)

Expand Down Expand Up @@ -279,7 +278,7 @@ type DefinitionCompiler(schema: SwaggerObject, provideNullable) as this =
| _ -> failwith "Wrong constructor arguments"

List.zip args fields
|> List.map(fun (arg, f) -> Expr.FieldSetUnchecked(this, f, arg))
|> List.map(fun (arg, f) -> Expr.FieldSet(this, f, arg))
|> List.rev
|> List.fold (fun a b -> Expr.Sequential(a, b)) <@@ () @@>
)
Expand Down
7 changes: 3 additions & 4 deletions src/SwaggerProvider.DesignTime/v3/DefinitionCompiler.fs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ namespace SwaggerProvider.Internal.v3.Compilers
open System
open System.Reflection
open ProviderImplementation.ProvidedTypes
open UncheckedQuotations
open FSharp.Data.Runtime.NameUtils
open Swagger.Internal
open SwaggerProvider.Internal
Expand Down Expand Up @@ -194,11 +193,11 @@ type DefinitionCompiler(schema: OpenApiDocument, provideNullable) as this =
ty,
getterCode =
(function
| [ this ] -> Expr.FieldGetUnchecked(this, providedField)
| [ this ] -> Expr.FieldGet(this, providedField)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please explain this change as well.

Why we should not use Expr methods crafted for TP authors as part of TP SDK?
https://github.com/fsprojects/FSharp.TypeProviders.SDK/blob/master/src/ProvidedTypes.fsi#L536-L539

It is probably because you SDK out of assembly and have no longer assess to them... Hmm

| _ -> failwith "invalid property getter params"),
setterCode =
(function
| [ this; v ] -> Expr.FieldSetUnchecked(this, providedField, v)
| [ this; v ] -> Expr.FieldSet(this, providedField, v)
| _ -> failwith "invalid property setter params")
)

Expand Down Expand Up @@ -307,7 +306,7 @@ type DefinitionCompiler(schema: OpenApiDocument, provideNullable) as this =
| _ -> failwith "Wrong constructor arguments"

List.zip args fields
|> List.map(fun (arg, f) -> Expr.FieldSetUnchecked(this, f, arg))
|> List.map(fun (arg, f) -> Expr.FieldSet(this, f, arg))
|> List.rev
|> List.fold (fun a b -> Expr.Sequential(a, b)) <@@ () @@>
)
Expand Down
11 changes: 3 additions & 8 deletions src/SwaggerProvider.Runtime/SwaggerProvider.Runtime.fsproj
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,9 @@
</PropertyGroup>
<Import Project="Sdk.targets" Sdk="Microsoft.NET.Sdk" />
<ItemGroup>
<Compile Include="..\..\paket-files\fsprojects\FSharp.TypeProviders.SDK\src\ProvidedTypes.fsi">
<Paket>True</Paket>
<Link>paket-files/ProvidedTypes.fsi</Link>
</Compile>
<Compile Include="..\..\paket-files\fsprojects\FSharp.TypeProviders.SDK\src\ProvidedTypes.fs">
<Paket>True</Paket>
<Link>paket-files/ProvidedTypes.fs</Link>
</Compile>
<PackageReference Update="FSharp.Core" ExcludeAssets="contentFiles" />
</ItemGroup>
<ItemGroup>
<Compile Include="..\Common\AssemblyInfo.fs">
<Link>AssemblyInfo.fs</Link>
</Compile>
Expand Down
3 changes: 0 additions & 3 deletions src/SwaggerProvider.Runtime/paket.references
Original file line number Diff line number Diff line change
@@ -1,5 +1,2 @@
File: ProvidedTypes.fsi
File: ProvidedTypes.fs

FSharp.Core
FSharp.SystemTextJson
Loading