Elixirのコアモジュールは以下の処理でコンパイルされる事をch02で説明しました。
cd /path/to/elixir/repo/lib/elixir
erl -I lib/elixir/include \
-noshell -pa lib/elixir/ebin \
-s elixir_compiler core -s erlang halt
コアモジュールのコンパイルのエントリポイントであるelixir_compiler:core
を見ていきましょう。
elixir_compiler:core()
がやっている事は
- elixirアプリを立ち上げる
- elixir_code_serverにコンパイルオプションをcast
- coreモジュールのソースファイルをコンパイル
です。
core() ->
% step.1
{ok, _} = application:ensure_all_started(elixir),
% step.2
elixir_code_server:cast({compiler_options, [{docs,false},{internal,true}]}),
% step.3
[core_file(File) || File <- core_main()].