This repository has been archived by the owner on Jan 3, 2019. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fsautocomplete FAKE support for Win/Unix
* Build * Run unit tests * Run integration tests * Cannot yet run emacs tests
- Loading branch information
1 parent
3a28e8c
commit b395c2d
Showing
15 changed files
with
206 additions
and
274 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,111 @@ | ||
// include Fake lib | ||
#r @"packages/FAKE/tools/FakeLib.dll" | ||
open Fake | ||
open System.IO | ||
open System.Text.RegularExpressions | ||
|
||
Target "RestorePackages" (fun _ -> | ||
"packages.config" | ||
|> RestorePackage (fun p -> | ||
{ p with | ||
ToolPath = "../lib/nuget/NuGet.exe" }) | ||
) | ||
|
||
let buildDir = "./bin/Debug/" | ||
let buildReleaseDir = "./bin/Release/" | ||
let unitTestDir = "./test/unit/" | ||
let unitTestBuildDir = unitTestDir + "build" | ||
let integrationTestDir = "./test/integration/" | ||
|
||
Target "BuildDebug" (fun _ -> | ||
MSBuildDebug buildDir "Build" ["./FSharp.AutoComplete.fsproj"] | ||
|> Log "Build-Output: " | ||
) | ||
|
||
Target "BuildRelease" (fun _ -> | ||
MSBuildRelease buildReleaseDir "Build" ["./FSharp.AutoComplete.fsproj"] | ||
|> Log "Build-Output: " | ||
) | ||
|
||
Target "BuildEmacs" (fun _ -> | ||
MSBuildDebug "../emacs/bin" "Build" ["./FSharp.AutoComplete.fsproj"] | ||
|> Log "Build-Output: " | ||
) | ||
|
||
Target "BuildUnitTest" (fun _ -> | ||
!! (unitTestDir + "/*/*.fsproj") | ||
|> MSBuildDebug unitTestBuildDir "Build" | ||
|> Log "TestBuild-Output: " | ||
) | ||
|
||
Target "UnitTest" (fun _ -> | ||
!! (unitTestBuildDir + "/*Tests.dll") | ||
|> NUnit (fun p -> | ||
{p with | ||
DisableShadowCopy = true | ||
Framework = "v4.0.30319" | ||
ToolName = "nunit-console-x86.exe" | ||
OutputFile = unitTestBuildDir + "/TestResults.xml"}) | ||
) | ||
|
||
let integrationTests = | ||
!! (integrationTestDir + "/**/*Runner.fsx") | ||
|
||
let runIntegrationTest (fn: string) : bool = | ||
let dir = Path.GetDirectoryName fn | ||
|
||
tracefn "Running FSIHelper '%s', '%s', '%s'" FSIHelper.fsiPath dir fn | ||
let b, msgs = FSIHelper.executeFSI dir fn [] | ||
if not b then | ||
for msg in msgs do | ||
traceError msg.Message | ||
|
||
// Normalize output files so that a simple | ||
// `git diff` will be clean if the tests passed. | ||
for fn in !! (dir + "/*.txt") do | ||
let lines = File.ReadAllLines fn | ||
for i in [ 0 .. lines.Length - 1 ] do | ||
lines.[i] <- Regex.Replace(lines.[i], | ||
"/.*?FSharp.AutoComplete/test/(.*?(\"|$))", | ||
@"<absolute path removed>/test/$1") | ||
|
||
File.WriteAllLines (fn, lines) | ||
b | ||
|
||
Target "IntegrationTest" (fun _ -> | ||
let runOk = | ||
[ for i in integrationTests do | ||
yield runIntegrationTest i ] | ||
|> Seq.forall id | ||
if not runOk then | ||
failwith "Integration tests did not run successfully" | ||
else | ||
|
||
let ok, out, err = | ||
Git.CommandHelper.runGitCommand | ||
"." | ||
("diff --exit-code " + integrationTestDir) | ||
if not ok then | ||
trace (toLines out) | ||
failwithf "Integration tests failed:\n%s" err | ||
) | ||
|
||
Target "Test" id | ||
Target "All" id | ||
|
||
"RestorePackages" | ||
==> "BuildUnitTest" | ||
==> "UnitTest" | ||
|
||
"RestorePackages" | ||
==> "BuildDebug" | ||
==> "IntegrationTest" | ||
|
||
"UnitTest" ==> "Test" | ||
"IntegrationTest" ==> "Test" | ||
|
||
"BuildDebug" ==> "All" | ||
"Test" ==> "All" | ||
|
||
RunTargetOrDefault "BuildDebug" | ||
|
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#!/bin/bash | ||
|
||
cd `dirname $0` | ||
|
||
FAKE="packages/FAKE/tools/FAKE.exe" | ||
|
||
if [[ ! -e ~/.config/.mono/certs ]]; | ||
then | ||
mozroots --import --sync --quiet | ||
fi | ||
|
||
if [[ ! -e $FAKE ]]; | ||
then | ||
mono ../lib/nuget/NuGet.exe "Install" "FAKE" "-OutputDirectory" "packages" "-ExcludeVersion" | ||
fi | ||
|
||
mono $FAKE "$@" | ||
|
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
@echo off | ||
|
||
pushd %~dp0 | ||
|
||
IF EXIST packages\FAKE\tools\Fake.exe GOTO FAKEINSTALLED | ||
|
||
"..\lib\nuget\NuGet.exe" "install" "FAKE" "-OutputDirectory" "packages" "-ExcludeVersion" "-Prerelease" | ||
|
||
:FAKEINSTALLED | ||
|
||
SET TARGET="All" | ||
|
||
IF NOT [%1]==[] (set TARGET="%1") | ||
|
||
"packages\FAKE\tools\Fake.exe" "build.fsx" "target=%TARGET%" | ||
|
||
popd | ||
|
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,7 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<packages> | ||
<package id="FSharp.Compiler.Service" version="0.0.62" targetFramework="net40" /> | ||
</packages> | ||
<package id="FSUnit" version="1.3.0.1" targetFramework="net40" /> | ||
<package id="NUnit" version="2.6.3" targetFramework="net40" /> | ||
<package id="NUnit.Runners" version="2.6.3" targetFramework="net40" /> | ||
</packages> |
This file contains 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
Oops, something went wrong.