Package org.pkl.core.project
Class ProjectDeps
- java.lang.Object
-
- org.pkl.core.project.ProjectDeps
-
public class ProjectDeps extends java.lang.ObjectThe Java representation of a project's resolved dependency list. Resolved dependencies are stored as JSON as a sibling file to PklProject. Each key in the JSON file records an entry for each dependecy via its base URI, and the major version number.A resolved dependency can either be local or remote. A remote dependency will have its checksums recorded, while a local dependency will point to the relative path of the project holding the dependency.
Sample structure:
{ "schemaVersion": 1, "resolvedDependencies": { "package://example.com/my/package@0": { "type": "remote", "uri": "projectpackage://example.com/my/package@0.5.0", "checksums": { "sha256": "abc123" } }, "package://example.com/other/package@1": { "type": "local", "uri": "projectpackage://example.com/other/package@1.5.0", "path": "../sibling" } } }
-
-
Constructor Summary
Constructors Constructor Description ProjectDeps(org.graalvm.collections.EconomicMap<CanonicalPackageUri,Dependency> resolvedDependencies)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(java.lang.Object o)@Nullable Dependencyget(CanonicalPackageUri canonicalPackageUri)Given a declared dependency, return the resolved dependency.inthashCode()static ProjectDepsparse(java.lang.String input)static ProjectDepsparse(java.nio.file.Path path)java.lang.StringtoString()voidwriteTo(java.io.OutputStream out)Serializes project dependencies to JSON, and writes it to the provided output stream.
-
-
-
Constructor Detail
-
ProjectDeps
public ProjectDeps(org.graalvm.collections.EconomicMap<CanonicalPackageUri,Dependency> resolvedDependencies)
-
-
Method Detail
-
parse
public static ProjectDeps parse(java.nio.file.Path path) throws java.io.IOException, java.net.URISyntaxException, Json.JsonParseException
- Throws:
java.io.IOExceptionjava.net.URISyntaxExceptionJson.JsonParseException
-
parse
public static ProjectDeps parse(java.lang.String input) throws Json.JsonParseException, java.net.URISyntaxException
- Throws:
Json.JsonParseExceptionjava.net.URISyntaxException
-
get
public @Nullable Dependency get(CanonicalPackageUri canonicalPackageUri)
Given a declared dependency, return the resolved dependency.
-
writeTo
public void writeTo(java.io.OutputStream out) throws java.io.IOExceptionSerializes project dependencies to JSON, and writes it to the provided output stream.- Throws:
java.io.IOException
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
-