Skip to content
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

Native Elixir Fixes #1021

Open
wants to merge 7 commits into
base: native-elixir
Choose a base branch
from

Conversation

artman41
Copy link
Contributor

@artman41 artman41 commented Jan 9, 2025

  • Cause failed compilation of .ex files to prevent creation of .app file
    • Replace wildcard for ex beams for a shell command
    • To prevent failed .ex compilation from continuing to create a $(PROJECT).app file, I've moved the elixir generation code to be ran by the actual shell. Doing this though meant the Module names of the compiled .ex files needed to be found separately. To solve this, I've tried to use a shell command to manually build the Module name based on the __aliases__ attribute in the elixir ast of the code
  • Allow support for Elixir v1.13 (supported by OTP 23)
    • I'm happy to remove this commit from the branch if you don't want to support OTP 23 essen
  • Replace my email
  • Account for .ex files which reference mix.exs config
    • I noticed when using the dependency mint that it referenced the Mix.Project.config() at compile time, hence the need to load the mix.exs project during .ex compilation
  • Simplify Ex compilation failure
    • As suggested, modified the compile_ex.erl to return the compiled modules for easier var binding. The erl code will now redirect the errors printed by 'Elixir.Kernel.ParallelCompiler':compile_to_path/2 to stderr & print to stdout only for the module names or the word _ERROR_ on a failed compilation

@artman41 artman41 mentioned this pull request Jan 9, 2025
@artman41 artman41 force-pushed the native-elixir_fixes branch 2 times, most recently from 5ad06c7 to f93789f Compare January 10, 2025 01:04
@artman41 artman41 force-pushed the native-elixir_fixes branch from f93789f to 9919545 Compare January 10, 2025 01:30
core/erlc.mk Outdated
# Older git versions do not have the --first-parent flag. Do without in that case.
$(eval GITDESCRIBE := $(shell git describe --dirty --abbrev=7 --tags --always --first-parent 2>/dev/null \
|| git describe --dirty --abbrev=7 --tags --always 2>/dev/null || true))
$(eval MODULES := $(MODULES) $(patsubst %,'%',$(sort $(notdir $(basename \
$(eval MODULES := $(MODULES) $(notdir $(basename $(wildcard ebin/Elixir.*))) $(patsubst %,'%',$(sort $(notdir $(basename \
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can't do that, the wildcard function operates on cache that is updated at the start of executing the target, so it won't know about the new Elixir beam files.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good point, leave it with me and I'll double check against what I have locally - could be the case that I need to rollback that change

@essen
Copy link
Member

essen commented Jan 10, 2025

I need more info about the two most recent commits because I don't know what they do.

@artman41
Copy link
Contributor Author

@essen tried a different way of getting the elixir beams, let me know what you think

I'll add an explanation under the commits in the PR description to say why it's needed 👍

@essen
Copy link
Member

essen commented Jan 11, 2025

I don't think you need to go that far. It is much better to get the modules list from the compilation, we only need a way to signal success or failure. That could be signaled as a word in the output, which we would then check, before making MODULES be everything except that (first or last) word. The check would error out if failure is indicated.

See word related functions in https://www.gnu.org/software/make/manual/html_node/Text-Functions.html especially firstword, wordlist.

@artman41
Copy link
Contributor Author

artman41 commented Jan 11, 2025

I don't think you need to go that far. It is much better to get the modules list from the compilation, we only need a way to signal success or failure. That could be signaled as a word in the output, which we would then check, before making MODULES be everything except that (first or last) word. The check would error out if failure is indicated.

See word related functions in https://www.gnu.org/software/make/manual/html_node/Text-Functions.html especially firstword, wordlist.

I feel dumb - I forgot entirely about firstword, glad you're able to offer a different perspective 😄

I'll revert that and get a change pushed up now 👍

Only thing I can think of that might be a problem though, shell will capture the compilation failure output - is there a way you can think of that would accurately redirect that to the shell?

Ignore the previous question - had a brain fart

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.

2 participants