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
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ open System.Reflection

[<TypeProvider>]
type BasicErasingProvider (config : TypeProviderConfig) as this =
inherit TypeProviderForNamespaces (config, assemblyReplacementMap=[("BasicProvider.DesignTime", "BasicProvider")], addDefaultProbingLocation=true)
inherit TypeProviderForNamespaces (config, assemblyReplacementMap=[("BasicProvider.DesignTime", "BasicProvider.Runtime")], addDefaultProbingLocation=true)

let ns = "BasicProvider.Provided"
let asm = Assembly.GetExecutingAssembly()
Expand Down
14 changes: 13 additions & 1 deletion examples/BasicProvider.Runtime/BasicProvider.Runtime.fsproj
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project>

<Import Project="Sdk.props" Sdk="Microsoft.NET.Sdk" />

<PropertyGroup>
<OutputType>Library</OutputType>
Expand All @@ -23,4 +25,14 @@
</ProjectReference>
</ItemGroup>

<Import Project="Sdk.targets" Sdk="Microsoft.NET.Sdk" />

<Target Name="AfterBuild">
<!-- We place the TPDTC DLLs and its dependencies in a well-known locations with respect to the runtime DLL -->
<Copy SourceFiles="..\BasicProvider.DesignTime\bin\$(Configuration)\netstandard2.0\BasicProvider.DesignTime.dll" DestinationFolder="$(OutputPath)\typeproviders\fsharp41\netstandard2.0" />
<Copy SourceFiles="..\BasicProvider.DesignTime\bin\$(Configuration)\netstandard2.0\BasicProvider.DesignTime.pdb" DestinationFolder="$(OutputPath)\typeproviders\fsharp41\netstandard2.0" />
<Copy SourceFiles="..\BasicProvider.DesignTime\bin\$(Configuration)\netstandard2.0\FSharp.TypeProviders.SDK.dll" DestinationFolder="$(OutputPath)\typeproviders\fsharp41\netstandard2.0" />
<Copy SourceFiles="..\BasicProvider.DesignTime\bin\$(Configuration)\netstandard2.0\FSharp.TypeProviders.SDK.pdb" DestinationFolder="$(OutputPath)\typeproviders\fsharp41\netstandard2.0" />
</Target>

</Project>
4 changes: 3 additions & 1 deletion examples/BasicProvider.Runtime/BasicProvider.Runtime.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,11 @@
<file src="..\BasicProvider.Runtime\bin\Release\netstandard2.0\BasicProvider.Runtime.pdb" target="lib/netstandard2.0" />
<file src="..\BasicProvider.Runtime\bin\Release\netstandard2.0\BasicProvider.Runtime.xml" target="lib/netstandard2.0" />

<!-- Place the TPDTC in the future-proof location -->
<!-- Place the TPDTC and its dependencies in the right location -->
<file src="..\BasicProvider.DesignTime\bin\Release\netstandard2.0\BasicProvider.DesignTime.dll" target="typeproviders/fsharp41/netstandard2.0" />
<file src="..\BasicProvider.DesignTime\bin\Release\netstandard2.0\BasicProvider.DesignTime.pdb" target="typeproviders/fsharp41/netstandard2.0" />
<file src="..\BasicProvider.DesignTime\bin\Release\netstandard2.0\FSharp.TypeProvider.SDK.dll" target="typeproviders/fsharp41/netstandard2.0" />
<file src="..\BasicProvider.DesignTime\bin\Release\netstandard2.0\FSharp.TypeProvider.SDK.pdb" target="typeproviders/fsharp41/netstandard2.0" />

</files>
</package>
24 changes: 12 additions & 12 deletions examples/BasicProvider.Tests/BasicProvider.Tests.fs
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,18 @@ open Xunit

// TODO - re-enable

//[<Fact>]
//let ``Default constructor should create instance`` () =
// Assert.Equal("My internal state", MyType().InnerState)

//[<Fact>]
//let ``Constructor with parameter should create instance`` () =
// Assert.Equal("override", MyType("override").InnerState)

//[<Fact>]
//let ``Method with ReflectedDefinition parameter should get its name`` () =
// let myValue = 2
// Assert.Equal("myValue", MyType.NameOf(myValue))
[<Fact>]
let ``Default constructor should create instance`` () =
Assert.Equal("My internal state", MyType().InnerState)

[<Fact>]
let ``Constructor with parameter should create instance`` () =
Assert.Equal("override", MyType("override").InnerState)

[<Fact>]
let ``Method with ReflectedDefinition parameter should get its name`` () =
let myValue = 2
Assert.Equal("myValue", MyType.NameOf(myValue))

type Generative2 = GenerativeProvider<2>
type Generative4 = GenerativeProvider<4>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<Project Sdk="Microsoft.NET.Sdk">
<Project>

<Import Project="Sdk.props" Sdk="Microsoft.NET.Sdk" />
<PropertyGroup>
<OutputType>Library</OutputType>
<TargetFramework>netstandard2.0</TargetFramework>
Expand All @@ -13,10 +15,22 @@
<None Include="paket.references" />
</ItemGroup>
<ItemGroup>
<PackageReference Update="FSharp.Core" Version="4.5.2" />
<ProjectReference Include="..\MyProvider.DesignTime\MyProvider.DesignTime.fsproj">
<IsFSharpDesignTimeProvider>true</IsFSharpDesignTimeProvider>
<PrivateAssets>all</PrivateAssets>
</ProjectReference>
</ItemGroup>
<Import Project="..\..\.paket\Paket.Restore.targets" />
<Import Project="Sdk.targets" Sdk="Microsoft.NET.Sdk" />

<Target Name="BeforeBuild">
<MSBuild Projects="..\MyProvider.DesignTime\MyProvider.DesignTime.fsproj" Targets="Restore" />
<MSBuild Projects="..\MyProvider.DesignTime\MyProvider.DesignTime.fsproj" Targets="Build" Properties="Configuration=$(Configuration)" />
</Target>
<Target Name="AfterBuild">
<!-- We place the TPDTC DLLs in a well-known locations with respect to the runtime DLL -->
<Copy SourceFiles="..\MyProvider.DesignTime\bin\$(Configuration)\netstandard2.0\MyProvider.DesignTime.dll" DestinationFolder="$(OutputPath)\typeproviders\fsharp41\netstandard2.0" />
<Copy SourceFiles="..\MyProvider.DesignTime\bin\$(Configuration)\netstandard2.0\FSharp.TypeProviders.SDK.dll" DestinationFolder="$(OutputPath)\typeproviders\fsharp41\netstandard2.0" />
</Target>
</Project>