Skip to content
This repository has been archived by the owner on Jul 18, 2024. It is now read-only.

Latest commit

 

History

History

rjsone

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 

rjsone

Bazel rule for rjsone.

Setup and usage via Bazel

WORKSPACE file:

load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
load("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository")

# rjsone is written in Go and hence needs rules_go and gazelle to be built.
# See https://github.com/bazelbuild/bazel-gazelle for the up to date setup instructions.
http_archive(
    name = "io_bazel_rules_go",
)

http_archive(
    name = "bazel_gazelle",
)

git_repository(
    name = "com_github_ash2k_bazel_tools",
    commit = "<commit>",
    remote = "https://github.com/ash2k/bazel-tools.git",
    shallow_since = "<bla>",
)

load("@com_github_ash2k_bazel_tools//:rjsone/deps.bzl", "rjsone_dependencies")

rjsone_dependencies()

BUILD.bazel file:

load("@com_github_ash2k_bazel_tools//:rjsone/def.bzl", "rjsone")

filegroup(
    name = "list",
    srcs = [
        "context1.yaml",
        "context2.yaml",
    ],
)

rjsone(
    name = "example1",
    contexts = [
        "context1.yaml",
        "context2.yaml",
    ],
    keyed_contexts = {
        ":list": "list",
        "named.yaml": "foobar",
    },
    template = "template_bazel.yaml",
)

Rule has two predeclared outputs: {name}.yaml and {name}.json. You may depend on one or the other depending on whether you want to get output as YAML or JSON.

bazel build //:example1 # builds both
bazel build //:example1.yaml
bazel build //:example1.json

Not all rjsone features are supported right now.