Skip to content

Commit

Permalink
Update Yaaf.FSharp.Scripting (now uses the 4.5 reference assemblies).…
Browse files Browse the repository at this point in the history
… Fixes crash with C# extension methods when the assembly containing them was build against net45. Fixes #201. (Might fix) References #328, #325, #139
  • Loading branch information
matthid committed Sep 20, 2015
1 parent 40797b0 commit 5b3671d
Show file tree
Hide file tree
Showing 8 changed files with 53 additions and 19 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
*.suo
.fake/
.vs/
bin/
obj/
paket-files/
Expand Down
9 changes: 9 additions & 0 deletions appveyor.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
init:
- git config --global core.autocrlf input
build_script:
- cmd: build.cmd
test: off
version: 0.0.1.{build}
artifacts:
- path: bin
name: bin
4 changes: 2 additions & 2 deletions paket.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ NUGET
remote: http://nuget.org/api/v2
specs:
CommandLineParser (1.9.71)
FAKE (4.3.4)
FAKE (4.4.2)
FSharp.Compiler.Service (0.0.90)
FSharpVSPowerTools.Core (1.9.0)
FSharp.Compiler.Service (>= 0.0.90)
Expand All @@ -17,4 +17,4 @@ NUGET
GITHUB
remote: matthid/Yaaf.FSharp.Scripting
specs:
src/source/Yaaf.FSharp.Scripting/YaafFSharpScripting.fs (1823a75ec30e022c1a086b32c773d5a6ddd0db00)
src/source/Yaaf.FSharp.Scripting/YaafFSharpScripting.fs (25170f50dabf631b6ec319d12c78b5276370f418)
2 changes: 1 addition & 1 deletion tests/FSharp.MetadataFormat.Tests/App.config
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="FSharp.Core" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="2.0.0.0-4.4.0.0" newVersion="4.4.0.0" />
<bindingRedirect oldVersion="2.0.0.0-4.3.1.0" newVersion="4.3.1.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="CommandLine" publicKeyToken="de6f01bd326f8c32" culture="neutral" />
Expand Down
18 changes: 17 additions & 1 deletion tests/FSharp.MetadataFormat.Tests/Tests.fs
Original file line number Diff line number Diff line change
Expand Up @@ -432,8 +432,24 @@ let ``MetadataFormat omit works without markdown``() =
let binDir = root @@ "files/FsLib/bin/Debug"
let library = binDir @@ "FsLib2.dll"
let output = getOutputDir()
MetadataFormat.Generate([library], output, layoutRoots, info, libDirs = [binDir; root @@ "../../lib"], markDownComments = false)
MetadataFormat.Generate
([library], output, layoutRoots, info, libDirs = [binDir; root @@ "../../lib"],
markDownComments = false)
let fileNames = Directory.GetFiles(output)
let files = dict [ for f in fileNames -> Path.GetFileName(f), File.ReadAllText(f) ]

files.ContainsKey "fslib-test_omit.html" |> should equal false

[<Test>]
let ``MetadataFormat test FsLib1``() =
let binDir = root @@ "files/FsLib/bin/Debug"
let library = binDir @@ "FsLib1.dll"
let output = getOutputDir()
MetadataFormat.Generate
([ library ], output, layoutRoots, info, libDirs = [ binDir; root @@ "../../lib" ],
markDownComments = false)
let fileNames = Directory.GetFiles(output)

let files =
dict [ for f in fileNames -> Path.GetFileName(f), File.ReadAllText(f) ]
files.ContainsKey "fslib-test_omit.html" |> should equal false
5 changes: 3 additions & 2 deletions tests/FSharp.MetadataFormat.Tests/files/FsLib/FsLib2.fsproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,10 @@
<OutputType>Library</OutputType>
<RootNamespace>FsLib</RootNamespace>
<AssemblyName>FsLib2</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<TargetFSharpCoreVersion>4.3.0.0</TargetFSharpCoreVersion>
<TargetFrameworkVersion>v4.6</TargetFrameworkVersion>
<TargetFSharpCoreVersion>4.4.0.0</TargetFSharpCoreVersion>
<Name>FsLib1</Name>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
Expand Down
22 changes: 20 additions & 2 deletions tests/FSharp.MetadataFormat.Tests/files/FsLib/Library1.fs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
namespace FsLib

/// Union sample
type Union =
type Union =
/// Hello of int
| Hello of int
/// World of string and int
Expand All @@ -12,11 +12,29 @@ type Union =
#endif

/// Record sample
type Record =
type Record =
{ /// This is name
Name : string
/// This is age
Age : int }
/// Additional members
member x.Foo = 0
member x.Foo2() = 0

type ITestInterface =
abstract Test : unit -> RazorEngine.Templating.IRazorEngineService
abstract FixScript : string -> string

/// Issue 201 docs
[<System.Runtime.CompilerServices.Extension>]
module Test_Issue201 =
/// Extension docs
[<System.Runtime.CompilerServices.Extension>]
let MyExtension (o : ITestInterface) =
ignore <| o.Test().GetKey(null)

[<AutoOpen>]
module Test_Issue201Extensions =
type ITestInterface with
member x.MyExtension() =
Test_Issue201.MyExtension x
11 changes: 0 additions & 11 deletions tests/FSharp.MetadataFormat.Tests/files/FsLib/Library2.fs
Original file line number Diff line number Diff line change
Expand Up @@ -45,17 +45,6 @@ type ITestInterface =
/// Issue 201 docs
[<System.Runtime.CompilerServices.Extension>]
module Test_Issue201 =
let internal notImpl () =
(raise <| System.NotSupportedException("Migration is not supported by this type, please implement GetMigrator."))
: 'a
/// Test FixScript_MSSQL Documentation
let FixScript_MSSQL (script:string) = script
/// Test FixScript_MySQL Documentation
let FixScript_MySQL (script:string) =
script.Replace(
"from information_schema.columns where",
"FROM information_schema.columns WHERE table_schema = SCHEMA() AND")

/// Extension docs
[<System.Runtime.CompilerServices.Extension>]
let MyExtension (o : ITestInterface) =
Expand Down

0 comments on commit 5b3671d

Please sign in to comment.