Suggestion: Mix should automatically recompile projects when config changes

62 views
Skip to first unread message

jbo...@wistia.com

unread,
Oct 12, 2016, 10:37:04 AM10/12/16
to elixir-lang-core
I feel like a common idiom in Elixir is to define environment-specific variables using module attributes so that each environment's changes can be compiled directly (instead of being called dynamically). The most obvious place to define these module attributes is in the respective config directory. Right now if you compile the source with a given module attribute you need to blow away the _build directory and call mix again to recompile. I think it would be nice if mix could look at the timestamp of the respective config file and recompile if needed. Alternatively, it would be helpful if mix would warn if the config file has changed and a recompile is needed to use the latest source (as there aren't any indicators that mix didn't pick up the changes in the config file)

Eric Meadows-Jönsson

unread,
Oct 12, 2016, 11:07:14 AM10/12/16
to elixir-l...@googlegroups.com
Mix does automatically recompile the project if a config file in config/ changes, it does not recompile dependencies if that's what you are referring to.

On Wed, Oct 12, 2016 at 4:37 PM, <jbo...@wistia.com> wrote:
I feel like a common idiom in Elixir is to define environment-specific variables using module attributes so that each environment's changes can be compiled directly (instead of being called dynamically). The most obvious place to define these module attributes is in the respective config directory. Right now if you compile the source with a given module attribute you need to blow away the _build directory and call mix again to recompile. I think it would be nice if mix could look at the timestamp of the respective config file and recompile if needed. Alternatively, it would be helpful if mix would warn if the config file has changed and a recompile is needed to use the latest source (as there aren't any indicators that mix didn't pick up the changes in the config file)

--
You received this message because you are subscribed to the Google Groups "elixir-lang-core" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elixir-lang-core+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elixir-lang-core/e382bc20-e178-4e7d-a039-b63f41a60e6f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Eric Meadows-Jönsson

jbo...@wistia.com

unread,
Oct 12, 2016, 11:31:19 AM10/12/16
to elixir-lang-core
Ah it looks like this is the case for standalone apps, but it's not the case for sub-apps generated inside an umbrella project. That is, if I change the config in one of my sub-apps then recompilation will not happen and running `mix test` will not reflect changes to the sub-app's configs. I'm guessing that the entire umbrella project shares the same build files and the umbrella project only recompiles based on changes in the top-level configs (even though the umbrella app seems to be reading the sub-app's configs when it does compile)


On Wednesday, October 12, 2016 at 11:07:14 AM UTC-4, Eric Meadows-Jönsson wrote:
Mix does automatically recompile the project if a config file in config/ changes, it does not recompile dependencies if that's what you are referring to.
On Wed, Oct 12, 2016 at 4:37 PM, <jbo...@wistia.com> wrote:
I feel like a common idiom in Elixir is to define environment-specific variables using module attributes so that each environment's changes can be compiled directly (instead of being called dynamically). The most obvious place to define these module attributes is in the respective config directory. Right now if you compile the source with a given module attribute you need to blow away the _build directory and call mix again to recompile. I think it would be nice if mix could look at the timestamp of the respective config file and recompile if needed. Alternatively, it would be helpful if mix would warn if the config file has changed and a recompile is needed to use the latest source (as there aren't any indicators that mix didn't pick up the changes in the config file)

--
You received this message because you are subscribed to the Google Groups "elixir-lang-core" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elixir-lang-co...@googlegroups.com.



--
Eric Meadows-Jönsson
Reply all
Reply to author
Forward
0 new messages