move Elm downloads into the Elm toolchain BUCK file

This commit is contained in:
Brian Hicks 2023-05-02 10:39:55 -05:00
parent 6f3413a9cf
commit 5f2937c188
No known key found for this signature in database
GPG Key ID: C4F324B9CAAB0D50
3 changed files with 28 additions and 25 deletions

View File

@ -2,3 +2,27 @@ export_file(
name = "isolated_compile.py",
visibility = ["PUBLIC"],
)
ELM_COMPILER_URL = select({
"config//os:linux": "https://github.com/elm/compiler/releases/download/0.19.1/binary-for-linux-64-bit.gz",
"config//os:macos": "https://github.com/elm/compiler/releases/download/0.19.1/binary-for-mac-64-bit.gz",
})
ELM_COMPILER_SHA256 = select({
"config//os:linux": "e44af52bb27f725a973478e589d990a6428e115fe1bb14f03833134d6c0f155c",
"config//os:macos": "05289f0e3d4f30033487c05e689964c3bb17c0c48012510dbef1df43868545d1",
})
http_file(
name = "elm_compiler_archive",
urls = [ELM_COMPILER_URL],
sha256 = ELM_COMPILER_SHA256,
)
genrule(
name = "elm_compiler_binary",
cmd = "gzip --decompress --stdout --keep $(location :elm_compiler_archive) > $OUT && chmod +x $OUT",
out = "elm",
executable = True,
visibility = ["PUBLIC"],
)

View File

@ -41,7 +41,10 @@ def _elm_toolchain_impl(ctx: "context") -> [[DefaultInfo.type, ElmToolchainInfo.
elm_toolchain = rule(
impl = _elm_toolchain_impl,
attrs = {
"elm": attrs.dep(providers = [RunInfo]),
"elm": attrs.dep(
providers = [RunInfo],
default = "prelude-nri//elm:elm_compiler_binary",
),
"_isolated_compile": attrs.dep(default="prelude-nri//elm:isolated_compile.py"),
},
is_toolchain_rule = True,

View File

@ -20,28 +20,4 @@ system_python_bootstrap_toolchain(
elm_toolchain(
name = "elm",
visibility = ["PUBLIC"],
elm = ":elm_compiler_binary",
)
ELM_COMPILER_URL = select({
"config//os:linux": "https://github.com/elm/compiler/releases/download/0.19.1/binary-for-linux-64-bit.gz",
"config//os:macos": "https://github.com/elm/compiler/releases/download/0.19.1/binary-for-mac-64-bit.gz",
})
ELM_COMPILER_SHA256 = select({
"config//os:linux": "e44af52bb27f725a973478e589d990a6428e115fe1bb14f03833134d6c0f155c",
"config//os:macos": "05289f0e3d4f30033487c05e689964c3bb17c0c48012510dbef1df43868545d1",
})
http_file(
name = "elm_compiler_archive",
urls = [ELM_COMPILER_URL],
sha256 = ELM_COMPILER_SHA256,
)
genrule(
name = "elm_compiler_binary",
cmd = "gzip --decompress --stdout --keep $(location :elm_compiler_archive) > $OUT && chmod +x $OUT",
out = "elm",
executable = True,
)