plumb the isolated compile script into Buck

This commit is contained in:
Brian Hicks 2023-04-27 16:01:49 -05:00
parent ceaff7bfd3
commit 6fbc1ed76b
No known key found for this signature in database
GPG Key ID: C4F324B9CAAB0D50
2 changed files with 12 additions and 2 deletions

4
prelude-nri/elm/BUCK Normal file
View File

@ -0,0 +1,4 @@
export_file(
name = "isolated_compile.py",
visibility = ["PUBLIC"],
)

View File

@ -1,8 +1,9 @@
ElmToolchainInfo = provider(fields=[
"elm",
"isolated_compile",
])
def _system_elm_toolchain_impl(_ctx) -> [[DefaultInfo.type, ElmToolchainInfo.type]]:
def _system_elm_toolchain_impl(ctx) -> [[DefaultInfo.type, ElmToolchainInfo.type]]:
"""
An Elm toolchain that assumes the current environment has all the binaries
it needs in PATH.
@ -11,13 +12,16 @@ def _system_elm_toolchain_impl(_ctx) -> [[DefaultInfo.type, ElmToolchainInfo.typ
DefaultInfo(),
ElmToolchainInfo(
elm = RunInfo(args = ["elm"]),
isolated_compile = ctx.attrs._isolated_compile,
),
]
system_elm_toolchain = rule(
impl = _system_elm_toolchain_impl,
attrs = {},
attrs = {
"_isolated_compile": attrs.dep(default="prelude-nri//elm:isolated_compile.py"),
},
is_toolchain_rule = True,
)
@ -30,6 +34,7 @@ def _elm_toolchain_impl(ctx: "context") -> [[DefaultInfo.type, ElmToolchainInfo.
DefaultInfo(),
ElmToolchainInfo(
elm = ctx.attrs.elm[RunInfo],
isolated_compile = ctx.attrs._isolated_compile,
),
]
@ -37,6 +42,7 @@ elm_toolchain = rule(
impl = _elm_toolchain_impl,
attrs = {
"elm": attrs.dep(providers = [RunInfo]),
"_isolated_compile": attrs.dep(default="prelude-nri//elm:isolated_compile.py"),
},
is_toolchain_rule = True,
)