Package org.pkl.core.project
Class ProjectPackager
- java.lang.Object
-
- org.pkl.core.project.ProjectPackager
-
public class ProjectPackager extends java.lang.ObjectGiven 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
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classProjectPackager.PackageResult
-
Constructor Summary
Constructors Constructor Description 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 Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcreatePackages()ProjectPackager.PackageResultdoPackage(Project project)voidvalidateImportsAndReads(Project project, java.nio.file.Path pklModulePath)Parse a Pkl module, and verify that itsimports andreads resolve to locations within the package directory.
-
-
-
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
-
doPackage
public ProjectPackager.PackageResult doPackage(Project project) 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 itsimports andreads 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.
-
-