Skip to content

Commit 35e87f4

Browse files
committed
Address regressions #1011 and #1014
1 parent a6aadec commit 35e87f4

File tree

11 files changed

+129
-10
lines changed

11 files changed

+129
-10
lines changed

src/cls/IPM/Lifecycle/Base.cls

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -967,7 +967,7 @@ Method %Compile(ByRef pParams) As %Status
967967
set tResource = orderedResourceList.GetNext(.tKey)
968968
quit:tKey=""
969969

970-
if '$data(tHandledMap(tResource.Name)) && $isobject(tResource.Processor) {
970+
if '$data(tHandledMap(tResource.Name)) && $isobject(tResource.Processor) && tResource.IsInScope("Compile") {
971971
if tResource.Processor.%IsA("%IPM.ResourceProcessor.AbstractCompilable") && tResource.Processor.CompileFromProject {
972972
if tVerbose {
973973
write !, tResource.Name_" was loaded as deployed code, so compilation isn't needed."

src/cls/IPM/Storage/Module.cls

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -869,6 +869,10 @@ Method BuildDependencyGraph(
869869
{
870870
set sc = $$$OK
871871
try {
872+
if $data(^IPMTest("BuildDependencyGraphCount")) {
873+
do $increment(^IPMTest("BuildDependencyGraphCount"))
874+
}
875+
872876
// Initialize internal variables
873877
kill manifestCache, repoSearchCache, moduleCache, workQueue
874878
set knownDependencies = ..GetKnownDependencies(..Name)

src/cls/IPM/Utils/Module.cls

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -276,14 +276,14 @@ ClassMethod LoadModuleFromDirectory(
276276
write:tVerbose !,"Loading from ",pDirectory,!
277277
merge tParams = pParams
278278
if $get(pParams("Install")) || $get(pParams("Update")) {
279-
if $get(pParams("Update"),0) {
280-
set tParams("cmd") = "update"
281-
} else {
282-
zkill tParams("Install")
283-
}
279+
zkill tParams("Install")
280+
zkill tParams("Update")
284281
} else {
285-
// Propagate all params except developer mode to dependencies
282+
// Propagate all params except DeveloperMode, UpdateSnapshots, IgnoreInstalled to dependencies
286283
set tParams("DeveloperMode") = $get(pOverrideDeveloperMode,0)
284+
// Do not pass these down so BuildDependencyGraph() does not get called more than necessary
285+
kill tParams("UpdateSnapshots")
286+
kill tParams("IgnoreInstalled")
287287
}
288288
set tSC = ..LoadNewModule(pDirectory,.tParams,pRepository,pLog)
289289
if $$$ISERR(tSC) {
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
Class Test.PM.Integration.BuildDependencyGraph Extends Test.PM.Integration.Base
2+
{
3+
4+
Method OnBeforeAllTests() As %Status
5+
{
6+
set sc = $$$OK
7+
kill ^IPMTest
8+
set ^IPMTest("BuildDependencyGraphCount") = 0
9+
return sc
10+
}
11+
12+
/// Counts the number of times that BuildDependencyGraph() gets invoked on test modules' installation to catch regressions
13+
Method TestBuildDependencyGraphCount()
14+
{
15+
// Install base module C
16+
set moduleDir = ..GetModuleDir("build-dependency-graph-loop/module-c")
17+
set status = ##class(%IPM.Main).Shell("load -verbose "_moduleDir)
18+
do $$$AssertStatusOK(status,"Module module-c successfully installed")
19+
20+
// Install module A (which has dependencies B-snapshot-version and C) with hidden flags UpdateSnapshots and IgnoreInstalled
21+
kill params
22+
set params("UpdateSnapshots") = 1
23+
set params("IgnoreInstalled") = 1
24+
set params("Verbose") = 1
25+
26+
set moduleDir = ..GetModuleDir("build-dependency-graph-loop/module-a")
27+
set sc = ##class(%IPM.Utils.Module).LoadNewModule(moduleDir, .params)
28+
do $$$AssertStatusOK(sc)
29+
30+
// TODO: Note that this number 4 is just what the number of BuildDependencyGraphCount gets cut down to with the fix for #1011. Without #1011 the number is 5. This is just to ensure no regressions for the future, but will be an even lower number with #998.
31+
do $$$AssertTrue(^IPMTest("BuildDependencyGraphCount") <= 4)
32+
}
33+
34+
Method OnAfterAllTests() As %Status
35+
{
36+
set sc = $$$OK
37+
kill ^IPMTest
38+
return sc
39+
}
40+
41+
}

tests/integration_tests/Test/PM/Integration/FileCopy.cls

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -125,21 +125,21 @@ Method TestFileCopyScope()
125125
set mgrDir = $system.Util.ManagerDirectory()
126126
do $$$AssertTrue(##class(%File).Exists(ipmDir _ "FileCopy/testmodule/cls/Test.cls"), "Test.cls in " _ ipmDir _ "FileCopy/testmodule/cls exists")
127127
do $$$AssertNotTrue(##class(%File).Exists(mgrDir _ "FileCopy/Scope/Test/test1.txt"), mgrDir _ "FileCopy/Scope/Test/test1.txt does not exist")
128-
do $$$AssertNotTrue(##class(%File).Exists(mgrDir _ "FileCopy/Scope/Verify/test2.txt"), mgrDir _ "FileCopy/Scope/Test/test2.txt does not exist")
128+
do $$$AssertNotTrue(##class(%File).Exists(mgrDir _ "FileCopy/Scope/Verify/test2.txt"), mgrDir _ "FileCopy/Scope/Verify/test2.txt does not exist")
129129

130130
// call <module> test
131131
set status = ##class(%IPM.Main).Shell("testmodule test -v")
132132
do $$$AssertStatusOK(status,"Test phase succeeded")
133133
// The Scope="test" file should be copied
134134
do $$$AssertTrue(##class(%File).Exists(mgrDir _ "FileCopy/Scope/Test/test1.txt"), mgrDir _ "FileCopy/Scope/Test/test1.txt does exist")
135-
do $$$AssertNotTrue(##class(%File).Exists(mgrDir _ "FileCopy/Scope/Verify/test2.txt"), mgrDir _ "FileCopy/Scope/Test/test2.txt does not exist")
135+
do $$$AssertNotTrue(##class(%File).Exists(mgrDir _ "FileCopy/Scope/Verify/test2.txt"), mgrDir _ "FileCopy/Scope/Verify/test2.txt does not exist")
136136

137137
// call <module> verify
138138
set status = ##class(%IPM.Main).Shell("testmodule verify -v")
139139
do $$$AssertStatusOK(status,"Verify phase succeeded")
140140
// The Scope="verify" file should be copied
141141
do $$$AssertTrue(##class(%File).Exists(mgrDir _ "FileCopy/Scope/Test/test1.txt"), mgrDir _ "FileCopy/Scope/Test/test1.txt does exist")
142-
do $$$AssertTrue(##class(%File).Exists(mgrDir _ "FileCopy/Scope/Verify/test2.txt"), mgrDir _ "FileCopy/Verify/Test/test2.txt does exist")
142+
do $$$AssertTrue(##class(%File).Exists(mgrDir _ "FileCopy/Scope/Verify/test2.txt"), mgrDir _ "FileCopy/Verify/Verify/test2.txt does exist")
143143

144144
// Clean up by deleting the copied directory
145145
set dir = mgrDir _ "FileCopy/"

tests/integration_tests/Test/PM/Integration/Scopes.cls

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,22 @@ Method TestEverything()
5050
do $$$AssertStatusOK(..TearDown())
5151
}
5252

53+
/// Validates that scoped classes do not compile on normal install
54+
Method TestScopedClassInstall()
55+
{
56+
set sc = $$$OK
57+
try {
58+
set moduleDir = ..GetModuleDir("scope")
59+
set status = ##class(%IPM.Main).Shell("load -verbose "_moduleDir)
60+
do $$$AssertStatusOK(status, "Module scope successfully installed.")
61+
62+
// Normal install: Scoped class should not exist
63+
do $$$AssertNotTrue($classmethod("%Dictionary.ClassDefinition","%ExistsId","HS.ScopedClass"),"Scoped class should NOT exist after normal install")
64+
} catch ex {
65+
do $$$AssertStatusOK(ex.AsStatus(), "Unexpected failure in TestScopedClassCompile")
66+
}
67+
}
68+
5369
XData ServerModule1 [ XMLNamespace = "http://www.intersystems.com/PackageManager" ]
5470
{
5571
<?xml version="1.0"?>
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<Export generator="IRIS" version="26">
3+
<Document name="module-a.ZPM">
4+
<Module>
5+
<Name>module-a</Name>
6+
<Version>1.0.0</Version>
7+
<Dependencies>
8+
<ModuleReference>
9+
<Name>module-b</Name>
10+
<Version>^1.0.0</Version>
11+
</ModuleReference>
12+
<ModuleReference>
13+
<Name>module-c</Name>
14+
<Version>1.0.0</Version>
15+
</ModuleReference>
16+
</Dependencies>
17+
</Module>
18+
</Document>
19+
</Export>
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<Export generator="IRIS" version="26">
3+
<Document name="module-b.ZPM">
4+
<Module>
5+
<Name>module-b</Name>
6+
<Version>1.0.0+snapshot</Version>
7+
<Dependencies>
8+
<ModuleReference>
9+
<Name>module-c</Name>
10+
<Version>1.0.0</Version>
11+
</ModuleReference>
12+
</Dependencies>
13+
</Module>
14+
</Document>
15+
</Export>
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<Export generator="IRIS" version="26">
3+
<Document name="module-c.ZPM">
4+
<Module>
5+
<Name>module-c</Name>
6+
<Version>1.0.0</Version>
7+
</Module>
8+
</Document>
9+
</Export>
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
Class HS.ScopedClass
2+
{
3+
4+
}

0 commit comments

Comments
 (0)