From 6a5be67f50b79dcbade26a6d94391ac638d02f82 Mon Sep 17 00:00:00 2001 From: Pravin Barton <9560941+isc-pbarton@users.noreply.github.com> Date: Thu, 20 Jun 2024 11:59:23 -0400 Subject: [PATCH 1/5] compile items on import --- CHANGELOG.md | 2 ++ cls/SourceControl/Git/Utils.cls | 3 +-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index dc070595..d0859463 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,6 +18,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Added a new "Branch" parameter to `##class(SourceControl.Git.PullEventHandler)` (#351) - Command-line utility to do a baseline export of items in a namespace +### Fixed +- Import All options now compile items after they are imported into IRIS from the repository (#362) ## [2.3.1] - 2024-04-30 diff --git a/cls/SourceControl/Git/Utils.cls b/cls/SourceControl/Git/Utils.cls index 196f1e71..3b6d6c59 100644 --- a/cls/SourceControl/Git/Utils.cls +++ b/cls/SourceControl/Git/Utils.cls @@ -1230,7 +1230,7 @@ ClassMethod ImportItem(InternalName As %String, force As %Boolean = 0, verbose A if ($extract(InternalName, 1) = "/"){ set sc = ..ImportCSPFile(InternalName) } else{ - set sc = $system.OBJ.Load(filename,"-l-d") + set sc = $system.OBJ.Load(filename,"ck") } } if sc { @@ -2282,4 +2282,3 @@ ClassMethod BaselineExport(pCommitMessage = "", pPushToRemote = "") As %Status } } - From 9718793d526c27d7250314752e07f1b97054cd43 Mon Sep 17 00:00:00 2001 From: Pravin Barton <9560941+isc-pbarton@users.noreply.github.com> Date: Thu, 20 Jun 2024 11:59:23 -0400 Subject: [PATCH 2/5] compile items on import --- CHANGELOG.md | 1 + cls/SourceControl/Git/Utils.cls | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1dbba46d..f2e0fda6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -23,6 +23,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Fixed - Modifications to local repo files are now synced with IRIS (#153) - Menu items names are properly translated from internal name in VSCode, Management Portal (#372) +- Import All options now compile items after they are imported into IRIS from the repository (#362) ## [2.3.1] - 2024-04-30 diff --git a/cls/SourceControl/Git/Utils.cls b/cls/SourceControl/Git/Utils.cls index b209ba6c..d9a1cf46 100644 --- a/cls/SourceControl/Git/Utils.cls +++ b/cls/SourceControl/Git/Utils.cls @@ -1187,7 +1187,7 @@ ClassMethod ImportItem(InternalName As %String, force As %Boolean = 0, verbose A if ($extract(InternalName, 1) = "/"){ set sc = ..ImportCSPFile(InternalName) } else{ - set sc = $system.OBJ.Load(filename,"-l-d") + set sc = $system.OBJ.Load(filename,"ck") } } if sc { From 31ea12b182a46884df620b363417febba86800e2 Mon Sep 17 00:00:00 2001 From: Pravin Barton <9560941+isc-pbarton@users.noreply.github.com> Date: Wed, 26 Jun 2024 09:23:44 -0400 Subject: [PATCH 3/5] Revert "compile items on import" This reverts commit 9718793d526c27d7250314752e07f1b97054cd43. --- CHANGELOG.md | 1 - cls/SourceControl/Git/Utils.cls | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f2e0fda6..1dbba46d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -23,7 +23,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Fixed - Modifications to local repo files are now synced with IRIS (#153) - Menu items names are properly translated from internal name in VSCode, Management Portal (#372) -- Import All options now compile items after they are imported into IRIS from the repository (#362) ## [2.3.1] - 2024-04-30 diff --git a/cls/SourceControl/Git/Utils.cls b/cls/SourceControl/Git/Utils.cls index d9a1cf46..b209ba6c 100644 --- a/cls/SourceControl/Git/Utils.cls +++ b/cls/SourceControl/Git/Utils.cls @@ -1187,7 +1187,7 @@ ClassMethod ImportItem(InternalName As %String, force As %Boolean = 0, verbose A if ($extract(InternalName, 1) = "/"){ set sc = ..ImportCSPFile(InternalName) } else{ - set sc = $system.OBJ.Load(filename,"ck") + set sc = $system.OBJ.Load(filename,"-l-d") } } if sc { From 4d023192dc3a9ff54c42465c7e72bda95749a5cc Mon Sep 17 00:00:00 2001 From: Pravin Barton <9560941+isc-pbarton@users.noreply.github.com> Date: Wed, 26 Jun 2024 17:09:42 -0400 Subject: [PATCH 4/5] compile on import using pull event handler --- CHANGELOG.md | 1 + cls/SourceControl/Git/Settings.cls | 5 ++++- cls/SourceControl/Git/Utils.cls | 24 ++++++++++++++++++++++++ csp/gitprojectsettings.csp | 12 ++++++++++++ 4 files changed, 41 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1dbba46d..40dc0d5e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -19,6 +19,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Command-line utility to do a baseline export of items in a namespace - 'New Branch' menu option in basic now will create new branches from the configured default merge branch (#366) - Merging back with the default merge branch is now a part of the basic mode's Sync flow (#366) +- Added a new option "compileOnImport". If true, Import options will compile files using the pull event handler. (#362) ### Fixed - Modifications to local repo files are now synced with IRIS (#153) diff --git a/cls/SourceControl/Git/Settings.cls b/cls/SourceControl/Git/Settings.cls index 3ac96028..dc73319f 100644 --- a/cls/SourceControl/Git/Settings.cls +++ b/cls/SourceControl/Git/Settings.cls @@ -44,6 +44,9 @@ Property systemBasicMode As %Boolean [ InitialExpression = {##class(SourceContro /// In Basic mode, Sync will merge changes from this remote branch Property defaultMergeBranch As %String [ InitialExpression = {##class(SourceControl.Git.Utils).DefaultMergeBranch()} ]; +/// Import All options compile imported options using the configured pull event handler +Property compileOnImport As %Boolean [ InitialExpression = {##class(SourceControl.Git.Utils).CompileOnImport()} ]; + Property Mappings [ MultiDimensional ]; Method %OnNew() As %Status @@ -97,6 +100,7 @@ Method %Save() As %Status set @storage@("settings","settingsUIReadOnly") = ..settingsUIReadOnly set @storage@("settings", "mappedItemsReadOnly") = ..mappedItemsReadOnly set @storage@("settings", "defaultMergeBranch") = ..defaultMergeBranch + set @storage@("settings", "compileOnImport") = ..compileOnImport set @storage@("settings", "basicMode") = ..systemBasicMode if ..basicMode = "system" { kill @storage@("settings", "user", $username, "basicMode") @@ -206,4 +210,3 @@ Method OnAfterConfigure() As %Boolean } } - diff --git a/cls/SourceControl/Git/Utils.cls b/cls/SourceControl/Git/Utils.cls index b209ba6c..a3ebcc01 100644 --- a/cls/SourceControl/Git/Utils.cls +++ b/cls/SourceControl/Git/Utils.cls @@ -153,6 +153,11 @@ ClassMethod PrivateKeyFile() As %String quit $get(@..#Storage@("settings","ssh","privateKeyFile")) } +ClassMethod CompileOnImport() As %Boolean +{ + quit $get(@..#Storage@("settings","compileOnImport"),1) +} + ClassMethod NeedSettings() As %Boolean [ CodeMode = expression ] { (..TempFolder() = "") || (..GitBinPath() = "") || (..GitBinPath() = """") @@ -1294,13 +1299,17 @@ ClassMethod ImportRoutines(force As %Boolean = 0) As %Status #dim ec as %Status = ..ListItemsInFiles(.itemList, .err) quit:'ec ec + + kill files + set settings = ##class(SourceControl.Git.Settings).%New() #dim internalName as %String = "" for { set internalName = $order(itemList(internalName)) quit:internalName="" set context = ##class(SourceControl.Git.PackageManagerContext).ForInternalName(internalName) continue:context.Package'=refPackage + set doImport = ..IsRoutineOutdated(internalName) || force if ..IsInSourceControl(internalName) { set sc = ..ImportItem(internalName, force) } else { @@ -1309,6 +1318,21 @@ ClassMethod ImportRoutines(force As %Boolean = 0) As %Status if $$$ISERR(sc) { set ec = $$$ADDSC(ec, sc) } + if doImport && settings.compileOnImport { + set modification = ##class(SourceControl.Git.Modification).%New() + set modification.changeType = "M" + set modification.internalName = internalName + set modification.externalName = ..FullExternalName(internalName) + set files($increment(files)) = modification + } + } + + set eventHandler = $classmethod(..PullEventClass(),"%New") + set eventHandler.LocalRoot = ..TempFolder() + merge eventHandler.ModifiedFiles = files + set sc = eventHandler.OnPull() + if $$$ISERR(sc) { + set ec = $$$ADDSC(ec,sc) } //let's delete all items for which corresponding files had been deleted diff --git a/csp/gitprojectsettings.csp b/csp/gitprojectsettings.csp index 50e91655..0aed2f5e 100644 --- a/csp/gitprojectsettings.csp +++ b/csp/gitprojectsettings.csp @@ -90,6 +90,8 @@ body { set settings.mappedItemsReadOnly = 0 } + set settings.compileOnImport = ($Get(%request.Data("compileOnImport", 1)) = 1) + if ($Get(%request.Data("basicMode", 1)) = 1) { set settings.basicMode = 1 } elseif ($Get(%request.Data("basicMode", 1)) = "system"){ @@ -336,6 +338,16 @@ body { +