module BuildHelpers open Fake open System open System.IO open System.Linq open Fake.XamarinHelper let Exec command args = let result = Shell.Exec(command, args) if result <> 0 then failwithf "%s exited with error %d" command result let RestorePackages solutionFile = Exec "nuget" ("restore " + solutionFile) solutionFile |> RestoreComponents (fun defaults -> {defaults with ToolPath = "/Users/me/Desktop/Dev/testrunner/tools/xpkg/xamarin-component.exe" }) let RunNUnitTests dllPath xmlPath = Exec "/Library/Frameworks/Mono.framework/Versions/Current/bin/nunit-console4" (dllPath + " -xml=" + xmlPath) TeamCityHelper.sendTeamCityNUnitImport xmlPath let RunUITests appPath = let testAppFolder = Path.Combine("MyApp.UITests", "testapps") if Directory.Exists(testAppFolder) then Directory.Delete(testAppFolder, true) Directory.CreateDirectory(testAppFolder) |> ignore let testAppPath = Path.Combine(testAppFolder, DirectoryInfo(appPath).Name) Directory.Move(appPath, testAppPath) //RestorePackages "MyApp.UITests/MyApp.UITests.csproj" MSBuild "MyApp.UITests/bin/Release" "Build" [ ("Configuration", "Release"); ("Platform", "Any CPU") ] [ "MyApp.UITests/MyApp.UITests.csproj" ] |> ignore RunNUnitTests "MyApp.UITests/bin/Release/MyApp.UITests.dll" "MyApp.UITests/bin/Release/testresults.xml"