rules_jsonnet
rules_jsonnet copied to clipboard
Ensure that `data` from code_libraries are included
Issue
When a jsonnet_library defined a data dependency and the jsonnet_library was included in a {tla,ext}_code_libraries (See updated //:extvar_code_library_test) the data was not being included which results in error like:
==================== Test output for //:extvar_code_library_test:
FAIL (exit code): extvar_code_library_test
Expected: 0
Actual: 1
Output: RUNTIME ERROR: couldn't open import "file.txt": no match locally or in the Jsonnet library path
s
extvar_code_library.jsonnet:2:14-34 thunk <data> from <$>
extvar_code_library.jsonnet:7:9-13 object <anonymous>
Field "data"
During manifestation
Digging into the sandbox, the data file (files.txt in the example //:extvar_code_library_test) looks like:
> ls /private/var/tmp/_bazel/e78a12433a29cf2af3c4357fe05a3925/execroot/_main/bazel-out/darwin_arm64
-fastbuild/bin/extvar_code_library_test.runfiles/_main/
code_library.libsonnet extvar_code_library.jsonnet workflow.libsonnet
extvar_code_library_test extvar_files_library_golden.json
Resolution
Adding the missing addition of the data_runfiles to the transitive_data in jsonnet_to_json{,_test}.
Updated the example to make use of this as well.