build.fsx 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. // include Fake lib
  2. #r @"packages/FAKE.3.5.4/tools/FakeLib.dll"
  3. #load "build-helpers.fsx"
  4. #load "hockey-app-helpers.fsx"
  5. open Fake
  6. open System
  7. open System.IO
  8. open System.Linq
  9. open BuildHelpers
  10. open Fake.XamarinHelper
  11. open HockeyAppHelper
  12. // *** Define Targets ***
  13. Target "common-build" (fun () ->
  14. RestorePackages "Calculator.sln"
  15. MSBuild "src/Calculator/bin/Debug" "Build" [ ("Configuration", "Debug"); ("Platform", "Any CPU") ] [ "Calculator.sln" ] |> ignore
  16. )
  17. Target "core-build" (fun () ->
  18. RestorePackages "Calculator.Core.sln"
  19. MSBuild "src/Calculator/bin/Debug" "Build" [ ("Configuration", "Debug"); ("Platform", "Any CPU") ] [ "Calculator.Core.sln" ] |> ignore
  20. )
  21. Target "core-tests" (fun () ->
  22. RunNUnitTests "src/Calculator/bin/Debug/Calculator.Tests.dll" "src/Calculator/bin/Debug/testresults.xml" |> ignore
  23. )
  24. Target "windows-phone-build" (fun () ->
  25. RestorePackages "Calculator.WindowsPhone.sln"
  26. MSBuild "src/Calculator.WindowsPhone/Calculator.WindowsPhone/bin/Debug" "Build" [ ("Configuration", "Debug") ] [ "Calculator.WindowsPhone.sln" ] |> ignore
  27. )
  28. Target "android-build" (fun () ->
  29. RestorePackages "Calculator.Android.sln"
  30. MSBuild "src/Calculator.Android/bin/Debug" "Build" [ ("Configuration", "Debug") ] [ "Calculator.Android.sln" ] |> ignore
  31. )
  32. Target "android-package" (fun () ->
  33. AndroidPackage (fun defaults ->
  34. {defaults with
  35. ProjectPath = "src/Calculator.Android/Calculator.Android.csproj"
  36. Configuration = "Debug"
  37. OutputPath = "src/Calculator.Android/bin/Debug"
  38. })
  39. |> fun file -> TeamCityHelper.PublishArtifact file.FullName
  40. )
  41. Target "android-uitests" (fun () ->
  42. AndroidPackage (fun defaults ->
  43. {defaults with
  44. ProjectPath = "src/Calculator.Android/Calculator.Android.csproj"
  45. Configuration = "Debug"
  46. OutputPath = "Calculator.Android/bin/Debug"
  47. }) |> ignore
  48. let appPath = Directory.EnumerateFiles(Path.Combine("src/Calculator.Android", "bin", "Debug"), "*.apk", SearchOption.AllDirectories).First()
  49. RunUITests appPath
  50. )
  51. Target "android-deploy" (fun () ->
  52. let buildCounter = BuildHelpers.GetBuildCounter TeamCityHelper.TeamCityBuildNumber
  53. let hockeyAppApiToken = ""
  54. let appPath = Directory.EnumerateFiles(Path.Combine( "Calculator.Android", "bin", "Release"), "*.apk", SearchOption.AllDirectories).First()
  55. HockeyAppHelper.Upload hockeyAppApiToken appPath buildCounter
  56. )
  57. // *** Define Dependencies ***
  58. "core-build"
  59. ==> "core-tests"
  60. "android-build"
  61. ==> "android-package"
  62. ==> "android-uitests"
  63. ==> "android-deploy"
  64. // *** Start Build ***
  65. RunTarget()