Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pkl-gradle: cannot use pkldoc generator on package URIs #791

Closed
bioball opened this issue Nov 8, 2024 · 0 comments · Fixed by #821
Closed

pkl-gradle: cannot use pkldoc generator on package URIs #791

bioball opened this issue Nov 8, 2024 · 0 comments · Fixed by #821
Labels
bug Something isn't working
Milestone

Comments

@bioball
Copy link
Contributor

bioball commented Nov 8, 2024

This is a regression:

In the following:

pkl {
  pkldocGenerators {
    register("pkldoc") {
      sourceModules = listOf(uri("package://pkg.pkl-lang.org/pkl-pantry/pkl.toml@1.0.0"))
    }
  }
}

The implicit <taskName>GetImports task will attempt to analyze the imports of a package, which fails with:

* What went wrong:
Execution failed for task ':pkldocGatherImports'.
> –– Pkl Error ––
  Module URI `package://pkg.pkl-lang.org/pkl-pantry/pkl.toml@1.0.0` has invalid syntax.

The workaround for now is to set transitiveModules explicitly to something, which disables the GetImports task dependency.

pkl {
  pkldocGenerators {
    register("pkldoc") {
      sourceModules = listOf(uri("package://pkg.pkl-lang.org/pkl-pantry/pkl.toml@1.0.0"))
      transitiveModules = files("some_file.txt")
    }
  }
}

To fix this: we only need to analyze the imports of file: URIs. There is little chance that non-file URIs can import file URIs, because Pkl's default security manager disallows this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant