mirror of
https://github.com/apple/pkl.git
synced 2026-07-11 07:32:56 +02:00
Improve handling of evaluator in multi-file output (#1670)
* Re-use same evaluator across output dirs * Close evaluator after all files are written
This commit is contained in:
@@ -229,8 +229,8 @@ constructor(
|
|||||||
private fun writeMultipleFileOutput(builder: EvaluatorBuilder) {
|
private fun writeMultipleFileOutput(builder: EvaluatorBuilder) {
|
||||||
val outputDirs = directoryOutputPaths!!
|
val outputDirs = directoryOutputPaths!!
|
||||||
val writtenFiles = mutableMapOf<Path, OutputFile>()
|
val writtenFiles = mutableMapOf<Path, OutputFile>()
|
||||||
|
builder.setOutputFormat(options.outputFormat).build().use { evaluator ->
|
||||||
for ((moduleUri, outputDir) in outputDirs) {
|
for ((moduleUri, outputDir) in outputDirs) {
|
||||||
val evaluator = builder.setOutputFormat(options.outputFormat).build()
|
|
||||||
if (outputDir.exists() && !outputDir.isDirectory()) {
|
if (outputDir.exists() && !outputDir.isDirectory()) {
|
||||||
throw CliException("Output path `$outputDir` exists and is not a directory.")
|
throw CliException("Output path `$outputDir` exists and is not a directory.")
|
||||||
}
|
}
|
||||||
@@ -268,6 +268,7 @@ constructor(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Resolves [rel] against this Path name-by-name. At each step, the real path is resolved if the
|
* Resolves [rel] against this Path name-by-name. At each step, the real path is resolved if the
|
||||||
|
|||||||
Reference in New Issue
Block a user