Skip to content

Commit

Permalink
Merge pull request #358 from tpetricek/fix_356
Browse files Browse the repository at this point in the history
Fix #356
  • Loading branch information
matthid committed Nov 21, 2015
2 parents 337a164 + d6841ab commit a6c8f16
Show file tree
Hide file tree
Showing 11 changed files with 133 additions and 26 deletions.
60 changes: 56 additions & 4 deletions build.fsx
Original file line number Diff line number Diff line change
Expand Up @@ -225,13 +225,65 @@ Target "NuGet" (fun _ ->
// --------------------------------------------------------------------------------------
// Generate the documentation

let fakePath = "packages" @@ "FAKE" @@ "tools" @@ "FAKE.exe"
let fakeStartInfo script workingDirectory args fsiargs environmentVars =
(fun (info: System.Diagnostics.ProcessStartInfo) ->
info.FileName <- System.IO.Path.GetFullPath fakePath
info.Arguments <- sprintf "%s --fsiargs -d:FAKE %s \"%s\"" args fsiargs script
info.WorkingDirectory <- workingDirectory
let setVar k v =
info.EnvironmentVariables.[k] <- v
for (k, v) in environmentVars do
setVar k v
setVar "MSBuild" msBuildExe
setVar "GIT" Git.CommandHelper.gitPath
setVar "FSI" fsiPath)

/// Run the given buildscript with FAKE.exe
let executeFAKEWithOutput workingDirectory script fsiargs envArgs =
let exitCode =
ExecProcessWithLambdas
(fakeStartInfo script workingDirectory "" fsiargs envArgs)
TimeSpan.MaxValue false ignore ignore
System.Threading.Thread.Sleep 1000
exitCode

// Documentation
let buildDocumentationTarget fsiargs target =
trace (sprintf "Building documentation (%s), this could take some time, please wait..." target)
let exit = executeFAKEWithOutput "docs/tools" "generate.fsx" fsiargs ["target", target]
if exit <> 0 then
failwith "generating reference documentation failed"
()

let bootStrapDocumentationFiles () =
// This is needed to bootstrap ourself (make sure we have the same environment while building as our users) ...
// If you came here from the nuspec file add your file.
// If you add files here to make the CI happy add those files to the .nuspec file as well
// TODO: INSTEAD build the nuspec file before generating the documentation and extract it...
ensureDirectory (__SOURCE_DIRECTORY__ @@ "packages/FSharp.Formatting/lib/net40")
let buildFiles = [ "CSharpFormat.dll"; "FSharp.CodeFormat.dll"; "FSharp.Literate.dll"
"FSharp.Markdown.dll"; "FSharp.MetadataFormat.dll"; "RazorEngine.dll";
"System.Web.Razor.dll"; "FSharp.Formatting.Common.dll" ]
let bundledFiles =
buildFiles
|> List.map (fun f ->
__SOURCE_DIRECTORY__ @@ sprintf "bin/%s" f,
__SOURCE_DIRECTORY__ @@ sprintf "packages/FSharp.Formatting/lib/net40/%s" f)
|> List.map (fun (source, dest) -> Path.GetFullPath source, Path.GetFullPath dest)
for source, dest in bundledFiles do
try
printfn "Copying %s to %s" source dest
File.Copy(source, dest, true)
with e -> printfn "Could not copy %s to %s, because %s" source dest e.Message

Target "GenerateDocs" (fun _ ->
if not <| executeFSIWithArgs "docs/tools" "generate.fsx" ["--define:RELEASE"; "--define:REFERENCE"; "--define:HELP"] [] then
failwith "generating reference documentation failed")
bootStrapDocumentationFiles ()
buildDocumentationTarget "--define:RELEASE --define:REFERENCE --define:HELP" "Default")

Target "WatchDocs" (fun _ ->
if not <| executeFSIWithArgs "docs/tools" "generate.fsx" ["--define:WATCH"] [] then
failwith "generating reference documentation failed")
bootStrapDocumentationFiles ()
buildDocumentationTarget "--define:WATCH" "Default")

