CertainLach/jrsonnet

import pathing doesn't match go-jsonnet

Opened this issue · 4 comments

Within a jsonnet or libsonnet file, the import command seems to operate from the directory where jrsonnet was invoked. The LIbrary search dirs (either -J or JSONNET_PATH) weren't respected either.

In general, the import functionality doesn't match the go-jsonnet implementation.

Is it?

out
├── a.jsonnet
├── b.jsonnet
└── library
    └── c.jsonnet

a.jsonnet:

import 'b.jsonnet'

b.jsonnet:

import 'c.jsonnet'

c.jsonnet:

1 + 2

Running jrsonnet out/a.jsonnet -J out/library yields 3.
So import operates on paths relative to calling file, and library paths are respected.

Do you have concrete examples where it behaves wrong? Is this problem in jrsonnet itself, or in the project, which is using jrsonnet as a library? Which version of jrsonnet do you use?

I'll try to work up a concrete example. I have a pretty extensive jSonnet project and my jsonnet invocations also have two library paths. When I run my generate script with go-jsonnet it works; with jrsonnet it fails.

I like the idea of faster runtimes for jrsonnet vs. jsonnet.

Don't you have symlinks lying around, by any chance?

@CertainLach could you clarify your question? Are you asking if I have symlinks in use in my jsonnet libraries? I didn't up until this week. I do have them now but I did not have them when I opened the issue.