-
-
Notifications
You must be signed in to change notification settings - Fork 73
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Right now you see that jsonnet_to_json() and jsonnet_to_json_test() implicitly call jsonnet with "-J .". This means that if these rules are used in combination with libraries that are declared in the root module, everything works as expected. But as soon as libraries are used from other modules, importing them becomes more tedious. The goal of this change is to ensure that if a Jsonnet project can be built within the root module, that module can also safely be used as a child module. We solve this by automatically adding the workspace root to the set of import paths for which one or more source files exist. Furthermore, by considering the root of every source file, we no longer need to use bin_dir and genfiles_dir. Fixes: #44 Fixes: #86 Fixed: #139 Fixes: #154 Fixes: #178
- Loading branch information
1 parent
0dac664
commit 91d5be0
Showing
9 changed files
with
70 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
other_module |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
(import 'hello.jsonnet') + ' ' + (import 'world.jsonnet') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
load("@rules_jsonnet//jsonnet:jsonnet.bzl", "jsonnet_library") | ||
|
||
jsonnet_library( | ||
name = "hello", | ||
srcs = ["hello.jsonnet"], | ||
visibility = ["//visibility:public"], | ||
) | ||
|
||
genrule( | ||
name = "world_src", | ||
outs = ["world.jsonnet"], | ||
cmd = "echo \\'world\\' > $@", | ||
) | ||
|
||
jsonnet_library( | ||
name = "world", | ||
srcs = ["world.jsonnet"], | ||
visibility = ["//visibility:public"], | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
module( | ||
name = "other_module", | ||
version = "0.0.0", | ||
) | ||
|
||
bazel_dep(name = "rules_jsonnet", version = "0.5.0") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
'hello' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
hello world |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters