Skip to content

Commit 82998c7

Browse files
committed
[[ ScriptifiedStacks ]] Normalized line endings.
1 parent 8deb5c6 commit 82998c7

5 files changed

Lines changed: 3541 additions & 5 deletions
Lines changed: 238 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,238 @@
1-
script "revDeployLibrary"////////////////////////////////////////////////////////////////////////////////-- A stack can be configured to be deployable to any number of different platforms.-- This presents a usability problem when switching between stacks configured for-- different platforms.-- To resolve this, we keep track of the last selected target for each platform and the-- order in which other platforms were last selected.-- The 'Test Target' menu disables all targets for which the current stack is not-- configured for.-- The current 'Test Target' is determined to be the first platform in the platform choice-- history for which the stack is configured. This is then used to pick the last chosen-- target for this platform.constant kSupportedPlatforms = "iOS Android"-- The mapping from deploy target to platformlocal sDeployTargetPlatforms-- The currently chosen deploy target for each platformlocal sDeployTargets-- The ordered list of platforms, in order of last choicelocal sDeployPlatforms-- Used to stop DeployAction being executed inside itselflocal sDeployActionInProgress-- This method is invoked by the menu bar when the user elects to test the-- current stack.command revIDEDeployAction if sDeployActionInProgress then exit revIDEDeployAction end if -- Get the stack we are dealing with local tStack put the mainStack of the topStack into tStack -- Make sure we save the stack if it needs it set the defaultStack to tStack if not revSaveCheck(tStack) then exit revIDEDeployAction end if -- Get the target local tTarget put revIDEDeployGetTarget() into tTarget -- Get the target platform local tPlatform put sDeployTargetPlatforms[tTarget] into tPlatform put true into sDeployActionInProgress -- Invoke the action in the appropriate platform-specific library local tError if there is a button tPlatform of me then dispatch "deployDo" to button tPlatform of me with tStack, tTarget put the result into tError else put "Unknown deployment platform - " & tPlatform into tError end if -- Report an error if one occured if tError is not empty then if revTestEnvironment() then return tError else answer error tError end if end if put false into sDeployActionInProgressend revIDEDeployAction-- This method is invoked (currently) by the standalone builder to deploy a mobile-- platform (not currently used as more work is needed to extricate standalone-- building from the standalone settings main stack).command revIDEDeployBuild pPlatform, pTargetStack, pOutputFolder -- Make sure we are dealing with main stack put the mainStack of stack pTargetStack into pTargetStack -- Dispatch the action to the platform-specific library dispatch "deployBuild" to button pPlatform of me with pTargetStack, pOutputFolderend revIDEDeployBuild-- This method is invoked by the menu bar to construct the current list of targets.-- It returns an array, one element per platform; each element consisting of the list-- of possible targets.function revIDEDeployListTargets local tTargets repeat for each word tPlatform in kSupportedPlatforms dispatch function "deployListTargets" to button tPlatform of me if it is "handled" and the result is not empty then put the result into tTargets[tPlatform] end if end repeat return tTargetsend revIDEDeployListTargets-- This method is invoked by the menu bar when the user selects a different deploy-- target.command revIDEDeploySetTarget pTarget local tPlatform put sDeployTargetPlatforms[pTarget] into tPlatform delete item itemOffset(tPlatform, sDeployPlatforms) of sDeployPlatforms put tPlatform, sDeployPlatforms into sDeployPlatforms put pTarget into sDeployTargets[tPlatform] set the cDeployPlatforms of stack "revPreferences" to sDeployPlatforms set the cDeployTargets of stack "revPreferences" to sDeployTargets revIDEDeployUpdateend revIDEDeploySetTarget-- This method returns the current target of the 'Deploy' action.function revIDEDeployGetTarget if the mode of the topStack is 1 then local tStack put the mainStack of the topStack into tStack repeat for each item tPlatform in sDeployPlatforms if the cRevStandaloneSettings[tPlatform] of stack tStack then return sDeployTargets[tPlatform] end if end repeat end if return emptyend revIDEDeployGetTarget-- This method returns true if deployment is possible with the given platform to the-- current top stackfunction revIDEDeployIsPossible pPlatform if the mode of the topStack is not 1 then return false end if local tStack put the mainStack of the topStack into tStack return the cRevStandaloneSettings[pPlatform] of stack tStackend revIDEDeployIsPossible-- This method updates the enable state of the 'Test' button on the menubar based on-- the current topStack.command revIDEDeployUpdate -- Enable the deploy button appropriately set the enabled of button "Deploy" of stack "revMenuBar" to revIDEDeployGetTarget() is not emptyend revIDEDeployUpdate-- This method is called on startup to initialize the deployment library. This includes-- attempting to auto-configure any SDKs and such if necessary.command revIDEDeployInitialize repeat for each word tPlatform in kSupportedPlatforms dispatch command "deployInitialize" to button tPlatform of me end repeat local tDeployPlatforms, tDeployTargets put the cDeployPlatforms of stack "revPreferences" into tDeployPlatforms put the cDeployTargets of stack "revPreferences" into tDeployTargets if tDeployPlatforms is not empty then put tDeployPlatforms into sDeployPlatforms put tDeployTargets into sDeployTargets else if the cSimulatorFamily of stack "revPreferences" is not empty then put "ios," into sDeployPlatforms put the cSimulatorFamily of stack "revPreferences" && "Simulator" && the cSimulatorVersion of stack "revPreferences" into sDeployTargets["ios"] end ifend revIDEDeployInitializeon revIDEDeployTargetsChanged put empty into sDeployTargetPlatforms repeat for each word tPlatform in kSupportedPlatforms dispatch function "deployListTargets" to button tPlatform of me if it is "handled" and the result is not empty then repeat for each line tTarget in the result put tPlatform into sDeployTargetPlatforms[tTarget] end repeat end if end repeatend revIDEDeployTargetsChanged//////////////////////////////////////////////////////////////////////////////////// Preferences require access to various specific aspects of deployment config, so these// calls provide this in a sane manner.//function revIDEDeployIOSIsValidSDK pVersion, pPath dispatch function "deployIsValidSDK" to button "iOS" of me with pVersion, pPath return the resultend revIDEDeployIOSIsValidSDKfunction revIDEDeployIOSGetSimulatorVersions dispatch function "deployGetSimulatorVersions" to button "iOS" of me return the resultend revIDEDeployIOSGetSimulatorVersionsfunction revIDEDeployIOSGetSDKVersions dispatch function "deployGetSDKVersions" to button "iOS" of me return the resultend revIDEDeployIOSGetSDKVersionscommand revIDEDeployIOSUpdateSimulators dispatch "deployUpdateSimulators" to button "iOS" of meend revIDEDeployIOSUpdateSimulatorscommand revIDEDeployIOSUpdateSDKs dispatch "deployUpdateSDKs" to button "iOS" of meend revIDEDeployIOSUpdateSDKsfunction revIDEDeployIOSGetDeviceSDK pVersion dispatch function "deployGetDeviceSDK" to button "iOS" of me with pVersion return the resultend revIDEDeployIOSGetDeviceSDK//////////////////////////////////////////////////////////////////////////////////// Preferences require access to various specific aspects of deployment config, so these// calls provide this in a sane manner.//function revIDEDeployAndroidIsValidSDK pPath dispatch function "deployIsValidSDK" to button "Android" of me with pPath return the resultend revIDEDeployAndroidIsValidSDKfunction revIDEDeployAndroidIsValidJDK pPath dispatch function "deployIsValidJDK" to button "Android" of me with pPath return the resultend revIDEDeployAndroidIsValidJDKfunction revIDEDeployAndroidGetJDK dispatch function "deployGetJDK" to button "Android" of me return the resultend revIDEDeployAndroidGetJDKcommand revIDEDeployAndroidInitialize dispatch "deployInitialize" to button "Android" of meend revIDEDeployAndroidInitialize////////////////////////////////////////////////////////////////////////////////
1+
script "revDeployLibrary"
2+
////////////////////////////////////////////////////////////////////////////////
3+
4+
-- A stack can be configured to be deployable to any number of different platforms.
5+
-- This presents a usability problem when switching between stacks configured for
6+
-- different platforms.
7+
-- To resolve this, we keep track of the last selected target for each platform and the
8+
-- order in which other platforms were last selected.
9+
-- The 'Test Target' menu disables all targets for which the current stack is not
10+
-- configured for.
11+
-- The current 'Test Target' is determined to be the first platform in the platform choice
12+
-- history for which the stack is configured. This is then used to pick the last chosen
13+
-- target for this platform.
14+
15+
constant kSupportedPlatforms = "iOS Android"
16+
17+
-- The mapping from deploy target to platform
18+
local sDeployTargetPlatforms
19+
20+
-- The currently chosen deploy target for each platform
21+
local sDeployTargets
22+
-- The ordered list of platforms, in order of last choice
23+
local sDeployPlatforms
24+
25+
-- Used to stop DeployAction being executed inside itself
26+
local sDeployActionInProgress
27+
28+
-- This method is invoked by the menu bar when the user elects to test the
29+
-- current stack.
30+
command revIDEDeployAction
31+
if sDeployActionInProgress then
32+
exit revIDEDeployAction
33+
end if
34+
35+
-- Get the stack we are dealing with
36+
local tStack
37+
put the mainStack of the topStack into tStack
38+
39+
-- Make sure we save the stack if it needs it
40+
set the defaultStack to tStack
41+
if not revSaveCheck(tStack) then
42+
exit revIDEDeployAction
43+
end if
44+
45+
-- Get the target
46+
local tTarget
47+
put revIDEDeployGetTarget() into tTarget
48+
49+
-- Get the target platform
50+
local tPlatform
51+
put sDeployTargetPlatforms[tTarget] into tPlatform
52+
53+
put true into sDeployActionInProgress
54+
55+
-- Invoke the action in the appropriate platform-specific library
56+
local tError
57+
if there is a button tPlatform of me then
58+
dispatch "deployDo" to button tPlatform of me with tStack, tTarget
59+
put the result into tError
60+
else
61+
put "Unknown deployment platform - " & tPlatform into tError
62+
end if
63+
64+
-- Report an error if one occured
65+
if tError is not empty then
66+
if revTestEnvironment() then
67+
return tError
68+
else
69+
answer error tError
70+
end if
71+
end if
72+
73+
put false into sDeployActionInProgress
74+
end revIDEDeployAction
75+
76+
-- This method is invoked (currently) by the standalone builder to deploy a mobile
77+
-- platform (not currently used as more work is needed to extricate standalone
78+
-- building from the standalone settings main stack).
79+
command revIDEDeployBuild pPlatform, pTargetStack, pOutputFolder
80+
-- Make sure we are dealing with main stack
81+
put the mainStack of stack pTargetStack into pTargetStack
82+
83+
-- Dispatch the action to the platform-specific library
84+
dispatch "deployBuild" to button pPlatform of me with pTargetStack, pOutputFolder
85+
end revIDEDeployBuild
86+
87+
-- This method is invoked by the menu bar to construct the current list of targets.
88+
-- It returns an array, one element per platform; each element consisting of the list
89+
-- of possible targets.
90+
function revIDEDeployListTargets
91+
local tTargets
92+
repeat for each word tPlatform in kSupportedPlatforms
93+
dispatch function "deployListTargets" to button tPlatform of me
94+
if it is "handled" and the result is not empty then
95+
put the result into tTargets[tPlatform]
96+
end if
97+
end repeat
98+
return tTargets
99+
end revIDEDeployListTargets
100+
101+
-- This method is invoked by the menu bar when the user selects a different deploy
102+
-- target.
103+
command revIDEDeploySetTarget pTarget
104+
local tPlatform
105+
put sDeployTargetPlatforms[pTarget] into tPlatform
106+
delete item itemOffset(tPlatform, sDeployPlatforms) of sDeployPlatforms
107+
put tPlatform, sDeployPlatforms into sDeployPlatforms
108+
put pTarget into sDeployTargets[tPlatform]
109+
set the cDeployPlatforms of stack "revPreferences" to sDeployPlatforms
110+
set the cDeployTargets of stack "revPreferences" to sDeployTargets
111+
revIDEDeployUpdate
112+
end revIDEDeploySetTarget
113+
114+
-- This method returns the current target of the 'Deploy' action.
115+
function revIDEDeployGetTarget
116+
if the mode of the topStack is 1 then
117+
local tStack
118+
put the mainStack of the topStack into tStack
119+
repeat for each item tPlatform in sDeployPlatforms
120+
if the cRevStandaloneSettings[tPlatform] of stack tStack then
121+
return sDeployTargets[tPlatform]
122+
end if
123+
end repeat
124+
end if
125+
126+
return empty
127+
end revIDEDeployGetTarget
128+
129+
-- This method returns true if deployment is possible with the given platform to the
130+
-- current top stack
131+
function revIDEDeployIsPossible pPlatform
132+
if the mode of the topStack is not 1 then
133+
return false
134+
end if
135+
136+
local tStack
137+
put the mainStack of the topStack into tStack
138+
return the cRevStandaloneSettings[pPlatform] of stack tStack
139+
end revIDEDeployIsPossible
140+
141+
-- This method updates the enable state of the 'Test' button on the menubar based on
142+
-- the current topStack.
143+
command revIDEDeployUpdate
144+
-- Enable the deploy button appropriately
145+
set the enabled of button "Deploy" of stack "revMenuBar" to revIDEDeployGetTarget() is not empty
146+
end revIDEDeployUpdate
147+
148+
-- This method is called on startup to initialize the deployment library. This includes
149+
-- attempting to auto-configure any SDKs and such if necessary.
150+
command revIDEDeployInitialize
151+
repeat for each word tPlatform in kSupportedPlatforms
152+
dispatch command "deployInitialize" to button tPlatform of me
153+
end repeat
154+
155+
local tDeployPlatforms, tDeployTargets
156+
put the cDeployPlatforms of stack "revPreferences" into tDeployPlatforms
157+
put the cDeployTargets of stack "revPreferences" into tDeployTargets
158+
if tDeployPlatforms is not empty then
159+
put tDeployPlatforms into sDeployPlatforms
160+
put tDeployTargets into sDeployTargets
161+
else if the cSimulatorFamily of stack "revPreferences" is not empty then
162+
put "ios," into sDeployPlatforms
163+
put the cSimulatorFamily of stack "revPreferences" && "Simulator" && the cSimulatorVersion of stack "revPreferences" into sDeployTargets["ios"]
164+
end if
165+
end revIDEDeployInitialize
166+
167+
on revIDEDeployTargetsChanged
168+
put empty into sDeployTargetPlatforms
169+
repeat for each word tPlatform in kSupportedPlatforms
170+
dispatch function "deployListTargets" to button tPlatform of me
171+
if it is "handled" and the result is not empty then
172+
repeat for each line tTarget in the result
173+
put tPlatform into sDeployTargetPlatforms[tTarget]
174+
end repeat
175+
end if
176+
end repeat
177+
end revIDEDeployTargetsChanged
178+
179+
////////////////////////////////////////////////////////////////////////////////
180+
//
181+
// Preferences require access to various specific aspects of deployment config, so these
182+
// calls provide this in a sane manner.
183+
//
184+
185+
function revIDEDeployIOSIsValidSDK pVersion, pPath
186+
dispatch function "deployIsValidSDK" to button "iOS" of me with pVersion, pPath
187+
return the result
188+
end revIDEDeployIOSIsValidSDK
189+
190+
function revIDEDeployIOSGetSimulatorVersions
191+
dispatch function "deployGetSimulatorVersions" to button "iOS" of me
192+
return the result
193+
end revIDEDeployIOSGetSimulatorVersions
194+
195+
function revIDEDeployIOSGetSDKVersions
196+
dispatch function "deployGetSDKVersions" to button "iOS" of me
197+
return the result
198+
end revIDEDeployIOSGetSDKVersions
199+
200+
command revIDEDeployIOSUpdateSimulators
201+
dispatch "deployUpdateSimulators" to button "iOS" of me
202+
end revIDEDeployIOSUpdateSimulators
203+
204+
command revIDEDeployIOSUpdateSDKs
205+
dispatch "deployUpdateSDKs" to button "iOS" of me
206+
end revIDEDeployIOSUpdateSDKs
207+
208+
function revIDEDeployIOSGetDeviceSDK pVersion
209+
dispatch function "deployGetDeviceSDK" to button "iOS" of me with pVersion
210+
return the result
211+
end revIDEDeployIOSGetDeviceSDK
212+
213+
////////////////////////////////////////////////////////////////////////////////
214+
//
215+
// Preferences require access to various specific aspects of deployment config, so these
216+
// calls provide this in a sane manner.
217+
//
218+
219+
function revIDEDeployAndroidIsValidSDK pPath
220+
dispatch function "deployIsValidSDK" to button "Android" of me with pPath
221+
return the result
222+
end revIDEDeployAndroidIsValidSDK
223+
224+
function revIDEDeployAndroidIsValidJDK pPath
225+
dispatch function "deployIsValidJDK" to button "Android" of me with pPath
226+
return the result
227+
end revIDEDeployAndroidIsValidJDK
228+
229+
function revIDEDeployAndroidGetJDK
230+
dispatch function "deployGetJDK" to button "Android" of me
231+
return the result
232+
end revIDEDeployAndroidGetJDK
233+
234+
command revIDEDeployAndroidInitialize
235+
dispatch "deployInitialize" to button "Android" of me
236+
end revIDEDeployAndroidInitialize
237+
238+
////////////////////////////////////////////////////////////////////////////////

0 commit comments

Comments
 (0)