@external_resource always recompiling when the file has not changed

Hi,

In a project “DEP” I have a bunch of modules created from json files. The modules declare @external_resource with the absolute path. They are not under priv.

I compared the output of File.stat!/1 at different points and it does not change ever.

But the modules are always recompiled.

I added a __mix_recompile?__ function that compares the md5 of the file because compilation is long. It works well.

Both @external_resource and __mix_recompile?__ are added from a __using__ macro.

But now I want to use this project in a “MAIN” project. The “DEP” project is included as a :path dependency, so if I change the elixir code of “DEP”, it is recompiled when I run tests for “MAIN”. But unfortunately it is not recompiled when I change the JSON files.

I would like to have a simple way to recompile elixir modules in “DEP” when running “MAIN” tests, only if the JSON files are changed.

Any idea?

Thank you

1 Like