mirror of
https://github.com/NoRedInk/noredink-ui.git
synced 2024-11-04 07:02:12 +03:00
format all bzl files consistently with buildifier
This commit is contained in:
parent
4db7f76d3a
commit
6c15c63487
2
BUCK
2
BUCK
@ -11,7 +11,7 @@ elm_docs(
|
|||||||
filegroup(
|
filegroup(
|
||||||
name = "src",
|
name = "src",
|
||||||
srcs = glob(["src/**/*.elm"]),
|
srcs = glob(["src/**/*.elm"]),
|
||||||
visibility = ["//component-catalog:app"]
|
visibility = ["//component-catalog:app"],
|
||||||
)
|
)
|
||||||
|
|
||||||
node_modules(
|
node_modules(
|
||||||
|
@ -8,7 +8,7 @@ elm_app(
|
|||||||
source_directories = {
|
source_directories = {
|
||||||
"../src": "//:src",
|
"../src": "//:src",
|
||||||
"src": "src",
|
"src": "src",
|
||||||
}
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
filegroup(
|
filegroup(
|
||||||
@ -20,5 +20,5 @@ filegroup(
|
|||||||
"elm.js": ":app",
|
"elm.js": ":app",
|
||||||
"application.json": "elm.json",
|
"application.json": "elm.json",
|
||||||
"package.json": "//:elm.json",
|
"package.json": "//:elm.json",
|
||||||
}
|
},
|
||||||
)
|
)
|
||||||
|
@ -11,12 +11,16 @@ def _elm_docs_impl(ctx: "context") -> [DefaultInfo.type]:
|
|||||||
ctx.attrs._python_toolchain[PythonToolchainInfo].interpreter,
|
ctx.attrs._python_toolchain[PythonToolchainInfo].interpreter,
|
||||||
elm_toolchain.isolated_compile[DefaultInfo].default_outputs,
|
elm_toolchain.isolated_compile[DefaultInfo].default_outputs,
|
||||||
ctx.attrs.elm_json,
|
ctx.attrs.elm_json,
|
||||||
"--build-dir", build.as_output(),
|
"--build-dir",
|
||||||
"--elm-compiler", elm_toolchain.elm,
|
build.as_output(),
|
||||||
|
"--elm-compiler",
|
||||||
|
elm_toolchain.elm,
|
||||||
"--verbose",
|
"--verbose",
|
||||||
"docs",
|
"docs",
|
||||||
"--out", docs.as_output(),
|
"--out",
|
||||||
"--src", ctx.attrs.src,
|
docs.as_output(),
|
||||||
|
"--src",
|
||||||
|
ctx.attrs.src,
|
||||||
)
|
)
|
||||||
|
|
||||||
ctx.actions.run(
|
ctx.actions.run(
|
||||||
@ -30,18 +34,18 @@ def _elm_docs_impl(ctx: "context") -> [DefaultInfo.type]:
|
|||||||
elm_docs = rule(
|
elm_docs = rule(
|
||||||
impl = _elm_docs_impl,
|
impl = _elm_docs_impl,
|
||||||
attrs = {
|
attrs = {
|
||||||
"out": attrs.string(default="docs.json"),
|
"out": attrs.string(default = "docs.json"),
|
||||||
"elm_json": attrs.source(),
|
"elm_json": attrs.source(),
|
||||||
"src": attrs.source(allow_directory = True),
|
"src": attrs.source(allow_directory = True),
|
||||||
"_elm_toolchain": attrs.toolchain_dep(
|
"_elm_toolchain": attrs.toolchain_dep(
|
||||||
default="toolchains//:elm",
|
default = "toolchains//:elm",
|
||||||
providers=[ElmToolchainInfo]
|
providers = [ElmToolchainInfo],
|
||||||
),
|
),
|
||||||
"_python_toolchain": attrs.toolchain_dep(
|
"_python_toolchain": attrs.toolchain_dep(
|
||||||
default="toolchains//:python",
|
default = "toolchains//:python",
|
||||||
providers=[PythonToolchainInfo]
|
providers = [PythonToolchainInfo],
|
||||||
),
|
),
|
||||||
}
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
def _elm_app_impl(ctx: "context") -> [DefaultInfo.type]:
|
def _elm_app_impl(ctx: "context") -> [DefaultInfo.type]:
|
||||||
@ -54,16 +58,19 @@ def _elm_app_impl(ctx: "context") -> [DefaultInfo.type]:
|
|||||||
ctx.attrs._python_toolchain[PythonToolchainInfo].interpreter,
|
ctx.attrs._python_toolchain[PythonToolchainInfo].interpreter,
|
||||||
elm_toolchain.isolated_compile[DefaultInfo].default_outputs,
|
elm_toolchain.isolated_compile[DefaultInfo].default_outputs,
|
||||||
ctx.attrs.elm_json,
|
ctx.attrs.elm_json,
|
||||||
"--build-dir", build.as_output(),
|
"--build-dir",
|
||||||
"--elm-compiler", elm_toolchain.elm,
|
build.as_output(),
|
||||||
|
"--elm-compiler",
|
||||||
|
elm_toolchain.elm,
|
||||||
"--verbose",
|
"--verbose",
|
||||||
"make",
|
"make",
|
||||||
ctx.attrs.main,
|
ctx.attrs.main,
|
||||||
"--output", out.as_output(),
|
"--output",
|
||||||
|
out.as_output(),
|
||||||
)
|
)
|
||||||
|
|
||||||
for (name, value) in ctx.attrs.source_directories.items():
|
for (name, value) in ctx.attrs.source_directories.items():
|
||||||
cmd.add(cmd_args(value, format="--source-directory=" + name + "={}"))
|
cmd.add(cmd_args(value, format = "--source-directory=" + name + "={}"))
|
||||||
|
|
||||||
if ctx.attrs.debug and ctx.attrs.optimize:
|
if ctx.attrs.debug and ctx.attrs.optimize:
|
||||||
fail("Only one of `optimize` and `debug` may be true!")
|
fail("Only one of `optimize` and `debug` may be true!")
|
||||||
@ -90,17 +97,17 @@ elm_app = rule(
|
|||||||
"main": attrs.source(),
|
"main": attrs.source(),
|
||||||
"source_directories": attrs.dict(
|
"source_directories": attrs.dict(
|
||||||
attrs.string(),
|
attrs.string(),
|
||||||
attrs.source(allow_directory=True),
|
attrs.source(allow_directory = True),
|
||||||
),
|
),
|
||||||
"debug": attrs.bool(default = False),
|
"debug": attrs.bool(default = False),
|
||||||
"optimize": attrs.bool(default = False),
|
"optimize": attrs.bool(default = False),
|
||||||
"_elm_toolchain": attrs.toolchain_dep(
|
"_elm_toolchain": attrs.toolchain_dep(
|
||||||
default="toolchains//:elm",
|
default = "toolchains//:elm",
|
||||||
providers=[ElmToolchainInfo]
|
providers = [ElmToolchainInfo],
|
||||||
),
|
),
|
||||||
"_python_toolchain": attrs.toolchain_dep(
|
"_python_toolchain": attrs.toolchain_dep(
|
||||||
default="toolchains//:python",
|
default = "toolchains//:python",
|
||||||
providers=[PythonToolchainInfo]
|
providers = [PythonToolchainInfo],
|
||||||
),
|
),
|
||||||
}
|
},
|
||||||
)
|
)
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
ElmToolchainInfo = provider(fields=[
|
ElmToolchainInfo = provider(fields = [
|
||||||
"elm",
|
"elm",
|
||||||
"isolated_compile",
|
"isolated_compile",
|
||||||
])
|
])
|
||||||
@ -16,11 +16,10 @@ def _system_elm_toolchain_impl(ctx) -> [[DefaultInfo.type, ElmToolchainInfo.type
|
|||||||
),
|
),
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
system_elm_toolchain = rule(
|
system_elm_toolchain = rule(
|
||||||
impl = _system_elm_toolchain_impl,
|
impl = _system_elm_toolchain_impl,
|
||||||
attrs = {
|
attrs = {
|
||||||
"_isolated_compile": attrs.dep(default="prelude-nri//elm:isolated_compile.py"),
|
"_isolated_compile": attrs.dep(default = "prelude-nri//elm:isolated_compile.py"),
|
||||||
},
|
},
|
||||||
is_toolchain_rule = True,
|
is_toolchain_rule = True,
|
||||||
)
|
)
|
||||||
@ -45,7 +44,7 @@ elm_toolchain = rule(
|
|||||||
providers = [RunInfo],
|
providers = [RunInfo],
|
||||||
default = "prelude-nri//elm:elm_compiler_binary",
|
default = "prelude-nri//elm:elm_compiler_binary",
|
||||||
),
|
),
|
||||||
"_isolated_compile": attrs.dep(default="prelude-nri//elm:isolated_compile.py"),
|
"_isolated_compile": attrs.dep(default = "prelude-nri//elm:isolated_compile.py"),
|
||||||
},
|
},
|
||||||
is_toolchain_rule = True,
|
is_toolchain_rule = True,
|
||||||
)
|
)
|
||||||
|
@ -11,9 +11,12 @@ def _node_modules_impl(ctx: "context") -> [DefaultInfo.type]:
|
|||||||
ctx.attrs._python_toolchain[PythonToolchainInfo].interpreter,
|
ctx.attrs._python_toolchain[PythonToolchainInfo].interpreter,
|
||||||
node_toolchain.build_node_modules[DefaultInfo].default_outputs,
|
node_toolchain.build_node_modules[DefaultInfo].default_outputs,
|
||||||
out.as_output(),
|
out.as_output(),
|
||||||
"--package", ctx.attrs.package,
|
"--package",
|
||||||
"--package-lock", ctx.attrs.package_lock,
|
ctx.attrs.package,
|
||||||
"--bin-dir", node_toolchain.bin_dir[DefaultInfo].default_outputs,
|
"--package-lock",
|
||||||
|
ctx.attrs.package_lock,
|
||||||
|
"--bin-dir",
|
||||||
|
node_toolchain.bin_dir[DefaultInfo].default_outputs,
|
||||||
],
|
],
|
||||||
category = "npm",
|
category = "npm",
|
||||||
)
|
)
|
||||||
@ -26,14 +29,14 @@ node_modules = rule(
|
|||||||
"package": attrs.source(),
|
"package": attrs.source(),
|
||||||
"package_lock": attrs.source(),
|
"package_lock": attrs.source(),
|
||||||
"_node_toolchain": attrs.toolchain_dep(
|
"_node_toolchain": attrs.toolchain_dep(
|
||||||
default="toolchains//:node",
|
default = "toolchains//:node",
|
||||||
providers=[NodeToolchainInfo]
|
providers = [NodeToolchainInfo],
|
||||||
),
|
),
|
||||||
"_python_toolchain": attrs.toolchain_dep(
|
"_python_toolchain": attrs.toolchain_dep(
|
||||||
default="toolchains//:python",
|
default = "toolchains//:python",
|
||||||
providers=[PythonToolchainInfo]
|
providers = [PythonToolchainInfo],
|
||||||
),
|
),
|
||||||
}
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
def _npm_bin_impl(ctx: "context") -> [[DefaultInfo.type, RunInfo.type]]:
|
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,
|
ctx.attrs.node_modules,
|
||||||
bin_name,
|
bin_name,
|
||||||
out.as_output(),
|
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",
|
category = "build_npm_bin",
|
||||||
)
|
)
|
||||||
@ -63,15 +67,15 @@ def _npm_bin_impl(ctx: "context") -> [[DefaultInfo.type, RunInfo.type]]:
|
|||||||
npm_bin = rule(
|
npm_bin = rule(
|
||||||
impl = _npm_bin_impl,
|
impl = _npm_bin_impl,
|
||||||
attrs = {
|
attrs = {
|
||||||
"bin_name": attrs.option(attrs.string(), default=None),
|
"bin_name": attrs.option(attrs.string(), default = None),
|
||||||
"node_modules": attrs.source(),
|
"node_modules": attrs.source(),
|
||||||
"_node_toolchain": attrs.toolchain_dep(
|
"_node_toolchain": attrs.toolchain_dep(
|
||||||
default="toolchains//:node",
|
default = "toolchains//:node",
|
||||||
providers=[NodeToolchainInfo]
|
providers = [NodeToolchainInfo],
|
||||||
),
|
),
|
||||||
"_python_toolchain": attrs.toolchain_dep(
|
"_python_toolchain": attrs.toolchain_dep(
|
||||||
default="toolchains//:python",
|
default = "toolchains//:python",
|
||||||
providers=[PythonToolchainInfo]
|
providers = [PythonToolchainInfo],
|
||||||
),
|
),
|
||||||
}
|
},
|
||||||
)
|
)
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
NodeToolchainInfo = provider(fields=[
|
NodeToolchainInfo = provider(fields = [
|
||||||
"bin_dir",
|
"bin_dir",
|
||||||
"node",
|
"node",
|
||||||
"build_node_modules",
|
"build_node_modules",
|
||||||
@ -24,17 +24,17 @@ node_toolchain = rule(
|
|||||||
impl = _node_toolchain_impl,
|
impl = _node_toolchain_impl,
|
||||||
attrs = {
|
attrs = {
|
||||||
"bin_dir": attrs.dep(
|
"bin_dir": attrs.dep(
|
||||||
default="prelude-nri//node:bin"
|
default = "prelude-nri//node:bin",
|
||||||
),
|
),
|
||||||
"node": attrs.dep(
|
"node": attrs.dep(
|
||||||
providers = [RunInfo],
|
providers = [RunInfo],
|
||||||
default="prelude-nri//node:node"
|
default = "prelude-nri//node:node",
|
||||||
),
|
),
|
||||||
"_build_node_modules": attrs.dep(
|
"_build_node_modules": attrs.dep(
|
||||||
default="prelude-nri//node:build_node_modules.py",
|
default = "prelude-nri//node:build_node_modules.py",
|
||||||
),
|
),
|
||||||
"_build_npm_bin": attrs.dep(
|
"_build_npm_bin": attrs.dep(
|
||||||
default="prelude-nri//node:build_npm_bin.py",
|
default = "prelude-nri//node:build_npm_bin.py",
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
is_toolchain_rule = True,
|
is_toolchain_rule = True,
|
||||||
|
2
prelude/cxx/omnibus.bzl
generated
2
prelude/cxx/omnibus.bzl
generated
@ -959,6 +959,6 @@ def omnibus_environment_attr():
|
|||||||
})
|
})
|
||||||
|
|
||||||
# In open source, we don't want to use omnibus
|
# In open source, we don't want to use omnibus
|
||||||
default = None # @oss-enable
|
default = None # @oss-enable
|
||||||
|
|
||||||
return attrs.option(attrs.dep(), default = default)
|
return attrs.option(attrs.dep(), default = default)
|
||||||
|
4
prelude/genrule.bzl
generated
4
prelude/genrule.bzl
generated
@ -55,8 +55,8 @@ def _requires_no_srcs_environment(ctx: "context") -> bool.type:
|
|||||||
return _NO_SRCS_ENVIRONMENT_LABEL in ctx.attrs.labels
|
return _NO_SRCS_ENVIRONMENT_LABEL in ctx.attrs.labels
|
||||||
|
|
||||||
# We don't want to use cache mode in open source because the config keys that drive it aren't wired up
|
# We don't want to use cache mode in open source because the config keys that drive it aren't wired up
|
||||||
# @oss-disable: _USE_CACHE_MODE = True
|
# @oss-disable: _USE_CACHE_MODE = True
|
||||||
_USE_CACHE_MODE = False # @oss-enable
|
_USE_CACHE_MODE = False # @oss-enable
|
||||||
|
|
||||||
# Extra attributes required by every genrule based on genrule_impl
|
# Extra attributes required by every genrule based on genrule_impl
|
||||||
def genrule_attributes() -> {str.type: "attribute"}:
|
def genrule_attributes() -> {str.type: "attribute"}:
|
||||||
|
2
prelude/rules.bzl
generated
2
prelude/rules.bzl
generated
@ -37,7 +37,7 @@ def _mk_rule(rule_spec: "") -> "rule":
|
|||||||
|
|
||||||
# Fat platforms is an idea specific to our toolchains, so doesn't apply to
|
# Fat platforms is an idea specific to our toolchains, so doesn't apply to
|
||||||
# open source. Ideally this restriction would be done at the toolchain level.
|
# open source. Ideally this restriction would be done at the toolchain level.
|
||||||
fat_platform_compatible = True # @oss-enable
|
fat_platform_compatible = True # @oss-enable
|
||||||
|
|
||||||
if not fat_platform_compatible:
|
if not fat_platform_compatible:
|
||||||
# copy so we don't try change the passed in object
|
# copy so we don't try change the passed in object
|
||||||
|
2
prelude/transitions/constraint_overrides.bzl
generated
2
prelude/transitions/constraint_overrides.bzl
generated
@ -18,7 +18,7 @@ _CONSTRAINTS = [
|
|||||||
"ovr_config//third-party/python/constraints:cinder.3.8",
|
"ovr_config//third-party/python/constraints:cinder.3.8",
|
||||||
]
|
]
|
||||||
|
|
||||||
_CONSTRAINTS = [] # @oss-enable
|
_CONSTRAINTS = [] # @oss-enable
|
||||||
|
|
||||||
# Apparently, `==` doesn't do value comparison for `ConstraintValueInfo`, so
|
# Apparently, `==` doesn't do value comparison for `ConstraintValueInfo`, so
|
||||||
# impl a hacky eq impl to workaround.
|
# impl a hacky eq impl to workaround.
|
||||||
|
Loading…
Reference in New Issue
Block a user