Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 17 additions & 17 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ GIT_TAG = $(strip $(shell head="$(call GIT_REVISION)"; git tag --points-at $$hea
SOURCE_DATE_EPOCH_PATH = lib/elixir/tmp/ebin_reproducible
SOURCE_DATE_EPOCH_FILE = $(SOURCE_DATE_EPOCH_PATH)/SOURCE_DATE_EPOCH

.PHONY: install compile erlang elixir unicode app build_plt clean_plt dialyze test check_reproducible clean clean_residual_files format install_man clean_man docs Docs.zip Precompiled.zip zips
.PHONY: install install_man build_plt clean_plt dialyze test check_reproducible clean clean_elixir clean_man format docs Docs.zip Precompiled.zip zips
.NOTPARALLEL:

#==> Functions
Expand Down Expand Up @@ -65,39 +65,42 @@ endef
#==> Compilation tasks

APP := lib/elixir/ebin/elixir.app
EEX := lib/eex/ebin/Elixir.EEx.beam
ELIXIR := lib/elixir/ebin/elixir.beam
PARSER := lib/elixir/src/elixir_parser.erl
KERNEL := lib/elixir/ebin/Elixir.Kernel.beam
UNICODE := lib/elixir/ebin/Elixir.String.Unicode.beam

default: compile

compile: erlang $(APP) elixir
compile: erlang elixir

erlang: $(PARSER)
erlang: $(ELIXIR)
$(ELIXIR): $(PARSER) lib/elixir/src/*
$(Q) if [ ! -f $(APP) ]; then $(call CHECK_ERLANG_RELEASE); fi
$(Q) cd lib/elixir && mkdir -p ebin && $(ERL_MAKE)
$(Q) $(GENERATE_APP) $(VERSION)

$(PARSER): lib/elixir/src/elixir_parser.yrl
$(Q) erlc -o $@ +'{verbose,true}' +'{report,true}' $<

# Since Mix depends on EEx and EEx depends on Mix,
# we first compile EEx without the .app file,
# then Mix, and then compile EEx fully
elixir: stdlib lib/eex/ebin/Elixir.EEx.beam mix ex_unit logger eex iex
elixir: stdlib $(EEX) mix ex_unit logger eex iex
stdlib: $(KERNEL) $(UNICODE) $(APP)

stdlib: lib/elixir/lib/*.ex lib/elixir/lib/*/*.ex lib/elixir/lib/*/*/*.ex VERSION
$(KERNEL): lib/elixir/src/* lib/elixir/lib/*.ex lib/elixir/lib/*/*.ex lib/elixir/lib/*/*/*.ex VERSION
$(Q) if [ ! -f $(KERNEL) ]; then \
echo "==> bootstrap (compile)"; \
$(ERL) -s elixir_compiler bootstrap -s erlang halt; \
"$(MAKE)" unicode; \
fi
$(Q) "$(MAKE)" unicode
@ echo "==> elixir (compile)";
$(Q) cd lib/elixir && ../../$(ELIXIRC) "lib/**/*.ex" -o ebin;
$(Q) "$(MAKE)" app

app: $(APP)
$(APP): lib/elixir/src/elixir.app.src lib/elixir/ebin VERSION $(GENERATE_APP)
$(Q) $(GENERATE_APP) $< $@ $(VERSION)
$(Q) $(GENERATE_APP) $(VERSION)

unicode: $(UNICODE)
$(UNICODE): lib/elixir/unicode/*
Expand Down Expand Up @@ -143,6 +146,7 @@ check_reproducible: compile
$(Q) mv lib/iex/ebin/* lib/iex/tmp/ebin_reproducible/
$(Q) mv lib/logger/ebin/* lib/logger/tmp/ebin_reproducible/
$(Q) mv lib/mix/ebin/* lib/mix/tmp/ebin_reproducible/
$(Q) rm -rf lib/*/ebin
SOURCE_DATE_EPOCH=$(call READ_SOURCE_DATE_EPOCH) "$(MAKE)" compile
$(Q) echo "Diffing..."
$(Q) bin/elixir lib/elixir/scripts/diff.exs lib/elixir/ebin/ lib/elixir/tmp/ebin_reproducible/
Expand All @@ -153,16 +157,10 @@ check_reproducible: compile
$(Q) bin/elixir lib/elixir/scripts/diff.exs lib/mix/ebin/ lib/mix/tmp/ebin_reproducible/
$(Q) echo "Builds are reproducible"

clean:
clean: clean_man
rm -rf ebin
rm -rf lib/*/ebin
rm -rf $(PARSER)
$(Q) "$(MAKE)" clean_residual_files

clean_elixir:
$(Q) rm -f lib/*/ebin/Elixir.*.beam

clean_residual_files:
rm -rf lib/*/_build/
rm -rf lib/*/tmp/
rm -rf lib/elixir/test/ebin/
Expand All @@ -172,7 +170,9 @@ clean_residual_files:
rm -rf lib/mix/test/fixtures/git_sparse_repo/
rm -rf lib/mix/test/fixtures/archive/ebin/
rm -f erl_crash.dump
$(Q) "$(MAKE)" clean_man

clean_elixir:
$(Q) rm -f lib/*/ebin/Elixir.*.beam

#==> Documentation tasks

Expand Down
14 changes: 7 additions & 7 deletions lib/elixir/lib/kernel/parallel_compiler.ex
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,11 @@ defmodule Kernel.ParallelCompiler do
dest = :erlang.get(:elixir_compiler_dest)

{:error_handler, error_handler} = :erlang.process_info(self(), :error_handler)
{_parent, checker} = Module.ParallelChecker.get()
{_parent, cache} = Module.ParallelChecker.get()

task =
Task.async(fn ->
Module.ParallelChecker.put(compiler_pid, checker)
Module.ParallelChecker.put(compiler_pid, cache)
:erlang.put(:elixir_compiler_info, {compiler_pid, file_pid})
:erlang.put(:elixir_compiler_file, file)
dest != :undefined and :erlang.put(:elixir_compiler_dest, dest)
Expand Down Expand Up @@ -253,11 +253,11 @@ defmodule Kernel.ParallelCompiler do
max(:erlang.system_info(:schedulers_online), 2)
end)

{:ok, checker} = Module.ParallelChecker.start_link(schedulers)
{:ok, cache} = Module.ParallelChecker.start_link(schedulers)

{status, modules_or_errors, info} =
try do
outcome = spawn_workers(schedulers, checker, files, output, options)
outcome = spawn_workers(schedulers, cache, files, output, options)
{outcome, Keyword.get(options, :warnings_as_errors, false)}
else
{{:ok, _, %{runtime_warnings: r_warnings, compile_warnings: c_warnings} = info}, true}
Expand All @@ -281,7 +281,7 @@ defmodule Kernel.ParallelCompiler do
{{:error, errors, info}, _} ->
{:error, errors, info}
after
Module.ParallelChecker.stop(checker)
Module.ParallelChecker.stop(cache)
end

# TODO: Require this to be set from Elixir v1.19
Expand Down Expand Up @@ -428,13 +428,13 @@ defmodule Kernel.ParallelCompiler do
end

defp spawn_workers([file | queue], spawned, waiting, files, result, warnings, errors, state) do
%{output: output, dest: dest, checker: checker} = state
%{output: output, dest: dest, checker: cache} = state
parent = self()
file = Path.expand(file)

{pid, ref} =
:erlang.spawn_monitor(fn ->
Module.ParallelChecker.put(parent, checker)
Module.ParallelChecker.put(parent, cache)
:erlang.put(:elixir_compiler_info, {parent, self()})
:erlang.put(:elixir_compiler_file, file)

Expand Down
Loading
Loading