Skip to content

Commit 7555c6b

Browse files
committed
Fixed installation process
Still a few lingering pieces: need to update SourceControl.Git.Change and need to test on a functional Ensemble instance (mine is broken)
1 parent a9be2ed commit 7555c6b

File tree

1 file changed

+30
-37
lines changed

1 file changed

+30
-37
lines changed

cls/SourceControl/Git/Utils.cls

Lines changed: 30 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1729,16 +1729,17 @@ ClassMethod BuildCEInstallationPackage(ByRef destination As %String) As %Status
17291729
{
17301730
#define sourcedir $System.Util.InstallDirectory()_"devuser/studio/templates/gitsourcecontrol/"
17311731
#define sourcedirstr ##Quote($$$sourcedir)
1732-
#define exportGBLString "GitSourceControlProjectExport"
1732+
#define exportGBLString "||GitSourceControlProjectExport"
17331733
#define exportGBLDoc $$$exportGBLString_".GBL"
1734-
#define exportGBL ##Expression("^||"_$$$exportGBLString)
1734+
#define exportGBL ##Expression("^"_$$$exportGBLString)
17351735
#define exportGBLName $Name($$$exportGBL)
1736-
#define exportGBLNameQ ##Quote("^||"_$$$exportGBLString)
1736+
#define exportGBLNameQ ##Quote("^"_$$$exportGBLString)
17371737

17381738
new %sourcedirstr
17391739
set sc = $$$OK
17401740
try {
17411741
set projectName = "GitSourceControl_CE"
1742+
set exportSpec = "/keepsource/exportversion=2016.2/diffexport"
17421743

17431744
// Main project
17441745
set destination = $Get(destination,##class(%Library.File).NormalizeFilename(projectName_".xml"))
@@ -1763,50 +1764,42 @@ ClassMethod BuildCEInstallationPackage(ByRef destination As %String) As %Status
17631764
do archive.AddToProject(project)
17641765

17651766
kill $$$exportGBL
1766-
$$$ThrowOnError(project.ExportToStream("/exportversion=2016.2/diffexport",0))
1767-
Set gblStream = ##class(%Stream.GlobalCharacter).%New($$$exportGBLName)
1768-
$$$ThrowOnError(gblStream.CopyFromAndSave(project.Stream))
1767+
$$$ThrowOnError(project.ExportToStream(exportSpec,0))
17691768

17701769
// Installer automation
1771-
set code($i(code)) = "#include %occInclude"
1772-
set code($i(code)) = " Set stream = ##class(%Stream.GlobalCharacter).%Open($ListBuild(1,"""","_$$$exportGBLNameQ_"),,.sc)"
1770+
set code($i(code)) = " New %ISCName set %ISCName = ""GitSourceControlInstaller"""
1771+
set code($i(code)) = " Set xdata = ##class(%Dictionary.XDataDefinition).IDKEYOpen(""SourceControl.Git.Installer"",""Payload"",,.sc)"
17731772
set code($i(code)) = " $$$ThrowOnError(sc)"
1774-
set code($i(code)) = " $$$ThrowOnError($System.OBJ.LoadStream(stream,""ck""))"
1773+
set code($i(code)) = " $$$ThrowOnError($System.OBJ.LoadStream(xdata.Data,""ck/nomulticompile""))"
17751774
do archive.GenerateInstallerCode($$$sourcedirstr,.code)
17761775
set code($i(code)) = " Do ##class(SourceControl.Git.Utils).Localize()"
17771776
set code($i(code)) = " Write !!"
17781777
set code($i(code)) = " Do ##class(SourceControl.Git.Utils).OutputConfigureMessage()"
1779-
1780-
// Wrapper project
1781-
if ##class(%Studio.Project).%ExistsId(projectName_"Wrapper") {
1782-
$$$ThrowOnError(##class(%Studio.Project).%DeleteId(projectName_"Wrapper"))
1778+
1779+
// Put installer automation in class
1780+
do $System.OBJ.Delete("SourceControl.Git.Installer.CLS","-d")
1781+
set class = ##class(%Dictionary.ClassDefinition).%New()
1782+
set class.Name = "SourceControl.Git.Installer"
1783+
set class.IncludeGenerator = "%occInclude"
1784+
set method = ##class(%Dictionary.MethodDefinition).%New()
1785+
set method.Name = "Run"
1786+
set method.CodeMode = "objectgenerator"
1787+
for i=1:1:code {
1788+
do method.Implementation.WriteLine(code(i))
17831789
}
1784-
set wrapper = ##class(%Studio.Project).%New()
1785-
set wrapper.Name = projectName_"Wrapper"
1790+
do method.Implementation.WriteLine(" job ##class(%SYSTEM.OBJ).Delete(""SourceControl.Git.Installer.CLS"")")
1791+
do class.Methods.Insert(method)
17861792

1787-
// Export of main project
1788-
do wrapper.AddItem($$$exportGBLDoc)
1793+
// Put payload in XData block
1794+
set xdata = ##class(%Dictionary.XDataDefinition).%New()
1795+
set xdata.Name = "Payload"
1796+
do xdata.Data.CopyFrom(project.Stream)
1797+
do class.XDatas.Insert(xdata)
17891798

1790-
// Installer routine
1791-
if ##class(%Library.Routine).Exists("INSTALL.MAC") {
1792-
$$$ThrowOnError(##class(%Library.Routine).Delete("INSTALL.MAC"))
1793-
}
1794-
set routine = ##class(%Routine).%New("INSTALL.MAC")
1795-
for i=1:1:code {
1796-
do routine.WriteLine(" "_code(i))
1797-
}
1798-
$$$ThrowOnError(routine.Save())
1799-
$$$ThrowOnError(routine.Compile("-d"))
1800-
do wrapper.AddItem("INSTALL.MAC")
1801-
1802-
// Deploy to a file
1803-
$$$ThrowOnError(wrapper.%Save())
1804-
kill ^||%pkg
1805-
set minVersion = "2016.2"
1806-
set spec = "/keepsource/exportversion="_minVersion_"/diffexport"
1807-
$$$ThrowOnError(wrapper.Deploy("",spec,,,"^||%pkg",0))
1808-
set ^||%pkg("VERSION") = minVersion
1809-
$$$ThrowOnError($$ExportXMLList^%apiOBJ("^||%pkg.gbl",destination,spec))
1799+
$$$ThrowOnError(class.%Save())
1800+
1801+
$$$ThrowOnError($System.OBJ.Export(class.Name_".CLS,"_$$$exportGBLDoc,destination,exportSpec))
1802+
$$$ThrowOnError($System.OBJ.Delete("SourceControl.Git.Installer.CLS"))
18101803
} catch e {
18111804
set sc = e.AsStatus()
18121805
}

0 commit comments

Comments
 (0)