apple / pkl

A configuration as code language with rich validation and tooling.
https://pkl-lang.org
Apache License 2.0
9.84k stars 259 forks source link

Unexpected error when resolving project in the current directory #531

Closed pauloborges closed 1 week ago

pauloborges commented 2 weeks ago
$ cat PklProject
amends "pkl:Project"
$ cat main.pkl
foo {
  bar = 1
}
$ tree .
.
├── PklProject
└── main.pkl

1 directory, 2 files
$ pkl project resolve .
An unexpected error has occurred. Would you mind filing a bug report?

java.lang.NullPointerException
    at org.pkl.cli.CliProjectResolver.doRun(CliProjectResolver.kt:47)
    at org.pkl.commons.cli.CliCommand.run(CliCommand.kt:45)
    at org.pkl.cli.commands.ProjectCommand$Companion$ResolveCommand.run(ProjectCommand.kt:71)
    at com.github.ajalt.clikt.parsers.Parser.parse(Parser.kt:198)
    at com.github.ajalt.clikt.parsers.Parser.parse(Parser.kt:211)
    at com.github.ajalt.clikt.parsers.Parser.parse(Parser.kt:211)
    at com.github.ajalt.clikt.parsers.Parser.parse(Parser.kt:18)
    at com.github.ajalt.clikt.core.CliktCommand.parse(CliktCommand.kt:400)
    at com.github.ajalt.clikt.core.CliktCommand.parse$default(CliktCommand.kt:397)
    at com.github.ajalt.clikt.core.CliktCommand.main(CliktCommand.kt:415)
    at com.github.ajalt.clikt.core.CliktCommand.main(CliktCommand.kt:440)
    at org.pkl.cli.Main$main$1.invoke(Main.kt:52)
    at org.pkl.cli.Main$main$1.invoke(Main.kt:40)
    at org.pkl.commons.cli.CliMainKt.cliMain(CliMain.kt:31)
    at org.pkl.cli.Main.main(Main.kt:40)
$ cd ..
$ pkl project resolve pkl-bug-report
pkl-bug-report/PklProject.deps.json
$ tree pkl-bug-report
pkl-bug-report
├── PklProject
├── PklProject.deps.json
└── main.pkl

1 directory, 3 files
holzensp commented 1 week ago

I've (trivially) reproduced this with 0.26.0. The problem is the .; pkl project resolve (inside pkl-bug-report) runs without issue, as does pkl project resolve pkl-bug-report from the parent dir (as reported). Thanks for the bug report, @pauloborges!