// --------------------------------------------------------------------------------------
// Release Scripts
Expand Down
14 changes: 0 additions & 14 deletions docs/tools/generate.fsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,20 +36,6 @@ open System.IO
open Fake
open Fake.FileHelper

// This is needed to bootstrap ourself (make sure we have the same environment while building as our users) ...
// If you came here from the nuspec file add your file.
// If you add files here to make the CI happy add those files to the .nuspec file as well
// TODO: INSTEAD build the nuspec file before generating the documentation and extract it...
ensureDirectory (__SOURCE_DIRECTORY__ @@ "../../packages/FSharp.Formatting/lib/net40")
let buildFiles = [ "CSharpFormat.dll"; "FSharp.CodeFormat.dll"; "FSharp.Literate.dll"
"FSharp.Markdown.dll"; "FSharp.MetadataFormat.dll"; "RazorEngine.dll";
"System.Web.Razor.dll"; "FSharp.Formatting.Common.dll" ]
let bundledFiles =
buildFiles
|> List.map (fun f ->
__SOURCE_DIRECTORY__ @@ sprintf "../../bin/%s" f,
__SOURCE_DIRECTORY__ @@ sprintf "../../packages/FSharp.Formatting/lib/net40/%s" f)
for source, dest in bundledFiles do File.Copy(source, dest, true)
#load "../../packages/FSharp.Formatting/FSharp.Formatting.fsx"

open FSharp.Literate
Expand Down
8 changes: 4 additions & 4 deletions src/Common/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@
[assembly: AssemblyTitleAttribute("FSharp.Formatting")]
[assembly: AssemblyProductAttribute("FSharp.Formatting")]
[assembly: AssemblyDescriptionAttribute("A package of libraries for building great F# documentation, samples and blogs")]
[assembly: AssemblyVersionAttribute("2.11.0")]
[assembly: AssemblyFileVersionAttribute("2.11.0")]
[assembly: AssemblyInformationalVersionAttribute("2.11.0-alpha2")]
[assembly: AssemblyVersionAttribute("2.12.0")]
[assembly: AssemblyFileVersionAttribute("2.12.0")]
[assembly: AssemblyInformationalVersionAttribute("2.12.0")]
[assembly: AssemblyCopyrightAttribute("Apache 2.0 License")]
namespace System {
internal static class AssemblyVersionInformation {
internal const string Version = "2.11.0";
internal const string Version = "2.12.0";
}
}
8 changes: 4 additions & 4 deletions src/Common/AssemblyInfo.fs
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ open System.Reflection
[<assembly: AssemblyTitleAttribute("FSharp.Formatting")>]
[<assembly: AssemblyProductAttribute("FSharp.Formatting")>]
[<assembly: AssemblyDescriptionAttribute("A package of libraries for building great F# documentation, samples and blogs")>]
[<assembly: AssemblyVersionAttribute("2.11.0")>]
[<assembly: AssemblyFileVersionAttribute("2.11.0")>]
[<assembly: AssemblyInformationalVersionAttribute("2.11.0-alpha2")>]
[<assembly: AssemblyVersionAttribute("2.12.0")>]
[<assembly: AssemblyFileVersionAttribute("2.12.0")>]
[<assembly: AssemblyInformationalVersionAttribute("2.12.0")>]
[<assembly: AssemblyCopyrightAttribute("Apache 2.0 License")>]
do ()

module internal AssemblyVersionInformation =
let [<Literal>] Version = "2.11.0"
let [<Literal>] Version = "2.12.0"
8 changes: 8 additions & 0 deletions src/FSharp.Formatting.CommandTool/App.config
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,14 @@
<runtime>

<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Microsoft.Build.Engine" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="4.0.0.0" newVersion="12.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Build.Framework" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="4.0.0.0" newVersion="12.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="FSharp.Core" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="2.0.0.0" newVersion="4.3.0.0" />
Expand Down
8 changes: 8 additions & 0 deletions tests/FSharp.CodeFormat.Tests/App.config
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,14 @@
<runtime>

