|
17 | 17 | ERLANG_MK_FILENAME := $(realpath $(lastword $(MAKEFILE_LIST))) |
18 | 18 | export ERLANG_MK_FILENAME |
19 | 19 |
|
20 | | -ERLANG_MK_VERSION = 2022.05.31-167-g10b849e |
| 20 | +ERLANG_MK_VERSION = 2022.05.31-171-g33d7b80 |
21 | 21 | ERLANG_MK_WITHOUT = |
22 | 22 |
|
23 | 23 | # Make 3.81 and 3.82 are deprecated. |
@@ -361,7 +361,7 @@ pkg_proper_name = proper |
361 | 361 | pkg_proper_description = PropEr: a QuickCheck-inspired property-based testing tool for Erlang. |
362 | 362 | pkg_proper_homepage = http://proper.softlab.ntua.gr |
363 | 363 | pkg_proper_fetch = git |
364 | | -pkg_proper_repo = https://github.com/proper-testing/proper |
| 364 | +pkg_proper_repo = https://github.com/manopapad/proper |
365 | 365 | pkg_proper_commit = master |
366 | 366 |
|
367 | 367 | PACKAGES += ranch |
@@ -1239,37 +1239,6 @@ define hex_get_tarball.erl |
1239 | 1239 | end |
1240 | 1240 | endef |
1241 | 1241 |
|
1242 | | -# Unfortunately this currently requires Elixir. |
1243 | | -define hex_version_resolver.erl |
1244 | | - HexVersionResolve = fun(Name, Req) -> |
1245 | | - application:ensure_all_started(ssl), |
1246 | | - application:ensure_all_started(inets), |
1247 | | - Config = $(hex_config.erl), |
1248 | | - case hex_repo:get_package(Config, atom_to_binary(Name)) of |
1249 | | - {ok, {200, _RespHeaders, Package}} -> |
1250 | | - #{releases := List} = Package, |
1251 | | - {value, #{version := Version}} = lists:search(fun(#{version := Vsn}) -> |
1252 | | - M = list_to_atom("Elixir.Version"), |
1253 | | - F = list_to_atom("match?"), |
1254 | | - M:F(Vsn, Req) |
1255 | | - end, List), |
1256 | | - {ok, Version}; |
1257 | | - {ok, {Status, _, Errors}} -> |
1258 | | - {error, Status, Errors} |
1259 | | - end |
1260 | | - end, |
1261 | | - HexVersionResolveAndPrint = fun(Name, Req) -> |
1262 | | - case HexVersionResolve(Name, Req) of |
1263 | | - {ok, Version} -> |
1264 | | - io:format("~s", [Version]), |
1265 | | - halt(0); |
1266 | | - {error, Status, Errors} -> |
1267 | | - io:format("Error ~b: ~0p~n", [Status, Errors]), |
1268 | | - halt(77) |
1269 | | - end |
1270 | | - end |
1271 | | -endef |
1272 | | - |
1273 | 1242 | ifeq ($(CACHE_DEPS),1) |
1274 | 1243 |
|
1275 | 1244 | # Hex only has a package version. No need to look in the Erlang.mk packages. |
@@ -1325,7 +1294,7 @@ endif |
1325 | 1294 |
|
1326 | 1295 | ifeq ($1,elixir) |
1327 | 1296 | autopatch-elixir:: |
1328 | | - ln -s lib/elixir/ebin $(DEPS_DIR)/elixir/ |
| 1297 | + $$(verbose) ln -s lib/elixir/ebin $(DEPS_DIR)/elixir/ |
1329 | 1298 | else |
1330 | 1299 | autopatch-$(call query_name,$1):: |
1331 | 1300 | $$(autopatch_verbose) $$(call dep_autopatch_for_$(AUTOPATCH_METHOD),$(call query_name,$1)) |
@@ -1530,7 +1499,6 @@ ALL_SRC_FILES := $(sort $(call core_find,src/,*)) |
1530 | 1499 | ERL_FILES := $(filter %.erl,$(ALL_SRC_FILES)) |
1531 | 1500 | CORE_FILES := $(filter %.core,$(ALL_SRC_FILES)) |
1532 | 1501 |
|
1533 | | -# @todo Must be defined first. |
1534 | 1502 | ALL_LIB_FILES := $(sort $(call core_find,lib/,*)) |
1535 | 1503 | EX_FILES := $(filter-out lib/mix/%,$(filter %.ex,$(ALL_SRC_FILES) $(ALL_LIB_FILES))) |
1536 | 1504 |
|
@@ -1753,7 +1721,7 @@ endef |
1753 | 1721 | ebin/$(PROJECT).app:: $(ERL_FILES) $(CORE_FILES) $(wildcard src/$(PROJECT).app.src) $(EX_FILES) |
1754 | 1722 | $(eval FILES_TO_COMPILE := $(filter-out $(EX_FILES) src/$(PROJECT).app.src,$?)) |
1755 | 1723 | $(if $(strip $(FILES_TO_COMPILE)),$(call compile_erl,$(FILES_TO_COMPILE))) |
1756 | | - $(if $(filter $?,$(EX_FILES)),$(elixirc_verbose) $(eval MODULES := $(shell $(call erlang,$(call compile_ex.erl,$(EX_FILES)))))) |
| 1724 | + $(if $(filter $(ELIXIR),disable),,$(if $(filter $?,$(EX_FILES)),$(elixirc_verbose) $(eval MODULES := $(shell $(call erlang,$(call compile_ex.erl,$(EX_FILES))))))) |
1757 | 1725 | $(eval ELIXIR_COMP_FAILED := $(if $(filter _ERROR_,$(firstword $(MODULES))),true,false)) |
1758 | 1726 | # Older git versions do not have the --first-parent flag. Do without in that case. |
1759 | 1727 | $(verbose) if $(ELIXIR_COMP_FAILED); then exit 1; fi |
@@ -1797,24 +1765,64 @@ endif |
1797 | 1765 | # Copyright (c) 2024, Loïc Hoguin <[email protected]> |
1798 | 1766 | # This file is part of erlang.mk and subject to the terms of the ISC License. |
1799 | 1767 |
|
1800 | | -ELIXIR ?= $(if $(filter elixir,$(BUILD_DEPS) $(DEPS)),dep,system) |
| 1768 | +# Elixir is automatically enabled in all cases except when |
| 1769 | +# an Erlang project uses an Elixir dependency. In that case |
| 1770 | +# $(ELIXIR) must be set explicitly. |
| 1771 | +ELIXIR ?= $(if $(filter elixir,$(BUILD_DEPS) $(DEPS)),dep,$(if $(EX_FILES),system,disable)) |
1801 | 1772 | export ELIXIR |
1802 | 1773 |
|
1803 | 1774 | ifeq ($(ELIXIR),system) |
1804 | 1775 | # We expect 'elixir' to be on the path. |
1805 | | -# @todo Only if there are EX_FILES |
1806 | 1776 | ELIXIR_LIBS ?= $(dir $(shell readlink -f `which elixir`))/../lib |
1807 | 1777 | ELIXIR_LIBS := $(ELIXIR_LIBS) |
1808 | 1778 | export ELIXIR_LIBS |
1809 | 1779 | ERL_LIBS := $(ERL_LIBS):$(ELIXIR_LIBS) |
1810 | 1780 | else |
| 1781 | +ifeq ($(ELIXIR),dep) |
1811 | 1782 | ERL_LIBS := $(ERL_LIBS):$(DEPS_DIR)/elixir/lib/ |
1812 | 1783 | endif |
| 1784 | +endif |
1813 | 1785 |
|
1814 | 1786 | elixirc_verbose_0 = @echo " EXC $(words $(EX_FILES)) files"; |
1815 | 1787 | elixirc_verbose_2 = set -x; |
1816 | 1788 | elixirc_verbose = $(elixirc_verbose_$(V)) |
1817 | 1789 |
|
| 1790 | +# Unfortunately this currently requires Elixir. |
| 1791 | +# https://github.com/jelly-beam/verl is a good choice |
| 1792 | +# for an Erlang implementation, but we already have to |
| 1793 | +# pull hex_core and Rebar3 so adding yet another pull |
| 1794 | +# is annoying, especially one that would be necessary |
| 1795 | +# every time we autopatch Rebar projects. Wait and see. |
| 1796 | +define hex_version_resolver.erl |
| 1797 | + HexVersionResolve = fun(Name, Req) -> |
| 1798 | + application:ensure_all_started(ssl), |
| 1799 | + application:ensure_all_started(inets), |
| 1800 | + Config = $(hex_config.erl), |
| 1801 | + case hex_repo:get_package(Config, atom_to_binary(Name)) of |
| 1802 | + {ok, {200, _RespHeaders, Package}} -> |
| 1803 | + #{releases := List} = Package, |
| 1804 | + {value, #{version := Version}} = lists:search(fun(#{version := Vsn}) -> |
| 1805 | + M = list_to_atom("Elixir.Version"), |
| 1806 | + F = list_to_atom("match?"), |
| 1807 | + M:F(Vsn, Req) |
| 1808 | + end, List), |
| 1809 | + {ok, Version}; |
| 1810 | + {ok, {Status, _, Errors}} -> |
| 1811 | + {error, Status, Errors} |
| 1812 | + end |
| 1813 | + end, |
| 1814 | + HexVersionResolveAndPrint = fun(Name, Req) -> |
| 1815 | + case HexVersionResolve(Name, Req) of |
| 1816 | + {ok, Version} -> |
| 1817 | + io:format("~s", [Version]), |
| 1818 | + halt(0); |
| 1819 | + {error, Status, Errors} -> |
| 1820 | + io:format("Error ~b: ~0p~n", [Status, Errors]), |
| 1821 | + halt(77) |
| 1822 | + end |
| 1823 | + end |
| 1824 | +endef |
| 1825 | + |
1818 | 1826 | define dep_autopatch_mix.erl |
1819 | 1827 | $(call hex_version_resolver.erl), |
1820 | 1828 | {ok, _} = application:ensure_all_started(elixir), |
@@ -1926,6 +1934,7 @@ define dep_autopatch_mix.erl |
1926 | 1934 | endef |
1927 | 1935 |
|
1928 | 1936 | define dep_autopatch_mix |
| 1937 | + if [ "$(ELIXIR)" = "disable" ]; then echo "Elixir is currently disabled. Please set 'ELIXIR = system' in the Makefile to enable"; exit 99; fi |
1929 | 1938 | sed 's|\(defmodule.*do\)|\1\n try do\n Code.compiler_options(on_undefined_variable: :warn)\n rescue _ -> :ok\n end\n|g' -i $(DEPS_DIR)/$(1)/mix.exs; \ |
1930 | 1939 | $(MAKE) $(DEPS_DIR)/hex_core/ebin/dep_built; \ |
1931 | 1940 | MIX_ENV="$(if $(MIX_ENV),$(strip $(MIX_ENV)),prod)" \ |
@@ -3483,6 +3492,11 @@ distclean-escript: |
3483 | 3492 |
|
3484 | 3493 | .PHONY: eunit apps-eunit |
3485 | 3494 |
|
| 3495 | +# Eunit can be disabled by setting this to any other value. |
| 3496 | +EUNIT ?= system |
| 3497 | + |
| 3498 | +ifeq ($(EUNIT),system) |
| 3499 | + |
3486 | 3500 | # Configuration |
3487 | 3501 |
|
3488 | 3502 | EUNIT_OPTS ?= |
@@ -3541,6 +3555,8 @@ apps-eunit: test-build |
3541 | 3555 | endif |
3542 | 3556 | endif |
3543 | 3557 |
|
| 3558 | +endif |
| 3559 | + |
3544 | 3560 | # Copyright (c) 2020, Loïc Hoguin <[email protected]> |
3545 | 3561 | # This file is part of erlang.mk and subject to the terms of the ISC License. |
3546 | 3562 |
|
|
0 commit comments