2017-05-20 14:45:48 +00:00
|
|
|
#r "packages/FAKE/tools/FakeLib.dll"
|
|
|
|
open Fake
|
|
|
|
open System
|
|
|
|
|
|
|
|
let buildDir = "./build/"
|
|
|
|
|
|
|
|
/// Path to the Aurelia app
|
|
|
|
let appPath = "src" @@ "app"
|
|
|
|
|
|
|
|
/// Path to the Suave API
|
|
|
|
let apiPath = "src" @@ "api"
|
|
|
|
|
|
|
|
// --- Targets ---
|
|
|
|
|
|
|
|
Target "Clean" (fun _ ->
|
|
|
|
CleanDir buildDir
|
|
|
|
)
|
|
|
|
|
|
|
|
Target "BuildApp" (fun _ ->
|
|
|
|
let result =
|
|
|
|
ExecProcessAndReturnMessages (fun info ->
|
|
|
|
info.UseShellExecute <- false
|
|
|
|
info.FileName <- "." @@ "build-au.bat") (TimeSpan.FromMinutes 2.)
|
|
|
|
match result.ExitCode with
|
|
|
|
| 0 -> Log "AppBuild-Output: " result.Messages
|
|
|
|
| _ -> failwith "Aurelia build failed"
|
|
|
|
)
|
|
|
|
|
|
|
|
Target "CopyApp" (fun _ ->
|
|
|
|
let apiWebPath = apiPath @@ "wwwroot"
|
|
|
|
[ "scripts" @@ "app-bundle.js"
|
|
|
|
"scripts" @@ "vendor-bundle.js"
|
|
|
|
"index.html"
|
|
|
|
]
|
|
|
|
|> List.iter (fun file ->
|
|
|
|
IO.File.Copy (appPath @@ file, apiWebPath @@ file, true)
|
|
|
|
Log "CopyApp--Output: " (Seq.singleton file))
|
|
|
|
)
|
|
|
|
|
|
|
|
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"
|
|
|
|
info.WorkingDirectory <- "src" @@ "api") (TimeSpan.FromMinutes 2.)
|
|
|
|
Log "AppBuild-Output: " result.Messages
|
|
|
|
match result.ExitCode with
|
|
|
|
| 0 -> ()
|
|
|
|
| _ -> failwith "API build failed"
|
|
|
|
(*!! "src/api/*.fsproj"
|
2017-05-20 14:45:48 +00:00
|
|
|
|> MSBuildRelease buildDir "Build"
|
2017-06-01 03:22:08 +00:00
|
|
|
|> Log "ApiBuild-Output: " *)
|
2017-05-20 14:45:48 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
Target "Run" (fun _ ->
|
2017-06-01 03:22:08 +00:00
|
|
|
ExecProcess (fun info ->
|
|
|
|
info.FileName <- "dotnet"
|
|
|
|
info.Arguments <- """publish -o ..\..\build"""
|
|
|
|
info.WorkingDirectory <- "src" @@ "api") TimeSpan.MaxValue
|
|
|
|
|> ignore
|
2017-05-20 14:45:48 +00:00
|
|
|
ExecProcess (fun info ->
|
|
|
|
info.FileName <- "dotnet"
|
|
|
|
info.Arguments <- "myPrayerJournal.dll"
|
|
|
|
info.WorkingDirectory <- "build") TimeSpan.MaxValue
|
|
|
|
|> ignore
|
|
|
|
)
|
|
|
|
|
|
|
|
Target "Default" (fun _ ->
|
|
|
|
Log "" Seq.empty
|
|
|
|
)
|
|
|
|
|
|
|
|
// --- Dependencies ---
|
|
|
|
|
|
|
|
"Clean"
|
|
|
|
==> "BuildApp"
|
|
|
|
==> "CopyApp"
|
|
|
|
==> "BuildApi"
|
|
|
|
==> "Default"
|
|
|
|
|
|
|
|
"BuildApi"
|
|
|
|
==> "Run"
|
|
|
|
|
|
|
|
RunTargetOrDefault "Default"
|