elm_binary fails with confusing error message if it has no dependencies
sepiatonal opened this issue · comments
Example BUILD:
load("@com_github_edschouten_rules_elm//elm:def.bzl", "elm_binary")
elm_binary(
name = "Project",
main = "src/Main.elm",
visibility = ["//visibility:public"],
deps = [],
)
Attempting to build this project results in the following error message:
Traceback (most recent call last):
File "external/com_github_edschouten_rules_elm/elm/compile.py", line 44, in <module>
with open(os.path.join(PACKAGES_DIR, "versions.dat"), "wb") as f:
FileNotFoundError: [Errno 2] No such file or directory: 'elm-home/0.19.0/package/versions.dat'
This seems to be because the code that creates the versions.dat
file (in this block) never actually gets to run if there aren't any dependency packages.
I'm aware that a workaround is to create a library that's used as a dependency for the binary. However, I'm unsure if it's intentional that a binary cannot be created without any dependencies. If it is intentional, better error handling to produce a clearer error message in this situation would probably be a good idea. If it's not intentional, it seems that perhaps this could be solved by having compile.py
create a blank versions.dat
if there are no dependency packages.
@sepiatonal
I added the test case for this issue, however I am probably not able to reproduce it. elm
compiler claims you always have to depend on core
. Can you either fix the test case or give more details howto reproduce this?