Skip to content
Merged
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
18 changes: 10 additions & 8 deletions paket.dependencies
Original file line number Diff line number Diff line change
@@ -1,25 +1,27 @@
source http://nuget.org/api/v2

nuget SharpYaml
nuget FSharp.Core

group Build
frameworks: net45, netstandard2.0
source https://nuget.org/api/v2

nuget FAKE
nuget FSharp.Formatting
nuget Octokit
nuget NuGet.CommandLine
nuget SourceLink.Fake
nuget FSharp.Core
nuget SharpYaml
nuget NetStandard.Library.NetFramework

github fsharp/FAKE modules/Octokit/Octokit.fsx
github fsprojects/FSharp.TypeProviders.StarterPack src/ProvidedTypes.fsi
github fsprojects/FSharp.TypeProviders.StarterPack src/ProvidedTypes.fs
github fsprojects/FSharp.TypeProviders.StarterPack src/ProvidedTypesTesting.fs
github fsprojects/FSharp.TypeProviders.SDK src/ProvidedTypes.fsi
github fsprojects/FSharp.TypeProviders.SDK src/ProvidedTypes.fs
github fsprojects/FSharp.TypeProviders.SDK src/ProvidedTypesTesting.fs

group Test
frameworks: net461
source https://nuget.org/api/v2

nuget FSharp.Core redirects: force
nuget Expecto
nuget Expecto
nuget SharpYaml

