-
Notifications
You must be signed in to change notification settings - Fork 3
/
makeall-palmos.wsf
227 lines (205 loc) · 8.5 KB
/
makeall-palmos.wsf
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
227
' $Id: makeall-palmos.wsf,v 1.28 2003-05-12 10:23:08 pgr Exp $
<job id="IRexxMakefile4PalmOS">
<?job error="false" debug="false"?>
<description>
A WSH as a WSF that automates CodeWarrior and makes IRexx for Palm OS.
It is best to invoke this using cscript, e.g.,
cscript makeall-palmos.wsf /h:d:\...\yaxx
</description>
<reference object="CodeWarrior.CodeWarriorApp"/>
<runtime>
<named
name="h"
helpstring="The home of the IRexx directory. Must be absolute."
type="string"
required="true"/>
<named
name="d"
helpstring="Build debug target? Default is yes (+)."
type="boolean"
required="false"/>
<named
name="r"
helpstring="Build release target? Default is yes (+)."
type="boolean"
required="false"/>
<named
name="dx"
helpstring="Build debug XML target? Default is yes (+)."
type="boolean"
required="false"/>
<named
name="rx"
helpstring="Build release XML target? Default is yes (+)."
type="boolean"
required="false"/>
<named
name="c"
helpstring="Do a clean build? Default is yes (+)."
type="boolean"
required="false"/>
<named
name="e"
helpstring="Stop on errors? Default is yes (+)."
type="boolean"
required="false"/>
<named
name="w"
helpstring="Close CW when done? Default is no (-)."
type="boolean"
required="false"/>
<named
name="k"
helpstring="Keep all projects opened? Default is yes (+)."
type="boolean"
required="false"/>
<named
name="s"
helpstring="Build SGML libs? Default is yes (+)."
type="boolean"
required="false"/>
</runtime>
<script language="VBScript">
option explicit
dim codewarrior
dim irexxhome
dim closeWhenDone
dim keepProjectOpen
dim targetRelease
dim targetDebug
dim targetReleaseXML
dim targetDebugXML
dim doClean
dim doSGML
dim stopOnErrors
Sub LogMessages(messages)
dim errCollection
dim errMsg, errCount
Dim i, eplurality, fplurality
if messages is nothing then exit sub
eplurality = ""
fplurality = "s"
Set errCollection = messages.Errors
errCount = errCollection.Count
if errCount = 0 then exit sub
if errCount > 1 then
eplurality = "s"
fplurality = ""
end if
Wscript.echo ""
wscript.echo "******* [errors] " & errCount & " error message" & eplurality & " follow" & fplurality
for i = 0 to errCount - 1
Set errMsg = errCollection.Item(i)
Wscript.echo errMsg.MessageText
next
wscript.echo ""
if stopOnErrors then WScript.Quit (1)
End Sub
Sub build(projectname)
dim project
dim messages
dim currentTarget
Set project = codewarrior.OpenProject(projectname, true, kCWConvertNo, kCWDonotRevertPanel)
if project is Nothing then
Wscript.echo "Could not open project " & projectname
Wscript.echo "Exiting..."
if closeWhenDone then codewarrior.quit kCWSaveNone
WScript.Quit (206004)
end if
Set currentTarget = project.GetCurrentTarget()
if targetDebug then
project.SetCurrentTarget "Debug"
if doClean then
Wscript.echo "------- [clean] " & projectname
project.RemoveObjectCode kCurrentTarget, true
end if
Wscript.echo "------- [debug] " & projectname
Set messages = project.BuildAndWaitToComplete
LogMessages messages
end if
if targetRelease then
project.SetCurrentTarget "Release"
if doClean then
Wscript.echo "------- [clean] " & projectname
project.RemoveObjectCode kCurrentTarget, true
end if
Wscript.echo "------- [release] " & projectname
Set messages = project.BuildAndWaitToComplete
LogMessages messages
end if
if targetDebugXML then
project.SetCurrentTarget "Debug XML"
if doClean then
Wscript.echo "------- [clean] " & projectname
project.RemoveObjectCode kCurrentTarget, true
end if
Wscript.echo "------- [debug XML] " & projectname
Set messages = project.BuildAndWaitToComplete
LogMessages messages
end if
if targetReleaseXML then
project.SetCurrentTarget "Release XML"
if doClean then
Wscript.echo "------- [clean] " & projectname
project.RemoveObjectCode kCurrentTarget, true
end if
Wscript.echo "------- [release XML] " & projectname
Set messages = project.BuildAndWaitToComplete
LogMessages messages
end if
project.SetCurrentTarget currentTarget.Name
if not keepProjectOpen then
Wscript.echo "------- [close] " & projectname
project.close
end if
End Sub
' TODO: Should use IREXXHOME environment variable or CD if parm not set.
if not WScript.Arguments.Named.Exists("h") then
Wscript.Arguments.ShowUsage
Wscript.Quit (100)
end if
irexxhome = WScript.Arguments.Named.Item("h")
targetDebug = true
if WScript.Arguments.Named.Exists("d") then targetDebug = WScript.Arguments.Named.Item("d")
targetRelease = true
if WScript.Arguments.Named.Exists("r") then targetRelease = WScript.Arguments.Named.Item("r")
targetDebugXML = false
if WScript.Arguments.Named.Exists("dx") then targetDebugXML = WScript.Arguments.Named.Item("dx")
targetReleaseXML = false
if WScript.Arguments.Named.Exists("rx") then targetReleaseXML = WScript.Arguments.Named.Item("rx")
doClean = true
if WScript.Arguments.Named.Exists("c") then doClean = WScript.Arguments.Named.Item("c")
stopOnErrors = true
if WScript.Arguments.Named.Exists("e") then stopOnErrors = WScript.Arguments.Named.Item("e")
closeWhenDone = false
if WScript.Arguments.Named.Exists("w") then closeWhenDone = WScript.Arguments.Named.Item("w")
keepProjectOpen = true
if WScript.Arguments.Named.Exists("k") then keepProjectOpen = WScript.Arguments.Named.Item("k")
doSGML = true
if WScript.Arguments.Named.Exists("s") then doSGML = WScript.Arguments.Named.Item("s")
Set codewarrior = CreateObject("CodeWarrior.CodeWarriorApp")
codewarrior.Visible = false
codewarrior.AllowUserInteraction = false
build irexxhome & "\mwerks\decnblib\decnblib.mcp"
build irexxhome & "\mwerks\palmiolib\palmiolib.mcp"
build irexxhome & "\mwerks\toolslib\toolslib1.mcp"
build irexxhome & "\mwerks\toolslib\toolslib2.mcp"
build irexxhome & "\mwerks\rexxlib\rexxlib-misc.mcp"
build irexxhome & "\mwerks\rexxlib\rexxlib-builtin.mcp"
build irexxhome & "\mwerks\rexxlib\rexxlib-compiler.mcp"
build irexxhome & "\mwerks\rexxlib\rexxlib-interpreter.mcp"
build irexxhome & "\mwerks\rexxlib\rexxlib-rexxstring.mcp"
build irexxhome & "\mwerks\rexxlib\rexxlib-routinesvar.mcp"
if doSGML then
build irexxhome & "\mwerks\yasp3lib\yasp3lib.mcp"
build irexxhome & "\mwerks\yasp3lib\yasp3lib-element.mcp"
build irexxhome & "\mwerks\yasp3lib\yasp3lib-entity.mcp"
build irexxhome & "\mwerks\yasp3lib\yasp3lib-model.mcp"
build irexxhome & "\mwerks\yasp3lib\yasp3lib-parser1.mcp"
build irexxhome & "\mwerks\yasp3lib\yasp3lib-parser2.mcp"
build irexxhome & "\mwerks\yasp3lib\yasp3lib-syntax.mcp"
end if
codewarrior.AllowUserInteraction = true
if closeWhenDone then codewarrior.quit kCWSaveNone
</script>
</job>