Files
myPrayerJournal/build.fsx
T

77 lines
1.6 KiB
FSharp
Raw Normal View History

2017-05-20 09:45:48 -05:00
#r "packages/FAKE/tools/FakeLib.dll"
open Fake
open System
let buildDir = "./build/"
2017-08-06 15:42:09 -05:00
/// Path to the Vue app
2017-05-20 09:45:48 -05:00
let appPath = "src" @@ "app"
/// Path to the Suave API
let apiPath = "src" @@ "api"
// --- Targets ---
Target "Clean" (fun _ ->
CleanDir buildDir
2017-08-06 15:42:09 -05:00
CleanDir (apiPath @@ "wwwroot")
2017-05-20 09:45:48 -05:00
)
Target "BuildApp" (fun _ ->
let result =
ExecProcessAndReturnMessages (fun info ->
info.UseShellExecute <- false
2017-08-06 15:42:09 -05:00
info.FileName <- "build-vue.bat") (TimeSpan.FromMinutes 2.)
2017-09-10 22:33:43 -05:00
match result.ExitCode with 0 -> Log "App: " result.Messages | _ -> failwith "Vue build failed"
2017-05-20 09:45:48 -05:00
)
Target "BuildApi" (fun _ ->
2017-05-31 22:22:08 -05:00
let result =
ExecProcessAndReturnMessages (fun info ->
info.UseShellExecute <- false
info.FileName <- "dotnet"
info.Arguments <- "build"
2017-08-06 15:42:09 -05:00
info.WorkingDirectory <- apiPath) (TimeSpan.FromMinutes 2.)
2017-09-10 22:33:43 -05:00
Log "Api: " result.Messages
2017-08-06 15:42:09 -05:00
match result.ExitCode with 0 -> () | _ -> failwith "API build failed"
)
Target "Publish" (fun _ ->
ExecProcess (fun info ->
info.FileName <- "dotnet"
info.Arguments <- """publish -o ..\..\build"""
info.WorkingDirectory <- apiPath) TimeSpan.MaxValue
|> ignore
2017-05-20 09:45:48 -05:00
)
Target "Run" (fun _ ->
ExecProcess (fun info ->
info.FileName <- "dotnet"
info.Arguments <- "myPrayerJournal.dll"
2017-08-06 15:42:09 -05:00
info.WorkingDirectory <- buildDir) TimeSpan.MaxValue
2017-05-20 09:45:48 -05:00
|> ignore
)
Target "Default" (fun _ ->
Log "" Seq.empty
)
// --- Dependencies ---
"Clean"
==> "BuildApp"
2017-08-06 15:42:09 -05:00
"BuildApp"
2017-05-20 09:45:48 -05:00
==> "BuildApi"
"BuildApi"
2017-08-06 15:42:09 -05:00
==> "Publish"
"Publish"
2017-05-20 09:45:48 -05:00
==> "Run"
2017-08-06 15:42:09 -05:00
"BuildApi"
==> "Default"
2017-05-20 09:45:48 -05:00
RunTargetOrDefault "Default"