@@ -274,17 +274,18 @@ ClassMethod LoadModuleFromDirectory(
274274 set tVerbose = $get (pParams (" Verbose" ))
275275 // LoadNewModule goes all the way through Reload->Validate->Compile->Activate, also compiling the new module.
276276 write :tVerbose !," Loading from " ,pDirectory ,!
277+
278+ // Propagate all params to dependencies except those that should only apply to the top level module
277279 merge tParams = pParams
278280 if $get (pParams (" Install" )) || $get (pParams (" Update" )) {
279281 if $get (pParams (" Update" ),0 ) {
280282 set tParams (" cmd" ) = " update"
281283 } else {
282284 zkill tParams (" Install" )
283285 }
284- } else {
285- // Propagate all params except developer mode to dependencies
286- set tParams (" DeveloperMode" ) = $get (pOverrideDeveloperMode ,0 )
287286 }
287+ set tParams (" DeveloperMode" ) = $get (pOverrideDeveloperMode ,0 )
288+
288289 set tSC = ..LoadNewModule (pDirectory ,.tParams ,pRepository ,pLog )
289290 if $$$ISERR(tSC ) {
290291 quit
@@ -1097,7 +1098,7 @@ ClassMethod LoadNewModule(
10971098
10981099 // If installing new version of IPM, clean up old mappings
10991100 if newModuleObj .Name =$$$IPMModuleName {
1100- $$$ThrowOnError(##class ( IPM.Installer ) .CleanupOldMappings ())
1101+ $$$ThrowOnError(. .CleanupOldMappings ())
11011102 }
11021103 }
11031104 if moduleCurrent '= " " {
@@ -1237,11 +1238,11 @@ ClassMethod LoadDependencies(
12371238 set permitDowngrade = +$get (pParams (" PermitDowngrade" ))
12381239 set ignoreInstalled = +$get (pParams (" IgnoreInstalled" ))
12391240 write !, " Building dependency graph..." // Intentionally always write even in non-verbose mode
1240- set sc = pModule .BuildDependencyGraph (.depdendencyGraph ,,reloadSnapshots ,," " ,,,,ignoreInstalled ,,permitDowngrade )
1241+ set sc = pModule .BuildDependencyGraph (.dependencyGraph ,,reloadSnapshots ,," " ,,,,ignoreInstalled ,,permitDowngrade )
12411242 $$$ThrowOnError(sc )
12421243 write " Done."
12431244
1244- do ..ConstructInvertedDependencyGraph (.depdendencyGraph , .invertedDependencyGraph )
1245+ do ..ConstructInvertedDependencyGraph (.dependencyGraph , .invertedDependencyGraph )
12451246 if isVerbose {
12461247 write !, " Created inverted dependency graph from dependency graph"
12471248 }
@@ -2417,4 +2418,35 @@ ClassMethod GetDeployedProjectName(moduleName As %String) As %String [ CodeMode
24172418moduleName _$$$DeployedProjectSuffix
24182419}
24192420
2421+ /// This method is called directly in LoadNewModule() instead of with an <Invoke> in the module.xml
2422+ /// because the old mappings break load/install before any <Invokes> can be run.
2423+ ClassMethod CleanupOldMappings () As %Status
2424+ {
2425+ set sc = $$$OK
2426+ // Cleanup old mappings from oddStudioDocument
2427+ set key = " "
2428+ for {
2429+ set key = $order (^oddStudioDocument (key ))
2430+ quit :key =" "
2431+ if (key [" %ZPM.PackageManager" ) || (key [" %ZHSLIB.PackageManager" ) {
2432+ kill ^oddStudioDocument (key )
2433+ }
2434+ }
2435+
2436+ set status = ##class (%IPM.Utils.Module ).RemoveGlobalMapping ($namespace ," oddStudioDocument:(BEGIN):(" " %ZP" " )" ," IRISLIB" )
2437+ if $$$ISERR(status ) {
2438+ set sc = $$$ADDSC(sc , status )
2439+ }
2440+ set status = ##class (%IPM.Utils.Module ).RemoveGlobalMapping ($namespace ," oddStudioDocument:(" " %ZP" " ):(" " A" " )" ," IRISSYS" )
2441+ if $$$ISERR(status ) {
2442+ set sc = $$$ADDSC(sc , status )
2443+ }
2444+ set status = ##class (%IPM.Utils.Module ).RemoveGlobalMapping ($namespace ," oddStudioDocument:(" " Ens" " ):(" " Ent" " )" ," ENSLIB" )
2445+ if $$$ISERR(status ) {
2446+ set sc = $$$ADDSC(sc , status )
2447+ }
2448+
2449+ return sc
2450+ }
2451+
24202452}
0 commit comments