Class ProjectPackager


  • public class ProjectPackager
    extends java.lang.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 Detail

      • ProjectPackager

        public ProjectPackager​(java.util.List<Project> projects,
                               java.nio.file.Path workingDir,
                               java.lang.String outputPathPattern,
                               StackFrameTransformer stackFrameTransformer,
                               SecurityManager securityManager,
                               boolean skipPublishCheck,
                               java.io.Writer outputWriter)
    • Method Detail

      • createPackages

        public void createPackages()
                            throws java.io.IOException
        Throws:
        java.io.IOException
      • validateImportsAndReads

        public void validateImportsAndReads​(Project project,
                                            java.nio.file.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.