-
Notifications
You must be signed in to change notification settings - Fork 28
Scope information in output array of BuildDependencyGraph() #1153
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
eb52948
8b286c7
3415e1b
f171606
2d382d5
fc830d5
afbef18
34c5e8a
2773f48
23ee448
d792342
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -879,6 +879,8 @@ ClassMethod HasScope( | |||||||||||||||||||||||||||||
| /// <li>Depth in the dependency tree (1 for direct dependencies, 2 for transitive, etc.)</li> | ||||||||||||||||||||||||||||||
| /// <li>Repository from which the module will be obtained (empty if already installed)</li> | ||||||||||||||||||||||||||||||
| /// <li>Version string of the module to be installed</li> | ||||||||||||||||||||||||||||||
| /// <li>Display name of the module</li> | ||||||||||||||||||||||||||||||
| /// <li>Scope of the module, or empty string if the dependency is not scoped</li> | ||||||||||||||||||||||||||||||
| /// </ul> | ||||||||||||||||||||||||||||||
| /// <p> | ||||||||||||||||||||||||||||||
| /// <b>Parameters:</b><br> | ||||||||||||||||||||||||||||||
|
|
@@ -1142,7 +1144,7 @@ Method ProcessSingleDependencyIterative( | |||||||||||||||||||||||||||||
| localObj.Version.Satisfies(searchExpr) && | ||||||||||||||||||||||||||||||
| ((version = "") || (version = localObj.VersionString)) | ||||||||||||||||||||||||||||||
| if installedVersionValid && '(localObj.Version.IsSnapshot() && pForceSnapshotReload) { | ||||||||||||||||||||||||||||||
| set pDependencyGraph(pDep.Name) = $listbuild(pDepth,"",localObj.VersionString,pDep.DisplayName) | ||||||||||||||||||||||||||||||
| set pDependencyGraph(pDep.Name) = $listbuild(pDepth,"",localObj.VersionString,pDep.DisplayName,pDep.Scope) | ||||||||||||||||||||||||||||||
| set pDependencyGraph(pDep.Name,pParentInfo) = pDep.VersionString | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| // Add to work queue for next depth | ||||||||||||||||||||||||||||||
|
|
@@ -1204,7 +1206,7 @@ Method ProcessSingleDependencyIterative( | |||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| set pDependencyGraph(pDep.Name) = $listbuild( | ||||||||||||||||||||||||||||||
| pDepth, qualifiedReference.ServerName, moduleObj.VersionString, qualifiedReference.Deployed, qualifiedReference.PlatformVersion,pDep.DisplayName | ||||||||||||||||||||||||||||||
| pDepth, qualifiedReference.ServerName, moduleObj.VersionString, qualifiedReference.Deployed, qualifiedReference.PlatformVersion,pDep.DisplayName,pDep.Scope | ||||||||||||||||||||||||||||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Wait, why does this setting of pDependencyGraph have an extra argument of deployed in there? I know this predates your change, but I'm a bit confused by it.
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. absolutely no clue 😃
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. So I asked Claude to do some investigative journalism and here's what it found:
@isc-kiyer what's your sense of the best thing to do here? This path-dependent inconsistency smells like a footgun and we should probably fully normalize it. Right now the caller has to know which path has been taken to know what the actual format will be. |
||||||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||||||
| set pDependencyGraph(pDep.Name,pParentInfo) = pDep.VersionString | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
|
|
@@ -1239,7 +1241,7 @@ Method ProcessSingleDependencyIterative( | |||||||||||||||||||||||||||||
| // occurs if needed. | ||||||||||||||||||||||||||||||
| set depth = $select(previousDepth=0:pDepth,previousDepth>pDepth:previousDepth,1:pDepth) | ||||||||||||||||||||||||||||||
| set dependencyGraph(pDep.Name) = $listbuild( | ||||||||||||||||||||||||||||||
| depth,qualifiedReference.ServerName,moduleObj.VersionString,pDep.DisplayName | ||||||||||||||||||||||||||||||
| depth,qualifiedReference.ServerName,moduleObj.VersionString,pDep.DisplayName,pDep.Scope | ||||||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||||||
| set dependencyGraph(pDep.Name,pParentInfo) = pDep.VersionString | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,56 @@ | ||
| Class Test.PM.Integration.BuildDependencyGraphScopedDeps Extends Test.PM.Integration.Base | ||
|
isc-kiyer marked this conversation as resolved.
|
||
| { | ||
|
|
||
| Parameter REPONAME = "build-dependency-graph-scoped-dep"; | ||
|
|
||
| Parameter MODNAME = "module-a"; | ||
|
|
||
| Property RepoPath As %String; | ||
|
|
||
| Method OnBeforeAllTests() As %Status | ||
| { | ||
| // Set up the repo path - use GetModuleDir utility | ||
| set ..RepoPath = ..GetModuleDir(..#REPONAME) | ||
|
|
||
| // Create filesystem repo pointing to test data | ||
| set sc = ##class(%IPM.Main).Shell("repo -n "_..#REPONAME_" -fs -path "_..RepoPath) | ||
| do $$$AssertStatusOK(sc,"Created"_..#REPONAME_"repo successfully.") | ||
| quit sc | ||
| } | ||
|
|
||
| Method OnAfterAllTests() As %Status | ||
| { | ||
| // Remove test repository | ||
| set sc = ##class(%IPM.Main).Shell("repo -delete -name "_..#REPONAME) | ||
| do $$$AssertStatusOK(sc,"Deleted "_..#REPONAME_"repo successfully.") | ||
| quit sc | ||
| } | ||
|
|
||
| /// BuildDependencyGraph should include scope information for scoped transitive dependencies | ||
| Method TestDependencyGraphScopedDependency() | ||
| { | ||
| do $$$AssertStatusOK(##class(%IPM.Utils.Module).LoadModuleFromDirectory(..RepoPath_..#MODNAME), "Successfully loaded module from directory.") | ||
| set module = ##class(%IPM.Storage.Module).NameOpen(..#MODNAME,,.sc) | ||
| do $$$AssertStatusOK(sc, "Successfully opened module object.") | ||
|
|
||
| // Expected dependencyGraph format: dependencyGraph(<module name>) = $listbuild(<depth>, <server>, <version>, <display name>, <scope>) | ||
| set scopes = $listbuild("test", "verify") | ||
| set sc = module.BuildDependencyGraph(.dependencyGraph, , , ,scopes) | ||
| do $$$AssertStatusOK(sc, "BuildDependencyGraph() call was successful.") | ||
|
|
||
| // Check non-scoped dependency | ||
| do $$$AssertTrue($data(dependencyGraph("module-b"))) | ||
| set $listbuild(,,,,moduleBScope) = dependencyGraph("module-b") | ||
| do $$$AssertEquals(moduleBScope, "", "module-b scope successfully checked to be empty.") | ||
|
|
||
| // Check scoped dependencies | ||
| do $$$AssertTrue($data(dependencyGraph("module-c"))) | ||
| set $listbuild(,,,,moduleCScope) = dependencyGraph("module-c") | ||
| do $$$AssertEquals(moduleCScope, "test", "module-c scope successfully checked to be 'test'.") | ||
|
|
||
| do $$$AssertTrue($data(dependencyGraph("module-d"))) | ||
| set $listbuild(,,,,moduleDScope) = dependencyGraph("module-d") | ||
| do $$$AssertEquals(moduleDScope, "verify", "module-d scope successfully checked to be 'verify'.") | ||
| } | ||
|
|
||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| <?xml version="1.0" encoding="UTF-8"?> | ||
| <Export generator="IRIS" version="26"> | ||
| <Document name="module-a.ZPM"> | ||
| <Module> | ||
| <Name>module-a</Name> | ||
| <Version>1.0.0</Version> | ||
| <Dependencies> | ||
| <ModuleReference> | ||
| <Name>module-b</Name> | ||
| <Version>^2.0.0</Version> | ||
| </ModuleReference> | ||
| </Dependencies> | ||
| </Module> | ||
| </Document> | ||
| </Export> |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| <?xml version="1.0" encoding="UTF-8"?> | ||
| <Export generator="IRIS" version="26"> | ||
| <Document name="module-b.ZPM"> | ||
| <Module> | ||
| <Name>module-b</Name> | ||
| <Version>2.0.0</Version> | ||
| <Dependencies> | ||
| <ModuleReference Scope="test"> | ||
| <Name>module-c</Name> | ||
| <Version>^3.0.0</Version> | ||
| </ModuleReference> | ||
| <ModuleReference Scope="verify"> | ||
| <Name>module-d</Name> | ||
| <Version>^4.0.0</Version> | ||
| </ModuleReference> | ||
| </Dependencies> | ||
| </Module> | ||
| </Document> | ||
| </Export> |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| <?xml version="1.0" encoding="UTF-8"?> | ||
| <Export generator="IRIS" version="26"> | ||
| <Document name="module-c.ZPM"> | ||
| <Module> | ||
| <Name>module-c</Name> | ||
| <Version>3.0.0</Version> | ||
| </Module> | ||
| </Document> | ||
| </Export> |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| <?xml version="1.0" encoding="UTF-8"?> | ||
| <Export generator="IRIS" version="26"> | ||
| <Document name="module-d.ZPM"> | ||
| <Module> | ||
| <Name>module-d</Name> | ||
| <Version>4.0.0</Version> | ||
| </Module> | ||
| </Document> | ||
| </Export> |
Uh oh!
There was an error while loading. Please reload this page.