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 pathbuilder_tool.livecodescript
More file actions
207 lines (177 loc) · 7.11 KB
/
builder_tool.livecodescript
File metadata and controls
207 lines (177 loc) · 7.11 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
script "Command Line Builder"
local sWarnAsError
local sDebug -- True if the builder should run in debugging mode
on startup
set the itemdelimiter to slash
start using stack (item 1 to -2 of the filename of me & slash & "builder_utilities.livecodescript")
start using stack (item 1 to -2 of the filename of me & slash & "edition_utilities.livecodescript")
set the itemDelimiter to comma
__loadExternal "revzip"
__loadExternal "revxml"
__loadExternal "revdb"
put false into sWarnAsError
put ($BUILDER_DEBUG is not empty) into sDebug
local tArgs, tArgIndex
repeat with tArgIndex = 1 to $# - 1
put value("$" & tArgIndex) into tArgs[tArgIndex]
end repeat
local tPlatforms, tStage, tEdition, tBuild
put empty into tPlatforms
put "tools" into tStage
put "community" into tEdition
put "stable" into tBuild
local tEngineDir, tPrivateDir, tOutputDir, tWorkDir, tDocsDir, tBuiltDocsDir, tArch
put 1 into tArgIndex
repeat while tArgIndex is among the keys of tArgs
if tArgs[tArgIndex] is "--platform" then
get tArgs[tArgIndex + 1]
if it is not among the items of "windows,win,win-x86,win-x86_64,macosx,mac,linux,linux-x86,linux-x86_64,universal" then
__builderLog "error", "Unknown platform '" & tArgs[tArgIndex + 1] & "'"
end if
-- Hack the arch from the platform. This should really use
-- triples.
set the itemdelimiter to "-"
put item -1 of it into tArch
set the itemdelimiter to comma
if it is "linux" then
put true into tPlatforms["linux-x86"]
put true into tPlatforms["linux-x86_64"]
else if it is "win" then
put true into tPlatforms["win-x86"]
put true into tPlatforms["win-x86_64"]
else
if it is "mac" then get "macosx"
put true into tPlatforms[it]
end if
add 1 to tArgIndex
else if tArgs[tArgIndex] is "--stage" then
if tArgs[tArgIndex + 1] is not among the items of "environment,tools,bundle,server,notes,docs,disk,guide,fmpackage" then
__builderLog "error", "Unknown stage '" & tArgs[tArgIndex + 1] & "'"
end if
put tArgs[tArgIndex + 1] into tStage
add 1 to tArgIndex
else if tArgs[tArgIndex] is "--edition" then
if tArgs[tArgIndex + 1] is not among the items of editionNames() then
__builderLog "error", "Unknown edition '" & tArgs[tArgIndex + 1] & "'"
end if
put tArgs[tArgIndex + 1] into tEdition
add 1 to tArgIndex
else if tArgs[tArgIndex] is "--build" then
if tArgs[tArgIndex + 1] is not among the items of "stable,maintenance,development,beta" then
__builderLog "error", "Unknown build '" & tArgs[tArgIndex + 1] & "'"
end if
put tArgs[tArgIndex + 1] into tBuild
add 1 to tArgIndex
else if tArgs[tArgIndex] is "--engine-dir" or tArgs[tArgIndex] is "--input-dir" then
if tArgs[tArgIndex + 1] is empty then
__builderLog "error", "No path specified for --engine-dir argument"
end if
put tArgs[tArgIndex + 1] into tEngineDir
add 1 to tArgIndex
else if tArgs[tArgIndex] is "--private-dir" then
if tArgs[tArgIndex + 1] is empty then
__builderLog "error", "No path specified for --private-dir argument"
end if
put tArgs[tArgIndex + 1] into tPrivateDir
add 1 to tArgIndex
else if tArgs[tArgIndex] is "--output-dir" then
if tArgs[tArgIndex + 1] is empty then
__builderLog "error", "No path specified for --output-dir argument"
end if
put tArgs[tArgIndex + 1] into tOutputDir
add 1 to tArgIndex
else if tArgs[tArgIndex] is "--work-dir" then
if tArgs[tArgIndex + 1] is empty then
__builderLog "error", "No path specified for --work-dir argument"
end if
put tArgs[tArgIndex + 1] into tWorkDir
add 1 to tArgIndex
else if tArgs[tArgIndex] is "--docs-dir" then
if tArgs[tArgIndex + 1] is empty then
__builderLog "error", "No path specified for --docs-dir argument"
end if
put tArgs[tArgIndex + 1] into tDocsDir
add 1 to tArgIndex
else if tArgs[tArgIndex] is "--built-docs-dir" then
if tArgs[tArgIndex + 1] is empty then
__builderLog "error", "No path specified for --built-docs-dir argument"
end if
put tArgs[tArgIndex + 1] into tBuiltDocsDir
add 1 to tArgIndex
else if tArgs[tArgIndex] is "--warn-as-error" then
put true into sWarnAsError
else if tArgs[tArgIndex] is "--debug" then
put true into sDebug
end if
add 1 to tArgIndex
end repeat
if the keys of tPlatforms is empty and tStage is "tools" then
__builderLog "error", "No platforms specified"
end if
if tEdition is "commercial" and tStage is not "server" then
__builderLog "error", "Commercial is only a valid edition for server packages"
end if
if tStage is "environment" then
put empty into tPlatforms
put true into tPlatforms["environment"]
put "engine" into tStage
end if
set the name of this stack to "Builder"
if tArch is not empty then
builderSetTargetArch tArch
end if
if tEngineDir is not empty then
builderSetEngineDir tEngineDir
end if
if tPrivateDir is not empty then
builderSetPrivateDir tPrivateDir
end if
if tOutputDir is not empty then
builderSetOutputDir tOutputDir
end if
if tWorkDir is not empty then
builderSetWorkDir tWorkDir
end if
if tDocsDir is not empty then
builderSetDocsDir tDocsDir
end if
if tBuiltDocsDir is not empty then
builderSetBuiltDocsDir tBuiltDocsDir
end if
builderBuild tStage, the keys of tPlatforms, tEdition, tBuild
quit 0
end startup
command __loadExternal pExternal
set the itemdelimiter to slash
if the platform is "MacOS" then
set the externals of the templateStack to item 1 to -4 of specialFolderPath("engine") & slash & pExternal & ".bundle"
else if the platform is "linux" then
set the externals of the templateStack to specialFolderPath("engine") & slash & pExternal & ".so"
end if
create stack pExternal && "External"
start using it
if the externalCommands of it is empty then
__builderLog "error", "Cannot load external" && pExternal
end if
end __loadExternal
command __builderLog pType, pMessage
local tLine
if pType is "debug" and not sDebug then
exit __builderLog
end if
-- Promote builder warnings to errors, if requested
if pType is "warning" and sWarnAsError then
put "error" into pType
end if
put toUpper(char 1 of pType) into char 1 of pType
repeat for each line tLine in pMessage
write ("[" && the internet date && "]" && ":" && pType && ":" && tLine & return) to stderr
end repeat
if pType is "error" then
quit 1
end if
end __builderLog
on errorDialog pBacktrace
write pBacktrace & return to stderr
quit 1
end errorDialog