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:
Daniel Chao
2024-06-04 16:52:20 -07:00
committed by GitHub
parent c0a7080287
commit d5ba8fa736
49 changed files with 764 additions and 235 deletions

View File

@@ -542,6 +542,12 @@ Cannot combine glob imports with triple-dot module URIs.
cannotGlobUri=\
Cannot expand glob pattern `{0}` because scheme `{1}` is not globbable.
cannotResolveInLocalDependencyNotGlobbable=\
Cannot resolve import in local dependency because scheme `{0}` is not globbable.
cannotResolveInLocalDependencyNotGlobbableNorLocal=\
Cannot resolve import in local dependency because scheme `{0}` is not globbable and is not local.
expectedAnnotationClass=\
Expected an annotation class.
@@ -680,6 +686,11 @@ Cannot resolve a triple-dot import from module URI `{0}`.\n\
\n\
Triple-dot imports may only be resolved by module schemes that are considered local, and have hierarchical URIs.
moduleDoesNotSupportDependencies=\
Module `{0}` does not support importing dependencies.\n\
\n\
Dependencies can only be imported in modules that belong to a project, or within a package.
cannotHaveRelativeImport=\
Module `{0}` cannot have a relative import URI.
@@ -819,6 +830,9 @@ Only type unions can have a default marker (*).
invalidModuleOutputValue=\
Expected `output.value` of module `{2}` to be of type `{0}`, but got type `{1}`.
cannotResolveDependencyWithoutHierarchicalUris=\
Cannot import dependency because project URI `{0}` does not have a hierarchical path.
cannotResolveDependencyNoProject=\
Cannot import dependency because there is no project found.\n\
\n\
@@ -830,6 +844,11 @@ Cannot find a dependency named `{0}`, because it is not declared in the current
\n\
To fix this, add it to the `dependencies` section of your `PklProject` file, and resolve your dependencies.
cannotResolveDependencyFromReaderWithOpaqueUris=\
Cannot resolve dependencies from module reader with opaque URIs.\n\
\n\
Module reader for scheme `{0}` does not support hierarchical URIs.
cannotFindDependencyInPackage=\
Cannot find dependency named `{0}`, because it was not declared in package `{1}`.
@@ -856,10 +875,10 @@ For example, `example.com` in URI `project://example.com/my/package@1.0.0`.
unexpectedChecksumInPackageUri=\
Did not expect to find a checksum component in this package URI.
missingProjectDepsJson=\
Cannot resolve dependency because file `PklProject.deps.json` is missing in project directory `{0}`.\n\
cannotLoadProjectDepsJson=\
Encountered an error when attempting to load `PklProject.deps.json` at `{0}`.\n\
\n\
Run `pkl project resolve` to create a new set of dependencies.
Try running `pkl project resolve` within the project directory to create a new set of dependencies.
invalidProjectDepsJson=\
Cannot resolve dependency because file `{0}` is malformed.\n\
@@ -978,6 +997,16 @@ No package was declared in project `{0}`.\n\
\n\
Add a `package` section to the PklProject file.
relativePathPropertyDefinedByProjectFromNonFileUri=\
Invalid property specified in project `{0}`\n\
\n\
Property `{1}` is only permitted in PklProject files loaded from `file:` URIs.
invalidUsageOfProjectFromNonFileUri=\
Invalid usage of project `{0}`\n\
\n\
This action can only be performed with PklProject files loaded from `file:` URIs.
packageTestsFailed=\
Failed to create package `{0}`, because its API tests are failing.