Skip to content

Commit

Permalink
Adjustments in accordance with SPICE-0005
Browse files Browse the repository at this point in the history
  • Loading branch information
bioball committed May 20, 2024
1 parent 50dcbb6 commit c0bbe50
Show file tree
Hide file tree
Showing 38 changed files with 883 additions and 602 deletions.
53 changes: 11 additions & 42 deletions pkl-cli/src/main/kotlin/org/pkl/cli/CliProjectPackager.kt
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,8 @@ import org.pkl.commons.cli.CliBaseOptions
import org.pkl.commons.cli.CliException
import org.pkl.commons.cli.CliTestException
import org.pkl.commons.cli.CliTestOptions
import org.pkl.core.Loggers
import org.pkl.core.SecurityManagers
import org.pkl.core.StackFrameTransformers
import org.pkl.core.module.ModuleKeyFactories
import org.pkl.core.project.Project
import org.pkl.core.project.ProjectPackager
import org.pkl.core.resource.ResourceReaders
import org.pkl.core.runtime.ModuleResolver
import org.pkl.core.runtime.ResourceManager
import org.pkl.core.runtime.VmContext
import org.pkl.core.runtime.VmUtils
import org.pkl.core.util.ErrorMessages

class CliProjectPackager(
Expand Down Expand Up @@ -85,38 +76,16 @@ class CliProjectPackager(
}
}
}
// A VmContext is needed here because loading PklProject.deps.json uses resource readers
VmUtils.createContext {
val vmContext = VmContext.get(null)
vmContext.initialize(
VmContext.Holder(
StackFrameTransformers.defaultTransformer,
SecurityManagers.defaultManager,
httpClient,
ModuleResolver(listOf(ModuleKeyFactories.standardLibrary)),
ResourceManager(SecurityManagers.defaultManager, listOf(ResourceReaders.file())),
Loggers.noop(),
mapOf(),
mapOf(),
null,
null,
null,
null
)
)

ProjectPackager(
projects,
cliOptions.normalizedWorkingDir,
outputPath,
stackFrameTransformer,
securityManager,
httpClient,
skipPublishCheck,
consoleWriter
)
.createPackages()
}
.close()
ProjectPackager(
projects,
cliOptions.normalizedWorkingDir,
outputPath,
stackFrameTransformer,
securityManager,
httpClient,
skipPublishCheck,
consoleWriter
)
.createPackages()
}
}
3 changes: 2 additions & 1 deletion pkl-core/src/main/java/org/pkl/core/EvaluatorImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,8 @@ public EvaluatorImpl(
packageResolver,
projectDependencies == null
? null
: new ProjectDependenciesManager(projectDependencies)));
: new ProjectDependenciesManager(
projectDependencies, moduleResolver, securityManager)));
});
this.timeout = timeout;
// NOTE: would probably make sense to share executor between evaluators
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1818,6 +1818,8 @@ private URI resolveImport(String importUri, StringConstantContext importUriCtx)
} catch (VmException e) {
throw exceptionBuilder()
.evalError(e.getMessage(), e.getMessageArguments())
.withCause(e.getCause())
.withHint(e.getHint())
.withSourceSection(createSourceSection(importUriCtx))
.build();
}
Expand Down

0 comments on commit c0bbe50

Please sign in to comment.