Skip to content

Commit

Permalink
Merge pull request #430 from cloudRoutine/version3-tests
Browse files Browse the repository at this point in the history
Update test and build infrastructure
  • Loading branch information
matthid authored Mar 22, 2017
2 parents 47acc98 + 21eb2f4 commit 5add72a
Show file tree
Hide file tree
Showing 74 changed files with 2,316 additions and 621 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ misc/literate/output/content/
*.sln.DotSettings.user
*.userprefs
*.bak
.paket/paket.exe
release.cmd
*.orig
*.aux
Expand Down
Binary file added .paket/paket.exe
Binary file not shown.
6 changes: 6 additions & 0 deletions .paket/paket.exe.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<appSettings>
<add key="Prerelease" value="True"/>
</appSettings>
</configuration>
11 changes: 9 additions & 2 deletions FSharp.Formatting.sln
Original file line number Diff line number Diff line change
@@ -1,15 +1,22 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 14
VisualStudioVersion = 14.0.25420.1
# Visual Studio 15
VisualStudioVersion = 15.0.26228.9
MinimumVisualStudioVersion = 12.0.31101.0
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "project", "project", "{194BD478-0DB5-44F3-A6C2-1FC75D3F3294}"
ProjectSection(SolutionItems) = preProject
.gitignore = .gitignore
.travis.yml = .travis.yml
appveyor.yml = appveyor.yml
build.cmd = build.cmd
build.fsx = build.fsx
build.sh = build.sh
nuget\FSharp.Formatting.CommandTool.nuspec = nuget\FSharp.Formatting.CommandTool.nuspec
packages\FSharp.Formatting\FSharp.Formatting.fsx = packages\FSharp.Formatting\FSharp.Formatting.fsx
nuget\FSharp.Formatting.nuspec = nuget\FSharp.Formatting.nuspec
paket.dependencies = paket.dependencies
paket.lock = paket.lock
README.md = README.md
RELEASE_NOTES.md = RELEASE_NOTES.md
EndProjectSection
EndProject
Expand Down
7 changes: 1 addition & 6 deletions build.cmd
Original file line number Diff line number Diff line change
@@ -1,14 +1,9 @@
@echo off

.paket\paket.bootstrapper.exe
if errorlevel 1 (
exit /b %errorlevel%
)

.paket\paket.exe restore
if errorlevel 1 (
exit /b %errorlevel%
)

packages\FAKE\tools\FAKE.exe build.fsx %*
pause

64 changes: 36 additions & 28 deletions build.fsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
System.IO.Directory.SetCurrentDirectory __SOURCE_DIRECTORY__

// --------------------------------------------------------------------------------------
// FAKE build script
// --------------------------------------------------------------------------------------
Expand All @@ -12,8 +14,6 @@ open Fake.AssemblyInfoFile
open Fake.Git
open Fake.ReleaseNotesHelper

Environment.CurrentDirectory <- __SOURCE_DIRECTORY__

