-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.fsx
103 lines (80 loc) · 2.41 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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
// include Fake libs
#r "./packages/FAKE/tools/FakeLib.dll"
open Fake
open System
// Directories
let buildDir = "./build/"
let deployDir = "./deploy/"
// Filesets
let appReferences =
!! "/**/*.csproj"
++ "/**/*.fsproj"
// version info
let version = "0.1" // or retrieve from CI server
// Oscar's Targets
let subfold = "app"
let fsYacc = "packages" </> "FsLexYacc" </> "build" </> "fsyacc.exe"
let fsLex = "packages" </> "FsLexYacc" </> "build" </> "fslex.exe"
let FSLexYaccRuntime = "packages" </> "FsLexYacc.Runtime" </> "lib"
</> "portable-net45+netcore45+wpa81+wp8+MonoAndroid10+MonoTouch10"
</> "FsLexYacc.Runtime.dll"
let builder (target : string) =
let (name,arg1,arg2) =
match target with
| "parser" ->
let (n,a1,a2) = ("Parser", "--module FolPar", "FolPar.fsy")
(n,a1,a2)
| "lexer" ->
let (n,a1,a2) = ("Lexer", " ", "FolLex.fsl --unicode")
(n,a1,a2)
| _ ->
let (n,a1,a2) = ("", "","")
(n,a1,a2)
let progPath : string =
match target with
| "parser" -> fsYacc
| "lexer" -> fsLex
| _ -> "Wtf!"
trace ("Building " </> name)
let srcPath = __SOURCE_DIRECTORY__ </> "Rivano/src/" </> subfold
let messages = ref []
let appendMessage msg = messages := msg :: !messages
let exitCode =
ExecProcessWithLambdas
(fun info ->
info.FileName <- progPath
info.Arguments <- arg1 </> srcPath </> arg2 ) (TimeSpan.FromSeconds(30.)) true appendMessage appendMessage
let output = !messages |> List.rev |> Array.ofList
printfn "Output from FsYacc:"
for line in output do
printfn "\t%s" line
if exitCode <> 0 then
failwithf "Process failed with code %d" exitCode
Target "Parser"(fun _ ->
builder("parser")
)
Target "Lexer"(fun _ ->
builder("lexer")
)
// Targets
Target "Clean" (fun _ ->
CleanDirs [buildDir; deployDir]
)
Target "Build" (fun _ ->
// compile all projects below src/app/
MSBuildDebug buildDir "Build" appReferences
|> Log "AppBuild-Output: "
)
Target "Deploy" (fun _ ->
!! (buildDir + "/**/*.*")
-- "*.zip"
|> Zip buildDir (deployDir + "ApplicationName." + version + ".zip")
)
// Build order
"Clean"
==> "Build"
==> "Parser"
==> "Lexer"
==> "Deploy"
// start build
RunTargetOrDefault "Build"