Skip to main content Svelte Highlight v7.21.1

Starlark language preview

1. BUILD target

rules, globs, and select
horizon-dark
# Build the server binary
go_binary(
    name = "server",
    srcs = glob(["*.go"]),
    deps = [
        "//internal/api",
        "//internal/db",
    ],
    visibility = ["//visibility:public"],
)
atom-one-dark
# Build the server binary
go_binary(
    name = "server",
    srcs = glob(["*.go"]),
    deps = [
        "//internal/api",
        "//internal/db",
    ],
    visibility = ["//visibility:public"],
)
github-dark
# Build the server binary
go_binary(
    name = "server",
    srcs = glob(["*.go"]),
    deps = [
        "//internal/api",
        "//internal/db",
    ],
    visibility = ["//visibility:public"],
)
dracula
# Build the server binary
go_binary(
    name = "server",
    srcs = glob(["*.go"]),
    deps = [
        "//internal/api",
        "//internal/db",
    ],
    visibility = ["//visibility:public"],
)
nord
# Build the server binary
go_binary(
    name = "server",
    srcs = glob(["*.go"]),
    deps = [
        "//internal/api",
        "//internal/db",
    ],
    visibility = ["//visibility:public"],
)
github
# Build the server binary
go_binary(
    name = "server",
    srcs = glob(["*.go"]),
    deps = [
        "//internal/api",
        "//internal/db",
    ],
    visibility = ["//visibility:public"],
)

2. Custom rule

function definitions and providers
horizon-dark
def _impl(ctx):
    out = ctx.actions.declare_file(ctx.label.name + ".txt")
    ctx.actions.write(output = out, content = "generated")
    return [DefaultInfo(files = depset([out]))]

my_rule = rule(
    implementation = _impl,
    attrs = {"value": attr.string(default = "hello")},
)
atom-one-dark
def _impl(ctx):
    out = ctx.actions.declare_file(ctx.label.name + ".txt")
    ctx.actions.write(output = out, content = "generated")
    return [DefaultInfo(files = depset([out]))]

my_rule = rule(
    implementation = _impl,
    attrs = {"value": attr.string(default = "hello")},
)
github-dark
def _impl(ctx):
    out = ctx.actions.declare_file(ctx.label.name + ".txt")
    ctx.actions.write(output = out, content = "generated")
    return [DefaultInfo(files = depset([out]))]

my_rule = rule(
    implementation = _impl,
    attrs = {"value": attr.string(default = "hello")},
)
dracula
def _impl(ctx):
    out = ctx.actions.declare_file(ctx.label.name + ".txt")
    ctx.actions.write(output = out, content = "generated")
    return [DefaultInfo(files = depset([out]))]

my_rule = rule(
    implementation = _impl,
    attrs = {"value": attr.string(default = "hello")},
)
nord
def _impl(ctx):
    out = ctx.actions.declare_file(ctx.label.name + ".txt")
    ctx.actions.write(output = out, content = "generated")
    return [DefaultInfo(files = depset([out]))]

my_rule = rule(
    implementation = _impl,
    attrs = {"value": attr.string(default = "hello")},
)
github
def _impl(ctx):
    out = ctx.actions.declare_file(ctx.label.name + ".txt")
    ctx.actions.write(output = out, content = "generated")
    return [DefaultInfo(files = depset([out]))]

my_rule = rule(
    implementation = _impl,
    attrs = {"value": attr.string(default = "hello")},
)