<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Microsoft.Build.Engine" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="4.0.0.0" newVersion="12.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Build.Framework" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="4.0.0.0" newVersion="12.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="CommandLine" publicKeyToken="de6f01bd326f8c32" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-1.9.71.2" newVersion="1.9.71.2" />
Expand Down
8 changes: 8 additions & 0 deletions tests/FSharp.Literate.Tests/App.config
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,14 @@
<runtime>

<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Microsoft.Build.Engine" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="4.0.0.0" newVersion="12.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Build.Framework" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="4.0.0.0" newVersion="12.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="FSharp.Core" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="2.0.0.0-4.3.0.0" newVersion="4.3.1.0" />
Expand Down
5 changes: 5 additions & 0 deletions tests/FSharp.Literate.Tests/FSharp.Literate.Tests.fsproj
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,11 @@
<Project>{341ebf32-d470-4c55-99e9-55f14f7ffbb1}</Project>
<Private>True</Private>
</ProjectReference>
<ProjectReference Include="..\..\src\FSharp.Formatting.Common\FSharp.Formatting.Common.fsproj">
<Name>FSharp.Formatting.Common</Name>
<Project>{91bad90e-bf3b-4646-a1a7-1568f8f25075}</Project>
<Private>True</Private>
</ProjectReference>
<ProjectReference Include="..\..\src\FSharp.Literate\FSharp.Literate.fsproj">
<Name>FSharp.Literate</Name>
<Project>{65e6d541-0486-4383-b619-5cfc5d2ba2f0}</Project>
Expand Down
24 changes: 24 additions & 0 deletions tests/FSharp.Literate.Tests/Tests.fs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,30 @@ open FSharp.Markdown.Unit
open NUnit.Framework
open FSharp.Literate.Tests.Setup


module Logging = FSharp.Formatting.Common.Log
type TraceOptions = System.Diagnostics.TraceOptions
do
try
System.Diagnostics.Trace.AutoFlush <- true
let allTraceOptions = TraceOptions.Callstack ||| TraceOptions.DateTime ||| TraceOptions.LogicalOperationStack |||
TraceOptions.ProcessId ||| TraceOptions.ThreadId ||| TraceOptions.Timestamp
let noTraceOptions = TraceOptions.None
let listeners =
[|Logging.ConsoleListener()
|> Logging.SetupListener noTraceOptions System.Diagnostics.SourceLevels.Information |]
let sources =
[ FSharp.Formatting.Common.Log.source
Yaaf.FSharp.Scripting.Log.source ]

sources |> Seq.iter (Logging.SetupSource listeners)

// Test that everything works
Logging.infof "FSharp.Formatting Logging setup!"
Yaaf.FSharp.Scripting.Log.infof "Yaaf.FSharp.Scripting Logging setup!"
with e ->
printfn "FSharp.Formatting Logging setup failed: %A" e

let properNewLines (text: string) = text.Replace("\r\n", System.Environment.NewLine)

// --------------------------------------------------------------------------------------
Expand Down
8 changes: 8 additions & 0 deletions tests/FSharp.Markdown.Tests/App.config
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,14 @@
<runtime>

<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Microsoft.Build.Engine" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="4.0.0.0" newVersion="12.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Build.Framework" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="4.0.0.0" newVersion="12.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="FSharp.Core" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="2.0.0.0-4.3.0.0" newVersion="4.3.1.0" />
Expand Down
8 changes: 8 additions & 0 deletions tests/FSharp.MetadataFormat.Tests/App.config
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,14 @@
<runtime>

<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Microsoft.Build.Engine" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="4.0.0.0" newVersion="12.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Build.Framework" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="4.0.0.0" newVersion="12.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="FSharp.Core" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="2.0.0.0-4.3.1.0" newVersion="4.3.1.0" />
Expand Down

0 comments on commit a6c8f16

Please sign in to comment.