// Information about the project to be used at NuGet and in AssemblyInfo files
let project = "FSharp.Formatting"
let projectTool = "FSharp.Formatting.CommandTool"
Expand Down Expand Up @@ -97,14 +97,21 @@ Target "UpdateFsxVersions" (fun _ ->
// --------------------------------------------------------------------------------------
// Build library


let solutionFile = "FSharp.Formatting.sln"

let msbuild14 = ProgramFilesX86</>"MSBuild"</>"14.0"</>"Bin"</>"MSBuild.exe"

if isWindows && fileExists msbuild14 then
setEnvironVar "MSBUILD" msbuild14

Target "Build" (fun _ ->
{ BaseDirectory = __SOURCE_DIRECTORY__
Includes = ["FSharp.Formatting.sln"]
Excludes = [] }
!! solutionFile
|> MSBuildRelease "" "Rebuild"
|> ignore
)


Target "MergeVSPowerTools" (fun _ ->
() (*
let binDir = __SOURCE_DIRECTORY__ @@ "bin"
Expand Down Expand Up @@ -137,34 +144,36 @@ Target "BuildTests" (fun _ ->
{ BaseDirectory = __SOURCE_DIRECTORY__
Includes = ["FSharp.Formatting.sln"]
Excludes = [] }
|> MSBuildRelease "" "Rebuild"
|> MSBuildRelease "" "Build"
|> ignore

{ BaseDirectory = __SOURCE_DIRECTORY__
Includes = ["tests/*/files/FsLib/FsLib.sln"]
Excludes = [] }
|> MSBuildDebug "" "Rebuild"
|> MSBuildDebug "" "Build"
|> ignore

{ BaseDirectory = __SOURCE_DIRECTORY__
Includes = ["tests/*/files/crefLib/crefLib.sln"]
Excludes = [] }
|> MSBuildDebug "" "Rebuild"
|> MSBuildDebug "" "Build"
|> ignore

{ BaseDirectory = __SOURCE_DIRECTORY__
Includes = ["tests/*/files/csharpSupport/csharpSupport.sln"]
Excludes = [] }
|> MSBuildDebug "" "Rebuild"
|> MSBuildDebug "" "Build"
|> ignore

{ BaseDirectory = __SOURCE_DIRECTORY__
Includes = ["tests/*/files/TestLib/TestLib.sln"]
Excludes = [] }
|> MSBuildDebug "" "Rebuild"
|> MSBuildDebug "" "Build"
|> ignore
)

open Fake.Testing

let testProjects =
[ "FSharp.CodeFormat.Tests"; "FSharp.Literate.Tests";
"FSharp.Markdown.Tests"; "FSharp.MetadataFormat.Tests" ]
Expand All @@ -177,12 +186,11 @@ for name in testProjects do
let taskName = sprintf "RunTest_%s" name
Target taskName <| fun () ->
!! (sprintf "tests/*/bin/Release/%s.dll" name)
|> NUnit (fun p ->
|> NUnit3 (fun p ->
{ p with
DisableShadowCopy = true
ShadowCopy = true
TimeOut = TimeSpan.FromMinutes 20.
Framework = "4.0"
OutputFile = "TestResults.xml" })
OutputDir = "TestResults.xml" })
taskName ==> "RunTests" |> ignore
"BuildTests" ==> taskName |> ignore

Expand All @@ -208,7 +216,7 @@ let RequireRange breakingPoint version =

Target "CopyFSharpCore" (fun _ ->
// We need to include optdata and sigdata as well, we copy everything to be consistent
for file in System.IO.Directory.EnumerateFiles("packages" @@ "FSharp.Core" @@ "lib" @@ "net40") do
for file in System.IO.Directory.EnumerateFiles("packages" </> "FSharp.Core" </> "lib" </> "net40") do
let source, dest = file, Path.Combine("bin", Path.GetFileName(file))
printfn "Copying %s to %s" source dest
File.Copy(source, dest, true))
Expand Down Expand Up @@ -252,7 +260,7 @@ Target "NuGet" (fun _ ->
// --------------------------------------------------------------------------------------
// Generate the documentation

let fakePath = "packages" @@ "FAKE" @@ "tools" @@ "FAKE.exe"
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
Expand All @@ -266,7 +274,7 @@ let fakeStartInfo script workingDirectory args fsiargs environmentVars =
setVar "GIT" Git.CommandHelper.gitPath
setVar "FSI" fsiPath)

let commandToolPath = "bin" @@ "fsformatting.exe"
let commandToolPath = "bin" </> "fsformatting.exe"
let commandToolStartInfo workingDirectory environmentVars args =
(fun (info: System.Diagnostics.ProcessStartInfo) ->
info.FileName <- System.IO.Path.GetFullPath commandToolPath
Expand Down Expand Up @@ -364,15 +372,15 @@ let bootStrapDocumentationFiles () =
// 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")
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"; "FSharp.Formatting.Razor.dll" ]
let bundledFiles =
buildFiles
|> List.map (fun f ->
__SOURCE_DIRECTORY__ @@ sprintf "bin/%s" f,
__SOURCE_DIRECTORY__ @@ sprintf "packages/FSharp.Formatting/lib/net40/%s" 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
Expand Down Expand Up @@ -459,15 +467,15 @@ Target "All" DoNothing
Target "DownloadPython" (fun _ ->
if not isUnix then
let w = new System.Net.WebClient()
let zipFile = "temp"@@"cpython.zip"
let zipFile = "temp"</>"cpython.zip"
if File.Exists zipFile then File.Delete zipFile
w.DownloadFile("https://www.python.org/ftp/python/3.5.1/python-3.5.1-embed-amd64.zip", zipFile)
let cpython = "temp"@@"CPython"
let cpython = "temp"</>"CPython"
CleanDir cpython
System.IO.Compression.ZipFile.ExtractToDirectory(zipFile, cpython)
let cpythonStdLib = cpython@@"stdlib"
let cpythonStdLib = cpython</>"stdlib"
CleanDir cpythonStdLib
System.IO.Compression.ZipFile.ExtractToDirectory(cpython@@"python35.zip", cpythonStdLib)
System.IO.Compression.ZipFile.ExtractToDirectory(cpython</>"python35.zip", cpythonStdLib)
)

Target "CreateTestJson" (fun _ ->
Expand All @@ -477,11 +485,11 @@ Target "CreateTestJson" (fun _ ->

let pythonExe, stdLib =
if not isUnix then
System.IO.Path.GetFullPath ("temp"@@"CPython"@@"python.exe"),
System.IO.Path.GetFullPath ("temp"@@"CPython"@@"stdlib")
System.IO.Path.GetFullPath ("temp"</>"CPython"</>"python.exe"),
System.IO.Path.GetFullPath ("temp"</>"CPython"</>"stdlib")
else "python", ""

let resultFile = "temp"@@"commonmark-tests.json"
let resultFile = "temp"</>"commonmark-tests.json"
if File.Exists resultFile then File.Delete resultFile
( use fileStream = new StreamWriter(File.Open(resultFile, System.IO.FileMode.Create))
executeHelper
Expand All @@ -499,7 +507,7 @@ Target "CreateTestJson" (fun _ ->
setVar "MSBuild" msBuildExe
setVar "GIT" Git.CommandHelper.gitPath
setVar "FSI" fsiPath))
File.Copy(resultFile, "tests"@@"commonmark_spec.json")
File.Copy(resultFile, "tests"</>"commonmark_spec.json")
)

"Clean" ==> "AssemblyInfo" ==> "Build" ==> "BuildTests"
Expand Down
10 changes: 0 additions & 10 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,6 @@
if test "$OS" = "Windows_NT"
then
# use .Net
.paket/paket.bootstrapper.exe
exit_code=$?
if [ $exit_code -ne 0 ]; then
exit $exit_code
fi

.paket/paket.exe restore
exit_code=$?
Expand All @@ -18,11 +13,6 @@ then
else
# use mono

mono .paket/paket.bootstrapper.exe
exit_code=$?
if [ $exit_code -ne 0 ]; then
exit $exit_code
fi

mono .paket/paket.exe restore
exit_code=$?
Expand Down
20 changes: 14 additions & 6 deletions paket.dependencies
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
source http://nuget.org/api/v2
source https://api.nuget.org/v3/index.json
source https://nuget.org/api/v2
redirects: on

nuget FSharp.Data
nuget FAKE
nuget CommandLineParser
nuget FSharp.Core
nuget FSharp.Core 4.0.0.1 redirects:force
nuget Microsoft.AspNet.Razor
nuget RazorEngine
nuget NUnit ~> 2
nuget NUnit.Runners ~> 2
nuget RazorEngine 3.9.3 framework: net45
nuget NuGet.CommandLine
nuget FSharp.Compiler.Service == 2.0.0.6
nuget FSharp.Compiler.Service 2.0.0.6
// See http://fsprojects.github.io/Paket/nuget-dependencies.html
// This basically means we need the lowest version for its dependencies (FSharp.Compiler.Service)
// Otherwise we get runtime errors without binding redirects
Expand All @@ -20,3 +19,12 @@ nuget FSharpVSPowerTools.Core !>= 0
nuget ILRepack

github matthid/Yaaf.FSharp.Scripting src/source/Yaaf.FSharp.Scripting/YaafFSharpScripting.fs

group Test
source https://api.nuget.org/v3/index.json
redirects: on

nuget FSharp.Core 4.0.0.1 redirects:force
nuget FsUnit 3.0.0 framework:net45
nuget NUnit
nuget NUnit.Console
Loading

0 comments on commit 5add72a

Please sign in to comment.