Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update test and build infrastructure #430

Merged
merged 9 commits into from
Mar 22, 2017
Merged
Show file tree
Hide file tree
Changes from 8 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
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

72 changes: 44 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__

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just wondering... Does this need to be on top now?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ideally setting the directory should be the first thing that you do, i changed the way it's done because the old environment way doesn't work on netcore

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think after opening the namespaces works as well and makes the code shorter :).

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you have to load the packages before you can open the namespaces, you need to set the dir if you want to load the packages properly, this is to account for the weird working dir that fsi is set to automatically when you use it in VS

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To be honest I don't even remember why its needed (I'm pretty sure the author of this). Now you are :)

// --------------------------------------------------------------------------------------
// 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,29 @@ Target "UpdateFsxVersions" (fun _ ->
// --------------------------------------------------------------------------------------
// Build library

//Target "Build" (fun _ ->
// { BaseDirectory = __SOURCE_DIRECTORY__
// Includes = ["FSharp.Formatting.sln"]
// Excludes = [] }
// |> MSBuildRelease "" "Build"
// |> ignore
//)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we enable this later?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nah, forgot to delete it


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 +152,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 +194,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 +224,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 +268,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 +282,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 +380,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 +475,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 +493,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 +515,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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I assume upgrading this did lead to errors (same as FSharp.Compiler.Service)?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there were some binding redirect issues that popped up like NUnit was the problem initially

NUGET
  remote: https://api.nuget.org/v3/index.json
    CommandLineParser (1.9.71)
    FAKE (4.56)
    FSharp.Compiler.Service (2.0.0.6)
    FSharp.Core (4.0.0.1) - redirects: force
    FSharp.Data (2.3.2)

I didn't upgrade FCS though

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