2,057 changes: 395 additions & 1,662 deletions paket.lock

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/FSharp.Configuration/ConfigTypeProvider.fs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ open ProviderImplementation.ProvidedTypes
[<TypeProvider>]
type FSharpConfigurationProvider(cfg: TypeProviderConfig) as this =
class
inherit TypeProviderForNamespaces()
inherit TypeProviderForNamespaces(cfg)
let context = new Context(this, cfg)
do this.AddNamespace (
rootNamespace,
Expand Down
23 changes: 18 additions & 5 deletions src/FSharp.Configuration/FSharp.Configuration.fsproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,32 @@
<TargetFramework>netstandard2.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<Compile Include="..\..\paket-files\build\fsprojects\FSharp.TypeProviders.StarterPack\src\ProvidedTypes.fsi" />
<Compile Include="..\..\paket-files\build\fsprojects\FSharp.TypeProviders.StarterPack\src\ProvidedTypes.fs" />
<Compile Include="..\..\paket-files\build\fsprojects\FSharp.TypeProviders.SDK\src\ProvidedTypes.fsi" />
<Compile Include="..\..\paket-files\build\fsprojects\FSharp.TypeProviders.SDK\src\ProvidedTypes.fs" />
<Compile Include="TypeProviders.Helper.fs" />
<Compile Include="ResXProvider.fs" />
<Compile Include="AppSettingsProvider.fs" />
<Compile Include="YamlConfigProvider.fs" />
<Compile Include="IniFileProvider.fs" />
<Compile Include="ConfigTypeProvider.fs" />
<Content Include="paket.references" />
</ItemGroup>
<ItemGroup>
<Reference Include="netstandard, Version=2.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51">
<HintPath>..\..\packages\build\NETStandard.Library.NETFramework\build\net461\lib\netstandard.dll</HintPath>
</Reference>
<!-- These files are the facades necessary to run .NET Standard 2.0 components on .NET Framweork 4.6.1 (.NET Framework 4.7 will -->
<!-- come with these facades included). Because the type provider is a .NET Standard 2.0 component, the deployment of the type -->
<!-- provider must include these facade DLLs if it is to run hosted inside an F# compiler executing using .NET Framework 4.6.1 or Mono 5.0. -->
<!-- -->
<!-- We are not yet sure if the presence of these files will prevent an otherwise .NET Standard 2.0 type provider running inside a -->
<!-- F# compiler executing using .NET CoreApp 2.0, as until recently F# compilers running using .NET CoreApp 2.0 do not load type providers correctly. -->
<None Include="..\..\packages\build\NETStandard.Library.NETFramework\build\net461\lib\netstandard.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="..\..\packages\build\NETStandard.Library.NETFramework\build\net461\lib\System.Reflection.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="..\..\packages\build\NETStandard.Library.NETFramework\build\net461\lib\System.Runtime.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
<Import Project="..\..\.paket\Paket.Restore.targets" />
</Project>
18 changes: 9 additions & 9 deletions src/FSharp.Configuration/IniFileProvider.fs
Original file line number Diff line number Diff line change
Expand Up @@ -82,48 +82,48 @@ let getValue (iniFileName: string) (section: string) (key: string) =
| Choice2Of2 _ -> None

let internal typedIniFile (context: Context) =
let iniFile = context.ProvidedTypesContext.ProvidedTypeDefinition(thisAssembly, rootNamespace, "IniFile", Some typeof<obj>, true)
let iniFile = ProvidedTypeDefinition(thisAssembly, rootNamespace, "IniFile", Some typeof<obj>, true)
//let cache = new MemoryCache(name = "IniFileProvider")
//context.AddDisposable cache

iniFile.DefineStaticParameters(
parameters = [ context.ProvidedTypesContext.ProvidedStaticParameter ("configFileName", typeof<string>) ],
parameters = [ ProvidedStaticParameter ("configFileName", typeof<string>) ],
instantiationFunction = (fun typeName parameterValues ->
//let value = lazy (
match parameterValues with
| [| :? string as iniFileName |] ->
let typeDef = context.ProvidedTypesContext.ProvidedTypeDefinition(thisAssembly, rootNamespace, typeName, Some typeof<obj>, true)
let typeDef = ProvidedTypeDefinition(thisAssembly, rootNamespace, typeName, Some typeof<obj>, true)
let niceName = createNiceNameProvider()
try
let filePath = findConfigFile context.ResolutionFolder iniFileName
match Parser.parse filePath with
| Choice1Of2 sections ->
for section in sections do
let sectionTy = context.ProvidedTypesContext.ProvidedTypeDefinition(section.Name, Some typeof<obj>, hideObjectMethods = true)
let sectionTy = ProvidedTypeDefinition(section.Name, Some typeof<obj>, hideObjectMethods = true)
for setting in section.Settings do
let sectionName = section.Name
let key = setting.Key
let prop =
match setting.Value with
| ValueParser.Int value -> context.ProvidedTypesContext.ProvidedProperty(key, typeof<int>, isStatic = true, getterCode = fun _ ->
| ValueParser.Int value -> ProvidedProperty(key, typeof<int>, isStatic = true, getterCode = fun _ ->
<@@
match getValue filePath sectionName key with
| Some v -> Int32.Parse v
| None -> value
@@>)
| ValueParser.Bool value -> context.ProvidedTypesContext.ProvidedProperty(key, typeof<bool>, isStatic = true, getterCode = fun _ ->
| ValueParser.Bool value -> ProvidedProperty(key, typeof<bool>, isStatic = true, getterCode = fun _ ->
<@@
match getValue filePath sectionName key with
| Some v -> Boolean.Parse v
| None -> value
@@>)
| ValueParser.Float value -> context.ProvidedTypesContext.ProvidedProperty(key, typeof<float>, isStatic = true, getterCode = fun _ ->
| ValueParser.Float value -> ProvidedProperty(key, typeof<float>, isStatic = true, getterCode = fun _ ->
<@@
match getValue filePath sectionName key with
| Some v -> Double.Parse (v, NumberStyles.Any, CultureInfo.InvariantCulture)
| None -> value
@@>)
| value -> context.ProvidedTypesContext.ProvidedProperty(key, typeof<string>, isStatic = true, getterCode = fun _ ->
| value -> ProvidedProperty(key, typeof<string>, isStatic = true, getterCode = fun _ ->
<@@
match getValue filePath sectionName key with
| Some v -> v
Expand All @@ -139,7 +139,7 @@ let internal typedIniFile (context: Context) =

let name = niceName "ConfigFileName"
let getValue = <@@ filePath @@>
let prop = context.ProvidedTypesContext.ProvidedProperty(name, typeof<string>, isStatic = true, getterCode = fun _ -> getValue)
let prop = ProvidedProperty(name, typeof<string>, isStatic = true, getterCode = fun _ -> getValue)

prop.AddXmlDoc "Returns the Filename"
typeDef.AddMember prop
Expand Down
5 changes: 1 addition & 4 deletions src/FSharp.Configuration/TypeProviders.Helper.fs
Original file line number Diff line number Diff line change
Expand Up @@ -268,8 +268,6 @@ type private ContextMessage =
| Cancel

type Context (provider: TypeProviderForNamespaces, cfg: TypeProviderConfig) =
let ctx = ProvidedTypesContext.Create(cfg)

let watcher: IDisposable option ref = ref None

let disposeWatcher() =
Expand Down Expand Up @@ -305,10 +303,9 @@ type Context (provider: TypeProviderForNamespaces, cfg: TypeProviderConfig) =
member __.ResolutionFolder = cfg.ResolutionFolder
member __.WatchFile (file: FilePath) = agent.Post (Watch file)
member __.AddDisposable x = agent.Post (AddDisposable x)
member __.ProvidedTypesContext = ctx

member __.ErasedType<'T>(assemblyName, rootNamespace, typeName) =
ctx.ProvidedTypeDefinition(assemblyName, rootNamespace, typeName, Some(typeof<'T>))
ProvidedTypeDefinition(assemblyName, rootNamespace, typeName, Some(typeof<'T>))

interface IDisposable with
member __.Dispose() = agent.Post Cancel
Expand Down
5 changes: 3 additions & 2 deletions src/FSharp.Configuration/paket.references
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
SharpYaml
FSharp.Core
group Build
SharpYaml
FSharp.Core
28 changes: 22 additions & 6 deletions tests/FSharp.Configuration.Tests/FSharp.Configuration.Tests.fsproj
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<Project Sdk="Microsoft.NET.Sdk">
<?xml version="1.0" encoding="utf-8"?>
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp2.0</TargetFramework>
Expand All @@ -9,17 +10,32 @@
<Compile Include="YamlProvider.Tests.fs" />
<Compile Include="IniFileProvider.Tests.fs" />
<Compile Include="Program.fs" />
</ItemGroup>
<ItemGroup>
<Content Include="paket.references" />
</ItemGroup>
<ItemGroup>
<!-- Note: I don't understand why Paket isn't working out this reference from the paket.references file -->
<Reference Include="Expecto">
<HintPath>..\..\packages\test\Expecto\lib\netstandard1.6\Expecto.dll</HintPath>
</Reference>
<!-- Note: This is referring to the Debug version, which is not normally what we want?-->
<Reference Include="FSharp.Configuration, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null">
<HintPath>..\..\src\FSharp.Configuration\bin\Debug\netstandard2.0\FSharp.Configuration.dll</HintPath>
</Reference>
<Reference Include="netstandard, Version=2.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51">
<HintPath>..\..\packages\build\NETStandard.Library.NETFramework\build\net461\lib\netstandard.dll</HintPath>
</Reference>
<!-- These files are the facades necessary to run .NET Standard 2.0 components on .NET Framweork 4.6.1 (.NET Framework 4.7 will -->
<!-- come with these facades included). Because the type provider is a .NET Standard 2.0 component, the deployment of the type -->
<!-- provider must include these facade DLLs if it is to run hosted inside an F# compiler executing using .NET Framework 4.6.1 or Mono 5.0. -->
<!-- -->
<!-- We are not yet sure if the presence of these files will prevent an otherwise .NET Standard 2.0 type provider running inside a -->
<!-- F# compiler executing using .NET CoreApp 2.0, as until recently F# compilers running using .NET CoreApp 2.0 do not load type providers correctly. -->
<None Include="..\..\packages\build\NETStandard.Library.NETFramework\build\net461\lib\netstandard.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="..\..\packages\build\NETStandard.Library.NETFramework\build\net461\lib\System.Reflection.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="..\..\packages\build\NETStandard.Library.NETFramework\build\net461\lib\System.Runtime.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
<Import Project="..\..\.paket\Paket.Restore.targets" />
</Project>
75 changes: 0 additions & 75 deletions tests/FSharp.Configuration.Tests/app.config
Original file line number Diff line number Diff line change
Expand Up @@ -57,81 +57,6 @@
<assemblyIdentity name="RazorEngine" publicKeyToken="9ee697374c7e744a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-3.3.0.0" newVersion="3.3.0.0" />
</dependentAssembly>
<dependentAssembly>
<Paket>True</Paket>
<assemblyIdentity name="FSharp.Core" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-65535.65535.65535.65535" newVersion="4.4.1.0" />
</dependentAssembly>
<dependentAssembly>
<Paket>True</Paket>
<assemblyIdentity name="System.Linq" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-65535.65535.65535.65535" newVersion="4.1.1.0" />
</dependentAssembly>
<dependentAssembly>
<Paket>True</Paket>
<assemblyIdentity name="System.Linq.Expressions" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-65535.65535.65535.65535" newVersion="4.1.1.0" />
</dependentAssembly>
<dependentAssembly>
<Paket>True</Paket>
<assemblyIdentity name="System.Linq.Queryable" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-65535.65535.65535.65535" newVersion="4.0.2.0" />
</dependentAssembly>
<dependentAssembly>
<Paket>True</Paket>
<assemblyIdentity name="System.Net.WebHeaderCollection" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-65535.65535.65535.65535" newVersion="4.0.2.0" />
</dependentAssembly>
<dependentAssembly>
<Paket>True</Paket>
<assemblyIdentity name="System.Reflection.Emit" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-65535.65535.65535.65535" newVersion="4.0.2.0" />
</dependentAssembly>
<dependentAssembly>
<Paket>True</Paket>
<assemblyIdentity name="System.Reflection.Emit.ILGeneration" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-65535.65535.65535.65535" newVersion="4.0.2.0" />
</dependentAssembly>
<dependentAssembly>
<Paket>True</Paket>
<assemblyIdentity name="System.Reflection.Emit.Lightweight" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-65535.65535.65535.65535" newVersion="4.0.2.0" />
</dependentAssembly>
<dependentAssembly>
<Paket>True</Paket>
<assemblyIdentity name="System.Runtime.Numerics" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-65535.65535.65535.65535" newVersion="4.0.2.0" />
</dependentAssembly>
<dependentAssembly>
<Paket>True</Paket>
<assemblyIdentity name="System.Security.Cryptography.OpenSsl" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-65535.65535.65535.65535" newVersion="4.1.0.0" />
</dependentAssembly>
<dependentAssembly>
<Paket>True</Paket>
<assemblyIdentity name="System.Text.RegularExpressions" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-65535.65535.65535.65535" newVersion="4.1.1.0" />
</dependentAssembly>
<dependentAssembly>
<Paket>True</Paket>
<assemblyIdentity name="System.Threading" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-65535.65535.65535.65535" newVersion="4.0.12.0" />
</dependentAssembly>
<dependentAssembly>
<Paket>True</Paket>
<assemblyIdentity name="System.Threading.Tasks.Parallel" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-65535.65535.65535.65535" newVersion="4.0.2.0" />
</dependentAssembly>
<dependentAssembly>
<Paket>True</Paket>
<assemblyIdentity name="System.Threading.Thread" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-65535.65535.65535.65535" newVersion="4.0.1.0" />
</dependentAssembly>
<dependentAssembly>
<Paket>True</Paket>
<assemblyIdentity name="System.Threading.ThreadPool" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-65535.65535.65535.65535" newVersion="4.0.11.0" />
</dependentAssembly>
</assemblyBinding></runtime>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6" />
Expand Down