Skip to content

Commit 705f049

Browse files
committed
Merge pull request livecode#3884 from livecodefraser/mergext-bundled
Include MergExt into the installed IDE application
2 parents d1c5171 + b53ec6c commit 705f049

File tree

4 files changed

+108
-0
lines changed

4 files changed

+108
-0
lines changed

Installer/package.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ installer LiveCode
3333
include Documentation
3434
include Toolchain.[[TargetPlatform]]
3535
include Extensions
36+
include MergExt
3637
codesign
3738
include Engine.[[TargetPlatform]]
3839
with TargetFolder as [[ToolsFolder]] do
@@ -105,6 +106,10 @@ component Externals
105106
emit externals to "[[TargetFolder]]/Externals/Externals.txt"
106107
emit dbdrivers to "[[TargetFolder]]/Externals/Database Drivers/Database Drivers.txt"
107108

109+
component MergExt
110+
into [[ToolsFolder]] place
111+
rfolder "mergext:MergExt"
112+
108113
component Uninstaller
109114
if TargetPlatform is "Windows" then
110115
place uninstaller at "[[TargetFolder]]/.setup.exe"

builder/builder_utilities.livecodescript

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
script "BuilderUtilities"
2+
constant kMergExtVersion = "2016-4-1"
3+
24
local sEngineDir
35
local sWorkDir
46
local sOutputDir
@@ -315,6 +317,14 @@ function builderBuiltNotesFolder
315317
return builderRepoFolder()
316318
end builderBuiltNotesFolder
317319

320+
function builderMergExtVersion
321+
return kMergExtVersion
322+
end builderMergExtVersion
323+
324+
function builderMergExtFolder
325+
return builderRepoFolder() & slash & "MergExt-Unpacked"
326+
end builderMergExtFolder
327+
318328
-- Folder for storing guide Markdown files that are generated as part
319329
-- of the build process.
320330
function builderBuiltGuidesFolder
@@ -534,3 +544,53 @@ end windowsManifest
534544
function macPList
535545
return url ("file:" & builderSystemFolder() & slash & "mac_info.plist")
536546
end macPList
547+
548+
////////////////////////////////////////////////////////////////////////////////
549+
550+
private function builderMergExtUrl pMergExtVersion, pEdition
551+
return "https://downloads.livecode.com/mergext/mergExt_" & pEdition & "_" & pMergExtVersion & ".zip"
552+
end builderMergExtUrl
553+
554+
private function builderMergExtDownloadedFilePath pMergExtVersion, pEdition
555+
return builderRepoFolder() & slash & "MergExt-" & pEdition & "-" & pMergExtVersion & ".zip"
556+
end builderMergExtDownloadedFilePath
557+
558+
command builderMergExtEnsureZip pMergExtVersion, pEdition
559+
local tZipPath
560+
put builderMergExtDownloadedFilePath(pMergExtVersion, pEdition) into tZipPath
561+
if there is not a file tZipPath then
562+
local tUrl
563+
put builderMergExtUrl(pMergExtVersion, pEdition) into tUrl
564+
builderLog "message", "Downloading MergExt to" && tZipPath
565+
get shell(merge("curl -o '[[tZipPath]]' '[[tUrl]]'"))
566+
if the result is not zero then
567+
builderLog "error", "Failed to download MergExt zip:" && it
568+
throw "failure"
569+
end if
570+
end if
571+
end builderMergExtEnsureZip
572+
573+
command builderMergExtUnpack pMergExtVersion, pEdition
574+
builderMergExtEnsureZip pMergExtVersion, pEdition
575+
576+
local tMergExtFolder
577+
local tMergExtZip
578+
put builderMergExtFolder() into tMergExtFolder
579+
put builderMergExtDownloadedFilePath(pMergExtVersion, pEdition) into tMergExtZip
580+
581+
if there is a folder tMergExtFolder then
582+
get shell(merge("rm -r '[[tMergExtFolder]]'"))
583+
end if
584+
585+
get shell(merge("mkdir -p '[[tMergExtFolder]]/MergExt'"))
586+
if the result is not zero then
587+
builderLog "error", "Failed to create MergExt folder:" && it
588+
throw "failure"
589+
end if
590+
591+
get shell(merge("cd '[[tMergExtFolder]]/MergExt' && unzip '[[tMergExtZip]]'"))
592+
if the result is not zero then
593+
builderLog "error", "Failed to unzip MergExt bundle:" && it
594+
throw "failure"
595+
end if
596+
end builderMergExtUnpack

