Skip to content

Commit c06aaaf

Browse files
committed
Ensure that data deps are usable from library vars
1 parent 4e40cb0 commit c06aaaf

4 files changed

Lines changed: 20 additions & 16 deletions

File tree

examples/BUILD

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,8 @@ jsonnet_to_json_test(
120120
jsonnet_library(
121121
name = "code_library_lib",
122122
srcs = ["code_library.libsonnet"],
123-
deps = [":workflow"]
123+
deps = [":workflow"],
124+
data = [":test_str_files"]
124125
)
125126

126127
jsonnet_to_json_test(
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
local codefile = std.extVar('codefile');
2+
local data = importstr 'file.txt';
23

34
{
45
job: codefile.workflow.Job,
56
shJob: codefile.workflow.ShJob,
7+
data: data,
68
}
Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,17 @@
11
{
2-
"job": {
3-
"deps": [ ],
4-
"inputs": [ ],
5-
"outputs": [ ],
6-
"type": "base"
7-
},
8-
"shJob": {
9-
"command": "",
10-
"deps": [ ],
11-
"inputs": [ ],
12-
"outputs": [ ],
13-
"type": "sh",
14-
"vars": { }
15-
}
2+
"job": {
3+
"deps": [],
4+
"inputs": [],
5+
"outputs": [],
6+
"type": "base"
7+
},
8+
"shJob": {
9+
"command": "",
10+
"deps": [],
11+
"inputs": [],
12+
"outputs": [],
13+
"type": "sh",
14+
"vars": {}
15+
},
16+
"data": "this is great\n"
1617
}

jsonnet/jsonnet.bzl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ def _setup_deps(deps, tla_code_libraries = {}, ext_code_libraries = {}):
9191
def _jsonnet_library_impl(ctx):
9292
"""Implementation of the jsonnet_library rule."""
9393
depinfo = _setup_deps(ctx.attr.deps)
94-
sources = depset(ctx.files.srcs, transitive = [depinfo.transitive_sources])
94+
sources = depset(ctx.files.srcs + ctx.files.data, transitive = [depinfo.transitive_sources])
9595
imports = depset(
9696
_get_import_paths(ctx.label, ctx.files.srcs, ctx.attr.imports, False),
9797
transitive = [depinfo.imports],

0 commit comments

Comments
 (0)