bazel-contrib / rules_jsonnet

Jsonnet rules for Bazel
https://bazelbuild.github.io/rules_jsonnet/
Apache License 2.0
68 stars 73 forks source link

Use consistent include paths when buiding in an external repository #178

Closed agotsis closed 7 months ago

agotsis commented 7 months ago

Currently, the include paths passed to the jsonnet compiler are not all adjusted for when used in an external repository - only explicitly included imports.

This results in inconsistent include behavior when rules from rules_jsonnet are depended upon in an external repository.

Adding the workspace_root as appropriate makes this behavior consistent between builds in a local workspace and in an external one.

All existing tests pass bazel build @examples//... with bazel 6.4.0.

agotsis commented 7 months ago

The CI build is failing on master already - see #173. This was tested successfully with bazel 6.4.0

Consider fixing #173 first, #174 seems to be insufficient.

Edit: All is well with #179.

EdSchouten commented 7 months ago

Thanks for the PR, @agotsis! I just merged a somewhat different change in #182 that should also address this issue. The reason I deviated from your change is because I think that we should simply make sure that the imports in the provider contains the correct set of paths to use. This also allows us to get rid of the genfiles/bindir logic.

agotsis commented 7 months ago

Thank you very much @EdSchouten - I have tested your changes in a large repo with complex dependencies on jsonnet and found that the issue that motivated me to open the PR has been fixed <3