Fix import analysis failures for glob imports into local package deps (#1992)
This commit is contained in:
1 parent
246e01b55c
commit
83e47694ef
12 files changed
+94
-1
No files matched your search
@@ -102,7 +102,8 @@ public class VmImportAnalyzer {
|
||||
try {
|
||||
if (entry.isGlob()) {
|
||||
var theModuleKey =
|
||||
moduleResolver.resolve(moduleKey.resolveUri(IoUtils.toUri(entry.stringValue())));
|
||||
moduleResolver.resolve(
|
||||
IoUtils.resolve(securityManager, moduleKey, IoUtils.toUri(entry.stringValue())));
|
||||
var elements =
|
||||
GlobResolver.resolveGlob(
|
||||
securityManager,
|
||||
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
amends "pkl:Project"
|
||||
|
||||
package {
|
||||
name = "a"
|
||||
baseUri = "package://example.com/a"
|
||||
version = "1.0.0"
|
||||
packageZipUrl = "https://example.com/a.zip"
|
||||
}
|
||||
+1
@@ -0,0 +1 @@
|
||||
x = 1
|
||||
+1
@@ -0,0 +1 @@
|
||||
x = 2
|
||||
Vendored
+3
@@ -0,0 +1,3 @@
|
||||
amends "pkl:Project"
|
||||
|
||||
dependencies { ["a"] = import(".../input-helper/projects/analyzeLocalPackageGlob/PklProject") }
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"schemaVersion": 1,
|
||||
"resolvedDependencies": {
|
||||
"package://example.com/a@1": {
|
||||
"type": "local",
|
||||
"uri": "projectpackage://example.com/a@1.0.0",
|
||||
"path": "../../../input-helper/projects/analyzeLocalPackageGlob"
|
||||
}
|
||||
}
|
||||
}
|
||||
Vendored
+26
@@ -0,0 +1,26 @@
|
||||
amends ".../snippetTest.pkl"
|
||||
|
||||
import "pkl:analyze"
|
||||
import "pkl:reflect"
|
||||
|
||||
import "glob.pkl"
|
||||
import "single.pkl"
|
||||
|
||||
examples {
|
||||
["single"] {
|
||||
analyze.importGraph(Set(reflect.Module(single).uri))
|
||||
}
|
||||
["glob"] {
|
||||
analyze.importGraph(Set(reflect.Module(glob).uri))
|
||||
}
|
||||
}
|
||||
|
||||
output {
|
||||
renderer {
|
||||
// mimick result of `pkl analyze imports` CLI command
|
||||
converters {
|
||||
[Map] = (it) -> it.toMapping()
|
||||
[Set] = (it) -> it.toListing()
|
||||
}
|
||||
}
|
||||
}
|
||||
Vendored
+1
@@ -0,0 +1 @@
|
||||
res = import*("@a/mods/*.pkl").toMap().mapValues((_, m) -> m.x)
|
||||
Vendored
+1
@@ -0,0 +1 @@
|
||||
res = import("@a/mods/one.pkl").x
|
||||
Vendored
+39
@@ -0,0 +1,39 @@
|
||||
examples {
|
||||
["single"] {
|
||||
new {
|
||||
imports {
|
||||
["file:///$snippetsDir/input/projects/analyzeLocalPackageGlob/single.pkl"] {
|
||||
new {
|
||||
uri = "projectpackage://example.com/a@1.0.0#/mods/one.pkl"
|
||||
}
|
||||
}
|
||||
["projectpackage://example.com/a@1.0.0#/mods/one.pkl"] {}
|
||||
}
|
||||
resolvedImports {
|
||||
["file:///$snippetsDir/input/projects/analyzeLocalPackageGlob/single.pkl"] = "file:///$snippetsDir/input/projects/analyzeLocalPackageGlob/single.pkl"
|
||||
["projectpackage://example.com/a@1.0.0#/mods/one.pkl"] = "file:///$snippetsDir/input-helper/projects/analyzeLocalPackageGlob/mods/one.pkl"
|
||||
}
|
||||
}
|
||||
}
|
||||
["glob"] {
|
||||
new {
|
||||
imports {
|
||||
["file:///$snippetsDir/input/projects/analyzeLocalPackageGlob/glob.pkl"] {
|
||||
new {
|
||||
uri = "projectpackage://example.com/a@1.0.0#/mods/one.pkl"
|
||||
}
|
||||
new {
|
||||
uri = "projectpackage://example.com/a@1.0.0#/mods/two.pkl"
|
||||
}
|
||||
}
|
||||
["projectpackage://example.com/a@1.0.0#/mods/one.pkl"] {}
|
||||
["projectpackage://example.com/a@1.0.0#/mods/two.pkl"] {}
|
||||
}
|
||||
resolvedImports {
|
||||
["file:///$snippetsDir/input/projects/analyzeLocalPackageGlob/glob.pkl"] = "file:///$snippetsDir/input/projects/analyzeLocalPackageGlob/glob.pkl"
|
||||
["projectpackage://example.com/a@1.0.0#/mods/one.pkl"] = "file:///$snippetsDir/input-helper/projects/analyzeLocalPackageGlob/mods/one.pkl"
|
||||
["projectpackage://example.com/a@1.0.0#/mods/two.pkl"] = "file:///$snippetsDir/input-helper/projects/analyzeLocalPackageGlob/mods/two.pkl"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Vendored
+1
@@ -0,0 +1 @@
|
||||
res = Map("@a/mods/one.pkl", 1, "@a/mods/two.pkl", 2)
|
||||
Vendored
+1
@@ -0,0 +1 @@
|
||||
res = 1
|
||||
Reference in new issue
Block a user