mirror of
https://github.com/apple/pkl.git
synced 2026-04-18 14:39:54 +02:00
Add support for Windows (#492)
This adds support for Windows. The in-language path separator is still `/`, to ensure Pkl programs are cross-platform. Log lines are written using CRLF endings on Windows. Modules that are combined with `--module-output-separator` uses LF endings to ensure consistent rendering across platforms. `jpkl` does not work on Windows as a direct executable. However, it can work with `java -jar jpkl`. Additional details: * Adjust git settings for Windows * Add native executable for pkl cli * Add jdk17 windows Gradle check in CI * Adjust CI test reports to be staged within Gradle rather than by shell script. * Fix: encode more characters that are not safe Windows paths * Skip running tests involving symbolic links on Windows (these require administrator privileges to run). * Introduce custom implementation of `IoUtils.relativize` * Allow Gradle to initialize ExecutableJar `Property` values * Add Gradle flag to enable remote JVM debugging Co-authored-by: Philip K.F. Hölzenspies <holzensp@gmail.com>
This commit is contained in:
@@ -22,6 +22,7 @@ import kotlin.Pair
|
||||
import org.pkl.commons.cli.CliBaseOptions.Companion.getProjectFile
|
||||
import org.pkl.commons.cli.CliCommand
|
||||
import org.pkl.commons.cli.CliException
|
||||
import org.pkl.commons.toPath
|
||||
import org.pkl.core.*
|
||||
import org.pkl.core.module.ModuleKeyFactories
|
||||
import org.pkl.core.packages.*
|
||||
@@ -136,7 +137,7 @@ class CliDocGenerator(private val options: CliDocGeneratorOptions) : CliCommand(
|
||||
val packageUris = mutableListOf<PackageUri>()
|
||||
for (moduleUri in options.base.normalizedSourceModules) {
|
||||
if (moduleUri.scheme == "file") {
|
||||
val dir = Path.of(moduleUri).parent
|
||||
val dir = moduleUri.toPath().parent
|
||||
val projectFile = dir.getProjectFile(options.base.normalizedRootDir)
|
||||
if (projectFile != null) {
|
||||
pklProjectPaths.add(projectFile)
|
||||
@@ -229,13 +230,12 @@ class CliDocGenerator(private val options: CliDocGeneratorOptions) : CliCommand(
|
||||
DocPackageInfo.fromPkl(module).apply {
|
||||
evaluator.collectImportedModules(overviewImports)
|
||||
}
|
||||
schemasByDocPackageInfoAndPath[docPackageInfo to Path.of(uri.path).parent] =
|
||||
mutableSetOf()
|
||||
schemasByDocPackageInfoAndPath[docPackageInfo to uri.toPath().parent] = mutableSetOf()
|
||||
}
|
||||
|
||||
for (uri in regularModuleUris) {
|
||||
val entry =
|
||||
schemasByDocPackageInfoAndPath.keys.find { uri.path.startsWith(it.second.toString()) }
|
||||
schemasByDocPackageInfoAndPath.keys.find { uri.toPath().startsWith(it.second) }
|
||||
?: throw CliException("Could not find a doc-package-info.pkl for module $uri")
|
||||
val schema =
|
||||
evaluator.evaluateSchema(ModuleSource.uri(uri)).apply {
|
||||
|
||||
@@ -26,6 +26,7 @@ import org.pkl.commons.deleteRecursively
|
||||
import org.pkl.core.ModuleSchema
|
||||
import org.pkl.core.PClassInfo
|
||||
import org.pkl.core.Version
|
||||
import org.pkl.core.util.IoUtils
|
||||
|
||||
/**
|
||||
* Entry point for the low-level Pkldoc API.
|
||||
@@ -126,7 +127,7 @@ class DocGenerator(
|
||||
val dest = basePath.resolve("current")
|
||||
if (dest.exists() && dest.isSameFileAs(src)) continue
|
||||
dest.deleteIfExists()
|
||||
dest.createSymbolicLinkPointingTo(basePath.relativize(src))
|
||||
dest.createSymbolicLinkPointingTo(IoUtils.relativize(src, basePath))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,6 +28,7 @@ import java.net.URI
|
||||
import java.nio.file.Path
|
||||
import org.pkl.commons.cli.cliMain
|
||||
import org.pkl.commons.cli.commands.BaseCommand
|
||||
import org.pkl.commons.cli.commands.BaseOptions.Companion.parseModuleName
|
||||
import org.pkl.commons.cli.commands.ProjectOptions
|
||||
import org.pkl.core.Release
|
||||
|
||||
|
||||
Reference in New Issue
Block a user