format all bzl files consistently with buildifier

This commit is contained in:
Brian Hicks 2023-05-02 08:48:58 -05:00
parent 4db7f76d3a
commit 6c15c63487
No known key found for this signature in database
GPG Key ID: C4F324B9CAAB0D50
10 changed files with 62 additions and 52 deletions

2
BUCK
View File

@ -11,7 +11,7 @@ elm_docs(
filegroup(
name = "src",
srcs = glob(["src/**/*.elm"]),
visibility = ["//component-catalog:app"]
visibility = ["//component-catalog:app"],
)
node_modules(

View File

@ -8,7 +8,7 @@ elm_app(
source_directories = {
"../src": "//:src",
"src": "src",
}
},
)
filegroup(
@ -20,5 +20,5 @@ filegroup(
"elm.js": ":app",
"application.json": "elm.json",
"package.json": "//:elm.json",
}
},
)

View File

@ -11,12 +11,16 @@ def _elm_docs_impl(ctx: "context") -> [DefaultInfo.type]:
ctx.attrs._python_toolchain[PythonToolchainInfo].interpreter,
elm_toolchain.isolated_compile[DefaultInfo].default_outputs,
ctx.attrs.elm_json,
"--build-dir", build.as_output(),
"--elm-compiler", elm_toolchain.elm,
"--build-dir",
build.as_output(),
"--elm-compiler",
elm_toolchain.elm,
"--verbose",
"docs",
"--out", docs.as_output(),
"--src", ctx.attrs.src,
"--out",
docs.as_output(),
"--src",
ctx.attrs.src,
)
ctx.actions.run(
@ -35,13 +39,13 @@ elm_docs = rule(
"src": attrs.source(allow_directory = True),
"_elm_toolchain": attrs.toolchain_dep(
default = "toolchains//:elm",
providers=[ElmToolchainInfo]
providers = [ElmToolchainInfo],
),
"_python_toolchain": attrs.toolchain_dep(
default = "toolchains//:python",
providers=[PythonToolchainInfo]
providers = [PythonToolchainInfo],
),
}
},
)
def _elm_app_impl(ctx: "context") -> [DefaultInfo.type]:
@ -54,12 +58,15 @@ def _elm_app_impl(ctx: "context") -> [DefaultInfo.type]:
ctx.attrs._python_toolchain[PythonToolchainInfo].interpreter,
elm_toolchain.isolated_compile[DefaultInfo].default_outputs,
ctx.attrs.elm_json,
"--build-dir", build.as_output(),
"--elm-compiler", elm_toolchain.elm,
"--build-dir",
build.as_output(),
"--elm-compiler",
elm_toolchain.elm,
"--verbose",
"make",
ctx.attrs.main,
"--output", out.as_output(),
"--output",
out.as_output(),
)
for (name, value) in ctx.attrs.source_directories.items():
@ -96,11 +103,11 @@ elm_app = rule(
"optimize": attrs.bool(default = False),
"_elm_toolchain": attrs.toolchain_dep(
default = "toolchains//:elm",
providers=[ElmToolchainInfo]
providers = [ElmToolchainInfo],
),
"_python_toolchain": attrs.toolchain_dep(
default = "toolchains//:python",
providers=[PythonToolchainInfo]
providers = [PythonToolchainInfo],
),
}
},
)

View File

@ -16,7 +16,6 @@ def _system_elm_toolchain_impl(ctx) -> [[DefaultInfo.type, ElmToolchainInfo.type
),
]
system_elm_toolchain = rule(
impl = _system_elm_toolchain_impl,
attrs = {

View File

@ -11,9 +11,12 @@ def _node_modules_impl(ctx: "context") -> [DefaultInfo.type]:
ctx.attrs._python_toolchain[PythonToolchainInfo].interpreter,
node_toolchain.build_node_modules[DefaultInfo].default_outputs,
out.as_output(),
"--package", ctx.attrs.package,
"--package-lock", ctx.attrs.package_lock,
"--bin-dir", node_toolchain.bin_dir[DefaultInfo].default_outputs,
"--package",
ctx.attrs.package,
"--package-lock",
ctx.attrs.package_lock,
"--bin-dir",
node_toolchain.bin_dir[DefaultInfo].default_outputs,
],
category = "npm",
)
@ -27,13 +30,13 @@ node_modules = rule(
"package_lock": attrs.source(),
"_node_toolchain": attrs.toolchain_dep(
default = "toolchains//:node",
providers=[NodeToolchainInfo]
providers = [NodeToolchainInfo],
),
"_python_toolchain": attrs.toolchain_dep(
default = "toolchains//:python",
providers=[PythonToolchainInfo]
providers = [PythonToolchainInfo],
),
}
},
)
def _npm_bin_impl(ctx: "context") -> [[DefaultInfo.type, RunInfo.type]]:
@ -50,7 +53,8 @@ def _npm_bin_impl(ctx: "context") -> [[DefaultInfo.type, RunInfo.type]]:
ctx.attrs.node_modules,
bin_name,
out.as_output(),
"--bin-dir", node_toolchain.bin_dir[DefaultInfo].default_outputs,
"--bin-dir",
node_toolchain.bin_dir[DefaultInfo].default_outputs,
],
category = "build_npm_bin",
)
@ -67,11 +71,11 @@ npm_bin = rule(
"node_modules": attrs.source(),
"_node_toolchain": attrs.toolchain_dep(
default = "toolchains//:node",
providers=[NodeToolchainInfo]
providers = [NodeToolchainInfo],
),
"_python_toolchain": attrs.toolchain_dep(
default = "toolchains//:python",
providers=[PythonToolchainInfo]
providers = [PythonToolchainInfo],
),
}
},
)

View File

@ -24,11 +24,11 @@ node_toolchain = rule(
impl = _node_toolchain_impl,
attrs = {
"bin_dir": attrs.dep(
default="prelude-nri//node:bin"
default = "prelude-nri//node:bin",
),
"node": attrs.dep(
providers = [RunInfo],
default="prelude-nri//node:node"
default = "prelude-nri//node:node",
),
"_build_node_modules": attrs.dep(
default = "prelude-nri//node:build_node_modules.py",