mirror of
https://github.com/apple/pkl.git
synced 2026-05-03 05:34:26 +02:00
Support scheme-agnostic projects (#486)
This adds changes to support loading project dependencies in non-file based projects. The design for this feature can be found in SPICE-0005: https://github.com/apple/pkl-evolution/pull/6 Changes: * Consider all imports prefixed with `@` as dependency notation. * Bugfix: fix resolution of glob expressions in a local dependency. * Adjust pkl.Project: - Allow local dependencies from a scheme-local paths. - Disallow certain evaluator settings if not loaded as a file-based module. * Breaking API change: `ProjectDependenciesManager` constructor now requires `ModuleResolver` and `SecurityManager`.
This commit is contained in:
@@ -0,0 +1,8 @@
|
||||
amends "pkl:Project"
|
||||
|
||||
dependencies {
|
||||
["fruit"] {
|
||||
uri = "package://localhost:0/fruit@1.0.5"
|
||||
}
|
||||
["project4"] = import("../project4/PklProject")
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
{
|
||||
"schemaVersion": 1,
|
||||
"resolvedDependencies": {
|
||||
"package://localhost:0/fruit@1": {
|
||||
"type": "remote",
|
||||
"uri": "projectpackage://localhost:0/fruit@1.0.5",
|
||||
"checksums": {
|
||||
"sha256": "$skipChecksumVerification"
|
||||
}
|
||||
},
|
||||
"package://localhost:0/project4@1": {
|
||||
"type": "local",
|
||||
"uri": "projectpackage://localhost:0/project4@1.0.0",
|
||||
"path": "../project4"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
import "@fruit/catalog/apple.pkl"
|
||||
import "@project4/module1.pkl"
|
||||
|
||||
prop1 = apple
|
||||
prop2 = module1
|
||||
@@ -0,0 +1,5 @@
|
||||
amends "pkl:Project"
|
||||
|
||||
dependencies {
|
||||
["project7"] = import("../project7/PklProject")
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"schemaVersion": 1,
|
||||
"resolvedDependencies": {
|
||||
"package://localhost:0/project7@1": {
|
||||
"type": "local",
|
||||
"uri": "projectpackage://localhost:0/project7@1.0.0",
|
||||
"path": "../project7"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
import* "@project7/*.pkl" as proj7Files
|
||||
|
||||
res = proj7Files
|
||||
@@ -0,0 +1,3 @@
|
||||
import "@project7/main.pkl"
|
||||
|
||||
res = main.res
|
||||
@@ -0,0 +1,8 @@
|
||||
amends "pkl:Project"
|
||||
|
||||
package {
|
||||
name = "project7"
|
||||
version = "1.0.0"
|
||||
packageZipUrl = "https://bogus.value"
|
||||
baseUri = "package://localhost:0/project7"
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
res = import*("*.pkl")
|
||||
Reference in New Issue
Block a user