Originally created by @jamesward on GitHub (Aug 1, 2024).
With a few projects which use the Pkl Gradle plugin that work on Linux, they fail on Windows with:
–– Pkl Error ––
Refusing to load module `C:/Users/james/Desktop/projects/hello-pkl/src/hello.pkl` because it does not match any entry in the module allowlist (`--allowed-modules`).
So this looks like some weirdness with URIs and the Windows C: stuff.
Originally created by @jamesward on GitHub (Aug 1, 2024).
With a few projects which use the Pkl Gradle plugin that work on Linux, they fail on Windows with:
```
–– Pkl Error ––
Refusing to load module `C:/Users/james/Desktop/projects/hello-pkl/src/hello.pkl` because it does not match any entry in the module allowlist (`--allowed-modules`).
```
If I modify the `pkl` Gradle config to be:
```
pkl {
evaluators {
register("evalPkl") {
allowedModules = listOf("")
sourceModules.add(file("src/hello.pkl"))
outputFile = layout.buildDirectory.file("hello.yaml")
outputFormat = "yaml"
}
}
}
```
(overriding the `allowedModules` to be more permissive) I get:
```
–– Pkl Error ––
I/O error loading module `C:/Users/james/Desktop/projects/hello-pkl/src/hello.pkl`.
MalformedURLException: unknown protocol: c
```
So this looks like some weirdness with URIs and the Windows `C:` stuff.
For now, the workaround is to give Pkl a URI. For example:
sourceModules.add(file("src/hello.pkl").toURI())
@bioball commented on GitHub (Aug 1, 2024):
This was fixed in https://github.com/apple/pkl/pull/403.
For now, the workaround is to give Pkl a URI. For example:
```kt
sourceModules.add(file("src/hello.pkl").toURI())
```
This might be fixed in #403 but even when turning the file into a URI, I still get the error:
Refusing to load module `C:/Users/james/Desktop/projects/hello-pkl/src/hello.pkl` because it does not match any entry in the module allowlist (`--allowed-modules`).
I've confirmed that file("src/hello.pkl").toURI() is:
So maybe still something funky with the C:/ in there.
@jamesward commented on GitHub (Aug 2, 2024):
This might be fixed in #403 but even when turning the file into a URI, I still get the error:
```
Refusing to load module `C:/Users/james/Desktop/projects/hello-pkl/src/hello.pkl` because it does not match any entry in the module allowlist (`--allowed-modules`).
```
I've confirmed that `file("src/hello.pkl").toURI()` is:
```
file:/C:/Users/james/Desktop/projects/hello-pkl/src/hello.pkl
```
So maybe still something funky with the `C:/` in there.
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Originally created by @jamesward on GitHub (Aug 1, 2024).
With a few projects which use the Pkl Gradle plugin that work on Linux, they fail on Windows with:
If I modify the
pklGradle config to be:(overriding the
allowedModulesto be more permissive) I get:So this looks like some weirdness with URIs and the Windows
C:stuff.@bioball commented on GitHub (Aug 1, 2024):
This was fixed in https://github.com/apple/pkl/pull/403.
For now, the workaround is to give Pkl a URI. For example:
@jamesward commented on GitHub (Aug 2, 2024):
Oh awesome! Thank you!
@jamesward commented on GitHub (Aug 2, 2024):
This might be fixed in #403 but even when turning the file into a URI, I still get the error:
I've confirmed that
file("src/hello.pkl").toURI()is:So maybe still something funky with the
C:/in there.@jamesward commented on GitHub (Aug 6, 2024):
Any other workaround ideas? Or any easy way to test the changes in #403 on Windows?
@bioball commented on GitHub (Aug 6, 2024):
This was just fixed in release 0.26.3! Give that a shot and let us know if you have any issues.
@jamesward commented on GitHub (Aug 6, 2024):
It works now! Thank you!