-
Notifications
You must be signed in to change notification settings - Fork 3.5k
Add --no-runtime-exs #12764
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
Add --no-runtime-exs #12764
Conversation
This adds a new CLI option to `mix run` that will skip loading the runtime.exs file. This is useful when you want to load a VM with all of the project's code and dependencies, but don't want to actually start it in any way. runtime.exs can use your project's dependencies, which might not be compiled yet if also using the `--no-compile` option. Normally you can simply gate your entire runtime.exs file in a condition that checks for an environment variable, but in the case of developer tooling like a language server, you can't alter the code.
@mhanberg what task are you invoking as the entry point? If you don't want it to not start nor compile, then maybe you should be calling only the loadpaths task and not any task that may start or compile code? For example, here is what we do for
|
The entry point (started as a port) is args: [
System.find_executable("elixir"),
"--sname",
sname,
"-S",
"mix",
"run",
"--no-halt",
"--no-compile",
"--no-start"
] I'll try out loadpaths after work today, thanks! |
@josevalim i'll hopefully get some time to look into your suggestion tonight, I had a crazy weekend (wife broke her leg 🥵, she's doing well now). thanks again! |
No rush and a speedy recovery to her! By the way, we talked a bit about language servers yesterday during the stream: https://www.twitch.tv/videos/1868498801 |
Thanks!
Nice! |
This mix task does what we actually want, which is to load all of the code paths and not start the app. Fixes #97 Closes elixir-lang/elixir#12764
This mix task does what we actually want, which is to load all of the code paths and not start the app. Fixes #97 Closes elixir-lang/elixir#12764
This mix task does what we actually want, which is to load all of the code paths and not start the app. Fixes #97 Closes elixir-lang/elixir#12764
Your approach of using |
This mix task does what we actually want, which is to load all of the code paths and not start the app. Fixes #97 Closes elixir-lang/elixir#12764
This adds a new CLI option to
mix run
that will skip loading the runtime.exs file.This is useful when you want to load a VM with all of the project's code and dependencies, but don't want to actually start it in any way.
runtime.exs can use your project's dependencies, which might not be compiled yet if also using the
--no-compile
option.Normally you can simply gate your entire runtime.exs file in a condition that checks for an environment variable, but in the case of developer tooling like a language server, you can't alter the code.
I'm not entirely sure if this is the best way to solve my problem, so I am interested in your thoughts here. I thought about
re-using the
--no-start
option to control whether the runtime.exs is executed, but I figured that is a backwards incompatible change, so I opted for a new option.(If you think this is reasonable to include, I will add tests/docs)
For more context, I have run into a situation in Next LS where a user's runtime.exs fails due to the code not yet being compiled (because I are using the
--no-compile
flag).I am intentionally not wanting any code to 'run', which is why I also pass the
--no-start
flag, which I think made me surprised that runtime.exs still ran.LMKWYT