Class ProjectPackager

java.lang.Object
org.pkl.core.project.ProjectPackager

public final class ProjectPackager extends Object
Given a list of project directories, prepares artifacts to be published as a package.

Validates that relative imports of all included Pkl modules resolve to locations within the package.

Given a package URI package://example.com/thepackage@1.0.0, the following files get created:

  • thepackage@1.0.0 - the metadata JSON file
  • thepackage@1.0.0.sha256 - the SHA-256 checksum of the metadata file
  • thepackage@1.0.0.zip - the zip archive containing the contents of the package
  • thepackage@1.0.0.zip.sha256 - the SHA-256 checksum of the zip archive
  • Constructor Details

  • Method Details

    • createPackages

      public void createPackages() throws IOException
      Throws:
      IOException
    • doPackage

      public ProjectPackager.PackageResult doPackage(Project project) throws IOException
      Throws:
      IOException
    • validateImportsAndReads

      public void validateImportsAndReads(Project project, Path pklModulePath)
      Parse a Pkl module, and verify that its imports and reads resolve to locations within the package directory.

      Note that these might be glob expressions, so these paths might not actually exist. For example, an import might look like "foo/*.pkl", which would resolve as path `/some/dir/foo/*.pkl`, which is not a real file. This is just a sanity check to ensure that the paths can reasonably resolve to a location within the package directory.