Merge pull request #1381 from NoRedInk/wat-elm-reorg

reorganize Elm deps to be a bit neater
This commit is contained in:
Brian Hicks 2023-05-02 11:54:01 -05:00 committed by GitHub
commit 1d8b1b42f8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 29 additions and 26 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

@ -22,7 +22,7 @@ def symlink_if_necessary(source, target):
- If the target already exists and points somewhere else, remove it
and relink.
"""
if os.path.exists(target):
if os.path.lexists(target):
if os.path.isfile(target):
logging.debug(f"`{target}` is a regular file")

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

@ -21,30 +21,6 @@ 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,
)
node_toolchain(