builder/tools_builder.livecodescript

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,41 @@ end toolsBuilderRunBundle
7676

7777
////////////////////////////////////////////////////////////////////////////////
7878

79+
private command toolsBuilderPrepareMergExt pMergExtVersion, pEdition, pPlatform
80+
-- Ensure that the MergExt bundle is downloaded and unpacked
81+
builderMergExtUnpack pMergExtVersion, (toUpper(char 1 of pEdition) & toLower(char 2 to -1 of pEdition))
82+
83+
-- Remove un-needed files from the unpacked MergExt collection
84+
local tOldFolder
85+
local tCollectionFolder
86+
put builderMergExtFolder() & "/" & "MergExt" into tCollectionFolder
87+
put the defaultFolder into tOldFolder
88+
set the defaultFolder to tCollectionFolder
89+
repeat for each line tExtension in the folders
90+
-- Skip special names
91+
if tExtension is empty or tExtension is "." or tExtension is ".." then next repeat
92+
93+
-- Enter the extension directory
94+
set the defaultFolder to tCollectionFolder & "/" & tExtension
95+
96+
-- Remove any iOS code if we're not building the OSX installer
97+
if pPlatform is not "macosx" then
98+
get shell("rm -rf *.lcext")
99+
end if
100+
101+
-- If the directory contains no code any more, remove it
102+
local tFiles
103+
put the files & return & the folders into tFiles
104+
filter lines of tFiles with regex pattern "^.*\.(so|dylib|bundle|dll|lcext)$"
105+
if tFiles is empty then
106+
set the defaultFolder to tCollectionFolder
107+
get shell(merge("rm -rf '[[tExtension]]'"))
108+
end if
109+
end repeat
110+
end toolsBuilderPrepareMergExt
111+
112+
////////////////////////////////////////////////////////////////////////////////
113+
79114
private command toolsBuilderMakePackage pVersion, pEdition, pPlatform, pEngineFolders, pIdeFolder, pDocsFolder
80115
local tPackageFile
81116

@@ -106,6 +141,9 @@ private command toolsBuilderMakePackage pVersion, pEdition, pPlatform, pEngineFo
106141
put builderWorkFolder() & slash & "tools-" & pPlatform & "-" & pVersion & ".zip" into tPackageFile
107142
builderEnsureFolderForFile tPackageFile
108143

144+
-- Ensure that MergExt is available for inclusion
145+
toolsBuilderPrepareMergExt builderMergExtVersion(), pEdition, pPlatform
146+
109147
--return tPackageFile
110148

111149
-- Configure the package compiler appropriately
@@ -131,6 +169,7 @@ private command toolsBuilderMakePackage pVersion, pEdition, pPlatform, pEngineFo
131169
packageCompilerConfigureSOurce tPackager, "emscripten", pEngineFolders["emscripten"]
132170
packageCompilerConfigureSource tPackager, "prebuilt", builderRepoFolder() & slash & "prebuilt"
133171
packageCompilerConfigureSource tPackager, "repo", builderRepoFolder()
172+
packageCompilerConfigureSource tPackager, "mergext", builderMergExtFolder()
134173
if tEditionType is among the items of "indy,business" then
135174
packageCompilerConfigureSource tPackager, "private", builderPrivateRepoFolder()
136175
end if
@@ -238,6 +277,7 @@ on toolsBuilderPackageReport pType, pMessage, pLine
238277
builderLog pType, pMessage
239278
end toolsBuilderPackageReport
240279

280+
241281
////////////////////////////////////////////////////////////////////////////////
242282

243283
private command toolsBuilderMakeInstaller pVersion, pEdition, pPlatform, pIdeFolder, pPrivateFolder, pPackageFile

docs/notes/feature-mergext.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# MergExt included in the IDE
2+
3+
The MergExt externals are now included as part of the IDE by default and are loaded at startup (where the external supports the platform).

0 commit comments

Comments
 (0)