From 1056cdc20aa5bb56f205884f76b6c66ba67ecac7 Mon Sep 17 00:00:00 2001 From: Yuki Yugui Sonoda Date: Tue, 13 Sep 2016 14:48:45 +0900 Subject: [PATCH 1/2] Allow .libsonnet files in srcs to follow the recent convention of suffixing library implementations with ".libsonnet". --- jsonnet/jsonnet.bzl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jsonnet/jsonnet.bzl b/jsonnet/jsonnet.bzl index 2540674..6bbb502 100644 --- a/jsonnet/jsonnet.bzl +++ b/jsonnet/jsonnet.bzl @@ -14,7 +14,7 @@ """Jsonnet rules for Bazel.""" -_JSONNET_FILETYPE = FileType([".jsonnet"]) +_JSONNET_FILETYPE = FileType([".jsonnet", ".libsonnet"]) def _setup_deps(deps): """Collects source files and import flags of transitive dependencies. From 4eab3adc5c630aaf3f4a215ee18908a3ca122a4d Mon Sep 17 00:00:00 2001 From: Yuki Yugui Sonoda Date: Fri, 30 Sep 2016 09:26:13 +0900 Subject: [PATCH 2/2] Fix examples with the libsonnet convention. --- README.md | 20 +++++++++---------- examples/BUILD | 2 +- examples/intersection.jsonnet | 2 +- examples/wordcount.jsonnet | 2 +- .../{workflow.jsonnet => workflow.libsonnet} | 0 5 files changed, 13 insertions(+), 13 deletions(-) rename examples/{workflow.jsonnet => workflow.libsonnet} (100%) diff --git a/README.md b/README.md index e16a38a..41d0a26 100644 --- a/README.md +++ b/README.md @@ -257,17 +257,17 @@ Suppose you have the following directory structure: WORKSPACE workflows/ BUILD - workflow.jsonnet + workflow.libsonnet wordcount.jsonnet intersection.jsonnet ``` -Say that `workflow.jsonnet` is a base configuration library for a workflow +Say that `workflow.libsonnet` is a base configuration library for a workflow scheduling system and `wordcount.jsonnet` and `intersection.jsonnet` both -import `workflow.jsonnet` to define workflows for performing a wordcount and +import `workflow.libsonnet` to define workflows for performing a wordcount and intersection of two files, respectively. -First, create a `jsonnet_library` target with `workflow.jsonnet`: +First, create a `jsonnet_library` target with `workflow.libsonnet`: `workflows/BUILD`: @@ -276,7 +276,7 @@ load("@io_bazel_rules_jsonnet//jsonnet:jsonnet.bzl", "jsonnet_library") jsonnet_library( name = "workflow", - srcs = ["workflow.jsonnet"], + srcs = ["workflow.libsonnet"], ) ``` @@ -469,12 +469,12 @@ Suppose you have the following directory structure: WORKSPACE config/ BUILD - base_config.jsonnet + base_config.libsonnet test_config.jsonnet test_config.json ``` -Suppose that `base_config.jsonnet` is a library Jsonnet file, containing the +Suppose that `base_config.libsonnet` is a library Jsonnet file, containing the base configuration for a service. Suppose that `test_config.jsonnet` is a test configuration file that is used to test `base_config.jsonnet`, and `test_config.json` is the expected JSON output from compiling @@ -496,7 +496,7 @@ load( jsonnet_library( name = "base_config", - srcs = ["base_config.jsonnet"], + srcs = ["base_config.libsonnet"], ) jsonnet_to_json_test( @@ -518,7 +518,7 @@ Suppose you have the following directory structure: WORKSPACE config/ BUILD - base_config.jsonnet + base_config.libsonnet invalid_config.jsonnet invalid_config.output ``` @@ -544,7 +544,7 @@ load( jsonnet_library( name = "base_config", - srcs = ["base_config.jsonnet"], + srcs = ["base_config.libsonnet"], ) jsonnet_to_json_test( diff --git a/examples/BUILD b/examples/BUILD index 6fbb726..5950663 100644 --- a/examples/BUILD +++ b/examples/BUILD @@ -9,7 +9,7 @@ load( jsonnet_library( name = "workflow", - srcs = ["workflow.jsonnet"], + srcs = ["workflow.libsonnet"], ) jsonnet_to_json( diff --git a/examples/intersection.jsonnet b/examples/intersection.jsonnet index a4c66ce..d757e49 100644 --- a/examples/intersection.jsonnet +++ b/examples/intersection.jsonnet @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -local workflow = import "examples/workflow.jsonnet"; +local workflow = import "examples/workflow.libsonnet"; // Workflow that performs an intersection of two files using shell commands. { diff --git a/examples/wordcount.jsonnet b/examples/wordcount.jsonnet index b6aafe4..bad7424 100644 --- a/examples/wordcount.jsonnet +++ b/examples/wordcount.jsonnet @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -local workflow = import "examples/workflow.jsonnet"; +local workflow = import "examples/workflow.libsonnet"; // Workflow that performs a wordcount using shell commands. { diff --git a/examples/workflow.jsonnet b/examples/workflow.libsonnet similarity index 100% rename from examples/workflow.jsonnet rename to examples/workflow.libsonnet