Last active
May 17, 2016 01:35
-
-
Save kekyo/a39cac521df12d6c9d762af3e30c0bd6 to your computer and use it in GitHub Desktop.
FSharp.Compiler.Services pdb test https://github.com/fsharp/FSharp.Compiler.Service/pull/564
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace Microsoft.BuildSettings | |
// [<assembly: System.Runtime.Versioning.TargetFrameworkAttribute(".NETFramework,Version=v4.6.1", FrameworkDisplayName=".NET Framework 4.6.1")>] | |
// [<assembly: System.Diagnostics.Debuggable(System.Diagnostics.DebuggableAttribute.DebuggingModes.Default ||| System.Diagnostics.DebuggableAttribute.DebuggingModes.DisableOptimizations)>] | |
do () |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
open System.IO | |
open Microsoft.FSharp.Compiler.SimpleSourceCodeServices | |
open Microsoft.FSharp.Compiler.SourceCodeServices | |
let checker = FSharpChecker.Create() | |
let simpleService = SimpleSourceCodeServices() | |
let dependencies = | |
[ @"C:\Program Files (x86)\Reference Assemblies\Microsoft\FSharp\.NETFramework\v4.0\4.4.0.0\FSharp.Core.dll" | |
@"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.1\mscorlib.dll" | |
@"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.1\System.Core.dll" | |
@"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.1\System.dll" | |
@"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.1\System.Numerics.dll" ] | |
[<EntryPoint>] | |
let main argv = | |
let src = System.IO.Path.GetFullPath(argv.[0]) | |
let text = System.IO.File.ReadAllText(src, System.Text.Encoding.UTF8) | |
let options = | |
checker.GetProjectOptionsFromCommandLineArgs( | |
Path.Combine(Path.GetDirectoryName(src), "x.proj"), | |
[| "-o:output.dll" | |
"-g" | |
"--debug:full" | |
"--debug+" // TEST: PR suggest | |
"--noframework" | |
"--define:DEBUG" | |
"--define:TRACE" | |
"--optimize-" | |
"--tailcalls-" | |
"--platform:anycpu32bitpreferred" | |
@"-r:C:\Program Files (x86)\Reference Assemblies\Microsoft\FSharp\.NETFramework\v4.0\4.4.0.0\FSharp.Core.dll" | |
@"-r:C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.1\mscorlib.dll" | |
@"-r:C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.1\System.Core.dll" | |
@"-r:C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.1\System.dll" | |
@"-r:C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.1\System.Numerics.dll" | |
"--target:library" | |
"--warn:3" | |
"--warnaserror:76" | |
"--vserrors" | |
"--LCID:1041" | |
"--utf8output" | |
"--fullpaths" | |
"--flaterrors" | |
"--subsystemversion:6.00" | |
"--highentropyva+" |]) | |
let xs = | |
let asm = System.IO.File.ReadAllText("AssemblyInfo.fs", System.Text.Encoding.UTF8) | |
Async.Parallel [ checker.ParseFileInProject("./AssemblyInfo.fs", asm, options); checker.ParseFileInProject(src, text, options) ] | |
|> Async.RunSynchronously | |
match xs.[0].ParseTree, xs.[1].ParseTree with | |
| Some a, Some ast -> | |
let errs, res = | |
simpleService.Compile([a; ast], "HelloFscx", "./HelloFscx.dll", dependencies, pdbFile="./HelloFscx.pdb", executable=false, noframework=true) | |
for e in errs do | |
if e.Severity = Microsoft.FSharp.Compiler.FSharpErrorSeverity.Error then | |
printfn "%s" (e.ToString()) | |
res | |
| _ -> | |
for e in xs.[0].Errors do | |
printfn "%s" (e.ToString()) | |
for e in xs.[1].Errors do | |
printfn "%s" (e.ToString()) | |
1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module SampleM | |
open System | |
let sampleF (a: int, b: string, c: int) = | |
Console.WriteLine("{0}:{1}", a + c, b) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
AssemblyInfo.fs and TestCode.fs are file contents, not part of executable.