Skip to content

BugFix: Keep Elixir modules listed in ebin/PROJECT.app on erl-only rebuilds - #1053

Open
artman41 wants to merge 1 commit into
ninenines:masterfrom
artman41:bugfix/gh1052
Open

BugFix: Keep Elixir modules listed in ebin/PROJECT.app on erl-only rebuilds#1053
artman41 wants to merge 1 commit into
ninenines:masterfrom
artman41:bugfix/gh1052

Conversation

@artman41

@artman41 artman41 commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Fixes #1052

To be upfront: Claude noticed this while I was having it scaffold a project.

Claude identified and produced the fix but I've had it break the change into more simpler and clean code because having it as a one-liner was almost unreadable.

I've reviewed the code myself and both the code & test appear good.

Happy to rework the code if needed

…builds (ninenines#1052)

MODULES was only recomputed from the Elixir compiler's output when at
least one EX_FILE was itself out of date ($?). A build triggered
solely by a changed .erl file or app.src skipped Elixir compilation
entirely, silently dropping any Elixir-defined modules from the
generated .app file's modules entry. This breaks releases running
under `-mode embedded`, which requires every module to be pre-listed
there and, unlike interactive `erl`, won't fall back to path-based
lookup for anything missing.

Since an .ex file's name doesn't necessarily match the module(s) it
defines, the only reliable way to learn a module's real name is to
compile it. Rather than doing that unconditionally on every rebuild,
cache the resolved list to ERLANG_MK_TMP/ex_modules.log the moment
there is a reason to compile (an EX_FILE is out of date, or the cache
is missing, e.g. first build or after distclean). Any other rebuild
reuses the cached list instead of recompiling every Elixir file again.

Added | $(ERLANG_MK_TMP) as an order-only prerequisite so the
directory exists before the cache file is written.

Covered by a new core-elixir-keep-modules-on-erl-only-rebuild test,
which also asserts (via a marker file and find -newer) that the
Elixir module is not recompiled on the erl-only rebuild.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Elixir modules not appended to App Resource file when only .erl modifications are made

1 participant