Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow .libsonnet files in srcs #11

Merged
merged 2 commits into from
Sep 30, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`:

Expand All @@ -276,7 +276,7 @@ load("@io_bazel_rules_jsonnet//jsonnet:jsonnet.bzl", "jsonnet_library")

jsonnet_library(
name = "workflow",
srcs = ["workflow.jsonnet"],
srcs = ["workflow.libsonnet"],
)
```

Expand Down Expand Up @@ -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
Expand All @@ -496,7 +496,7 @@ load(

jsonnet_library(
name = "base_config",
srcs = ["base_config.jsonnet"],
srcs = ["base_config.libsonnet"],
)

jsonnet_to_json_test(
Expand All @@ -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
```
Expand All @@ -544,7 +544,7 @@ load(

jsonnet_library(
name = "base_config",
srcs = ["base_config.jsonnet"],
srcs = ["base_config.libsonnet"],
)

jsonnet_to_json_test(
Expand Down
2 changes: 1 addition & 1 deletion examples/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ load(

jsonnet_library(
name = "workflow",
srcs = ["workflow.jsonnet"],
srcs = ["workflow.libsonnet"],
)

jsonnet_to_json(
Expand Down
2 changes: 1 addition & 1 deletion examples/intersection.jsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -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.
{
Expand Down
2 changes: 1 addition & 1 deletion examples/wordcount.jsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -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.
{
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion jsonnet/jsonnet.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down