-
Notifications
You must be signed in to change notification settings - Fork 662
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Is there a way to let 'elm make' behave like a compiler without package manager smartness? #1908
Comments
For the time being, I'm experimenting with allowing build actions to access the internet. Also: instead of managing dependencies on elm/json and elm/core through Bazel and adding them to source-directories, I am falling back to specifying those through elm.json. Now I run into another issue. If I manually download packages such as elm/url and elm/browser and try building them as part of a project by adding them to source-directories, it can't find any modules underneath Elm.Kernel. This seems to be due to some special treatment that libraries under elm/* get. Only those packages are permitted to implement modules in Javascript. I fully understand that the Elm project wants to protect its ecosystem, but the combination of the facts that it's not possible to override dependencies to explicit checkouts, the hardcoded requirement of using elm/core and elm/json, and that only elm/* can declare Elm.Kernel makes it pretty hard to embed builds of Elm projects into larger projects. It looks like this issue is already known within the Elm community. I stumbled upon this issue report that seems strongly related to what I'm running into: gdotdesign/elm-github-install#62 (comment). Considering that this issue is already known for some time, I don't think I have a lot of choice here but to (hopefully temporarily) stop my efforts integrating Elm into Bazel. |
@EdSchouten Not sure to what degree this alleviates your problems, but using the I'm not sure what the phone-home behaviour is about, exactly. As far as I know, this happens when the project does not have up to date info in |
For what it's worth ... here's some snippets of Bazel I use. It relies on npm_install and npm_binary ... it seems to avoid hitting the network unless something changes in elm.json or package.json but I haven't checked to see if sandboxing is being strictly enforced.
|
Just to give a status update on this. I managed to get these build rules to work in the end and have published them here. They should be pretty awesome to use. There were some ugly things I had to do, though:
This is actually the first time I'm using Elm. So far I think the language is pretty awesome. It's very likely that I'm going to be using it going forward. That said, I'm baffled by the totalitarian mindset that went into designing the build tool. Especially for a language that is almost never used on its own (read: people likely want to use an Elm web application in combination with a backend service written in another language), I fail to understand why its build process is so hard to integrate. |
To answer the initial question, there is not a way to do this. Folks on the Elm Slack can probably give more information on why the build system works as it does. Different people have different opinions about the design tradeoffs faced by Elm in particular when it comes to packages. Many people have yelled very aggressively about how it really should be, but I do not think it cannot be made to work for everyone. Folks on slack can probably point you to some of the posts if you'd like to learn more. Folks are trying to do a good job, but there are different definitions of good job. We may not ultimately agree about things, but I ask from a place of deep weariness that it can be discussed without calling any names. Anyway, I think slack is the best place for background info on this. |
@EdSchouten I think you should primary check this project https://github.com/hercules-ci/elm2nix |
Quick Summary:
I am trying to write build rules for Elm for the Bazel build system. Bazel is a pretty awesome build system: it scales to large projects, provides reproducibility, permits distributed builds, allows you to build many programming languages in a single project through a single build rule language, provides hermeticity, etc. To guarantee hermeticity, build actions may be executed with file system/network sandboxing in place.
My plan is therefore to invoke build actions for Elm sources by providing copies of everything that is necessary:
Before running
elm make
, my plan is to generate anelm.json
that looks like this:So far I'm not having a lot of luck following this approach:
"dependencies"
. Because the"dependencies"
system only seems to provide support for listing version numbers (and not, say, allowing you to specify a custom directory of a checkout), there's effectively no way to build code in an isolated environment.SSCCE
Additional Details
Background: I happen to be the author of Buildbarn, one of the more popular remote build cluster implementations for Bazel. I am currently investigating rewriting Buildbarn's web frontend in Elm, so that you can use it to view build progress/completion in real-time. As Buildbarn is built using (surprise!) Bazel, a prerequisite is to have decent rules for Elm.
The text was updated successfully, but these errors were encountered: