Skip to content
This repository was archived by the owner on Aug 31, 2021. It is now read-only.

Commit 8a22cde

Browse files
committed
[[ ModuleAssemblies ]] Ensure build scripts can handle multi-module assemblies
1 parent c93a529 commit 8a22cde

File tree

1 file changed

+36
-2
lines changed

1 file changed

+36
-2
lines changed

util/package_extension.livecodescript

Lines changed: 36 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ command extractDocs pEnginePath, pExtractScript, pDocsParser, pSourceFolder, pSo
5252
end if
5353
end extractDocs
5454

55-
private command packageExtension pExtensionName, pSourceFolder, pSourceFileName, pTargetFolder, pRemoveSource
55+
private command packageExtension pExtensionName, pSourceFolder, pSourceFileName, pTargetFolder, pRemoveSource, pSupportFiles
5656
local tTargetDir, tBuildTarget, tZip
5757
put pExtensionName into tTargetDir
5858
put pTargetFolder & slash & tTargetDir into tBuildTarget
@@ -71,6 +71,10 @@ private command packageExtension pExtensionName, pSourceFolder, pSourceFileName,
7171
if pRemoveSource is "true" then
7272
put return & "rm" && q(tBuildTarget & slash & pSourceFileName) \
7373
after tShell
74+
repeat for each line tSupport in tSupportFiles
75+
put return & "rm" && q(tBuildTarget & slash & tSupport) \
76+
after tShell
77+
end repeat
7478
end if
7579

7680
write "packaging extension" && pSourceFileName & return to stdout
@@ -90,13 +94,43 @@ command packageScriptExtension pSourceFolder, pSourceFileName, pTargetFolder, pR
9094
pSourceFolder, pSourceFileName, pTargetFolder, pRemoveSource
9195
end packageScriptExtension
9296

97+
private function getSupportFiles pSourceFolder, pSourceFileName, pExtension
98+
local tSupportFiles, tBase
99+
set the itemdelimiter to "."
100+
put item 1 to -2 of pSourceFileName into tBase
101+
put files(pSourceFolder) into tSupportFiles
102+
filter tSupportFiles with tBase & "-*." & pExtension
103+
return tSupportFiles
104+
end getSupportFiles
105+
93106
command packageBuilderExtension pSourceFolder, pSourceFileName, pTargetFolder, pRemoveSource, pLCCompile, pInterfaceFolder
94107
local tCompileShell
95108
put q(pLCCompile) into tCompileShell
96109
put " -Werror" after tCompileShell
97110
put " --modulepath" && q(pInterfaceFolder) after tCompileShell
98111
put " --manifest" && q(pSourceFolder & slash & "manifest.xml") after tCompileShell
99112
put " --output" && q(pSourceFolder & slash & "module.lcm") after tCompileShell
113+
114+
-- Multi-module assemblies must be in reverse dependency order
115+
local tSupportFiles, tSupportDepsOrder, tDepsShell
116+
put getSupportFiles(pSourceFolder, pSourceFileName, "lcb") into tSupportFiles
117+
118+
if tSupportFiles is not empty then
119+
put q(pLCCompile) into tDepsShell
120+
put " --deps order" after tDepsShell
121+
repeat for each line tSupportModule in tSupportFiles
122+
put " " & q(pSourceFolder & slash & tSupportModule) after tDepsShell
123+
end repeat
124+
125+
put shell(tDepsShell) into tSupportDepsOrder
126+
if the result is not 0 then
127+
write "subprocess error when finding support deps order for" && pSourceFileName & ":" && tSupportDepsOrder to stderr
128+
quit 3
129+
end if
130+
replace return with space in tSupportDepsOrder
131+
put " " & tSupportDepsOrder after tCompileShell
132+
end if
133+
100134
put " " & q(pSourceFolder & slash & pSourceFileName) after tCompileShell
101135

102136
get shell(tCompileShell)
@@ -118,7 +152,7 @@ command packageBuilderExtension pSourceFolder, pSourceFileName, pTargetFolder, p
118152
end if
119153

120154
packageExtension tExtensionName, pSourceFolder, pSourceFileName, \
121-
pTargetFolder, pRemoveSource
155+
pTargetFolder, pRemoveSource, tSupportFiles
122156
end packageBuilderExtension
123157

124158
on errorDialog tError

0 commit comments

Comments
 (0)