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