-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathbuild.fsx
75 lines (60 loc) · 1.54 KB
/
build.fsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
// include Fake libs
#r "./packages/FAKE/tools/FakeLib.dll"
#r "System.IO.Compression.FileSystem"
open System
open System.IO
open Fake
open Fake.NpmHelper
let yarn =
if EnvironmentHelper.isWindows then "yarn.cmd" else "yarn"
|> ProcessHelper.tryFindFileOnPath
|> function
| Some yarn -> yarn
| ex -> failwith ( sprintf "yarn not found (%A)\n" ex )
// Directories
let buildDir = "./build/"
// Filesets
let projects =
!! "src/*.fsproj"
// Artifact packages
let packages =
!! "src/package.json"
let dotnetcliVersion = "1.0.1"
let mutable dotnetExePath = "dotnet"
let runDotnet workingDir =
DotNetCli.RunCommand (fun p -> { p with ToolPath = dotnetExePath
WorkingDir = workingDir } )
Target "InstallDotNetCore" (fun _ ->
dotnetExePath <- DotNetCli.InstallDotNetSDK dotnetcliVersion
)
Target "Install" (fun _ ->
projects
|> Seq.iter (fun s ->
let dir = IO.Path.GetDirectoryName s
printf "Installing: %s\n" dir
Npm (fun p ->
{ p with
NpmFilePath = yarn
Command = Install Standard
WorkingDirectory = dir
})
runDotnet dir "restore"
)
)
// Targets
Target "Clean" (fun _ ->
CleanDirs [buildDir]
)
Target "Build" (fun _ ->
projects
|> Seq.iter (fun s ->
let dir = IO.Path.GetDirectoryName s
runDotnet dir "build")
)
// Build order
"Clean"
==> "InstallDotNetCore"
==> "Install"
==> "Build"
// start build
RunTargetOrDefault "Build"