This repository was archived by the owner on Aug 31, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 227
Expand file tree
/
Copy pathengine_builder.livecodescript
More file actions
226 lines (180 loc) · 8.96 KB
/
engine_builder.livecodescript
File metadata and controls
226 lines (180 loc) · 8.96 KB
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
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
script "EngineBuilder"
---------------------------------------------------------------------
private function engineBuilderVMRunPath
return "/Applications/VMware Fusion.app/Contents/Library/vmrun"
end engineBuilderVMRunPath
private function engineBuilderVMFolder
return "/Users/michael/Documents/Virtual Machines"
end engineBuilderVMFolder
private function engineBuilderWindowsVMPath
return engineBuilderVMFolder() & "/Windows - Build.vmwarevm"
end engineBuilderWindowsVMPath
private function engineBuilderLinuxVMPath
return engineBuilderVMFolder() & "/Linux - Build.vmwarevm"
end engineBuilderLinuxVMPath
private function engineBuilderLinuxVMRepoPath
return "/host/Workspace/livecode/builds/livecode"
end engineBuilderLinuxVMRepoPath
private function engineBuilderLinuxVMCommercialPath
return "/host/Workspace/livecode/builds/livecode-commercial"
end engineBuilderLinuxVMCommercialPath
private function engineBuilderWindowsVMCommercialPath
return "C:/Workspace/livecode"
end engineBuilderWindowsVMCommercialPath
private function engineBuilderWindowsVMRepoPath
return "C:/Workspace/livecode-commercial"
end engineBuilderWindowsVMRepoPath
private function engineBuilderLogFolder
return builderRepoFolder() & "/_build/logs"
end engineBuilderLogFolder
private function engineBuilderLogFolderLinuxVM
return engineBuilderLinuxVMRepoPath() & "/_build/logs"
end engineBuilderLogFolderLinuxVM
private function engineBuilderLogFolderWindowsVM
return engineBuilderLinuxWimdowsRepoPath() & "/_build/logs"
end engineBuilderLogFolderWindowsVM
---------------------------------------------------------------------
private function wrapQ pVal
return quote & pVal & quote
end wrapQ
---------------------------------------------------------------------
private command engineBuilderBuildMac pEdition, pVersion
builderLog "report", "Building Mac engines..."
put empty into URL ("file:" & engineBuilderLogFolder() & "/error_mac.log")
put empty into URL ("file:" & engineBuilderLogFolder() & "/build_mac.log")
local tCommand
put "sh" && wrapQ(builderCommercialFolder() & "/build-mac.osx") && ">" && wrapQ(engineBuilderLogFolder() & "/build_mac.log") && "2>" && wrapQ(engineBuilderLogFolder() & "/error_mac.log") into tCommand
get shell(tCommand)
builderLog "message", "Mac build result..."
builderLog "message", URL ("file:" & engineBuilderLogFolder() & "/error_mac.log")
builderLog "report", "Building Mac complete."
end engineBuilderBuildMac
private command engineBuilderBuildIOS pEdition, pVersion
builderLog "report", "Building iOS engines..."
put empty into URL ("file:" & engineBuilderLogFolder() & "/error_ios.log")
put empty into URL ("file:" & engineBuilderLogFolder() & "/build_ios.log")
local tCommand
put "sh" && wrapQ(builderCommercialFolder() & "/build-ios.osx") && ">" && wrapQ(engineBuilderLogFolder() & "/build_ios.log") && "2>" && wrapQ(engineBuilderLogFolder() & "/error_ios.log") into tCommand
get shell(tCommand)
builderLog "message", "iOS build result..."
builderLog "message", URL ("file:" & engineBuilderLogFolder() & "/error_ios.log")
builderLog "report", "Building iOS complete."
end engineBuilderBuildIOS
private command engineBuilderBuildAndroid pEdition, pVersion
builderLog "report", "Building Android engines..."
put empty into URL ("file:" & engineBuilderLogFolder() & "/error_android.log")
put empty into URL ("file:" & engineBuilderLogFolder() & "/build_android.log")
local tCommand
put "sh" && wrapQ(builderCommercialFolder() & "/build-android.osx") && ">" && wrapQ(engineBuilderLogFolder() & "/build_android.log") && "2>" && wrapQ(engineBuilderLogFolder() & "/error_android.log") into tCommand
get shell(tCommand)
builderLog "message", "Android build result..."
builderLog "message", URL ("file:" & engineBuilderLogFolder() & "/error_android.log")
builderLog "report", "Building Android complete."
end engineBuilderBuildAndroid
private command engineBuilderBuildLinux pEdition, pVersion
local tCommand
builderLog "report", "Building Linux engines..."
put empty into URL ("file:" & engineBuilderLogFolder() & "/error_linux.log")
put empty into URL ("file:" & engineBuilderLogFolder() & "/build_linux.log")
builderLog "message", "Starting VM..."
put wrapQ(engineBuilderVMRunPath()) && "-T fusion start" && wrapQ(engineBuilderLinuxVMPath()) && "nogui" into tCommand
get shell(tCommand)
if it contains "error" then
builderLog "report", "Error starting VM:" && it
throw "failure"
end if
builderLog "message", "Compiling engines..."
put wrapQ(engineBuilderVMRunPath()) && "-T fusion -gu build -gp runlog runScriptInGuest" && wrapQ(engineBuilderLinuxVMPath()) && "/bin/sh" && wrapQ(engineBuilderLinuxVMCommercialPath() & "/build-linux.lnx >" && engineBuilderLogFolderLinuxVM() & "/build_linux.log" && "2>" && engineBuilderLogFolderLinuxVM() & "/error_linux.log") into tCommand
get shell(tCommand)
if it contains "error" then
builderLog "report", "Error building Linux engines:" && it
throw "failure"
end if
builderLog "message", "Linux compile result..."
builderLog "message", URL ("file:" & engineBuilderLogFolder() & "/error_linux.log")
builderLog "message", "Suspending VM..."
put wrapQ(engineBuilderVMRunPath()) && "-T fusion suspend" && wrapQ(engineBuilderLinuxVMPath()) into tCommand
get shell(tCommand)
if it contains "error" then
builderLog "report", "Error suspending VM:" && it
throw "failure"
end if
builderLog "report", "Building Linux complete."
end engineBuilderBuildLinux
private command engineBuilderBuildWindows pEdition, pVersion
exit engineBuilderBuildWindows
builderLog "report", "Building Windows engines..."
put empty into URL ("file:" & engineBuilderLogFolder() & "/error_windows.log")
local tCommand
put wrapQ(engineBuilderVMRunPath()) && "-T fusion -gu administrator -gp runlog runScriptInGuest" && wrapQ(engineBuilderWindowsVMPath()) && wrapQ() && "cmd.exe /k \" & wrapQ(engineBuilderWindowsVMCommercialPath() & "/build-windows.bat" && pVersion && builderBuildsFolder()) into tCommand
get shell(tCommand)
if it is not empty then
builderLog "report", "Error building Windows engines:" && it
throw "failure"
else
builderLog "message", "Windows build result..."
builderLog "message", URL ("file:" & engineBuilderLogFolder() & "/error_windows.log")
builderLog "report", "Building Windows complete."
end if
end engineBuilderBuildWindows
---------------------------------------------------------------------
private command engineBuilderBuildEnvironment pEdition, pVersion
builderLog "report", "Configuring commercial environment stack..."
builderLog "message", "Fetching public key..."
local tPostDataArray
put pVersion into tPostDataArray["version"]
put "jobbies123!" into tPostDataArray["password"]
local tPostData
repeat for each line tKey in the keys of tPostDataArray
put "&" & tKey & "=" & urlencode(tPostDataArray[tKey]) after tPostData
end repeat
delete the first char of tPostData
local tResult
post tPostData to URL "http://livecode.com/livecode/building/fetch_key"
put the result into tResult
if the result is not empty then
builderLog "report", "Error fetching public key for version" && pVersion & ":" && tResult
throw "failure"
end if
local tPubKey
put line 2 to -1 of it into tPubKey
if line 1 of it is not "success" then
builderLog "report", "Error fetching public key for version" && pVersion & ":" && line 2 to -1 of it
throw "failure"
end if
builderLog "message", "New public key for version" && pVersion & "..."
builderLog "message", tPubKey
builderLog "message", "Writing public key to stack..."
local tKeyFile
put the tempName into tKeyFile
put tPubKey into URL ("binfile:" & tKeyFile)
get shell(builderSystemFolder() & "/public_key_setter -ui" && builderCommercialFolder() & "/src/environment.livecode" && tKeyFile)
builderLog "message", it
delete file tKeyFile
builderLog "report", "Commercial environment stack configured."
end engineBuilderBuildEnvironment
---------------------------------------------------------------------
command engineBuilderRun pPlatform, pEdition, pVersion
builderEnsureFolder engineBuilderLogFolder()
switch pPlatform
case "environment"
engineBuilderBuildEnvironment pEdition, pVersion
break
case "mac"
engineBuilderBuildMac pEdition, pVersion
break
case "linux"
engineBuilderBuildLinux pEdition, pVersion
break
case "windows"
engineBuilderBuildWindows pEdition, pVersion
break
case "android"
engineBuilderBuildAndroid pEdition, pVersion
break
case "ios"
engineBuilderBuildiOS pEdition, pVersion
break
end switch
end engineBuilderRun
---------------------------------------------------------------------