-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathbuild.fsx
129 lines (99 loc) · 3.7 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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
#r "./packages/FAKE/tools/FakeLib.dll"
open Fake
open Fake.XamarinHelper
open Fake.DotNetCli
open Fake.NpmHelper
//sh build.sh AndroidPackage -ev keystorePath=*.keystore -ev keystorePwd=****** -ev keystoreAlias=******
// Directories
let buildDir = "./build/"
// Targets
Target "Clean" <| fun _ ->
!! "src/**/bin"
++ "src/**/obj"
++ buildDir
|> CleanDirs
Target "Restore" <| fun _ ->
Restore <| fun p ->
{ p with
NoCache = false
AdditionalArgs = ["terminal-snake.sln"] }
Target "RestoreNpm" <| fun _ ->
Npm <| fun p ->
{ p with
Command = Install Standard }
Target "BuildLib" <| fun _ ->
DotNetCli.Build <| fun p ->
{ p with
Configuration = "Release"
Project = "./src/snake-game-lib/snake-game-lib.fsproj"
Output = "../../build/snake-game-lib" }
Target "BuildTerminal" <| fun _ ->
DotNetCli.Build <| fun p ->
{ p with
Configuration = "Release"
Project = "./src/terminal-snake/terminal-snake.fsproj"
Output = "../../build/terminal-snake" }
Target "BuildWeb" <| fun _ ->
Shell.Exec ("./node_modules/.bin/fable", "src/web-snake/") |> ignore
Copy "./build/web-snake/" ["./src/web-snake/index.html"]
Target "AndroidPackage" <| fun () ->
trace "Cleaning Android project"
MSBuildWithDefaults "Clean" ["./src/android-snake/android-snake.fsproj"] |> ignore
let keystorePath = getBuildParam "keystorePath"
let keystorePwd = getBuildParam "keystorePwd"
let keystoreAlias = getBuildParam "keystoreAlias"
trace <| sprintf "Using keystore %s; path=%s; password=%s" keystoreAlias keystorePath keystorePwd
trace "Packaging Android app"
AndroidPackage (fun defaults ->
{ defaults with
ProjectPath = "./src/android-snake/android-snake.fsproj"
Configuration = "Release"
OutputPath = "./build/android/.temp/x" }
)
|> AndroidSignAndAlign (fun defaults ->
{ defaults with
KeystorePath = keystorePath
KeystorePassword = keystorePwd
KeystoreAlias = keystoreAlias }
)
|> fun file -> MoveFile "./build/android/" file.FullName
trace "Removing Android temp build"
FileHelper.DeleteDir "./build/android/.temp"
Target "IosPackage" <| fun () ->
trace "Cleaning iOS project"
MSBuildWithDefaults "Clean" ["./src/ios-snake/ios-snake.fsproj"] |> ignore
let buildPath = "./build/ios/"
trace "Packaging iOS app"
iOSBuild (fun defaults ->
{ defaults with
ProjectPath = "./src/ios-snake/ios-snake.fsproj"
Configuration = "Release|iPhone"
Target = "Build"
OutputPath = buildPath + ".temp/" }
)
let appPath = "./build/ios/IOS.Snake.app"
ensureDirectory appPath
FileSystemHelper.subDirectories (directoryInfo buildPath)
|> Seq.find (fun d -> d.Name.EndsWith ".app")
|> fun a -> copyRecursive a (directoryInfo appPath) true |> ignore
DeleteDirs ["./build/ios/.tempIOS.Snake.app"; "./build/ios/.temp"]
DeleteFile "./build/ios/.tempmtouch.stamp"
// let outputFolder = Path.Combine("src", "TipCalc.iOS", "bin", "iPhone", "AppStore")
// let appPath = Directory.EnumerateDirectories(outputFolder, "*.app").First()
// let zipFilePath = Path.Combine(outputFolder, "TipCalc.iOS.zip")
// let zipArgs = String.Format("-r -y '{0}' '{1}'", zipFilePath, appPath)
// Exec "zip" zipArgs
// TeamCityHelper.PublishArtifact zipFilePath
// Build order
"Clean"
"Restore"
==> "BuildLib"
==> "BuildTerminal"
"RestoreNpm"
==> "BuildWeb"
// "Restore"
// ==> "AndroidPackage"
// "Restore"
// ==> "IosPackage"
// start build
RunTargetOrDefault "BuildTerminal"