Last active
October 25, 2015 17:08
-
-
Save Kimserey/5583b396e16481db7ddc to your computer and use it in GitHub Desktop.
FAKE build script to deploy W# UI.Next SPA. Defines multiple targets depending on the number of instances. Clean, build, deploy and run on IIS express website for particular instance on port 9090 by default. Can be overwritten with -ev port XXXX
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// -------------------------------------------------------------------------------------- | |
// Build instances used in build.fsx to create Targets | |
// -------------------------------------------------------------------------------------- | |
module BuildInstances | |
// Add new instances here | |
// | |
let instances = [ | |
"earth" | |
"mars" | |
"pluton" | |
] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@echo off | |
cls | |
packages\FAKE.4.7.2\tools\FAKE.exe build.fsx %* |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// -------------------------------------------------------------------------------------- | |
// FAKE build script | |
// -------------------------------------------------------------------------------------- | |
#r "packages/FAKE.4.7.2/tools/FakeLib.dll" | |
#r "packages/FAKE.IIS.4.7.2/tools/Fake.IIS.dll" | |
#load "build-instances.fsx" | |
open System | |
open System.IO | |
open System.Diagnostics | |
open Fake | |
open Fake.ProcessHelper | |
open Fake.IISHelper | |
open Fake.IISExpress | |
open Fake.EnvironmentHelper | |
let makeTargets instance = | |
let fsproj = Include "UINext.Test/UINext.Test.fsproj" | |
let defaultConfigs = [ "Configuration", "Debug" ] | |
let port = getBuildParamOrDefault "port" "9090" |> int | |
let targetDir = Path.Combine [| __SOURCE_DIRECTORY__; "build"; "Debug"; instance |] | |
Target ("Clean-" + instance) (fun _ -> | |
MSBuild targetDir "Clean" defaultConfigs fsproj |> ignore | |
CleanDirs [ targetDir ] | |
) | |
Target ("Build-" + instance) (fun () -> | |
MSBuild targetDir "Build" (defaultConfigs @ [ "DefineConstants", instance.ToUpper() ]) fsproj |> ignore | |
CopyDir <| Path.Combine [| targetDir; "_PublishedWebsites"; "UINext.Test"; "Content" |] | |
<| Path.Combine [| __SOURCE_DIRECTORY__; "UINext.Test"; "Content" |] | |
<| fun _ -> true | |
) | |
Target ("Deploy-" + instance) (fun _ -> | |
let args = sprintf "/path:\"%s\" /port:%d" (Path.Combine [| targetDir; "_PublishedWebsites"; "UINext.Test" |]) port | |
ProcessStartInfo(FileName = IISExpressDefaults.ToolPath, Arguments = args, UseShellExecute = false) | |
|> Process.Start | |
|> ignore | |
) | |
Target ("Run-" + instance) (fun _ -> | |
OpenWebsiteInBrowser "localhost" port | |
) | |
Target instance DoNothing | |
("Clean-" + instance) | |
==> ("Build-" + instance) | |
==> ("Deploy-" + instance) | |
==> ("Run-" + instance) | |
==> instance | |
List.map makeTargets BuildInstances.instances |> ignore | |
Target "default" DoNothing | |
RunTargetOrDefault "default" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment